summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/helpers.h
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-08-13 22:04:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-08-13 22:04:53 (GMT)
commit7cb4e815b691d05d8c0aea9decf56b9dbc41dfa6 (patch)
treeade598a747daa2e061f4903a81ac74e52e0c38b1 /plugins/pychrysalide/helpers.h
parentdd2853ea8cf97b773ba362da50d06d4abc608a09 (diff)
Used a Python enumeration for the binary symbol status.
Diffstat (limited to 'plugins/pychrysalide/helpers.h')
-rw-r--r--plugins/pychrysalide/helpers.h29
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 */