summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/arch/immediate.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/arch/immediate.c')
-rw-r--r--plugins/pychrysalide/arch/immediate.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/plugins/pychrysalide/arch/immediate.c b/plugins/pychrysalide/arch/immediate.c
index e3c5c34..5ee2d41 100644
--- a/plugins/pychrysalide/arch/immediate.c
+++ b/plugins/pychrysalide/arch/immediate.c
@@ -36,6 +36,8 @@
#include "operand.h"
+#include "targetableop.h"
+#include "../access.h"
#include "../helpers.h"
@@ -674,21 +676,33 @@ PyTypeObject *get_python_imm_operand_type(void)
* *
******************************************************************************/
-bool register_python_imm_operand(PyObject *module)
+bool ensure_python_imm_operand_is_registered(void)
{
- PyTypeObject *py_imm_operand_type; /* Type Python 'BinContent' */
+ PyTypeObject *type; /* Type Python 'ImmOperand' */
+ PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
- py_imm_operand_type = get_python_imm_operand_type();
+ type = get_python_imm_operand_type();
- dict = PyModule_GetDict(module);
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.arch");
+
+ dict = PyModule_GetDict(module);
+
+ if (!ensure_python_arch_operand_is_registered())
+ return false;
- if (!register_class_for_pygobject(dict, G_TYPE_IMM_OPERAND,
- py_imm_operand_type, get_python_arch_operand_type()))
- return false;
+ if (!ensure_python_targetable_operand_is_registered())
+ return false;
- if (!py_imm_operand_define_constants(py_imm_operand_type))
- return false;
+ if (!register_class_for_pygobject(dict, G_TYPE_IMM_OPERAND, type, get_python_arch_operand_type()))
+ return false;
+
+ if (!py_imm_operand_define_constants(type))
+ return false;
+
+ }
return true;