1987-04-29 10:22:07 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*
|
|
|
|
* Author: Ceriel J.H. Jacobs
|
|
|
|
*/
|
|
|
|
|
1986-03-26 15:11:02 +00:00
|
|
|
/* I D E N T I F I E R D E S C R I P T O R S T R U C T U R E */
|
|
|
|
|
1987-04-29 10:22:07 +00:00
|
|
|
/* $Header$ */
|
|
|
|
|
1986-03-26 15:11:02 +00:00
|
|
|
struct module {
|
1986-12-01 10:06:53 +00:00
|
|
|
struct node *mo_priority;/* priority of a module */
|
1986-04-28 18:06:58 +00:00
|
|
|
struct scopelist *mo_vis;/* scope of this module */
|
1986-04-17 09:28:09 +00:00
|
|
|
struct node *mo_body; /* body of this module */
|
1986-03-29 01:04:49 +00:00
|
|
|
#define mod_priority df_value.df_module.mo_priority
|
1986-04-28 18:06:58 +00:00
|
|
|
#define mod_vis df_value.df_module.mo_vis
|
1986-04-17 09:28:09 +00:00
|
|
|
#define mod_body df_value.df_module.mo_body
|
1986-03-26 15:11:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct variable {
|
1986-04-04 13:47:04 +00:00
|
|
|
arith va_off; /* address or offset of variable */
|
1986-04-21 17:27:06 +00:00
|
|
|
char *va_name; /* name of variable if given */
|
1986-03-29 01:04:49 +00:00
|
|
|
#define var_off df_value.df_variable.va_off
|
1986-04-21 17:27:06 +00:00
|
|
|
#define var_name df_value.df_variable.va_name
|
1986-03-26 15:11:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct constant {
|
1987-07-30 13:37:39 +00:00
|
|
|
struct token co_const; /* result of a constant expression */
|
1986-04-08 18:15:46 +00:00
|
|
|
#define con_const df_value.df_constant.co_const
|
1986-03-26 15:11:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct enumval {
|
1987-06-18 15:46:08 +00:00
|
|
|
arith en_val; /* value of this enumeration literal */
|
1986-04-04 13:47:04 +00:00
|
|
|
struct def *en_next; /* next enumeration literal */
|
1986-03-29 01:04:49 +00:00
|
|
|
#define enm_val df_value.df_enum.en_val
|
|
|
|
#define enm_next df_value.df_enum.en_next
|
1986-03-26 15:11:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct field {
|
1986-03-29 01:04:49 +00:00
|
|
|
arith fd_off;
|
1986-03-26 15:11:02 +00:00
|
|
|
struct variant {
|
1986-03-29 01:04:49 +00:00
|
|
|
struct caselabellist *v_cases;
|
|
|
|
label v_casedescr;
|
|
|
|
struct def *v_varianttag;
|
|
|
|
} *fd_variant;
|
|
|
|
#define fld_off df_value.df_field.fd_off
|
|
|
|
#define fld_variant df_value.df_field.fd_variant
|
1986-03-26 15:11:02 +00:00
|
|
|
};
|
|
|
|
|
1986-04-04 13:47:04 +00:00
|
|
|
struct dfproc {
|
1986-04-28 18:06:58 +00:00
|
|
|
struct scopelist *pr_vis; /* scope of procedure */
|
1986-04-17 09:28:09 +00:00
|
|
|
struct node *pr_body; /* body of this procedure */
|
1986-04-28 18:06:58 +00:00
|
|
|
#define prc_vis df_value.df_proc.pr_vis
|
1986-04-17 09:28:09 +00:00
|
|
|
#define prc_body df_value.df_proc.pr_body
|
1986-06-04 09:01:48 +00:00
|
|
|
#define NameOfProc(xdf) ((xdf)->prc_vis->sc_scope->sc_name)
|
1986-04-04 13:47:04 +00:00
|
|
|
};
|
|
|
|
|
1986-03-26 15:11:02 +00:00
|
|
|
struct import {
|
1986-04-12 02:21:24 +00:00
|
|
|
struct def *im_def; /* imported definition */
|
|
|
|
#define imp_def df_value.df_import.im_def
|
|
|
|
};
|
|
|
|
|
|
|
|
struct dforward {
|
1986-04-28 18:06:58 +00:00
|
|
|
struct scopelist *fo_vis;
|
1986-04-12 02:21:24 +00:00
|
|
|
struct node *fo_node;
|
1986-04-21 17:27:06 +00:00
|
|
|
char *fo_name;
|
1986-04-12 02:21:24 +00:00
|
|
|
#define for_node df_value.df_forward.fo_node
|
1986-04-28 18:06:58 +00:00
|
|
|
#define for_vis df_value.df_forward.fo_vis
|
1986-04-21 17:27:06 +00:00
|
|
|
#define for_name df_value.df_forward.fo_name
|
1986-03-26 15:11:02 +00:00
|
|
|
};
|
|
|
|
|
1986-11-26 16:40:45 +00:00
|
|
|
struct forwtype {
|
|
|
|
struct node *f_node;
|
|
|
|
#define df_forw_node df_value.df_fortype.f_node
|
|
|
|
};
|
|
|
|
|
1986-03-26 15:11:02 +00:00
|
|
|
struct def { /* list of definitions for a name */
|
1987-07-16 19:51:40 +00:00
|
|
|
struct def *df_next; /* next definition in definitions chain */
|
1986-03-29 01:04:49 +00:00
|
|
|
struct def *df_nextinscope;
|
|
|
|
/* link all definitions in a scope */
|
1986-03-26 15:11:02 +00:00
|
|
|
struct idf *df_idf; /* link back to the name */
|
1986-04-15 17:51:53 +00:00
|
|
|
struct scope *df_scope; /* scope in which this definition resides */
|
1986-11-26 16:40:45 +00:00
|
|
|
unsigned short df_kind; /* the kind of this definition: */
|
1986-04-04 13:47:04 +00:00
|
|
|
#define D_MODULE 0x0001 /* a module */
|
|
|
|
#define D_PROCEDURE 0x0002 /* procedure of function */
|
|
|
|
#define D_VARIABLE 0x0004 /* a variable */
|
|
|
|
#define D_FIELD 0x0008 /* a field in a record */
|
|
|
|
#define D_TYPE 0x0010 /* a type */
|
|
|
|
#define D_ENUM 0x0020 /* an enumeration literal */
|
|
|
|
#define D_CONST 0x0040 /* a constant */
|
|
|
|
#define D_IMPORT 0x0080 /* an imported definition */
|
|
|
|
#define D_PROCHEAD 0x0100 /* a procedure heading in a definition module */
|
|
|
|
#define D_HIDDEN 0x0200 /* a hidden type */
|
1986-10-06 20:36:30 +00:00
|
|
|
#define D_FORWARD 0x0400 /* not yet defined */
|
|
|
|
#define D_FORWMODULE 0x0800 /* module must be declared later */
|
1986-11-26 16:40:45 +00:00
|
|
|
#define D_FORWTYPE 0x1000 /* forward type */
|
|
|
|
#define D_FTYPE 0x2000 /* resolved forward type */
|
|
|
|
#define D_ERROR 0x4000 /* a compiler generated definition for an
|
1986-03-27 17:37:41 +00:00
|
|
|
undefined variable
|
|
|
|
*/
|
1986-10-06 20:36:30 +00:00
|
|
|
#define D_VALUE (D_PROCEDURE|D_VARIABLE|D_FIELD|D_ENUM|D_CONST|D_PROCHEAD)
|
1986-11-26 16:40:45 +00:00
|
|
|
#define D_ISTYPE (D_HIDDEN|D_TYPE|D_FTYPE)
|
1986-05-28 18:36:51 +00:00
|
|
|
#define is_type(dfx) ((dfx)->df_kind & D_ISTYPE)
|
1986-12-16 15:22:33 +00:00
|
|
|
unsigned short df_flags;
|
1986-05-28 18:36:51 +00:00
|
|
|
#define D_NOREG 0x01 /* set if it may not reside in a register */
|
1986-11-17 11:41:28 +00:00
|
|
|
#define D_USED 0x02 /* set if used (future use ???) */
|
|
|
|
#define D_DEFINED 0x04 /* set if it is assigned a value (future use ???) */
|
1986-11-26 16:40:45 +00:00
|
|
|
#define D_VARPAR 0x08 /* set if it is a VAR parameter */
|
|
|
|
#define D_VALPAR 0x10 /* set if it is a value parameter */
|
|
|
|
#define D_EXPORTED 0x20 /* set if exported */
|
|
|
|
#define D_QEXPORTED 0x40 /* set if qualified exported */
|
1986-12-16 15:22:33 +00:00
|
|
|
#define D_BUSY 0x80 /* set if busy reading this definition module */
|
1987-04-29 10:22:07 +00:00
|
|
|
#define D_FOREIGN 0x100 /* set for foreign language modules */
|
1987-06-29 12:46:00 +00:00
|
|
|
#define D_ADDRGIVEN 0x200 /* set if address given for variable */
|
1986-03-26 15:11:02 +00:00
|
|
|
struct type *df_type;
|
|
|
|
union {
|
|
|
|
struct module df_module;
|
|
|
|
struct variable df_variable;
|
|
|
|
struct constant df_constant;
|
|
|
|
struct enumval df_enum;
|
|
|
|
struct field df_field;
|
|
|
|
struct import df_import;
|
1986-04-04 13:47:04 +00:00
|
|
|
struct dfproc df_proc;
|
1986-04-12 02:21:24 +00:00
|
|
|
struct dforward df_forward;
|
1986-11-26 16:40:45 +00:00
|
|
|
struct forwtype df_fortype;
|
1986-04-04 13:47:04 +00:00
|
|
|
int df_stdname; /* define for standard name */
|
1986-03-26 15:11:02 +00:00
|
|
|
} df_value;
|
|
|
|
};
|
|
|
|
|
1986-10-06 20:36:30 +00:00
|
|
|
/* ALLOCDEF "def" 50 */
|
1986-03-26 15:11:02 +00:00
|
|
|
|
1986-03-27 17:37:41 +00:00
|
|
|
extern struct def
|
1986-03-26 15:11:02 +00:00
|
|
|
*define(),
|
1986-06-17 12:04:05 +00:00
|
|
|
*DefineLocalModule(),
|
|
|
|
*MkDef(),
|
1986-10-06 20:36:30 +00:00
|
|
|
*DeclProc();
|
1986-03-27 17:37:41 +00:00
|
|
|
|
1986-06-17 12:04:05 +00:00
|
|
|
extern struct def
|
|
|
|
*lookup(),
|
|
|
|
*lookfor();
|
1986-03-27 17:37:41 +00:00
|
|
|
#define NULLDEF ((struct def *) 0)
|