diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-07-17 16:36:21 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-07-17 16:36:21 (GMT) |
commit | 24d3836fcf8d443eb654b981f65478cd9923b8f1 (patch) | |
tree | 7672a28b864127e8958c3c6cce751dcf646d2fbe /plugins/pychrysa/gui/panels/module.c | |
parent | a61f089babe336b012da31a494b0f7470b6e1a9a (diff) |
Updated the Python bindings.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@552 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/pychrysa/gui/panels/module.c')
-rw-r--r-- | plugins/pychrysa/gui/panels/module.c | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/plugins/pychrysa/gui/panels/module.c b/plugins/pychrysa/gui/panels/module.c index bd13cd9..ca8845d 100644 --- a/plugins/pychrysa/gui/panels/module.c +++ b/plugins/pychrysa/gui/panels/module.c @@ -1,6 +1,6 @@ /* Chrysalide - Outil d'analyse de fichiers binaires - * module.c - intégration du répertoire arch en tant que module + * module.c - intégration du répertoire panels en tant que module * * Copyright (C) 2012-2013 Cyrille Bagard * @@ -25,6 +25,9 @@ #include "module.h" +#include <assert.h> + + #include "log.h" #include "panel.h" @@ -44,27 +47,45 @@ bool add_gui_panels_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_gui_panels_methods[] = { - { NULL } + static PyModuleDef py_chrysalide_panels_module = { + + .m_base = PyModuleDef_HEAD_INIT, + + .m_name = "gui.analysis.panels", + .m_doc = "Python module for Chrysalide.gui.panels", + + .m_size = -1, + }; - module = Py_InitModule("pychrysalide.gui.panels", py_gui_panels_methods); + result = false; + + module = PyModule_Create(&py_chrysalide_panels_module); if (module == NULL) return false; - Py_INCREF(module); - ret = PyModule_AddObject(super, "pychrysalide.gui.panels", module); + ret = PyState_AddModule(super, &py_chrysalide_panels_module); + if (ret != 0) goto loading_failed; + + ret = _PyImport_FixupBuiltin(module, "pychrysalide.gui.panels"); + if (ret != 0) goto loading_failed; - result = (ret == 0); + Py_INCREF(module); + ret = PyModule_AddObject(super, "panels", module); + if (ret != 0) goto loading_failed; - if (ret != 0) /* ... */; + result = true; result &= register_python_panel_item(module); result &= register_python_log_panel(module); - return true; + loading_failed: + + assert(result); + + return result; } |