60b02eea0e
Exception: states.h is the plural form.
48 lines
890 B
C
48 lines
890 B
C
#ifndef SYMBOLS
|
|
#define SYMBOLS
|
|
|
|
//! Size of symbol hashtable.
|
|
/** Optimistically large. Should be a prime, says theory.
|
|
*/
|
|
#define HASHSIZE 997
|
|
|
|
#define T_UNDEF -1
|
|
#define T_PROTOCOL 0
|
|
#define T_CONST 1
|
|
#define T_VAR 2
|
|
#define T_SYSCONST 3
|
|
|
|
#define EOS 0
|
|
|
|
struct symbol
|
|
{
|
|
//! Type of symbol.
|
|
/**
|
|
*\sa T_UNDEF, T_PROTOCOL, T_CONST, T_VAR, T_SYSCONST
|
|
*/
|
|
int type;
|
|
//! Line number at which it occurred.
|
|
int lineno;
|
|
//! Ascii string with name of the symbol.
|
|
char *text;
|
|
//! Possible next pointer.
|
|
struct symbol *next;
|
|
//! Used for linking all symbol blocks, freed or in use.
|
|
struct symbol *allocnext;
|
|
};
|
|
|
|
typedef struct symbol *Symbol;
|
|
|
|
void symbolsInit (void);
|
|
void symbolsDone (void);
|
|
|
|
Symbol get_symb (void);
|
|
void free_symb (Symbol s);
|
|
|
|
void insert (Symbol s);
|
|
Symbol lookup (char *s);
|
|
void symbolPrint (Symbol s);
|
|
Symbol symbolSysConst (char *str);
|
|
|
|
#endif
|