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/targetableop.c | |
parent | 36945bffa2ca648b58c99905ebf9b1b536a9188a (diff) |
Reorganized the Python plugin code.
Diffstat (limited to 'plugins/pychrysalide/arch/targetableop.c')
-rw-r--r-- | plugins/pychrysalide/arch/targetableop.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/plugins/pychrysalide/arch/targetableop.c b/plugins/pychrysalide/arch/targetableop.c index 8951492..0fb23e0 100644 --- a/plugins/pychrysalide/arch/targetableop.c +++ b/plugins/pychrysalide/arch/targetableop.c @@ -37,6 +37,7 @@ #include "processor.h" #include "vmpa.h" +#include "../access.h" #include "../format/format.h" @@ -163,15 +164,22 @@ PyTypeObject *get_python_targetable_operand_type(void) * * ******************************************************************************/ -bool register_python_targetable_operand(PyObject *module) +bool ensure_python_targetable_operand_is_registered(void) { - PyTypeObject *py_targetable_operand_type; /* Type 'TargetableOperand' */ + PyTypeObject *type; /* Type 'TargetableOperand' */ + PyObject *module; /* Module à recompléter */ PyObject *dict; /* Dictionnaire du module */ - py_targetable_operand_type = get_python_targetable_operand_type(); + type = get_python_targetable_operand_type(); - dict = PyModule_GetDict(module); - pyg_register_interface(dict, "TargetableOperand", G_TYPE_TARGETABLE_OPERAND, py_targetable_operand_type); + if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) + { + module = get_access_to_python_module("pychrysalide.arch"); + + dict = PyModule_GetDict(module); + pyg_register_interface(dict, "TargetableOperand", G_TYPE_TARGETABLE_OPERAND, type); + + } return true; |