summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/block.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/analysis/block.c
parent36945bffa2ca648b58c99905ebf9b1b536a9188a (diff)
Reorganized the Python plugin code.
Diffstat (limited to 'plugins/pychrysalide/analysis/block.c')
-rw-r--r--plugins/pychrysalide/analysis/block.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/plugins/pychrysalide/analysis/block.c b/plugins/pychrysalide/analysis/block.c
index e646ba8..010efd4 100644
--- a/plugins/pychrysalide/analysis/block.c
+++ b/plugins/pychrysalide/analysis/block.c
@@ -31,6 +31,7 @@
#include <analysis/block.h>
+#include "../access.h"
#include "../helpers.h"
@@ -216,11 +217,9 @@ PyTypeObject *get_python_instr_block_type(void)
return &py_instr_block_type;
}
-
-
/******************************************************************************
* *
-* Paramètres : module = module dont la définition est à compléter. *
+* Paramètres : - *
* *
* Description : Prend en charge l'objet 'pychrysalide.analysis.InstrBlock'. *
* *
@@ -230,22 +229,25 @@ PyTypeObject *get_python_instr_block_type(void)
* *
******************************************************************************/
-bool register_python_instr_block(PyObject *module)
+bool ensure_python_instr_block_is_registered(void)
{
-#if 0
- PyTypeObject *py_instr_block_type; /* Type Python 'InstrBlock' */
+ PyTypeObject *type; /* Type Python 'InstrBlock' */
+ PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
- py_instr_block_type = get_python_instr_block_type();
+ type = get_python_instr_block_type();
- dict = PyModule_GetDict(module);
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.analysis");
- if (!register_class_for_pygobject(dict, G_TYPE_INSTR_BLOCK, py_instr_block_type, &PyGObject_Type))
- return false;
+ dict = PyModule_GetDict(module);
+
+ if (!register_class_for_pygobject(dict, G_TYPE_CODE_BLOCK, type, &PyGObject_Type))
+ return false;
+
+ }
- if (!py_instructions_block_define_constants(py_instr_block_type))
- return false;
-#endif
return true;
}