diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/decomp/lang/java.c | 14 | ||||
-rw-r--r-- | src/glibext/gcodebuffer.c | 46 | ||||
-rw-r--r-- | src/glibext/gcodebuffer.h | 6 |
3 files changed, 64 insertions, 2 deletions
diff --git a/src/decomp/lang/java.c b/src/decomp/lang/java.c index 7c5750b..e5ebdf9 100644 --- a/src/decomp/lang/java.c +++ b/src/decomp/lang/java.c @@ -346,18 +346,24 @@ static void g_java_output_write_comp_sign(GJavaOutput *output, GBufferLine *line static GBufferLine *g_java_output_start_class(GJavaOutput *output, GCodeBuffer *buffer, const GOpenidaType *type) { GBufferLine *result; /* Adresse nouvelle à remonter */ + char *name; /* Désignation humaine */ result = g_code_buffer_append_new_line_fixme(buffer); g_buffer_line_insert_text(result, BLC_ASSEMBLY_HEAD, "class", 5, RTT_KEY_WORD); g_buffer_line_insert_text(result, BLC_ASSEMBLY_HEAD, " ", 1, RTT_RAW); - /* TODO */ - g_buffer_line_insert_text(result, BLC_ASSEMBLY_HEAD, "XXX", 3, RTT_RAW); + name = _g_openida_type_to_string(type, true); + g_buffer_line_insert_text(result, BLC_ASSEMBLY_HEAD, name, strlen(name), RTT_RAW); + free(name); g_buffer_line_insert_text(result, BLC_ASSEMBLY_HEAD, " ", 1, RTT_RAW); g_buffer_line_insert_text(result, BLC_ASSEMBLY_HEAD, "{", 1, RTT_HOOK); + result = g_code_buffer_append_new_line_fixme(buffer); + + g_code_buffer_inc_indentation(buffer); + return result; } @@ -380,10 +386,14 @@ static void g_java_output_end_class(GJavaOutput *output, GCodeBuffer *buffer) { GBufferLine *result; /* Adresse nouvelle à remonter */ + g_code_buffer_dec_indentation(buffer); + result = g_code_buffer_append_new_line_fixme(buffer); g_buffer_line_insert_text(result, BLC_ASSEMBLY_HEAD, "}", 1, RTT_HOOK); + result = g_code_buffer_append_new_line_fixme(buffer); + return result; } diff --git a/src/glibext/gcodebuffer.c b/src/glibext/gcodebuffer.c index 97d6505..fe00e2d 100644 --- a/src/glibext/gcodebuffer.c +++ b/src/glibext/gcodebuffer.c @@ -97,6 +97,8 @@ struct _GCodeBuffer size_t count; /* Quantité en cache */ size_t used; /* Quantité utilisée */ + size_t indent; /* Indentation des lignes */ + }; /* Tampon pour code désassemblé (classe) */ @@ -420,6 +422,7 @@ static size_t g_code_buffer_get_index_from_address(GCodeBuffer *buffer, vmpa_t a GBufferLine *g_code_buffer_append_new_line(GCodeBuffer *buffer, vmpa_t addr) { GBufferLine *result; /* Instance à retourner */ + size_t i; /* Boucle de parcours */ if (buffer->used == buffer->count) { @@ -431,6 +434,9 @@ GBufferLine *g_code_buffer_append_new_line(GCodeBuffer *buffer, vmpa_t addr) result = g_buffer_line_new(addr); buffer->lines[buffer->used++] = result; + for (i = 0; i < buffer->indent; i++) + g_buffer_line_insert_text(result, BLC_ASSEMBLY_HEAD, " ", 4, RTT_RAW); + return result; } @@ -438,6 +444,46 @@ GBufferLine *g_code_buffer_append_new_line(GCodeBuffer *buffer, vmpa_t addr) /****************************************************************************** * * +* Paramètres : buffer = composant GTK à mettre à jour. * +* * +* Description : Augmente l'indentation des prochaines lignes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_code_buffer_inc_indentation(GCodeBuffer *buffer) +{ + buffer->indent++; + +} + + +/****************************************************************************** +* * +* Paramètres : buffer = composant GTK à mettre à jour. * +* * +* Description : Diminue l'indentation des prochaines lignes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_code_buffer_dec_indentation(GCodeBuffer *buffer) +{ + /* BUG_ON(buffer->indent == 0) */ + + buffer->indent--; + +} + + +/****************************************************************************** +* * * Paramètres : buffer = tampon de données à utiliser. * * start = première adresse visée ou 0. * * end = dernière adresse visée ou VMPA_MAX. * diff --git a/src/glibext/gcodebuffer.h b/src/glibext/gcodebuffer.h index 3fc6155..1cac790 100644 --- a/src/glibext/gcodebuffer.h +++ b/src/glibext/gcodebuffer.h @@ -62,6 +62,12 @@ GCodeBuffer *g_code_buffer_new(void); /* Ajoute une nouvelle ligne à un tampon pour code désassemblé. */ GBufferLine *g_code_buffer_append_new_line(GCodeBuffer *, vmpa_t); +/* Augmente l'indentation des prochaines lignes. */ +void g_code_buffer_inc_indentation(GCodeBuffer *); + +/* Diminue l'indentation des prochaines lignes. */ +void g_code_buffer_dec_indentation(GCodeBuffer *); + /* Traitement d'une ligne parcourue. */ typedef bool (* process_line_fc) (GCodeBuffer *, GBufferLine *, void *); |