summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-08-27 09:47:29 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-08-27 10:07:59 (GMT)
commitacd37cbf8578686d2e5bae64b6b4eb6d2bc5376b (patch)
treec3ec34400c422ccd3e0f122ae6c0ec7ea67e37de /plugins
parent8ca477e012b11a19363542d171b8e973d637641c (diff)
Deleted the reference to the main window in all panels.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/pychrysa/Makefile.am1
-rw-r--r--plugins/pychrysa/gtkext/displaypanel.c2
-rw-r--r--plugins/pychrysa/gui/editem.c1
-rw-r--r--plugins/pychrysa/gui/panels/panel.c3
-rw-r--r--plugins/pychrysa/pychrysa.c45
-rw-r--r--plugins/pychrysa/quirks.c294
-rw-r--r--plugins/pychrysa/quirks.h61
7 files changed, 2 insertions, 405 deletions
diff --git a/plugins/pychrysa/Makefile.am b/plugins/pychrysa/Makefile.am
index e9798b2..fe23e99 100644
--- a/plugins/pychrysa/Makefile.am
+++ b/plugins/pychrysa/Makefile.am
@@ -7,7 +7,6 @@ pychrysalide_la_SOURCES = \
helpers.h helpers.c \
plugin.h plugin.c \
pychrysa.h pychrysa.c \
- quirks.h quirks.c \
weak.h weak.c
pychrysalide_la_LIBADD = \
diff --git a/plugins/pychrysa/gtkext/displaypanel.c b/plugins/pychrysa/gtkext/displaypanel.c
index aa166e5..b75d173 100644
--- a/plugins/pychrysa/gtkext/displaypanel.c
+++ b/plugins/pychrysa/gtkext/displaypanel.c
@@ -78,7 +78,7 @@ static PyObject *py_display_panel_new(PyTypeObject *type, PyObject *args, PyObje
ret = PyArg_ParseTuple(args, "ssOs", &name, &lname, &widget, &path);
if (!ret) Py_RETURN_NONE;
- item = g_view_panel_new(get_internal_ref(), name, lname,
+ item = g_view_panel_new(name, lname,
GTK_WIDGET(pygobject_get(widget)), path);
result = py_display_panel_from_c(G_DISPLAY_PANEL(item));
diff --git a/plugins/pychrysa/gui/editem.c b/plugins/pychrysa/gui/editem.c
index a7e9206..91f5246 100644
--- a/plugins/pychrysa/gui/editem.c
+++ b/plugins/pychrysa/gui/editem.c
@@ -32,7 +32,6 @@
#include "../helpers.h"
-#include "../quirks.h"
#include "../analysis/binary.h"
diff --git a/plugins/pychrysa/gui/panels/panel.c b/plugins/pychrysa/gui/panels/panel.c
index 9ca271f..72c9e7e 100644
--- a/plugins/pychrysa/gui/panels/panel.c
+++ b/plugins/pychrysa/gui/panels/panel.c
@@ -35,7 +35,6 @@
#include "../editem.h"
#include "../../helpers.h"
-#include "../../quirks.h"
#include "../../gtkext/dockable.h"
@@ -83,7 +82,7 @@ static int py_panel_item_init(PyObject *self, PyObject *args, PyObject *kwds)
GTK_WIDGET(pygobject_get(widget)), startup, path);
/* FIXME ? Est-ce à l'utilisateur de s'enregistrer ? */
- register_panel_item(item, get_internal_ref(), get_main_configuration());
+ register_panel_item(item, get_main_configuration());
/**
* Si Python ne voit plus la variable représentant le panneau utilisée,
diff --git a/plugins/pychrysa/pychrysa.c b/plugins/pychrysa/pychrysa.c
index f4cfe90..a404c1a 100644
--- a/plugins/pychrysa/pychrysa.c
+++ b/plugins/pychrysa/pychrysa.c
@@ -43,7 +43,6 @@
#include "helpers.h"
#include "plugin.h"
-#include "quirks.h"
#include "analysis/module.h"
#include "arch/module.h"
#include "common/module.h"
@@ -68,9 +67,6 @@ static PyObject *py_chrysalide_version(PyObject *, PyObject *);
/* Fournit la version du greffon pour Python. */
static PyObject *py_chrysalide_mod_version(PyObject *, PyObject *);
-/* Recherche et fournit si elle existe une valeur globale. */
-static PyObject *py_chrysalide_get_global_gobject(PyObject *, PyObject *);
-
/* Détermine si l'interpréteur lancé est celui pris en compte. */
static bool is_current_abi_suitable(void);
@@ -159,41 +155,6 @@ static PyObject *py_chrysalide_mod_version(PyObject *self, PyObject *args)
/******************************************************************************
* *
-* Paramètres : self = NULL car méthode statique. *
-* args = contient la clef d'accès à un champ particulier. *
-* *
-* Description : Recherche et fournit si elle existe une valeur globale. *
-* *
-* Retour : Object attaché à l'espace de référencement global ou NULL. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_chrysalide_get_global_gobject(PyObject *self, PyObject *args)
-{
- PyObject *result; /* Instance à retourner */
- const char *key; /* Désignation du champ visé */
- int ret; /* Bilan de lecture des args. */
- void *data; /* Donnée quelconque */
-
- ret = PyArg_ParseTuple(args, "s", &key);
- if (!ret) Py_RETURN_NONE;
-
- data = g_object_get_data(get_internal_ref(), key);
- if (data == NULL) Py_RETURN_NONE;
-
- if (!G_IS_OBJECT(data)) Py_RETURN_NONE;
-
- result = pygobject_new(G_OBJECT(data));
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : - *
* *
* Description : Détermine si l'interpréteur lancé est celui pris en compte. *
@@ -348,10 +309,6 @@ PyMODINIT_FUNC PyInit_pychrysalide(void)
METH_NOARGS,
"mod_version(/)\n--\n\nProvide the version number of Chrysalide module for Python."
},
- { "get_global_gobject", py_chrysalide_get_global_gobject,
- METH_VARARGS,
- "get_global_gobject(key, /)\n--\n\nRetrieve if it exists a global GObject registered with the given key."
- },
{ NULL }
};
@@ -558,8 +515,6 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin, GObject *ref)
DIR *dir; /* Répertoire à parcourir */
int ret; /* Bilan de préparatifs */
- define_internal_ref(ref);
-
/* Définition des zones d'influence */
dir = opendir(PLUGINS_DIR G_DIR_SEPARATOR_S "python");
diff --git a/plugins/pychrysa/quirks.c b/plugins/pychrysa/quirks.c
deleted file mode 100644
index 82ee0d5..0000000
--- a/plugins/pychrysa/quirks.c
+++ /dev/null
@@ -1,294 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * quirks.c - transmission du type Python exact aux instances de PyObject
- *
- * 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 "quirks.h"
-
-
-
-
-#if 0
-
-//#include <pyglib.h>
-#include <pygobject.h>
-
-
-#include "helpers.h"
-
-
-
-
-
-/* Coordonnées insérées manuellement */
-typedef struct _PyGObjectData_fake
-{
- PyTypeObject *type; /* Type précis pour Python */
- GSList *closures; /* Supports d'appel */
-
-} PyGObjectData_fake;
-
-
-/* Clef d'accès réservée */
-static GQuark pygobject_instance_data_key_fake = 0;
-
-/* Clef pour l'enregistrement de l'objet Python dans l'objet GLib */
-static GQuark pygobject_wrapper_key_fake = 0;
-
-
-
-
-static void pygobject_data_free_fake(PyGObjectData_fake *data)
-{
- //PyGILState_STATE state; /* Etat interne de Python */
- GSList *iter; /* Boucle de parcours */
- GSList *old; /* Sauvegarde avant libération */
-
- //state = pyglib_gil_state_ensure();
-
- Py_DECREF(data->type);
-
- pyg_begin_allow_threads;
-
- for (iter = data->closures; iter; )
- {
- /**
- * On obtient le lien avant la libération via
- * pygobject_unwatch_closure()...
- */
- old = iter;
- iter = iter->next;
-
- g_closure_invalidate((GClosure *)old->data);
-
- }
-
- pyg_end_allow_threads;
-
- g_free(data);
-
- //pyglib_gil_state_release(state);
-
-}
-
-
-
-static PyGObjectData_fake *pygobject_data_new_fake(void)
-{
- PyGObjectData_fake *result; /* Instance à retourner */
-
- result = g_new0(PyGObjectData_fake, 1);
-
- return result;
-
-}
-
-
-static GObject *_ref = NULL;
-
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Définit les éléments immuables pour toute association. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void pychrysalide_init_quirks(void)
-{
- pygobject_instance_data_key_fake = g_quark_from_static_string("PyGObject::instance-data");
- pygobject_wrapper_key_fake = g_quark_from_static_string("PyGObject::wrapper");
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : threshold0 = seuil pour la collecte de niveau 0. *
-* threshold1 = seuil pour la collecte de niveau 1. *
-* threshold2 = seuil pour la collecte de niveau 2. *
-* *
-* Description : Modifie les seuils de collecte pour le collecteur de Python. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void pychrysalide_set_gc_threshold(int threshold0, int threshold1, int threshold2)
-{
- PyObject *module; /* Module Python "gc" */
- PyObject *args; /* Arguments pour l'appel */
- PyObject *value; /* Valeurs obtenues */
-
- module = PyImport_ImportModule("gc");
-
- if (threshold0 == 0 && threshold1 == 0 && threshold2 == 0)
- {
- args = Py_BuildValue("()");
- value = run_python_method(module, "disable", args);
- }
- else
- {
- args = Py_BuildValue("(iii)", threshold0, threshold1, threshold2);
- value = run_python_method(module, "set_threshold", args);
- }
-
- Py_DECREF(value);
- Py_DECREF(args);
-
- Py_DECREF(module);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : obj = instance GLib crée en C. *
-* type = type de l'objet Python correspond. *
-* *
-* Description : Crée l'association précise attendue par Python-GObject. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void pychrysalide_set_instance_data(GObject *obj, PyTypeObject *type)
-{
- PyGObjectData_fake *data;
-
- data = g_object_get_qdata(obj, pygobject_instance_data_key_fake);
-
- Py_INCREF(type);
-
- if (data == NULL)
- {
- data = pygobject_data_new_fake();
-
- /**
- * Dans la majorité des cas, le type est retrouvé depuis un appel à
- * PyObject_GetAttrString(), qui fournit une nouvelle référence.
- * Donc nul besoin d'incrémenter encore cette référence.
- */
- data->type = type;
-
- g_object_set_qdata_full(obj, pygobject_instance_data_key_fake,
- data, (GDestroyNotify)pygobject_data_free_fake);
-
- }
- /**
- * On décharge l'usage du type : le compteur est déjà bien à jour si
- * le (futur) objet est en mémoire.
- */
- else Py_DECREF(type);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : obj = instance existante GLib. *
-* *
-* Description : Fournit l'instance Python d'une instance GLib, si existante. *
-* *
-* Retour : Instance Python mise en place ou NULL. *
-* *
-* Remarques : Les retours non nuls voient leur compteur incrémenté. *
-* *
-******************************************************************************/
-
-PyObject *pychrysalide_get_pygobject(GObject *obj)
-{
- PyObject *result; /* Objet en place à renvoyer */
-
- result = (PyObject *)g_object_get_qdata(obj, pygobject_wrapper_key_fake);
-
- if (result != NULL)
- Py_INCREF(result);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = objet à initialiser (théoriquement). *
-* args = arguments fournis à l'appel. *
-* kwds = arguments de type key=val fournis. *
-* *
-* Description : Initialise un objet dérivé de GObject en Python. *
-* *
-* Retour : 0. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-int pychrysalide_allow_args_for_gobjects(PyObject *self, PyObject *args, PyObject *kwds)
-{
- return 0;
-
-}
-#endif
-
-
-
-
-
-/* Mémorisation de l'espace de référencement global */
-static GObject *_ref = NULL;
-
-
-
-/******************************************************************************
-* *
-* Paramètres : ref = espace de référencement global à utiliser. *
-* *
-* Description : Evite à Python d'avoir à manipuler les références internes. *
-* *
-* Retour : Adresse de l'espace de référencement global. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GObject *_get_internal_ref(GObject *ref)
-{
- if (ref != NULL)
- {
- g_object_ref(ref);
- _ref = ref;
- }
-
- return _ref;
-
-}
diff --git a/plugins/pychrysa/quirks.h b/plugins/pychrysa/quirks.h
deleted file mode 100644
index c0caa67..0000000
--- a/plugins/pychrysa/quirks.h
+++ /dev/null
@@ -1,61 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * quirks.h - prototypes pour la transmission du type Python exact aux instances de PyObject
- *
- * 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_PYOIDA_QUIRKS_H
-#define _PLUGINS_PYOIDA_QUIRKS_H
-
-
-//#include <Python.h>
-#include <glib-object.h>
-
-
-#if 0
-/* Définit les éléments immuables pour toute association. */
-void pychrysalide_init_quirks(void);
-
-/* Modifie les seuils de collecte pour le collecteur de Python. */
-void pychrysalide_set_gc_threshold(int, int, int);
-
-/* Crée l'association précise attendue par Python-GObject. */
-void pychrysalide_set_instance_data(GObject *, PyTypeObject *);
-
-/* Fournit l'instance Python d'une instance GLib, si existante. */
-PyObject *pychrysalide_get_pygobject(GObject *);
-
-/* Initialise un objet dérivé de GObject en Python. */
-int pychrysalide_allow_args_for_gobjects(PyObject *, PyObject *, PyObject *);
-#endif
-
-
-
-/* Evite à Python d'avoir à manipuler les références internes. */
-GObject *_get_internal_ref(GObject *);
-
-
-#define define_internal_ref(r) _get_internal_ref(r)
-#define get_internal_ref() _get_internal_ref(NULL)
-
-
-
-#endif /* _PLUGINS_PYOIDA_QUIRKS_H */