diff options
Diffstat (limited to 'plugins/pychrysalide/glibext')
-rw-r--r-- | plugins/pychrysalide/glibext/binportion.c | 35 | ||||
-rw-r--r-- | plugins/pychrysalide/glibext/constants.c | 13 |
2 files changed, 13 insertions, 35 deletions
diff --git a/plugins/pychrysalide/glibext/binportion.c b/plugins/pychrysalide/glibext/binportion.c index 14df461..3065755 100644 --- a/plugins/pychrysalide/glibext/binportion.c +++ b/plugins/pychrysalide/glibext/binportion.c @@ -73,9 +73,6 @@ static PyObject *py_binary_portion_get_rights(PyObject *, void *); /* Définit les droits associés à une partie de code. */ static int py_binary_portion_set_rights(PyObject *, PyObject *, void *); -/* Définit les constantes pour les portions de binaire. */ -static bool py_binary_portion_define_constants(PyTypeObject *); - /****************************************************************************** @@ -608,35 +605,6 @@ static int py_binary_portion_set_rights(PyObject *self, PyObject *value, void *c /****************************************************************************** * * -* Paramètres : obj_type = type dont le dictionnaire est à compléter. * -* * -* Description : Définit les constantes pour les portions de binaire. * -* * -* Retour : true en cas de succès de l'opération, false sinon. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static bool py_binary_portion_define_constants(PyTypeObject *obj_type) -{ - bool result; /* Bilan à retourner */ - - result = true; - - if (result) result = PyDict_AddStringMacro(obj_type, BPC_RAW); - if (result) result = PyDict_AddStringMacro(obj_type, BPC_CODE); - if (result) result = PyDict_AddStringMacro(obj_type, BPC_DATA); - if (result) result = PyDict_AddStringMacro(obj_type, BPC_DATA_RO); - if (result) result = PyDict_AddStringMacro(obj_type, BPC_DISASS_ERROR); - - return result; - -} - - -/****************************************************************************** -* * * Paramètres : - * * * * Description : Fournit un accès à une définition de type à diffuser. * @@ -718,9 +686,6 @@ bool ensure_python_binary_portion_is_registered(void) if (!register_class_for_pygobject(dict, G_TYPE_BIN_PORTION, type, &PyGObject_Type)) return false; - if (!py_binary_portion_define_constants(type)) - return false; - if (!define_binary_portion_constants(type)) return false; diff --git a/plugins/pychrysalide/glibext/constants.c b/plugins/pychrysalide/glibext/constants.c index 680feaf..e24a6e0 100644 --- a/plugins/pychrysalide/glibext/constants.c +++ b/plugins/pychrysalide/glibext/constants.c @@ -49,8 +49,21 @@ bool define_binary_portion_constants(PyTypeObject *type) { bool result; /* Bilan à retourner */ + PyObject *strdict; /* Groupe de chaînes constantes*/ PyObject *values; /* Groupe de valeurs à établir */ + result = create_string_constants_group_to_type(type, "BinaryPortionCode", + "Selector names for the CSS rendering.", &strdict); + + if (result) result = extend_string_constants_group(strdict, "RAW", BPC_RAW); + if (result) result = extend_string_constants_group(strdict, "CODE", BPC_CODE); + if (result) result = extend_string_constants_group(strdict, "DATA", BPC_DATA); + if (result) result = extend_string_constants_group(strdict, "DATA_RO", BPC_DATA_RO); + if (result) result = extend_string_constants_group(strdict, "DISASS_ERROR", BPC_DISASS_ERROR); + + if (!result) + goto exit; + values = PyDict_New(); result = add_const_to_group(values, "NONE", PAC_NONE); |