1 | /************************************************************************** |
---|
2 | |
---|
3 | IDL.h (IDL parse tree and namespace components) |
---|
4 | |
---|
5 | Copyright (C) 1998, 1999 Andrew T. Veliath |
---|
6 | |
---|
7 | This library is free software; you can redistribute it and/or |
---|
8 | modify it under the terms of the GNU Library General Public |
---|
9 | License as published by the Free Software Foundation; either |
---|
10 | version 2 of the License, or (at your option) any later version. |
---|
11 | |
---|
12 | This library is distributed in the hope that it will be useful, |
---|
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
15 | Library General Public License for more details. |
---|
16 | |
---|
17 | You should have received a copy of the GNU Library General Public |
---|
18 | License along with this library; if not, write to the Free |
---|
19 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
20 | |
---|
21 | $Id: IDL.h.new.in,v 1.1.1.1 2002-12-26 17:10:36 ghudson Exp $ |
---|
22 | |
---|
23 | ***************************************************************************/ |
---|
24 | #ifndef __IDL_H |
---|
25 | #define __IDL_H |
---|
26 | |
---|
27 | #include <glib.h> |
---|
28 | |
---|
29 | /* Try to find wchar_t support */ |
---|
30 | #include <stdlib.h> |
---|
31 | #if @HAVE_WCHAR_H@ /* HAVE_WCHAR_H */ |
---|
32 | # include <wchar.h> |
---|
33 | #endif |
---|
34 | #if @HAVE_WCSTR_H@ /* HAVE_WCSTR_H */ |
---|
35 | # include <wcstr.h> |
---|
36 | #endif |
---|
37 | |
---|
38 | #ifdef __cplusplus |
---|
39 | extern "C" { |
---|
40 | #endif |
---|
41 | |
---|
42 | #include <stdio.h> |
---|
43 | |
---|
44 | /* version */ |
---|
45 | #define LIBIDL_GEN_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) |
---|
46 | #define LIBIDL_MAJOR_VERSION @LIBIDL_MAJOR_VERSION@ |
---|
47 | #define LIBIDL_MINOR_VERSION @LIBIDL_MINOR_VERSION@ |
---|
48 | #define LIBIDL_MICRO_VERSION @LIBIDL_MICRO_VERSION@ |
---|
49 | #define LIBIDL_VERSION_CODE LIBIDL_GEN_VERSION(@LIBIDL_MAJOR_VERSION@,@LIBIDL_MINOR_VERSION@,@LIBIDL_MICRO_VERSION@) |
---|
50 | |
---|
51 | /* miscellaneous constants */ |
---|
52 | #define IDL_SUCCESS 0 |
---|
53 | #define IDL_ERROR 1 |
---|
54 | #define IDL_WARNING1 2 |
---|
55 | #define IDL_WARNING2 3 |
---|
56 | #define IDL_WARNING3 4 |
---|
57 | #define IDL_WARNINGMAX IDL_WARNING3 |
---|
58 | |
---|
59 | /* general parse flags */ |
---|
60 | #define IDLF_VERBOSE (1UL << 0) |
---|
61 | #define IDLF_NO_EVAL_CONST (1UL << 1) |
---|
62 | #define IDLF_COMBINE_REOPENED_MODULES (1UL << 2) |
---|
63 | #define IDLF_PREFIX_FILENAME (1UL << 3) |
---|
64 | #define IDLF_IGNORE_FORWARDS (1UL << 4) |
---|
65 | #define IDLF_PEDANTIC (1UL << 5) |
---|
66 | #define IDLF_INHIBIT_TAG_ONLY (1UL << 6) |
---|
67 | #define IDLF_INHIBIT_INCLUDES (1UL << 7) |
---|
68 | #define IDLF_SHOW_CPP_ERRORS (1UL << 8) |
---|
69 | |
---|
70 | /* syntax extension parse flags */ |
---|
71 | #define IDLF_TYPECODES (1UL << 16) |
---|
72 | #define IDLF_XPIDL (1UL << 17) |
---|
73 | #define IDLF_PROPERTIES (1UL << 18) |
---|
74 | #define IDLF_CODEFRAGS (1UL << 19) |
---|
75 | #define IDLF_SRCFILES (1UL << 20) |
---|
76 | |
---|
77 | /* declaration specification flags */ |
---|
78 | #define IDLF_DECLSPEC_EXIST (1UL << 0) |
---|
79 | #define IDLF_DECLSPEC_INHIBIT (1UL << 1) |
---|
80 | #define IDLF_DECLSPEC_PIDL (1UL << 2) |
---|
81 | |
---|
82 | /* output flags */ |
---|
83 | #define IDLF_OUTPUT_NO_NEWLINES (1UL << 0) |
---|
84 | #define IDLF_OUTPUT_NO_QUALIFY_IDENTS (1UL << 1) |
---|
85 | #define IDLF_OUTPUT_PROPERTIES (1UL << 2) |
---|
86 | #define IDLF_OUTPUT_CODEFRAGS (1UL << 3) |
---|
87 | |
---|
88 | #ifdef _WIN32 |
---|
89 | # define IDL_EXPORT __declspec (dllexport) |
---|
90 | # define IDL_IMPORT __declspec (dllimport) |
---|
91 | #else |
---|
92 | # define IDL_EXPORT /* empty */ |
---|
93 | # define IDL_IMPORT extern |
---|
94 | #endif |
---|
95 | |
---|
96 | /* type casting checks */ |
---|
97 | #define IDL_check_cast_enable(boolean) do { \ |
---|
98 | IDL_IMPORT int __IDL_check_type_casts; \ |
---|
99 | __IDL_check_type_casts = (boolean); \ |
---|
100 | } while (0) |
---|
101 | #define IDL_CHECK_CAST(tree, thetype, name) \ |
---|
102 | (IDL_check_type_cast(tree, thetype, \ |
---|
103 | __FILE__, __LINE__, \ |
---|
104 | G_GNUC_PRETTY_FUNCTION)->u.name) |
---|
105 | |
---|
106 | #ifdef G_HAVE_GINT64 |
---|
107 | # if G_MAXLONG > 0xffffffffUL |
---|
108 | # define IDL_LL "l" |
---|
109 | # else |
---|
110 | # define IDL_LL "ll" |
---|
111 | # endif |
---|
112 | typedef gint64 IDL_longlong_t; |
---|
113 | typedef guint64 IDL_ulonglong_t; |
---|
114 | #else |
---|
115 | # define IDL_LL "l" |
---|
116 | typedef long IDL_longlong_t; |
---|
117 | typedef unsigned long IDL_ulonglong_t; |
---|
118 | # warning 64-bit integer type not available, using 32-bit instead |
---|
119 | #endif /* G_HAVE_GINT64 */ |
---|
120 | |
---|
121 | typedef unsigned int IDL_declspec_t; |
---|
122 | typedef struct _IDL_tree_node IDL_tree_node; |
---|
123 | typedef struct _IDL_tree_node * IDL_tree; |
---|
124 | |
---|
125 | struct _IDL_LIST { |
---|
126 | IDL_tree data; |
---|
127 | IDL_tree prev; |
---|
128 | IDL_tree next; |
---|
129 | IDL_tree _tail; /* Internal use, may not be valid */ |
---|
130 | }; |
---|
131 | |
---|
132 | #define IDL_LIST(a) IDL_CHECK_CAST(a, IDLN_LIST, idl_list) |
---|
133 | extern IDL_tree IDL_list_new (IDL_tree data); |
---|
134 | extern IDL_tree IDL_list_concat (IDL_tree orig, |
---|
135 | IDL_tree append); |
---|
136 | extern IDL_tree IDL_list_remove (IDL_tree list, |
---|
137 | IDL_tree p); |
---|
138 | extern int IDL_list_length (IDL_tree list); |
---|
139 | extern IDL_tree IDL_list_nth (IDL_tree list, |
---|
140 | int n); |
---|
141 | |
---|
142 | struct _IDL_GENTREE { |
---|
143 | IDL_tree data; |
---|
144 | GHashTable *siblings; |
---|
145 | GHashTable *children; |
---|
146 | GHashFunc hash_func; |
---|
147 | GCompareFunc key_compare_func; |
---|
148 | IDL_tree _import; /* Internal use, do not recurse */ |
---|
149 | char *_cur_prefix; /* Internal use */ |
---|
150 | }; |
---|
151 | #define IDL_GENTREE(a) IDL_CHECK_CAST(a, IDLN_GENTREE, idl_gentree) |
---|
152 | extern IDL_tree IDL_gentree_new (GHashFunc hash_func, |
---|
153 | GCompareFunc key_compare_func, |
---|
154 | IDL_tree data); |
---|
155 | extern IDL_tree IDL_gentree_new_sibling (IDL_tree from, |
---|
156 | IDL_tree data); |
---|
157 | extern IDL_tree IDL_gentree_chain_sibling (IDL_tree from, |
---|
158 | IDL_tree data); |
---|
159 | extern IDL_tree IDL_gentree_chain_child (IDL_tree from, |
---|
160 | IDL_tree data); |
---|
161 | |
---|
162 | struct _IDL_INTEGER { |
---|
163 | IDL_longlong_t value; |
---|
164 | }; |
---|
165 | #define IDL_INTEGER(a) IDL_CHECK_CAST(a, IDLN_INTEGER, idl_integer) |
---|
166 | extern IDL_tree IDL_integer_new (IDL_longlong_t value); |
---|
167 | |
---|
168 | struct _IDL_STRING { |
---|
169 | char *value; |
---|
170 | }; |
---|
171 | #define IDL_STRING(a) IDL_CHECK_CAST(a, IDLN_STRING, idl_string) |
---|
172 | extern IDL_tree IDL_string_new (char *value); |
---|
173 | |
---|
174 | struct _IDL_WIDE_STRING { |
---|
175 | wchar_t *value; |
---|
176 | }; |
---|
177 | #define IDL_WIDE_STRING(a) IDL_CHECK_CAST(a, IDLN_WIDE_STRING, idl_wide_string) |
---|
178 | extern IDL_tree IDL_wide_string_new (wchar_t *value); |
---|
179 | |
---|
180 | struct _IDL_CHAR { |
---|
181 | char *value; |
---|
182 | }; |
---|
183 | #define IDL_CHAR(a) IDL_CHECK_CAST(a, IDLN_CHAR, idl_char) |
---|
184 | extern IDL_tree IDL_char_new (char *value); |
---|
185 | |
---|
186 | struct _IDL_WIDE_CHAR { |
---|
187 | wchar_t *value; |
---|
188 | }; |
---|
189 | #define IDL_WIDE_CHAR(a) IDL_CHECK_CAST(a, IDLN_WIDE_CHAR, idl_wide_char) |
---|
190 | extern IDL_tree IDL_wide_char_new (wchar_t *value); |
---|
191 | |
---|
192 | struct _IDL_FIXED { |
---|
193 | char *value; |
---|
194 | }; |
---|
195 | #define IDL_FIXED(a) IDL_CHECK_CAST(a, IDLN_FIXED, idl_fixed) |
---|
196 | extern IDL_tree IDL_fixed_new (char *value); |
---|
197 | |
---|
198 | struct _IDL_FLOAT { |
---|
199 | double value; |
---|
200 | }; |
---|
201 | #define IDL_FLOAT(a) IDL_CHECK_CAST(a, IDLN_FLOAT, idl_float) |
---|
202 | extern IDL_tree IDL_float_new (double value); |
---|
203 | |
---|
204 | struct _IDL_BOOLEAN { |
---|
205 | unsigned value; |
---|
206 | }; |
---|
207 | #define IDL_BOOLEAN(a) IDL_CHECK_CAST(a, IDLN_BOOLEAN, idl_boolean) |
---|
208 | extern IDL_tree IDL_boolean_new (unsigned value); |
---|
209 | |
---|
210 | struct _IDL_IDENT { |
---|
211 | char *str; |
---|
212 | char *repo_id; |
---|
213 | GSList *comments; |
---|
214 | IDL_tree _ns_ref; /* Internal use, do not recurse */ |
---|
215 | unsigned _flags; /* Internal use */ |
---|
216 | #define IDLF_IDENT_CASE_MISMATCH_HIT (1UL << 0) |
---|
217 | }; |
---|
218 | #define IDL_IDENT(a) IDL_CHECK_CAST(a, IDLN_IDENT, idl_ident) |
---|
219 | #define IDL_IDENT_TO_NS(a) IDL_CHECK_CAST(a, IDLN_IDENT, idl_ident._ns_ref) |
---|
220 | #define IDL_IDENT_REPO_ID(a) IDL_CHECK_CAST(a, IDLN_IDENT, idl_ident.repo_id) |
---|
221 | extern IDL_tree IDL_ident_new (char *str); |
---|
222 | extern void IDL_queue_new_ident_comment (const char *str); |
---|
223 | |
---|
224 | enum IDL_float_type { |
---|
225 | IDL_FLOAT_TYPE_FLOAT, |
---|
226 | IDL_FLOAT_TYPE_DOUBLE, |
---|
227 | IDL_FLOAT_TYPE_LONGDOUBLE |
---|
228 | }; |
---|
229 | |
---|
230 | struct _IDL_TYPE_FLOAT { |
---|
231 | enum IDL_float_type f_type; |
---|
232 | }; |
---|
233 | #define IDL_TYPE_FLOAT(a) IDL_CHECK_CAST(a, IDLN_TYPE_FLOAT, idl_type_float) |
---|
234 | extern IDL_tree IDL_type_float_new (enum IDL_float_type f_type); |
---|
235 | |
---|
236 | struct _IDL_TYPE_FIXED { |
---|
237 | IDL_tree positive_int_const; |
---|
238 | IDL_tree integer_lit; |
---|
239 | }; |
---|
240 | #define IDL_TYPE_FIXED(a) IDL_CHECK_CAST(a, IDLN_TYPE_FIXED, idl_type_fixed) |
---|
241 | extern IDL_tree IDL_type_fixed_new (IDL_tree positive_int_const, |
---|
242 | IDL_tree integer_lit); |
---|
243 | |
---|
244 | enum IDL_integer_type { |
---|
245 | IDL_INTEGER_TYPE_SHORT, |
---|
246 | IDL_INTEGER_TYPE_LONG, |
---|
247 | IDL_INTEGER_TYPE_LONGLONG |
---|
248 | }; |
---|
249 | |
---|
250 | struct _IDL_TYPE_INTEGER { |
---|
251 | unsigned f_signed : 1; |
---|
252 | enum IDL_integer_type f_type; |
---|
253 | }; |
---|
254 | #define IDL_TYPE_INTEGER(a) IDL_CHECK_CAST(a, IDLN_TYPE_INTEGER, idl_type_integer) |
---|
255 | extern IDL_tree IDL_type_integer_new (unsigned f_signed, |
---|
256 | enum IDL_integer_type f_type); |
---|
257 | |
---|
258 | extern IDL_tree IDL_type_char_new (void); |
---|
259 | extern IDL_tree IDL_type_wide_char_new (void); |
---|
260 | extern IDL_tree IDL_type_boolean_new (void); |
---|
261 | extern IDL_tree IDL_type_octet_new (void); |
---|
262 | extern IDL_tree IDL_type_any_new (void); |
---|
263 | extern IDL_tree IDL_type_object_new (void); |
---|
264 | extern IDL_tree IDL_type_typecode_new (void); |
---|
265 | |
---|
266 | struct _IDL_TYPE_STRING { |
---|
267 | IDL_tree positive_int_const; |
---|
268 | }; |
---|
269 | #define IDL_TYPE_STRING(a) IDL_CHECK_CAST(a, IDLN_TYPE_STRING, idl_type_string) |
---|
270 | extern IDL_tree IDL_type_string_new (IDL_tree positive_int_const); |
---|
271 | |
---|
272 | struct _IDL_TYPE_WIDE_STRING { |
---|
273 | IDL_tree positive_int_const; |
---|
274 | }; |
---|
275 | #define IDL_TYPE_WIDE_STRING(a) IDL_CHECK_CAST(a, IDLN_TYPE_WIDE_STRING, idl_type_wide_string) |
---|
276 | extern IDL_tree IDL_type_wide_string_new (IDL_tree positive_int_const); |
---|
277 | |
---|
278 | struct _IDL_TYPE_ENUM { |
---|
279 | IDL_tree ident; |
---|
280 | IDL_tree enumerator_list; |
---|
281 | }; |
---|
282 | #define IDL_TYPE_ENUM(a) IDL_CHECK_CAST(a, IDLN_TYPE_ENUM, idl_type_enum) |
---|
283 | extern IDL_tree IDL_type_enum_new (IDL_tree ident, |
---|
284 | IDL_tree enumerator_list); |
---|
285 | |
---|
286 | struct _IDL_TYPE_ARRAY { |
---|
287 | IDL_tree ident; |
---|
288 | IDL_tree size_list; |
---|
289 | }; |
---|
290 | #define IDL_TYPE_ARRAY(a) IDL_CHECK_CAST(a, IDLN_TYPE_ARRAY, idl_type_array) |
---|
291 | extern IDL_tree IDL_type_array_new (IDL_tree ident, |
---|
292 | IDL_tree size_list); |
---|
293 | |
---|
294 | struct _IDL_TYPE_SEQUENCE { |
---|
295 | IDL_tree simple_type_spec; |
---|
296 | IDL_tree positive_int_const; |
---|
297 | }; |
---|
298 | #define IDL_TYPE_SEQUENCE(a) IDL_CHECK_CAST(a, IDLN_TYPE_SEQUENCE, idl_type_sequence) |
---|
299 | extern IDL_tree IDL_type_sequence_new (IDL_tree simple_type_spec, |
---|
300 | IDL_tree positive_int_const); |
---|
301 | |
---|
302 | struct _IDL_TYPE_STRUCT { |
---|
303 | IDL_tree ident; |
---|
304 | IDL_tree member_list; |
---|
305 | }; |
---|
306 | #define IDL_TYPE_STRUCT(a) IDL_CHECK_CAST(a, IDLN_TYPE_STRUCT, idl_type_struct) |
---|
307 | extern IDL_tree IDL_type_struct_new (IDL_tree ident, |
---|
308 | IDL_tree member_list); |
---|
309 | |
---|
310 | struct _IDL_TYPE_UNION { |
---|
311 | IDL_tree ident; |
---|
312 | IDL_tree switch_type_spec; |
---|
313 | IDL_tree switch_body; |
---|
314 | }; |
---|
315 | #define IDL_TYPE_UNION(a) IDL_CHECK_CAST(a, IDLN_TYPE_UNION, idl_type_union) |
---|
316 | extern IDL_tree IDL_type_union_new (IDL_tree ident, |
---|
317 | IDL_tree switch_type_spec, |
---|
318 | IDL_tree switch_body); |
---|
319 | struct _IDL_MEMBER { |
---|
320 | IDL_tree type_spec; |
---|
321 | IDL_tree dcls; |
---|
322 | }; |
---|
323 | #define IDL_MEMBER(a) IDL_CHECK_CAST(a, IDLN_MEMBER, idl_member) |
---|
324 | extern IDL_tree IDL_member_new (IDL_tree type_spec, |
---|
325 | IDL_tree dcls); |
---|
326 | |
---|
327 | struct _IDL_NATIVE { |
---|
328 | IDL_tree ident; |
---|
329 | char *user_type; /* XPIDL extension */ |
---|
330 | }; |
---|
331 | #define IDL_NATIVE(a) IDL_CHECK_CAST(a, IDLN_NATIVE, idl_native) |
---|
332 | extern IDL_tree IDL_native_new (IDL_tree ident); |
---|
333 | |
---|
334 | |
---|
335 | struct _IDL_TYPE_DCL { |
---|
336 | IDL_tree type_spec; |
---|
337 | IDL_tree dcls; |
---|
338 | }; |
---|
339 | #define IDL_TYPE_DCL(a) IDL_CHECK_CAST(a, IDLN_TYPE_DCL, idl_type_dcl) |
---|
340 | extern IDL_tree IDL_type_dcl_new (IDL_tree type_spec, |
---|
341 | IDL_tree dcls); |
---|
342 | |
---|
343 | struct _IDL_CONST_DCL { |
---|
344 | IDL_tree const_type; |
---|
345 | IDL_tree ident; |
---|
346 | IDL_tree const_exp; |
---|
347 | }; |
---|
348 | #define IDL_CONST_DCL(a) IDL_CHECK_CAST(a, IDLN_CONST_DCL, idl_const_dcl) |
---|
349 | extern IDL_tree IDL_const_dcl_new (IDL_tree const_type, |
---|
350 | IDL_tree ident, |
---|
351 | IDL_tree const_exp); |
---|
352 | |
---|
353 | struct _IDL_EXCEPT_DCL { |
---|
354 | IDL_tree ident; |
---|
355 | IDL_tree members; |
---|
356 | }; |
---|
357 | #define IDL_EXCEPT_DCL(a) IDL_CHECK_CAST(a, IDLN_EXCEPT_DCL, idl_except_dcl) |
---|
358 | extern IDL_tree IDL_except_dcl_new (IDL_tree ident, |
---|
359 | IDL_tree members); |
---|
360 | |
---|
361 | struct _IDL_ATTR_DCL { |
---|
362 | unsigned f_readonly : 1; |
---|
363 | IDL_tree param_type_spec; |
---|
364 | IDL_tree simple_declarations; |
---|
365 | }; |
---|
366 | #define IDL_ATTR_DCL(a) IDL_CHECK_CAST(a, IDLN_ATTR_DCL, idl_attr_dcl) |
---|
367 | extern IDL_tree IDL_attr_dcl_new (unsigned f_readonly, |
---|
368 | IDL_tree param_type_spec, |
---|
369 | IDL_tree simple_declarations); |
---|
370 | |
---|
371 | struct _IDL_OP_DCL { |
---|
372 | unsigned __f_noscript : 1; /* Deprecated */ |
---|
373 | unsigned f_oneway : 1; |
---|
374 | /* XPIDL extension (varags) */ |
---|
375 | unsigned f_varargs : 1; |
---|
376 | IDL_tree op_type_spec; |
---|
377 | IDL_tree ident; |
---|
378 | IDL_tree parameter_dcls; |
---|
379 | IDL_tree raises_expr; |
---|
380 | IDL_tree context_expr; |
---|
381 | }; |
---|
382 | #define IDL_OP_DCL(a) IDL_CHECK_CAST(a, IDLN_OP_DCL, idl_op_dcl) |
---|
383 | extern IDL_tree IDL_op_dcl_new (unsigned f_oneway, |
---|
384 | IDL_tree op_type_spec, |
---|
385 | IDL_tree ident, |
---|
386 | IDL_tree parameter_dcls, |
---|
387 | IDL_tree raises_expr, |
---|
388 | IDL_tree context_expr); |
---|
389 | |
---|
390 | enum IDL_param_attr { |
---|
391 | IDL_PARAM_IN, |
---|
392 | IDL_PARAM_OUT, |
---|
393 | IDL_PARAM_INOUT |
---|
394 | }; |
---|
395 | |
---|
396 | struct _IDL_PARAM_DCL { |
---|
397 | enum IDL_param_attr attr; |
---|
398 | IDL_tree param_type_spec; |
---|
399 | IDL_tree simple_declarator; |
---|
400 | }; |
---|
401 | #define IDL_PARAM_DCL(a) IDL_CHECK_CAST(a, IDLN_PARAM_DCL, idl_param_dcl) |
---|
402 | extern IDL_tree IDL_param_dcl_new (enum IDL_param_attr attr, |
---|
403 | IDL_tree param_type_spec, |
---|
404 | IDL_tree simple_declarator); |
---|
405 | |
---|
406 | struct _IDL_CASE_STMT { |
---|
407 | IDL_tree labels; |
---|
408 | IDL_tree element_spec; |
---|
409 | }; |
---|
410 | #define IDL_CASE_STMT(a) IDL_CHECK_CAST(a, IDLN_CASE_STMT, idl_case_stmt) |
---|
411 | extern IDL_tree IDL_case_stmt_new (IDL_tree labels, |
---|
412 | IDL_tree element_spec); |
---|
413 | |
---|
414 | struct _IDL_INTERFACE { |
---|
415 | IDL_tree ident; |
---|
416 | IDL_tree inheritance_spec; |
---|
417 | IDL_tree body; |
---|
418 | }; |
---|
419 | #define IDL_INTERFACE(a) IDL_CHECK_CAST(a, IDLN_INTERFACE, idl_interface) |
---|
420 | extern IDL_tree IDL_interface_new (IDL_tree ident, |
---|
421 | IDL_tree inheritance_spec, |
---|
422 | IDL_tree body); |
---|
423 | |
---|
424 | struct _IDL_FORWARD_DCL { |
---|
425 | IDL_tree ident; |
---|
426 | }; |
---|
427 | #define IDL_FORWARD_DCL(a) IDL_CHECK_CAST(a, IDLN_FORWARD_DCL, idl_forward_dcl) |
---|
428 | extern IDL_tree IDL_forward_dcl_new (IDL_tree ident); |
---|
429 | |
---|
430 | struct _IDL_MODULE { |
---|
431 | IDL_tree ident; |
---|
432 | IDL_tree definition_list; |
---|
433 | }; |
---|
434 | #define IDL_MODULE(a) IDL_CHECK_CAST(a, IDLN_MODULE, idl_module) |
---|
435 | extern IDL_tree IDL_module_new (IDL_tree ident, |
---|
436 | IDL_tree definition_list); |
---|
437 | |
---|
438 | enum IDL_binop { |
---|
439 | IDL_BINOP_OR, |
---|
440 | IDL_BINOP_XOR, |
---|
441 | IDL_BINOP_AND, |
---|
442 | IDL_BINOP_SHR, |
---|
443 | IDL_BINOP_SHL, |
---|
444 | IDL_BINOP_ADD, |
---|
445 | IDL_BINOP_SUB, |
---|
446 | IDL_BINOP_MULT, |
---|
447 | IDL_BINOP_DIV, |
---|
448 | IDL_BINOP_MOD |
---|
449 | }; |
---|
450 | |
---|
451 | struct _IDL_BINOP { |
---|
452 | enum IDL_binop op; |
---|
453 | IDL_tree left, right; |
---|
454 | }; |
---|
455 | #define IDL_BINOP(a) IDL_CHECK_CAST(a, IDLN_BINOP, idl_binop) |
---|
456 | extern IDL_tree IDL_binop_new (enum IDL_binop op, |
---|
457 | IDL_tree left, |
---|
458 | IDL_tree right); |
---|
459 | |
---|
460 | enum IDL_unaryop { |
---|
461 | IDL_UNARYOP_PLUS, |
---|
462 | IDL_UNARYOP_MINUS, |
---|
463 | IDL_UNARYOP_COMPLEMENT |
---|
464 | }; |
---|
465 | |
---|
466 | struct _IDL_UNARYOP { |
---|
467 | enum IDL_unaryop op; |
---|
468 | IDL_tree operand; |
---|
469 | }; |
---|
470 | #define IDL_UNARYOP(a) IDL_CHECK_CAST(a, IDLN_UNARYOP, idl_unaryop) |
---|
471 | extern IDL_tree IDL_unaryop_new (enum IDL_unaryop op, |
---|
472 | IDL_tree operand); |
---|
473 | |
---|
474 | /* XPIDL code fragments extension. */ |
---|
475 | struct _IDL_CODEFRAG { |
---|
476 | char *desc; |
---|
477 | GSList *lines; |
---|
478 | }; |
---|
479 | #define IDL_CODEFRAG(a) IDL_CHECK_CAST(a, IDLN_CODEFRAG, idl_codefrag) |
---|
480 | extern IDL_tree IDL_codefrag_new (char *desc, |
---|
481 | GSList *lines); |
---|
482 | |
---|
483 | /* source/include file marking extension. */ |
---|
484 | struct _IDL_SRCFILE { |
---|
485 | char *filename; |
---|
486 | int seenCnt; |
---|
487 | gboolean isTop; |
---|
488 | gboolean wasInhibit; |
---|
489 | }; |
---|
490 | #define IDL_SRCFILE(a) IDL_CHECK_CAST(a, IDLN_SRCFILE, idl_srcfile) |
---|
491 | extern IDL_tree IDL_srcfile_new (char *filename, int seenCnt, gboolean isTop, gboolean wasInhibit); |
---|
492 | |
---|
493 | /* |
---|
494 | * IDL_tree_type - Enumerations of node types |
---|
495 | * |
---|
496 | * Note this enumerator list is subject to change in the future. A program should not need |
---|
497 | * more than a recompilation to adjust for a change in this list, so instead of using a |
---|
498 | * statically initialized jumptable, allocate an array of size IDLN_LAST and assign the |
---|
499 | * elements manually. |
---|
500 | */ |
---|
501 | typedef enum { |
---|
502 | IDLN_NONE, |
---|
503 | IDLN_ANY, |
---|
504 | |
---|
505 | IDLN_LIST, |
---|
506 | IDLN_GENTREE, |
---|
507 | IDLN_INTEGER, |
---|
508 | IDLN_STRING, |
---|
509 | IDLN_WIDE_STRING, |
---|
510 | IDLN_CHAR, |
---|
511 | IDLN_WIDE_CHAR, |
---|
512 | IDLN_FIXED, |
---|
513 | IDLN_FLOAT, |
---|
514 | IDLN_BOOLEAN, |
---|
515 | IDLN_IDENT, |
---|
516 | IDLN_TYPE_DCL, |
---|
517 | IDLN_CONST_DCL, |
---|
518 | IDLN_EXCEPT_DCL, |
---|
519 | IDLN_ATTR_DCL, |
---|
520 | IDLN_OP_DCL, |
---|
521 | IDLN_PARAM_DCL, |
---|
522 | IDLN_FORWARD_DCL, |
---|
523 | IDLN_TYPE_INTEGER, |
---|
524 | IDLN_TYPE_FLOAT, |
---|
525 | IDLN_TYPE_FIXED, |
---|
526 | IDLN_TYPE_CHAR, |
---|
527 | IDLN_TYPE_WIDE_CHAR, |
---|
528 | IDLN_TYPE_STRING, |
---|
529 | IDLN_TYPE_WIDE_STRING, |
---|
530 | IDLN_TYPE_BOOLEAN, |
---|
531 | IDLN_TYPE_OCTET, |
---|
532 | IDLN_TYPE_ANY, |
---|
533 | IDLN_TYPE_OBJECT, |
---|
534 | IDLN_TYPE_TYPECODE, |
---|
535 | IDLN_TYPE_ENUM, |
---|
536 | IDLN_TYPE_SEQUENCE, |
---|
537 | IDLN_TYPE_ARRAY, |
---|
538 | IDLN_TYPE_STRUCT, |
---|
539 | IDLN_TYPE_UNION, |
---|
540 | IDLN_MEMBER, |
---|
541 | IDLN_NATIVE, |
---|
542 | IDLN_CASE_STMT, |
---|
543 | IDLN_INTERFACE, |
---|
544 | IDLN_MODULE, |
---|
545 | IDLN_BINOP, |
---|
546 | IDLN_UNARYOP, |
---|
547 | IDLN_CODEFRAG, |
---|
548 | IDLN_SRCFILE, |
---|
549 | |
---|
550 | IDLN_LAST |
---|
551 | } IDL_tree_type; |
---|
552 | IDL_IMPORT const char * IDL_tree_type_names[]; |
---|
553 | |
---|
554 | struct _IDL_tree_node { |
---|
555 | IDL_tree_type _type; |
---|
556 | IDL_tree up; /* Do not recurse */ |
---|
557 | IDL_declspec_t declspec; |
---|
558 | GHashTable *properties; |
---|
559 | int refs; |
---|
560 | char *_file; /* Internal use */ |
---|
561 | int _line; /* Internal use */ |
---|
562 | union { |
---|
563 | struct _IDL_LIST idl_list; |
---|
564 | struct _IDL_GENTREE idl_gentree; |
---|
565 | struct _IDL_INTEGER idl_integer; |
---|
566 | struct _IDL_STRING idl_string; |
---|
567 | struct _IDL_WIDE_STRING idl_wide_string; |
---|
568 | struct _IDL_CHAR idl_char; |
---|
569 | struct _IDL_WIDE_CHAR idl_wide_char; |
---|
570 | struct _IDL_FIXED idl_fixed; |
---|
571 | struct _IDL_FLOAT idl_float; |
---|
572 | struct _IDL_BOOLEAN idl_boolean; |
---|
573 | struct _IDL_IDENT idl_ident; |
---|
574 | struct _IDL_TYPE_DCL idl_type_dcl; |
---|
575 | struct _IDL_CONST_DCL idl_const_dcl; |
---|
576 | struct _IDL_EXCEPT_DCL idl_except_dcl; |
---|
577 | struct _IDL_ATTR_DCL idl_attr_dcl; |
---|
578 | struct _IDL_OP_DCL idl_op_dcl; |
---|
579 | struct _IDL_PARAM_DCL idl_param_dcl; |
---|
580 | struct _IDL_FORWARD_DCL idl_forward_dcl; |
---|
581 | struct _IDL_TYPE_FLOAT idl_type_float; |
---|
582 | struct _IDL_TYPE_FIXED idl_type_fixed; |
---|
583 | struct _IDL_TYPE_INTEGER idl_type_integer; |
---|
584 | struct _IDL_TYPE_ENUM idl_type_enum; |
---|
585 | struct _IDL_TYPE_STRING idl_type_string; |
---|
586 | struct _IDL_TYPE_WIDE_STRING idl_type_wide_string; |
---|
587 | struct _IDL_TYPE_SEQUENCE idl_type_sequence; |
---|
588 | struct _IDL_TYPE_ARRAY idl_type_array; |
---|
589 | struct _IDL_TYPE_STRUCT idl_type_struct; |
---|
590 | struct _IDL_TYPE_UNION idl_type_union; |
---|
591 | struct _IDL_MEMBER idl_member; |
---|
592 | struct _IDL_NATIVE idl_native; |
---|
593 | struct _IDL_CASE_STMT idl_case_stmt; |
---|
594 | struct _IDL_INTERFACE idl_interface; |
---|
595 | struct _IDL_MODULE idl_module; |
---|
596 | struct _IDL_BINOP idl_binop; |
---|
597 | struct _IDL_UNARYOP idl_unaryop; |
---|
598 | struct _IDL_CODEFRAG idl_codefrag; |
---|
599 | struct _IDL_SRCFILE idl_srcfile; |
---|
600 | } u; |
---|
601 | |
---|
602 | /* Fields for application use */ |
---|
603 | guint32 flags; |
---|
604 | gpointer data; |
---|
605 | }; |
---|
606 | #define IDL_NODE_TYPE(a) ((a)->_type) |
---|
607 | #define IDL_NODE_TYPE_NAME(a) ((a)?IDL_tree_type_names[IDL_NODE_TYPE(a)]:"NULL") |
---|
608 | #define IDL_NODE_UP(a) ((a)->up) |
---|
609 | #define IDL_NODE_PROPERTIES(a) ((a)->properties) |
---|
610 | #define IDL_NODE_DECLSPEC(a) ((a)->declspec) |
---|
611 | #define IDL_NODE_REFS(a) ((a)->refs) |
---|
612 | #define IDL_NODE_IS_LITERAL(a) \ |
---|
613 | (IDL_NODE_TYPE(a) == IDLN_INTEGER || \ |
---|
614 | IDL_NODE_TYPE(a) == IDLN_STRING || \ |
---|
615 | IDL_NODE_TYPE(a) == IDLN_WIDE_STRING || \ |
---|
616 | IDL_NODE_TYPE(a) == IDLN_CHAR || \ |
---|
617 | IDL_NODE_TYPE(a) == IDLN_WIDE_CHAR || \ |
---|
618 | IDL_NODE_TYPE(a) == IDLN_FIXED || \ |
---|
619 | IDL_NODE_TYPE(a) == IDLN_FLOAT || \ |
---|
620 | IDL_NODE_TYPE(a) == IDLN_BOOLEAN) |
---|
621 | #define IDL_NODE_IS_TYPE(a) \ |
---|
622 | (IDL_NODE_TYPE(a) == IDLN_TYPE_INTEGER || \ |
---|
623 | IDL_NODE_TYPE(a) == IDLN_TYPE_STRING || \ |
---|
624 | IDL_NODE_TYPE(a) == IDLN_TYPE_WIDE_STRING || \ |
---|
625 | IDL_NODE_TYPE(a) == IDLN_TYPE_CHAR || \ |
---|
626 | IDL_NODE_TYPE(a) == IDLN_TYPE_WIDE_CHAR || \ |
---|
627 | IDL_NODE_TYPE(a) == IDLN_TYPE_FIXED || \ |
---|
628 | IDL_NODE_TYPE(a) == IDLN_TYPE_FLOAT || \ |
---|
629 | IDL_NODE_TYPE(a) == IDLN_TYPE_BOOLEAN || \ |
---|
630 | IDL_NODE_TYPE(a) == IDLN_TYPE_OCTET || \ |
---|
631 | IDL_NODE_TYPE(a) == IDLN_TYPE_ANY || \ |
---|
632 | IDL_NODE_TYPE(a) == IDLN_TYPE_OBJECT || \ |
---|
633 | IDL_NODE_TYPE(a) == IDLN_TYPE_TYPECODE || \ |
---|
634 | IDL_NODE_TYPE(a) == IDLN_TYPE_ENUM || \ |
---|
635 | IDL_NODE_TYPE(a) == IDLN_TYPE_ARRAY || \ |
---|
636 | IDL_NODE_TYPE(a) == IDLN_TYPE_SEQUENCE || \ |
---|
637 | IDL_NODE_TYPE(a) == IDLN_TYPE_STRUCT || \ |
---|
638 | IDL_NODE_TYPE(a) == IDLN_TYPE_UNION) |
---|
639 | #define IDL_NODE_IS_SCOPED(a) \ |
---|
640 | (IDL_NODE_TYPE(a) == IDLN_IDENT || \ |
---|
641 | IDL_NODE_TYPE(a) == IDLN_INTERFACE || \ |
---|
642 | IDL_NODE_TYPE(a) == IDLN_MODULE || \ |
---|
643 | IDL_NODE_TYPE(a) == IDLN_EXCEPT_DCL || \ |
---|
644 | IDL_NODE_TYPE(a) == IDLN_OP_DCL || \ |
---|
645 | IDL_NODE_TYPE(a) == IDLN_TYPE_ENUM || \ |
---|
646 | IDL_NODE_TYPE(a) == IDLN_TYPE_STRUCT || \ |
---|
647 | IDL_NODE_TYPE(a) == IDLN_TYPE_UNION) |
---|
648 | |
---|
649 | typedef struct _IDL_ns * IDL_ns; |
---|
650 | |
---|
651 | struct _IDL_ns { |
---|
652 | IDL_tree global; |
---|
653 | IDL_tree file; |
---|
654 | IDL_tree current; |
---|
655 | GHashTable *inhibits; |
---|
656 | GHashTable *filename_hash; |
---|
657 | }; |
---|
658 | #define IDL_NS(a) (*(a)) |
---|
659 | |
---|
660 | typedef enum { |
---|
661 | IDL_INPUT_REASON_INIT, |
---|
662 | IDL_INPUT_REASON_FILL, |
---|
663 | IDL_INPUT_REASON_ABORT, |
---|
664 | IDL_INPUT_REASON_FINISH |
---|
665 | } IDL_input_reason; |
---|
666 | |
---|
667 | union IDL_input_data { |
---|
668 | struct { |
---|
669 | const char *filename; |
---|
670 | } init; |
---|
671 | struct { |
---|
672 | char *buffer; |
---|
673 | size_t max_size; |
---|
674 | } fill; |
---|
675 | }; |
---|
676 | |
---|
677 | typedef int (*IDL_input_callback) (IDL_input_reason reason, |
---|
678 | union IDL_input_data *data, |
---|
679 | gpointer user_data); |
---|
680 | |
---|
681 | typedef int (*IDL_msg_callback) (int level, |
---|
682 | int num, |
---|
683 | int line, |
---|
684 | const char *filename, |
---|
685 | const char *message); |
---|
686 | |
---|
687 | typedef struct _IDL_tree_func_state IDL_tree_func_state; |
---|
688 | typedef struct _IDL_tree_func_data IDL_tree_func_data; |
---|
689 | |
---|
690 | #define IDL_WalkF_TypespecOnly (1<<0) |
---|
691 | |
---|
692 | /* Traversal state data. Recursive walks chain states. */ |
---|
693 | struct _IDL_tree_func_state { |
---|
694 | IDL_tree_func_state *up; |
---|
695 | IDL_tree start; |
---|
696 | IDL_tree_func_data *bottom; |
---|
697 | glong flags; |
---|
698 | }; |
---|
699 | |
---|
700 | /* This holds a list of the up hierarchy traversed, beginning from traversal. This is |
---|
701 | * useful since nodes referenced after initial definition will have a different traversal |
---|
702 | * path than the actual up path. */ |
---|
703 | struct _IDL_tree_func_data { |
---|
704 | IDL_tree_func_state *state; |
---|
705 | IDL_tree_func_data *up; |
---|
706 | IDL_tree tree; |
---|
707 | gint step; |
---|
708 | gpointer data; /* Application data */ |
---|
709 | gint level; |
---|
710 | }; |
---|
711 | |
---|
712 | typedef gboolean (*IDL_tree_func) (IDL_tree_func_data *tnfd, |
---|
713 | gpointer user_data); |
---|
714 | |
---|
715 | extern IDL_tree IDL_check_type_cast (const IDL_tree var, |
---|
716 | IDL_tree_type type, |
---|
717 | const char *file, |
---|
718 | int line, |
---|
719 | const char *function); |
---|
720 | |
---|
721 | extern const char * IDL_get_libver_string (void); |
---|
722 | |
---|
723 | extern const char * IDL_get_IDLver_string (void); |
---|
724 | |
---|
725 | extern int IDL_parse_filename (const char *filename, |
---|
726 | const char *cpp_args, |
---|
727 | IDL_msg_callback msg_cb, |
---|
728 | IDL_tree *tree, IDL_ns *ns, |
---|
729 | unsigned long parse_flags, |
---|
730 | int max_msg_level); |
---|
731 | |
---|
732 | extern int IDL_parse_filename_with_input (const char *filename, |
---|
733 | IDL_input_callback input_cb, |
---|
734 | gpointer input_cb_user_data, |
---|
735 | IDL_msg_callback msg_cb, |
---|
736 | IDL_tree *tree, IDL_ns *ns, |
---|
737 | unsigned long parse_flags, |
---|
738 | int max_msg_level); |
---|
739 | |
---|
740 | extern int IDL_ns_prefix (IDL_ns ns, |
---|
741 | const char *s); |
---|
742 | |
---|
743 | extern void IDL_ns_ID (IDL_ns ns, |
---|
744 | const char *s); |
---|
745 | |
---|
746 | extern void IDL_ns_version (IDL_ns ns, |
---|
747 | const char *s); |
---|
748 | |
---|
749 | extern int IDL_inhibit_get (void); |
---|
750 | |
---|
751 | extern void IDL_inhibit_push (void); |
---|
752 | |
---|
753 | extern void IDL_inhibit_pop (void); |
---|
754 | |
---|
755 | extern IDL_tree IDL_file_set (const char *filename, |
---|
756 | int line); |
---|
757 | |
---|
758 | extern void IDL_file_get (const char **filename, |
---|
759 | int *line); |
---|
760 | |
---|
761 | extern IDL_tree IDL_get_parent_node (IDL_tree p, |
---|
762 | IDL_tree_type type, |
---|
763 | int *scope_levels); |
---|
764 | |
---|
765 | extern IDL_tree IDL_tree_get_scope (IDL_tree p); |
---|
766 | |
---|
767 | extern int IDL_tree_get_node_info (IDL_tree tree, |
---|
768 | char **who, |
---|
769 | char **what); |
---|
770 | |
---|
771 | extern void IDL_tree_error (IDL_tree p, |
---|
772 | const char *fmt, |
---|
773 | ...) |
---|
774 | G_GNUC_PRINTF (2, 3); |
---|
775 | |
---|
776 | extern void IDL_tree_warning (IDL_tree p, |
---|
777 | int level, |
---|
778 | const char *fmt, |
---|
779 | ...) |
---|
780 | G_GNUC_PRINTF (3, 4); |
---|
781 | |
---|
782 | extern const char * IDL_tree_property_get (IDL_tree tree, |
---|
783 | const char *key); |
---|
784 | |
---|
785 | extern void IDL_tree_property_set (IDL_tree tree, |
---|
786 | const char *key, |
---|
787 | const char *value); |
---|
788 | |
---|
789 | extern gboolean IDL_tree_property_remove (IDL_tree tree, |
---|
790 | const char *key); |
---|
791 | |
---|
792 | extern void IDL_tree_properties_copy (IDL_tree from_tree, |
---|
793 | IDL_tree to_tree); |
---|
794 | |
---|
795 | extern void IDL_tree_remove_inhibits (IDL_tree *tree, |
---|
796 | IDL_ns ns); |
---|
797 | |
---|
798 | extern void IDL_tree_walk (IDL_tree p, |
---|
799 | IDL_tree_func_data *current, |
---|
800 | IDL_tree_func pre_tree_func, |
---|
801 | IDL_tree_func post_tree_func, |
---|
802 | gpointer user_data); |
---|
803 | |
---|
804 | extern void IDL_tree_walk2 (IDL_tree p, |
---|
805 | IDL_tree_func_data *current, |
---|
806 | glong flags, |
---|
807 | IDL_tree_func pre_tree_func, |
---|
808 | IDL_tree_func post_tree_func, |
---|
809 | gpointer user_data); |
---|
810 | |
---|
811 | extern void IDL_tree_walk_in_order (IDL_tree p, |
---|
812 | IDL_tree_func tree_func, |
---|
813 | gpointer user_data); |
---|
814 | |
---|
815 | extern void IDL_tree_free (IDL_tree root); |
---|
816 | |
---|
817 | extern void IDL_tree_to_IDL (IDL_tree p, |
---|
818 | IDL_ns ns, |
---|
819 | FILE *output, |
---|
820 | unsigned long output_flags); |
---|
821 | |
---|
822 | extern GString * IDL_tree_to_IDL_string (IDL_tree p, |
---|
823 | IDL_ns ns, |
---|
824 | unsigned long output_flags); |
---|
825 | |
---|
826 | extern gboolean IDL_tree_contains_node (IDL_tree p, |
---|
827 | IDL_tree searchNode); |
---|
828 | |
---|
829 | extern gboolean IDL_tree_is_recursive (IDL_tree tree, |
---|
830 | gpointer dummy); |
---|
831 | |
---|
832 | extern gchar * IDL_do_escapes (const char *s); |
---|
833 | |
---|
834 | extern IDL_tree IDL_resolve_const_exp (IDL_tree p, |
---|
835 | IDL_tree_type type); |
---|
836 | |
---|
837 | extern IDL_ns IDL_ns_new (void); |
---|
838 | |
---|
839 | extern void IDL_ns_free (IDL_ns ns); |
---|
840 | |
---|
841 | extern IDL_tree IDL_ns_resolve_this_scope_ident (IDL_ns ns, |
---|
842 | IDL_tree scope, |
---|
843 | IDL_tree ident); |
---|
844 | |
---|
845 | extern IDL_tree IDL_ns_resolve_ident (IDL_ns ns, |
---|
846 | IDL_tree ident); |
---|
847 | |
---|
848 | extern IDL_tree IDL_ns_lookup_this_scope (IDL_ns ns, |
---|
849 | IDL_tree scope, |
---|
850 | IDL_tree ident, |
---|
851 | gboolean *conflict); |
---|
852 | |
---|
853 | extern IDL_tree IDL_ns_lookup_cur_scope (IDL_ns ns, |
---|
854 | IDL_tree ident, |
---|
855 | gboolean *conflict); |
---|
856 | |
---|
857 | extern IDL_tree IDL_ns_place_new (IDL_ns ns, |
---|
858 | IDL_tree ident); |
---|
859 | |
---|
860 | extern void IDL_ns_push_scope (IDL_ns ns, |
---|
861 | IDL_tree ident); |
---|
862 | |
---|
863 | extern void IDL_ns_pop_scope (IDL_ns ns); |
---|
864 | |
---|
865 | extern IDL_tree IDL_ns_qualified_ident_new (IDL_tree nsid); |
---|
866 | |
---|
867 | extern gchar * IDL_ns_ident_to_qstring (IDL_tree ns_ident, |
---|
868 | const char *join, |
---|
869 | int scope_levels); |
---|
870 | |
---|
871 | extern int IDL_ns_scope_levels_from_here (IDL_ns ns, |
---|
872 | IDL_tree ident, |
---|
873 | IDL_tree parent); |
---|
874 | |
---|
875 | extern gchar * IDL_ns_ident_make_repo_id (IDL_ns ns, |
---|
876 | IDL_tree p, |
---|
877 | const char *p_prefix, |
---|
878 | int *major, |
---|
879 | int *minor); |
---|
880 | |
---|
881 | #ifdef __cplusplus |
---|
882 | } |
---|
883 | #endif |
---|
884 | |
---|
885 | #endif /* __IDL_H */ |
---|