[NTVDM]
[reactos.git] / base / applications / winhlp32 / macro.lex.yy.c
1 #line 2 "macro.lex.yy.c"
2
3 #line 4 "macro.lex.yy.c"
4
5 #define YY_INT_ALIGNED short int
6
7 /* A lexical scanner generated by flex */
8
9 #define FLEX_SCANNER
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 35
13 #if YY_FLEX_SUBMINOR_VERSION > 0
14 #define FLEX_BETA
15 #endif
16
17 /* First, we deal with platform-specific or compiler-specific issues. */
18
19 /* begin standard C headers. */
20 #include <stdio.h>
21 #include <string.h>
22 #include <errno.h>
23 #include <stdlib.h>
24
25 /* end standard C headers. */
26
27 /* flex integer type definitions */
28
29 #ifndef FLEXINT_H
30 #define FLEXINT_H
31
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
35
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types.
38 */
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
41 #endif
42
43 #include <inttypes.h>
44 typedef int8_t flex_int8_t;
45 typedef uint8_t flex_uint8_t;
46 typedef int16_t flex_int16_t;
47 typedef uint16_t flex_uint16_t;
48 typedef int32_t flex_int32_t;
49 typedef uint32_t flex_uint32_t;
50 #else
51 typedef signed char flex_int8_t;
52 typedef short int flex_int16_t;
53 typedef int flex_int32_t;
54 typedef unsigned char flex_uint8_t;
55 typedef unsigned short int flex_uint16_t;
56 typedef unsigned int flex_uint32_t;
57
58 /* Limits of integral types. */
59 #ifndef INT8_MIN
60 #define INT8_MIN (-128)
61 #endif
62 #ifndef INT16_MIN
63 #define INT16_MIN (-32767-1)
64 #endif
65 #ifndef INT32_MIN
66 #define INT32_MIN (-2147483647-1)
67 #endif
68 #ifndef INT8_MAX
69 #define INT8_MAX (127)
70 #endif
71 #ifndef INT16_MAX
72 #define INT16_MAX (32767)
73 #endif
74 #ifndef INT32_MAX
75 #define INT32_MAX (2147483647)
76 #endif
77 #ifndef UINT8_MAX
78 #define UINT8_MAX (255U)
79 #endif
80 #ifndef UINT16_MAX
81 #define UINT16_MAX (65535U)
82 #endif
83 #ifndef UINT32_MAX
84 #define UINT32_MAX (4294967295U)
85 #endif
86
87 #endif /* ! C99 */
88
89 #endif /* ! FLEXINT_H */
90
91 #ifdef __cplusplus
92
93 /* The "const" storage-class-modifier is valid. */
94 #define YY_USE_CONST
95
96 #else /* ! __cplusplus */
97
98 /* C99 requires __STDC__ to be defined as 1. */
99 #if defined (__STDC__)
100
101 #define YY_USE_CONST
102
103 #endif /* defined (__STDC__) */
104 #endif /* ! __cplusplus */
105
106 #ifdef YY_USE_CONST
107 #define yyconst const
108 #else
109 #define yyconst
110 #endif
111
112 /* Returned upon end-of-file. */
113 #define YY_NULL 0
114
115 /* Promotes a possibly negative, possibly signed char to an unsigned
116 * integer for use as an array index. If the signed char is negative,
117 * we want to instead treat it as an 8-bit unsigned char, hence the
118 * double cast.
119 */
120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
121
122 /* Enter a start condition. This macro really ought to take a parameter,
123 * but we do it the disgusting crufty way forced on us by the ()-less
124 * definition of BEGIN.
125 */
126 #define BEGIN (yy_start) = 1 + 2 *
127
128 /* Translate the current start state into a value that can be later handed
129 * to BEGIN to return to the state. The YYSTATE alias is for lex
130 * compatibility.
131 */
132 #define YY_START (((yy_start) - 1) / 2)
133 #define YYSTATE YY_START
134
135 /* Action number for EOF rule of a given start state. */
136 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
137
138 /* Special action meaning "start processing a new file". */
139 #define YY_NEW_FILE yyrestart(yyin )
140
141 #define YY_END_OF_BUFFER_CHAR 0
142
143 /* Size of default input buffer. */
144 #ifndef YY_BUF_SIZE
145 #ifdef __ia64__
146 /* On IA-64, the buffer size is 16k, not 8k.
147 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
148 * Ditto for the __ia64__ case accordingly.
149 */
150 #define YY_BUF_SIZE 32768
151 #else
152 #define YY_BUF_SIZE 16384
153 #endif /* __ia64__ */
154 #endif
155
156 /* The state buf must be large enough to hold one state per character in the main buffer.
157 */
158 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
159
160 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
161 #define YY_TYPEDEF_YY_BUFFER_STATE
162 typedef struct yy_buffer_state *YY_BUFFER_STATE;
163 #endif
164
165 extern int yyleng;
166
167 extern FILE *yyin, *yyout;
168
169 #define EOB_ACT_CONTINUE_SCAN 0
170 #define EOB_ACT_END_OF_FILE 1
171 #define EOB_ACT_LAST_MATCH 2
172
173 #define YY_LESS_LINENO(n)
174
175 /* Return all but the first "n" matched characters back to the input stream. */
176 #define yyless(n) \
177 do \
178 { \
179 /* Undo effects of setting up yytext. */ \
180 int yyless_macro_arg = (n); \
181 YY_LESS_LINENO(yyless_macro_arg);\
182 *yy_cp = (yy_hold_char); \
183 YY_RESTORE_YY_MORE_OFFSET \
184 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
185 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
186 } \
187 while ( 0 )
188
189 #define unput(c) yyunput( c, (yytext_ptr) )
190
191 #ifndef YY_TYPEDEF_YY_SIZE_T
192 #define YY_TYPEDEF_YY_SIZE_T
193 typedef size_t yy_size_t;
194 #endif
195
196 #ifndef YY_STRUCT_YY_BUFFER_STATE
197 #define YY_STRUCT_YY_BUFFER_STATE
198 struct yy_buffer_state
199 {
200 FILE *yy_input_file;
201
202 char *yy_ch_buf; /* input buffer */
203 char *yy_buf_pos; /* current position in input buffer */
204
205 /* Size of input buffer in bytes, not including room for EOB
206 * characters.
207 */
208 yy_size_t yy_buf_size;
209
210 /* Number of characters read into yy_ch_buf, not including EOB
211 * characters.
212 */
213 int yy_n_chars;
214
215 /* Whether we "own" the buffer - i.e., we know we created it,
216 * and can realloc() it to grow it, and should free() it to
217 * delete it.
218 */
219 int yy_is_our_buffer;
220
221 /* Whether this is an "interactive" input source; if so, and
222 * if we're using stdio for input, then we want to use getc()
223 * instead of fread(), to make sure we stop fetching input after
224 * each newline.
225 */
226 int yy_is_interactive;
227
228 /* Whether we're considered to be at the beginning of a line.
229 * If so, '^' rules will be active on the next match, otherwise
230 * not.
231 */
232 int yy_at_bol;
233
234 int yy_bs_lineno; /**< The line count. */
235 int yy_bs_column; /**< The column count. */
236
237 /* Whether to try to fill the input buffer when we reach the
238 * end of it.
239 */
240 int yy_fill_buffer;
241
242 int yy_buffer_status;
243
244 #define YY_BUFFER_NEW 0
245 #define YY_BUFFER_NORMAL 1
246 /* When an EOF's been seen but there's still some text to process
247 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
248 * shouldn't try reading from the input source any more. We might
249 * still have a bunch of tokens to match, though, because of
250 * possible backing-up.
251 *
252 * When we actually see the EOF, we change the status to "new"
253 * (via yyrestart()), so that the user can continue scanning by
254 * just pointing yyin at a new input file.
255 */
256 #define YY_BUFFER_EOF_PENDING 2
257
258 };
259 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
260
261 /* Stack of input buffers. */
262 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
263 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
264 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
265
266 /* We provide macros for accessing buffer states in case in the
267 * future we want to put the buffer states in a more general
268 * "scanner state".
269 *
270 * Returns the top of the stack, or NULL.
271 */
272 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
273 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
274 : NULL)
275
276 /* Same as previous macro, but useful when we know that the buffer stack is not
277 * NULL or when we need an lvalue. For internal use only.
278 */
279 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
280
281 /* yy_hold_char holds the character lost when yytext is formed. */
282 static char yy_hold_char;
283 static int yy_n_chars; /* number of characters read into yy_ch_buf */
284 int yyleng;
285
286 /* Points to current character in buffer. */
287 static char *yy_c_buf_p = (char *) 0;
288 static int yy_init = 0; /* whether we need to initialize */
289 static int yy_start = 0; /* start state number */
290
291 /* Flag which is used to allow yywrap()'s to do buffer switches
292 * instead of setting up a fresh yyin. A bit of a hack ...
293 */
294 static int yy_did_buffer_switch_on_eof;
295
296 void yyrestart (FILE *input_file );
297 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
298 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
299 void yy_delete_buffer (YY_BUFFER_STATE b );
300 void yy_flush_buffer (YY_BUFFER_STATE b );
301 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
302 void yypop_buffer_state (void );
303
304 static void yyensure_buffer_stack (void );
305 static void yy_load_buffer_state (void );
306 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
307
308 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
309
310 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
311 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
312 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
313
314 void *yyalloc (yy_size_t );
315 void *yyrealloc (void *,yy_size_t );
316 void yyfree (void * );
317
318 #define yy_new_buffer yy_create_buffer
319
320 #define yy_set_interactive(is_interactive) \
321 { \
322 if ( ! YY_CURRENT_BUFFER ){ \
323 yyensure_buffer_stack (); \
324 YY_CURRENT_BUFFER_LVALUE = \
325 yy_create_buffer(yyin,YY_BUF_SIZE ); \
326 } \
327 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
328 }
329
330 #define yy_set_bol(at_bol) \
331 { \
332 if ( ! YY_CURRENT_BUFFER ){\
333 yyensure_buffer_stack (); \
334 YY_CURRENT_BUFFER_LVALUE = \
335 yy_create_buffer(yyin,YY_BUF_SIZE ); \
336 } \
337 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
338 }
339
340 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
341
342 /* Begin user sect3 */
343
344 typedef unsigned char YY_CHAR;
345
346 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
347
348 typedef int yy_state_type;
349
350 extern int yylineno;
351
352 int yylineno = 1;
353
354 extern char *yytext;
355 #define yytext_ptr yytext
356
357 static yy_state_type yy_get_previous_state (void );
358 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
359 static int yy_get_next_buffer (void );
360 static void yy_fatal_error (yyconst char msg[] );
361
362 /* Done after the current pattern has been matched and before the
363 * corresponding action - sets up yytext.
364 */
365 #define YY_DO_BEFORE_ACTION \
366 (yytext_ptr) = yy_bp; \
367 yyleng = (size_t) (yy_cp - yy_bp); \
368 (yy_hold_char) = *yy_cp; \
369 *yy_cp = '\0'; \
370 (yy_c_buf_p) = yy_cp;
371
372 #define YY_NUM_RULES 14
373 #define YY_END_OF_BUFFER 15
374 /* This struct is not used in this scanner,
375 but its presence is necessary. */
376 struct yy_trans_info
377 {
378 flex_int32_t yy_verify;
379 flex_int32_t yy_nxt;
380 };
381 static yyconst flex_int16_t yy_accept[28] =
382 { 0,
383 0, 0, 0, 0, 15, 13, 14, 12, 5, 6,
384 13, 1, 1, 3, 4, 10, 8, 9, 10, 7,
385 1, 1, 0, 3, 11, 2, 0
386 } ;
387
388 static yyconst flex_int32_t yy_ec[256] =
389 { 0,
390 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
391 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
392 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
393 1, 3, 1, 4, 1, 1, 1, 1, 5, 1,
394 1, 1, 6, 1, 6, 1, 1, 7, 8, 8,
395 8, 8, 8, 8, 8, 8, 8, 1, 1, 1,
396 1, 1, 1, 1, 9, 9, 9, 9, 9, 9,
397 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
398 9, 9, 9, 9, 9, 9, 9, 10, 9, 9,
399 1, 11, 1, 1, 12, 13, 14, 14, 14, 14,
400
401 14, 14, 9, 9, 9, 9, 9, 9, 9, 9,
402 9, 9, 9, 9, 9, 9, 9, 9, 9, 10,
403 9, 9, 1, 1, 1, 1, 1, 1, 1, 1,
404 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
405 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
410 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
411
412 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
413 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
415 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
416 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
417 1, 1, 1, 1, 1
418 } ;
419
420 static yyconst flex_int32_t yy_meta[15] =
421 { 0,
422 1, 2, 1, 1, 1, 1, 3, 3, 4, 5,
423 1, 4, 1, 6
424 } ;
425
426 static yyconst flex_int16_t yy_base[33] =
427 { 0,
428 0, 0, 13, 25, 25, 62, 62, 62, 62, 62,
429 12, 13, 14, 0, 62, 62, 62, 62, 0, 62,
430 6, 24, 0, 0, 62, 0, 62, 38, 42, 45,
431 51, 55
432 } ;
433
434 static yyconst flex_int16_t yy_def[33] =
435 { 0,
436 27, 1, 28, 28, 27, 27, 27, 27, 27, 27,
437 27, 29, 27, 30, 27, 27, 27, 27, 31, 27,
438 29, 27, 32, 30, 27, 32, 0, 27, 27, 27,
439 27, 27
440 } ;
441
442 static yyconst flex_int16_t yy_nxt[77] =
443 { 0,
444 6, 7, 8, 9, 10, 11, 12, 13, 14, 14,
445 6, 6, 15, 14, 7, 23, 17, 18, 21, 22,
446 22, 22, 23, 19, 27, 20, 7, 27, 17, 18,
447 22, 22, 27, 27, 27, 19, 27, 20, 16, 16,
448 16, 16, 16, 16, 22, 27, 22, 24, 24, 24,
449 24, 25, 27, 25, 25, 25, 25, 26, 27, 27,
450 26, 5, 27, 27, 27, 27, 27, 27, 27, 27,
451 27, 27, 27, 27, 27, 27
452 } ;
453
454 static yyconst flex_int16_t yy_chk[77] =
455 { 0,
456 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
457 1, 1, 1, 1, 3, 21, 3, 3, 11, 11,
458 13, 13, 12, 3, 5, 3, 4, 0, 4, 4,
459 22, 22, 0, 0, 0, 4, 0, 4, 28, 28,
460 28, 28, 28, 28, 29, 0, 29, 30, 30, 30,
461 30, 31, 0, 31, 31, 31, 31, 32, 0, 0,
462 32, 27, 27, 27, 27, 27, 27, 27, 27, 27,
463 27, 27, 27, 27, 27, 27
464 } ;
465
466 static yy_state_type yy_last_accepting_state;
467 static char *yy_last_accepting_cpos;
468
469 extern int yy_flex_debug;
470 int yy_flex_debug = 0;
471
472 /* The intent behind this definition is that it'll catch
473 * any uses of REJECT which flex missed.
474 */
475 #define REJECT reject_used_but_not_detected
476 #define yymore() yymore_used_but_not_detected
477 #define YY_MORE_ADJ 0
478 #define YY_RESTORE_YY_MORE_OFFSET
479 char *yytext;
480 #line 1 "macro.lex.l"
481 #line 2 "macro.lex.l"
482 /*
483 * Help Viewer
484 *
485 * Copyright 1996 Ulrich Schmid
486 * Copyright 2002,2008 Eric Pouech
487 *
488 * This library is free software; you can redistribute it and/or
489 * modify it under the terms of the GNU Lesser General Public
490 * License as published by the Free Software Foundation; either
491 * version 2.1 of the License, or (at your option) any later version.
492 *
493 * This library is distributed in the hope that it will be useful,
494 * but WITHOUT ANY WARRANTY; without even the implied warranty of
495 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
496 * Lesser General Public License for more details.
497 *
498 * You should have received a copy of the GNU Lesser General Public
499 * License along with this library; if not, write to the Free Software
500 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
501 */
502 #define YY_NO_INPUT 1
503
504 #line 26 "macro.lex.l"
505 #include "config.h"
506 #include <assert.h>
507 #include <stdarg.h>
508
509 #define YY_NO_UNISTD_H
510 #include "windef.h"
511 #include "winbase.h"
512 #include "wingdi.h"
513 #include "winuser.h"
514 #include "winhelp.h"
515
516 #include "wine/debug.h"
517
518 WINE_DEFAULT_DEBUG_CHANNEL(winhelp);
519
520 struct lex_data {
521 LPCSTR macroptr;
522 LPSTR strptr;
523 int quote_stack[32];
524 unsigned quote_stk_idx;
525 LPSTR cache_string[32];
526 int cache_used;
527 WINHELP_WINDOW* window;
528 };
529 static struct lex_data* lex_data = NULL;
530
531 struct lexret yylval;
532
533 #define YY_INPUT(buf,result,max_size)\
534 if ((result = *lex_data->macroptr ? 1 : 0)) buf[0] = *lex_data->macroptr++;
535
536 #line 537 "macro.lex.yy.c"
537
538 #define INITIAL 0
539 #define quote 1
540
541 #ifndef YY_NO_UNISTD_H
542 /* Special case for "unistd.h", since it is non-ANSI. We include it way
543 * down here because we want the user's section 1 to have been scanned first.
544 * The user has a chance to override it with an option.
545 */
546 #include <unistd.h>
547 #endif
548
549 #ifndef YY_EXTRA_TYPE
550 #define YY_EXTRA_TYPE void *
551 #endif
552
553 static int yy_init_globals (void );
554
555 /* Accessor methods to globals.
556 These are made visible to non-reentrant scanners for convenience. */
557
558 int yylex_destroy (void );
559
560 int yyget_debug (void );
561
562 void yyset_debug (int debug_flag );
563
564 YY_EXTRA_TYPE yyget_extra (void );
565
566 void yyset_extra (YY_EXTRA_TYPE user_defined );
567
568 FILE *yyget_in (void );
569
570 void yyset_in (FILE * in_str );
571
572 FILE *yyget_out (void );
573
574 void yyset_out (FILE * out_str );
575
576 int yyget_leng (void );
577
578 char *yyget_text (void );
579
580 int yyget_lineno (void );
581
582 void yyset_lineno (int line_number );
583
584 /* Macros after this point can all be overridden by user definitions in
585 * section 1.
586 */
587
588 #ifndef YY_SKIP_YYWRAP
589 #ifdef __cplusplus
590 extern "C" int yywrap (void );
591 #else
592 extern int yywrap (void );
593 #endif
594 #endif
595
596 #ifndef yytext_ptr
597 static void yy_flex_strncpy (char *,yyconst char *,int );
598 #endif
599
600 #ifdef YY_NEED_STRLEN
601 static int yy_flex_strlen (yyconst char * );
602 #endif
603
604 #ifndef YY_NO_INPUT
605
606 #ifdef __cplusplus
607 static int yyinput (void );
608 #else
609 static int input (void );
610 #endif
611
612 #endif
613
614 /* Amount of stuff to slurp up with each read. */
615 #ifndef YY_READ_BUF_SIZE
616 #ifdef __ia64__
617 /* On IA-64, the buffer size is 16k, not 8k */
618 #define YY_READ_BUF_SIZE 16384
619 #else
620 #define YY_READ_BUF_SIZE 8192
621 #endif /* __ia64__ */
622 #endif
623
624 /* Copy whatever the last rule matched to the standard output. */
625 #ifndef ECHO
626 /* This used to be an fputs(), but since the string might contain NUL's,
627 * we now use fwrite().
628 */
629 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
630 #endif
631
632 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
633 * is returned in "result".
634 */
635 #ifndef YY_INPUT
636 #define YY_INPUT(buf,result,max_size) \
637 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
638 { \
639 int c = '*'; \
640 size_t n; \
641 for ( n = 0; n < max_size && \
642 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
643 buf[n] = (char) c; \
644 if ( c == '\n' ) \
645 buf[n++] = (char) c; \
646 if ( c == EOF && ferror( yyin ) ) \
647 YY_FATAL_ERROR( "input in flex scanner failed" ); \
648 result = n; \
649 } \
650 else \
651 { \
652 errno=0; \
653 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
654 { \
655 if( errno != EINTR) \
656 { \
657 YY_FATAL_ERROR( "input in flex scanner failed" ); \
658 break; \
659 } \
660 errno=0; \
661 clearerr(yyin); \
662 } \
663 }\
664 \
665
666 #endif
667
668 /* No semi-colon after return; correct usage is to write "yyterminate();" -
669 * we don't want an extra ';' after the "return" because that will cause
670 * some compilers to complain about unreachable statements.
671 */
672 #ifndef yyterminate
673 #define yyterminate() return YY_NULL
674 #endif
675
676 /* Number of entries by which start-condition stack grows. */
677 #ifndef YY_START_STACK_INCR
678 #define YY_START_STACK_INCR 25
679 #endif
680
681 /* Report a fatal error. */
682 #ifndef YY_FATAL_ERROR
683 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
684 #endif
685
686 /* end tables serialization structures and prototypes */
687
688 /* Default declaration of generated scanner - a define so the user can
689 * easily add parameters.
690 */
691 #ifndef YY_DECL
692 #define YY_DECL_IS_OURS 1
693
694 extern int yylex (void);
695
696 #define YY_DECL int yylex (void)
697 #endif /* !YY_DECL */
698
699 /* Code executed at the beginning of each rule, after yytext and yyleng
700 * have been set up.
701 */
702 #ifndef YY_USER_ACTION
703 #define YY_USER_ACTION
704 #endif
705
706 /* Code executed at the end of each rule. */
707 #ifndef YY_BREAK
708 #define YY_BREAK break;
709 #endif
710
711 #define YY_RULE_SETUP \
712 YY_USER_ACTION
713
714 /** The main scanner function which does all the work.
715 */
716 YY_DECL
717 {
718 register yy_state_type yy_current_state;
719 register char *yy_cp, *yy_bp;
720 register int yy_act;
721
722 #line 58 "macro.lex.l"
723
724
725 #line 726 "macro.lex.yy.c"
726
727 if ( !(yy_init) )
728 {
729 (yy_init) = 1;
730
731 #ifdef YY_USER_INIT
732 YY_USER_INIT;
733 #endif
734
735 if ( ! (yy_start) )
736 (yy_start) = 1; /* first start state */
737
738 if ( ! yyin )
739 yyin = stdin;
740
741 if ( ! yyout )
742 yyout = stdout;
743
744 if ( ! YY_CURRENT_BUFFER ) {
745 yyensure_buffer_stack ();
746 YY_CURRENT_BUFFER_LVALUE =
747 yy_create_buffer(yyin,YY_BUF_SIZE );
748 }
749
750 yy_load_buffer_state( );
751 }
752
753 while ( 1 ) /* loops until end-of-file is reached */
754 {
755 yy_cp = (yy_c_buf_p);
756
757 /* Support of yytext. */
758 *yy_cp = (yy_hold_char);
759
760 /* yy_bp points to the position in yy_ch_buf of the start of
761 * the current run.
762 */
763 yy_bp = yy_cp;
764
765 yy_current_state = (yy_start);
766 yy_match:
767 do
768 {
769 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
770 if ( yy_accept[yy_current_state] )
771 {
772 (yy_last_accepting_state) = yy_current_state;
773 (yy_last_accepting_cpos) = yy_cp;
774 }
775 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
776 {
777 yy_current_state = (int) yy_def[yy_current_state];
778 if ( yy_current_state >= 28 )
779 yy_c = yy_meta[(unsigned int) yy_c];
780 }
781 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
782 ++yy_cp;
783 }
784 while ( yy_current_state != 27 );
785 yy_cp = (yy_last_accepting_cpos);
786 yy_current_state = (yy_last_accepting_state);
787
788 yy_find_action:
789 yy_act = yy_accept[yy_current_state];
790
791 YY_DO_BEFORE_ACTION;
792
793 do_action: /* This label is used only to access EOF actions. */
794
795 switch ( yy_act )
796 { /* beginning of action switch */
797 case 0: /* must back up */
798 /* undo the effects of YY_DO_BEFORE_ACTION */
799 *yy_cp = (yy_hold_char);
800 yy_cp = (yy_last_accepting_cpos);
801 yy_current_state = (yy_last_accepting_state);
802 goto yy_find_action;
803
804 case 1:
805 YY_RULE_SETUP
806 #line 60 "macro.lex.l"
807 yylval.integer = strtol(yytext, NULL, 10); return INTEGER;
808 YY_BREAK
809 case 2:
810 YY_RULE_SETUP
811 #line 61 "macro.lex.l"
812 yylval.integer = strtol(yytext, NULL, 16); return INTEGER;
813 YY_BREAK
814 case 3:
815 YY_RULE_SETUP
816 #line 63 "macro.lex.l"
817 return MACRO_Lookup(yytext, &yylval);
818 YY_BREAK
819 case 4:
820 #line 66 "macro.lex.l"
821 case 5:
822 #line 67 "macro.lex.l"
823 case 6:
824 #line 68 "macro.lex.l"
825 case 7:
826 #line 69 "macro.lex.l"
827 case 8:
828 #line 70 "macro.lex.l"
829 case 9:
830 YY_RULE_SETUP
831 #line 70 "macro.lex.l"
832 {
833 if (lex_data->quote_stk_idx == 0 ||
834 (yytext[0] == '\"' && lex_data->quote_stack[lex_data->quote_stk_idx - 1] != '\"') ||
835 (yytext[0] == '`'))
836 {
837 /* opening a new one */
838 if (lex_data->quote_stk_idx == 0)
839 {
840 assert(lex_data->cache_used < sizeof(lex_data->cache_string) / sizeof(lex_data->cache_string[0]));
841 lex_data->strptr = lex_data->cache_string[lex_data->cache_used] = HeapAlloc(GetProcessHeap(), 0, strlen(lex_data->macroptr) + 1);
842 yylval.string = lex_data->strptr;
843 lex_data->cache_used++;
844 BEGIN(quote);
845 }
846 else *lex_data->strptr++ = yytext[0];
847 lex_data->quote_stack[lex_data->quote_stk_idx++] = yytext[0];
848 assert(lex_data->quote_stk_idx < sizeof(lex_data->quote_stack) / sizeof(lex_data->quote_stack[0]));
849 }
850 else
851 {
852 if (yytext[0] == '`') assert(0);
853 /* close the current quote */
854 if (--lex_data->quote_stk_idx == 0)
855 {
856 BEGIN INITIAL;
857 *lex_data->strptr++ = '\0';
858 return STRING;
859 }
860 else *lex_data->strptr++ = yytext[0];
861 }
862 }
863 YY_BREAK
864 case 10:
865 YY_RULE_SETUP
866 #line 102 "macro.lex.l"
867 *lex_data->strptr++ = yytext[0];
868 YY_BREAK
869 case 11:
870 YY_RULE_SETUP
871 #line 103 "macro.lex.l"
872 *lex_data->strptr++ = yytext[1];
873 YY_BREAK
874 case YY_STATE_EOF(quote):
875 #line 104 "macro.lex.l"
876 return 0;
877 YY_BREAK
878 case 12:
879 YY_RULE_SETUP
880 #line 106 "macro.lex.l"
881
882 YY_BREAK
883 case 13:
884 YY_RULE_SETUP
885 #line 107 "macro.lex.l"
886 return yytext[0];
887 YY_BREAK
888 case 14:
889 YY_RULE_SETUP
890 #line 108 "macro.lex.l"
891 ECHO;
892 YY_BREAK
893 #line 894 "macro.lex.yy.c"
894 case YY_STATE_EOF(INITIAL):
895 yyterminate();
896
897 case YY_END_OF_BUFFER:
898 {
899 /* Amount of text matched not including the EOB char. */
900 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
901
902 /* Undo the effects of YY_DO_BEFORE_ACTION. */
903 *yy_cp = (yy_hold_char);
904 YY_RESTORE_YY_MORE_OFFSET
905
906 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
907 {
908 /* We're scanning a new file or input source. It's
909 * possible that this happened because the user
910 * just pointed yyin at a new source and called
911 * yylex(). If so, then we have to assure
912 * consistency between YY_CURRENT_BUFFER and our
913 * globals. Here is the right place to do so, because
914 * this is the first action (other than possibly a
915 * back-up) that will match for the new input source.
916 */
917 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
918 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
919 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
920 }
921
922 /* Note that here we test for yy_c_buf_p "<=" to the position
923 * of the first EOB in the buffer, since yy_c_buf_p will
924 * already have been incremented past the NUL character
925 * (since all states make transitions on EOB to the
926 * end-of-buffer state). Contrast this with the test
927 * in input().
928 */
929 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
930 { /* This was really a NUL. */
931 yy_state_type yy_next_state;
932
933 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
934
935 yy_current_state = yy_get_previous_state( );
936
937 /* Okay, we're now positioned to make the NUL
938 * transition. We couldn't have
939 * yy_get_previous_state() go ahead and do it
940 * for us because it doesn't know how to deal
941 * with the possibility of jamming (and we don't
942 * want to build jamming into it because then it
943 * will run more slowly).
944 */
945
946 yy_next_state = yy_try_NUL_trans( yy_current_state );
947
948 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
949
950 if ( yy_next_state )
951 {
952 /* Consume the NUL. */
953 yy_cp = ++(yy_c_buf_p);
954 yy_current_state = yy_next_state;
955 goto yy_match;
956 }
957
958 else
959 {
960 yy_cp = (yy_last_accepting_cpos);
961 yy_current_state = (yy_last_accepting_state);
962 goto yy_find_action;
963 }
964 }
965
966 else switch ( yy_get_next_buffer( ) )
967 {
968 case EOB_ACT_END_OF_FILE:
969 {
970 (yy_did_buffer_switch_on_eof) = 0;
971
972 if ( yywrap( ) )
973 {
974 /* Note: because we've taken care in
975 * yy_get_next_buffer() to have set up
976 * yytext, we can now set up
977 * yy_c_buf_p so that if some total
978 * hoser (like flex itself) wants to
979 * call the scanner after we return the
980 * YY_NULL, it'll still work - another
981 * YY_NULL will get returned.
982 */
983 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
984
985 yy_act = YY_STATE_EOF(YY_START);
986 goto do_action;
987 }
988
989 else
990 {
991 if ( ! (yy_did_buffer_switch_on_eof) )
992 YY_NEW_FILE;
993 }
994 break;
995 }
996
997 case EOB_ACT_CONTINUE_SCAN:
998 (yy_c_buf_p) =
999 (yytext_ptr) + yy_amount_of_matched_text;
1000
1001 yy_current_state = yy_get_previous_state( );
1002
1003 yy_cp = (yy_c_buf_p);
1004 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1005 goto yy_match;
1006
1007 case EOB_ACT_LAST_MATCH:
1008 (yy_c_buf_p) =
1009 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1010
1011 yy_current_state = yy_get_previous_state( );
1012
1013 yy_cp = (yy_c_buf_p);
1014 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1015 goto yy_find_action;
1016 }
1017 break;
1018 }
1019
1020 default:
1021 YY_FATAL_ERROR(
1022 "fatal flex scanner internal error--no action found" );
1023 } /* end of action switch */
1024 } /* end of scanning one token */
1025 } /* end of yylex */
1026
1027 /* yy_get_next_buffer - try to read in a new buffer
1028 *
1029 * Returns a code representing an action:
1030 * EOB_ACT_LAST_MATCH -
1031 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1032 * EOB_ACT_END_OF_FILE - end of file
1033 */
1034 static int yy_get_next_buffer (void)
1035 {
1036 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1037 register char *source = (yytext_ptr);
1038 register int number_to_move, i;
1039 int ret_val;
1040
1041 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1042 YY_FATAL_ERROR(
1043 "fatal flex scanner internal error--end of buffer missed" );
1044
1045 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1046 { /* Don't try to fill the buffer, so this is an EOF. */
1047 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1048 {
1049 /* We matched a single character, the EOB, so
1050 * treat this as a final EOF.
1051 */
1052 return EOB_ACT_END_OF_FILE;
1053 }
1054
1055 else
1056 {
1057 /* We matched some text prior to the EOB, first
1058 * process it.
1059 */
1060 return EOB_ACT_LAST_MATCH;
1061 }
1062 }
1063
1064 /* Try to read more data. */
1065
1066 /* First move last chars to start of buffer. */
1067 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1068
1069 for ( i = 0; i < number_to_move; ++i )
1070 *(dest++) = *(source++);
1071
1072 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1073 /* don't do the read, it's not guaranteed to return an EOF,
1074 * just force an EOF
1075 */
1076 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1077
1078 else
1079 {
1080 int num_to_read =
1081 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1082
1083 while ( num_to_read <= 0 )
1084 { /* Not enough room in the buffer - grow it. */
1085
1086 /* just a shorter name for the current buffer */
1087 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1088
1089 int yy_c_buf_p_offset =
1090 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1091
1092 if ( b->yy_is_our_buffer )
1093 {
1094 int new_size = b->yy_buf_size * 2;
1095
1096 if ( new_size <= 0 )
1097 b->yy_buf_size += b->yy_buf_size / 8;
1098 else
1099 b->yy_buf_size *= 2;
1100
1101 b->yy_ch_buf = (char *)
1102 /* Include room in for 2 EOB chars. */
1103 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1104 }
1105 else
1106 /* Can't grow it, we don't own it. */
1107 b->yy_ch_buf = 0;
1108
1109 if ( ! b->yy_ch_buf )
1110 YY_FATAL_ERROR(
1111 "fatal error - scanner input buffer overflow" );
1112
1113 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1114
1115 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1116 number_to_move - 1;
1117
1118 }
1119
1120 if ( num_to_read > YY_READ_BUF_SIZE )
1121 num_to_read = YY_READ_BUF_SIZE;
1122
1123 /* Read in more data. */
1124 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1125 (yy_n_chars), (size_t) num_to_read );
1126
1127 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1128 }
1129
1130 if ( (yy_n_chars) == 0 )
1131 {
1132 if ( number_to_move == YY_MORE_ADJ )
1133 {
1134 ret_val = EOB_ACT_END_OF_FILE;
1135 yyrestart(yyin );
1136 }
1137
1138 else
1139 {
1140 ret_val = EOB_ACT_LAST_MATCH;
1141 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1142 YY_BUFFER_EOF_PENDING;
1143 }
1144 }
1145
1146 else
1147 ret_val = EOB_ACT_CONTINUE_SCAN;
1148
1149 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1150 /* Extend the array by 50%, plus the number we really need. */
1151 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1152 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1153 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1154 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1155 }
1156
1157 (yy_n_chars) += number_to_move;
1158 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1159 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1160
1161 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1162
1163 return ret_val;
1164 }
1165
1166 /* yy_get_previous_state - get the state just before the EOB char was reached */
1167
1168 static yy_state_type yy_get_previous_state (void)
1169 {
1170 register yy_state_type yy_current_state;
1171 register char *yy_cp;
1172
1173 yy_current_state = (yy_start);
1174
1175 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1176 {
1177 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1178 if ( yy_accept[yy_current_state] )
1179 {
1180 (yy_last_accepting_state) = yy_current_state;
1181 (yy_last_accepting_cpos) = yy_cp;
1182 }
1183 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1184 {
1185 yy_current_state = (int) yy_def[yy_current_state];
1186 if ( yy_current_state >= 28 )
1187 yy_c = yy_meta[(unsigned int) yy_c];
1188 }
1189 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1190 }
1191
1192 return yy_current_state;
1193 }
1194
1195 /* yy_try_NUL_trans - try to make a transition on the NUL character
1196 *
1197 * synopsis
1198 * next_state = yy_try_NUL_trans( current_state );
1199 */
1200 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1201 {
1202 register int yy_is_jam;
1203 register char *yy_cp = (yy_c_buf_p);
1204
1205 register YY_CHAR yy_c = 1;
1206 if ( yy_accept[yy_current_state] )
1207 {
1208 (yy_last_accepting_state) = yy_current_state;
1209 (yy_last_accepting_cpos) = yy_cp;
1210 }
1211 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1212 {
1213 yy_current_state = (int) yy_def[yy_current_state];
1214 if ( yy_current_state >= 28 )
1215 yy_c = yy_meta[(unsigned int) yy_c];
1216 }
1217 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1218 yy_is_jam = (yy_current_state == 27);
1219
1220 return yy_is_jam ? 0 : yy_current_state;
1221 }
1222
1223 #ifndef YY_NO_INPUT
1224 #ifdef __cplusplus
1225 static int yyinput (void)
1226 #else
1227 static int input (void)
1228 #endif
1229
1230 {
1231 int c;
1232
1233 *(yy_c_buf_p) = (yy_hold_char);
1234
1235 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1236 {
1237 /* yy_c_buf_p now points to the character we want to return.
1238 * If this occurs *before* the EOB characters, then it's a
1239 * valid NUL; if not, then we've hit the end of the buffer.
1240 */
1241 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1242 /* This was really a NUL. */
1243 *(yy_c_buf_p) = '\0';
1244
1245 else
1246 { /* need more input */
1247 int offset = (yy_c_buf_p) - (yytext_ptr);
1248 ++(yy_c_buf_p);
1249
1250 switch ( yy_get_next_buffer( ) )
1251 {
1252 case EOB_ACT_LAST_MATCH:
1253 /* This happens because yy_g_n_b()
1254 * sees that we've accumulated a
1255 * token and flags that we need to
1256 * try matching the token before
1257 * proceeding. But for input(),
1258 * there's no matching to consider.
1259 * So convert the EOB_ACT_LAST_MATCH
1260 * to EOB_ACT_END_OF_FILE.
1261 */
1262
1263 /* Reset buffer status. */
1264 yyrestart(yyin );
1265
1266 /*FALLTHROUGH*/
1267
1268 case EOB_ACT_END_OF_FILE:
1269 {
1270 if ( yywrap( ) )
1271 return EOF;
1272
1273 if ( ! (yy_did_buffer_switch_on_eof) )
1274 YY_NEW_FILE;
1275 #ifdef __cplusplus
1276 return yyinput();
1277 #else
1278 return input();
1279 #endif
1280 }
1281
1282 case EOB_ACT_CONTINUE_SCAN:
1283 (yy_c_buf_p) = (yytext_ptr) + offset;
1284 break;
1285 }
1286 }
1287 }
1288
1289 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1290 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1291 (yy_hold_char) = *++(yy_c_buf_p);
1292
1293 return c;
1294 }
1295 #endif /* ifndef YY_NO_INPUT */
1296
1297 /** Immediately switch to a different input stream.
1298 * @param input_file A readable stream.
1299 *
1300 * @note This function does not reset the start condition to @c INITIAL .
1301 */
1302 void yyrestart (FILE * input_file )
1303 {
1304
1305 if ( ! YY_CURRENT_BUFFER ){
1306 yyensure_buffer_stack ();
1307 YY_CURRENT_BUFFER_LVALUE =
1308 yy_create_buffer(yyin,YY_BUF_SIZE );
1309 }
1310
1311 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1312 yy_load_buffer_state( );
1313 }
1314
1315 /** Switch to a different input buffer.
1316 * @param new_buffer The new input buffer.
1317 *
1318 */
1319 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1320 {
1321
1322 /* TODO. We should be able to replace this entire function body
1323 * with
1324 * yypop_buffer_state();
1325 * yypush_buffer_state(new_buffer);
1326 */
1327 yyensure_buffer_stack ();
1328 if ( YY_CURRENT_BUFFER == new_buffer )
1329 return;
1330
1331 if ( YY_CURRENT_BUFFER )
1332 {
1333 /* Flush out information for old buffer. */
1334 *(yy_c_buf_p) = (yy_hold_char);
1335 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1336 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1337 }
1338
1339 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1340 yy_load_buffer_state( );
1341
1342 /* We don't actually know whether we did this switch during
1343 * EOF (yywrap()) processing, but the only time this flag
1344 * is looked at is after yywrap() is called, so it's safe
1345 * to go ahead and always set it.
1346 */
1347 (yy_did_buffer_switch_on_eof) = 1;
1348 }
1349
1350 static void yy_load_buffer_state (void)
1351 {
1352 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1353 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1354 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1355 (yy_hold_char) = *(yy_c_buf_p);
1356 }
1357
1358 /** Allocate and initialize an input buffer state.
1359 * @param file A readable stream.
1360 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1361 *
1362 * @return the allocated buffer state.
1363 */
1364 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1365 {
1366 YY_BUFFER_STATE b;
1367
1368 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1369 if ( ! b )
1370 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1371
1372 b->yy_buf_size = size;
1373
1374 /* yy_ch_buf has to be 2 characters longer than the size given because
1375 * we need to put in 2 end-of-buffer characters.
1376 */
1377 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1378 if ( ! b->yy_ch_buf )
1379 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1380
1381 b->yy_is_our_buffer = 1;
1382
1383 yy_init_buffer(b,file );
1384
1385 return b;
1386 }
1387
1388 /** Destroy the buffer.
1389 * @param b a buffer created with yy_create_buffer()
1390 *
1391 */
1392 void yy_delete_buffer (YY_BUFFER_STATE b )
1393 {
1394
1395 if ( ! b )
1396 return;
1397
1398 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1399 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1400
1401 if ( b->yy_is_our_buffer )
1402 yyfree((void *) b->yy_ch_buf );
1403
1404 yyfree((void *) b );
1405 }
1406
1407 /* Initializes or reinitializes a buffer.
1408 * This function is sometimes called more than once on the same buffer,
1409 * such as during a yyrestart() or at EOF.
1410 */
1411 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1412
1413 {
1414 int oerrno = errno;
1415
1416 yy_flush_buffer(b );
1417
1418 b->yy_input_file = file;
1419 b->yy_fill_buffer = 1;
1420
1421 /* If b is the current buffer, then yy_init_buffer was _probably_
1422 * called from yyrestart() or through yy_get_next_buffer.
1423 * In that case, we don't want to reset the lineno or column.
1424 */
1425 if (b != YY_CURRENT_BUFFER){
1426 b->yy_bs_lineno = 1;
1427 b->yy_bs_column = 0;
1428 }
1429
1430 b->yy_is_interactive = 0;
1431
1432 errno = oerrno;
1433 }
1434
1435 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1436 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1437 *
1438 */
1439 void yy_flush_buffer (YY_BUFFER_STATE b )
1440 {
1441 if ( ! b )
1442 return;
1443
1444 b->yy_n_chars = 0;
1445
1446 /* We always need two end-of-buffer characters. The first causes
1447 * a transition to the end-of-buffer state. The second causes
1448 * a jam in that state.
1449 */
1450 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1451 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1452
1453 b->yy_buf_pos = &b->yy_ch_buf[0];
1454
1455 b->yy_at_bol = 1;
1456 b->yy_buffer_status = YY_BUFFER_NEW;
1457
1458 if ( b == YY_CURRENT_BUFFER )
1459 yy_load_buffer_state( );
1460 }
1461
1462 /** Pushes the new state onto the stack. The new state becomes
1463 * the current state. This function will allocate the stack
1464 * if necessary.
1465 * @param new_buffer The new state.
1466 *
1467 */
1468 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1469 {
1470 if (new_buffer == NULL)
1471 return;
1472
1473 yyensure_buffer_stack();
1474
1475 /* This block is copied from yy_switch_to_buffer. */
1476 if ( YY_CURRENT_BUFFER )
1477 {
1478 /* Flush out information for old buffer. */
1479 *(yy_c_buf_p) = (yy_hold_char);
1480 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1481 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1482 }
1483
1484 /* Only push if top exists. Otherwise, replace top. */
1485 if (YY_CURRENT_BUFFER)
1486 (yy_buffer_stack_top)++;
1487 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1488
1489 /* copied from yy_switch_to_buffer. */
1490 yy_load_buffer_state( );
1491 (yy_did_buffer_switch_on_eof) = 1;
1492 }
1493
1494 /** Removes and deletes the top of the stack, if present.
1495 * The next element becomes the new top.
1496 *
1497 */
1498 void yypop_buffer_state (void)
1499 {
1500 if (!YY_CURRENT_BUFFER)
1501 return;
1502
1503 yy_delete_buffer(YY_CURRENT_BUFFER );
1504 YY_CURRENT_BUFFER_LVALUE = NULL;
1505 if ((yy_buffer_stack_top) > 0)
1506 --(yy_buffer_stack_top);
1507
1508 if (YY_CURRENT_BUFFER) {
1509 yy_load_buffer_state( );
1510 (yy_did_buffer_switch_on_eof) = 1;
1511 }
1512 }
1513
1514 /* Allocates the stack if it does not exist.
1515 * Guarantees space for at least one push.
1516 */
1517 static void yyensure_buffer_stack (void)
1518 {
1519 int num_to_alloc;
1520
1521 if (!(yy_buffer_stack)) {
1522
1523 /* First allocation is just for 2 elements, since we don't know if this
1524 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1525 * immediate realloc on the next call.
1526 */
1527 num_to_alloc = 1;
1528 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1529 (num_to_alloc * sizeof(struct yy_buffer_state*)
1530 );
1531 if ( ! (yy_buffer_stack) )
1532 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1533
1534 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1535
1536 (yy_buffer_stack_max) = num_to_alloc;
1537 (yy_buffer_stack_top) = 0;
1538 return;
1539 }
1540
1541 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1542
1543 /* Increase the buffer to prepare for a possible push. */
1544 int grow_size = 8 /* arbitrary grow size */;
1545
1546 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1547 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1548 ((yy_buffer_stack),
1549 num_to_alloc * sizeof(struct yy_buffer_state*)
1550 );
1551 if ( ! (yy_buffer_stack) )
1552 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1553
1554 /* zero only the new slots.*/
1555 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1556 (yy_buffer_stack_max) = num_to_alloc;
1557 }
1558 }
1559
1560 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1561 * @param base the character buffer
1562 * @param size the size in bytes of the character buffer
1563 *
1564 * @return the newly allocated buffer state object.
1565 */
1566 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1567 {
1568 YY_BUFFER_STATE b;
1569
1570 if ( size < 2 ||
1571 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1572 base[size-1] != YY_END_OF_BUFFER_CHAR )
1573 /* They forgot to leave room for the EOB's. */
1574 return 0;
1575
1576 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1577 if ( ! b )
1578 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1579
1580 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1581 b->yy_buf_pos = b->yy_ch_buf = base;
1582 b->yy_is_our_buffer = 0;
1583 b->yy_input_file = 0;
1584 b->yy_n_chars = b->yy_buf_size;
1585 b->yy_is_interactive = 0;
1586 b->yy_at_bol = 1;
1587 b->yy_fill_buffer = 0;
1588 b->yy_buffer_status = YY_BUFFER_NEW;
1589
1590 yy_switch_to_buffer(b );
1591
1592 return b;
1593 }
1594
1595 /** Setup the input buffer state to scan a string. The next call to yylex() will
1596 * scan from a @e copy of @a str.
1597 * @param yystr a NUL-terminated string to scan
1598 *
1599 * @return the newly allocated buffer state object.
1600 * @note If you want to scan bytes that may contain NUL values, then use
1601 * yy_scan_bytes() instead.
1602 */
1603 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1604 {
1605
1606 return yy_scan_bytes(yystr,strlen(yystr) );
1607 }
1608
1609 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1610 * scan from a @e copy of @a bytes.
1611 * @param yybytes the byte buffer to scan
1612 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1613 *
1614 * @return the newly allocated buffer state object.
1615 */
1616 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1617 {
1618 YY_BUFFER_STATE b;
1619 char *buf;
1620 yy_size_t n;
1621 int i;
1622
1623 /* Get memory for full buffer, including space for trailing EOB's. */
1624 n = _yybytes_len + 2;
1625 buf = (char *) yyalloc(n );
1626 if ( ! buf )
1627 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1628
1629 for ( i = 0; i < _yybytes_len; ++i )
1630 buf[i] = yybytes[i];
1631
1632 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1633
1634 b = yy_scan_buffer(buf,n );
1635 if ( ! b )
1636 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1637
1638 /* It's okay to grow etc. this buffer, and we should throw it
1639 * away when we're done.
1640 */
1641 b->yy_is_our_buffer = 1;
1642
1643 return b;
1644 }
1645
1646 #ifndef YY_EXIT_FAILURE
1647 #define YY_EXIT_FAILURE 2
1648 #endif
1649
1650 static void yy_fatal_error (yyconst char* msg )
1651 {
1652 (void) fprintf( stderr, "%s\n", msg );
1653 exit( YY_EXIT_FAILURE );
1654 }
1655
1656 /* Redefine yyless() so it works in section 3 code. */
1657
1658 #undef yyless
1659 #define yyless(n) \
1660 do \
1661 { \
1662 /* Undo effects of setting up yytext. */ \
1663 int yyless_macro_arg = (n); \
1664 YY_LESS_LINENO(yyless_macro_arg);\
1665 yytext[yyleng] = (yy_hold_char); \
1666 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1667 (yy_hold_char) = *(yy_c_buf_p); \
1668 *(yy_c_buf_p) = '\0'; \
1669 yyleng = yyless_macro_arg; \
1670 } \
1671 while ( 0 )
1672
1673 /* Accessor methods (get/set functions) to struct members. */
1674
1675 /** Get the current line number.
1676 *
1677 */
1678 int yyget_lineno (void)
1679 {
1680
1681 return yylineno;
1682 }
1683
1684 /** Get the input stream.
1685 *
1686 */
1687 FILE *yyget_in (void)
1688 {
1689 return yyin;
1690 }
1691
1692 /** Get the output stream.
1693 *
1694 */
1695 FILE *yyget_out (void)
1696 {
1697 return yyout;
1698 }
1699
1700 /** Get the length of the current token.
1701 *
1702 */
1703 int yyget_leng (void)
1704 {
1705 return yyleng;
1706 }
1707
1708 /** Get the current token.
1709 *
1710 */
1711
1712 char *yyget_text (void)
1713 {
1714 return yytext;
1715 }
1716
1717 /** Set the current line number.
1718 * @param line_number
1719 *
1720 */
1721 void yyset_lineno (int line_number )
1722 {
1723
1724 yylineno = line_number;
1725 }
1726
1727 /** Set the input stream. This does not discard the current
1728 * input buffer.
1729 * @param in_str A readable stream.
1730 *
1731 * @see yy_switch_to_buffer
1732 */
1733 void yyset_in (FILE * in_str )
1734 {
1735 yyin = in_str ;
1736 }
1737
1738 void yyset_out (FILE * out_str )
1739 {
1740 yyout = out_str ;
1741 }
1742
1743 int yyget_debug (void)
1744 {
1745 return yy_flex_debug;
1746 }
1747
1748 void yyset_debug (int bdebug )
1749 {
1750 yy_flex_debug = bdebug ;
1751 }
1752
1753 static int yy_init_globals (void)
1754 {
1755 /* Initialization is the same as for the non-reentrant scanner.
1756 * This function is called from yylex_destroy(), so don't allocate here.
1757 */
1758
1759 (yy_buffer_stack) = 0;
1760 (yy_buffer_stack_top) = 0;
1761 (yy_buffer_stack_max) = 0;
1762 (yy_c_buf_p) = (char *) 0;
1763 (yy_init) = 0;
1764 (yy_start) = 0;
1765
1766 /* Defined in main.c */
1767 #ifdef YY_STDINIT
1768 yyin = stdin;
1769 yyout = stdout;
1770 #else
1771 yyin = (FILE *) 0;
1772 yyout = (FILE *) 0;
1773 #endif
1774
1775 /* For future reference: Set errno on error, since we are called by
1776 * yylex_init()
1777 */
1778 return 0;
1779 }
1780
1781 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1782 int yylex_destroy (void)
1783 {
1784
1785 /* Pop the buffer stack, destroying each element. */
1786 while(YY_CURRENT_BUFFER){
1787 yy_delete_buffer(YY_CURRENT_BUFFER );
1788 YY_CURRENT_BUFFER_LVALUE = NULL;
1789 yypop_buffer_state();
1790 }
1791
1792 /* Destroy the stack itself. */
1793 yyfree((yy_buffer_stack) );
1794 (yy_buffer_stack) = NULL;
1795
1796 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1797 * yylex() is called, initialization will occur. */
1798 yy_init_globals( );
1799
1800 return 0;
1801 }
1802
1803 /*
1804 * Internal utility routines.
1805 */
1806
1807 #ifndef yytext_ptr
1808 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1809 {
1810 register int i;
1811 for ( i = 0; i < n; ++i )
1812 s1[i] = s2[i];
1813 }
1814 #endif
1815
1816 #ifdef YY_NEED_STRLEN
1817 static int yy_flex_strlen (yyconst char * s )
1818 {
1819 register int n;
1820 for ( n = 0; s[n]; ++n )
1821 ;
1822
1823 return n;
1824 }
1825 #endif
1826
1827 void *yyalloc (yy_size_t size )
1828 {
1829 return (void *) malloc( size );
1830 }
1831
1832 void *yyrealloc (void * ptr, yy_size_t size )
1833 {
1834 /* The cast to (char *) in the following accommodates both
1835 * implementations that use char* generic pointers, and those
1836 * that use void* generic pointers. It works with the latter
1837 * because both ANSI C and C++ allow castless assignment from
1838 * any pointer type to void*, and deal with argument conversions
1839 * as though doing an assignment.
1840 */
1841 return (void *) realloc( (char *) ptr, size );
1842 }
1843
1844 void yyfree (void * ptr )
1845 {
1846 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1847 }
1848
1849 #define YYTABLES_NAME "yytables"
1850
1851 #line 108 "macro.lex.l"
1852
1853
1854
1855 #if 0
1856 /* all code for testing macros */
1857 #include "winhelp.h"
1858 static CHAR szTestMacro[256];
1859
1860 static LRESULT CALLBACK MACRO_TestDialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
1861 {
1862 if (msg == WM_COMMAND && wParam == IDOK)
1863 {
1864 GetDlgItemText(hDlg, 99, szTestMacro, sizeof(szTestMacro));
1865 EndDialog(hDlg, IDOK);
1866 return TRUE;
1867 }
1868 return FALSE;
1869 }
1870
1871 void macro_test(void)
1872 {
1873 WNDPROC lpfnDlg = MakeProcInstance(MACRO_TestDialogProc, Globals.hInstance);
1874 DialogBox(Globals.hInstance, STRING_DIALOG_TEST, Globals.active_win->hMainWnd, (DLGPROC)lpfnDlg);
1875 FreeProcInstance(lpfnDlg);
1876 macro = szTestMacro;
1877 }
1878 #endif
1879
1880 /* small helper function for debug messages */
1881 static const char* ts(int t)
1882 {
1883 static char c[2] = {0,0};
1884
1885 switch (t)
1886 {
1887 case EMPTY: return "EMPTY";
1888 case VOID_FUNCTION: return "VOID_FUNCTION";
1889 case BOOL_FUNCTION: return "BOOL_FUNCTION";
1890 case INTEGER: return "INTEGER";
1891 case STRING: return "STRING";
1892 case IDENTIFIER: return "IDENTIFIER";
1893 default: c[0] = (char)t; return c;
1894 }
1895 }
1896
1897 static int MACRO_CallBoolFunc(void *fn, const char* args, void** ret);
1898
1899 /******************************************************************
1900 * MACRO_CheckArgs
1901 *
1902 * checks number of arguments against prototype, and stores arguments on
1903 * stack pa for later call
1904 * returns -1 on error, otherwise the number of pushed parameters
1905 */
1906 static int MACRO_CheckArgs(void* pa[], unsigned max, const char* args)
1907 {
1908 int t;
1909 unsigned int len = 0, idx = 0;
1910
1911 WINE_TRACE("Checking %s\n", args);
1912
1913 if (yylex() != '(') {WINE_WARN("missing (\n");return -1;}
1914
1915 if (*args)
1916 {
1917 len = strlen(args);
1918 for (;;)
1919 {
1920 t = yylex();
1921 WINE_TRACE("Got %s <=> %c\n", ts(t), *args);
1922
1923 switch (*args)
1924 {
1925 case 'S':
1926 if (t != STRING)
1927 {WINE_WARN("missing S\n");return -1;}
1928 pa[idx] = (void*)yylval.string;
1929 break;
1930 case 'U':
1931 case 'I':
1932 if (t != INTEGER)
1933 {WINE_WARN("missing U\n");return -1;}
1934 pa[idx] = LongToPtr(yylval.integer);
1935 break;
1936 case 'B':
1937 if (t != BOOL_FUNCTION)
1938 {WINE_WARN("missing B\n");return -1;}
1939 if (MACRO_CallBoolFunc(yylval.function, yylval.proto, &pa[idx]) == 0)
1940 return -1;
1941 break;
1942 default:
1943 WINE_WARN("unexpected %s while args is %c\n", ts(t), *args);
1944 return -1;
1945 }
1946 idx++;
1947 if (*++args == '\0') break;
1948 t = yylex();
1949 if (t == ')') goto CheckArgs_end;
1950 if (t != ',') {WINE_WARN("missing ,\n");return -1;}
1951 if (idx >= max) {WINE_FIXME("stack overflow (%d)\n", max);return -1;}
1952 }
1953 }
1954 if (yylex() != ')') {WINE_WARN("missing )\n");return -1;}
1955
1956 CheckArgs_end:
1957 while (len > idx) pa[--len] = NULL;
1958 return idx;
1959 }
1960
1961 /******************************************************************
1962 * MACRO_CallBoolFunc
1963 *
1964 * Invokes boolean function fn, which arguments are defined by args
1965 * stores bool result into ret
1966 */
1967 static int MACRO_CallBoolFunc(void *fn, const char* args, void** ret)
1968 {
1969 void* pa[2];
1970 int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
1971
1972 if (idx < 0) return 0;
1973 if (!fn) return 1;
1974
1975 WINE_TRACE("calling with %u pmts\n", idx);
1976
1977 switch (strlen(args))
1978 {
1979 case 0:
1980 {
1981 BOOL (WINAPI *func)(void) = fn;
1982 *ret = (void *)(ULONG_PTR)func();
1983 break;
1984 }
1985 case 1:
1986 {
1987 BOOL (WINAPI *func)(void *) = fn;
1988 *ret = (void *)(ULONG_PTR)func( pa[0]);
1989 break;
1990 }
1991 default: WINE_FIXME("NIY\n");
1992 }
1993
1994 return 1;
1995 }
1996
1997 /******************************************************************
1998 * MACRO_CallVoidFunc
1999 *
2000 *
2001 */
2002 static int MACRO_CallVoidFunc(void *fn, const char* args)
2003 {
2004 void* pa[6];
2005 int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
2006
2007 if (idx < 0) return 0;
2008 if (!fn) return 1;
2009
2010 WINE_TRACE("calling %p with %u pmts\n", fn, idx);
2011
2012 switch (strlen(args))
2013 {
2014 case 0:
2015 {
2016 void (WINAPI *func)(void) = fn;
2017 func();
2018 break;
2019 }
2020 case 1:
2021 {
2022 void (WINAPI *func)(void*) = fn;
2023 func( pa[0] );
2024 break;
2025 }
2026 case 2:
2027 {
2028 void (WINAPI *func)(void*,void*) = fn;
2029 func( pa[0], pa[1] );
2030 break;
2031 }
2032 case 3:
2033 {
2034 void (WINAPI *func)(void*,void*,void*) = fn;
2035 func( pa[0], pa[1], pa[2] );
2036 break;
2037 }
2038 case 4:
2039 {
2040 void (WINAPI *func)(void*,void*,void*,void*) = fn;
2041 func( pa[0], pa[1], pa[2], pa[3] );
2042 break;
2043 }
2044 case 5:
2045 {
2046 void (WINAPI *func)(void*,void*,void*,void*,void*) = fn;
2047 func( pa[0], pa[1], pa[2], pa[3], pa[4] );
2048 break;
2049 }
2050 case 6:
2051 {
2052 void (WINAPI *func)(void*,void*,void*,void*,void*,void*) = fn;
2053 func( pa[0], pa[1], pa[2], pa[3], pa[4], pa[5] );
2054 break;
2055 }
2056 default: WINE_FIXME("NIY\n");
2057 }
2058
2059 return 1;
2060 }
2061
2062 BOOL MACRO_ExecuteMacro(WINHELP_WINDOW* window, LPCSTR macro)
2063 {
2064 struct lex_data curr_lex_data, *prev_lex_data;
2065 BOOL ret = TRUE;
2066 int t;
2067
2068 WINE_TRACE("%s\n", wine_dbgstr_a(macro));
2069
2070 prev_lex_data = lex_data;
2071 lex_data = &curr_lex_data;
2072
2073 memset(lex_data, 0, sizeof(*lex_data));
2074 lex_data->macroptr = macro;
2075 lex_data->window = WINHELP_GrabWindow(window);
2076
2077 while ((t = yylex()) != EMPTY)
2078 {
2079 switch (t)
2080 {
2081 case VOID_FUNCTION:
2082 WINE_TRACE("got type void func(%s)\n", yylval.proto);
2083 MACRO_CallVoidFunc(yylval.function, yylval.proto);
2084 break;
2085 case BOOL_FUNCTION:
2086 WINE_WARN("got type bool func(%s)\n", yylval.proto);
2087 break;
2088 default:
2089 WINE_WARN("got unexpected type %s\n", ts(t));
2090 YY_FLUSH_BUFFER;
2091 ret = FALSE;
2092 goto done;
2093 }
2094 switch (t = yylex())
2095 {
2096 case EMPTY: goto done;
2097 case ';': break;
2098 default: ret = FALSE; YY_FLUSH_BUFFER; goto done;
2099 }
2100 }
2101
2102 done:
2103 for (t = 0; t < lex_data->cache_used; t++)
2104 HeapFree(GetProcessHeap(), 0, lex_data->cache_string[t]);
2105 lex_data = prev_lex_data;
2106 WINHELP_ReleaseWindow(window);
2107
2108 return ret;
2109 }
2110
2111 WINHELP_WINDOW* MACRO_CurrentWindow(void)
2112 {
2113 return lex_data ? lex_data->window : Globals.active_win;
2114 }
2115
2116 #ifndef yywrap
2117 int yywrap(void) { return 1; }
2118 #endif
2119