Current Path : /sys/amd64/compile/hs32/modules/usr/src/sys/modules/s3/@/amd64/compile/hs32/modules/usr/src/sys/modules/usb/usie/@/amd64/compile/hs32/modules/usr/src/sys/modules/oce/@/amd64/compile/hs32/modules/usr/src/sys/modules/ahci/@/amd64/compile/hs32/modules/usr/src/sys/modules/aic7xxx/aicasm/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //sys/amd64/compile/hs32/modules/usr/src/sys/modules/s3/@/amd64/compile/hs32/modules/usr/src/sys/modules/usb/usie/@/amd64/compile/hs32/modules/usr/src/sys/modules/oce/@/amd64/compile/hs32/modules/usr/src/sys/modules/ahci/@/amd64/compile/hs32/modules/usr/src/sys/modules/aic7xxx/aicasm/aicasm_scan.c |
/* A lexical scanner generated by flex */ /* Scanner skeleton version: * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ * $FreeBSD: release/9.1.0/usr.bin/lex/flex.skl 214272 2010-10-24 15:31:41Z uqs $ */ #if defined(__FreeBSD__) #include <sys/cdefs.h> #else #define __unused #define __dead2 #endif #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #include <stdio.h> /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include <stdlib.h> #include <unistd.h> /* Use prototypes in function declarations. */ #define YY_USE_PROTOS /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch #pragma warn -use #include <io.h> #include <stdlib.h> #define YY_USE_CONST #define YY_USE_PROTOS #endif #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif #ifdef YY_USE_PROTOS #define YY_PROTO(proto) proto #else #define YY_PROTO(proto) () #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yy_start - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #define YY_BUF_SIZE 16384 typedef struct yy_buffer_state *YY_BUFFER_STATE; extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * * if ( condition_holds ) * yyless( 5 ); * else * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all * done when it reached the ';' after the yyless() call. */ /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ *yy_cp = yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, yytext_ptr ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ typedef unsigned int yy_size_t; struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". */ #define YY_CURRENT_BUFFER yy_current_buffer /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart YY_PROTO(( FILE *input_file )); void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); void yy_load_buffer_state YY_PROTO(( void )); YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) __unused; static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); static int yy_get_next_buffer YY_PROTO(( void )); static void yy_fatal_error YY_PROTO(( yyconst char msg[] )) __dead2; /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yytext_ptr = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; #define YY_NUM_RULES 112 #define YY_END_OF_BUFFER 113 static yyconst short int yy_accept[363] = { 0, 0, 0, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 108, 113, 111, 22, 1, 2, 82, 19, 111, 82, 83, 85, 82, 82, 48, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 6, 5, 7, 8, 15, 13, 14, 11, 12, 91, 112, 89, 90, 91, 87, 88, 20, 21, 112, 99, 96, 97, 98, 95, 103, 100, 101, 102, 104, 108, 107, 106, 112, 22, 0, 0, 3, 83, 0, 85, 80, 81, 109, 110, 110, 110, 110, 110, 30, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 57, 59, 110, 110, 61, 110, 110, 110, 110, 76, 110, 110, 110, 110, 110, 110, 110, 110, 6, 7, 7, 9, 8, 4, 8, 15, 90, 0, 20, 93, 94, 0, 96, 95, 103, 100, 108, 0, 108, 105, 0, 0, 84, 110, 110, 110, 110, 110, 110, 110, 65, 64, 110, 110, 75, 110, 110, 70, 55, 71, 110, 68, 110, 110, 110, 110, 110, 0, 10, 67, 56, 58, 60, 62, 110, 110, 54, 53, 110, 78, 72, 110, 77, 52, 51, 40, 110, 49, 50, 110, 110, 69, 110, 73, 0, 0, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 66, 63, 110, 110, 79, 36, 110, 110, 10, 37, 110, 46, 110, 110, 110, 39, 74, 0, 0, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 38, 110, 110, 25, 110, 110, 35, 110, 29, 110, 110, 110, 0, 0, 110, 110, 110, 17, 110, 110, 110, 110, 110, 110, 110, 110, 110, 23, 110, 110, 110, 47, 0, 0, 110, 110, 110, 110, 110, 16, 110, 110, 27, 44, 110, 110, 110, 110, 110, 92, 0, 110, 110, 110, 110, 110, 110, 110, 45, 26, 110, 24, 110, 86, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 28, 42, 110, 41, 110, 32, 110, 34, 33, 43, 110, 110, 31, 18, 0 } ; static yyconst int yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 6, 7, 1, 1, 5, 1, 8, 9, 10, 5, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 17, 17, 5, 5, 18, 5, 19, 1, 1, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 30, 31, 32, 33, 34, 29, 35, 36, 37, 29, 38, 39, 40, 29, 29, 5, 41, 5, 1, 42, 1, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 29, 59, 60, 61, 62, 63, 64, 65, 29, 66, 5, 5, 5, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst int yy_meta[67] = { 0, 1, 2, 3, 1, 1, 4, 1, 5, 6, 7, 8, 9, 10, 11, 12, 12, 12, 1, 1, 12, 12, 12, 12, 12, 12, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 1, 9, 12, 12, 12, 12, 12, 12, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 } ; static yyconst short int yy_base[384] = { 0, 0, 0, 64, 65, 68, 77, 86, 127, 934, 933, 168, 209, 250, 291, 99, 104, 79, 99, 938, 941, 935, 941, 941, 941, 941, 63, 926, 83, 101, 917, 915, 925, 118, 924, 111, 131, 114, 136, 141, 117, 144, 103, 148, 147, 180, 113, 151, 267, 227, 149, 65, 184, 187, 146, 189, 0, 941, 153, 219, 0, 941, 0, 941, 941, 941, 941, 941, 917, 916, 941, 941, 0, 941, 241, 941, 927, 941, 941, 0, 0, 926, 941, 941, 941, 886, 941, 885, 922, 922, 876, 866, 941, 54, 0, 256, 941, 941, 941, 913, 303, 266, 193, 307, 912, 239, 278, 232, 234, 231, 270, 273, 154, 275, 279, 188, 280, 309, 310, 313, 311, 316, 333, 319, 911, 910, 318, 320, 909, 328, 331, 330, 334, 908, 335, 339, 338, 345, 344, 340, 341, 332, 0, 340, 341, 941, 346, 941, 347, 0, 901, 900, 0, 911, 941, 360, 910, 0, 0, 909, 869, 906, 867, 941, 859, 861, 0, 350, 337, 358, 364, 363, 351, 366, 897, 375, 394, 395, 896, 399, 400, 895, 894, 893, 398, 892, 401, 403, 404, 406, 410, 413, 941, 891, 890, 889, 888, 887, 412, 408, 886, 885, 409, 884, 883, 415, 882, 881, 880, 879, 417, 878, 856, 421, 422, 849, 411, 847, 803, 797, 414, 416, 418, 419, 445, 423, 424, 425, 427, 428, 431, 432, 840, 839, 433, 435, 836, 835, 434, 436, 941, 833, 441, 832, 440, 462, 463, 831, 829, 780, 764, 465, 467, 469, 468, 470, 477, 482, 478, 483, 484, 804, 487, 488, 803, 489, 490, 801, 491, 789, 495, 496, 497, 738, 735, 505, 501, 506, 769, 511, 508, 510, 512, 509, 513, 514, 520, 516, 765, 523, 517, 525, 761, 766, 719, 531, 524, 532, 527, 528, 757, 529, 535, 756, 657, 542, 544, 545, 547, 549, 661, 660, 557, 560, 550, 552, 563, 564, 571, 653, 649, 573, 647, 574, 652, 578, 579, 581, 584, 585, 589, 587, 590, 591, 592, 596, 595, 599, 601, 600, 597, 602, 603, 604, 606, 611, 619, 622, 645, 644, 605, 642, 620, 640, 623, 637, 634, 633, 630, 629, 336, 153, 941, 666, 678, 690, 702, 714, 726, 738, 750, 758, 770, 782, 794, 806, 810, 822, 833, 837, 849, 861, 873, 72 } ; static yyconst short int yy_def[384] = { 0, 362, 1, 363, 363, 364, 364, 365, 365, 366, 366, 367, 367, 368, 368, 369, 369, 370, 370, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 372, 362, 373, 374, 375, 362, 375, 362, 362, 362, 362, 362, 376, 376, 362, 362, 377, 362, 378, 362, 362, 362, 362, 379, 380, 362, 362, 362, 362, 381, 362, 381, 382, 362, 362, 362, 362, 362, 383, 362, 362, 362, 362, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 372, 373, 373, 362, 374, 362, 374, 375, 376, 376, 377, 362, 362, 378, 362, 379, 380, 362, 381, 382, 381, 362, 362, 362, 383, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 362, 362, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 362, 362, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 362, 371, 371, 371, 371, 371, 371, 371, 371, 362, 362, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 362, 362, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 362, 362, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 362, 362, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 362, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, 0, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362 } ; static yyconst short int yy_nxt[1008] = { 0, 20, 21, 22, 23, 24, 25, 26, 24, 24, 24, 24, 24, 24, 27, 28, 29, 29, 30, 31, 32, 33, 34, 34, 35, 34, 34, 34, 34, 34, 34, 34, 34, 34, 36, 37, 38, 34, 39, 40, 34, 20, 34, 41, 42, 43, 44, 45, 46, 34, 34, 47, 48, 34, 34, 49, 50, 51, 34, 52, 53, 54, 34, 34, 34, 55, 34, 57, 57, 93, 93, 61, 62, 98, 58, 58, 63, 64, 59, 59, 61, 62, 86, 87, 166, 63, 64, 65, 65, 66, 65, 65, 67, 65, 65, 65, 65, 65, 93, 93, 69, 81, 86, 87, 70, 71, 81, 82, 83, 90, 84, 98, 82, 83, 91, 84, 95, 95, 95, 98, 88, 98, 98, 94, 133, 98, 98, 65, 65, 65, 66, 65, 65, 67, 65, 65, 65, 65, 65, 98, 88, 69, 100, 101, 98, 70, 71, 104, 94, 98, 104, 102, 98, 104, 98, 98, 98, 98, 111, 98, 105, 98, 98, 144, 121, 106, 103, 145, 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 98, 107, 108, 112, 98, 140, 116, 98, 98, 98, 109, 122, 110, 98, 113, 114, 117, 115, 132, 123, 180, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, 147, 169, 134, 136, 148, 118, 98, 119, 137, 138, 98, 98, 135, 98, 153, 184, 120, 141, 98, 139, 154, 66, 75, 76, 66, 75, 75, 75, 75, 77, 78, 75, 77, 75, 75, 75, 75, 75, 75, 75, 75, 129, 95, 95, 95, 98, 98, 171, 173, 98, 174, 175, 98, 176, 98, 130, 177, 98, 98, 98, 168, 131, 75, 75, 76, 66, 75, 75, 75, 75, 77, 78, 75, 77, 75, 75, 75, 75, 75, 75, 75, 75, 98, 124, 172, 125, 98, 178, 98, 98, 98, 181, 98, 126, 127, 98, 185, 98, 98, 98, 167, 179, 170, 75, 128, 182, 191, 98, 183, 98, 98, 98, 192, 98, 98, 98, 98, 98, 98, 98, 98, 362, 144, 98, 98, 362, 145, 362, 362, 98, 98, 362, 148, 153, 190, 193, 195, 98, 196, 154, 189, 187, 98, 98, 186, 98, 188, 194, 199, 220, 221, 222, 201, 209, 98, 205, 215, 197, 225, 198, 223, 202, 217, 203, 207, 200, 204, 206, 210, 208, 211, 213, 216, 98, 98, 212, 224, 98, 98, 98, 98, 214, 98, 98, 226, 98, 191, 98, 98, 98, 98, 98, 240, 98, 98, 98, 98, 98, 98, 227, 98, 98, 98, 98, 98, 228, 98, 98, 229, 252, 98, 98, 98, 98, 98, 98, 253, 251, 254, 98, 98, 236, 257, 230, 98, 233, 242, 243, 235, 234, 237, 245, 231, 232, 238, 239, 241, 244, 246, 255, 247, 98, 98, 248, 98, 260, 98, 98, 98, 98, 263, 259, 256, 267, 268, 258, 98, 98, 262, 261, 265, 98, 98, 98, 266, 264, 98, 98, 98, 98, 98, 270, 269, 276, 98, 98, 98, 279, 275, 278, 98, 272, 277, 280, 98, 98, 281, 98, 98, 98, 98, 98, 98, 98, 271, 98, 98, 297, 295, 98, 296, 299, 98, 98, 98, 285, 98, 98, 98, 282, 98, 98, 291, 300, 98, 284, 283, 287, 286, 298, 289, 98, 288, 98, 98, 301, 98, 290, 98, 98, 306, 98, 313, 292, 302, 308, 98, 312, 314, 98, 315, 316, 98, 98, 303, 304, 309, 327, 305, 318, 98, 307, 98, 98, 328, 317, 325, 98, 98, 326, 98, 320, 323, 98, 98, 329, 98, 321, 98, 98, 98, 98, 335, 319, 98, 98, 98, 322, 98, 98, 98, 98, 98, 98, 98, 98, 334, 344, 337, 338, 98, 343, 330, 346, 336, 347, 345, 352, 98, 98, 332, 98, 98, 331, 333, 342, 339, 353, 98, 98, 354, 358, 98, 98, 355, 340, 98, 356, 348, 98, 350, 98, 341, 98, 98, 324, 98, 349, 98, 351, 359, 360, 98, 324, 310, 357, 98, 361, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 74, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 99, 98, 98, 311, 99, 310, 98, 99, 142, 142, 98, 142, 142, 142, 98, 142, 142, 142, 294, 142, 143, 143, 293, 143, 143, 143, 143, 143, 143, 143, 143, 143, 146, 146, 98, 146, 146, 146, 146, 146, 146, 146, 146, 146, 149, 149, 98, 149, 98, 98, 149, 149, 149, 149, 149, 149, 150, 150, 150, 150, 152, 152, 152, 274, 152, 152, 152, 152, 152, 152, 152, 152, 155, 273, 98, 155, 98, 98, 98, 155, 98, 98, 155, 157, 98, 98, 157, 158, 250, 158, 158, 249, 98, 158, 98, 158, 158, 158, 158, 160, 160, 98, 160, 160, 160, 160, 160, 160, 160, 160, 160, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 219, 218, 161, 362, 161, 159, 156, 153, 151, 151, 98, 98, 98, 98, 98, 98, 165, 164, 89, 163, 161, 161, 159, 156, 151, 151, 98, 98, 97, 96, 92, 89, 362, 73, 73, 19, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362 } ; static yyconst short int yy_chk[1008] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, 93, 93, 5, 5, 51, 3, 4, 5, 5, 3, 4, 6, 6, 17, 17, 383, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 28, 28, 7, 15, 18, 18, 7, 7, 16, 15, 15, 26, 15, 42, 16, 16, 26, 16, 29, 29, 29, 35, 17, 46, 37, 28, 51, 40, 33, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 36, 18, 8, 33, 35, 38, 8, 8, 37, 28, 39, 40, 36, 41, 37, 54, 44, 43, 50, 42, 47, 38, 361, 112, 58, 46, 39, 36, 58, 8, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 45, 41, 41, 43, 52, 54, 44, 53, 115, 55, 41, 47, 41, 102, 43, 43, 44, 43, 50, 47, 112, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 59, 102, 52, 53, 59, 45, 49, 45, 53, 53, 109, 107, 52, 108, 74, 115, 45, 55, 105, 53, 74, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 49, 95, 95, 95, 101, 48, 105, 107, 110, 108, 108, 111, 109, 113, 49, 109, 106, 114, 116, 101, 49, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 100, 48, 106, 48, 103, 110, 117, 118, 120, 113, 119, 48, 48, 121, 116, 126, 123, 127, 100, 111, 103, 14, 48, 113, 122, 129, 114, 131, 130, 141, 122, 132, 134, 360, 168, 136, 135, 139, 140, 143, 144, 138, 137, 143, 144, 146, 148, 167, 172, 146, 148, 155, 121, 123, 127, 169, 127, 155, 120, 118, 171, 170, 117, 173, 119, 126, 130, 167, 168, 169, 131, 136, 175, 134, 139, 127, 172, 129, 170, 132, 141, 132, 135, 130, 132, 134, 136, 135, 137, 138, 140, 176, 177, 137, 171, 184, 179, 180, 186, 138, 187, 188, 173, 189, 191, 199, 202, 190, 216, 198, 191, 220, 205, 221, 210, 222, 223, 173, 213, 214, 225, 226, 227, 175, 228, 229, 176, 221, 230, 231, 234, 238, 235, 239, 222, 220, 223, 244, 242, 187, 225, 177, 224, 180, 199, 202, 186, 184, 188, 210, 177, 179, 189, 190, 198, 205, 213, 224, 214, 245, 246, 216, 251, 228, 252, 254, 253, 255, 231, 227, 224, 239, 242, 226, 256, 258, 230, 229, 235, 257, 259, 260, 238, 234, 262, 263, 265, 266, 268, 244, 242, 252, 270, 271, 272, 255, 251, 254, 276, 246, 253, 256, 275, 277, 257, 280, 283, 281, 279, 282, 284, 285, 245, 287, 290, 277, 275, 286, 276, 280, 289, 296, 291, 262, 298, 299, 301, 258, 295, 297, 271, 281, 302, 260, 259, 265, 263, 279, 268, 305, 266, 306, 307, 282, 308, 270, 309, 314, 287, 315, 296, 272, 283, 290, 312, 295, 297, 313, 298, 299, 316, 317, 284, 285, 291, 314, 286, 302, 318, 289, 321, 323, 315, 301, 312, 325, 326, 313, 327, 306, 309, 328, 329, 316, 331, 307, 330, 332, 333, 334, 326, 305, 336, 335, 340, 308, 337, 339, 338, 341, 342, 343, 350, 344, 325, 335, 328, 329, 345, 334, 317, 337, 327, 338, 336, 343, 346, 352, 321, 347, 354, 318, 323, 333, 330, 344, 359, 358, 345, 352, 357, 356, 346, 331, 355, 347, 339, 353, 341, 351, 332, 349, 348, 324, 322, 340, 320, 342, 354, 358, 319, 311, 310, 350, 304, 359, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 363, 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 364, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 365, 366, 366, 366, 366, 366, 366, 366, 366, 366, 366, 366, 366, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, 369, 369, 369, 369, 369, 369, 369, 369, 369, 369, 369, 369, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 371, 303, 300, 294, 371, 293, 292, 371, 372, 372, 288, 372, 372, 372, 278, 372, 372, 372, 274, 372, 373, 373, 273, 373, 373, 373, 373, 373, 373, 373, 373, 373, 374, 374, 269, 374, 374, 374, 374, 374, 374, 374, 374, 374, 375, 375, 267, 375, 264, 261, 375, 375, 375, 375, 375, 375, 376, 376, 376, 376, 377, 377, 377, 250, 377, 377, 377, 377, 377, 377, 377, 377, 378, 249, 248, 378, 247, 243, 241, 378, 237, 236, 378, 379, 233, 232, 379, 380, 219, 380, 380, 218, 217, 380, 215, 380, 380, 380, 380, 381, 381, 212, 381, 381, 381, 381, 381, 381, 381, 381, 381, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 382, 211, 209, 208, 207, 206, 204, 203, 201, 200, 197, 196, 195, 194, 193, 185, 183, 182, 181, 178, 174, 165, 164, 162, 161, 160, 159, 156, 153, 151, 150, 133, 128, 125, 124, 104, 99, 91, 90, 89, 88, 87, 85, 81, 76, 69, 68, 34, 32, 31, 30, 27, 21, 19, 10, 9, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362, 362 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" #define INITIAL 0 #line 2 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" /*- * Lexical Analyzer for the Aic7xxx SCSI Host adapter sequencer assembler. * * Copyright (c) 1997, 1998, 2000 Justin T. Gibbs. * Copyright (c) 2001, 2002 Adaptec Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions, and the following disclaimer, * without modification. * 2. Redistributions in binary form must reproduce at minimum a disclaimer * substantially similar to the "NO WARRANTY" disclaimer below * ("Disclaimer") and any redistribution must be conditioned upon * including a substantially similar Disclaimer requirement for further * binary redistribution. * 3. Neither the names of the above-listed copyright holders nor the names * of any contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * * NO WARRANTY * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * * $Id: //depot/aic7xxx/aic7xxx/aicasm/aicasm_scan.l#19 $ * * $FreeBSD: release/9.1.0/sys/dev/aic7xxx/aicasm/aicasm_scan.l 229101 2011-12-31 14:34:07Z dim $ */ #include <sys/types.h> #include <inttypes.h> #include <limits.h> #include <regex.h> #include <stdio.h> #include <string.h> #include <sysexits.h> #include <sys/queue.h> #include "aicasm.h" #include "aicasm_symbol.h" #include "aicasm_gram.h" /* This is used for macro body capture too, so err on the large size. */ #define MAX_STR_CONST 4096 static char string_buf[MAX_STR_CONST]; static char *string_buf_ptr; static int parren_count; static int quote_count; static char msgbuf[255]; extern int yylex(void); extern int mmlex(void); extern int mmparse(void); extern void mm_switch_to_buffer(YY_BUFFER_STATE); extern void mm_delete_buffer(YY_BUFFER_STATE); #define YY_NO_INPUT 1 #define COMMENT 1 #define CEXPR 2 #define INCLUDE 3 #define STRING 4 #define MACRODEF 5 #define MACROARGLIST 6 #define MACROCALLARGS 7 #define MACROBODY 8 /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap YY_PROTO(( void )); #else extern int yywrap YY_PROTO(( void )); #endif #endif #ifndef YY_NO_UNPUT static void yyunput YY_PROTO(( int c, char *buf_ptr )); #endif #ifndef yytext_ptr static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen YY_PROTO(( yyconst char * )); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput YY_PROTO(( void )); #else static int input YY_PROTO(( void )); #endif #endif #if YY_STACK_USED static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = 0; #ifndef YY_NO_PUSH_STATE static void yy_push_state YY_PROTO(( int new_state )); #endif #ifndef YY_NO_POP_STATE static void yy_pop_state YY_PROTO(( void )); #endif #ifndef YY_NO_TOP_STATE static int yy_top_state YY_PROTO(( void )); #endif #else #define YY_NO_PUSH_STATE 1 #define YY_NO_POP_STATE 1 #define YY_NO_TOP_STATE 1 #endif #ifdef YY_MALLOC_DECL YY_MALLOC_DECL #else #if __STDC__ #ifndef __cplusplus #include <stdlib.h> #endif #else /* Just try to get by without declaring the routines. This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */ #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( yy_current_buffer->yy_is_interactive ) \ { \ int c = '*', n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL int yylex YY_PROTO(( void )) #endif /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION YY_DECL { yy_state_type yy_current_state; char *yy_cp, *yy_bp; int yy_act; #line 92 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" if ( yy_init ) { yy_init = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! yy_start ) yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_load_buffer_state(); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = yy_c_buf_p; /* Support of yytext. */ *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = yy_start; yy_match: do { YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 363 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 941 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; case 1: YY_RULE_SETUP #line 93 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { ++yylineno; } YY_BREAK case 2: YY_RULE_SETUP #line 94 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" ; YY_BREAK case 3: YY_RULE_SETUP #line 95 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { BEGIN COMMENT; /* Enter comment eating state */ } YY_BREAK case 4: YY_RULE_SETUP #line 96 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { fprintf(stderr, "Warning! Comment within comment."); } YY_BREAK case 5: YY_RULE_SETUP #line 97 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { ++yylineno; } YY_BREAK case 6: YY_RULE_SETUP #line 98 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" ; YY_BREAK case 7: YY_RULE_SETUP #line 99 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" ; YY_BREAK case 8: YY_RULE_SETUP #line 100 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" ; YY_BREAK case 9: YY_RULE_SETUP #line 101 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { BEGIN INITIAL; } YY_BREAK case 10: YY_RULE_SETUP #line 102 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { string_buf_ptr = string_buf; parren_count = 1; BEGIN CEXPR; return T_IF; } YY_BREAK case 11: YY_RULE_SETUP #line 108 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { *string_buf_ptr++ = '('; parren_count++; } YY_BREAK case 12: YY_RULE_SETUP #line 109 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { parren_count--; if (parren_count == 0) { /* All done */ BEGIN INITIAL; *string_buf_ptr = '\0'; yylval.sym = symtable_get(string_buf); return T_CEXPR; } else { *string_buf_ptr++ = ')'; } } YY_BREAK case 13: YY_RULE_SETUP #line 121 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { ++yylineno; } YY_BREAK case 14: YY_RULE_SETUP #line 122 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" ; YY_BREAK case 15: YY_RULE_SETUP #line 123 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { char *yptr; yptr = yytext; while (*yptr != '\0') { /* Remove duplicate spaces */ if (*yptr == '\t') *yptr = ' '; if (*yptr == ' ' && string_buf_ptr != string_buf && string_buf_ptr[-1] == ' ') yptr++; else *string_buf_ptr++ = *yptr++; } } YY_BREAK case 16: YY_RULE_SETUP #line 140 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_VERSION; } YY_BREAK case 17: YY_RULE_SETUP #line 141 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_PREFIX; } YY_BREAK case 18: YY_RULE_SETUP #line 142 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_PATCH_ARG_LIST; } YY_BREAK case 19: YY_RULE_SETUP #line 143 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { string_buf_ptr = string_buf; BEGIN STRING; } YY_BREAK case 20: YY_RULE_SETUP #line 147 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { char *yptr; yptr = yytext; while (*yptr) *string_buf_ptr++ = *yptr++; } YY_BREAK case 21: YY_RULE_SETUP #line 154 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { /* All done */ BEGIN INITIAL; *string_buf_ptr = '\0'; yylval.str = string_buf; return T_STRING; } YY_BREAK case 22: YY_RULE_SETUP #line 161 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" ; YY_BREAK /* Register/SCB/SRAM definition keywords */ case 23: YY_RULE_SETUP #line 164 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_EXPORT; } YY_BREAK case 24: YY_RULE_SETUP #line 165 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_REGISTER; } YY_BREAK case 25: YY_RULE_SETUP #line 166 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { yylval.value = FALSE; return T_CONST; } YY_BREAK case 26: YY_RULE_SETUP #line 167 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_DOWNLOAD; } YY_BREAK case 27: YY_RULE_SETUP #line 168 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_ADDRESS; } YY_BREAK case 28: YY_RULE_SETUP #line 169 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_ACCESS_MODE; } YY_BREAK case 29: YY_RULE_SETUP #line 170 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_MODES; } YY_BREAK case 30: YY_RULE_SETUP #line 171 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { if (strcmp(yytext, "RW") == 0) yylval.value = RW; else if (strcmp(yytext, "RO") == 0) yylval.value = RO; else yylval.value = WO; return T_MODE; } YY_BREAK case 31: YY_RULE_SETUP #line 180 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_BEGIN_CS; } YY_BREAK case 32: YY_RULE_SETUP #line 181 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_END_CS; } YY_BREAK case 33: YY_RULE_SETUP #line 182 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_SET_SRC_MODE; } YY_BREAK case 34: YY_RULE_SETUP #line 183 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_SET_DST_MODE; } YY_BREAK case 35: YY_RULE_SETUP #line 184 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_FIELD; } YY_BREAK case 36: YY_RULE_SETUP #line 185 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_ENUM; } YY_BREAK case 37: YY_RULE_SETUP #line 186 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_MASK; } YY_BREAK case 38: YY_RULE_SETUP #line 187 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_ALIAS; } YY_BREAK case 39: YY_RULE_SETUP #line 188 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_SIZE; } YY_BREAK case 40: YY_RULE_SETUP #line 189 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_SCB; } YY_BREAK case 41: YY_RULE_SETUP #line 190 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_SRAM; } YY_BREAK case 42: YY_RULE_SETUP #line 191 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_ACCUM; } YY_BREAK case 43: YY_RULE_SETUP #line 192 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_MODE_PTR; } YY_BREAK case 44: YY_RULE_SETUP #line 193 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_ALLONES; } YY_BREAK case 45: YY_RULE_SETUP #line 194 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_ALLZEROS; } YY_BREAK case 46: YY_RULE_SETUP #line 195 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_NONE; } YY_BREAK case 47: YY_RULE_SETUP #line 196 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_SINDEX; } YY_BREAK case 48: YY_RULE_SETUP #line 197 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_A; } YY_BREAK /* Opcodes */ case 49: YY_RULE_SETUP #line 200 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_SHL; } YY_BREAK case 50: YY_RULE_SETUP #line 201 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_SHR; } YY_BREAK case 51: YY_RULE_SETUP #line 202 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_ROR; } YY_BREAK case 52: YY_RULE_SETUP #line 203 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_ROL; } YY_BREAK case 53: YY_RULE_SETUP #line 204 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_MVI; } YY_BREAK case 54: YY_RULE_SETUP #line 205 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_MOV; } YY_BREAK case 55: YY_RULE_SETUP #line 206 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_CLR; } YY_BREAK case 56: YY_RULE_SETUP #line 207 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_JMP; } YY_BREAK case 57: YY_RULE_SETUP #line 208 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_JC; } YY_BREAK case 58: YY_RULE_SETUP #line 209 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_JNC; } YY_BREAK case 59: YY_RULE_SETUP #line 210 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_JE; } YY_BREAK case 60: YY_RULE_SETUP #line 211 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_JNE; } YY_BREAK case 61: YY_RULE_SETUP #line 212 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_JZ; } YY_BREAK case 62: YY_RULE_SETUP #line 213 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_JNZ; } YY_BREAK case 63: YY_RULE_SETUP #line 214 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_CALL; } YY_BREAK case 64: YY_RULE_SETUP #line 215 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_ADD; } YY_BREAK case 65: YY_RULE_SETUP #line 216 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_ADC; } YY_BREAK case 66: YY_RULE_SETUP #line 217 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_BMOV; } YY_BREAK case 67: YY_RULE_SETUP #line 218 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_INC; } YY_BREAK case 68: YY_RULE_SETUP #line 219 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_DEC; } YY_BREAK case 69: YY_RULE_SETUP #line 220 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_STC; } YY_BREAK case 70: YY_RULE_SETUP #line 221 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_CLC; } YY_BREAK case 71: YY_RULE_SETUP #line 222 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_CMP; } YY_BREAK case 72: YY_RULE_SETUP #line 223 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_NOT; } YY_BREAK case 73: YY_RULE_SETUP #line 224 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_XOR; } YY_BREAK case 74: YY_RULE_SETUP #line 225 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_TEST;} YY_BREAK case 75: YY_RULE_SETUP #line 226 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_AND; } YY_BREAK case 76: YY_RULE_SETUP #line 227 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_OR; } YY_BREAK case 77: YY_RULE_SETUP #line 228 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_RET; } YY_BREAK case 78: YY_RULE_SETUP #line 229 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_NOP; } YY_BREAK case 79: YY_RULE_SETUP #line 230 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_ELSE; } YY_BREAK /* Allowed Symbols */ case 80: YY_RULE_SETUP #line 233 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_EXPR_LSHIFT; } YY_BREAK case 81: YY_RULE_SETUP #line 234 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return T_EXPR_RSHIFT; } YY_BREAK case 82: YY_RULE_SETUP #line 235 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return yytext[0]; } YY_BREAK /* Number processing */ case 83: YY_RULE_SETUP #line 238 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { yylval.value = strtol(yytext, NULL, 8); return T_NUMBER; } YY_BREAK case 84: YY_RULE_SETUP #line 243 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { yylval.value = strtoul(yytext + 2, NULL, 16); return T_NUMBER; } YY_BREAK case 85: YY_RULE_SETUP #line 248 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { yylval.value = strtol(yytext, NULL, 10); return T_NUMBER; } YY_BREAK /* Include Files */ case 86: YY_RULE_SETUP #line 253 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { BEGIN INCLUDE; quote_count = 0; return T_INCLUDE; } YY_BREAK case 87: YY_RULE_SETUP #line 258 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return yytext[0]; } YY_BREAK case 88: YY_RULE_SETUP #line 259 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { BEGIN INITIAL; return yytext[0]; } YY_BREAK case 89: YY_RULE_SETUP #line 260 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { if (quote_count != 0) BEGIN INITIAL; quote_count++; return yytext[0]; } YY_BREAK case 90: YY_RULE_SETUP #line 266 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { char *yptr; yptr = yytext; string_buf_ptr = string_buf; while (*yptr) *string_buf_ptr++ = *yptr++; yylval.str = string_buf; *string_buf_ptr = '\0'; return T_PATH; } YY_BREAK case 91: YY_RULE_SETUP #line 277 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { stop("Invalid include line", EX_DATAERR); } YY_BREAK case 92: YY_RULE_SETUP #line 278 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { BEGIN MACRODEF; return T_DEFINE; } YY_BREAK case 93: YY_RULE_SETUP #line 282 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { char *yptr; /* Strip space and return as a normal symbol */ yptr = yytext; while (*yptr != ' ' && *yptr != '\t') yptr++; *yptr = '\0'; yylval.sym = symtable_get(yytext); string_buf_ptr = string_buf; BEGIN MACROBODY; return T_SYMBOL; } YY_BREAK case 94: YY_RULE_SETUP #line 295 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { /* * We store the symbol with its opening * parren so we can differentiate macros * that take args from macros with the * same name that do not take args as * is allowed in C. */ BEGIN MACROARGLIST; yylval.sym = symtable_get(yytext); unput('('); return T_SYMBOL; } YY_BREAK case 95: YY_RULE_SETUP #line 308 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { yylval.str = yytext; return T_ARG; } YY_BREAK case 96: YY_RULE_SETUP #line 312 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" ; YY_BREAK case 97: YY_RULE_SETUP #line 313 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { return yytext[0]; } YY_BREAK case 98: YY_RULE_SETUP #line 316 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { string_buf_ptr = string_buf; BEGIN MACROBODY; return ')'; } YY_BREAK case 99: YY_RULE_SETUP #line 321 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { snprintf(msgbuf, sizeof(msgbuf), "Invalid character " "'%c' in macro argument list", yytext[0]); stop(msgbuf, EX_DATAERR); } YY_BREAK case 100: YY_RULE_SETUP #line 327 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" ; YY_BREAK case 101: YY_RULE_SETUP #line 328 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { parren_count++; if (parren_count == 1) return ('('); *string_buf_ptr++ = '('; } YY_BREAK case 102: YY_RULE_SETUP #line 334 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { parren_count--; if (parren_count == 0) { BEGIN INITIAL; return (')'); } *string_buf_ptr++ = ')'; } YY_BREAK case 103: YY_RULE_SETUP #line 342 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { char *yptr; yptr = yytext; while (*yptr) *string_buf_ptr++ = *yptr++; } YY_BREAK case 104: YY_RULE_SETUP #line 349 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { if (string_buf_ptr != string_buf) { /* * Return an argument and * rescan this comma so we * can return it as well. */ *string_buf_ptr = '\0'; yylval.str = string_buf; string_buf_ptr = string_buf; unput(','); return T_ARG; } return ','; } YY_BREAK case 105: YY_RULE_SETUP #line 364 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { /* Eat escaped newlines. */ ++yylineno; } YY_BREAK case 106: YY_RULE_SETUP #line 368 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" ; YY_BREAK case 107: YY_RULE_SETUP #line 369 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { /* Macros end on the first unescaped newline. */ BEGIN INITIAL; *string_buf_ptr = '\0'; yylval.str = string_buf; ++yylineno; return T_MACROBODY; } YY_BREAK case 108: YY_RULE_SETUP #line 377 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { char *yptr; char c; yptr = yytext; while ((c = *yptr++)) { /* * Strip carriage returns. */ if (c == '\r') continue; *string_buf_ptr++ = c; } } YY_BREAK case 109: YY_RULE_SETUP #line 391 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { char *yptr; char *ycopy; /* May be a symbol or a macro invocation. */ yylval.sym = symtable_get(yytext); if (yylval.sym->type == MACRO) { YY_BUFFER_STATE old_state; YY_BUFFER_STATE temp_state; ycopy = strdup(yytext); yptr = ycopy + yyleng; while (yptr > ycopy) unput(*--yptr); old_state = YY_CURRENT_BUFFER; temp_state = yy_create_buffer(stdin, YY_BUF_SIZE); yy_switch_to_buffer(temp_state); mm_switch_to_buffer(old_state); mmparse(); mm_switch_to_buffer(temp_state); yy_switch_to_buffer(old_state); mm_delete_buffer(temp_state); expand_macro(yylval.sym); } else { if (yylval.sym->type == UNINITIALIZED) { /* Try without the '(' */ symbol_delete(yylval.sym); yytext[yyleng-1] = '\0'; yylval.sym = symtable_get(yytext); } unput('('); return T_SYMBOL; } } YY_BREAK case 110: YY_RULE_SETUP #line 428 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { yylval.sym = symtable_get(yytext); if (yylval.sym->type == MACRO) { expand_macro(yylval.sym); } else { return T_SYMBOL; } } YY_BREAK case 111: YY_RULE_SETUP #line 436 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" { snprintf(msgbuf, sizeof(msgbuf), "Invalid character " "'%c'", yytext[0]); stop(msgbuf, EX_DATAERR); } YY_BREAK case 112: YY_RULE_SETUP #line 441 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" ECHO; YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(COMMENT): case YY_STATE_EOF(CEXPR): case YY_STATE_EOF(INCLUDE): case YY_STATE_EOF(STRING): case YY_STATE_EOF(MACRODEF): case YY_STATE_EOF(MACROARGLIST): case YY_STATE_EOF(MACROCALLARGS): case YY_STATE_EOF(MACROBODY): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yy_hold_char; YY_RESTORE_YY_MORE_OFFSET if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between yy_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ yy_n_chars = yy_current_buffer->yy_n_chars; yy_current_buffer->yy_input_file = yyin; yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yy_c_buf_p; goto yy_find_action; } } else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { yy_did_buffer_switch_on_eof = 0; if ( yywrap() ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_current_buffer->yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ #ifdef YY_USE_PROTOS static int yy_get_next_buffer(void) #else static int yy_get_next_buffer() #endif { char *dest = yy_current_buffer->yy_ch_buf; char *source = yytext_ptr; int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( yy_current_buffer->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ yy_current_buffer->yy_n_chars = yy_n_chars = 0; else { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = (int) (yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yy_flex_realloc( (void *) b->yy_ch_buf, b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; #endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); yy_current_buffer->yy_n_chars = yy_n_chars; } if ( yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ #ifdef YY_USE_PROTOS static yy_state_type yy_get_previous_state(void) #else static yy_state_type yy_get_previous_state() #endif { yy_state_type yy_current_state; char *yy_cp; yy_current_state = yy_start; for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 363 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ #ifdef YY_USE_PROTOS static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) #else static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif { int yy_is_jam; char *yy_cp = yy_c_buf_p; YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 363 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 362); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS static void yyunput( int c, char *yy_bp ) #else static void yyunput( c, yy_bp ) int c; char *yy_bp; #endif { char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ int number_to_move = yy_n_chars + 2; char *dest = &yy_current_buffer->yy_ch_buf[ yy_current_buffer->yy_buf_size + 2]; char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); yy_current_buffer->yy_n_chars = yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; yytext_ptr = yy_bp; yy_hold_char = *yy_cp; yy_c_buf_p = yy_cp; } #endif /* ifndef YY_NO_UNPUT */ #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput() #else #ifdef YY_USE_PROTOS static int input(void) #else static int input() #endif #endif { int c; *yy_c_buf_p = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* This was really a NUL. */ *yy_c_buf_p = '\0'; else { /* need more input */ int offset = yy_c_buf_p - yytext_ptr; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart( yyin ); /* fall through */ case EOB_ACT_END_OF_FILE: { if ( yywrap() ) return EOF; if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + offset; break; } } } c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ *yy_c_buf_p = '\0'; /* preserve yytext */ yy_hold_char = *++yy_c_buf_p; return c; } #endif /* ifndef YY_NO_INPUT */ #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) #else void yyrestart( input_file ) FILE *input_file; #endif { if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_init_buffer( yy_current_buffer, input_file ); yy_load_buffer_state(); } #ifdef YY_USE_PROTOS void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) #else void yy_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif { if ( yy_current_buffer == new_buffer ) return; if ( yy_current_buffer ) { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yy_did_buffer_switch_on_eof = 1; } #ifdef YY_USE_PROTOS void yy_load_buffer_state( void ) #else void yy_load_buffer_state() #endif { yy_n_chars = yy_current_buffer->yy_n_chars; yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; } #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) #else YY_BUFFER_STATE yy_create_buffer( file, size ) FILE *file; int size; #endif { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer( b, file ); return b; } #ifdef YY_USE_PROTOS void yy_delete_buffer( YY_BUFFER_STATE b ) #else void yy_delete_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; if ( b == yy_current_buffer ) yy_current_buffer = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yy_flex_free( (void *) b->yy_ch_buf ); yy_flex_free( (void *) b ); } #ifndef YY_ALWAYS_INTERACTIVE #ifndef YY_NEVER_INTERACTIVE extern int isatty YY_PROTO(( int )); #endif #endif #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) #else void yy_init_buffer( b, file ) YY_BUFFER_STATE b; FILE *file; #endif { yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; #if YY_ALWAYS_INTERACTIVE b->yy_is_interactive = 1; #else #if YY_NEVER_INTERACTIVE b->yy_is_interactive = 0; #else b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif } #ifdef YY_USE_PROTOS void yy_flush_buffer( YY_BUFFER_STATE b ) #else void yy_flush_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == yy_current_buffer ) yy_load_buffer_state(); } #ifndef YY_NO_SCAN_BUFFER #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) #else YY_BUFFER_STATE yy_scan_buffer( base, size ) char *base; yy_size_t size; #endif { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b ); return b; } #endif #ifndef YY_NO_SCAN_STRING #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) #else YY_BUFFER_STATE yy_scan_string( yy_str ) yyconst char *yy_str; #endif { int len; for ( len = 0; yy_str[len]; ++len ) ; return yy_scan_bytes( yy_str, len ); } #endif #ifndef YY_NO_SCAN_BYTES #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) #else YY_BUFFER_STATE yy_scan_bytes( bytes, len ) yyconst char *bytes; int len; #endif { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) yy_flex_alloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #endif #ifndef YY_NO_PUSH_STATE #ifdef YY_USE_PROTOS static void yy_push_state( int new_state ) #else static void yy_push_state( new_state ) int new_state; #endif { if ( yy_start_stack_ptr >= yy_start_stack_depth ) { yy_size_t new_size; yy_start_stack_depth += YY_START_STACK_INCR; new_size = yy_start_stack_depth * sizeof( int ); if ( ! yy_start_stack ) yy_start_stack = (int *) yy_flex_alloc( new_size ); else yy_start_stack = (int *) yy_flex_realloc( (void *) yy_start_stack, new_size ); if ( ! yy_start_stack ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); } #endif #ifndef YY_NO_POP_STATE #ifdef YY_USE_PROTOS static void yy_pop_state(void) #else static void yy_pop_state() #endif { if ( --yy_start_stack_ptr < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(yy_start_stack[yy_start_stack_ptr]); } #endif #ifndef YY_NO_TOP_STATE #ifdef YY_USE_PROTOS static int yy_top_state(void) #else static int yy_top_state() #endif { return yy_start_stack[yy_start_stack_ptr - 1]; } #endif #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif #ifdef YY_USE_PROTOS static void yy_fatal_error( yyconst char msg[] ) #else static void yy_fatal_error( msg ) char msg[]; #endif { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ yy_c_buf_p = yytext + n; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ } \ while ( 0 ) /* Internal utility routines. */ #ifndef yytext_ptr #ifdef YY_USE_PROTOS static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) #else static void yy_flex_strncpy( s1, s2, n ) char *s1; yyconst char *s2; int n; #endif { int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN #ifdef YY_USE_PROTOS static int yy_flex_strlen( yyconst char *s ) #else static int yy_flex_strlen( s ) yyconst char *s; #endif { int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #ifdef YY_USE_PROTOS static void *yy_flex_alloc( yy_size_t size ) #else static void *yy_flex_alloc( size ) yy_size_t size; #endif { return (void *) malloc( size ); } #ifdef YY_USE_PROTOS static void *yy_flex_realloc( void *ptr, yy_size_t size ) #else static void *yy_flex_realloc( ptr, size ) void *ptr; yy_size_t size; #endif { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } #ifdef YY_USE_PROTOS static void yy_flex_free( void *ptr ) #else static void yy_flex_free( ptr ) void *ptr; #endif { free( ptr ); } #if YY_MAIN int main() { yylex(); return 0; } #endif #line 441 "/usr/src/sys/modules/aic7xxx/aicasm/../../../dev/aic7xxx/aicasm/aicasm_scan.l" typedef struct include { YY_BUFFER_STATE buffer; int lineno; char *filename; SLIST_ENTRY(include) links; }include_t; SLIST_HEAD(, include) include_stack; void include_file(char *file_name, include_type type) { FILE *newfile; include_t *include; newfile = NULL; /* Try the current directory first */ if (includes_search_curdir != 0 || type == SOURCE_FILE) newfile = fopen(file_name, "r"); if (newfile == NULL && type != SOURCE_FILE) { path_entry_t include_dir; for (include_dir = search_path.slh_first; include_dir != NULL; include_dir = include_dir->links.sle_next) { char fullname[PATH_MAX]; if ((include_dir->quoted_includes_only == TRUE) && (type != QUOTED_INCLUDE)) continue; snprintf(fullname, sizeof(fullname), "%s/%s", include_dir->directory, file_name); if ((newfile = fopen(fullname, "r")) != NULL) break; } } if (newfile == NULL) { perror(file_name); stop("Unable to open input file", EX_SOFTWARE); /* NOTREACHED */ } if (type != SOURCE_FILE) { include = (include_t *)malloc(sizeof(include_t)); if (include == NULL) { stop("Unable to allocate include stack entry", EX_SOFTWARE); /* NOTREACHED */ } include->buffer = YY_CURRENT_BUFFER; include->lineno = yylineno; include->filename = yyfilename; SLIST_INSERT_HEAD(&include_stack, include, links); } yy_switch_to_buffer(yy_create_buffer(newfile, YY_BUF_SIZE)); yylineno = 1; yyfilename = strdup(file_name); } static void next_substitution(struct symbol *mac_symbol, const char *body_pos, const char **next_match, struct macro_arg **match_marg, regmatch_t *match); void expand_macro(struct symbol *macro_symbol) { struct macro_arg *marg; struct macro_arg *match_marg; const char *body_head; const char *body_pos; const char *next_match; regmatch_t match = { .rm_so = 0, .rm_eo = 0 }; /* * Due to the nature of unput, we must work * backwards through the macro body performing * any expansions. */ body_head = macro_symbol->info.macroinfo->body; body_pos = body_head + strlen(body_head); while (body_pos > body_head) { next_match = body_head; match_marg = NULL; next_substitution(macro_symbol, body_pos, &next_match, &match_marg, &match); /* Put back everything up until the replacement. */ while (body_pos > next_match) unput(*--body_pos); /* Perform the replacement. */ if (match_marg != NULL) { const char *strp; next_match = match_marg->replacement_text; strp = next_match + strlen(next_match); while (strp > next_match) unput(*--strp); /* Skip past the unexpanded macro arg. */ body_pos -= match.rm_eo - match.rm_so; } } /* Cleanup replacement text. */ STAILQ_FOREACH(marg, ¯o_symbol->info.macroinfo->args, links) { free(marg->replacement_text); } } /* * Find the next substitution in the macro working backwards from * body_pos until the beginning of the macro buffer. next_match * should be initialized to the beginning of the macro buffer prior * to calling this routine. */ static void next_substitution(struct symbol *mac_symbol, const char *body_pos, const char **next_match, struct macro_arg **match_marg, regmatch_t *match) { regmatch_t matches[2]; struct macro_arg *marg; const char *search_pos; int retval; do { search_pos = *next_match; STAILQ_FOREACH(marg, &mac_symbol->info.macroinfo->args, links) { retval = regexec(&marg->arg_regex, search_pos, 2, matches, 0); if (retval == 0 && (matches[1].rm_eo + search_pos) <= body_pos && (matches[1].rm_eo + search_pos) > *next_match) { *match = matches[1]; *next_match = match->rm_eo + search_pos; *match_marg = marg; } } } while (search_pos != *next_match); } int yywrap(void) { include_t *include; yy_delete_buffer(YY_CURRENT_BUFFER); (void)fclose(yyin); if (yyfilename != NULL) free(yyfilename); yyfilename = NULL; include = include_stack.slh_first; if (include != NULL) { yy_switch_to_buffer(include->buffer); yylineno = include->lineno; yyfilename = include->filename; SLIST_REMOVE_HEAD(&include_stack, links); free(include); return (0); } return (1); }