summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/glibext/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa/glibext/module.c')
-rw-r--r--plugins/pychrysa/glibext/module.c49
1 files changed, 37 insertions, 12 deletions
diff --git a/plugins/pychrysa/glibext/module.c b/plugins/pychrysa/glibext/module.c
index b62ae7b..9f3d3a8 100644
--- a/plugins/pychrysa/glibext/module.c
+++ b/plugins/pychrysa/glibext/module.c
@@ -2,7 +2,7 @@
/* Chrysalide - Outil d'analyse de fichiers binaires
* module.c - intégration du répertoire glibext en tant que module
*
- * Copyright (C) 2012 Cyrille Bagard
+ * Copyright (C) 2012-2014 Cyrille Bagard
*
* This file is part of Chrysalide.
*
@@ -25,8 +25,7 @@
#include "module.h"
-#include "bufferline.h"
-#include "codebuffer.h"
+#include "configuration.h"
@@ -44,24 +43,50 @@
bool add_glibext_module_to_python_module(PyObject *super)
{
- bool result;
- PyObject *module;
+ bool result; /* Bilan à retourner */
+ PyObject *module; /* Sous-module mis en place */
int ret; /* Bilan d'un appel */
- static PyMethodDef py_glibext_methods[] = {
- { NULL }
+ static PyModuleDef py_chrysalide_glibext_module = {
+
+ .m_base = PyModuleDef_HEAD_INIT,
+
+ .m_name = "pychrysalide.glibext",
+ .m_doc = "Python module for Chrysalide.glibext",
+
+ .m_size = -1,
+
};
- module = Py_InitModule("pychrysalide.glibext", py_glibext_methods);
+ result = false;
+
+ module = PyModule_Create(&py_chrysalide_glibext_module);
if (module == NULL) return false;
+ ret = PyState_AddModule(super, &py_chrysalide_glibext_module);
+ if (ret != 0) goto agmtpm_exit;
+
+ ret = _PyImport_FixupBuiltin(module, "pychrysalide.glibext");
+ if (ret != 0) goto agmtpm_exit;
+
Py_INCREF(module);
- ret = PyModule_AddObject(super, "pychrysalide.glibext", module);
+ ret = PyModule_AddObject(super, "glibext", module);
+ if (ret != 0) goto agmtpm_exit;
+
+ result = true;
+
+ result &= register_python_config_param(module);
+ result &= register_python_config_param_iterator(module);
+ result &= register_python_generic_config(module);
+
+ agmtpm_exit:
- result = (ret == 0);
+ if (!result)
+ {
+ printf("something went wrong in %s...\n", __FUNCTION__);
+ /* ... */
- result &= register_python_buffer_line(module);
- result &= register_python_code_buffer(module);
+ }
return result;