summaryrefslogtreecommitdiff
path: root/src/glibext
diff options
context:
space:
mode:
Diffstat (limited to 'src/glibext')
-rw-r--r--src/glibext/gbufferline.c4
-rw-r--r--src/glibext/gbufferline.h2
-rw-r--r--src/glibext/gcodebuffer.c27
-rw-r--r--src/glibext/gcodebuffer.h6
4 files changed, 20 insertions, 19 deletions
diff --git a/src/glibext/gbufferline.c b/src/glibext/gbufferline.c
index 6e06fe4..ac6dc23 100644
--- a/src/glibext/gbufferline.c
+++ b/src/glibext/gbufferline.c
@@ -391,9 +391,9 @@ GBufferLine *g_buffer_line_new(const vmpa2t *addr, BufferLineColumn main)
* *
******************************************************************************/
-vmpa_t g_buffer_line_get_address(const GBufferLine *line)
+const vmpa2t *g_buffer_line_get_address(const GBufferLine *line)
{
- return 0/* FIXME line->addr*/;
+ return line->addr;
}
diff --git a/src/glibext/gbufferline.h b/src/glibext/gbufferline.h
index fa64fe1..4ca07ca 100644
--- a/src/glibext/gbufferline.h
+++ b/src/glibext/gbufferline.h
@@ -86,7 +86,7 @@ GType g_buffer_line_get_type(void);
GBufferLine *g_buffer_line_new(const vmpa2t *, BufferLineColumn);
/* Indique l'adresse à laquelle se situe la ligne. */
-vmpa_t g_buffer_line_get_address(const GBufferLine *);
+const vmpa2t *g_buffer_line_get_address(const GBufferLine *);
/* 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);
diff --git a/src/glibext/gcodebuffer.c b/src/glibext/gcodebuffer.c
index 708a089..6a21222 100644
--- a/src/glibext/gcodebuffer.c
+++ b/src/glibext/gcodebuffer.c
@@ -1083,13 +1083,13 @@ gint g_buffer_view_get_height(const GBufferView *view)
* *
* Description : Calcule la position idéale de curseur pour un point donné. *
* *
-* Retour : Adresse si une a pu être déterminée, VMPA_INVALID sinon. *
+* Retour : Adresse si une a pu être déterminée, NULL sinon. *
* *
* Remarques : - *
* *
******************************************************************************/
-vmpa_t g_buffer_view_compute_caret(GBufferView *view, GBufferLine *line, size_t index, gint x, GdkRectangle *caret)
+const vmpa2t *g_buffer_view_compute_caret(GBufferView *view, GBufferLine *line, size_t index, gint x, GdkRectangle *caret)
{
gint tmp_x; /* Copie de travail modifiable */
GBufferSegment *segment; /* Segment visé par le pointeur*/
@@ -1098,10 +1098,10 @@ vmpa_t g_buffer_view_compute_caret(GBufferView *view, GBufferLine *line, size_t
tmp_x = x;
tmp_x -= view->left_text;
- if (tmp_x < 0) return VMPA_INVALID;
+ if (tmp_x < 0) return NULL;
segment = g_buffer_line_get_segment_at(line, view->max_widths, &tmp_x, true);
- if (segment == NULL) return VMPA_INVALID;
+ if (segment == NULL) return NULL;
caret->x = (x - tmp_x) + g_buffer_segment_get_caret_position(segment, tmp_x);
@@ -1456,19 +1456,22 @@ GBufferLine *g_buffer_view_find_line_at(GBufferView *view, gint y, size_t *idx)
* *
******************************************************************************/
-bool g_buffer_view_get_address_coordinates(GBufferView *view, vmpa_t addr, gint *x, gint *y)
+bool g_buffer_view_get_address_coordinates(GBufferView *view, const vmpa2t *addr, gint *x, gint *y)
{
+ bool result; /* Bilan à retourner */
gint lheight; /* Hauteur d'une ligne */
- vmpa_t current; /* Adresse parcourue */
size_t first; /* Première ligne intégrée */
size_t last; /* Dernière ligne intégrée */
size_t i; /* Boucle de parcours */
+ const vmpa2t *current; /* Adresse parcourue */
+ int ret; /* Bilan d'une comparaison */
+
+ result = false;
*x = 0;
*y = 0;
lheight = g_buffer_view_get_line_height(view);
- current = VMPA_MAX;
first = g_code_buffer_get_index_from_address(view->buffer, view->start, true);
last = g_code_buffer_get_index_from_address(view->buffer, view->end, false);
@@ -1477,17 +1480,15 @@ bool g_buffer_view_get_address_coordinates(GBufferView *view, vmpa_t addr, gint
for (i = first; i <= last; i++)
{
current = g_buffer_line_get_address(view->buffer->lines[i]);
+ ret = cmp_vmpa(current, addr);
- if (current == addr)
- break;
-
- if (current > addr)
- return false;
+ result = (ret == 0);
+ if (ret >= 0) break;
*y += lheight;
}
- return (current == addr);
+ return result;
}
diff --git a/src/glibext/gcodebuffer.h b/src/glibext/gcodebuffer.h
index 3167d41..5be0084 100644
--- a/src/glibext/gcodebuffer.h
+++ b/src/glibext/gcodebuffer.h
@@ -57,7 +57,7 @@ GType g_code_buffer_get_type(void);
GCodeBuffer *g_code_buffer_new(BufferLineColumn);
/* FIXME */
-#define g_code_buffer_append_new_line_fixme(b) g_code_buffer_append_new_line(b, 0ull)
+#define g_code_buffer_append_new_line_fixme(b) g_code_buffer_append_new_line(b, make_vmpa(VMPA_NO_PHYSICAL, VMPA_NO_VIRTUAL))
/* Ajoute une nouvelle ligne à un tampon pour code désassemblé. */
GBufferLine *g_code_buffer_append_new_line(GCodeBuffer *, const vmpa2t *);
@@ -128,7 +128,7 @@ gint g_buffer_view_get_width(GBufferView *, bool, bool, bool);
gint g_buffer_view_get_height(const GBufferView *);
/* Calcule la position idéale de curseur pour un point donné. */
-vmpa_t g_buffer_view_compute_caret(GBufferView *, GBufferLine *, size_t, gint, GdkRectangle *);
+const vmpa2t *g_buffer_view_compute_caret(GBufferView *, GBufferLine *, size_t, gint, GdkRectangle *);
/* Déplace le curseur au sein d'une vue de tampon. */
vmpa_t g_buffer_view_move_caret(GBufferView *, GdkRectangle *, bool, GdkScrollDirection, bool, bool, bool);
@@ -146,7 +146,7 @@ void g_buffer_view_draw(const GBufferView *, cairo_t *, gint, gint, const cairo_
GBufferLine *g_buffer_view_find_line_at(GBufferView *, gint, size_t *);
/* Indique la position d'affichage d'une adresse donnée. */
-bool g_buffer_view_get_address_coordinates(GBufferView *, vmpa_t, gint *, gint *);
+bool g_buffer_view_get_address_coordinates(GBufferView *, const vmpa2t *, gint *, gint *);