summaryrefslogtreecommitdiff
path: root/src/icont/tsym.h
blob: a932345a6bed262cced0fa9e051ddde6d8d07135 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
 * Structures for symbol table entries.
 */

struct tlentry {			/* local table entry */
   struct tlentry *l_blink;	/*   link for bucket chain */
   char *l_name;		/*   name of variable */
   int l_flag;			/*   variable flags */
   int l_index;			/*   "index" of local in table */
   struct tlentry *l_next;      /*   next local in table */
   };

struct tgentry {			/* global table entry */
   struct tgentry *g_blink;	/*   link for bucket chain */
   char *g_name;		/*   name of variable */
   int g_flag;			/*   variable flags */
   int g_nargs;			/*   number of args (procedure) or */
   int g_index;			/*   "index" of global in table */
   struct tgentry *g_next;      /*   next global in table */
   };				/*     number of fields (record) */

struct tcentry {			/* constant table entry */
   struct tcentry *c_blink;	/*   link for bucket chain */
   char *c_name;		/*   pointer to string */
   int c_length;		/*   length of string */
   int c_flag;			/*   type of literal flag */
   int c_index;			/*   "index" of constant in table */
   struct tcentry *c_next;      /*   next constant in table */
   };

/*
 * Flag values.
 */

#define F_Global	    01	/* variable declared global externally */
#define F_Proc		    04	/* procedure */
#define F_Record	   010	/* record */
#define F_Dynamic	   020	/* variable declared local dynamic */
#define F_Static	   040	/* variable declared local static */
#define F_Builtin	  0100	/* identifier refers to built-in procedure */
#define F_ImpError	  0400	/* procedure has default error */
#define F_Argument	 01000	/* variable is a formal parameter */
#define F_IntLit	 02000	/* literal is an integer */
#define F_RealLit	 04000	/* literal is a real */
#define F_StrLit	010000	/* literal is a string */
#define F_CsetLit	020000	/* literal is a cset */

/*
 * Symbol table region pointers.
 */

extern struct tlentry **lhash;	/* hash area for local table */
extern struct tgentry **ghash;	/* hash area for global table */
extern struct tcentry **chash;	/* hash area for constant table */

extern struct tlentry *lfirst;	/* first local table entry */
extern struct tlentry *llast;	/* last local table entry */
extern struct tcentry *cfirst;	/* first constant table entry */
extern struct tcentry *clast;	/* last constant table entry */
extern struct tgentry *gfirst;	/* first global table entry */
extern struct tgentry *glast;	/* last global table entry */

/*
 * Hash functions for symbol tables.
 */

#define ghasher(x)	(((word)x)&gmask)	 /* global symbol table */
#define lhasher(x)	(((word)x)&lmask)	 /* local symbol table */
#define chasher(x)	(((word)x)&cmask)	 /* constant symbol table */