diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2020-01-03 22:51:31 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2020-01-03 22:51:31 (GMT) |
commit | 8255d60ac64a851c2e7ca37d63aa1ba37d35b704 (patch) | |
tree | 06f1855dd7ead9da2acc0c595e3710faf503628f /plugins/pychrysalide/helpers.c | |
parent | 90b8f66eb8ae62d951dfbd333fb338e38874c9fe (diff) |
Used a Python enumeration for verbosity levels.
Diffstat (limited to 'plugins/pychrysalide/helpers.c')
-rw-r--r-- | plugins/pychrysalide/helpers.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/plugins/pychrysalide/helpers.c b/plugins/pychrysalide/helpers.c index d2215d8..367714d 100644 --- a/plugins/pychrysalide/helpers.c +++ b/plugins/pychrysalide/helpers.c @@ -1024,7 +1024,8 @@ int forward_pygobjet_init(PyObject *self) /****************************************************************************** * * -* Paramètres : owner = type dont le dictionnaire est à compléter. * +* Paramètres : owner = désignation du propriétaire du dictionnaire visé. * +* dict = dictionnaire dont le contenu est à compléter. * * flags = indique le type d'énumération ciblée. * * name = désignation humaine du groupe à constituer. * * values = noms et valeurs associées. * @@ -1038,7 +1039,7 @@ int forward_pygobjet_init(PyObject *self) * * ******************************************************************************/ -bool attach_constants_group(PyTypeObject *owner, bool flags, const char *name, PyObject *values, const char *doc) +bool _attach_constants_group(const char *owner, PyObject *dict, bool flags, const char *name, PyObject *values, const char *doc) { bool result; /* Bilan à retourner */ PyObject *enum_mod; /* Module Python enum */ @@ -1093,10 +1094,10 @@ bool attach_constants_group(PyTypeObject *owner, bool flags, const char *name, P kwargs = PyDict_New(); - dot = rindex(owner->tp_name, '.'); + dot = rindex(owner, '.'); assert(dot != NULL); - module = strndup(owner->tp_name, dot - owner->tp_name); + module = strndup(owner, dot - owner); str_obj = PyUnicode_FromString(module); ret = PyDict_SetItemString(kwargs, "module", str_obj); @@ -1121,7 +1122,7 @@ bool attach_constants_group(PyTypeObject *owner, bool flags, const char *name, P new = PyObject_Call(class, args, kwargs); if (new == NULL) goto build_error; - ret = PyDict_SetItemString(owner->tp_dict, name, new); + ret = PyDict_SetItemString(dict, name, new); if (ret != 0) goto register_0_error; features = get_access_to_python_module("pychrysalide.features"); @@ -1165,7 +1166,7 @@ bool attach_constants_group(PyTypeObject *owner, bool flags, const char *name, P /****************************************************************************** * * -* Paramètres : owner = propriétaire du groupe de constantes. * +* Paramètres : owner = désignation du propriétaire du dictionnaire visé. * * name = désignation humaine du groupe à consulter. * * value = valeur à transmettre à Python. * * * @@ -1177,7 +1178,7 @@ bool attach_constants_group(PyTypeObject *owner, bool flags, const char *name, P * * ******************************************************************************/ -PyObject *cast_with_constants_group(const PyTypeObject *owner, const char *name, unsigned long value) +PyObject *_cast_with_constants_group(const char *owner, const char *name, unsigned long value) { PyObject *result; /* Objet Python à retourner */ char *dot; /* Position du dernier point */ @@ -1191,10 +1192,10 @@ PyObject *cast_with_constants_group(const PyTypeObject *owner, const char *name, /* Recherche de la classe Python */ - dot = strrchr(owner->tp_name, '.'); + dot = strrchr(owner, '.'); assert(dot != NULL); - modname = strndup(owner->tp_name, dot - owner->tp_name); + modname = strndup(owner, dot - owner); module = get_access_to_python_module(modname); |