diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2009-07-04 12:21:26 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2009-07-04 12:21:26 (GMT) |
commit | a60e81ac70b3d829f486ce7b6534005a9d025206 (patch) | |
tree | 0e3b284a12a1f8f4932f5cd05247a556cf8c5bf9 /src/analysis/roptions.c | |
parent | b6893c7b85c34f7a3c65ac76bfd9d95b1c4ebf55 (diff) |
Defined general rendering options using a GLib object.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@89 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/roptions.c')
-rw-r--r-- | src/analysis/roptions.c | 239 |
1 files changed, 239 insertions, 0 deletions
diff --git a/src/analysis/roptions.c b/src/analysis/roptions.c new file mode 100644 index 0000000..aab8ef7 --- /dev/null +++ b/src/analysis/roptions.c @@ -0,0 +1,239 @@ + +/* OpenIDA - Outil d'analyse de fichiers binaires + * roptions.c - options de rendus des lignes de code + * + * Copyright (C) 2009 Cyrille Bagard + * + * This file is part of OpenIDA. + * + * OpenIDA 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. + * + * OpenIDA 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 Foobar. If not, see <http://www.gnu.org/licenses/>. + */ + + +#include "roptions.h" + + + +/* Options de représentation (instance) */ +struct _GRenderingOptions +{ + exe_format *format; /* Format du contenu bianire */ + GArchProcessor *proc; /* Architecture utilisée */ + + bool show_address[MRD_COUNT]; /* Affichage de l'adresse ? */ + bool show_code[MRD_COUNT]; /* Affichage du code brut ? */ + +}; + +/* Options de représentation (classe) */ +struct _GRenderingOptionsClass +{ + GObjectClass parent; /* A laisser en premier */ + +}; + + +/* Initialise la classe des options pour le rendu des lignes. */ +static void g_rendering_options_class_init(GRenderingOptionsClass *); + +/* Initialise une instance d'options pour le rendu des lignes. */ +static void g_rendering_options_init(GRenderingOptions *); + + + +/* Indique le type définit pour une ligne de représentation. */ +G_DEFINE_TYPE(GRenderingOptions, g_rendering_options, G_TYPE_OBJECT); + + +/****************************************************************************** +* * +* Paramètres : klass = classe à initialiser. * +* * +* Description : Initialise la classe des options pour le rendu des lignes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_rendering_options_class_init(GRenderingOptionsClass *klass) +{ + +} + + +/****************************************************************************** +* * +* Paramètres : options = instance à initialiser. * +* * +* Description : Initialise une instance d'options pour le rendu des lignes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_rendering_options_init(GRenderingOptions *options) +{ + +} + + +/****************************************************************************** +* * +* Paramètres : format = format du contenu binaire. * +* proc = architecture utilisée par le binaire. * +* * +* Description : Crée un un groupe d'options pour le rendu des lignes. * +* * +* Retour : Adresse de la structure mise en place. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GRenderingOptions *g_rendering_options_new(exe_format *format, GArchProcessor *proc) +{ + GRenderingOptions *result; /* Structure à retourner */ + + result = g_object_new(G_TYPE_RENDERING_OPTIONS, NULL); + + result->format = format; + result->proc = proc; + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : options = options à consulter. * +* * +* Description : Fournit le format du contenu binaire représenté. * +* * +* Retour : Format du contenu binaire. * +* * +* Remarques : - * +* * +******************************************************************************/ + +exe_format *g_rendering_options_get_format(const GRenderingOptions *options) +{ + return options->format; + +} + + +/****************************************************************************** +* * +* Paramètres : options = options à consulter. * +* * +* Description : Fournit l'architecture du contenu binaire représenté. * +* * +* Retour : Architecture utilisée par le binaire. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GArchProcessor *g_rendering_options_get_processor(const GRenderingOptions *options) +{ + return options->proc; + +} + + +/****************************************************************************** +* * +* Paramètres : options = options à mettre à jour. * +* rendering = type de rendu impliqué. * +* state = nouvel état de l'option visée. * +* * +* Description : Affiche (ou non) les adresses des instructions. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_rendering_options_show_address(GRenderingOptions *options, MainRendering rendering, bool state) +{ + options->show_address[rendering] = state; + +} + + +/****************************************************************************** +* * +* Paramètres : options = options à consulter. * +* rendering = type de rendu impliqué. * +* * +* Description : Indique si les adresses des instructions sont à afficher. * +* * +* Retour : Etat courant de l'option visée. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool g_rendering_options_has_to_show_address(const GRenderingOptions *options, MainRendering rendering) +{ + return options->show_address[rendering]; + +} + + +/****************************************************************************** +* * +* Paramètres : options = options à mettre à jour. * +* rendering = type de rendu impliqué. * +* state = nouvel état de l'option visée. * +* * +* Description : Affiche (ou non) le code des instructions. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_rendering_options_show_code(GRenderingOptions *options, MainRendering rendering, bool state) +{ + options->show_code[rendering] = state; + +} + + +/****************************************************************************** +* * +* Paramètres : options = options à consulter. * +* rendering = type de rendu impliqué. * +* * +* Description : Indique si le code des instructions est à afficher. * +* * +* Retour : Etat courant de l'option visée. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool g_rendering_options_has_to_show_code(const GRenderingOptions *options, MainRendering rendering) +{ + return options->show_code[rendering]; + +} |