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