Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenlex.yy.c
Go to the documentation of this file.
00001 /* A lexical scanner generated by flex */ 00002 00003 /* Scanner skeleton version: 00004 * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ 00005 */ 00006 00007 #define FLEX_SCANNER 00008 #define YY_FLEX_MAJOR_VERSION 2 00009 #define YY_FLEX_MINOR_VERSION 5 00010 00011 #include <stdio.h> 00012 00013 00014 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ 00015 #ifdef c_plusplus 00016 #ifndef __cplusplus 00017 #define __cplusplus 00018 #endif 00019 #endif 00020 00021 00022 #ifdef __cplusplus 00023 00024 #include <stdlib.h> 00025 #include <unistd.h> 00026 00027 /* Use prototypes in function declarations. */ 00028 #define YY_USE_PROTOS 00029 00030 /* The "const" storage-class-modifier is valid. */ 00031 #define YY_USE_CONST 00032 00033 #else /* ! __cplusplus */ 00034 00035 #if __STDC__ 00036 00037 #define YY_USE_PROTOS 00038 #define YY_USE_CONST 00039 00040 #endif /* __STDC__ */ 00041 #endif /* ! __cplusplus */ 00042 00043 #ifdef __TURBOC__ 00044 #pragma warn -rch 00045 #pragma warn -use 00046 #include <io.h> 00047 #include <stdlib.h> 00048 #define YY_USE_CONST 00049 #define YY_USE_PROTOS 00050 #endif 00051 00052 #ifdef YY_USE_CONST 00053 #define yyconst const 00054 #else 00055 #define yyconst 00056 #endif 00057 00058 00059 #ifdef YY_USE_PROTOS 00060 #define YY_PROTO(proto) proto 00061 #else 00062 #define YY_PROTO(proto) () 00063 #endif 00064 00065 /* Returned upon end-of-file. */ 00066 #define YY_NULL 0 00067 00068 /* Promotes a possibly negative, possibly signed char to an unsigned 00069 * integer for use as an array index. If the signed char is negative, 00070 * we want to instead treat it as an 8-bit unsigned char, hence the 00071 * double cast. 00072 */ 00073 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 00074 00075 /* Enter a start condition. This macro really ought to take a parameter, 00076 * but we do it the disgusting crufty way forced on us by the ()-less 00077 * definition of BEGIN. 00078 */ 00079 #define BEGIN yy_start = 1 + 2 * 00080 00081 /* Translate the current start state into a value that can be later handed 00082 * to BEGIN to return to the state. The YYSTATE alias is for lex 00083 * compatibility. 00084 */ 00085 #define YY_START ((yy_start - 1) / 2) 00086 #define YYSTATE YY_START 00087 00088 /* Action number for EOF rule of a given start state. */ 00089 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 00090 00091 /* Special action meaning "start processing a new file". */ 00092 #define YY_NEW_FILE yyrestart( yyin ) 00093 00094 #define YY_END_OF_BUFFER_CHAR 0 00095 00096 /* Size of default input buffer. */ 00097 #define YY_BUF_SIZE 16384 00098 00099 typedef struct yy_buffer_state *YY_BUFFER_STATE; 00100 00101 extern int yyleng; 00102 extern FILE *yyin, *yyout; 00103 00104 #define EOB_ACT_CONTINUE_SCAN 0 00105 #define EOB_ACT_END_OF_FILE 1 00106 #define EOB_ACT_LAST_MATCH 2 00107 00108 /* The funky do-while in the following #define is used to turn the definition 00109 * int a single C statement (which needs a semi-colon terminator). This 00110 * avoids problems with code like: 00111 * 00112 * if ( condition_holds ) 00113 * yyless( 5 ); 00114 * else 00115 * do_something_else(); 00116 * 00117 * Prior to using the do-while the compiler would get upset at the 00118 * "else" because it interpreted the "if" statement as being all 00119 * done when it reached the ';' after the yyless() call. 00120 */ 00121 00122 /* Return all but the first 'n' matched characters back to the input stream. */ 00123 00124 #define yyless(n) \ 00125 do \ 00126 { \ 00127 /* Undo effects of setting up yytext. */ \ 00128 *yy_cp = yy_hold_char; \ 00129 YY_RESTORE_YY_MORE_OFFSET \ 00130 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ 00131 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 00132 } \ 00133 while ( 0 ) 00134 00135 #define unput(c) yyunput( c, yytext_ptr ) 00136 00137 /* The following is because we cannot portably get our hands on size_t 00138 * (without autoconf's help, which isn't available because we want 00139 * flex-generated scanners to compile on their own). 00140 */ 00141 typedef unsigned int yy_size_t; 00142 00143 00144 struct yy_buffer_state 00145 { 00146 FILE *yy_input_file; 00147 00148 char *yy_ch_buf; /* input buffer */ 00149 char *yy_buf_pos; /* current position in input buffer */ 00150 00151 /* Size of input buffer in bytes, not including room for EOB 00152 * characters. 00153 */ 00154 yy_size_t yy_buf_size; 00155 00156 /* Number of characters read into yy_ch_buf, not including EOB 00157 * characters. 00158 */ 00159 int yy_n_chars; 00160 00161 /* Whether we "own" the buffer - i.e., we know we created it, 00162 * and can realloc() it to grow it, and should free() it to 00163 * delete it. 00164 */ 00165 int yy_is_our_buffer; 00166 00167 /* Whether this is an "interactive" input source; if so, and 00168 * if we're using stdio for input, then we want to use getc() 00169 * instead of fread(), to make sure we stop fetching input after 00170 * each newline. 00171 */ 00172 int yy_is_interactive; 00173 00174 /* Whether we're considered to be at the beginning of a line. 00175 * If so, '^' rules will be active on the next match, otherwise 00176 * not. 00177 */ 00178 int yy_at_bol; 00179 00180 /* Whether to try to fill the input buffer when we reach the 00181 * end of it. 00182 */ 00183 int yy_fill_buffer; 00184 00185 int yy_buffer_status; 00186 #define YY_BUFFER_NEW 0 00187 #define YY_BUFFER_NORMAL 1 00188 /* When an EOF's been seen but there's still some text to process 00189 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 00190 * shouldn't try reading from the input source any more. We might 00191 * still have a bunch of tokens to match, though, because of 00192 * possible backing-up. 00193 * 00194 * When we actually see the EOF, we change the status to "new" 00195 * (via yyrestart()), so that the user can continue scanning by 00196 * just pointing yyin at a new input file. 00197 */ 00198 #define YY_BUFFER_EOF_PENDING 2 00199 }; 00200 00201 static YY_BUFFER_STATE yy_current_buffer = 0; 00202 00203 /* We provide macros for accessing buffer states in case in the 00204 * future we want to put the buffer states in a more general 00205 * "scanner state". 00206 */ 00207 #define YY_CURRENT_BUFFER yy_current_buffer 00208 00209 00210 /* yy_hold_char holds the character lost when yytext is formed. */ 00211 static char yy_hold_char; 00212 00213 static int yy_n_chars; /* number of characters read into yy_ch_buf */ 00214 00215 00216 int yyleng; 00217 00218 /* Points to current character in buffer. */ 00219 static char *yy_c_buf_p = (char *) 0; 00220 static int yy_init = 1; /* whether we need to initialize */ 00221 static int yy_start = 0; /* start state number */ 00222 00223 /* Flag which is used to allow yywrap()'s to do buffer switches 00224 * instead of setting up a fresh yyin. A bit of a hack ... 00225 */ 00226 static int yy_did_buffer_switch_on_eof; 00227 00228 void yyrestart YY_PROTO(( FILE *input_file )); 00229 00230 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); 00231 void yy_load_buffer_state YY_PROTO(( void )); 00232 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); 00233 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); 00234 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); 00235 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); 00236 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) 00237 00238 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); 00239 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); 00240 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); 00241 00242 static void *yy_flex_alloc YY_PROTO(( yy_size_t )); 00243 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); 00244 static void yy_flex_free YY_PROTO(( void * )); 00245 00246 #define yy_new_buffer yy_create_buffer 00247 00248 #define yy_set_interactive(is_interactive) \ 00249 { \ 00250 if ( ! yy_current_buffer ) \ 00251 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ 00252 yy_current_buffer->yy_is_interactive = is_interactive; \ 00253 } 00254 00255 #define yy_set_bol(at_bol) \ 00256 { \ 00257 if ( ! yy_current_buffer ) \ 00258 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ 00259 yy_current_buffer->yy_at_bol = at_bol; \ 00260 } 00261 00262 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) 00263 00264 typedef unsigned char YY_CHAR; 00265 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; 00266 typedef int yy_state_type; 00267 extern char *yytext; 00268 #define yytext_ptr yytext 00269 00270 static yy_state_type yy_get_previous_state YY_PROTO(( void )); 00271 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); 00272 static int yy_get_next_buffer YY_PROTO(( void )); 00273 static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); 00274 00275 /* Done after the current pattern has been matched and before the 00276 * corresponding action - sets up yytext. 00277 */ 00278 #define YY_DO_BEFORE_ACTION \ 00279 yytext_ptr = yy_bp; \ 00280 yyleng = (int) (yy_cp - yy_bp); \ 00281 yy_hold_char = *yy_cp; \ 00282 *yy_cp = '\0'; \ 00283 yy_c_buf_p = yy_cp; 00284 00285 #define YY_NUM_RULES 14 00286 #define YY_END_OF_BUFFER 15 00287 static yyconst short int yy_accept[28] = 00288 { 0, 00289 0, 0, 0, 0, 15, 13, 14, 12, 5, 6, 00290 13, 1, 1, 3, 4, 10, 8, 9, 10, 7, 00291 1, 1, 0, 3, 11, 2, 0 00292 } ; 00293 00294 static yyconst int yy_ec[256] = 00295 { 0, 00296 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 00297 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00298 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00299 1, 3, 1, 4, 1, 1, 1, 1, 5, 1, 00300 1, 1, 6, 1, 6, 1, 1, 7, 8, 8, 00301 8, 8, 8, 8, 8, 8, 8, 1, 1, 1, 00302 1, 1, 1, 1, 9, 9, 9, 9, 9, 9, 00303 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 00304 9, 9, 9, 9, 9, 9, 9, 10, 9, 9, 00305 1, 11, 1, 1, 12, 13, 14, 14, 14, 14, 00306 00307 14, 14, 9, 9, 9, 9, 9, 9, 9, 9, 00308 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 00309 9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 00310 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00311 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00312 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00313 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00314 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00315 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00316 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00317 00318 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00319 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00320 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00321 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00322 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00323 1, 1, 1, 1, 1 00324 } ; 00325 00326 static yyconst int yy_meta[15] = 00327 { 0, 00328 1, 2, 1, 1, 1, 1, 3, 3, 4, 5, 00329 1, 4, 1, 6 00330 } ; 00331 00332 static yyconst short int yy_base[33] = 00333 { 0, 00334 0, 0, 13, 25, 25, 62, 62, 62, 62, 62, 00335 12, 13, 14, 0, 62, 62, 62, 62, 0, 62, 00336 6, 24, 0, 0, 62, 0, 62, 38, 42, 45, 00337 51, 55 00338 } ; 00339 00340 static yyconst short int yy_def[33] = 00341 { 0, 00342 27, 1, 28, 28, 27, 27, 27, 27, 27, 27, 00343 27, 29, 27, 30, 27, 27, 27, 27, 31, 27, 00344 29, 27, 32, 30, 27, 32, 0, 27, 27, 27, 00345 27, 27 00346 } ; 00347 00348 static yyconst short int yy_nxt[77] = 00349 { 0, 00350 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 00351 6, 6, 15, 14, 7, 23, 17, 18, 21, 22, 00352 22, 22, 23, 19, 27, 20, 7, 27, 17, 18, 00353 22, 22, 27, 27, 27, 19, 27, 20, 16, 16, 00354 16, 16, 16, 16, 22, 27, 22, 24, 24, 24, 00355 24, 25, 27, 25, 25, 25, 25, 26, 27, 27, 00356 26, 5, 27, 27, 27, 27, 27, 27, 27, 27, 00357 27, 27, 27, 27, 27, 27 00358 } ; 00359 00360 static yyconst short int yy_chk[77] = 00361 { 0, 00362 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00363 1, 1, 1, 1, 3, 21, 3, 3, 11, 11, 00364 13, 13, 12, 3, 5, 3, 4, 0, 4, 4, 00365 22, 22, 0, 0, 0, 4, 0, 4, 28, 28, 00366 28, 28, 28, 28, 29, 0, 29, 30, 30, 30, 00367 30, 31, 0, 31, 31, 31, 31, 32, 0, 0, 00368 32, 27, 27, 27, 27, 27, 27, 27, 27, 27, 00369 27, 27, 27, 27, 27, 27 00370 } ; 00371 00372 static yy_state_type yy_last_accepting_state; 00373 static char *yy_last_accepting_cpos; 00374 00375 /* The intent behind this definition is that it'll catch 00376 * any uses of REJECT which flex missed. 00377 */ 00378 #define REJECT reject_used_but_not_detected 00379 #define yymore() yymore_used_but_not_detected 00380 #define YY_MORE_ADJ 0 00381 #define YY_RESTORE_YY_MORE_OFFSET 00382 char *yytext; 00383 #line 1 ".\\macro.lex.l" 00384 #define INITIAL 0 00385 #line 2 ".\\macro.lex.l" 00386 /* 00387 * Help Viewer 00388 * 00389 * Copyright 1996 Ulrich Schmid 00390 * Copyright 2002,2008 Eric Pouech 00391 * 00392 * This library is free software; you can redistribute it and/or 00393 * modify it under the terms of the GNU Lesser General Public 00394 * License as published by the Free Software Foundation; either 00395 * version 2.1 of the License, or (at your option) any later version. 00396 * 00397 * This library is distributed in the hope that it will be useful, 00398 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00399 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00400 * Lesser General Public License for more details. 00401 * 00402 * You should have received a copy of the GNU Lesser General Public 00403 * License along with this library; if not, write to the Free Software 00404 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00405 */ 00406 #define YY_NO_INPUT 1 00407 #define YY_NO_UNPUT 1 00408 #define quote 1 00409 00410 #line 26 ".\\macro.lex.l" 00411 #include "config.h" 00412 #include <assert.h> 00413 #include <stdarg.h> 00414 00415 #ifndef HAVE_UNISTD_H 00416 #define YY_NO_UNISTD_H 00417 #endif 00418 00419 #include "windef.h" 00420 #include "winbase.h" 00421 #include "wingdi.h" 00422 #include "winuser.h" 00423 #include "winhelp.h" 00424 00425 #include "wine/debug.h" 00426 00427 WINE_DEFAULT_DEBUG_CHANNEL(winhelp); 00428 00429 struct lex_data { 00430 LPCSTR macroptr; 00431 LPSTR strptr; 00432 int quote_stack[32]; 00433 unsigned quote_stk_idx; 00434 LPSTR cache_string[32]; 00435 int cache_used; 00436 WINHELP_WINDOW* window; 00437 }; 00438 static struct lex_data* lex_data = NULL; 00439 00440 struct lexret yylval; 00441 00442 #define YY_INPUT(buf,result,max_size)\ 00443 if ((result = *lex_data->macroptr ? 1 : 0)) buf[0] = *lex_data->macroptr++; 00444 00445 #line 446 "lex.yy.c" 00446 00447 /* Macros after this point can all be overridden by user definitions in 00448 * section 1. 00449 */ 00450 00451 #ifndef YY_SKIP_YYWRAP 00452 #ifdef __cplusplus 00453 extern "C" int yywrap YY_PROTO(( void )); 00454 #else 00455 extern int yywrap YY_PROTO(( void )); 00456 #endif 00457 #endif 00458 00459 #ifndef YY_NO_UNPUT 00460 static void yyunput YY_PROTO(( int c, char *buf_ptr )); 00461 #endif 00462 00463 #ifndef yytext_ptr 00464 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); 00465 #endif 00466 00467 #ifdef YY_NEED_STRLEN 00468 static int yy_flex_strlen YY_PROTO(( yyconst char * )); 00469 #endif 00470 00471 #ifndef YY_NO_INPUT 00472 #ifdef __cplusplus 00473 static int yyinput YY_PROTO(( void )); 00474 #else 00475 static int input YY_PROTO(( void )); 00476 #endif 00477 #endif 00478 00479 #if YY_STACK_USED 00480 static int yy_start_stack_ptr = 0; 00481 static int yy_start_stack_depth = 0; 00482 static int *yy_start_stack = 0; 00483 #ifndef YY_NO_PUSH_STATE 00484 static void yy_push_state YY_PROTO(( int new_state )); 00485 #endif 00486 #ifndef YY_NO_POP_STATE 00487 static void yy_pop_state YY_PROTO(( void )); 00488 #endif 00489 #ifndef YY_NO_TOP_STATE 00490 static int yy_top_state YY_PROTO(( void )); 00491 #endif 00492 00493 #else 00494 #define YY_NO_PUSH_STATE 1 00495 #define YY_NO_POP_STATE 1 00496 #define YY_NO_TOP_STATE 1 00497 #endif 00498 00499 #ifdef YY_MALLOC_DECL 00500 YY_MALLOC_DECL 00501 #else 00502 #if __STDC__ 00503 #ifndef __cplusplus 00504 #include <stdlib.h> 00505 #endif 00506 #else 00507 /* Just try to get by without declaring the routines. This will fail 00508 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) 00509 * or sizeof(void*) != sizeof(int). 00510 */ 00511 #endif 00512 #endif 00513 00514 /* Amount of stuff to slurp up with each read. */ 00515 #ifndef YY_READ_BUF_SIZE 00516 #define YY_READ_BUF_SIZE 8192 00517 #endif 00518 00519 /* Copy whatever the last rule matched to the standard output. */ 00520 00521 #ifndef ECHO 00522 /* This used to be an fputs(), but since the string might contain NUL's, 00523 * we now use fwrite(). 00524 */ 00525 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) 00526 #endif 00527 00528 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 00529 * is returned in "result". 00530 */ 00531 #ifndef YY_INPUT 00532 #define YY_INPUT(buf,result,max_size) \ 00533 if ( yy_current_buffer->yy_is_interactive ) \ 00534 { \ 00535 int c = '*', n; \ 00536 for ( n = 0; n < max_size && \ 00537 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 00538 buf[n] = (char) c; \ 00539 if ( c == '\n' ) \ 00540 buf[n++] = (char) c; \ 00541 if ( c == EOF && ferror( yyin ) ) \ 00542 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 00543 result = n; \ 00544 } \ 00545 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ 00546 && ferror( yyin ) ) \ 00547 YY_FATAL_ERROR( "input in flex scanner failed" ); 00548 #endif 00549 00550 /* No semi-colon after return; correct usage is to write "yyterminate();" - 00551 * we don't want an extra ';' after the "return" because that will cause 00552 * some compilers to complain about unreachable statements. 00553 */ 00554 #ifndef yyterminate 00555 #define yyterminate() return YY_NULL 00556 #endif 00557 00558 /* Number of entries by which start-condition stack grows. */ 00559 #ifndef YY_START_STACK_INCR 00560 #define YY_START_STACK_INCR 25 00561 #endif 00562 00563 /* Report a fatal error. */ 00564 #ifndef YY_FATAL_ERROR 00565 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) 00566 #endif 00567 00568 /* Default declaration of generated scanner - a define so the user can 00569 * easily add parameters. 00570 */ 00571 #ifndef YY_DECL 00572 #define YY_DECL int yylex YY_PROTO(( void )) 00573 #endif 00574 00575 /* Code executed at the beginning of each rule, after yytext and yyleng 00576 * have been set up. 00577 */ 00578 #ifndef YY_USER_ACTION 00579 #define YY_USER_ACTION 00580 #endif 00581 00582 /* Code executed at the end of each rule. */ 00583 #ifndef YY_BREAK 00584 #define YY_BREAK break; 00585 #endif 00586 00587 #define YY_RULE_SETUP \ 00588 YY_USER_ACTION 00589 00590 YY_DECL 00591 { 00592 register yy_state_type yy_current_state; 00593 register char *yy_cp, *yy_bp; 00594 register int yy_act; 00595 00596 #line 61 ".\\macro.lex.l" 00597 00598 00599 #line 600 "lex.yy.c" 00600 00601 if ( yy_init ) 00602 { 00603 yy_init = 0; 00604 00605 #ifdef YY_USER_INIT 00606 YY_USER_INIT; 00607 #endif 00608 00609 if ( ! yy_start ) 00610 yy_start = 1; /* first start state */ 00611 00612 if ( ! yyin ) 00613 yyin = stdin; 00614 00615 if ( ! yyout ) 00616 yyout = stdout; 00617 00618 if ( ! yy_current_buffer ) 00619 yy_current_buffer = 00620 yy_create_buffer( yyin, YY_BUF_SIZE ); 00621 00622 yy_load_buffer_state(); 00623 } 00624 00625 while ( 1 ) /* loops until end-of-file is reached */ 00626 { 00627 yy_cp = yy_c_buf_p; 00628 00629 /* Support of yytext. */ 00630 *yy_cp = yy_hold_char; 00631 00632 /* yy_bp points to the position in yy_ch_buf of the start of 00633 * the current run. 00634 */ 00635 yy_bp = yy_cp; 00636 00637 yy_current_state = yy_start; 00638 yy_match: 00639 do 00640 { 00641 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 00642 if ( yy_accept[yy_current_state] ) 00643 { 00644 yy_last_accepting_state = yy_current_state; 00645 yy_last_accepting_cpos = yy_cp; 00646 } 00647 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 00648 { 00649 yy_current_state = (int) yy_def[yy_current_state]; 00650 if ( yy_current_state >= 28 ) 00651 yy_c = yy_meta[(unsigned int) yy_c]; 00652 } 00653 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 00654 ++yy_cp; 00655 } 00656 while ( yy_base[yy_current_state] != 62 ); 00657 00658 yy_find_action: 00659 yy_act = yy_accept[yy_current_state]; 00660 if ( yy_act == 0 ) 00661 { /* have to back up */ 00662 yy_cp = yy_last_accepting_cpos; 00663 yy_current_state = yy_last_accepting_state; 00664 yy_act = yy_accept[yy_current_state]; 00665 } 00666 00667 YY_DO_BEFORE_ACTION; 00668 00669 00670 do_action: /* This label is used only to access EOF actions. */ 00671 00672 00673 switch ( yy_act ) 00674 { /* beginning of action switch */ 00675 case 0: /* must back up */ 00676 /* undo the effects of YY_DO_BEFORE_ACTION */ 00677 *yy_cp = yy_hold_char; 00678 yy_cp = yy_last_accepting_cpos; 00679 yy_current_state = yy_last_accepting_state; 00680 goto yy_find_action; 00681 00682 case 1: 00683 YY_RULE_SETUP 00684 #line 63 ".\\macro.lex.l" 00685 yylval.integer = strtol(yytext, NULL, 10); return INTEGER; 00686 YY_BREAK 00687 case 2: 00688 YY_RULE_SETUP 00689 #line 64 ".\\macro.lex.l" 00690 yylval.integer = strtol(yytext, NULL, 16); return INTEGER; 00691 YY_BREAK 00692 case 3: 00693 YY_RULE_SETUP 00694 #line 66 ".\\macro.lex.l" 00695 return MACRO_Lookup(yytext, &yylval); 00696 YY_BREAK 00697 case 4: 00698 #line 69 ".\\macro.lex.l" 00699 case 5: 00700 #line 70 ".\\macro.lex.l" 00701 case 6: 00702 #line 71 ".\\macro.lex.l" 00703 case 7: 00704 #line 72 ".\\macro.lex.l" 00705 case 8: 00706 #line 73 ".\\macro.lex.l" 00707 case 9: 00708 YY_RULE_SETUP 00709 #line 73 ".\\macro.lex.l" 00710 { 00711 if (lex_data->quote_stk_idx == 0 || 00712 (yytext[0] == '\"' && lex_data->quote_stack[lex_data->quote_stk_idx - 1] != '\"') || 00713 (yytext[0] == '`')) 00714 { 00715 /* opening a new one */ 00716 if (lex_data->quote_stk_idx == 0) 00717 { 00718 assert(lex_data->cache_used < sizeof(lex_data->cache_string) / sizeof(lex_data->cache_string[0])); 00719 lex_data->strptr = lex_data->cache_string[lex_data->cache_used] = HeapAlloc(GetProcessHeap(), 0, strlen(lex_data->macroptr) + 1); 00720 yylval.string = lex_data->strptr; 00721 lex_data->cache_used++; 00722 BEGIN(quote); 00723 } 00724 else *lex_data->strptr++ = yytext[0]; 00725 lex_data->quote_stack[lex_data->quote_stk_idx++] = yytext[0]; 00726 assert(lex_data->quote_stk_idx < sizeof(lex_data->quote_stack) / sizeof(lex_data->quote_stack[0])); 00727 } 00728 else 00729 { 00730 if (yytext[0] == '`') assert(0); 00731 /* close the current quote */ 00732 if (--lex_data->quote_stk_idx == 0) 00733 { 00734 BEGIN INITIAL; 00735 *lex_data->strptr++ = '\0'; 00736 return STRING; 00737 } 00738 else *lex_data->strptr++ = yytext[0]; 00739 } 00740 } 00741 YY_BREAK 00742 case 10: 00743 YY_RULE_SETUP 00744 #line 105 ".\\macro.lex.l" 00745 *lex_data->strptr++ = yytext[0]; 00746 YY_BREAK 00747 case 11: 00748 YY_RULE_SETUP 00749 #line 106 ".\\macro.lex.l" 00750 *lex_data->strptr++ = yytext[1]; 00751 YY_BREAK 00752 case YY_STATE_EOF(quote): 00753 #line 107 ".\\macro.lex.l" 00754 return 0; 00755 YY_BREAK 00756 case 12: 00757 YY_RULE_SETUP 00758 #line 109 ".\\macro.lex.l" 00759 00760 YY_BREAK 00761 case 13: 00762 YY_RULE_SETUP 00763 #line 110 ".\\macro.lex.l" 00764 return yytext[0]; 00765 YY_BREAK 00766 case 14: 00767 YY_RULE_SETUP 00768 #line 111 ".\\macro.lex.l" 00769 ECHO; 00770 YY_BREAK 00771 #line 772 "lex.yy.c" 00772 case YY_STATE_EOF(INITIAL): 00773 yyterminate(); 00774 00775 case YY_END_OF_BUFFER: 00776 { 00777 /* Amount of text matched not including the EOB char. */ 00778 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; 00779 00780 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 00781 *yy_cp = yy_hold_char; 00782 YY_RESTORE_YY_MORE_OFFSET 00783 00784 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) 00785 { 00786 /* We're scanning a new file or input source. It's 00787 * possible that this happened because the user 00788 * just pointed yyin at a new source and called 00789 * yylex(). If so, then we have to assure 00790 * consistency between yy_current_buffer and our 00791 * globals. Here is the right place to do so, because 00792 * this is the first action (other than possibly a 00793 * back-up) that will match for the new input source. 00794 */ 00795 yy_n_chars = yy_current_buffer->yy_n_chars; 00796 yy_current_buffer->yy_input_file = yyin; 00797 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; 00798 } 00799 00800 /* Note that here we test for yy_c_buf_p "<=" to the position 00801 * of the first EOB in the buffer, since yy_c_buf_p will 00802 * already have been incremented past the NUL character 00803 * (since all states make transitions on EOB to the 00804 * end-of-buffer state). Contrast this with the test 00805 * in input(). 00806 */ 00807 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) 00808 { /* This was really a NUL. */ 00809 yy_state_type yy_next_state; 00810 00811 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; 00812 00813 yy_current_state = yy_get_previous_state(); 00814 00815 /* Okay, we're now positioned to make the NUL 00816 * transition. We couldn't have 00817 * yy_get_previous_state() go ahead and do it 00818 * for us because it doesn't know how to deal 00819 * with the possibility of jamming (and we don't 00820 * want to build jamming into it because then it 00821 * will run more slowly). 00822 */ 00823 00824 yy_next_state = yy_try_NUL_trans( yy_current_state ); 00825 00826 yy_bp = yytext_ptr + YY_MORE_ADJ; 00827 00828 if ( yy_next_state ) 00829 { 00830 /* Consume the NUL. */ 00831 yy_cp = ++yy_c_buf_p; 00832 yy_current_state = yy_next_state; 00833 goto yy_match; 00834 } 00835 00836 else 00837 { 00838 yy_cp = yy_c_buf_p; 00839 goto yy_find_action; 00840 } 00841 } 00842 00843 else switch ( yy_get_next_buffer() ) 00844 { 00845 case EOB_ACT_END_OF_FILE: 00846 { 00847 yy_did_buffer_switch_on_eof = 0; 00848 00849 if ( yywrap() ) 00850 { 00851 /* Note: because we've taken care in 00852 * yy_get_next_buffer() to have set up 00853 * yytext, we can now set up 00854 * yy_c_buf_p so that if some total 00855 * hoser (like flex itself) wants to 00856 * call the scanner after we return the 00857 * YY_NULL, it'll still work - another 00858 * YY_NULL will get returned. 00859 */ 00860 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; 00861 00862 yy_act = YY_STATE_EOF(YY_START); 00863 goto do_action; 00864 } 00865 00866 else 00867 { 00868 if ( ! yy_did_buffer_switch_on_eof ) 00869 YY_NEW_FILE; 00870 } 00871 break; 00872 } 00873 00874 case EOB_ACT_CONTINUE_SCAN: 00875 yy_c_buf_p = 00876 yytext_ptr + yy_amount_of_matched_text; 00877 00878 yy_current_state = yy_get_previous_state(); 00879 00880 yy_cp = yy_c_buf_p; 00881 yy_bp = yytext_ptr + YY_MORE_ADJ; 00882 goto yy_match; 00883 00884 case EOB_ACT_LAST_MATCH: 00885 yy_c_buf_p = 00886 &yy_current_buffer->yy_ch_buf[yy_n_chars]; 00887 00888 yy_current_state = yy_get_previous_state(); 00889 00890 yy_cp = yy_c_buf_p; 00891 yy_bp = yytext_ptr + YY_MORE_ADJ; 00892 goto yy_find_action; 00893 } 00894 break; 00895 } 00896 00897 default: 00898 YY_FATAL_ERROR( 00899 "fatal flex scanner internal error--no action found" ); 00900 } /* end of action switch */ 00901 } /* end of scanning one token */ 00902 } /* end of yylex */ 00903 00904 00905 /* yy_get_next_buffer - try to read in a new buffer 00906 * 00907 * Returns a code representing an action: 00908 * EOB_ACT_LAST_MATCH - 00909 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 00910 * EOB_ACT_END_OF_FILE - end of file 00911 */ 00912 00913 static int yy_get_next_buffer() 00914 { 00915 register char *dest = yy_current_buffer->yy_ch_buf; 00916 register char *source = yytext_ptr; 00917 register int number_to_move, i; 00918 int ret_val; 00919 00920 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) 00921 YY_FATAL_ERROR( 00922 "fatal flex scanner internal error--end of buffer missed" ); 00923 00924 if ( yy_current_buffer->yy_fill_buffer == 0 ) 00925 { /* Don't try to fill the buffer, so this is an EOF. */ 00926 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) 00927 { 00928 /* We matched a single character, the EOB, so 00929 * treat this as a final EOF. 00930 */ 00931 return EOB_ACT_END_OF_FILE; 00932 } 00933 00934 else 00935 { 00936 /* We matched some text prior to the EOB, first 00937 * process it. 00938 */ 00939 return EOB_ACT_LAST_MATCH; 00940 } 00941 } 00942 00943 /* Try to read more data. */ 00944 00945 /* First move last chars to start of buffer. */ 00946 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; 00947 00948 for ( i = 0; i < number_to_move; ++i ) 00949 *(dest++) = *(source++); 00950 00951 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 00952 /* don't do the read, it's not guaranteed to return an EOF, 00953 * just force an EOF 00954 */ 00955 yy_current_buffer->yy_n_chars = yy_n_chars = 0; 00956 00957 else 00958 { 00959 int num_to_read = 00960 yy_current_buffer->yy_buf_size - number_to_move - 1; 00961 00962 while ( num_to_read <= 0 ) 00963 { /* Not enough room in the buffer - grow it. */ 00964 #ifdef YY_USES_REJECT 00965 YY_FATAL_ERROR( 00966 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); 00967 #else 00968 00969 /* just a shorter name for the current buffer */ 00970 YY_BUFFER_STATE b = yy_current_buffer; 00971 00972 int yy_c_buf_p_offset = 00973 (int) (yy_c_buf_p - b->yy_ch_buf); 00974 00975 if ( b->yy_is_our_buffer ) 00976 { 00977 int new_size = b->yy_buf_size * 2; 00978 00979 if ( new_size <= 0 ) 00980 b->yy_buf_size += b->yy_buf_size / 8; 00981 else 00982 b->yy_buf_size *= 2; 00983 00984 b->yy_ch_buf = (char *) 00985 /* Include room in for 2 EOB chars. */ 00986 yy_flex_realloc( (void *) b->yy_ch_buf, 00987 b->yy_buf_size + 2 ); 00988 } 00989 else 00990 /* Can't grow it, we don't own it. */ 00991 b->yy_ch_buf = 0; 00992 00993 if ( ! b->yy_ch_buf ) 00994 YY_FATAL_ERROR( 00995 "fatal error - scanner input buffer overflow" ); 00996 00997 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; 00998 00999 num_to_read = yy_current_buffer->yy_buf_size - 01000 number_to_move - 1; 01001 #endif 01002 } 01003 01004 if ( num_to_read > YY_READ_BUF_SIZE ) 01005 num_to_read = YY_READ_BUF_SIZE; 01006 01007 /* Read in more data. */ 01008 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), 01009 yy_n_chars, num_to_read ); 01010 01011 yy_current_buffer->yy_n_chars = yy_n_chars; 01012 } 01013 01014 if ( yy_n_chars == 0 ) 01015 { 01016 if ( number_to_move == YY_MORE_ADJ ) 01017 { 01018 ret_val = EOB_ACT_END_OF_FILE; 01019 yyrestart( yyin ); 01020 } 01021 01022 else 01023 { 01024 ret_val = EOB_ACT_LAST_MATCH; 01025 yy_current_buffer->yy_buffer_status = 01026 YY_BUFFER_EOF_PENDING; 01027 } 01028 } 01029 01030 else 01031 ret_val = EOB_ACT_CONTINUE_SCAN; 01032 01033 yy_n_chars += number_to_move; 01034 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; 01035 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; 01036 01037 yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; 01038 01039 return ret_val; 01040 } 01041 01042 01043 /* yy_get_previous_state - get the state just before the EOB char was reached */ 01044 01045 static yy_state_type yy_get_previous_state() 01046 { 01047 register yy_state_type yy_current_state; 01048 register char *yy_cp; 01049 01050 yy_current_state = yy_start; 01051 01052 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) 01053 { 01054 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 01055 if ( yy_accept[yy_current_state] ) 01056 { 01057 yy_last_accepting_state = yy_current_state; 01058 yy_last_accepting_cpos = yy_cp; 01059 } 01060 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 01061 { 01062 yy_current_state = (int) yy_def[yy_current_state]; 01063 if ( yy_current_state >= 28 ) 01064 yy_c = yy_meta[(unsigned int) yy_c]; 01065 } 01066 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 01067 } 01068 01069 return yy_current_state; 01070 } 01071 01072 01073 /* yy_try_NUL_trans - try to make a transition on the NUL character 01074 * 01075 * synopsis 01076 * next_state = yy_try_NUL_trans( current_state ); 01077 */ 01078 01079 #ifdef YY_USE_PROTOS 01080 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) 01081 #else 01082 static yy_state_type yy_try_NUL_trans( yy_current_state ) 01083 yy_state_type yy_current_state; 01084 #endif 01085 { 01086 register int yy_is_jam; 01087 register char *yy_cp = yy_c_buf_p; 01088 01089 register YY_CHAR yy_c = 1; 01090 if ( yy_accept[yy_current_state] ) 01091 { 01092 yy_last_accepting_state = yy_current_state; 01093 yy_last_accepting_cpos = yy_cp; 01094 } 01095 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 01096 { 01097 yy_current_state = (int) yy_def[yy_current_state]; 01098 if ( yy_current_state >= 28 ) 01099 yy_c = yy_meta[(unsigned int) yy_c]; 01100 } 01101 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 01102 yy_is_jam = (yy_current_state == 27); 01103 01104 return yy_is_jam ? 0 : yy_current_state; 01105 } 01106 01107 01108 #ifndef YY_NO_UNPUT 01109 #ifdef YY_USE_PROTOS 01110 static void yyunput( int c, register char *yy_bp ) 01111 #else 01112 static void yyunput( c, yy_bp ) 01113 int c; 01114 register char *yy_bp; 01115 #endif 01116 { 01117 register char *yy_cp = yy_c_buf_p; 01118 01119 /* undo effects of setting up yytext */ 01120 *yy_cp = yy_hold_char; 01121 01122 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) 01123 { /* need to shift things up to make room */ 01124 /* +2 for EOB chars. */ 01125 register int number_to_move = yy_n_chars + 2; 01126 register char *dest = &yy_current_buffer->yy_ch_buf[ 01127 yy_current_buffer->yy_buf_size + 2]; 01128 register char *source = 01129 &yy_current_buffer->yy_ch_buf[number_to_move]; 01130 01131 while ( source > yy_current_buffer->yy_ch_buf ) 01132 *--dest = *--source; 01133 01134 yy_cp += (int) (dest - source); 01135 yy_bp += (int) (dest - source); 01136 yy_current_buffer->yy_n_chars = 01137 yy_n_chars = yy_current_buffer->yy_buf_size; 01138 01139 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) 01140 YY_FATAL_ERROR( "flex scanner push-back overflow" ); 01141 } 01142 01143 *--yy_cp = (char) c; 01144 01145 01146 yytext_ptr = yy_bp; 01147 yy_hold_char = *yy_cp; 01148 yy_c_buf_p = yy_cp; 01149 } 01150 #endif /* ifndef YY_NO_UNPUT */ 01151 01152 01153 #ifdef __cplusplus 01154 static int yyinput() 01155 #else 01156 static int input() 01157 #endif 01158 { 01159 int c; 01160 01161 *yy_c_buf_p = yy_hold_char; 01162 01163 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) 01164 { 01165 /* yy_c_buf_p now points to the character we want to return. 01166 * If this occurs *before* the EOB characters, then it's a 01167 * valid NUL; if not, then we've hit the end of the buffer. 01168 */ 01169 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) 01170 /* This was really a NUL. */ 01171 *yy_c_buf_p = '\0'; 01172 01173 else 01174 { /* need more input */ 01175 int offset = yy_c_buf_p - yytext_ptr; 01176 ++yy_c_buf_p; 01177 01178 switch ( yy_get_next_buffer() ) 01179 { 01180 case EOB_ACT_LAST_MATCH: 01181 /* This happens because yy_g_n_b() 01182 * sees that we've accumulated a 01183 * token and flags that we need to 01184 * try matching the token before 01185 * proceeding. But for input(), 01186 * there's no matching to consider. 01187 * So convert the EOB_ACT_LAST_MATCH 01188 * to EOB_ACT_END_OF_FILE. 01189 */ 01190 01191 /* Reset buffer status. */ 01192 yyrestart( yyin ); 01193 01194 /* fall through */ 01195 01196 case EOB_ACT_END_OF_FILE: 01197 { 01198 if ( yywrap() ) 01199 return EOF; 01200 01201 if ( ! yy_did_buffer_switch_on_eof ) 01202 YY_NEW_FILE; 01203 #ifdef __cplusplus 01204 return yyinput(); 01205 #else 01206 return input(); 01207 #endif 01208 } 01209 01210 case EOB_ACT_CONTINUE_SCAN: 01211 yy_c_buf_p = yytext_ptr + offset; 01212 break; 01213 } 01214 } 01215 } 01216 01217 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ 01218 *yy_c_buf_p = '\0'; /* preserve yytext */ 01219 yy_hold_char = *++yy_c_buf_p; 01220 01221 01222 return c; 01223 } 01224 01225 01226 #ifdef YY_USE_PROTOS 01227 void yyrestart( FILE *input_file ) 01228 #else 01229 void yyrestart( input_file ) 01230 FILE *input_file; 01231 #endif 01232 { 01233 if ( ! yy_current_buffer ) 01234 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); 01235 01236 yy_init_buffer( yy_current_buffer, input_file ); 01237 yy_load_buffer_state(); 01238 } 01239 01240 01241 #ifdef YY_USE_PROTOS 01242 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) 01243 #else 01244 void yy_switch_to_buffer( new_buffer ) 01245 YY_BUFFER_STATE new_buffer; 01246 #endif 01247 { 01248 if ( yy_current_buffer == new_buffer ) 01249 return; 01250 01251 if ( yy_current_buffer ) 01252 { 01253 /* Flush out information for old buffer. */ 01254 *yy_c_buf_p = yy_hold_char; 01255 yy_current_buffer->yy_buf_pos = yy_c_buf_p; 01256 yy_current_buffer->yy_n_chars = yy_n_chars; 01257 } 01258 01259 yy_current_buffer = new_buffer; 01260 yy_load_buffer_state(); 01261 01262 /* We don't actually know whether we did this switch during 01263 * EOF (yywrap()) processing, but the only time this flag 01264 * is looked at is after yywrap() is called, so it's safe 01265 * to go ahead and always set it. 01266 */ 01267 yy_did_buffer_switch_on_eof = 1; 01268 } 01269 01270 01271 #ifdef YY_USE_PROTOS 01272 void yy_load_buffer_state( void ) 01273 #else 01274 void yy_load_buffer_state() 01275 #endif 01276 { 01277 yy_n_chars = yy_current_buffer->yy_n_chars; 01278 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; 01279 yyin = yy_current_buffer->yy_input_file; 01280 yy_hold_char = *yy_c_buf_p; 01281 } 01282 01283 01284 #ifdef YY_USE_PROTOS 01285 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) 01286 #else 01287 YY_BUFFER_STATE yy_create_buffer( file, size ) 01288 FILE *file; 01289 int size; 01290 #endif 01291 { 01292 YY_BUFFER_STATE b; 01293 01294 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); 01295 if ( ! b ) 01296 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 01297 01298 b->yy_buf_size = size; 01299 01300 /* yy_ch_buf has to be 2 characters longer than the size given because 01301 * we need to put in 2 end-of-buffer characters. 01302 */ 01303 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); 01304 if ( ! b->yy_ch_buf ) 01305 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 01306 01307 b->yy_is_our_buffer = 1; 01308 01309 yy_init_buffer( b, file ); 01310 01311 return b; 01312 } 01313 01314 01315 #ifdef YY_USE_PROTOS 01316 void yy_delete_buffer( YY_BUFFER_STATE b ) 01317 #else 01318 void yy_delete_buffer( b ) 01319 YY_BUFFER_STATE b; 01320 #endif 01321 { 01322 if ( ! b ) 01323 return; 01324 01325 if ( b == yy_current_buffer ) 01326 yy_current_buffer = (YY_BUFFER_STATE) 0; 01327 01328 if ( b->yy_is_our_buffer ) 01329 yy_flex_free( (void *) b->yy_ch_buf ); 01330 01331 yy_flex_free( (void *) b ); 01332 } 01333 01334 01335 #ifndef YY_ALWAYS_INTERACTIVE 01336 #ifndef YY_NEVER_INTERACTIVE 01337 extern int isatty YY_PROTO(( int )); 01338 #endif 01339 #endif 01340 01341 #ifdef YY_USE_PROTOS 01342 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) 01343 #else 01344 void yy_init_buffer( b, file ) 01345 YY_BUFFER_STATE b; 01346 FILE *file; 01347 #endif 01348 01349 01350 { 01351 yy_flush_buffer( b ); 01352 01353 b->yy_input_file = file; 01354 b->yy_fill_buffer = 1; 01355 01356 #if YY_ALWAYS_INTERACTIVE 01357 b->yy_is_interactive = 1; 01358 #else 01359 #if YY_NEVER_INTERACTIVE 01360 b->yy_is_interactive = 0; 01361 #else 01362 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 01363 #endif 01364 #endif 01365 } 01366 01367 01368 #ifdef YY_USE_PROTOS 01369 void yy_flush_buffer( YY_BUFFER_STATE b ) 01370 #else 01371 void yy_flush_buffer( b ) 01372 YY_BUFFER_STATE b; 01373 #endif 01374 01375 { 01376 if ( ! b ) 01377 return; 01378 01379 b->yy_n_chars = 0; 01380 01381 /* We always need two end-of-buffer characters. The first causes 01382 * a transition to the end-of-buffer state. The second causes 01383 * a jam in that state. 01384 */ 01385 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 01386 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 01387 01388 b->yy_buf_pos = &b->yy_ch_buf[0]; 01389 01390 b->yy_at_bol = 1; 01391 b->yy_buffer_status = YY_BUFFER_NEW; 01392 01393 if ( b == yy_current_buffer ) 01394 yy_load_buffer_state(); 01395 } 01396 01397 01398 #ifndef YY_NO_SCAN_BUFFER 01399 #ifdef YY_USE_PROTOS 01400 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) 01401 #else 01402 YY_BUFFER_STATE yy_scan_buffer( base, size ) 01403 char *base; 01404 yy_size_t size; 01405 #endif 01406 { 01407 YY_BUFFER_STATE b; 01408 01409 if ( size < 2 || 01410 base[size-2] != YY_END_OF_BUFFER_CHAR || 01411 base[size-1] != YY_END_OF_BUFFER_CHAR ) 01412 /* They forgot to leave room for the EOB's. */ 01413 return 0; 01414 01415 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); 01416 if ( ! b ) 01417 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); 01418 01419 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 01420 b->yy_buf_pos = b->yy_ch_buf = base; 01421 b->yy_is_our_buffer = 0; 01422 b->yy_input_file = 0; 01423 b->yy_n_chars = b->yy_buf_size; 01424 b->yy_is_interactive = 0; 01425 b->yy_at_bol = 1; 01426 b->yy_fill_buffer = 0; 01427 b->yy_buffer_status = YY_BUFFER_NEW; 01428 01429 yy_switch_to_buffer( b ); 01430 01431 return b; 01432 } 01433 #endif 01434 01435 01436 #ifndef YY_NO_SCAN_STRING 01437 #ifdef YY_USE_PROTOS 01438 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) 01439 #else 01440 YY_BUFFER_STATE yy_scan_string( yy_str ) 01441 yyconst char *yy_str; 01442 #endif 01443 { 01444 int len; 01445 for ( len = 0; yy_str[len]; ++len ) 01446 ; 01447 01448 return yy_scan_bytes( yy_str, len ); 01449 } 01450 #endif 01451 01452 01453 #ifndef YY_NO_SCAN_BYTES 01454 #ifdef YY_USE_PROTOS 01455 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) 01456 #else 01457 YY_BUFFER_STATE yy_scan_bytes( bytes, len ) 01458 yyconst char *bytes; 01459 int len; 01460 #endif 01461 { 01462 YY_BUFFER_STATE b; 01463 char *buf; 01464 yy_size_t n; 01465 int i; 01466 01467 /* Get memory for full buffer, including space for trailing EOB's. */ 01468 n = len + 2; 01469 buf = (char *) yy_flex_alloc( n ); 01470 if ( ! buf ) 01471 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 01472 01473 for ( i = 0; i < len; ++i ) 01474 buf[i] = bytes[i]; 01475 01476 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; 01477 01478 b = yy_scan_buffer( buf, n ); 01479 if ( ! b ) 01480 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); 01481 01482 /* It's okay to grow etc. this buffer, and we should throw it 01483 * away when we're done. 01484 */ 01485 b->yy_is_our_buffer = 1; 01486 01487 return b; 01488 } 01489 #endif 01490 01491 01492 #ifndef YY_NO_PUSH_STATE 01493 #ifdef YY_USE_PROTOS 01494 static void yy_push_state( int new_state ) 01495 #else 01496 static void yy_push_state( new_state ) 01497 int new_state; 01498 #endif 01499 { 01500 if ( yy_start_stack_ptr >= yy_start_stack_depth ) 01501 { 01502 yy_size_t new_size; 01503 01504 yy_start_stack_depth += YY_START_STACK_INCR; 01505 new_size = yy_start_stack_depth * sizeof( int ); 01506 01507 if ( ! yy_start_stack ) 01508 yy_start_stack = (int *) yy_flex_alloc( new_size ); 01509 01510 else 01511 yy_start_stack = (int *) yy_flex_realloc( 01512 (void *) yy_start_stack, new_size ); 01513 01514 if ( ! yy_start_stack ) 01515 YY_FATAL_ERROR( 01516 "out of memory expanding start-condition stack" ); 01517 } 01518 01519 yy_start_stack[yy_start_stack_ptr++] = YY_START; 01520 01521 BEGIN(new_state); 01522 } 01523 #endif 01524 01525 01526 #ifndef YY_NO_POP_STATE 01527 static void yy_pop_state() 01528 { 01529 if ( --yy_start_stack_ptr < 0 ) 01530 YY_FATAL_ERROR( "start-condition stack underflow" ); 01531 01532 BEGIN(yy_start_stack[yy_start_stack_ptr]); 01533 } 01534 #endif 01535 01536 01537 #ifndef YY_NO_TOP_STATE 01538 static int yy_top_state() 01539 { 01540 return yy_start_stack[yy_start_stack_ptr - 1]; 01541 } 01542 #endif 01543 01544 #ifndef YY_EXIT_FAILURE 01545 #define YY_EXIT_FAILURE 2 01546 #endif 01547 01548 #ifdef YY_USE_PROTOS 01549 static void yy_fatal_error( yyconst char msg[] ) 01550 #else 01551 static void yy_fatal_error( msg ) 01552 char msg[]; 01553 #endif 01554 { 01555 (void) fprintf( stderr, "%s\n", msg ); 01556 exit( YY_EXIT_FAILURE ); 01557 } 01558 01559 01560 01561 /* Redefine yyless() so it works in section 3 code. */ 01562 01563 #undef yyless 01564 #define yyless(n) \ 01565 do \ 01566 { \ 01567 /* Undo effects of setting up yytext. */ \ 01568 yytext[yyleng] = yy_hold_char; \ 01569 yy_c_buf_p = yytext + n; \ 01570 yy_hold_char = *yy_c_buf_p; \ 01571 *yy_c_buf_p = '\0'; \ 01572 yyleng = n; \ 01573 } \ 01574 while ( 0 ) 01575 01576 01577 /* Internal utility routines. */ 01578 01579 #ifndef yytext_ptr 01580 #ifdef YY_USE_PROTOS 01581 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) 01582 #else 01583 static void yy_flex_strncpy( s1, s2, n ) 01584 char *s1; 01585 yyconst char *s2; 01586 int n; 01587 #endif 01588 { 01589 register int i; 01590 for ( i = 0; i < n; ++i ) 01591 s1[i] = s2[i]; 01592 } 01593 #endif 01594 01595 #ifdef YY_NEED_STRLEN 01596 #ifdef YY_USE_PROTOS 01597 static int yy_flex_strlen( yyconst char *s ) 01598 #else 01599 static int yy_flex_strlen( s ) 01600 yyconst char *s; 01601 #endif 01602 { 01603 register int n; 01604 for ( n = 0; s[n]; ++n ) 01605 ; 01606 01607 return n; 01608 } 01609 #endif 01610 01611 01612 #ifdef YY_USE_PROTOS 01613 static void *yy_flex_alloc( yy_size_t size ) 01614 #else 01615 static void *yy_flex_alloc( size ) 01616 yy_size_t size; 01617 #endif 01618 { 01619 return (void *) malloc( size ); 01620 } 01621 01622 #ifdef YY_USE_PROTOS 01623 static void *yy_flex_realloc( void *ptr, yy_size_t size ) 01624 #else 01625 static void *yy_flex_realloc( ptr, size ) 01626 void *ptr; 01627 yy_size_t size; 01628 #endif 01629 { 01630 /* The cast to (char *) in the following accommodates both 01631 * implementations that use char* generic pointers, and those 01632 * that use void* generic pointers. It works with the latter 01633 * because both ANSI C and C++ allow castless assignment from 01634 * any pointer type to void*, and deal with argument conversions 01635 * as though doing an assignment. 01636 */ 01637 return (void *) realloc( (char *) ptr, size ); 01638 } 01639 01640 #ifdef YY_USE_PROTOS 01641 static void yy_flex_free( void *ptr ) 01642 #else 01643 static void yy_flex_free( ptr ) 01644 void *ptr; 01645 #endif 01646 { 01647 free( ptr ); 01648 } 01649 01650 #if YY_MAIN 01651 int main() 01652 { 01653 yylex(); 01654 return 0; 01655 } 01656 #endif 01657 #line 111 ".\\macro.lex.l" 01658 01659 01660 #if 0 01661 /* all code for testing macros */ 01662 #include "winhelp.h" 01663 static CHAR szTestMacro[256]; 01664 01665 static LRESULT CALLBACK MACRO_TestDialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) 01666 { 01667 if (msg == WM_COMMAND && wParam == IDOK) 01668 { 01669 GetDlgItemText(hDlg, 99, szTestMacro, sizeof(szTestMacro)); 01670 EndDialog(hDlg, IDOK); 01671 return TRUE; 01672 } 01673 return FALSE; 01674 } 01675 01676 void macro_test(void) 01677 { 01678 WNDPROC lpfnDlg = MakeProcInstance(MACRO_TestDialogProc, Globals.hInstance); 01679 DialogBox(Globals.hInstance, STRING_DIALOG_TEST, Globals.active_win->hMainWnd, (DLGPROC)lpfnDlg); 01680 FreeProcInstance(lpfnDlg); 01681 macro = szTestMacro; 01682 } 01683 #endif 01684 01685 /* small helper function for debug messages */ 01686 static const char* ts(int t) 01687 { 01688 static char c[2] = {0,0}; 01689 01690 switch (t) 01691 { 01692 case EMPTY: return "EMPTY"; 01693 case VOID_FUNCTION: return "VOID_FUNCTION"; 01694 case BOOL_FUNCTION: return "BOOL_FUNCTION"; 01695 case INTEGER: return "INTEGER"; 01696 case STRING: return "STRING"; 01697 case IDENTIFIER: return "IDENTIFIER"; 01698 default: c[0] = (char)t; return c; 01699 } 01700 } 01701 01702 static int MACRO_CallBoolFunc(void *fn, const char* args, void** ret); 01703 01704 /****************************************************************** 01705 * MACRO_CheckArgs 01706 * 01707 * checks number of arguments against prototype, and stores arguments on 01708 * stack pa for later call 01709 * returns -1 on error, otherwise the number of pushed parameters 01710 */ 01711 static int MACRO_CheckArgs(void* pa[], unsigned max, const char* args) 01712 { 01713 int t; 01714 unsigned int len = 0, idx = 0; 01715 01716 WINE_TRACE("Checking %s\n", args); 01717 01718 if (yylex() != '(') {WINE_WARN("missing (\n");return -1;} 01719 01720 if (*args) 01721 { 01722 len = strlen(args); 01723 for (;;) 01724 { 01725 t = yylex(); 01726 WINE_TRACE("Got %s <=> %c\n", ts(t), *args); 01727 01728 switch (*args) 01729 { 01730 case 'S': 01731 if (t != STRING) 01732 {WINE_WARN("missing S\n");return -1;} 01733 pa[idx] = (void*)yylval.string; 01734 break; 01735 case 'U': 01736 case 'I': 01737 if (t != INTEGER) 01738 {WINE_WARN("missing U\n");return -1;} 01739 pa[idx] = LongToPtr(yylval.integer); 01740 break; 01741 case 'B': 01742 if (t != BOOL_FUNCTION) 01743 {WINE_WARN("missing B\n");return -1;} 01744 if (MACRO_CallBoolFunc(yylval.function, yylval.proto, &pa[idx]) == 0) 01745 return -1; 01746 break; 01747 default: 01748 WINE_WARN("unexpected %s while args is %c\n", ts(t), *args); 01749 return -1; 01750 } 01751 idx++; 01752 if (*++args == '\0') break; 01753 t = yylex(); 01754 if (t == ')') goto CheckArgs_end; 01755 if (t != ',') {WINE_WARN("missing ,\n");return -1;} 01756 if (idx >= max) {WINE_FIXME("stack overflow (%d)\n", max);return -1;} 01757 } 01758 } 01759 if (yylex() != ')') {WINE_WARN("missing )\n");return -1;} 01760 01761 CheckArgs_end: 01762 while (len > idx) pa[--len] = NULL; 01763 return idx; 01764 } 01765 01766 /****************************************************************** 01767 * MACRO_CallBoolFunc 01768 * 01769 * Invokes boolean function fn, which arguments are defined by args 01770 * stores bool result into ret 01771 */ 01772 static int MACRO_CallBoolFunc(void *fn, const char* args, void** ret) 01773 { 01774 void* pa[2]; 01775 int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args); 01776 01777 if (idx < 0) return 0; 01778 if (!fn) return 1; 01779 01780 WINE_TRACE("calling with %u pmts\n", idx); 01781 01782 switch (strlen(args)) 01783 { 01784 case 0: 01785 { 01786 BOOL (WINAPI *func)(void) = fn; 01787 *ret = (void *)(ULONG_PTR)func(); 01788 break; 01789 } 01790 case 1: 01791 { 01792 BOOL (WINAPI *func)(void *) = fn; 01793 *ret = (void *)(ULONG_PTR)func( pa[0]); 01794 break; 01795 } 01796 default: WINE_FIXME("NIY\n"); 01797 } 01798 01799 return 1; 01800 } 01801 01802 /****************************************************************** 01803 * MACRO_CallVoidFunc 01804 * 01805 * 01806 */ 01807 static int MACRO_CallVoidFunc(void *fn, const char* args) 01808 { 01809 void* pa[6]; 01810 int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args); 01811 01812 if (idx < 0) return 0; 01813 if (!fn) return 1; 01814 01815 WINE_TRACE("calling %p with %u pmts\n", fn, idx); 01816 01817 switch (strlen(args)) 01818 { 01819 case 0: 01820 { 01821 void (WINAPI *func)(void) = fn; 01822 func(); 01823 break; 01824 } 01825 case 1: 01826 { 01827 void (WINAPI *func)(void*) = fn; 01828 func( pa[0] ); 01829 break; 01830 } 01831 case 2: 01832 { 01833 void (WINAPI *func)(void*,void*) = fn; 01834 func( pa[0], pa[1] ); 01835 break; 01836 } 01837 case 3: 01838 { 01839 void (WINAPI *func)(void*,void*,void*) = fn; 01840 func( pa[0], pa[1], pa[2] ); 01841 break; 01842 } 01843 case 4: 01844 { 01845 void (WINAPI *func)(void*,void*,void*,void*) = fn; 01846 func( pa[0], pa[1], pa[2], pa[3] ); 01847 break; 01848 } 01849 case 5: 01850 { 01851 void (WINAPI *func)(void*,void*,void*,void*,void*) = fn; 01852 func( pa[0], pa[1], pa[2], pa[3], pa[4] ); 01853 break; 01854 } 01855 case 6: 01856 { 01857 void (WINAPI *func)(void*,void*,void*,void*,void*,void*) = fn; 01858 func( pa[0], pa[1], pa[2], pa[3], pa[4], pa[5] ); 01859 break; 01860 } 01861 default: WINE_FIXME("NIY\n"); 01862 } 01863 01864 return 1; 01865 } 01866 01867 BOOL MACRO_ExecuteMacro(WINHELP_WINDOW* window, LPCSTR macro) 01868 { 01869 struct lex_data curr_lex_data, *prev_lex_data; 01870 BOOL ret = TRUE; 01871 int t; 01872 01873 WINE_TRACE("%s\n", wine_dbgstr_a(macro)); 01874 01875 prev_lex_data = lex_data; 01876 lex_data = &curr_lex_data; 01877 01878 memset(lex_data, 0, sizeof(*lex_data)); 01879 lex_data->macroptr = macro; 01880 lex_data->window = WINHELP_GrabWindow(window); 01881 01882 while ((t = yylex()) != EMPTY) 01883 { 01884 switch (t) 01885 { 01886 case VOID_FUNCTION: 01887 WINE_TRACE("got type void func(%s)\n", yylval.proto); 01888 MACRO_CallVoidFunc(yylval.function, yylval.proto); 01889 break; 01890 case BOOL_FUNCTION: 01891 WINE_WARN("got type bool func(%s)\n", yylval.proto); 01892 break; 01893 default: 01894 WINE_WARN("got unexpected type %s\n", ts(t)); 01895 YY_FLUSH_BUFFER; 01896 ret = FALSE; 01897 goto done; 01898 } 01899 switch (t = yylex()) 01900 { 01901 case EMPTY: goto done; 01902 case ';': break; 01903 default: ret = FALSE; YY_FLUSH_BUFFER; goto done; 01904 } 01905 } 01906 01907 done: 01908 for (t = 0; t < lex_data->cache_used; t++) 01909 HeapFree(GetProcessHeap(), 0, lex_data->cache_string[t]); 01910 lex_data = prev_lex_data; 01911 WINHELP_ReleaseWindow(window); 01912 01913 return ret; 01914 } 01915 01916 WINHELP_WINDOW* MACRO_CurrentWindow(void) 01917 { 01918 return lex_data ? lex_data->window : Globals.active_win; 01919 } 01920 01921 #ifndef yywrap 01922 int yywrap(void) { return 1; } 01923 #endif Generated on Mon May 28 2012 04:17:34 for ReactOS by
1.7.6.1
|