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"
507 #define YY_NO_UNISTD_H
514 unsigned quote_stk_idx
;
515 LPSTR cache_string
[32];
517 WINHELP_WINDOW
* window
;
519 static struct lex_data
* lex_data
= NULL
;
521 struct lexret yylval
;
523 #define YY_INPUT(buf,result,max_size)\
524 if ((result = *lex_data->macroptr ? 1 : 0)) buf[0] = *lex_data->macroptr++;
526 #line 537 "macro.lex.yy.c"
531 #ifndef YY_NO_UNISTD_H
532 /* Special case for "unistd.h", since it is non-ANSI. We include it way
533 * down here because we want the user's section 1 to have been scanned first.
534 * The user has a chance to override it with an option.
539 #ifndef YY_EXTRA_TYPE
540 #define YY_EXTRA_TYPE void *
543 static int yy_init_globals (void );
545 /* Accessor methods to globals.
546 These are made visible to non-reentrant scanners for convenience. */
548 int yylex_destroy (void );
550 int yyget_debug (void );
552 void yyset_debug (int debug_flag
);
554 YY_EXTRA_TYPE
yyget_extra (void );
556 void yyset_extra (YY_EXTRA_TYPE user_defined
);
558 FILE *yyget_in (void );
560 void yyset_in (FILE * in_str
);
562 FILE *yyget_out (void );
564 void yyset_out (FILE * out_str
);
566 int yyget_leng (void );
568 char *yyget_text (void );
570 int yyget_lineno (void );
572 void yyset_lineno (int line_number
);
574 /* Macros after this point can all be overridden by user definitions in
578 #ifndef YY_SKIP_YYWRAP
580 extern "C" int yywrap (void );
582 extern int yywrap (void );
587 static void yy_flex_strncpy (char *,yyconst
char *,int );
590 #ifdef YY_NEED_STRLEN
591 static int yy_flex_strlen (yyconst
char * );
597 static int yyinput (void );
599 static int input (void );
604 /* Amount of stuff to slurp up with each read. */
605 #ifndef YY_READ_BUF_SIZE
607 /* On IA-64, the buffer size is 16k, not 8k */
608 #define YY_READ_BUF_SIZE 16384
610 #define YY_READ_BUF_SIZE 8192
611 #endif /* __ia64__ */
614 /* Copy whatever the last rule matched to the standard output. */
616 /* This used to be an fputs(), but since the string might contain NUL's,
617 * we now use fwrite().
619 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
622 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
623 * is returned in "result".
626 #define YY_INPUT(buf,result,max_size) \
627 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
631 for ( n = 0; n < max_size && \
632 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
635 buf[n++] = (char) c; \
636 if ( c == EOF && ferror( yyin ) ) \
637 YY_FATAL_ERROR( "input in flex scanner failed" ); \
643 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
645 if( errno != EINTR) \
647 YY_FATAL_ERROR( "input in flex scanner failed" ); \
658 /* No semi-colon after return; correct usage is to write "yyterminate();" -
659 * we don't want an extra ';' after the "return" because that will cause
660 * some compilers to complain about unreachable statements.
663 #define yyterminate() return YY_NULL
666 /* Number of entries by which start-condition stack grows. */
667 #ifndef YY_START_STACK_INCR
668 #define YY_START_STACK_INCR 25
671 /* Report a fatal error. */
672 #ifndef YY_FATAL_ERROR
673 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
676 /* end tables serialization structures and prototypes */
678 /* Default declaration of generated scanner - a define so the user can
679 * easily add parameters.
682 #define YY_DECL_IS_OURS 1
684 extern int yylex (void);
686 #define YY_DECL int yylex (void)
687 #endif /* !YY_DECL */
689 /* Code executed at the beginning of each rule, after yytext and yyleng
692 #ifndef YY_USER_ACTION
693 #define YY_USER_ACTION
696 /* Code executed at the end of each rule. */
698 #define YY_BREAK break;
701 #define YY_RULE_SETUP \
704 /** The main scanner function which does all the work.
708 register yy_state_type yy_current_state
;
709 register char *yy_cp
, *yy_bp
;
712 #line 58 "macro.lex.l"
715 #line 726 "macro.lex.yy.c"
726 (yy_start
) = 1; /* first start state */
734 if ( ! YY_CURRENT_BUFFER
) {
735 yyensure_buffer_stack ();
736 YY_CURRENT_BUFFER_LVALUE
=
737 yy_create_buffer(yyin
,YY_BUF_SIZE
);
740 yy_load_buffer_state( );
743 while ( 1 ) /* loops until end-of-file is reached */
745 yy_cp
= (yy_c_buf_p
);
747 /* Support of yytext. */
748 *yy_cp
= (yy_hold_char
);
750 /* yy_bp points to the position in yy_ch_buf of the start of
755 yy_current_state
= (yy_start
);
759 register YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)];
760 if ( yy_accept
[yy_current_state
] )
762 (yy_last_accepting_state
) = yy_current_state
;
763 (yy_last_accepting_cpos
) = yy_cp
;
765 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
767 yy_current_state
= (int) yy_def
[yy_current_state
];
768 if ( yy_current_state
>= 28 )
769 yy_c
= yy_meta
[(unsigned int) yy_c
];
771 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
774 while ( yy_current_state
!= 27 );
775 yy_cp
= (yy_last_accepting_cpos
);
776 yy_current_state
= (yy_last_accepting_state
);
779 yy_act
= yy_accept
[yy_current_state
];
783 do_action
: /* This label is used only to access EOF actions. */
786 { /* beginning of action switch */
787 case 0: /* must back up */
788 /* undo the effects of YY_DO_BEFORE_ACTION */
789 *yy_cp
= (yy_hold_char
);
790 yy_cp
= (yy_last_accepting_cpos
);
791 yy_current_state
= (yy_last_accepting_state
);
796 #line 60 "macro.lex.l"
797 yylval
.integer
= strtol(yytext
, NULL
, 10); return INTEGER
;
801 #line 61 "macro.lex.l"
802 yylval
.integer
= strtol(yytext
, NULL
, 16); return INTEGER
;
806 #line 63 "macro.lex.l"
807 return MACRO_Lookup(yytext
, &yylval
);
810 #line 66 "macro.lex.l"
812 #line 67 "macro.lex.l"
814 #line 68 "macro.lex.l"
816 #line 69 "macro.lex.l"
818 #line 70 "macro.lex.l"
821 #line 70 "macro.lex.l"
823 if (lex_data
->quote_stk_idx
== 0 ||
824 (yytext
[0] == '\"' && lex_data
->quote_stack
[lex_data
->quote_stk_idx
- 1] != '\"') ||
827 /* opening a new one */
828 if (lex_data
->quote_stk_idx
== 0)
830 assert(lex_data
->cache_used
< sizeof(lex_data
->cache_string
) / sizeof(lex_data
->cache_string
[0]));
831 lex_data
->strptr
= lex_data
->cache_string
[lex_data
->cache_used
] = HeapAlloc(GetProcessHeap(), 0, strlen(lex_data
->macroptr
) + 1);
832 yylval
.string
= lex_data
->strptr
;
833 lex_data
->cache_used
++;
836 else *lex_data
->strptr
++ = yytext
[0];
837 lex_data
->quote_stack
[lex_data
->quote_stk_idx
++] = yytext
[0];
838 assert(lex_data
->quote_stk_idx
< sizeof(lex_data
->quote_stack
) / sizeof(lex_data
->quote_stack
[0]));
842 if (yytext
[0] == '`') assert(0);
843 /* close the current quote */
844 if (--lex_data
->quote_stk_idx
== 0)
847 *lex_data
->strptr
++ = '\0';
850 else *lex_data
->strptr
++ = yytext
[0];
856 #line 102 "macro.lex.l"
857 *lex_data
->strptr
++ = yytext
[0];
861 #line 103 "macro.lex.l"
862 *lex_data
->strptr
++ = yytext
[1];
864 case YY_STATE_EOF(quote
):
865 #line 104 "macro.lex.l"
870 #line 106 "macro.lex.l"
875 #line 107 "macro.lex.l"
880 #line 108 "macro.lex.l"
883 #line 894 "macro.lex.yy.c"
884 case YY_STATE_EOF(INITIAL
):
887 case YY_END_OF_BUFFER
:
889 /* Amount of text matched not including the EOB char. */
890 int yy_amount_of_matched_text
= (int) (yy_cp
- (yytext_ptr
)) - 1;
892 /* Undo the effects of YY_DO_BEFORE_ACTION. */
893 *yy_cp
= (yy_hold_char
);
894 YY_RESTORE_YY_MORE_OFFSET
896 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_NEW
)
898 /* We're scanning a new file or input source. It's
899 * possible that this happened because the user
900 * just pointed yyin at a new source and called
901 * yylex(). If so, then we have to assure
902 * consistency between YY_CURRENT_BUFFER and our
903 * globals. Here is the right place to do so, because
904 * this is the first action (other than possibly a
905 * back-up) that will match for the new input source.
907 (yy_n_chars
) = YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
908 YY_CURRENT_BUFFER_LVALUE
->yy_input_file
= yyin
;
909 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
= YY_BUFFER_NORMAL
;
912 /* Note that here we test for yy_c_buf_p "<=" to the position
913 * of the first EOB in the buffer, since yy_c_buf_p will
914 * already have been incremented past the NUL character
915 * (since all states make transitions on EOB to the
916 * end-of-buffer state). Contrast this with the test
919 if ( (yy_c_buf_p
) <= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] )
920 { /* This was really a NUL. */
921 yy_state_type yy_next_state
;
923 (yy_c_buf_p
) = (yytext_ptr
) + yy_amount_of_matched_text
;
925 yy_current_state
= yy_get_previous_state( );
927 /* Okay, we're now positioned to make the NUL
928 * transition. We couldn't have
929 * yy_get_previous_state() go ahead and do it
930 * for us because it doesn't know how to deal
931 * with the possibility of jamming (and we don't
932 * want to build jamming into it because then it
933 * will run more slowly).
936 yy_next_state
= yy_try_NUL_trans( yy_current_state
);
938 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
942 /* Consume the NUL. */
943 yy_cp
= ++(yy_c_buf_p
);
944 yy_current_state
= yy_next_state
;
950 yy_cp
= (yy_last_accepting_cpos
);
951 yy_current_state
= (yy_last_accepting_state
);
956 else switch ( yy_get_next_buffer( ) )
958 case EOB_ACT_END_OF_FILE
:
960 (yy_did_buffer_switch_on_eof
) = 0;
964 /* Note: because we've taken care in
965 * yy_get_next_buffer() to have set up
966 * yytext, we can now set up
967 * yy_c_buf_p so that if some total
968 * hoser (like flex itself) wants to
969 * call the scanner after we return the
970 * YY_NULL, it'll still work - another
971 * YY_NULL will get returned.
973 (yy_c_buf_p
) = (yytext_ptr
) + YY_MORE_ADJ
;
975 yy_act
= YY_STATE_EOF(YY_START
);
981 if ( ! (yy_did_buffer_switch_on_eof
) )
987 case EOB_ACT_CONTINUE_SCAN
:
989 (yytext_ptr
) + yy_amount_of_matched_text
;
991 yy_current_state
= yy_get_previous_state( );
993 yy_cp
= (yy_c_buf_p
);
994 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
997 case EOB_ACT_LAST_MATCH
:
999 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)];
1001 yy_current_state
= yy_get_previous_state( );
1003 yy_cp
= (yy_c_buf_p
);
1004 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1005 goto yy_find_action
;
1012 "fatal flex scanner internal error--no action found" );
1013 } /* end of action switch */
1014 } /* end of scanning one token */
1015 } /* end of yylex */
1017 /* yy_get_next_buffer - try to read in a new buffer
1019 * Returns a code representing an action:
1020 * EOB_ACT_LAST_MATCH -
1021 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1022 * EOB_ACT_END_OF_FILE - end of file
1024 static int yy_get_next_buffer (void)
1026 register char *dest
= YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
;
1027 register char *source
= (yytext_ptr
);
1028 register int number_to_move
, i
;
1031 if ( (yy_c_buf_p
) > &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
) + 1] )
1033 "fatal flex scanner internal error--end of buffer missed" );
1035 if ( YY_CURRENT_BUFFER_LVALUE
->yy_fill_buffer
== 0 )
1036 { /* Don't try to fill the buffer, so this is an EOF. */
1037 if ( (yy_c_buf_p
) - (yytext_ptr
) - YY_MORE_ADJ
== 1 )
1039 /* We matched a single character, the EOB, so
1040 * treat this as a final EOF.
1042 return EOB_ACT_END_OF_FILE
;
1047 /* We matched some text prior to the EOB, first
1050 return EOB_ACT_LAST_MATCH
;
1054 /* Try to read more data. */
1056 /* First move last chars to start of buffer. */
1057 number_to_move
= (int) ((yy_c_buf_p
) - (yytext_ptr
)) - 1;
1059 for ( i
= 0; i
< number_to_move
; ++i
)
1060 *(dest
++) = *(source
++);
1062 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
1063 /* don't do the read, it's not guaranteed to return an EOF,
1066 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
) = 0;
1071 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
- number_to_move
- 1;
1073 while ( num_to_read
<= 0 )
1074 { /* Not enough room in the buffer - grow it. */
1076 /* just a shorter name for the current buffer */
1077 YY_BUFFER_STATE b
= YY_CURRENT_BUFFER
;
1079 int yy_c_buf_p_offset
=
1080 (int) ((yy_c_buf_p
) - b
->yy_ch_buf
);
1082 if ( b
->yy_is_our_buffer
)
1084 int new_size
= b
->yy_buf_size
* 2;
1086 if ( new_size
<= 0 )
1087 b
->yy_buf_size
+= b
->yy_buf_size
/ 8;
1089 b
->yy_buf_size
*= 2;
1091 b
->yy_ch_buf
= (char *)
1092 /* Include room in for 2 EOB chars. */
1093 yyrealloc((void *) b
->yy_ch_buf
,b
->yy_buf_size
+ 2 );
1096 /* Can't grow it, we don't own it. */
1099 if ( ! b
->yy_ch_buf
)
1101 "fatal error - scanner input buffer overflow" );
1103 (yy_c_buf_p
) = &b
->yy_ch_buf
[yy_c_buf_p_offset
];
1105 num_to_read
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
-
1110 if ( num_to_read
> YY_READ_BUF_SIZE
)
1111 num_to_read
= YY_READ_BUF_SIZE
;
1113 /* Read in more data. */
1114 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
]),
1115 (yy_n_chars
), (size_t) num_to_read
);
1117 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
1120 if ( (yy_n_chars
) == 0 )
1122 if ( number_to_move
== YY_MORE_ADJ
)
1124 ret_val
= EOB_ACT_END_OF_FILE
;
1130 ret_val
= EOB_ACT_LAST_MATCH
;
1131 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
=
1132 YY_BUFFER_EOF_PENDING
;
1137 ret_val
= EOB_ACT_CONTINUE_SCAN
;
1139 if ((yy_size_t
) ((yy_n_chars
) + number_to_move
) > YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
) {
1140 /* Extend the array by 50%, plus the number we really need. */
1141 yy_size_t new_size
= (yy_n_chars
) + number_to_move
+ ((yy_n_chars
) >> 1);
1142 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
= (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
,new_size
);
1143 if ( ! YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
1144 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1147 (yy_n_chars
) += number_to_move
;
1148 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] = YY_END_OF_BUFFER_CHAR
;
1149 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
) + 1] = YY_END_OF_BUFFER_CHAR
;
1151 (yytext_ptr
) = &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[0];
1156 /* yy_get_previous_state - get the state just before the EOB char was reached */
1158 static yy_state_type
yy_get_previous_state (void)
1160 register yy_state_type yy_current_state
;
1161 register char *yy_cp
;
1163 yy_current_state
= (yy_start
);
1165 for ( yy_cp
= (yytext_ptr
) + YY_MORE_ADJ
; yy_cp
< (yy_c_buf_p
); ++yy_cp
)
1167 register YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
1168 if ( yy_accept
[yy_current_state
] )
1170 (yy_last_accepting_state
) = yy_current_state
;
1171 (yy_last_accepting_cpos
) = yy_cp
;
1173 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1175 yy_current_state
= (int) yy_def
[yy_current_state
];
1176 if ( yy_current_state
>= 28 )
1177 yy_c
= yy_meta
[(unsigned int) yy_c
];
1179 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1182 return yy_current_state
;
1185 /* yy_try_NUL_trans - try to make a transition on the NUL character
1188 * next_state = yy_try_NUL_trans( current_state );
1190 static yy_state_type
yy_try_NUL_trans (yy_state_type yy_current_state
)
1192 register int yy_is_jam
;
1193 register char *yy_cp
= (yy_c_buf_p
);
1195 register YY_CHAR yy_c
= 1;
1196 if ( yy_accept
[yy_current_state
] )
1198 (yy_last_accepting_state
) = yy_current_state
;
1199 (yy_last_accepting_cpos
) = yy_cp
;
1201 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1203 yy_current_state
= (int) yy_def
[yy_current_state
];
1204 if ( yy_current_state
>= 28 )
1205 yy_c
= yy_meta
[(unsigned int) yy_c
];
1207 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1208 yy_is_jam
= (yy_current_state
== 27);
1210 return yy_is_jam
? 0 : yy_current_state
;
1215 static int yyinput (void)
1217 static int input (void)
1223 *(yy_c_buf_p
) = (yy_hold_char
);
1225 if ( *(yy_c_buf_p
) == YY_END_OF_BUFFER_CHAR
)
1227 /* yy_c_buf_p now points to the character we want to return.
1228 * If this occurs *before* the EOB characters, then it's a
1229 * valid NUL; if not, then we've hit the end of the buffer.
1231 if ( (yy_c_buf_p
) < &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] )
1232 /* This was really a NUL. */
1233 *(yy_c_buf_p
) = '\0';
1236 { /* need more input */
1237 int offset
= (yy_c_buf_p
) - (yytext_ptr
);
1240 switch ( yy_get_next_buffer( ) )
1242 case EOB_ACT_LAST_MATCH
:
1243 /* This happens because yy_g_n_b()
1244 * sees that we've accumulated a
1245 * token and flags that we need to
1246 * try matching the token before
1247 * proceeding. But for input(),
1248 * there's no matching to consider.
1249 * So convert the EOB_ACT_LAST_MATCH
1250 * to EOB_ACT_END_OF_FILE.
1253 /* Reset buffer status. */
1258 case EOB_ACT_END_OF_FILE
:
1263 if ( ! (yy_did_buffer_switch_on_eof
) )
1272 case EOB_ACT_CONTINUE_SCAN
:
1273 (yy_c_buf_p
) = (yytext_ptr
) + offset
;
1279 c
= *(unsigned char *) (yy_c_buf_p
); /* cast for 8-bit char's */
1280 *(yy_c_buf_p
) = '\0'; /* preserve yytext */
1281 (yy_hold_char
) = *++(yy_c_buf_p
);
1285 #endif /* ifndef YY_NO_INPUT */
1287 /** Immediately switch to a different input stream.
1288 * @param input_file A readable stream.
1290 * @note This function does not reset the start condition to @c INITIAL .
1292 void yyrestart (FILE * input_file
)
1295 if ( ! YY_CURRENT_BUFFER
){
1296 yyensure_buffer_stack ();
1297 YY_CURRENT_BUFFER_LVALUE
=
1298 yy_create_buffer(yyin
,YY_BUF_SIZE
);
1301 yy_init_buffer(YY_CURRENT_BUFFER
,input_file
);
1302 yy_load_buffer_state( );
1305 /** Switch to a different input buffer.
1306 * @param new_buffer The new input buffer.
1309 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer
)
1312 /* TODO. We should be able to replace this entire function body
1314 * yypop_buffer_state();
1315 * yypush_buffer_state(new_buffer);
1317 yyensure_buffer_stack ();
1318 if ( YY_CURRENT_BUFFER
== new_buffer
)
1321 if ( YY_CURRENT_BUFFER
)
1323 /* Flush out information for old buffer. */
1324 *(yy_c_buf_p
) = (yy_hold_char
);
1325 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= (yy_c_buf_p
);
1326 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
1329 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
1330 yy_load_buffer_state( );
1332 /* We don't actually know whether we did this switch during
1333 * EOF (yywrap()) processing, but the only time this flag
1334 * is looked at is after yywrap() is called, so it's safe
1335 * to go ahead and always set it.
1337 (yy_did_buffer_switch_on_eof
) = 1;
1340 static void yy_load_buffer_state (void)
1342 (yy_n_chars
) = YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
1343 (yytext_ptr
) = (yy_c_buf_p
) = YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
;
1344 yyin
= YY_CURRENT_BUFFER_LVALUE
->yy_input_file
;
1345 (yy_hold_char
) = *(yy_c_buf_p
);
1348 /** Allocate and initialize an input buffer state.
1349 * @param file A readable stream.
1350 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1352 * @return the allocated buffer state.
1354 YY_BUFFER_STATE
yy_create_buffer (FILE * file
, int size
)
1358 b
= (YY_BUFFER_STATE
) yyalloc(sizeof( struct yy_buffer_state
) );
1360 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1362 b
->yy_buf_size
= size
;
1364 /* yy_ch_buf has to be 2 characters longer than the size given because
1365 * we need to put in 2 end-of-buffer characters.
1367 b
->yy_ch_buf
= (char *) yyalloc(b
->yy_buf_size
+ 2 );
1368 if ( ! b
->yy_ch_buf
)
1369 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1371 b
->yy_is_our_buffer
= 1;
1373 yy_init_buffer(b
,file
);
1378 /** Destroy the buffer.
1379 * @param b a buffer created with yy_create_buffer()
1382 void yy_delete_buffer (YY_BUFFER_STATE b
)
1388 if ( b
== YY_CURRENT_BUFFER
) /* Not sure if we should pop here. */
1389 YY_CURRENT_BUFFER_LVALUE
= (YY_BUFFER_STATE
) 0;
1391 if ( b
->yy_is_our_buffer
)
1392 yyfree((void *) b
->yy_ch_buf
);
1394 yyfree((void *) b
);
1397 /* Initializes or reinitializes a buffer.
1398 * This function is sometimes called more than once on the same buffer,
1399 * such as during a yyrestart() or at EOF.
1401 static void yy_init_buffer (YY_BUFFER_STATE b
, FILE * file
)
1406 yy_flush_buffer(b
);
1408 b
->yy_input_file
= file
;
1409 b
->yy_fill_buffer
= 1;
1411 /* If b is the current buffer, then yy_init_buffer was _probably_
1412 * called from yyrestart() or through yy_get_next_buffer.
1413 * In that case, we don't want to reset the lineno or column.
1415 if (b
!= YY_CURRENT_BUFFER
){
1416 b
->yy_bs_lineno
= 1;
1417 b
->yy_bs_column
= 0;
1420 b
->yy_is_interactive
= 0;
1425 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1426 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1429 void yy_flush_buffer (YY_BUFFER_STATE b
)
1436 /* We always need two end-of-buffer characters. The first causes
1437 * a transition to the end-of-buffer state. The second causes
1438 * a jam in that state.
1440 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
1441 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
1443 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
1446 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1448 if ( b
== YY_CURRENT_BUFFER
)
1449 yy_load_buffer_state( );
1452 /** Pushes the new state onto the stack. The new state becomes
1453 * the current state. This function will allocate the stack
1455 * @param new_buffer The new state.
1458 void yypush_buffer_state (YY_BUFFER_STATE new_buffer
)
1460 if (new_buffer
== NULL
)
1463 yyensure_buffer_stack();
1465 /* This block is copied from yy_switch_to_buffer. */
1466 if ( YY_CURRENT_BUFFER
)
1468 /* Flush out information for old buffer. */
1469 *(yy_c_buf_p
) = (yy_hold_char
);
1470 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= (yy_c_buf_p
);
1471 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
1474 /* Only push if top exists. Otherwise, replace top. */
1475 if (YY_CURRENT_BUFFER
)
1476 (yy_buffer_stack_top
)++;
1477 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
1479 /* copied from yy_switch_to_buffer. */
1480 yy_load_buffer_state( );
1481 (yy_did_buffer_switch_on_eof
) = 1;
1484 /** Removes and deletes the top of the stack, if present.
1485 * The next element becomes the new top.
1488 void yypop_buffer_state (void)
1490 if (!YY_CURRENT_BUFFER
)
1493 yy_delete_buffer(YY_CURRENT_BUFFER
);
1494 YY_CURRENT_BUFFER_LVALUE
= NULL
;
1495 if ((yy_buffer_stack_top
) > 0)
1496 --(yy_buffer_stack_top
);
1498 if (YY_CURRENT_BUFFER
) {
1499 yy_load_buffer_state( );
1500 (yy_did_buffer_switch_on_eof
) = 1;
1504 /* Allocates the stack if it does not exist.
1505 * Guarantees space for at least one push.
1507 static void yyensure_buffer_stack (void)
1511 if (!(yy_buffer_stack
)) {
1513 /* First allocation is just for 2 elements, since we don't know if this
1514 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1515 * immediate realloc on the next call.
1518 (yy_buffer_stack
) = (struct yy_buffer_state
**)yyalloc
1519 (num_to_alloc
* sizeof(struct yy_buffer_state
*)
1521 if ( ! (yy_buffer_stack
) )
1522 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1524 memset((yy_buffer_stack
), 0, num_to_alloc
* sizeof(struct yy_buffer_state
*));
1526 (yy_buffer_stack_max
) = num_to_alloc
;
1527 (yy_buffer_stack_top
) = 0;
1531 if ((yy_buffer_stack_top
) >= ((yy_buffer_stack_max
)) - 1){
1533 /* Increase the buffer to prepare for a possible push. */
1534 int grow_size
= 8 /* arbitrary grow size */;
1536 num_to_alloc
= (yy_buffer_stack_max
) + grow_size
;
1537 (yy_buffer_stack
) = (struct yy_buffer_state
**)yyrealloc
1539 num_to_alloc
* sizeof(struct yy_buffer_state
*)
1541 if ( ! (yy_buffer_stack
) )
1542 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1544 /* zero only the new slots.*/
1545 memset((yy_buffer_stack
) + (yy_buffer_stack_max
), 0, grow_size
* sizeof(struct yy_buffer_state
*));
1546 (yy_buffer_stack_max
) = num_to_alloc
;
1550 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1551 * @param base the character buffer
1552 * @param size the size in bytes of the character buffer
1554 * @return the newly allocated buffer state object.
1556 YY_BUFFER_STATE
yy_scan_buffer (char * base
, yy_size_t size
)
1561 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
1562 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
1563 /* They forgot to leave room for the EOB's. */
1566 b
= (YY_BUFFER_STATE
) yyalloc(sizeof( struct yy_buffer_state
) );
1568 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1570 b
->yy_buf_size
= size
- 2; /* "- 2" to take care of EOB's */
1571 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
1572 b
->yy_is_our_buffer
= 0;
1573 b
->yy_input_file
= 0;
1574 b
->yy_n_chars
= b
->yy_buf_size
;
1575 b
->yy_is_interactive
= 0;
1577 b
->yy_fill_buffer
= 0;
1578 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1580 yy_switch_to_buffer(b
);
1585 /** Setup the input buffer state to scan a string. The next call to yylex() will
1586 * scan from a @e copy of @a str.
1587 * @param yystr a NUL-terminated string to scan
1589 * @return the newly allocated buffer state object.
1590 * @note If you want to scan bytes that may contain NUL values, then use
1591 * yy_scan_bytes() instead.
1593 YY_BUFFER_STATE
yy_scan_string (yyconst
char * yystr
)
1596 return yy_scan_bytes(yystr
,strlen(yystr
) );
1599 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1600 * scan from a @e copy of @a bytes.
1601 * @param yybytes the byte buffer to scan
1602 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1604 * @return the newly allocated buffer state object.
1606 YY_BUFFER_STATE
yy_scan_bytes (yyconst
char * yybytes
, int _yybytes_len
)
1613 /* Get memory for full buffer, including space for trailing EOB's. */
1614 n
= _yybytes_len
+ 2;
1615 buf
= (char *) yyalloc(n
);
1617 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1619 for ( i
= 0; i
< _yybytes_len
; ++i
)
1620 buf
[i
] = yybytes
[i
];
1622 buf
[_yybytes_len
] = buf
[_yybytes_len
+1] = YY_END_OF_BUFFER_CHAR
;
1624 b
= yy_scan_buffer(buf
,n
);
1626 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1628 /* It's okay to grow etc. this buffer, and we should throw it
1629 * away when we're done.
1631 b
->yy_is_our_buffer
= 1;
1636 #ifndef YY_EXIT_FAILURE
1637 #define YY_EXIT_FAILURE 2
1640 static void yy_fatal_error (yyconst
char* msg
)
1642 (void) fprintf( stderr
, "%s\n", msg
);
1643 exit( YY_EXIT_FAILURE
);
1646 /* Redefine yyless() so it works in section 3 code. */
1652 /* Undo effects of setting up yytext. */ \
1653 int yyless_macro_arg = (n); \
1654 YY_LESS_LINENO(yyless_macro_arg);\
1655 yytext[yyleng] = (yy_hold_char); \
1656 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1657 (yy_hold_char) = *(yy_c_buf_p); \
1658 *(yy_c_buf_p) = '\0'; \
1659 yyleng = yyless_macro_arg; \
1663 /* Accessor methods (get/set functions) to struct members. */
1665 /** Get the current line number.
1668 int yyget_lineno (void)
1674 /** Get the input stream.
1677 FILE *yyget_in (void)
1682 /** Get the output stream.
1685 FILE *yyget_out (void)
1690 /** Get the length of the current token.
1693 int yyget_leng (void)
1698 /** Get the current token.
1702 char *yyget_text (void)
1707 /** Set the current line number.
1708 * @param line_number
1711 void yyset_lineno (int line_number
)
1714 yylineno
= line_number
;
1717 /** Set the input stream. This does not discard the current
1719 * @param in_str A readable stream.
1721 * @see yy_switch_to_buffer
1723 void yyset_in (FILE * in_str
)
1728 void yyset_out (FILE * out_str
)
1733 int yyget_debug (void)
1735 return yy_flex_debug
;
1738 void yyset_debug (int bdebug
)
1740 yy_flex_debug
= bdebug
;
1743 static int yy_init_globals (void)
1745 /* Initialization is the same as for the non-reentrant scanner.
1746 * This function is called from yylex_destroy(), so don't allocate here.
1749 (yy_buffer_stack
) = 0;
1750 (yy_buffer_stack_top
) = 0;
1751 (yy_buffer_stack_max
) = 0;
1752 (yy_c_buf_p
) = (char *) 0;
1756 /* Defined in main.c */
1765 /* For future reference: Set errno on error, since we are called by
1771 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1772 int yylex_destroy (void)
1775 /* Pop the buffer stack, destroying each element. */
1776 while(YY_CURRENT_BUFFER
){
1777 yy_delete_buffer(YY_CURRENT_BUFFER
);
1778 YY_CURRENT_BUFFER_LVALUE
= NULL
;
1779 yypop_buffer_state();
1782 /* Destroy the stack itself. */
1783 yyfree((yy_buffer_stack
) );
1784 (yy_buffer_stack
) = NULL
;
1786 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1787 * yylex() is called, initialization will occur. */
1794 * Internal utility routines.
1798 static void yy_flex_strncpy (char* s1
, yyconst
char * s2
, int n
)
1801 for ( i
= 0; i
< n
; ++i
)
1806 #ifdef YY_NEED_STRLEN
1807 static int yy_flex_strlen (yyconst
char * s
)
1810 for ( n
= 0; s
[n
]; ++n
)
1817 void *yyalloc (yy_size_t size
)
1819 return (void *) malloc( size
);
1822 void *yyrealloc (void * ptr
, yy_size_t size
)
1824 /* The cast to (char *) in the following accommodates both
1825 * implementations that use char* generic pointers, and those
1826 * that use void* generic pointers. It works with the latter
1827 * because both ANSI C and C++ allow castless assignment from
1828 * any pointer type to void*, and deal with argument conversions
1829 * as though doing an assignment.
1831 return (void *) realloc( (char *) ptr
, size
);
1834 void yyfree (void * ptr
)
1836 free( (char *) ptr
); /* see yyrealloc() for (char *) cast */
1839 #define YYTABLES_NAME "yytables"
1841 #line 108 "macro.lex.l"
1846 /* all code for testing macros */
1847 #include "winhelp.h"
1848 static CHAR szTestMacro
[256];
1850 static LRESULT CALLBACK
MACRO_TestDialogProc(HWND hDlg
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
1852 if (msg
== WM_COMMAND
&& wParam
== IDOK
)
1854 GetDlgItemText(hDlg
, 99, szTestMacro
, sizeof(szTestMacro
));
1855 EndDialog(hDlg
, IDOK
);
1861 void macro_test(void)
1863 WNDPROC lpfnDlg
= MakeProcInstance(MACRO_TestDialogProc
, Globals
.hInstance
);
1864 DialogBox(Globals
.hInstance
, STRING_DIALOG_TEST
, Globals
.active_win
->hMainWnd
, (DLGPROC
)lpfnDlg
);
1865 FreeProcInstance(lpfnDlg
);
1866 macro
= szTestMacro
;
1870 /* small helper function for debug messages */
1871 static const char* ts(int t
)
1873 static char c
[2] = {0,0};
1877 case EMPTY
: return "EMPTY";
1878 case VOID_FUNCTION
: return "VOID_FUNCTION";
1879 case BOOL_FUNCTION
: return "BOOL_FUNCTION";
1880 case INTEGER
: return "INTEGER";
1881 case STRING
: return "STRING";
1882 case IDENTIFIER
: return "IDENTIFIER";
1883 default: c
[0] = (char)t
; return c
;
1887 static int MACRO_CallBoolFunc(void *fn
, const char* args
, void** ret
);
1889 /******************************************************************
1892 * checks number of arguments against prototype, and stores arguments on
1893 * stack pa for later call
1894 * returns -1 on error, otherwise the number of pushed parameters
1896 static int MACRO_CheckArgs(void* pa
[], unsigned max
, const char* args
)
1899 unsigned int len
= 0, idx
= 0;
1901 WINE_TRACE("Checking %s\n", args
);
1903 if (yylex() != '(') {WINE_WARN("missing (\n");return -1;}
1911 WINE_TRACE("Got %s <=> %c\n", ts(t
), *args
);
1917 {WINE_WARN("missing S\n");return -1;}
1918 pa
[idx
] = (void*)yylval
.string
;
1923 {WINE_WARN("missing U\n");return -1;}
1924 pa
[idx
] = LongToPtr(yylval
.integer
);
1927 if (t
!= BOOL_FUNCTION
)
1928 {WINE_WARN("missing B\n");return -1;}
1929 if (MACRO_CallBoolFunc(yylval
.function
, yylval
.proto
, &pa
[idx
]) == 0)
1933 WINE_WARN("unexpected %s while args is %c\n", ts(t
), *args
);
1937 if (*++args
== '\0') break;
1939 if (t
== ')') goto CheckArgs_end
;
1940 if (t
!= ',') {WINE_WARN("missing ,\n");return -1;}
1941 if (idx
>= max
) {WINE_FIXME("stack overflow (%d)\n", max
);return -1;}
1944 if (yylex() != ')') {WINE_WARN("missing )\n");return -1;}
1947 while (len
> idx
) pa
[--len
] = NULL
;
1951 /******************************************************************
1952 * MACRO_CallBoolFunc
1954 * Invokes boolean function fn, which arguments are defined by args
1955 * stores bool result into ret
1957 static int MACRO_CallBoolFunc(void *fn
, const char* args
, void** ret
)
1960 int idx
= MACRO_CheckArgs(pa
, sizeof(pa
)/sizeof(pa
[0]), args
);
1962 if (idx
< 0) return 0;
1965 WINE_TRACE("calling with %u pmts\n", idx
);
1967 switch (strlen(args
))
1971 BOOL (WINAPI
*func
)(void) = fn
;
1972 *ret
= (void *)(ULONG_PTR
)func();
1977 BOOL (WINAPI
*func
)(void *) = fn
;
1978 *ret
= (void *)(ULONG_PTR
)func( pa
[0]);
1981 default: WINE_FIXME("NIY\n");
1987 /******************************************************************
1988 * MACRO_CallVoidFunc
1992 static int MACRO_CallVoidFunc(void *fn
, const char* args
)
1995 int idx
= MACRO_CheckArgs(pa
, sizeof(pa
)/sizeof(pa
[0]), args
);
1997 if (idx
< 0) return 0;
2000 WINE_TRACE("calling %p with %u pmts\n", fn
, idx
);
2002 switch (strlen(args
))
2006 void (WINAPI
*func
)(void) = fn
;
2012 void (WINAPI
*func
)(void*) = fn
;
2018 void (WINAPI
*func
)(void*,void*) = fn
;
2019 func( pa
[0], pa
[1] );
2024 void (WINAPI
*func
)(void*,void*,void*) = fn
;
2025 func( pa
[0], pa
[1], pa
[2] );
2030 void (WINAPI
*func
)(void*,void*,void*,void*) = fn
;
2031 func( pa
[0], pa
[1], pa
[2], pa
[3] );
2036 void (WINAPI
*func
)(void*,void*,void*,void*,void*) = fn
;
2037 func( pa
[0], pa
[1], pa
[2], pa
[3], pa
[4] );
2042 void (WINAPI
*func
)(void*,void*,void*,void*,void*,void*) = fn
;
2043 func( pa
[0], pa
[1], pa
[2], pa
[3], pa
[4], pa
[5] );
2046 default: WINE_FIXME("NIY\n");
2052 BOOL
MACRO_ExecuteMacro(WINHELP_WINDOW
* window
, LPCSTR macro
)
2054 struct lex_data curr_lex_data
, *prev_lex_data
;
2058 WINE_TRACE("%s\n", wine_dbgstr_a(macro
));
2060 prev_lex_data
= lex_data
;
2061 lex_data
= &curr_lex_data
;
2063 memset(lex_data
, 0, sizeof(*lex_data
));
2064 lex_data
->macroptr
= macro
;
2065 lex_data
->window
= WINHELP_GrabWindow(window
);
2067 while ((t
= yylex()) != EMPTY
)
2072 WINE_TRACE("got type void func(%s)\n", yylval
.proto
);
2073 MACRO_CallVoidFunc(yylval
.function
, yylval
.proto
);
2076 WINE_WARN("got type bool func(%s)\n", yylval
.proto
);
2079 WINE_WARN("got unexpected type %s\n", ts(t
));
2084 switch (t
= yylex())
2086 case EMPTY
: goto done
;
2088 default: ret
= FALSE
; YY_FLUSH_BUFFER
; goto done
;
2093 for (t
= 0; t
< lex_data
->cache_used
; t
++)
2094 HeapFree(GetProcessHeap(), 0, lex_data
->cache_string
[t
]);
2095 lex_data
= prev_lex_data
;
2096 WINHELP_ReleaseWindow(window
);
2101 WINHELP_WINDOW
* MACRO_CurrentWindow(void)
2103 return lex_data
? lex_data
->window
: Globals
.active_win
;
2107 int yywrap(void) { return 1; }