summaryrefslogtreecommitdiff
path: root/src/glibext
diff options
context:
space:
mode:
Diffstat (limited to 'src/glibext')
-rw-r--r--src/glibext/Makefile.am79
-rw-r--r--src/glibext/buffercache-int.h2
-rw-r--r--src/glibext/buffercache.c168
-rw-r--r--src/glibext/buffercache.h28
-rw-r--r--src/glibext/bufferline.c15
-rw-r--r--src/glibext/bufferline.h8
-rw-r--r--src/glibext/comparison-int.h58
-rw-r--r--src/glibext/comparison.c199
-rw-r--r--src/glibext/comparison.h80
-rw-r--r--src/glibext/configuration.c8
-rw-r--r--src/glibext/configuration.h23
-rw-r--r--src/glibext/delayed-int.h2
-rw-r--r--src/glibext/delayed.c10
-rw-r--r--src/glibext/delayed.h5
-rw-r--r--src/glibext/gbinarycursor.c105
-rw-r--r--src/glibext/gbinportion-int.h2
-rw-r--r--src/glibext/gbinportion.c113
-rw-r--r--src/glibext/gbinportion.h22
-rw-r--r--src/glibext/generators/Makefile.am20
-rw-r--r--src/glibext/generators/hex.c32
-rw-r--r--src/glibext/generators/prologue.c37
-rw-r--r--src/glibext/generators/rborder.c37
-rw-r--r--src/glibext/glinecursor-int.h2
-rw-r--r--src/glibext/glinecursor.h6
-rw-r--r--src/glibext/linecolumn.c20
-rw-r--r--src/glibext/linecolumn.h14
-rw-r--r--src/glibext/linesegment.c67
-rw-r--r--src/glibext/linesegment.h26
-rw-r--r--src/glibext/notifier.h74
-rw-r--r--src/glibext/seq.h2
-rw-r--r--src/glibext/umemslice-int.h71
-rw-r--r--src/glibext/umemslice.c423
-rw-r--r--src/glibext/umemslice.h80
-rw-r--r--src/glibext/widthtracker.c2
-rw-r--r--src/glibext/widthtracker.h3
35 files changed, 1691 insertions, 152 deletions
diff --git a/src/glibext/Makefile.am b/src/glibext/Makefile.am
index 6bcf4b8..986bbd1 100644
--- a/src/glibext/Makefile.am
+++ b/src/glibext/Makefile.am
@@ -3,53 +3,60 @@ BUILT_SOURCES = chrysamarshal.h chrysamarshal.c
noinst_LTLIBRARIES = libglibext.la
-libglibext_la_SOURCES = \
- buffercache-int.h \
- buffercache.h buffercache.c \
- bufferline.h bufferline.c \
- bufferview.h bufferview.c \
- chrysamarshal.h chrysamarshal.c \
- configuration-int.h \
- configuration.h configuration.c \
- delayed-int.h \
- delayed.h delayed.c \
- gbinarycursor.h gbinarycursor.c \
- gbinportion-int.h \
- gbinportion.h gbinportion.c \
- gdisplayoptions.h gdisplayoptions.c \
- glinecursor-int.h \
- glinecursor.h glinecursor.c \
- gloadedpanel-int.h \
- gloadedpanel.h gloadedpanel.c \
- gnhash.h gnhash.c \
- linecolumn.h linecolumn.c \
- linegen-int.h \
- linegen.h linegen.c \
- linesegment.h linesegment.c \
- named-int.h \
- named.h named.c \
- objhole.h \
- proto.h \
- seq.h seq.c \
- signal.h signal.c \
- singleton.h singleton.c \
+libglibext_la_SOURCES = \
+ buffercache-int.h \
+ buffercache.h buffercache.c \
+ bufferline.h bufferline.c \
+ chrysamarshal.h chrysamarshal.c \
+ comparison-int.h \
+ comparison.h comparison.c \
+ configuration-int.h \
+ configuration.h configuration.c \
+ delayed-int.h \
+ delayed.h delayed.c \
+ gbinarycursor.h gbinarycursor.c \
+ gbinportion-int.h \
+ gbinportion.h gbinportion.c \
+ gdisplayoptions.h gdisplayoptions.c \
+ glinecursor-int.h \
+ glinecursor.h glinecursor.c \
+ gnhash.h gnhash.c \
+ linecolumn.h linecolumn.c \
+ linegen-int.h \
+ linegen.h linegen.c \
+ notifier.h \
+ objhole.h \
+ proto.h \
+ seq.h seq.c \
+ signal.h signal.c \
+ singleton.h singleton.c \
+ linesegment.h linesegment.c \
+ umemslice-int.h \
+ umemslice.h umemslice.c
+
+if BUILD_GTK_SUPPORT
+
+libglibext_la_SOURCES += \
+ bufferview.h bufferview.c \
+ gloadedpanel-int.h \
+ gloadedpanel.h gloadedpanel.c \
+ named-int.h \
+ named.h named.c \
widthtracker.h widthtracker.c
+endif
+
+libglibext_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS)
+
libglibext_la_LIBADD = \
generators/libglibextgenerators.la
-libglibext_la_LDFLAGS =
-
devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%)
dev_HEADERS = $(libglibext_la_SOURCES:%c=)
-AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
-
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
-
SUBDIRS = generators
diff --git a/src/glibext/buffercache-int.h b/src/glibext/buffercache-int.h
index 36e4369..0e831a2 100644
--- a/src/glibext/buffercache-int.h
+++ b/src/glibext/buffercache-int.h
@@ -68,7 +68,9 @@ struct _GBufferCache
GBinContent *content; /* Contenu binaire global */
+#ifdef INCLUDE_GTK_SUPPORT
GWidthTracker *tracker; /* Suivi des largeurs */
+#endif
cache_info *lines; /* Liste des lignes intégrées */
size_t count; /* Quantité en cache */
diff --git a/src/glibext/buffercache.c b/src/glibext/buffercache.c
index fd2adc5..78c7479 100644
--- a/src/glibext/buffercache.c
+++ b/src/glibext/buffercache.c
@@ -59,9 +59,13 @@ static void get_cache_info_cursor(const cache_info *, size_t, gint, GLineCursor
/* Suivit les variations du compteur de références d'une ligne. */
static void on_line_ref_toggle(cache_info *, GBufferLine *, gboolean);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Fournit la ligne de tampon correspondant aux générateurs. */
static GBufferLine *get_cache_info_line(cache_info *, const GWidthTracker *, size_t, const GBinContent *);
+#endif
+
/* Force la réinitialisation d'une éventuelle ligne cachée. */
static void _reset_cache_info_line_unlocked(cache_info *);
@@ -367,6 +371,9 @@ static void on_line_ref_toggle(cache_info *info, GBufferLine *line, gboolean las
}
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : info = informations sur une ligne à venir manipuler. *
@@ -422,6 +429,9 @@ static GBufferLine *get_cache_info_line(cache_info *info, const GWidthTracker *t
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : info = informations sur une ligne à venir manipuler. *
@@ -547,7 +557,9 @@ static void g_buffer_cache_init(GBufferCache *cache)
cache->used = 0;
g_rw_lock_init(&cache->access);
+#ifdef INCLUDE_GTK_SUPPORT
cache->tracker = NULL;
+#endif
}
@@ -587,7 +599,9 @@ static void g_buffer_cache_dispose(GBufferCache *cache)
}
+#ifdef INCLUDE_GTK_SUPPORT
g_clear_object(&cache->tracker);
+#endif
G_OBJECT_CLASS(g_buffer_cache_parent_class)->dispose(G_OBJECT(cache));
@@ -656,7 +670,9 @@ GBufferCache *g_buffer_cache_new(GBinContent *content, size_t col_count, size_t
g_object_ref(G_OBJECT(content));
}
+#ifdef INCLUDE_GTK_SUPPORT
result->tracker = g_width_tracker_new(result, col_count, opt_count);
+#endif
return result;
@@ -758,6 +774,9 @@ gint g_buffer_cache_get_text_position(const GBufferCache *cache)
}
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : cache = composant GLib à consulter. *
@@ -783,6 +802,9 @@ GWidthTracker *g_buffer_cache_get_width_tracker(const GBufferCache *cache)
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : cache = cache de lignes à mettre à jour. *
@@ -905,7 +927,7 @@ static size_t g_buffer_cache_compute_repetition(GBufferCache *cache, size_t inde
void g_buffer_cache_insert_at(GBufferCache *cache, size_t index, GLineGenerator *generator, BufferLineFlags flags, bool before, bool after)
{
-#ifndef NDEBUG
+#if !defined(NDEBUG) && defined(INCLUDE_GTK_SUPPORT)
GLineCursor *gen_cursor; /* Position du générateur */
GLineCursor *line_cursor; /* Position de la ligne */
int ret; /* Bilan de comparaison */
@@ -919,7 +941,7 @@ void g_buffer_cache_insert_at(GBufferCache *cache, size_t index, GLineGenerator
assert(!(before && after));
-#ifndef NDEBUG
+#if !defined(NDEBUG) && defined(INCLUDE_GTK_SUPPORT)
if (!before && !after)
{
@@ -981,7 +1003,9 @@ void g_buffer_cache_insert_at(GBufferCache *cache, size_t index, GLineGenerator
cache->used += needed;
+#ifdef INCLUDE_GTK_SUPPORT
g_width_tracker_update_added(cache->tracker, index, needed);
+#endif
g_signal_emit_by_name(cache, "size-changed", true, index, needed);
@@ -991,7 +1015,9 @@ void g_buffer_cache_insert_at(GBufferCache *cache, size_t index, GLineGenerator
{
extend_cache_info(&cache->lines[index], generator, flags);
+#ifdef INCLUDE_GTK_SUPPORT
g_width_tracker_update(cache->tracker, index);
+#endif
if (needed > 1)
{
@@ -1005,7 +1031,9 @@ void g_buffer_cache_insert_at(GBufferCache *cache, size_t index, GLineGenerator
cache->used += needed - 1;
+#ifdef INCLUDE_GTK_SUPPORT
g_width_tracker_update_added(cache->tracker, index + 1, needed - 1);
+#endif
}
@@ -1051,7 +1079,9 @@ void g_buffer_cache_delete_at(GBufferCache *cache, size_t index)
cache->used--;
+#ifdef INCLUDE_GTK_SUPPORT
g_width_tracker_update_deleted(cache->tracker, index, index);
+#endif
g_signal_emit_by_name(cache, "size-changed", false, index, 1);
@@ -1170,7 +1200,9 @@ GLineGenerator *g_buffer_cache_delete_type_at(GBufferCache *cache, size_t index,
cache->used--;
+#ifdef INCLUDE_GTK_SUPPORT
g_width_tracker_update_deleted(cache->tracker, delete, delete);
+#endif
g_signal_emit_by_name(cache, "size-changed", false, delete, 1);
@@ -1235,7 +1267,9 @@ void g_buffer_cache_append(GBufferCache *cache, GLineGenerator *generator, Buffe
cache->used += count;
+#ifdef INCLUDE_GTK_SUPPORT
g_width_tracker_update_added(cache->tracker, index, count);
+#endif
g_signal_emit_by_name(cache, "size-changed", true, index, count);
@@ -1292,7 +1326,9 @@ void g_buffer_cache_extend_with(GBufferCache *cache, size_t count, GLineGenerato
if (added > 0)
{
+#ifdef INCLUDE_GTK_SUPPORT
g_width_tracker_update_added(cache->tracker, index, added);
+#endif
g_signal_emit_by_name(cache, "size-changed", true, index, added);
@@ -1349,7 +1385,9 @@ void g_buffer_cache_truncate(GBufferCache *cache, size_t max)
cache->used = max;
+#ifdef INCLUDE_GTK_SUPPORT
g_width_tracker_update_deleted(cache->tracker, max, max + removed - 1);
+#endif
g_signal_emit_by_name(cache, "size-changed", false, max, removed);
@@ -1358,6 +1396,9 @@ void g_buffer_cache_truncate(GBufferCache *cache, size_t max)
}
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : cache = tampon de lignes à venir consulter. *
@@ -1384,6 +1425,9 @@ void g_buffer_cache_get_line_cursor(GBufferCache *cache, size_t index, gint x, G
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : cache = tampon de lignes à venir consulter. *
@@ -1508,6 +1552,62 @@ void g_buffer_cache_remove_line_flag(GBufferCache *cache, size_t index, BufferLi
/******************************************************************************
* *
+* Paramètres : cache = tampon de lignes à consulter. *
+* start = point de départ du parcours. *
+* flag = propriétés à retrouver si possible. *
+* *
+* Description : Avance autant que possible vers une ligne idéale. *
+* *
+* Retour : Indice de la ligne recherchée, si elle existe. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+size_t g_buffer_cache_look_for_flag(GBufferCache *cache, size_t start, BufferLineFlags flag)
+{
+ size_t result; /* Indice de ligne à retourner */
+ GLineCursor *init; /* Localisation de départ */
+ size_t i; /* Boucle de parcours */
+ GLineCursor *next; /* Localisation suivante */
+ int ret; /* Bilan de comparaison */
+
+ assert(!g_rw_lock_writer_trylock(&cache->access));
+
+ assert(start < cache->used);
+
+ result = start;
+
+ get_cache_info_cursor(&cache->lines[start], start, 0, &init);
+
+ for (i = start + 1; i < cache->used; i++)
+ {
+ get_cache_info_cursor(&cache->lines[i], i, 0, &next);
+
+ ret = g_line_cursor_compare(init, next);
+
+ g_object_unref(G_OBJECT(next));
+
+ if (ret != 0)
+ break;
+
+ if ((g_buffer_cache_get_line_flags(cache, i) & flag) != 0)
+ {
+ result = i;
+ break;
+ }
+
+ }
+
+ g_object_unref(G_OBJECT(init));
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : cache = tampon de lignes à venir consulter. *
* index = indice de la ligne visée par l'opération. *
* *
@@ -1536,6 +1636,9 @@ void g_buffer_cache_refresh_line(GBufferCache *cache, size_t index)
}
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : cache = tampon de lignes à consulter. *
@@ -1659,6 +1762,9 @@ void g_buffer_cache_draw(const GBufferCache *cache, cairo_t *cr, size_t first, s
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : cache = tampon de lignes à consulter. *
@@ -1766,60 +1872,7 @@ size_t g_buffer_cache_find_index_by_cursor(GBufferCache *cache, const GLineCurso
}
-/******************************************************************************
-* *
-* Paramètres : cache = tampon de lignes à consulter. *
-* start = point de départ du parcours. *
-* flag = propriétés à retrouver si possible. *
-* *
-* Description : Avance autant que possible vers une ligne idéale. *
-* *
-* Retour : Indice de la ligne recherchée, si elle existe. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-size_t g_buffer_cache_look_for_flag(GBufferCache *cache, size_t start, BufferLineFlags flag)
-{
- size_t result; /* Indice de ligne à retourner */
- GLineCursor *init; /* Localisation de départ */
- size_t i; /* Boucle de parcours */
- GLineCursor *next; /* Localisation suivante */
- int ret; /* Bilan de comparaison */
-
- assert(!g_rw_lock_writer_trylock(&cache->access));
-
- assert(start < cache->used);
-
- result = start;
-
- get_cache_info_cursor(&cache->lines[start], start, 0, &init);
-
- for (i = start + 1; i < cache->used; i++)
- {
- get_cache_info_cursor(&cache->lines[i], i, 0, &next);
-
- ret = g_line_cursor_compare(init, next);
-
- g_object_unref(G_OBJECT(next));
-
- if (ret != 0)
- break;
-
- if ((g_buffer_cache_get_line_flags(cache, i) & flag) != 0)
- {
- result = i;
- break;
- }
-
- }
-
- g_object_unref(G_OBJECT(init));
-
- return result;
-
-}
+#ifdef INCLUDE_GTK_SUPPORT
/******************************************************************************
@@ -1888,3 +1941,6 @@ bool g_buffer_cache_get_cursor_coordinates(GBufferCache *cache, const GLineCurso
return result;
}
+
+
+#endif
diff --git a/src/glibext/buffercache.h b/src/glibext/buffercache.h
index e657fff..68941c5 100644
--- a/src/glibext/buffercache.h
+++ b/src/glibext/buffercache.h
@@ -27,12 +27,16 @@
#include <glib-object.h>
#include <stdbool.h>
-#include <gdk/gdk.h>
+#ifdef INCLUDE_GTK_SUPPORT
+# include <gdk/gdk.h>
+#endif
#include "gdisplayoptions.h"
#include "linegen.h"
-#include "widthtracker.h"
+#ifdef INCLUDE_GTK_SUPPORT
+# include "widthtracker.h"
+#endif
@@ -72,9 +76,13 @@ gint g_buffer_cache_get_left_margin(const GBufferCache *);
/* Fournit la position de départ pour l'impression de texte. */
gint g_buffer_cache_get_text_position(const GBufferCache *);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Fournit un lien vers la structure de suivi de largeurs. */
GWidthTracker *g_buffer_cache_get_width_tracker(const GBufferCache *);
+#endif
+
/* Met à disposition un encadrement des accès aux lignes. */
void g_buffer_cache_lock_unlock(GBufferCache *, bool, bool);
@@ -107,9 +115,13 @@ void g_buffer_cache_extend_with(GBufferCache *, size_t, GLineGenerator *);
/* Réduit le tampon à une quantité de lignes précise. */
void g_buffer_cache_truncate(GBufferCache *, size_t);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Retrouve l'emplacement correspondant à une position de ligne. */
void g_buffer_cache_get_line_cursor(GBufferCache *, size_t, gint, GLineCursor **);
+#endif
+
/* Ajoute une propriété particulière à une ligne. */
void g_buffer_cache_add_line_flag(GBufferCache *, size_t, BufferLineFlags);
@@ -119,9 +131,14 @@ BufferLineFlags g_buffer_cache_get_line_flags(GBufferCache *, size_t);
/* Retire une propriété particulière attachée à une ligne. */
void g_buffer_cache_remove_line_flag(GBufferCache *, size_t, BufferLineFlags);
+/* Avance autant que possible vers une ligne idéale. */
+size_t g_buffer_cache_look_for_flag(GBufferCache *, size_t, BufferLineFlags);
+
/* Force la mise à jour du contenu d'une ligne donnée. */
void g_buffer_cache_refresh_line(GBufferCache *, size_t);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Retrouve une ligne au sein d'un tampon avec un indice. */
GBufferLine *g_buffer_cache_find_line_by_index(GBufferCache *, size_t);
@@ -131,18 +148,21 @@ void g_buffer_cache_collect_widths(GBufferCache *, size_t, size_t, size_t, gint
/* Imprime une partie choisie du tampon contenant des lignes. */
void g_buffer_cache_draw(const GBufferCache *, cairo_t *, size_t, size_t, const cairo_rectangle_int_t *, const GDisplayOptions *, const gint *, const segcnt_list *);
+#endif
+
/* Indique l'indice correspondant à une adresse donnée. */
size_t _g_buffer_cache_find_index_by_cursor(GBufferCache *, const GLineCursor *, bool, size_t, size_t);
/* Indique l'indice correspondant à une adresse donnée. */
size_t g_buffer_cache_find_index_by_cursor(GBufferCache *, const GLineCursor *, bool);
-/* Avance autant que possible vers une ligne idéale. */
-size_t g_buffer_cache_look_for_flag(GBufferCache *, size_t, BufferLineFlags);
+#ifdef INCLUDE_GTK_SUPPORT
/* Indique la position d'affichage d'une adresse donnée. */
bool g_buffer_cache_get_cursor_coordinates(GBufferCache *, const GLineCursor *, size_t, size_t, bool, gint *, gint *);
+#endif
+
#endif /* _GLIBEXT_BUFFERCACHE_H */
diff --git a/src/glibext/bufferline.c b/src/glibext/bufferline.c
index 85fe027..2bdfebc 100644
--- a/src/glibext/bufferline.c
+++ b/src/glibext/bufferline.c
@@ -33,7 +33,6 @@
#include "linecolumn.h"
#include "../common/extstr.h"
#include "../core/paths.h"
-#include "../gtkext/gtkblockdisplay.h"
@@ -70,8 +69,10 @@ struct _GBufferLineClass
{
GObjectClass parent; /* A laisser en premier */
+#ifdef INCLUDE_GTK_SUPPORT
cairo_surface_t *entrypoint_img; /* Image pour les entrées */
cairo_surface_t *bookmark_img; /* Image pour les signets */
+#endif
/* Signaux */
@@ -121,13 +122,17 @@ G_DEFINE_TYPE(GBufferLine, g_buffer_line, G_TYPE_OBJECT);
static void g_buffer_line_class_init(GBufferLineClass *class)
{
GObjectClass *object; /* Autre version de la classe */
+#ifdef INCLUDE_GTK_SUPPORT
gchar *filename; /* Chemin d'accès à utiliser */
+#endif
object = G_OBJECT_CLASS(class);
object->dispose = (GObjectFinalizeFunc/* ! */)g_buffer_line_dispose;
object->finalize = (GObjectFinalizeFunc)g_buffer_line_finalize;
+#ifdef INCLUDE_GTK_SUPPORT
+
filename = find_pixmap_file("entrypoint.png");
assert(filename != NULL);
@@ -142,6 +147,8 @@ static void g_buffer_line_class_init(GBufferLineClass *class)
g_free(filename);
+#endif
+
g_signal_new("content-changed",
G_TYPE_BUFFER_LINE,
G_SIGNAL_RUN_LAST,
@@ -885,6 +892,9 @@ void g_buffer_line_export(GBufferLine *line, buffer_export_context *ctx, BufferE
/* ---------------------------------------------------------------------------------- */
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : line = ligne à venir consulter. *
@@ -1479,3 +1489,6 @@ void g_buffer_line_draw(GBufferLine *line, size_t index, cairo_t *cairo, gint x_
}
}
+
+
+#endif
diff --git a/src/glibext/bufferline.h b/src/glibext/bufferline.h
index 791fd5d..f5f25d0 100644
--- a/src/glibext/bufferline.h
+++ b/src/glibext/bufferline.h
@@ -31,7 +31,9 @@
#include "gdisplayoptions.h"
#include "linesegment.h"
-#include "widthtracker.h"
+#ifdef INCLUDE_GTK_SUPPORT
+# include "widthtracker.h"
+#endif
#include "../analysis/content.h"
#include "../arch/vmpa.h"
@@ -139,6 +141,8 @@ typedef struct _col_coord_t
} col_coord_t;
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Fait remonter les largeurs requises par une ligne donnée. */
void g_buffer_line_collect_widths(const GBufferLine *, size_t, size_t, gint *, gint *);
@@ -160,6 +164,8 @@ bool g_buffer_line_find_near_coord(const GBufferLine *, size_t, col_coord_t *, G
/* Imprime la ligne de texte représentée. */
void g_buffer_line_draw(GBufferLine *, size_t, cairo_t *, gint, gint, GWidthTracker *, const GDisplayOptions *, const segcnt_list *);
+#endif
+
#endif /* _GLIBEXT_BUFFERLINE_H */
diff --git a/src/glibext/comparison-int.h b/src/glibext/comparison-int.h
new file mode 100644
index 0000000..446f25d
--- /dev/null
+++ b/src/glibext/comparison-int.h
@@ -0,0 +1,58 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * comparison-int.h - définitions internes propres aux opérations de comparaison d'objets
+ *
+ * Copyright (C) 2022 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide 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.
+ *
+ * Chrysalide 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _GLIBEXT_COMPARISON_INT_H
+#define _GLIBEXT_COMPARISON_INT_H
+
+
+#include "comparison.h"
+
+
+
+/* Réalise une comparaison entre objets selon un critère précis. */
+typedef bool (* compare_rich_fc) (const GComparableItem *, const GComparableItem *, RichCmpOperation, bool *);
+
+
+/* Instance d'élément comparable (interface) */
+struct _GComparableItemIface
+{
+ GTypeInterface base_iface; /* A laisser en premier */
+
+ compare_rich_fc cmp_rich; /* Comparaison de façon précise*/
+
+};
+
+
+/* Redéfinition */
+typedef GComparableItemIface GComparableItemInterface;
+
+
+/* Réalise une comparaison riche entre valeurs entière. */
+bool compare_rich_integer_values_signed(long long, long long, RichCmpOperation);
+
+/* Réalise une comparaison riche entre valeurs entière. */
+bool compare_rich_integer_values_unsigned(unsigned long long, unsigned long long, RichCmpOperation);
+
+
+
+#endif /* _GLIBEXT_COMPARISON_INT_H */
diff --git a/src/glibext/comparison.c b/src/glibext/comparison.c
new file mode 100644
index 0000000..8ce6941
--- /dev/null
+++ b/src/glibext/comparison.c
@@ -0,0 +1,199 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * comparison.c - opérations de comparaison d'objets
+ *
+ * Copyright (C) 2022 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide 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.
+ *
+ * Chrysalide 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/>.
+ */
+
+
+#include "comparison.h"
+
+
+#include <assert.h>
+
+
+#include "comparison-int.h"
+
+
+
+/* Procède à l'initialisation de l'interface de comparaison. */
+static void g_comparable_item_default_init(GComparableItemInterface *);
+
+
+
+/* Détermine le type d'une interface pour un objet comparable. */
+G_DEFINE_INTERFACE(GComparableItem, g_comparable_item, G_TYPE_OBJECT)
+
+
+/******************************************************************************
+* *
+* Paramètres : iface = interface GLib à initialiser. *
+* *
+* Description : Procède à l'initialisation de l'interface de comparaison. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_comparable_item_default_init(GComparableItemInterface *iface)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : item = premier objet à consulter pour une comparaison. *
+* other = second objet à consulter pour une comparaison. *
+* op = opération de comparaison à réaliser. *
+* status = bilan des opérations de comparaison. [OUT] *
+* *
+* Description : Réalise une comparaison entre objets selon un critère précis.*
+* *
+* Retour : true si la comparaison a pu être effectuée, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_comparable_item_compare_rich(const GComparableItem *item, const GComparableItem *other, RichCmpOperation op, bool *status)
+{
+ bool result; /* Etat à retourner */
+ GComparableItemIface *iface; /* Interface utilisée */
+
+ iface = G_COMPARABLE_ITEM_GET_IFACE(item);
+
+ result = iface->cmp_rich(item, other, op, status);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : a = premier élément à consulter pour une comparaison. *
+* b = second objet à consulter pour une comparaison. *
+* op = opération de comparaison à réaliser. *
+* *
+* Description : Réalise une comparaison riche entre valeurs entière. *
+* *
+* Retour : Bilan des opérations de comparaison. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool compare_rich_integer_values_signed(long long a, long long b, RichCmpOperation op)
+{
+ bool result; /* Bilan à retourner */
+
+ switch (op)
+ {
+ case RCO_LT:
+ result = (a < b);
+ break;
+
+ case RCO_LE:
+ result = (a <= b);
+ break;
+
+ case RCO_EQ:
+ result = (a == b);
+ break;
+
+ case RCO_NE:
+ result = (a != b);
+ break;
+
+ case RCO_GT:
+ result = (a > b);
+ break;
+
+ case RCO_GE:
+ result = (a >= b);
+ break;
+
+ default:
+ assert(false);
+ result = false;
+ break;
+
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : a = premier élément à consulter pour une comparaison. *
+* b = second objet à consulter pour une comparaison. *
+* op = opération de comparaison à réaliser. *
+* *
+* Description : Réalise une comparaison riche entre valeurs entière. *
+* *
+* Retour : Bilan des opérations de comparaison. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool compare_rich_integer_values_unsigned(unsigned long long a, unsigned long long b, RichCmpOperation op)
+{
+ bool result; /* Bilan à retourner */
+
+ switch (op)
+ {
+ case RCO_LT:
+ result = (a < b);
+ break;
+
+ case RCO_LE:
+ result = (a <= b);
+ break;
+
+ case RCO_EQ:
+ result = (a == b);
+ break;
+
+ case RCO_NE:
+ result = (a != b);
+ break;
+
+ case RCO_GT:
+ result = (a > b);
+ break;
+
+ case RCO_GE:
+ result = (a >= b);
+ break;
+
+ default:
+ assert(false);
+ result = false;
+ break;
+
+ }
+
+ return result;
+
+}
diff --git a/src/glibext/comparison.h b/src/glibext/comparison.h
new file mode 100644
index 0000000..8d43210
--- /dev/null
+++ b/src/glibext/comparison.h
@@ -0,0 +1,80 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * comparison.h - prototypes pour les opérations de comparaison d'objets
+ *
+ * Copyright (C) 2022 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide 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.
+ *
+ * Chrysalide 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_COMPARISON_H
+#define _GLIBEXT_COMPARISON_H
+
+
+#include <glib-object.h>
+#include <stdbool.h>
+
+
+
+#define G_TYPE_COMPARABLE_ITEM (g_comparable_item_get_type())
+#define G_COMPARABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_COMPARABLE_ITEM, GComparableItem))
+#define G_COMPARABLE_ITEM_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST((vtable), G_TYPE_COMPARABLE_ITEM, GComparableItemIface))
+#define G_IS_COMPARABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_COMPARABLE_ITEM))
+#define G_IS_COMPARABLE_ITEM_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE((vtable), G_TYPE_COMPARABLE_ITEM))
+#define G_COMPARABLE_ITEM_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), G_TYPE_COMPARABLE_ITEM, GComparableItemIface))
+
+
+/* Instance d'élément comparable (coquille vide) */
+typedef struct _GComparableItem GComparableItem;
+
+/* Instance d'élément comparable (interface) */
+typedef struct _GComparableItemIface GComparableItemIface;
+
+
+/* Modes de comparaison */
+typedef enum _RichCmpOperation
+{
+ RCO_LT, /* Equivalent de '<' */
+ RCO_LE, /* Equivalent de '<=' */
+ RCO_EQ, /* Equivalent de '==' */
+ RCO_NE, /* Equivalent de '!=' */
+ RCO_GT, /* Equivalent de '>' */
+ RCO_GE, /* Equivalent de '>°' */
+
+} RichCmpOperation;
+
+/* Détermination d'un besoin de comparaison supplémentaire */
+#define STATUS_NOT_EQUAL(_s, _o) \
+ ({ \
+ bool __result; \
+ if (_o == RCO_LE || _o == RCO_EQ || _o == RCO_GE) \
+ __result = !_s; \
+ else \
+ __result = _s; \
+ __result; \
+ })
+
+
+/* Détermine le type d'une interface pour un objet comparable. */
+GType g_comparable_item_get_type(void) G_GNUC_CONST;
+
+/* Réalise une comparaison entre objets selon un critère précis. */
+bool g_comparable_item_compare_rich(const GComparableItem *, const GComparableItem *, RichCmpOperation, bool *);
+
+
+
+#endif /* _GLIBEXT_COMPARISON_H */
diff --git a/src/glibext/configuration.c b/src/glibext/configuration.c
index 5bc94a7..ce7fac8 100644
--- a/src/glibext/configuration.c
+++ b/src/glibext/configuration.c
@@ -1224,13 +1224,9 @@ static void g_generic_config_init(GGenConfig *config)
static void g_generic_config_dispose(GGenConfig *config)
{
- g_list_free_full(config->groups, g_object_unref);
+ g_clear_list(&config->groups, g_object_unref);
- config->groups = NULL;
-
- g_list_free_full(config->params, g_object_unref);
-
- config->params = NULL;
+ g_clear_list(&config->params, g_object_unref);
G_OBJECT_CLASS(g_generic_config_parent_class)->dispose(G_OBJECT(config));
diff --git a/src/glibext/configuration.h b/src/glibext/configuration.h
index aac6dc7..05dbc65 100644
--- a/src/glibext/configuration.h
+++ b/src/glibext/configuration.h
@@ -27,7 +27,28 @@
#include <glib-object.h>
#include <stdbool.h>
-#include <gdk/gdk.h>
+#ifdef INCLUDE_GTK_SUPPORT
+# include <gdk/gdk.h>
+#endif
+
+
+#if !defined(INCLUDE_GTK_SUPPORT) && !defined(HOMEMADE_RGBA)
+
+# define HOMEMADE_RGBA
+
+/**
+ * Copie depuis /usr/include/gtk-3.0/gdk/gdkrgba.h
+ */
+typedef struct _GdkRGBA
+{
+ gdouble red;
+ gdouble green;
+ gdouble blue;
+ gdouble alpha;
+
+} GdkRGBA;
+
+#endif
diff --git a/src/glibext/delayed-int.h b/src/glibext/delayed-int.h
index dd780d0..4f84e86 100644
--- a/src/glibext/delayed-int.h
+++ b/src/glibext/delayed-int.h
@@ -28,8 +28,8 @@
#include "delayed.h"
+#include "notifier.h"
#include "../common/dllist.h"
-#include "../gtkext/gtkstatusstack.h"
diff --git a/src/glibext/delayed.c b/src/glibext/delayed.c
index ec4063d..6b5ac35 100644
--- a/src/glibext/delayed.c
+++ b/src/glibext/delayed.c
@@ -33,7 +33,9 @@
#include "delayed-int.h"
#include "../core/nproc.h"
-#include "../gui/core/global.h"
+#ifdef INCLUDE_GTK_SUPPORT
+# include "../gui/core/global.h"
+#endif
@@ -612,7 +614,11 @@ static void *g_work_group_process(GWorkGroup *group)
g_mutex_unlock(&group->mutex);
+#ifdef INCLUDE_GTK_SUPPORT
status = get_global_status();
+#else
+ status = NULL;
+#endif
g_delayed_work_process(work, status);
g_object_unref(G_OBJECT(work));
@@ -879,7 +885,7 @@ static void g_work_queue_dispose(GWorkQueue *queue)
g_mutex_lock(&queue->mutex);
for (i = 0; i < queue->groups_count; i++)
- g_object_unref(G_OBJECT(queue->groups[i]));
+ g_clear_object(&queue->groups[i]);
g_mutex_unlock(&queue->mutex);
diff --git a/src/glibext/delayed.h b/src/glibext/delayed.h
index 0fc7e7a..89eed12 100644
--- a/src/glibext/delayed.h
+++ b/src/glibext/delayed.h
@@ -31,11 +31,6 @@
-/* Abstration d'une gestion de barre de statut (instance) */
-typedef struct _GtkStatusStack GtkStatusStack;
-
-
-
/* -------------------------- TACHE DIFFEREE DANS LE TEMPS -------------------------- */
diff --git a/src/glibext/gbinarycursor.c b/src/glibext/gbinarycursor.c
index 5308fdf..d62abfb 100644
--- a/src/glibext/gbinarycursor.c
+++ b/src/glibext/gbinarycursor.c
@@ -25,9 +25,15 @@
#include <assert.h>
+#include <malloc.h>
+
+
+#include <i18n.h>
#include "glinecursor-int.h"
+#include "../analysis/binary.h"
+#include "../common/extstr.h"
@@ -76,6 +82,11 @@ static bool g_binary_cursor_is_valid(const GBinaryCursor *);
/* Construit une étiquette de représentation d'un suivi. */
static char *g_binary_cursor_build_label(const GBinaryCursor *);
+/* Extrait des détails complémentaires et actualise le statut. */
+#ifdef INCLUDE_GTK_SUPPORT
+static void prepare_and_show_status_from_binary_cursor(const mrange_t *, const char *, const GLoadedBinary *, GtkStatusStack *);
+#endif
+
/* Affiche une position dans une barre de statut. */
static void g_binary_cursor_show_status(const GBinaryCursor *, GtkStatusStack *, GLoadedContent *);
@@ -333,6 +344,93 @@ static char *g_binary_cursor_build_label(const GBinaryCursor *cursor)
/******************************************************************************
* *
+* Paramètres : range = emplacement à mettre en valeur. *
+* encoding = encodage d'une éventuelle instruction ou NULL. *
+* binary = binaire chargé rassemblant l'ensemble des infos. *
+* stack = barre de statut à actualiser. *
+* *
+* Description : Extrait des détails complémentaires et actualise le statut. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+#ifdef INCLUDE_GTK_SUPPORT
+static void prepare_and_show_status_from_binary_cursor(const mrange_t *range, const char *encoding, const GLoadedBinary *binary, GtkStatusStack *stack)
+{
+ GExeFormat *format; /* Format de binaire à traiter */
+ const vmpa2t *addr; /* Localisation de départ */
+ GBinPortion *portions; /* Couche première de portions */
+ GBinPortion *portion; /* Zone mémoire d'appartenance */
+ const char *text; /* Texte au contenu à copier */
+ const char *segment; /* Désignation d'un segment */
+ GBinSymbol *symbol; /* Symbole présent à l'adresse */
+ phys_t diff; /* Décalage de l'adresse */
+ char *label; /* Description d'un symbole */
+ vmpa2t tmp; /* Zone de construction temp. */
+ VMPA_BUFFER(offset); /* Décalage physique */
+ char *sym_name; /* Position selon un symbole */
+
+ /* Préparations utiles */
+
+ format = g_loaded_binary_get_format(binary);
+
+ addr = get_mrange_addr(range);
+
+ /* Zone d'appartenance */
+
+ portions = g_exe_format_get_portions(format);
+
+ portion = g_binary_portion_find_at_addr(portions, addr);
+
+ text = g_binary_portion_get_desc(portion);
+
+ segment = (text != NULL ? text : _("Binary"));
+
+ g_object_unref(G_OBJECT(portion));
+
+ g_object_unref(G_OBJECT(portions));
+
+ /* Symbole concerné */
+
+ sym_name = NULL;
+
+ if (g_binary_format_resolve_symbol(G_BIN_FORMAT(format), addr, false, &symbol, &diff))
+ {
+ label = g_binary_symbol_get_label(symbol);
+
+ if (label != NULL)
+ {
+ sym_name = label;
+
+ sym_name = stradd(sym_name, "+");
+
+ init_vmpa(&tmp, diff, VMPA_NO_VIRTUAL);
+ vmpa2_phys_to_string(&tmp, MDS_UNDEFINED, offset, NULL);
+
+ sym_name = stradd(sym_name, offset);
+
+ }
+
+ g_object_unref(G_OBJECT(symbol));
+
+ }
+
+ /* Demande d'affichage final */
+
+ gtk_status_stack_update_current_location(stack, range, segment, sym_name, encoding);
+
+ if (sym_name != NULL)
+ free(sym_name);
+
+}
+#endif
+
+
+/******************************************************************************
+* *
* Paramètres : cursor = emplacement du curseur à afficher. *
* stack = pile de statuts à mettre à jour. *
* content = contenu contenant le curseur à représenter. *
@@ -347,6 +445,7 @@ static char *g_binary_cursor_build_label(const GBinaryCursor *cursor)
static void g_binary_cursor_show_status(const GBinaryCursor *cursor, GtkStatusStack *stack, GLoadedContent *content)
{
+#ifdef INCLUDE_GTK_SUPPORT
GLoadedBinary *binary; /* Binaire chargé et analysé */
GArchProcessor *proc; /* Architecture du binaire */
mrange_t tmp; /* Emplacement réduit */
@@ -364,7 +463,7 @@ static void g_binary_cursor_show_status(const GBinaryCursor *cursor, GtkStatusSt
{
init_mrange(&tmp, &cursor->addr, VMPA_NO_PHYSICAL);
- gtk_status_stack_update_current_location(stack, binary, &tmp, NULL);
+ prepare_and_show_status_from_binary_cursor(&tmp, NULL, binary, stack);
}
@@ -378,7 +477,7 @@ static void g_binary_cursor_show_status(const GBinaryCursor *cursor, GtkStatusSt
range = g_arch_instruction_get_range(instr);
encoding = g_arch_instruction_get_encoding(instr);
- gtk_status_stack_update_current_location(stack, binary, range, encoding);
+ prepare_and_show_status_from_binary_cursor(range, encoding, binary, stack);
g_object_unref(G_OBJECT(instr));
@@ -390,7 +489,7 @@ static void g_binary_cursor_show_status(const GBinaryCursor *cursor, GtkStatusSt
else
gtk_status_stack_reset_current_location(stack);
-
+#endif
}
diff --git a/src/glibext/gbinportion-int.h b/src/glibext/gbinportion-int.h
index b5c70c8..a29f53c 100644
--- a/src/glibext/gbinportion-int.h
+++ b/src/glibext/gbinportion-int.h
@@ -36,7 +36,9 @@ struct _GBinPortion
char *code; /* Code de la couleur de fond */
+#ifdef INCLUDE_GTK_SUPPORT
cairo_surface_t *icon; /* Image de représentation */
+#endif
char *desc; /* Désignation humaine */
char **text; /* Lignes brutes à représenter */
diff --git a/src/glibext/gbinportion.c b/src/glibext/gbinportion.c
index 884c31d..12e12fb 100644
--- a/src/glibext/gbinportion.c
+++ b/src/glibext/gbinportion.c
@@ -38,9 +38,9 @@
#include "../analysis/human/asm/lang.h"
#include "../common/extstr.h"
#include "../common/sort.h"
+#include "../core/columns.h"
#include "../glibext/gbinarycursor.h"
#include "../glibext/linegen-int.h"
-#include "../gtkext/gtkblockdisplay.h"
@@ -62,9 +62,13 @@ static void g_binary_portion_dispose(GBinPortion *);
/* Procède à la libération totale de la mémoire. */
static void g_binary_portion_finalize(GBinPortion *);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Détermine l'aire d'une sous-portion. */
static bool g_binary_portion_compute_sub_area(const GBinPortion *, phys_t, const GdkRectangle *, GdkRectangle *);
+#endif
+
/* ------------------------ OFFRE DE CAPACITES DE GENERATION ------------------------ */
@@ -73,12 +77,16 @@ static bool g_binary_portion_compute_sub_area(const GBinPortion *, phys_t, const
/* Indique le nombre de ligne prêtes à être générées. */
static size_t g_binary_portion_count_lines(const GBinPortion *);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Retrouve l'emplacement correspondant à une position donnée. */
static void g_binary_portion_compute_cursor(const GBinPortion *, gint, size_t, size_t, GLineCursor **);
/* Détermine si le conteneur s'inscrit dans une plage donnée. */
static int g_binary_portion_contain_cursor(const GBinPortion *, size_t, size_t, const GLineCursor *);
+#endif
+
/* Renseigne sur les propriétés liées à un générateur. */
static BufferLineFlags g_binary_portion_get_flags(const GBinPortion *, size_t, size_t);
@@ -93,12 +101,19 @@ static void g_binary_portion_print(GBinPortion *, GBufferLine *, size_t, size_t,
/* Détermine si une portion contient une adresse donnée. */
static bool g_binary_portion_contains_vmpa(const GBinPortion *, const vmpa2t *);
+#ifdef INCLUDE_GTK_SUPPORT
+
+/* Recherche la portion présente à une adresse donnée. */
+static GBinPortion *g_binary_portion_find_with_area_at_addr(GBinPortion *, const vmpa2t *, GdkRectangle *);
+
/* Détermine si une portion contient une position donnée. */
static bool g_binary_portion_contains_physical(const GBinPortion *, phys_t);
/* Détermine si une portion contient une adresse donnée. */
static bool g_binary_portion_contains_virtual(const GBinPortion *, virt_t);
+#endif
+
/* ---------------------------------------------------------------------------------- */
@@ -154,6 +169,10 @@ static void g_binary_portion_init(GBinPortion *portion)
portion->code = NULL;
+#ifdef INCLUDE_GTK_SUPPORT
+ portion->icon = NULL;
+#endif
+
portion->desc = NULL;
portion->text = NULL;
portion->lcount = 0;
@@ -181,8 +200,10 @@ static void g_binary_portion_init(GBinPortion *portion)
static void g_binary_portion_interface_init(GLineGeneratorInterface *iface)
{
iface->count = (linegen_count_lines_fc)g_binary_portion_count_lines;
+#ifdef INCLUDE_GTK_SUPPORT
iface->compute = (linegen_compute_fc)g_binary_portion_compute_cursor;
iface->contain = (linegen_contain_fc)g_binary_portion_contain_cursor;
+#endif
iface->get_flags = (linegen_get_flags_fc)g_binary_portion_get_flags;
iface->print = (linegen_print_fc)g_binary_portion_print;
@@ -232,8 +253,10 @@ static void g_binary_portion_finalize(GBinPortion *portion)
if (portion->code != NULL)
free(portion->code);
+#ifdef INCLUDE_GTK_SUPPORT
if (portion->icon != NULL)
cairo_surface_destroy(portion->icon);
+#endif
if (portion->desc != NULL)
free(portion->desc);
@@ -310,6 +333,9 @@ int g_binary_portion_compare(const GBinPortion **a, const GBinPortion **b)
}
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : portion = description de partie à mettre à jour. *
@@ -360,6 +386,9 @@ cairo_surface_t *g_binary_portion_get_icon(const GBinPortion *portion)
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : portion = description de partie à mettre à jour. *
@@ -588,6 +617,9 @@ PortionAccessRights g_binary_portion_get_rights(const GBinPortion *portion)
}
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : portion = description de partie à mettre à jour. *
@@ -669,6 +701,9 @@ void g_binary_portion_query_tooltip(GBinPortion *portion, GtkTooltip *tooltip)
}
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : portion = portion mère à consulter. *
@@ -707,6 +742,9 @@ static bool g_binary_portion_compute_sub_area(const GBinPortion *portion, phys_t
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : portion = description de partie à consulter. *
@@ -762,6 +800,9 @@ void g_binary_portion_draw(const GBinPortion *portion, GtkStyleContext *context,
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : portion = portion principale à compléter. *
@@ -1025,6 +1066,9 @@ static size_t g_binary_portion_count_lines(const GBinPortion *portion)
}
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : portion = générateur à consulter. *
@@ -1081,6 +1125,9 @@ static int g_binary_portion_contain_cursor(const GBinPortion *portion, size_t in
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : portion = générateur à consulter. *
@@ -1143,6 +1190,9 @@ static void g_binary_portion_print(GBinPortion *portion, GBufferLine *line, size
/* ---------------------------------------------------------------------------------- */
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : portion = couche de portions à parcourir pour les recherches.*
@@ -1237,6 +1287,9 @@ GBinPortion *g_binary_portion_find_at_pos(GBinPortion *portion, gint x, GdkRecta
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : portion = portion mère à consulter. *
@@ -1276,6 +1329,55 @@ static bool g_binary_portion_contains_vmpa(const GBinPortion *portion, const vmp
* *
* Paramètres : portion = couche de portions à parcourir pour les recherches.*
* addr = adresse du point de recherche. *
+* *
+* Description : Recherche la portion présente à une adresse donnée. *
+* *
+* Retour : Portion trouvée à l'endroit indiqué. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GBinPortion *g_binary_portion_find_at_addr(GBinPortion *portion, const vmpa2t *addr)
+{
+ GBinPortion *result; /* Portion à retourner */
+ phys_t full; /* Espace total représenté */
+ size_t i; /* Boucle de parcours #1 */
+ GBinPortion *sub; /* Portion incluse à traiter */
+
+ result = NULL;
+
+ full = get_mrange_length(&portion->range);
+
+ for (i = 0; i < portion->count && result == NULL; i++)
+ {
+ sub = portion->subs[i];
+
+ if (!g_binary_portion_contains_vmpa(sub, addr))
+ continue;
+
+ result = g_binary_portion_find_at_addr(sub, addr);
+
+ }
+
+ if (result == NULL)
+ {
+ result = portion;
+ g_object_ref(G_OBJECT(result));
+ }
+
+ return result;
+
+}
+
+
+#ifdef INCLUDE_GTK_SUPPORT
+
+
+/******************************************************************************
+* *
+* Paramètres : portion = couche de portions à parcourir pour les recherches.*
+* addr = adresse du point de recherche. *
* area = étendue de portion mère, puis celle trouvée. [OUT] *
* *
* Description : Recherche la portion présente à une adresse donnée. *
@@ -1286,7 +1388,7 @@ static bool g_binary_portion_contains_vmpa(const GBinPortion *portion, const vmp
* *
******************************************************************************/
-GBinPortion *g_binary_portion_find_at_addr(GBinPortion *portion, const vmpa2t *addr, GdkRectangle *area)
+static GBinPortion *g_binary_portion_find_with_area_at_addr(GBinPortion *portion, const vmpa2t *addr, GdkRectangle *area)
{
GBinPortion *result; /* Portion à retourner */
phys_t full; /* Espace total représenté */
@@ -1308,7 +1410,7 @@ GBinPortion *g_binary_portion_find_at_addr(GBinPortion *portion, const vmpa2t *a
if (!g_binary_portion_compute_sub_area(sub, full, area, &sub_area))
continue;
- result = g_binary_portion_find_at_addr(sub, addr, &sub_area);
+ result = g_binary_portion_find_with_area_at_addr(sub, addr, &sub_area);
if (result != NULL)
*area = sub_area;
@@ -1385,7 +1487,7 @@ bool get_binary_portion_pos_from_addr(GBinPortion *root, const vmpa2t *addr, con
owner_area = *area;
- owner = g_binary_portion_find_at_addr(root, addr, &owner_area);
+ owner = g_binary_portion_find_with_area_at_addr(root, addr, &owner_area);
if (owner == NULL) return false;
diff = compute_vmpa_diff(addr, get_mrange_addr(&owner->range));
@@ -1431,6 +1533,9 @@ gboolean query_tooltip_for_binary_portion(GBinPortion *root, gint x, gint y, con
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : portion = portion mère à consulter. *
diff --git a/src/glibext/gbinportion.h b/src/glibext/gbinportion.h
index 3a960b7..ea4b4aa 100644
--- a/src/glibext/gbinportion.h
+++ b/src/glibext/gbinportion.h
@@ -27,7 +27,9 @@
#include <glib-object.h>
#include <stdbool.h>
-#include <gtk/gtk.h>
+#ifdef INCLUDE_GTK_SUPPORT
+# include <gtk/gtk.h>
+#endif
#include "../arch/vmpa.h"
@@ -87,12 +89,16 @@ GBinPortion *g_binary_portion_new(const char *, const vmpa2t *, phys_t);
/* Etablit la comparaison ascendante entre deux portions. */
int g_binary_portion_compare(const GBinPortion **, const GBinPortion **);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Attribue à la portion une éventuelle image de représentation. */
void g_binary_portion_set_icon(GBinPortion *, cairo_surface_t *);
/* Fournit une éventuelle image de représentation de portion. */
cairo_surface_t *g_binary_portion_get_icon(const GBinPortion *);
+#endif
+
/* Attribue une description humaine à une partie de code. */
void g_binary_portion_set_desc(GBinPortion *, const char *);
@@ -117,12 +123,16 @@ void g_binary_portion_set_rights(GBinPortion *, PortionAccessRights);
/* Fournit les droits associés à une partie de code. */
PortionAccessRights g_binary_portion_get_rights(const GBinPortion *);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Prépare une astuce concernant une portion pour son affichage. */
void g_binary_portion_query_tooltip(GBinPortion *, GtkTooltip *);
/* Représente la portion sur une bande dédiée. */
void g_binary_portion_draw(const GBinPortion *, GtkStyleContext *, cairo_t *, const GdkRectangle *);
+#endif
+
/* Procède à l'inclusion d'une portion dans une autre. */
void g_binary_portion_include(GBinPortion *, GBinPortion *);
@@ -147,14 +157,20 @@ bool g_binary_portion_visit(GBinPortion *, visit_portion_fc, void *);
/* ------------------------ PARCOURS D'ENSEMBLES DE PORTIONS ------------------------ */
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Compte le nombre de portions présentes dans une arborescence. */
size_t g_binary_portion_count(const GBinPortion *);
/* Recherche la portion présente à un point donné. */
GBinPortion *g_binary_portion_find_at_pos(GBinPortion *, gint, GdkRectangle *);
+#endif
+
/* Recherche la portion présente à une adresse donnée. */
-GBinPortion *g_binary_portion_find_at_addr(GBinPortion *, const vmpa2t *, GdkRectangle *);
+GBinPortion *g_binary_portion_find_at_addr(GBinPortion *, const vmpa2t *);
+
+#ifdef INCLUDE_GTK_SUPPORT
/* Fournit la position correspondant à une adresse donnée. */
bool get_binary_portion_addr_from_pos(GBinPortion *, gint, const GdkRectangle *, vmpa2t *);
@@ -165,6 +181,8 @@ bool get_binary_portion_pos_from_addr(GBinPortion *, const vmpa2t *, const GdkRe
/* Prépare une astuce concernant une portion pour son affichage. */
gboolean query_tooltip_for_binary_portion(GBinPortion *, gint, gint, const GdkRectangle *, GtkTooltip *);
+#endif
+
/* Fournit l'emplacement correspondant à une position physique. */
bool g_binary_portion_translate_offset_into_vmpa(const GBinPortion *, phys_t, vmpa2t *);
diff --git a/src/glibext/generators/Makefile.am b/src/glibext/generators/Makefile.am
index c448bb7..a332498 100644
--- a/src/glibext/generators/Makefile.am
+++ b/src/glibext/generators/Makefile.am
@@ -1,21 +1,21 @@
noinst_LTLIBRARIES = libglibextgenerators.la
-libglibextgenerators_la_SOURCES = \
- hex.h hex.c \
- prologue.h prologue.c \
- rborder.h rborder.c
-libglibextgenerators_la_LDFLAGS =
+libglibextgenerators_la_SOURCES = \
+ prologue.h prologue.c \
+ rborder.h rborder.c
+if BUILD_GTK_SUPPORT
-devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%)
+libglibextgenerators_la_SOURCES += \
+ hex.h hex.c
-dev_HEADERS = $(libglibextgenerators_la_SOURCES:%c=)
+endif
+libglibextgenerators_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS)
-AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
-AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
+devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%)
-SUBDIRS =
+dev_HEADERS = $(libglibextgenerators_la_SOURCES:%c=)
diff --git a/src/glibext/generators/hex.c b/src/glibext/generators/hex.c
index 7de2d6b..668ebae 100644
--- a/src/glibext/generators/hex.c
+++ b/src/glibext/generators/hex.c
@@ -32,11 +32,15 @@
#include "../gbinarycursor.h"
#include "../linegen-int.h"
#include "../linesegment.h"
+#include "../../core/columns.h"
#include "../../core/params.h"
#include "../../gtkext/hexdisplay.h"
+/* --------------------------- RENDU AMIQUE D'HEXADECIMAL --------------------------- */
+
+
/* Tampon pour générateur de lignes hexadécimales (instance) */
struct _GHexGenerator
{
@@ -79,15 +83,24 @@ static void g_hex_generator_dispose(GHexGenerator *);
/* Procède à la libération totale de la mémoire. */
static void g_hex_generator_finalize(GHexGenerator *);
+
+
+/* ------------------------ OFFRE DE CAPACITES DE GENERATION ------------------------ */
+
+
/* Indique le nombre de ligne prêtes à être générées. */
static size_t g_hex_generator_count_lines(const GHexGenerator *);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Retrouve l'emplacement correspondant à une position donnée. */
static void g_hex_generator_compute_cursor(const GHexGenerator *, gint, size_t, size_t, GLineCursor **);
/* Détermine si le conteneur s'inscrit dans une plage donnée. */
static int g_hex_generator_contain_cursor(const GHexGenerator *, size_t, size_t, const GLineCursor *);
+#endif
+
/* Renseigne sur les propriétés liées à un générateur. */
static BufferLineFlags g_hex_generator_get_flags(const GHexGenerator *, size_t, size_t);
@@ -96,6 +109,11 @@ static void g_hex_generator_print(GHexGenerator *, GBufferLine *, size_t, size_t
+/* ---------------------------------------------------------------------------------- */
+/* RENDU AMIQUE D'HEXADECIMAL */
+/* ---------------------------------------------------------------------------------- */
+
+
/* Détermine le type du générateur de lignes hexadécimales à la volée. */
G_DEFINE_TYPE_WITH_CODE(GHexGenerator, g_hex_generator, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE(G_TYPE_LINE_GENERATOR, g_hex_generator_interface_init));
@@ -186,8 +204,10 @@ static void g_hex_generator_init(GHexGenerator *generator)
static void g_hex_generator_interface_init(GLineGeneratorInterface *iface)
{
iface->count = (linegen_count_lines_fc)g_hex_generator_count_lines;
+#ifdef INCLUDE_GTK_SUPPORT
iface->compute = (linegen_compute_fc)g_hex_generator_compute_cursor;
iface->contain = (linegen_contain_fc)g_hex_generator_contain_cursor;
+#endif
iface->get_flags = (linegen_get_flags_fc)g_hex_generator_get_flags;
iface->print = (linegen_print_fc)g_hex_generator_print;
@@ -262,6 +282,12 @@ GHexGenerator *g_hex_generator_new(GBinContent *content)
}
+
+/* ---------------------------------------------------------------------------------- */
+/* OFFRE DE CAPACITES DE GENERATION */
+/* ---------------------------------------------------------------------------------- */
+
+
/******************************************************************************
* *
* Paramètres : generator = générateur à consulter. *
@@ -291,6 +317,9 @@ static size_t g_hex_generator_count_lines(const GHexGenerator *generator)
}
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : generator = générateur à consulter. *
@@ -407,6 +436,9 @@ static int g_hex_generator_contain_cursor(const GHexGenerator *generator, size_t
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : generator = générateur à consulter. *
diff --git a/src/glibext/generators/prologue.c b/src/glibext/generators/prologue.c
index e19107b..6b3260d 100644
--- a/src/glibext/generators/prologue.c
+++ b/src/glibext/generators/prologue.c
@@ -29,14 +29,19 @@
#include "../bufferline.h"
-#include "../gbinarycursor.h"
+#ifdef INCLUDE_GTK_SUPPORT
+# include "../gbinarycursor.h"
+#endif
#include "../linegen-int.h"
#include "../linesegment.h"
+#include "../../core/columns.h"
#include "../../format/executable.h"
-#include "../../gtkext/gtkblockdisplay.h"
+/* ------------------------- MARQUE D'INTRODUCTION DE RENDU ------------------------- */
+
+
/* Tampon pour générateur de lignes en prologue (instance) */
struct _GIntroGenerator
{
@@ -72,15 +77,24 @@ static void g_intro_generator_dispose(GIntroGenerator *);
/* Procède à la libération totale de la mémoire. */
static void g_intro_generator_finalize(GIntroGenerator *);
+
+
+/* ------------------------ OFFRE DE CAPACITES DE GENERATION ------------------------ */
+
+
/* Indique le nombre de ligne prêtes à être générées. */
static size_t g_intro_generator_count_lines(const GIntroGenerator *);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Retrouve l'emplacement correspondant à une position donnée. */
static void g_intro_generator_compute_cursor(const GIntroGenerator *, gint, size_t, size_t, GLineCursor **);
/* Détermine si le conteneur s'inscrit dans une plage donnée. */
static int g_intro_generator_contain_cursor(const GIntroGenerator *, size_t, size_t, const GLineCursor *);
+#endif
+
/* Renseigne sur les propriétés liées à un générateur. */
static BufferLineFlags g_intro_generator_get_flags(const GIntroGenerator *, size_t, size_t);
@@ -89,6 +103,11 @@ static void g_intro_generator_print(GIntroGenerator *, GBufferLine *, size_t, si
+/* ---------------------------------------------------------------------------------- */
+/* MARQUE D'INTRODUCTION DE RENDU */
+/* ---------------------------------------------------------------------------------- */
+
+
/* Détermine le type du générateur de lignes d'introduction à la volée. */
G_DEFINE_TYPE_WITH_CODE(GIntroGenerator, g_intro_generator, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE(G_TYPE_LINE_GENERATOR, g_intro_generator_interface_init));
@@ -153,8 +172,10 @@ static void g_intro_generator_init(GIntroGenerator *generator)
static void g_intro_generator_interface_init(GLineGeneratorInterface *iface)
{
iface->count = (linegen_count_lines_fc)g_intro_generator_count_lines;
+#ifdef INCLUDE_GTK_SUPPORT
iface->compute = (linegen_compute_fc)g_intro_generator_compute_cursor;
iface->contain = (linegen_contain_fc)g_intro_generator_contain_cursor;
+#endif
iface->get_flags = (linegen_get_flags_fc)g_intro_generator_get_flags;
iface->print = (linegen_print_fc)g_intro_generator_print;
@@ -263,6 +284,12 @@ GIntroGenerator *g_intro_generator_new(const GBinFormat *format, const GCodingLa
}
+
+/* ---------------------------------------------------------------------------------- */
+/* OFFRE DE CAPACITES DE GENERATION */
+/* ---------------------------------------------------------------------------------- */
+
+
/******************************************************************************
* *
* Paramètres : generator = générateur à consulter. *
@@ -282,6 +309,9 @@ static size_t g_intro_generator_count_lines(const GIntroGenerator *generator)
}
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : generator = générateur à consulter. *
@@ -338,6 +368,9 @@ static int g_intro_generator_contain_cursor(const GIntroGenerator *generator, si
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : generator = générateur à consulter. *
diff --git a/src/glibext/generators/rborder.c b/src/glibext/generators/rborder.c
index 97e7a22..8379c7a 100644
--- a/src/glibext/generators/rborder.c
+++ b/src/glibext/generators/rborder.c
@@ -30,13 +30,18 @@
#include "../bufferline.h"
-#include "../gbinarycursor.h"
+#ifdef INCLUDE_GTK_SUPPORT
+# include "../gbinarycursor.h"
+#endif
#include "../linegen-int.h"
#include "../linesegment.h"
-#include "../../gtkext/gtkblockdisplay.h"
+#include "../../core/columns.h"
+/* -------------------------- MARQUE DE BORDURE DE ROUTINE -------------------------- */
+
+
/* Tampon pour générateur de délimitations de routines (instance) */
struct _GBorderGenerator
{
@@ -79,15 +84,24 @@ static void g_border_generator_dispose(GBorderGenerator *);
/* Procède à la libération totale de la mémoire. */
static void g_border_generator_finalize(GBorderGenerator *);
+
+
+/* ------------------------ OFFRE DE CAPACITES DE GENERATION ------------------------ */
+
+
/* Indique le nombre de ligne prêtes à être générées. */
static size_t g_border_generator_count_lines(const GBorderGenerator *);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Retrouve l'emplacement correspondant à une position donnée. */
static void g_border_generator_compute_cursor(const GBorderGenerator *, gint, size_t, size_t, GLineCursor **);
/* Détermine si le conteneur s'inscrit dans une plage donnée. */
static int g_border_generator_contain_cursor(const GBorderGenerator *, size_t, size_t, const GLineCursor *);
+#endif
+
/* Renseigne sur les propriétés liées à un générateur. */
static BufferLineFlags g_border_generator_get_flags(const GBorderGenerator *, size_t, size_t);
@@ -96,6 +110,11 @@ static void g_border_generator_print(GBorderGenerator *, GBufferLine *, size_t,
+/* ---------------------------------------------------------------------------------- */
+/* MARQUE DE BORDURE DE ROUTINE */
+/* ---------------------------------------------------------------------------------- */
+
+
/* Détermine le type du générateur de délimitations de routines à la volée. */
G_DEFINE_TYPE_WITH_CODE(GBorderGenerator, g_border_generator, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE(G_TYPE_LINE_GENERATOR, g_border_generator_interface_init));
@@ -158,8 +177,10 @@ static void g_border_generator_init(GBorderGenerator *generator)
static void g_border_generator_interface_init(GLineGeneratorInterface *iface)
{
iface->count = (linegen_count_lines_fc)g_border_generator_count_lines;
+#ifdef INCLUDE_GTK_SUPPORT
iface->compute = (linegen_compute_fc)g_border_generator_compute_cursor;
iface->contain = (linegen_contain_fc)g_border_generator_contain_cursor;
+#endif
iface->get_flags = (linegen_get_flags_fc)g_border_generator_get_flags;
iface->print = (linegen_print_fc)g_border_generator_print;
@@ -240,6 +261,12 @@ GBorderGenerator *g_border_generator_new(GCodingLanguage *lang, const vmpa2t *ad
}
+
+/* ---------------------------------------------------------------------------------- */
+/* OFFRE DE CAPACITES DE GENERATION */
+/* ---------------------------------------------------------------------------------- */
+
+
/******************************************************************************
* *
* Paramètres : generator = générateur à consulter. *
@@ -259,6 +286,9 @@ static size_t g_border_generator_count_lines(const GBorderGenerator *generator)
}
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : generator = générateur à consulter. *
@@ -315,6 +345,9 @@ static int g_border_generator_contain_cursor(const GBorderGenerator *generator,
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : generator = générateur à consulter. *
diff --git a/src/glibext/glinecursor-int.h b/src/glibext/glinecursor-int.h
index b440f76..5a2f84d 100644
--- a/src/glibext/glinecursor-int.h
+++ b/src/glibext/glinecursor-int.h
@@ -26,7 +26,7 @@
#include "glinecursor.h"
-#include "../gtkext/gtkstatusstack.h"
+#include "notifier.h"
diff --git a/src/glibext/glinecursor.h b/src/glibext/glinecursor.h
index 5c35c52..549dfbe 100644
--- a/src/glibext/glinecursor.h
+++ b/src/glibext/glinecursor.h
@@ -32,11 +32,7 @@
#include "../analysis/loaded.h"
#include "../common/packed.h"
#include "../common/sqlite.h"
-
-
-
-/* Depuis ../gtkext/gtkstatusstack.h : abstration d'une gestion de barre de statut (instance) */
-typedef struct _GtkStatusStack GtkStatusStack;
+#include "../glibext/notifier.h"
diff --git a/src/glibext/linecolumn.c b/src/glibext/linecolumn.c
index 38088d2..35f7698 100644
--- a/src/glibext/linecolumn.c
+++ b/src/glibext/linecolumn.c
@@ -49,7 +49,9 @@ void init_line_column(line_column *column)
column->segments = NULL;
column->count = 0;
+#ifdef INCLUDE_GTK_SUPPORT
column->max_width = 0;
+#endif
}
@@ -81,11 +83,16 @@ void reset_line_column(line_column *column)
column->count = 0;
+#ifdef INCLUDE_GTK_SUPPORT
column->max_width = 0;
+#endif
}
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : column = colonne de ligne à mettre à jour. *
@@ -129,6 +136,9 @@ gint get_column_width(const line_column *column)
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : column = colonne de ligne à venir compléter. *
@@ -157,7 +167,9 @@ size_t append_text_to_line_column(line_column *column, const char *text, size_t
column->segments[result] = segment;
+#ifdef INCLUDE_GTK_SUPPORT
column->max_width += get_line_segment_width(segment);
+#endif
return result;
@@ -200,11 +212,16 @@ void replace_text_in_line_column(line_column *column, size_t index, const char *
column->segments[index] = segment;
+#ifdef INCLUDE_GTK_SUPPORT
refresh_line_column_width(column);
+#endif
}
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : column = colonne de ligne de texte à consulter. *
@@ -432,6 +449,9 @@ void draw_line_column_segments(const line_column *column, cairo_t *cairo, gint x
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : column = colonne de ligne de texte à venir consulter. *
diff --git a/src/glibext/linecolumn.h b/src/glibext/linecolumn.h
index 05624c5..6dd50f6 100644
--- a/src/glibext/linecolumn.h
+++ b/src/glibext/linecolumn.h
@@ -27,7 +27,9 @@
#include <stdbool.h>
#include <glib-object.h>
-#include <gdk/gdk.h>
+#ifdef INCLUDE_GTK_SUPPORT
+# include <gdk/gdk.h>
+#endif
#include "linesegment.h"
@@ -44,7 +46,9 @@ struct _line_column
line_segment **segments; /* Liste des segments contenus */
size_t count; /* Taille de cette liste */
+#ifdef INCLUDE_GTK_SUPPORT
int max_width; /* Largeur max. de l'espace */
+#endif
};
@@ -55,18 +59,24 @@ void init_line_column(line_column *);
/* Réinitialise une colonne de ligne. */
void reset_line_column(line_column *);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Recalcule la largeur d'une colonne de segments. */
void refresh_line_column_width(line_column *);
/* Fournit la quantité de pixels requise pour l'impression. */
gint get_column_width(const line_column *);
+#endif
+
/* Ajoute un fragment de texte à une colonne de ligne. */
size_t append_text_to_line_column(line_column *, const char *, size_t, RenderingTagType);
/* Remplace un fragment de texte dans une colonne de ligne. */
void replace_text_in_line_column(line_column *, size_t, const char *, size_t);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Indique l'indice du premier contenu de la colonne. */
bool get_line_column_first_content_index(const line_column *, size_t *);
@@ -85,6 +95,8 @@ line_segment *get_line_column_content_from_index(const line_column *, size_t);
/* Imprime le contenu d'une colonne de ligne de texte. */
void draw_line_column_segments(const line_column *, cairo_t *, gint, gint, const segcnt_list *);
+#endif
+
/* Donne le texte représenté par une colonne de ligne de texte. */
char *get_line_column_text(const line_column *, bool);
diff --git a/src/glibext/linesegment.c b/src/glibext/linesegment.c
index da6fbe2..192e030 100644
--- a/src/glibext/linesegment.c
+++ b/src/glibext/linesegment.c
@@ -30,13 +30,14 @@
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
-#include <gtk/gtk.h>
#include "../common/extstr.h"
#include "../common/fnv1a.h"
#include "../core/paths.h"
-#include "../gtkext/rendering.h"
+#ifdef INCLUDE_GTK_SUPPORT
+# include "../gtkext/rendering.h"
+#endif
@@ -80,6 +81,9 @@ static const char *_segment_names[RTT_COUNT] = {
};
+
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Compléments à Cairo */
#define CAIRO_FONT_SLANT_COUNT 3
@@ -96,6 +100,7 @@ typedef struct _segment_rendering
cairo_t *font_ctxts[CAIRO_FONTS_COUNT]; /* Contextes de police */
double x_advances[CAIRO_FONTS_COUNT]; /* Largeurs par caractère */
+
rendering_pattern_t patterns[RTT_COUNT];/* Modèles d'impression */
} segment_rendering;
@@ -104,6 +109,8 @@ typedef struct _segment_rendering
/* Configuration globale des rendus */
static segment_rendering _seg_params;
+#endif
+
/* ----------------------- ISOLATION DE CONTENUS PARTAGEABLES ----------------------- */
@@ -114,7 +121,11 @@ struct _line_segment
{
gint ref_count; /* Compteur de références */
- rendering_pattern_t *pattern; /* Propriétés du rendu */
+#ifdef INCLUDE_GTK_SUPPORT
+ rendering_pattern_t *pattern; /* Propriétés du rendu */
+#else
+ RenderingTagType type; /* Type de rendu attendu */
+#endif
fnv64_t hash; /* Empreinte pour comparaisons */
char text[0]; /* Texte brut conservé */
@@ -144,6 +155,8 @@ static void release_shared_segment_content(line_segment *);
/* -------------------- GESTION OPTIMALE D'UNE LISTE DE CONTENUS -------------------- */
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Liste identifiant un ensemble de segments */
struct _segcnt_list
{
@@ -158,6 +171,8 @@ struct _segcnt_list
/* Indique si le contenu d'un segment est notable ou non. */
bool selection_list_has_segment_content(const segcnt_list *, const line_segment *);
+#endif
+
/* ---------------------------------------------------------------------------------- */
@@ -165,6 +180,9 @@ bool selection_list_has_segment_content(const segcnt_list *, const line_segment
/* ---------------------------------------------------------------------------------- */
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : - *
@@ -223,6 +241,9 @@ bool load_segment_rendering_parameters(void)
}
+#endif
+
+
/* ---------------------------------------------------------------------------------- */
/* ISOLATION DE CONTENUS PARTAGEABLES */
@@ -309,7 +330,11 @@ static bool is_line_segment_equal(const line_segment *content, const line_segmen
{
bool result; /* Résultat à retourner */
+#ifdef INCLUDE_GTK_SUPPORT
result = (content->pattern == other->pattern);
+#else
+ result = (content->type == other->type);
+#endif
if (result)
result = (cmp_fnv_64a(content->hash, other->hash) == 0);
@@ -452,7 +477,11 @@ line_segment *get_new_line_segment(RenderingTagType type, const char *text, size
else
content = (line_segment *)malloc(sizeof(line_segment) + length + 1);
+#ifdef INCLUDE_GTK_SUPPORT
content->pattern = &_seg_params.patterns[type];
+#else
+ content->type = type;
+#endif
content->hash = fnv_64a_hash(text);
@@ -523,7 +552,11 @@ RenderingTagType get_line_segment_type(const line_segment *segment)
{
RenderingTagType result; /* Résultat à renvoyer */
+#ifdef INCLUDE_GTK_SUPPORT
result = (RenderingTagType)(segment->pattern - _seg_params.patterns);
+#else
+ result = segment->type;
+#endif
return result;
@@ -545,6 +578,16 @@ RenderingTagType get_line_segment_type(const line_segment *segment)
char *get_line_segment_text(const line_segment *segment, bool markup)
{
+#ifndef INCLUDE_GTK_SUPPORT
+
+ char *result; /* Description à renvoyer */
+
+ result = strdup(segment->text);
+
+ return result;
+
+#else
+
char *result; /* Description à renvoyer */
char color[7]; /* Couleur hexadécimale */
char *valid;
@@ -624,9 +667,14 @@ char *get_line_segment_text(const line_segment *segment, bool markup)
return result;
+#endif
+
}
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : segment = fragment de texte à consulter. *
@@ -911,6 +959,9 @@ void export_line_segment_style(buffer_export_context *ctx, BufferExportType type
}
+#endif
+
+
/******************************************************************************
* *
* Paramètres : segment = fragment de texte à manipuler. *
@@ -927,12 +978,12 @@ void export_line_segment_style(buffer_export_context *ctx, BufferExportType type
void export_line_segment(const line_segment *segment, buffer_export_context *ctx, BufferExportType type)
{
- size_t index; /* Indice du modèle de rendu */
+ RenderingTagType index; /* Indice du modèle de rendu */
switch (type)
{
case BET_HTML:
- index = (segment->pattern - _seg_params.patterns);
+ index = get_line_segment_type(segment);
dprintf(ctx->fd, "<SPAN class=\"%s\">", _segment_names[index]);
break;
default:
@@ -959,6 +1010,9 @@ void export_line_segment(const line_segment *segment, buffer_export_context *ctx
/* ---------------------------------------------------------------------------------- */
+#ifdef INCLUDE_GTK_SUPPORT
+
+
/******************************************************************************
* *
* Paramètres : - *
@@ -1147,3 +1201,6 @@ bool selection_list_has_segment_content(const segcnt_list *list, const line_segm
return result;
}
+
+
+#endif
diff --git a/src/glibext/linesegment.h b/src/glibext/linesegment.h
index 3585ffb..4859fbb 100644
--- a/src/glibext/linesegment.h
+++ b/src/glibext/linesegment.h
@@ -27,22 +27,31 @@
#include <glib-object.h>
#include <stdbool.h>
-#include <gdk/gdk.h>
-#include <pango/pango.h>
+#ifdef INCLUDE_GTK_SUPPORT
+# include <gdk/gdk.h>
+# include <pango/pango.h>
+#endif
+#ifdef INCLUDE_GTK_SUPPORT
/* Liste identifiant un ensemble de segments */
typedef struct _segcnt_list segcnt_list;
+#endif
+
/* ------------------------ NATURE POUR UN FRAGMENT DE TEXTE ------------------------ */
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Procède à l'initialisation des paramètres de rendu de texte. */
bool load_segment_rendering_parameters(void);
+#endif
+
/* ----------------------- ISOLATION DE CONTENUS PARTAGEABLES ----------------------- */
@@ -127,6 +136,8 @@ RenderingTagType get_line_segment_type(const line_segment *);
/* Fournit le texte brut conservé dans le segment. */
char *get_line_segment_text(const line_segment *, bool);
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Fournit la quantité de pixels requise pour l'impression. */
gint get_line_segment_width(const line_segment *);
@@ -139,6 +150,9 @@ bool move_caret_on_line_segment(const line_segment *, gint *, bool, GdkScrollDir
/* Imprime le fragment de texte représenté. */
void draw_line_segment(const line_segment *, cairo_t *, gint *, gint, const segcnt_list *);
+#endif
+
+
/* Types d'exportation */
typedef enum _BufferExportType
{
@@ -171,9 +185,13 @@ typedef struct _buffer_export_context
} buffer_export_context;
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Exporte tous les styles utilisés par des segments. */
void export_line_segment_style(buffer_export_context *, BufferExportType);
+#endif
+
/* Exporte le fragment de texte représenté. */
void export_line_segment(const line_segment *, buffer_export_context *, BufferExportType);
@@ -182,6 +200,8 @@ void export_line_segment(const line_segment *, buffer_export_context *, BufferEx
/* -------------------- GESTION OPTIMALE D'UNE LISTE DE CONTENUS -------------------- */
+#ifdef INCLUDE_GTK_SUPPORT
+
/* Initilise une liste de contenus de segments. */
segcnt_list *init_segment_content_list(void);
@@ -200,6 +220,8 @@ bool reset_segment_content_list(segcnt_list *);
/* Marque le contenu d'un segment comme remarquable. */
bool add_segment_content_to_selection_list(segcnt_list *, const line_segment *);
+#endif
+
#endif /* _GLIBEXT_LINESEGMENT_H */
diff --git a/src/glibext/notifier.h b/src/glibext/notifier.h
new file mode 100644
index 0000000..db19e10
--- /dev/null
+++ b/src/glibext/notifier.h
@@ -0,0 +1,74 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * notifier.h - prototypes pour les opérations de comparaison d'objets
+ *
+ * Copyright (C) 2022 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide 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.
+ *
+ * Chrysalide 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_NOTIFIER_H
+#define _GLIBEXT_NOTIFIER_H
+
+
+
+
+
+
+
+
+#ifdef INCLUDE_GTK_SUPPORT
+# include "../gtkext/gtkstatusstack.h"
+#else
+
+
+
+
+
+
+typedef void GtkStatusStack;
+
+
+
+/* -------------------------- STATUT DES SUIVIS D'ACTIVITE -------------------------- */
+
+
+/* Identifiant unique de rapport de progression */
+typedef unsigned long activity_id_t;
+
+/* Identifiant particulier pour une absence d'identifiant */
+#define NO_ACTIVITY_ID 0
+
+
+#define gtk_status_stack_update_current_location(a0, a1, a2, a3, a4)
+#define gtk_status_stack_reset_current_location(a0)
+
+#define gtk_status_stack_add_activity(a0, a1, a2) 0
+#define gtk_status_stack_extend_activity(a0, a1, a2)
+#define gtk_status_stack_update_activity(a0, a1, a2)
+#define gtk_status_stack_update_activity_value(a0, a1, a2)
+#define gtk_status_stack_remove_activity(a0, a1)
+
+
+
+#endif
+
+
+
+
+
+#endif /* _GLIBEXT_NOTIFIER_H */
diff --git a/src/glibext/seq.h b/src/glibext/seq.h
index c00b4e2..f9051da 100644
--- a/src/glibext/seq.h
+++ b/src/glibext/seq.h
@@ -30,7 +30,7 @@
#include <sys/types.h>
-#include "../gtkext/gtkstatusstack.h"
+#include "notifier.h"
diff --git a/src/glibext/umemslice-int.h b/src/glibext/umemslice-int.h
new file mode 100644
index 0000000..36cc2d4
--- /dev/null
+++ b/src/glibext/umemslice-int.h
@@ -0,0 +1,71 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * umemslice-int.h - prototypes internes pour les allocations en série d'un même type d'objets
+ *
+ * Copyright (C) 2023 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide 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.
+ *
+ * Chrysalide 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _GLIBEXT_UMEMSLICE_INT_H
+#define _GLIBEXT_UMEMSLICE_INT_H
+
+
+#include <stdbool.h>
+
+
+#include "umemslice.h"
+
+
+
+/* Informations portant sur un bloc */
+typedef struct _slice_slab_info_t
+{
+ void *data_max; /* Zone de débordement */
+ umem_slice_iter_t iter; /* Données pour l'utilisateur */
+
+} slice_slab_info_t;
+
+#define SLICE_INFO_SIZE (sizeof(void *) + sizeof(umem_slice_iter_t))
+
+
+/* Allocateur s'appuyant sur des séries d'objets de même type (instance) */
+struct _GUMemSlice
+{
+ GObject parent; /* A laisser en premier */
+
+ size_t obj_size; /* Taille des objects */
+
+ slice_slab_info_t *slabs; /* Ensembles complets */
+ slice_slab_info_t *last; /* Accès à l'ultime tranche */
+
+};
+
+/* Allocateur s'appuyant sur des séries d'objets de même type (classe) */
+struct _GUMemSliceClass
+{
+ GObjectClass parent; /* A laisser en premier */
+
+};
+
+
+/* Met en place un allocateur de zones identiques. */
+bool g_umem_slice_create(GUMemSlice *, size_t);
+
+
+
+#endif /* _GLIBEXT_UMEMSLICE_INT_H */
diff --git a/src/glibext/umemslice.c b/src/glibext/umemslice.c
new file mode 100644
index 0000000..40088ef
--- /dev/null
+++ b/src/glibext/umemslice.c
@@ -0,0 +1,423 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * umemslice.c - allocations en série d'un même type d'objets
+ *
+ * Copyright (C) 2023 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide 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.
+ *
+ * Chrysalide 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "umemslice.h"
+
+
+#include <assert.h>
+#include <stdint.h>
+#include <sys/mman.h>
+
+
+#include "umemslice-int.h"
+#include "../core/logs.h"
+
+
+
+/* --------------------------- GESTION D'UN BLOC D'OBJETS --------------------------- */
+
+
+#define SLAB_SIZE (8 * 1024 * 1024)
+
+
+/* Alloue un espace pour un nouveau slab en mémoire. */
+static slice_slab_info_t *create_slice_slab(size_t, size_t);
+
+/* Supprime l'espace correspondant à un slab en mémoire. */
+static void destroy_slice_slab(slice_slab_info_t *, size_t);
+
+
+
+/* --------------------------- ALLOCATIONS ET LIBERATIONS --------------------------- */
+
+
+/* Initialise la classe des allocateurs d'objets similaires. */
+static void g_umem_slice_class_init(GUMemSliceClass *);
+
+/* Initialise une instance d'allocateur d'objets similaires. */
+static void g_umem_slice_init(GUMemSlice *);
+
+/* Supprime toutes les références externes. */
+static void g_umem_slice_dispose(GUMemSlice *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_umem_slice_finalize(GUMemSlice *);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* GESTION D'UN BLOC D'OBJETS */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : slab_size = taille totale du slab à allouer. *
+* obj_size = taille des futurs objets contenus. *
+* *
+* Description : Alloue un espace pour un nouveau slab en mémoire. *
+* *
+* Retour : Adresse du gestionnaire du slab mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static slice_slab_info_t *create_slice_slab(size_t slab_size, size_t obj_size)
+{
+ slice_slab_info_t *result; /* Structure à retourner */
+ void *data; /* Zone de mémoire allouée */
+ int ret; /* Bilan d'une précision */
+ size_t quantity; /* Quantité d'objets allouable */
+
+ assert(obj_size % sizeof(unsigned long) == 0);
+
+ data = mmap(NULL, slab_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS/* | MAP_POPULATE*/, -1, 0);
+
+ if (data == MAP_FAILED)
+ {
+ LOG_ERROR_N("mmap");
+ result = NULL;
+ goto exit;
+ }
+
+ ret = madvise(data, slab_size, MADV_SEQUENTIAL);
+ if (ret == -1)
+ LOG_ERROR_N("madvise");
+
+ /* Initialisation du gestionnaire */
+
+ result = data;
+
+ quantity = (slab_size - SLICE_INFO_SIZE) / obj_size;
+
+ //result->data_max = ((uint8_t *)data) + (quantity * obj_size);
+
+ result->iter.data_end = ((uint8_t *)data) + SLICE_INFO_SIZE;
+ result->iter.next = NULL;
+
+ result->data_max = result->iter.data_end + (quantity * obj_size);
+
+ exit:
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : slab = gestionnaire d'une zone mémoire à manipuler. *
+* slab_size = taille totale du slab à allouer. *
+* *
+* Description : Supprime l'espace correspondant à un slab en mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void destroy_slice_slab(slice_slab_info_t *slab, size_t slab_size)
+{
+ void *data; /* Zone de mémoire allouée */
+ int ret; /* Bilan de l'opération */
+
+ data = slab;
+
+ ret = munmap(data, slab_size);
+
+ if (ret == -1)
+ LOG_ERROR_N("munmap");
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* ALLOCATIONS ET LIBERATIONS */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour un allocateur en série d'objets depuis une même zone mémoire. */
+G_DEFINE_TYPE(GUMemSlice, g_umem_slice, G_TYPE_OBJECT);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des allocateurs d'objets similaires. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_umem_slice_class_init(GUMemSliceClass *klass)
+{
+ GObjectClass *object; /* Autre version de la classe */
+
+ object = G_OBJECT_CLASS(klass);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)g_umem_slice_dispose;
+ object->finalize = (GObjectFinalizeFunc)g_umem_slice_finalize;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : slice = instance à initialiser. *
+* *
+* Description : Initialise une instance d'allocateur d'objets similaires. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_umem_slice_init(GUMemSlice *slice)
+{
+ slice->obj_size = 0;
+
+ slice->slabs = NULL;
+ slice->last = NULL;
+
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : slice = instance d'objet GLib à traiter. *
+* *
+* Description : Supprime toutes les références externes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_umem_slice_dispose(GUMemSlice *slice)
+{
+ G_OBJECT_CLASS(g_umem_slice_parent_class)->dispose(G_OBJECT(slice));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : slice = instance d'objet GLib à traiter. *
+* *
+* Description : Procède à la libération totale de la mémoire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_umem_slice_finalize(GUMemSlice *slice)
+{
+ slice_slab_info_t *slab; /* Slab à libérer entièrement */
+ slice_slab_info_t *next; /* Slab suivant à traiter */
+
+ for (slab = slice->slabs; slab != NULL; slab = next)
+ {
+ if (slab->iter.next == NULL)
+ next = NULL;
+ else
+ next = (slice_slab_info_t *)(((uint8_t *)slab->iter.next) - sizeof(void *));
+
+ destroy_slice_slab(slab, SLAB_SIZE);
+
+ }
+
+ G_OBJECT_CLASS(g_umem_slice_parent_class)->finalize(G_OBJECT(slice));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : size = taille des objets à allouer en mémoire. *
+* *
+* Description : Crée un allocateur dédié à la création de zones identiques. *
+* *
+* Retour : Allocateur mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GUMemSlice *g_umem_slice_new(size_t size)
+{
+ GUMemSlice *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_UMEM_SLICE, NULL);
+
+ if (!g_umem_slice_create(result, size))
+ g_clear_object(&result);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : slice = instance à initialiser pleinement. *
+* size = taille des objets à allouer en mémoire. *
+* *
+* Description : Met en place un allocateur de zones identiques. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_umem_slice_create(GUMemSlice *slice, size_t size)
+{
+ bool result; /* Bilan à retourner */
+
+ result = true;
+
+ slice->obj_size = size;
+
+ slice->slabs = create_slice_slab(SLAB_SIZE, size);
+ slice->last = slice->slabs;
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : slice = allocateur à manipuler. *
+* *
+* Description : Alloue une nouvelle zone de la taille attendue en mémoire. *
+* *
+* Retour : Adresse de la zone nouvellement disponible ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void *g_umem_slice_alloc(GUMemSlice *slice)
+{
+ void *result; /* Allocation à retourner */
+ slice_slab_info_t *slab; /* Slab concerné par l'opérat° */
+ umem_slice_iter_t *iter; /* Tête d'écriture courante */
+
+ slab = slice->last;
+
+ assert(slab != NULL);
+
+ if (slab->iter.data_end == slab->data_max)
+ {
+ slice->last = create_slice_slab(SLAB_SIZE, slice->obj_size);
+
+ slab->iter.next = &slice->last->iter;
+
+ slab = slice->last;
+
+ }
+
+ iter = &slab->iter;
+
+ result = iter->data_end;
+
+ iter->data_end_ul += slice->obj_size;
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : slice = allocateur à manipuler. *
+* val = valeur de 64 bits à intégrer. *
+* *
+* Description : Mémorise un mot de 64 bits dans une nouvelle zone en mémoire.*
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_umem_slice_put_uint64(GUMemSlice *slice, uint64_t val)
+{
+ slice_slab_info_t *slab; /* Slab concerné par l'opérat° */
+
+ assert(slice->obj_size == sizeof(uint64_t));
+
+ slab = slice->last;
+
+ assert(slab != NULL);
+
+ if (slab->iter.data_end == slab->data_max)
+ {
+ slice->last = create_slice_slab(SLAB_SIZE, slice->obj_size);
+
+ slab->iter.next = &slice->last->iter;
+
+ slab = slice->last;
+
+ }
+
+ *slab->iter.data_end_uint64 = val;
+
+ slab->iter.data_end_ul += slice->obj_size;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : slice = allocateur à consulter. *
+* *
+* Description : Fournit un itérateur pour les données allouées. *
+* *
+* Retour : Premier descripteur des données allouées. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+const umem_slice_iter_t *g_umem_slice_get_iter(const GUMemSlice *slice)
+{
+ const umem_slice_iter_t *result; /* Pointeur à retourner */
+
+ result = &slice->slabs->iter;
+
+ return result;
+
+}
diff --git a/src/glibext/umemslice.h b/src/glibext/umemslice.h
new file mode 100644
index 0000000..54b8433
--- /dev/null
+++ b/src/glibext/umemslice.h
@@ -0,0 +1,80 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * umemslice.h - prototypes pour les allocations en série d'un même type d'objets
+ *
+ * Copyright (C) 2023 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide 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.
+ *
+ * Chrysalide 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _GLIBEXT_UMEMSLICE_H
+#define _GLIBEXT_UMEMSLICE_H
+
+
+#include <glib-object.h>
+#include <stdint.h>
+
+
+
+#define G_TYPE_UMEM_SLICE g_umem_slice_get_type()
+#define G_UMEM_SLICE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_UMEM_SLICE, GUMemSlice))
+#define G_IS_UMEM_SLICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_UMEM_SLICE))
+#define G_UMEM_SLICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_UMEM_SLICE, GUMemSliceClass))
+#define G_IS_UMEM_SLICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_UMEM_SLICE))
+#define G_UMEM_SLICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_UMEM_SLICE, GUMemSliceClass))
+
+
+/* Allocateur s'appuyant sur des séries d'objets de même type (instance) */
+typedef struct _GUMemSlice GUMemSlice;
+
+/* Allocateur s'appuyant sur des séries d'objets de même type (classe) */
+typedef struct _GUMemSliceClass GUMemSliceClass;
+
+
+/* Indique le type défini pour un allocateur en série d'objets depuis une même zone mémoire. */
+GType g_umem_slice_get_type(void);
+
+/* Crée un allocateur dédié à la création de zones identiques. */
+GUMemSlice *g_umem_slice_new(size_t);
+
+/* Alloue une nouvelle zone de la taille attendue en mémoire. */
+void *g_umem_slice_alloc(GUMemSlice *);
+
+/* Mémorise un mot de 64 bits dans une nouvelle zone en mémoire. */
+void g_umem_slice_put_uint64(GUMemSlice *, uint64_t);
+
+/* Itérateur pour tranches de mémoire */
+typedef struct _umem_slice_iter_t
+{
+ union
+ {
+ void *data_end; /* Première zone libre */
+ uint64_t *data_end_uint64;
+ unsigned long data_end_ul;
+ };
+ struct _umem_slice_iter_t *next; /* Lien vers tranche suivante */
+
+ void *data[0]; /* Accès au premier élément */
+
+} umem_slice_iter_t;
+
+/* Fournit un itérateur pour les données allouées. */
+const umem_slice_iter_t *g_umem_slice_get_iter(const GUMemSlice *);
+
+
+
+#endif /* _GLIBEXT_UMEMSLICE_H */
diff --git a/src/glibext/widthtracker.c b/src/glibext/widthtracker.c
index eba30c1..bfeb32c 100644
--- a/src/glibext/widthtracker.c
+++ b/src/glibext/widthtracker.c
@@ -1095,8 +1095,8 @@ void g_width_tracker_update_deleted(GWidthTracker *tracker, size_t start, size_t
void g_width_tracker_build_initial_cache(GWidthTracker *tracker, wgroup_id_t gid, GtkStatusStack *status)
{
guint runs_count; /* Qté d'exécutions parallèles */
- GWidthUpdate **updates; /* Mesures à suivre */
size_t run_size; /* Volume réparti par exécution*/
+ GWidthUpdate **updates; /* Mesures à suivre */
GWorkQueue *queue; /* Gestionnaire de différés */
activity_id_t id; /* Identifiant de progression */
guint i; /* Boucle de parcours */
diff --git a/src/glibext/widthtracker.h b/src/glibext/widthtracker.h
index 113cf8a..ce0aa93 100644
--- a/src/glibext/widthtracker.h
+++ b/src/glibext/widthtracker.h
@@ -51,6 +51,9 @@ typedef struct _line_width_summary
/* gbuffercache.h : Tampon pour gestion de lignes optimisée (instance) */
typedef struct _GBufferCache GBufferCache;
+/* ../gtkext/gtkstatusstack.h : Abstration d'une gestion de barre de statut (instance) */
+typedef struct _GtkStatusStack GtkStatusStack;
+
#define G_TYPE_WIDTH_TRACKER (g_width_tracker_get_type())
#define G_WIDTH_TRACKER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_WIDTH_TRACKER, GWidthTracker))