summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/analysis/routine.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/routine.c
parent36945bffa2ca648b58c99905ebf9b1b536a9188a (diff)
Reorganized the Python plugin code.
Diffstat (limited to 'plugins/pychrysalide/analysis/routine.c')
-rw-r--r--plugins/pychrysalide/analysis/routine.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/plugins/pychrysalide/analysis/routine.c b/plugins/pychrysalide/analysis/routine.c
index fddc026..1e255bb 100644
--- a/plugins/pychrysalide/analysis/routine.c
+++ b/plugins/pychrysalide/analysis/routine.c
@@ -38,6 +38,7 @@
#include "block.h"
#include "type.h"
+#include "../access.h"
#include "../helpers.h"
#include "../format/symbol.h"
@@ -651,7 +652,7 @@ PyTypeObject *get_python_binary_routine_type(void)
/******************************************************************************
* *
-* Paramètres : module = module dont la définition est à compléter. *
+* Paramètres : - *
* *
* Description : Prend en charge l'objet 'pychrysalide.analysis.BinRoutine'. *
* *
@@ -661,18 +662,27 @@ PyTypeObject *get_python_binary_routine_type(void)
* *
******************************************************************************/
-bool register_python_binary_routine(PyObject *module)
+bool ensure_python_binary_routine_is_registered(void)
{
- PyTypeObject *py_binary_routine_type; /* Type Python 'BinRoutine' */
+ PyTypeObject *type; /* Type Python 'BinRoutine' */
+ PyObject *module; /* Module à recompléter */
PyObject *dict; /* Dictionnaire du module */
- py_binary_routine_type = get_python_binary_routine_type();
+ type = get_python_binary_routine_type();
+
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.analysis");
+
+ dict = PyModule_GetDict(module);
+
+ if (!ensure_python_binary_symbol_is_registered())
+ return false;
- dict = PyModule_GetDict(module);
+ if (!register_class_for_pygobject(dict, G_TYPE_BIN_ROUTINE, type, get_python_binary_symbol_type()))
+ return false;
- if (!register_class_for_pygobject(dict, G_TYPE_BIN_ROUTINE,
- py_binary_routine_type, get_python_binary_symbol_type()))
- return false;
+ }
return true;