summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/glibext
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-01-16 19:02:56 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-01-16 19:02:56 (GMT)
commit9da8f8b37e3edebc917b4e223dd2447cd7cbc818 (patch)
tree3f330b13e7ca2a0a163882be3043ca9571f25211 /plugins/pychrysa/glibext
parenteb9b7fd76451db5c9f07a800c0394480e4b88c9c (diff)
Changed the Python bindings source directory and updated code.
Diffstat (limited to 'plugins/pychrysa/glibext')
-rw-r--r--plugins/pychrysa/glibext/Makefile.am19
-rw-r--r--plugins/pychrysa/glibext/buffercache.c165
-rw-r--r--plugins/pychrysa/glibext/buffercache.h42
-rw-r--r--plugins/pychrysa/glibext/bufferline.c373
-rw-r--r--plugins/pychrysa/glibext/bufferline.h42
-rw-r--r--plugins/pychrysa/glibext/configuration.c1165
-rw-r--r--plugins/pychrysa/glibext/configuration.h66
-rw-r--r--plugins/pychrysa/glibext/linegen.c404
-rw-r--r--plugins/pychrysa/glibext/linegen.h42
-rw-r--r--plugins/pychrysa/glibext/loadedpanel.c166
-rw-r--r--plugins/pychrysa/glibext/loadedpanel.h42
-rw-r--r--plugins/pychrysa/glibext/module.c103
-rw-r--r--plugins/pychrysa/glibext/module.h39
13 files changed, 0 insertions, 2668 deletions
diff --git a/plugins/pychrysa/glibext/Makefile.am b/plugins/pychrysa/glibext/Makefile.am
deleted file mode 100644
index e4d5243..0000000
--- a/plugins/pychrysa/glibext/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-
-noinst_LTLIBRARIES = libpychrysaglibext.la
-
-libpychrysaglibext_la_SOURCES = \
- buffercache.h buffercache.c \
- bufferline.h bufferline.c \
- configuration.h configuration.c \
- linegen.h linegen.c \
- loadedpanel.h loadedpanel.c \
- module.h module.c
-
-
-libpychrysaglibext_la_LDFLAGS =
-
-
-AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \
- -I../../../src
-
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/plugins/pychrysa/glibext/buffercache.c b/plugins/pychrysa/glibext/buffercache.c
deleted file mode 100644
index f61d34f..0000000
--- a/plugins/pychrysa/glibext/buffercache.c
+++ /dev/null
@@ -1,165 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * buffercache.c - équivalent Python du fichier "glibext/gbuffercache.h"
- *
- * Copyright (C) 2016-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "buffercache.h"
-
-
-#include <pygobject.h>
-
-
-#include <glibext/gbuffercache.h>
-
-
-#include "../arch/vmpa.h"
-#include "../helpers.h"
-
-
-
-#if 0
-/* Retrouve une ligne au sein d'un tampon avec une adresse. */
-static PyObject *py_code_buffer_find_line_by_addr(PyObject *, PyObject *);
-
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe représentant un tampon de code. *
-* args = arguments fournis à l'appel. *
-* *
-* Description : Retrouve une ligne au sein d'un tampon avec une adresse. *
-* *
-* Retour : Instance de la ligne trouvée. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_code_buffer_find_line_by_addr(PyObject *self, PyObject *args)
-{
- PyObject *result; /* Trouvailles à retourner */
- PyObject *py_vmpa; /* Localisation version Python */
- int ret; /* Bilan de lecture des args. */
- vmpa2t *addr; /* Adresse visée par l'opérat° */
- GBuffercache *buffer; /* Version native */
- GBufferLine *line; /* Ligne trouvée */
-
- ret = PyArg_ParseTuple(args, "O", &py_vmpa);
- if (!ret) return NULL;
-
- ret = PyObject_IsInstance(py_vmpa, (PyObject *)get_python_vmpa_type());
- if (!ret) return NULL;
-
- addr = get_internal_vmpa(py_vmpa);
- if (addr == NULL) return NULL;
-
- buffer = G_CODE_BUFFER(pygobject_get(self));
-
- line = g_code_buffer_find_line_by_addr(buffer, addr, 0, NULL);
- if (line == NULL) Py_RETURN_NONE;
-
- result = pygobject_new(G_OBJECT(line));
-
- return result;
-
-}
-#endif
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit un accès à une définition de type à diffuser. *
-* *
-* Retour : Définition d'objet pour Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyTypeObject *get_python_buffer_cache_type(void)
-{
- static PyMethodDef py_buffer_cache_methods[] = {
-#if 0
- {
- "find_line_by_addr", (PyCFunction)py_buffer_cache_find_line_by_addr,
- METH_VARARGS,
- "find_line_by_addr($self, addr, /)\n--\n\nFind a buffer line with a given address."
- },
-#endif
- { NULL }
- };
-
- static PyGetSetDef py_buffer_cache_getseters[] = {
- { NULL }
- };
-
- static PyTypeObject py_buffer_cache_type = {
-
- PyVarObject_HEAD_INIT(NULL, 0)
-
- .tp_name = "pychrysalide.glibext.Buffercache",
- .tp_basicsize = sizeof(PyGObject),
-
- .tp_flags = Py_TPFLAGS_DEFAULT,
-
- .tp_doc = "PyChrysalide code buffer",
-
- .tp_methods = py_buffer_cache_methods,
- .tp_getset = py_buffer_cache_getseters,
-
- };
-
- return &py_buffer_cache_type;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Prend en charge l'objet 'pychrysalide.glibext.BufferCache'. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool register_python_buffer_cache(PyObject *module)
-{
- PyTypeObject *py_buffer_cache_type; /* Type Python 'BufferCache' */
- PyObject *dict; /* Dictionnaire du module */
-
- py_buffer_cache_type = get_python_buffer_cache_type();
-
- dict = PyModule_GetDict(module);
-
- if (!register_class_for_pygobject(dict, G_TYPE_BUFFER_CACHE, py_buffer_cache_type, &PyGObject_Type))
- return false;
-
- return true;
-
-}
diff --git a/plugins/pychrysa/glibext/buffercache.h b/plugins/pychrysa/glibext/buffercache.h
deleted file mode 100644
index 8d88e08..0000000
--- a/plugins/pychrysa/glibext/buffercache.h
+++ /dev/null
@@ -1,42 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * buffercache.h - prototypes pour l'équivalent Python du fichier "glibext/buffercache.h"
- *
- * Copyright (C) 2016-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#ifndef _PLUGINS_PYCHRYSA_GLIBEXT_BUFFERCACHE_H
-#define _PLUGINS_PYCHRYSA_GLIBEXT_BUFFERCACHE_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-
-
-/* Fournit un accès à une définition de type à diffuser. */
-PyTypeObject *get_python_buffer_cache_type(void);
-
-/* Prend en charge l'objet 'pychrysalide.glibext.CodeBuffer'. */
-bool register_python_buffer_cache(PyObject *);
-
-
-
-#endif /* _PLUGINS_PYCHRYSA_GLIBEXT_BUFFERCACHE_H */
diff --git a/plugins/pychrysa/glibext/bufferline.c b/plugins/pychrysa/glibext/bufferline.c
deleted file mode 100644
index bfb894b..0000000
--- a/plugins/pychrysa/glibext/bufferline.c
+++ /dev/null
@@ -1,373 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * bufferline.c - équivalent Python du fichier "glibext/gbufferline.h"
- *
- * Copyright (C) 2012-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "bufferline.h"
-
-
-#include <malloc.h>
-#include <pygobject.h>
-
-
-#include <i18n.h>
-
-
-#include <glibext/gbufferline.h>
-
-
-#include "../helpers.h"
-#include "../arch/vmpa.h"
-
-
-
-/* Reconstruit et fournit le texte présent sur une ligne tampon. */
-static PyObject *py_buffer_line_get_text(PyObject *, PyObject *);
-
-/* Ajoute une propriété particulière à une ligne donnée. */
-static PyObject *py_buffer_line_add_flag(PyObject *, PyObject *);
-
-/* Retire une propriété particulière à une ligne donnée. */
-static PyObject *py_buffer_line_remove_flag(PyObject *, PyObject *);
-
-/* Fournit l'emplacement où se situe un symbole. */
-static PyObject *py_buffer_line_get_range(PyObject *, void *);
-
-/* Renseigne sur les propriétés particulières liées à une ligne. */
-static PyObject *py_buffer_line_get_flags(PyObject *, void *);
-
-/* Définit les constantes pour les lignes de tampon. */
-static bool py_buffer_line_define_constants(PyTypeObject *);
-
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe représentant une ligne de tampon. *
-* args = arguments fournis à l'appel. *
-* *
-* Description : Reconstruit et fournit le texte présent sur une ligne tampon.*
-* *
-* Retour : Texte reconstruit pour l'occasion. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_buffer_line_get_text(PyObject *self, PyObject *args)
-{
- PyObject *result; /* Trouvailles à retourner */
- BufferLineColumn first; /* Première colonne à parcourir*/
- BufferLineColumn end; /* Dernière colonne à parcourir*/
- int markup; /* Besoin de décorations ? */
- int ret; /* Bilan de lecture des args. */
- GBufferLine *line; /* Version native */
- char *text; /* Texte reconstruit à libérer */
-
- ret = PyArg_ParseTuple(args, "IIp", &first, &end, &markup);
- if (!ret) return NULL;
-
- if (first >= BLC_COUNT || end >= BLC_COUNT)
- {
- PyErr_SetString(PyExc_ValueError, _("Invalid range in arguments"));
- return NULL;
- }
-
- line = G_BUFFER_LINE(pygobject_get(self));
- text = g_buffer_line_get_text(line, first, end, markup);
-
- result = PyUnicode_FromString(text);
-
- free(text);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe représentant une ligne de tampon. *
-* args = arguments fournis à l'appel. *
-* *
-* Description : Ajoute une propriété particulière à une ligne donnée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_buffer_line_add_flag(PyObject *self, PyObject *args)
-{
- BufferLineFlags flag; /* Drapeau à considérer */
- int ret; /* Bilan de lecture des args. */
- GBufferLine *line; /* Version native */
-
- ret = PyArg_ParseTuple(args, "I", &flag);
- if (!ret) return NULL;
-
- if ((flag & ~BLF_ALL) != 0)
- {
- PyErr_SetString(PyExc_ValueError, _("Invalid flag"));
- return NULL;
- }
-
- line = G_BUFFER_LINE(pygobject_get(self));
- g_buffer_line_add_flag(line, flag);
-
- Py_RETURN_NONE;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe représentant une ligne de tampon. *
-* args = arguments fournis à l'appel. *
-* *
-* Description : Retire une propriété particulière à une ligne donnée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_buffer_line_remove_flag(PyObject *self, PyObject *args)
-{
- BufferLineFlags flag; /* Drapeau à considérer */
- int ret; /* Bilan de lecture des args. */
- GBufferLine *line; /* Version native */
-
- ret = PyArg_ParseTuple(args, "I", &flag);
- if (!ret) return NULL;
-
- if ((flag & ~BLF_ALL) != 0)
- {
- PyErr_SetString(PyExc_ValueError, _("Invalid flag"));
- return NULL;
- }
-
- line = G_BUFFER_LINE(pygobject_get(self));
- g_buffer_line_remove_flag(line, flag);
-
- Py_RETURN_NONE;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = objet Python concerné par l'appel. *
-* closure = non utilisé ici. *
-* *
-* Description : Indique la zone mémoire où se situe la ligne. *
-* *
-* Retour : Emplacement mémoire virtuel ou physique. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_buffer_line_get_range(PyObject *self, void *closure)
-{
- PyObject *result; /* Valeur à retourner */
- GBufferLine *line; /* Elément à consulter */
- const mrange_t *range; /* Couverture courante */
-
- line = G_BUFFER_LINE(pygobject_get(self));
- range = g_buffer_line_get_range(line);
-
- result = build_from_internal_mrange(range);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = objet Python concerné par l'appel. *
-* closure = non utilisé ici. *
-* *
-* Description : Renseigne sur les propriétés particulières liées à une ligne.*
-* *
-* Retour : Propriétés intégrées. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_buffer_line_get_flags(PyObject *self, void *closure)
-{
- PyObject *result; /* Valeur à retourner */
- GBufferLine *line; /* Elément à consulter */
- BufferLineFlags flags; /* Drapeaux à exporter */
-
- line = G_BUFFER_LINE(pygobject_get(self));
- flags = g_buffer_line_get_flags(line);
-
- result = PyLong_FromLong(flags);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : obj_type = type dont le dictionnaire est à compléter. *
-* *
-* Description : Définit les constantes pour les lignes de tampon. *
-* *
-* Retour : true en cas de succès de l'opération, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool py_buffer_line_define_constants(PyTypeObject *obj_type)
-{
- bool result; /* Bilan à retourner */
-
- result = true;
-
- result &= PyDict_AddIntMacro(obj_type, BLC_PHYSICAL);
- result &= PyDict_AddIntMacro(obj_type, BLC_VIRTUAL);
- result &= PyDict_AddIntMacro(obj_type, BLC_BINARY);
- result &= PyDict_AddIntMacro(obj_type, BLC_ASSEMBLY_HEAD);
- result &= PyDict_AddIntMacro(obj_type, BLC_ASSEMBLY);
- result &= PyDict_AddIntMacro(obj_type, BLC_COMMENTS);
- result &= PyDict_AddIntMacro(obj_type, BLC_COUNT);
- result &= PyDict_AddIntMacro(obj_type, BLC_LAST_USED);
- result &= PyDict_AddIntMacro(obj_type, BLC_INVALID);
- result &= PyDict_AddIntMacro(obj_type, BLC_MAIN);
- result &= PyDict_AddIntMacro(obj_type, BLC_FIRST);
- result &= PyDict_AddIntMacro(obj_type, BLC_DISPLAY);
-
- result &= PyDict_AddIntMacro(obj_type, BLF_NONE);
- result &= PyDict_AddIntMacro(obj_type, BLF_HAS_CODE);
- result &= PyDict_AddIntMacro(obj_type, BLF_ENTRYPOINT);
- result &= PyDict_AddIntMacro(obj_type, BLF_BOOKMARK);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit un accès à une définition de type à diffuser. *
-* *
-* Retour : Définition d'objet pour Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyTypeObject *get_python_buffer_line_type(void)
-{
- static PyMethodDef py_buffer_line_methods[] = {
- {
- "get_text", py_buffer_line_get_text,
- METH_VARARGS,
- "get_text($self, first_col, last_col, markup, /)\n--\n\nProvide the text of a buffer line."
- },
- {
- "add_flag", py_buffer_line_add_flag,
- METH_VARARGS,
- "add_flag($self, flag, /)\n--\n\nAdd a flag to the buffer line."
- },
- {
- "remove_flag", py_buffer_line_remove_flag,
- METH_VARARGS,
- "remove_flag($self, flag, /)\n--\n\nRemove a flag from the buffer line."
- },
- { NULL }
- };
-
- static PyGetSetDef py_buffer_line_getseters[] = {
- {
- "range", py_buffer_line_get_range, NULL,
- "Range covered by the line.", NULL
- },
- {
- "flags", py_buffer_line_get_flags, NULL,
- "Current flags of the buffer line.", NULL
- },
- { NULL }
- };
-
- static PyTypeObject py_buffer_line_type = {
-
- PyVarObject_HEAD_INIT(NULL, 0)
-
- .tp_name = "pychrysalide.glibext.BufferLine",
- .tp_basicsize = sizeof(PyGObject),
-
- .tp_flags = Py_TPFLAGS_DEFAULT,
-
- .tp_doc = "PyChrysalide buffer line",
-
- .tp_methods = py_buffer_line_methods,
- .tp_getset = py_buffer_line_getseters,
-
- };
-
- return &py_buffer_line_type;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Prend en charge l'objet 'pychrysalide.glibext.BufferLine'. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool register_python_buffer_line(PyObject *module)
-{
- PyTypeObject *py_buffer_line_type; /* Type Python 'BufferLine' */
- PyObject *dict; /* Dictionnaire du module */
-
- py_buffer_line_type = get_python_buffer_line_type();
-
- dict = PyModule_GetDict(module);
-
- if (!register_class_for_pygobject(dict, G_TYPE_BUFFER_LINE, py_buffer_line_type, &PyGObject_Type))
- return false;
-
- if (!py_buffer_line_define_constants(py_buffer_line_type))
- return false;
-
- return true;
-
-}
diff --git a/plugins/pychrysa/glibext/bufferline.h b/plugins/pychrysa/glibext/bufferline.h
deleted file mode 100644
index 86b567f..0000000
--- a/plugins/pychrysa/glibext/bufferline.h
+++ /dev/null
@@ -1,42 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * bufferline.h - prototypes pour l'équivalent Python du fichier "glibext/bufferline.h"
- *
- * Copyright (C) 2012-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#ifndef _PLUGINS_PYCHRYSA_GLIBEXT_BUFFERLINE_H
-#define _PLUGINS_PYCHRYSA_GLIBEXT_BUFFERLINE_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-
-
-/* Fournit un accès à une définition de type à diffuser. */
-PyTypeObject *get_python_buffer_line_type(void);
-
-/* Prend en charge l'objet 'pychrysalide.glibext.BufferLine'. */
-bool register_python_buffer_line(PyObject *);
-
-
-
-#endif /* _PLUGINS_PYCHRYSA_GLIBEXT_BUFFERLINE_H */
diff --git a/plugins/pychrysa/glibext/configuration.c b/plugins/pychrysa/glibext/configuration.c
deleted file mode 100644
index a780f73..0000000
--- a/plugins/pychrysa/glibext/configuration.c
+++ /dev/null
@@ -1,1165 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * configuration.c - prototypes pour l'équivalent Python du fichier "glibext/configuration.c"
- *
- * Copyright (C) 2014-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "configuration.h"
-
-
-#include <pygobject.h>
-
-
-#include <glibext/configuration.h>
-
-
-#include "../helpers.h"
-
-
-
-/* ---------------------------- ELEMENT DE CONFIGURATION ---------------------------- */
-
-
-/* Crée un nouvel objet Python de type 'ConfigParam'. */
-static PyObject *py_config_param_new(PyTypeObject *, PyObject *, PyObject *);
-
-/* Efface toute valeur courante d'un paramètre de configuration. */
-static PyObject *py_config_param_make_empty(PyObject *, PyObject *);
-
-/* Réinitialise la valeur d'un paramètre de configuration. */
-static PyObject *py_config_param_reset(PyObject *, PyObject *);
-
-/* Indique le chemin d'accès utilisé pour un paramètre. */
-static PyObject *py_config_param_get_path(PyObject *, void *);
-
-/* Indique le type de valeur utilisée par un paramètre. */
-static PyObject *py_config_param_get_type(PyObject *, void *);
-
-/* Indique le statut d'une valeur utilisée par un paramètre. */
-static PyObject *py_config_param_get_state(PyObject *, void *);
-
-/* Indique la valeur courante d'un paramètre de configuration. */
-static PyObject *py_config_param_get_value(PyObject *, void *);
-
-/* Modifie la valeur courante d'un paramètre de configuration. */
-static int py_config_param_set_value(PyObject *, PyObject *, void *);
-
-/* Définit les constantes pour les paramètres. */
-static bool py_config_param_define_constants(PyObject *);
-
-
-
-/* ----------------------------- PARCOURS DE PARAMETRES ----------------------------- */
-
-
-/* Parcours des éléments de configuration */
-typedef struct _pyConfigParamIterator
-{
- PyObject_HEAD /* A laisser en premier */
-
- GGenConfig *config; /* Configuration à parcourir */
- GList *params; /* Liste de paramètres */
-
- GList *last; /* Dernier élément retourné */
-
-} pyConfigParamIterator;
-
-
-/* Prend acte d'un compteur de référence à 0. */
-static void py_config_param_iterator_dealloc(PyObject *);
-
-/* Fournit un itérateur pour paramètres de configuration. */
-static PyObject *py_config_param_iterator_next(PyObject *);
-
-/* Initialise un objet Python de type 'ConfigParamIterator'. */
-static int py_config_param_iterator_init(PyObject *, PyObject *, PyObject *);
-
-
-
-/* ----------------------- GESTION GENERIQUE DE CONFIGURATION ----------------------- */
-
-
-/* Crée un nouvel objet Python de type 'GenConfig'. */
-static PyObject *py_generic_config_new(PyTypeObject *, PyObject *, PyObject *);
-
-/* Lit la configuration depuis un fichier. */
-static PyObject *py_generic_config_read(PyObject *, PyObject *);
-
-/* Ecrit la configuration dans un fichier. */
-static PyObject *py_generic_config_write(PyObject *, PyObject *);
-
-/* Retrouve un élément de configuration par son chemin. */
-static PyObject *py_generic_config_search(PyObject *, PyObject *);
-
-/* Ajoute un paramètre à une configuration. */
-static PyObject *py_generic_config_add(PyObject *, PyObject *);
-
-/* Retire un paramètre d'une configuration. */
-static PyObject *py_generic_config_delete(PyObject *, PyObject *);
-
-/* Fournit le chemin d'accès au binaire représenté. */
-static PyObject *py_generic_config_get_filename(PyObject *, void *);
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/* ELEMENT DE CONFIGURATION */
-/* ---------------------------------------------------------------------------------- */
-
-
-/******************************************************************************
-* *
-* Paramètres : type = type de l'objet à instancier. *
-* args = arguments fournis à l'appel. *
-* kwds = arguments de type key=val fournis. *
-* *
-* Description : Crée un nouvel objet Python de type 'ConfigParam'. *
-* *
-* Retour : Instance Python mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_config_param_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
- PyObject *result; /* Instance à retourner */
- const char *path; /* Accès au paramètre */
- unsigned int ptype; /* Type de paramètre */
- PyObject *value; /* Valeur par défaut éventuelle*/
- int ret; /* Bilan de lecture des args. */
- GCfgParam *param; /* Paramètre mis en place */
-
- value = NULL;
-
- ret = PyArg_ParseTuple(args, "sI|O", &path, &ptype, &value);
- if (!ret) Py_RETURN_NONE;
-
- if (value == NULL || value == Py_None)
- param = g_config_param_new_empty(path, ptype);
-
- else
- switch (ptype)
- {
- case CPT_BOOLEAN:
- if (PyBool_Check(value))
- param = g_config_param_new(path, CPT_BOOLEAN, (bool)(value == Py_True));
- else
- param = NULL;
- break;
-
- case CPT_INTEGER:
- if (PyLong_Check(value))
- param = g_config_param_new(path, CPT_INTEGER, (int)PyLong_AsLong(value));
- else
- param = NULL;
- break;
-
- case CPT_STRING:
- if (PyUnicode_Check(value))
- param = g_config_param_new(path, CPT_STRING, PyUnicode_DATA(value));
- else
- param = NULL;
- break;
-
- default:
- param = NULL;
- break;
-
- }
-
- if (param != NULL)
- {
- result = pygobject_new(G_OBJECT(param));
- g_object_unref(param);
- }
- else result = NULL;
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = paramètre de configuration à manipuler. *
-* args = non utilisé ici. *
-* *
-* Description : Efface toute valeur courante d'un paramètre de configuration.*
-* *
-* Retour : None. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_config_param_make_empty(PyObject *self, PyObject *args)
-{
- GCfgParam *param; /* Paramètre visé par l'opérat°*/
-
- param = G_CFG_PARAM(pygobject_get(self));
-
- g_config_param_make_empty(param);
-
- Py_RETURN_NONE;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = paramètre de configuration à manipuler. *
-* args = non utilisé ici. *
-* *
-* Description : Réinitialise la valeur d'un paramètre de configuration. *
-* *
-* Retour : None. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_config_param_reset(PyObject *self, PyObject *args)
-{
- GCfgParam *param; /* Paramètre visé par l'opérat°*/
-
- param = G_CFG_PARAM(pygobject_get(self));
-
- g_config_param_reset(param);
-
- Py_RETURN_NONE;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = paramètre de configuration à manipuler. *
-* closure = non utilisé ici. *
-* *
-* Description : Indique le chemin d'accès utilisé pour un paramètre. *
-* *
-* Retour : Chemin d'accès en Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_config_param_get_path(PyObject *self, void *closure)
-{
- GCfgParam *param; /* Paramètre visé par l'opérat°*/
- const char *path; /* Chemin d'accès à diffuser */
-
- param = G_CFG_PARAM(pygobject_get(self));
- path = g_config_param_get_path(param);
-
- return PyUnicode_FromString(path);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = paramètre de configuration à manipuler. *
-* closure = non utilisé ici. *
-* *
-* Description : Indique le type de valeur utilisée par un paramètre. *
-* *
-* Retour : Type en Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_config_param_get_type(PyObject *self, void *closure)
-{
- GCfgParam *param; /* Paramètre visé par l'opérat°*/
- ConfigParamType type; /* Type de paramètre */
-
- param = G_CFG_PARAM(pygobject_get(self));
- type = g_config_param_get_ptype(param);
-
- return PyLong_FromLong(type);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = paramètre de configuration à manipuler. *
-* closure = non utilisé ici. *
-* *
-* Description : Indique le statut d'une valeur utilisée par un paramètre. *
-* *
-* Retour : Etat en Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_config_param_get_state(PyObject *self, void *closure)
-{
- GCfgParam *param; /* Paramètre visé par l'opérat°*/
- ConfigParamState state; /* Statut de paramètre */
-
- param = G_CFG_PARAM(pygobject_get(self));
- state = g_config_param_get_state(param);
-
- return PyLong_FromLong(state);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = paramètre de configuration à manipuler. *
-* closure = non utilisé ici. *
-* *
-* Description : Indique la valeur courante d'un paramètre de configuration. *
-* *
-* Retour : Etat en Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_config_param_get_value(PyObject *self, void *closure)
-{
- PyObject *result; /* Valeur à retourner */
- GCfgParam *param; /* Paramètre visé par l'opérat°*/
- ConfigParamType type; /* Type de paramètre manipulé */
- bool boolean; /* Valeur booléenne */
- int integer; /* Valeur entière */
- char *string; /* Chaîne de caractères */
-
- param = G_CFG_PARAM(pygobject_get(self));
- type = g_config_param_get_ptype(param);
-
- switch (type)
- {
- case CPT_BOOLEAN:
- g_config_param_get_value(param, &boolean);
- result = (boolean ? Py_True : Py_False);
- Py_INCREF(result);
- break;
-
- case CPT_INTEGER:
- g_config_param_get_value(param, &integer);
- result = PyLong_FromLong(integer);
- break;
-
- case CPT_STRING:
- g_config_param_get_value(param, &string);
- if (string != NULL)
- result = PyUnicode_FromString(string);
- else
- {
- result = Py_None;
- Py_INCREF(result);
- }
- break;
-
- default:
- result = NULL;
- break;
-
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = paramètre de configuration à manipuler. *
-* value = nouvelle valeur à convertir et définir. *
-* closure = non utilisé ici. *
-* *
-* Description : Modifie la valeur courante d'un paramètre de configuration. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static int py_config_param_set_value(PyObject *self, PyObject *value, void *closure)
-{
- int result; /* Conclusion à remonter */
- GCfgParam *param; /* Paramètre visé par l'opérat°*/
- ConfigParamType type; /* Type de paramètre manipulé */
-
- result = -1;
-
- param = G_CFG_PARAM(pygobject_get(self));
-
- if (value == Py_None)
- {
- g_config_param_make_empty(param);
- result = 0;
- }
-
- else
- {
- type = g_config_param_get_ptype(param);
-
- switch (type)
- {
- case CPT_BOOLEAN:
- if (PyBool_Check(value))
- {
- g_config_param_set_value(param, (bool)(value == Py_True));
- result = 0;
- }
- break;
-
- case CPT_INTEGER:
- if (PyLong_Check(value))
- {
- g_config_param_set_value(param, (int)PyLong_AsLong(value));
- result = 0;
- }
- break;
-
- case CPT_STRING:
- if (PyUnicode_Check(value))
- {
- g_config_param_set_value(param, PyUnicode_DATA(value));
- result = 0;
- }
- break;
-
- default:
- break;
-
- }
-
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit un accès à une définition de type à diffuser. *
-* *
-* Retour : Définition d'objet pour Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyTypeObject *get_python_config_param_type(void)
-{
- static PyMethodDef py_config_param_methods[] = {
- { "make_empty", py_config_param_make_empty,
- METH_NOARGS,
- "Unset the value of the current parameter."
- },
- { "reset", py_config_param_reset,
- METH_NOARGS,
- "Reset the content of the current parameter."
- },
- { NULL }
- };
-
- static PyGetSetDef py_config_param_getseters[] = {
- {
- "path", py_config_param_get_path, NULL,
- "Show the path used as key for a configuration parameter.", NULL
- },
- {
- "type", py_config_param_get_type, NULL,
- "Show the type of value provided by a configuration parameter.", NULL
- },
- {
- "state", py_config_param_get_state, NULL,
- "Show the state of a configuration parameter.", NULL
- },
- {
- "value", py_config_param_get_value, py_config_param_set_value,
- "Handle the value of a configuration parameter.", NULL
- },
- { NULL }
- };
-
- static PyTypeObject py_config_param_type = {
-
- PyVarObject_HEAD_INIT(NULL, 0)
-
- .tp_name = "pychrysalide.glibext.ConfigParam",
- .tp_basicsize = sizeof(PyGObject),
-
- .tp_flags = Py_TPFLAGS_DEFAULT,
-
- .tp_doc = "PyChrysalide generic configuration",
-
- .tp_methods = py_config_param_methods,
- .tp_getset = py_config_param_getseters,
- .tp_new = (newfunc)py_config_param_new
-
- };
-
- return &py_config_param_type;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : dict = dictionnaire à compléter. *
-* *
-* Description : Définit les constantes pour les paramètres. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool py_config_param_define_constants(PyObject *dict)
-{
- int ret; /* Bilan d'un ajout */
-
-#define DEF_ULONG_CONST(name) \
- ret = PyDict_SetItemString(dict, #name, PyLong_FromUnsignedLong(name)); \
- if (ret == -1) return false;
-
- DEF_ULONG_CONST(CPT_BOOLEAN);
- DEF_ULONG_CONST(CPT_INTEGER);
- DEF_ULONG_CONST(CPT_STRING);
- DEF_ULONG_CONST(CPT_COUNT);
-
- DEF_ULONG_CONST(CPS_UNDEFINED);
- DEF_ULONG_CONST(CPS_CHANGED);
- DEF_ULONG_CONST(CPS_DEFAULT);
- DEF_ULONG_CONST(CPS_EMPTY);
-
- return true;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Prend en charge l'objet 'pychrysalide.glibext.ConfigParam'. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool register_python_config_param(PyObject *module)
-{
- PyTypeObject *py_config_param_type; /* Type Python 'ConfigParam' */
- PyObject *dict; /* Dictionnaire du module */
-
- py_config_param_type = get_python_config_param_type();
-
- dict = PyModule_GetDict(module);
-
- if (!register_class_for_pygobject(dict, G_TYPE_CFG_PARAM, py_config_param_type, &PyGObject_Type))
- return false;
-
- if (!py_config_param_define_constants(py_config_param_type->tp_dict))
- return false;
-
- return true;
-
-}
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/* PARCOURS DE PARAMETRES */
-/* ---------------------------------------------------------------------------------- */
-
-
-/******************************************************************************
-* *
-* Paramètres : self = instance Python à libérer de la mémoire. *
-* *
-* Description : Prend acte d'un compteur de référence à 0. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void py_config_param_iterator_dealloc(PyObject *self)
-{
- pyConfigParamIterator *iterator; /* Références pour le parcours */
-
- /**
- * Il aurait été sans doute mieux de reposer ici sur .tp_finalize,
- * mais cela semble impliquer de mettre en place tous les mécanismes de GC...
- *
- * cf. https://docs.python.org/3/extending/newtypes.html#finalization-and-de-allocation
- */
-
- iterator = (pyConfigParamIterator *)self;
-
- g_generic_config_runlock(iterator->config);
- g_object_unref(G_OBJECT(iterator->config));
-
- Py_TYPE(self)->tp_free((PyObject *)self);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = itérateur à manipuler. *
-* *
-* Description : Fournit un itérateur pour paramètres de configuration. *
-* *
-* Retour : Instance Python prête à emploi. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_config_param_iterator_next(PyObject *self)
-{
- PyObject *result; /* Instance à retourner */
- pyConfigParamIterator *iterator; /* Références pour le parcours */
- GList *item; /* Nouvel élément courant */
-
- iterator = (pyConfigParamIterator *)self;
-
- if (iterator->last == NULL) item = iterator->params;
- else item = g_list_next(iterator->last);
-
- iterator->last = item;
-
- if (item != NULL)
- {
- result = pygobject_new(G_OBJECT(item->data));
- Py_INCREF(result);
- }
- else
- {
- PyErr_SetNone(PyExc_StopIteration);
- result = NULL;
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = objet instancié à initialiser. *
-* args = arguments fournis à l'appel. *
-* kwds = arguments de type key=val fournis. *
-* *
-* Description : Initialise un objet Python de type 'ConfigParamIterator'. *
-* *
-* Retour : Instance Python mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static int py_config_param_iterator_init(PyObject *self, PyObject *args, PyObject *kwds)
-{
- pyConfigParamIterator *iterator; /* Références pour le parcours */
- PyObject *config; /* Configuration format Python */
- int ret; /* Bilan de lecture des args. */
-
- ret = PyArg_ParseTuple(args, "O", &config);
- if (!ret) return -1;
-
- ret = PyObject_IsInstance(config, (PyObject *)get_python_generic_config_type());
- if (!ret) return -1;
-
- iterator = (pyConfigParamIterator *)self;
-
- iterator->config = G_GEN_CONFIG(pygobject_get(config));
- g_object_ref(G_OBJECT(iterator->config));
-
- g_generic_config_rlock(iterator->config);
-
- iterator->params = g_generic_config_list_params(iterator->config);
-
- iterator->last = NULL;
-
- return 0;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit un accès à une définition de type à diffuser. *
-* *
-* Retour : Définition d'objet pour Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyTypeObject *get_python_config_param_iterator_type(void)
-{
- static PyTypeObject py_config_param_iterator_type = {
-
- PyVarObject_HEAD_INIT(NULL, 0)
-
- .tp_name = "pychrysalide.glibext.ConfigParamIterator",
- .tp_basicsize = sizeof(pyConfigParamIterator),
-
- .tp_dealloc = py_config_param_iterator_dealloc,
-
- .tp_flags = Py_TPFLAGS_DEFAULT,
-
- .tp_doc = "Iterator for configuration parameters",
-
- .tp_iter = PyObject_SelfIter,
- .tp_iternext = py_config_param_iterator_next,
-
- .tp_init = py_config_param_iterator_init,
-
- .tp_new = PyType_GenericNew,
-
- };
-
- return &py_config_param_iterator_type;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Prend en charge l'objet 'pychrysalide...ConfigParamIterator'.*
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool register_python_config_param_iterator(PyObject *module)
-{
- PyTypeObject *py_config_param_iterator_type;/* Type Python 'Cnf...Iter'*/
- int ret; /* Bilan d'un appel */
-
- py_config_param_iterator_type = get_python_config_param_iterator_type();
-
- py_config_param_iterator_type->tp_base = &PyBaseObject_Type;
-
- if (PyType_Ready(py_config_param_iterator_type) != 0)
- return false;
-
- Py_INCREF(py_config_param_iterator_type);
- ret = PyModule_AddObject(module, "ConfigParamIterator", (PyObject *)py_config_param_iterator_type);
- if (ret != 0) return false;
-
- return true;
-
-}
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/* GESTION GENERIQUE DE CONFIGURATION */
-/* ---------------------------------------------------------------------------------- */
-
-
-/******************************************************************************
-* *
-* Paramètres : type = type de l'objet à instancier. *
-* args = arguments fournis à l'appel. *
-* kwds = arguments de type key=val fournis. *
-* *
-* Description : Crée un nouvel objet Python de type 'GenConfig'. *
-* *
-* Retour : Instance Python mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_generic_config_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
- PyObject *result; /* Instance à retourner */
- const char *name; /* Nom du fichier à charger */
- int ret; /* Bilan de lecture des args. */
- GGenConfig *config; /* Version GLib du format */
-
- ret = PyArg_ParseTuple(args, "s", &name);
- if (!ret) Py_RETURN_NONE;
-
- config = g_generic_config_new(name);
-
- result = pygobject_new(G_OBJECT(config));
- g_object_unref(config);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = configuration à manipuler. *
-* args = non utilisé ici. *
-* *
-* Description : Lit la configuration depuis un fichier. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_generic_config_read(PyObject *self, PyObject *args)
-{
- PyObject *result; /* Instance à retourner */
- GGenConfig *config; /* Version GLib du format */
- bool status; /* Bilan de l'opération */
-
- config = G_GEN_CONFIG(pygobject_get(self));
-
- status = g_generic_config_read(config);
-
- result = status ? Py_True : Py_False;
- Py_INCREF(result);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = configuration à manipuler. *
-* args = non utilisé ici. *
-* *
-* Description : Ecrit la configuration dans un fichier. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_generic_config_write(PyObject *self, PyObject *args)
-{
- PyObject *result; /* Instance à retourner */
- GGenConfig *config; /* Version GLib du format */
- bool status; /* Bilan de l'opération */
-
- config = G_GEN_CONFIG(pygobject_get(self));
-
- status = g_generic_config_write(config);
-
- result = status ? Py_True : Py_False;
- Py_INCREF(result);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = configuration à manipuler. *
-* args = indication sur l'élément à retrouver. *
-* *
-* Description : Retrouve un élément de configuration par son chemin. *
-* *
-* Retour : Elément trouvé ou NULL en cas d'échec. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_generic_config_search(PyObject *self, PyObject *args)
-{
- PyObject *result; /* Instance à retourner */
- GGenConfig *config; /* Version GLib du format */
- const char *path; /* Chemin d'accès du paramètre */
- int ret; /* Bilan de lecture des args. */
- GCfgParam *param; /* Paramètre trouvé ou NULL */
-
- config = G_GEN_CONFIG(pygobject_get(self));
-
- ret = PyArg_ParseTuple(args, "s", &path);
- if (!ret) Py_RETURN_NONE;
-
- param = g_generic_config_search(config, path);
-
- result = pygobject_new(G_OBJECT(param));
- Py_XINCREF(result);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = configuration à manipuler. *
-* args = indication sur l'élément à retrouver. *
-* *
-* Description : Ajoute un paramètre à une configuration. *
-* *
-* Retour : Elément ajouté ou NULL en cas d'échec. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_generic_config_add(PyObject *self, PyObject *args)
-{
- PyObject *result; /* Instance à retourner */
- GGenConfig *config; /* Version GLib du format */
- PyObject *param; /* Paramètre transmis */
- int ret; /* Bilan de lecture des args. */
- GCfgParam *added; /* Elément ajouté ou NULL */
-
- config = G_GEN_CONFIG(pygobject_get(self));
-
- ret = PyArg_ParseTuple(args, "O", &param);
- if (!ret) Py_RETURN_NONE;
-
- ret = PyObject_IsInstance(param, (PyObject *)get_python_config_param_type());
- if (!ret) Py_RETURN_NONE;
-
- added = g_generic_config_add_param(config, G_CFG_PARAM(pygobject_get(param)));
-
- if (added != NULL)
- {
- result = pygobject_new(G_OBJECT(added));
- Py_XINCREF(result);
- }
- else
- result = NULL;
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = configuration à manipuler. *
-* args = indication sur l'élément à retrouver. *
-* *
-* Description : Retire un paramètre d'une configuration. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_generic_config_delete(PyObject *self, PyObject *args)
-{
- GGenConfig *config; /* Version GLib du format */
- const char *path; /* Chemin d'accès du paramètre */
- int ret; /* Bilan de lecture des args. */
-
- config = G_GEN_CONFIG(pygobject_get(self));
-
- ret = PyArg_ParseTuple(args, "s", &path);
- if (!ret) Py_RETURN_NONE;
-
- g_generic_config_delete_param(config, path);
-
- Py_RETURN_NONE;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = configuration à manipuler. *
-* args = non utilisé ici. *
-* *
-* Description : Renvoie la liste des paramètres de configuration. *
-* *
-* Retour : Itérateur pour la liste des paramètres. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_generic_config_list_params(PyObject *self, PyObject *args)
-{
- PyObject *result; /* Instance à retourner */
- PyTypeObject *iterator_type; /* Type Python de l'itérateur */
- PyObject *args_list; /* Arguments de mise en place */
-
- iterator_type = get_python_config_param_iterator_type();
-
- Py_INCREF(self);
-
- args_list = Py_BuildValue("(O)", self);
- result = PyObject_CallObject((PyObject *)iterator_type, args_list);
-
- Py_DECREF(args_list);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = NULL car méthode statique. *
-* closure = non utilisé ici. *
-* *
-* Description : Fournit le chemin d'accès au binaire représenté. *
-* *
-* Retour : Chemin d'accès en Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_generic_config_get_filename(PyObject *self, void *closure)
-{
- GGenConfig *config; /* Version GLib du format */
- const char *filename; /* Chemin d'accès au fichier */
-
- config = G_GEN_CONFIG(pygobject_get(self));
-
- filename = g_generic_config_get_filename(config);
-
- return PyUnicode_FromString(filename);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit un accès à une définition de type à diffuser. *
-* *
-* Retour : Définition d'objet pour Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyTypeObject *get_python_generic_config_type(void)
-{
- static PyMethodDef py_generic_config_methods[] = {
- { "read", py_generic_config_read,
- METH_NOARGS,
- "Read the configuration from its relative XML file."
- },
- { "write", py_generic_config_write,
- METH_NOARGS,
- "Write the configuration to its relative XML file."
- },
- { "search", py_generic_config_search,
- METH_VARARGS,
- "Look for a given configuration parameter."
- },
- { "add", py_generic_config_add,
- METH_VARARGS,
- "Add an existing parameter to a configuration."
- },
- { "delete", py_generic_config_delete,
- METH_VARARGS,
- "Delete an existing parameter from a configuration."
- },
- { "params", py_generic_config_list_params,
- METH_NOARGS,
- "List all registered configuration parameters."
- },
- { NULL }
- };
-
- static PyGetSetDef py_generic_config_getseters[] = {
- {
- "filename", py_generic_config_get_filename, NULL,
- "Show the filename of the loaded binary file.", NULL
- },
- { NULL }
- };
-
- static PyTypeObject py_generic_config_type = {
-
- PyVarObject_HEAD_INIT(NULL, 0)
-
- .tp_name = "pychrysalide.glibext.GenConfig",
- .tp_basicsize = sizeof(PyGObject),
-
- .tp_flags = Py_TPFLAGS_DEFAULT,
-
- .tp_doc = "PyChrysalide generic configuration",
-
- .tp_methods = py_generic_config_methods,
- .tp_getset = py_generic_config_getseters,
- .tp_new = (newfunc)py_generic_config_new
-
- };
-
- return &py_generic_config_type;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Prend en charge l'objet 'pychrysalide.glibext.GenConfig'. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool register_python_generic_config(PyObject *module)
-{
- PyTypeObject *py_generic_config_type; /* Type Python 'GenConfig' */
- PyObject *dict; /* Dictionnaire du module */
-
- py_generic_config_type = get_python_generic_config_type();
-
- dict = PyModule_GetDict(module);
-
- if (!register_class_for_pygobject(dict, G_TYPE_GEN_CONFIG, py_generic_config_type, &PyGObject_Type))
- return false;
-
- return true;
-
-}
diff --git a/plugins/pychrysa/glibext/configuration.h b/plugins/pychrysa/glibext/configuration.h
deleted file mode 100644
index ec1a3d7..0000000
--- a/plugins/pychrysa/glibext/configuration.h
+++ /dev/null
@@ -1,66 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * configuration.h - prototypes pour l'équivalent Python du fichier "glibext/configuration.h"
- *
- * Copyright (C) 2014-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#ifndef _PLUGINS_PYCHRYSA_GLIBEXT_CONFIGURATION_H
-#define _PLUGINS_PYCHRYSA_GLIBEXT_CONFIGURATION_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-
-
-/* ---------------------------- ELEMENT DE CONFIGURATION ---------------------------- */
-
-
-/* Fournit un accès à une définition de type à diffuser. */
-PyTypeObject *get_python_config_param_type(void);
-
-/* Prend en charge l'objet 'pychrysalide.glibext.ConfigParam'. */
-bool register_python_config_param(PyObject *);
-
-
-
-/* ----------------------------- PARCOURS DE PARAMETRES ----------------------------- */
-
-
-/* Fournit un accès à une définition de type à diffuser. */
-PyTypeObject *get_python_config_param_iterator_type(void);
-
-/* Prend en charge l'objet 'pychrysalide.glibext.ConfigParamIterator'. */
-bool register_python_config_param_iterator(PyObject *);
-
-
-/* ----------------------- GESTION GENERIQUE DE CONFIGURATION ----------------------- */
-
-
-/* Fournit un accès à une définition de type à diffuser. */
-PyTypeObject *get_python_generic_config_type(void);
-
-/* Prend en charge l'objet 'pychrysalide.glibext.GenConfig'. */
-bool register_python_generic_config(PyObject *);
-
-
-
-#endif /* _PLUGINS_PYCHRYSA_GLIBEXT_CONFIGURATION_H */
diff --git a/plugins/pychrysa/glibext/linegen.c b/plugins/pychrysa/glibext/linegen.c
deleted file mode 100644
index b6aad6b..0000000
--- a/plugins/pychrysa/glibext/linegen.c
+++ /dev/null
@@ -1,404 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * linegen.c - équivalent Python du fichier "glibext/linegen.h"
- *
- * Copyright (C) 2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "linegen.h"
-
-
-#include <pygobject.h>
-
-
-#include <common/cpp.h>
-#include <glibext/linegen.h>
-
-
-#include "../helpers.h"
-#include "../analysis/content.h"
-#include "../arch/vmpa.h"
-#include "../glibext/bufferline.h"
-
-
-
-/* Indique le nombre de ligne prêtes à être générées. */
-static PyObject *py_line_generator_count_lines(PyObject *, PyObject *);
-
-/* Retrouve l'emplacement correspondant à une position donnée. */
-static PyObject *py_line_generator_compute_addr(PyObject *, PyObject *);
-
-/* Détermine si le conteneur s'inscrit dans une plage donnée. */
-static PyObject *py_line_generator_contains_addr(PyObject *, PyObject *);
-
-/* Renseigne sur les propriétés liées à un générateur. */
-static PyObject *py_line_generator_get_flags(PyObject *, PyObject *);
-
-/* Imprime dans une ligne de rendu le contenu représenté. */
-static PyObject *py_line_generator_print(PyObject *, PyObject *);
-
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe représentant un générateur à manipuler. *
-* args = arguments fournis à l'appel. *
-* *
-* Description : Indique le nombre de ligne prêtes à être générées. *
-* *
-* Retour : Nombre de lignes devant apparaître au final. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_line_generator_count_lines(PyObject *self, PyObject *args)
-{
- PyObject *result; /* Décompte à retourner */
- GLineGenerator *generator; /* Version native */
- size_t count; /* Nombre de lignes présentes */
-
- generator = G_LINE_GENERATOR(pygobject_get(self));
-
- count = g_line_generator_count_lines(generator);
-
- result = Py_BuildValue("k", count);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe représentant un générateur à manipuler. *
-* args = arguments fournis à l'appel. *
-* *
-* Description : Retrouve l'emplacement correspondant à une position donnée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_line_generator_compute_addr(PyObject *self, PyObject *args)
-{
- PyObject *result; /* Localisation à retourner */
- GLineGenerator *generator; /* Version native */
- gint x; /* Position géographique */
- size_t index; /* Indice dans le tampon */
- size_t repeat; /* Utilisations successives */
- int ret; /* Bilan de lecture des args. */
- vmpa2t addr; /* Adresse visée par l'opérat° */
-
- generator = G_LINE_GENERATOR(pygobject_get(self));
-
- ret = PyArg_ParseTuple(args, "ikk", &x, &index, &repeat);
- if (!ret) return NULL;
-
- g_line_generator_compute_addr(generator, x, &addr, index, repeat);
-
- result = build_from_internal_vmpa(&addr);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe représentant un générateur à manipuler. *
-* args = arguments fournis à l'appel. *
-* *
-* Description : Détermine si le conteneur s'inscrit dans une plage donnée. *
-* *
-* Retour : Bilan de la détermination, utilisable en comparaisons. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_line_generator_contains_addr(PyObject *self, PyObject *args)
-{
- GLineGenerator *generator; /* Version native */
- PyObject *py_vmpa; /* Localisation version Python */
- size_t index; /* Indice dans le tampon */
- size_t repeat; /* Utilisations successives */
- int ret; /* Bilan de lecture des args. */
- vmpa2t *addr; /* Adresse visée par l'opérat° */
-
- generator = G_LINE_GENERATOR(pygobject_get(self));
-
- ret = PyArg_ParseTuple(args, "O!kk", get_python_vmpa_type(), &py_vmpa, &index, &repeat);
- if (!ret) return NULL;
-
- addr = get_internal_vmpa(py_vmpa);
- if (addr == NULL) return NULL;
-
- g_line_generator_contains_addr(generator, addr, index, repeat);
-
- Py_RETURN_NONE;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe représentant un générateur à manipuler. *
-* args = arguments fournis à l'appel. *
-* *
-* Description : Renseigne sur les propriétés liées à un générateur. *
-* *
-* Retour : Propriétés particulières associées. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_line_generator_get_flags(PyObject *self, PyObject *args)
-{
- PyObject *result; /* Propriétés à retourner */
- GLineGenerator *generator; /* Version native */
- size_t index; /* Indice dans le tampon */
- size_t repeat; /* Utilisations successives */
- int ret; /* Bilan de lecture des args. */
- BufferLineFlags flags; /* Propriétés courantes */
-
- generator = G_LINE_GENERATOR(pygobject_get(self));
-
- ret = PyArg_ParseTuple(args, "kk", &index, &repeat);
- if (!ret) return NULL;
-
- flags = g_line_generator_get_flags(generator, index, repeat);
-
- result = Py_BuildValue("I", flags);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe représentant un générateur à manipuler. *
-* args = arguments fournis à l'appel. *
-* *
-* Description : Imprime dans une ligne de rendu le contenu représenté. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_line_generator_print(PyObject *self, PyObject *args)
-{
- GLineGenerator *generator; /* Version native */
- PyObject *py_line; /* Ligne version Python */
- size_t index; /* Indice dans le tampon */
- size_t repeat; /* Utilisations successives */
- PyObject *py_content; /* Contenu version Python */
- int ret; /* Bilan de lecture des args. */
- GBufferLine *line; /* Ligne de rendu à compléter */
- GBinContent *content; /* Contenu binaire associé */
-
- generator = G_LINE_GENERATOR(pygobject_get(self));
-
- ret = PyArg_ParseTuple(args, "O!kkO!", get_python_buffer_line_type(), &py_line, &index,
- &repeat, get_python_binary_content_type(), &py_content);
- if (!ret) return NULL;
-
- line = G_BUFFER_LINE(pygobject_get(py_line));
-
- content = G_BIN_CONTENT(pygobject_get(py_content));
-
- g_line_generator_print(generator, line, index, repeat, content);
-
- Py_RETURN_NONE;
-
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-#if 0
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit un accès à une définition de type à diffuser. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void python_line_generator_interface_init(GLineGeneratorIface *iface, PyTypeObject *type)
-{
- GLineGeneratorIface *parent; /* Défintion parente */
- size_t i; /* Boucle de parcours */
- PyObject *method; /* Méthode à associer */
-
- static const char *meth_names[] = {
- "count_lines",
- "compute_addr",
- "contains_addr",
- "get_flags",
- "print"
- };
-
- parent = g_type_interface_peek_parent(iface);
-
- for (i = 0; i < ARRAY_SIZE(meth_names); i++)
- {
- method = NULL;
-
- if (type != NULL)
- method = PyObject_GetAttrString((PyObject *)type, meth_names[i]);
-
- if (method != NULL && PyObject_TypeCheck(method, &PyCFunction_Type) == 0)
- /*iface->iface_method = _wrap_TestInterface__proxy_do_iface_method*/;
-
- else
- {
- PyErr_Clear();
-
- if (parent != NULL)
- /*iface->iface_method = parent->iface_method*/;
-
- }
-
- Py_XDECREF(method);
-
- }
-
-}
-
-
-#endif
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit un accès à une définition de type à diffuser. *
-* *
-* Retour : Définition d'objet pour Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyTypeObject *get_python_line_generator_type(void)
-{
- static PyMethodDef py_line_generator_methods[] = {
- {
- "count_lines", py_line_generator_count_lines,
- METH_NOARGS,
- "count_lines($self, /)\n--\n\nCount the number of lines which can be displayed."
- },
- {
- "compute_addr", py_line_generator_compute_addr,
- METH_VARARGS,
- "compute_addr($self, x, index, repeat, /)\n--\n\nReturn the position at a given location."
- },
- {
- "contains_addr", py_line_generator_contains_addr,
- METH_VARARGS,
- "contains_addr($self, addr, index, repeat, /)\n--\n\nTell if the generator contains an address."
- },
- {
- "get_flags", py_line_generator_get_flags,
- METH_VARARGS,
- "get_flags($self, index, repeat, /)\n--\n\nGet the flags of a position from the generator."
- },
- {
- "print", py_line_generator_print,
- METH_VARARGS,
- "print($self, line, index, repeat, content, /)\n--\n\nProduce output into a line from content."
- },
- { NULL }
- };
-
- static PyGetSetDef py_line_generator_getseters[] = {
- { NULL }
- };
-
- static PyTypeObject py_line_generator_type = {
-
- PyVarObject_HEAD_INIT(NULL, 0)
-
- .tp_name = "pychrysalide.glibext.LineGenerator",
- //.tp_basicsize = sizeof(PyGObject),
-
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-
- .tp_doc = "PyChrysalide line content generator",
-
- .tp_methods = py_line_generator_methods,
- .tp_getset = py_line_generator_getseters,
-
- };
-
- return &py_line_generator_type;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Prend en charge l'objet 'pychrysalide.glibext.LineGenerator'.*
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool register_python_line_generator(PyObject *module)
-{
- PyTypeObject *py_line_generator_type; /* Type Python 'LineGenerator' */
- PyObject *dict; /* Dictionnaire du module */
-
- py_line_generator_type = get_python_line_generator_type();
-
- dict = PyModule_GetDict(module);
- pyg_register_interface(dict, "LineGenerator", G_TYPE_LINE_GENERATOR, py_line_generator_type);
-
- return true;
-
-}
diff --git a/plugins/pychrysa/glibext/linegen.h b/plugins/pychrysa/glibext/linegen.h
deleted file mode 100644
index 8669bb7..0000000
--- a/plugins/pychrysa/glibext/linegen.h
+++ /dev/null
@@ -1,42 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * linegen.h - prototypes pour l'équivalent Python du fichier "glibext/linegen.h"
- *
- * Copyright (C) 2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#ifndef _PLUGINS_PYCHRYSA_GLIBEXT_LINEGEN_H
-#define _PLUGINS_PYCHRYSA_GLIBEXT_LINEGEN_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-
-
-/* Fournit un accès à une définition de type à diffuser. */
-PyTypeObject *get_python_line_generator_type(void);
-
-/* Prend en charge l'objet 'pychrysalide.glibext.LineGenerator'. */
-bool register_python_line_generator(PyObject *);
-
-
-
-#endif /* _PLUGINS_PYCHRYSA_GLIBEXT_LINEGEN_H */
diff --git a/plugins/pychrysa/glibext/loadedpanel.c b/plugins/pychrysa/glibext/loadedpanel.c
deleted file mode 100644
index f831607..0000000
--- a/plugins/pychrysa/glibext/loadedpanel.c
+++ /dev/null
@@ -1,166 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * loadedpanel.c - équivalent Python du fichier "glibext/gloadedpanel.h"
- *
- * Copyright (C) 2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "loadedpanel.h"
-
-
-#include <pygobject.h>
-
-
-#include <glibext/gloadedpanel.h>
-
-
-
-
-/* Retrouve l'emplacement correspondant à une position donnée. */
-//static PyObject *py_loaded_panel_compute_addr(PyObject *, PyObject *);
-
-
-
-
-#if 0
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe représentant un générateur à manipuler. *
-* args = arguments fournis à l'appel. *
-* *
-* Description : Retrouve l'emplacement correspondant à une position donnée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_loaded_panel_compute_addr(PyObject *self, PyObject *args)
-{
- PyObject *result; /* Localisation à retourner */
- GLineGenerator *generator; /* Version native */
- gint x; /* Position géographique */
- size_t index; /* Indice dans le tampon */
- size_t repeat; /* Utilisations successives */
- int ret; /* Bilan de lecture des args. */
- vmpa2t addr; /* Adresse visée par l'opérat° */
-
- generator = G_LOADED_PANEL(pygobject_get(self));
-
- ret = PyArg_ParseTuple(args, "ikk", &x, &index, &repeat);
- if (!ret) return NULL;
-
- g_loaded_panel_compute_addr(generator, x, &addr, index, repeat);
-
- result = build_from_internal_vmpa(&addr);
-
- return result;
-
-}
-
-#endif
-
-
-
-
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit un accès à une définition de type à diffuser. *
-* *
-* Retour : Définition d'objet pour Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyTypeObject *get_python_loaded_panel_type(void)
-{
- static PyMethodDef py_loaded_panel_methods[] = {
- /*
- {
- "compute_addr", py_loaded_panel_compute_addr,
- METH_VARARGS,
- "compute_addr($self, x, index, repeat, /)\n--\n\nReturn the position at a given location."
- },
- */
- { NULL }
- };
-
- static PyGetSetDef py_loaded_panel_getseters[] = {
- { NULL }
- };
-
- static PyTypeObject py_loaded_panel_type = {
-
- PyVarObject_HEAD_INIT(NULL, 0)
-
- .tp_name = "pychrysalide.glibext.LoadedPanel",
- //.tp_basicsize = sizeof(PyGObject),
-
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-
- .tp_doc = "PyChrysalide loaded panel",
-
- .tp_methods = py_loaded_panel_methods,
- .tp_getset = py_loaded_panel_getseters,
-
- };
-
- return &py_loaded_panel_type;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Prend en charge l'objet 'pychrysalide.glibext.LoadedPanel'. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool register_python_loaded_panel(PyObject *module)
-{
- PyTypeObject *py_loaded_panel_type; /* Type Python 'LineGenerator' */
- PyObject *dict; /* Dictionnaire du module */
-
- py_loaded_panel_type = get_python_loaded_panel_type();
-
- dict = PyModule_GetDict(module);
- pyg_register_interface(dict, "LoadedPanel", G_TYPE_LOADED_PANEL, py_loaded_panel_type);
-
- return true;
-
-}
diff --git a/plugins/pychrysa/glibext/loadedpanel.h b/plugins/pychrysa/glibext/loadedpanel.h
deleted file mode 100644
index a133983..0000000
--- a/plugins/pychrysa/glibext/loadedpanel.h
+++ /dev/null
@@ -1,42 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * loadedpanel.h - prototypes pour l'équivalent Python du fichier "glibext/gloadedpanel.h"
- *
- * Copyright (C) 2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#ifndef _PLUGINS_PYCHRYSA_GLIBEXT_LOADEDPANEL_H
-#define _PLUGINS_PYCHRYSA_GLIBEXT_LOADEDPANEL_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-
-
-/* Fournit un accès à une définition de type à diffuser. */
-PyTypeObject *get_python_loaded_panel_type(void);
-
-/* Prend en charge l'objet 'pychrysalide.glibext.LoadedPanel'. */
-bool register_python_loaded_panel(PyObject *);
-
-
-
-#endif /* _PLUGINS_PYCHRYSA_GLIBEXT_LOADEDPANEL_H */
diff --git a/plugins/pychrysa/glibext/module.c b/plugins/pychrysa/glibext/module.c
deleted file mode 100644
index a3b0a25..0000000
--- a/plugins/pychrysa/glibext/module.c
+++ /dev/null
@@ -1,103 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * module.c - intégration du répertoire glibext en tant que module
- *
- * Copyright (C) 2012-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "module.h"
-
-
-#include <assert.h>
-
-
-#include "buffercache.h"
-#include "bufferline.h"
-#include "configuration.h"
-#include "linegen.h"
-#include "loadedpanel.h"
-#include "../access.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Ajoute le module 'glibext' au module Python. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool add_glibext_module_to_python_module(PyObject *super)
-{
- bool result; /* Bilan à retourner */
- PyObject *module; /* Sous-module mis en place */
- int ret; /* Bilan d'un appel */
-
- 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,
-
- };
-
- 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, "glibext", module);
- if (ret != 0) goto agmtpm_exit;
-
- result = true;
-
- result &= register_python_buffer_cache(module);
- result &= register_python_buffer_line(module);
- result &= register_python_config_param(module);
- result &= register_python_config_param_iterator(module);
- result &= register_python_generic_config(module);
- result &= register_python_line_generator(module);
- result &= register_python_loaded_panel(module);
-
- if (result)
- register_access_to_python_module("pychrysalide.glibext", module);
-
- agmtpm_exit:
-
- assert(result);
-
- return result;
-
-}
diff --git a/plugins/pychrysa/glibext/module.h b/plugins/pychrysa/glibext/module.h
deleted file mode 100644
index 5a29cca..0000000
--- a/plugins/pychrysa/glibext/module.h
+++ /dev/null
@@ -1,39 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * module.h - prototypes pour l'intégration du répertoire glibext en tant que module
- *
- * Copyright (C) 2012-2017 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#ifndef _PLUGINS_PYCHRYSALIDE_GLIBEXT_MODULE_H
-#define _PLUGINS_PYCHRYSALIDE_GLIBEXT_MODULE_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-
-
-/* Ajoute le module 'glibext' au module Python. */
-bool add_glibext_module_to_python_module(PyObject *);
-
-
-
-#endif /* _PLUGINS_PYOIDA_GLIBEXT_MODULE_H */