summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/gui/panels
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-03-26 22:05:49 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-03-26 22:05:49 (GMT)
commitadddee10e395524778c026bf577e885cd8f5947d (patch)
tree6368bccad32f2fdb68bcebd35d5623e48d8d1ba0 /plugins/pychrysalide/gui/panels
parent16d050be2b5660f86cf65c465dd5e49ed615b4d0 (diff)
Given the priority to string.h from system includes.
Diffstat (limited to 'plugins/pychrysalide/gui/panels')
-rw-r--r--plugins/pychrysalide/gui/panels/Makefile.am19
-rw-r--r--plugins/pychrysalide/gui/panels/module.c97
-rw-r--r--plugins/pychrysalide/gui/panels/module.h42
-rw-r--r--plugins/pychrysalide/gui/panels/panel.c433
-rw-r--r--plugins/pychrysalide/gui/panels/panel.h45
5 files changed, 0 insertions, 636 deletions
diff --git a/plugins/pychrysalide/gui/panels/Makefile.am b/plugins/pychrysalide/gui/panels/Makefile.am
deleted file mode 100644
index ec5522f..0000000
--- a/plugins/pychrysalide/gui/panels/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-
-noinst_LTLIBRARIES = libpychrysaguipanels.la
-
-libpychrysaguipanels_la_SOURCES = \
- module.h module.c \
- panel.h panel.c
-
-libpychrysaguipanels_la_LDFLAGS =
-
-
-devdir = $(includedir)/chrysalide-$(subdir)
-
-dev_HEADERS = $(libpychrysaguipanels_la_SOURCES:%c=)
-
-
-AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \
- -I$(top_srcdir)/src
-
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/plugins/pychrysalide/gui/panels/module.c b/plugins/pychrysalide/gui/panels/module.c
deleted file mode 100644
index dd6b91e..0000000
--- a/plugins/pychrysalide/gui/panels/module.c
+++ /dev/null
@@ -1,97 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * module.c - intégration du répertoire panels 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 "panel.h"
-#include "../../helpers.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : super = module dont la définition est à compléter. *
-* *
-* Description : Ajoute le module 'gui.panels' à un module Python. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool add_gui_panels_module(PyObject *super)
-{
- bool result; /* Bilan à retourner */
- PyObject *module; /* Sous-module mis en place */
-
- static PyModuleDef py_chrysalide_gui_panels_module = {
-
- .m_base = PyModuleDef_HEAD_INIT,
-
- .m_name = "pychrysalide.gui.panels",
- .m_doc = "Python module for Chrysalide.gui.panels",
-
- .m_size = -1,
-
- };
-
- module = build_python_module(super, &py_chrysalide_gui_panels_module);
-
- result = (module != NULL);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Intègre les objets du module 'gui.panels'. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool populate_gui_panels_module(void)
-{
- bool result; /* Bilan à retourner */
-
- result = true;
-
- if (result) result = ensure_python_panel_item_is_registered();
-
- assert(result);
-
- return result;
-
-}
diff --git a/plugins/pychrysalide/gui/panels/module.h b/plugins/pychrysalide/gui/panels/module.h
deleted file mode 100644
index 559a8c4..0000000
--- a/plugins/pychrysalide/gui/panels/module.h
+++ /dev/null
@@ -1,42 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * module.h - prototypes pour l'intégration du répertoire panels 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_GUI_PANELS_MODULE_H
-#define _PLUGINS_PYCHRYSALIDE_GUI_PANELS_MODULE_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-
-
-/* Ajoute le module 'gui.panels' à un module Python. */
-bool add_gui_panels_module(PyObject *);
-
-/* Intègre les objets du module 'gui.panels'. */
-bool populate_gui_panels_module(void);
-
-
-
-#endif /* _PLUGINS_PYCHRYSALIDE_GUI_PANELS_MODULE_H */
diff --git a/plugins/pychrysalide/gui/panels/panel.c b/plugins/pychrysalide/gui/panels/panel.c
deleted file mode 100644
index 2d0b562..0000000
--- a/plugins/pychrysalide/gui/panels/panel.c
+++ /dev/null
@@ -1,433 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * panel.c - équivalent Python du fichier "gui/panels/panel.c"
- *
- * 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 "panel.h"
-
-
-#include <pygobject.h>
-
-
-#include <i18n.h>
-#include <core/params.h>
-#include <gui/core/panels.h>
-#include <gui/panels/panel-int.h>
-#include <plugins/dt.h>
-
-
-#include "../editem.h"
-#include "../../access.h"
-#include "../../helpers.h"
-#include "../../gtkext/dockable.h"
-
-
-
-/* ------------------------ GLUE POUR CREATION DEPUIS PYTHON ------------------------ */
-
-
-/* Accompagne la création d'une instance dérivée en Python. */
-static PyObject *py_panel_item_new(PyTypeObject *, PyObject *, PyObject *);
-
-/* Initialise la classe des panneaux pour l'interface graphique. */
-static void py_panel_item_init_gclass(GPanelItemClass *, gpointer);
-
-/* Initialise une instance sur la base du dérivé de GObject. */
-static int py_panel_item_init(PyObject *self, PyObject *args, PyObject *kwds);
-
-
-
-/* -------------------------- FONCTIONNALITES D'UN PANNEAU -------------------------- */
-
-
-/* Place un panneau dans l'ensemble affiché. */
-static PyObject *py_panel_item_dock(PyObject *, PyObject *);
-
-/* Définit les constantes pour les panneaux. */
-static bool py_panel_item_define_constants(PyTypeObject *);
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/* GLUE POUR CREATION DEPUIS PYTHON */
-/* ---------------------------------------------------------------------------------- */
-
-
-/******************************************************************************
-* *
-* Paramètres : type = type du nouvel objet à mettre en place. *
-* args = éventuelle liste d'arguments. *
-* kwds = éventuel dictionnaire de valeurs mises à disposition. *
-* *
-* Description : Accompagne la création d'une instance dérivée en Python. *
-* *
-* Retour : Nouvel objet Python mis en place ou NULL en cas d'échec. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_panel_item_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
-{
- PyObject *result; /* Objet à retourner */
- PyTypeObject *base; /* Type de base à dériver */
- bool first_time; /* Evite les multiples passages*/
- GType gtype; /* Nouveau type de processeur */
- bool status; /* Bilan d'un enregistrement */
-
- /* Validations diverses */
-
- base = get_python_panel_item_type();
-
- if (type == base)
- {
- result = NULL;
- PyErr_Format(PyExc_RuntimeError, _("%s is an abstract class"), type->tp_name);
- goto exit;
- }
-
- /* Mise en place d'un type dédié */
-
- first_time = (g_type_from_name(type->tp_name) == 0);
-
- gtype = build_dynamic_type(G_TYPE_PANEL_ITEM, type->tp_name,
- (GClassInitFunc)py_panel_item_init_gclass, NULL, NULL);
-
- if (first_time)
- {
- status = register_class_for_dynamic_pygobject(gtype, type, base);
-
- if (!status)
- {
- result = NULL;
- goto exit;
- }
-
- }
-
- /* On crée, et on laisse ensuite la main à PyGObject_Type.tp_init() */
-
- result = PyType_GenericNew(type, args, kwds);
-
- exit:
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : class = classe à initialiser. *
-* unused = données non utilisées ici. *
-* *
-* Description : Initialise la classe des panneaux pour l'interface graphique.*
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void py_panel_item_init_gclass(GPanelItemClass *class, gpointer unused)
-{
- py_editor_item_init_gclass(G_EDITOR_ITEM_CLASS(class), NULL);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = objet à initialiser (théoriquement). *
-* args = arguments fournis à l'appel. *
-* kwds = arguments de type key=val fournis. *
-* *
-* Description : Initialise une instance sur la base du dérivé de GObject. *
-* *
-* Retour : 0. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static int py_panel_item_init(PyObject *self, PyObject *args, PyObject *kwds)
-{
- unsigned long personality; /* Nature du panneau */
- const char *name; /* Désignation humaine */
- const char *lname; /* Nom version longue */
- PyGObject *widget; /* Composant visuel du panneau */
- int startup; /* Recommandation au démarrage */
- const char *path; /* Placement à l'affichage */
- int ret; /* Bilan de lecture des args. */
- PyObject *new_kwds; /* Nouveau dictionnaire épuré */
- GPanelItem *panel; /* Panneau à manipuler */
- GEditorItem *item; /* Version basique d'instance */
-
- static char *kwlist[] = { "name", "widget", "personality", "lname", "dock", "path", NULL };
-
- /* Récupération des paramètres */
-
- ret = PyArg_ParseTupleAndKeywords(args, kwds, "sOksps", kwlist,
- &name, &widget, &personality, &lname, &startup, &path);
- if (!ret) return -1;
-
- /* Initialisation d'un objet GLib */
-
- new_kwds = PyDict_New();
-
- ret = PyGObject_Type.tp_init(self, args, new_kwds);
-
- Py_DECREF(new_kwds);
-
- if (ret == -1) return -1;
-
- /* Eléments de base */
-
- panel = G_PANEL_ITEM(pygobject_get(self));
-
- item = G_EDITOR_ITEM(panel);
-
- item->name = strdup(name);;
- item->widget = GTK_WIDGET(pygobject_get(widget));
-
- panel->personality = personality;
- panel->lname = strdup(lname);
- panel->dock_at_startup = startup;
- panel->path = strdup(path);
-
- /**
- * Si Python ne voit plus la variable représentant le panneau utilisée,
- * il va la supprimer, ce qui va supprimer le composant GTK.
- *
- * On sera donc en situation de Use-After-Free, dont les conséquences
- * arrivent très vite.
- */
- g_object_ref(G_OBJECT(item->widget));
-
- return 0;
-
-}
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/* FONCTIONNALITES D'UN PANNEAU */
-/* ---------------------------------------------------------------------------------- */
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe représentant un binaire. *
-* args = arguments fournis à l'appel. *
-* *
-* Description : Place un panneau dans l'ensemble affiché. *
-* *
-* Retour : Py_None. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_panel_item_dock(PyObject *self, PyObject *args)
-{
- GPanelItem *item; /* Panneau à manipuler */
-
- item = G_PANEL_ITEM(pygobject_get(self));
-
- g_panel_item_dock(item);
-
- Py_RETURN_NONE;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Fournit un accès à une définition de type à diffuser. *
-* *
-* Retour : Définition d'objet pour Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PyTypeObject *get_python_panel_item_type(void)
-{
- static PyMethodDef py_panel_item_methods[] = {
- {
- "dock", py_panel_item_dock,
- METH_NOARGS,
- "dock($self, /)\n--\n\nDisplay the panel item in the right place."
- },
- { NULL }
- };
-
- static PyGetSetDef py_panel_item_getseters[] = {
- { NULL }
- };
-
- static PyTypeObject py_panel_item_type = {
-
- PyVarObject_HEAD_INIT(NULL, 0)
-
- .tp_name = "pychrysalide.gui.panels.PanelItem",
- .tp_basicsize = sizeof(PyGObject),
-
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
-
- .tp_doc = "PyChrysalide panel item.",
-
- .tp_methods = py_panel_item_methods,
- .tp_getset = py_panel_item_getseters,
-
- .tp_init = py_panel_item_init,
- .tp_new = py_panel_item_new,
-
- };
-
- return &py_panel_item_type;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : obj_type = type dont le dictionnaire est à compléter. *
-* *
-* Description : Définit les constantes pour les panneaux. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool py_panel_item_define_constants(PyTypeObject *obj_type)
-{
- bool result; /* Bilan à retourner */
-
- result = true;
-
- result &= PyDict_AddULongMacro(obj_type, PIP_INVALID);
-
- result &= PyDict_AddULongMacro(obj_type, PIP_SINGLETON);
- result &= PyDict_AddULongMacro(obj_type, PIP_BINARY_VIEW);
- result &= PyDict_AddULongMacro(obj_type, PIP_OTHER);
-
- result &= PyDict_AddULongMacro(obj_type, PIP_COUNT);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : module = module dont la définition est à compléter. *
-* *
-* Description : Prend en charge l'objet 'pychrysalide.gui.panels.PanelItem'. *
-* *
-* Retour : Bilan de l'opération. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool ensure_python_panel_item_is_registered(void)
-{
- PyTypeObject *type; /* Type Python 'LoadedBinary' */
- PyObject *module; /* Module à recompléter */
- PyObject *dict; /* Dictionnaire du module */
-
- type = get_python_panel_item_type();
-
- if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
- {
- module = get_access_to_python_module("pychrysalide.gui.panels");
-
- dict = PyModule_GetDict(module);
-
- if (!ensure_python_editor_item_is_registered())
- return false;
-
- if (!ensure_python_gtk_dockable_is_registered())
- return false;
-
- if (!_register_class_for_pygobject(dict, G_TYPE_PANEL_ITEM, type,
- get_python_editor_item_type(), get_python_gtk_dockable_type(), NULL))
- return false;
-
- if (!py_panel_item_define_constants(type))
- return false;
-
- }
-
- return true;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : arg = argument quelconque à tenter de convertir. *
-* dst = destination des valeurs récupérées en cas de succès. *
-* *
-* Description : Tente de convertir en panneau pour GUI. *
-* *
-* Retour : Bilan de l'opération, voire indications supplémentaires. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-int convert_to_panel_item(PyObject *arg, void *dst)
-{
- int result; /* Bilan à retourner */
-
- result = PyObject_IsInstance(arg, (PyObject *)get_python_panel_item_type());
-
- switch (result)
- {
- case -1:
- /* L'exception est déjà fixée par Python */
- result = 0;
- break;
-
- case 0:
- PyErr_SetString(PyExc_TypeError, "unable to convert the provided argument to executable format");
- break;
-
- case 1:
- *((GPanelItem **)dst) = G_PANEL_ITEM(pygobject_get(arg));
- break;
-
- default:
- assert(false);
- break;
-
- }
-
- return result;
-
-}
diff --git a/plugins/pychrysalide/gui/panels/panel.h b/plugins/pychrysalide/gui/panels/panel.h
deleted file mode 100644
index 907c650..0000000
--- a/plugins/pychrysalide/gui/panels/panel.h
+++ /dev/null
@@ -1,45 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * panel.h - prototypes pour l'équivalent Python du fichier "gui/panels/panel.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_PYCHRYSALIDE_GUI_PANELS_PANEL_H
-#define _PLUGINS_PYCHRYSALIDE_GUI_PANELS_PANEL_H
-
-
-#include <Python.h>
-#include <stdbool.h>
-
-
-
-/* Fournit un accès à une définition de type à diffuser. */
-PyTypeObject *get_python_panel_item_type(void);
-
-/* Prend en charge l'objet 'pychrysalide.gui.panels.PanelItem'. */
-bool ensure_python_panel_item_is_registered(void);
-
-/* Tente de convertir en panneau pour GUI. */
-int convert_to_panel_item(PyObject *, void *);
-
-
-
-#endif /* _PLUGINS_PYCHRYSALIDE_GUI_PANELS_PANEL_H */