struct symstr * symstr_succ(struct symstr *ss, struct alphabet *alpha, int *ok) { struct symstr *new_ss; struct symstr_component *sc; struct symbol *sym; new_ss = symstr_dup(ss); *ok = 1; sc = new_ss->tail; for (;;) { sym = symbol_next(sc->sym, alpha); if (sym != NULL) { sc->sym = sym; break; } else { sc->sym = alphabet_first(alpha); sc = sc->prev; if (sc == NULL) { symstr_prepend(new_ss, alphabet_first(alpha), NULL, 0, SYMSTR_OP_NOP); break; } } } return(new_ss); }
struct symstr * symstr_next(struct symstr *ss, struct alphabet *alpha, int *ok) { struct symstr *new_ss; struct symstr_component *sc; struct symbol *sym; new_ss = symstr_dup(ss); sc = new_ss->tail; sym = symbol_next(sc->sym, alpha); if (sym != NULL) { sc->sym = sym; *ok = 1; } else { *ok = 0; } return(new_ss); }
static void list_symbol_table (void) { extern symbolS *symbol_rootP; int got_some = 0; symbolS *ptr; eject = 1; listing_page (NULL); for (ptr = symbol_rootP; ptr != (symbolS *) NULL; ptr = symbol_next (ptr)) { if (SEG_NORMAL (S_GET_SEGMENT (ptr)) || S_GET_SEGMENT (ptr) == absolute_section) { /* Don't report section symbols. They are not interesting. */ if (symbol_section_p (ptr)) continue; if (S_GET_NAME (ptr)) { char buf[30], fmt[8]; valueT val = S_GET_VALUE (ptr); /* @@ Note that this is dependent on the compilation options, not solely on the target characteristics. */ if (sizeof (val) == 4 && sizeof (int) == 4) sprintf (buf, "%08lx", (unsigned long) val); else if (sizeof (val) <= sizeof (unsigned long)) { sprintf (fmt, "%%0%lulx", (unsigned long) (sizeof (val) * 2)); sprintf (buf, fmt, (unsigned long) val); } #if defined (BFD64) else if (sizeof (val) > 4) sprintf_vma (buf, val); #endif else abort (); if (!got_some) { fprintf (list_file, "DEFINED SYMBOLS\n"); on_page++; got_some = 1; } if (symbol_get_frag (ptr) && symbol_get_frag (ptr)->line) { fprintf (list_file, "%20s:%-5d %s:%s %s\n", symbol_get_frag (ptr)->line->file->filename, symbol_get_frag (ptr)->line->line, segment_name (S_GET_SEGMENT (ptr)), buf, S_GET_NAME (ptr)); } else { fprintf (list_file, "%33s:%s %s\n", segment_name (S_GET_SEGMENT (ptr)), buf, S_GET_NAME (ptr)); } on_page++; listing_page (NULL); } } } if (!got_some) { fprintf (list_file, "NO DEFINED SYMBOLS\n"); on_page++; } emit_line (NULL, "\n"); got_some = 0; for (ptr = symbol_rootP; ptr != (symbolS *) NULL; ptr = symbol_next (ptr)) { if (S_GET_NAME (ptr) && strlen (S_GET_NAME (ptr)) != 0) { if (S_GET_SEGMENT (ptr) == undefined_section) { if (!got_some) { got_some = 1; emit_line (NULL, "UNDEFINED SYMBOLS\n"); } emit_line (NULL, "%s\n", S_GET_NAME (ptr)); } } } if (!got_some) emit_line (NULL, "NO UNDEFINED SYMBOLS\n"); }