summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/pychrysalide/arch/module.c52
-rw-r--r--plugins/pychrysalide/arch/vmpa.c11
2 files changed, 35 insertions, 28 deletions
diff --git a/plugins/pychrysalide/arch/module.c b/plugins/pychrysalide/arch/module.c
index 009dc7b..8bd6df6 100644
--- a/plugins/pychrysalide/arch/module.c
+++ b/plugins/pychrysalide/arch/module.c
@@ -29,6 +29,7 @@
#include <arch/archbase.h>
+#include <common/endianness.h>
#include "feeder.h"
@@ -67,25 +68,38 @@ static bool py_base_define_constants(PyTypeObject *obj_type)
result = true;
- result &= PyDict_AddIntMacro(obj_type, MDS_UNDEFINED);
-
- result &= PyDict_AddIntMacro(obj_type, MDS_4_BITS_UNSIGNED);
- result &= PyDict_AddIntMacro(obj_type, MDS_8_BITS_UNSIGNED);
- result &= PyDict_AddIntMacro(obj_type, MDS_16_BITS_UNSIGNED);
- result &= PyDict_AddIntMacro(obj_type, MDS_32_BITS_UNSIGNED);
- result &= PyDict_AddIntMacro(obj_type, MDS_64_BITS_UNSIGNED);
-
- result &= PyDict_AddIntMacro(obj_type, MDS_4_BITS_SIGNED);
- result &= PyDict_AddIntMacro(obj_type, MDS_8_BITS_SIGNED);
- result &= PyDict_AddIntMacro(obj_type, MDS_16_BITS_SIGNED);
- result &= PyDict_AddIntMacro(obj_type, MDS_32_BITS_SIGNED);
- result &= PyDict_AddIntMacro(obj_type, MDS_64_BITS_SIGNED);
-
- result &= PyDict_AddIntMacro(obj_type, MDS_4_BITS);
- result &= PyDict_AddIntMacro(obj_type, MDS_8_BITS);
- result &= PyDict_AddIntMacro(obj_type, MDS_16_BITS);
- result &= PyDict_AddIntMacro(obj_type, MDS_32_BITS);
- result &= PyDict_AddIntMacro(obj_type, MDS_64_BITS);
+ if (result) result = PyDict_AddIntMacro(obj_type, MDS_UNDEFINED);
+
+ if (result) result = PyDict_AddIntMacro(obj_type, MDS_4_BITS_UNSIGNED);
+ if (result) result = PyDict_AddIntMacro(obj_type, MDS_8_BITS_UNSIGNED);
+ if (result) result = PyDict_AddIntMacro(obj_type, MDS_16_BITS_UNSIGNED);
+ if (result) result = PyDict_AddIntMacro(obj_type, MDS_32_BITS_UNSIGNED);
+ if (result) result = PyDict_AddIntMacro(obj_type, MDS_64_BITS_UNSIGNED);
+
+ if (result) result = PyDict_AddIntMacro(obj_type, MDS_4_BITS_SIGNED);
+ if (result) result = PyDict_AddIntMacro(obj_type, MDS_8_BITS_SIGNED);
+ if (result) result = PyDict_AddIntMacro(obj_type, MDS_16_BITS_SIGNED);
+ if (result) result = PyDict_AddIntMacro(obj_type, MDS_32_BITS_SIGNED);
+ if (result) result = PyDict_AddIntMacro(obj_type, MDS_64_BITS_SIGNED);
+
+ if (result) result = PyDict_AddIntMacro(obj_type, MDS_4_BITS);
+ if (result) result = PyDict_AddIntMacro(obj_type, MDS_8_BITS);
+ if (result) result = PyDict_AddIntMacro(obj_type, MDS_16_BITS);
+ if (result) result = PyDict_AddIntMacro(obj_type, MDS_32_BITS);
+ if (result) result = PyDict_AddIntMacro(obj_type, MDS_64_BITS);
+
+ /**
+ * Comme il existe déjà le module struct, de nouvelles primitives de
+ * lecture/écriture de données sensibles au boutisme sont inutiles dans Python.
+ *
+ * On choisit donc de ne pas créer de nouvelle entité dans le module Chrysalide
+ * pour exporter les constantes suivantes.
+ */
+
+ if (result) result = PyDict_AddIntMacro(obj_type, SRE_LITTLE);
+ if (result) result = PyDict_AddIntMacro(obj_type, SRE_LITTLE_WORD);
+ if (result) result = PyDict_AddIntMacro(obj_type, SRE_BIG_WORD);
+ if (result) result = PyDict_AddIntMacro(obj_type, SRE_BIG);
return result;
diff --git a/plugins/pychrysalide/arch/vmpa.c b/plugins/pychrysalide/arch/vmpa.c
index abca73f..cdf20c9 100644
--- a/plugins/pychrysalide/arch/vmpa.c
+++ b/plugins/pychrysalide/arch/vmpa.c
@@ -39,7 +39,6 @@
-#include <common/endianness.h> /* TODO : à bouger vers base ? */
@@ -536,14 +535,8 @@ static bool py_vmpa_define_constants(PyTypeObject *obj_type)
result = true;
- result &= PyDict_AddIntMacro(obj_type, VMPA_NO_PHYSICAL);
- result &= PyDict_AddIntMacro(obj_type, VMPA_NO_VIRTUAL);
-
- /* TODO : à bouger vers base ? */
- result &= PyDict_AddIntMacro(obj_type, SRE_LITTLE);
- result &= PyDict_AddIntMacro(obj_type, SRE_LITTLE_WORD);
- result &= PyDict_AddIntMacro(obj_type, SRE_BIG_WORD);
- result &= PyDict_AddIntMacro(obj_type, SRE_BIG);
+ if (result) result = PyDict_AddIntMacro(obj_type, VMPA_NO_PHYSICAL);
+ if (result) result = PyDict_AddIntMacro(obj_type, VMPA_NO_VIRTUAL);
return result;