ack/util/grind/symbol.hh

60 lines
1.7 KiB
C++
Raw Normal View History

1990-09-19 14:31:12 +00:00
/* $Header$ */
/* Symbol table data structure.
1990-08-31 18:22:53 +00:00
Each identifier structure refers to a list of possible meanings of this
identifier. Each of these meanings is represented by a "symbol" structure.
*/
typedef union constant { /* depends on type */
long co_ival;
double co_rval;
char *co_sval;
char *co_setval;
} t_const, *p_const;
typedef struct name {
long nm_value; /* address or offset */
struct scope *nm_scope; /* for names that define a scope */
} t_name, *p_name;
typedef struct symbol {
struct symbol *sy_next; /* link to next meaning */
struct symbol *sy_prev_sc; /* link to previous decl in scope */
struct type *sy_type; /* type of symbol */
int sy_class;
#define CONST 0x0001
#define TYPE 0x0002
#define TAG 0x0004
#define MODULE 0x0008
#define PROC 0x0010
#define FUNCTION 0x0020
#define VAR 0x0040
#define REGVAR 0x0080
#define LOCVAR 0x0100
#define VARPAR 0x0200
1990-09-07 14:56:24 +00:00
#define FIELD 0x0400
1990-08-31 18:22:53 +00:00
#define FILESYM 0x0800 /* a filename */
#define FILELINK 0x1000 /* a filename without its suffix */
struct idf *sy_idf; /* reference back to its idf structure */
struct scope *sy_scope; /* scope in which this symbol resides */
union {
t_const syv_const; /* CONST */
t_name syv_name;
struct file *syv_file; /* for FILESYM */
struct symbol *syv_fllink; /* for FILELINK */
1990-09-07 14:56:24 +00:00
struct fields *syv_field;
1990-08-31 18:22:53 +00:00
} sy_v;
#define sy_const sy_v.syv_const
#define sy_name sy_v.syv_name
#define sy_file sy_v.syv_file
#define sy_filelink sy_v.syv_fllink
1990-09-07 14:56:24 +00:00
#define sy_field sy_v.syv_field
1990-08-31 18:22:53 +00:00
} t_symbol, *p_symbol;
/* ALLOCDEF "symbol" 50 */
1990-09-19 14:31:12 +00:00
extern p_symbol NewSymbol(), Lookup(), Lookfromscope(), add_file();
1990-08-31 18:22:53 +00:00
extern p_symbol identify();
1990-09-21 16:58:20 +00:00
extern p_symbol currfile, listfile;