summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/helpers.h
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2022-02-20 23:22:59 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2022-02-20 23:22:59 (GMT)
commit2a0b25fca5f6d4bef7edd4d618e420559209e8ec (patch)
tree36d1b6dfc9a49af0f04af0abbc169c0ffd4bd070 /plugins/pychrysalide/helpers.h
parent945e0c9ecce02155555387aad672e272f5646362 (diff)
Translate enumerations before PyGObject using internal definitions when needed.
Diffstat (limited to 'plugins/pychrysalide/helpers.h')
-rw-r--r--plugins/pychrysalide/helpers.h54
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. */