summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/arch/processor.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-08-16 09:16:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-08-16 09:16:53 (GMT)
commitfb315963527f6412273829f09513325e446eb6c9 (patch)
tree361f19767812a8f758545e8daa2973fe0b3c9de7 /plugins/pychrysalide/arch/processor.c
parent36945bffa2ca648b58c99905ebf9b1b536a9188a (diff)
Reorganized the Python plugin code.
Diffstat (limited to 'plugins/pychrysalide/arch/processor.c')
-rw-r--r--plugins/pychrysalide/arch/processor.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/plugins/pychrysalide/arch/processor.c b/plugins/pychrysalide/arch/processor.c
index c2ee530..3ac18fa 100644
--- a/plugins/pychrysalide/arch/processor.c
+++ b/plugins/pychrysalide/arch/processor.c
@@ -38,6 +38,7 @@
#include "instriter.h"
#include "instruction.h"
#include "vmpa.h"
+#include "../access.h"
#include "../helpers.h"
@@ -489,20 +490,27 @@ PyTypeObject *get_python_arch_processor_type(void)
* *
******************************************************************************/
-bool register_python_arch_processor(PyObject *module)
+bool ensure_python_arch_processor_is_registered(void)
{
- PyTypeObject *py_arch_processor_type; /* Type Python 'BinContent' */
+ PyTypeObject *type; /* Type Python 'ArchProcessor' */
+ PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
- py_arch_processor_type = get_python_arch_processor_type();
+ type = get_python_arch_processor_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 (!register_class_for_pygobject(dict, G_TYPE_ARCH_PROCESSOR, py_arch_processor_type, &PyGObject_Type))
- return false;
+ if (!register_class_for_pygobject(dict, G_TYPE_ARCH_PROCESSOR, type, &PyGObject_Type))
+ return false;
- if (!define_python_arch_processor_constants(py_arch_processor_type))
- return false;
+ if (!define_python_arch_processor_constants(type))
+ return false;
+
+ }
return true;