summaryrefslogtreecommitdiff
path: root/src/format/symbol.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/symbol.c')
-rw-r--r--src/format/symbol.c106
1 files changed, 100 insertions, 6 deletions
diff --git a/src/format/symbol.c b/src/format/symbol.c
index 2cd4f87..5684928 100644
--- a/src/format/symbol.c
+++ b/src/format/symbol.c
@@ -30,9 +30,12 @@
#include "symbol-int.h"
-#include "../glibext/gbinarycursor.h"
+#include "../analysis/db/misc/rlestr.h"
+#include "../core/columns.h"
+#ifdef INCLUDE_GTK_SUPPORT
+# include "../glibext/gbinarycursor.h"
+#endif
#include "../glibext/linegen-int.h"
-#include "../gtkext/gtkblockdisplay.h"
@@ -65,12 +68,16 @@ static void g_binary_symbol_finalize(GBinSymbol *);
/* Indique le nombre de ligne prêtes à être générées. */
static size_t g_binary_symbol_count_lines(const GBinSymbol *);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Retrouve l'emplacement correspondant à une position donnée. */
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_contain_cursor(const GBinSymbol *, size_t, size_t, const GLineCursor *);
+#endif
+
/* Renseigne sur les propriétés liées à un générateur. */
static BufferLineFlags g_binary_symbol_get_line_flags(const GBinSymbol *, size_t, size_t);
@@ -176,8 +183,10 @@ 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;
+#ifdef INCLUDE_GTK_SUPPORT
iface->compute = (linegen_compute_fc)g_binary_symbol_compute_cursor;
iface->contain = (linegen_contain_fc)g_binary_symbol_contain_cursor;
+#endif
iface->get_flags = (linegen_get_flags_fc)g_binary_symbol_get_line_flags;
iface->print = (linegen_print_fc)g_binary_symbol_print;
@@ -783,6 +792,9 @@ static size_t g_binary_symbol_count_lines(const GBinSymbol *symbol)
}
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : symbol = générateur à consulter. *
@@ -850,6 +862,9 @@ static int g_binary_symbol_contain_cursor(const GBinSymbol *symbol, size_t index
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : symbol = générateur à consulter. *
@@ -940,8 +955,57 @@ static void g_binary_symbol_print(GBinSymbol *symbol, GBufferLine *line, size_t
static bool _g_binary_symbol_load(GBinSymbol *symbol, GObjectStorage *storage, packed_buffer_t *pbuf)
{
bool result; /* Bilan à retourner */
+ sym_extra_data_t *extra; /* Données insérées à consulter*/
+ uleb128_t value; /* Valeur ULEB128 à charger */
+ rle_string str; /* Chaîne à charger */
+
+ extra = GET_BIN_SYMBOL_EXTRA(symbol);
+
+ LOCK_GOBJECT_EXTRA(extra);
+
+ result = unpack_uleb128(&value, pbuf);
+
+ if (result)
+ extra->stype = value;
+
+ if (result)
+ {
+ result = unpack_uleb128(&value, pbuf);
+
+ if (result)
+ extra->status = value;
+
+ }
- result = true;
+ if (result)
+ result = extract_packed_buffer(pbuf, &extra->nm_prefix, 1, false);
+
+ if (result)
+ {
+ result = unpack_uleb128(&value, pbuf);
+
+ if (result)
+ extra->flags = value;
+
+ }
+
+ UNLOCK_GOBJECT_EXTRA(extra);
+
+ if (result)
+ result = unpack_mrange(&symbol->range, pbuf);
+
+ if (result)
+ {
+ setup_empty_rle_string(&str);
+
+ result = unpack_rle_string(&str, pbuf);
+
+ if (result && get_rle_string(&str) != NULL)
+ symbol->alt = strdup(get_rle_string(&str));
+
+ exit_rle_string(&str);
+
+ }
return result;
@@ -965,7 +1029,7 @@ static bool _g_binary_symbol_load(GBinSymbol *symbol, GObjectStorage *storage, p
static bool g_binary_symbol_load(GBinSymbol *symbol, GObjectStorage *storage, packed_buffer_t *pbuf)
{
bool result; /* Bilan à retourner */
- GBinSymbolClass *class; /* Classe à activer */
+ GBinSymbolClass *class; /* Classe à activer */
class = G_BIN_SYMBOL_GET_CLASS(symbol);
@@ -993,8 +1057,38 @@ static bool g_binary_symbol_load(GBinSymbol *symbol, GObjectStorage *storage, pa
static bool _g_binary_symbol_store(GBinSymbol *symbol, GObjectStorage *storage, packed_buffer_t *pbuf)
{
bool result; /* Bilan à retourner */
+ sym_extra_data_t *extra; /* Données insérées à consulter*/
+ rle_string str; /* Chaîne à conserver */
+
+ extra = GET_BIN_SYMBOL_EXTRA(symbol);
+
+ LOCK_GOBJECT_EXTRA(extra);
+
+ result = pack_uleb128((uleb128_t []){ extra->stype }, pbuf);
+
+ if (result)
+ result = pack_uleb128((uleb128_t []){ extra->status }, pbuf);
- result = true;
+ if (result)
+ result = extend_packed_buffer(pbuf, &extra->nm_prefix, 1, false);
+
+ if (result)
+ result = pack_uleb128((uleb128_t []){ extra->flags }, pbuf);
+
+ UNLOCK_GOBJECT_EXTRA(extra);
+
+ if (result)
+ result = pack_mrange(&symbol->range, pbuf);
+
+ if (result)
+ {
+ init_static_rle_string(&str, symbol->alt);
+
+ result = pack_rle_string(&str, pbuf);
+
+ exit_rle_string(&str);
+
+ }
return result;
@@ -1018,7 +1112,7 @@ static bool _g_binary_symbol_store(GBinSymbol *symbol, GObjectStorage *storage,
static bool g_binary_symbol_store(GBinSymbol *symbol, GObjectStorage *storage, packed_buffer_t *pbuf)
{
bool result; /* Bilan à retourner */
- GBinSymbolClass *class; /* Classe à activer */
+ GBinSymbolClass *class; /* Classe à activer */
class = G_BIN_SYMBOL_GET_CLASS(symbol);