diff options
Diffstat (limited to 'plugins/pychrysalide')
| -rw-r--r-- | plugins/pychrysalide/arch/instruction.c | 41 | 
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; | 
