scyther/src/symbol.h

49 lines
989 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
enum symboltypes { T_UNDEF = -1, T_PROTOCOL, T_CONST, T_VAR, T_SYSCONST };
2004-04-23 11:58:43 +01:00
#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.
const 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 (const Symbol s);
2004-04-23 11:58:43 +01:00
void insert (const Symbol s);
Symbol lookup (const char *s);
void symbolPrint (const Symbol s);
void symbolPrintAll (void);
Symbol symbolSysConst (const char *str);
2004-04-23 11:58:43 +01:00
void eprintf (char *fmt, ... );
extern int globalError;
2004-04-23 11:58:43 +01:00
#endif