/* A lexical scanner generated by flex */ /* Scanner skeleton version: * $Header: /cvs/root/flex/flex/skel.c,v 1.2 2004/05/07 00:28:17 jkh Exp $ */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include #include /* Use prototypes in function declarations. */ #define YY_USE_PROTOS /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch #pragma warn -use #include #include #define YY_USE_CONST #define YY_USE_PROTOS #endif #ifdef YY_USE_CONST #define cifpconst const #else #define cifpconst #endif #ifdef YY_USE_PROTOS #define YY_PROTO(proto) proto #else #define YY_PROTO(proto) () #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN 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. */ #define YY_BUF_SIZE 16384 typedef struct cifp_buffer_state *YY_BUFFER_STATE; 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 /* 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 ) * cifpless( 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 cifpless() call. */ /* Return all but the first 'n' matched characters back to the input stream. */ #define cifpless(n) \ do \ { \ /* Undo effects of setting up cifptext. */ \ *cifp_cp = cifp_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ cifp_c_buf_p = cifp_cp = cifp_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up cifptext again */ \ } \ while ( 0 ) #define unput(c) cifpunput( c, cifptext_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 cifp_size_t; 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; /* 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 }; static YY_BUFFER_STATE cifp_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". */ #define YY_CURRENT_BUFFER cifp_current_buffer /* 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 = 1; /* 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 YY_PROTO(( FILE *input_file )); void cifp_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); void cifp_load_buffer_state YY_PROTO(( void )); YY_BUFFER_STATE cifp_create_buffer YY_PROTO(( FILE *file, int size )); void cifp_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); void cifp_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); void cifp_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); #define YY_FLUSH_BUFFER cifp_flush_buffer( cifp_current_buffer ) YY_BUFFER_STATE cifp_scan_buffer YY_PROTO(( char *base, cifp_size_t size )); YY_BUFFER_STATE cifp_scan_string YY_PROTO(( cifpconst char *cifp_str )); YY_BUFFER_STATE cifp_scan_bytes YY_PROTO(( cifpconst char *bytes, int len )); static void *cifp_flex_alloc YY_PROTO(( cifp_size_t )); static void *cifp_flex_realloc YY_PROTO(( void *, cifp_size_t )); static void cifp_flex_free YY_PROTO(( void * )); #define cifp_new_buffer cifp_create_buffer #define cifp_set_interactive(is_interactive) \ { \ if ( ! cifp_current_buffer ) \ cifp_current_buffer = cifp_create_buffer( cifpin, YY_BUF_SIZE ); \ cifp_current_buffer->cifp_is_interactive = is_interactive; \ } #define cifp_set_bol(at_bol) \ { \ if ( ! cifp_current_buffer ) \ cifp_current_buffer = cifp_create_buffer( cifpin, YY_BUF_SIZE ); \ cifp_current_buffer->cifp_at_bol = at_bol; \ } #define YY_AT_BOL() (cifp_current_buffer->cifp_at_bol) typedef unsigned char YY_CHAR; FILE *cifpin = (FILE *) 0, *cifpout = (FILE *) 0; typedef int cifp_state_type; extern char *cifptext; #define cifptext_ptr cifptext static cifp_state_type cifp_get_previous_state YY_PROTO(( void )); static cifp_state_type cifp_try_NUL_trans YY_PROTO(( cifp_state_type current_state )); static int cifp_get_next_buffer YY_PROTO(( void )); static void cifp_fatal_error YY_PROTO(( 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; \ cifpleng = (int) (cifp_cp - cifp_bp); \ 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 static cifpconst short int 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 int 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 int cifp_meta[18] = { 0, 1, 2, 2, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static cifpconst short int 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 short int 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 short int 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 short int 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; /* 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 cifpmore() cifpmore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *cifptext; #line 1 "cifparse.l" #define INITIAL 0 #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; /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int cifpwrap YY_PROTO(( void )); #else extern int cifpwrap YY_PROTO(( void )); #endif #endif #ifndef YY_NO_UNPUT static void cifpunput YY_PROTO(( int c, char *buf_ptr )); #endif #ifndef cifptext_ptr static void cifp_flex_strncpy YY_PROTO(( char *, cifpconst char *, int )); #endif #ifdef YY_NEED_STRLEN static int cifp_flex_strlen YY_PROTO(( cifpconst char * )); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int cifpinput YY_PROTO(( void )); #else static int input YY_PROTO(( void )); #endif #endif #if YY_STACK_USED static int cifp_start_stack_ptr = 0; static int cifp_start_stack_depth = 0; static int *cifp_start_stack = 0; #ifndef YY_NO_PUSH_STATE static void cifp_push_state YY_PROTO(( int new_state )); #endif #ifndef YY_NO_POP_STATE static void cifp_pop_state YY_PROTO(( void )); #endif #ifndef YY_NO_TOP_STATE static int cifp_top_state YY_PROTO(( void )); #endif #else #define YY_NO_PUSH_STATE 1 #define YY_NO_POP_STATE 1 #define YY_NO_TOP_STATE 1 #endif #ifdef YY_MALLOC_DECL YY_MALLOC_DECL #else #if __STDC__ #ifndef __cplusplus #include #endif #else /* Just try to get by without declaring the routines. This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */ #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( cifptext, cifpleng, 1, cifpout ) #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 ( cifp_current_buffer->cifp_is_interactive ) \ { \ int c = '*', 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 if ( ((result = fread( buf, 1, max_size, cifpin )) == 0) \ && ferror( cifpin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); #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 /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL int cifplex YY_PROTO(( void )) #endif /* 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 ) \ cifp_current_buffer->cifp_at_bol = \ (cifptext[cifpleng - 1] == '\n'); \ YY_USER_ACTION YY_DECL { register cifp_state_type cifp_current_state; register char *cifp_cp, *cifp_bp; register int cifp_act; #line 71 "cifparse.l" if ( cifp_init ) { cifp_init = 0; #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 ( ! cifp_current_buffer ) cifp_current_buffer = cifp_create_buffer( cifpin, YY_BUF_SIZE ); cifp_load_buffer_state(); } while ( 1 ) /* loops until end-of-file is reached */ { 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: 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: 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: 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: 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 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 ( cifp_current_buffer->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 cifp_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 = cifp_current_buffer->cifp_n_chars; cifp_current_buffer->cifp_input_file = cifpin; cifp_current_buffer->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 <= &cifp_current_buffer->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 = &cifp_current_buffer->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() { register char *dest = cifp_current_buffer->cifp_ch_buf; register char *source = cifptext_ptr; register int number_to_move, i; int ret_val; if ( cifp_c_buf_p > &cifp_current_buffer->cifp_ch_buf[cifp_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( cifp_current_buffer->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 ( cifp_current_buffer->cifp_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ cifp_current_buffer->cifp_n_chars = cifp_n_chars = 0; else { int num_to_read = cifp_current_buffer->cifp_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = cifp_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. */ cifp_flex_realloc( (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 = cifp_current_buffer->cifp_buf_size - number_to_move - 1; #endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&cifp_current_buffer->cifp_ch_buf[number_to_move]), cifp_n_chars, num_to_read ); cifp_current_buffer->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; cifp_current_buffer->cifp_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; cifp_n_chars += number_to_move; cifp_current_buffer->cifp_ch_buf[cifp_n_chars] = YY_END_OF_BUFFER_CHAR; cifp_current_buffer->cifp_ch_buf[cifp_n_chars + 1] = YY_END_OF_BUFFER_CHAR; cifptext_ptr = &cifp_current_buffer->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() { 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 ); */ #ifdef YY_USE_PROTOS static cifp_state_type cifp_try_NUL_trans( cifp_state_type cifp_current_state ) #else static cifp_state_type cifp_try_NUL_trans( cifp_current_state ) cifp_state_type cifp_current_state; #endif { 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; } #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS static void cifpunput( int c, register char *cifp_bp ) #else static void cifpunput( c, cifp_bp ) int c; register char *cifp_bp; #endif { register char *cifp_cp = cifp_c_buf_p; /* undo effects of setting up cifptext */ *cifp_cp = cifp_hold_char; if ( cifp_cp < cifp_current_buffer->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 = &cifp_current_buffer->cifp_ch_buf[ cifp_current_buffer->cifp_buf_size + 2]; register char *source = &cifp_current_buffer->cifp_ch_buf[number_to_move]; while ( source > cifp_current_buffer->cifp_ch_buf ) *--dest = *--source; cifp_cp += (int) (dest - source); cifp_bp += (int) (dest - source); cifp_current_buffer->cifp_n_chars = cifp_n_chars = cifp_current_buffer->cifp_buf_size; if ( cifp_cp < cifp_current_buffer->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; } #endif /* ifndef YY_NO_UNPUT */ #ifdef __cplusplus static int cifpinput() #else static int input() #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 < &cifp_current_buffer->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 ); /* fall through */ 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; cifp_current_buffer->cifp_at_bol = (c == '\n'); return c; } #ifdef YY_USE_PROTOS void cifprestart( FILE *input_file ) #else void cifprestart( input_file ) FILE *input_file; #endif { if ( ! cifp_current_buffer ) cifp_current_buffer = cifp_create_buffer( cifpin, YY_BUF_SIZE ); cifp_init_buffer( cifp_current_buffer, input_file ); cifp_load_buffer_state(); } #ifdef YY_USE_PROTOS void cifp_switch_to_buffer( YY_BUFFER_STATE new_buffer ) #else void cifp_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif { if ( cifp_current_buffer == new_buffer ) return; if ( cifp_current_buffer ) { /* Flush out information for old buffer. */ *cifp_c_buf_p = cifp_hold_char; cifp_current_buffer->cifp_buf_pos = cifp_c_buf_p; cifp_current_buffer->cifp_n_chars = cifp_n_chars; } cifp_current_buffer = 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; } #ifdef YY_USE_PROTOS void cifp_load_buffer_state( void ) #else void cifp_load_buffer_state() #endif { cifp_n_chars = cifp_current_buffer->cifp_n_chars; cifptext_ptr = cifp_c_buf_p = cifp_current_buffer->cifp_buf_pos; cifpin = cifp_current_buffer->cifp_input_file; cifp_hold_char = *cifp_c_buf_p; } #ifdef YY_USE_PROTOS YY_BUFFER_STATE cifp_create_buffer( FILE *file, int size ) #else YY_BUFFER_STATE cifp_create_buffer( file, size ) FILE *file; int size; #endif { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) cifp_flex_alloc( 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 *) cifp_flex_alloc( 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; } #ifdef YY_USE_PROTOS void cifp_delete_buffer( YY_BUFFER_STATE b ) #else void cifp_delete_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; if ( b == cifp_current_buffer ) cifp_current_buffer = (YY_BUFFER_STATE) 0; if ( b->cifp_is_our_buffer ) cifp_flex_free( (void *) b->cifp_ch_buf ); cifp_flex_free( (void *) b ); } #ifndef YY_ALWAYS_INTERACTIVE #ifndef YY_NEVER_INTERACTIVE extern int isatty YY_PROTO(( int )); #endif #endif #ifdef YY_USE_PROTOS void cifp_init_buffer( YY_BUFFER_STATE b, FILE *file ) #else void cifp_init_buffer( b, file ) YY_BUFFER_STATE b; FILE *file; #endif { cifp_flush_buffer( b ); b->cifp_input_file = file; b->cifp_fill_buffer = 1; #if YY_ALWAYS_INTERACTIVE b->cifp_is_interactive = 1; #else #if YY_NEVER_INTERACTIVE b->cifp_is_interactive = 0; #else b->cifp_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif } #ifdef YY_USE_PROTOS void cifp_flush_buffer( YY_BUFFER_STATE b ) #else void cifp_flush_buffer( b ) YY_BUFFER_STATE b; #endif { 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 == cifp_current_buffer ) cifp_load_buffer_state(); } #ifndef YY_NO_SCAN_BUFFER #ifdef YY_USE_PROTOS YY_BUFFER_STATE cifp_scan_buffer( char *base, cifp_size_t size ) #else YY_BUFFER_STATE cifp_scan_buffer( base, size ) char *base; cifp_size_t size; #endif { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) cifp_flex_alloc( 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; } #endif #ifndef YY_NO_SCAN_STRING #ifdef YY_USE_PROTOS YY_BUFFER_STATE cifp_scan_string( cifpconst char *cifp_str ) #else YY_BUFFER_STATE cifp_scan_string( cifp_str ) cifpconst char *cifp_str; #endif { int len; for ( len = 0; cifp_str[len]; ++len ) ; return cifp_scan_bytes( cifp_str, len ); } #endif #ifndef YY_NO_SCAN_BYTES #ifdef YY_USE_PROTOS YY_BUFFER_STATE cifp_scan_bytes( cifpconst char *bytes, int len ) #else YY_BUFFER_STATE cifp_scan_bytes( bytes, len ) cifpconst char *bytes; int len; #endif { YY_BUFFER_STATE b; char *buf; cifp_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) cifp_flex_alloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in cifp_scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[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; } #endif #ifndef YY_NO_PUSH_STATE #ifdef YY_USE_PROTOS static void cifp_push_state( int new_state ) #else static void cifp_push_state( new_state ) int new_state; #endif { if ( cifp_start_stack_ptr >= cifp_start_stack_depth ) { cifp_size_t new_size; cifp_start_stack_depth += YY_START_STACK_INCR; new_size = cifp_start_stack_depth * sizeof( int ); if ( ! cifp_start_stack ) cifp_start_stack = (int *) cifp_flex_alloc( new_size ); else cifp_start_stack = (int *) cifp_flex_realloc( (void *) cifp_start_stack, new_size ); if ( ! cifp_start_stack ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } cifp_start_stack[cifp_start_stack_ptr++] = YY_START; BEGIN(new_state); } #endif #ifndef YY_NO_POP_STATE static void cifp_pop_state() { if ( --cifp_start_stack_ptr < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(cifp_start_stack[cifp_start_stack_ptr]); } #endif #ifndef YY_NO_TOP_STATE static int cifp_top_state() { return cifp_start_stack[cifp_start_stack_ptr - 1]; } #endif #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif #ifdef YY_USE_PROTOS static void cifp_fatal_error( cifpconst char msg[] ) #else static void cifp_fatal_error( msg ) char msg[]; #endif { (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. */ \ cifptext[cifpleng] = cifp_hold_char; \ cifp_c_buf_p = cifptext + n; \ cifp_hold_char = *cifp_c_buf_p; \ *cifp_c_buf_p = '\0'; \ cifpleng = n; \ } \ while ( 0 ) /* Internal utility routines. */ #ifndef cifptext_ptr #ifdef YY_USE_PROTOS static void cifp_flex_strncpy( char *s1, cifpconst char *s2, int n ) #else static void cifp_flex_strncpy( s1, s2, n ) char *s1; cifpconst char *s2; int n; #endif { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN #ifdef YY_USE_PROTOS static int cifp_flex_strlen( cifpconst char *s ) #else static int cifp_flex_strlen( s ) cifpconst char *s; #endif { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #ifdef YY_USE_PROTOS static void *cifp_flex_alloc( cifp_size_t size ) #else static void *cifp_flex_alloc( size ) cifp_size_t size; #endif { return (void *) malloc( size ); } #ifdef YY_USE_PROTOS static void *cifp_flex_realloc( void *ptr, cifp_size_t size ) #else static void *cifp_flex_realloc( ptr, size ) void *ptr; cifp_size_t size; #endif { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } #ifdef YY_USE_PROTOS static void cifp_flex_free( void *ptr ) #else static void cifp_flex_free( ptr ) void *ptr; #endif { free( ptr ); } #if YY_MAIN int main() { cifplex(); return 0; } #endif #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] = NULL; } 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); }