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