summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-08-16 18:02:13 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-08-16 18:02:13 (GMT)
commit9167c2a44efba513aaf8cac6d5589c565ed14ddf (patch)
tree54ece09f4d2eaca6c3475bc92001d106e2409242
parent81297d1f95d33dffe85316a91ac8b028dfc91b2f (diff)
Added some constants for instructions in the Python API.
-rw-r--r--plugins/pychrysalide/arch/instruction.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/plugins/pychrysalide/arch/instruction.c b/plugins/pychrysalide/arch/instruction.c
index df5bc15..4202625 100644
--- a/plugins/pychrysalide/arch/instruction.c
+++ b/plugins/pychrysalide/arch/instruction.c
@@ -74,6 +74,11 @@ static PyObject *py_arch_instruction_get_operands(PyObject *, void *);
+/* Définit les constantes pour les instructions. */
+static bool py_arch_instruction_define_constants(PyTypeObject *);
+
+
+
@@ -422,6 +427,39 @@ static PyObject *py_arch_instruction_get_operands(PyObject *self, void *unused)
/******************************************************************************
* *
+* Paramètres : obj_type = type dont le dictionnaire est à compléter. *
+* *
+* Description : Définit les constantes pour les instructions. *
+* *
+* Retour : true en cas de succès de l'opération, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool py_arch_instruction_define_constants(PyTypeObject *obj_type)
+{
+ bool result; /* Bilan à retourner */
+
+ result = true;
+
+ result &= PyDict_AddIntMacro(obj_type, ILT_EXEC_FLOW);
+ result &= PyDict_AddIntMacro(obj_type, ILT_JUMP);
+ result &= PyDict_AddIntMacro(obj_type, ILT_CASE_JUMP);
+ result &= PyDict_AddIntMacro(obj_type, ILT_JUMP_IF_TRUE);
+ result &= PyDict_AddIntMacro(obj_type, ILT_JUMP_IF_FALSE);
+ result &= PyDict_AddIntMacro(obj_type, ILT_LOOP);
+ result &= PyDict_AddIntMacro(obj_type, ILT_CALL);
+ result &= PyDict_AddIntMacro(obj_type, ILT_CATCH_EXCEPTION);
+ result &= PyDict_AddIntMacro(obj_type, ILT_REF);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : - *
* *
* Description : Fournit un accès à une définition de type à diffuser. *
@@ -522,6 +560,9 @@ bool ensure_python_arch_instruction_is_registered(void)
&PyGObject_Type, get_python_line_generator_type(), NULL))
return false;
+ if (!py_arch_instruction_define_constants(type))
+ return false;
+
}
return true;