diff options
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); } |