diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-01-15 14:57:19 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-01-15 14:57:19 (GMT) |
commit | e28ba4839188307f94293af4e29ed6e774c0a499 (patch) | |
tree | 2b3ce4dd609f5fe03fcfc3641c9723b39205079b /src/glibext/gcodebuffer.c | |
parent | 0a028b306093746324eabdb94881083f9b7e61c1 (diff) |
Exported disassembled content in plain text or HTML format properly.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@455 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/glibext/gcodebuffer.c')
-rw-r--r-- | src/glibext/gcodebuffer.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/glibext/gcodebuffer.c b/src/glibext/gcodebuffer.c index eab418e..d13c9d6 100644 --- a/src/glibext/gcodebuffer.c +++ b/src/glibext/gcodebuffer.c @@ -1572,6 +1572,78 @@ void g_buffer_view_draw(const GBufferView *view, cairo_t *cr, gint fake_x, gint /****************************************************************************** * * +* Paramètres : view = visualisation à représenter. * +* ctx = éléments à disposition pour l'exportation. * +* type = type d'exportation attendue. * +* display = règles d'affichage des colonnes modulables. * +* * +* Description : Exporte le contenu du tampon de code désassemblé. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_buffer_view_export(const GBufferView *view, buffer_export_context *ctx, BufferExportType type, const bool *display) +{ + size_t start; /* Première ligne visée */ + size_t end; /* Dernière ligne avant limite */ + GBufferLine **lines; /* Liste des lignes à traiter */ + size_t i; /* Boucle de parcours */ + + start = g_code_buffer_get_index_from_address(view->buffer, view->start, true); + end = g_code_buffer_get_index_from_address(view->buffer, view->end, false); + + lines = view->buffer->lines; + + switch (type) + { + case BET_HTML: + dprintf(ctx->fd, "<HTML>\n"); + dprintf(ctx->fd, "<HEAD>\n"); + dprintf(ctx->fd, "\t<META http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>\n"); + dprintf(ctx->fd, "</HEAD>\n"); + dprintf(ctx->fd, "<BODY>\n"); + dprintf(ctx->fd, "<STYLE type=\"text/css\">\n"); + dprintf(ctx->fd, "TABLE {\n"); + dprintf(ctx->fd, "\tbackground-color: %s;\n", ctx->bg_color); + dprintf(ctx->fd, "\tborder: 0px;\n"); + dprintf(ctx->fd, "\tfont-family: %s;\n", ctx->font_name); + dprintf(ctx->fd, "}\n"); + dprintf(ctx->fd, "TD {\n"); + dprintf(ctx->fd, "\tborder: 0px;\n"); + dprintf(ctx->fd, "\tpadding-left: 8px;\n"); + dprintf(ctx->fd, "\tpadding-right: 8px;\n"); + dprintf(ctx->fd, "}\n"); + g_buffer_segment_export_style(ctx, type); + dprintf(ctx->fd, "</STYLE>\n"); + dprintf(ctx->fd, "<TABLE>\n"); + break; + default: + break; + } + + if (view->buffer->used > 0) + for (i = start; i <= end; i++) + g_buffer_line_export(lines[i], ctx, type, display); + + switch (type) + { + case BET_HTML: + dprintf(ctx->fd, "</TABLE>\n"); + dprintf(ctx->fd, "</BODY>\n"); + dprintf(ctx->fd, "</HTML>\n"); + break; + default: + break; + } + +} + + +/****************************************************************************** +* * * Paramètres : view = visualisation à consulter. * * y = ordonnée comprise dans la ligne recherchée. * * idx = indice de la ligne trouvée ou NULL. [OUT] * |