From: kaashoek Date: Wed, 25 Nov 1987 13:52:01 +0000 (+0000) Subject: (no commit message) X-Git-Tag: release-5-5~3708 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=7af2561a91a522120ba2f0c08868ffbb3360fe97;p=ack.git --- diff --git a/util/ceg/ce_back/obj_back/symboldef.c b/util/ceg/ce_back/obj_back/symboldef.c index 6dfb7451e..99fe2a067 100644 --- a/util/ceg/ce_back/obj_back/symboldef.c +++ b/util/ceg/ce_back/obj_back/symboldef.c @@ -12,7 +12,5 @@ char *sym; i = find_sym( sym, SYMBOL_DEFINITION); (symbol_table + i)->on_valu = cur_value(); (symbol_table + i)->on_type |= (S_MIN + conv_seg( cur_seg)); - /* print( "s %s in %d seg %d addr %ld\n", sym , i, conv_seg( cur_seg), - cur_value()); */ } diff --git a/util/ceg/ce_back/obj_back/symtable.c b/util/ceg/ce_back/obj_back/symtable.c index 83f031266..86623a417 100644 --- a/util/ceg/ce_back/obj_back/symtable.c +++ b/util/ceg/ce_back/obj_back/symtable.c @@ -4,6 +4,27 @@ #include "header.h" #include "back.h" +/* Findsym() manages the symbol table. It can be called in three ways. + * 1) findsym( "string", DEFINITION) : look if string is present in the + * symol table. If not create a new entry: set index into the + * string_area. Return the index to the entry. Symbol_def() will + * the fields. + * 2) findsym( "string", REFERENCE) : If string is present but never used + * (see 3)) make this name extern visible and set on_valu on -1. + * We use the on_valu field to distinguish between external visible + * names that are defined here and those that are defined in another file. + * If the string is not present create a new entry and make the name extern + * visible and set on_valu on -1. + * If the name is present do nothing special. + * 3) findsym( "string", STORE_STRING) : this call is made to save a + * copy action. The first time a name is encountered we store it + * immediately in the symbol table. If the name is not present we + * create a new entry and set the on_valu field on -2. In this + * way we can tell later that the name is not used yet. The index + * is stored in the global varaible 'index_symbol_table' because it is + * very likely that the same string is in the next call to findsym. + * (After introducing a new name one does something with this name) + */ int string_lengte = 0, index_symbol_table = -1;