summaryrefslogtreecommitdiff
path: root/src/glibext/gcodebuffer.h
blob: b92f38b1da8f8767226b26b0501679c0d6d8d0d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141

/* OpenIDA - Outil d'analyse de fichiers binaires
 * gcodebuffer.h - prototypes pour l'affichage d'un fragment de code d'assemblage
 *
 * Copyright (C) 2010-2012 Cyrille Bagard
 *
 *  This file is part of OpenIDA.
 *
 *  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 <http://www.gnu.org/licenses/>.
 */


#ifndef _GLIBEXT_GCODEBUFFER_H
#define _GLIBEXT_GCODEBUFFER_H


#include <glib-object.h>


#include "gbufferline.h"



/* -------------------------- TAMPON POUR CODE DESASSEMBLE -------------------------- */


#define G_TYPE_CODE_BUFFER                  (g_code_buffer_get_type())
#define G_CODE_BUFFER(obj)                  (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_CODE_BUFFER, GCodeBuffer))
#define G_CODE_BUFFER_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_CODE_BUFFER, GCodeBufferClass))
#define G_IS_CODE_BUFFER(obj)               (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_CODE_BUFFER))
#define G_IS_CODE_BUFFER_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_CODE_BUFFER))
#define G_CODE_BUFFER_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_CODE_BUFFER, GCodeBufferClass))


/* Tampon pour code désassemblé (instance) */
typedef struct _GCodeBuffer GCodeBuffer;

/* Tampon pour code désassemblé (classe) */
typedef struct _GCodeBufferClass GCodeBufferClass;


/* Détermine le type du composant de tampon pour code désassemblé. */
GType g_code_buffer_get_type(void);

/* Crée un nouveau composant de tampon pour code désassemblé. */
GCodeBuffer *g_code_buffer_new(void);

/* FIXME */
#define g_code_buffer_append_new_line_fixme(b) g_code_buffer_append_new_line(b, 0ull)

/* Ajoute une nouvelle ligne à un tampon pour code désassemblé. */
GBufferLine *g_code_buffer_append_new_line(GCodeBuffer *, vmpa_t);

/* Retrouve une ligne au sein d'un tampon avec une adresse. */
GBufferLine *g_code_buffer_find_line_by_addr(const 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 *);

/* Exporte dans un fichier le tampon de code désassemblé. */
void g_buffer_code_scan(GCodeBuffer *, vmpa_t, vmpa_t, const char *, process_line_fc, void *);



/* ---------------------- VUE PARTICULIERE D'UN TAMPON DE CODE ---------------------- */


#define G_TYPE_BUFFER_VIEW                  (g_buffer_view_get_type())
#define G_BUFFER_VIEW(obj)                  (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_BUFFER_VIEW, GBufferView))
#define G_BUFFER_VIEW_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_BUFFER_VIEW, GBufferViewClass))
#define G_IS_BUFFER_VIEW(obj)               (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_BUFFER_VIEW))
#define G_IS_BUFFER_VIEW_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_BUFFER_VIEW))
#define G_BUFFER_VIEW_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_BUFFER_VIEW, GBufferViewClass))


/* Vue d'un tampon pour code désassemblé (instance) */
typedef struct _GBufferView GBufferView;

/* Vue d'un tampon pour code désassemblé (classe) */
typedef struct _GBufferViewClass GBufferViewClass;


/* Détermine le type de la vue d'un tampon pour code désassemblé. */
GType g_buffer_view_get_type(void);

/* Crée une nouvelle vue d'un tampon pour code désassemblé. */
GBufferView *g_buffer_view_new(GCodeBuffer *);

/* Restreint le champ d'application de l'affichage. */
void g_buffer_view_restrict(GBufferView *, vmpa_t, vmpa_t);

/* Indique le champ d'application de l'affichage. */
void g_buffer_view_get_restrictions(GBufferView *, vmpa_t *, vmpa_t *);

/* Fournit le tampon de code lié à un visualisateur donné. */
GCodeBuffer *g_buffer_view_get_buffer(const GBufferView *);

/* Fournit la hauteur d'impression d'une ligne visualisée. */
gint g_buffer_view_get_line_height(GBufferView *);

/* Fournit les dimensions requises par une visualisation. */
void g_buffer_view_get_size(GBufferView *, gint *, gint *, bool, bool);

/* Supprime toute mise en évidence de segments. */
bool g_buffer_view_unhighlight_segments(GBufferView *);

/* Surligne tous les segments similaires à celui sous la souris. */
void g_buffer_view_highlight_segments(GBufferView *, gint, gint);

/* Définit à une procédure à appeler lors des dessins de ligne. */
void g_buffer_view_define_extra_drawing(GBufferView *, buffer_line_draw_fc, void *);

/* Imprime la visualisation du tampon de code désassemblé. */
void g_buffer_view_draw(const GBufferView *, const GdkEventExpose *, GdkGC *, gint, gint, bool, bool);

/* Fournit la ligne présente à une ordonnée donnée. */
GBufferLine *g_buffer_view_find_line_at(GBufferView *, gint);

/* Indique la position d'affichage d'une adresse donnée. */
bool g_buffer_view_get_address_coordinates(GBufferView *, vmpa_t, gint *, gint *);



#endif  /* _GLIBEXT_GCODEBUFFER_H */