summaryrefslogtreecommitdiff
path: root/src/format
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-07-14 11:48:54 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-07-14 11:48:54 (GMT)
commitbea3337108fa5b59b8f6fdbe016d5ed6a6300bc6 (patch)
tree517abf46e76b2a6cc8ddb3ac2dec5ffacc28a128 /src/format
parente0af5dc9c01a5b9649c68ec63109ba98b6843329 (diff)
Begun to switch to abstract locations in internal rendering buffers.
Diffstat (limited to 'src/format')
-rw-r--r--src/format/symbol.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/format/symbol.c b/src/format/symbol.c
index 3f8e808..9c8a6e0 100644
--- a/src/format/symbol.c
+++ b/src/format/symbol.c
@@ -30,6 +30,7 @@
#include "symbol-int.h"
+#include "../glibext/gbinarycursor.h"
#include "../glibext/linegen-int.h"
@@ -61,10 +62,10 @@ static void g_binary_symbol_finalize(GBinSymbol *);
static size_t g_binary_symbol_count_lines(const GBinSymbol *);
/* Retrouve l'emplacement correspondant à une position donnée. */
-static void g_binary_symbol_compute_addr(const GBinSymbol *, gint, vmpa2t *, size_t, size_t);
+static void g_binary_symbol_compute_cursor(const GBinSymbol *, gint, size_t, size_t, GLineCursor **);
/* Détermine si le conteneur s'inscrit dans une plage donnée. */
-static int g_binary_symbol_contains_addr(const GBinSymbol *, const vmpa2t *, size_t, size_t);
+static int g_binary_symbol_contains_cursor(const GBinSymbol *, size_t, size_t, const GLineCursor *);
/* Renseigne sur les propriétés liées à un générateur. */
static BufferLineFlags g_binary_symbol_get_flags(const GBinSymbol *, size_t, size_t);
@@ -144,8 +145,8 @@ static void g_binary_symbol_init(GBinSymbol *symbol)
static void g_binary_symbol_interface_init(GLineGeneratorInterface *iface)
{
iface->count = (linegen_count_lines_fc)g_binary_symbol_count_lines;
- iface->compute = (linegen_compute_fc)g_binary_symbol_compute_addr;
- iface->contains = (linegen_contains_fc)g_binary_symbol_contains_addr;
+ iface->compute = (linegen_compute_fc)g_binary_symbol_compute_cursor;
+ iface->contains = (linegen_contains_fc)g_binary_symbol_contains_cursor;
iface->get_flags = (linegen_get_flags_fc)g_binary_symbol_get_flags;
iface->print = (linegen_print_fc)g_binary_symbol_print;
@@ -503,9 +504,9 @@ static size_t g_binary_symbol_count_lines(const GBinSymbol *symbol)
* *
* Paramètres : symbol = générateur à consulter. *
* x = position géographique sur la ligne concernée. *
-* addr = position en mémoire à analyser. *
* index = indice de cette même ligne dans le tampon global. *
* repeat = indice d'utilisations successives du générateur. *
+* cursor = emplacement à constituer. [OUT] *
* *
* Description : Retrouve l'emplacement correspondant à une position donnée. *
* *
@@ -515,9 +516,11 @@ static size_t g_binary_symbol_count_lines(const GBinSymbol *symbol)
* *
******************************************************************************/
-void g_binary_symbol_compute_addr(const GBinSymbol *symbol, gint x, vmpa2t *addr, size_t index, size_t repeat)
+void g_binary_symbol_compute_cursor(const GBinSymbol *symbol, gint x, size_t index, size_t repeat, GLineCursor **cursor)
{
- copy_vmpa(addr, get_mrange_addr(&symbol->range));
+ *cursor = g_binary_cursor_new();
+
+ g_binary_cursor_update(G_BINARY_CURSOR(*cursor), get_mrange_addr(&symbol->range));
}
@@ -525,9 +528,9 @@ void g_binary_symbol_compute_addr(const GBinSymbol *symbol, gint x, vmpa2t *addr
/******************************************************************************
* *
* Paramètres : symbol = générateur à consulter. *
-* addr = position en mémoire à analyser. *
* index = indice de cette même ligne dans le tampon global. *
* repeat = indice d'utilisations successives du générateur. *
+* cursor = emplacement à analyser. *
* *
* Description : Détermine si le conteneur s'inscrit dans une plage donnée. *
* *
@@ -537,9 +540,14 @@ void g_binary_symbol_compute_addr(const GBinSymbol *symbol, gint x, vmpa2t *addr
* *
******************************************************************************/
-static int g_binary_symbol_contains_addr(const GBinSymbol *symbol, const vmpa2t *addr, size_t index, size_t repeat)
+static int g_binary_symbol_contains_cursor(const GBinSymbol *symbol, size_t index, size_t repeat, const GLineCursor *cursor)
{
int result; /* Conclusion à retourner */
+ vmpa2t addr; /* Autre emplacement à comparer*/
+
+ assert(G_IS_BINARY_CURSOR(cursor));
+
+ g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr);
/**
* En tant que générateur, le symbole ne couvre qu'une ou plusieurs lignes
@@ -552,7 +560,7 @@ static int g_binary_symbol_contains_addr(const GBinSymbol *symbol, const vmpa2t
*
*/
- result = cmp_vmpa(addr, get_mrange_addr(&symbol->range));
+ result = cmp_vmpa(&addr, get_mrange_addr(&symbol->range));
return result;