]> granicus.if.org Git - flex/commitdiff
moved symbol table definitions from flexdef.h into sym.c
authorVern Paxson <vern@ee.lbl.gov>
Mon, 21 Aug 2000 16:38:02 +0000 (16:38 +0000)
committerVern Paxson <vern@ee.lbl.gov>
Mon, 21 Aug 2000 16:38:02 +0000 (16:38 +0000)
flexdef.h
sym.c

index c4de2e0da49459023b282c9bc1853db87338dbda..b51264a2c31e646c1b14e192ca13221ae16cfa57 100644 (file)
--- a/flexdef.h
+++ b/flexdef.h
 
 /* 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 1d24a43c602c5ab4af29a8d403412d807cc8cb31..a7dd20ba15a6bc3060c8cbb1c0442fe467f7b54b 100644 (file)
--- a/sym.c
+++ b/sym.c
 
 #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;
        {