summaryrefslogtreecommitdiff
path: root/src/decomp/instr/ite.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2013-01-31 21:29:49 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2013-01-31 21:29:49 (GMT)
commit0936f64aac6a4fa9ebc08962bc9cac663f210c00 (patch)
treee888b4d7b547680bb26082913216bc637073e734 /src/decomp/instr/ite.c
parentb6341581220e92114b0838a15a1c1cec1078efc2 (diff)
Saved the first steps of switch instructions decompilation.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@335 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/decomp/instr/ite.c')
-rw-r--r--src/decomp/instr/ite.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/decomp/instr/ite.c b/src/decomp/instr/ite.c
index d78bb31..60627a6 100644
--- a/src/decomp/instr/ite.c
+++ b/src/decomp/instr/ite.c
@@ -1,8 +1,8 @@
/* OpenIDA - Outil d'analyse de fichiers binaires
- * cond.c - représentation des conditions
+ * ite.c - représentation des branchements conditionnels
*
- * Copyright (C) 2010 Cyrille Bagard
+ * Copyright (C) 2010-2013 Cyrille Bagard
*
* This file is part of OpenIDA.
*
@@ -107,7 +107,7 @@ static void g_ite_instruction_class_init(GITEInstructionClass *klass)
/******************************************************************************
* *
-* Paramètres : expr = instance à initialiser. *
+* Paramètres : instr = instance à initialiser. *
* *
* Description : Initialise une instance d'aiguillage du flux d'exécution. *
* *
@@ -117,15 +117,15 @@ static void g_ite_instruction_class_init(GITEInstructionClass *klass)
* *
******************************************************************************/
-static void g_ite_instruction_init(GITEInstruction *expr)
+static void g_ite_instruction_init(GITEInstruction *instr)
{
- GDecInstruction *instr; /* Autre version de l'objet */
+ GDecInstruction *base; /* Autre version de l'objet */
- instr = G_DEC_INSTRUCTION(expr);
+ base = G_DEC_INSTRUCTION(instr);
- instr->visit = (dec_instr_visit_fc)g_ite_instruction_visit;
- instr->replace = (dec_instr_replace_fc)g_ite_instruction_replace;
- instr->print = (dec_instr_print_fc)g_ite_instruction_print;
+ base->visit = (dec_instr_visit_fc)g_ite_instruction_visit;
+ base->replace = (dec_instr_replace_fc)g_ite_instruction_replace;
+ base->print = (dec_instr_print_fc)g_ite_instruction_print;
}
@@ -226,7 +226,7 @@ static bool g_ite_instruction_replace(GITEInstruction *instr, GDecInstruction *o
/******************************************************************************
* *
-* Paramètres : expr = instruction à transcrire en version humaine. *
+* Paramètres : instr = instruction à 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. *
@@ -239,24 +239,24 @@ static bool g_ite_instruction_replace(GITEInstruction *instr, GDecInstruction *o
* *
******************************************************************************/
-static GBufferLine *g_ite_instruction_print(const GITEInstruction *expr, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
+static GBufferLine *g_ite_instruction_print(const GITEInstruction *instr, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
{
GBufferLine *result; /* Ligne à retourner */
g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, "if ", 3, RTT_KEY_WORD);
- if (expr->inverse)
+ if (instr->inverse)
g_buffer_line_insert_text(line /* FIXME */, BLC_ASSEMBLY_HEAD, "!", 1, RTT_KEY_WORD);
- result = g_dec_instruction_print(G_DEC_INSTRUCTION(expr->cond),
+ result = g_dec_instruction_print(G_DEC_INSTRUCTION(instr->cond),
buffer, line, output);
- result = g_dec_instruction_print(expr->true_branch, buffer, result, output);
+ result = g_dec_instruction_print(instr->true_branch, buffer, result, output);
- if (expr->false_branch != NULL)
+ if (instr->false_branch != NULL)
{
g_buffer_line_insert_text(result, BLC_ASSEMBLY_HEAD, "else", 4, RTT_KEY_WORD);
- result = g_dec_instruction_print(expr->false_branch, buffer, result, output);
+ result = g_dec_instruction_print(instr->false_branch, buffer, result, output);
}
return result;
@@ -266,7 +266,7 @@ static GBufferLine *g_ite_instruction_print(const GITEInstruction *expr, GCodeBu
/******************************************************************************
* *
-* Paramètres : cond = expression fixant le choix de l'aiguillage. *
+* Paramètres : instr = expression fixant le choix de l'aiguillage. *
* true_branch = instructions si la condition est vérifiée. *
* false_branch = instructions si la cond. n'est pas vérifiée. *
* *
@@ -278,21 +278,21 @@ static GBufferLine *g_ite_instruction_print(const GITEInstruction *expr, GCodeBu
* *
******************************************************************************/
-void g_ite_instruction_set_branches(GITEInstruction *expr, GDecInstruction *true_branch, GDecInstruction *false_branch)
+void g_ite_instruction_set_branches(GITEInstruction *instr, GDecInstruction *true_branch, GDecInstruction *false_branch)
{
if (true_branch == NULL)
{
- expr->inverse = true;
+ instr->inverse = true;
- expr->true_branch = false_branch;
- expr->false_branch = true_branch;
+ instr->true_branch = false_branch;
+ instr->false_branch = true_branch;
}
else
{
- expr->true_branch = true_branch;
- expr->false_branch = false_branch;
+ instr->true_branch = true_branch;
+ instr->false_branch = false_branch;
}
}