Sync to Wine-0.9.58
[reactos.git] / reactos / tools / widl / parser.yy.c
1 #define yy_create_buffer parser__create_buffer
2 #define yy_delete_buffer parser__delete_buffer
3 #define yy_scan_buffer parser__scan_buffer
4 #define yy_scan_string parser__scan_string
5 #define yy_scan_bytes parser__scan_bytes
6 #define yy_flex_debug parser__flex_debug
7 #define yy_init_buffer parser__init_buffer
8 #define yy_flush_buffer parser__flush_buffer
9 #define yy_load_buffer_state parser__load_buffer_state
10 #define yy_switch_to_buffer parser__switch_to_buffer
11 #define yyin parser_in
12 #define yyleng parser_leng
13 #define yylex parser_lex
14 #define yyout parser_out
15 #define yyrestart parser_restart
16 #define yytext parser_text
17 #define yywrap parser_wrap
18
19 #line 20 "parser.yy.c"
20 /* A lexical scanner generated by flex */
21
22 /* Scanner skeleton version:
23 * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
24 */
25
26 #define FLEX_SCANNER
27 #define YY_FLEX_MAJOR_VERSION 2
28 #define YY_FLEX_MINOR_VERSION 5
29
30 #include <stdio.h>
31
32
33 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
34 #ifdef c_plusplus
35 #ifndef __cplusplus
36 #define __cplusplus
37 #endif
38 #endif
39
40
41 #ifdef __cplusplus
42
43 #include <stdlib.h>
44 #include <unistd.h>
45
46 /* Use prototypes in function declarations. */
47 #define YY_USE_PROTOS
48
49 /* The "const" storage-class-modifier is valid. */
50 #define YY_USE_CONST
51
52 #else /* ! __cplusplus */
53
54 #if __STDC__
55
56 #define YY_USE_PROTOS
57 #define YY_USE_CONST
58
59 #endif /* __STDC__ */
60 #endif /* ! __cplusplus */
61
62 #ifdef __TURBOC__
63 #pragma warn -rch
64 #pragma warn -use
65 #include <io.h>
66 #include <stdlib.h>
67 #define YY_USE_CONST
68 #define YY_USE_PROTOS
69 #endif
70
71 #ifdef YY_USE_CONST
72 #define yyconst const
73 #else
74 #define yyconst
75 #endif
76
77
78 #ifdef YY_USE_PROTOS
79 #define YY_PROTO(proto) proto
80 #else
81 #define YY_PROTO(proto) ()
82 #endif
83
84 /* Returned upon end-of-file. */
85 #define YY_NULL 0
86
87 /* Promotes a possibly negative, possibly signed char to an unsigned
88 * integer for use as an array index. If the signed char is negative,
89 * we want to instead treat it as an 8-bit unsigned char, hence the
90 * double cast.
91 */
92 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
93
94 /* Enter a start condition. This macro really ought to take a parameter,
95 * but we do it the disgusting crufty way forced on us by the ()-less
96 * definition of BEGIN.
97 */
98 #define BEGIN yy_start = 1 + 2 *
99
100 /* Translate the current start state into a value that can be later handed
101 * to BEGIN to return to the state. The YYSTATE alias is for lex
102 * compatibility.
103 */
104 #define YY_START ((yy_start - 1) / 2)
105 #define YYSTATE YY_START
106
107 /* Action number for EOF rule of a given start state. */
108 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
109
110 /* Special action meaning "start processing a new file". */
111 #define YY_NEW_FILE yyrestart( yyin )
112
113 #define YY_END_OF_BUFFER_CHAR 0
114
115 /* Size of default input buffer. */
116 #define YY_BUF_SIZE 16384
117
118 typedef struct yy_buffer_state *YY_BUFFER_STATE;
119
120 extern int yyleng;
121 extern FILE *yyin, *yyout;
122
123 #define EOB_ACT_CONTINUE_SCAN 0
124 #define EOB_ACT_END_OF_FILE 1
125 #define EOB_ACT_LAST_MATCH 2
126
127 /* The funky do-while in the following #define is used to turn the definition
128 * int a single C statement (which needs a semi-colon terminator). This
129 * avoids problems with code like:
130 *
131 * if ( condition_holds )
132 * yyless( 5 );
133 * else
134 * do_something_else();
135 *
136 * Prior to using the do-while the compiler would get upset at the
137 * "else" because it interpreted the "if" statement as being all
138 * done when it reached the ';' after the yyless() call.
139 */
140
141 /* Return all but the first 'n' matched characters back to the input stream. */
142
143 #define yyless(n) \
144 do \
145 { \
146 /* Undo effects of setting up yytext. */ \
147 *yy_cp = yy_hold_char; \
148 YY_RESTORE_YY_MORE_OFFSET \
149 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
150 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
151 } \
152 while ( 0 )
153
154 #define unput(c) yyunput( c, yytext_ptr )
155
156 /* The following is because we cannot portably get our hands on size_t
157 * (without autoconf's help, which isn't available because we want
158 * flex-generated scanners to compile on their own).
159 */
160 typedef unsigned int yy_size_t;
161
162
163 struct yy_buffer_state
164 {
165 FILE *yy_input_file;
166
167 char *yy_ch_buf; /* input buffer */
168 char *yy_buf_pos; /* current position in input buffer */
169
170 /* Size of input buffer in bytes, not including room for EOB
171 * characters.
172 */
173 yy_size_t yy_buf_size;
174
175 /* Number of characters read into yy_ch_buf, not including EOB
176 * characters.
177 */
178 int yy_n_chars;
179
180 /* Whether we "own" the buffer - i.e., we know we created it,
181 * and can realloc() it to grow it, and should free() it to
182 * delete it.
183 */
184 int yy_is_our_buffer;
185
186 /* Whether this is an "interactive" input source; if so, and
187 * if we're using stdio for input, then we want to use getc()
188 * instead of fread(), to make sure we stop fetching input after
189 * each newline.
190 */
191 int yy_is_interactive;
192
193 /* Whether we're considered to be at the beginning of a line.
194 * If so, '^' rules will be active on the next match, otherwise
195 * not.
196 */
197 int yy_at_bol;
198
199 /* Whether to try to fill the input buffer when we reach the
200 * end of it.
201 */
202 int yy_fill_buffer;
203
204 int yy_buffer_status;
205 #define YY_BUFFER_NEW 0
206 #define YY_BUFFER_NORMAL 1
207 /* When an EOF's been seen but there's still some text to process
208 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
209 * shouldn't try reading from the input source any more. We might
210 * still have a bunch of tokens to match, though, because of
211 * possible backing-up.
212 *
213 * When we actually see the EOF, we change the status to "new"
214 * (via yyrestart()), so that the user can continue scanning by
215 * just pointing yyin at a new input file.
216 */
217 #define YY_BUFFER_EOF_PENDING 2
218 };
219
220 static YY_BUFFER_STATE yy_current_buffer = 0;
221
222 /* We provide macros for accessing buffer states in case in the
223 * future we want to put the buffer states in a more general
224 * "scanner state".
225 */
226 #define YY_CURRENT_BUFFER yy_current_buffer
227
228
229 /* yy_hold_char holds the character lost when yytext is formed. */
230 static char yy_hold_char;
231
232 static int yy_n_chars; /* number of characters read into yy_ch_buf */
233
234
235 int yyleng;
236
237 /* Points to current character in buffer. */
238 static char *yy_c_buf_p = (char *) 0;
239 static int yy_init = 1; /* whether we need to initialize */
240 static int yy_start = 0; /* start state number */
241
242 /* Flag which is used to allow yywrap()'s to do buffer switches
243 * instead of setting up a fresh yyin. A bit of a hack ...
244 */
245 static int yy_did_buffer_switch_on_eof;
246
247 void yyrestart YY_PROTO(( FILE *input_file ));
248
249 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
250 void yy_load_buffer_state YY_PROTO(( void ));
251 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
252 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
253 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
254 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
255 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
256
257 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
258 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
259 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
260
261 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
262 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
263 static void yy_flex_free YY_PROTO(( void * ));
264
265 #define yy_new_buffer yy_create_buffer
266
267 #define yy_set_interactive(is_interactive) \
268 { \
269 if ( ! yy_current_buffer ) \
270 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
271 yy_current_buffer->yy_is_interactive = is_interactive; \
272 }
273
274 #define yy_set_bol(at_bol) \
275 { \
276 if ( ! yy_current_buffer ) \
277 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
278 yy_current_buffer->yy_at_bol = at_bol; \
279 }
280
281 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
282
283 typedef unsigned char YY_CHAR;
284 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
285 typedef int yy_state_type;
286 extern char *yytext;
287 #define yytext_ptr yytext
288
289 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
290 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
291 static int yy_get_next_buffer YY_PROTO(( void ));
292 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
293
294 /* Done after the current pattern has been matched and before the
295 * corresponding action - sets up yytext.
296 */
297 #define YY_DO_BEFORE_ACTION \
298 yytext_ptr = yy_bp; \
299 yyleng = (int) (yy_cp - yy_bp); \
300 yy_hold_char = *yy_cp; \
301 *yy_cp = '\0'; \
302 yy_c_buf_p = yy_cp;
303
304 #define YY_NUM_RULES 23
305 #define YY_END_OF_BUFFER 24
306 static yyconst short int yy_accept[113] =
307 { 0,
308 0, 0, 0, 0, 0, 0, 2, 2, 24, 22,
309 19, 18, 3, 14, 14, 22, 22, 17, 17, 9,
310 19, 1, 8, 23, 4, 8, 14, 14, 11, 11,
311 10, 2, 0, 14, 0, 20, 21, 17, 17, 0,
312 1, 1, 7, 6, 5, 14, 0, 11, 11, 2,
313 15, 13, 17, 14, 0, 11, 0, 17, 14, 0,
314 11, 0, 15, 17, 14, 0, 11, 17, 14, 0,
315 11, 17, 14, 0, 11, 17, 14, 0, 11, 17,
316 0, 14, 0, 16, 0, 0, 0, 0, 0, 0,
317 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
318
319 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
320 12, 0
321 } ;
322
323 static yyconst int yy_ec[256] =
324 { 0,
325 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
326 1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
327 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
328 1, 2, 1, 4, 5, 1, 1, 1, 1, 6,
329 1, 1, 7, 1, 8, 9, 1, 10, 11, 11,
330 11, 11, 11, 11, 11, 11, 11, 1, 1, 12,
331 1, 13, 1, 1, 14, 15, 15, 15, 16, 17,
332 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
333 18, 19, 20, 18, 18, 18, 18, 18, 21, 18,
334 22, 23, 24, 1, 18, 1, 15, 15, 15, 15,
335
336 25, 15, 18, 18, 18, 18, 18, 18, 18, 18,
337 18, 18, 18, 18, 18, 18, 18, 18, 18, 26,
338 18, 18, 1, 1, 1, 1, 1, 1, 1, 1,
339 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
340 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
341 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
342 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
343 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
344 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
345 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
346
347 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
348 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
349 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
350 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
351 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
352 1, 1, 1, 1, 1
353 } ;
354
355 static yyconst int yy_meta[27] =
356 { 0,
357 1, 1, 2, 1, 1, 1, 1, 1, 1, 3,
358 3, 1, 1, 3, 3, 3, 3, 4, 4, 4,
359 4, 1, 1, 1, 3, 5
360 } ;
361
362 static yyconst short int yy_base[151] =
363 { 0,
364 0, 25, 25, 28, 42, 31, 265, 264, 266, 269,
365 269, 269, 269, 60, 28, 253, 251, 0, 249, 269,
366 38, 260, 269, 269, 269, 31, 39, 62, 79, 0,
367 269, 0, 31, 35, 0, 269, 269, 0, 244, 72,
368 258, 257, 269, 269, 269, 65, 0, 96, 0, 0,
369 113, 0, 242, 68, 0, 129, 149, 240, 70, 0,
370 151, 72, 74, 229, 81, 0, 168, 224, 91, 0,
371 185, 212, 98, 0, 202, 204, 117, 216, 207, 124,
372 0, 108, 129, 269, 0, 0, 0, 206, 0, 0,
373 0, 0, 201, 0, 0, 0, 0, 200, 0, 0,
374
375 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
376 269, 269, 228, 233, 236, 241, 244, 247, 252, 204,
377 195, 194, 189, 188, 187, 178, 177, 172, 171, 170,
378 161, 160, 155, 150, 149, 148, 139, 138, 134, 133,
379 131, 130, 129, 117, 100, 84, 61, 52, 44, 31
380 } ;
381
382 static yyconst short int yy_def[151] =
383 { 0,
384 112, 1, 113, 113, 1, 5, 114, 114, 112, 112,
385 112, 112, 112, 112, 112, 112, 112, 115, 115, 112,
386 112, 112, 112, 112, 112, 116, 117, 117, 112, 118,
387 112, 119, 112, 112, 120, 112, 112, 115, 115, 112,
388 112, 112, 112, 112, 112, 121, 121, 112, 118, 119,
389 112, 120, 115, 122, 122, 112, 112, 115, 123, 123,
390 112, 112, 51, 115, 124, 124, 112, 115, 125, 125,
391 112, 115, 126, 126, 112, 115, 112, 112, 118, 115,
392 127, 112, 112, 112, 128, 129, 130, 112, 131, 132,
393 133, 134, 112, 135, 136, 137, 138, 112, 139, 140,
394
395 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
396 112, 0, 112, 112, 112, 112, 112, 112, 112, 112,
397 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
398 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
399 112, 112, 112, 112, 112, 112, 112, 112, 112, 112
400 } ;
401
402 static yyconst short int yy_nxt[296] =
403 { 0,
404 10, 11, 12, 13, 10, 10, 10, 10, 10, 14,
405 15, 16, 17, 18, 18, 18, 18, 18, 18, 19,
406 18, 20, 10, 10, 18, 18, 21, 24, 25, 22,
407 24, 25, 21, 111, 44, 22, 33, 34, 34, 40,
408 51, 51, 41, 33, 34, 34, 110, 26, 46, 46,
409 26, 27, 28, 45, 109, 29, 29, 29, 29, 30,
410 30, 30, 30, 108, 35, 31, 29, 30, 33, 34,
411 34, 46, 46, 40, 54, 54, 41, 59, 59, 65,
412 65, 63, 63, 63, 63, 35, 107, 112, 48, 48,
413 69, 69, 48, 48, 48, 48, 49, 49, 49, 49,
414
415 73, 73, 106, 48, 49, 56, 56, 77, 77, 56,
416 56, 56, 56, 49, 49, 49, 49, 82, 82, 105,
417 56, 49, 51, 51, 81, 83, 82, 82, 57, 84,
418 83, 104, 103, 102, 84, 101, 100, 57, 61, 61,
419 98, 97, 61, 61, 61, 61, 49, 49, 49, 49,
420 96, 95, 93, 61, 49, 62, 62, 92, 63, 63,
421 67, 67, 91, 90, 67, 67, 67, 67, 49, 49,
422 49, 49, 88, 87, 86, 67, 49, 71, 71, 85,
423 78, 71, 71, 71, 71, 49, 49, 49, 49, 74,
424 70, 66, 71, 49, 75, 75, 60, 55, 75, 75,
425
426 75, 75, 49, 49, 49, 49, 52, 99, 94, 75,
427 49, 79, 79, 89, 81, 79, 79, 79, 79, 49,
428 49, 49, 49, 81, 80, 76, 79, 49, 23, 23,
429 23, 23, 23, 32, 32, 32, 32, 32, 38, 38,
430 38, 43, 72, 43, 43, 43, 47, 68, 47, 49,
431 49, 49, 50, 64, 50, 50, 50, 58, 42, 42,
432 53, 42, 39, 37, 36, 112, 24, 24, 9, 112,
433 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
434 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
435 112, 112, 112, 112, 112
436
437 } ;
438
439 static yyconst short int yy_chk[296] =
440 { 0,
441 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
442 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
443 1, 1, 1, 1, 1, 1, 2, 3, 3, 2,
444 4, 4, 6, 150, 26, 6, 15, 15, 15, 21,
445 33, 33, 21, 34, 34, 34, 149, 3, 27, 27,
446 4, 5, 5, 26, 148, 5, 5, 5, 5, 5,
447 5, 5, 5, 147, 27, 5, 5, 5, 14, 14,
448 14, 28, 28, 40, 46, 46, 40, 54, 54, 59,
449 59, 62, 62, 63, 63, 14, 146, 28, 29, 29,
450 65, 65, 29, 29, 29, 29, 29, 29, 29, 29,
451
452 69, 69, 145, 29, 29, 48, 48, 73, 73, 48,
453 48, 48, 48, 48, 48, 48, 48, 82, 82, 144,
454 48, 48, 51, 51, 77, 80, 77, 77, 51, 80,
455 83, 143, 142, 141, 83, 140, 139, 51, 56, 56,
456 138, 137, 56, 56, 56, 56, 56, 56, 56, 56,
457 136, 135, 134, 56, 56, 57, 57, 133, 57, 57,
458 61, 61, 132, 131, 61, 61, 61, 61, 61, 61,
459 61, 61, 130, 129, 128, 61, 61, 67, 67, 127,
460 126, 67, 67, 67, 67, 67, 67, 67, 67, 125,
461 124, 123, 67, 67, 71, 71, 122, 121, 71, 71,
462
463 71, 71, 71, 71, 71, 71, 120, 98, 93, 71,
464 71, 75, 75, 88, 79, 75, 75, 75, 75, 75,
465 75, 75, 75, 78, 76, 72, 75, 75, 113, 113,
466 113, 113, 113, 114, 114, 114, 114, 114, 115, 115,
467 115, 116, 68, 116, 116, 116, 117, 64, 117, 118,
468 118, 118, 119, 58, 119, 119, 119, 53, 42, 41,
469 39, 22, 19, 17, 16, 9, 8, 7, 112, 112,
470 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
471 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
472 112, 112, 112, 112, 112
473
474 } ;
475
476 static yy_state_type yy_last_accepting_state;
477 static char *yy_last_accepting_cpos;
478
479 /* The intent behind this definition is that it'll catch
480 * any uses of REJECT which flex missed.
481 */
482 #define REJECT reject_used_but_not_detected
483 #define yymore() yymore_used_but_not_detected
484 #define YY_MORE_ADJ 0
485 #define YY_RESTORE_YY_MORE_OFFSET
486 char *yytext;
487 #line 1 "parser.l"
488 #define INITIAL 0
489 /* -*-C-*-
490 * IDL Compiler
491 *
492 * Copyright 2002 Ove Kaaven
493 *
494 * This library is free software; you can redistribute it and/or
495 * modify it under the terms of the GNU Lesser General Public
496 * License as published by the Free Software Foundation; either
497 * version 2.1 of the License, or (at your option) any later version.
498 *
499 * This library is distributed in the hope that it will be useful,
500 * but WITHOUT ANY WARRANTY; without even the implied warranty of
501 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
502 * Lesser General Public License for more details.
503 *
504 * You should have received a copy of the GNU Lesser General Public
505 * License along with this library; if not, write to the Free Software
506 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
507 */
508 #define YY_STACK_USED 1
509 #define YY_NO_UNPUT 1
510 #define YY_NO_TOP_STATE 1
511 #define YY_NEVER_INTERACTIVE 1
512 #define QUOTE 1
513
514 #define ATTR 2
515
516 #define PP_LINE 3
517
518 #line 39 "parser.l"
519
520 #include "config.h"
521
522 #include <stdio.h>
523 #include <stdlib.h>
524 #include <string.h>
525 #include <ctype.h>
526 #include <assert.h>
527
528 #ifdef HAVE_UNISTD_H
529 #include <unistd.h>
530 #else
531 #define YY_NO_UNISTD_H
532 #endif
533
534 #include "widl.h"
535 #include "utils.h"
536 #include "parser.h"
537 #include "wine/wpp.h"
538
539 #include "parser.tab.h"
540
541 extern char *temp_name;
542
543 static void addcchar(char c);
544 static char *get_buffered_cstring(void);
545
546 static char *cbuffer;
547 static int cbufidx;
548 static int cbufalloc = 0;
549
550 static int kw_token(const char *kw);
551 static int attr_token(const char *kw);
552
553 #define MAX_IMPORT_DEPTH 10
554 struct {
555 YY_BUFFER_STATE state;
556 char *input_name;
557 int line_number;
558 char *temp_name;
559 } import_stack[MAX_IMPORT_DEPTH];
560 int import_stack_ptr = 0;
561
562 static void pop_import(void);
563
564 UUID *parse_uuid(const char *u)
565 {
566 UUID* uuid = xmalloc(sizeof(UUID));
567 char b[3];
568 /* it would be nice to use UuidFromStringA */
569 uuid->Data1 = strtoul(u, NULL, 16);
570 uuid->Data2 = strtoul(u+9, NULL, 16);
571 uuid->Data3 = strtoul(u+14, NULL, 16);
572 b[2] = 0;
573 memcpy(b, u+19, 2); uuid->Data4[0] = strtoul(b, NULL, 16);
574 memcpy(b, u+21, 2); uuid->Data4[1] = strtoul(b, NULL, 16);
575 memcpy(b, u+24, 2); uuid->Data4[2] = strtoul(b, NULL, 16);
576 memcpy(b, u+26, 2); uuid->Data4[3] = strtoul(b, NULL, 16);
577 memcpy(b, u+28, 2); uuid->Data4[4] = strtoul(b, NULL, 16);
578 memcpy(b, u+30, 2); uuid->Data4[5] = strtoul(b, NULL, 16);
579 memcpy(b, u+32, 2); uuid->Data4[6] = strtoul(b, NULL, 16);
580 memcpy(b, u+34, 2); uuid->Data4[7] = strtoul(b, NULL, 16);
581 return uuid;
582 }
583
584 /*
585 **************************************************************************
586 * The flexer starts here
587 **************************************************************************
588 */
589 #line 590 "parser.yy.c"
590
591 /* Macros after this point can all be overridden by user definitions in
592 * section 1.
593 */
594
595 #ifndef YY_SKIP_YYWRAP
596 #ifdef __cplusplus
597 extern "C" int yywrap YY_PROTO(( void ));
598 #else
599 extern int yywrap YY_PROTO(( void ));
600 #endif
601 #endif
602
603 #ifndef YY_NO_UNPUT
604 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
605 #endif
606
607 #ifndef yytext_ptr
608 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
609 #endif
610
611 #ifdef YY_NEED_STRLEN
612 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
613 #endif
614
615 #ifndef YY_NO_INPUT
616 #ifdef __cplusplus
617 static int yyinput YY_PROTO(( void ));
618 #else
619 static int input YY_PROTO(( void ));
620 #endif
621 #endif
622
623 #if YY_STACK_USED
624 static int yy_start_stack_ptr = 0;
625 static int yy_start_stack_depth = 0;
626 static int *yy_start_stack = 0;
627 #ifndef YY_NO_PUSH_STATE
628 static void yy_push_state YY_PROTO(( int new_state ));
629 #endif
630 #ifndef YY_NO_POP_STATE
631 static void yy_pop_state YY_PROTO(( void ));
632 #endif
633 #ifndef YY_NO_TOP_STATE
634 static int yy_top_state YY_PROTO(( void ));
635 #endif
636
637 #else
638 #define YY_NO_PUSH_STATE 1
639 #define YY_NO_POP_STATE 1
640 #define YY_NO_TOP_STATE 1
641 #endif
642
643 #ifdef YY_MALLOC_DECL
644 YY_MALLOC_DECL
645 #else
646 #if __STDC__
647 #ifndef __cplusplus
648 #include <stdlib.h>
649 #endif
650 #else
651 /* Just try to get by without declaring the routines. This will fail
652 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
653 * or sizeof(void*) != sizeof(int).
654 */
655 #endif
656 #endif
657
658 /* Amount of stuff to slurp up with each read. */
659 #ifndef YY_READ_BUF_SIZE
660 #define YY_READ_BUF_SIZE 8192
661 #endif
662
663 /* Copy whatever the last rule matched to the standard output. */
664
665 #ifndef ECHO
666 /* This used to be an fputs(), but since the string might contain NUL's,
667 * we now use fwrite().
668 */
669 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
670 #endif
671
672 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
673 * is returned in "result".
674 */
675 #ifndef YY_INPUT
676 #define YY_INPUT(buf,result,max_size) \
677 if ( yy_current_buffer->yy_is_interactive ) \
678 { \
679 int c = '*', n; \
680 for ( n = 0; n < max_size && \
681 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
682 buf[n] = (char) c; \
683 if ( c == '\n' ) \
684 buf[n++] = (char) c; \
685 if ( c == EOF && ferror( yyin ) ) \
686 YY_FATAL_ERROR( "input in flex scanner failed" ); \
687 result = n; \
688 } \
689 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
690 && ferror( yyin ) ) \
691 YY_FATAL_ERROR( "input in flex scanner failed" );
692 #endif
693
694 /* No semi-colon after return; correct usage is to write "yyterminate();" -
695 * we don't want an extra ';' after the "return" because that will cause
696 * some compilers to complain about unreachable statements.
697 */
698 #ifndef yyterminate
699 #define yyterminate() return YY_NULL
700 #endif
701
702 /* Number of entries by which start-condition stack grows. */
703 #ifndef YY_START_STACK_INCR
704 #define YY_START_STACK_INCR 25
705 #endif
706
707 /* Report a fatal error. */
708 #ifndef YY_FATAL_ERROR
709 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
710 #endif
711
712 /* Default declaration of generated scanner - a define so the user can
713 * easily add parameters.
714 */
715 #ifndef YY_DECL
716 #define YY_DECL int yylex YY_PROTO(( void ))
717 #endif
718
719 /* Code executed at the beginning of each rule, after yytext and yyleng
720 * have been set up.
721 */
722 #ifndef YY_USER_ACTION
723 #define YY_USER_ACTION
724 #endif
725
726 /* Code executed at the end of each rule. */
727 #ifndef YY_BREAK
728 #define YY_BREAK break;
729 #endif
730
731 #define YY_RULE_SETUP \
732 if ( yyleng > 0 ) \
733 yy_current_buffer->yy_at_bol = \
734 (yytext[yyleng - 1] == '\n'); \
735 YY_USER_ACTION
736
737 YY_DECL
738 {
739 register yy_state_type yy_current_state;
740 register char *yy_cp, *yy_bp;
741 register int yy_act;
742
743 #line 111 "parser.l"
744
745 #line 746 "parser.yy.c"
746
747 if ( yy_init )
748 {
749 yy_init = 0;
750
751 #ifdef YY_USER_INIT
752 YY_USER_INIT;
753 #endif
754
755 if ( ! yy_start )
756 yy_start = 1; /* first start state */
757
758 if ( ! yyin )
759 yyin = stdin;
760
761 if ( ! yyout )
762 yyout = stdout;
763
764 if ( ! yy_current_buffer )
765 yy_current_buffer =
766 yy_create_buffer( yyin, YY_BUF_SIZE );
767
768 yy_load_buffer_state();
769 }
770
771 while ( 1 ) /* loops until end-of-file is reached */
772 {
773 yy_cp = yy_c_buf_p;
774
775 /* Support of yytext. */
776 *yy_cp = yy_hold_char;
777
778 /* yy_bp points to the position in yy_ch_buf of the start of
779 * the current run.
780 */
781 yy_bp = yy_cp;
782
783 yy_current_state = yy_start;
784 yy_current_state += YY_AT_BOL();
785 yy_match:
786 do
787 {
788 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
789 if ( yy_accept[yy_current_state] )
790 {
791 yy_last_accepting_state = yy_current_state;
792 yy_last_accepting_cpos = yy_cp;
793 }
794 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
795 {
796 yy_current_state = (int) yy_def[yy_current_state];
797 if ( yy_current_state >= 113 )
798 yy_c = yy_meta[(unsigned int) yy_c];
799 }
800 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
801 ++yy_cp;
802 }
803 while ( yy_base[yy_current_state] != 269 );
804
805 yy_find_action:
806 yy_act = yy_accept[yy_current_state];
807 if ( yy_act == 0 )
808 { /* have to back up */
809 yy_cp = yy_last_accepting_cpos;
810 yy_current_state = yy_last_accepting_state;
811 yy_act = yy_accept[yy_current_state];
812 }
813
814 YY_DO_BEFORE_ACTION;
815
816
817 do_action: /* This label is used only to access EOF actions. */
818
819
820 switch ( yy_act )
821 { /* beginning of action switch */
822 case 0: /* must back up */
823 /* undo the effects of YY_DO_BEFORE_ACTION */
824 *yy_cp = yy_hold_char;
825 yy_cp = yy_last_accepting_cpos;
826 yy_current_state = yy_last_accepting_state;
827 goto yy_find_action;
828
829 case 1:
830 YY_RULE_SETUP
831 #line 112 "parser.l"
832 yy_push_state(PP_LINE);
833 YY_BREAK
834 case 2:
835 YY_RULE_SETUP
836 #line 113 "parser.l"
837 {
838 int lineno;
839 char *cptr, *fname;
840 yy_pop_state();
841 lineno = (int)strtol(yytext, &cptr, 10);
842 if(!lineno)
843 error_loc("Malformed '#...' line-directive; invalid linenumber\n");
844 fname = strchr(cptr, '"');
845 if(!fname)
846 error_loc("Malformed '#...' line-directive; missing filename\n");
847 fname++;
848 cptr = strchr(fname, '"');
849 if(!cptr)
850 error_loc("Malformed '#...' line-directive; missing terminating \"\n");
851 *cptr = '\0';
852 line_number = lineno - 1; /* We didn't read the newline */
853 free( input_name );
854 input_name = xstrdup(fname);
855 }
856 YY_BREAK
857 case 3:
858 YY_RULE_SETUP
859 #line 132 "parser.l"
860 yy_push_state(QUOTE); cbufidx = 0;
861 YY_BREAK
862 case 4:
863 YY_RULE_SETUP
864 #line 133 "parser.l"
865 {
866 yy_pop_state();
867 parser_lval.str = get_buffered_cstring();
868 return aSTRING;
869 }
870 YY_BREAK
871 case 5:
872 #line 139 "parser.l"
873 case 6:
874 YY_RULE_SETUP
875 #line 139 "parser.l"
876 addcchar(yytext[1]);
877 YY_BREAK
878 case 7:
879 YY_RULE_SETUP
880 #line 140 "parser.l"
881 addcchar('\\'); addcchar(yytext[1]);
882 YY_BREAK
883 case 8:
884 YY_RULE_SETUP
885 #line 141 "parser.l"
886 addcchar(yytext[0]);
887 YY_BREAK
888 case 9:
889 YY_RULE_SETUP
890 #line 142 "parser.l"
891 yy_push_state(ATTR); return '[';
892 YY_BREAK
893 case 10:
894 YY_RULE_SETUP
895 #line 143 "parser.l"
896 yy_pop_state(); return ']';
897 YY_BREAK
898 case 11:
899 YY_RULE_SETUP
900 #line 144 "parser.l"
901 return attr_token(yytext);
902 YY_BREAK
903 case 12:
904 YY_RULE_SETUP
905 #line 145 "parser.l"
906 {
907 parser_lval.uuid = parse_uuid(yytext);
908 return aUUID;
909 }
910 YY_BREAK
911 case 13:
912 YY_RULE_SETUP
913 #line 149 "parser.l"
914 {
915 parser_lval.num = strtoul(yytext, NULL, 0);
916 return aHEXNUM;
917 }
918 YY_BREAK
919 case 14:
920 YY_RULE_SETUP
921 #line 153 "parser.l"
922 {
923 parser_lval.num = strtoul(yytext, NULL, 0);
924 return aNUM;
925 }
926 YY_BREAK
927 case 15:
928 YY_RULE_SETUP
929 #line 157 "parser.l"
930 {
931 parser_lval.dbl = strtod(yytext, NULL);
932 return aDOUBLE;
933 }
934 YY_BREAK
935 case 16:
936 *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
937 yy_c_buf_p = yy_cp -= 1;
938 YY_DO_BEFORE_ACTION; /* set up yytext again */
939 YY_RULE_SETUP
940 #line 161 "parser.l"
941 return tSAFEARRAY;
942 YY_BREAK
943 case 17:
944 YY_RULE_SETUP
945 #line 162 "parser.l"
946 return kw_token(yytext);
947 YY_BREAK
948 case 18:
949 YY_RULE_SETUP
950 #line 163 "parser.l"
951 line_number++;
952 YY_BREAK
953 case 19:
954 YY_RULE_SETUP
955 #line 164 "parser.l"
956
957 YY_BREAK
958 case 20:
959 YY_RULE_SETUP
960 #line 165 "parser.l"
961 return SHL;
962 YY_BREAK
963 case 21:
964 YY_RULE_SETUP
965 #line 166 "parser.l"
966 return SHR;
967 YY_BREAK
968 case 22:
969 YY_RULE_SETUP
970 #line 167 "parser.l"
971 return yytext[0];
972 YY_BREAK
973 case YY_STATE_EOF(INITIAL):
974 case YY_STATE_EOF(QUOTE):
975 case YY_STATE_EOF(ATTR):
976 case YY_STATE_EOF(PP_LINE):
977 #line 168 "parser.l"
978 {
979 if (import_stack_ptr) {
980 pop_import();
981 return aEOF;
982 }
983 else yyterminate();
984 }
985 YY_BREAK
986 case 23:
987 YY_RULE_SETUP
988 #line 175 "parser.l"
989 ECHO;
990 YY_BREAK
991 #line 992 "parser.yy.c"
992
993 case YY_END_OF_BUFFER:
994 {
995 /* Amount of text matched not including the EOB char. */
996 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
997
998 /* Undo the effects of YY_DO_BEFORE_ACTION. */
999 *yy_cp = yy_hold_char;
1000 YY_RESTORE_YY_MORE_OFFSET
1001
1002 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
1003 {
1004 /* We're scanning a new file or input source. It's
1005 * possible that this happened because the user
1006 * just pointed yyin at a new source and called
1007 * yylex(). If so, then we have to assure
1008 * consistency between yy_current_buffer and our
1009 * globals. Here is the right place to do so, because
1010 * this is the first action (other than possibly a
1011 * back-up) that will match for the new input source.
1012 */
1013 yy_n_chars = yy_current_buffer->yy_n_chars;
1014 yy_current_buffer->yy_input_file = yyin;
1015 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
1016 }
1017
1018 /* Note that here we test for yy_c_buf_p "<=" to the position
1019 * of the first EOB in the buffer, since yy_c_buf_p will
1020 * already have been incremented past the NUL character
1021 * (since all states make transitions on EOB to the
1022 * end-of-buffer state). Contrast this with the test
1023 * in input().
1024 */
1025 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1026 { /* This was really a NUL. */
1027 yy_state_type yy_next_state;
1028
1029 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1030
1031 yy_current_state = yy_get_previous_state();
1032
1033 /* Okay, we're now positioned to make the NUL
1034 * transition. We couldn't have
1035 * yy_get_previous_state() go ahead and do it
1036 * for us because it doesn't know how to deal
1037 * with the possibility of jamming (and we don't
1038 * want to build jamming into it because then it
1039 * will run more slowly).
1040 */
1041
1042 yy_next_state = yy_try_NUL_trans( yy_current_state );
1043
1044 yy_bp = yytext_ptr + YY_MORE_ADJ;
1045
1046 if ( yy_next_state )
1047 {
1048 /* Consume the NUL. */
1049 yy_cp = ++yy_c_buf_p;
1050 yy_current_state = yy_next_state;
1051 goto yy_match;
1052 }
1053
1054 else
1055 {
1056 yy_cp = yy_c_buf_p;
1057 goto yy_find_action;
1058 }
1059 }
1060
1061 else switch ( yy_get_next_buffer() )
1062 {
1063 case EOB_ACT_END_OF_FILE:
1064 {
1065 yy_did_buffer_switch_on_eof = 0;
1066
1067 if ( yywrap() )
1068 {
1069 /* Note: because we've taken care in
1070 * yy_get_next_buffer() to have set up
1071 * yytext, we can now set up
1072 * yy_c_buf_p so that if some total
1073 * hoser (like flex itself) wants to
1074 * call the scanner after we return the
1075 * YY_NULL, it'll still work - another
1076 * YY_NULL will get returned.
1077 */
1078 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1079
1080 yy_act = YY_STATE_EOF(YY_START);
1081 goto do_action;
1082 }
1083
1084 else
1085 {
1086 if ( ! yy_did_buffer_switch_on_eof )
1087 YY_NEW_FILE;
1088 }
1089 break;
1090 }
1091
1092 case EOB_ACT_CONTINUE_SCAN:
1093 yy_c_buf_p =
1094 yytext_ptr + yy_amount_of_matched_text;
1095
1096 yy_current_state = yy_get_previous_state();
1097
1098 yy_cp = yy_c_buf_p;
1099 yy_bp = yytext_ptr + YY_MORE_ADJ;
1100 goto yy_match;
1101
1102 case EOB_ACT_LAST_MATCH:
1103 yy_c_buf_p =
1104 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1105
1106 yy_current_state = yy_get_previous_state();
1107
1108 yy_cp = yy_c_buf_p;
1109 yy_bp = yytext_ptr + YY_MORE_ADJ;
1110 goto yy_find_action;
1111 }
1112 break;
1113 }
1114
1115 default:
1116 YY_FATAL_ERROR(
1117 "fatal flex scanner internal error--no action found" );
1118 } /* end of action switch */
1119 } /* end of scanning one token */
1120 } /* end of yylex */
1121
1122
1123 /* yy_get_next_buffer - try to read in a new buffer
1124 *
1125 * Returns a code representing an action:
1126 * EOB_ACT_LAST_MATCH -
1127 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1128 * EOB_ACT_END_OF_FILE - end of file
1129 */
1130
1131 static int yy_get_next_buffer()
1132 {
1133 register char *dest = yy_current_buffer->yy_ch_buf;
1134 register char *source = yytext_ptr;
1135 register int number_to_move, i;
1136 int ret_val;
1137
1138 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1139 YY_FATAL_ERROR(
1140 "fatal flex scanner internal error--end of buffer missed" );
1141
1142 if ( yy_current_buffer->yy_fill_buffer == 0 )
1143 { /* Don't try to fill the buffer, so this is an EOF. */
1144 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1145 {
1146 /* We matched a single character, the EOB, so
1147 * treat this as a final EOF.
1148 */
1149 return EOB_ACT_END_OF_FILE;
1150 }
1151
1152 else
1153 {
1154 /* We matched some text prior to the EOB, first
1155 * process it.
1156 */
1157 return EOB_ACT_LAST_MATCH;
1158 }
1159 }
1160
1161 /* Try to read more data. */
1162
1163 /* First move last chars to start of buffer. */
1164 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1165
1166 for ( i = 0; i < number_to_move; ++i )
1167 *(dest++) = *(source++);
1168
1169 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1170 /* don't do the read, it's not guaranteed to return an EOF,
1171 * just force an EOF
1172 */
1173 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1174
1175 else
1176 {
1177 int num_to_read =
1178 yy_current_buffer->yy_buf_size - number_to_move - 1;
1179
1180 while ( num_to_read <= 0 )
1181 { /* Not enough room in the buffer - grow it. */
1182 #ifdef YY_USES_REJECT
1183 YY_FATAL_ERROR(
1184 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1185 #else
1186
1187 /* just a shorter name for the current buffer */
1188 YY_BUFFER_STATE b = yy_current_buffer;
1189
1190 int yy_c_buf_p_offset =
1191 (int) (yy_c_buf_p - b->yy_ch_buf);
1192
1193 if ( b->yy_is_our_buffer )
1194 {
1195 int new_size = b->yy_buf_size * 2;
1196
1197 if ( new_size <= 0 )
1198 b->yy_buf_size += b->yy_buf_size / 8;
1199 else
1200 b->yy_buf_size *= 2;
1201
1202 b->yy_ch_buf = (char *)
1203 /* Include room in for 2 EOB chars. */
1204 yy_flex_realloc( (void *) b->yy_ch_buf,
1205 b->yy_buf_size + 2 );
1206 }
1207 else
1208 /* Can't grow it, we don't own it. */
1209 b->yy_ch_buf = 0;
1210
1211 if ( ! b->yy_ch_buf )
1212 YY_FATAL_ERROR(
1213 "fatal error - scanner input buffer overflow" );
1214
1215 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1216
1217 num_to_read = yy_current_buffer->yy_buf_size -
1218 number_to_move - 1;
1219 #endif
1220 }
1221
1222 if ( num_to_read > YY_READ_BUF_SIZE )
1223 num_to_read = YY_READ_BUF_SIZE;
1224
1225 /* Read in more data. */
1226 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1227 yy_n_chars, num_to_read );
1228
1229 yy_current_buffer->yy_n_chars = yy_n_chars;
1230 }
1231
1232 if ( yy_n_chars == 0 )
1233 {
1234 if ( number_to_move == YY_MORE_ADJ )
1235 {
1236 ret_val = EOB_ACT_END_OF_FILE;
1237 yyrestart( yyin );
1238 }
1239
1240 else
1241 {
1242 ret_val = EOB_ACT_LAST_MATCH;
1243 yy_current_buffer->yy_buffer_status =
1244 YY_BUFFER_EOF_PENDING;
1245 }
1246 }
1247
1248 else
1249 ret_val = EOB_ACT_CONTINUE_SCAN;
1250
1251 yy_n_chars += number_to_move;
1252 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1253 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1254
1255 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1256
1257 return ret_val;
1258 }
1259
1260
1261 /* yy_get_previous_state - get the state just before the EOB char was reached */
1262
1263 static yy_state_type yy_get_previous_state()
1264 {
1265 register yy_state_type yy_current_state;
1266 register char *yy_cp;
1267
1268 yy_current_state = yy_start;
1269 yy_current_state += YY_AT_BOL();
1270
1271 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1272 {
1273 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1274 if ( yy_accept[yy_current_state] )
1275 {
1276 yy_last_accepting_state = yy_current_state;
1277 yy_last_accepting_cpos = yy_cp;
1278 }
1279 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1280 {
1281 yy_current_state = (int) yy_def[yy_current_state];
1282 if ( yy_current_state >= 113 )
1283 yy_c = yy_meta[(unsigned int) yy_c];
1284 }
1285 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1286 }
1287
1288 return yy_current_state;
1289 }
1290
1291
1292 /* yy_try_NUL_trans - try to make a transition on the NUL character
1293 *
1294 * synopsis
1295 * next_state = yy_try_NUL_trans( current_state );
1296 */
1297
1298 #ifdef YY_USE_PROTOS
1299 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1300 #else
1301 static yy_state_type yy_try_NUL_trans( yy_current_state )
1302 yy_state_type yy_current_state;
1303 #endif
1304 {
1305 register int yy_is_jam;
1306 register char *yy_cp = yy_c_buf_p;
1307
1308 register YY_CHAR yy_c = 1;
1309 if ( yy_accept[yy_current_state] )
1310 {
1311 yy_last_accepting_state = yy_current_state;
1312 yy_last_accepting_cpos = yy_cp;
1313 }
1314 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1315 {
1316 yy_current_state = (int) yy_def[yy_current_state];
1317 if ( yy_current_state >= 113 )
1318 yy_c = yy_meta[(unsigned int) yy_c];
1319 }
1320 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1321 yy_is_jam = (yy_current_state == 112);
1322
1323 return yy_is_jam ? 0 : yy_current_state;
1324 }
1325
1326
1327 #ifndef YY_NO_UNPUT
1328 #ifdef YY_USE_PROTOS
1329 static void yyunput( int c, register char *yy_bp )
1330 #else
1331 static void yyunput( c, yy_bp )
1332 int c;
1333 register char *yy_bp;
1334 #endif
1335 {
1336 register char *yy_cp = yy_c_buf_p;
1337
1338 /* undo effects of setting up yytext */
1339 *yy_cp = yy_hold_char;
1340
1341 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1342 { /* need to shift things up to make room */
1343 /* +2 for EOB chars. */
1344 register int number_to_move = yy_n_chars + 2;
1345 register char *dest = &yy_current_buffer->yy_ch_buf[
1346 yy_current_buffer->yy_buf_size + 2];
1347 register char *source =
1348 &yy_current_buffer->yy_ch_buf[number_to_move];
1349
1350 while ( source > yy_current_buffer->yy_ch_buf )
1351 *--dest = *--source;
1352
1353 yy_cp += (int) (dest - source);
1354 yy_bp += (int) (dest - source);
1355 yy_current_buffer->yy_n_chars =
1356 yy_n_chars = yy_current_buffer->yy_buf_size;
1357
1358 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1359 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1360 }
1361
1362 *--yy_cp = (char) c;
1363
1364
1365 yytext_ptr = yy_bp;
1366 yy_hold_char = *yy_cp;
1367 yy_c_buf_p = yy_cp;
1368 }
1369 #endif /* ifndef YY_NO_UNPUT */
1370
1371
1372 #ifdef __cplusplus
1373 static int yyinput()
1374 #else
1375 static int input()
1376 #endif
1377 {
1378 int c;
1379
1380 *yy_c_buf_p = yy_hold_char;
1381
1382 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1383 {
1384 /* yy_c_buf_p now points to the character we want to return.
1385 * If this occurs *before* the EOB characters, then it's a
1386 * valid NUL; if not, then we've hit the end of the buffer.
1387 */
1388 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1389 /* This was really a NUL. */
1390 *yy_c_buf_p = '\0';
1391
1392 else
1393 { /* need more input */
1394 int offset = yy_c_buf_p - yytext_ptr;
1395 ++yy_c_buf_p;
1396
1397 switch ( yy_get_next_buffer() )
1398 {
1399 case EOB_ACT_LAST_MATCH:
1400 /* This happens because yy_g_n_b()
1401 * sees that we've accumulated a
1402 * token and flags that we need to
1403 * try matching the token before
1404 * proceeding. But for input(),
1405 * there's no matching to consider.
1406 * So convert the EOB_ACT_LAST_MATCH
1407 * to EOB_ACT_END_OF_FILE.
1408 */
1409
1410 /* Reset buffer status. */
1411 yyrestart( yyin );
1412
1413 /* fall through */
1414
1415 case EOB_ACT_END_OF_FILE:
1416 {
1417 if ( yywrap() )
1418 return EOF;
1419
1420 if ( ! yy_did_buffer_switch_on_eof )
1421 YY_NEW_FILE;
1422 #ifdef __cplusplus
1423 return yyinput();
1424 #else
1425 return input();
1426 #endif
1427 }
1428
1429 case EOB_ACT_CONTINUE_SCAN:
1430 yy_c_buf_p = yytext_ptr + offset;
1431 break;
1432 }
1433 }
1434 }
1435
1436 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1437 *yy_c_buf_p = '\0'; /* preserve yytext */
1438 yy_hold_char = *++yy_c_buf_p;
1439
1440 yy_current_buffer->yy_at_bol = (c == '\n');
1441
1442 return c;
1443 }
1444
1445
1446 #ifdef YY_USE_PROTOS
1447 void yyrestart( FILE *input_file )
1448 #else
1449 void yyrestart( input_file )
1450 FILE *input_file;
1451 #endif
1452 {
1453 if ( ! yy_current_buffer )
1454 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1455
1456 yy_init_buffer( yy_current_buffer, input_file );
1457 yy_load_buffer_state();
1458 }
1459
1460
1461 #ifdef YY_USE_PROTOS
1462 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1463 #else
1464 void yy_switch_to_buffer( new_buffer )
1465 YY_BUFFER_STATE new_buffer;
1466 #endif
1467 {
1468 if ( yy_current_buffer == new_buffer )
1469 return;
1470
1471 if ( yy_current_buffer )
1472 {
1473 /* Flush out information for old buffer. */
1474 *yy_c_buf_p = yy_hold_char;
1475 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1476 yy_current_buffer->yy_n_chars = yy_n_chars;
1477 }
1478
1479 yy_current_buffer = new_buffer;
1480 yy_load_buffer_state();
1481
1482 /* We don't actually know whether we did this switch during
1483 * EOF (yywrap()) processing, but the only time this flag
1484 * is looked at is after yywrap() is called, so it's safe
1485 * to go ahead and always set it.
1486 */
1487 yy_did_buffer_switch_on_eof = 1;
1488 }
1489
1490
1491 #ifdef YY_USE_PROTOS
1492 void yy_load_buffer_state( void )
1493 #else
1494 void yy_load_buffer_state()
1495 #endif
1496 {
1497 yy_n_chars = yy_current_buffer->yy_n_chars;
1498 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1499 yyin = yy_current_buffer->yy_input_file;
1500 yy_hold_char = *yy_c_buf_p;
1501 }
1502
1503
1504 #ifdef YY_USE_PROTOS
1505 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1506 #else
1507 YY_BUFFER_STATE yy_create_buffer( file, size )
1508 FILE *file;
1509 int size;
1510 #endif
1511 {
1512 YY_BUFFER_STATE b;
1513
1514 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1515 if ( ! b )
1516 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1517
1518 b->yy_buf_size = size;
1519
1520 /* yy_ch_buf has to be 2 characters longer than the size given because
1521 * we need to put in 2 end-of-buffer characters.
1522 */
1523 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1524 if ( ! b->yy_ch_buf )
1525 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1526
1527 b->yy_is_our_buffer = 1;
1528
1529 yy_init_buffer( b, file );
1530
1531 return b;
1532 }
1533
1534
1535 #ifdef YY_USE_PROTOS
1536 void yy_delete_buffer( YY_BUFFER_STATE b )
1537 #else
1538 void yy_delete_buffer( b )
1539 YY_BUFFER_STATE b;
1540 #endif
1541 {
1542 if ( ! b )
1543 return;
1544
1545 if ( b == yy_current_buffer )
1546 yy_current_buffer = (YY_BUFFER_STATE) 0;
1547
1548 if ( b->yy_is_our_buffer )
1549 yy_flex_free( (void *) b->yy_ch_buf );
1550
1551 yy_flex_free( (void *) b );
1552 }
1553
1554
1555 #ifndef YY_ALWAYS_INTERACTIVE
1556 #ifndef YY_NEVER_INTERACTIVE
1557 extern int isatty YY_PROTO(( int ));
1558 #endif
1559 #endif
1560
1561 #ifdef YY_USE_PROTOS
1562 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1563 #else
1564 void yy_init_buffer( b, file )
1565 YY_BUFFER_STATE b;
1566 FILE *file;
1567 #endif
1568
1569
1570 {
1571 yy_flush_buffer( b );
1572
1573 b->yy_input_file = file;
1574 b->yy_fill_buffer = 1;
1575
1576 #if YY_ALWAYS_INTERACTIVE
1577 b->yy_is_interactive = 1;
1578 #else
1579 #if YY_NEVER_INTERACTIVE
1580 b->yy_is_interactive = 0;
1581 #else
1582 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1583 #endif
1584 #endif
1585 }
1586
1587
1588 #ifdef YY_USE_PROTOS
1589 void yy_flush_buffer( YY_BUFFER_STATE b )
1590 #else
1591 void yy_flush_buffer( b )
1592 YY_BUFFER_STATE b;
1593 #endif
1594
1595 {
1596 if ( ! b )
1597 return;
1598
1599 b->yy_n_chars = 0;
1600
1601 /* We always need two end-of-buffer characters. The first causes
1602 * a transition to the end-of-buffer state. The second causes
1603 * a jam in that state.
1604 */
1605 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1606 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1607
1608 b->yy_buf_pos = &b->yy_ch_buf[0];
1609
1610 b->yy_at_bol = 1;
1611 b->yy_buffer_status = YY_BUFFER_NEW;
1612
1613 if ( b == yy_current_buffer )
1614 yy_load_buffer_state();
1615 }
1616
1617
1618 #ifndef YY_NO_SCAN_BUFFER
1619 #ifdef YY_USE_PROTOS
1620 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1621 #else
1622 YY_BUFFER_STATE yy_scan_buffer( base, size )
1623 char *base;
1624 yy_size_t size;
1625 #endif
1626 {
1627 YY_BUFFER_STATE b;
1628
1629 if ( size < 2 ||
1630 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1631 base[size-1] != YY_END_OF_BUFFER_CHAR )
1632 /* They forgot to leave room for the EOB's. */
1633 return 0;
1634
1635 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1636 if ( ! b )
1637 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1638
1639 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1640 b->yy_buf_pos = b->yy_ch_buf = base;
1641 b->yy_is_our_buffer = 0;
1642 b->yy_input_file = 0;
1643 b->yy_n_chars = b->yy_buf_size;
1644 b->yy_is_interactive = 0;
1645 b->yy_at_bol = 1;
1646 b->yy_fill_buffer = 0;
1647 b->yy_buffer_status = YY_BUFFER_NEW;
1648
1649 yy_switch_to_buffer( b );
1650
1651 return b;
1652 }
1653 #endif
1654
1655
1656 #ifndef YY_NO_SCAN_STRING
1657 #ifdef YY_USE_PROTOS
1658 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1659 #else
1660 YY_BUFFER_STATE yy_scan_string( yy_str )
1661 yyconst char *yy_str;
1662 #endif
1663 {
1664 int len;
1665 for ( len = 0; yy_str[len]; ++len )
1666 ;
1667
1668 return yy_scan_bytes( yy_str, len );
1669 }
1670 #endif
1671
1672
1673 #ifndef YY_NO_SCAN_BYTES
1674 #ifdef YY_USE_PROTOS
1675 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1676 #else
1677 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1678 yyconst char *bytes;
1679 int len;
1680 #endif
1681 {
1682 YY_BUFFER_STATE b;
1683 char *buf;
1684 yy_size_t n;
1685 int i;
1686
1687 /* Get memory for full buffer, including space for trailing EOB's. */
1688 n = len + 2;
1689 buf = (char *) yy_flex_alloc( n );
1690 if ( ! buf )
1691 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1692
1693 for ( i = 0; i < len; ++i )
1694 buf[i] = bytes[i];
1695
1696 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1697
1698 b = yy_scan_buffer( buf, n );
1699 if ( ! b )
1700 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1701
1702 /* It's okay to grow etc. this buffer, and we should throw it
1703 * away when we're done.
1704 */
1705 b->yy_is_our_buffer = 1;
1706
1707 return b;
1708 }
1709 #endif
1710
1711
1712 #ifndef YY_NO_PUSH_STATE
1713 #ifdef YY_USE_PROTOS
1714 static void yy_push_state( int new_state )
1715 #else
1716 static void yy_push_state( new_state )
1717 int new_state;
1718 #endif
1719 {
1720 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1721 {
1722 yy_size_t new_size;
1723
1724 yy_start_stack_depth += YY_START_STACK_INCR;
1725 new_size = yy_start_stack_depth * sizeof( int );
1726
1727 if ( ! yy_start_stack )
1728 yy_start_stack = (int *) yy_flex_alloc( new_size );
1729
1730 else
1731 yy_start_stack = (int *) yy_flex_realloc(
1732 (void *) yy_start_stack, new_size );
1733
1734 if ( ! yy_start_stack )
1735 YY_FATAL_ERROR(
1736 "out of memory expanding start-condition stack" );
1737 }
1738
1739 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1740
1741 BEGIN(new_state);
1742 }
1743 #endif
1744
1745
1746 #ifndef YY_NO_POP_STATE
1747 static void yy_pop_state()
1748 {
1749 if ( --yy_start_stack_ptr < 0 )
1750 YY_FATAL_ERROR( "start-condition stack underflow" );
1751
1752 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1753 }
1754 #endif
1755
1756
1757 #ifndef YY_NO_TOP_STATE
1758 static int yy_top_state()
1759 {
1760 return yy_start_stack[yy_start_stack_ptr - 1];
1761 }
1762 #endif
1763
1764 #ifndef YY_EXIT_FAILURE
1765 #define YY_EXIT_FAILURE 2
1766 #endif
1767
1768 #ifdef YY_USE_PROTOS
1769 static void yy_fatal_error( yyconst char msg[] )
1770 #else
1771 static void yy_fatal_error( msg )
1772 char msg[];
1773 #endif
1774 {
1775 (void) fprintf( stderr, "%s\n", msg );
1776 exit( YY_EXIT_FAILURE );
1777 }
1778
1779
1780
1781 /* Redefine yyless() so it works in section 3 code. */
1782
1783 #undef yyless
1784 #define yyless(n) \
1785 do \
1786 { \
1787 /* Undo effects of setting up yytext. */ \
1788 yytext[yyleng] = yy_hold_char; \
1789 yy_c_buf_p = yytext + n; \
1790 yy_hold_char = *yy_c_buf_p; \
1791 *yy_c_buf_p = '\0'; \
1792 yyleng = n; \
1793 } \
1794 while ( 0 )
1795
1796
1797 /* Internal utility routines. */
1798
1799 #ifndef yytext_ptr
1800 #ifdef YY_USE_PROTOS
1801 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1802 #else
1803 static void yy_flex_strncpy( s1, s2, n )
1804 char *s1;
1805 yyconst char *s2;
1806 int n;
1807 #endif
1808 {
1809 register int i;
1810 for ( i = 0; i < n; ++i )
1811 s1[i] = s2[i];
1812 }
1813 #endif
1814
1815 #ifdef YY_NEED_STRLEN
1816 #ifdef YY_USE_PROTOS
1817 static int yy_flex_strlen( yyconst char *s )
1818 #else
1819 static int yy_flex_strlen( s )
1820 yyconst char *s;
1821 #endif
1822 {
1823 register int n;
1824 for ( n = 0; s[n]; ++n )
1825 ;
1826
1827 return n;
1828 }
1829 #endif
1830
1831
1832 #ifdef YY_USE_PROTOS
1833 static void *yy_flex_alloc( yy_size_t size )
1834 #else
1835 static void *yy_flex_alloc( size )
1836 yy_size_t size;
1837 #endif
1838 {
1839 return (void *) malloc( size );
1840 }
1841
1842 #ifdef YY_USE_PROTOS
1843 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1844 #else
1845 static void *yy_flex_realloc( ptr, size )
1846 void *ptr;
1847 yy_size_t size;
1848 #endif
1849 {
1850 /* The cast to (char *) in the following accommodates both
1851 * implementations that use char* generic pointers, and those
1852 * that use void* generic pointers. It works with the latter
1853 * because both ANSI C and C++ allow castless assignment from
1854 * any pointer type to void*, and deal with argument conversions
1855 * as though doing an assignment.
1856 */
1857 return (void *) realloc( (char *) ptr, size );
1858 }
1859
1860 #ifdef YY_USE_PROTOS
1861 static void yy_flex_free( void *ptr )
1862 #else
1863 static void yy_flex_free( ptr )
1864 void *ptr;
1865 #endif
1866 {
1867 free( ptr );
1868 }
1869
1870 #if YY_MAIN
1871 int main()
1872 {
1873 yylex();
1874 return 0;
1875 }
1876 #endif
1877 #line 175 "parser.l"
1878
1879
1880 #ifndef parser_wrap
1881 int parser_wrap(void)
1882 {
1883 return 1;
1884 }
1885 #endif
1886
1887 struct keyword {
1888 const char *kw;
1889 int token;
1890 };
1891
1892 static const struct keyword keywords[] = {
1893 {"FALSE", tFALSE},
1894 {"TRUE", tTRUE},
1895 {"__cdecl", tCDECL},
1896 {"__int64", tINT64},
1897 {"__stdcall", tSTDCALL},
1898 {"_stdcall", tSTDCALL},
1899 {"boolean", tBOOLEAN},
1900 {"byte", tBYTE},
1901 {"callback", tCALLBACK},
1902 {"case", tCASE},
1903 {"char", tCHAR},
1904 {"coclass", tCOCLASS},
1905 {"code", tCODE},
1906 {"comm_status", tCOMMSTATUS},
1907 {"const", tCONST},
1908 {"cpp_quote", tCPPQUOTE},
1909 {"default", tDEFAULT},
1910 {"dispinterface", tDISPINTERFACE},
1911 {"double", tDOUBLE},
1912 {"enum", tENUM},
1913 {"error_status_t", tERRORSTATUST},
1914 {"extern", tEXTERN},
1915 {"float", tFLOAT},
1916 {"handle_t", tHANDLET},
1917 {"hyper", tHYPER},
1918 {"import", tIMPORT},
1919 {"importlib", tIMPORTLIB},
1920 {"in_line", tINLINE},
1921 {"int", tINT},
1922 {"interface", tINTERFACE},
1923 {"library", tLIBRARY},
1924 {"long", tLONG},
1925 {"methods", tMETHODS},
1926 {"module", tMODULE},
1927 {"properties", tPROPERTIES},
1928 {"short", tSHORT},
1929 {"signed", tSIGNED},
1930 {"sizeof", tSIZEOF},
1931 {"small", tSMALL},
1932 {"struct", tSTRUCT},
1933 {"switch", tSWITCH},
1934 {"typedef", tTYPEDEF},
1935 {"union", tUNION},
1936 {"unsigned", tUNSIGNED},
1937 {"void", tVOID},
1938 {"wchar_t", tWCHAR},
1939 };
1940 #define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0]))
1941
1942 /* keywords only recognized in attribute lists */
1943 static const struct keyword attr_keywords[] =
1944 {
1945 {"aggregatable", tAGGREGATABLE},
1946 {"allocate", tALLOCATE},
1947 {"appobject", tAPPOBJECT},
1948 {"async", tASYNC},
1949 {"async_uuid", tASYNCUUID},
1950 {"auto_handle", tAUTOHANDLE},
1951 {"bindable", tBINDABLE},
1952 {"broadcast", tBROADCAST},
1953 {"byte_count", tBYTECOUNT},
1954 {"call_as", tCALLAS},
1955 {"context_handle", tCONTEXTHANDLE},
1956 {"context_handle_noserialize", tCONTEXTHANDLENOSERIALIZE},
1957 {"context_handle_serialize", tCONTEXTHANDLENOSERIALIZE},
1958 {"control", tCONTROL},
1959 {"defaultcollelem", tDEFAULTCOLLELEM},
1960 {"defaultvalue", tDEFAULTVALUE},
1961 {"defaultvtable", tDEFAULTVTABLE},
1962 {"displaybind", tDISPLAYBIND},
1963 {"dllname", tDLLNAME},
1964 {"dual", tDUAL},
1965 {"endpoint", tENDPOINT},
1966 {"entry", tENTRY},
1967 {"explicit_handle", tEXPLICITHANDLE},
1968 {"handle", tHANDLE},
1969 {"helpcontext", tHELPCONTEXT},
1970 {"helpfile", tHELPFILE},
1971 {"helpstring", tHELPSTRING},
1972 {"helpstringcontext", tHELPSTRINGCONTEXT},
1973 {"helpstringdll", tHELPSTRINGDLL},
1974 {"hidden", tHIDDEN},
1975 {"id", tID},
1976 {"idempotent", tIDEMPOTENT},
1977 {"iid_is", tIIDIS},
1978 {"immediatebind", tIMMEDIATEBIND},
1979 {"implicit_handle", tIMPLICITHANDLE},
1980 {"in", tIN},
1981 {"input_sync", tINPUTSYNC},
1982 {"lcid", tLCID},
1983 {"length_is", tLENGTHIS},
1984 {"local", tLOCAL},
1985 {"nonbrowsable", tNONBROWSABLE},
1986 {"noncreatable", tNONCREATABLE},
1987 {"nonextensible", tNONEXTENSIBLE},
1988 {"object", tOBJECT},
1989 {"odl", tODL},
1990 {"oleautomation", tOLEAUTOMATION},
1991 {"optional", tOPTIONAL},
1992 {"out", tOUT},
1993 {"pointer_default", tPOINTERDEFAULT},
1994 {"propget", tPROPGET},
1995 {"propput", tPROPPUT},
1996 {"propputref", tPROPPUTREF},
1997 {"ptr", tPTR},
1998 {"public", tPUBLIC},
1999 {"range", tRANGE},
2000 {"readonly", tREADONLY},
2001 {"ref", tREF},
2002 {"requestedit", tREQUESTEDIT},
2003 {"restricted", tRESTRICTED},
2004 {"retval", tRETVAL},
2005 {"single", tSINGLE},
2006 {"size_is", tSIZEIS},
2007 {"source", tSOURCE},
2008 {"strict_context_handle", tSTRICTCONTEXTHANDLE},
2009 {"string", tSTRING},
2010 {"switch_is", tSWITCHIS},
2011 {"switch_type", tSWITCHTYPE},
2012 {"transmit_as", tTRANSMITAS},
2013 {"unique", tUNIQUE},
2014 {"uuid", tUUID},
2015 {"v1_enum", tV1ENUM},
2016 {"vararg", tVARARG},
2017 {"version", tVERSION},
2018 {"wire_marshal", tWIREMARSHAL},
2019 };
2020
2021
2022 #define KWP(p) ((const struct keyword *)(p))
2023
2024 static int kw_cmp_func(const void *s1, const void *s2)
2025 {
2026 return strcmp(KWP(s1)->kw, KWP(s2)->kw);
2027 }
2028
2029 static int kw_token(const char *kw)
2030 {
2031 struct keyword key, *kwp;
2032 key.kw = kw;
2033 kwp = bsearch(&key, keywords, NKEYWORDS, sizeof(keywords[0]), kw_cmp_func);
2034 if (kwp) {
2035 parser_lval.str = xstrdup(kwp->kw);
2036 return kwp->token;
2037 }
2038 parser_lval.str = xstrdup(kw);
2039 return is_type(kw) ? aKNOWNTYPE : aIDENTIFIER;
2040 }
2041
2042 static int attr_token(const char *kw)
2043 {
2044 struct keyword key, *kwp;
2045 key.kw = kw;
2046 kwp = bsearch(&key, attr_keywords, sizeof(attr_keywords)/sizeof(attr_keywords[0]),
2047 sizeof(attr_keywords[0]), kw_cmp_func);
2048 if (kwp) {
2049 parser_lval.str = xstrdup(kwp->kw);
2050 return kwp->token;
2051 }
2052 return kw_token(kw);
2053 }
2054
2055 static void addcchar(char c)
2056 {
2057 if(cbufidx >= cbufalloc)
2058 {
2059 cbufalloc += 1024;
2060 cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0]));
2061 if(cbufalloc > 65536)
2062 parser_warning("Reallocating string buffer larger than 64kB\n");
2063 }
2064 cbuffer[cbufidx++] = c;
2065 }
2066
2067 static char *get_buffered_cstring(void)
2068 {
2069 addcchar(0);
2070 return xstrdup(cbuffer);
2071 }
2072
2073 static void pop_import(void)
2074 {
2075 int ptr = import_stack_ptr-1;
2076
2077 fclose(yyin);
2078 yy_delete_buffer( YY_CURRENT_BUFFER );
2079 yy_switch_to_buffer( import_stack[ptr].state );
2080 if (temp_name) {
2081 unlink(temp_name);
2082 free(temp_name);
2083 }
2084 temp_name = import_stack[ptr].temp_name;
2085 free( input_name );
2086 input_name = import_stack[ptr].input_name;
2087 line_number = import_stack[ptr].line_number;
2088 import_stack_ptr--;
2089 }
2090
2091 struct imports {
2092 char *name;
2093 struct imports *next;
2094 } *first_import;
2095
2096 int do_import(char *fname)
2097 {
2098 FILE *f;
2099 char *hname, *path, *p;
2100 struct imports *import;
2101 int ptr = import_stack_ptr;
2102 int ret;
2103
2104 if (!parse_only && do_header) {
2105 hname = dup_basename(fname, ".idl");
2106 p = hname + strlen(hname) - 2;
2107 if (p <= hname || strcmp( p, ".h" )) strcat(hname, ".h");
2108
2109 fprintf(header, "#include <%s>\n", hname);
2110 free(hname);
2111 }
2112
2113 import = first_import;
2114 while (import && strcmp(import->name, fname))
2115 import = import->next;
2116 if (import) return 0; /* already imported */
2117
2118 import = xmalloc(sizeof(struct imports));
2119 import->name = xstrdup(fname);
2120 import->next = first_import;
2121 first_import = import;
2122
2123 /* don't search for a file name with a path in the include directories,
2124 * for compatibility with MIDL */
2125 if (strchr( fname, '/' ) || strchr( fname, '\\' ))
2126 path = strdup( fname );
2127 else if (!(path = wpp_find_include( fname, input_name )))
2128 error_loc("Unable to open include file %s\n", fname);
2129
2130 import_stack[ptr].temp_name = temp_name;
2131 import_stack[ptr].input_name = input_name;
2132 import_stack[ptr].line_number = line_number;
2133 import_stack_ptr++;
2134 input_name = path;
2135 line_number = 1;
2136
2137 ret = wpp_parse_temp( path, NULL, &temp_name );
2138 if (ret) exit(1);
2139
2140 if((f = fopen(temp_name, "r")) == NULL)
2141 error_loc("Unable to open %s\n", temp_name);
2142
2143 import_stack[ptr].state = YY_CURRENT_BUFFER;
2144 yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE));
2145 return 1;
2146 }
2147
2148 void abort_import(void)
2149 {
2150 int ptr;
2151
2152 for (ptr=0; ptr<import_stack_ptr; ptr++)
2153 unlink(import_stack[ptr].temp_name);
2154 }