diff options
| author | Cyrille Bagard <nocbos@gmail.com> | 2018-08-16 09:16:53 (GMT) | 
|---|---|---|
| committer | Cyrille Bagard <nocbos@gmail.com> | 2018-08-16 09:16:53 (GMT) | 
| commit | fb315963527f6412273829f09513325e446eb6c9 (patch) | |
| tree | 361f19767812a8f758545e8daa2973fe0b3c9de7 /plugins/pychrysalide/arch/operand.c | |
| parent | 36945bffa2ca648b58c99905ebf9b1b536a9188a (diff) | |
Reorganized the Python plugin code.
Diffstat (limited to 'plugins/pychrysalide/arch/operand.c')
| -rw-r--r-- | plugins/pychrysalide/arch/operand.c | 22 | 
1 files changed, 15 insertions, 7 deletions
| diff --git a/plugins/pychrysalide/arch/operand.c b/plugins/pychrysalide/arch/operand.c index 427f92b..e464eac 100644 --- a/plugins/pychrysalide/arch/operand.c +++ b/plugins/pychrysalide/arch/operand.c @@ -31,6 +31,7 @@  #include <arch/operand.h> +#include "../access.h"  #include "../helpers.h" @@ -90,19 +91,26 @@ PyTypeObject *get_python_arch_operand_type(void)  *                                                                             *  ******************************************************************************/ -bool register_python_arch_operand(PyObject *module) +bool ensure_python_arch_operand_is_registered(void)  { -    PyTypeObject *py_arch_operand_type;     /* Type Python 'BinContent'    */ +    PyTypeObject *type;                     /* Type Python 'ArchOperand'   */ +    PyObject *module;                       /* Module à recompléter        */      PyObject *dict;                         /* Dictionnaire du module      */ -    py_arch_operand_type = get_python_arch_operand_type(); +    type = get_python_arch_operand_type(); -    APPLY_ABSTRACT_FLAG(py_arch_operand_type); +    if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) +    { +        APPLY_ABSTRACT_FLAG(type); -    dict = PyModule_GetDict(module); +        module = get_access_to_python_module("pychrysalide.arch"); -    if (!register_class_for_pygobject(dict, G_TYPE_ARCH_OPERAND, py_arch_operand_type, &PyGObject_Type)) -        return false; +        dict = PyModule_GetDict(module); + +        if (!register_class_for_pygobject(dict, G_TYPE_ARCH_OPERAND, type, &PyGObject_Type)) +            return false; + +    }      return true; | 
