summaryrefslogtreecommitdiffhomepage
path: root/mixlib
diff options
context:
space:
mode:
authorjaortega <jaortega>2000-11-19 00:38:43 +0000
committerjaortega <jaortega>2000-11-19 00:38:43 +0000
commitc6acfb52dcad94462a4dac6fe0bac5d2d0e022b5 (patch)
tree8183a179e32c094b35394ded3fb4c51534171c56 /mixlib
parentb096c061eb3e2992830f37c361f9179738aba5eb (diff)
downloadmdk-c6acfb52dcad94462a4dac6fe0bac5d2d0e022b5.tar.gz
mdk-c6acfb52dcad94462a4dac6fe0bac5d2d0e022b5.tar.bz2
using skip local symbols mode when printing symbol table
Diffstat (limited to 'mixlib')
-rw-r--r--mixlib/mix_code_file.c2
-rw-r--r--mixlib/mix_parser.c2
-rw-r--r--mixlib/mix_symbol_table.c10
-rw-r--r--mixlib/mix_symbol_table.h3
4 files changed, 11 insertions, 6 deletions
diff --git a/mixlib/mix_code_file.c b/mixlib/mix_code_file.c
index 9bcd098..ba53a64 100644
--- a/mixlib/mix_code_file.c
+++ b/mixlib/mix_code_file.c
@@ -178,7 +178,7 @@ mix_code_file_new_write(const gchar *name, mix_address_t addr,
if ( check && result->source_path != NULL )
check = fputs (result->source_path, file) != EOF;
if ( check && debug )
- mix_symbol_table_print (table, MIX_SYM_LINE, file);
+ mix_symbol_table_print (table, MIX_SYM_LINE, file, TRUE);
if ( !check )
{
mix_code_file_delete (result);
diff --git a/mixlib/mix_parser.c b/mixlib/mix_parser.c
index 1b876ad..80dff45 100644
--- a/mixlib/mix_parser.c
+++ b/mixlib/mix_parser.c
@@ -359,7 +359,7 @@ mix_parser_write_listing (mix_parser_t *parser, const gchar *list_file)
fprintf (file, _("\n*** Start address: %d\n"),
mix_short_magnitude (parser->start));
fprintf (file, _("\n*** Symbol table\n"));
- mix_symbol_table_print (parser->symbol_table, MIX_SYM_ROWS, file);
+ mix_symbol_table_print (parser->symbol_table, MIX_SYM_ROWS, file, TRUE);
fprintf (file, _("\n*** End of summary ***\n"));
mix_file_delete (mfile);
return parser->status;
diff --git a/mixlib/mix_symbol_table.c b/mixlib/mix_symbol_table.c
index 36c15a9..1045886 100644
--- a/mixlib/mix_symbol_table.c
+++ b/mixlib/mix_symbol_table.c
@@ -114,11 +114,13 @@ mix_symbol_table_is_defined(const mix_symbol_table_t *table, const gchar *sym)
#define is_local_sym_(sym) \
((sym) && (strlen(sym)==2) && (sym[1] == 'B') && isdigit(sym[0]))
+static gboolean skip_ = FALSE;
+
static void
print_sym_rows_(gpointer symbol, gpointer value, gpointer file)
{
char *s = (char *)symbol;
- if (!is_local_sym_(s)) {
+ if (skip_ && !is_local_sym_(s)) {
mix_word_t word = (mix_word_t)GPOINTER_TO_UINT(value);
fprintf((FILE *)file, "%s: %s%ld\n", s,
mix_word_is_negative(word)? "-":"",
@@ -130,7 +132,7 @@ static void
print_sym_line_(gpointer symbol, gpointer value, gpointer file)
{
char *s = (char *)symbol;
- if (!is_local_sym_(s)) {
+ if (skip_ && !is_local_sym_(s)) {
mix_word_t word = (mix_word_t)GPOINTER_TO_UINT(value);
fprintf((FILE *)file, ",%s =%s%ld", s,
mix_word_is_negative(word)? "-":"",
@@ -139,9 +141,11 @@ print_sym_line_(gpointer symbol, gpointer value, gpointer file)
}
void
-mix_symbol_table_print(const mix_symbol_table_t *table, gint mode, FILE *file)
+mix_symbol_table_print(const mix_symbol_table_t *table, gint mode,
+ FILE *file, gboolean skiplocal)
{
GHFunc func = (mode == MIX_SYM_LINE)? print_sym_line_ : print_sym_rows_;
+ skip_ = skiplocal;
if ( table != NULL )
g_hash_table_foreach((GHashTable *)table, func, (gpointer)file);
if ( mode == MIX_SYM_LINE ) putc(';', file); /* to mark end-of-table */
diff --git a/mixlib/mix_symbol_table.h b/mixlib/mix_symbol_table.h
index d9eaede..da9046f 100644
--- a/mixlib/mix_symbol_table.h
+++ b/mixlib/mix_symbol_table.h
@@ -92,7 +92,8 @@ enum {
};
extern void
-mix_symbol_table_print(const mix_symbol_table_t *table, gint mode, FILE *file);
+mix_symbol_table_print(const mix_symbol_table_t *table, gint mode,
+ FILE *file, gboolean skiplocal);
#endif /* MIX_SYMBOL_TABLE_H */