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
|
|
|
/* S C O P E M E C H A N I S M */
|
2019-03-01 17:39:25 +00:00
|
|
|
#ifndef SCOPE_H_
|
|
|
|
#define SCOPE_H_
|
|
|
|
|
2019-05-10 17:09:03 +00:00
|
|
|
struct def;
|
1987-04-29 10:22:07 +00:00
|
|
|
|
1986-03-26 15:11:02 +00:00
|
|
|
#define OPENSCOPE 0 /* Indicating an open scope */
|
|
|
|
#define CLOSEDSCOPE 1 /* Indicating a closed scope (module) */
|
|
|
|
|
1986-04-12 02:21:24 +00:00
|
|
|
#define SC_CHKFORW 1 /* Check for forward definitions when closing
|
|
|
|
a scope
|
|
|
|
*/
|
|
|
|
#define SC_CHKPROC 2 /* Check for forward procedure definitions
|
|
|
|
when closing a scope
|
|
|
|
*/
|
1986-04-22 22:36:16 +00:00
|
|
|
#define SC_REVERSE 4 /* Reverse list of definitions, to get it
|
|
|
|
back into original order
|
|
|
|
*/
|
1986-04-12 02:21:24 +00:00
|
|
|
|
1986-03-26 15:11:02 +00:00
|
|
|
struct scope {
|
1987-07-16 19:51:40 +00:00
|
|
|
/* struct scope *next; */
|
1986-04-18 17:53:47 +00:00
|
|
|
char *sc_name; /* name of this scope */
|
1986-03-29 01:04:49 +00:00
|
|
|
struct def *sc_def; /* list of definitions in this scope */
|
1986-04-15 17:51:53 +00:00
|
|
|
arith sc_off; /* offsets of variables in this scope */
|
|
|
|
char sc_scopeclosed; /* flag indicating closed or open scope */
|
1988-10-25 17:43:19 +00:00
|
|
|
char sc_defmodule; /* flag set is this scope is from a separate
|
|
|
|
definition module
|
|
|
|
*/
|
1986-04-18 17:53:47 +00:00
|
|
|
int sc_level; /* level of this scope */
|
1986-05-30 18:48:00 +00:00
|
|
|
struct def *sc_definedby; /* The def structure defining this scope */
|
1987-10-19 11:28:37 +00:00
|
|
|
struct node *sc_end; /* node to remember line number of end of scope */
|
1986-03-26 15:11:02 +00:00
|
|
|
};
|
|
|
|
|
1986-04-28 18:06:58 +00:00
|
|
|
struct scopelist {
|
1987-07-16 19:51:40 +00:00
|
|
|
struct scopelist *sc_next;
|
1986-04-28 18:06:58 +00:00
|
|
|
struct scope *sc_scope;
|
1986-05-16 17:15:36 +00:00
|
|
|
struct scopelist *sc_encl;
|
1990-07-30 15:56:25 +00:00
|
|
|
int sc_count;
|
1986-04-28 18:06:58 +00:00
|
|
|
};
|
|
|
|
|
1987-09-24 13:07:31 +00:00
|
|
|
|
2019-05-10 17:09:03 +00:00
|
|
|
|
|
|
|
extern struct scope
|
1986-12-01 10:06:53 +00:00
|
|
|
*PervasiveScope;
|
1986-03-26 15:11:02 +00:00
|
|
|
|
2019-05-10 17:09:03 +00:00
|
|
|
extern struct scopelist
|
1986-12-01 10:06:53 +00:00
|
|
|
*CurrVis, *GlobalVis;
|
1986-04-28 18:06:58 +00:00
|
|
|
|
|
|
|
#define CurrentScope (CurrVis->sc_scope)
|
1986-12-01 10:06:53 +00:00
|
|
|
#define GlobalScope (GlobalVis->sc_scope)
|
1986-04-28 18:06:58 +00:00
|
|
|
#define enclosing(x) ((x)->sc_encl)
|
1986-04-15 17:51:53 +00:00
|
|
|
#define scopeclosed(x) ((x)->sc_scopeclosed)
|
1987-07-16 19:51:40 +00:00
|
|
|
#define nextvisible(x) ((x)->sc_next) /* use with scopelists */
|
1987-04-29 10:22:07 +00:00
|
|
|
|
2019-03-01 17:39:25 +00:00
|
|
|
|
|
|
|
|
2019-05-10 17:09:03 +00:00
|
|
|
|
|
|
|
void Reverse(struct def **pdf);
|
2019-03-01 17:39:25 +00:00
|
|
|
void open_scope(int scopetype);
|
2019-05-10 17:09:03 +00:00
|
|
|
struct scope * open_and_close_scope(int scopetype);
|
2019-03-01 17:39:25 +00:00
|
|
|
void InitScope(void);
|
|
|
|
void close_scope(int flag);
|
|
|
|
#ifdef DEBUG
|
2019-05-10 17:09:03 +00:00
|
|
|
void DumpScope(register struct def *df);
|
2019-03-01 17:39:25 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* SCOPE_H_ */
|