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/lang | |
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/lang')
-rw-r--r-- | src/decomp/lang/java.c | 84 |
1 files changed, 81 insertions, 3 deletions
diff --git a/src/decomp/lang/java.c b/src/decomp/lang/java.c index ae7fb70..f4466a5 100644 --- a/src/decomp/lang/java.c +++ b/src/decomp/lang/java.c @@ -84,6 +84,12 @@ static void g_java_output_start_routine_body(GJavaOutput *, GCodeBuffer *, GBuff /* Termine la définition du corps d'une routine. */ static void g_java_output_end_routine_body(GJavaOutput *, GCodeBuffer *); +/* Commence la définition d'un bloc de code. */ +static GBufferLine *g_java_output_start_code_block(GJavaOutput *, GCodeBuffer *, GBufferLine *, size_t); + +/* Termine la définition d'un bloc de code. */ +static GBufferLine *g_java_output_end_code_block(GJavaOutput *, GCodeBuffer *, GBufferLine *, size_t); + /* Indique le type défini pour une sortie en langage Java. */ @@ -142,6 +148,9 @@ static void g_java_output_init(GJavaOutput *output) lang->start_routine_body = (lgbufln_fc)g_java_output_start_routine_body; lang->end_routine_body = (lgbuf_fc)g_java_output_end_routine_body; + lang->start_code_block = (rlgbuflnsz_fc)g_java_output_start_code_block; + lang->end_code_block = (rlgbuflnsz_fc)g_java_output_end_code_block; + } @@ -465,11 +474,12 @@ static void g_java_output_end_routine_prototype(GJavaOutput *output, GCodeBuffer static void g_java_output_start_routine_body(GJavaOutput *output, GCodeBuffer *buffer, GBufferLine *line) { + /* g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, " ", 1, RTT_RAW); - g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, "{", 2, RTT_HOOK); + g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, "{", 1, RTT_HOOK); g_code_buffer_inc_indentation(buffer); - + */ } @@ -489,11 +499,79 @@ static void g_java_output_start_routine_body(GJavaOutput *output, GCodeBuffer *b static void g_java_output_end_routine_body(GJavaOutput *output, GCodeBuffer *buffer) { GBufferLine *line; /* Nouvelle ligne à constituer */ - + /* g_code_buffer_dec_indentation(buffer); line = g_code_buffer_append_new_line_fixme(buffer); g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, "}", 1, RTT_HOOK); + */ +} + + +/****************************************************************************** +* * +* Paramètres : output = encadrant de l'impression en langage de prog. * +* buffer = tampon de sortie à disposition. * +* line = ligne contenant le prototype de la routine traitée. * +* count = nombre d'éléments du bloc. * +* * +* Description : Commence la définition d'un bloc de code. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static GBufferLine *g_java_output_start_code_block(GJavaOutput *output, GCodeBuffer *buffer, GBufferLine *line, size_t count) +{ + GBufferLine *result; /* Nouvelle ligne à utiliser */ + + if (count > 1) + { + g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, " ", 1, RTT_RAW); + g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, "{", 1, RTT_HOOK); + } + + g_code_buffer_inc_indentation(buffer); + + result = g_code_buffer_append_new_line_fixme(buffer); /* FIXME : n° de ligne */ + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : output = encadrant de l'impression en langage de prog. * +* buffer = tampon de sortie à disposition. * +* line = ligne contenant le prototype de la routine traitée. * +* count = nombre d'éléments du bloc. * +* * +* Description : Termine la définition d'un bloc de code. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static GBufferLine *g_java_output_end_code_block(GJavaOutput *output, GCodeBuffer *buffer, GBufferLine *line, size_t count) +{ + GBufferLine *result; /* Nouvelle ligne à constituer */ + + g_code_buffer_dec_indentation(buffer); + + result = g_code_buffer_append_new_line_fixme(buffer); + + if (count > 1) + { + g_buffer_line_insert_text(result, BLC_ASSEMBLY_HEAD, "}", 1, RTT_HOOK); + g_buffer_line_insert_text(result, BLC_ASSEMBLY_HEAD, " ", 1, RTT_RAW); + } + + return result; } |