diff options
Diffstat (limited to 'src/analysis/line_comment.c')
-rw-r--r-- | src/analysis/line_comment.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/analysis/line_comment.c b/src/analysis/line_comment.c index 331bd19..a39cb11 100644 --- a/src/analysis/line_comment.c +++ b/src/analysis/line_comment.c @@ -38,7 +38,7 @@ struct _GCommentLine GRenderingLine parent; /* Instance parente */ char *comment; /* Texte à afficher */ - const disass_options *options; /* Options de représentation */ + const GRenderingOptions *options; /* Options de représentation */ }; @@ -58,7 +58,7 @@ static void g_comment_line_class_init(GCommentLineClass *); static void g_comment_line_init(GCommentLine *); /* Met à jour la ligne de représentation de commentaires. */ -void g_comment_line_refresh_markup(GCommentLine *, LinesMainOwner); +void g_comment_line_refresh_markup(GCommentLine *, MainRendering); @@ -112,8 +112,8 @@ static void g_comment_line_init(GCommentLine *line) /****************************************************************************** * * -* Paramètres : line = ligne de représentation à actualiser. * -* owner = support effectif final des lignes de code. * +* Paramètres : line = ligne de représentation à actualiser. * +* rendering = support effectif final des lignes de code. * * * * Description : Met à jour la ligne de représentation de commentaires. * * * @@ -123,23 +123,28 @@ static void g_comment_line_init(GCommentLine *line) * * ******************************************************************************/ -void g_comment_line_refresh_markup(GCommentLine *line, LinesMainOwner owner) +void g_comment_line_refresh_markup(GCommentLine *line, MainRendering rendering) { + bool show_address; /* Affichage de l'adresse ? */ + bool show_code; /* Affichage du code brut ? */ size_t len; /* Taille du contenu */ char *content; /* Contenu réellement imprimé */ char buffer[CODE_BUFFER_LEN]; /* Zone tampon à utiliser */ const off_t *max_bin_len; /* Taille de ligne max/globale */ size_t clen; /* Taille du commentaire */ + show_address = g_rendering_options_has_to_show_address(line->options, rendering); + show_code = g_rendering_options_has_to_show_code(line->options, rendering); + len = strlen("<tt>") + 1; content = (char *)calloc(len, sizeof(char)); strcpy(content, "<tt>"); /* Eventuelle adresse virtuelle */ - if (line->options->show_address) + if (show_address) { - switch (g_arch_processor_get_memory_size(line->options->proc)) + switch (g_arch_processor_get_memory_size(g_rendering_options_get_processor(line->options))) { case MDS_8_BITS: snprintf(buffer, CODE_BUFFER_LEN, @@ -176,16 +181,16 @@ void g_comment_line_refresh_markup(GCommentLine *line, LinesMainOwner owner) /* Eventuel code brut (sauté) */ - if (line->options->show_code) + if (show_code) { - max_bin_len = &G_RENDERING_LINE(line)->max_bin_len[owner]; + max_bin_len = &G_RENDERING_LINE(line)->max_bin_len[rendering]; - clen = (line->options->show_address ? strlen("\t") : 0); + clen = (show_address ? strlen("\t") : 0); clen += *max_bin_len; content = (char *)realloc(content, (len + clen) * sizeof(char)); - if (line->options->show_address) + if (show_address) { strcat(content, "\t"); len += strlen("\t"); @@ -201,14 +206,14 @@ void g_comment_line_refresh_markup(GCommentLine *line, LinesMainOwner owner) /* Commentaire proprement dit */ - clen = (line->options->show_address || line->options->show_code ? strlen("\t") : 0); + clen = (show_address || show_code ? strlen("\t") : 0); clen += strlen("<b><span foreground='#003300'>"); clen += strlen("; ") + strlen(line->comment); clen += strlen("</span></b>"); content = (char *)realloc(content, (len + clen) * sizeof(char)); - if (line->options->show_address || line->options->show_code) + if (show_address || show_code) { strcat(content, "\t"); len += strlen("\t"); @@ -225,7 +230,7 @@ void g_comment_line_refresh_markup(GCommentLine *line, LinesMainOwner owner) content = (char *)realloc(content, len * sizeof(char)); strcat(content, "</tt>"); - pango_layout_set_markup(G_RENDERING_LINE(line)->layout[owner], content, len - 1); + pango_layout_set_markup(G_RENDERING_LINE(line)->layout[rendering], content, len - 1); free(content); @@ -246,7 +251,7 @@ void g_comment_line_refresh_markup(GCommentLine *line, LinesMainOwner owner) * * ******************************************************************************/ -GRenderingLine *g_comment_line_new(uint64_t offset, const char *comment, const disass_options *options) +GRenderingLine *g_comment_line_new(uint64_t offset, const char *comment, const GRenderingOptions *options) { GCommentLine *result; /* Structure à retourner */ |