summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-06-06 14:08:21 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-06-06 14:08:21 (GMT)
commitb5934203c1cb287eb46b07e866b54d1de240b87b (patch)
tree283fad2a6d4517b84985331e5234095c71c8734b /src/analysis
parente72eea33b9967d4169d2c8ffcb4a9e85c4c3ee8c (diff)
Used a treeview with icons to show all known symbols.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@165 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/routine.c29
-rw-r--r--src/analysis/routine.h18
-rw-r--r--src/analysis/type.c7
-rw-r--r--src/analysis/type.h4
-rw-r--r--src/analysis/variable.c16
-rw-r--r--src/analysis/variable.h8
6 files changed, 54 insertions, 28 deletions
diff --git a/src/analysis/routine.c b/src/analysis/routine.c
index c5bf056..8db366d 100644
--- a/src/analysis/routine.c
+++ b/src/analysis/routine.c
@@ -340,6 +340,25 @@ void g_binary_routine_set_namespace(GBinRoutine *routine, GOpenidaType *namespac
/******************************************************************************
* *
+* Paramètres : routine = routine à mettre à jour. *
+* *
+* Description : Fournit le groupe d'appartenance d'une routine donnée. *
+* *
+* Retour : éventuelle instance d'appartenance ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GOpenidaType *g_binary_routine_get_namespace(const GBinRoutine *routine)
+{
+ return routine->namespace;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : routine = routine à mettre à jour. *
* name = désignation humainement lisible. *
* *
@@ -444,7 +463,9 @@ void g_binary_routine_set_return_type(GBinRoutine *routine, GOpenidaType *type)
g_object_unref(G_OBJECT(routine->ret_type));
routine->ret_type = type;
- g_object_ref(G_OBJECT(type));
+
+ if (type != NULL)
+ g_object_ref(G_OBJECT(type));
}
@@ -593,7 +614,7 @@ size_t g_binary_routine_get_var_index_from_offset(const GBinRoutine *routine, si
* *
******************************************************************************/
-char *g_binary_routine_to_string(const GBinRoutine *routine)
+char *_g_binary_routine_to_string(const GBinRoutine *routine, Routine2StringOptions options)
{
char *result; /* Chaîne à renvoyer */
char *namespace; /* Groupe d'appartenance */
@@ -629,7 +650,7 @@ char *g_binary_routine_to_string(const GBinRoutine *routine)
/* Nom de la routine */
- if (routine->namespace != NULL)
+ if (options & RSO_NAMESPACE && routine->namespace != NULL)
{
namespace = g_openida_type_to_string(routine->namespace);
@@ -650,7 +671,7 @@ char *g_binary_routine_to_string(const GBinRoutine *routine)
{
if (i > 0) result = stradd(result, ", ");
- typestr = g_binary_variable_to_string(routine->args[i]);
+ typestr = g_binary_variable_to_string(routine->args[i], !(options & RSO_LONG_TYPE));
result = stradd(result, typestr);
free(typestr);
diff --git a/src/analysis/routine.h b/src/analysis/routine.h
index 0b673f7..cd17bf3 100644
--- a/src/analysis/routine.h
+++ b/src/analysis/routine.h
@@ -58,6 +58,17 @@ typedef struct _GBinRoutine GBinRoutine;
typedef struct _GBinRoutineClass GBinRoutineClass;
+/* Modalités de représentation en chaîne */
+typedef enum _Routine2StringOptions
+{
+ RSO_LONG_TYPE = (1 << 0), /* Type avec espace de noms */
+ RSO_NAMESPACE = (1 << 1) /* Affichage de l'appartenance */
+
+} Routine2StringOptions;
+
+#define RSO_ALL (RSO_LONG_TYPE | RSO_NAMESPACE)
+
+
/* Indique le type définit pour une représentation de routine. */
GType g_bin_routine_get_type(void);
@@ -88,6 +99,9 @@ void g_binary_routine_set_type(GBinRoutine *, RoutineType);
/* Définit le groupe d'appartenance d'une routine donnée. */
void g_binary_routine_set_namespace(GBinRoutine *, GOpenidaType *);
+/* Fournit le groupe d'appartenance d'une routine donnée. */
+GOpenidaType *g_binary_routine_get_namespace(const GBinRoutine *);
+
/* Définit le nom humain d'une routine. */
void g_binary_routine_set_name(GBinRoutine *, char *);
@@ -113,7 +127,9 @@ void g_binary_routine_register_if_needed(GBinRoutine *, size_t, bool);
size_t g_binary_routine_get_var_index_from_offset(const GBinRoutine *, size_t, bool);
/* Décrit le prototype de la routine sous forme de caractères. */
-char *g_binary_routine_to_string(const GBinRoutine *);
+char *_g_binary_routine_to_string(const GBinRoutine *, Routine2StringOptions);
+
+#define g_binary_routine_to_string(r) _g_binary_routine_to_string((r), RSO_ALL)
diff --git a/src/analysis/type.c b/src/analysis/type.c
index 3282e2b..d16917f 100644
--- a/src/analysis/type.c
+++ b/src/analysis/type.c
@@ -366,7 +366,8 @@ void g_openida_type_set_namespace(GOpenidaType *type, GOpenidaType *namespace)
/******************************************************************************
* *
-* Paramètres : type = type à convertir. *
+* Paramètres : type = type à convertir. *
+* simple = indique si l'espace de noms doit être exclus ou non.*
* *
* Description : Décrit le type fourni sous forme de caractères. *
* *
@@ -376,14 +377,14 @@ void g_openida_type_set_namespace(GOpenidaType *type, GOpenidaType *namespace)
* *
******************************************************************************/
-char *g_openida_type_to_string(const GOpenidaType *type)
+char *_g_openida_type_to_string(const GOpenidaType *type, bool simple)
{
char *result; /* Chaîne à retourner */
char *namespace; /* Groupe d'appartenance */
result = type->to_string(type);
- if (type->namespace != NULL)
+ if (!simple && type->namespace != NULL)
{
namespace = g_openida_type_to_string(type->namespace);
diff --git a/src/analysis/type.h b/src/analysis/type.h
index 2662235..ac17235 100644
--- a/src/analysis/type.h
+++ b/src/analysis/type.h
@@ -72,7 +72,9 @@ GOpenidaType *g_openida_type_dup(const GOpenidaType *);
void g_openida_type_set_namespace(GOpenidaType *, GOpenidaType *);
/* Décrit le type fourni sous forme de caractères. */
-char *g_openida_type_to_string(const GOpenidaType *);
+char *_g_openida_type_to_string(const GOpenidaType *, bool);
+
+#define g_openida_type_to_string(t) _g_openida_type_to_string((t), false)
/* Ajoute un qualificatif à une instance de type. */
void g_openida_type_add_qualifier(GOpenidaType *, TypeQualifier);
diff --git a/src/analysis/variable.c b/src/analysis/variable.c
index 87df60e..86fc4cc 100644
--- a/src/analysis/variable.c
+++ b/src/analysis/variable.c
@@ -234,18 +234,10 @@ void g_binary_variable_set_owner(GBinVariable *var, GOpenidaType *owner)
}
-
-
-
-
-
-
-
-
-
/******************************************************************************
* *
-* Paramètres : var = variable à convertir. *
+* Paramètres : var = variable à convertir. *
+* simple = indique si l'espace de noms doit être exclus ou non.*
* *
* Description : Décrit la variable donnée sous forme de caractères. *
* *
@@ -255,11 +247,11 @@ void g_binary_variable_set_owner(GBinVariable *var, GOpenidaType *owner)
* *
******************************************************************************/
-char *g_binary_variable_to_string(const GBinVariable *var)
+char *g_binary_variable_to_string(const GBinVariable *var, bool simple)
{
char *result; /* Valeur à retourner */
- result = g_openida_type_to_string(var->type);
+ result = _g_openida_type_to_string(var->type, simple);
if (var->name != NULL)
{
diff --git a/src/analysis/variable.h b/src/analysis/variable.h
index 88e2b91..df8ee81 100644
--- a/src/analysis/variable.h
+++ b/src/analysis/variable.h
@@ -72,14 +72,8 @@ GOpenidaType *g_binary_variable_get_owner(const GBinVariable *);
/* Définit la zone d'appartenance d'une variable donnée. */
void g_binary_variable_set_owner(GBinVariable *, GOpenidaType *);
-
-
-
-
-/* TODO : remme */
-
/* Décrit la variable donnée sous forme de caractères. */
-char *g_binary_variable_to_string(const GBinVariable *);
+char *g_binary_variable_to_string(const GBinVariable *, bool);