home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cproto.zip / cproto46 / symbol.h < prev    next >
C/C++ Source or Header  |  1994-10-12  |  939b  |  33 lines

  1. /* $Id: symbol.h,v 4.1 1994/10/12 14:12: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.     char *value;        /* value of symbol (for defines) */
  13.     short flags;        /* symbol attributes */
  14. } Symbol;
  15.  
  16. /* The hash table length should be a prime number. */
  17. #define SYM_MAX_HASH 251
  18.  
  19. typedef struct symbol_table {
  20.     Symbol *bucket[SYM_MAX_HASH];    /* hash buckets */
  21. } SymbolTable;
  22.  
  23. extern SymbolTable *new_symbol_table    /* Create symbol table */
  24.     ARGS((void));
  25. extern void free_symbol_table        /* Destroy symbol table */
  26.     ARGS((SymbolTable *s));
  27. extern Symbol *find_symbol        /* Lookup symbol name */
  28.     ARGS((SymbolTable *s, char *n));
  29. extern Symbol *new_symbol        /* Define new symbol */
  30.     ARGS((SymbolTable *s, char *n, char *v, int f));
  31.  
  32. #endif
  33.