#line 3 "" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 35 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include #include #include #include /* end standard C headers. */ /* flex integer type definitions */ #ifndef FLEXINT_H #define FLEXINT_H /* C99 systems have . Non-C99 systems may or may not. */ #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, * if you want the limit (max/min) macros for int types. */ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN #define INT8_MIN (-128) #endif #ifndef INT16_MIN #define INT16_MIN (-32767-1) #endif #ifndef INT32_MIN #define INT32_MIN (-2147483647-1) #endif #ifndef INT8_MAX #define INT8_MAX (127) #endif #ifndef INT16_MAX #define INT16_MAX (32767) #endif #ifndef INT32_MAX #define INT32_MAX (2147483647) #endif #ifndef UINT8_MAX #define UINT8_MAX (255U) #endif #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #ifndef UINT32_MAX #define UINT32_MAX (4294967295U) #endif #endif /* ! FLEXINT_H */ #ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ /* C99 requires __STDC__ to be defined as 1. */ #if defined (__STDC__) #define YY_USE_CONST #endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define cifpconst const #else #define cifpconst #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 (cifp_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 (((cifp_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 cifprestart(cifpin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 #endif /* The state buf must be large enough to hold one state per character in the main buffer. */ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(cifp_state_type)) #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct cifp_buffer_state *YY_BUFFER_STATE; #endif extern int cifpleng; extern FILE *cifpin, *cifpout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) /* Return all but the first "n" matched characters back to the input stream. */ #define cifpless(n) \ do \ { \ /* Undo effects of setting up cifptext. */ \ int cifpless_macro_arg = (n); \ YY_LESS_LINENO(cifpless_macro_arg);\ *cifp_cp = (cifp_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (cifp_c_buf_p) = cifp_cp = cifp_bp + cifpless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up cifptext again */ \ } \ while ( 0 ) #define unput(c) cifpunput( c, (cifptext_ptr) ) #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t cifp_size_t; #endif #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct cifp_buffer_state { FILE *cifp_input_file; char *cifp_ch_buf; /* input buffer */ char *cifp_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ cifp_size_t cifp_buf_size; /* Number of characters read into cifp_ch_buf, not including EOB * characters. */ int cifp_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 cifp_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 cifp_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 cifp_at_bol; int cifp_bs_lineno; /**< The line count. */ int cifp_bs_column; /**< The column count. */ /* Whether to try to fill the input buffer when we reach the * end of it. */ int cifp_fill_buffer; int cifp_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 cifprestart()), so that the user can continue scanning by * just pointing cifpin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ static size_t cifp_buffer_stack_top = 0; /**< index of top of stack. */ static size_t cifp_buffer_stack_max = 0; /**< capacity of stack. */ static YY_BUFFER_STATE * cifp_buffer_stack = 0; /**< Stack as an array. */ /* 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". * * Returns the top of the stack, or NULL. */ #define YY_CURRENT_BUFFER ( (cifp_buffer_stack) \ ? (cifp_buffer_stack)[(cifp_buffer_stack_top)] \ : NULL) /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (cifp_buffer_stack)[(cifp_buffer_stack_top)] /* cifp_hold_char holds the character lost when cifptext is formed. */ static char cifp_hold_char; static int cifp_n_chars; /* number of characters read into cifp_ch_buf */ int cifpleng; /* Points to current character in buffer. */ static char *cifp_c_buf_p = (char *) 0; static int cifp_init = 0; /* whether we need to initialize */ static int cifp_start = 0; /* start state number */ /* Flag which is used to allow cifpwrap()'s to do buffer switches * instead of setting up a fresh cifpin. A bit of a hack ... */ static int cifp_did_buffer_switch_on_eof; void cifprestart (FILE *input_file ); void cifp_switch_to_buffer (YY_BUFFER_STATE new_buffer ); YY_BUFFER_STATE cifp_create_buffer (FILE *file,int size ); void cifp_delete_buffer (YY_BUFFER_STATE b ); void cifp_flush_buffer (YY_BUFFER_STATE b ); void cifppush_buffer_state (YY_BUFFER_STATE new_buffer ); void cifppop_buffer_state (void ); static void cifpensure_buffer_stack (void ); static void cifp_load_buffer_state (void ); static void cifp_init_buffer (YY_BUFFER_STATE b,FILE *file ); #define YY_FLUSH_BUFFER cifp_flush_buffer(YY_CURRENT_BUFFER ) YY_BUFFER_STATE cifp_scan_buffer (char *base,cifp_size_t size ); YY_BUFFER_STATE cifp_scan_string (cifpconst char *cifp_str ); YY_BUFFER_STATE cifp_scan_bytes (cifpconst char *bytes,int len ); void *cifpalloc (cifp_size_t ); void *cifprealloc (void *,cifp_size_t ); void cifpfree (void * ); #define cifp_new_buffer cifp_create_buffer #define cifp_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ cifpensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ cifp_create_buffer(cifpin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->cifp_is_interactive = is_interactive; \ } #define cifp_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ cifpensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ cifp_create_buffer(cifpin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->cifp_at_bol = at_bol; \ } #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->cifp_at_bol) /* Begin user sect3 */ typedef unsigned char YY_CHAR; FILE *cifpin = (FILE *) 0, *cifpout = (FILE *) 0; typedef int cifp_state_type; extern int cifplineno; int cifplineno = 1; extern char *cifptext; #define cifptext_ptr cifptext static cifp_state_type cifp_get_previous_state (void ); static cifp_state_type cifp_try_NUL_trans (cifp_state_type current_state ); static int cifp_get_next_buffer (void ); static void cifp_fatal_error (cifpconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up cifptext. */ #define YY_DO_BEFORE_ACTION \ (cifptext_ptr) = cifp_bp; \ (cifptext_ptr) -= (cifp_more_len); \ cifpleng = (size_t) (cifp_cp - (cifptext_ptr)); \ (cifp_hold_char) = *cifp_cp; \ *cifp_cp = '\0'; \ (cifp_c_buf_p) = cifp_cp; #define YY_NUM_RULES 12 #define YY_END_OF_BUFFER 13 /* This struct is not used in this scanner, but its presence is necessary. */ struct cifp_trans_info { flex_int32_t cifp_verify; flex_int32_t cifp_nxt; }; static cifpconst flex_int16_t cifp_accept[46] = { 0, 0, 0, 13, 9, 3, 1, 9, 9, 9, 6, 9, 9, 12, 2, 9, 9, 3, 1, 9, 0, 0, 9, 9, 0, 7, 9, 0, 0, 9, 9, 9, 8, 9, 11, 10, 9, 9, 2, 2, 9, 9, 4, 5, 4, 0 } ; static cifpconst flex_int32_t cifp_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, 1, 4, 5, 1, 1, 1, 6, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 1, 1, 1, 9, 1, 10, 1, 1, 11, 1, 1, 1, 1, 1, 1, 1, 12, 1, 1, 13, 14, 1, 1, 1, 15, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 17, 1, 10, 1, 1, 11, 1, 1, 1, 1, 1, 1, 1, 12, 1, 1, 13, 14, 1, 1, 1, 15, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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 cifpconst flex_int32_t cifp_meta[18] = { 0, 1, 2, 2, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static cifpconst flex_int16_t cifp_base[57] = { 0, 0, 10, 96, 0, 92, 69, 25, 17, 28, 0, 55, 49, 0, 0, 53, 0, 58, 97, 33, 18, 21, 30, 36, 56, 97, 38, 39, 44, 46, 40, 41, 0, 48, 97, 97, 43, 38, 55, 0, 26, 8, 0, 0, 0, 97, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 92 } ; static cifpconst flex_int16_t cifp_def[57] = { 0, 45, 1, 45, 46, 45, 45, 47, 48, 49, 46, 46, 46, 50, 46, 46, 46, 45, 45, 47, 51, 45, 46, 48, 52, 45, 49, 53, 45, 46, 46, 46, 50, 54, 45, 45, 46, 46, 54, 55, 46, 46, 56, 46, 56, 0, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45 } ; static cifpconst flex_int16_t cifp_nxt[115] = { 0, 4, 5, 6, 7, 8, 9, 10, 4, 10, 4, 11, 12, 4, 4, 4, 4, 13, 14, 24, 25, 21, 21, 34, 34, 43, 15, 20, 21, 22, 27, 28, 34, 34, 29, 20, 21, 22, 24, 25, 27, 28, 28, 42, 29, 28, 35, 35, 35, 35, 39, 39, 41, 40, 37, 36, 16, 39, 39, 25, 17, 33, 31, 16, 16, 30, 16, 19, 19, 19, 23, 23, 23, 26, 26, 26, 32, 18, 32, 20, 20, 20, 24, 24, 24, 27, 27, 27, 38, 38, 38, 39, 39, 44, 17, 44, 45, 3, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45 } ; static cifpconst flex_int16_t cifp_chk[115] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 8, 8, 20, 20, 21, 21, 41, 2, 7, 7, 7, 9, 9, 22, 22, 9, 19, 19, 19, 23, 23, 26, 26, 27, 40, 26, 27, 28, 28, 29, 29, 33, 33, 37, 36, 31, 30, 33, 38, 38, 24, 17, 15, 12, 38, 46, 11, 46, 47, 47, 47, 48, 48, 48, 49, 49, 49, 50, 6, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, 55, 55, 56, 5, 56, 3, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45 } ; static cifp_state_type cifp_last_accepting_state; static char *cifp_last_accepting_cpos; extern int cifp_flex_debug; int cifp_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected static int cifp_more_flag = 0; static int cifp_more_len = 0; #define cifpmore() ((cifp_more_flag) = 1) #define YY_MORE_ADJ (cifp_more_len) #define YY_RESTORE_YY_MORE_OFFSET char *cifptext; #line 1 "cifparse.l" #line 2 "cifparse.l" /* COPYRIGHT 1996 Rutgers - The State University of New Jersey This software is provided WITHOUT WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR ANY OTHER WARRANTY, EXPRESS OR IMPLIED. RUTGERS MAKE NO REPRESENTATION OR WARRANTY THAT THE SOFTWARE WILL NOT INFRINGE ANY PATENT, COPYRIGHT OR OTHER PROPRIETARY RIGHT. The user of this software shall indemnify, hold harmless and defend Rutgers, its governors, trustees, officers, employees, students, agents and the authors against any and all claims, suits, losses, liabilities, damages, costs, fees, and expenses including reasonable attorneys' fees resulting from or arising out of the use of this software. This indemnification shall include, but is not limited to, any and all claims alleging products liability. This software may be used only for not-for-profit educational and research purposes. */ /* FILE: ndb_cifparse_lex.l This file is part of the NDBQUERY application, a program component of the Nucleic Acid Database Project. H. M. Berman, W. K. Olson, D. L. Beveridge, J. K. Westbrook, A. Gelbin, T. Demeny, S. H. Shieh, A. R. Srinivasan, and B. Schneider. (1992). The Nucleic Acid Database: A Comprehensive Relational Database of Three-Dimensional Structures of Nucleic Acids. Biophys J., 63, 751- 759. Questions about this software should be directed to: ndbadmin@ndbserver.rutgers.edu PURPOSE: DDL 2.1 compliant CIF file lexer ... Modified to allow multiple lexers in single program, support flex, etc. by D.A. Case, 12/97 */ /*$$LICENSE-NDB$$*/ #include #include #include #include "cifparse.h" #include "cifp.tab.h" /* * Local prototypes */ static void alt_cifpmore(); static void delete_punctuation(); static char tbuf[MAXVALUELENGTH+1]; /* * Local static variables ... */ static int isText = FALSE; static int i, j; static int buflen; #line 560 "" #define INITIAL 0 #ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include #endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * #endif static int cifp_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ int cifplex_destroy (void ); int cifpget_debug (void ); void cifpset_debug (int debug_flag ); YY_EXTRA_TYPE cifpget_extra (void ); void cifpset_extra (YY_EXTRA_TYPE user_defined ); FILE *cifpget_in (void ); void cifpset_in (FILE * in_str ); FILE *cifpget_out (void ); void cifpset_out (FILE * out_str ); int cifpget_leng (void ); char *cifpget_text (void ); int cifpget_lineno (void ); void cifpset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int cifpwrap (void ); #else extern int cifpwrap (void ); #endif #endif static void cifpunput (int c,char *buf_ptr ); #ifndef cifptext_ptr static void cifp_flex_strncpy (char *,cifpconst char *,int ); #endif #ifdef YY_NEED_STRLEN static int cifp_flex_strlen (cifpconst char * ); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int cifpinput (void ); #else static int input (void ); #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 do { if (fwrite( cifptext, cifpleng, 1, cifpout )) {} } while (0) #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_LVALUE->cifp_is_interactive ) \ { \ int c = '*'; \ unsigned n; \ for ( n = 0; n < max_size && \ (c = getc( cifpin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( cifpin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, cifpin))==0 && ferror(cifpin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(cifpin); \ } \ }\ \ #endif /* No semi-colon after return; correct usage is to write "cifpterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef cifpterminate #define cifpterminate() 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) cifp_fatal_error( msg ) #endif /* end tables serialization structures and prototypes */ /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 extern int cifplex (void); #define YY_DECL int cifplex (void) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after cifptext and cifpleng * 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 \ if ( cifpleng > 0 ) \ YY_CURRENT_BUFFER_LVALUE->cifp_at_bol = \ (cifptext[cifpleng - 1] == '\n'); \ YY_USER_ACTION /** The main scanner function which does all the work. */ YY_DECL { register cifp_state_type cifp_current_state; register char *cifp_cp, *cifp_bp; register int cifp_act; #line 71 "cifparse.l" #line 747 "" if ( !(cifp_init) ) { (cifp_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! (cifp_start) ) (cifp_start) = 1; /* first start state */ if ( ! cifpin ) cifpin = stdin; if ( ! cifpout ) cifpout = stdout; if ( ! YY_CURRENT_BUFFER ) { cifpensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = cifp_create_buffer(cifpin,YY_BUF_SIZE ); } cifp_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { (cifp_more_len) = 0; if ( (cifp_more_flag) ) { (cifp_more_len) = (cifp_c_buf_p) - (cifptext_ptr); (cifp_more_flag) = 0; } cifp_cp = (cifp_c_buf_p); /* Support of cifptext. */ *cifp_cp = (cifp_hold_char); /* cifp_bp points to the position in cifp_ch_buf of the start of * the current run. */ cifp_bp = cifp_cp; cifp_current_state = (cifp_start); cifp_current_state += YY_AT_BOL(); cifp_match: do { register YY_CHAR cifp_c = cifp_ec[YY_SC_TO_UI(*cifp_cp)]; if ( cifp_accept[cifp_current_state] ) { (cifp_last_accepting_state) = cifp_current_state; (cifp_last_accepting_cpos) = cifp_cp; } while ( cifp_chk[cifp_base[cifp_current_state] + cifp_c] != cifp_current_state ) { cifp_current_state = (int) cifp_def[cifp_current_state]; if ( cifp_current_state >= 46 ) cifp_c = cifp_meta[(unsigned int) cifp_c]; } cifp_current_state = cifp_nxt[cifp_base[cifp_current_state] + (unsigned int) cifp_c]; ++cifp_cp; } while ( cifp_base[cifp_current_state] != 97 ); cifp_find_action: cifp_act = cifp_accept[cifp_current_state]; if ( cifp_act == 0 ) { /* have to back up */ cifp_cp = (cifp_last_accepting_cpos); cifp_current_state = (cifp_last_accepting_state); cifp_act = cifp_accept[cifp_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( cifp_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *cifp_cp = (cifp_hold_char); cifp_cp = (cifp_last_accepting_cpos); cifp_current_state = (cifp_last_accepting_state); goto cifp_find_action; case 1: /* rule 1 can match eol */ YY_RULE_SETUP #line 72 "cifparse.l" { /* New Lines */ lineNo++; if (cifptext[cifpleng-1] == ';') { if (isText == TRUE) { /* end of text value */ strncat(tbuf,cifptext,MAXVALUELENGTH); buflen = strlen(tbuf); delete_punctuation(cifplval.TempBuffer,tbuf,&buflen); isText = FALSE; return(VALUE); } else { /* text value begins */ isText = TRUE; strcpy(tbuf,""); } } if (isText == TRUE) alt_cifpmore(); } YY_BREAK case 2: /* rule 2 can match eol */ YY_RULE_SETUP #line 89 "cifparse.l" { /* multi-line text value */ if (cifptext[0] == ';' && cifptext[cifpleng-1] != '\n') { /* text value begins*/ isText = TRUE; strncpy(tbuf,cifptext,MAXVALUELENGTH); } else { isText = FALSE; strncat(tbuf,cifptext,MAXVALUELENGTH); buflen = strlen(tbuf); for (i=0; i= 0; i--) { if ( cifptext[i] == '\'' || cifptext[i] == '\"') { cifptext[i]='\0'; break; } else break; } for (i=0; i < cifpleng; i++) { if (cifptext[i] == '\'' || cifptext[i] == '\"') { j++; break; } else break; } strncpy(cifplval.TempBuffer, &cifptext[j],MAXVALUELENGTH); return(VALUE); } else { alt_cifpmore(); } } YY_BREAK case 10: /* rule 10 can match eol */ YY_RULE_SETUP #line 176 "cifparse.l" { /* Single Quoted Strings */ if (!isText) { j=0; for (i=cifpleng-1; i >= 0; i--) { if ( cifptext[i] == ' ' || cifptext[i] == '\t' || cifptext[i] == '\n') cifptext[i]='\0'; else if ( cifptext[i] == '\'') { cifptext[i]='\0'; break; } else break; } for (i=0; i < cifpleng; i++) { if ( cifptext[i] == ' ' || cifptext[i] == '\t') j++; else if (cifptext[i] == '\'') { j++; break; } else break; } strncpy(cifplval.TempBuffer, &cifptext[j],MAXVALUELENGTH); return(VALUE); } else { alt_cifpmore(); if (cifptext[cifpleng-1] == '\n') unput('\n'); } } YY_BREAK case 11: /* rule 11 can match eol */ YY_RULE_SETUP #line 210 "cifparse.l" { /* Double Quoted Strings */ if (!isText) { j=0; for (i=cifpleng-1; i >= 0; i--) { if ( cifptext[i] == ' ' || cifptext[i] == '\t' || cifptext[i] == '\n') cifptext[i]='\0'; else if ( cifptext[i] == '\"') { cifptext[i]='\0'; break; } else break; } for (i=0; i < cifpleng; i++) { if ( cifptext[i] == ' ' || cifptext[i] == '\t') j++; else if (cifptext[i] == '\"') { j++; break; } else break; } strncpy(cifplval.TempBuffer, &cifptext[j], MAXVALUELENGTH); return(VALUE); } else { alt_cifpmore(); if (cifptext[cifpleng-1] == '\n') unput('\n'); } } YY_BREAK case 12: YY_RULE_SETUP #line 241 "cifparse.l" ECHO; YY_BREAK #line 1046 "" case YY_STATE_EOF(INITIAL): cifpterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int cifp_amount_of_matched_text = (int) (cifp_cp - (cifptext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *cifp_cp = (cifp_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->cifp_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 cifpin at a new source and called * cifplex(). 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. */ (cifp_n_chars) = YY_CURRENT_BUFFER_LVALUE->cifp_n_chars; YY_CURRENT_BUFFER_LVALUE->cifp_input_file = cifpin; YY_CURRENT_BUFFER_LVALUE->cifp_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for cifp_c_buf_p "<=" to the position * of the first EOB in the buffer, since cifp_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 ( (cifp_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf[(cifp_n_chars)] ) { /* This was really a NUL. */ cifp_state_type cifp_next_state; (cifp_c_buf_p) = (cifptext_ptr) + cifp_amount_of_matched_text; cifp_current_state = cifp_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * cifp_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). */ cifp_next_state = cifp_try_NUL_trans( cifp_current_state ); cifp_bp = (cifptext_ptr) + YY_MORE_ADJ; if ( cifp_next_state ) { /* Consume the NUL. */ cifp_cp = ++(cifp_c_buf_p); cifp_current_state = cifp_next_state; goto cifp_match; } else { cifp_cp = (cifp_c_buf_p); goto cifp_find_action; } } else switch ( cifp_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { (cifp_did_buffer_switch_on_eof) = 0; if ( cifpwrap( ) ) { /* Note: because we've taken care in * cifp_get_next_buffer() to have set up * cifptext, we can now set up * cifp_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. */ (cifp_c_buf_p) = (cifptext_ptr) + YY_MORE_ADJ; cifp_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! (cifp_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: (cifp_c_buf_p) = (cifptext_ptr) + cifp_amount_of_matched_text; cifp_current_state = cifp_get_previous_state( ); cifp_cp = (cifp_c_buf_p); cifp_bp = (cifptext_ptr) + YY_MORE_ADJ; goto cifp_match; case EOB_ACT_LAST_MATCH: (cifp_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf[(cifp_n_chars)]; cifp_current_state = cifp_get_previous_state( ); cifp_cp = (cifp_c_buf_p); cifp_bp = (cifptext_ptr) + YY_MORE_ADJ; goto cifp_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 cifplex */ /* cifp_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 cifp_get_next_buffer (void) { register char *dest = YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf; register char *source = (cifptext_ptr); register int number_to_move, i; int ret_val; if ( (cifp_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf[(cifp_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( YY_CURRENT_BUFFER_LVALUE->cifp_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( (cifp_c_buf_p) - (cifptext_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) ((cifp_c_buf_p) - (cifptext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->cifp_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_LVALUE->cifp_n_chars = (cifp_n_chars) = 0; else { int num_to_read = YY_CURRENT_BUFFER_LVALUE->cifp_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int cifp_c_buf_p_offset = (int) ((cifp_c_buf_p) - b->cifp_ch_buf); if ( b->cifp_is_our_buffer ) { int new_size = b->cifp_buf_size * 2; if ( new_size <= 0 ) b->cifp_buf_size += b->cifp_buf_size / 8; else b->cifp_buf_size *= 2; b->cifp_ch_buf = (char *) /* Include room in for 2 EOB chars. */ cifprealloc((void *) b->cifp_ch_buf,b->cifp_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->cifp_ch_buf = 0; if ( ! b->cifp_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); (cifp_c_buf_p) = &b->cifp_ch_buf[cifp_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->cifp_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf[number_to_move]), (cifp_n_chars), (size_t) num_to_read ); YY_CURRENT_BUFFER_LVALUE->cifp_n_chars = (cifp_n_chars); } if ( (cifp_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; cifprestart(cifpin ); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->cifp_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((cifp_size_t) ((cifp_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->cifp_buf_size) { /* Extend the array by 50%, plus the number we really need. */ cifp_size_t new_size = (cifp_n_chars) + number_to_move + ((cifp_n_chars) >> 1); YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf = (char *) cifprealloc((void *) YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in cifp_get_next_buffer()" ); } (cifp_n_chars) += number_to_move; YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf[(cifp_n_chars)] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf[(cifp_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; (cifptext_ptr) = &YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf[0]; return ret_val; } /* cifp_get_previous_state - get the state just before the EOB char was reached */ static cifp_state_type cifp_get_previous_state (void) { register cifp_state_type cifp_current_state; register char *cifp_cp; cifp_current_state = (cifp_start); cifp_current_state += YY_AT_BOL(); for ( cifp_cp = (cifptext_ptr) + YY_MORE_ADJ; cifp_cp < (cifp_c_buf_p); ++cifp_cp ) { register YY_CHAR cifp_c = (*cifp_cp ? cifp_ec[YY_SC_TO_UI(*cifp_cp)] : 1); if ( cifp_accept[cifp_current_state] ) { (cifp_last_accepting_state) = cifp_current_state; (cifp_last_accepting_cpos) = cifp_cp; } while ( cifp_chk[cifp_base[cifp_current_state] + cifp_c] != cifp_current_state ) { cifp_current_state = (int) cifp_def[cifp_current_state]; if ( cifp_current_state >= 46 ) cifp_c = cifp_meta[(unsigned int) cifp_c]; } cifp_current_state = cifp_nxt[cifp_base[cifp_current_state] + (unsigned int) cifp_c]; } return cifp_current_state; } /* cifp_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = cifp_try_NUL_trans( current_state ); */ static cifp_state_type cifp_try_NUL_trans (cifp_state_type cifp_current_state ) { register int cifp_is_jam; register char *cifp_cp = (cifp_c_buf_p); register YY_CHAR cifp_c = 1; if ( cifp_accept[cifp_current_state] ) { (cifp_last_accepting_state) = cifp_current_state; (cifp_last_accepting_cpos) = cifp_cp; } while ( cifp_chk[cifp_base[cifp_current_state] + cifp_c] != cifp_current_state ) { cifp_current_state = (int) cifp_def[cifp_current_state]; if ( cifp_current_state >= 46 ) cifp_c = cifp_meta[(unsigned int) cifp_c]; } cifp_current_state = cifp_nxt[cifp_base[cifp_current_state] + (unsigned int) cifp_c]; cifp_is_jam = (cifp_current_state == 45); return cifp_is_jam ? 0 : cifp_current_state; } static void cifpunput (int c, register char * cifp_bp ) { register char *cifp_cp; cifp_cp = (cifp_c_buf_p); /* undo effects of setting up cifptext */ *cifp_cp = (cifp_hold_char); if ( cifp_cp < YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = (cifp_n_chars) + 2; register char *dest = &YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf[ YY_CURRENT_BUFFER_LVALUE->cifp_buf_size + 2]; register char *source = &YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf[number_to_move]; while ( source > YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf ) *--dest = *--source; cifp_cp += (int) (dest - source); cifp_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->cifp_n_chars = (cifp_n_chars) = YY_CURRENT_BUFFER_LVALUE->cifp_buf_size; if ( cifp_cp < YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--cifp_cp = (char) c; (cifptext_ptr) = cifp_bp; (cifp_hold_char) = *cifp_cp; (cifp_c_buf_p) = cifp_cp; } #ifndef YY_NO_INPUT #ifdef __cplusplus static int cifpinput (void) #else static int input (void) #endif { int c; *(cifp_c_buf_p) = (cifp_hold_char); if ( *(cifp_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* cifp_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 ( (cifp_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->cifp_ch_buf[(cifp_n_chars)] ) /* This was really a NUL. */ *(cifp_c_buf_p) = '\0'; else { /* need more input */ int offset = (cifp_c_buf_p) - (cifptext_ptr); ++(cifp_c_buf_p); switch ( cifp_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because cifp_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. */ cifprestart(cifpin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { if ( cifpwrap( ) ) return EOF; if ( ! (cifp_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return cifpinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: (cifp_c_buf_p) = (cifptext_ptr) + offset; break; } } } c = *(unsigned char *) (cifp_c_buf_p); /* cast for 8-bit char's */ *(cifp_c_buf_p) = '\0'; /* preserve cifptext */ (cifp_hold_char) = *++(cifp_c_buf_p); YY_CURRENT_BUFFER_LVALUE->cifp_at_bol = (c == '\n'); return c; } #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. * @param input_file A readable stream. * * @note This function does not reset the start condition to @c INITIAL . */ void cifprestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ cifpensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = cifp_create_buffer(cifpin,YY_BUF_SIZE ); } cifp_init_buffer(YY_CURRENT_BUFFER,input_file ); cifp_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ void cifp_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with * cifppop_buffer_state(); * cifppush_buffer_state(new_buffer); */ cifpensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(cifp_c_buf_p) = (cifp_hold_char); YY_CURRENT_BUFFER_LVALUE->cifp_buf_pos = (cifp_c_buf_p); YY_CURRENT_BUFFER_LVALUE->cifp_n_chars = (cifp_n_chars); } YY_CURRENT_BUFFER_LVALUE = new_buffer; cifp_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (cifpwrap()) processing, but the only time this flag * is looked at is after cifpwrap() is called, so it's safe * to go ahead and always set it. */ (cifp_did_buffer_switch_on_eof) = 1; } static void cifp_load_buffer_state (void) { (cifp_n_chars) = YY_CURRENT_BUFFER_LVALUE->cifp_n_chars; (cifptext_ptr) = (cifp_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->cifp_buf_pos; cifpin = YY_CURRENT_BUFFER_LVALUE->cifp_input_file; (cifp_hold_char) = *(cifp_c_buf_p); } /** Allocate and initialize an input buffer state. * @param file A readable stream. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. * * @return the allocated buffer state. */ YY_BUFFER_STATE cifp_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) cifpalloc(sizeof( struct cifp_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in cifp_create_buffer()" ); b->cifp_buf_size = size; /* cifp_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->cifp_ch_buf = (char *) cifpalloc(b->cifp_buf_size + 2 ); if ( ! b->cifp_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in cifp_create_buffer()" ); b->cifp_is_our_buffer = 1; cifp_init_buffer(b,file ); return b; } /** Destroy the buffer. * @param b a buffer created with cifp_create_buffer() * */ void cifp_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->cifp_is_our_buffer ) cifpfree((void *) b->cifp_ch_buf ); cifpfree((void *) b ); } #ifndef __cplusplus extern int isatty (int ); #endif /* __cplusplus */ /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a cifprestart() or at EOF. */ static void cifp_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; cifp_flush_buffer(b ); b->cifp_input_file = file; b->cifp_fill_buffer = 1; /* If b is the current buffer, then cifp_init_buffer was _probably_ * called from cifprestart() or through cifp_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ b->cifp_bs_lineno = 1; b->cifp_bs_column = 0; } b->cifp_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; errno = oerrno; } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ void cifp_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; b->cifp_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->cifp_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->cifp_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->cifp_buf_pos = &b->cifp_ch_buf[0]; b->cifp_at_bol = 1; b->cifp_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) cifp_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes * the current state. This function will allocate the stack * if necessary. * @param new_buffer The new state. * */ void cifppush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; cifpensure_buffer_stack(); /* This block is copied from cifp_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ *(cifp_c_buf_p) = (cifp_hold_char); YY_CURRENT_BUFFER_LVALUE->cifp_buf_pos = (cifp_c_buf_p); YY_CURRENT_BUFFER_LVALUE->cifp_n_chars = (cifp_n_chars); } /* Only push if top exists. Otherwise, replace top. */ if (YY_CURRENT_BUFFER) (cifp_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; /* copied from cifp_switch_to_buffer. */ cifp_load_buffer_state( ); (cifp_did_buffer_switch_on_eof) = 1; } /** Removes and deletes the top of the stack, if present. * The next element becomes the new top. * */ void cifppop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; cifp_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((cifp_buffer_stack_top) > 0) --(cifp_buffer_stack_top); if (YY_CURRENT_BUFFER) { cifp_load_buffer_state( ); (cifp_did_buffer_switch_on_eof) = 1; } } /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ static void cifpensure_buffer_stack (void) { int num_to_alloc; if (!(cifp_buffer_stack)) { /* First allocation is just for 2 elements, since we don't know if this * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ num_to_alloc = 1; (cifp_buffer_stack) = (struct cifp_buffer_state**)cifpalloc (num_to_alloc * sizeof(struct cifp_buffer_state*) ); if ( ! (cifp_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in cifpensure_buffer_stack()" ); memset((cifp_buffer_stack), 0, num_to_alloc * sizeof(struct cifp_buffer_state*)); (cifp_buffer_stack_max) = num_to_alloc; (cifp_buffer_stack_top) = 0; return; } if ((cifp_buffer_stack_top) >= ((cifp_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ int grow_size = 8 /* arbitrary grow size */; num_to_alloc = (cifp_buffer_stack_max) + grow_size; (cifp_buffer_stack) = (struct cifp_buffer_state**)cifprealloc ((cifp_buffer_stack), num_to_alloc * sizeof(struct cifp_buffer_state*) ); if ( ! (cifp_buffer_stack) ) YY_FATAL_ERROR( "out of dynamic memory in cifpensure_buffer_stack()" ); /* zero only the new slots.*/ memset((cifp_buffer_stack) + (cifp_buffer_stack_max), 0, grow_size * sizeof(struct cifp_buffer_state*)); (cifp_buffer_stack_max) = num_to_alloc; } } /** Setup the input buffer state to scan directly from a user-specified character buffer. * @param base the character buffer * @param size the size in bytes of the character buffer * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE cifp_scan_buffer (char * base, cifp_size_t size ) { 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) cifpalloc(sizeof( struct cifp_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in cifp_scan_buffer()" ); b->cifp_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->cifp_buf_pos = b->cifp_ch_buf = base; b->cifp_is_our_buffer = 0; b->cifp_input_file = 0; b->cifp_n_chars = b->cifp_buf_size; b->cifp_is_interactive = 0; b->cifp_at_bol = 1; b->cifp_fill_buffer = 0; b->cifp_buffer_status = YY_BUFFER_NEW; cifp_switch_to_buffer(b ); return b; } /** Setup the input buffer state to scan a string. The next call to cifplex() will * scan from a @e copy of @a str. * @param cifpstr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * cifp_scan_bytes() instead. */ YY_BUFFER_STATE cifp_scan_string (cifpconst char * cifpstr ) { return cifp_scan_bytes(cifpstr,strlen(cifpstr) ); } /** Setup the input buffer state to scan the given bytes. The next call to cifplex() will * scan from a @e copy of @a bytes. * @param bytes the byte buffer to scan * @param len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ YY_BUFFER_STATE cifp_scan_bytes (cifpconst char * cifpbytes, int _cifpbytes_len ) { YY_BUFFER_STATE b; char *buf; cifp_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _cifpbytes_len + 2; buf = (char *) cifpalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in cifp_scan_bytes()" ); for ( i = 0; i < _cifpbytes_len; ++i ) buf[i] = cifpbytes[i]; buf[_cifpbytes_len] = buf[_cifpbytes_len+1] = YY_END_OF_BUFFER_CHAR; b = cifp_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in cifp_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->cifp_is_our_buffer = 1; return b; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif static void cifp_fatal_error (cifpconst char* msg ) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine cifpless() so it works in section 3 code. */ #undef cifpless #define cifpless(n) \ do \ { \ /* Undo effects of setting up cifptext. */ \ int cifpless_macro_arg = (n); \ YY_LESS_LINENO(cifpless_macro_arg);\ cifptext[cifpleng] = (cifp_hold_char); \ (cifp_c_buf_p) = cifptext + cifpless_macro_arg; \ (cifp_hold_char) = *(cifp_c_buf_p); \ *(cifp_c_buf_p) = '\0'; \ cifpleng = cifpless_macro_arg; \ } \ while ( 0 ) /* Accessor methods (get/set functions) to struct members. */ /** Get the current line number. * */ int cifpget_lineno (void) { return cifplineno; } /** Get the input stream. * */ FILE *cifpget_in (void) { return cifpin; } /** Get the output stream. * */ FILE *cifpget_out (void) { return cifpout; } /** Get the length of the current token. * */ int cifpget_leng (void) { return cifpleng; } /** Get the current token. * */ char *cifpget_text (void) { return cifptext; } /** Set the current line number. * @param line_number * */ void cifpset_lineno (int line_number ) { cifplineno = line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param in_str A readable stream. * * @see cifp_switch_to_buffer */ void cifpset_in (FILE * in_str ) { cifpin = in_str ; } void cifpset_out (FILE * out_str ) { cifpout = out_str ; } int cifpget_debug (void) { return cifp_flex_debug; } void cifpset_debug (int bdebug ) { cifp_flex_debug = bdebug ; } static int cifp_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. * This function is called from cifplex_destroy(), so don't allocate here. */ (cifp_buffer_stack) = 0; (cifp_buffer_stack_top) = 0; (cifp_buffer_stack_max) = 0; (cifp_c_buf_p) = (char *) 0; (cifp_init) = 0; (cifp_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT cifpin = stdin; cifpout = stdout; #else cifpin = (FILE *) 0; cifpout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by * cifplex_init() */ return 0; } /* cifplex_destroy is for both reentrant and non-reentrant scanners. */ int cifplex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ cifp_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; cifppop_buffer_state(); } /* Destroy the stack itself. */ cifpfree((cifp_buffer_stack) ); (cifp_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time * cifplex() is called, initialization will occur. */ cifp_init_globals( ); return 0; } /* * Internal utility routines. */ #ifndef cifptext_ptr static void cifp_flex_strncpy (char* s1, cifpconst char * s2, int n ) { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN static int cifp_flex_strlen (cifpconst char * s ) { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif void *cifpalloc (cifp_size_t size ) { return (void *) malloc( size ); } void *cifprealloc (void * ptr, cifp_size_t size ) { /* 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 ); } void cifpfree (void * ptr ) { free( (char *) ptr ); /* see cifprealloc() for (char *) cast */ } #define YYTABLES_NAME "cifptables" #line 241 "cifparse.l" /*--------------------------------------------------------------------------- * delete_punctuation * Purpose: * Deletes leading and trailing semicolons and quotes on text strings. * Input : * char *ibuf: The string which cifplex finds * char *obuf: unquoted string * int *bufLen: The sting length of ibuf *---------------------------------------------------------------------------*/ static void delete_punctuation(obuf, ibuf, bufLen) char *obuf; char *ibuf; int *bufLen; { int i; if (*bufLen == 0) return; if (*bufLen > MAXVALUELENGTH) { fprintf( stderr,"String value exceeds maximum length %d > %d",*bufLen,MAXVALUELENGTH); fprintf( stderr,"You must reset the CIFPARSE definition of MAXVALUELENGTH greater than %d to process this file",*bufLen); exit(1); } for (i=0; i<*bufLen; i++) if (ibuf[i] == ';') break; strcpy(obuf, &ibuf[i+1]); (*bufLen)-=i; for (i= *bufLen-1; i >=0; i--) if (obuf[i] == ';') break; if (obuf[i-1] == '\n') i--; (*bufLen)-= (*bufLen-i); obuf[*bufLen] = '\0'; } int cifpwrap() { return(1); } static void alt_cifpmore() { buflen = strlen(tbuf); if (buflen + strlen(cifptext) > MAXVALUELENGTH) { fprintf( stderr,"Exceeded maximum buffer size %d starting at line %d",MAXVALUELENGTH,lineNo); fprintf( stderr,"Increase the MAXVALUELENGTH to read this file"); } else strcat(tbuf, cifptext); }