/* 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 $ */ #define FLEX_SCANNER #define BVL_Y__FLEX_MAJOR_VERSION 2 #define BVL_Y__FLEX_MINOR_VERSION 5 #include #include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include /* Use prototypes in function declarations. */ #define BVL_Y__USE_PROTOS /* The "const" storage-class-modifier is valid. */ #define BVL_Y__USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define BVL_Y__USE_PROTOS #define BVL_Y__USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch #pragma warn -use #include #include #define BVL_Y__USE_CONST #define BVL_Y__USE_PROTOS #endif #ifdef BVL_Y__USE_CONST #define bvl_y_const const #else #define bvl_y_const #endif #ifdef BVL_Y__USE_PROTOS #define BVL_Y__PROTO(proto) proto #else #define BVL_Y__PROTO(proto) () #endif /* Returned upon end-of-file. */ #define BVL_Y__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 BVL_Y__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 bvl_y__start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The BVL_Y_STATE alias is for lex * compatibility. */ #define BVL_Y__START ((bvl_y__start - 1) / 2) #define BVL_Y_STATE BVL_Y__START /* Action number for EOF rule of a given start state. */ #define BVL_Y__STATE_EOF(state) (BVL_Y__END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define BVL_Y__NEW_FILE bvl_y_restart( bvl_y_in ) #define BVL_Y__END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #define BVL_Y__BUF_SIZE 16384 typedef struct bvl_y__buffer_state *BVL_Y__BUFFER_STATE; extern int bvl_y_leng; extern FILE *bvl_y_in, *bvl_y_out; #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 ) * bvl_y_less( 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 bvl_y_less() call. */ /* Return all but the first 'n' matched characters back to the input stream. */ #define bvl_y_less(n) \ do \ { \ /* Undo effects of setting up bvl_y_text. */ \ *bvl_y__cp = bvl_y__hold_char; \ BVL_Y__RESTORE_BVL_Y__MORE_OFFSET \ bvl_y__c_buf_p = bvl_y__cp = bvl_y__bp + n - BVL_Y__MORE_ADJ; \ BVL_Y__DO_BEFORE_ACTION; /* set up bvl_y_text again */ \ } \ while ( 0 ) #define unput(c) bvl_y_unput( c, bvl_y_text_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 bvl_y__size_t; struct bvl_y__buffer_state { FILE *bvl_y__input_file; char *bvl_y__ch_buf; /* input buffer */ char *bvl_y__buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ bvl_y__size_t bvl_y__buf_size; /* Number of characters read into bvl_y__ch_buf, not including EOB * characters. */ int bvl_y__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 bvl_y__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 bvl_y__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 bvl_y__at_bol; /* Whether to try to fill the input buffer when we reach the * end of it. */ int bvl_y__fill_buffer; int bvl_y__buffer_status; #define BVL_Y__BUFFER_NEW 0 #define BVL_Y__BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as BVL_Y__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 bvl_y_restart()), so that the user can continue scanning by * just pointing bvl_y_in at a new input file. */ #define BVL_Y__BUFFER_EOF_PENDING 2 }; static BVL_Y__BUFFER_STATE bvl_y__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 BVL_Y__CURRENT_BUFFER bvl_y__current_buffer /* bvl_y__hold_char holds the character lost when bvl_y_text is formed. */ static char bvl_y__hold_char; static int bvl_y__n_chars; /* number of characters read into bvl_y__ch_buf */ int bvl_y_leng; /* Points to current character in buffer. */ static char *bvl_y__c_buf_p = (char *) 0; static int bvl_y__init = 1; /* whether we need to initialize */ static int bvl_y__start = 0; /* start state number */ /* Flag which is used to allow bvl_y_wrap()'s to do buffer switches * instead of setting up a fresh bvl_y_in. A bit of a hack ... */ static int bvl_y__did_buffer_switch_on_eof; void bvl_y_restart BVL_Y__PROTO(( FILE *input_file )); void bvl_y__switch_to_buffer BVL_Y__PROTO(( BVL_Y__BUFFER_STATE new_buffer )); void bvl_y__load_buffer_state BVL_Y__PROTO(( void )); BVL_Y__BUFFER_STATE bvl_y__create_buffer BVL_Y__PROTO(( FILE *file, int size )); void bvl_y__delete_buffer BVL_Y__PROTO(( BVL_Y__BUFFER_STATE b )); void bvl_y__init_buffer BVL_Y__PROTO(( BVL_Y__BUFFER_STATE b, FILE *file )); void bvl_y__flush_buffer BVL_Y__PROTO(( BVL_Y__BUFFER_STATE b )); #define BVL_Y__FLUSH_BUFFER bvl_y__flush_buffer( bvl_y__current_buffer ) BVL_Y__BUFFER_STATE bvl_y__scan_buffer BVL_Y__PROTO(( char *base, bvl_y__size_t size )); BVL_Y__BUFFER_STATE bvl_y__scan_string BVL_Y__PROTO(( bvl_y_const char *bvl_y__str )); BVL_Y__BUFFER_STATE bvl_y__scan_bytes BVL_Y__PROTO(( bvl_y_const char *bytes, int len )); static void *bvl_y__flex_alloc BVL_Y__PROTO(( bvl_y__size_t )); static void *bvl_y__flex_realloc BVL_Y__PROTO(( void *, bvl_y__size_t )); static void bvl_y__flex_free BVL_Y__PROTO(( void * )); #define bvl_y__new_buffer bvl_y__create_buffer #define bvl_y__set_interactive(is_interactive) \ { \ if ( ! bvl_y__current_buffer ) \ bvl_y__current_buffer = bvl_y__create_buffer( bvl_y_in, BVL_Y__BUF_SIZE ); \ bvl_y__current_buffer->bvl_y__is_interactive = is_interactive; \ } #define bvl_y__set_bol(at_bol) \ { \ if ( ! bvl_y__current_buffer ) \ bvl_y__current_buffer = bvl_y__create_buffer( bvl_y_in, BVL_Y__BUF_SIZE ); \ bvl_y__current_buffer->bvl_y__at_bol = at_bol; \ } #define BVL_Y__AT_BOL() (bvl_y__current_buffer->bvl_y__at_bol) typedef unsigned char BVL_Y__CHAR; FILE *bvl_y_in = (FILE *) 0, *bvl_y_out = (FILE *) 0; typedef int bvl_y__state_type; extern char *bvl_y_text; #define bvl_y_text_ptr bvl_y_text static bvl_y__state_type bvl_y__get_previous_state BVL_Y__PROTO(( void )); static bvl_y__state_type bvl_y__try_NUL_trans BVL_Y__PROTO(( bvl_y__state_type current_state )); static int bvl_y__get_next_buffer BVL_Y__PROTO(( void )); static void bvl_y__fatal_error BVL_Y__PROTO(( bvl_y_const char msg[] )); /* Done after the current pattern has been matched and before the * corresponding action - sets up bvl_y_text. */ #define BVL_Y__DO_BEFORE_ACTION \ bvl_y_text_ptr = bvl_y__bp; \ bvl_y_leng = (int) (bvl_y__cp - bvl_y__bp); \ bvl_y__hold_char = *bvl_y__cp; \ *bvl_y__cp = '\0'; \ bvl_y__c_buf_p = bvl_y__cp; #define BVL_Y__NUM_RULES 35 #define BVL_Y__END_OF_BUFFER 36 static bvl_y_const short int bvl_y__accept[105] = { 0, 0, 0, 36, 34, 2, 1, 24, 34, 34, 3, 4, 5, 6, 8, 9, 10, 11, 25, 26, 28, 13, 14, 17, 19, 18, 27, 27, 23, 0, 30, 0, 30, 0, 7, 0, 20, 0, 0, 28, 0, 0, 0, 12, 15, 22, 21, 16, 27, 0, 0, 0, 29, 0, 0, 33, 0, 0, 28, 0, 0, 28, 0, 0, 0, 28, 0, 0, 0, 28, 0, 0, 0, 28, 0, 28, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 0, 28, 0, 28, 0, 28, 0, 0, 0, 32, 0 } ; static bvl_y_const int bvl_y__ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 21, 22, 23, 24, 7, 7, 25, 26, 27, 27, 28, 27, 29, 30, 30, 30, 30, 30, 31, 30, 32, 33, 30, 34, 30, 30, 30, 30, 30, 35, 30, 30, 7, 7, 7, 7, 36, 7, 37, 38, 39, 39, 40, 39, 41, 42, 42, 42, 42, 42, 43, 42, 44, 45, 42, 46, 42, 42, 42, 42, 42, 47, 42, 42, 7, 48, 7, 7, 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 bvl_y_const int bvl_y__meta[49] = { 0, 1, 2, 1, 2, 3, 4, 2, 5, 2, 2, 2, 2, 2, 2, 2, 2, 6, 2, 7, 8, 2, 2, 2, 2, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9, 9, 10, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9, 9, 2 } ; static bvl_y_const short int bvl_y__base[123] = { 0, 0, 0, 255, 274, 274, 274, 274, 249, 243, 274, 0, 274, 274, 237, 274, 274, 232, 274, 222, 43, 221, 274, 27, 218, 218, 204, 48, 274, 232, 227, 223, 220, 204, 274, 52, 274, 0, 165, 53, 0, 50, 164, 274, 274, 274, 274, 274, 146, 145, 0, 0, 274, 177, 55, 274, 58, 59, 58, 70, 160, 55, 63, 44, 93, 73, 0, 97, 99, 83, 157, 0, 90, 80, 92, 96, 156, 274, 112, 116, 114, 117, 126, 120, 118, 107, 126, 128, 153, 122, 132, 138, 126, 127, 151, 130, 148, 141, 150, 142, 146, 161, 154, 274, 274, 184, 193, 202, 206, 216, 149, 130, 75, 71, 223, 228, 236, 242, 68, 60, 249, 253, 263 } ; static bvl_y_const short int bvl_y__def[123] = { 0, 104, 1, 104, 104, 104, 104, 104, 105, 106, 104, 107, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 108, 108, 104, 105, 104, 106, 104, 104, 104, 109, 104, 110, 104, 104, 111, 104, 104, 104, 104, 104, 104, 104, 108, 108, 112, 113, 104, 109, 109, 104, 109, 114, 104, 115, 104, 104, 116, 117, 109, 104, 118, 114, 114, 104, 104, 119, 115, 104, 115, 104, 104, 104, 116, 116, 117, 117, 109, 104, 120, 121, 104, 109, 104, 104, 120, 120, 121, 121, 104, 104, 109, 104, 104, 104, 104, 122, 122, 104, 0, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104 } ; static bvl_y_const short int bvl_y__nxt[323] = { 0, 4, 5, 6, 7, 8, 4, 4, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 26, 26, 26, 26, 26, 27, 26, 26, 27, 4, 26, 27, 26, 26, 26, 26, 26, 27, 26, 26, 27, 28, 37, 44, 45, 77, 50, 54, 55, 51, 54, 55, 37, 38, 55, 39, 40, 60, 65, 60, 85, 77, 61, 38, 41, 39, 40, 75, 84, 66, 69, 63, 42, 81, 41, 62, 41, 49, 56, 41, 71, 56, 42, 73, 76, 64, 41, 70, 68, 55, 56, 41, 79, 56, 83, 69, 65, 64, 104, 74, 71, 86, 104, 73, 41, 104, 83, 66, 75, 104, 77, 82, 70, 86, 104, 77, 41, 65, 104, 74, 73, 104, 55, 82, 55, 76, 68, 88, 104, 88, 59, 65, 89, 94, 97, 94, 93, 104, 95, 73, 104, 79, 99, 81, 55, 104, 104, 91, 87, 57, 103, 98, 96, 97, 99, 93, 104, 103, 99, 100, 87, 91, 97, 95, 96, 89, 101, 104, 75, 69, 98, 100, 61, 55, 104, 49, 39, 58, 101, 29, 29, 29, 29, 29, 29, 29, 29, 29, 31, 31, 31, 31, 31, 31, 31, 31, 31, 33, 33, 33, 33, 33, 33, 33, 33, 33, 48, 52, 48, 48, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 67, 31, 67, 67, 32, 29, 67, 72, 72, 72, 30, 72, 78, 49, 47, 46, 78, 43, 36, 78, 80, 35, 80, 34, 32, 80, 90, 30, 104, 90, 104, 104, 90, 92, 92, 104, 92, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 3, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104 } ; static bvl_y_const short int bvl_y__chk[323] = { 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, 20, 23, 23, 63, 27, 35, 35, 27, 54, 54, 39, 20, 56, 20, 20, 41, 57, 41, 119, 62, 41, 39, 20, 39, 39, 61, 118, 57, 58, 113, 20, 63, 39, 112, 20, 27, 35, 58, 59, 54, 39, 59, 61, 56, 39, 58, 57, 64, 35, 58, 62, 54, 65, 69, 67, 56, 68, 59, 72, 73, 74, 72, 69, 74, 65, 67, 75, 68, 78, 64, 69, 73, 79, 80, 69, 84, 81, 72, 85, 74, 82, 64, 87, 75, 67, 83, 68, 83, 111, 90, 83, 86, 89, 86, 85, 91, 86, 92, 93, 78, 95, 80, 96, 79, 81, 84, 82, 110, 102, 89, 87, 97, 99, 92, 93, 101, 100, 95, 82, 90, 98, 94, 87, 88, 96, 91, 76, 70, 97, 99, 60, 53, 49, 48, 42, 38, 96, 105, 105, 105, 105, 105, 105, 105, 105, 105, 106, 106, 106, 106, 106, 106, 106, 106, 106, 107, 107, 107, 107, 107, 107, 107, 107, 107, 108, 33, 108, 108, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 114, 32, 114, 114, 31, 30, 114, 115, 115, 115, 29, 115, 116, 26, 25, 24, 116, 21, 19, 116, 117, 17, 117, 14, 9, 117, 120, 8, 3, 120, 0, 0, 120, 121, 121, 0, 121, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104 } ; static bvl_y__state_type bvl_y__last_accepting_state; static char *bvl_y__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 bvl_y_more() bvl_y_more_used_but_not_detected #define BVL_Y__MORE_ADJ 0 #define BVL_Y__RESTORE_BVL_Y__MORE_OFFSET char *bvl_y_text; #line 1 "../../../src/abv/src/bvl_bcomp_l.l" #define INITIAL 0 /*------------------------------------------------------------\ | | | This file is part of the Alliance CAD System Copyright | | (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| | | | Home page : http://www-asim.lip6.fr/alliance/ | | E-mail : mailto:alliance-users@asim.lip6.fr | | | | This progam is free software; you can redistribute it | | and/or modify it under the terms of the GNU Library General| | Public License as published by the Free Software Foundation | | either version 2 of the License, or (at your option) any | | later version. | | | | Alliance VLSI CAD System is distributed in the hope that | | it will be useful, but WITHOUT ANY WARRANTY; | | without even the implied warranty of MERCHANTABILITY or | | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | | Public License for more details. | | | | You should have received a copy of the GNU General Public | | License along with the GNU C Library; see the file COPYING. | | If not, write to the Free Software Foundation, Inc., | | 675 Mass Ave, Cambridge, MA 02139, USA. | | | \------------------------------------------------------------*/ #line 28 "../../../src/abv/src/bvl_bcomp_l.l" #include #include #include #include "mut.h" #include "abl.h" #include "abe.h" typedef struct bvl_expr { char *IDENT; /* identifier or constant name */ struct chain *LIST_ABL; /* pointer on bvl_abllst list */ short WIDTH; /* width of bit vector */ } bvl_ablstr; typedef struct { char *NAME; /* identifier name */ short LEFT; /* vector's left index */ short RIGHT; /* vector's right index */ char FLAG; } bvl_name; struct g_type { int VALU; char FLAG; }; #include "bvl_bcomp_y.h" #include "bvl_blex.h" /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef BVL_Y__SKIP_BVL_Y_WRAP #ifdef __cplusplus extern "C" int bvl_y_wrap BVL_Y__PROTO(( void )); #else extern int bvl_y_wrap BVL_Y__PROTO(( void )); #endif #endif #ifndef BVL_Y__NO_UNPUT static void bvl_y_unput BVL_Y__PROTO(( int c, char *buf_ptr )); #endif #ifndef bvl_y_text_ptr static void bvl_y__flex_strncpy BVL_Y__PROTO(( char *, bvl_y_const char *, int )); #endif #ifdef BVL_Y__NEED_STRLEN static int bvl_y__flex_strlen BVL_Y__PROTO(( bvl_y_const char * )); #endif #ifndef BVL_Y__NO_INPUT #ifdef __cplusplus static int bvl_y_input BVL_Y__PROTO(( void )); #else static int input BVL_Y__PROTO(( void )); #endif #endif #if BVL_Y__STACK_USED static int bvl_y__start_stack_ptr = 0; static int bvl_y__start_stack_depth = 0; static int *bvl_y__start_stack = 0; #ifndef BVL_Y__NO_PUSH_STATE static void bvl_y__push_state BVL_Y__PROTO(( int new_state )); #endif #ifndef BVL_Y__NO_POP_STATE static void bvl_y__pop_state BVL_Y__PROTO(( void )); #endif #ifndef BVL_Y__NO_TOP_STATE static int bvl_y__top_state BVL_Y__PROTO(( void )); #endif #else #define BVL_Y__NO_PUSH_STATE 1 #define BVL_Y__NO_POP_STATE 1 #define BVL_Y__NO_TOP_STATE 1 #endif #ifdef BVL_Y__MALLOC_DECL BVL_Y__MALLOC_DECL #else #if __STDC__ #ifndef __cplusplus #include #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 BVL_Y__READ_BUF_SIZE #define BVL_Y__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( bvl_y_text, bvl_y_leng, 1, bvl_y_out ) #endif /* Gets input and stuffs it into "buf". number of characters read, or BVL_Y__NULL, * is returned in "result". */ #ifndef BVL_Y__INPUT #define BVL_Y__INPUT(buf,result,max_size) \ if ( bvl_y__current_buffer->bvl_y__is_interactive ) \ { \ int c = '*', n; \ for ( n = 0; n < max_size && \ (c = getc( bvl_y_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( bvl_y_in ) ) \ BVL_Y__FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else if ( ((result = fread( buf, 1, max_size, bvl_y_in )) == 0) \ && ferror( bvl_y_in ) ) \ BVL_Y__FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "bvl_y_terminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef bvl_y_terminate #define bvl_y_terminate() return BVL_Y__NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef BVL_Y__START_STACK_INCR #define BVL_Y__START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef BVL_Y__FATAL_ERROR #define BVL_Y__FATAL_ERROR(msg) bvl_y__fatal_error( msg ) #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef BVL_Y__DECL #define BVL_Y__DECL int bvl_y_lex BVL_Y__PROTO(( void )) #endif /* Code executed at the beginning of each rule, after bvl_y_text and bvl_y_leng * have been set up. */ #ifndef BVL_Y__USER_ACTION #define BVL_Y__USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef BVL_Y__BREAK #define BVL_Y__BREAK break; #endif #define BVL_Y__RULE_SETUP \ BVL_Y__USER_ACTION BVL_Y__DECL { register bvl_y__state_type bvl_y__current_state; register char *bvl_y__cp = NULL, *bvl_y__bp = NULL; register int bvl_y__act; #line 84 "../../../src/abv/src/bvl_bcomp_l.l" if ( bvl_y__init ) { bvl_y__init = 0; #ifdef BVL_Y__USER_INIT BVL_Y__USER_INIT; #endif if ( ! bvl_y__start ) bvl_y__start = 1; /* first start state */ if ( ! bvl_y_in ) bvl_y_in = stdin; if ( ! bvl_y_out ) bvl_y_out = stdout; if ( ! bvl_y__current_buffer ) bvl_y__current_buffer = bvl_y__create_buffer( bvl_y_in, BVL_Y__BUF_SIZE ); bvl_y__load_buffer_state(); } while ( 1 ) /* loops until end-of-file is reached */ { bvl_y__cp = bvl_y__c_buf_p; /* Support of bvl_y_text. */ *bvl_y__cp = bvl_y__hold_char; /* bvl_y__bp points to the position in bvl_y__ch_buf of the start of * the current run. */ bvl_y__bp = bvl_y__cp; bvl_y__current_state = bvl_y__start; bvl_y__match: do { register BVL_Y__CHAR bvl_y__c = bvl_y__ec[BVL_Y__SC_TO_UI(*bvl_y__cp)]; if ( bvl_y__accept[bvl_y__current_state] ) { bvl_y__last_accepting_state = bvl_y__current_state; bvl_y__last_accepting_cpos = bvl_y__cp; } while ( bvl_y__chk[bvl_y__base[bvl_y__current_state] + bvl_y__c] != bvl_y__current_state ) { bvl_y__current_state = (int) bvl_y__def[bvl_y__current_state]; if ( bvl_y__current_state >= 105 ) bvl_y__c = bvl_y__meta[(unsigned int) bvl_y__c]; } bvl_y__current_state = bvl_y__nxt[bvl_y__base[bvl_y__current_state] + (unsigned int) bvl_y__c]; ++bvl_y__cp; } while ( bvl_y__base[bvl_y__current_state] != 274 ); bvl_y__find_action: bvl_y__act = bvl_y__accept[bvl_y__current_state]; if ( bvl_y__act == 0 ) { /* have to back up */ bvl_y__cp = bvl_y__last_accepting_cpos; bvl_y__current_state = bvl_y__last_accepting_state; bvl_y__act = bvl_y__accept[bvl_y__current_state]; } BVL_Y__DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( bvl_y__act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of BVL_Y__DO_BEFORE_ACTION */ *bvl_y__cp = bvl_y__hold_char; bvl_y__cp = bvl_y__last_accepting_cpos; bvl_y__current_state = bvl_y__last_accepting_state; goto bvl_y__find_action; case 1: BVL_Y__RULE_SETUP #line 85 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("Newline\n");*/ BVL_LINNUM++; } BVL_Y__BREAK case 2: BVL_Y__RULE_SETUP #line 89 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("space\n");*/ } BVL_Y__BREAK case 3: BVL_Y__RULE_SETUP #line 92 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("Ampersand\n");*/ return(Ampersand); } BVL_Y__BREAK case 4: BVL_Y__RULE_SETUP #line 96 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("Apostrophe\n");*/ return(Apostrophe); } BVL_Y__BREAK case 5: BVL_Y__RULE_SETUP #line 100 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("LeftParen\n");*/ return(LeftParen); } BVL_Y__BREAK case 6: BVL_Y__RULE_SETUP #line 104 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("RightParen\n");*/ return(RightParen); } BVL_Y__BREAK case 7: BVL_Y__RULE_SETUP #line 108 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("DoubleStar\n");*/ return(DoubleStar); } BVL_Y__BREAK case 8: BVL_Y__RULE_SETUP #line 112 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("Star\n");*/ return(Star); } BVL_Y__BREAK case 9: BVL_Y__RULE_SETUP #line 116 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("Plus\n");*/ return(Plus); } BVL_Y__BREAK case 10: BVL_Y__RULE_SETUP #line 120 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("Comma\n");*/ return(Comma); } BVL_Y__BREAK case 11: BVL_Y__RULE_SETUP #line 124 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("Minus\n");*/ return(Minus); } BVL_Y__BREAK case 12: BVL_Y__RULE_SETUP #line 128 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("VarAsgn\n");*/ return(VarAsgn); } BVL_Y__BREAK case 13: BVL_Y__RULE_SETUP #line 132 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("Colon\n");*/ return(Colon); } BVL_Y__BREAK case 14: BVL_Y__RULE_SETUP #line 136 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("Semicolon\n");*/ return(Semicolon); } BVL_Y__BREAK case 15: BVL_Y__RULE_SETUP #line 140 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("_LESym\n");*/ return(_LESym); } BVL_Y__BREAK case 16: BVL_Y__RULE_SETUP #line 144 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("_GESym\n");*/ return(_GESym); } BVL_Y__BREAK case 17: BVL_Y__RULE_SETUP #line 148 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("_LTSym\n");*/ return(_LTSym); } BVL_Y__BREAK case 18: BVL_Y__RULE_SETUP #line 152 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("_GTSym\n");*/ return(_GTSym); } BVL_Y__BREAK case 19: BVL_Y__RULE_SETUP #line 156 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("_EQSym\n");*/ return(_EQSym); } BVL_Y__BREAK case 20: BVL_Y__RULE_SETUP #line 160 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("_NESym\n");*/ return(_NESym); } BVL_Y__BREAK case 21: BVL_Y__RULE_SETUP #line 164 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("Arrow\n");*/ return(Arrow); } BVL_Y__BREAK case 22: BVL_Y__RULE_SETUP #line 168 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("Box\n");*/ return(Box); } BVL_Y__BREAK case 23: BVL_Y__RULE_SETUP #line 172 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("Bar\n");*/ return(Bar); } BVL_Y__BREAK case 24: BVL_Y__RULE_SETUP #line 176 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("Bar\n");*/ return(Bar); } BVL_Y__BREAK case 25: BVL_Y__RULE_SETUP #line 180 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("Dot\n");*/ return(Dot); } BVL_Y__BREAK case 26: BVL_Y__RULE_SETUP #line 184 "../../../src/abv/src/bvl_bcomp_l.l" { /*printf ("Slash\n");*/ return(Slash); } BVL_Y__BREAK case 27: BVL_Y__RULE_SETUP #line 189 "../../../src/abv/src/bvl_bcomp_l.l" { int itoken; itoken = search (bvl_y_text); if (itoken == EMPTYHT) { bvl_y_lval.text = namealloc (bvl_y_text); /*printf ("Identifier : %s\n", bvl_y_text);*/ return (Identifier); } else { /*printf ("Key word : %s\n", bvl_y_text);*/ return (itoken); } } BVL_Y__BREAK case 28: BVL_Y__RULE_SETUP #line 205 "../../../src/abv/src/bvl_bcomp_l.l" { bvl_y_lval.text = mbkalloc ((unsigned int)strlen(bvl_y_text)+1); strcpy (bvl_y_lval.text, bvl_y_text); return (AbstractLit); } BVL_Y__BREAK case 29: BVL_Y__RULE_SETUP #line 210 "../../../src/abv/src/bvl_bcomp_l.l" { bvl_y_lval.text = namealloc (bvl_y_text); return (CharacterLit); } BVL_Y__BREAK case 30: BVL_Y__RULE_SETUP #line 214 "../../../src/abv/src/bvl_bcomp_l.l" { bvl_y_lval.text = namealloc (bvl_y_text); return (StringLit); } BVL_Y__BREAK case 31: BVL_Y__RULE_SETUP #line 218 "../../../src/abv/src/bvl_bcomp_l.l" { bvl_y_lval.text = namealloc (bvl_y_text); return (BitStringLit); } BVL_Y__BREAK case 32: *bvl_y__cp = bvl_y__hold_char; /* undo effects of setting up bvl_y_text */ bvl_y__c_buf_p = bvl_y__cp -= 1; BVL_Y__DO_BEFORE_ACTION; /* set up bvl_y_text again */ BVL_Y__RULE_SETUP #line 223 "../../../src/abv/src/bvl_bcomp_l.l" { bvl_y_lval.text = namealloc(bvl_y_text); return( PRAGMA ); } BVL_Y__BREAK case 33: *bvl_y__cp = bvl_y__hold_char; /* undo effects of setting up bvl_y_text */ bvl_y__c_buf_p = bvl_y__cp -= 1; BVL_Y__DO_BEFORE_ACTION; /* set up bvl_y_text again */ BVL_Y__RULE_SETUP #line 227 "../../../src/abv/src/bvl_bcomp_l.l" BVL_Y__BREAK case 34: BVL_Y__RULE_SETUP #line 231 "../../../src/abv/src/bvl_bcomp_l.l" { return (*bvl_y_text); } BVL_Y__BREAK case 35: BVL_Y__RULE_SETUP #line 234 "../../../src/abv/src/bvl_bcomp_l.l" ECHO; BVL_Y__BREAK case BVL_Y__STATE_EOF(INITIAL): bvl_y_terminate(); case BVL_Y__END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int bvl_y__amount_of_matched_text = (int) (bvl_y__cp - bvl_y_text_ptr) - 1; /* Undo the effects of BVL_Y__DO_BEFORE_ACTION. */ *bvl_y__cp = bvl_y__hold_char; BVL_Y__RESTORE_BVL_Y__MORE_OFFSET if ( bvl_y__current_buffer->bvl_y__buffer_status == BVL_Y__BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed bvl_y_in at a new source and called * bvl_y_lex(). If so, then we have to assure * consistency between bvl_y__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. */ bvl_y__n_chars = bvl_y__current_buffer->bvl_y__n_chars; bvl_y__current_buffer->bvl_y__input_file = bvl_y_in; bvl_y__current_buffer->bvl_y__buffer_status = BVL_Y__BUFFER_NORMAL; } /* Note that here we test for bvl_y__c_buf_p "<=" to the position * of the first EOB in the buffer, since bvl_y__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 ( bvl_y__c_buf_p <= &bvl_y__current_buffer->bvl_y__ch_buf[bvl_y__n_chars] ) { /* This was really a NUL. */ bvl_y__state_type bvl_y__next_state; bvl_y__c_buf_p = bvl_y_text_ptr + bvl_y__amount_of_matched_text; bvl_y__current_state = bvl_y__get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * bvl_y__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). */ bvl_y__next_state = bvl_y__try_NUL_trans( bvl_y__current_state ); bvl_y__bp = bvl_y_text_ptr + BVL_Y__MORE_ADJ; if ( bvl_y__next_state ) { /* Consume the NUL. */ bvl_y__cp = ++bvl_y__c_buf_p; bvl_y__current_state = bvl_y__next_state; goto bvl_y__match; } else { bvl_y__cp = bvl_y__c_buf_p; goto bvl_y__find_action; } } else switch ( bvl_y__get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { bvl_y__did_buffer_switch_on_eof = 0; if ( bvl_y_wrap() ) { /* Note: because we've taken care in * bvl_y__get_next_buffer() to have set up * bvl_y_text, we can now set up * bvl_y__c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * BVL_Y__NULL, it'll still work - another * BVL_Y__NULL will get returned. */ bvl_y__c_buf_p = bvl_y_text_ptr + BVL_Y__MORE_ADJ; bvl_y__act = BVL_Y__STATE_EOF(BVL_Y__START); goto do_action; } else { if ( ! bvl_y__did_buffer_switch_on_eof ) BVL_Y__NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: bvl_y__c_buf_p = bvl_y_text_ptr + bvl_y__amount_of_matched_text; bvl_y__current_state = bvl_y__get_previous_state(); bvl_y__cp = bvl_y__c_buf_p; bvl_y__bp = bvl_y_text_ptr + BVL_Y__MORE_ADJ; goto bvl_y__match; case EOB_ACT_LAST_MATCH: bvl_y__c_buf_p = &bvl_y__current_buffer->bvl_y__ch_buf[bvl_y__n_chars]; bvl_y__current_state = bvl_y__get_previous_state(); bvl_y__cp = bvl_y__c_buf_p; bvl_y__bp = bvl_y_text_ptr + BVL_Y__MORE_ADJ; goto bvl_y__find_action; } break; } default: BVL_Y__FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of bvl_y_lex */ /* bvl_y__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 */ static int bvl_y__get_next_buffer() { register char *dest = bvl_y__current_buffer->bvl_y__ch_buf; register char *source = bvl_y_text_ptr; register int number_to_move, i; int ret_val; if ( bvl_y__c_buf_p > &bvl_y__current_buffer->bvl_y__ch_buf[bvl_y__n_chars + 1] ) BVL_Y__FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( bvl_y__current_buffer->bvl_y__fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( bvl_y__c_buf_p - bvl_y_text_ptr - BVL_Y__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) (bvl_y__c_buf_p - bvl_y_text_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( bvl_y__current_buffer->bvl_y__buffer_status == BVL_Y__BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ bvl_y__current_buffer->bvl_y__n_chars = bvl_y__n_chars = 0; else { int num_to_read = bvl_y__current_buffer->bvl_y__buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ #ifdef BVL_Y__USES_REJECT BVL_Y__FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else /* just a shorter name for the current buffer */ BVL_Y__BUFFER_STATE b = bvl_y__current_buffer; int bvl_y__c_buf_p_offset = (int) (bvl_y__c_buf_p - b->bvl_y__ch_buf); if ( b->bvl_y__is_our_buffer ) { int new_size = b->bvl_y__buf_size * 2; if ( new_size <= 0 ) b->bvl_y__buf_size += b->bvl_y__buf_size / 8; else b->bvl_y__buf_size *= 2; b->bvl_y__ch_buf = (char *) /* Include room in for 2 EOB chars. */ bvl_y__flex_realloc( (void *) b->bvl_y__ch_buf, b->bvl_y__buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->bvl_y__ch_buf = 0; if ( ! b->bvl_y__ch_buf ) BVL_Y__FATAL_ERROR( "fatal error - scanner input buffer overflow" ); bvl_y__c_buf_p = &b->bvl_y__ch_buf[bvl_y__c_buf_p_offset]; num_to_read = bvl_y__current_buffer->bvl_y__buf_size - number_to_move - 1; #endif } if ( num_to_read > BVL_Y__READ_BUF_SIZE ) num_to_read = BVL_Y__READ_BUF_SIZE; /* Read in more data. */ BVL_Y__INPUT( (&bvl_y__current_buffer->bvl_y__ch_buf[number_to_move]), bvl_y__n_chars, num_to_read ); bvl_y__current_buffer->bvl_y__n_chars = bvl_y__n_chars; } if ( bvl_y__n_chars == 0 ) { if ( number_to_move == BVL_Y__MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; bvl_y_restart( bvl_y_in ); } else { ret_val = EOB_ACT_LAST_MATCH; bvl_y__current_buffer->bvl_y__buffer_status = BVL_Y__BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; bvl_y__n_chars += number_to_move; bvl_y__current_buffer->bvl_y__ch_buf[bvl_y__n_chars] = BVL_Y__END_OF_BUFFER_CHAR; bvl_y__current_buffer->bvl_y__ch_buf[bvl_y__n_chars + 1] = BVL_Y__END_OF_BUFFER_CHAR; bvl_y_text_ptr = &bvl_y__current_buffer->bvl_y__ch_buf[0]; return ret_val; } /* bvl_y__get_previous_state - get the state just before the EOB char was reached */ static bvl_y__state_type bvl_y__get_previous_state() { register bvl_y__state_type bvl_y__current_state; register char *bvl_y__cp; bvl_y__current_state = bvl_y__start; for ( bvl_y__cp = bvl_y_text_ptr + BVL_Y__MORE_ADJ; bvl_y__cp < bvl_y__c_buf_p; ++bvl_y__cp ) { register BVL_Y__CHAR bvl_y__c = (*bvl_y__cp ? bvl_y__ec[BVL_Y__SC_TO_UI(*bvl_y__cp)] : 1); if ( bvl_y__accept[bvl_y__current_state] ) { bvl_y__last_accepting_state = bvl_y__current_state; bvl_y__last_accepting_cpos = bvl_y__cp; } while ( bvl_y__chk[bvl_y__base[bvl_y__current_state] + bvl_y__c] != bvl_y__current_state ) { bvl_y__current_state = (int) bvl_y__def[bvl_y__current_state]; if ( bvl_y__current_state >= 105 ) bvl_y__c = bvl_y__meta[(unsigned int) bvl_y__c]; } bvl_y__current_state = bvl_y__nxt[bvl_y__base[bvl_y__current_state] + (unsigned int) bvl_y__c]; } return bvl_y__current_state; } /* bvl_y__try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = bvl_y__try_NUL_trans( current_state ); */ #ifdef BVL_Y__USE_PROTOS static bvl_y__state_type bvl_y__try_NUL_trans( bvl_y__state_type bvl_y__current_state ) #else static bvl_y__state_type bvl_y__try_NUL_trans( bvl_y__current_state ) bvl_y__state_type bvl_y__current_state; #endif { register int bvl_y__is_jam; register char *bvl_y__cp = bvl_y__c_buf_p; register BVL_Y__CHAR bvl_y__c = 1; if ( bvl_y__accept[bvl_y__current_state] ) { bvl_y__last_accepting_state = bvl_y__current_state; bvl_y__last_accepting_cpos = bvl_y__cp; } while ( bvl_y__chk[bvl_y__base[bvl_y__current_state] + bvl_y__c] != bvl_y__current_state ) { bvl_y__current_state = (int) bvl_y__def[bvl_y__current_state]; if ( bvl_y__current_state >= 105 ) bvl_y__c = bvl_y__meta[(unsigned int) bvl_y__c]; } bvl_y__current_state = bvl_y__nxt[bvl_y__base[bvl_y__current_state] + (unsigned int) bvl_y__c]; bvl_y__is_jam = (bvl_y__current_state == 104); return bvl_y__is_jam ? 0 : bvl_y__current_state; } #ifndef BVL_Y__NO_UNPUT #ifdef BVL_Y__USE_PROTOS static void bvl_y_unput( int c, register char *bvl_y__bp ) #else static void bvl_y_unput( c, bvl_y__bp ) int c; register char *bvl_y__bp; #endif { register char *bvl_y__cp = bvl_y__c_buf_p; /* undo effects of setting up bvl_y_text */ *bvl_y__cp = bvl_y__hold_char; if ( bvl_y__cp < bvl_y__current_buffer->bvl_y__ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = bvl_y__n_chars + 2; register char *dest = &bvl_y__current_buffer->bvl_y__ch_buf[ bvl_y__current_buffer->bvl_y__buf_size + 2]; register char *source = &bvl_y__current_buffer->bvl_y__ch_buf[number_to_move]; while ( source > bvl_y__current_buffer->bvl_y__ch_buf ) *--dest = *--source; bvl_y__cp += (int) (dest - source); bvl_y__bp += (int) (dest - source); bvl_y__current_buffer->bvl_y__n_chars = bvl_y__n_chars = bvl_y__current_buffer->bvl_y__buf_size; if ( bvl_y__cp < bvl_y__current_buffer->bvl_y__ch_buf + 2 ) BVL_Y__FATAL_ERROR( "flex scanner push-back overflow" ); } *--bvl_y__cp = (char) c; bvl_y_text_ptr = bvl_y__bp; bvl_y__hold_char = *bvl_y__cp; bvl_y__c_buf_p = bvl_y__cp; } #endif /* ifndef BVL_Y__NO_UNPUT */ #ifndef BVL_Y__NO_INPUT #ifdef __cplusplus static int bvl_y_input() #else static int input() #endif { int c; *bvl_y__c_buf_p = bvl_y__hold_char; if ( *bvl_y__c_buf_p == BVL_Y__END_OF_BUFFER_CHAR ) { /* bvl_y__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 ( bvl_y__c_buf_p < &bvl_y__current_buffer->bvl_y__ch_buf[bvl_y__n_chars] ) /* This was really a NUL. */ *bvl_y__c_buf_p = '\0'; else { /* need more input */ int offset = bvl_y__c_buf_p - bvl_y_text_ptr; ++bvl_y__c_buf_p; switch ( bvl_y__get_next_buffer() ) { case EOB_ACT_LAST_MATCH: /* This happens because bvl_y__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. */ bvl_y_restart( bvl_y_in ); /* fall through */ case EOB_ACT_END_OF_FILE: { if ( bvl_y_wrap() ) return EOF; if ( ! bvl_y__did_buffer_switch_on_eof ) BVL_Y__NEW_FILE; #ifdef __cplusplus return bvl_y_input(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: bvl_y__c_buf_p = bvl_y_text_ptr + offset; break; } } } c = *(unsigned char *) bvl_y__c_buf_p; /* cast for 8-bit char's */ *bvl_y__c_buf_p = '\0'; /* preserve bvl_y_text */ bvl_y__hold_char = *++bvl_y__c_buf_p; return c; } #endif /* BVL_Y__NO_INPUT */ #ifdef BVL_Y__USE_PROTOS void bvl_y_restart( FILE *input_file ) #else void bvl_y_restart( input_file ) FILE *input_file; #endif { if ( ! bvl_y__current_buffer ) bvl_y__current_buffer = bvl_y__create_buffer( bvl_y_in, BVL_Y__BUF_SIZE ); bvl_y__init_buffer( bvl_y__current_buffer, input_file ); bvl_y__load_buffer_state(); } #ifdef BVL_Y__USE_PROTOS void bvl_y__switch_to_buffer( BVL_Y__BUFFER_STATE new_buffer ) #else void bvl_y__switch_to_buffer( new_buffer ) BVL_Y__BUFFER_STATE new_buffer; #endif { if ( bvl_y__current_buffer == new_buffer ) return; if ( bvl_y__current_buffer ) { /* Flush out information for old buffer. */ *bvl_y__c_buf_p = bvl_y__hold_char; bvl_y__current_buffer->bvl_y__buf_pos = bvl_y__c_buf_p; bvl_y__current_buffer->bvl_y__n_chars = bvl_y__n_chars; } bvl_y__current_buffer = new_buffer; bvl_y__load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (bvl_y_wrap()) processing, but the only time this flag * is looked at is after bvl_y_wrap() is called, so it's safe * to go ahead and always set it. */ bvl_y__did_buffer_switch_on_eof = 1; } #ifdef BVL_Y__USE_PROTOS void bvl_y__load_buffer_state( void ) #else void bvl_y__load_buffer_state() #endif { bvl_y__n_chars = bvl_y__current_buffer->bvl_y__n_chars; bvl_y_text_ptr = bvl_y__c_buf_p = bvl_y__current_buffer->bvl_y__buf_pos; bvl_y_in = bvl_y__current_buffer->bvl_y__input_file; bvl_y__hold_char = *bvl_y__c_buf_p; } #ifdef BVL_Y__USE_PROTOS BVL_Y__BUFFER_STATE bvl_y__create_buffer( FILE *file, int size ) #else BVL_Y__BUFFER_STATE bvl_y__create_buffer( file, size ) FILE *file; int size; #endif { BVL_Y__BUFFER_STATE b; b = (BVL_Y__BUFFER_STATE) bvl_y__flex_alloc( sizeof( struct bvl_y__buffer_state ) ); if ( ! b ) BVL_Y__FATAL_ERROR( "out of dynamic memory in bvl_y__create_buffer()" ); b->bvl_y__buf_size = size; /* bvl_y__ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->bvl_y__ch_buf = (char *) bvl_y__flex_alloc( b->bvl_y__buf_size + 2 ); if ( ! b->bvl_y__ch_buf ) BVL_Y__FATAL_ERROR( "out of dynamic memory in bvl_y__create_buffer()" ); b->bvl_y__is_our_buffer = 1; bvl_y__init_buffer( b, file ); return b; } #ifdef BVL_Y__USE_PROTOS void bvl_y__delete_buffer( BVL_Y__BUFFER_STATE b ) #else void bvl_y__delete_buffer( b ) BVL_Y__BUFFER_STATE b; #endif { if ( ! b ) return; if ( b == bvl_y__current_buffer ) bvl_y__current_buffer = (BVL_Y__BUFFER_STATE) 0; if ( b->bvl_y__is_our_buffer ) bvl_y__flex_free( (void *) b->bvl_y__ch_buf ); bvl_y__flex_free( (void *) b ); } #ifdef BVL_Y__USE_PROTOS void bvl_y__init_buffer( BVL_Y__BUFFER_STATE b, FILE *file ) #else void bvl_y__init_buffer( b, file ) BVL_Y__BUFFER_STATE b; FILE *file; #endif { bvl_y__flush_buffer( b ); b->bvl_y__input_file = file; b->bvl_y__fill_buffer = 1; #if BVL_Y__ALWAYS_INTERACTIVE b->bvl_y__is_interactive = 1; #else #if BVL_Y__NEVER_INTERACTIVE b->bvl_y__is_interactive = 0; #else b->bvl_y__is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif } #ifdef BVL_Y__USE_PROTOS void bvl_y__flush_buffer( BVL_Y__BUFFER_STATE b ) #else void bvl_y__flush_buffer( b ) BVL_Y__BUFFER_STATE b; #endif { if ( ! b ) return; b->bvl_y__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->bvl_y__ch_buf[0] = BVL_Y__END_OF_BUFFER_CHAR; b->bvl_y__ch_buf[1] = BVL_Y__END_OF_BUFFER_CHAR; b->bvl_y__buf_pos = &b->bvl_y__ch_buf[0]; b->bvl_y__at_bol = 1; b->bvl_y__buffer_status = BVL_Y__BUFFER_NEW; if ( b == bvl_y__current_buffer ) bvl_y__load_buffer_state(); } #ifndef BVL_Y__NO_SCAN_BUFFER #ifdef BVL_Y__USE_PROTOS BVL_Y__BUFFER_STATE bvl_y__scan_buffer( char *base, bvl_y__size_t size ) #else BVL_Y__BUFFER_STATE bvl_y__scan_buffer( base, size ) char *base; bvl_y__size_t size; #endif { BVL_Y__BUFFER_STATE b; if ( size < 2 || base[size-2] != BVL_Y__END_OF_BUFFER_CHAR || base[size-1] != BVL_Y__END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (BVL_Y__BUFFER_STATE) bvl_y__flex_alloc( sizeof( struct bvl_y__buffer_state ) ); if ( ! b ) BVL_Y__FATAL_ERROR( "out of dynamic memory in bvl_y__scan_buffer()" ); b->bvl_y__buf_size = size - 2; /* "- 2" to take care of EOB's */ b->bvl_y__buf_pos = b->bvl_y__ch_buf = base; b->bvl_y__is_our_buffer = 0; b->bvl_y__input_file = 0; b->bvl_y__n_chars = b->bvl_y__buf_size; b->bvl_y__is_interactive = 0; b->bvl_y__at_bol = 1; b->bvl_y__fill_buffer = 0; b->bvl_y__buffer_status = BVL_Y__BUFFER_NEW; bvl_y__switch_to_buffer( b ); return b; } #endif #ifndef BVL_Y__NO_SCAN_STRING #ifdef BVL_Y__USE_PROTOS BVL_Y__BUFFER_STATE bvl_y__scan_string( bvl_y_const char *bvl_y__str ) #else BVL_Y__BUFFER_STATE bvl_y__scan_string( bvl_y__str ) bvl_y_const char *bvl_y__str; #endif { int len; for ( len = 0; bvl_y__str[len]; ++len ) ; return bvl_y__scan_bytes( bvl_y__str, len ); } #endif #ifndef BVL_Y__NO_SCAN_BYTES #ifdef BVL_Y__USE_PROTOS BVL_Y__BUFFER_STATE bvl_y__scan_bytes( bvl_y_const char *bytes, int len ) #else BVL_Y__BUFFER_STATE bvl_y__scan_bytes( bytes, len ) bvl_y_const char *bytes; int len; #endif { BVL_Y__BUFFER_STATE b; char *buf; bvl_y__size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) bvl_y__flex_alloc( n ); if ( ! buf ) BVL_Y__FATAL_ERROR( "out of dynamic memory in bvl_y__scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = BVL_Y__END_OF_BUFFER_CHAR; b = bvl_y__scan_buffer( buf, n ); if ( ! b ) BVL_Y__FATAL_ERROR( "bad buffer in bvl_y__scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->bvl_y__is_our_buffer = 1; return b; } #endif #ifndef BVL_Y__NO_PUSH_STATE #ifdef BVL_Y__USE_PROTOS static void bvl_y__push_state( int new_state ) #else static void bvl_y__push_state( new_state ) int new_state; #endif { if ( bvl_y__start_stack_ptr >= bvl_y__start_stack_depth ) { bvl_y__size_t new_size; bvl_y__start_stack_depth += BVL_Y__START_STACK_INCR; new_size = bvl_y__start_stack_depth * sizeof( int ); if ( ! bvl_y__start_stack ) bvl_y__start_stack = (int *) bvl_y__flex_alloc( new_size ); else bvl_y__start_stack = (int *) bvl_y__flex_realloc( (void *) bvl_y__start_stack, new_size ); if ( ! bvl_y__start_stack ) BVL_Y__FATAL_ERROR( "out of memory expanding start-condition stack" ); } bvl_y__start_stack[bvl_y__start_stack_ptr++] = BVL_Y__START; BEGIN(new_state); } #endif #ifndef BVL_Y__NO_POP_STATE static void bvl_y__pop_state() { if ( --bvl_y__start_stack_ptr < 0 ) BVL_Y__FATAL_ERROR( "start-condition stack underflow" ); BEGIN(bvl_y__start_stack[bvl_y__start_stack_ptr]); } #endif #ifndef BVL_Y__NO_TOP_STATE static int bvl_y__top_state() { return bvl_y__start_stack[bvl_y__start_stack_ptr - 1]; } #endif #ifndef BVL_Y__EXIT_FAILURE #define BVL_Y__EXIT_FAILURE 2 #endif #ifdef BVL_Y__USE_PROTOS static void bvl_y__fatal_error( bvl_y_const char msg[] ) #else static void bvl_y__fatal_error( msg ) char msg[]; #endif { (void) fprintf( stderr, "%s\n", msg ); exit( BVL_Y__EXIT_FAILURE ); } /* Redefine bvl_y_less() so it works in section 3 code. */ #undef bvl_y_less #define bvl_y_less(n) \ do \ { \ /* Undo effects of setting up bvl_y_text. */ \ bvl_y_text[bvl_y_leng] = bvl_y__hold_char; \ bvl_y__c_buf_p = bvl_y_text + n; \ bvl_y__hold_char = *bvl_y__c_buf_p; \ *bvl_y__c_buf_p = '\0'; \ bvl_y_leng = n; \ } \ while ( 0 ) /* Internal utility routines. */ #ifndef bvl_y_text_ptr #ifdef BVL_Y__USE_PROTOS static void bvl_y__flex_strncpy( char *s1, bvl_y_const char *s2, int n ) #else static void bvl_y__flex_strncpy( s1, s2, n ) char *s1; bvl_y_const char *s2; int n; #endif { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef BVL_Y__NEED_STRLEN #ifdef BVL_Y__USE_PROTOS static int bvl_y__flex_strlen( bvl_y_const char *s ) #else static int bvl_y__flex_strlen( s ) bvl_y_const char *s; #endif { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #ifdef BVL_Y__USE_PROTOS static void *bvl_y__flex_alloc( bvl_y__size_t size ) #else static void *bvl_y__flex_alloc( size ) bvl_y__size_t size; #endif { return (void *) malloc( size ); } #ifdef BVL_Y__USE_PROTOS static void *bvl_y__flex_realloc( void *ptr, bvl_y__size_t size ) #else static void *bvl_y__flex_realloc( ptr, size ) void *ptr; bvl_y__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 BVL_Y__USE_PROTOS static void bvl_y__flex_free( void *ptr ) #else static void bvl_y__flex_free( ptr ) void *ptr; #endif { free( ptr ); } #if BVL_Y__MAIN int main() { bvl_y_lex(); return 0; } #endif #line 234 "../../../src/abv/src/bvl_bcomp_l.l" /* ###--------------------------------------------------------------### */ /* function : bvl_y_wrap */ /* description : return 1 */ /* called func. : none */ /* ###--------------------------------------------------------------### */ int bvl_y_wrap () { return (1); } /* ###--------------------------------------------------------------### */ /* function : search */ /* description : check that an identifier is a reserved word or not */ /* called func. : addht, addhtitem, gethtitem, namealloc */ /* ###--------------------------------------------------------------### */ static int search (key) char *key; { static ht *pt_hash = NULL; if (pt_hash == NULL) { pt_hash = addht (107); addhtitem (pt_hash, namealloc("abs") , ABS ); addhtitem (pt_hash, namealloc("access") , ACCESS ); addhtitem (pt_hash, namealloc("after") , AFTER ); addhtitem (pt_hash, namealloc("alias") , ALIAS ); addhtitem (pt_hash, namealloc("all") , ALL ); addhtitem (pt_hash, namealloc("and") , tok_AND ); addhtitem (pt_hash, namealloc("architecture") , ARCHITECTURE ); addhtitem (pt_hash, namealloc("array") , ARRAY ); addhtitem (pt_hash, namealloc("assert") , ASSERT ); addhtitem (pt_hash, namealloc("attribute") , ATTRIBUTE ); addhtitem (pt_hash, namealloc("begin") , _BEGIN ); addhtitem (pt_hash, namealloc("bit") , BIT ); addhtitem (pt_hash, namealloc("bit_vector") , BIT_VECTOR ); addhtitem (pt_hash, namealloc("block") , _BLOCK ); addhtitem (pt_hash, namealloc("body") , BODY ); addhtitem (pt_hash, namealloc("buffer") , BUFFER ); addhtitem (pt_hash, namealloc("bus") , BUS ); addhtitem (pt_hash, namealloc("case") , CASE ); addhtitem (pt_hash, namealloc("component") , COMPONENT ); addhtitem (pt_hash, namealloc("configuration"), CONFIGURATION); addhtitem (pt_hash, namealloc("constant") , CONSTANT ); addhtitem (pt_hash, namealloc("disconnect") , DISCONNECT ); addhtitem (pt_hash, namealloc("downto") , DOWNTO ); addhtitem (pt_hash, namealloc("else") , ELSE ); addhtitem (pt_hash, namealloc("elsif") , ELSIF ); addhtitem (pt_hash, namealloc("end") , _END ); addhtitem (pt_hash, namealloc("entity") , ENTITY ); addhtitem (pt_hash, namealloc("error") , ERROR ); addhtitem (pt_hash, namealloc("exit") , _EXIT ); addhtitem (pt_hash, namealloc("file") , _FILE ); addhtitem (pt_hash, namealloc("for") , FOR ); addhtitem (pt_hash, namealloc("function") , FUNCTION ); addhtitem (pt_hash, namealloc("generate") , GENERATE ); addhtitem (pt_hash, namealloc("generic") , GENERIC ); addhtitem (pt_hash, namealloc("guarded") , GUARDED ); addhtitem (pt_hash, namealloc("if") , IF ); addhtitem (pt_hash, namealloc("in") , _IN ); addhtitem (pt_hash, namealloc("inout") , _INOUT ); addhtitem (pt_hash, namealloc("is") , IS ); addhtitem (pt_hash, namealloc("label") , _LABEL ); addhtitem (pt_hash, namealloc("library") , LIBRARY ); addhtitem (pt_hash, namealloc("linkage") , _LINKAGE ); addhtitem (pt_hash, namealloc("loop") , LOOP ); addhtitem (pt_hash, namealloc("map") , MAP ); addhtitem (pt_hash, namealloc("mod") , MOD ); addhtitem (pt_hash, namealloc("ms") , _MS ); addhtitem (pt_hash, namealloc("mux_bit") , MUX_BIT ); addhtitem (pt_hash, namealloc("mux_vector") , MUX_VECTOR ); addhtitem (pt_hash, namealloc("nand") , _NAND ); addhtitem (pt_hash, namealloc("natural") , NATURAL ); addhtitem (pt_hash, namealloc("new") , NEW ); addhtitem (pt_hash, namealloc("next") , _NEXT ); addhtitem (pt_hash, namealloc("nor") , _NOR ); addhtitem (pt_hash, namealloc("not") , _NOT ); addhtitem (pt_hash, namealloc("ns") , _NS ); addhtitem (pt_hash, namealloc("null") , tok_NULL ); addhtitem (pt_hash, namealloc("of") , OF ); addhtitem (pt_hash, namealloc("on") , ON ); addhtitem (pt_hash, namealloc("open") , OPEN ); addhtitem (pt_hash, namealloc("or") , _OR ); addhtitem (pt_hash, namealloc("others") , OTHERS ); addhtitem (pt_hash, namealloc("out") , _OUT ); addhtitem (pt_hash, namealloc("package") , _PACKAGE ); addhtitem (pt_hash, namealloc("port") , PORT ); addhtitem (pt_hash, namealloc("procedure") , PROCEDURE ); addhtitem (pt_hash, namealloc("process") , PROCESS ); addhtitem (pt_hash, namealloc("ps") , _PS ); addhtitem (pt_hash, namealloc("range") , RANGE ); addhtitem (pt_hash, namealloc("record") , RECORD ); addhtitem (pt_hash, namealloc("reg_bit") , REG_BIT ); addhtitem (pt_hash, namealloc("reg_vector") , REG_VECTOR ); addhtitem (pt_hash, namealloc("register") , REGISTER ); addhtitem (pt_hash, namealloc("rem") , REM ); addhtitem (pt_hash, namealloc("report") , REPORT ); addhtitem (pt_hash, namealloc("return") , RETURN ); addhtitem (pt_hash, namealloc("select") , SELECT ); addhtitem (pt_hash, namealloc("severity") , SEVERITY ); addhtitem (pt_hash, namealloc("signal") , SIGNAL ); addhtitem (pt_hash, namealloc("stable") , _STABLE ); addhtitem (pt_hash, namealloc("subtype") , SUBTYPE ); addhtitem (pt_hash, namealloc("then") , THEN ); addhtitem (pt_hash, namealloc("to") , TO ); addhtitem (pt_hash, namealloc("transport") , TRANSPORT ); addhtitem (pt_hash, namealloc("type") , _TYPE ); addhtitem (pt_hash, namealloc("units") , UNITS ); addhtitem (pt_hash, namealloc("until") , UNTIL ); addhtitem (pt_hash, namealloc("us") , _US ); addhtitem (pt_hash, namealloc("use") , USE ); addhtitem (pt_hash, namealloc("variable") , VARIABLE ); addhtitem (pt_hash, namealloc("wait") , WAIT ); addhtitem (pt_hash, namealloc("warning") , WARNING ); addhtitem (pt_hash, namealloc("when") , WHEN ); addhtitem (pt_hash, namealloc("while") , WHILE ); addhtitem (pt_hash, namealloc("with") , WITH ); addhtitem (pt_hash, namealloc("wor_bit") , WOR_BIT ); addhtitem (pt_hash, namealloc("wor_vector") , WOR_VECTOR ); addhtitem (pt_hash, namealloc("xor") , _XOR ); } return (gethtitem (pt_hash, namealloc(key))); }