diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2022-12-29 11:02:46 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2022-12-29 11:02:46 (GMT) |
commit | 41db261acccf3494aa93b71a181cde9e8605a841 (patch) | |
tree | 07a00f88920a8e601268d415131630052ef85988 /src | |
parent | c27f884ec1d18d9cff0d19d6ba8de1dd54d991c4 (diff) |
Refactor Makefiles to exclude GTK on demand.
Diffstat (limited to 'src')
103 files changed, 1165 insertions, 491 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 321b472..55a8f05 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,6 +4,9 @@ lib_LTLIBRARIES = libchrysacore.la bin_PROGRAMS = chrysalide chrysalide-hub +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/intl + + ############################################################ # Bibliothèque dynamique @@ -17,27 +20,45 @@ GOBJECT_LEAKS_SOURCES = gleak.h gleak.c endif -libchrysacore_la_SOURCES = \ + +if BUILD_GTK_SUPPORT + + GTKEXT_LIBADD = \ + gtkext/libgtkext.la + + GTKEXT_SUBDIR = \ + gtkext + + GUI_LIBADD = \ + gui/libgui.la + + GUI_SUBDIR = \ + gui + +endif + + +libchrysacore_la_SOURCES = \ $(GOBJECT_LEAKS_SOURCES) # -ldl: dladdr(), dlerror() libchrysacore_la_LDFLAGS = \ -avoid-version -ldl \ - $(LIBGTK_LIBS) $(LIBXML_LIBS) \ + $(TOOLKIT_LIBS) $(LIBXML_LIBS) \ $(LIBSQLITE_LIBS) $(LIBARCHIVE_LIBS) \ $(LIBCURL_LIBS) -libchrysacore_la_LIBADD = \ - analysis/libanalysis.la \ - arch/libarch.la \ - common/libcommon.la \ - core/libcore.la \ - debug/libdebug.la \ - format/libformat.la \ - glibext/libglibext.la \ - gtkext/libgtkext.la \ - gui/libgui.la \ - mangling/libmangling.la \ +libchrysacore_la_LIBADD = \ + analysis/libanalysis.la \ + arch/libarch.la \ + common/libcommon.la \ + core/libcore.la \ + debug/libdebug.la \ + format/libformat.la \ + glibext/libglibext.la \ + $(GTKEXT_LIBADD) \ + $(GUI_LIBADD) \ + mangling/libmangling.la \ plugins/libplugins.la @@ -52,15 +73,11 @@ chrysalide_SOURCES = \ main.c -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/intl $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) `pkg-config --cflags gthread-2.0` $(LIBPYTHON_CFLAGS) +chrysalide_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - - -chrysalide_LDFLAGS = $(LIBGTK_LIBS) -L/usr/X11R6/lib -ldl -lm $(LIBXML_LIBS) `pkg-config --libs gthread-2.0` $(LIBPYTHON_LIBS) $(LIBARCHIVE_LIBS) $(LIBSQLITE_LIBS) \ +chrysalide_LDFLAGS = $(TOOLKIT_LIBS) -L/usr/X11R6/lib -ldl -lm $(LIBXML_LIBS) $(LIBPYTHON_LIBS) $(LIBARCHIVE_LIBS) $(LIBSQLITE_LIBS) \ -L.libs -lchrysacore - chrysalide_LDADD = $(LIBINTL) @@ -74,8 +91,9 @@ EXTRA_chrysalide_hub_DEPENDENCIES = $(lib_LTLIBRARIES) chrysalide_hub_SOURCES = \ hub.c +chrysalide_hub_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) -chrysalide_hub_LDFLAGS = $(LIBGTK_LIBS) -L.libs -lchrysacore +chrysalide_hub_LDFLAGS = $(TOOLKIT_LIBS) $(LIBXML_LIBS) -L.libs -lchrysacore @@ -85,4 +103,4 @@ chrysalide_hub_LDFLAGS = $(LIBGTK_LIBS) -L.libs -lchrysacore # glibext doit être traité en premier, à cause des marshals GLib -SUBDIRS = core glibext gtkext analysis arch format common debug gui mangling plugins +SUBDIRS = core glibext $(GTKEXT_SUBDIR) analysis arch format common debug $(GUI_SUBDIR) mangling plugins diff --git a/src/analysis/Makefile.am b/src/analysis/Makefile.am index 1dd83cb..39dd2dd 100644 --- a/src/analysis/Makefile.am +++ b/src/analysis/Makefile.am @@ -18,6 +18,8 @@ libanalysis_la_SOURCES = \ type.h type.c \ variable.h variable.c +libanalysis_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) + libanalysis_la_LIBADD = \ contents/libanalysiscontents.la \ db/libanalysisdb.la \ @@ -26,16 +28,10 @@ libanalysis_la_LIBADD = \ storage/libanalysisstorage.la \ types/libanalysistypes.la -libanalysis_la_LDFLAGS = - devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libanalysis_la_SOURCES:%c=) -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - SUBDIRS = contents db disass human storage types diff --git a/src/analysis/binary.c b/src/analysis/binary.c index 41f148a..0f0ff93 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -43,17 +43,18 @@ #include "../common/cpp.h" #include "../common/xdg.h" #include "../core/collections.h" +#include "../core/columns.h" #include "../core/logs.h" #include "../core/params.h" #include "../core/processors.h" #include "../format/known.h" #include "../glibext/gbinarycursor.h" -#include "../glibext/gloadedpanel.h" -#include "../gtkext/easygtk.h" -#include "../gtkext/gtkblockdisplay.h" -#include "../gtkext/gtkdisplaypanel.h" -#include "../gtkext/gtkgraphdisplay.h" -#include "../gtkext/hexdisplay.h" +#ifdef HAVE_GTK_SUPPORT +# include "../glibext/gloadedpanel.h" +# include "../gtkext/easygtk.h" +# include "../gtkext/gtkdisplaypanel.h" +# include "../gtkext/gtkgraphdisplay.h" +#endif @@ -168,6 +169,8 @@ static void on_binary_processor_changed(GArchProcessor *, GArchInstruction *, gb /* Fournit le désignation associée à l'élément chargé. */ static char *g_loaded_binary_describe(const GLoadedBinary *, bool); +#ifdef HAVE_GTK_SUPPORT + /* Détermine le nombre de vues disponibles pour un contenu. */ static unsigned int g_loaded_binary_count_views(const GLoadedBinary *); @@ -186,6 +189,8 @@ static unsigned int g_loaded_binary_get_view_index(GLoadedBinary *, GtkWidget *) /* Fournit toutes les options d'affichage pour un contenu. */ static GDisplayOptions *g_loaded_binary_get_display_options(const GLoadedBinary *, unsigned int); +#endif + /* ---------------------------------------------------------------------------------- */ @@ -231,6 +236,8 @@ static void g_loaded_binary_class_init(GLoadedBinaryClass *klass) loaded->describe = (describe_loaded_fc)g_loaded_binary_describe; +#ifdef HAVE_GTK_SUPPORT + loaded->count_views = (count_loaded_views_fc)g_loaded_binary_count_views; loaded->get_view_name = (get_loaded_view_name_fc)g_loaded_binary_get_view_name; loaded->build_def_view = (build_loaded_def_view_fc)g_loaded_binary_build_default_view; @@ -239,6 +246,8 @@ static void g_loaded_binary_class_init(GLoadedBinaryClass *klass) loaded->get_options = (get_loaded_options_fc)g_loaded_binary_get_display_options; +#endif + } @@ -1466,7 +1475,9 @@ static bool g_loaded_binary_analyze(GLoadedBinary *binary, bool connect, bool ca char *desc; /* Description humaine associée*/ bool has_virt; /* Présence de virtuel ? */ GProcContext *context; /* Contexte de suivi dédié */ +#ifdef HAVE_GTK_SUPPORT GWidthTracker *tracker; /* Gestionnaire de largeur */ +#endif /* Interprétation du format associé */ @@ -1512,12 +1523,16 @@ static bool g_loaded_binary_analyze(GLoadedBinary *binary, bool connect, bool ca { output_disassembly(binary, context, status, &binary->disass_cache); +#ifdef HAVE_GTK_SUPPORT + tracker = g_buffer_cache_get_width_tracker(binary->disass_cache); g_width_tracker_build_initial_cache(tracker, gid, status); g_object_unref(G_OBJECT(tracker)); +#endif + } g_object_unref(G_OBJECT(context)); @@ -1661,6 +1676,9 @@ static char *g_loaded_binary_describe(const GLoadedBinary *binary, bool full) } +#ifdef HAVE_GTK_SUPPORT + + /****************************************************************************** * * * Paramètres : binary = contenu chargé à consulter. * @@ -1872,3 +1890,6 @@ static GDisplayOptions *g_loaded_binary_get_display_options(const GLoadedBinary return result; } + + +#endif diff --git a/src/analysis/block-int.h b/src/analysis/block-int.h index faa0e1f..869042c 100644 --- a/src/analysis/block-int.h +++ b/src/analysis/block-int.h @@ -44,12 +44,16 @@ typedef int (* block_compare_links_fc) (const block_link_t *, const block_link_t /* Fournit les détails des origines d'un bloc de code donné. */ typedef block_link_t * (* block_get_links_fc) (const GCodeBlock *, const GBlockList *, size_t *); +#ifdef HAVE_GTK_SUPPORT + /* Fournit la représentation graphique d'un bloc de code. */ typedef GBufferView * (* block_build_view_fc) (const GCodeBlock *, segcnt_list *); /* Construit un ensemble d'indications pour bloc. */ typedef char *(* block_build_tooltip_fc) (const GCodeBlock *); +#endif + /* Description d'un bloc de code (instance) */ struct _GCodeBlock @@ -64,7 +68,9 @@ struct _GCodeBlock size_t index; /* Indice dans une liste */ size_t rank; /* Rang dans l'exécution */ +#ifdef HAVE_GTK_SUPPORT GBufferView *view; /* Représentation construite */ +#endif }; @@ -77,8 +83,10 @@ struct _GCodeBlockClass block_compare_links_fc cmp_links; /* Comparaison de liens */ block_get_links_fc get_src; /* Obtention des origines */ block_get_links_fc get_dest; /* Obtention des destinations */ +#ifdef HAVE_GTK_SUPPORT block_build_view_fc build; /* Construction d'une vue */ block_build_tooltip_fc build_tooltip; /* Construction d'une bulle */ +#endif }; diff --git a/src/analysis/block.c b/src/analysis/block.c index 119dc86..a60d7ed 100644 --- a/src/analysis/block.c +++ b/src/analysis/block.c @@ -139,7 +139,9 @@ static void g_code_block_init(GCodeBlock *block) block->index = (size_t)-1; block->rank = (size_t)-1; +#ifdef HAVE_GTK_SUPPORT block->view = NULL; +#endif } @@ -158,7 +160,9 @@ static void g_code_block_init(GCodeBlock *block) static void g_code_block_dispose(GCodeBlock *block) { +#ifdef HAVE_GTK_SUPPORT g_clear_object(&block->view); +#endif G_OBJECT_CLASS(g_code_block_parent_class)->dispose(G_OBJECT(block)); @@ -322,6 +326,9 @@ void g_code_block_set_rank(GCodeBlock *block, size_t rank) } +#ifdef HAVE_GTK_SUPPORT + + /****************************************************************************** * * * Paramètres : block = bloc de code à manipuler. * @@ -383,6 +390,9 @@ char *g_code_block_build_tooltip(const GCodeBlock *block) } +#endif + + /* ---------------------------------------------------------------------------------- */ /* DEFINITION DE LIAISONS ENTRE BLOCS DE CODE */ diff --git a/src/analysis/block.h b/src/analysis/block.h index 63f0be0..08cfeb4 100644 --- a/src/analysis/block.h +++ b/src/analysis/block.h @@ -33,7 +33,9 @@ #include "../arch/instruction.h" #include "../arch/vmpa.h" #include "../common/bits.h" -#include "../glibext/bufferview.h" +#ifdef HAVE_GTK_SUPPORT +# include "../glibext/bufferview.h" +#endif #include "../glibext/linesegment.h" @@ -74,12 +76,16 @@ size_t g_code_block_get_rank(const GCodeBlock *); /* Définit le rang du bloc de code dans le flot d'exécution. */ void g_code_block_set_rank(GCodeBlock *, size_t); +#ifdef HAVE_GTK_SUPPORT + /* Fournit la représentation graphique d'un bloc de code. */ GBufferView *g_code_block_get_view(GCodeBlock *, segcnt_list *); /* Construit un ensemble d'indications pour bloc. */ char *g_code_block_build_tooltip(const GCodeBlock *); +#endif + /* ------------------- DEFINITION DE LIAISONS ENTRE BLOCS DE CODE ------------------- */ diff --git a/src/analysis/contents/Makefile.am b/src/analysis/contents/Makefile.am index 66e3cac..1263f42 100644 --- a/src/analysis/contents/Makefile.am +++ b/src/analysis/contents/Makefile.am @@ -8,18 +8,9 @@ libanalysiscontents_la_SOURCES = \ memory.h memory.c \ restricted.h restricted.c -libanalysiscontents_la_LIBADD = - -libanalysiscontents_la_LDFLAGS = +libanalysiscontents_la_CFLAGS = $(TOOLKIT_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libanalysiscontents_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = diff --git a/src/analysis/db/Makefile.am b/src/analysis/db/Makefile.am index 8f8242c..b9325e0 100644 --- a/src/analysis/db/Makefile.am +++ b/src/analysis/db/Makefile.am @@ -21,20 +21,16 @@ libanalysisdb_la_SOURCES = \ server.h server.c \ snapshot.h snapshot.c +libanalysisdb_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) $(LIBARCHIVE_CFLAGS) $(LIBSQLITE_CFLAGS) $(LIBSSL_CFLAGS) + libanalysisdb_la_LIBADD = \ items/libanalysisdbitems.la \ misc/libanalysisdbmisc.la -libanalysisdb_la_LDFLAGS = $(LIBSSL_LIBS) - devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libanalysisdb_la_SOURCES:%c=) -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBARCHIVE_CFLAGS) $(LIBSQLITE_CFLAGS) $(LIBSSL_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - SUBDIRS = items misc diff --git a/src/analysis/db/items/Makefile.am b/src/analysis/db/items/Makefile.am index b9ce117..f8f70d5 100644 --- a/src/analysis/db/items/Makefile.am +++ b/src/analysis/db/items/Makefile.am @@ -7,18 +7,9 @@ libanalysisdbitems_la_SOURCES = \ move.h move.c \ switcher.h switcher.c -libanalysisdbitems_la_LIBADD = - -libanalysisdbitems_la_LDFLAGS = +libanalysisdbitems_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) $(LIBSQLITE_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libanalysisdbitems_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBARCHIVE_CFLAGS) $(LIBSQLITE_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = diff --git a/src/analysis/db/items/comment.c b/src/analysis/db/items/comment.c index da7a4c0..fb27f60 100644 --- a/src/analysis/db/items/comment.c +++ b/src/analysis/db/items/comment.c @@ -39,9 +39,9 @@ #include "../../human/asm/lang.h" #include "../../../common/array.h" #include "../../../common/extstr.h" +#include "../../../core/columns.h" #include "../../../glibext/gbinarycursor.h" #include "../../../glibext/linegen-int.h" -#include "../../../gtkext/gtkblockdisplay.h" diff --git a/src/analysis/db/items/move.c b/src/analysis/db/items/move.c index af1c8c1..d009456 100644 --- a/src/analysis/db/items/move.c +++ b/src/analysis/db/items/move.c @@ -35,9 +35,13 @@ #include "../collection-int.h" #include "../item-int.h" -#include "../../../gui/core/global.h" +#ifdef HAVE_GTK_SUPPORT +# include "../../../gui/core/global.h" +#endif #include "../../../glibext/gbinarycursor.h" -#include "../../../glibext/gloadedpanel.h" +#ifdef HAVE_GTK_SUPPORT +# include "../../../glibext/gloadedpanel.h" +#endif @@ -410,6 +414,8 @@ static char *g_db_move_build_label(GDbMove *move) static bool g_db_move_run(const GDbMove *move, GLineCursor *cursor) { +#ifdef HAVE_GTK_SUPPORT + GLoadedPanel *panel; /* Afficheur effectif de code */ typedef struct _move_params @@ -465,6 +471,8 @@ static bool g_db_move_run(const GDbMove *move, GLineCursor *cursor) if (panel != NULL) g_object_unref(G_OBJECT(panel)); +#endif + return true; } diff --git a/src/analysis/db/misc/Makefile.am b/src/analysis/db/misc/Makefile.am index 6d4af6c..fc3cab2 100644 --- a/src/analysis/db/misc/Makefile.am +++ b/src/analysis/db/misc/Makefile.am @@ -6,18 +6,7 @@ libanalysisdbmisc_la_SOURCES = \ snapshot.h snapshot.c \ timestamp.h timestamp.c -libanalysisdbmisc_la_LIBADD = - -libanalysisdbmisc_la_LDFLAGS = - devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libanalysisdbmisc_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBARCHIVE_CFLAGS) $(LIBSQLITE_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = diff --git a/src/analysis/disass/Makefile.am b/src/analysis/disass/Makefile.am index 5631468..fe840c6 100644 --- a/src/analysis/disass/Makefile.am +++ b/src/analysis/disass/Makefile.am @@ -15,14 +15,9 @@ libanalysisdisass_la_SOURCES = \ rank.h rank.c \ routines.h routines.c -libanalysisdisass_la_LDFLAGS = +libanalysisdisass_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libanalysisdisass_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) diff --git a/src/analysis/disass/area.h b/src/analysis/disass/area.h index 12c4617..0817419 100644 --- a/src/analysis/disass/area.h +++ b/src/analysis/disass/area.h @@ -30,7 +30,7 @@ #include "../../format/preload.h" #include "../../format/symbol.h" #include "../../glibext/delayed.h" -#include "../../gtkext/gtkstatusstack.h" +#include "../../glibext/notifier.h" diff --git a/src/analysis/disass/block.c b/src/analysis/disass/block.c index ea1441f..973fd56 100644 --- a/src/analysis/disass/block.c +++ b/src/analysis/disass/block.c @@ -34,9 +34,9 @@ #include "../block-int.h" #include "../../arch/instructions/raw.h" #include "../../common/extstr.h" +#include "../../core/columns.h" #include "../../core/params.h" #include "../../glibext/gbinarycursor.h" -#include "../../gtkext/gtkblockdisplay.h" @@ -88,12 +88,16 @@ static block_link_t *g_basic_block_get_sources(const GBasicBlock *, const GBlock /* Fournit les détails des destinations de bloc de code. */ static block_link_t *g_basic_block_get_destinations(const GBasicBlock *, const GBlockList *, size_t *); +#ifdef HAVE_GTK_SUPPORT + /* Fournit la représentation graphique d'un bloc de code. */ static GBufferView *g_basic_block_build_view(const GBasicBlock *, segcnt_list *); /* Construit un ensemble d'indications pour bloc. */ static char *g_basic_block_build_tooltip(const GBasicBlock *); +#endif + /* ---------------------------------------------------------------------------------- */ @@ -133,8 +137,10 @@ static void g_basic_block_class_init(GBasicBlockClass *class) block->cmp_links = (block_compare_links_fc)g_basic_block_compare_links; block->get_src = (block_get_links_fc)g_basic_block_get_sources; block->get_dest = (block_get_links_fc)g_basic_block_get_destinations; +#ifdef HAVE_GTK_SUPPORT block->build = (block_build_view_fc)g_basic_block_build_view; block->build_tooltip = (block_build_tooltip_fc)g_basic_block_build_tooltip; +#endif } @@ -466,6 +472,9 @@ static block_link_t *g_basic_block_get_destinations(const GBasicBlock *block, co } +#ifdef HAVE_GTK_SUPPORT + + /****************************************************************************** * * * Paramètres : block = bloc de code à manipuler. * @@ -856,6 +865,9 @@ static char *g_basic_block_build_tooltip(const GBasicBlock *block) } +#endif + + /****************************************************************************** * * * Paramètres : block = bloc d'instructions à consulter. * diff --git a/src/analysis/disass/disassembler.c b/src/analysis/disass/disassembler.c index 4056c59..7ea127d 100644 --- a/src/analysis/disass/disassembler.c +++ b/src/analysis/disass/disassembler.c @@ -38,11 +38,11 @@ #include "routines.h" #include "../human/asm/lang.h" #include "../../arch/storage.h" +#include "../../core/columns.h" #include "../../core/global.h" #include "../../core/params.h" #include "../../core/nproc.h" #include "../../glibext/generators/prologue.h" -#include "../../gtkext/gtkblockdisplay.h" #include "../../plugins/pglist.h" @@ -391,7 +391,9 @@ void output_disassembly(GLoadedBinary *binary, GProcContext *context, GtkStatusS GBinContent *content; /* Contenu bianire manipulé */ GCodingLanguage *lang; /* Langage de sortie préféré */ int offset; /* Décalage des étiquettes */ +#ifdef HAVE_GTK_SUPPORT GWidthTracker *tracker; /* Gestionnaire de largeurs */ +#endif char **text; /* Contenu brute à imprimer */ char *desc; /* Désignation du binaire */ const gchar *checksum; /* Identifiant de binaire */ @@ -409,9 +411,11 @@ void output_disassembly(GLoadedBinary *binary, GProcContext *context, GtkStatusS g_generic_config_get_value(get_main_configuration(), MPK_LABEL_OFFSET, &offset); +#ifdef HAVE_GTK_SUPPORT tracker = g_buffer_cache_get_width_tracker(*cache); g_width_tracker_set_column_min_width(tracker, DLC_ASSEMBLY_LABEL, offset); g_object_unref(G_OBJECT(tracker)); +#endif g_buffer_cache_wlock(*cache); diff --git a/src/analysis/disass/fetch.h b/src/analysis/disass/fetch.h index 7afabc6..44b5424 100644 --- a/src/analysis/disass/fetch.h +++ b/src/analysis/disass/fetch.h @@ -27,7 +27,7 @@ #include "../binary.h" #include "../../glibext/delayed.h" -#include "../../gtkext/gtkstatusstack.h" +#include "../../glibext/notifier.h" diff --git a/src/analysis/disass/instructions.h b/src/analysis/disass/instructions.h index c0cd4ac..24fe982 100644 --- a/src/analysis/disass/instructions.h +++ b/src/analysis/disass/instructions.h @@ -28,7 +28,7 @@ #include "../routine.h" #include "../../arch/processor.h" #include "../../format/executable.h" -#include "../../gtkext/gtkstatusstack.h" +#include "../../glibext/notifier.h" diff --git a/src/analysis/disass/limit.c b/src/analysis/disass/limit.c index 1e460e0..2caefd6 100644 --- a/src/analysis/disass/limit.c +++ b/src/analysis/disass/limit.c @@ -76,7 +76,7 @@ void compute_routine_limit(GBinSymbol *symbol, const vmpa2t *next, GArchProcesso /* Dans tous les cas, on va se référer à la portion contenante... */ - portion = g_binary_portion_find_at_addr(portions, &addr, (GdkRectangle []) { { 0 } }); + portion = g_binary_portion_find_at_addr(portions, &addr); assert(portion != NULL); range = g_binary_portion_get_range(portion); diff --git a/src/analysis/disass/output.h b/src/analysis/disass/output.h index 20729d2..2213840 100644 --- a/src/analysis/disass/output.h +++ b/src/analysis/disass/output.h @@ -29,7 +29,7 @@ #include "../human/lang.h" #include "../../format/preload.h" #include "../../glibext/buffercache.h" -#include "../../gtkext/gtkstatusstack.h" +#include "../../glibext/notifier.h" diff --git a/src/analysis/disass/routines.h b/src/analysis/disass/routines.h index 9a2c308..af8e814 100644 --- a/src/analysis/disass/routines.h +++ b/src/analysis/disass/routines.h @@ -27,7 +27,7 @@ #include "../binary.h" #include "../routine.h" -#include "../../gtkext/gtkstatusstack.h" +#include "../../glibext/notifier.h" diff --git a/src/analysis/human/Makefile.am b/src/analysis/human/Makefile.am index bd5fa9f..a8e98e6 100644 --- a/src/analysis/human/Makefile.am +++ b/src/analysis/human/Makefile.am @@ -6,19 +6,15 @@ libanalysishuman_la_SOURCES = \ lang-int.h \ lang.h lang.c +libanalysishuman_la_CFLAGS = $(TOOLKIT_CFLAGS) + libanalysishuman_la_LIBADD = \ asm/libanalysishumanasm.la -libanalysishuman_la_LDFLAGS = - devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libanalysishuman_la_SOURCES:%c=) -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBARCHIVE_CFLAGS) $(LIBSQLITE_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - SUBDIRS = asm diff --git a/src/analysis/human/asm/Makefile.am b/src/analysis/human/asm/Makefile.am index 9dbf717..a3ab6a4 100644 --- a/src/analysis/human/asm/Makefile.am +++ b/src/analysis/human/asm/Makefile.am @@ -5,18 +5,9 @@ noinst_LTLIBRARIES = libanalysishumanasm.la libanalysishumanasm_la_SOURCES = \ lang.h lang.c -libanalysishumanasm_la_LIBADD = - -libanalysishumanasm_la_LDFLAGS = +libanalysishumanasm_la_CFLAGS = $(TOOLKIT_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libanalysishumanasm_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBARCHIVE_CFLAGS) $(LIBSQLITE_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = diff --git a/src/analysis/loaded-int.h b/src/analysis/loaded-int.h index 62534a6..f91e85d 100644 --- a/src/analysis/loaded-int.h +++ b/src/analysis/loaded-int.h @@ -48,6 +48,8 @@ typedef bool (* analyze_loaded_fc) (GLoadedContent *, bool, bool, wgroup_id_t, G /* Fournit le désignation associée à l'élément chargé. */ typedef char * (* describe_loaded_fc) (const GLoadedContent *, bool); +#ifdef HAVE_GTK_SUPPORT + /* Détermine le nombre de vues disponibles pour un contenu. */ typedef unsigned int (* count_loaded_views_fc) (const GLoadedContent *); @@ -66,6 +68,8 @@ typedef unsigned int (* get_loaded_view_index_fc) (GLoadedContent *, GtkWidget * /* Fournit toutes les options d'affichage pour un contenu. */ typedef GDisplayOptions * (* get_loaded_options_fc) (const GLoadedContent *, unsigned int); +#endif + /* Accès à un contenu binaire quelconque (instance) */ struct _GLoadedContent @@ -91,6 +95,8 @@ struct _GLoadedContentClass describe_loaded_fc describe; /* Description de contenu */ +#ifdef HAVE_GTK_SUPPORT + count_loaded_views_fc count_views; /* Compteur de vues */ get_loaded_view_name_fc get_view_name; /* Désignation d'une vue donnée*/ build_loaded_def_view_fc build_def_view;/* Mise en place initiale */ @@ -99,6 +105,8 @@ struct _GLoadedContentClass get_loaded_options_fc get_options; /* Obtention de liste d'options*/ +#endif + /* Signaux */ void (* analyzed) (GLoadedContent *, gboolean); diff --git a/src/analysis/loaded.c b/src/analysis/loaded.c index 9ec2f74..02caeff 100644 --- a/src/analysis/loaded.c +++ b/src/analysis/loaded.c @@ -32,8 +32,10 @@ #include "../core/global.h" #include "../core/queue.h" #include "../glibext/chrysamarshal.h" -#include "../glibext/gloadedpanel.h" -#include "../glibext/named-int.h" +#ifdef HAVE_GTK_SUPPORT +# include "../glibext/gloadedpanel.h" +# include "../glibext/named-int.h" +#endif #include "../glibext/seq.h" #include "../plugins/pglist.h" @@ -60,9 +62,13 @@ static void g_loaded_content_class_init(GLoadedContentClass *); /* Initialise un contenu chargé. */ static void g_loaded_content_init(GLoadedContent *); +#ifdef HAVE_GTK_SUPPORT + /* Procède à l'initialisation de l'interface de composant nommé. */ static void g_loaded_content_named_init(GNamedWidgetIface *); +#endif + /* Supprime toutes les références externes. */ static void g_loaded_content_dispose(GLoadedContent *); @@ -89,8 +95,12 @@ static void on_loaded_content_analysis_completed(GSeqWork *, analysis_data_t *); /* Détermine le type d'une interface pour l'intégration de contenu chargé. */ +#ifdef HAVE_GTK_SUPPORT G_DEFINE_TYPE_WITH_CODE(GLoadedContent, g_loaded_content, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(G_TYPE_NAMED_WIDGET, g_loaded_content_named_init)); +#else +G_DEFINE_TYPE(GLoadedContent, g_loaded_content, G_TYPE_OBJECT); +#endif /****************************************************************************** @@ -143,6 +153,9 @@ static void g_loaded_content_init(GLoadedContent *content) } +#ifdef HAVE_GTK_SUPPORT + + /****************************************************************************** * * * Paramètres : iface = interface GLib à initialiser. * @@ -163,6 +176,9 @@ static void g_loaded_content_named_init(GNamedWidgetIface *iface) } +#endif + + /****************************************************************************** * * * Paramètres : content = instance d'objet GLib à traiter. * @@ -577,6 +593,9 @@ char **g_loaded_content_detect_obfuscators(const GLoadedContent *content, bool v /* ---------------------------------------------------------------------------------- */ +#ifdef HAVE_GTK_SUPPORT + + /****************************************************************************** * * * Paramètres : content = contenu chargé à consulter. * @@ -745,12 +764,18 @@ GDisplayOptions *g_loaded_content_get_display_options(const GLoadedContent *cont } +#endif + + /* ---------------------------------------------------------------------------------- */ /* VUES ET BASCULEMENT ENTRE LES VUES */ /* ---------------------------------------------------------------------------------- */ +#ifdef HAVE_GTK_SUPPORT + + /****************************************************************************** * * * Paramètres : panel = panneau affichant un contenu binaire. * @@ -866,3 +891,6 @@ GtkWidget *get_loaded_panel_from_built_view(GtkWidget *view) return result; } + + +#endif diff --git a/src/analysis/loaded.h b/src/analysis/loaded.h index 406375c..040dacb 100644 --- a/src/analysis/loaded.h +++ b/src/analysis/loaded.h @@ -27,13 +27,17 @@ #include <glib-object.h> #include <stdbool.h> -#include <gtk/gtk.h> +#ifdef HAVE_GTK_SUPPORT +# include <gtk/gtk.h> +#endif #include "content.h" #include "../common/xml.h" #include "../glibext/gdisplayoptions.h" -#include "../gtkext/gtkdockstation.h" +#ifdef HAVE_GTK_SUPPORT +# include "../gtkext/gtkdockstation.h" +#endif @@ -87,6 +91,8 @@ char **g_loaded_content_detect_obfuscators(const GLoadedContent *, bool, size_t /* --------------------------- GESTION DYNAMIQUE DES VUES --------------------------- */ +#ifdef HAVE_GTK_SUPPORT + /* Détermine le nombre de vues disponibles pour un contenu. */ unsigned int g_loaded_content_count_views(const GLoadedContent *); @@ -105,11 +111,15 @@ unsigned int g_loaded_content_get_view_index(GLoadedContent *, GtkWidget *); /* Fournit toutes les options d'affichage pour un contenu. */ GDisplayOptions *g_loaded_content_get_display_options(const GLoadedContent *, unsigned int); +#endif + /* ----------------------- VUES ET BASCULEMENT ENTRE LES VUES ----------------------- */ +#ifdef HAVE_GTK_SUPPORT + /* Fournit la station d'accueil d'un panneau d'affichage. */ GtkDockStation *get_dock_station_for_view_panel(GtkWidget *); @@ -119,6 +129,8 @@ GtkWidget *get_scroll_window_for_view_panel(GtkWidget *); /* Fournit le panneau chargé inclus dans un affichage. */ GtkWidget *get_loaded_panel_from_built_view(GtkWidget *); +#endif + #endif /* _ANALYSIS_LOADED_H */ diff --git a/src/analysis/project.c b/src/analysis/project.c index 682dfb9..c966195 100644 --- a/src/analysis/project.c +++ b/src/analysis/project.c @@ -1365,6 +1365,9 @@ static void on_new_content_resolved(GContentResolver *resolver, wgroup_id_t wid, /* ---------------------------------------------------------------------------------- */ +#ifdef HAVE_GTK_SUPPORT + + /****************************************************************************** * * * Paramètres : - * @@ -1437,3 +1440,6 @@ void push_project_into_recent_list(const GStudyProject *project) g_generic_config_set_value(get_main_configuration(), MPK_LAST_PROJECT, project->filename); } + + +#endif diff --git a/src/analysis/project.h b/src/analysis/project.h index e8c6365..c058444 100644 --- a/src/analysis/project.h +++ b/src/analysis/project.h @@ -25,7 +25,9 @@ #define _ANALYSIS_PROJECT_H -#include <gtk/gtk.h> +#ifdef HAVE_GTK_SUPPORT +# include <gtk/gtk.h> +#endif #include "loaded.h" @@ -115,12 +117,16 @@ GLoadedContent **g_study_project_get_contents(GStudyProject *, size_t *); /* ------------------------- GESTION GLOBALISEE DES PROJETS ------------------------- */ +#ifdef HAVE_GTK_SUPPORT + /* Fournit le gestionnaire des projets connus. */ GtkRecentManager *get_project_manager(void); /* Place un projet au sommet de la pile des projets récents. */ void push_project_into_recent_list(const GStudyProject *); +#endif + #endif /* _PROJECT_H */ diff --git a/src/analysis/routine.c b/src/analysis/routine.c index 41bf451..de066dc 100644 --- a/src/analysis/routine.c +++ b/src/analysis/routine.c @@ -37,9 +37,9 @@ #include "routine-int.h" #include "../arch/instructions/raw.h" #include "../common/extstr.h" +#include "../core/columns.h" #include "../core/params.h" #include "../glibext/gbinarycursor.h" -#include "../gtkext/gtkblockdisplay.h" @@ -1047,6 +1047,8 @@ void g_binary_routine_print_code(const GBinRoutine *routine, GLangOutput *lang, +#ifdef HAVE_GTK_SUPPORT + /****************************************************************************** * * @@ -1334,3 +1336,6 @@ char *g_binary_routine_build_tooltip(const GBinRoutine *routine, const GLoadedBi return result; } + + +#endif diff --git a/src/analysis/routine.h b/src/analysis/routine.h index f148406..2e5e22d 100644 --- a/src/analysis/routine.h +++ b/src/analysis/routine.h @@ -133,10 +133,13 @@ char *g_binary_routine_to_string(const GBinRoutine *, bool); +#ifdef HAVE_GTK_SUPPORT /* Construit un petit résumé concis de la routine. */ char *g_binary_routine_build_tooltip(const GBinRoutine *, const GLoadedBinary *); +#endif + #endif /* _ANALYSIS_ROUTINE_H */ diff --git a/src/analysis/storage/Makefile.am b/src/analysis/storage/Makefile.am index aee0faf..3eb287b 100644 --- a/src/analysis/storage/Makefile.am +++ b/src/analysis/storage/Makefile.am @@ -13,18 +13,9 @@ libanalysisstorage_la_SOURCES = \ storage.h storage.c \ tpmem.h tpmem.c -libanalysisstorage_la_LIBADD = - -libanalysisstorage_la_LDFLAGS = $(LIBSSL_LIBS) +libanalysisstorage_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libanalysisstorage_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBARCHIVE_CFLAGS) $(LIBSQLITE_CFLAGS) $(LIBSSL_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = diff --git a/src/analysis/types/Makefile.am b/src/analysis/types/Makefile.am index e3cbda0..bc6ff14 100644 --- a/src/analysis/types/Makefile.am +++ b/src/analysis/types/Makefile.am @@ -12,18 +12,9 @@ libanalysistypes_la_SOURCES = \ proto.h proto.c \ template.h template.c -libanalysistypes_la_LIBADD = - -libanalysistypes_la_LDFLAGS = +libanalysistypes_la_CFLAGS = $(TOOLKIT_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libanalysistypes_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = diff --git a/src/arch/Makefile.am b/src/arch/Makefile.am index 8a2eea3..bdfceb7 100644 --- a/src/arch/Makefile.am +++ b/src/arch/Makefile.am @@ -1,29 +1,29 @@ noinst_LTLIBRARIES = libarch.la -libarch_la_SOURCES = \ - archbase.h archbase.c \ - context-int.h \ - context.h context.c \ - instriter.h instriter.c \ - instruction-int.h \ - instruction.h instruction.c \ - link.h link.c \ - operand-int.h operand-int.c \ - operand.h operand.c \ - post.h post.c \ - processor-int.h \ - processor.h processor.c \ - register-int.h \ - register.h register.c \ - storage.h storage.c \ +libarch_la_SOURCES = \ + archbase.h archbase.c \ + context-int.h \ + context.h context.c \ + instriter.h instriter.c \ + instruction-int.h \ + instruction.h instruction.c \ + link.h link.c \ + operand-int.h operand-int.c \ + operand.h operand.c \ + post.h post.c \ + processor-int.h \ + processor.h processor.c \ + register-int.h \ + register.h register.c \ + storage.h storage.c \ vmpa.h vmpa.c -libarch_la_LIBADD = \ - instructions/libarchinstructions.la \ - operands/libarchoperands.la +libarch_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) -libarch_la_LDFLAGS = +libarch_la_LIBADD = \ + instructions/libarchinstructions.la \ + operands/libarchoperands.la devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) @@ -31,9 +31,4 @@ devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libarch_la_SOURCES:%c=) -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - - SUBDIRS = instructions operands diff --git a/src/arch/instruction.c b/src/arch/instruction.c index 4de16d6..7fb9c4a 100644 --- a/src/arch/instruction.c +++ b/src/arch/instruction.c @@ -35,11 +35,11 @@ #include "instruction-int.h" #include "storage.h" #include "../analysis/storage/serialize-int.h" +#include "../core/columns.h" #include "../core/logs.h" #include "../core/processors.h" #include "../glibext/gbinarycursor.h" #include "../glibext/linegen-int.h" -#include "../gtkext/gtkblockdisplay.h" @@ -81,12 +81,16 @@ bool g_arch_instruction_store_destinations(GArchInstruction *, GObjectStorage *, /* Indique le nombre de ligne prêtes à être générées. */ static size_t g_arch_instruction_count_lines(const GArchInstruction *); +#ifdef HAVE_GTK_SUPPORT + /* Retrouve l'emplacement correspondant à une position donnée. */ static void g_arch_instruction_compute_cursor(const GArchInstruction *, gint, size_t, size_t, GLineCursor **); /* Détermine si le conteneur s'inscrit dans une plage donnée. */ static int g_arch_instruction_contain_cursor(const GArchInstruction *, size_t, size_t, const GLineCursor *); +#endif + /* Renseigne sur les propriétés liées à un générateur. */ static BufferLineFlags g_arch_instruction_get_flags2(const GArchInstruction *, size_t, size_t); @@ -195,8 +199,10 @@ static void g_arch_instruction_init(GArchInstruction *instr) static void g_arch_instruction_generator_init(GLineGeneratorInterface *iface) { iface->count = (linegen_count_lines_fc)g_arch_instruction_count_lines; +#ifdef HAVE_GTK_SUPPORT iface->compute = (linegen_compute_fc)g_arch_instruction_compute_cursor; iface->contain = (linegen_contain_fc)g_arch_instruction_contain_cursor; +#endif iface->get_flags = (linegen_get_flags_fc)g_arch_instruction_get_flags2; iface->print = (linegen_print_fc)g_arch_instruction_print; @@ -1835,6 +1841,9 @@ static size_t g_arch_instruction_count_lines(const GArchInstruction *instr) } +#ifdef HAVE_GTK_SUPPORT + + /****************************************************************************** * * * Paramètres : instr = générateur à consulter. * @@ -1891,6 +1900,9 @@ static int g_arch_instruction_contain_cursor(const GArchInstruction *instr, size } +#endif + + /****************************************************************************** * * * Paramètres : instr = générateur à consulter. * diff --git a/src/arch/instructions/Makefile.am b/src/arch/instructions/Makefile.am index 24d3eb5..28cf90f 100644 --- a/src/arch/instructions/Makefile.am +++ b/src/arch/instructions/Makefile.am @@ -1,24 +1,14 @@ noinst_LTLIBRARIES = libarchinstructions.la -libarchinstructions_la_SOURCES = \ - raw.h raw.c \ - undefined-int.h \ +libarchinstructions_la_SOURCES = \ + raw.h raw.c \ + undefined-int.h \ undefined.h undefined.c -libarchinstructions_la_LIBADD = - -libarchinstructions_la_LDFLAGS = +libarchinstructions_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libarchinstructions_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - - -SUBDIRS = diff --git a/src/arch/instructions/raw.c b/src/arch/instructions/raw.c index 6340e46..26282fa 100644 --- a/src/arch/instructions/raw.c +++ b/src/arch/instructions/raw.c @@ -35,7 +35,7 @@ #include "../instruction-int.h" #include "../operands/immediate.h" #include "../operands/target.h" -#include "../../gtkext/gtkblockdisplay.h" +#include "../../core/columns.h" diff --git a/src/arch/instructions/undefined.c b/src/arch/instructions/undefined.c index 7ed5db9..15c63e7 100644 --- a/src/arch/instructions/undefined.c +++ b/src/arch/instructions/undefined.c @@ -31,7 +31,7 @@ #include "undefined-int.h" -#include "../../gtkext/gtkblockdisplay.h" +#include "../../core/columns.h" diff --git a/src/arch/operand-int.h b/src/arch/operand-int.h index e78c2b0..3973287 100644 --- a/src/arch/operand-int.h +++ b/src/arch/operand-int.h @@ -48,9 +48,13 @@ typedef GArchOperand * (* get_inner_operand_fc) (const GArchOperand *, const cha /* Traduit un opérande en version humainement lisible. */ typedef void (* operand_print_fc) (const GArchOperand *, GBufferLine *); +#ifdef HAVE_GTK_SUPPORT + /* Construit un petit résumé concis de l'opérande. */ typedef char * (* operand_build_tooltip_fc) (const GArchOperand *, const GLoadedBinary *); +#endif + /* Fournit une liste de candidats embarqués par un candidat. */ typedef GArchOperand ** (* operand_list_inners_fc) (const GArchOperand *, size_t *); @@ -113,7 +117,9 @@ struct _GArchOperandClass get_inner_operand_fc get_inner; /* Récupération d'un opérande */ operand_print_fc print; /* Texte humain équivalent */ +#ifdef HAVE_GTK_SUPPORT operand_build_tooltip_fc build_tooltip; /* Construction de description */ +#endif operand_list_inners_fc list_inner; /* Récupération d'internes */ operand_update_inners_fc update_inner; /* Mise à jour des éléments */ diff --git a/src/arch/operand.c b/src/arch/operand.c index f262373..ab7eeab 100644 --- a/src/arch/operand.c +++ b/src/arch/operand.c @@ -408,6 +408,9 @@ void g_arch_operand_print(const GArchOperand *operand, GBufferLine *line) } +#ifdef HAVE_GTK_SUPPORT + + /****************************************************************************** * * * Paramètres : operand = opérande à consulter. * @@ -438,6 +441,9 @@ char *g_arch_operand_build_tooltip(const GArchOperand *operand, const GLoadedBin } +#endif + + /****************************************************************************** * * * Paramètres : operand = opérande à venir modifier. * diff --git a/src/arch/operand.h b/src/arch/operand.h index a93e898..62d2969 100644 --- a/src/arch/operand.h +++ b/src/arch/operand.h @@ -88,9 +88,13 @@ GArchOperand *g_arch_operand_get_inner_operand_from_path(const GArchOperand *, c /* Traduit un opérande en version humainement lisible. */ void g_arch_operand_print(const GArchOperand *, GBufferLine *); +#ifdef HAVE_GTK_SUPPORT + /* Construit un petit résumé concis de l'opérande. */ char *g_arch_operand_build_tooltip(const GArchOperand *, const GLoadedBinary *); +#endif + /* Ajoute une information complémentaire à un opérande. */ bool g_arch_operand_set_flag(GArchOperand *, ArchOperandFlag); diff --git a/src/arch/operands/Makefile.am b/src/arch/operands/Makefile.am index 4371457..f2a8767 100644 --- a/src/arch/operands/Makefile.am +++ b/src/arch/operands/Makefile.am @@ -18,19 +18,9 @@ libarchoperands_la_SOURCES = \ targetable-int.h \ targetable.h targetable.c -libarchoperands_la_LIBADD = - -libarchoperands_la_LDFLAGS = +libarchoperands_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libarchoperands_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - - -SUBDIRS = diff --git a/src/arch/operands/immediate.c b/src/arch/operands/immediate.c index 0df8bbb..9cb60a1 100644 --- a/src/arch/operands/immediate.c +++ b/src/arch/operands/immediate.c @@ -43,7 +43,7 @@ #include "../../common/asm.h" #include "../../common/extstr.h" #include "../../common/sort.h" -#include "../../gtkext/gtkblockdisplay.h" +#include "../../core/columns.h" @@ -82,9 +82,13 @@ static void g_imm_operand_print(const GImmOperand *, GBufferLine *); /* Compare un opérande avec un autre. */ static int g_imm_operand_compare(const GImmOperand *, const GImmOperand *, bool); +#ifdef HAVE_GTK_SUPPORT + /* Construit un petit résumé concis de l'opérande. */ static char *g_imm_operand_build_tooltip(const GImmOperand *, const GLoadedBinary *); +#endif + /* Fournit l'empreinte d'un candidat à une centralisation. */ static guint g_imm_operand_hash(const GImmOperand *, bool); @@ -148,7 +152,9 @@ static void g_imm_operand_class_init(GImmOperandClass *klass) operand->compare = (operand_compare_fc)g_imm_operand_compare; operand->print = (operand_print_fc)g_imm_operand_print; +#ifdef HAVE_GTK_SUPPORT operand->build_tooltip = (operand_build_tooltip_fc)g_imm_operand_build_tooltip; +#endif operand->hash = (operand_hash_fc)g_imm_operand_hash; @@ -1226,6 +1232,9 @@ static int g_imm_operand_compare(const GImmOperand *a, const GImmOperand *b, boo } +#ifdef HAVE_GTK_SUPPORT + + /****************************************************************************** * * * Paramètres : operand = opérande à consulter. * @@ -1314,6 +1323,9 @@ static char *g_imm_operand_build_tooltip(const GImmOperand *operand, const GLoad } +#endif + + /****************************************************************************** * * * Paramètres : operand = objet dont l'instance se veut unique. * diff --git a/src/arch/operands/known.c b/src/arch/operands/known.c index 152bdac..5402879 100644 --- a/src/arch/operands/known.c +++ b/src/arch/operands/known.c @@ -32,8 +32,8 @@ #include "immediate-int.h" #include "rename-int.h" #include "../../analysis/db/misc/rlestr.h" +#include "../../core/columns.h" #include "../../core/logs.h" -#include "../../gtkext/gtkblockdisplay.h" diff --git a/src/arch/operands/target.c b/src/arch/operands/target.c index 068d060..e33e1ee 100644 --- a/src/arch/operands/target.c +++ b/src/arch/operands/target.c @@ -41,7 +41,7 @@ #include "../../format/format.h" #include "../../format/strsym.h" #include "../../glibext/gbinarycursor.h" -#include "../../gtkext/gtkblockdisplay.h" +#include "../../core/columns.h" @@ -74,9 +74,13 @@ static int g_target_operand_compare(const GTargetOperand *, const GTargetOperand /* Traduit un opérande en version humainement lisible. */ static void g_target_operand_print(const GTargetOperand *, GBufferLine *); +#ifdef HAVE_GTK_SUPPORT + /* Construit un petit résumé concis de l'opérande. */ static char *g_target_operand_build_tooltip(const GTargetOperand *, const GLoadedBinary *); +#endif + /* Fournit l'empreinte d'un candidat à une centralisation. */ static guint g_target_operand_hash(const GTargetOperand *, bool); @@ -132,7 +136,9 @@ static void g_target_operand_class_init(GTargetOperandClass *klass) operand->compare = (operand_compare_fc)g_target_operand_compare; operand->print = (operand_print_fc)g_target_operand_print; +#ifdef HAVE_GTK_SUPPORT operand->build_tooltip = (operand_build_tooltip_fc)g_target_operand_build_tooltip; +#endif operand->hash = (operand_hash_fc)g_target_operand_hash; @@ -382,6 +388,9 @@ GArchOperand *g_target_operand_new(MemoryDataSize size, const vmpa2t *addr) } +#ifdef HAVE_GTK_SUPPORT + + /****************************************************************************** * * * Paramètres : operand = opérande à consulter. * @@ -462,6 +471,9 @@ static char *g_target_operand_build_tooltip(const GTargetOperand *operand, const } +#endif + + /****************************************************************************** * * * Paramètres : operand = structure dont le contenu est à consulter. * diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 28e5459..9a8fdf2 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -31,16 +31,9 @@ libcommon_la_SOURCES = \ xdg.h xdg.c \ xml.h xml.c -libcommon_la_LDFLAGS = $(LIBGTK_LIBS) $(LIBXML_LIBS) $(LIBCURL_LIBS) +libcommon_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) $(LIBCURL_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libcommon_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBCURL_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = diff --git a/src/core/Makefile.am b/src/core/Makefile.am index 12dcddd..ac1ae14 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -3,6 +3,7 @@ noinst_LTLIBRARIES = libcore.la libcore_la_SOURCES = \ collections.h collections.c \ + columns.h \ core.h core.c \ demanglers.h demanglers.c \ global.h global.c \ @@ -13,16 +14,9 @@ libcore_la_SOURCES = \ processors.h processors.c \ queue.h queue.c -libcore_la_LDFLAGS = $(LIBGTK_LIBS) $(LIBXML_LIBS) +libcore_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libcore_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = diff --git a/src/core/collections.h b/src/core/collections.h index 69da6f7..87f2435 100644 --- a/src/core/collections.h +++ b/src/core/collections.h @@ -49,4 +49,4 @@ void delete_collections_list(GList **); -#endif /* _ANALYSIS_DB_COLLECTION_H */ +#endif /* _CORE_COLLECTIONS_H */ diff --git a/src/core/columns.h b/src/core/columns.h new file mode 100644 index 0000000..81f78f8 --- /dev/null +++ b/src/core/columns.h @@ -0,0 +1,59 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * columns.h - prototypes pour l'énumération globale des colonnes de rendu + * + * 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 _CORE_COLUMNS_H +#define _CORE_COLUMNS_H + + + +/* Désignation des colonnes d'une ligne */ +typedef enum _DisassLineColumn +{ + DLC_PHYSICAL, /* Position physique */ + DLC_VIRTUAL, /* Adresse virtuelle */ + DLC_BINARY, /* Contenu sous forme binaire */ + DLC_ASSEMBLY_LABEL, /* Etiquette dans les données */ + DLC_ASSEMBLY_HEAD, /* Instruction pour assembleur */ + DLC_ASSEMBLY, /* Code pour assembleur */ + DLC_COMMENTS, /* Commentaires éventuels */ + + DLC_COUNT, + +} DisassLineColumn; + + +/* Désignation des colonnes d'une ligne */ +typedef enum _HexLineColumn +{ + HLC_PHYSICAL, /* Position physique */ + HLC_BINARY, /* Données binaires brutes */ + HLC_PADDING, /* Espacement forcé */ + HLC_TRANSLATION, /* Traduction de contenu */ + + HLC_COUNT, + +} HexLineColumn; + + + +#endif /* _CORE_COLUMNS_H */ diff --git a/src/core/logs.c b/src/core/logs.c index 2769bd5..9385020 100644 --- a/src/core/logs.c +++ b/src/core/logs.c @@ -29,8 +29,10 @@ #include "../common/extstr.h" -#include "../gui/core/items.h" -#include "../gui/panels/log.h" +#ifdef HAVE_GTK_SUPPORT +# include "../gui/core/items.h" +# include "../gui/panels/log.h" +#endif @@ -107,10 +109,14 @@ void set_log_verbosity(LogMessageType level) void log_simple_message(LogMessageType type, const char *msg) { +#ifdef HAVE_GTK_SUPPORT GEditorItem *item; /* Eventuel affichage présent */ +#endif if (type >= _verbosity) { +#ifdef HAVE_GTK_SUPPORT + item = find_editor_item_by_type(G_TYPE_LOG_PANEL); if (item != NULL) @@ -120,6 +126,9 @@ void log_simple_message(LogMessageType type, const char *msg) } else + +#endif + print_message_without_gui(type, msg); } diff --git a/src/debug/Makefile.am b/src/debug/Makefile.am index 6cfc90f..ce21776 100644 --- a/src/debug/Makefile.am +++ b/src/debug/Makefile.am @@ -12,18 +12,9 @@ libdebug_la_SOURCES = \ stream-int.h \ stream.h stream.c -libdebug_la_LIBADD = - -libdebug_la_CFLAGS = $(AM_CFLAGS) +libdebug_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libdebug_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = diff --git a/src/format/Makefile.am b/src/format/Makefile.am index 2004f93..305cd92 100644 --- a/src/format/Makefile.am +++ b/src/format/Makefile.am @@ -19,18 +19,9 @@ libformat_la_SOURCES = \ symbol-int.h \ symbol.h symbol.c -libformat_la_LIBADD = - -libformat_la_LDFLAGS = +libformat_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libformat_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = diff --git a/src/format/format-int.h b/src/format/format-int.h index 3e6ae3e..f18bb24 100644 --- a/src/format/format-int.h +++ b/src/format/format-int.h @@ -31,7 +31,6 @@ #include "known-int.h" #include "preload.h" #include "../glibext/objhole.h" -#include "../gtkext/gtkstatusstack.h" #include "../mangling/demangler.h" diff --git a/src/format/format.h b/src/format/format.h index a23782c..f9aa430 100644 --- a/src/format/format.h +++ b/src/format/format.h @@ -34,6 +34,7 @@ #include "../analysis/content.h" #include "../arch/context.h" #include "../glibext/delayed.h" +#include "../glibext/notifier.h" diff --git a/src/format/known.h b/src/format/known.h index 8319a63..dcc8669 100644 --- a/src/format/known.h +++ b/src/format/known.h @@ -31,6 +31,7 @@ #include "../analysis/content.h" #include "../glibext/delayed.h" +#include "../glibext/notifier.h" diff --git a/src/format/strsym.c b/src/format/strsym.c index d585434..c352a0e 100644 --- a/src/format/strsym.c +++ b/src/format/strsym.c @@ -33,7 +33,7 @@ #include "symbol-int.h" #include "../arch/operands/feeder-int.h" #include "../common/alloc.h" -#include "../gtkext/gtkblockdisplay.h" +#include "../core/columns.h" diff --git a/src/format/symbol.c b/src/format/symbol.c index b20426d..934eee3 100644 --- a/src/format/symbol.c +++ b/src/format/symbol.c @@ -31,9 +31,11 @@ #include "symbol-int.h" #include "../analysis/db/misc/rlestr.h" -#include "../glibext/gbinarycursor.h" +#include "../core/columns.h" +#ifdef HAVE_GTK_SUPPORT +# include "../glibext/gbinarycursor.h" +#endif #include "../glibext/linegen-int.h" -#include "../gtkext/gtkblockdisplay.h" @@ -66,12 +68,16 @@ static void g_binary_symbol_finalize(GBinSymbol *); /* Indique le nombre de ligne prêtes à être générées. */ static size_t g_binary_symbol_count_lines(const GBinSymbol *); +#ifdef HAVE_GTK_SUPPORT + /* Retrouve l'emplacement correspondant à une position donnée. */ static void g_binary_symbol_compute_cursor(const GBinSymbol *, gint, size_t, size_t, GLineCursor **); /* Détermine si le conteneur s'inscrit dans une plage donnée. */ static int g_binary_symbol_contain_cursor(const GBinSymbol *, size_t, size_t, const GLineCursor *); +#endif + /* Renseigne sur les propriétés liées à un générateur. */ static BufferLineFlags g_binary_symbol_get_line_flags(const GBinSymbol *, size_t, size_t); @@ -177,8 +183,10 @@ static void g_binary_symbol_init(GBinSymbol *symbol) static void g_binary_symbol_interface_init(GLineGeneratorInterface *iface) { iface->count = (linegen_count_lines_fc)g_binary_symbol_count_lines; +#ifdef HAVE_GTK_SUPPORT iface->compute = (linegen_compute_fc)g_binary_symbol_compute_cursor; iface->contain = (linegen_contain_fc)g_binary_symbol_contain_cursor; +#endif iface->get_flags = (linegen_get_flags_fc)g_binary_symbol_get_line_flags; iface->print = (linegen_print_fc)g_binary_symbol_print; @@ -784,6 +792,9 @@ static size_t g_binary_symbol_count_lines(const GBinSymbol *symbol) } +#ifdef HAVE_GTK_SUPPORT + + /****************************************************************************** * * * Paramètres : symbol = générateur à consulter. * @@ -851,6 +862,9 @@ static int g_binary_symbol_contain_cursor(const GBinSymbol *symbol, size_t index } +#endif + + /****************************************************************************** * * * Paramètres : symbol = générateur à consulter. * diff --git a/src/glibext/Makefile.am b/src/glibext/Makefile.am index 6bcf4b8..67fe0d8 100644 --- a/src/glibext/Makefile.am +++ b/src/glibext/Makefile.am @@ -3,53 +3,56 @@ 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 \ + 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 + +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..4991bd0 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 HAVE_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..ed1068c 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 HAVE_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 HAVE_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 HAVE_GTK_SUPPORT cache->tracker = NULL; +#endif } @@ -587,7 +599,9 @@ static void g_buffer_cache_dispose(GBufferCache *cache) } +#ifdef HAVE_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 HAVE_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 HAVE_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(HAVE_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(HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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..ec23b59 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 HAVE_GTK_SUPPORT +# include <gdk/gdk.h> +#endif #include "gdisplayoptions.h" #include "linegen.h" -#include "widthtracker.h" +#ifdef HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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..3fc08a4 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 HAVE_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 HAVE_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 HAVE_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 HAVE_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..1690d15 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 HAVE_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 HAVE_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/configuration.h b/src/glibext/configuration.h index aac6dc7..b5dcc3c 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 HAVE_GTK_SUPPORT +# include <gdk/gdk.h> +#endif + + +#if !defined(HAVE_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..321144b 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 HAVE_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 HAVE_GTK_SUPPORT status = get_global_status(); +#else + status = NULL; +#endif g_delayed_work_process(work, status); g_object_unref(G_OBJECT(work)); 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..76975a7 100644 --- a/src/glibext/gbinarycursor.c +++ b/src/glibext/gbinarycursor.c @@ -28,6 +28,7 @@ #include "glinecursor-int.h" +#include "../analysis/binary.h" diff --git a/src/glibext/gbinportion-int.h b/src/glibext/gbinportion-int.h index b5c70c8..1e6ade3 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 HAVE_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..4f16e9f 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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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..7bc1ee6 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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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..b182176 100644 --- a/src/glibext/generators/hex.c +++ b/src/glibext/generators/hex.c @@ -37,6 +37,9 @@ +/* --------------------------- RENDU AMIQUE D'HEXADECIMAL --------------------------- */ + + /* Tampon pour générateur de lignes hexadécimales (instance) */ struct _GHexGenerator { @@ -79,15 +82,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 HAVE_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 +108,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 +203,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 HAVE_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 +281,12 @@ GHexGenerator *g_hex_generator_new(GBinContent *content) } + +/* ---------------------------------------------------------------------------------- */ +/* OFFRE DE CAPACITES DE GENERATION */ +/* ---------------------------------------------------------------------------------- */ + + /****************************************************************************** * * * Paramètres : generator = générateur à consulter. * @@ -291,6 +316,9 @@ static size_t g_hex_generator_count_lines(const GHexGenerator *generator) } +#ifdef HAVE_GTK_SUPPORT + + /****************************************************************************** * * * Paramètres : generator = générateur à consulter. * @@ -407,6 +435,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..944de8e 100644 --- a/src/glibext/generators/prologue.c +++ b/src/glibext/generators/prologue.c @@ -29,14 +29,19 @@ #include "../bufferline.h" -#include "../gbinarycursor.h" +#ifdef HAVE_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 HAVE_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 HAVE_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 HAVE_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..b4db5d3 100644 --- a/src/glibext/generators/rborder.c +++ b/src/glibext/generators/rborder.c @@ -30,13 +30,18 @@ #include "../bufferline.h" -#include "../gbinarycursor.h" +#ifdef HAVE_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 HAVE_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 HAVE_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 HAVE_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..03fa179 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 HAVE_GTK_SUPPORT column->max_width = 0; +#endif } @@ -81,11 +83,16 @@ void reset_line_column(line_column *column) column->count = 0; +#ifdef HAVE_GTK_SUPPORT column->max_width = 0; +#endif } +#ifdef HAVE_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 HAVE_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 HAVE_GTK_SUPPORT refresh_line_column_width(column); +#endif } +#ifdef HAVE_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..15baa4c 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 HAVE_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 HAVE_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 HAVE_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 HAVE_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..ec8cc96 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 HAVE_GTK_SUPPORT +# include "../gtkext/rendering.h" +#endif @@ -80,6 +81,9 @@ static const char *_segment_names[RTT_COUNT] = { }; + +#ifdef HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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 HAVE_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..99837f9 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 HAVE_GTK_SUPPORT +# include <gdk/gdk.h> +# include <pango/pango.h> +#endif +#ifdef HAVE_GTK_SUPPORT /* Liste identifiant un ensemble de segments */ typedef struct _segcnt_list segcnt_list; +#endif + /* ------------------------ NATURE POUR UN FRAGMENT DE TEXTE ------------------------ */ +#ifdef HAVE_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 HAVE_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 HAVE_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 HAVE_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..c1023d6 --- /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 HAVE_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) +#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/gtkext/Makefile.am b/src/gtkext/Makefile.am index 8c46615..5bfc55f 100644 --- a/src/gtkext/Makefile.am +++ b/src/gtkext/Makefile.am @@ -32,7 +32,7 @@ libgtkext_la_SOURCES = \ libgtkext_la_LIBADD = \ graph/libgtkextgraph.la -libgtkext_la_LDFLAGS = +libgtkext_la_CFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) @@ -40,10 +40,6 @@ devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libgtkext_la_SOURCES:%c=) -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - SUBDIRS = graph diff --git a/src/gtkext/graph/Makefile.am b/src/gtkext/graph/Makefile.am index c7f1d4b..ba7318e 100644 --- a/src/gtkext/graph/Makefile.am +++ b/src/gtkext/graph/Makefile.am @@ -11,18 +11,9 @@ libgtkextgraph_la_SOURCES = \ rank.h rank.c \ vspace.h vspace.c -libgtkextgraph_la_LIBADD = - -libgtkextgraph_la_LDFLAGS = +libgtkextgraph_la_CFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = diff --git a/src/gtkext/gtkblockdisplay.h b/src/gtkext/gtkblockdisplay.h index 196fe2e..6c0879c 100644 --- a/src/gtkext/gtkblockdisplay.h +++ b/src/gtkext/gtkblockdisplay.h @@ -48,22 +48,6 @@ typedef struct _GtkBlockDisplay GtkBlockDisplay; typedef struct _GtkBlockDisplayClass GtkBlockDisplayClass; -/* Désignation des colonnes d'une ligne */ -typedef enum _DisassLineColumn -{ - DLC_PHYSICAL, /* Position physique */ - DLC_VIRTUAL, /* Adresse virtuelle */ - DLC_BINARY, /* Contenu sous forme binaire */ - DLC_ASSEMBLY_LABEL, /* Etiquette dans les données */ - DLC_ASSEMBLY_HEAD, /* Instruction pour assembleur */ - DLC_ASSEMBLY, /* Code pour assembleur */ - DLC_COMMENTS, /* Commentaires éventuels */ - - DLC_COUNT, - -} DisassLineColumn; - - /* Détermine le type du composant d'affichage de bloc en langage d'assemblage. */ GType gtk_block_display_get_type(void); diff --git a/src/gtkext/gtkstatusstack.c b/src/gtkext/gtkstatusstack.c index 0b35e1b..499ea88 100644 --- a/src/gtkext/gtkstatusstack.c +++ b/src/gtkext/gtkstatusstack.c @@ -554,7 +554,7 @@ void gtk_status_stack_update_current_location(GtkStatusStack *stack, const GLoad portions = g_exe_format_get_portions(format); - portion = g_binary_portion_find_at_addr(portions, addr, (GdkRectangle []) { { 0 } }); + portion = g_binary_portion_find_at_addr(portions, addr); text = g_binary_portion_get_desc(portion); diff --git a/src/gtkext/hexdisplay.h b/src/gtkext/hexdisplay.h index 45a1da9..9190548 100644 --- a/src/gtkext/hexdisplay.h +++ b/src/gtkext/hexdisplay.h @@ -48,19 +48,6 @@ typedef struct _GtkHexDisplay GtkHexDisplay; typedef struct _GtkHexDisplayClass GtkHexDisplayClass; -/* Désignation des colonnes d'une ligne */ -typedef enum _HexLineColumn -{ - HLC_PHYSICAL, /* Position physique */ - HLC_BINARY, /* Données binaires brutes */ - HLC_PADDING, /* Espacement forcé */ - HLC_TRANSLATION, /* Traduction de contenu */ - - HLC_COUNT, - -} HexLineColumn; - - /* Détermine le type du composant d'affichage sous forme hexadécimale. */ GType gtk_hex_display_get_type(void); diff --git a/src/gtkext/rendering.h b/src/gtkext/rendering.h index d80c096..9adfe1a 100644 --- a/src/gtkext/rendering.h +++ b/src/gtkext/rendering.h @@ -27,7 +27,7 @@ #include <stdbool.h> -#include <gtk/gtk.h> +#include <gdk/gdk.h> diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index fcb0298..058b36e 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -25,7 +25,7 @@ libgui_la_LIBADD = \ panels/libguipanels.la \ tb/libguitb.la -libgui_la_LDFLAGS = +libgui_la_CFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) @@ -33,10 +33,6 @@ devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libgui_la_SOURCES:%c=) -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - SUBDIRS = core dialogs menus panels tb diff --git a/src/gui/core/Makefile.am b/src/gui/core/Makefile.am index ebe1278..2077c4b 100644 --- a/src/gui/core/Makefile.am +++ b/src/gui/core/Makefile.am @@ -20,7 +20,7 @@ libguicore_la_SOURCES = \ resources.h resources.c \ theme.h theme.c -libguicore_la_LDFLAGS = $(LIBGTK_LIBS) $(LIBXML_LIBS) +libguicore_la_CFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) @@ -28,13 +28,6 @@ devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libguicore_la_SOURCES:%c=) -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = - - resources.c: gresource.xml $(RES_FILES) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name gui_core gresource.xml diff --git a/src/gui/dialogs/Makefile.am b/src/gui/dialogs/Makefile.am index a8e7b93..5716f14 100644 --- a/src/gui/dialogs/Makefile.am +++ b/src/gui/dialogs/Makefile.am @@ -31,7 +31,7 @@ libguidialogs_la_SOURCES = \ snapshots.h snapshots.c \ storage.h storage.c -libguidialogs_la_LDFLAGS = +libguidialogs_la_CFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) @@ -39,13 +39,6 @@ devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libguidialogs_la_SOURCES:%c=) -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = - - resources.c: gresource.xml $(UI_FILES) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name gui_dialogs gresource.xml diff --git a/src/gui/menus/Makefile.am b/src/gui/menus/Makefile.am index 3959044..727c0cf 100644 --- a/src/gui/menus/Makefile.am +++ b/src/gui/menus/Makefile.am @@ -11,18 +11,9 @@ libguimenus_la_SOURCES = \ project.h project.c \ view.h view.c -libguimenus_la_LDFLAGS = - -libguimenus_la_LIBADD = $(LIBINTL) +libguimenus_la_CFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libguimenus_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = diff --git a/src/gui/panels/Makefile.am b/src/gui/panels/Makefile.am index 0bde9bf..83e173b 100644 --- a/src/gui/panels/Makefile.am +++ b/src/gui/panels/Makefile.am @@ -33,7 +33,7 @@ libguipanels_la_SOURCES = \ view.h view.c \ welcome.h welcome.c -libguipanels_la_LDFLAGS = +libguipanels_la_CFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) @@ -41,13 +41,6 @@ devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libguipanels_la_SOURCES:%c=) -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = - - resources.c: gresource.xml $(UI_FILES) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name gui_panels gresource.xml diff --git a/src/gui/panels/strings.c b/src/gui/panels/strings.c index f9d6b00..4627850 100644 --- a/src/gui/panels/strings.c +++ b/src/gui/panels/strings.c @@ -859,7 +859,7 @@ static void reload_strings_for_new_list_view(const GStringsPanel *panel, GtkStat vmpa2_phys_to_string(addr, size, phys, NULL); vmpa2_virt_to_string(addr, size, virt, NULL); - portion = g_binary_portion_find_at_addr(portions, addr, (GdkRectangle []) { { 0 } }); + portion = g_binary_portion_find_at_addr(portions, addr); area = g_binary_portion_get_desc(portion); g_object_unref(G_OBJECT(portion)); diff --git a/src/gui/tb/Makefile.am b/src/gui/tb/Makefile.am index 3286757..a519d05 100644 --- a/src/gui/tb/Makefile.am +++ b/src/gui/tb/Makefile.am @@ -6,16 +6,9 @@ libguitb_la_SOURCES = \ tbitem-int.h \ tbitem.h tbitem.c -libguitb_la_LDFLAGS = +libguitb_la_CFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libguitb_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = @@ -31,7 +31,9 @@ #include <stdlib.h> #include <string.h> #include <strings.h> -#include <gtk/gtk.h> +#ifdef HAVE_GTK_SUPPORT +# include <gtk/gtk.h> +#endif #include <config.h> @@ -354,7 +356,9 @@ int main(int argc, char **argv) /* Initialisation de GTK */ g_set_prgname("Chrysalide Hub"); +#ifdef HAVE_GTK_SUPPORT gtk_init(&argc, &argv); +#endif /* Initialisation du programme */ @@ -31,7 +31,9 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <gtk/gtk.h> +#ifdef HAVE_GTK_SUPPORT +# include <gtk/gtk.h> +#endif #include <config.h> @@ -50,9 +52,11 @@ #include "core/paths.h" #include "core/queue.h" #include "glibext/delayed.h" -#include "gui/editor.h" -#include "gui/core/core.h" -#include "gui/core/global.h" +#ifdef HAVE_GTK_SUPPORT +# include "gui/editor.h" +# include "gui/core/core.h" +# include "gui/core/global.h" +#endif #include "plugins/pglist.h" @@ -63,9 +67,13 @@ static void show_chrysalide_help(const char *); /* Affiche des indications sur la version courante du programme. */ static void show_chrysalide_version(void); +#ifdef HAVE_GTK_SUPPORT + /* Recharge le dernier projet ouvert s'il existe. */ static gboolean load_last_project(GGenConfig *); +#endif + /* Ouvre les éventuels fichiers fournis au démarrage. */ static int open_binaries(char **, int); @@ -186,16 +194,20 @@ int main(int argc, char **argv) bool show_help; /* Affichage de l'aide ? */ bool show_version; /* Affichage de la version ? */ LogMessageType verbosity; /* Niveau de filtre de message */ +#ifdef HAVE_GTK_SUPPORT bool batch_mode; /* Exécution sans GUI ? */ +#endif bool save; /* Sauvegarde du cache ? */ char *prj_filename; /* Chemin vers un projet */ int index; /* Indice d'argument */ int ret; /* Bilan d'un appel */ char *edir; /* Répertoire de base effectif */ bool status; /* Bilan d'opérations */ +#ifdef HAVE_GTK_SUPPORT GtkWidget *editor; /* Fenêtre graphique */ GGenConfig *config; /* Configuration globale */ bool welcome; /* Affichage de la bienvenue ? */ +#endif char resolved[PATH_MAX]; /* Résolution de nom de fichier*/ GStudyProject *project; /* Nouveau projet courant */ @@ -225,7 +237,9 @@ int main(int argc, char **argv) show_version = false; verbosity = LMT_INFO; +#ifdef HAVE_GTK_SUPPORT batch_mode = false; +#endif save = false; prj_filename = NULL; @@ -249,7 +263,9 @@ int main(int argc, char **argv) break; case 'b': +#ifdef HAVE_GTK_SUPPORT batch_mode = true; +#endif break; case 's': @@ -294,11 +310,15 @@ int main(int argc, char **argv) /* Initialisation de GTK */ g_set_prgname("Chrysalide"); +#ifdef HAVE_GTK_SUPPORT gtk_init(&argc, &argv); +#endif /* Initialisation du programme */ +#ifdef HAVE_GTK_SUPPORT if (batch_mode) +#endif set_batch_mode(); set_log_verbosity(verbosity); @@ -308,6 +328,8 @@ int main(int argc, char **argv) /* Création de l'interface */ +#ifdef HAVE_GTK_SUPPORT + if (!batch_mode) { editor = create_editor(); @@ -330,8 +352,12 @@ int main(int argc, char **argv) else editor = NULL; +#endif + init_all_plugins(true); +#ifdef HAVE_GTK_SUPPORT + config = get_main_configuration(); if (!batch_mode) @@ -340,6 +366,8 @@ int main(int argc, char **argv) if (!status) goto exit_complete_gui; } +#endif + /* Lancement du serveur local */ status = ensure_internal_connections_setup(); @@ -354,6 +382,8 @@ int main(int argc, char **argv) /* Charge le dernier projet ? */ +#ifdef HAVE_GTK_SUPPORT + if (batch_mode) welcome = true; else @@ -363,6 +393,9 @@ int main(int argc, char **argv) g_idle_add((GSourceFunc)load_last_project, config); else + +#endif + { if (prj_filename != NULL) { @@ -382,7 +415,11 @@ int main(int argc, char **argv) if (ret == 0) { +#ifdef HAVE_GTK_SUPPORT project = g_study_project_open(prj_filename, !batch_mode); +#else + project = g_study_project_open(prj_filename, false); +#endif if (project == NULL) goto bad_project; } @@ -410,7 +447,12 @@ int main(int argc, char **argv) result = open_binaries(argv + optind, argc - optind); +#ifdef HAVE_GTK_SUPPORT + if (batch_mode) + +#endif + { wait_for_all_global_works(); @@ -422,16 +464,22 @@ int main(int argc, char **argv) } +#ifdef HAVE_GTK_SUPPORT + else gtk_main(); +#endif + set_current_project(NULL); bad_project: no_internal_server: +#ifdef HAVE_GTK_SUPPORT exit_complete_gui: +#endif #ifdef TRACK_GOBJECT_LEAKS remember_gtypes_for_leaks(); @@ -439,6 +487,8 @@ int main(int argc, char **argv) exit_all_plugins(); +#ifdef HAVE_GTK_SUPPORT + if (!batch_mode) unload_all_gui_components(); @@ -449,6 +499,8 @@ int main(int argc, char **argv) failed_to_load_editor: +#endif + unload_all_core_components(true); #ifdef TRACK_GOBJECT_LEAKS @@ -462,6 +514,9 @@ int main(int argc, char **argv) } +#ifdef HAVE_GTK_SUPPORT + + /****************************************************************************** * * * Paramètres : cfg = configuration globale sur laquelle s'appuyer. * @@ -492,6 +547,9 @@ static gboolean load_last_project(GGenConfig *cfg) } +#endif + + /****************************************************************************** * * * Paramètres : files = noms de fichier fournis en ligne de commande. * diff --git a/src/mangling/Makefile.am b/src/mangling/Makefile.am index c1a9427..4c868f7 100644 --- a/src/mangling/Makefile.am +++ b/src/mangling/Makefile.am @@ -7,18 +7,9 @@ libmangling_la_SOURCES = \ demangler-int.h \ demangler.h demangler.c -libmangling_la_LDFLAGS = - -libmangling_la_LIBADD = +libmangling_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libmangling_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index b4ac1d5..6cb8d34 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -11,18 +11,9 @@ libplugins_la_SOURCES = \ plugin.h plugin.c \ self.h -libplugins_la_CFLAGS = $(AM_CFLAGS) - -libplugins_la_LDFLAGS = +libplugins_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libplugins_la_SOURCES:%c=) - - -AM_CPPFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) - -AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS) - -SUBDIRS = diff --git a/src/plugins/pglist.h b/src/plugins/pglist.h index e0aec3f..9cc6aee 100644 --- a/src/plugins/pglist.h +++ b/src/plugins/pglist.h @@ -27,7 +27,9 @@ #include <stdbool.h> -#include <gtk/gtk.h> +#ifdef HAVE_GTK_SUPPORT +# include <gtk/gtk.h> +#endif #include "plugin-def.h" diff --git a/src/plugins/plugin-int.h b/src/plugins/plugin-int.h index 88e0fbb..db1cbb0 100644 --- a/src/plugins/plugin-int.h +++ b/src/plugins/plugin-int.h @@ -57,6 +57,8 @@ typedef void (* pg_handle_content_fc) (const GPluginModule *, PluginAction, GBin /* Procède à une opération liée à un contenu chargé. */ typedef void (* pg_handle_loaded_fc) (const GPluginModule *, PluginAction, GLoadedContent *, wgroup_id_t, GtkStatusStack *); +#ifdef HAVE_GTK_SUPPORT + /* Complète une liste de resources pour thème. */ typedef void (* pg_include_theme_fc) (const GPluginModule *, PluginAction, gboolean, char ***, size_t *); @@ -66,6 +68,8 @@ typedef void (* pg_notify_panel_fc) (const GPluginModule *, PluginAction, GPanel /* Rend compte d'un affichage ou d'un retrait de panneau. */ typedef void (* pg_notify_docking_fc) (const GPluginModule *, PluginAction, GPanelItem *, bool); +#endif + /* Assure l'interprétation d'un format en différé. */ typedef bool (* pg_handle_format_analysis_fc) (const GPluginModule *, PluginAction, GKnownFormat *, wgroup_id_t, GtkStatusStack *); @@ -115,9 +119,11 @@ struct _GPluginModuleClass pg_get_modname_fc get_modname; /* Fourniture du nom brut */ +#ifdef HAVE_GTK_SUPPORT pg_include_theme_fc include_theme; /* Extension d'un thème */ pg_notify_panel_fc notify_panel; /* Création de panneau */ pg_notify_docking_fc notify_docking; /* Affichage ou retrait */ +#endif pg_handle_content_fc handle_content; /* Explorations ou résolutions */ pg_handle_loaded_fc handle_loaded; /* Traitement de contenu chargé*/ diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index e563817..1ef90fb 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -669,8 +669,10 @@ static void g_plugin_module_init_gclass(GPluginModuleClass *class, GModule *modu switch (action) { case PGA_GUI_THEME: +#ifdef HAVE_GTK_SUPPORT load_plugin_symbol(module, "chrysalide_plugin_include_theme", &class->include_theme); +#endif break; default: @@ -686,13 +688,17 @@ static void g_plugin_module_init_gclass(GPluginModuleClass *class, GModule *modu switch (action) { case PGA_PANEL_CREATION: +#ifdef HAVE_GTK_SUPPORT load_plugin_symbol(module, "chrysalide_plugin_on_panel_creation", &class->notify_panel); +#endif break; case PGA_PANEL_DOCKING: +#ifdef HAVE_GTK_SUPPORT load_plugin_symbol(module, "chrysalide_plugin_on_panel_docking", &class->notify_docking); +#endif break; default: @@ -1423,6 +1429,9 @@ gpointer g_plugin_module_build_type_instance(GPluginModule *plugin, PluginAction } +#ifdef HAVE_GTK_SUPPORT + + /****************************************************************************** * * * Paramètres : plugin = greffon à manipuler. * @@ -1501,6 +1510,9 @@ void g_plugin_module_notify_panel_docking(const GPluginModule *plugin, PluginAct } +#endif + + /****************************************************************************** * * * Paramètres : plugin = greffon à manipuler. * diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h index ff456b3..aac5f0d 100644 --- a/src/plugins/plugin.h +++ b/src/plugins/plugin.h @@ -36,8 +36,10 @@ #include "../format/known.h" #include "../format/preload.h" #include "../glibext/configuration.h" -#include "../gtkext/gtkstatusstack.h" +#include "../glibext/notifier.h" +#ifdef HAVE_GTK_SUPPORT #include "../gui/panel.h" +#endif @@ -119,6 +121,8 @@ void g_plugin_module_notify_plugins_loaded(GPluginModule *, PluginAction, void * /* Crée une instance à partir d'un type dynamique externe. */ gpointer g_plugin_module_build_type_instance(GPluginModule *, PluginAction, GType); +#ifdef HAVE_GTK_SUPPORT + /* Complète une liste de resources pour thème. */ void g_plugin_module_include_theme(const GPluginModule *, PluginAction, gboolean, char ***, size_t *); @@ -128,6 +132,8 @@ void g_plugin_module_notify_panel_creation(const GPluginModule *, PluginAction, /* Rend compte d'un affichage ou d'un retrait de panneau. */ void g_plugin_module_notify_panel_docking(const GPluginModule *, PluginAction, GPanelItem *, bool); +#endif + /* Procède à une opération liée à un contenu binaire. */ void g_plugin_module_handle_binary_content(const GPluginModule *, PluginAction, GBinContent *, wgroup_id_t, GtkStatusStack *); |