scyther/src/symbols.h

48 lines
890 B
C
Raw Normal View History

2004-04-23 11:58:43 +01:00
#ifndef SYMBOLS
#define SYMBOLS
2004-05-15 16:45:08 +01:00
//! Size of symbol hashtable.
/** Optimistically large. Should be a prime, says theory.
*/
2004-04-23 11:58:43 +01:00
#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
{
2004-05-15 16:45:08 +01:00
//! Type of symbol.
/**
*\sa T_UNDEF, T_PROTOCOL, T_CONST, T_VAR, T_SYSCONST
*/
2004-04-23 11:58:43 +01:00
int type;
2004-05-15 16:45:08 +01:00
//! Line number at which it occurred.
2004-04-23 11:58:43 +01:00
int lineno;
2004-05-15 16:45:08 +01:00
//! Ascii string with name of the symbol.
2004-04-23 11:58:43 +01:00
char *text;
2004-05-15 16:45:08 +01:00
//! Possible next pointer.
2004-04-23 11:58:43 +01:00
struct symbol *next;
2004-05-15 16:45:08 +01:00
//! Used for linking all symbol blocks, freed or in use.
2004-04-23 11:58:43 +01:00
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