-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathscope.h
More file actions
147 lines (125 loc) · 4.36 KB
/
scope.h
File metadata and controls
147 lines (125 loc) · 4.36 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#ifndef SCOPE_H
#define SCOPE_H
/** **********************************************************************
** Module: Scope \file scope.h
** Description: This module implements a hierarchical (i.e., scoped)
** symbol table. The symbol table can store definitions of entities,
** types, algorithms, and variables, as well as containing a list
** of subscopes.
** Constants:
** SCOPE_NULL - the null scope
**
************************************************************************/
/*
* This software was developed by U.S. Government employees as part of
* their official duties and is not subject to copyright.
*
* $Log: scope.h,v $
* Revision 1.10 1997/01/21 19:17:11 dar
* made C++ compatible
*
* Revision 1.9 1995/04/05 14:58:31 clark
* CADDETC preval
*
* Revision 1.8 1994/05/11 19:51:05 libes
* numerous fixes
*
* Revision 1.7 1993/10/15 18:48:24 libes
* CADDETC certified
*
* Revision 1.6 1993/01/19 22:16:43 libes
* *** empty log message ***
*
* Revision 1.5 1992/08/18 17:12:41 libes
* rm'd extraneous error messages
*
* Revision 1.4 1992/06/08 18:06:24 libes
* prettied up interface to print_objects_when_running
*/
/*************/
/* constants */
/*************/
#define SCOPE_NULL (Scope)0
/****************/
/* modules used */
/****************/
#include <scl_export.h>
#include "type.h"
#include "variable.h"
#include "entity.h"
#include "express.h"
#include "alg.h"
#include "schema.h"
/*****************/
/* packages used */
/*****************/
#include "expbasic.h" /* get basic definitions */
#include "dict.h"
#include "symbol.h"
/***************************/
/* hidden type definitions */
/***************************/
/* these allow one to give SCOPEfind hints to its search strategy */
#define SCOPE_FIND_TYPE OBJ_TYPE_BITS
#define SCOPE_FIND_ENTITY OBJ_ENTITY_BITS
#define SCOPE_FIND_FUNCTION OBJ_FUNCTION_BITS
#define SCOPE_FIND_PROCEDURE OBJ_PROCEDURE_BITS
#define SCOPE_FIND_VARIABLE OBJ_VARIABLE_BITS
#define SCOPE_FIND_ANYTHING OBJ_ANYTHING_BITS
struct Scope_ {
Symbol symbol;
char type; /* see above */
ClientData clientData; /**< user may use this for any purpose */
int search_id; /**< key to avoid searching this scope twice */
Dictionary symbol_table,enum_table;
struct Scope_ * superscope;
union {
struct Procedure_ * proc;
struct Function_ * func;
struct Rule_ * rule;
struct Entity_ * entity;
struct Schema_ * schema;
struct Express_ * express;
struct Increment_ * incr;
struct TypeHead_ * type;
/* no, query owns a scope rather than scope owning a query
* struct Query *query; */
} u;
Linked_List where; /**< optional where clause */
};
/********************/
/* global variables */
/********************/
#ifdef SCOPE_C
#include "defstart.h"
#else
#include "decstart.h"
#endif /* SCOPE_C */
#include "de_end.h"
/******************************/
/* macro function definitions */
/******************************/
#define SCOPEis(scope) ((scope)->type)
#define SCOPEis_schema(scope) ((scope)->type == OBJ_SCHEMA)
#define SCOPEget_symbol(scope) (&(scope)->symbol)
#define SCOPEput_name(scope,name) ((scope)->symbol.name = name)
#define SCOPEget_name(scope) ((scope)->symbol.name)
#define SCOPEget_resolved(scope) ((scope)->symbol.resolved)
#define SCOPEget_clientData(s) ((s)->clientData)
#define SCOPEput_clientData(s,d) ((s)->clientData = (d))
#define SCOPEdo_types(s,t,de) DICTdo_type_init(s->symbol_table,&de,OBJ_TYPE);{\
Type t; \
while (0 != (t = (Type)DICTdo(&de))) {
#define SCOPEdo_entities(s,t,de) DICTdo_type_init(s->symbol_table,&de,OBJ_ENTITY); { \
Entity t; \
while (0 != (t = (Entity)DICTdo(&de))) {
#define SCOPEod }}
/***********************/
/* function prototypes */
/***********************/
extern SCL_EXPRESS_EXPORT struct Symbol_ * SCOPE_get_symbol PROTO( ( Generic ) );
extern SCL_EXPRESS_EXPORT void SCOPE_get_entities PROTO( ( Scope, Linked_List ) );
extern SCL_EXPRESS_EXPORT Linked_List SCOPEget_entities PROTO( ( Scope ) );
extern SCL_EXPRESS_EXPORT Linked_List SCOPEget_entities_superclass_order PROTO( ( Scope ) );
extern SCL_EXPRESS_EXPORT Generic SCOPEfind PROTO( ( Scope, char *, int ) );
#endif /* SCOPE_H */