summaryrefslogtreecommitdiff
path: root/symbol.h
diff options
context:
space:
mode:
Diffstat (limited to 'symbol.h')
-rw-r--r--symbol.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/symbol.h b/symbol.h
new file mode 100644
index 0000000..2ce0f5f
--- /dev/null
+++ b/symbol.h
@@ -0,0 +1,41 @@
+/* $Id: symbol.h,v 1.1 2004-05-03 05:17:48 behdad Exp $
+ *
+ * Definitions for a symbol table
+ */
+#include "config.h"
+
+#ifndef _SYMBOL_H
+#define _SYMBOL_H
+
+typedef struct _symbol {
+ struct _symbol *next; /* next symbol in list */
+ char *name; /* name of symbol */
+ unsigned short flags; /* symbol attributes */
+
+ enum { SYMVAL_NONE, SYMVAL_ENUM } valtype;
+
+ union {
+ struct _enumerator_list *enum_list;
+ } value;
+} Symbol;
+
+/* The hash table length should be a prime number. */
+#define SYM_MAX_HASH 251
+
+typedef struct _symbol_table {
+ Symbol *bucket[SYM_MAX_HASH]; /* hash buckets */
+} SymbolTable;
+
+/* Create symbol table */
+extern SymbolTable *create_symbol_table();
+
+/* destroy symbol table */
+extern void destroy_symbol_table _((SymbolTable *symtab));
+
+/* Lookup symbol name */
+extern Symbol *find_symbol _((SymbolTable *symtab, char *name));
+
+/* Define new symbol */
+extern Symbol *new_symbol _((SymbolTable *symtab, char *name, int flags));
+
+#endif