summaryrefslogtreecommitdiff
path: root/src/decomp/expr
diff options
context:
space:
mode:
Diffstat (limited to 'src/decomp/expr')
-rw-r--r--src/decomp/expr/Makefile.am28
-rw-r--r--src/decomp/expr/access.c249
-rw-r--r--src/decomp/expr/access.h60
-rw-r--r--src/decomp/expr/arithm.c286
-rw-r--r--src/decomp/expr/arithm.h76
-rw-r--r--src/decomp/expr/array.c251
-rw-r--r--src/decomp/expr/array.h61
-rw-r--r--src/decomp/expr/assign.c287
-rw-r--r--src/decomp/expr/assign.h66
-rw-r--r--src/decomp/expr/block.c395
-rw-r--r--src/decomp/expr/block.h84
-rw-r--r--src/decomp/expr/call.c290
-rw-r--r--src/decomp/expr/call.h64
-rw-r--r--src/decomp/expr/comp.c311
-rw-r--r--src/decomp/expr/comp.h60
-rw-r--r--src/decomp/expr/cond.c461
-rw-r--r--src/decomp/expr/cond.h72
-rw-r--r--src/decomp/expr/dalvik/Makefile.am12
-rw-r--r--src/decomp/expr/dalvik/array.c155
-rw-r--r--src/decomp/expr/dalvik/array.h61
-rw-r--r--src/decomp/expr/immediate.c153
-rw-r--r--src/decomp/expr/immediate.h61
-rw-r--r--src/decomp/expr/pseudo.c253
-rw-r--r--src/decomp/expr/pseudo.h83
-rw-r--r--src/decomp/expr/return.c243
-rw-r--r--src/decomp/expr/return.h60
-rw-r--r--src/decomp/expr/text.c159
-rw-r--r--src/decomp/expr/text.h60
28 files changed, 0 insertions, 4401 deletions
diff --git a/src/decomp/expr/Makefile.am b/src/decomp/expr/Makefile.am
deleted file mode 100644
index 665c3f7..0000000
--- a/src/decomp/expr/Makefile.am
+++ /dev/null
@@ -1,28 +0,0 @@
-
-noinst_LTLIBRARIES = libdecompexpr.la
-
-libdecompexpr_la_SOURCES = \
- access.h access.c \
- arithm.h arithm.c \
- array.h array.c \
- assign.h assign.c \
- block.h block.c \
- call.h call.c \
- comp.h comp.c \
- cond.h cond.c \
- immediate.h immediate.c \
- pseudo.h pseudo.c \
- return.h return.c \
- text.h text.c
-
-libdecompexpr_la_LDFLAGS =
-
-libdecompexpr_la_LIBADD = \
- dalvik/libdecompexprdalvik.la
-
-
-AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
-
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
-
-SUBDIRS = dalvik
diff --git a/src/decomp/expr/access.c b/src/decomp/expr/access.c
deleted file mode 100644
index b16ee36..0000000
--- a/src/decomp/expr/access.c
+++ /dev/null
@@ -1,249 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * access.c - représentation des accès à des éléments d'entités
- *
- * Copyright (C) 2012-2013 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "access.h"
-
-
-#include "../expression-int.h"
-
-
-
-/* Définition d'un accès quelconque (instance) */
-struct _GAccessExpression
-{
- GDecExpression parent; /* A laisser en premier */
-
- GDecExpression *owner; /* Destination de l'accessat° */
- GDecExpression *target; /* Source de l'accessation */
-
-};
-
-
-/* Définition d'un accès quelconque (classe) */
-struct _GAccessExpressionClass
-{
- GDecExpressionClass parent; /* A laisser en premier */
-
-};
-
-
-
-/* Initialise la classe des accessations quelconques. */
-static void g_access_expression_class_init(GAccessExpressionClass *);
-
-/* Initialise une instance d'accessation quelconque. */
-static void g_access_expression_init(GAccessExpression *);
-
-/* Visite un ensemble hiérarchique d'instructions décompilées. */
-static bool g_access_expression_visit(GAccessExpression *, dec_instr_visitor_cb, DecInstrVisitFlags, void *);
-
-/* Remplace une instruction décompilée par une autre. */
-static bool g_access_expression_replace(GAccessExpression *, GDecInstruction *, GDecInstruction *);
-
-/* Imprime pour l'écran un version humaine d'une expression. */
-static GBufferLine *g_access_expression_print(const GAccessExpression *, GCodeBuffer *, GBufferLine *, GLangOutput *);
-
-
-
-/* Indique le type défini pour un accès quelconque. */
-G_DEFINE_TYPE(GAccessExpression, g_access_expression, G_TYPE_DEC_EXPRESSION);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des accessations quelconques. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_access_expression_class_init(GAccessExpressionClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = instance à initialiser. *
-* *
-* Description : Initialise une instance d'accessation quelconque. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_access_expression_init(GAccessExpression *expr)
-{
- GDecInstruction *instr; /* Autre version de l'objet */
-
- instr = G_DEC_INSTRUCTION(expr);
-
- instr->visit = (dec_instr_visit_fc)g_access_expression_visit;
- instr->replace = (dec_instr_replace_fc)g_access_expression_replace;
- instr->print = (dec_instr_print_fc)g_access_expression_print;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : owner = entité qui accueille la cible accédée. *
-* target = élément du propriétaire auquel on accède. *
-* *
-* Description : Représente l'accès à un élément d'une entité. *
-* *
-* Retour : Expression mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *g_access_expression_new(GDecExpression *owner, GDecExpression *target)
-{
- GAccessExpression *result; /* Expression à retourner */
-
- result = g_object_new(G_TYPE_ACCESS_EXPRESSION, NULL);
-
- result->owner = owner;
- result->target = target;
-
- return G_DEC_INSTRUCTION(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = première instruction à venir visiter. *
-* callback = procédure à appeler à chaque instruction visitée. *
-* flags = moments des appels à réaliser en retour. *
-* data = données quelconques associées au visiteur. *
-* *
-* Description : Visite un ensemble hiérarchique d'instructions décompilées. *
-* *
-* Retour : true si le parcours a été jusqu'à son terme, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_access_expression_visit(GAccessExpression *expr, dec_instr_visitor_cb callback, DecInstrVisitFlags flags, void *data)
-{
- bool result; /* Bilan à retourner */
-
- result = _g_dec_instruction_visit(G_DEC_INSTRUCTION(expr->owner), G_DEC_INSTRUCTION(expr),
- callback, flags, data);
-
- if (result)
- result = _g_dec_instruction_visit(G_DEC_INSTRUCTION(expr->target), G_DEC_INSTRUCTION(expr),
- callback, flags, data);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = première instruction à venir ausculter. *
-* old = instruction décompilée à venir remplacer. *
-* new = instruction décompilée à utiliser dorénavant. *
-* *
-* Description : Remplace une instruction décompilée par une autre. *
-* *
-* Retour : true si un remplacement a été effectué, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_access_expression_replace(GAccessExpression *expr, GDecInstruction *old, GDecInstruction *new)
-{
- bool result; /* Bilan à retourner */
-
- if (expr->owner == G_DEC_EXPRESSION(old))
- {
- g_object_unref(G_OBJECT(expr->owner));
- g_object_ref(G_OBJECT(new));
- expr->owner = G_DEC_EXPRESSION(new);
-
- result = true;
-
- }
- else
- result = g_dec_instruction_replace(G_DEC_INSTRUCTION(expr->owner), old, new);
-
- if (expr->target == G_DEC_EXPRESSION(old))
- {
- g_object_unref(G_OBJECT(expr->target));
- g_object_ref(G_OBJECT(new));
- expr->target = G_DEC_EXPRESSION(new);
-
- result = true;
-
- }
- else
- result |= g_dec_instruction_replace(G_DEC_INSTRUCTION(expr->target), old, new);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = expression à transcrire en version humaine. *
-* buffer = tampon où doit se réaliser l'insertion. *
-* line = ligne d'impression prête à emploi ou NULL. *
-* output = langage de programmation de sortie. *
-* *
-* Description : Imprime pour l'écran un version humaine d'une expression. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GBufferLine *g_access_expression_print(const GAccessExpression *expr, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
-{
- GBufferLine *result; /* Ligne à retourner */
-
- result = g_dec_instruction_print(G_DEC_INSTRUCTION(expr->owner),
- buffer, line, output);
-
- g_buffer_line_append_text(result, BLC_ASSEMBLY_HEAD, ".", 3, RTT_PUNCT, NULL);
-
- result = g_dec_instruction_print(G_DEC_INSTRUCTION(expr->target),
- buffer, result, output);
-
- return result;
-
-}
diff --git a/src/decomp/expr/access.h b/src/decomp/expr/access.h
deleted file mode 100644
index 220de07..0000000
--- a/src/decomp/expr/access.h
+++ /dev/null
@@ -1,60 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * access.h - prototypes pour la représentation des accès à des éléments d'entités
- *
- * Copyright (C) 2012 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _DECOMP_EXPR_ACCESS_H
-#define _DECOMP_EXPR_ACCESS_H
-
-
-#include <glib-object.h>
-
-
-#include "../expression.h"
-#include "../instruction.h"
-
-
-
-#define G_TYPE_ACCESS_EXPRESSION g_access_expression_get_type()
-#define G_ACCESS_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_access_expression_get_type(), GAccessExpression))
-#define G_IS_ACCESS_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_access_expression_get_type()))
-#define G_ACCESS_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ACCESS_EXPRESSION, GAccessExpressionClass))
-#define G_IS_ACCESS_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ACCESS_EXPRESSION))
-#define G_ACCESS_EXPRESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ACCESS_EXPRESSION, GAccessExpressionClass))
-
-
-
-/* Définition d'un accès quelconque (instance) */
-typedef struct _GAccessExpression GAccessExpression;
-
-/* Définition d'un accès quelconque (classe) */
-typedef struct _GAccessExpressionClass GAccessExpressionClass;
-
-
-/* Indique le type défini pour un accès quelconque. */
-GType g_access_expression_get_type(void);
-
-/* Représente l'accès à un élément d'une entité. */
-GDecInstruction *g_access_expression_new(GDecExpression *, GDecExpression *);
-
-
-
-#endif /* _DECOMP_EXPR_ACCESS_H */
diff --git a/src/decomp/expr/arithm.c b/src/decomp/expr/arithm.c
deleted file mode 100644
index 8944596..0000000
--- a/src/decomp/expr/arithm.c
+++ /dev/null
@@ -1,286 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * arithm.c - représentation des opérations arithmétiques
- *
- * Copyright (C) 2010-2013 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "arithm.h"
-
-
-#include "../expression-int.h"
-
-
-
-/* Définition d'une opération arithmétique définie (instance) */
-struct _GArithmExpression
-{
- GDecExpression parent; /* A laisser en premier */
-
- GDecExpression *op1; /* Premier opérande manipulé */
- GDecExpression *op2; /* Second opérande manipulé */
-
- ArithmOperationType type; /* Opération à représenter */
-
-};
-
-
-/* Définition d'une opération arithmétique définie (classe) */
-struct _GArithmExpressionClass
-{
- GDecExpressionClass parent; /* A laisser en premier */
-
-};
-
-
-
-/* Initialise la classe des opérations arithmétiques définies. */
-static void g_arithm_expression_class_init(GArithmExpressionClass *);
-
-/* Initialise une instance d'opération arithmétique définie. */
-static void g_arithm_expression_init(GArithmExpression *);
-
-/* Visite un ensemble hiérarchique d'instructions décompilées. */
-static bool g_arithm_expression_visit(GArithmExpression *, dec_instr_visitor_cb, DecInstrVisitFlags, void *);
-
-/* Remplace une instruction décompilée par une autre. */
-static bool g_arithm_expression_replace(GArithmExpression *, GDecInstruction *, GDecInstruction *);
-
-/* Imprime pour l'écran un version humaine d'une expression. */
-static GBufferLine *g_arithm_expression_print(const GArithmExpression *, GCodeBuffer *, GBufferLine *, GLangOutput *);
-
-
-
-/* Indique le type défini pour une opération arithmétique définie. */
-G_DEFINE_TYPE(GArithmExpression, g_arithm_expression, G_TYPE_DEC_EXPRESSION);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des opérations arithmétiques définies. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_arithm_expression_class_init(GArithmExpressionClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = instance à initialiser. *
-* *
-* Description : Initialise une instance d'opération arithmétique définie. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_arithm_expression_init(GArithmExpression *expr)
-{
- GDecInstruction *instr; /* Autre version de l'objet */
-
- instr = G_DEC_INSTRUCTION(expr);
-
- instr->visit = (dec_instr_visit_fc)g_arithm_expression_visit;
- instr->replace = (dec_instr_replace_fc)g_arithm_expression_replace;
- instr->print = (dec_instr_print_fc)g_arithm_expression_print;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : op1 = premier opérande à manipuler. *
-* type = type d'opération à mener ici. *
-* op2 = seconde opérande à manipuler. *
-* *
-* Description : Représente une opération arithmétique entre deux opérandes. *
-* *
-* Retour : Expression mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *g_arithm_expression_new(GDecExpression *op1, ArithmOperationType type, GDecExpression *op2)
-{
- GArithmExpression *result; /* Expression à retourner */
-
- result = g_object_new(G_TYPE_ARITHM_EXPRESSION, NULL);
-
- result->op1 = op1;
- result->op2 = op2;
-
- result->type = type;
-
- return G_DEC_INSTRUCTION(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = première instruction à venir visiter. *
-* callback = procédure à appeler à chaque instruction visitée. *
-* flags = moments des appels à réaliser en retour. *
-* data = données quelconques associées au visiteur. *
-* *
-* Description : Visite un ensemble hiérarchique d'instructions décompilées. *
-* *
-* Retour : true si le parcours a été jusqu'à son terme, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_arithm_expression_visit(GArithmExpression *expr, dec_instr_visitor_cb callback, DecInstrVisitFlags flags, void *data)
-{
- bool result; /* Bilan à retourner */
-
- result = _g_dec_instruction_visit(G_DEC_INSTRUCTION(expr->op1), G_DEC_INSTRUCTION(expr),
- callback, flags, data);
-
- if (result)
- result = _g_dec_instruction_visit(G_DEC_INSTRUCTION(expr->op2), G_DEC_INSTRUCTION(expr),
- callback, flags, data);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = première instruction à venir ausculter. *
-* old = instruction décompilée à venir remplacer. *
-* new = instruction décompilée à utiliser dorénavant. *
-* *
-* Description : Remplace une instruction décompilée par une autre. *
-* *
-* Retour : true si un remplacement a été effectué, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_arithm_expression_replace(GArithmExpression *expr, GDecInstruction *old, GDecInstruction *new)
-{
- bool result; /* Bilan à retourner */
-
- if (expr->op1 == G_DEC_EXPRESSION(old))
- {
- g_object_unref(G_OBJECT(expr->op1));
- g_object_ref(G_OBJECT(new));
- expr->op1 = G_DEC_EXPRESSION(new);
-
- result = true;
-
- }
- else
- result = g_dec_instruction_replace(G_DEC_INSTRUCTION(expr->op1), old, new);
-
- if (expr->op2 == G_DEC_EXPRESSION(old))
- {
- g_object_unref(G_OBJECT(expr->op2));
- g_object_ref(G_OBJECT(new));
- expr->op2 = G_DEC_EXPRESSION(new);
-
- result = true;
-
- }
- else
- result |= g_dec_instruction_replace(G_DEC_INSTRUCTION(expr->op2), old, new);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = expression à transcrire en version humaine. *
-* buffer = tampon où doit se réaliser l'insertion. *
-* line = ligne d'impression prête à emploi ou NULL. *
-* output = langage de programmation de sortie. *
-* *
-* Description : Imprime pour l'écran un version humaine d'une expression. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GBufferLine *g_arithm_expression_print(const GArithmExpression *expr, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
-{
- GBufferLine *result; /* Ligne à retourner */
- const char *sign; /* Symbole de l'opération */
-
- result = g_dec_instruction_print(G_DEC_INSTRUCTION(expr->op1),
- buffer, line, output);
-
- switch (expr->type)
- {
- case AOT_ADD:
- sign = " + ";
- break;
- case AOT_SUB:
- sign = " - ";
- break;
- case AOT_MUL:
- sign = " * ";
- break;
- case AOT_DIV:
- sign = " / ";
- break;
- case AOT_REM:
- sign = " % ";
- break;
- case AOT_AND:
- sign = " & ";
- break;
- case AOT_OR:
- sign = " | ";
- break;
- case AOT_XOR:
- sign = " ^ ";
- break;
- default: /* AOT_COUNT */
- sign = " ? ";
- break;
- }
-
- g_buffer_line_append_text(result, BLC_ASSEMBLY_HEAD, sign, 3, RTT_SIGNS, NULL);
-
- result = g_dec_instruction_print(G_DEC_INSTRUCTION(expr->op2),
- buffer, result, output);
-
- return result;
-
-}
diff --git a/src/decomp/expr/arithm.h b/src/decomp/expr/arithm.h
deleted file mode 100644
index 47aac7f..0000000
--- a/src/decomp/expr/arithm.h
+++ /dev/null
@@ -1,76 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * arithm.h - prototypes pour la représentation des opérations arithmétiques
- *
- * Copyright (C) 2010 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _ANALYSIS_DECOMP_COMMON_ARITHM_H
-#define _ANALYSIS_DECOMP_COMMON_ARITHM_H
-
-
-#include <glib-object.h>
-
-
-#include "../expression.h"
-#include "../instruction.h"
-
-
-
-#define G_TYPE_ARITHM_EXPRESSION g_arithm_expression_get_type()
-#define G_ARITHM_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_arithm_expression_get_type(), GArithmExpression))
-#define G_IS_ARITHM_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_arithm_expression_get_type()))
-#define G_ARITHM_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ARITHM_EXPRESSION, GArithmExpressionClass))
-#define G_IS_ARITHM_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ARITHM_EXPRESSION))
-#define G_ARITHM_EXPRESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ARITHM_EXPRESSION, GArithmExpressionClass))
-
-
-/* Définition d'une opération arithmétique définie (instance) */
-typedef struct _GArithmExpression GArithmExpression;
-
-/* Définition d'une opération arithmétique définie (classe) */
-typedef struct _GArithmExpressionClass GArithmExpressionClass;
-
-
-/* Types d'opérations menables */
-typedef enum _ArithmOperationType
-{
- AOT_ADD, /* Addition */
- AOT_SUB, /* Soustraction */
- AOT_MUL, /* Multiplication */
- AOT_DIV, /* Division */
- AOT_REM, /* Modulo */
- AOT_AND, /* Et logique */
- AOT_OR, /* Ou logique */
- AOT_XOR, /* Ou exclusif */
-
- AOT_COUNT
-
-} ArithmOperationType;
-
-
-/* Indique le type défini pour une opération arithmétique définie. */
-GType g_arithm_expression_get_type(void);
-
-/* Représente une opération arithmétique entre deux opérandes. */
-GDecInstruction *g_arithm_expression_new(GDecExpression *, ArithmOperationType, GDecExpression *);
-
-
-
-#endif /* _ANALYSIS_DECOMP_COMMON_ARITHM_H */
diff --git a/src/decomp/expr/array.c b/src/decomp/expr/array.c
deleted file mode 100644
index a78405e..0000000
--- a/src/decomp/expr/array.c
+++ /dev/null
@@ -1,251 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * array.c - manipulations de tableaux génériques
- *
- * Copyright (C) 2010-2013 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "array.h"
-
-
-#include "../expression-int.h"
-
-
-
-/* Définition d'un accès à une cellule de tableau (instance) */
-struct _GArrayAccess
-{
- GDecExpression parent; /* A laisser en premier */
-
- GDecExpression *array; /* Elément auquel accéder */
- GDecExpression *index; /* Position de la cellule */
-
-};
-
-
-/* Définition d'un accès à une cellule de tableau (classe) */
-struct _GArrayAccessClass
-{
- GDecExpressionClass parent; /* A laisser en premier */
-
-};
-
-
-
-/* Initialise la classe des accès aux cellules de tableau. */
-static void g_array_access_class_init(GArrayAccessClass *);
-
-/* Initialise une instance d'accès à une cellule de tableau. */
-static void g_array_access_init(GArrayAccess *);
-
-/* Visite un ensemble hiérarchique d'instructions décompilées. */
-static bool g_array_access_visit(GArrayAccess *, dec_instr_visitor_cb, DecInstrVisitFlags, void *);
-
-/* Remplace une instruction décompilée par une autre. */
-static bool g_array_access_replace(GArrayAccess *, GDecInstruction *, GDecInstruction *);
-
-/* Imprime pour l'écran un version humaine d'une expression. */
-static GBufferLine *g_array_access_print(const GArrayAccess *, GCodeBuffer *, GBufferLine *, GLangOutput *);
-
-
-
-/* Indique le type défini pour un accès à une cellule de tableau. */
-G_DEFINE_TYPE(GArrayAccess, g_array_access, G_TYPE_DEC_EXPRESSION);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des accès aux cellules de tableau. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_array_access_class_init(GArrayAccessClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = instance à initialiser. *
-* *
-* Description : Initialise une instance d'accès à une cellule de tableau. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_array_access_init(GArrayAccess *expr)
-{
- GDecInstruction *instr; /* Autre version de l'objet */
-
- instr = G_DEC_INSTRUCTION(expr);
-
- instr->visit = (dec_instr_visit_fc)g_array_access_visit;
- instr->replace = (dec_instr_replace_fc)g_array_access_replace;
- instr->print = (dec_instr_print_fc)g_array_access_print;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : array = tableau auquel on doit accéder. *
-* index = indice de la cellule concernée. *
-* *
-* Description : Construit un accès à une cellule de tableau comme expression.*
-* *
-* Retour : Expression mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *g_array_access_new(GDecExpression *array, GDecExpression *index)
-{
- GArrayAccess *result; /* Expression à retourner */
-
- result = g_object_new(G_TYPE_ARRAY_ACCESS, NULL);
-
- result->array = array;
- result->index = index;
-
- return G_DEC_INSTRUCTION(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = première instruction à venir visiter. *
-* callback = procédure à appeler à chaque instruction visitée. *
-* flags = moments des appels à réaliser en retour. *
-* data = données quelconques associées au visiteur. *
-* *
-* Description : Visite un ensemble hiérarchique d'instructions décompilées. *
-* *
-* Retour : true si le parcours a été jusqu'à son terme, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_array_access_visit(GArrayAccess *expr, dec_instr_visitor_cb callback, DecInstrVisitFlags flags, void *data)
-{
- bool result; /* Bilan à retourner */
-
- result = _g_dec_instruction_visit(G_DEC_INSTRUCTION(expr->array), G_DEC_INSTRUCTION(expr),
- callback, flags, data);
-
- if (result)
- result = _g_dec_instruction_visit(G_DEC_INSTRUCTION(expr->index), G_DEC_INSTRUCTION(expr),
- callback, flags, data);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = première instruction à venir ausculter. *
-* old = instruction décompilée à venir remplacer. *
-* new = instruction décompilée à utiliser dorénavant. *
-* *
-* Description : Remplace une instruction décompilée par une autre. *
-* *
-* Retour : true si un remplacement a été effectué, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_array_access_replace(GArrayAccess *expr, GDecInstruction *old, GDecInstruction *new)
-{
- bool result; /* Bilan à retourner */
-
- if (expr->array == G_DEC_EXPRESSION(old))
- {
- g_object_unref(G_OBJECT(expr->array));
- g_object_ref(G_OBJECT(new));
- expr->array = G_DEC_EXPRESSION(new);
-
- result = true;
-
- }
- else
- result = g_dec_instruction_replace(G_DEC_INSTRUCTION(expr->array), old, new);
-
- if (expr->index == G_DEC_EXPRESSION(old))
- {
- g_object_unref(G_OBJECT(expr->index));
- g_object_ref(G_OBJECT(new));
- expr->index = G_DEC_EXPRESSION(new);
-
- result = true;
-
- }
- else
- result |= g_dec_instruction_replace(G_DEC_INSTRUCTION(expr->index), old, new);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = expression à transcrire en version humaine. *
-* buffer = tampon où doit se réaliser l'insertion. *
-* line = ligne d'impression prête à emploi ou NULL. *
-* output = langage de programmation de sortie. *
-* *
-* Description : Imprime pour l'écran un version humaine d'une expression. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GBufferLine *g_array_access_print(const GArrayAccess *expr, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
-{
- GBufferLine *result; /* Ligne à retourner */
-
- result = g_dec_instruction_print(G_DEC_INSTRUCTION(expr->array),
- buffer, line, output);
-
- g_buffer_line_append_text(result, BLC_ASSEMBLY_HEAD, "[", 1, RTT_RAW, NULL);
-
- result = g_dec_instruction_print(G_DEC_INSTRUCTION(expr->index),
- buffer, result, output);
-
- g_buffer_line_append_text(result, BLC_ASSEMBLY_HEAD, "]", 1, RTT_RAW, NULL);
-
- return result;
-
-}
diff --git a/src/decomp/expr/array.h b/src/decomp/expr/array.h
deleted file mode 100644
index 2cce58a..0000000
--- a/src/decomp/expr/array.h
+++ /dev/null
@@ -1,61 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * array.h - prototypes pour les manipulations de tableaux génériques
- *
- * Copyright (C) 2010 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _DECOMP_EXPR_ARRAY_H
-#define _DECOMP_EXPR_ARRAY_H
-
-
-#include <glib-object.h>
-
-
-#include "../expression.h"
-#include "../instruction.h"
-
-
-
-#define G_TYPE_ARRAY_ACCESS g_array_access_get_type()
-#define G_ARRAY_ACCESS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_array_access_get_type(), GArrayAccess))
-#define G_IS_ARRAY_ACCESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_array_access_get_type()))
-#define G_ARRAY_ACCESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ARRAY_ACCESS, GArrayAccessClass))
-#define G_IS_ARRAY_ACCESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ARRAY_ACCESS))
-#define G_ARRAY_ACCESS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ARRAY_ACCESS, GArrayAccessClass))
-
-
-
-/* Définition d'un accès à une cellule de tableau (instance) */
-typedef struct _GArrayAccess GArrayAccess;
-
-/* Définition d'un accès à une cellule de tableau (classe) */
-typedef struct _GArrayAccessClass GArrayAccessClass;
-
-
-
-/* Indique le type défini pour un accès à une cellule de tableau. */
-GType g_array_access_get_type(void);
-
-/* Construit un accès à une cellule de tableau comme expression. */
-GDecInstruction *g_array_access_new(GDecExpression *, GDecExpression *);
-
-
-
-#endif /* _DECOMP_EXPR_ARRAY_H */
diff --git a/src/decomp/expr/assign.c b/src/decomp/expr/assign.c
deleted file mode 100644
index 6a614ae..0000000
--- a/src/decomp/expr/assign.c
+++ /dev/null
@@ -1,287 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * assign.c - représentation des assignations
- *
- * Copyright (C) 2010-2013 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "assign.h"
-
-
-#include "../expression-int.h"
-
-
-
-/* Définition d'une assignation quelconque (instance) */
-struct _GAssignExpression
-{
- GDecExpression parent; /* A laisser en premier */
-
- GDecExpression *dest; /* Destination de l'assignat° */
- GDecExpression *src; /* Source de l'assignation */
-
-};
-
-
-/* Définition d'une assignation quelconque (classe) */
-struct _GAssignExpressionClass
-{
- GDecExpressionClass parent; /* A laisser en premier */
-
-};
-
-
-
-/* Initialise la classe des assignations quelconques. */
-static void g_assign_expression_class_init(GAssignExpressionClass *);
-
-/* Initialise une instance d'assignation quelconque. */
-static void g_assign_expression_init(GAssignExpression *);
-
-/* Visite un ensemble hiérarchique d'instructions décompilées. */
-static bool g_assign_expression_visit(GAssignExpression *, dec_instr_visitor_cb, DecInstrVisitFlags, void *);
-
-/* Remplace une instruction décompilée par une autre. */
-static bool g_assign_expression_replace(GAssignExpression *, GDecInstruction *, GDecInstruction *);
-
-/* Imprime pour l'écran un version humaine d'une expression. */
-static GBufferLine *g_assign_expression_print(const GAssignExpression *, GCodeBuffer *, GBufferLine *, GLangOutput *);
-
-
-
-/* Indique le type défini pour une assignation quelconque. */
-G_DEFINE_TYPE(GAssignExpression, g_assign_expression, G_TYPE_DEC_EXPRESSION);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des assignations quelconques. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_assign_expression_class_init(GAssignExpressionClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = instance à initialiser. *
-* *
-* Description : Initialise une instance d'assignation quelconque. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_assign_expression_init(GAssignExpression *expr)
-{
- GDecInstruction *instr; /* Autre version de l'objet */
-
- instr = G_DEC_INSTRUCTION(expr);
-
- instr->visit = (dec_instr_visit_fc)g_assign_expression_visit;
- instr->replace = (dec_instr_replace_fc)g_assign_expression_replace;
- instr->print = (dec_instr_print_fc)g_assign_expression_print;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : dest = expression servant de destination. *
-* src = source de l'expression à transférer. *
-* *
-* Description : Assigne le contenu d'une expression dans une autre. *
-* *
-* Retour : Expression mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *g_assign_expression_new(GDecExpression *dest, GDecExpression *src)
-{
- GAssignExpression *result; /* Expression à retourner */
-
- result = g_object_new(G_TYPE_ASSIGN_EXPRESSION, NULL);
-
- result->dest = dest;
- result->src = src;
-
- return G_DEC_INSTRUCTION(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = première instruction à venir visiter. *
-* callback = procédure à appeler à chaque instruction visitée. *
-* flags = moments des appels à réaliser en retour. *
-* data = données quelconques associées au visiteur. *
-* *
-* Description : Visite un ensemble hiérarchique d'instructions décompilées. *
-* *
-* Retour : true si le parcours a été jusqu'à son terme, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_assign_expression_visit(GAssignExpression *expr, dec_instr_visitor_cb callback, DecInstrVisitFlags flags, void *data)
-{
- bool result; /* Bilan à retourner */
-
- result = _g_dec_instruction_visit(G_DEC_INSTRUCTION(expr->dest), G_DEC_INSTRUCTION(expr),
- callback, flags, data);
-
- if (result)
- result = _g_dec_instruction_visit(G_DEC_INSTRUCTION(expr->src), G_DEC_INSTRUCTION(expr),
- callback, flags, data);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = première instruction à venir ausculter. *
-* old = instruction décompilée à venir remplacer. *
-* new = instruction décompilée à utiliser dorénavant. *
-* *
-* Description : Remplace une instruction décompilée par une autre. *
-* *
-* Retour : true si un remplacement a été effectué, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_assign_expression_replace(GAssignExpression *expr, GDecInstruction *old, GDecInstruction *new)
-{
- bool result; /* Bilan à retourner */
-
- if (expr->dest == G_DEC_EXPRESSION(old))
- {
- g_object_unref(G_OBJECT(expr->dest));
- g_object_ref(G_OBJECT(new));
- expr->dest = G_DEC_EXPRESSION(new);
-
- result = true;
-
- }
- else
- result = g_dec_instruction_replace(G_DEC_INSTRUCTION(expr->dest), old, new);
-
- if (expr->src == G_DEC_EXPRESSION(old))
- {
- g_object_unref(G_OBJECT(expr->src));
- g_object_ref(G_OBJECT(new));
- expr->src = G_DEC_EXPRESSION(new);
-
- result = true;
-
- }
- else
- result |= g_dec_instruction_replace(G_DEC_INSTRUCTION(expr->src), old, new);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = expression à transcrire en version humaine. *
-* buffer = tampon où doit se réaliser l'insertion. *
-* line = ligne d'impression prête à emploi ou NULL. *
-* output = langage de programmation de sortie. *
-* *
-* Description : Imprime pour l'écran un version humaine d'une expression. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GBufferLine *g_assign_expression_print(const GAssignExpression *expr, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
-{
- GBufferLine *result; /* Ligne à retourner */
-
- result = g_dec_instruction_print(G_DEC_INSTRUCTION(expr->dest),
- buffer, line, output);
-
- g_buffer_line_append_text(result, BLC_ASSEMBLY_HEAD, " = ", 3, RTT_SIGNS, NULL);
-
- result = g_dec_instruction_print(G_DEC_INSTRUCTION(expr->src),
- buffer, result, output);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : assign = expression à consulter. *
-* *
-* Description : Indique la destination d'une assignation. *
-* *
-* Retour : Expression mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecExpression *g_assign_expression_get_dest(const GAssignExpression *assign)
-{
- return assign->dest;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : assign = expression à consulter. *
-* *
-* Description : Indique la source d'une assignation. *
-* *
-* Retour : Expression mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecExpression *g_assign_expression_get_src(const GAssignExpression *assign)
-{
- return assign->src;
-
-}
diff --git a/src/decomp/expr/assign.h b/src/decomp/expr/assign.h
deleted file mode 100644
index ed1ad91..0000000
--- a/src/decomp/expr/assign.h
+++ /dev/null
@@ -1,66 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * assign.h - prototypes pour la représentation des assignations
- *
- * Copyright (C) 2010-2013 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _DECOMP_EXPR_ASSIGN_H
-#define _DECOMP_EXPR_ASSIGN_H
-
-
-#include <glib-object.h>
-
-
-#include "../expression.h"
-#include "../instruction.h"
-
-
-
-#define G_TYPE_ASSIGN_EXPRESSION g_assign_expression_get_type()
-#define G_ASSIGN_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_assign_expression_get_type(), GAssignExpression))
-#define G_IS_ASSIGN_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_assign_expression_get_type()))
-#define G_ASSIGN_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ASSIGN_EXPRESSION, GAssignExpressionClass))
-#define G_IS_ASSIGN_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ASSIGN_EXPRESSION))
-#define G_ASSIGN_EXPRESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ASSIGN_EXPRESSION, GAssignExpressionClass))
-
-
-
-/* Définition d'une assignation quelconque (instance) */
-typedef struct _GAssignExpression GAssignExpression;
-
-/* Définition d'une assignation quelconque (classe) */
-typedef struct _GAssignExpressionClass GAssignExpressionClass;
-
-
-/* Indique le type défini pour une assignation quelconque. */
-GType g_assign_expression_get_type(void);
-
-/* Assigne le contenu d'une expression dans une autre. */
-GDecInstruction *g_assign_expression_new(GDecExpression *, GDecExpression *);
-
-/* Indique la destination d'une assignation. */
-GDecExpression *g_assign_expression_get_dest(const GAssignExpression *);
-
-/* Indique la source d'une assignation. */
-GDecExpression *g_assign_expression_get_src(const GAssignExpression *);
-
-
-
-#endif /* _DECOMP_EXPR_ASSIGN_H */
diff --git a/src/decomp/expr/block.c b/src/decomp/expr/block.c
deleted file mode 100644
index e7d11a7..0000000
--- a/src/decomp/expr/block.c
+++ /dev/null
@@ -1,395 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * block.c - regroupement d'un lot d'instructions
- *
- * Copyright (C) 2010-2013 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "block.h"
-
-
-#include <malloc.h>
-#include <string.h>
-
-
-#include "../expression-int.h"
-
-
-
-/* Définition d'un ensemble d'instructions décompilées (instance) */
-struct _GExprBlock
-{
- GDecExpression parent; /* A laisser en premier */
-
- BlockBordeBehavior behavior; /* Type de Rendu des bordures */
-
- GDecInstruction **list; /* Instructions contenues */
- size_t count; /* Taille de cette liste */
-
-};
-
-
-/* Définition d'un ensemble d'instructions décompilées (classe) */
-struct _GExprBlockClass
-{
- GDecExpressionClass parent; /* A laisser en premier */
-
-};
-
-
-
-/* Initialise la classe des ensembles d'instructions. */
-static void g_expr_block_class_init(GExprBlockClass *);
-
-/* Initialise une instance d'ensemble d'instructions. */
-static void g_expr_block_init(GExprBlock *);
-
-/* Visite un ensemble hiérarchique d'instructions décompilées. */
-static bool g_expr_block_visit(GExprBlock *, dec_instr_visitor_cb, DecInstrVisitFlags, void *);
-
-/* Remplace une instruction décompilée par une autre. */
-static bool g_expr_block_replace(GExprBlock *, GDecInstruction *, GDecInstruction *);
-
-/* Imprime pour l'écran un version humaine d'une expression. */
-static GBufferLine *g_expr_block_print(const GExprBlock *, GCodeBuffer *, GBufferLine *, GLangOutput *);
-
-
-
-/* Indique le type défini pour un ensemble d'instructions décompilées. */
-G_DEFINE_TYPE(GExprBlock, g_expr_block, G_TYPE_DEC_EXPRESSION);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des ensembles d'instructions. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_expr_block_class_init(GExprBlockClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = instance à initialiser. *
-* *
-* Description : Initialise une instance d'ensemble d'instructions. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_expr_block_init(GExprBlock *block)
-{
- GDecInstruction *instr; /* Autre version de l'objet */
-
- instr = G_DEC_INSTRUCTION(block);
-
- instr->visit = (dec_instr_visit_fc)g_expr_block_visit;
- instr->replace = (dec_instr_replace_fc)g_expr_block_replace;
- instr->print = (dec_instr_print_fc)g_expr_block_print;
-
- block->behavior = BBB_AUTO;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : item = premier élément du nouvel ensemble. *
-* *
-* Description : Constuit un conteneur pour diverses instructions décompilées.*
-* *
-* Retour : Conteneur d'instructions mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *g_expr_block_new(GDecInstruction *item)
-{
- GExprBlock *result; /* Groupe d'instructions à renvoyer */
-
- result = g_object_new(G_TYPE_EXPR_BLOCK, NULL);
-
- g_expr_block_add_item(result, item);
-
- return G_DEC_INSTRUCTION(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = première instruction à venir visiter. *
-* *
-* Description : Fournit le comportement du bloc pour le rendu de ses bords. *
-* *
-* Retour : Comportement pour le rendu des bordures. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-BlockBordeBehavior g_expr_block_get_border_behavior(const GExprBlock *block)
-{
- return block->behavior;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = première instruction à venir visiter. *
-* behavior = comportement pour le rendu des bordures. *
-* *
-* Description : Définit le comportement du bloc pour le rendu de ses bords. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_expr_block_set_border_behavior(GExprBlock *block, BlockBordeBehavior behavior)
-{
- block->behavior = behavior;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = première instruction à venir visiter. *
-* callback = procédure à appeler à chaque instruction visitée. *
-* flags = moments des appels à réaliser en retour. *
-* data = données quelconques associées au visiteur. *
-* *
-* Description : Visite un ensemble hiérarchique d'instructions décompilées. *
-* *
-* Retour : true si le parcours a été jusqu'à son terme, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_expr_block_visit(GExprBlock *block, dec_instr_visitor_cb callback, DecInstrVisitFlags flags, void *data)
-{
- bool result; /* Bilan à retourner */
- size_t i; /* Boucle de parcours */
-
- result = true;
-
- for (i = 0; i < block->count && result; i++)
- result = _g_dec_instruction_visit(block->list[i], G_DEC_INSTRUCTION(block),
- callback, flags, data);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = première instruction à venir ausculter. *
-* old = instruction décompilée à venir remplacer. *
-* new = instruction décompilée à utiliser dorénavant. *
-* *
-* Description : Remplace une instruction décompilée par une autre. *
-* *
-* Retour : true si un remplacement a été effectué, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_expr_block_replace(GExprBlock *block, GDecInstruction *old, GDecInstruction *new)
-{
- bool result; /* Bilan à retourner */
- size_t i; /* Boucle de parcours */
-
- result = false;
-
- for (i = 0; i < block->count; i++)
- {
- if (block->list[i] == old)
- {
- g_object_unref(G_OBJECT(block->list[i]));
- g_object_ref(G_OBJECT(new));
- block->list[i] = new;
-
- result = true;
-
- }
- else
- result |= g_dec_instruction_replace(block->list[i], old, new);
-
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = expression à transcrire en version humaine. *
-* buffer = tampon où doit se réaliser l'insertion. *
-* line = ligne d'impression prête à emploi ou NULL. *
-* output = langage de programmation de sortie. *
-* *
-* Description : Imprime pour l'écran un version humaine d'une expression. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GBufferLine *g_expr_block_print(const GExprBlock *block, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
-{
- GBufferLine *result; /* Ligne à retourner */
- size_t expr_count; /* Taille officielle */
- size_t i; /* Boucle de parcours */
-
- switch (block->behavior)
- {
- case BBB_AUTO:
- expr_count = block->count;
- break;
- case BBB_FORCE_OFF:
- expr_count = 1;
- break;
- case BBB_FORCE_ON:
- expr_count = 2;
- break;
- }
-
- result = g_lang_output_start_code_block(output, buffer, line, expr_count);
-
- for (i = 0; i < block->count; i++)
- {
- if (i > 0)
- result = g_code_buffer_append_new_line_fixme(buffer); /* FIXME : n° de ligne */
-
- result = g_dec_instruction_print(block->list[i], buffer, result, output);
-
- }
-
- result = g_lang_output_end_code_block(output, buffer, result, expr_count);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = ensemble à faire évoluer. *
-* item = nouvel élément à placer dans l'ensemble. *
-* *
-* Description : Ajoute une instruction décompilée au conteneur existant. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_expr_block_add_item(GExprBlock *block, GDecInstruction *item)
-{
- block->list = (GDecInstruction **)realloc(block->list,
- ++block->count * sizeof(GDecInstruction *));
- block->list[block->count - 1] = item;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = ensemble à consulter. *
-* index = indice de l'instruction décompilée recherchée. *
-* *
-* Description : Fournit une instruction décompilée donnée du conteneur. *
-* *
-* Retour : Instruction décompilée, ou NULL si l'indice n'est pas valide.*
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *g_expr_block_get_item(const GExprBlock *block, size_t index)
-{
- GDecInstruction *result; /* Elément à retourner */
-
- result = NULL;
-
- if (index < block->count)
- result = block->list[index];
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : block = ensemble à faire évoluer. *
-* item = nouvel élément à retirer de l'ensemble. *
-* *
-* Description : Supprime une instruction décompilée du conteneur existant. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_expr_block_delete_item(GExprBlock *block, GDecInstruction *item)
-{
- size_t i; /* Boucle de parcours */
-
- for (i = 0; i < block->count; i++)
- if (block->list[i] == item)
- break;
-
- if (i < block->count)
- {
- if ((i + 1) < block->count)
- memmove(&block->list[i], &block->list[i + 1],
- (block->count - i - 1) * sizeof(GDecInstruction *));
-
- block->list = (GDecInstruction **)realloc(block->list,
- --block->count * sizeof(GDecInstruction *));
-
- g_object_unref(G_OBJECT(item));
-
- }
-
-}
diff --git a/src/decomp/expr/block.h b/src/decomp/expr/block.h
deleted file mode 100644
index 88abc91..0000000
--- a/src/decomp/expr/block.h
+++ /dev/null
@@ -1,84 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * block.h - prototypes pour le regroupement d'un lot d'instructions
- *
- * Copyright (C) 2010-2013 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _DECOMP_EXPR_BLOCK_H
-#define _DECOMP_EXPR_BLOCK_H
-
-
-#include <glib-object.h>
-
-
-#include "../instruction.h"
-
-
-
-#define G_TYPE_EXPR_BLOCK g_expr_block_get_type()
-#define G_EXPR_BLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_expr_block_get_type(), GExprBlock))
-#define G_IS_EXPR_BLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_expr_block_get_type()))
-#define G_EXPR_BLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_EXPR_BLOCK, GExprBlockClass))
-#define G_IS_EXPR_BLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_EXPR_BLOCK))
-#define G_EXPR_BLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_EXPR_BLOCK, GExprBlockClass))
-
-
-
-/* Définition d'un ensemble d'instructions décompilées (instance) */
-typedef struct _GExprBlock GExprBlock;
-
-/* Définition d'un ensemble d'instructions décompilées (classe) */
-typedef struct _GExprBlockClass GExprBlockClass;
-
-
-/* Rendu des bordures */
-typedef enum _BlockBordeBehavior
-{
- BBB_AUTO,
- BBB_FORCE_OFF,
- BBB_FORCE_ON
-
-} BlockBordeBehavior;
-
-
-/* Indique le type défini pour un ensemble d'instructions décompilées. */
-GType g_expr_block_get_type(void);
-
-/* Constuit un conteneur pour diverses instructions décompilées. */
-GDecInstruction *g_expr_block_new(GDecInstruction *);
-
-/* Fournit le comportement du bloc pour le rendu de ses bords. */
-BlockBordeBehavior g_expr_block_get_border_behavior(const GExprBlock *);
-
-/* Définit le comportement du bloc pour le rendu de ses bords. */
-void g_expr_block_set_border_behavior(GExprBlock *, BlockBordeBehavior);
-
-/* Ajoute une instruction décompilée au conteneur existant. */
-void g_expr_block_add_item(GExprBlock *, GDecInstruction *);
-
-/* Fournit une instruction décompilée donnée du conteneur. */
-GDecInstruction *g_expr_block_get_item(const GExprBlock *, size_t);
-
-/* Supprime une instruction décompilée du conteneur existant. */
-void g_expr_block_delete_item(GExprBlock *, GDecInstruction *);
-
-
-
-#endif /* _DECOMP_EXPR_BLOCK_H */
diff --git a/src/decomp/expr/call.c b/src/decomp/expr/call.c
deleted file mode 100644
index 6387730..0000000
--- a/src/decomp/expr/call.c
+++ /dev/null
@@ -1,290 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * call.c - encadrement des appels de routine
- *
- * Copyright (C) 2010-2013 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "call.h"
-
-
-#include <malloc.h>
-#include <string.h>
-
-
-#include "../expression-int.h"
-
-
-
-/* Définition d'un appel à une routine quelconque (instance) */
-struct _GRoutineCall
-{
- GDecExpression parent; /* A laisser en premier */
-
- GBinRoutine *routine; /* Routine sollicitée */
-
- GDecInstruction **args; /* Arguments à associer */
- size_t count; /* Nombre d'arguments présents */
-
-};
-
-
-/* Définition d'un appel à une routine quelconque (classe) */
-struct _GRoutineCallClass
-{
- GDecExpressionClass parent; /* A laisser en premier */
-
-};
-
-
-
-/* Initialise la classe des appels à une routine quelconque. */
-static void g_routine_call_class_init(GRoutineCallClass *);
-
-/* Initialise une instance d'appel à une routine quelconque. */
-static void g_routine_call_init(GRoutineCall *);
-
-/* Visite un ensemble hiérarchique d'instructions décompilées. */
-static bool g_routine_call_visit(GRoutineCall *, dec_instr_visitor_cb, DecInstrVisitFlags, void *);
-
-/* Remplace une instruction décompilée par une autre. */
-static bool g_routine_call_replace(GRoutineCall *, GDecInstruction *, GDecInstruction *);
-
-/* Imprime pour l'écran un version humaine d'une expression. */
-static GBufferLine *g_routine_call_print(const GRoutineCall *, GCodeBuffer *, GBufferLine *, GLangOutput *);
-
-
-
-/* Indique le type défini pour un appel à une routine quelconque. */
-G_DEFINE_TYPE(GRoutineCall, g_routine_call, G_TYPE_DEC_EXPRESSION);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des appels à une routine quelconque. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_routine_call_class_init(GRoutineCallClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = instance à initialiser. *
-* *
-* Description : Initialise une instance d'appel à une routine quelconque. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_routine_call_init(GRoutineCall *expr)
-{
- GDecInstruction *instr; /* Autre version de l'objet */
-
- instr = G_DEC_INSTRUCTION(expr);
-
- instr->visit = (dec_instr_visit_fc)g_routine_call_visit;
- instr->replace = (dec_instr_replace_fc)g_routine_call_replace;
- instr->print = (dec_instr_print_fc)g_routine_call_print;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : routine = routine dont il est fait appel. *
-* *
-* Description : Exprime un appel à une routine quelconque. *
-* *
-* Retour : Expression mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *g_routine_call_new(GBinRoutine *routine)
-{
- GRoutineCall *result; /* Expression à retourner */
-
- result = g_object_new(G_TYPE_ROUTINE_CALL, NULL);
-
- result->routine = routine;
-
- return G_DEC_INSTRUCTION(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : call = première instruction à venir visiter. *
-* callback = procédure à appeler à chaque instruction visitée. *
-* flags = moments des appels à réaliser en retour. *
-* data = données quelconques associées au visiteur. *
-* *
-* Description : Visite un ensemble hiérarchique d'instructions décompilées. *
-* *
-* Retour : true si le parcours a été jusqu'à son terme, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_routine_call_visit(GRoutineCall *call, dec_instr_visitor_cb callback, DecInstrVisitFlags flags, void *data)
-{
- bool result; /* Bilan à retourner */
- size_t i; /* Boucle de parcours */
-
- result = true;
-
- for (i = 0; i < call->count && result; i++)
- result = _g_dec_instruction_visit(call->args[i], G_DEC_INSTRUCTION(call),
- callback, flags, data);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : call = première instruction à venir ausculter. *
-* old = instruction décompilée à venir remplacer. *
-* new = instruction décompilée à utiliser dorénavant. *
-* *
-* Description : Remplace une instruction décompilée par une autre. *
-* *
-* Retour : true si un remplacement a été effectué, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_routine_call_replace(GRoutineCall *call, GDecInstruction *old, GDecInstruction *new)
-{
- bool result; /* Bilan à retourner */
- size_t i; /* Boucle de parcours */
-
- result = false;
-
- for (i = 0; i < call->count; i++)
- {
- if (call->args[i] == old)
- {
- g_object_unref(G_OBJECT(call->args[i]));
- g_object_ref(G_OBJECT(new));
- call->args[i] = new;
-
- result = true;
-
- }
- else
- result |= g_dec_instruction_replace(call->args[i], old, new);
-
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : call = expression à transcrire en version humaine. *
-* buffer = tampon où doit se réaliser l'insertion. *
-* line = ligne d'impression prête à emploi ou NULL. *
-* output = langage de programmation de sortie. *
-* *
-* Description : Imprime pour l'écran un version humaine d'une expression. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GBufferLine *g_routine_call_print(const GRoutineCall *call, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
-{
- GBufferLine *result; /* Ligne à retourner */
- const char *name; /* Désignation de la routine */
- size_t i; /* Boucle de parcours */
-
- name = g_binary_routine_get_name(call->routine);
- g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, name, strlen(name), RTT_RAW, NULL);
-
- g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, "(", 1, RTT_PUNCT, NULL);
-
- if (call->count > 0)
- {
- result = g_dec_instruction_print(call->args[0], buffer, line, output);
-
- for (i = 1; i < call->count; i++)
- {
- g_buffer_line_append_text(result, BLC_ASSEMBLY_HEAD, ",", 1, RTT_PUNCT, NULL);
- g_buffer_line_append_text(result, BLC_ASSEMBLY_HEAD, " ", 1, RTT_RAW, NULL);
-
- g_dec_instruction_print(call->args[i], buffer, result, output);
-
- }
-
- }
- else result = line;
-
- g_buffer_line_append_text(result, BLC_ASSEMBLY_HEAD, ")", 1, RTT_PUNCT, NULL);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : call = expression d'appel à mettre à jour. *
-* arg = nouvel argument à associer à l'appel. *
-* *
-* Description : Enregistre un nouvel argument pour l'appel de routine. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_routine_call_add_arg(GRoutineCall *call, GDecInstruction *arg)
-{
- call->args = (GDecInstruction **)realloc(call->args,
- ++call->count * sizeof(GDecInstruction *));
-
- call->args[call->count - 1] = arg;
-
- /* TODO : synchroniser avec la routine (cf. constructeurs construits à la volée) */
-
-}
diff --git a/src/decomp/expr/call.h b/src/decomp/expr/call.h
deleted file mode 100644
index 7ce8354..0000000
--- a/src/decomp/expr/call.h
+++ /dev/null
@@ -1,64 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * call.h - prototypes pour l'encadrement des appels de routine
- *
- * Copyright (C) 2010-2012 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _DECOMP_EXPR_CALL_H
-#define _DECOMP_EXPR_CALL_H
-
-
-#include <glib-object.h>
-
-
-#include "../expression.h"
-#include "../instruction.h"
-#include "../../analysis/routine.h"
-
-
-
-#define G_TYPE_ROUTINE_CALL g_routine_call_get_type()
-#define G_ROUTINE_CALL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_routine_call_get_type(), GRoutineCall))
-#define G_IS_ROUTINE_CALL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_routine_call_get_type()))
-#define G_ROUTINE_CALL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_ROUTINE_CALL, GRoutineCallClass))
-#define G_IS_ROUTINE_CALL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_ROUTINE_CALL))
-#define G_ROUTINE_CALL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_ROUTINE_CALL, GRoutineCallClass))
-
-
-
-/* Définition d'un appel à une routine quelconque (instance) */
-typedef struct _GRoutineCall GRoutineCall;
-
-/* Définition d'un appel à une routine quelconque (classe) */
-typedef struct _GRoutineCallClass GRoutineCallClass;
-
-
-/* Indique le type défini pour un appel à une routine quelconque. */
-GType g_routine_call_get_type(void);
-
-/* Exprime un appel à une routine quelconque. */
-GDecInstruction *g_routine_call_new(GBinRoutine *);
-
-/* Enregistre un nouvel argument pour l'appel de routine. */
-void g_routine_call_add_arg(GRoutineCall *, GDecInstruction *);
-
-
-
-#endif /* _DECOMP_EXPR_CALL_H */
diff --git a/src/decomp/expr/comp.c b/src/decomp/expr/comp.c
deleted file mode 100644
index 6d22898..0000000
--- a/src/decomp/expr/comp.c
+++ /dev/null
@@ -1,311 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * comp.c - représentation des comparaisons
- *
- * Copyright (C) 2013 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "comp.h"
-
-
-#include "../expression-int.h"
-
-
-
-/* Définition d'une comparaison binaire quelconque (instance) */
-struct _GCompExpression
-{
- GDecExpression parent; /* A laisser en premier */
-
- GDecExpression *a; /* Premier élément à comparer */
- CompSignType sign; /* Méthode de comparaison */
- GDecExpression *b; /* Second élément à comparer */
-
-};
-
-
-/* Définition d'une comparaison binaire quelconque (classe) */
-struct _GCompExpressionClass
-{
- GDecExpressionClass parent; /* A laisser en premier */
-
-};
-
-
-
-/* Initialise la classe des comparaisons binaires quelconques. */
-static void g_comp_expression_class_init(GCompExpressionClass *);
-
-/* Initialise une instance de comparaison binaire quelconque. */
-static void g_comp_expression_init(GCompExpression *);
-
-/* Visite un ensemble hiérarchique d'instructions décompilées. */
-static bool g_comp_expression_visit(GCompExpression *, dec_instr_visitor_cb, DecInstrVisitFlags, void *);
-
-/* Remplace une instruction décompilée par une autre. */
-static bool g_comp_expression_replace(GCompExpression *, GDecInstruction *, GDecInstruction *);
-
-/* Imprime pour l'écran un version humaine d'une expression. */
-static GBufferLine *g_comp_expression_print(const GCompExpression *, GCodeBuffer *, GBufferLine *, GLangOutput *);
-
-/* Réalise une négation sur une expression décompilée. */
-static bool g_comp_expression_negate(GCompExpression *);
-
-
-
-/* Indique le type défini pour une comparaison binaire quelconque. */
-G_DEFINE_TYPE(GCompExpression, g_comp_expression, G_TYPE_DEC_EXPRESSION);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des comparaisons binaires quelconques. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_comp_expression_class_init(GCompExpressionClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = instance à initialiser. *
-* *
-* Description : Initialise une instance de comparaison binaire quelconque. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_comp_expression_init(GCompExpression *expr)
-{
- GDecInstruction *instr; /* Autre version de l'objet */
- GDecExpression *base; /* Autre version de l'objet */
-
- instr = G_DEC_INSTRUCTION(expr);
-
- instr->visit = (dec_instr_visit_fc)g_comp_expression_visit;
- instr->replace = (dec_instr_replace_fc)g_comp_expression_replace;
- instr->print = (dec_instr_print_fc)g_comp_expression_print;
-
- base = G_DEC_EXPRESSION(expr);
-
- base->negate = (dec_expr_negate_fc)g_comp_expression_negate;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : a = second élément à comparer. *
-* sign = choix de la méthode de comparaison. *
-* b = second élément à comparer. *
-* *
-* Description : Exprime une comparaison binaire quelconque. *
-* *
-* Retour : Expression mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecExpression *g_comp_expression_new(GDecExpression *a, CompSignType sign, GDecExpression *b)
-{
- GCompExpression *result; /* Expression à retourner */
-
- result = g_object_new(G_TYPE_COMP_EXPRESSION, NULL);
-
- result->a = a;
- result->sign = sign;
- result->b = b;
-
- return G_DEC_EXPRESSION(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = première instruction à venir visiter. *
-* callback = procédure à appeler à chaque instruction visitée. *
-* flags = moments des appels à réaliser en retour. *
-* data = données quelconques associées au visiteur. *
-* *
-* Description : Visite un ensemble hiérarchique d'instructions décompilées. *
-* *
-* Retour : true si le parcours a été jusqu'à son terme, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_comp_expression_visit(GCompExpression *expr, dec_instr_visitor_cb callback, DecInstrVisitFlags flags, void *data)
-{
- bool result; /* Bilan à retourner */
-
- result = _g_dec_instruction_visit(G_DEC_INSTRUCTION(expr->a), G_DEC_INSTRUCTION(expr),
- callback, flags, data);
-
- if (result)
- result = _g_dec_instruction_visit(G_DEC_INSTRUCTION(expr->b), G_DEC_INSTRUCTION(expr),
- callback, flags, data);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = première instruction à venir ausculter. *
-* old = instruction décompilée à venir remplacer. *
-* new = instruction décompilée à utiliser dorénavant. *
-* *
-* Description : Remplace une instruction décompilée par une autre. *
-* *
-* Retour : true si un remplacement a été effectué, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_comp_expression_replace(GCompExpression *expr, GDecInstruction *old, GDecInstruction *new)
-{
- bool result; /* Bilan à retourner */
-
- if (expr->a == G_DEC_EXPRESSION(old))
- {
- g_object_unref(G_OBJECT(expr->a));
- g_object_ref(G_OBJECT(new));
- expr->a = G_DEC_EXPRESSION(new);
-
- result = true;
-
- }
- else
- result = g_dec_instruction_replace(G_DEC_INSTRUCTION(expr->a), old, new);
-
- if (expr->b == G_DEC_EXPRESSION(old))
- {
- g_object_unref(G_OBJECT(expr->b));
- g_object_ref(G_OBJECT(new));
- expr->b = G_DEC_EXPRESSION(new);
-
- result = true;
-
- }
- else
- result |= g_dec_instruction_replace(G_DEC_INSTRUCTION(expr->b), old, new);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = expression à transcrire en version humaine. *
-* buffer = tampon où doit se réaliser l'insertion. *
-* line = ligne d'impression prête à emploi ou NULL. *
-* output = langage de programmation de sortie. *
-* *
-* Description : Imprime pour l'écran un version humaine d'une expression. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GBufferLine *g_comp_expression_print(const GCompExpression *expr, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
-{
- GBufferLine *result; /* Ligne à retourner */
-
- result = line;
-
- result = g_dec_instruction_print(G_DEC_INSTRUCTION(expr->a),
- buffer, result, output);
-
- g_lang_output_write_comp_sign(output, result, expr->sign);
-
- result = g_dec_instruction_print(G_DEC_INSTRUCTION(expr->b),
- buffer, result, output);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = instance à traiter. *
-* *
-* Description : Réalise une négation sur une expression décompilée. *
-* *
-* Retour : true si la négation a été gérée, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_comp_expression_negate(GCompExpression *expr)
-{
- bool result; /* Bilan à retourner */
-
- result = true;
-
- switch (expr->sign)
- {
- case CST_EQ:
- expr->sign = CST_NE;
- break;
- case CST_NE:
- expr->sign = CST_EQ;
- break;
- case CST_LT:
- expr->sign = CST_GE;
- break;
- case CST_GE:
- expr->sign = CST_LT;
- break;
- case CST_GT:
- expr->sign = CST_LE;
- break;
- case CST_LE:
- expr->sign = CST_GT;
- break;
- default:
- result = false;
- break;
-
- }
-
- return result;
-
-}
diff --git a/src/decomp/expr/comp.h b/src/decomp/expr/comp.h
deleted file mode 100644
index d3f534c..0000000
--- a/src/decomp/expr/comp.h
+++ /dev/null
@@ -1,60 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * comp.h - prototypes pour la représentation des comparaisons
- *
- * Copyright (C) 2013 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _DECOMP_EXPR_COMP_H
-#define _DECOMP_EXPR_COMP_H
-
-
-#include <glib-object.h>
-
-
-#include "../expression.h"
-#include "../output.h"
-
-
-
-#define G_TYPE_COMP_EXPRESSION g_comp_expression_get_type()
-#define G_COMP_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_comp_expression_get_type(), GCompExpression))
-#define G_IS_COMP_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_comp_expression_get_type()))
-#define G_COMP_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_COMP_EXPRESSION, GCompExpressionClass))
-#define G_IS_COMP_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_COMP_EXPRESSION))
-#define G_COMP_EXPRESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_COMP_EXPRESSION, GCompExpressionClass))
-
-
-
-/* Définition d'une comparaison binaire quelconque (instance) */
-typedef struct _GCompExpression GCompExpression;
-
-/* Définition d'une comparaison binaire quelconque (classe) */
-typedef struct _GCompExpressionClass GCompExpressionClass;
-
-
-/* Indique le type défini pour une comparaison binaire quelconque. */
-GType g_comp_expression_get_type(void);
-
-/* Exprime une comparaison binaire quelconque. */
-GDecExpression *g_comp_expression_new(GDecExpression *, CompSignType, GDecExpression *);
-
-
-
-#endif /* _DECOMP_EXPR_COMP_H */
diff --git a/src/decomp/expr/cond.c b/src/decomp/expr/cond.c
deleted file mode 100644
index c0b3f83..0000000
--- a/src/decomp/expr/cond.c
+++ /dev/null
@@ -1,461 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * cond.c - représentation des conditions
- *
- * Copyright (C) 2010-2013 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "cond.h"
-
-
-#include <malloc.h>
-
-
-#include "../expression-int.h"
-
-
-
-/* Définition d'une condition binaire quelconque (instance) */
-struct _GCondExpression
-{
- GDecExpression parent; /* A laisser en premier */
-
- CondOperatorType operator; /* Opérateur de la liste */
-
- union
- {
- GDecExpression *exp; /* Expression analysée de base */
- struct
- {
- GCondExpression **conds; /* Liste d'expressions */
- size_t count; /* Taille de cette liste */
- };
- };
-
-};
-
-
-/* Définition d'une condition binaire quelconque (classe) */
-struct _GCondExpressionClass
-{
- GDecExpressionClass parent; /* A laisser en premier */
-
-};
-
-
-
-/* Initialise la classe des conditions binaires quelconques. */
-static void g_cond_expression_class_init(GCondExpressionClass *);
-
-/* Initialise une instance de condition binaire quelconque. */
-static void g_cond_expression_init(GCondExpression *);
-
-/* Visite un ensemble hiérarchique d'instructions décompilées. */
-static bool g_cond_expression_visit(GCondExpression *, dec_instr_visitor_cb, DecInstrVisitFlags, void *);
-
-/* Remplace une instruction décompilée par une autre. */
-static bool g_cond_expression_replace(GCondExpression *, GDecInstruction *, GDecInstruction *);
-
-/* Imprime pour l'écran un version humaine d'une expression. */
-static GBufferLine *g_cond_expression_print(const GCondExpression *, GCodeBuffer *, GBufferLine *, GLangOutput *);
-
-/* Réalise une négation sur une expression décompilée. */
-static bool g_cond_expression_negate(GCondExpression *);
-
-
-
-/* Indique le type défini pour une condition binaire quelconque. */
-G_DEFINE_TYPE(GCondExpression, g_cond_expression, G_TYPE_DEC_EXPRESSION);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des conditions binaires quelconques. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_cond_expression_class_init(GCondExpressionClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : cond = instance à initialiser. *
-* *
-* Description : Initialise une instance de condition binaire quelconque. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_cond_expression_init(GCondExpression *cond)
-{
- GDecInstruction *instr; /* Autre version de l'objet */
- GDecExpression *expr; /* Autre version de l'objet */
-
- instr = G_DEC_INSTRUCTION(cond);
-
- instr->visit = (dec_instr_visit_fc)g_cond_expression_visit;
- instr->replace = (dec_instr_replace_fc)g_cond_expression_replace;
- instr->print = (dec_instr_print_fc)g_cond_expression_print;
-
- expr = G_DEC_EXPRESSION(cond);
-
- expr->negate = (dec_expr_negate_fc)g_cond_expression_negate;
-
- cond->operator = COT_NONE;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : exp = expression sur laquelle repose la condition. *
-* *
-* Description : Exprime une condition binaire quelconque. *
-* *
-* Retour : Expression mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecExpression *g_cond_expression_new(GDecExpression *exp)
-{
- GCondExpression *result; /* Expression à retourner */
-
- result = g_object_new(G_TYPE_COND_EXPRESSION, NULL);
-
- result->exp = exp;
-
- return G_DEC_EXPRESSION(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = première instruction à venir visiter. *
-* callback = procédure à appeler à chaque instruction visitée. *
-* flags = moments des appels à réaliser en retour. *
-* data = données quelconques associées au visiteur. *
-* *
-* Description : Visite un ensemble hiérarchique d'instructions décompilées. *
-* *
-* Retour : true si le parcours a été jusqu'à son terme, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_cond_expression_visit(GCondExpression *expr, dec_instr_visitor_cb callback, DecInstrVisitFlags flags, void *data)
-{
- bool result; /* Bilan à retourner */
- size_t i; /* Boucle de parcours */
-
- if (expr->operator == COT_NONE)
- result = _g_dec_instruction_visit(G_DEC_INSTRUCTION(expr->exp), G_DEC_INSTRUCTION(expr),
- callback, flags, data);
-
- else
- {
- result = true;
-
- for (i = 0; i < expr->count && result; i++)
- result = _g_dec_instruction_visit(G_DEC_INSTRUCTION(expr->conds[i]),
- G_DEC_INSTRUCTION(expr),
- callback, flags, data);
-
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = première instruction à venir ausculter. *
-* old = instruction décompilée à venir remplacer. *
-* new = instruction décompilée à utiliser dorénavant. *
-* *
-* Description : Remplace une instruction décompilée par une autre. *
-* *
-* Retour : true si un remplacement a été effectué, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_cond_expression_replace(GCondExpression *expr, GDecInstruction *old, GDecInstruction *new)
-{
- bool result; /* Bilan à retourner */
- size_t i; /* Boucle de parcours */
-
- if (expr->operator == COT_NONE)
- {
- if (expr->exp == G_DEC_EXPRESSION(old))
- {
- g_object_unref(G_OBJECT(expr->exp));
- g_object_ref(G_OBJECT(new));
- expr->exp = G_DEC_EXPRESSION(new);
-
- result = true;
-
- }
- else
- result = g_dec_instruction_replace(G_DEC_INSTRUCTION(expr->exp), old, new);
-
- }
- else
- {
- result = false;
-
- for (i = 0; i < expr->count; i++)
- {
- if (expr->conds[i] == G_COND_EXPRESSION(old))
- {
- g_object_unref(G_OBJECT(expr->conds[i]));
- g_object_ref(G_OBJECT(new));
- expr->conds[i] = G_COND_EXPRESSION(new);
-
- result = true;
-
- }
- else
- result |= g_dec_instruction_replace(G_DEC_INSTRUCTION(expr->conds[i]), old, new);
-
- }
-
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = expression à transcrire en version humaine. *
-* buffer = tampon où doit se réaliser l'insertion. *
-* line = ligne d'impression prête à emploi ou NULL. *
-* output = langage de programmation de sortie. *
-* *
-* Description : Imprime pour l'écran un version humaine d'une expression. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GBufferLine *g_cond_expression_print(const GCondExpression *expr, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
-{
- GBufferLine *result; /* Ligne à retourner */
- size_t i; /* Boucle de parcours */
-
- result = g_lang_output_encapsulate_condition(output, buffer, line, true);
-
- if (expr->operator == COT_NONE)
- result = g_dec_instruction_print(G_DEC_INSTRUCTION(expr->exp),
- buffer, result, output);
-
- else
- for (i = 0; i < expr->count; i++)
- {
- if (i > 0)
- g_lang_output_write_cond_operator(output, result, expr->operator);
-
- result = g_dec_instruction_print(G_DEC_INSTRUCTION(expr->conds[i]),
- buffer, result, output);
-
- }
-
- result = g_lang_output_encapsulate_condition(output, buffer, result, false);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : cond = instance à traiter. *
-* *
-* Description : Réalise une négation sur une expression décompilée. *
-* *
-* Retour : true si la négation a été gérée, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_cond_expression_negate(GCondExpression *cond)
-{
- size_t i; /* Boucle de parcours */
-
- if (cond->operator == COT_NONE)
- g_dec_expression_negate(cond->exp);
-
- else
- {
- cond->operator = (cond->operator == COT_AND ? COT_OR : COT_AND);
-
- for (i = 0; i < cond->count; i++)
- g_dec_expression_negate(G_DEC_EXPRESSION(cond->conds[i]));
-
- }
-
- return true;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : cond = instance à consulter. *
-* *
-* Description : Fournit l'opération logique entre les comparaisons. *
-* *
-* Retour : Opération liant les différentes parties, ou COT_NONE. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-CondOperatorType g_cond_expression_get_operator(const GCondExpression *cond)
-{
- return cond->operator;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : cond = instance à consulter. *
-* *
-* Description : Fournit l'expression d'une condition. *
-* *
-* Retour : Expression sur laquelle repose la condition. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecExpression *g_cond_expression_get_expression(const GCondExpression *cond)
-{
- return cond->exp;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : cond = instance à modifier. *
-* exp = expression sur laquelle repose la condition. *
-* *
-* Description : Définit l'expression d'une condition. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_cond_expression_set_expression(GCondExpression *cond, GDecExpression *exp)
-{
- if (cond->exp != NULL)
- g_object_unref(G_OBJECT(cond->exp));
-
- cond->exp = exp;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : cond = instance à compléter. *
-* extra = condition à rajouter. *
-* op = lien avec le reste de la condition. *
-* *
-* Description : Etend l'expression d'une condition. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_cond_expression_add_condition(GCondExpression *cond, GCondExpression *extra, CondOperatorType op)
-{
- GCondExpression *existing; /* Expr. première revalorisée */
-
- if (cond->operator == COT_NONE)
- {
- existing = G_COND_EXPRESSION(g_cond_expression_new(cond->exp));
- goto gceac_replace_existing;
- }
- else
- {
- if (cond->operator == op)
- {
- cond->conds = (GCondExpression **)calloc(++cond->count, sizeof(GCondExpression));
- cond->conds[cond->count - 1] = extra;
- }
- else
- {
- existing = G_COND_EXPRESSION(g_cond_expression_new(NULL));
-
- existing->operator = cond->operator;
- existing->conds = cond->conds;
- existing->count = cond->count;
-
- goto gceac_replace_existing;
-
- }
-
- }
-
- gceac_done:
-
- return;
-
- gceac_replace_existing:
-
- cond->operator = op;
-
- cond->conds = (GCondExpression **)calloc(2, sizeof(GCondExpression));
- cond->conds[0] = existing;
- cond->conds[1] = extra;
-
- cond->count = 2;
-
- goto gceac_done;
-
-}
diff --git a/src/decomp/expr/cond.h b/src/decomp/expr/cond.h
deleted file mode 100644
index 7980a75..0000000
--- a/src/decomp/expr/cond.h
+++ /dev/null
@@ -1,72 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * cond.h - prototypes pour la représentation des conditions
- *
- * Copyright (C) 2010-2013 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _DECOMP_EXPR_COND_H
-#define _DECOMP_EXPR_COND_H
-
-
-#include <glib-object.h>
-
-
-#include "../expression.h"
-#include "../output.h"
-
-
-
-#define G_TYPE_COND_EXPRESSION g_cond_expression_get_type()
-#define G_COND_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_cond_expression_get_type(), GCondExpression))
-#define G_IS_COND_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_cond_expression_get_type()))
-#define G_COND_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_COND_EXPRESSION, GCondExpressionClass))
-#define G_IS_COND_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_COND_EXPRESSION))
-#define G_COND_EXPRESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_COND_EXPRESSION, GCondExpressionClass))
-
-
-
-/* Définition d'une condition binaire quelconque (instance) */
-typedef struct _GCondExpression GCondExpression;
-
-/* Définition d'une condition binaire quelconque (classe) */
-typedef struct _GCondExpressionClass GCondExpressionClass;
-
-
-/* Indique le type défini pour une condition binaire quelconque. */
-GType g_cond_expression_get_type(void);
-
-/* Exprime une condition binaire quelconque. */
-GDecExpression *g_cond_expression_new(GDecExpression *);
-
-/* Fournit l'opération logique entre les comparaisons. */
-CondOperatorType g_cond_expression_get_operator(const GCondExpression *);
-
-/* Fournit l'expression d'une condition. */
-GDecExpression *g_cond_expression_get_expression(const GCondExpression *);
-
-/* Définit l'expression d'une condition. */
-void g_cond_expression_set_expression(GCondExpression *, GDecExpression *);
-
-/* Etend l'expression d'une condition. */
-void g_cond_expression_add_condition(GCondExpression *, GCondExpression *, CondOperatorType);
-
-
-
-#endif /* _DECOMP_EXPR_COND_H */
diff --git a/src/decomp/expr/dalvik/Makefile.am b/src/decomp/expr/dalvik/Makefile.am
deleted file mode 100644
index 1fe430e..0000000
--- a/src/decomp/expr/dalvik/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-
-noinst_LTLIBRARIES = libdecompexprdalvik.la
-
-libdecompexprdalvik_la_SOURCES = \
- array.h array.c
-
-libdecompexprdalvik_la_LDFLAGS =
-
-
-AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
-
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/src/decomp/expr/dalvik/array.c b/src/decomp/expr/dalvik/array.c
deleted file mode 100644
index 98647f4..0000000
--- a/src/decomp/expr/dalvik/array.c
+++ /dev/null
@@ -1,155 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * array.c - manipulations de tableaux propres à Dalvik
- *
- * Copyright (C) 2010 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "array.h"
-
-
-#include "../../expression-int.h"
-
-
-
-/* Définition d'une expression de mesure de tableau (instance) */
-struct _GDalvikALength
-{
- GDecExpression parent; /* A laisser en premier */
-
- GDecExpression *array; /* Elément auquel accéder */
-
-};
-
-
-/* Définition d'une expression de mesure de tableau (classe) */
-struct _GDalvikALengthClass
-{
- GDecExpressionClass parent; /* A laisser en premier */
-
-};
-
-
-
-/* Initialise la classe des expressions de mesure de tableau. */
-static void g_dalvik_alength_class_init(GDalvikALengthClass *);
-
-/* Initialise une instance d'expression de mesure de tableau. */
-static void g_dalvik_alength_init(GDalvikALength *);
-
-/* Imprime pour l'écran un version humaine d'une expression. */
-static void g_dalvik_alength_print(const GDalvikALength *, GCodeBuffer *, GBufferLine *, GLangOutput *);
-
-
-
-/* Indique le type défini pour une expression de mesure de tableau. */
-G_DEFINE_TYPE(GDalvikALength, g_dalvik_alength, G_TYPE_DEC_EXPRESSION);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des expressions de mesure de tableau. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_alength_class_init(GDalvikALengthClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = instance à initialiser. *
-* *
-* Description : Initialise une instance d'expression de mesure de tableau. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_alength_init(GDalvikALength *expr)
-{
- GDecInstruction *instr; /* Autre version de l'objet */
-
- instr = G_DEC_INSTRUCTION(expr);
-
- instr->print = (dec_instr_print_fc)g_dalvik_alength_print;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : array = tableau dont on doit mesurer la taille. *
-* *
-* Description : Construit une expression à partir d'une mesure de tableau. *
-* *
-* Retour : Expression mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *g_dalvik_alength_new(GDecExpression *array)
-{
- GDalvikALength *result; /* Expression à retourner */
-
- result = g_object_new(G_TYPE_DALVIK_ALENGTH, NULL);
-
- result->array = array;
-
- return G_DEC_INSTRUCTION(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = expression à transcrire en version humaine. *
-* buffer = tampon où doit se réaliser l'insertion. *
-* line = ligne d'impression prête à emploi ou NULL. *
-* output = langage de programmation de sortie. *
-* *
-* Description : Imprime pour l'écran un version humaine d'une expression. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_dalvik_alength_print(const GDalvikALength *expr, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
-{
- g_dec_instruction_print(G_DEC_INSTRUCTION(expr->array),
- buffer, line, output);
-
- g_buffer_line_append_text(line, BLC_ASSEMBLY, ".", 1, RTT_RAW, NULL);
-
- g_buffer_line_append_text(line, BLC_ASSEMBLY, "length", 6, RTT_RAW, NULL);
-
-}
diff --git a/src/decomp/expr/dalvik/array.h b/src/decomp/expr/dalvik/array.h
deleted file mode 100644
index ee50a43..0000000
--- a/src/decomp/expr/dalvik/array.h
+++ /dev/null
@@ -1,61 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * array.h - prototypes pour les manipulations de tableaux propres à Dalvik
- *
- * Copyright (C) 2010 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _DECOMP_EXPR_DALVIK_ARRAY_H
-#define _DECOMP_EXPR_DALVIK_ARRAY_H
-
-
-#include <glib-object.h>
-
-
-#include "../../expression.h"
-#include "../../instruction.h"
-
-
-
-#define G_TYPE_DALVIK_ALENGTH g_dalvik_alength_get_type()
-#define G_DALVIK_ALENGTH(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_dalvik_alength_get_type(), GDalvikALength))
-#define G_IS_DALVIK_ALENGTH(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_dalvik_alength_get_type()))
-#define G_DALVIK_ALENGTH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DALVIK_ALENGTH, GDalvikALengthClass))
-#define G_IS_DALVIK_ALENGTH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DALVIK_ALENGTH))
-#define G_DALVIK_ALENGTH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DALVIK_ALENGTH, GDalvikALengthClass))
-
-
-
-/* Définition d'une expression de mesure de tableau (instance) */
-typedef struct _GDalvikALength GDalvikALength;
-
-/* Définition d'une expression de mesure de tableau (classe) */
-typedef struct _GDalvikALengthClass GDalvikALengthClass;
-
-
-
-/* Indique le type défini pour une expression de mesure de tableau. */
-GType g_dalvik_alength_get_type(void);
-
-/* Construit une expression à partir d'une mesure de tableau. */
-GDecInstruction *g_dalvik_alength_new(GDecExpression *);
-
-
-
-#endif /* _DECOMP_EXPR_DALVIK_ARRAY_H */
diff --git a/src/decomp/expr/immediate.c b/src/decomp/expr/immediate.c
deleted file mode 100644
index 3bf2dea..0000000
--- a/src/decomp/expr/immediate.c
+++ /dev/null
@@ -1,153 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * immediate.c - raccord avec les opérandes de valeur immédiate
- *
- * Copyright (C) 2010-2013 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "immediate.h"
-
-
-#include "../expression-int.h"
-
-
-
-/* Définition d'une expression de valeur immédiate (instance) */
-struct _GImmExpression
-{
- GDecExpression parent; /* A laisser en premier */
-
- GImmOperand *operand; /* Conteneur d'origine */
-
-};
-
-
-/* Définition d'une expression de valeur immédiate (classe) */
-struct _GImmExpressionClass
-{
- GDecExpressionClass parent; /* A laisser en premier */
-
-};
-
-
-
-/* Initialise la classe des expressions de valeur immédiate. */
-static void g_imm_expression_class_init(GImmExpressionClass *);
-
-/* Initialise une instance d'expression de valeur immédiate. */
-static void g_imm_expression_init(GImmExpression *);
-
-/* Imprime pour l'écran un version humaine d'une expression. */
-static GBufferLine *g_imm_expression_print(const GImmExpression *, GCodeBuffer *, GBufferLine *, GLangOutput *);
-
-
-
-/* Indique le type défini pour une expression de valeur immédiate. */
-G_DEFINE_TYPE(GImmExpression, g_imm_expression, G_TYPE_DEC_EXPRESSION);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des expressions de valeur immédiate. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_imm_expression_class_init(GImmExpressionClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = instance à initialiser. *
-* *
-* Description : Initialise une instance d'expression de valeur immédiate. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_imm_expression_init(GImmExpression *expr)
-{
- GDecInstruction *instr; /* Autre version de l'objet */
-
- instr = G_DEC_INSTRUCTION(expr);
-
- instr->print = (dec_instr_print_fc)g_imm_expression_print;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : operand = conteneur d'origie de la valeur immédiate. *
-* *
-* Description : Construit une expression à partir d'une valeur immédiate. *
-* *
-* Retour : Expression mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *g_imm_expression_new(GImmOperand *operand)
-{
- GImmExpression *result; /* Expression à retourner */
-
- result = g_object_new(G_TYPE_IMM_EXPRESSION, NULL);
-
- result->operand = operand;
- g_object_ref(G_OBJECT(operand)); /* FIXME : ref pas déjà acquise ? */
-
- return G_DEC_INSTRUCTION(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = expression à transcrire en version humaine. *
-* buffer = tampon où doit se réaliser l'insertion. *
-* line = ligne d'impression prête à emploi ou NULL. *
-* output = langage de programmation de sortie. *
-* *
-* Description : Imprime pour l'écran un version humaine d'une expression. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GBufferLine *g_imm_expression_print(const GImmExpression *expr, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
-{
- g_arch_operand_print(G_ARCH_OPERAND(expr->operand), line, ASX_COUNT);
-
- return line;
-
-}
diff --git a/src/decomp/expr/immediate.h b/src/decomp/expr/immediate.h
deleted file mode 100644
index 8185754..0000000
--- a/src/decomp/expr/immediate.h
+++ /dev/null
@@ -1,61 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * immediate.h - prototypes pour le raccord avec les opérandes de valeur immédiate
- *
- * Copyright (C) 2010 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _DECOMP_EXPR_IMMEDIATE_H
-#define _DECOMP_EXPR_IMMEDIATE_H
-
-
-#include <glib-object.h>
-
-
-#include "../instruction.h"
-#include "../../arch/immediate.h"
-
-
-
-#define G_TYPE_IMM_EXPRESSION g_imm_expression_get_type()
-#define G_IMM_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_imm_expression_get_type(), GImmExpression))
-#define G_IS_IMM_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_imm_expression_get_type()))
-#define G_IMM_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_IMM_EXPRESSION, GImmExpressionClass))
-#define G_IS_IMM_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_IMM_EXPRESSION))
-#define G_IMM_EXPRESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_IMM_EXPRESSION, GImmExpressionClass))
-
-
-
-/* Définition d'une expression de valeur immédiate (instance) */
-typedef struct _GImmExpression GImmExpression;
-
-/* Définition d'une expression de valeur immédiate (classe) */
-typedef struct _GImmExpressionClass GImmExpressionClass;
-
-
-
-/* Indique le type défini pour une expression de valeur immédiate. */
-GType g_imm_expression_get_type(void);
-
-/*Construit une expression à partir d'une valeur immédiate. */
-GDecInstruction *g_imm_expression_new(GImmOperand *);
-
-
-
-#endif /* _DECOMP_EXPR_IMMEDIATE_H */
diff --git a/src/decomp/expr/pseudo.c b/src/decomp/expr/pseudo.c
deleted file mode 100644
index 626cd8f..0000000
--- a/src/decomp/expr/pseudo.c
+++ /dev/null
@@ -1,253 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * pseudo.c - définition des pseudo-registres
- *
- * Copyright (C) 2010-2013 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "pseudo.h"
-
-
-#include <malloc.h>
-#include <stdio.h>
-#include <string.h>
-
-
-#include "../expression-int.h"
-
-
-
-/* Définition d'un pseudo-registre (instance) */
-struct _GPseudoRegister
-{
- GDecExpression parent; /* A laisser en premier */
-
- PseudoRegUsage usage; /* Type d'utilisation attendue */
-
- char *name; /* Désignation générale */
- size_t index; /* Position dans l'ensemble */
- GBinVariable *var; /* Variable plus précise */
-
-};
-
-
-/* Définition d'un pseudo-registre (classe) */
-struct _GPseudoRegisterClass
-{
- GDecExpressionClass parent; /* A laisser en premier */
-
-};
-
-
-
-/* Initialise la classe des pseudo-registres. */
-static void g_pseudo_register_class_init(GPseudoRegisterClass *);
-
-/* Initialise une instance de pseudo-registre. */
-static void g_pseudo_register_init(GPseudoRegister *);
-
-/* Imprime pour l'écran un version humaine d'une expression. */
-static GBufferLine *g_pseudo_register_print(const GPseudoRegister *, GCodeBuffer *, GBufferLine *, GLangOutput *);
-
-
-
-/* Indique le type défini pour un pseudo-registre. */
-G_DEFINE_TYPE(GPseudoRegister, g_pseudo_register, G_TYPE_DEC_EXPRESSION);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des pseudo-registres. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_pseudo_register_class_init(GPseudoRegisterClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : reg = instance à initialiser. *
-* *
-* Description : Initialise une instance de pseudo-registre. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_pseudo_register_init(GPseudoRegister *reg)
-{
- GDecInstruction *instr; /* Autre version de l'objet */
-
- instr = G_DEC_INSTRUCTION(reg);
-
- instr->print = (dec_instr_print_fc)g_pseudo_register_print;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : usage = précision quant à l'usage du pseudo-registre à créer.*
-* *
-* Description : Assigne le contenu d'une expression dans une autre. *
-* *
-* Retour : Pseudo-registre mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *g_pseudo_register_new(PseudoRegUsage usage)
-{
- GPseudoRegister *result; /* Pseudo-registre à renvoyer */
-
- result = g_object_new(G_TYPE_PSEUDO_REGISTER, NULL);
-
- result->usage = usage;
-
- return G_DEC_INSTRUCTION(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : reg = pseudo-registre à venir consulter. *
-* *
-* Description : Indique l'usage attendu du pseudo-registre consulté. *
-* *
-* Retour : Utilité du pseudo-registre en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-PseudoRegUsage g_pseudo_register_get_usage(const GPseudoRegister *reg)
-{
- return reg->usage;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : reg = expression à transcrire en version humaine. *
-* buffer = tampon où doit se réaliser l'insertion. *
-* line = ligne d'impression prête à emploi ou NULL. *
-* output = langage de programmation de sortie. *
-* *
-* Description : Imprime pour l'écran un version humaine d'une expression. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GBufferLine *g_pseudo_register_print(const GPseudoRegister *reg, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
-{
- char label[32];
- char *name;
-
- if (reg->var != NULL)
- {
- name = g_binary_variable_to_string(reg->var, true);
- g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, name, strlen(name), RTT_RAW, NULL);
- free(name);
- }
- else
- {
- snprintf(label, 32, "%s%zu", reg->name, reg->index);
- g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, label, strlen(label), RTT_RAW, NULL);
- }
-
- return line;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : reg = expression représentant un pseudo-registre à traiter. *
-* name = désignation générale à associer au pseudo-registre. *
-* *
-* Description : Définit un nom général pour un pseudo-registre donné. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_pseudo_register_set_basename(GPseudoRegister *reg, const char *name)
-{
- reg->name = strdup(name);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : reg = expression représentant un pseudo-registre à traiter.*
-* index = indice à associer au pseudo-registre. *
-* *
-* Description : Définit un indice unique pour un pseudo-registre donné. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_pseudo_register_set_index(GPseudoRegister *reg, size_t index)
-{
- reg->index = index;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : reg = expression représentant un pseudo-registre à traiter. *
-* var = indications supplémentaire quant à la variable. *
-* *
-* Description : Précise le nom et le type de la variable. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_pseudo_register_set_variable(GPseudoRegister *reg, GBinVariable *var)
-{
- reg->var = var;
-
-}
diff --git a/src/decomp/expr/pseudo.h b/src/decomp/expr/pseudo.h
deleted file mode 100644
index 5436404..0000000
--- a/src/decomp/expr/pseudo.h
+++ /dev/null
@@ -1,83 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * pseudo.h - prototypes pour la définition des pseudo-registres
- *
- * Copyright (C) 2010-2013 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _DECOMP_EXPR_PSEUDO_H
-#define _DECOMP_EXPR_PSEUDO_H
-
-
-#include <glib-object.h>
-
-
-#include "../instruction.h"
-#include "../../analysis/variable.h"
-
-
-
-#define G_TYPE_PSEUDO_REGISTER g_pseudo_register_get_type()
-#define G_PSEUDO_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_pseudo_register_get_type(), GPseudoRegister))
-#define G_IS_PSEUDO_REGISTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_pseudo_register_get_type()))
-#define G_PSEUDO_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_PSEUDO_REGISTER, GPseudoRegisterClass))
-#define G_IS_PSEUDO_REGISTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_PSEUDO_REGISTER))
-#define G_PSEUDO_REGISTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_PSEUDO_REGISTER, GPseudoRegisterClass))
-
-
-
-/* Types de pseudo-registre */
-typedef enum _PseudoRegUsage
-{
- PRU_THIS, /* "this" pour les objets */
- PRU_ARG, /* Argument de fonction */
- PRU_LOCAL, /* Variable locale */
- PRU_FIXED /* Variable type champ */
-
-} PseudoRegUsage;
-
-
-/* Définition d'un pseudo-registre (instance) */
-typedef struct _GPseudoRegister GPseudoRegister;
-
-/* Définition d'un pseudo-registre (classe) */
-typedef struct _GPseudoRegisterClass GPseudoRegisterClass;
-
-
-/* Indique le type défini pour un pseudo-registre. */
-GType g_pseudo_register_get_type(void);
-
-/* Assigne le contenu d'une expression dans une autre. */
-GDecInstruction *g_pseudo_register_new(PseudoRegUsage);
-
-/* Indique l'usage attendu du pseudo-registre consulté. */
-PseudoRegUsage g_pseudo_register_get_usage(const GPseudoRegister *);
-
-/* Définit un nom général pour un pseudo-registre donné. */
-void g_pseudo_register_set_basename(GPseudoRegister *, const char *);
-
-/* Définit un indice unique pour un pseudo-registre donné. */
-void g_pseudo_register_set_index(GPseudoRegister *, size_t);
-
-/* Précise le nom et le type de la variable. */
-void g_pseudo_register_set_variable(GPseudoRegister *, GBinVariable *);
-
-
-
-#endif /* _DECOMP_EXPR_PSEUDO_H */
diff --git a/src/decomp/expr/return.c b/src/decomp/expr/return.c
deleted file mode 100644
index 16a5a54..0000000
--- a/src/decomp/expr/return.c
+++ /dev/null
@@ -1,243 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * return.c - représentation des ordres de retour
- *
- * Copyright (C) 2010-2013 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "return.h"
-
-
-#include "../expression-int.h"
-
-
-
-/* Définition d'un ordre de retour (instance) */
-struct _GReturnExpression
-{
- GDecExpression parent; /* A laisser en premier */
-
- GDecExpression *payload; /* Eventuel paquet associé */
-
-};
-
-
-/* Définition d'un ordre de retour (classe) */
-struct _GReturnExpressionClass
-{
- GDecExpressionClass parent; /* A laisser en premier */
-
-};
-
-
-
-/* Initialise la classe des ordres de retour. */
-static void g_return_expression_class_init(GReturnExpressionClass *);
-
-/* Initialise une instance d'ordre de retour. */
-static void g_return_expression_init(GReturnExpression *);
-
-/* Visite un ensemble hiérarchique d'instructions décompilées. */
-static bool g_return_expression_visit(GReturnExpression *, dec_instr_visitor_cb, DecInstrVisitFlags, void *);
-
-/* Remplace une instruction décompilée par une autre. */
-static bool g_return_expression_replace(GReturnExpression *, GDecInstruction *, GDecInstruction *);
-
-/* Imprime pour l'écran un version humaine d'une expression. */
-static GBufferLine *g_return_expression_print(const GReturnExpression *, GCodeBuffer *, GBufferLine *, GLangOutput *);
-
-
-
-/* Indique le type défini pour un ordre de retour. */
-G_DEFINE_TYPE(GReturnExpression, g_return_expression, G_TYPE_DEC_EXPRESSION);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des ordres de retour. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_return_expression_class_init(GReturnExpressionClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = instance à initialiser. *
-* *
-* Description : Initialise une instance d'ordre de retour. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_return_expression_init(GReturnExpression *expr)
-{
- GDecInstruction *instr; /* Autre version de l'objet */
-
- instr = G_DEC_INSTRUCTION(expr);
-
- instr->visit = (dec_instr_visit_fc)g_return_expression_visit;
- instr->replace = (dec_instr_replace_fc)g_return_expression_replace;
- instr->print = (dec_instr_print_fc)g_return_expression_print;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : payload = éventuelle expression à associer au retour. *
-* *
-* Description : Constitue un ordre de retour vers l'appelant. *
-* *
-* Retour : Expression mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *g_return_expression_new(GDecExpression *payload)
-{
- GReturnExpression *result; /* Expression à retourner */
-
- result = g_object_new(G_TYPE_RETURN_EXPRESSION, NULL);
-
- result->payload = payload;
-
- return G_DEC_INSTRUCTION(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = première instruction à venir visiter. *
-* callback = procédure à appeler à chaque instruction visitée. *
-* flags = moments des appels à réaliser en retour. *
-* data = données quelconques associées au visiteur. *
-* *
-* Description : Visite un ensemble hiérarchique d'instructions décompilées. *
-* *
-* Retour : true si le parcours a été jusqu'à son terme, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_return_expression_visit(GReturnExpression *expr, dec_instr_visitor_cb callback, DecInstrVisitFlags flags, void *data)
-{
- bool result; /* Bilan à retourner */
-
- if (expr->payload)
- result = _g_dec_instruction_visit(G_DEC_INSTRUCTION(expr->payload), G_DEC_INSTRUCTION(expr),
- callback, flags, data);
- else
- result = false;
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = première instruction à venir ausculter. *
-* old = instruction décompilée à venir remplacer. *
-* new = instruction décompilée à utiliser dorénavant. *
-* *
-* Description : Remplace une instruction décompilée par une autre. *
-* *
-* Retour : true si un remplacement a été effectué, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool g_return_expression_replace(GReturnExpression *expr, GDecInstruction *old, GDecInstruction *new)
-{
- bool result; /* Bilan à retourner */
-
- if (expr->payload)
- {
- if (expr->payload == G_DEC_EXPRESSION(old))
- {
- g_object_unref(G_OBJECT(expr->payload));
- g_object_ref(G_OBJECT(new));
- expr->payload = G_DEC_EXPRESSION(new);
-
- result = true;
-
- }
- else
- result = g_dec_instruction_replace(G_DEC_INSTRUCTION(expr->payload), old, new);
-
- }
- else
- result = false;
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = expression à transcrire en version humaine. *
-* buffer = tampon où doit se réaliser l'insertion. *
-* line = ligne d'impression prête à emploi ou NULL. *
-* output = langage de programmation de sortie. *
-* *
-* Description : Imprime pour l'écran un version humaine d'une expression. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GBufferLine *g_return_expression_print(const GReturnExpression *expr, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
-{
- GBufferLine *result; /* Ligne à retourner */
-
- g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, "return", 6, RTT_KEY_WORD, NULL);
-
- if (expr->payload != NULL)
- {
- g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, " ", 1, RTT_RAW, NULL);
-
- result = g_dec_instruction_print(G_DEC_INSTRUCTION(expr->payload),
- buffer, line, output);
-
- }
- else result = line;
-
- return result;
-
-}
diff --git a/src/decomp/expr/return.h b/src/decomp/expr/return.h
deleted file mode 100644
index ed28b96..0000000
--- a/src/decomp/expr/return.h
+++ /dev/null
@@ -1,60 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * return.h - prototypes pour la représentation des ordres de retour
- *
- * Copyright (C) 2010 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _DECOMP_EXPR_RETURN_H
-#define _DECOMP_EXPR_RETURN_H
-
-
-#include <glib-object.h>
-
-
-#include "../expression.h"
-#include "../instruction.h"
-
-
-
-#define G_TYPE_RETURN_EXPRESSION g_return_expression_get_type()
-#define G_RETURN_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_return_expression_get_type(), GReturnExpression))
-#define G_IS_RETURN_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_return_expression_get_type()))
-#define G_RETURN_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_RETURN_EXPRESSION, GReturnExpressionClass))
-#define G_IS_RETURN_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_RETURN_EXPRESSION))
-#define G_RETURN_EXPRESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_RETURN_EXPRESSION, GReturnExpressionClass))
-
-
-
-/* Définition d'un ordre de retour (instance) */
-typedef struct _GReturnExpression GReturnExpression;
-
-/* Définition d'un ordre de retour (classe) */
-typedef struct _GReturnExpressionClass GReturnExpressionClass;
-
-
-/* Indique le type défini pour un ordre de retour. */
-GType g_return_expression_get_type(void);
-
-/* Constitue un ordre de retour vers l'appelant. */
-GDecInstruction *g_return_expression_new(GDecExpression *);
-
-
-
-#endif /* _DECOMP_EXPR_RETURN_H */
diff --git a/src/decomp/expr/text.c b/src/decomp/expr/text.c
deleted file mode 100644
index bdf0495..0000000
--- a/src/decomp/expr/text.c
+++ /dev/null
@@ -1,159 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * text.c - raccord avec les opérandes de chaînes de caractères
- *
- * Copyright (C) 2012 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "text.h"
-
-
-#include <string.h>
-
-
-#include "../expression-int.h"
-
-
-
-/* Définition d'une expression de valeur immédiate (instance) */
-struct _GStrExpression
-{
- GDecExpression parent; /* A laisser en premier */
-
- char *value; /* Chaîne représentée */
- size_t len; /* Taille du texte */
-
-};
-
-
-/* Définition d'une expression de valeur immédiate (classe) */
-struct _GStrExpressionClass
-{
- GDecExpressionClass parent; /* A laisser en premier */
-
-};
-
-
-
-/* Initialise la classe des expressions de valeur immédiate. */
-static void g_str_expression_class_init(GStrExpressionClass *);
-
-/* Initialise une instance d'expression de valeur immédiate. */
-static void g_str_expression_init(GStrExpression *);
-
-/* Imprime pour l'écran un version humaine d'une expression. */
-static GBufferLine *g_str_expression_print(const GStrExpression *, GCodeBuffer *, GBufferLine *, GLangOutput *);
-
-
-
-/* Indique le type défini pour une expression de valeur immédiate. */
-G_DEFINE_TYPE(GStrExpression, g_str_expression, G_TYPE_DEC_EXPRESSION);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des expressions de valeur immédiate. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_str_expression_class_init(GStrExpressionClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = instance à initialiser. *
-* *
-* Description : Initialise une instance d'expression de valeur immédiate. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_str_expression_init(GStrExpression *expr)
-{
- GDecInstruction *instr; /* Autre version de l'objet */
-
- instr = G_DEC_INSTRUCTION(expr);
-
- instr->print = (dec_instr_print_fc)g_str_expression_print;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : value = chaîne de caractères à représenter. *
-* *
-* Description : Construit une expression à partir d'une valeur immédiate. *
-* *
-* Retour : Expression mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GDecInstruction *g_str_expression_new(const char *value)
-{
- GStrExpression *result; /* Expression à retourner */
-
- result = g_object_new(G_TYPE_STR_EXPRESSION, NULL);
-
- result->value = strdup(value);
- result->len = strlen(value);
-
- return G_DEC_INSTRUCTION(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : expr = expression à transcrire en version humaine. *
-* buffer = tampon où doit se réaliser l'insertion. *
-* line = ligne d'impression prête à emploi ou NULL. *
-* output = langage de programmation de sortie. *
-* *
-* Description : Imprime pour l'écran un version humaine d'une expression. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GBufferLine *g_str_expression_print(const GStrExpression *expr, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
-{
- g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, "\"", 1, RTT_STRING, NULL);
- g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, expr->value, expr->len, RTT_STRING, NULL);
- g_buffer_line_append_text(line, BLC_ASSEMBLY_HEAD, "\"", 1, RTT_STRING, NULL);
-
- return line;
-
-}
diff --git a/src/decomp/expr/text.h b/src/decomp/expr/text.h
deleted file mode 100644
index e54b4db..0000000
--- a/src/decomp/expr/text.h
+++ /dev/null
@@ -1,60 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * text.h - prototypes pour le raccord avec les opérandes de chaînes de caractères
- *
- * Copyright (C) 2012 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _DECOMP_EXPR_TEXT_H
-#define _DECOMP_EXPR_TEXT_H
-
-
-#include <glib-object.h>
-
-
-#include "../instruction.h"
-
-
-
-#define G_TYPE_STR_EXPRESSION g_str_expression_get_type()
-#define G_STR_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_str_expression_get_type(), GStrExpression))
-#define G_IS_STR_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_str_expression_get_type()))
-#define G_STR_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_STR_EXPRESSION, GStrExpressionClass))
-#define G_IS_STR_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_STR_EXPRESSION))
-#define G_STR_EXPRESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_STR_EXPRESSION, GStrExpressionClass))
-
-
-
-/* Définition d'une expression de valeur immédiate (instance) */
-typedef struct _GStrExpression GStrExpression;
-
-/* Définition d'une expression de valeur immédiate (classe) */
-typedef struct _GStrExpressionClass GStrExpressionClass;
-
-
-
-/* Indique le type défini pour une expression de valeur immédiate. */
-GType g_str_expression_get_type(void);
-
-/*Construit une expression à partir d'une valeur immédiate. */
-GDecInstruction *g_str_expression_new(const char *);
-
-
-
-#endif /* _DECOMP_EXPR_TEXT_H */