1 /* $Id: symbol.h,v 2.0.1.2 1993/08/31 05:04:35 greyham Exp greyham $ 2 * 3 * Definitions for a symbol table 4 */ 5 #include "config.h" 6 7 #ifndef _SYMBOL_H 8 #define _SYMBOL_H 9 10 typedef struct _symbol { 11 struct _symbol *next; /* next symbol in list */ 12 char *name; /* name of symbol */ 13 unsigned short flags; /* symbol attributes */ 14 15 enum { SYMVAL_NONE, SYMVAL_ENUM } valtype; 16 17 union { 18 struct _enumerator_list *enum_list; 19 } value; 20 } Symbol; 21 22 /* The hash table length should be a prime number. */ 23 #define SYM_MAX_HASH 251 24 25 typedef struct _symbol_table { 26 Symbol *bucket[SYM_MAX_HASH]; /* hash buckets */ 27 } SymbolTable; 28 29 /* Create symbol table */ 30 extern SymbolTable *create_symbol_table(); 31 32 /* destroy symbol table */ 33 extern void destroy_symbol_table _((SymbolTable *symtab)); 34 35 /* Lookup symbol name */ 36 extern Symbol *find_symbol _((SymbolTable *symtab, char *name)); 37 38 /* Define new symbol */ 39 extern Symbol *new_symbol _((SymbolTable *symtab, char *name, int flags)); 40 41 #endif 42