summaryrefslogtreecommitdiff
path: root/src/analysis/line_code.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-03-31 21:12:35 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-03-31 21:12:35 (GMT)
commit7cbdd17b441b35d48624956aa438bde69f18bc37 (patch)
tree438af8d0a994d6e203cf66ea91cf336bb071ee44 /src/analysis/line_code.c
parentd5e55f2ad015781bd7bee0e3216e47d6218e0841 (diff)
Implemented first steps to a Python plugins support.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@146 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/line_code.c')
-rw-r--r--src/analysis/line_code.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/src/analysis/line_code.c b/src/analysis/line_code.c
index 24f3ec9..7c80074 100644
--- a/src/analysis/line_code.c
+++ b/src/analysis/line_code.c
@@ -136,7 +136,8 @@ static void g_code_line_init(GCodeLine *line)
static void g_code_line_add_text(GCodeLine *line, GRenderingOptions *options, MainRendering rendering, FILE *stream)
{
- GContentExporter *exporter; /* Autre vision de la ligne */
+ GContentExporter *exporter; /* Autre vision de la ligne #1 */
+ GRenderingLine *basic; /* Autre vision de la ligne #2 */
bool show_address; /* Affichage de l'adresse ? */
bool show_code; /* Affichage du code brut ? */
MemoryDataSize msize; /* Taille du bus d'adresses */
@@ -149,6 +150,7 @@ static void g_code_line_add_text(GCodeLine *line, GRenderingOptions *options, Ma
off_t i; /* Boucle de parcours */
exporter = G_CONTENT_EXPORTER(line);
+ basic = G_RENDERING_LINE(line);
show_address = g_rendering_options_has_to_show_address(options, rendering);
show_code = g_rendering_options_has_to_show_code(options, rendering);
@@ -195,6 +197,16 @@ static void g_code_line_add_text(GCodeLine *line, GRenderingOptions *options, Ma
g_content_exporter_add_text(G_CONTENT_EXPORTER(line->instr), options, rendering, stream);
+ /* Commentaire ? */
+
+ if (basic->comment != NULL)
+ {
+ g_content_exporter_insert_text(exporter, stream, "\t", 1, RTT_NONE);
+ g_content_exporter_insert_text(exporter, stream, "; ", 2, RTT_COMMENT);
+ g_content_exporter_insert_text(exporter, stream, basic->comment,
+ strlen(basic->comment), RTT_COMMENT);
+ }
+
}
@@ -216,6 +228,8 @@ static void g_code_line_add_text(GCodeLine *line, GRenderingOptions *options, Ma
static void g_code_line_add_to_gtk_buffer(GCodeLine *line, MainRendering rendering, GtkTextBuffer *buffer, GtkTextIter *iter, size_t lengths[SAR_COUNT])
{
+ GContentExporter *exporter; /* Autre vision de la ligne #1 */
+ GRenderingLine *basic; /* Autre vision de la ligne #2 */
bool show_address; /* Affichage de l'adresse ? */
bool show_code; /* Affichage du code brut ? */
MemoryDataSize msize; /* Taille du bus d'adresses */
@@ -227,6 +241,9 @@ static void g_code_line_add_to_gtk_buffer(GCodeLine *line, MainRendering renderi
char *bin_code; /* Tampon du code binaire */
off_t i; /* Boucle de parcours */
+ exporter = G_CONTENT_EXPORTER(line);
+ basic = G_RENDERING_LINE(line);
+
show_address = g_rendering_options_has_to_show_address(line->options, rendering);
show_code = g_rendering_options_has_to_show_code(line->options, rendering);
@@ -239,10 +256,10 @@ static void g_code_line_add_to_gtk_buffer(GCodeLine *line, MainRendering renderi
len = vmpa_to_string(G_RENDERING_LINE(line)->offset, msize, address);
lengths[SAR_ADDRESS] = len;
- g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(line), buffer, iter,
+ g_content_exporter_insert_with_gtk_tag(exporter, buffer, iter,
address, len, RTT_NONE);
- g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(line), buffer, iter,
+ g_content_exporter_insert_with_gtk_tag(exporter, buffer, iter,
"\t", 1, RTT_NONE);
}
@@ -266,12 +283,12 @@ static void g_code_line_add_to_gtk_buffer(GCodeLine *line, MainRendering renderi
snprintf(&bin_code[i * (2 + 1)], 3, "%02hhx", content[bin_offset + i]);
}
- g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(line), buffer, iter,
+ g_content_exporter_insert_with_gtk_tag(exporter, buffer, iter,
bin_code, bin_len * 3 - 1, RTT_RAW_CODE);
free(bin_code);
- g_content_exporter_insert_with_gtk_tag(G_CONTENT_EXPORTER(line), buffer, iter,
+ g_content_exporter_insert_with_gtk_tag(exporter, buffer, iter,
"\t", 1, RTT_NONE);
}
@@ -284,6 +301,16 @@ static void g_code_line_add_to_gtk_buffer(GCodeLine *line, MainRendering renderi
lengths[SAR_INSTRUCTION] = MAX(lengths[SAR_INSTRUCTION], 4 /* FIXME */);
+ /* Commentaire ? */
+
+ if (basic->comment != NULL)
+ {
+ g_content_exporter_insert_with_gtk_tag(exporter, buffer, iter, "\t", 1, RTT_NONE);
+ g_content_exporter_insert_with_gtk_tag(exporter, buffer, iter, "; ", 2, RTT_COMMENT);
+ g_content_exporter_insert_with_gtk_tag(exporter, buffer, iter, basic->comment,
+ strlen(basic->comment), RTT_COMMENT);
+ }
+
}