-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsymtab.h
224 lines (198 loc) · 6.57 KB
/
symtab.h
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
/**
* $Id: symtab.h,v 1.7 2009/01/08 16:46:33 buccella Exp $
*
* (C) Copyright IBM Corp. 2004
*
* THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
* ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
* CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
*
* You can obtain a current copy of the Eclipse Public License from
* http://www.opensource.org/licenses/eclipse-1.0.php
*
* Author: Viktor Mihajlovski <[email protected]>
* Contributors:
*
* Description: MOF Compiler Symbol Table
*
*/
# if ! defined SYMTABH
# define SYMTABH
# include <hash.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define CLASS_ASSOCIATION 0x0001
#define CLASS_INDICATION 0x0002
#define CLASS_FORWARDDECL 0x0100
#define CLASS_COMPLETED 0x0200
#define PROPERTY_KEY 0x0001
#define PARAMETER_IN 0x0001
#define PARAMETER_OUT 0x0002
//Qualifier Flavor
#define Qual_F_DisableOverride 1 //default is Overriddable,different default than objectImpl
#define Qual_F_Restricted 2 //default is ToSubclass,different default than objectImpl
#define Qual_F_ToInstance 4 //deprecated
#define Qual_F_Translatable 8 //default is no
//Qualifier Scope
#define Qual_S_Class 1
#define Qual_S_Association 2
#define Qual_S_Reference 4
#define Qual_S_Property 8
#define Qual_S_Method 16
#define Qual_S_Parameter 32
#define Qual_S_Indication 64
#define Qual_S_Any 255
extern void yyerror( char * ); /* introduce YACC error function */
typedef struct class_struct class_entry;
typedef struct class_ch_struct {
class_entry * class_item;
struct class_ch_struct * class_next;
} class_chain;
typedef union {
int type_base;
class_entry * type_ref;
} type_type;
typedef struct value_struct {
char * val_value;
struct value_struct * val_next; /* link pointer */
} value_chain;
typedef struct qual_quals_struct {
unsigned char scope;
unsigned char flavor;
} qual_quals;
typedef struct qual_def_struct {
char * qual_id;
type_type qual_type;
int qual_array;
value_chain * qual_defval;
qual_quals qual_attrs; //scope&flavor
} qual_entry;
typedef struct qual_struct {
char * qual_id;
qual_entry * qual_qual;
value_chain * qual_vals;
struct qual_struct * qual_next; /* link pointer */
} qual_chain;
typedef struct param_struct {
char * param_id;
unsigned param_attr;
type_type param_type;
int param_array;
value_chain * param_value;
qual_chain * param_quals;
struct param_struct * param_next; /* link pointer */
} param_chain;
typedef struct method_struct {
char * method_id;
char * method_class;
type_type method_type;
int method_array;
qual_chain * method_quals;
param_chain * method_params;
struct method_struct * method_next; /* link pointer */
} method_chain;
typedef struct prop_struct {
char * prop_id;
char * prop_class;
unsigned prop_attr;
type_type prop_type;
int prop_array;
value_chain * prop_value;
qual_chain * prop_quals;
struct prop_struct * prop_next; /* link pointer */
} prop_chain;
typedef struct prop_or_method_struct {
prop_chain * pom_props;
method_chain * pom_methods;
} prop_or_method_list;
struct class_struct {
char * class_id;
unsigned class_attr;
struct class_struct * class_parent;
qual_chain * class_quals;
prop_chain * class_props;
method_chain * class_methods;
int instmig;
};
typedef struct symtab_struct {
enum {
SYM_TOKEN,
SYM_CLASS,
SYM_QUAL,
} sym_type;
union {
int sym_token;
class_entry * sym_class;
qual_entry * sym_qual;
} sym_union;
} symtab_entry;
symtab_entry * make_token( int token_value );
void add_class_list(class_chain * cl_ch, class_entry * cls);
void add_qual_list(qual_chain * qu_ch, qual_entry * q);
class_entry * get_class_from_list(class_chain * cl_ch, char * name);
#ifndef ONEPASS
void fix_forward_decls(class_chain * cl_ch);
#endif
class_entry * make_class(hashentry * he,
qual_chain * qu_ch,
const char * name,
class_entry * parent,
prop_or_method_list * pom_li);
class_entry * get_class_def( hashentry * he, const char * name );
qual_entry * make_qualifier_definition(hashentry * he,
const char * name,
type_type typeid,
char * arrayspec,
value_chain * pr_ch,
qual_quals sf);
type_type make_ref_type( hashentry * he, const char * name );
qual_chain * make_qualifier(hashentry * he,
const char * name,
value_chain * val_ch );
qual_entry * get_qual_def( hashentry * he, const char * name );
void qualifier_list_add( qual_chain * qu_ch1, qual_chain * qu_ch2 );
value_chain * make_value_list(const char * value);
void value_list_add(value_chain * val_ch1, const char * val);
char * make_string(const char * string);
char * make_char(const char * string);
char * append_string(char * string1, const char * string2);
prop_or_method_list * make_pom_list(qual_chain * qu_ch,
type_type typeid,
const char * name,
const char * arrayspec,
param_chain * pa_ch,
value_chain * va_ch
);
void pom_list_add(prop_or_method_list * pom_li1, prop_or_method_list * pom_li2);
prop_chain * make_property_chain(qual_chain * qu_ch,
type_type typeid,
const char * name,
const char * arrayspec,
value_chain * va_ch
);
method_chain * make_method_chain(qual_chain * qu_ch,
type_type typeid,
const char * name,
const char * arrayspec,
param_chain * pa_ch
);
param_chain * make_param_list(qual_chain * qu_ch,
type_type typeid,
const char * name,
const char * arrayspec
);
void param_list_add(param_chain * pa_ch1, param_chain * pa_ch2);
class_entry * make_instance(hashentry * he,
qual_chain * qu_ch,
const char * name,
prop_or_method_list * pom_li,
int instmig);
prop_chain * check_for_prop(class_entry * e, char * prop_id);
prop_chain * check_for_parent_prop(class_entry * e, char * prop_id);
int check_for_keys(class_entry * ce, class_entry * ie);
class_entry * get_class_def_for_instance(class_entry * ie);
int check_valid_props(class_entry * ce, class_entry * ie);
int make_scope(char * scopeVal);
int make_flavor(char * flavorVal);
# endif