summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVern Paxson <vern@ee.lbl.gov>2000-08-21 16:38:02 +0000
committerVern Paxson <vern@ee.lbl.gov>2000-08-21 16:38:02 +0000
commit27a4656e92b48bd9025c57ac336947dd1e26cd56 (patch)
tree55390d1173e517a23a3efd61c02595fec3144c23
parent74656baab5891186cccfe78058862ac0f7f2c65d (diff)
moved symbol table definitions from flexdef.h into sym.c
-rw-r--r--flexdef.h30
-rw-r--r--sym.c37
2 files changed, 28 insertions, 39 deletions
diff --git a/flexdef.h b/flexdef.h
index c4de2e0..b51264a 100644
--- a/flexdef.h
+++ b/flexdef.h
@@ -314,30 +314,6 @@
/* Declarations for global variables. */
-/* Variables for symbol tables:
- * sctbl - start-condition symbol table
- * ndtbl - name-definition symbol table
- * ccltab - character class text symbol table
- */
-
-struct hash_entry
- {
- struct hash_entry *prev, *next;
- char *name;
- char *str_val;
- int int_val;
- } ;
-
-typedef struct hash_entry **hash_table;
-
-#define NAME_TABLE_HASH_SIZE 101
-#define START_COND_HASH_SIZE 101
-#define CCL_HASH_SIZE 101
-
-extern struct hash_entry *ndtbl[NAME_TABLE_HASH_SIZE];
-extern struct hash_entry *sctbl[START_COND_HASH_SIZE];
-extern struct hash_entry *ccltab[CCL_HASH_SIZE];
-
/* Variables for flags:
* printstats - if true (-v), dump statistics
@@ -995,18 +971,12 @@ extern int yywrap PROTO((void));
/* from file sym.c */
-/* Add symbol and definitions to symbol table. */
-extern int addsym PROTO((register char[], char*, int, hash_table, int));
-
/* Save the text of a character class. */
extern void cclinstal PROTO ((Char [], int));
/* Lookup the number associated with character class. */
extern int ccllookup PROTO((Char []));
-/* Find symbol in symbol table. */
-extern struct hash_entry *findsym PROTO((register char[], hash_table, int ));
-
extern void ndinstal PROTO((char[], Char[])); /* install a name definition */
extern Char *ndlookup PROTO((char[])); /* lookup a name definition */
diff --git a/sym.c b/sym.c
index 1d24a43..a7dd20b 100644
--- a/sym.c
+++ b/sym.c
@@ -30,17 +30,36 @@
#include "flexdef.h"
+/* Variables for symbol tables:
+ * sctbl - start-condition symbol table
+ * ndtbl - name-definition symbol table
+ * ccltab - character class text symbol table
+ */
-/* declare functions that have forward references */
+struct hash_entry
+ {
+ struct hash_entry *prev, *next;
+ char *name;
+ char *str_val;
+ int int_val;
+ } ;
-int hashfunct PROTO((register char[], int));
+typedef struct hash_entry **hash_table;
+#define NAME_TABLE_HASH_SIZE 101
+#define START_COND_HASH_SIZE 101
+#define CCL_HASH_SIZE 101
-struct hash_entry *ndtbl[NAME_TABLE_HASH_SIZE];
-struct hash_entry *sctbl[START_COND_HASH_SIZE];
-struct hash_entry *ccltab[CCL_HASH_SIZE];
+static struct hash_entry *ndtbl[NAME_TABLE_HASH_SIZE];
+static struct hash_entry *sctbl[START_COND_HASH_SIZE];
+static struct hash_entry *ccltab[CCL_HASH_SIZE];
+
+
+/* declare functions that have forward references */
-struct hash_entry *findsym();
+static int addsym PROTO((register char[], char*, int, hash_table, int));
+static struct hash_entry *findsym();
+static int hashfunct PROTO((register char[], int));
/* addsym - add symbol and definitions to symbol table
@@ -48,7 +67,7 @@ struct hash_entry *findsym();
* -1 is returned if the symbol already exists, and the change not made.
*/
-int addsym( sym, str_def, int_def, table, table_size )
+static int addsym( sym, str_def, int_def, table, table_size )
register char sym[];
char *str_def;
int int_def;
@@ -127,7 +146,7 @@ Char ccltxt[];
/* findsym - find symbol in symbol table */
-struct hash_entry *findsym( sym, table, table_size )
+static struct hash_entry *findsym( sym, table, table_size )
register char sym[];
hash_table table;
int table_size;
@@ -153,7 +172,7 @@ int table_size;
/* hashfunct - compute the hash value for "str" and hash size "hash_size" */
-int hashfunct( str, hash_size )
+static int hashfunct( str, hash_size )
register char str[];
int hash_size;
{