diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-03-15 00:01:58 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-03-15 00:01:58 (GMT) |
commit | b94be85e00d7770af4de93bbba91b421cfb6faea (patch) | |
tree | ea16d5248b293b3a458ad16625c6919315a4aa4a /src | |
parent | fab9d7cd46922abea7d94f36dcd4630cdf3f4719 (diff) |
Marked lines which are able to start a group of lines as width managers.
Diffstat (limited to 'src')
-rw-r--r-- | src/analysis/disass/output.c | 17 | ||||
-rw-r--r-- | src/format/symbol.c | 61 | ||||
-rw-r--r-- | src/format/symbol.h | 6 |
3 files changed, 69 insertions, 15 deletions
diff --git a/src/analysis/disass/output.c b/src/analysis/disass/output.c index 07165c0..51b0a04 100644 --- a/src/analysis/disass/output.c +++ b/src/analysis/disass/output.c @@ -246,21 +246,8 @@ void print_disassembled_instructions(GCodeBuffer *buffer, const GExeFormat *form /* Début d'un groupe bien cohérent avec les alignements ? */ - switch (g_binary_symbol_get_target_type(symbols[sym_index])) - { - case STP_ROUTINE: - case STP_OBJECT: - case STP_FUNCTION: - case STP_ENTRY_POINT: - case STP_STRING: - case STP_RO_STRING: - g_buffer_line_add_flag(line, BLF_WIDTH_MANAGER); - break; - - default: - break; - - } + if (g_binary_symbol_is_block_start(symbols[sym_index])) + g_buffer_line_add_flag(line, BLF_WIDTH_MANAGER); /* Commentaire ? */ diff --git a/src/format/symbol.c b/src/format/symbol.c index 58fdfb3..2c2e5ad 100644 --- a/src/format/symbol.c +++ b/src/format/symbol.c @@ -36,6 +36,7 @@ struct _GBinSymbol SymbolType type; /* Type du symbole */ + bool block_start; /* Début d'un bloc ? */ char *alt; /* Nom alternatif */ union @@ -244,6 +245,66 @@ SymbolType g_binary_symbol_get_target_type(const GBinSymbol *symbol) /****************************************************************************** * * +* Paramètres : symbol = symbole à venir compléter. * +* start = indication quant à la nature du symbole. * +* * +* Description : Définit si un symbole est susceptible de démarrer un bloc. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_binary_symbol_define_as_block_start(GBinSymbol *symbol, bool start) +{ + symbol->block_start = start; + +} + + +/****************************************************************************** +* * +* Paramètres : symbol = symbole à venir consulter. * +* * +* Description : Indique si un symbole est susceptible de démarrer un bloc. * +* * +* Retour : Capacité de rassemblement du symbole. * +* * +* Remarques : - * +* * +******************************************************************************/ + +bool g_binary_symbol_is_block_start(GBinSymbol *symbol) +{ + bool result; /* Statut à retourner */ + + switch (g_binary_symbol_get_target_type(symbol)) + { + case STP_ROUTINE: + case STP_OBJECT: + case STP_FUNCTION: + case STP_ENTRY_POINT: + case STP_STRING: + case STP_RO_STRING: + result = true; + break; + + default: + result = false; + break; + + } + + result |= symbol->block_start; + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : symbol = symbole à venir consulter. * * * * Description : Fournit un étiquette pour viser un symbole. * diff --git a/src/format/symbol.h b/src/format/symbol.h index 6f2078c..c616a85 100644 --- a/src/format/symbol.h +++ b/src/format/symbol.h @@ -83,6 +83,12 @@ int g_binary_symbol_cmp(const GBinSymbol **, const GBinSymbol **); /* Fournit le type du symbole. */ SymbolType g_binary_symbol_get_target_type(const GBinSymbol *); +/* Définit si un symbole est susceptible de démarrer un bloc. */ +void g_binary_symbol_define_as_block_start(GBinSymbol *, bool); + +/* Indique si un symbole est susceptible de démarrer un bloc. */ +bool g_binary_symbol_is_block_start(GBinSymbol *); + /* Fournit un étiquette pour viser un symbole. */ const char *g_binary_symbol_get_label(const GBinSymbol *); |