1 #line 2 "macro.lex.yy.c"
3 #line 4 "macro.lex.yy.c"
5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
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
17 /* First, we deal with platform-specific or compiler-specific issues. */
19 /* begin standard C headers. */
25 /* end standard C headers. */
27 /* flex integer type definitions */
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types.
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
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
;
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
;
58 /* Limits of integral types. */
60 #define INT8_MIN (-128)
63 #define INT16_MIN (-32767-1)
66 #define INT32_MIN (-2147483647-1)
69 #define INT8_MAX (127)
72 #define INT16_MAX (32767)
75 #define INT32_MAX (2147483647)
78 #define UINT8_MAX (255U)
81 #define UINT16_MAX (65535U)
84 #define UINT32_MAX (4294967295U)
89 #endif /* ! FLEXINT_H */
93 /* The "const" storage-class-modifier is valid. */
96 #else /* ! __cplusplus */
98 /* C99 requires __STDC__ to be defined as 1. */
99 #if defined (__STDC__)
103 #endif /* defined (__STDC__) */
104 #endif /* ! __cplusplus */
107 #define yyconst const
112 /* Returned upon end-of-file. */
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
120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
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.
126 #define BEGIN (yy_start) = 1 + 2 *
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
132 #define YY_START (((yy_start) - 1) / 2)
133 #define YYSTATE YY_START
135 /* Action number for EOF rule of a given start state. */
136 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
138 /* Special action meaning "start processing a new file". */
139 #define YY_NEW_FILE yyrestart(yyin )
141 #define YY_END_OF_BUFFER_CHAR 0
143 /* Size of default input buffer. */
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.
150 #define YY_BUF_SIZE 32768
152 #define YY_BUF_SIZE 16384
153 #endif /* __ia64__ */
156 /* The state buf must be large enough to hold one state per character in the main buffer.
158 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
160 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
161 #define YY_TYPEDEF_YY_BUFFER_STATE
162 typedef struct yy_buffer_state
*YY_BUFFER_STATE
;
167 extern FILE *yyin
, *yyout
;
169 #define EOB_ACT_CONTINUE_SCAN 0
170 #define EOB_ACT_END_OF_FILE 1
171 #define EOB_ACT_LAST_MATCH 2
173 #define YY_LESS_LINENO(n)
175 /* Return all but the first "n" matched characters back to the input stream. */
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 */ \
189 #define unput(c) yyunput( c, (yytext_ptr) )
191 #ifndef YY_TYPEDEF_YY_SIZE_T
192 #define YY_TYPEDEF_YY_SIZE_T
193 typedef size_t yy_size_t
;
196 #ifndef YY_STRUCT_YY_BUFFER_STATE
197 #define YY_STRUCT_YY_BUFFER_STATE
198 struct yy_buffer_state
202 char *yy_ch_buf
; /* input buffer */
203 char *yy_buf_pos
; /* current position in input buffer */
205 /* Size of input buffer in bytes, not including room for EOB
208 yy_size_t yy_buf_size
;
210 /* Number of characters read into yy_ch_buf, not including EOB
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
219 int yy_is_our_buffer
;
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
226 int yy_is_interactive
;
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
234 int yy_bs_lineno
; /**< The line count. */
235 int yy_bs_column
; /**< The column count. */
237 /* Whether to try to fill the input buffer when we reach the
242 int yy_buffer_status
;
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.
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.
256 #define YY_BUFFER_EOF_PENDING 2
259 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
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. */
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
270 * Returns the top of the stack, or NULL.
272 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
273 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
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.
279 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
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 */
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 */
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 ...
294 static int yy_did_buffer_switch_on_eof
;
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 );
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
);
308 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
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
);
314 void *yyalloc (yy_size_t
);
315 void *yyrealloc (void *,yy_size_t
);
316 void yyfree (void * );
318 #define yy_new_buffer yy_create_buffer
320 #define yy_set_interactive(is_interactive) \
322 if ( ! YY_CURRENT_BUFFER ){ \
323 yyensure_buffer_stack (); \
324 YY_CURRENT_BUFFER_LVALUE = \
325 yy_create_buffer(yyin,YY_BUF_SIZE ); \
327 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
330 #define yy_set_bol(at_bol) \
332 if ( ! YY_CURRENT_BUFFER ){\
333 yyensure_buffer_stack (); \
334 YY_CURRENT_BUFFER_LVALUE = \
335 yy_create_buffer(yyin,YY_BUF_SIZE ); \
337 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
340 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
342 /* Begin user sect3 */
344 typedef unsigned char YY_CHAR
;
346 FILE *yyin
= (FILE *) 0, *yyout
= (FILE *) 0;
348 typedef int yy_state_type
;
355 #define yytext_ptr yytext
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
[] );
362 /* Done after the current pattern has been matched and before the
363 * corresponding action - sets up yytext.
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; \
370 (yy_c_buf_p) = yy_cp;
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. */
378 flex_int32_t yy_verify
;
381 static yyconst flex_int16_t yy_accept
[28] =
383 0, 0, 0, 0, 15, 13, 14, 12, 5, 6,
384 13, 1, 1, 3, 4, 10, 8, 9, 10, 7,
388 static yyconst flex_int32_t yy_ec
[256] =
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,
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,
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,
420 static yyconst flex_int32_t yy_meta
[15] =
422 1, 2, 1, 1, 1, 1, 3, 3, 4, 5,
426 static yyconst flex_int16_t yy_base
[33] =
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,
434 static yyconst flex_int16_t yy_def
[33] =
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,
442 static yyconst flex_int16_t yy_nxt
[77] =
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
454 static yyconst flex_int16_t yy_chk
[77] =
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
466 static yy_state_type yy_last_accepting_state
;
467 static char *yy_last_accepting_cpos
;
469 extern int yy_flex_debug
;
470 int yy_flex_debug
= 0;
472 /* The intent behind this definition is that it'll catch
473 * any uses of REJECT which flex missed.
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
480 #line 1 "macro.lex.l"
481 #line 2 "macro.lex.l"
485 * Copyright 1996 Ulrich Schmid
486 * Copyright 2002,2008 Eric Pouech
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.
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.
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
502 #define YY_NO_INPUT 1
504 #line 26 "macro.lex.l"
509 #define YY_NO_UNISTD_H
516 #include "wine/debug.h"
518 WINE_DEFAULT_DEBUG_CHANNEL(winhelp
);
524 unsigned quote_stk_idx
;
525 LPSTR cache_string
[32];
527 WINHELP_WINDOW
* window
;
529 static struct lex_data
* lex_data
= NULL
;
531 struct lexret yylval
;
533 #define YY_INPUT(buf,result,max_size)\
534 if ((result = *lex_data->macroptr ? 1 : 0)) buf[0] = *lex_data->macroptr++;
536 #line 537 "macro.lex.yy.c"
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.
549 #ifndef YY_EXTRA_TYPE
550 #define YY_EXTRA_TYPE void *
553 static int yy_init_globals (void );
555 /* Accessor methods to globals.
556 These are made visible to non-reentrant scanners for convenience. */
558 int yylex_destroy (void );
560 int yyget_debug (void );
562 void yyset_debug (int debug_flag
);
564 YY_EXTRA_TYPE
yyget_extra (void );
566 void yyset_extra (YY_EXTRA_TYPE user_defined
);
568 FILE *yyget_in (void );
570 void yyset_in (FILE * in_str
);
572 FILE *yyget_out (void );
574 void yyset_out (FILE * out_str
);
576 int yyget_leng (void );
578 char *yyget_text (void );
580 int yyget_lineno (void );
582 void yyset_lineno (int line_number
);
584 /* Macros after this point can all be overridden by user definitions in
588 #ifndef YY_SKIP_YYWRAP
590 extern "C" int yywrap (void );
592 extern int yywrap (void );
597 static void yy_flex_strncpy (char *,yyconst
char *,int );
600 #ifdef YY_NEED_STRLEN
601 static int yy_flex_strlen (yyconst
char * );
607 static int yyinput (void );
609 static int input (void );
614 /* Amount of stuff to slurp up with each read. */
615 #ifndef YY_READ_BUF_SIZE
617 /* On IA-64, the buffer size is 16k, not 8k */
618 #define YY_READ_BUF_SIZE 16384
620 #define YY_READ_BUF_SIZE 8192
621 #endif /* __ia64__ */
624 /* Copy whatever the last rule matched to the standard output. */
626 /* This used to be an fputs(), but since the string might contain NUL's,
627 * we now use fwrite().
629 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
632 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
633 * is returned in "result".
636 #define YY_INPUT(buf,result,max_size) \
637 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
641 for ( n = 0; n < max_size && \
642 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
645 buf[n++] = (char) c; \
646 if ( c == EOF && ferror( yyin ) ) \
647 YY_FATAL_ERROR( "input in flex scanner failed" ); \
653 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
655 if( errno != EINTR) \
657 YY_FATAL_ERROR( "input in flex scanner failed" ); \
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.
673 #define yyterminate() return YY_NULL
676 /* Number of entries by which start-condition stack grows. */
677 #ifndef YY_START_STACK_INCR
678 #define YY_START_STACK_INCR 25
681 /* Report a fatal error. */
682 #ifndef YY_FATAL_ERROR
683 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
686 /* end tables serialization structures and prototypes */
688 /* Default declaration of generated scanner - a define so the user can
689 * easily add parameters.
692 #define YY_DECL_IS_OURS 1
694 extern int yylex (void);
696 #define YY_DECL int yylex (void)
697 #endif /* !YY_DECL */
699 /* Code executed at the beginning of each rule, after yytext and yyleng
702 #ifndef YY_USER_ACTION
703 #define YY_USER_ACTION
706 /* Code executed at the end of each rule. */
708 #define YY_BREAK break;
711 #define YY_RULE_SETUP \
714 /** The main scanner function which does all the work.
718 register yy_state_type yy_current_state
;
719 register char *yy_cp
, *yy_bp
;
722 #line 58 "macro.lex.l"
725 #line 726 "macro.lex.yy.c"
736 (yy_start
) = 1; /* first start state */
744 if ( ! YY_CURRENT_BUFFER
) {
745 yyensure_buffer_stack ();
746 YY_CURRENT_BUFFER_LVALUE
=
747 yy_create_buffer(yyin
,YY_BUF_SIZE
);
750 yy_load_buffer_state( );
753 while ( 1 ) /* loops until end-of-file is reached */
755 yy_cp
= (yy_c_buf_p
);
757 /* Support of yytext. */
758 *yy_cp
= (yy_hold_char
);
760 /* yy_bp points to the position in yy_ch_buf of the start of
765 yy_current_state
= (yy_start
);
769 register YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)];
770 if ( yy_accept
[yy_current_state
] )
772 (yy_last_accepting_state
) = yy_current_state
;
773 (yy_last_accepting_cpos
) = yy_cp
;
775 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
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
];
781 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
784 while ( yy_current_state
!= 27 );
785 yy_cp
= (yy_last_accepting_cpos
);
786 yy_current_state
= (yy_last_accepting_state
);
789 yy_act
= yy_accept
[yy_current_state
];
793 do_action
: /* This label is used only to access EOF actions. */
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
);
806 #line 60 "macro.lex.l"
807 yylval
.integer
= strtol(yytext
, NULL
, 10); return INTEGER
;
811 #line 61 "macro.lex.l"
812 yylval
.integer
= strtol(yytext
, NULL
, 16); return INTEGER
;
816 #line 63 "macro.lex.l"
817 return MACRO_Lookup(yytext
, &yylval
);
820 #line 66 "macro.lex.l"
822 #line 67 "macro.lex.l"
824 #line 68 "macro.lex.l"
826 #line 69 "macro.lex.l"
828 #line 70 "macro.lex.l"
831 #line 70 "macro.lex.l"
833 if (lex_data
->quote_stk_idx
== 0 ||
834 (yytext
[0] == '\"' && lex_data
->quote_stack
[lex_data
->quote_stk_idx
- 1] != '\"') ||
837 /* opening a new one */
838 if (lex_data
->quote_stk_idx
== 0)
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
++;
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]));
852 if (yytext
[0] == '`') assert(0);
853 /* close the current quote */
854 if (--lex_data
->quote_stk_idx
== 0)
857 *lex_data
->strptr
++ = '\0';
860 else *lex_data
->strptr
++ = yytext
[0];
866 #line 102 "macro.lex.l"
867 *lex_data
->strptr
++ = yytext
[0];
871 #line 103 "macro.lex.l"
872 *lex_data
->strptr
++ = yytext
[1];
874 case YY_STATE_EOF(quote
):
875 #line 104 "macro.lex.l"
880 #line 106 "macro.lex.l"
885 #line 107 "macro.lex.l"
890 #line 108 "macro.lex.l"
893 #line 894 "macro.lex.yy.c"
894 case YY_STATE_EOF(INITIAL
):
897 case YY_END_OF_BUFFER
:
899 /* Amount of text matched not including the EOB char. */
900 int yy_amount_of_matched_text
= (int) (yy_cp
- (yytext_ptr
)) - 1;
902 /* Undo the effects of YY_DO_BEFORE_ACTION. */
903 *yy_cp
= (yy_hold_char
);
904 YY_RESTORE_YY_MORE_OFFSET
906 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_NEW
)
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.
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
;
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
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
;
933 (yy_c_buf_p
) = (yytext_ptr
) + yy_amount_of_matched_text
;
935 yy_current_state
= yy_get_previous_state( );
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).
946 yy_next_state
= yy_try_NUL_trans( yy_current_state
);
948 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
952 /* Consume the NUL. */
953 yy_cp
= ++(yy_c_buf_p
);
954 yy_current_state
= yy_next_state
;
960 yy_cp
= (yy_last_accepting_cpos
);
961 yy_current_state
= (yy_last_accepting_state
);
966 else switch ( yy_get_next_buffer( ) )
968 case EOB_ACT_END_OF_FILE
:
970 (yy_did_buffer_switch_on_eof
) = 0;
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.
983 (yy_c_buf_p
) = (yytext_ptr
) + YY_MORE_ADJ
;
985 yy_act
= YY_STATE_EOF(YY_START
);
991 if ( ! (yy_did_buffer_switch_on_eof
) )
997 case EOB_ACT_CONTINUE_SCAN
:
999 (yytext_ptr
) + yy_amount_of_matched_text
;
1001 yy_current_state
= yy_get_previous_state( );
1003 yy_cp
= (yy_c_buf_p
);
1004 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1007 case EOB_ACT_LAST_MATCH
:
1009 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)];
1011 yy_current_state
= yy_get_previous_state( );
1013 yy_cp
= (yy_c_buf_p
);
1014 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1015 goto yy_find_action
;
1022 "fatal flex scanner internal error--no action found" );
1023 } /* end of action switch */
1024 } /* end of scanning one token */
1025 } /* end of yylex */
1027 /* yy_get_next_buffer - try to read in a new buffer
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
1034 static int yy_get_next_buffer (void)
1036 register char *dest
= YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
;
1037 register char *source
= (yytext_ptr
);
1038 register int number_to_move
, i
;
1041 if ( (yy_c_buf_p
) > &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
) + 1] )
1043 "fatal flex scanner internal error--end of buffer missed" );
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 )
1049 /* We matched a single character, the EOB, so
1050 * treat this as a final EOF.
1052 return EOB_ACT_END_OF_FILE
;
1057 /* We matched some text prior to the EOB, first
1060 return EOB_ACT_LAST_MATCH
;
1064 /* Try to read more data. */
1066 /* First move last chars to start of buffer. */
1067 number_to_move
= (int) ((yy_c_buf_p
) - (yytext_ptr
)) - 1;
1069 for ( i
= 0; i
< number_to_move
; ++i
)
1070 *(dest
++) = *(source
++);
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,
1076 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
) = 0;
1081 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
- number_to_move
- 1;
1083 while ( num_to_read
<= 0 )
1084 { /* Not enough room in the buffer - grow it. */
1086 /* just a shorter name for the current buffer */
1087 YY_BUFFER_STATE b
= YY_CURRENT_BUFFER
;
1089 int yy_c_buf_p_offset
=
1090 (int) ((yy_c_buf_p
) - b
->yy_ch_buf
);
1092 if ( b
->yy_is_our_buffer
)
1094 int new_size
= b
->yy_buf_size
* 2;
1096 if ( new_size
<= 0 )
1097 b
->yy_buf_size
+= b
->yy_buf_size
/ 8;
1099 b
->yy_buf_size
*= 2;
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 );
1106 /* Can't grow it, we don't own it. */
1109 if ( ! b
->yy_ch_buf
)
1111 "fatal error - scanner input buffer overflow" );
1113 (yy_c_buf_p
) = &b
->yy_ch_buf
[yy_c_buf_p_offset
];
1115 num_to_read
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
-
1120 if ( num_to_read
> YY_READ_BUF_SIZE
)
1121 num_to_read
= YY_READ_BUF_SIZE
;
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
);
1127 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
1130 if ( (yy_n_chars
) == 0 )
1132 if ( number_to_move
== YY_MORE_ADJ
)
1134 ret_val
= EOB_ACT_END_OF_FILE
;
1140 ret_val
= EOB_ACT_LAST_MATCH
;
1141 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
=
1142 YY_BUFFER_EOF_PENDING
;
1147 ret_val
= EOB_ACT_CONTINUE_SCAN
;
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()" );
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
;
1161 (yytext_ptr
) = &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[0];
1166 /* yy_get_previous_state - get the state just before the EOB char was reached */
1168 static yy_state_type
yy_get_previous_state (void)
1170 register yy_state_type yy_current_state
;
1171 register char *yy_cp
;
1173 yy_current_state
= (yy_start
);
1175 for ( yy_cp
= (yytext_ptr
) + YY_MORE_ADJ
; yy_cp
< (yy_c_buf_p
); ++yy_cp
)
1177 register YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
1178 if ( yy_accept
[yy_current_state
] )
1180 (yy_last_accepting_state
) = yy_current_state
;
1181 (yy_last_accepting_cpos
) = yy_cp
;
1183 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
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
];
1189 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1192 return yy_current_state
;
1195 /* yy_try_NUL_trans - try to make a transition on the NUL character
1198 * next_state = yy_try_NUL_trans( current_state );
1200 static yy_state_type
yy_try_NUL_trans (yy_state_type yy_current_state
)
1202 register int yy_is_jam
;
1203 register char *yy_cp
= (yy_c_buf_p
);
1205 register YY_CHAR yy_c
= 1;
1206 if ( yy_accept
[yy_current_state
] )
1208 (yy_last_accepting_state
) = yy_current_state
;
1209 (yy_last_accepting_cpos
) = yy_cp
;
1211 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
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
];
1217 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1218 yy_is_jam
= (yy_current_state
== 27);
1220 return yy_is_jam
? 0 : yy_current_state
;
1225 static int yyinput (void)
1227 static int input (void)
1233 *(yy_c_buf_p
) = (yy_hold_char
);
1235 if ( *(yy_c_buf_p
) == YY_END_OF_BUFFER_CHAR
)
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.
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';
1246 { /* need more input */
1247 int offset
= (yy_c_buf_p
) - (yytext_ptr
);
1250 switch ( yy_get_next_buffer( ) )
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.
1263 /* Reset buffer status. */
1268 case EOB_ACT_END_OF_FILE
:
1273 if ( ! (yy_did_buffer_switch_on_eof
) )
1282 case EOB_ACT_CONTINUE_SCAN
:
1283 (yy_c_buf_p
) = (yytext_ptr
) + offset
;
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
);
1295 #endif /* ifndef YY_NO_INPUT */
1297 /** Immediately switch to a different input stream.
1298 * @param input_file A readable stream.
1300 * @note This function does not reset the start condition to @c INITIAL .
1302 void yyrestart (FILE * input_file
)
1305 if ( ! YY_CURRENT_BUFFER
){
1306 yyensure_buffer_stack ();
1307 YY_CURRENT_BUFFER_LVALUE
=
1308 yy_create_buffer(yyin
,YY_BUF_SIZE
);
1311 yy_init_buffer(YY_CURRENT_BUFFER
,input_file
);
1312 yy_load_buffer_state( );
1315 /** Switch to a different input buffer.
1316 * @param new_buffer The new input buffer.
1319 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer
)
1322 /* TODO. We should be able to replace this entire function body
1324 * yypop_buffer_state();
1325 * yypush_buffer_state(new_buffer);
1327 yyensure_buffer_stack ();
1328 if ( YY_CURRENT_BUFFER
== new_buffer
)
1331 if ( YY_CURRENT_BUFFER
)
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
);
1339 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
1340 yy_load_buffer_state( );
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.
1347 (yy_did_buffer_switch_on_eof
) = 1;
1350 static void yy_load_buffer_state (void)
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
);
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.
1362 * @return the allocated buffer state.
1364 YY_BUFFER_STATE
yy_create_buffer (FILE * file
, int size
)
1368 b
= (YY_BUFFER_STATE
) yyalloc(sizeof( struct yy_buffer_state
) );
1370 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1372 b
->yy_buf_size
= size
;
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.
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()" );
1381 b
->yy_is_our_buffer
= 1;
1383 yy_init_buffer(b
,file
);
1388 /** Destroy the buffer.
1389 * @param b a buffer created with yy_create_buffer()
1392 void yy_delete_buffer (YY_BUFFER_STATE b
)
1398 if ( b
== YY_CURRENT_BUFFER
) /* Not sure if we should pop here. */
1399 YY_CURRENT_BUFFER_LVALUE
= (YY_BUFFER_STATE
) 0;
1401 if ( b
->yy_is_our_buffer
)
1402 yyfree((void *) b
->yy_ch_buf
);
1404 yyfree((void *) b
);
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.
1411 static void yy_init_buffer (YY_BUFFER_STATE b
, FILE * file
)
1416 yy_flush_buffer(b
);
1418 b
->yy_input_file
= file
;
1419 b
->yy_fill_buffer
= 1;
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.
1425 if (b
!= YY_CURRENT_BUFFER
){
1426 b
->yy_bs_lineno
= 1;
1427 b
->yy_bs_column
= 0;
1430 b
->yy_is_interactive
= 0;
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.
1439 void yy_flush_buffer (YY_BUFFER_STATE b
)
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.
1450 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
1451 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
1453 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
1456 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1458 if ( b
== YY_CURRENT_BUFFER
)
1459 yy_load_buffer_state( );
1462 /** Pushes the new state onto the stack. The new state becomes
1463 * the current state. This function will allocate the stack
1465 * @param new_buffer The new state.
1468 void yypush_buffer_state (YY_BUFFER_STATE new_buffer
)
1470 if (new_buffer
== NULL
)
1473 yyensure_buffer_stack();
1475 /* This block is copied from yy_switch_to_buffer. */
1476 if ( YY_CURRENT_BUFFER
)
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
);
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
;
1489 /* copied from yy_switch_to_buffer. */
1490 yy_load_buffer_state( );
1491 (yy_did_buffer_switch_on_eof
) = 1;
1494 /** Removes and deletes the top of the stack, if present.
1495 * The next element becomes the new top.
1498 void yypop_buffer_state (void)
1500 if (!YY_CURRENT_BUFFER
)
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
);
1508 if (YY_CURRENT_BUFFER
) {
1509 yy_load_buffer_state( );
1510 (yy_did_buffer_switch_on_eof
) = 1;
1514 /* Allocates the stack if it does not exist.
1515 * Guarantees space for at least one push.
1517 static void yyensure_buffer_stack (void)
1521 if (!(yy_buffer_stack
)) {
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.
1528 (yy_buffer_stack
) = (struct yy_buffer_state
**)yyalloc
1529 (num_to_alloc
* sizeof(struct yy_buffer_state
*)
1531 if ( ! (yy_buffer_stack
) )
1532 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1534 memset((yy_buffer_stack
), 0, num_to_alloc
* sizeof(struct yy_buffer_state
*));
1536 (yy_buffer_stack_max
) = num_to_alloc
;
1537 (yy_buffer_stack_top
) = 0;
1541 if ((yy_buffer_stack_top
) >= ((yy_buffer_stack_max
)) - 1){
1543 /* Increase the buffer to prepare for a possible push. */
1544 int grow_size
= 8 /* arbitrary grow size */;
1546 num_to_alloc
= (yy_buffer_stack_max
) + grow_size
;
1547 (yy_buffer_stack
) = (struct yy_buffer_state
**)yyrealloc
1549 num_to_alloc
* sizeof(struct yy_buffer_state
*)
1551 if ( ! (yy_buffer_stack
) )
1552 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
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
;
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
1564 * @return the newly allocated buffer state object.
1566 YY_BUFFER_STATE
yy_scan_buffer (char * base
, yy_size_t size
)
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. */
1576 b
= (YY_BUFFER_STATE
) yyalloc(sizeof( struct yy_buffer_state
) );
1578 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
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;
1587 b
->yy_fill_buffer
= 0;
1588 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1590 yy_switch_to_buffer(b
);
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
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.
1603 YY_BUFFER_STATE
yy_scan_string (yyconst
char * yystr
)
1606 return yy_scan_bytes(yystr
,strlen(yystr
) );
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.
1614 * @return the newly allocated buffer state object.
1616 YY_BUFFER_STATE
yy_scan_bytes (yyconst
char * yybytes
, int _yybytes_len
)
1623 /* Get memory for full buffer, including space for trailing EOB's. */
1624 n
= _yybytes_len
+ 2;
1625 buf
= (char *) yyalloc(n
);
1627 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1629 for ( i
= 0; i
< _yybytes_len
; ++i
)
1630 buf
[i
] = yybytes
[i
];
1632 buf
[_yybytes_len
] = buf
[_yybytes_len
+1] = YY_END_OF_BUFFER_CHAR
;
1634 b
= yy_scan_buffer(buf
,n
);
1636 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1638 /* It's okay to grow etc. this buffer, and we should throw it
1639 * away when we're done.
1641 b
->yy_is_our_buffer
= 1;
1646 #ifndef YY_EXIT_FAILURE
1647 #define YY_EXIT_FAILURE 2
1650 static void yy_fatal_error (yyconst
char* msg
)
1652 (void) fprintf( stderr
, "%s\n", msg
);
1653 exit( YY_EXIT_FAILURE
);
1656 /* Redefine yyless() so it works in section 3 code. */
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; \
1673 /* Accessor methods (get/set functions) to struct members. */
1675 /** Get the current line number.
1678 int yyget_lineno (void)
1684 /** Get the input stream.
1687 FILE *yyget_in (void)
1692 /** Get the output stream.
1695 FILE *yyget_out (void)
1700 /** Get the length of the current token.
1703 int yyget_leng (void)
1708 /** Get the current token.
1712 char *yyget_text (void)
1717 /** Set the current line number.
1718 * @param line_number
1721 void yyset_lineno (int line_number
)
1724 yylineno
= line_number
;
1727 /** Set the input stream. This does not discard the current
1729 * @param in_str A readable stream.
1731 * @see yy_switch_to_buffer
1733 void yyset_in (FILE * in_str
)
1738 void yyset_out (FILE * out_str
)
1743 int yyget_debug (void)
1745 return yy_flex_debug
;
1748 void yyset_debug (int bdebug
)
1750 yy_flex_debug
= bdebug
;
1753 static int yy_init_globals (void)
1755 /* Initialization is the same as for the non-reentrant scanner.
1756 * This function is called from yylex_destroy(), so don't allocate here.
1759 (yy_buffer_stack
) = 0;
1760 (yy_buffer_stack_top
) = 0;
1761 (yy_buffer_stack_max
) = 0;
1762 (yy_c_buf_p
) = (char *) 0;
1766 /* Defined in main.c */
1775 /* For future reference: Set errno on error, since we are called by
1781 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1782 int yylex_destroy (void)
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();
1792 /* Destroy the stack itself. */
1793 yyfree((yy_buffer_stack
) );
1794 (yy_buffer_stack
) = NULL
;
1796 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1797 * yylex() is called, initialization will occur. */
1804 * Internal utility routines.
1808 static void yy_flex_strncpy (char* s1
, yyconst
char * s2
, int n
)
1811 for ( i
= 0; i
< n
; ++i
)
1816 #ifdef YY_NEED_STRLEN
1817 static int yy_flex_strlen (yyconst
char * s
)
1820 for ( n
= 0; s
[n
]; ++n
)
1827 void *yyalloc (yy_size_t size
)
1829 return (void *) malloc( size
);
1832 void *yyrealloc (void * ptr
, yy_size_t size
)
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.
1841 return (void *) realloc( (char *) ptr
, size
);
1844 void yyfree (void * ptr
)
1846 free( (char *) ptr
); /* see yyrealloc() for (char *) cast */
1849 #define YYTABLES_NAME "yytables"
1851 #line 108 "macro.lex.l"
1856 /* all code for testing macros */
1857 #include "winhelp.h"
1858 static CHAR szTestMacro
[256];
1860 static LRESULT CALLBACK
MACRO_TestDialogProc(HWND hDlg
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
1862 if (msg
== WM_COMMAND
&& wParam
== IDOK
)
1864 GetDlgItemText(hDlg
, 99, szTestMacro
, sizeof(szTestMacro
));
1865 EndDialog(hDlg
, IDOK
);
1871 void macro_test(void)
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
;
1880 /* small helper function for debug messages */
1881 static const char* ts(int t
)
1883 static char c
[2] = {0,0};
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
;
1897 static int MACRO_CallBoolFunc(void *fn
, const char* args
, void** ret
);
1899 /******************************************************************
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
1906 static int MACRO_CheckArgs(void* pa
[], unsigned max
, const char* args
)
1909 unsigned int len
= 0, idx
= 0;
1911 WINE_TRACE("Checking %s\n", args
);
1913 if (yylex() != '(') {WINE_WARN("missing (\n");return -1;}
1921 WINE_TRACE("Got %s <=> %c\n", ts(t
), *args
);
1927 {WINE_WARN("missing S\n");return -1;}
1928 pa
[idx
] = (void*)yylval
.string
;
1933 {WINE_WARN("missing U\n");return -1;}
1934 pa
[idx
] = LongToPtr(yylval
.integer
);
1937 if (t
!= BOOL_FUNCTION
)
1938 {WINE_WARN("missing B\n");return -1;}
1939 if (MACRO_CallBoolFunc(yylval
.function
, yylval
.proto
, &pa
[idx
]) == 0)
1943 WINE_WARN("unexpected %s while args is %c\n", ts(t
), *args
);
1947 if (*++args
== '\0') break;
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;}
1954 if (yylex() != ')') {WINE_WARN("missing )\n");return -1;}
1957 while (len
> idx
) pa
[--len
] = NULL
;
1961 /******************************************************************
1962 * MACRO_CallBoolFunc
1964 * Invokes boolean function fn, which arguments are defined by args
1965 * stores bool result into ret
1967 static int MACRO_CallBoolFunc(void *fn
, const char* args
, void** ret
)
1970 int idx
= MACRO_CheckArgs(pa
, sizeof(pa
)/sizeof(pa
[0]), args
);
1972 if (idx
< 0) return 0;
1975 WINE_TRACE("calling with %u pmts\n", idx
);
1977 switch (strlen(args
))
1981 BOOL (WINAPI
*func
)(void) = fn
;
1982 *ret
= (void *)(ULONG_PTR
)func();
1987 BOOL (WINAPI
*func
)(void *) = fn
;
1988 *ret
= (void *)(ULONG_PTR
)func( pa
[0]);
1991 default: WINE_FIXME("NIY\n");
1997 /******************************************************************
1998 * MACRO_CallVoidFunc
2002 static int MACRO_CallVoidFunc(void *fn
, const char* args
)
2005 int idx
= MACRO_CheckArgs(pa
, sizeof(pa
)/sizeof(pa
[0]), args
);
2007 if (idx
< 0) return 0;
2010 WINE_TRACE("calling %p with %u pmts\n", fn
, idx
);
2012 switch (strlen(args
))
2016 void (WINAPI
*func
)(void) = fn
;
2022 void (WINAPI
*func
)(void*) = fn
;
2028 void (WINAPI
*func
)(void*,void*) = fn
;
2029 func( pa
[0], pa
[1] );
2034 void (WINAPI
*func
)(void*,void*,void*) = fn
;
2035 func( pa
[0], pa
[1], pa
[2] );
2040 void (WINAPI
*func
)(void*,void*,void*,void*) = fn
;
2041 func( pa
[0], pa
[1], pa
[2], pa
[3] );
2046 void (WINAPI
*func
)(void*,void*,void*,void*,void*) = fn
;
2047 func( pa
[0], pa
[1], pa
[2], pa
[3], pa
[4] );
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] );
2056 default: WINE_FIXME("NIY\n");
2062 BOOL
MACRO_ExecuteMacro(WINHELP_WINDOW
* window
, LPCSTR macro
)
2064 struct lex_data curr_lex_data
, *prev_lex_data
;
2068 WINE_TRACE("%s\n", wine_dbgstr_a(macro
));
2070 prev_lex_data
= lex_data
;
2071 lex_data
= &curr_lex_data
;
2073 memset(lex_data
, 0, sizeof(*lex_data
));
2074 lex_data
->macroptr
= macro
;
2075 lex_data
->window
= WINHELP_GrabWindow(window
);
2077 while ((t
= yylex()) != EMPTY
)
2082 WINE_TRACE("got type void func(%s)\n", yylval
.proto
);
2083 MACRO_CallVoidFunc(yylval
.function
, yylval
.proto
);
2086 WINE_WARN("got type bool func(%s)\n", yylval
.proto
);
2089 WINE_WARN("got unexpected type %s\n", ts(t
));
2094 switch (t
= yylex())
2096 case EMPTY
: goto done
;
2098 default: ret
= FALSE
; YY_FLUSH_BUFFER
; goto 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
);
2111 WINHELP_WINDOW
* MACRO_CurrentWindow(void)
2113 return lex_data
? lex_data
->window
: Globals
.active_win
;
2117 int yywrap(void) { return 1; }