diff options
Diffstat (limited to 'src/glibext')
| -rw-r--r-- | src/glibext/Makefile.am | 3 | ||||
| -rw-r--r-- | src/glibext/gbinarycursor.c | 204 | ||||
| -rw-r--r-- | src/glibext/gbinarycursor.h | 65 | ||||
| -rw-r--r-- | src/glibext/glinecursor-int.h | 48 | ||||
| -rw-r--r-- | src/glibext/glinecursor.c | 126 | ||||
| -rw-r--r-- | src/glibext/glinecursor.h | 52 | ||||
| -rw-r--r-- | src/glibext/gloadedpanel-int.h | 9 | ||||
| -rw-r--r-- | src/glibext/gloadedpanel.c | 50 | ||||
| -rw-r--r-- | src/glibext/gloadedpanel.h | 7 | 
9 files changed, 564 insertions, 0 deletions
diff --git a/src/glibext/Makefile.am b/src/glibext/Makefile.am index 9a7c49f..9efc138 100644 --- a/src/glibext/Makefile.am +++ b/src/glibext/Makefile.am @@ -8,10 +8,13 @@ libglibext_la_SOURCES =					\  	configuration.h configuration.c		\  	delayed-int.h						\  	delayed.h delayed.c					\ +	gbinarycursor.h gbinarycursor.c		\  	gbinportion.h gbinportion.c			\  	gbuffercache.h gbuffercache.c		\  	gbufferline.h gbufferline.c			\  	gbufferview.h gbufferview.c			\ +	glinecursor-int.h					\ +	glinecursor.h glinecursor.c			\  	gloadedpanel-int.h					\  	gloadedpanel.h gloadedpanel.c		\  	gnhash.h gnhash.c					\ diff --git a/src/glibext/gbinarycursor.c b/src/glibext/gbinarycursor.c new file mode 100644 index 0000000..3bd7199 --- /dev/null +++ b/src/glibext/gbinarycursor.c @@ -0,0 +1,204 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * gbinarycursor.c - suivi de positions dans des panneaux de chargement + * + * Copyright (C) 2018 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 Chrysalide.  If not, see <http://www.gnu.org/licenses/>. + */ + + +#include "gbinarycursor.h" + + + +/* Suivi de positions dans un panneau de chargement (instance) */ +struct _GBinaryCursor +{ +    GObject parent;                         /* A laisser en premier        */ + +    vmpa2t addr;                            /* Position mémoire du curseur */ + +}; + +/* Suivi de positions dans un panneau de chargement (classe) */ +struct _GBinaryCursorClass +{ +    GObjectClass parent;                    /* A laisser en premier        */ + +}; + + +/* Procède à l'initialisation d'une classe de suivi de position. */ +static void g_binary_cursor_class_init(GBinaryCursorClass *); + +/* Procède à l'initialisation d'un suivi de positions. */ +static void g_binary_cursor_init(GBinaryCursor *); + +/* Supprime toutes les références externes. */ +static void g_binary_cursor_dispose(GBinaryCursor *); + +/* Procède à la libération totale de la mémoire. */ +static void g_binary_cursor_finalize(GBinaryCursor *); + + + +/* Détermine le type du gestionnaire de largeurs associées aux lignes. */ +G_DEFINE_TYPE(GBinaryCursor, g_binary_cursor, G_TYPE_OBJECT); + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : class = classe de composant GTK à initialiser.               * +*                                                                             * +*  Description : Procède à l'initialisation d'une classe de suivi de position.* +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static void g_binary_cursor_class_init(GBinaryCursorClass *class) +{ +    GObjectClass *object;                   /* Autre version de la classe  */ + +    object = G_OBJECT_CLASS(class); + +    object->dispose = (GObjectFinalizeFunc/* ! */)g_binary_cursor_dispose; +    object->finalize = (GObjectFinalizeFunc)g_binary_cursor_finalize; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : cursor = composant GLib à initialiser.                       * +*                                                                             * +*  Description : Procède à l'initialisation d'un suivi de positions.          * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static void g_binary_cursor_init(GBinaryCursor *cursor) +{ +    init_vmpa(&cursor->addr, VMPA_NO_PHYSICAL, VMPA_NO_VIRTUAL); + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : cursor = instance d'objet GLib à traiter.                    * +*                                                                             * +*  Description : Supprime toutes les références externes.                     * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static void g_binary_cursor_dispose(GBinaryCursor *cursor) +{ +    G_OBJECT_CLASS(g_binary_cursor_parent_class)->dispose(G_OBJECT(cursor)); + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : cursor = instance d'objet GLib à traiter.                    * +*                                                                             * +*  Description : Procède à la libération totale de la mémoire.                * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static void g_binary_cursor_finalize(GBinaryCursor *cursor) +{ +    G_OBJECT_CLASS(g_binary_cursor_parent_class)->finalize(G_OBJECT(cursor)); + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : -                                                            * +*                                                                             * +*  Description : Crée un nouveau suivi de positions dans un panneau.          * +*                                                                             * +*  Retour      : Instance de suivi en place.                                  * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GLineCursor *g_binary_cursor_new(void) +{ +    GLineCursor *result;                    /* Instance à retourner        */ + +    result = g_object_new(G_TYPE_BINARY_CURSOR, NULL); + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : cursor = suivi de positions à mettre à jour.                 * +*                addr   = emplacement dans le binaire visé.                   * +*                                                                             * +*  Description : Met à jour la position suivi dans un panneau de chargement.  * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +void g_binary_cursor_update(GBinaryCursor *cursor, const vmpa2t *addr) +{ +    copy_vmpa(&cursor->addr, addr); + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : cursor = suivi de positions à consulter.                     * +*                addr   = emplacement dans le binaire visé. [OUT]             * +*                                                                             * +*  Description : Transmet la position suivi dans un panneau de chargement.    * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +void g_binary_cursor_get_info(GBinaryCursor *cursor, vmpa2t *addr) +{ +    copy_vmpa(addr, &cursor->addr); + +} diff --git a/src/glibext/gbinarycursor.h b/src/glibext/gbinarycursor.h new file mode 100644 index 0000000..e6617b6 --- /dev/null +++ b/src/glibext/gbinarycursor.h @@ -0,0 +1,65 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * gbinarycursor.h - prototypes pour le suivi de positions dans des panneaux de chargement + * + * Copyright (C) 2018 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 Chrysalide.  If not, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef _GLIBEXT_BINARYCURSOR_H +#define _GLIBEXT_BINARYCURSOR_H + + +#include <glib-object.h> + + +#include "glinecursor.h" +#include "../arch/vmpa.h" + + + +#define G_TYPE_BINARY_CURSOR            (g_binary_cursor_get_type()) +#define G_BINARY_CURSOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_BINARY_CURSOR, GBinaryCursor)) +#define G_BINARY_CURSOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_BINARY_CURSOR, GBinaryCursorClass)) +#define G_IS_BINARY_CURSOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_BINARY_CURSOR)) +#define G_IS_BINARY_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_BINARY_CURSOR)) +#define G_BINARY_CURSOR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_BINARY_CURSOR, GBinaryCursorClass)) + + +/* Suivi de positions dans un panneau de chargement (instance) */ +typedef struct _GBinaryCursor GBinaryCursor; + +/* Suivi de positions dans un panneau de chargement (classe) */ +typedef struct _GBinaryCursorClass GBinaryCursorClass; + + +/* Détermine le type du suivi de positions dans un panneau de chargement. */ +GType g_binary_cursor_get_type(void); + +/* Crée un nouveau suivi de positions dans un panneau. */ +GLineCursor *g_binary_cursor_new(void); + +/* Met à jour la position suivi dans un panneau de chargement. */ +void g_binary_cursor_update(GBinaryCursor *, const vmpa2t *); + +/* Transmet la position suivi dans un panneau de chargement. */ +void g_binary_cursor_get_info(GBinaryCursor *, vmpa2t *); + + + +#endif  /* _GLIBEXT_BINARYCURSOR_H */ diff --git a/src/glibext/glinecursor-int.h b/src/glibext/glinecursor-int.h new file mode 100644 index 0000000..411b072 --- /dev/null +++ b/src/glibext/glinecursor-int.h @@ -0,0 +1,48 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * glinecursor-int.h - définitions internes propres au suivi de positions + * + * Copyright (C) 2018 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 Chrysalide.  If not, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef _GLIBEXT_GLINECURSOR_INT_H +#define _GLIBEXT_GLINECURSOR_INT_H + + +#include "glinecursor.h" + + + +/* Suivi de positions dans un panneau de chargement (instance) */ +struct _GLineCursor +{ +    GObject parent;                         /* A laisser en premier        */ + +}; + +/* Suivi de positions dans un panneau de chargement (classe) */ +struct _GLineCursorClass +{ +    GObjectClass parent;                    /* A laisser en premier        */ + +}; + + + +#endif  /* _GLIBEXT_GLINECURSOR_INT_H */ diff --git a/src/glibext/glinecursor.c b/src/glibext/glinecursor.c new file mode 100644 index 0000000..8ad24bd --- /dev/null +++ b/src/glibext/glinecursor.c @@ -0,0 +1,126 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * glinecursor.c - suivi de positions dans des panneaux de chargement + * + * Copyright (C) 2018 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 Chrysalide.  If not, see <http://www.gnu.org/licenses/>. + */ + + +#include "glinecursor.h" + + +#include "glinecursor-int.h" + + + +/* Procède à l'initialisation d'une classe de suivi de position. */ +static void g_line_cursor_class_init(GLineCursorClass *); + +/* Procède à l'initialisation d'un suivi de positions. */ +static void g_line_cursor_init(GLineCursor *); + +/* Supprime toutes les références externes. */ +static void g_line_cursor_dispose(GLineCursor *); + +/* Procède à la libération totale de la mémoire. */ +static void g_line_cursor_finalize(GLineCursor *); + + + +/* Détermine le type du gestionnaire de largeurs associées aux lignes. */ +G_DEFINE_TYPE(GLineCursor, g_line_cursor, G_TYPE_OBJECT); + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : class = classe de composant GTK à initialiser.               * +*                                                                             * +*  Description : Procède à l'initialisation d'une classe de suivi de position.* +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static void g_line_cursor_class_init(GLineCursorClass *class) +{ +    GObjectClass *object;                   /* Autre version de la classe  */ + +    object = G_OBJECT_CLASS(class); + +    object->dispose = (GObjectFinalizeFunc/* ! */)g_line_cursor_dispose; +    object->finalize = (GObjectFinalizeFunc)g_line_cursor_finalize; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : cursor = composant GLib à initialiser.                       * +*                                                                             * +*  Description : Procède à l'initialisation d'un suivi de positions.          * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static void g_line_cursor_init(GLineCursor *cursor) +{ + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : cursor = instance d'objet GLib à traiter.                    * +*                                                                             * +*  Description : Supprime toutes les références externes.                     * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static void g_line_cursor_dispose(GLineCursor *cursor) +{ +    G_OBJECT_CLASS(g_line_cursor_parent_class)->dispose(G_OBJECT(cursor)); + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : cursor = instance d'objet GLib à traiter.                    * +*                                                                             * +*  Description : Procède à la libération totale de la mémoire.                * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static void g_line_cursor_finalize(GLineCursor *cursor) +{ +    G_OBJECT_CLASS(g_line_cursor_parent_class)->finalize(G_OBJECT(cursor)); + +} diff --git a/src/glibext/glinecursor.h b/src/glibext/glinecursor.h new file mode 100644 index 0000000..e541e66 --- /dev/null +++ b/src/glibext/glinecursor.h @@ -0,0 +1,52 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * glinecursor.h - prototypes pour le suivi de positions dans des panneaux de chargement + * + * Copyright (C) 2018 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 Chrysalide.  If not, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef _GLIBEXT_LINECURSOR_H +#define _GLIBEXT_LINECURSOR_H + + +#include <glib-object.h> + + + +#define G_TYPE_LINE_CURSOR            (g_line_cursor_get_type()) +#define G_LINE_CURSOR(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_LINE_CURSOR, GLineCursor)) +#define G_LINE_CURSOR_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_LINE_CURSOR, GLineCursorClass)) +#define G_IS_LINE_CURSOR(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_LINE_CURSOR)) +#define G_IS_LINE_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_LINE_CURSOR)) +#define G_LINE_CURSOR_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_LINE_CURSOR, GLineCursorClass)) + + +/* Suivi de positions dans un panneau de chargement (instance) */ +typedef struct _GLineCursor GLineCursor; + +/* Suivi de positions dans un panneau de chargement (classe) */ +typedef struct _GLineCursorClass GLineCursorClass; + + +/* Détermine le type du suivi de positions dans un panneau de chargement. */ +GType g_line_cursor_get_type(void); + + + +#endif  /* _GLIBEXT_LINECURSOR_H */ diff --git a/src/glibext/gloadedpanel-int.h b/src/glibext/gloadedpanel-int.h index 3059912..b26ca06 100644 --- a/src/glibext/gloadedpanel-int.h +++ b/src/glibext/gloadedpanel-int.h @@ -35,6 +35,12 @@ typedef void (* set_loaded_panel_content_fc) (GLoadedPanel *, GLoadedContent *);  /* Fournit le contenu associé à un panneau de chargement. */  typedef GLoadedContent * (* get_loaded_panel_content_fc) (const GLoadedPanel *); +/* Fournit le position courante dans un panneau de chargement. */ +typedef GLineCursor * (* get_loaded_cursor_fc) (const GLoadedPanel *); + +/* Définit le position courante dans un panneau de chargement. */ +typedef void (* set_loaded_cursor_fc) (GLoadedPanel *, const GLineCursor *); +  /* Place en cache un rendu destiné à l'aperçu graphique rapide. */  typedef void (* cache_loaded_glance_fc) (GLoadedPanel *, cairo_t *, const GtkAllocation *, double); @@ -47,6 +53,9 @@ struct _GLoadedPanelIface      set_loaded_panel_content_fc set_content;/* Définition du contenu       */      get_loaded_panel_content_fc get_content;/* Récupération du contenu     */ +    get_loaded_cursor_fc get_cursor;        /* Fourniture d'une position   */ +    set_loaded_cursor_fc set_cursor;        /* Application d'une position  */ +      cache_loaded_glance_fc cache_glance;    /* Cache de la mignature       */  }; diff --git a/src/glibext/gloadedpanel.c b/src/glibext/gloadedpanel.c index 341c207..5f43821 100644 --- a/src/glibext/gloadedpanel.c +++ b/src/glibext/gloadedpanel.c @@ -109,6 +109,56 @@ GLoadedContent *g_loaded_panel_get_content(const GLoadedPanel *panel)  /******************************************************************************  *                                                                             * +*  Paramètres  : panel = composant GTK à consulter.                           * +*                                                                             * +*  Description : Fournit le position courante dans un panneau de chargement.  * +*                                                                             * +*  Retour      : Informations relatives à la position du curseur.             * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GLineCursor *g_loaded_panel_get_cursor(const GLoadedPanel *panel) +{ +    GLineCursor *result;                    /* Contenu à retourner         */ +    GLoadedPanelIface *iface;               /* Interface utilisée          */ + +    iface = G_LOADED_PANEL_GET_IFACE(panel); + +    result = iface->get_cursor(panel); + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : panel  = composant GTK à mettre à jour.                      * +*                cursor = informations relatives à la position du curseur.    * +*                                                                             * +*  Description : Définit le position courante dans un panneau de chargement.  * +*                                                                             * +*  Retour      : -                                                            * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +void g_loaded_panel_set_cursor(GLoadedPanel *panel, const GLineCursor *cursor) +{ +    GLoadedPanelIface *iface;               /* Interface utilisée          */ + +    iface = G_LOADED_PANEL_GET_IFACE(panel); + +    iface->set_cursor(panel, cursor); + +} + + +/****************************************************************************** +*                                                                             *  *  Paramètres  : panel = composant GTK à manipuler.                           *  *                cairo = assistant pour la création de rendus.                *  *                area  = taille de la surface réduite à disposition.          * diff --git a/src/glibext/gloadedpanel.h b/src/glibext/gloadedpanel.h index 545760b..5d22cdb 100644 --- a/src/glibext/gloadedpanel.h +++ b/src/glibext/gloadedpanel.h @@ -29,6 +29,7 @@  #include <gtk/gtk.h> +#include "glinecursor.h"  #include "../analysis/loaded.h" @@ -57,6 +58,12 @@ void g_loaded_panel_set_content(GLoadedPanel *, GLoadedContent *);  /* Fournit le contenu associé à un panneau de chargement. */  GLoadedContent *g_loaded_panel_get_content(const GLoadedPanel *); +/* Fournit le position courante dans un panneau de chargement. */ +GLineCursor *g_loaded_panel_get_cursor(const GLoadedPanel *); + +/* Définit le position courante dans un panneau de chargement. */ +void g_loaded_panel_set_cursor(GLoadedPanel *, const GLineCursor *); +  /* Place en cache un rendu destiné à l'aperçu graphique rapide. */  void g_loaded_panel_cache_glance(GLoadedPanel *, cairo_t *, const GtkAllocation *, double);  | 
