/* Chrysalide - Outil d'analyse de fichiers binaires * gbufferline.h - prototypes pour la représentation de fragments de texte en ligne * * Copyright (C) 2010-2014 Cyrille Bagard * * This file is part of Chrysalide. * * OpenIDA is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * OpenIDA is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Foobar. If not, see . */ #ifndef _GLIBEXT_GBUFFERLINE_H #define _GLIBEXT_GBUFFERLINE_H #include #include #include "gbuffersegment.h" #include "../arch/archbase.h" #include "../arch/vmpa.h" #define G_TYPE_BUFFER_LINE (g_buffer_line_get_type()) #define G_BUFFER_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_BUFFER_LINE, GBufferLine)) #define G_BUFFER_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_BUFFER_LINE, GBufferLineClass)) #define G_IS_BUFFER_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_BUFFER_LINE)) #define G_IS_BUFFER_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_BUFFER_LINE)) #define G_BUFFER_LINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_BUFFER_LINE, GBufferLineClass)) /* Représentation de fragments de texte en ligne (instance) */ typedef struct _GBufferLine GBufferLine; /* Représentation de fragments de texte en ligne (classe) */ typedef struct _GBufferLineClass GBufferLineClass; /* Désignation des colonnes d'une ligne */ typedef enum _BufferLineColumn { BLC_PHYSICAL, /* Position physique */ BLC_VIRTUAL, /* Adresse virtuelle */ BLC_BINARY, /* Contenu sous forme binaire */ BLC_ASSEMBLY_HEAD, /* Instruction pour assembleur */ BLC_ASSEMBLY, /* Code pour assembleur */ BLC_COMMENTS, /* Commentaires éventuels */ BLC_COUNT, BLC_LAST_USED, /* Dernière colonne utilisée */ BLC_INVALID, /* Valeur de non-initialisation*/ BLC_MAIN /* Colonne principale (cf. imm)*/ } BufferLineColumn; /* Première colonne de l'ensemble */ #define BLC_FIRST BLC_PHYSICAL /* Première colonne toujours affichée */ #define BLC_DISPLAY BLC_ASSEMBLY_HEAD /* Confort pour l'insertion de texte */ #define SL(str) str, strlen(str) /* Espace entre les colonnes */ #define COL_MARGIN 23 /* Détermine le type de la représentation de fragments de texte en ligne. */ GType g_buffer_line_get_type(void); /* Crée une nouvelle représentation de fragments de texte. */ GBufferLine *g_buffer_line_new(const mrange_t *, BufferLineColumn); /* Indique la zone mémoire où se situe la ligne. */ const mrange_t *g_buffer_line_get_range(const GBufferLine *); /* Construit le tronc commun d'une ligne autour de sa position. */ void g_buffer_line_fill_mrange(GBufferLine *, MemoryDataSize, MemoryDataSize); /* Construit le tronc commun d'une ligne d'instruction. */ void g_buffer_line_fill_for_instr(GBufferLine *, MemoryDataSize, MemoryDataSize, const bin_t *, off_t, bool); /* Ajoute un fragment de texte à une colonne de ligne. */ void g_buffer_line_add_segment(GBufferLine *, BufferLineColumn, GBufferSegment *) __attribute__ ((deprecated)); /* Donne le segment présent à une abscisse donnée. */ GBufferSegment *g_buffer_line_get_segment_at(const GBufferLine *, const gint [BLC_COUNT], const bool *, gint *, GdkScrollDirection, bool); /* Fournit le segment voisin d'un autre segment identifié. */ GBufferSegment *g_buffer_line_find_near_segment(const GBufferLine *, GBufferSegment *, const gint [BLC_COUNT], const bool *, GdkScrollDirection, gint *); /* Met en surbrillance des segments similaires. */ GSList *g_buffer_line_highlight_all_same_segments(const GBufferLine *, GSList *, const GBufferSegment *); /* Ajoute du texte à formater dans une ligne donnée. */ void g_buffer_line_insert_text(GBufferLine *, BufferLineColumn, const char *, size_t, RenderingTagType); /* Donne le texte représenté par une ligne de tampon. */ char *g_buffer_line_get_text(const GBufferLine *); /* Fournit la largeur requise pour une colonne de ligne donnée. */ gint g_buffer_line_get_column_width(GBufferLine *, BufferLineColumn); /* Fournit la dernière largeur d'une ligne avec fusion. */ gint g_buffer_line_get_merge_width(GBufferLine *, BufferLineColumn *, const bool *); /* Définit la colonne à partir de laquelle la fusion opère. */ void g_buffer_line_start_merge_at(GBufferLine *, BufferLineColumn); /* Imprime la ligne de texte représentée. */ void g_buffer_line_draw(GBufferLine *, cairo_t *, const gint [BLC_COUNT], gint, gint, const bool *); /* Exporte la ligne de texte représentée. */ void g_buffer_line_export(GBufferLine *, int, BufferExportType, bool, bool, bool, bool); #endif /* _GLIBEXT_GBUFFERLINE_H */