diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2014-07-10 14:47:37 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2014-07-10 14:47:37 (GMT) |
commit | db863244b804cbf4c06399f7c6f8241d91c9ee9b (patch) | |
tree | da7cc911b0f10c5122536271235ab68f2202804a /plugins/pychrysa/glibext/module.c | |
parent | e8aa314462196cc9e8461ae23eb13f8bffcc983f (diff) |
Fully rewritten the core configuration system.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@381 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/pychrysa/glibext/module.c')
-rw-r--r-- | plugins/pychrysa/glibext/module.c | 49 |
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; |