diff options
Diffstat (limited to 'plugins/pychrysalide/helpers.h')
-rw-r--r-- | plugins/pychrysalide/helpers.h | 54 |
1 files changed, 40 insertions, 14 deletions
diff --git a/plugins/pychrysalide/helpers.h b/plugins/pychrysalide/helpers.h index 931be95..0ef8adc 100644 --- a/plugins/pychrysalide/helpers.h +++ b/plugins/pychrysalide/helpers.h @@ -308,20 +308,46 @@ int convert_to_gdk_rgba(PyObject *, void *); }) /* Officialise un groupe de constantes avec sémentique. */ -bool _attach_constants_group(const char *, PyObject *, bool, const char *, PyObject *, const char *); - -#define attach_constants_group_to_type(type, flags, name, values, doc) \ - _attach_constants_group(type->tp_name, type->tp_dict, flags, name, values, doc) - -#define attach_constants_group_to_module(mod, flags, name, values, doc) \ - ({ \ - bool __result; \ - const char *__owner; \ - PyObject *__dict; \ - __owner = PyModule_GetName(mod); \ - __dict = PyModule_GetDict(mod); \ - __result = _attach_constants_group(__owner, __dict, flags, name, values, doc); \ - __result; \ +PyObject *_attach_constants_group(const char *, PyObject *, bool, const char *, PyObject *, const char *); + +#define attach_constants_group_to_type(type, flags, name, values, doc) \ + ({ \ + bool __result; \ + PyObject *__new; \ + __new = _attach_constants_group(type->tp_name, type->tp_dict, flags, name, values, \ + doc); \ + __result = (__new != NULL); \ + Py_XDECREF(__new); \ + __result; \ + }) + +#define attach_constants_group_to_module(mod, flags, name, values, doc) \ + ({ \ + bool __result; \ + const char *__owner; \ + PyObject *__dict; \ + PyObject *__new; \ + __owner = PyModule_GetName(mod); \ + __dict = PyModule_GetDict(mod); \ + __new = _attach_constants_group(__owner, __dict, flags, name, values, doc); \ + __result = (__new != NULL); \ + Py_XDECREF(__new); \ + __result; \ + }) + +/* Officialise un groupe de constantes avec lien GLib. */ +PyObject *_attach_constants_group_with_pyg_enum(const char *, PyObject *, bool, const char *, PyObject *, const char *, GType); + + +#define attach_constants_group_to_type_with_pyg_enum(type, flags, name, values, doc, gtype) \ + ({ \ + bool __result; \ + PyObject *__new; \ + __new = _attach_constants_group_with_pyg_enum(type->tp_name, type->tp_dict, flags, \ + name, values, doc, gtype); \ + __result = (__new != NULL); \ + Py_XDECREF(__new); \ + __result; \ }) /* Traduit une valeur constante C en équivalent Python. */ |