summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/pychrysalide/analysis/loaded.c11
-rw-r--r--plugins/pychrysalide/glibext/Makefile.am1
-rw-r--r--plugins/pychrysalide/glibext/binarycursor.c374
-rw-r--r--plugins/pychrysalide/glibext/binarycursor.h45
-rw-r--r--plugins/pychrysalide/glibext/linecursor.c2
-rw-r--r--plugins/pychrysalide/glibext/linecursor.h2
-rw-r--r--plugins/pychrysalide/glibext/module.c2
-rw-r--r--plugins/pychrysalide/gui/core/global.c49
-rw-r--r--plugins/pychrysalide/gui/editem.c103
-rw-r--r--src/analysis/db/items/comment.c2
-rw-r--r--src/arch/instruction.c2
-rw-r--r--src/format/symbol.c2
-rw-r--r--src/glibext/gbinarycursor.c25
-rw-r--r--src/glibext/gbinarycursor.h5
-rw-r--r--src/glibext/gbinportion.c2
-rw-r--r--src/glibext/generators/hex.c2
-rw-r--r--src/glibext/generators/prologue.c2
-rw-r--r--src/glibext/generators/rborder.c2
-rw-r--r--src/gtkext/gtkgraphdisplay.c2
-rw-r--r--src/gui/dialogs/export_graph.c2
-rw-r--r--src/gui/editem-int.h2
-rw-r--r--src/gui/menus/edition.c8
22 files changed, 626 insertions, 21 deletions
diff --git a/plugins/pychrysalide/analysis/loaded.c b/plugins/pychrysalide/analysis/loaded.c
index 5fde43c..d25b4d3 100644
--- a/plugins/pychrysalide/analysis/loaded.c
+++ b/plugins/pychrysalide/analysis/loaded.c
@@ -281,6 +281,12 @@ static PyObject *py_loaded_content_get_content(PyObject *self, void *closure)
GLoadedContent *content; /* Version GLib de l'élément */
GBinContent *bincnt; /* Contenu binaire associé */
+#define LOADED_CONTENT_CONTENT_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ content, py_loaded_content, \
+ "Binary content, provided as a pychrysalide.analysis.BinContent instance." \
+)
+
content = G_LOADED_CONTENT(pygobject_get(self));
bincnt = g_loaded_content_get_content(content);
@@ -325,10 +331,7 @@ PyTypeObject *get_python_loaded_content_type(void)
};
static PyGetSetDef py_loaded_content_getseters[] = {
- {
- "content", py_loaded_content_get_content, NULL,
- "Binary content.", NULL
- },
+ LOADED_CONTENT_CONTENT_ATTRIB,
{ NULL }
};
diff --git a/plugins/pychrysalide/glibext/Makefile.am b/plugins/pychrysalide/glibext/Makefile.am
index 8a6de46..28d27f6 100644
--- a/plugins/pychrysalide/glibext/Makefile.am
+++ b/plugins/pychrysalide/glibext/Makefile.am
@@ -2,6 +2,7 @@
noinst_LTLIBRARIES = libpychrysaglibext.la
libpychrysaglibext_la_SOURCES = \
+ binarycursor.h binarycursor.c \
binportion.h binportion.c \
buffercache.h buffercache.c \
bufferline.h bufferline.c \
diff --git a/plugins/pychrysalide/glibext/binarycursor.c b/plugins/pychrysalide/glibext/binarycursor.c
new file mode 100644
index 0000000..92a4b8c
--- /dev/null
+++ b/plugins/pychrysalide/glibext/binarycursor.c
@@ -0,0 +1,374 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * binarycursor.c - équivalent Python du fichier "glibext/gbinarycursor.h"
+ *
+ * Copyright (C) 2019 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 "binarycursor.h"
+
+
+#include <pygobject.h>
+
+
+#include <i18n.h>
+#include <glibext/gbinarycursor.h>
+
+
+#include "linecursor.h"
+#include "../access.h"
+#include "../helpers.h"
+#include "../arch/vmpa.h"
+
+
+
+/* Crée un nouvel objet Python de type 'BinaryCursor'. */
+static PyObject *py_binary_cursor_new(PyTypeObject *, PyObject *, PyObject *);
+
+/* Met à jour la position suivi dans un panneau de chargement. */
+static PyObject *py_binary_cursor_update(PyObject *, PyObject *);
+
+/* Transmet la position de suivi dans un panneau de chargement. */
+static PyObject *py_binary_cursor_retrieve(PyObject *, PyObject *);
+
+/* Indique la représentation de l'emplacement. */
+static PyObject *py_binary_cursor_get_raw(PyObject *, void *);
+
+/* Précise la représentation de l'emplacement. */
+static int py_binary_cursor_set_raw(PyObject *, PyObject *, void *);
+
+
+
+/******************************************************************************
+* *
+* 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 'BinaryCursor'. *
+* *
+* Retour : Instance Python mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_binary_cursor_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *result; /* Instance à retourner */
+ GLineCursor *cursor; /* Création GLib à transmettre */
+
+#define BINARY_CURSOR_DOC \
+ "BinaryCursor handles a position into a disassembly view.\n" \
+ "\n" \
+ "Instances can be created using the following constructor:\n" \
+ "\n" \
+ " BinaryCursor()\n"
+
+ cursor = g_binary_cursor_new();
+
+ g_object_ref_sink(G_OBJECT(cursor));
+ result = pygobject_new(G_OBJECT(cursor));
+ g_object_unref(cursor);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = variable non utilisée ici. *
+* args = arguments fournis à l'appel. *
+* *
+* Description : Met à jour la position suivi dans un panneau de chargement. *
+* *
+* Retour : None. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_binary_cursor_update(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Instance à retourner */
+ vmpa2t addr; /* Emplacement fourni */
+ int ret; /* Bilan de lecture des args. */
+ GBinaryCursor *cursor; /* Version GLib du type */
+
+#define BINARY_CURSOR_UPDATE_METHOD PYTHON_METHOD_DEF \
+( \
+ update, "$self, addr", \
+ METH_VARARGS, py_binary_cursor, \
+ "Update the location of the cursor.\n" \
+ "\n" \
+ "The *addr* argument must be able to get converted into" \
+ " a pychrysalide.arch.vmpa instance." \
+)
+
+ ret = PyArg_ParseTuple(args, "O&", convert_any_to_vmpa, &addr);
+ if (!ret) return NULL;
+
+ cursor = G_BINARY_CURSOR(pygobject_get(self));
+
+ g_binary_cursor_update(cursor, &addr);
+
+ result = Py_None;
+ Py_INCREF(result);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = variable non utilisée ici. *
+* args = arguments fournis à l'appel. *
+* *
+* Description : Transmet la position de suivi dans un panneau de chargement. *
+* *
+* Retour : Emplacement courant. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_binary_cursor_retrieve(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Instance à retourner */
+ GBinaryCursor *cursor; /* Version GLib du type */
+ vmpa2t addr; /* Emplacement fourni */
+
+#define BINARY_CURSOR_RETRIEVE_METHOD PYTHON_METHOD_DEF \
+( \
+ retrieve, "$self", \
+ METH_NOARGS, py_binary_cursor, \
+ "Retrieve the location of the cursor.\n" \
+ "\n" \
+ "The result is provided as a pychrysalide.arch.vmpa instance." \
+)
+
+ cursor = G_BINARY_CURSOR(pygobject_get(self));
+
+ g_binary_cursor_retrieve(cursor, &addr);
+
+ result = build_from_internal_vmpa(&addr);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* closure = non utilisé ici. *
+* *
+* Description : Indique la représentation de l'emplacement. *
+* *
+* Retour : True so la représentation de l'emplacement est brute. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_binary_cursor_get_raw(PyObject *self, void *closure)
+{
+ PyObject *result; /* Valeur à retourner */
+ GBinaryCursor *cursor; /* Instance à manipuler */
+ bool raw; /* Statut défini */
+
+#define BINARY_CURSOR_RAW_ATTRIB PYTHON_GETSET_DEF_FULL \
+( \
+ raw, py_binary_cursor, \
+ "Type of rendering in the status bar for the binary location." \
+)
+
+ cursor = G_BINARY_CURSOR(pygobject_get(self));
+ raw = g_binary_cursor_is_raw(cursor);
+
+ result = raw ? Py_True : Py_False;
+ Py_INCREF(result);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* value = valeur fournie à intégrer ou prendre en compte. *
+* closure = adresse non utilisée ici. *
+* *
+* Description : Précise la représentation de l'emplacement. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static int py_binary_cursor_set_raw(PyObject *self, PyObject *value, void *closure)
+{
+ bool raw; /* Statut à définir */
+ GBinaryCursor *cursor; /* Instance à manipuler */
+
+ raw = (value == Py_True);
+
+ cursor = G_BINARY_CURSOR(pygobject_get(self));
+
+ g_binary_cursor_set_raw(cursor, raw);
+
+ 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_binary_cursor_type(void)
+{
+ static PyMethodDef py_binary_cursor_methods[] = {
+ BINARY_CURSOR_UPDATE_METHOD,
+ BINARY_CURSOR_RETRIEVE_METHOD,
+ { NULL }
+ };
+
+ static PyGetSetDef py_binary_cursor_getseters[] = {
+ BINARY_CURSOR_RAW_ATTRIB,
+ { NULL }
+ };
+
+ static PyTypeObject py_binary_cursor_type = {
+
+ PyVarObject_HEAD_INIT(NULL, 0)
+
+ .tp_name = "pychrysalide.glibext.BinaryCursor",
+ .tp_basicsize = sizeof(PyGObject),
+
+ .tp_flags = Py_TPFLAGS_DEFAULT,
+
+ .tp_doc = BINARY_CURSOR_DOC,
+
+ .tp_methods = py_binary_cursor_methods,
+ .tp_getset = py_binary_cursor_getseters,
+ .tp_new = py_binary_cursor_new,
+
+ };
+
+ return &py_binary_cursor_type;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : module = module dont la définition est à compléter. *
+* *
+* Description : Prend en charge l'objet 'pychrysalide.glibext.BinaryCursor'. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool ensure_python_binary_cursor_is_registered(void)
+{
+ PyTypeObject *type; /* Type Python 'BinaryCursor' */
+ PyObject *module; /* Module à recompléter */
+ PyObject *dict; /* Dictionnaire du module */
+
+ type = get_python_binary_cursor_type();
+
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.glibext");
+
+ dict = PyModule_GetDict(module);
+
+ if (!ensure_python_line_cursor_is_registered())
+ return false;
+
+ if (!register_class_for_pygobject(dict, G_TYPE_BINARY_CURSOR, type, get_python_line_cursor_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 curseur pour ligne. *
+* *
+* Retour : Bilan de l'opération, voire indications supplémentaires. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+int convert_to_binary_cursor(PyObject *arg, void *dst)
+{
+ int result; /* Bilan à retourner */
+
+ result = PyObject_IsInstance(arg, (PyObject *)get_python_binary_cursor_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 binary cursor"));
+ break;
+
+ case 1:
+ *((GBinaryCursor **)dst) = G_BINARY_CURSOR(pygobject_get(arg));
+ break;
+
+ default:
+ assert(false);
+ break;
+
+ }
+
+ return result;
+
+}
diff --git a/plugins/pychrysalide/glibext/binarycursor.h b/plugins/pychrysalide/glibext/binarycursor.h
new file mode 100644
index 0000000..9832d8f
--- /dev/null
+++ b/plugins/pychrysalide/glibext/binarycursor.h
@@ -0,0 +1,45 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * binarycursor.h - prototypes pour l'équivalent Python du fichier "glibext/binarycursor.h"
+ *
+ * Copyright (C) 2019 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_BINARYCURSOR_H
+#define _PLUGINS_PYCHRYSALIDE_GLIBEXT_BINARYCURSOR_H
+
+
+#include <Python.h>
+#include <stdbool.h>
+
+
+
+/* Fournit un accès à une définition de type à diffuser. */
+PyTypeObject *get_python_binary_cursor_type(void);
+
+/* Prend en charge l'objet 'pychrysalide.glibext.BinaryCursor'. */
+bool ensure_python_binary_cursor_is_registered(void);
+
+/* Tente de convertir en curseur pour ligne. */
+int convert_to_binary_cursor(PyObject *, void *);
+
+
+
+#endif /* _PLUGINS_PYCHRYSALIDE_GLIBEXT_BINARYCURSOR_H */
diff --git a/plugins/pychrysalide/glibext/linecursor.c b/plugins/pychrysalide/glibext/linecursor.c
index bb3b8ba..edc5696 100644
--- a/plugins/pychrysalide/glibext/linecursor.c
+++ b/plugins/pychrysalide/glibext/linecursor.c
@@ -162,7 +162,7 @@ PyTypeObject *get_python_line_cursor_type(void)
* *
* Paramètres : module = module dont la définition est à compléter. *
* *
-* Description : Prend en charge l'objet 'pychrysalide.glibext.Linecursor'. *
+* Description : Prend en charge l'objet 'pychrysalide.glibext.LineCursor'. *
* *
* Retour : Bilan de l'opération. *
* *
diff --git a/plugins/pychrysalide/glibext/linecursor.h b/plugins/pychrysalide/glibext/linecursor.h
index 896e6bb..ce94c8a 100644
--- a/plugins/pychrysalide/glibext/linecursor.h
+++ b/plugins/pychrysalide/glibext/linecursor.h
@@ -34,7 +34,7 @@
/* Fournit un accès à une définition de type à diffuser. */
PyTypeObject *get_python_line_cursor_type(void);
-/* Prend en charge l'objet 'pychrysalide.glibext.Linecursor'. */
+/* Prend en charge l'objet 'pychrysalide.glibext.LineCursor'. */
bool ensure_python_line_cursor_is_registered(void);
/* Tente de convertir en curseur pour ligne. */
diff --git a/plugins/pychrysalide/glibext/module.c b/plugins/pychrysalide/glibext/module.c
index a30d200..509f36c 100644
--- a/plugins/pychrysalide/glibext/module.c
+++ b/plugins/pychrysalide/glibext/module.c
@@ -28,6 +28,7 @@
#include <assert.h>
+#include "binarycursor.h"
#include "binportion.h"
#include "buffercache.h"
#include "bufferline.h"
@@ -95,6 +96,7 @@ bool populate_glibext_module(void)
result = true;
+ if (result) result = ensure_python_binary_cursor_is_registered();
if (result) result = ensure_python_binary_portion_is_registered();
if (result) result = ensure_python_buffer_cache_is_registered();
if (result) result = ensure_python_buffer_line_is_registered();
diff --git a/plugins/pychrysalide/gui/core/global.c b/plugins/pychrysalide/gui/core/global.c
index 40f6b6e..26d51cb 100644
--- a/plugins/pychrysalide/gui/core/global.c
+++ b/plugins/pychrysalide/gui/core/global.c
@@ -39,6 +39,9 @@
/* Fournit l'adresse de la fenêtre principale de l'éditeur. */
static PyObject *py_global_get_editor_window(PyObject *, PyObject *);
+/* Fournit le contenu actif en cours d'étude. */
+static PyObject *py_global_get_current_content(PyObject *, PyObject *);
+
/******************************************************************************
@@ -86,6 +89,51 @@ static PyObject *py_global_get_editor_window(PyObject *self, PyObject *args)
/******************************************************************************
* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* args = non utilisé ici. *
+* *
+* Description : Fournit le contenu actif en cours d'étude. *
+* *
+* Retour : Instance courante de contenu étudié ou None. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_global_get_current_content(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Instance Python à retourner */
+ GLoadedContent *content; /* Contenu courant récupéré */
+
+#define GLOBAL_GET_CURRENT_CONTENT_METHOD PYTHON_METHOD_DEF \
+( \
+ get_current_content, "", \
+ METH_NOARGS, py_global, \
+ "Provide access to the active loaded content, as a" \
+ " pychrysalide.analysis.LoadedContent instance, or None" \
+ " if no current content is loaded." \
+)
+
+ content = get_current_content();
+
+ if (content != NULL)
+ {
+ result = pygobject_new(G_OBJECT(content));
+ g_object_unref(G_OBJECT(content));
+ }
+ else
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : - *
* *
* Description : Définit une extension du module 'core' à compléter. *
@@ -103,6 +151,7 @@ bool populate_gui_core_module_with_global(void)
static PyMethodDef py_global_methods[] = {
GLOBAL_GET_EDITOR_WINDOW_METHOD,
+ GLOBAL_GET_CURRENT_CONTENT_METHOD,
{ NULL }
};
diff --git a/plugins/pychrysalide/gui/editem.c b/plugins/pychrysalide/gui/editem.c
index 68962ae..71bf316 100644
--- a/plugins/pychrysalide/gui/editem.c
+++ b/plugins/pychrysalide/gui/editem.c
@@ -51,6 +51,12 @@ static void py_editor_item_change_view_wrapper(GEditorItem *, GLoadedPanel *, GL
/* Réagit à une modification de la vue du contenu analysé. */
static void py_editor_item_update_view_wrapper(GEditorItem *, GLoadedPanel *);
+/* Réagit à une modification de la vue du contenu analysé. */
+static void py_editor_item_track_cursor_wrapper(GEditorItem *, GLoadedPanel *, const GLineCursor *);
+
+/* Réagit à une modification de la vue du contenu analysé. */
+static void py_editor_item_focus_cursor_wrapper(GEditorItem *, GLoadedContent *, const GLineCursor *);
+
/* ---------------------------------------------------------------------------------- */
@@ -77,6 +83,9 @@ void py_editor_item_init_gclass(GEditorItemClass *class, gpointer unused)
class->change_view = py_editor_item_change_view_wrapper;
class->update_view = py_editor_item_update_view_wrapper;
+ class->track_cursor = py_editor_item_track_cursor_wrapper;
+ class->focus_cursor = py_editor_item_focus_cursor_wrapper;
+
}
@@ -255,6 +264,100 @@ static void py_editor_item_update_view_wrapper(GEditorItem *item, GLoadedPanel *
}
+/******************************************************************************
+* *
+* Paramètres : item = instance à consulter. *
+* panel = composant d'affichage parcouru. *
+* cursor = nouvel emplacement du curseur courant. *
+* *
+* Description : Réagit à une modification de la vue du contenu analysé. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void py_editor_item_track_cursor_wrapper(GEditorItem *item, GLoadedPanel *panel, const GLineCursor *cursor)
+{
+ PyObject *pyobj; /* Objet Python concerné */
+ PyThreadState *tstate; /* Contexte d'environnement */
+ PyObject *args; /* Arguments pour l'appel */
+ PyObject *pyret; /* Retour de Python */
+
+ pyobj = pygobject_new(G_OBJECT(item));
+
+ tstate = get_pychrysalide_main_tstate();
+
+ if (tstate != NULL)
+ PyEval_RestoreThread(tstate);
+
+ if (has_python_method(pyobj, "_track_cursor"))
+ {
+ args = PyTuple_New(2);
+ PyTuple_SetItem(args, 0, pygobject_new(G_OBJECT(panel)));
+ PyTuple_SetItem(args, 1, pygobject_new(G_OBJECT(cursor)));
+
+ pyret = run_python_method(pyobj, "_track_cursor", args);
+
+ Py_DECREF(args);
+ Py_DECREF(pyret);
+
+ }
+
+ if (tstate != NULL)
+ PyEval_SaveThread();
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : item = instance à consulter. *
+* content = contenu contenant le curseur à représenter. *
+* cursor = nouvel emplacement du curseur courant. *
+* *
+* Description : Réagit à une modification de la vue du contenu analysé. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void py_editor_item_focus_cursor_wrapper(GEditorItem *item, GLoadedContent *content, const GLineCursor *cursor)
+{
+ PyObject *pyobj; /* Objet Python concerné */
+ PyThreadState *tstate; /* Contexte d'environnement */
+ PyObject *args; /* Arguments pour l'appel */
+ PyObject *pyret; /* Retour de Python */
+
+ pyobj = pygobject_new(G_OBJECT(item));
+
+ tstate = get_pychrysalide_main_tstate();
+
+ if (tstate != NULL)
+ PyEval_RestoreThread(tstate);
+
+ if (has_python_method(pyobj, "_focus_cursor"))
+ {
+ args = PyTuple_New(2);
+ PyTuple_SetItem(args, 0, pygobject_new(G_OBJECT(content)));
+ PyTuple_SetItem(args, 1, pygobject_new(G_OBJECT(cursor)));
+
+ pyret = run_python_method(pyobj, "_focus_cursor", args);
+
+ Py_DECREF(args);
+ Py_DECREF(pyret);
+
+ }
+
+ if (tstate != NULL)
+ PyEval_SaveThread();
+
+}
+
+
/* ---------------------------------------------------------------------------------- */
/* FONCTIONNALITES D'UN ELEMENT */
diff --git a/src/analysis/db/items/comment.c b/src/analysis/db/items/comment.c
index 47ab5b3..1c1025e 100644
--- a/src/analysis/db/items/comment.c
+++ b/src/analysis/db/items/comment.c
@@ -1389,7 +1389,7 @@ static int g_db_comment_contains_cursor(const GDbComment *comment, size_t index,
assert(G_IS_BINARY_CURSOR(cursor));
- g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr);
+ g_binary_cursor_retrieve(G_BINARY_CURSOR(cursor), &addr);
result = cmp_vmpa(&addr, &comment->addr);
diff --git a/src/arch/instruction.c b/src/arch/instruction.c
index 5880c34..f571330 100644
--- a/src/arch/instruction.c
+++ b/src/arch/instruction.c
@@ -1771,7 +1771,7 @@ static int g_arch_instruction_contains_cursor(const GArchInstruction *instr, siz
assert(G_IS_BINARY_CURSOR(cursor));
- g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr);
+ g_binary_cursor_retrieve(G_BINARY_CURSOR(cursor), &addr);
result = cmp_mrange_with_vmpa(&instr->range, &addr);
diff --git a/src/format/symbol.c b/src/format/symbol.c
index 149dd2a..f16e0a9 100644
--- a/src/format/symbol.c
+++ b/src/format/symbol.c
@@ -552,7 +552,7 @@ static int g_binary_symbol_contains_cursor(const GBinSymbol *symbol, size_t inde
assert(G_IS_BINARY_CURSOR(cursor));
- g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr);
+ g_binary_cursor_retrieve(G_BINARY_CURSOR(cursor), &addr);
/**
* En tant que générateur, le symbole ne couvre qu'une ou plusieurs lignes
diff --git a/src/glibext/gbinarycursor.c b/src/glibext/gbinarycursor.c
index 86f931f..5d4c0f8 100644
--- a/src/glibext/gbinarycursor.c
+++ b/src/glibext/gbinarycursor.c
@@ -416,6 +416,29 @@ void g_binary_cursor_set_raw(GBinaryCursor *cursor, bool raw)
/******************************************************************************
* *
+* Paramètres : cursor = suivi de positions à consulter. *
+* *
+* Description : Indique la représentation de l'emplacement. *
+* *
+* Retour : true so la représentation de l'emplacement est brute. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_binary_cursor_is_raw(const GBinaryCursor *cursor)
+{
+ bool result; /* Statut à retourner */
+
+ result = cursor->raw;
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : cursor = suivi de positions à mettre à jour. *
* addr = emplacement dans le binaire visé. *
* *
@@ -447,7 +470,7 @@ void g_binary_cursor_update(GBinaryCursor *cursor, const vmpa2t *addr)
* *
******************************************************************************/
-void g_binary_cursor_get_info(const GBinaryCursor *cursor, vmpa2t *addr)
+void g_binary_cursor_retrieve(const GBinaryCursor *cursor, vmpa2t *addr)
{
copy_vmpa(addr, &cursor->addr);
diff --git a/src/glibext/gbinarycursor.h b/src/glibext/gbinarycursor.h
index defcb56..082d80f 100644
--- a/src/glibext/gbinarycursor.h
+++ b/src/glibext/gbinarycursor.h
@@ -57,6 +57,9 @@ GType g_binary_cursor_get_type(void);
/* Crée un nouveau suivi de positions dans un panneau. */
GLineCursor *g_binary_cursor_new(void);
+/* Indique la représentation de l'emplacement. */
+bool g_binary_cursor_is_raw(const GBinaryCursor *);
+
/* Précise la représentation de l'emplacement. */
void g_binary_cursor_set_raw(GBinaryCursor *, bool);
@@ -64,7 +67,7 @@ void g_binary_cursor_set_raw(GBinaryCursor *, bool);
void g_binary_cursor_update(GBinaryCursor *, const vmpa2t *);
/* Transmet la position de suivi dans un panneau de chargement. */
-void g_binary_cursor_get_info(const GBinaryCursor *, vmpa2t *);
+void g_binary_cursor_retrieve(const GBinaryCursor *, vmpa2t *);
diff --git a/src/glibext/gbinportion.c b/src/glibext/gbinportion.c
index 0074713..f7b3832 100644
--- a/src/glibext/gbinportion.c
+++ b/src/glibext/gbinportion.c
@@ -1071,7 +1071,7 @@ static int g_binary_portion_contains_cursor(const GBinPortion *portion, size_t i
assert(G_IS_BINARY_CURSOR(cursor));
- g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr);
+ g_binary_cursor_retrieve(G_BINARY_CURSOR(cursor), &addr);
result = cmp_vmpa(&addr, get_mrange_addr(&portion->range));
diff --git a/src/glibext/generators/hex.c b/src/glibext/generators/hex.c
index 48fc5b3..6a0287d 100644
--- a/src/glibext/generators/hex.c
+++ b/src/glibext/generators/hex.c
@@ -386,7 +386,7 @@ static int g_hex_generator_contains_cursor(const GHexGenerator *generator, size_
assert(G_IS_BINARY_CURSOR(cursor));
- g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr);
+ g_binary_cursor_retrieve(G_BINARY_CURSOR(cursor), &addr);
init_vmpa(&pos, generator->bytes_per_line * index, VMPA_NO_VIRTUAL);
diff --git a/src/glibext/generators/prologue.c b/src/glibext/generators/prologue.c
index 63d326b..133220d 100644
--- a/src/glibext/generators/prologue.c
+++ b/src/glibext/generators/prologue.c
@@ -328,7 +328,7 @@ static int g_intro_generator_contains_cursor(const GIntroGenerator *generator, s
assert(G_IS_BINARY_CURSOR(cursor));
- g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr);
+ g_binary_cursor_retrieve(G_BINARY_CURSOR(cursor), &addr);
result = cmp_vmpa(&addr, &generator->addr);
diff --git a/src/glibext/generators/rborder.c b/src/glibext/generators/rborder.c
index 640fa2d..7d90f79 100644
--- a/src/glibext/generators/rborder.c
+++ b/src/glibext/generators/rborder.c
@@ -305,7 +305,7 @@ static int g_border_generator_contains_cursor(const GBorderGenerator *generator,
assert(G_IS_BINARY_CURSOR(cursor));
- g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr);
+ g_binary_cursor_retrieve(G_BINARY_CURSOR(cursor), &addr);
result = cmp_vmpa(&addr, &generator->addr);
diff --git a/src/gtkext/gtkgraphdisplay.c b/src/gtkext/gtkgraphdisplay.c
index ed3c923..95a9d01 100644
--- a/src/gtkext/gtkgraphdisplay.c
+++ b/src/gtkext/gtkgraphdisplay.c
@@ -917,7 +917,7 @@ static void gtk_graph_display_prepare_for_cursor(GtkGraphDisplay *display, const
assert(G_IS_BINARY_CURSOR(cursor));
- g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr);
+ g_binary_cursor_retrieve(G_BINARY_CURSOR(cursor), &addr);
if (display->routine == NULL)
need_update = true;
diff --git a/src/gui/dialogs/export_graph.c b/src/gui/dialogs/export_graph.c
index 55556b6..0af0203 100644
--- a/src/gui/dialogs/export_graph.c
+++ b/src/gui/dialogs/export_graph.c
@@ -117,7 +117,7 @@ void run_graph_export_assistant(GLoadedBinary *binary, GtkGraphDisplay *display,
if (cursor != NULL)
{
- g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &target);
+ g_binary_cursor_retrieve(G_BINARY_CURSOR(cursor), &target);
g_object_unref(G_OBJECT(cursor));
diff --git a/src/gui/editem-int.h b/src/gui/editem-int.h
index 744a55f..cf2d813 100644
--- a/src/gui/editem-int.h
+++ b/src/gui/editem-int.h
@@ -79,8 +79,10 @@ struct _GEditorItemClass
change_item_content_fc change_content; /* Changement de contenu */
change_item_view_fc change_view; /* Rechargement dû à une vue */
update_item_view_fc update_view; /* Rechargement dû à évolutions*/
+
track_cursor_in_view_fc track_cursor; /* Suivi des positions */
focus_cursor_fc focus_cursor; /* Prête attention à une addr. */
+
update_project_fc update_project; /* Actualisation des binaires */
};
diff --git a/src/gui/menus/edition.c b/src/gui/menus/edition.c
index 2cfcf85..cdf8aa3 100644
--- a/src/gui/menus/edition.c
+++ b/src/gui/menus/edition.c
@@ -487,7 +487,7 @@ static void mcb_edition_switch_numeric_operand(GtkMenuItem *menuitem, gpointer u
assert(G_IS_IMM_OPERAND(creator));
cursor = g_loaded_panel_get_cursor(panel);
- g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr);
+ g_binary_cursor_retrieve(G_BINARY_CURSOR(cursor), &addr);
g_object_unref(G_OBJECT(cursor));
binary = G_LOADED_BINARY(get_current_content());
@@ -570,7 +570,7 @@ static void mcb_edition_follow_ref(GtkMenuItem *menuitem, gpointer unused)
proc = g_loaded_binary_get_processor(binary);
cursor = g_loaded_panel_get_cursor(panel);
- g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &iaddr);
+ g_binary_cursor_retrieve(G_BINARY_CURSOR(cursor), &iaddr);
g_object_unref(G_OBJECT(cursor));
defined = g_targetable_operand_get_addr(G_TARGETABLE_OPERAND(creator), &iaddr, format, proc, &addr);
@@ -624,7 +624,7 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar)
assert(GTK_IS_BLOCK_DISPLAY(panel) || GTK_IS_GRAPH_DISPLAY(panel));
cursor = g_loaded_panel_get_cursor(panel);
- g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr);
+ g_binary_cursor_retrieve(G_BINARY_CURSOR(cursor), &addr);
g_object_unref(G_OBJECT(cursor));
binary = G_LOADED_BINARY(get_current_content());
@@ -703,7 +703,7 @@ static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar)
assert(GTK_IS_BLOCK_DISPLAY(panel) || GTK_IS_GRAPH_DISPLAY(panel));
cursor = g_loaded_panel_get_cursor(panel);
- g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr);
+ g_binary_cursor_retrieve(G_BINARY_CURSOR(cursor), &addr);
g_object_unref(G_OBJECT(cursor));
/* Accès à la collection */