home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume29 / cproto / part02 / symbol.h < prev   
C/C++ Source or Header  |  1992-04-06  |  776b  |  28 lines

  1. /* $Id: symbol.h 3.3 92/03/14 11:57:48 cthuang Exp $
  2.  *
  3.  * A symbol table is a collection of string identifiers stored in a
  4.  * hash table.
  5.  */
  6. #ifndef SYMBOL_H
  7. #define SYMBOL_H
  8.  
  9. typedef struct symbol {
  10.     struct symbol *next;    /* next symbol in list */
  11.     char *name;         /* name of symbol */
  12.     unsigned short flags;    /* symbol attributes */
  13. } Symbol;
  14.  
  15. /* The hash table length should be a prime number. */
  16. #define SYM_MAX_HASH 251
  17.  
  18. typedef struct symbol_table {
  19.     Symbol *bucket[SYM_MAX_HASH];    /* hash buckets */
  20. } SymbolTable;
  21.  
  22. extern SymbolTable *new_symbol_table(); /* Create symbol table */
  23. extern void free_symbol_table();    /* Destroy symbol table */
  24. extern Symbol *find_symbol();        /* Lookup symbol name */
  25. extern Symbol *new_symbol();        /* Define new symbol */
  26.  
  27. #endif
  28.