summaryrefslogtreecommitdiff
path: root/src/format
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-10-12 07:28:19 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-10-12 07:28:19 (GMT)
commitc7a14e50bd002e3922969e9bae7816753aefb073 (patch)
treecd098d2f92880705810dfdc353dad6ad1412b2c2 /src/format
parent4a51f37982c2d5d358971e947d05786b939af88e (diff)
Reorganized types definitions.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@267 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format')
-rw-r--r--src/format/dex/class.c4
-rwxr-xr-xsrc/format/dex/dex.c4
-rw-r--r--src/format/dex/pool.c14
-rw-r--r--src/format/dex/pool.h4
-rw-r--r--src/format/mangling/context-int.h2
-rw-r--r--src/format/mangling/context.c2
-rw-r--r--src/format/mangling/context.h2
-rw-r--r--src/format/mangling/demangler.c4
-rw-r--r--src/format/mangling/demangler.h2
-rw-r--r--src/format/mangling/itanium_gram.y64
-rw-r--r--src/format/mangling/java_gram.y7
11 files changed, 56 insertions, 53 deletions
diff --git a/src/format/dex/class.c b/src/format/dex/class.c
index cdf6c2c..52389c4 100644
--- a/src/format/dex/class.c
+++ b/src/format/dex/class.c
@@ -370,7 +370,7 @@ void g_dex_class_decompile(const GDexClass *class, GLangOutput *lang, GCodeBuffe
{
- GOpenidaType *type;
+ GDataType *type;
size_t i; /* Boucle de parcours */
@@ -392,7 +392,7 @@ GBufferLine *line, GLangOutput *output)
//g_buffer_line_insert_text(line, BLC_ASSEMBLY, "{", 3, RTT_SIGNS);
- //printf("Output :: %s\n", _g_openida_type_to_string(type, true));
+ //printf("Output :: %s\n", _g_data_type_to_string(type, true));
diff --git a/src/format/dex/dex.c b/src/format/dex/dex.c
index 7075929..821da7a 100755
--- a/src/format/dex/dex.c
+++ b/src/format/dex/dex.c
@@ -304,7 +304,7 @@ static void g_dex_format_decompile(const GDexFormat *format, GCodeBuffer *buffer
#if 0
- GOpenidaType *get_type_from_dex_pool(const GDexFormat *format, uint16_t index)
+ GDataType *get_type_from_dex_pool(const GDexFormat *format, uint16_t index)
Décrit le type fourni sous forme de caractères. *
@@ -315,7 +315,7 @@ static void g_dex_format_decompile(const GDexFormat *format, GCodeBuffer *buffer
* *
******************************************************************************/
-char *_g_openida_type_to_string(const GOpenidaType *type, bool simple)
+char *_g_data_type_to_string(const GDataType *type, bool simple)
#endif
diff --git a/src/format/dex/pool.c b/src/format/dex/pool.c
index d82144f..9237839 100644
--- a/src/format/dex/pool.c
+++ b/src/format/dex/pool.c
@@ -84,7 +84,7 @@ const char *get_string_from_dex_pool(const GDexFormat *format, uint32_t index)
* *
******************************************************************************/
-GOpenidaType *get_type_from_dex_pool(const GDexFormat *format, uint16_t index)
+GDataType *get_type_from_dex_pool(const GDexFormat *format, uint16_t index)
{
off_t pos; /* Tête de lecture */
type_id_item type_id; /* Définition de la classe */
@@ -141,9 +141,9 @@ GOpenidaType *get_type_from_dex_pool(const GDexFormat *format, uint16_t index)
* *
******************************************************************************/
-GOpenidaType *get_class_from_dex_pool(const GDexFormat *format, uint32_t index)
+GDataType *get_class_from_dex_pool(const GDexFormat *format, uint32_t index)
{
- GOpenidaType *result; /* Instance à retourner */
+ GDataType *result; /* Instance à retourner */
off_t pos; /* Tête de lecture */
class_def_item class_def; /* Définition de la classe */
@@ -185,9 +185,9 @@ GBinVariable *get_field_from_dex_pool(const GDexFormat *format, uint32_t index)
GBinVariable *result; /* Instance à retourner */
off_t pos; /* Tête de lecture */
field_id_item field_id; /* Description du champ */
- GOpenidaType *type; /* Type du champ */
+ GDataType *type; /* Type du champ */
const char *name; /* Désignation humaine */
- GOpenidaType *owner; /* Propriétaire du champ */
+ GDataType *owner; /* Propriétaire du champ */
if (index >= format->header.field_ids_size)
return NULL;
@@ -250,7 +250,7 @@ GBinRoutine *get_routine_from_dex_pool(const GDexFormat *format, uint32_t index)
method_id_item meth_id; /* Description de la méthode */
- GOpenidaType *type;
+ GDataType *type;
string_id_item str_id; /* Identifiant de chaîne */
string_data_item str_data; /* Description de chaîne */
@@ -281,7 +281,7 @@ GBinRoutine *get_routine_from_dex_pool(const GDexFormat *format, uint32_t index)
printf("class is nil\n");
else
- printf("class = '%s'\n", g_openida_type_to_string(type));
+ printf("class = '%s'\n", g_data_type_to_string(type));
*/
/* Nom de la méthode */
diff --git a/src/format/dex/pool.h b/src/format/dex/pool.h
index 56fd99c..6894da1 100644
--- a/src/format/dex/pool.h
+++ b/src/format/dex/pool.h
@@ -34,11 +34,11 @@
const char *get_string_from_dex_pool(const GDexFormat *, uint32_t);
/* Extrait une représentation de type d'une table DEX. */
-GOpenidaType *get_type_from_dex_pool(const GDexFormat *, uint16_t);
+GDataType *get_type_from_dex_pool(const GDexFormat *, uint16_t);
/* Extrait une représentation de classe d'une table DEX. */
-GOpenidaType *get_class_from_dex_pool(const GDexFormat *, uint32_t);
+GDataType *get_class_from_dex_pool(const GDexFormat *, uint32_t);
diff --git a/src/format/mangling/context-int.h b/src/format/mangling/context-int.h
index ba4a1a9..1cf0359 100644
--- a/src/format/mangling/context-int.h
+++ b/src/format/mangling/context-int.h
@@ -37,7 +37,7 @@ struct _GDemanglingContext
union
{
GBinRoutine *routine; /* Routine décodée */
- GOpenidaType *type; /* Type décodé */
+ GDataType *type; /* Type décodé */
};
};
diff --git a/src/format/mangling/context.c b/src/format/mangling/context.c
index 05fc9a2..7180995 100644
--- a/src/format/mangling/context.c
+++ b/src/format/mangling/context.c
@@ -108,7 +108,7 @@ GBinRoutine *g_demangling_context_get_decoded_routine(const GDemanglingContext *
* *
******************************************************************************/
-GOpenidaType *g_demangling_context_get_decoded_type(const GDemanglingContext *context)
+GDataType *g_demangling_context_get_decoded_type(const GDemanglingContext *context)
{
return context->type;
diff --git a/src/format/mangling/context.h b/src/format/mangling/context.h
index c584838..767d231 100644
--- a/src/format/mangling/context.h
+++ b/src/format/mangling/context.h
@@ -53,7 +53,7 @@ GType g_demangling_context_get_type(void);
GBinRoutine *g_demangling_context_get_decoded_routine(const GDemanglingContext *);
/* Fournit le type créé à l'issue du codage. */
-GOpenidaType *g_demangling_context_get_decoded_type(const GDemanglingContext *);
+GDataType *g_demangling_context_get_decoded_type(const GDemanglingContext *);
diff --git a/src/format/mangling/demangler.c b/src/format/mangling/demangler.c
index 012c736..52dad54 100644
--- a/src/format/mangling/demangler.c
+++ b/src/format/mangling/demangler.c
@@ -202,9 +202,9 @@ GBinRoutine *demangle_routine(DemanglerType type, const char *desc)
* *
******************************************************************************/
-GOpenidaType *demangle_type(DemanglerType type, const char *desc)
+GDataType *demangle_type(DemanglerType type, const char *desc)
{
- GOpenidaType *result; /* Construction à remonter */
+ GDataType *result; /* Construction à remonter */
GDemanglingContext *context; /* Contexte pour le décodage */
result = NULL;
diff --git a/src/format/mangling/demangler.h b/src/format/mangling/demangler.h
index 7fe5850..8b1c160 100644
--- a/src/format/mangling/demangler.h
+++ b/src/format/mangling/demangler.h
@@ -47,7 +47,7 @@ GBinRoutine *try_to_demangle_routine(const char *);
GBinRoutine *demangle_routine(DemanglerType, const char *);
/* Tente de décoder une chaîne de caractères donnée. */
-GOpenidaType *demangle_type(DemanglerType, const char *);
+GDataType *demangle_type(DemanglerType, const char *);
diff --git a/src/format/mangling/itanium_gram.y b/src/format/mangling/itanium_gram.y
index ab59ac7..0fd3b2b 100644
--- a/src/format/mangling/itanium_gram.y
+++ b/src/format/mangling/itanium_gram.y
@@ -10,6 +10,8 @@
#include "context-int.h"
#include "itanium.h"
#include "../../common/extstr.h"
+#include "../../analysis/types/cse.h"
+#include "../../analysis/types/template.h"
@@ -87,10 +89,10 @@ static GBinRoutine *g_itanium_dcontext_push_routine(GItaniumDContext *, GBinRout
static GBinRoutine *g_itanium_dcontext_pop_routine(GItaniumDContext *);
/* Ajoute un élément dans une liste de substitutions. */
-static void g_itanium_dcontext_add_item(GItaniumDContext *, GOpenidaType *);
+static void g_itanium_dcontext_add_item(GItaniumDContext *, GDataType *);
/* Fournit le nième élément d'une liste de substitutions. */
-static GOpenidaType *g_itanium_dcontext_get_item(GItaniumDContext *, guint);
+static GDataType *g_itanium_dcontext_get_item(GItaniumDContext *, guint);
/* Autorise ou non le dépilement des opérateurs. */
static void g_itanium_dcontext_update(GItaniumDContext *);
@@ -104,7 +106,7 @@ static void g_itanium_dcontext_update(GItaniumDContext *);
static void compute_routine_itanium_ret_type(GBinRoutine *);
/* Recherche et fait sauter les premiers arguments rencontrés. */
-static void update_itanium_ret_type(GOpenidaType *);
+static void update_itanium_ret_type(GDataType *);
@@ -164,7 +166,7 @@ char *strmerge(char *str1, const char *sep, char *str2);
union
{
char *str;
- void/*GOpenidaType*/ *type;
+ void/*GDataType*/ *type;
};
int/*bool*/ is_string;
@@ -175,7 +177,7 @@ char *strmerge(char *str1, const char *sep, char *str2);
unsigned int val;
short/*s16_t*/ s16_val;
- void /*GOpenidaType*/ *type;
+ void /*GDataType*/ *type;
void /*GTemplateType*/ *templtype;
void/*simple_variable*/ *simple;
@@ -339,7 +341,7 @@ name:
{
char *tmp;
- tmp = g_openida_type_to_string($1);
+ tmp = g_data_type_to_string($1);
$$.type = g_template_type_new(tmp, $2);
$$.is_string = false;
@@ -350,7 +352,7 @@ name:
}
//g_template_type_add_params($1, $2);
- printf(" [name tmp:: %s]\n", g_openida_type_to_string($$.type));
+ printf(" [name tmp:: %s]\n", g_data_type_to_string($$.type));
}
;
@@ -374,8 +376,8 @@ nested_name:
$$ = ($4 != NULL ? strmerge($3, "::", $4) : $3); printf("passage nested p+uq = '%s'\n", $$);
$$ = g_class_enum_type_new(CET_UNKNOWN, $$); g_itanium_dcontext_add_item(context, $$);
}
- | NN registered_template_prefix template_args EE { $$ = $2; g_template_type_add_params($2, $3); printf(" [nested tmp:: %s]\n", g_openida_type_to_string($$)); }
- | NN qualifiers registered_template_prefix template_args EE { $$ = $3; g_template_type_add_params($3, $4); printf(" [nested tmp:: %s]\n", g_openida_type_to_string($$)); }
+ | NN registered_template_prefix template_args EE { $$ = $2; g_template_type_add_params($2, $3); printf(" [nested tmp:: %s]\n", g_data_type_to_string($$)); }
+ | NN qualifiers registered_template_prefix template_args EE { $$ = $3; g_template_type_add_params($3, $4); printf(" [nested tmp:: %s]\n", g_data_type_to_string($$)); }
;
@@ -386,19 +388,19 @@ registered_prefix:
else
{
g_itanium_dcontext_add_item(context, $1);
- $$ = g_openida_type_to_string($1);
+ $$ = g_data_type_to_string($1);
}
}
| substitution {
- $$ = g_openida_type_to_string($1);
- printf("prefix substi :: %s\n", g_openida_type_to_string($1));
+ $$ = g_data_type_to_string($1);
+ printf("prefix substi :: %s\n", g_data_type_to_string($1));
}
;
prefix:
/* vide */ { $$ = NULL; }
- | registered_prefix unqualified_name { $$ = ($2 != NULL ? g_class_enum_type_new(CET_CLASS, strmerge($1, "::", $2)) : $1); printf("passage p+uq = '%s'\n", g_openida_type_to_string($$)); }
- | registered_template_prefix template_args { $$ = $1; g_template_type_add_params($1, $2); printf("passage p_tmp = '%s'\n", g_openida_type_to_string($$)); }
+ | registered_prefix unqualified_name { $$ = ($2 != NULL ? g_class_enum_type_new(CET_CLASS, strmerge($1, "::", $2)) : $1); printf("passage p+uq = '%s'\n", g_data_type_to_string($$)); }
+ | registered_template_prefix template_args { $$ = $1; g_template_type_add_params($1, $2); printf("passage p_tmp = '%s'\n", g_data_type_to_string($$)); }
;
registered_template_prefix:
@@ -414,12 +416,12 @@ template_prefix:
g_itanium_dcontext_add_item(context, g_class_enum_type_new(CET_CLASS, $$));
}
| template_param {
- $$ = g_openida_type_to_string($1);
+ $$ = g_data_type_to_string($1);
printf("[[ tmp param %s ]]\n", $$);
g_object_unref(G_OBJECT($1));
}
| substitution {
- $$ = g_openida_type_to_string($1);
+ $$ = g_data_type_to_string($1);
printf("template_prefix substi :: %s\n", $$);
g_object_unref(G_OBJECT($1));
}
@@ -526,20 +528,20 @@ function_type:
type:
- builtin_type { $$ = $1; printf("builtin '%s'\n", g_openida_type_to_string($1)); }
+ builtin_type { $$ = $1; printf("builtin '%s'\n", g_data_type_to_string($1)); }
| class_enum_type { $$ = $1; printf("type :: %p\n", $1); fflush(NULL); g_itanium_dcontext_add_item(context, $1); }
| substitution { $$ = $1; }
| template_param { $$ = $1; }
| template_template_param template_args {
- $$ = g_template_type_new(g_openida_type_to_string($1), NULL);
+ $$ = g_template_type_new(g_data_type_to_string($1), NULL);
g_object_unref($1);
g_template_type_add_params($$, $2);
- printf(" [type tmp:: %s]\n", g_openida_type_to_string($$));
+ printf(" [type tmp:: %s]\n", g_data_type_to_string($$));
}
| function_type { $$ = $1; }
| qualifiers type {
- $$ = g_openida_type_dup($2);
- g_openida_type_add_qualifier($$, $1);
+ $$ = g_data_type_dup($2);
+ g_data_type_add_qualifier($$, $1);
g_itanium_dcontext_add_item(context, $$);
}
| TP type { $$ = g_encapsulated_type_new(ECT_POINTER, $2); g_itanium_dcontext_add_item(context, $$); }
@@ -604,14 +606,14 @@ class_enum_type:
template_param:
TPARAM_FIRST {
- const GOpenidaType *type = g_binary_routine_get_type_from_name(routine);
+ const GDataType *type = g_binary_routine_get_type_from_name(routine);
if (G_IS_TEMPLATE_TYPE(type))
$$ = g_template_type_get_param(G_TEMPLATE_TYPE(type), 0);
else $$ = NULL;
if ($$ == NULL) YYERROR; if (!G_IS_BASIC_TYPE($$)) g_itanium_dcontext_add_item(context, $$);
}
| TPARAM_N {
- const GOpenidaType *type = g_binary_routine_get_type_from_name(routine);
+ const GDataType *type = g_binary_routine_get_type_from_name(routine);
if (G_IS_TEMPLATE_TYPE(type))
$$ = g_template_type_get_param(G_TEMPLATE_TYPE(type), $1 + 1);
else $$ = NULL;
@@ -929,11 +931,11 @@ static GBinRoutine *g_itanium_dcontext_pop_routine(GItaniumDContext *context)
* *
******************************************************************************/
-static void g_itanium_dcontext_add_item(GItaniumDContext *context, GOpenidaType *type)
+static void g_itanium_dcontext_add_item(GItaniumDContext *context, GDataType *type)
{
g_object_ref(G_OBJECT(type));
- printf(" [[ %u ]] PUSH '%s' (%p)\n", g_slist_length(context->substitutions) - 1, g_openida_type_to_string(type), type);
+ printf(" [[ %u ]] PUSH '%s' (%p)\n", g_slist_length(context->substitutions) - 1, g_data_type_to_string(type), type);
context->substitutions = g_slist_append(context->substitutions, type);
@@ -953,11 +955,11 @@ static void g_itanium_dcontext_add_item(GItaniumDContext *context, GOpenidaType
* *
******************************************************************************/
-static GOpenidaType *g_itanium_dcontext_get_item(GItaniumDContext *context, guint n)
+static GDataType *g_itanium_dcontext_get_item(GItaniumDContext *context, guint n)
{
printf("get [%u] == %p\n", n, g_slist_nth_data(context->substitutions, n + 1));
- return G_OPENIDA_TYPE(g_slist_nth_data(context->substitutions, n + 1));
+ return G_DATA_TYPE(g_slist_nth_data(context->substitutions, n + 1));
}
@@ -1072,7 +1074,7 @@ bool demangle_itanium_routine(GItaniumDContext *context, const char *desc)
GBinRoutine *routine; /* Routine à construire */
YY_BUFFER_STATE buffer; /* Tampon pour bison */
int ret; /* Bilan de l'appel */
- GOpenidaType *name_type; /* Nom basé sur un type ? */
+ GDataType *name_type; /* Nom basé sur un type ? */
routine = g_demangling_context_get_decoded_routine(G_DEMANGLING_CONTEXT(context));
@@ -1113,7 +1115,7 @@ static void compute_routine_itanium_ret_type(GBinRoutine *routine)
size_t count; /* Nombre d'arguments présents */
size_t i; /* Boucle de parcours */
GBinVariable *arg; /* Argument de la routine */
- GOpenidaType *type; /* Type associé à l'argument */
+ GDataType *type; /* Type associé à l'argument */
/* Traitement récursif des arguments */
@@ -1173,12 +1175,12 @@ static void compute_routine_itanium_ret_type(GBinRoutine *routine)
* *
******************************************************************************/
-static void update_itanium_ret_type(GOpenidaType *type)
+static void update_itanium_ret_type(GDataType *type)
{
GTemplateType *template; /* Gabarit à analyser */
size_t max; /* Nombre d'itérations */
size_t i; /* Boucle de parcours */
- GOpenidaType *subtype; /* Type à traiter */
+ GDataType *subtype; /* Type à traiter */
GEncapsulatedType *encaps; /* Encapsulation quelconque */
GBinRoutine *routine; /* Routine à traiter */
diff --git a/src/format/mangling/java_gram.y b/src/format/mangling/java_gram.y
index 25d5ffb..bbd2de3 100644
--- a/src/format/mangling/java_gram.y
+++ b/src/format/mangling/java_gram.y
@@ -5,6 +5,7 @@
#include "context-int.h"
#include "java.h"
+#include "../../analysis/types/cse.h"
@@ -53,7 +54,7 @@ static void g_java_dcontext_init(GJavaDContext *);
%union {
- void /*GOpenidaType*/ *type;
+ void /*GDataType*/ *type;
size_t adeep; /* Dimension d'un tableau */
@@ -125,12 +126,12 @@ full_class_name:
TEXT { $$ = g_class_enum_type_new(CET_CLASS, $1); }
| full_class_name SLASH TEXT {
$$ = g_class_enum_type_new(CET_CLASS, $3);
- g_openida_type_set_namespace($$, $1);
+ g_data_type_set_namespace($$, $1);
g_object_unref($1);
}
| full_class_name DOLLAR TEXT {
$$ = g_class_enum_type_new(CET_CLASS, $3);
- g_openida_type_set_namespace($$, $1);
+ g_data_type_set_namespace($$, $1);
g_object_unref($1);
}
;