diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2012-11-28 09:43:50 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2012-11-28 09:43:50 (GMT) |
commit | f95598b68b98f6eda701f8f02bc09cb13f65fc72 (patch) | |
tree | eefee33963448a1ce53a7eb80dacabbcdce8fc21 /src/decomp/instruction.c | |
parent | fbb4b6f53d2189ba9f61c1fd149534d8aef82dcd (diff) |
Followed the excution flow to decompile instructions.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@293 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/decomp/instruction.c')
-rw-r--r-- | src/decomp/instruction.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/src/decomp/instruction.c b/src/decomp/instruction.c index c48ac7b..2d42e71 100644 --- a/src/decomp/instruction.c +++ b/src/decomp/instruction.c @@ -79,6 +79,35 @@ static void g_dec_instruction_init(GDecInstruction *instr) /****************************************************************************** * * +* Paramètres : instr = première instruction à venir visiter. * +* process = procédure à appeler à chaque instruction visitée. * +* data = données quelconques associées au visiteur. * +* order = précise le sens de la visite. * +* * +* Description : Visite un ensemble hiérarchique d'instructions décompilées. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_dec_instruction_visit(GDecInstruction *instr, process_decomp_fc process, void *data, bool order) +{ + if (order) + process(instr, data); + + if (instr->visit) + instr->visit(instr, process, data, order); + + if (!order) + process(instr, data); + +} + + +/****************************************************************************** +* * * 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. * @@ -92,12 +121,9 @@ static void g_dec_instruction_init(GDecInstruction *instr) * * ******************************************************************************/ -void g_dec_instruction_print(const GDecInstruction *instr, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output) +GBufferLine *g_dec_instruction_print(const GDecInstruction *instr, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output) { - if (line == NULL) - line = g_code_buffer_append_new_line_fixme(buffer); /* FIXME : n° de ligne */ - - instr->print(instr, buffer, line, output); + return instr->print(instr, buffer, line, output); } |