diff options
Diffstat (limited to 'plugins/pychrysalide/helpers.h')
-rw-r--r-- | plugins/pychrysalide/helpers.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/plugins/pychrysalide/helpers.h b/plugins/pychrysalide/helpers.h index 4ffb447..e2ebfbc 100644 --- a/plugins/pychrysalide/helpers.h +++ b/plugins/pychrysalide/helpers.h @@ -156,4 +156,33 @@ bool register_class_for_dynamic_pygobject(GType, PyTypeObject *, PyTypeObject *) +/* ----------------------- TRANSFERT DES VALEURS CONSTANTES ------------------------- */ + + +/* Officialise un groupe de constantes avec sémentique. */ +bool attach_constants_group(PyTypeObject *, bool, const char *, PyObject *, const char *); + +/* Simplification d'un ajout de constante pour l'appelant */ +#define add_const_to_group(d, n, v) \ + ({ \ + bool __result; \ + PyObject *__val; \ + int __ret; \ + __val = PyLong_FromUnsignedLong(v); \ + if (__val == NULL) \ + __result = false; \ + else \ + { \ + __ret = PyDict_SetItemString(d, n, __val); \ + Py_DECREF(__val); \ + __result = (__ret == 0); \ + } \ + __result; \ + }) + +/* Traduit une valeur constante C en équivalent Python. */ +PyObject *cast_with_constants_group(const PyTypeObject *, const char *, unsigned long); + + + #endif /* _PLUGINS_PYCHRYSALIDE_HELPERS_H */ |