scan_c.c.preserve
上传用户:dgyhgb
上传日期:2007-01-07
资源大小:676k
文件大小:48k
- /* A lexical scanner generated by flex */
- /* scanner skeleton version:
- * $Header: /home/horse/u0/vern/flex/RCS/flex.skel,v 2.16 90/08/03 14:09:36 vern Exp Locker: vern $
- */
- #define FLEX_SCANNER
- #include <stdio.h>
- /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
- #ifdef c_plusplus
- #ifndef __cplusplus
- #define __cplusplus
- #endif
- #endif
- #ifdef __cplusplus
- #include <stdlib.h>
- #include <osfcn.h>
- /* use prototypes in function declarations */
- #define YY_USE_PROTOS
- /* the "const" storage-class-modifier is valid */
- #define YY_USE_CONST
- #else /* ! __cplusplus */
- #ifdef __STDC__
- #ifdef __GNUC__
- #include <stddef.h>
- void *malloc( size_t );
- void free( void* );
- #else
- #include <stdlib.h>
- #endif /* __GNUC__ */
- #define YY_USE_PROTOS
- #define YY_USE_CONST
- #endif /* __STDC__ */
- #endif /* ! __cplusplus */
- #ifdef __TURBOC__
- #define YY_USE_CONST
- #endif
- #ifndef YY_USE_CONST
- #define const
- #endif
- #ifdef YY_USE_PROTOS
- #define YY_PROTO(proto) proto
- #else
- #define YY_PROTO(proto) ()
- /* we can't get here if it's an ANSI C compiler, or a C++ compiler,
- * so it's got to be a K&R compiler, and therefore there's no standard
- * place from which to include these definitions
- */
- char *malloc();
- int free();
- int read();
- #endif
- /* amount of stuff to slurp up with each read */
- #ifndef YY_READ_BUF_SIZE
- #define YY_READ_BUF_SIZE 8192
- #endif
- /* returned upon end-of-file */
- #define YY_END_TOK 0
- /* copy whatever the last rule matched to the standard output */
- /* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */
- /* this used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite()
- */
- #define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout )
- /* gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
- #define YY_INPUT(buf,result,max_size)
- if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 )
- YY_FATAL_ERROR( "read() in flex scanner failed" );
- #define YY_NULL 0
- /* no semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
- #define yyterminate() return ( YY_NULL )
- /* report a fatal error */
- /* The funky do-while is used to turn this macro definition into
- * a single C statement (which needs a semi-colon terminator).
- * This avoids problems with code like:
- *
- * if ( something_happens )
- * YY_FATAL_ERROR( "oops, the something happened" );
- * else
- * everything_okay();
- *
- * 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 YY_FATAL_ERROR() call.
- */
- #define YY_FATAL_ERROR(msg)
- do
- {
- (void) fputs( msg, stderr );
- (void) putc( 'n', stderr );
- exit( 1 );
- }
- while ( 0 )
- /* default yywrap function - always treat EOF as an EOF */
- #define yywrap() 1
- /* enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN
- */
- #define BEGIN yy_start = 1 + 2 *
- /* 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
- do
- {
- yy_init_buffer( yy_current_buffer, yyin );
- yy_load_buffer_state();
- }
- while ( 0 )
- /* default declaration of generated scanner - a define so the user can
- * easily add parameters
- */
- #define YY_DECL int yylex YY_PROTO(( void ))
- /* code executed at the end of each rule */
- #define YY_BREAK break;
- #define YY_END_OF_BUFFER_CHAR 0
- #ifndef YY_BUF_SIZE
- #define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */
- #endif
- typedef struct yy_buffer_state *YY_BUFFER_STATE;
- #define FLEX_DEBUG
- #define YY_CHAR unsigned char
- # line 1 "scan_c.l"
- #define INITIAL 0
- # line 2 "scan_c.l"
- /*
- * scan_c.l - scanner-extractor of GNU SQL/C compiler
- *
- * This file is a part of GNU SQL Server
- *
- * Copyright (c) 1996, 1997, Free Software Foundation, Inc
- * Developed at the Institute of System Programming
- * This file is written by Michael Kimelman.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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 this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Contact: gss@ispras.ru
- *
- */
- /* $Id: scan_c.l,v 1.247 1997/04/21 14:26:13 kml Exp $ */
- #include "xmem.h"
- #include "gsqltrn.h"
- #include "sql_decl.h"
- #include "procname.h"
- #include <assert.h>
- #define SWITCH_COND(cond) { save_condition();BEGIN(cond);}
- #define REST_COND rest_condition();
- #define SCANNER_NAME yylex_extractor
- #ifdef YY_DECL
- # undef YY_DECL
- #endif
- #define YY_DECL int SCANNER_NAME(void)
- YY_DECL;
- #define YY_USER_INIT { BEGIN(START_CONDITION); line_num=1; }
- #define YY_USER_ACTION if(yy_flex_debug){
- fprintf(stderr,"nCurrent lex state=%dn",yy_start);}
- #define SQL_PROC(code) if(code){file_pos=line_num; return 1<<code;}
- static str_buf c_scanner_buffer={0,0,NULL};
- #define sql_str(s,l) buffer_string(&c_scanner_buffer,s,l)
- /* defined in main routine */
- int open_file(FILE **f,char *ext);
- static void save_condition __P((void));
- static void rest_condition __P((void));
- #ifndef START_CONDITION
- # define START_CONDITION scan_mode_state
- #endif
- #define BEGIN_MODE(v) { BEGIN(v); scan_mode_state=v; }
- static char *statement_scanner_buffer=NULL;
- static int line_num=1;
- static int io_diff=0;
- static char *progname_out=NULL;
- static int bline=1;
- #define APPEND_BUFFER { sql_str(yytext,yyleng);}
- #define POP_BUFFER pop_cl_buffer()
- void
- pop_cl_buffer(void)
- {
- register char *b=sql_str(NULL,0);
- statement_scanner_buffer=b?savestring(b):NULL;
- }
- #define C_lang 1
- #define c_comment 2
- #define C_str 3
- #define ESQL 4
- #define MOD 5
- #define SCH 6
- #define SQL 7
- #define SQL_str 8
- #define SQL_ident 9
- #define SQL_comment 10
- # line 100 "scan_c.l"
- /* done after the current pattern has been matched and before the
- * corresponding action - sets up yytext
- */
- #define YY_DO_BEFORE_ACTION
- yytext = yy_bp;
- yyleng = yy_cp - yy_bp;
- yy_hold_char = *yy_cp;
- *yy_cp = ' ';
- yy_c_buf_p = yy_cp;
- #define EOB_ACT_CONTINUE_SCAN 0
- #define EOB_ACT_END_OF_FILE 1
- #define EOB_ACT_LAST_MATCH 2
- /* return all but the first 'n' matched characters back to the input stream */
- #define yyless(n)
- do
- {
- /* undo effects of setting up yytext */
- *yy_cp = yy_hold_char;
- yy_c_buf_p = yy_cp = yy_bp + n;
- YY_DO_BEFORE_ACTION; /* set up yytext again */
- }
- while ( 0 )
- #define unput(c) yyunput( c, yytext )
- struct yy_buffer_state
- {
- FILE *yy_input_file;
- YY_CHAR *yy_ch_buf; /* input buffer */
- YY_CHAR *yy_buf_pos; /* current position in input buffer */
- /* size of input buffer in bytes, not including room for EOB characters */
- int yy_buf_size;
- /* number of characters read into yy_ch_buf, not including EOB characters */
- int yy_n_chars;
- int yy_eof_status; /* whether we've seen an EOF on this buffer */
- #define EOF_NOT_SEEN 0
- /* "pending" happens when the EOF has been seen but there's still
- * some text process
- */
- #define EOF_PENDING 1
- #define EOF_DONE 2
- };
- static YY_BUFFER_STATE yy_current_buffer;
- /* we provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state"
- */
- #define YY_CURRENT_BUFFER yy_current_buffer
- /* yy_hold_char holds the character lost when yytext is formed */
- static YY_CHAR yy_hold_char;
- static int yy_n_chars; /* number of characters read into yy_ch_buf */
- #ifndef YY_USER_ACTION
- #define YY_USER_ACTION
- #endif
- #ifndef YY_USER_INIT
- #define YY_USER_INIT
- #endif
- extern YY_CHAR *yytext;
- extern int yyleng;
- extern FILE *yyin, *yyout;
- YY_CHAR *yytext;
- int yyleng;
- FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
- #define YY_END_OF_BUFFER 46
- typedef int yy_state_type;
- static const short int yy_accept[158] =
- { 0,
- 0, 0, 0, 0, 12, 12, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 46, 44, 27, 6, 44, 44, 44, 44,
- 44, 27, 44, 44, 45, 3, 45, 5, 5, 3,
- 5, 5, 5, 12, 14, 13, 10, 11, 7, 10,
- 33, 28, 32, 30, 29, 33, 33, 17, 21, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 45, 45,
- 45, 45, 36, 35, 37, 39, 38, 41, 42, 43,
- 27, 31, 0, 0, 0, 0, 27, 0, 0, 4,
- 1, 0, 2, 0, 12, 13, 13, 15, 10, 9,
- 8, 28, 16, 0, 0, 0, 0, 0, 36, 34,
- 39, 40, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 22, 0, 0, 0, 0, 0, 0,
- 23, 0, 0, 0, 0, 24, 0, 18, 0, 0,
- 0, 25, 19, 0, 0, 20, 0
- } ;
- static const YY_CHAR yy_ec[256] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 1, 4, 5, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 1, 6, 1, 7, 1, 1, 8, 1,
- 1, 9, 1, 1, 10, 1, 11, 12, 12, 12,
- 12, 12, 12, 12, 12, 12, 12, 1, 13, 1,
- 1, 1, 1, 1, 15, 12, 16, 17, 18, 12,
- 19, 20, 21, 12, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 31, 32, 33, 34, 35, 12, 12,
- 1, 14, 1, 1, 12, 1, 15, 12, 16, 17,
- 18, 12, 19, 20, 21, 12, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
- 12, 12, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 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 const YY_CHAR yy_meta[36] =
- { 0,
- 1, 1, 2, 1, 1, 3, 1, 4, 5, 1,
- 1, 6, 1, 1, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6
- } ;
- static const short int yy_base[180] =
- { 0,
- 0, 23, 2, 46, 3, 11, 15, 28, 63, 75,
- 76, 81, 98, 0, 20, 39, 20, 42, 16, 40,
- 317, 316, 318, 321, 5, 321, 307, 293, 286, 285,
- 287, 100, 56, 277, 321, 321, 302, 321, 73, 321,
- 117, 301, 274, 0, 321, 59, 321, 321, 321, 93,
- 321, 80, 321, 321, 321, 298, 298, 321, 321, 288,
- 279, 275, 280, 273, 272, 271, 281, 277, 274, 267,
- 266, 268, 0, 321, 285, 0, 321, 286, 321, 321,
- 93, 321, 260, 272, 263, 271, 121, 131, 252, 321,
- 321, 268, 321, 122, 0, 101, 132, 321, 321, 321,
- 321, 140, 321, 269, 258, 268, 249, 250, 0, 321,
- 0, 321, 262, 264, 251, 245, 260, 252, 258, 248,
- 246, 251, 241, 200, 0, 207, 224, 209, 194, 178,
- 184, 0, 120, 321, 119, 60, 102, 113, 0, 108,
- 321, 0, 88, 88, 69, 321, 0, 321, 49, 0,
- 22, 321, 321, 14, 0, 321, 321, 144, 150, 156,
- 162, 168, 174, 180, 186, 192, 198, 204, 210, 216,
- 222, 228, 234, 239, 244, 249, 254, 259, 264
- } ;
- static const short int yy_def[180] =
- { 0,
- 158, 158, 159, 160, 161, 161, 162, 162, 163, 163,
- 10, 10, 10, 13, 159, 159, 164, 164, 165, 165,
- 166, 166, 157, 157, 157, 157, 157, 157, 157, 157,
- 157, 157, 167, 157, 157, 157, 157, 157, 157, 157,
- 167, 157, 157, 168, 157, 169, 157, 157, 157, 170,
- 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
- 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
- 157, 157, 171, 157, 157, 172, 157, 157, 157, 157,
- 157, 157, 157, 157, 157, 157, 157, 167, 157, 157,
- 157, 157, 157, 157, 168, 169, 169, 157, 157, 157,
- 157, 157, 157, 157, 157, 157, 157, 157, 171, 157,
- 172, 157, 157, 157, 157, 157, 157, 157, 157, 157,
- 157, 157, 157, 157, 173, 157, 157, 157, 157, 157,
- 157, 174, 157, 157, 157, 157, 157, 157, 175, 157,
- 157, 176, 157, 157, 157, 157, 177, 157, 157, 178,
- 157, 157, 157, 157, 179, 157, 0, 157, 157, 157,
- 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
- 157, 157, 157, 157, 157, 157, 157, 157, 157
- } ;
- static const short int yy_nxt[357] =
- { 0,
- 157, 25, 26, 25, 26, 45, 81, 36, 81, 27,
- 157, 46, 37, 45, 28, 29, 30, 48, 77, 46,
- 49, 78, 74, 31, 32, 26, 25, 75, 50, 33,
- 48, 155, 27, 49, 69, 70, 71, 28, 29, 30,
- 34, 50, 77, 72, 74, 78, 31, 39, 26, 75,
- 154, 40, 41, 69, 70, 71, 42, 91, 91, 91,
- 91, 136, 72, 43, 52, 53, 52, 97, 54, 98,
- 55, 88, 56, 57, 94, 58, 52, 53, 52, 88,
- 54, 102, 55, 102, 56, 57, 51, 58, 59, 143,
- 89, 51, 60, 59, 81, 100, 81, 60, 101, 61,
- 151, 87, 62, 81, 61, 150, 88, 62, 51, 157,
- 51, 157, 63, 64, 65, 149, 66, 89, 91, 91,
- 91, 91, 87, 94, 81, 147, 67, 88, 88, 145,
- 144, 68, 91, 91, 91, 91, 142, 125, 89, 89,
- 97, 102, 98, 102, 24, 24, 24, 24, 24, 24,
- 35, 35, 35, 35, 35, 35, 38, 38, 38, 38,
- 38, 38, 44, 44, 44, 44, 44, 44, 47, 47,
- 47, 47, 47, 47, 51, 51, 51, 51, 51, 51,
- 73, 73, 73, 73, 73, 73, 76, 76, 76, 76,
- 76, 76, 79, 79, 79, 79, 79, 79, 90, 90,
- 90, 90, 90, 90, 95, 140, 95, 95, 139, 95,
- 96, 138, 96, 96, 96, 96, 99, 99, 99, 99,
- 99, 99, 109, 137, 109, 136, 109, 109, 111, 135,
- 133, 111, 111, 111, 134, 134, 134, 134, 134, 141,
- 141, 141, 141, 141, 146, 146, 146, 146, 146, 148,
- 148, 148, 148, 148, 152, 152, 152, 152, 152, 153,
- 153, 153, 153, 153, 156, 156, 156, 156, 156, 125,
- 132, 131, 130, 129, 128, 127, 126, 125, 124, 123,
- 122, 121, 120, 119, 118, 117, 92, 116, 115, 114,
- 113, 112, 110, 86, 85, 84, 83, 108, 107, 106,
- 85, 84, 83, 105, 86, 104, 103, 82, 92, 93,
- 93, 92, 86, 85, 84, 83, 82, 157, 80, 80,
- 23, 157, 157, 157, 157, 157, 157, 157, 157, 157,
- 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
- 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
- 157, 157, 157, 157, 157, 157
- } ;
- static const short int yy_chk[357] =
- { 0,
- 0, 1, 1, 1, 3, 5, 25, 3, 25, 1,
- 0, 5, 3, 6, 1, 1, 1, 7, 19, 6,
- 7, 19, 17, 1, 2, 2, 2, 17, 7, 2,
- 8, 154, 2, 8, 15, 15, 15, 2, 2, 2,
- 2, 8, 20, 15, 18, 20, 2, 4, 4, 18,
- 151, 4, 4, 16, 16, 16, 4, 33, 33, 33,
- 33, 136, 16, 4, 9, 9, 9, 46, 9, 46,
- 9, 149, 9, 9, 39, 9, 10, 10, 10, 39,
- 10, 52, 10, 52, 10, 10, 11, 10, 11, 136,
- 39, 12, 11, 12, 81, 50, 81, 12, 50, 11,
- 145, 32, 11, 32, 12, 144, 32, 12, 13, 96,
- 13, 96, 13, 13, 13, 143, 13, 32, 41, 41,
- 41, 41, 87, 94, 87, 140, 13, 87, 94, 138,
- 137, 13, 88, 88, 88, 88, 135, 133, 87, 94,
- 97, 102, 97, 102, 158, 158, 158, 158, 158, 158,
- 159, 159, 159, 159, 159, 159, 160, 160, 160, 160,
- 160, 160, 161, 161, 161, 161, 161, 161, 162, 162,
- 162, 162, 162, 162, 163, 163, 163, 163, 163, 163,
- 164, 164, 164, 164, 164, 164, 165, 165, 165, 165,
- 165, 165, 166, 166, 166, 166, 166, 166, 167, 167,
- 167, 167, 167, 167, 168, 131, 168, 168, 130, 168,
- 169, 129, 169, 169, 169, 169, 170, 170, 170, 170,
- 170, 170, 171, 128, 171, 127, 171, 171, 172, 126,
- 124, 172, 172, 172, 173, 173, 173, 173, 173, 174,
- 174, 174, 174, 174, 175, 175, 175, 175, 175, 176,
- 176, 176, 176, 176, 177, 177, 177, 177, 177, 178,
- 178, 178, 178, 178, 179, 179, 179, 179, 179, 123,
- 122, 121, 120, 119, 118, 117, 116, 115, 114, 113,
- 108, 107, 106, 105, 104, 92, 89, 86, 85, 84,
- 83, 78, 75, 72, 71, 70, 69, 68, 67, 66,
- 65, 64, 63, 62, 61, 60, 57, 56, 43, 42,
- 37, 34, 31, 30, 29, 28, 27, 23, 22, 21,
- 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
- 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
- 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
- 157, 157, 157, 157, 157, 157
- } ;
- static yy_state_type yy_last_accepting_state;
- static YY_CHAR *yy_last_accepting_cpos;
- extern int yy_flex_debug;
- int yy_flex_debug = 1;
- static const short int yy_rule_linenum[45] =
- { 0,
- 114, 119, 124, 128, 129, 130, 134, 135, 136, 137,
- 138, 146, 147, 148, 151, 161, 169, 178, 182, 187,
- 193, 207, 219, 223, 236, 236, 250, 251, 252, 256,
- 260, 263, 267, 273, 274, 279, 280, 287, 292, 293,
- 294, 301, 302, 306
- } ;
- /* the intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed
- */
- #define REJECT reject_used_but_not_detected
- #define yymore() yymore_used_but_not_detected
- #define YY_MORE_ADJ 0
- /* these variables are all declared out here so that section 3 code can
- * manipulate them
- */
- /* points to current character in buffer */
- static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0;
- static int yy_init = 1; /* whether we need to initialize */
- static int yy_start = 0; /* start state number */
- /* flag which is used to allow yywrap()'s to do buffer switches
- * instead of setting up a fresh yyin. A bit of a hack ...
- */
- static int yy_did_buffer_switch_on_eof;
- static yy_state_type yy_get_previous_state YY_PROTO(( void ));
- static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
- static int yy_get_next_buffer YY_PROTO(( void ));
- static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
- void yyrestart YY_PROTO(( FILE *input_file ));
- void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
- void yy_load_buffer_state YY_PROTO(( void ));
- YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
- void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
- void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
- #define yy_new_buffer yy_create_buffer
- #ifdef __cplusplus
- static int yyinput YY_PROTO(( void ));
- #else
- static int input YY_PROTO(( void ));
- #endif
- YY_DECL
- {
- register yy_state_type yy_current_state;
- register YY_CHAR *yy_cp, *yy_bp;
- register int yy_act;
- static int esql_caller = 0;
- static int rout_title = 0;
- int comment_caller = 0;
- int first_start = yy_init;
- int with_grant_options = 0;
-
- #ifdef FLEX_DEBUG
- yy_flex_debug=client_scanner_debug;
- #endif
- /*********************************************
- * C lexics *
- *********************************************/
- if ( yy_init )
- {
- YY_USER_INIT;
- if ( ! yy_start )
- yy_start = 1; /* first start state */
- if ( ! yyin )
- yyin = stdin;
- if ( ! yyout )
- yyout = stdout;
- if ( yy_current_buffer )
- yy_init_buffer( yy_current_buffer, yyin );
- else
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
- yy_load_buffer_state();
- yy_init = 0;
- }
- while ( 1 ) /* loops until end-of-file is reached */
- {
- yy_cp = yy_c_buf_p;
- /* support of yytext */
- *yy_cp = yy_hold_char;
- /* yy_bp points to the position in yy_ch_buf of the start of the
- * current run.
- */
- yy_bp = yy_cp;
- yy_current_state = yy_start;
- if ( yy_bp[-1] == 'n' )
- ++yy_current_state;
- yy_match:
- do
- {
- register YY_CHAR yy_c = yy_ec[*yy_cp];
- if ( yy_accept[yy_current_state] )
- {
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = yy_def[yy_current_state];
- if ( yy_current_state >= 158 )
- yy_c = yy_meta[yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- ++yy_cp;
- }
- while ( yy_current_state != 157 );
- yy_cp = yy_last_accepting_cpos;
- yy_current_state = yy_last_accepting_state;
- yy_find_action:
- yy_act = yy_accept[yy_current_state];
- YY_DO_BEFORE_ACTION;
- YY_USER_ACTION;
- do_action: /* this label is used only to access EOF actions */
- if ( yy_flex_debug )
- {
- if ( yy_act == 0 )
- fprintf( stderr, "--scanner backtrackingn" );
- else if ( yy_act < 45 )
- fprintf( stderr, "--accepting rule at line %d ("%s")n",
- yy_rule_linenum[yy_act], yytext );
- else if ( yy_act == 45 )
- fprintf( stderr, "--accepting default rule ("%s")n",
- yytext );
- else if ( yy_act == 46 )
- fprintf( stderr, "--(end of buffer or a NUL)n" );
- else
- fprintf( stderr, "--EOFn" );
- }
- switch ( yy_act )
- {
- case 0: /* must backtrack */
- /* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = yy_hold_char;
- yy_cp = yy_last_accepting_cpos;
- yy_current_state = yy_last_accepting_state;
- goto yy_find_action;
- case 1:
- # line 114 "scan_c.l"
- {
- esql_caller=C_lang;
- bline=line_num;
- BEGIN_MODE(ESQL);
- }
- YY_BREAK
- case 2:
- # line 119 "scan_c.l"
- {
- ECHO;
- comment_caller=C_lang;
- BEGIN_MODE(c_comment);
- }
- YY_BREAK
- case 3:
- # line 124 "scan_c.l"
- {
- ECHO;
- BEGIN_MODE(C_str);
- }
- YY_BREAK
- case 4:
- # line 129 "scan_c.l"
- case 5:
- # line 129 "scan_c.l"
- { ECHO; }
- YY_BREAK
- case 6:
- # line 130 "scan_c.l"
- { ECHO; line_num++; }
- YY_BREAK
- /*********************************************
- * C string recognizer *
- *********************************************/
- case 7:
- # line 134 "scan_c.l"
- { ECHO; BEGIN_MODE(C_lang); }
- YY_BREAK
- case 8:
- # line 135 "scan_c.l"
- { ECHO; }
- YY_BREAK
- case 9:
- # line 136 "scan_c.l"
- { ECHO; ++line_num; }
- YY_BREAK
- case 10:
- # line 137 "scan_c.l"
- { ECHO; }
- YY_BREAK
- case 11:
- # line 138 "scan_c.l"
- {
- ECHO;
- yyerror("Unterminated C string");
- BEGIN_MODE(C_lang);
- }
- YY_BREAK
- /*********************************************
- * C comment recornizer *
- *********************************************/
- case 12:
- # line 146 "scan_c.l"
- { if (comment_caller == C_lang) { ECHO; } }
- YY_BREAK
- case 13:
- # line 147 "scan_c.l"
- { if (comment_caller == C_lang) { ECHO; } }
- YY_BREAK
- case 14:
- # line 148 "scan_c.l"
- { if (comment_caller == C_lang) { ECHO; }
- line_num++;
- }
- YY_BREAK
- case 15:
- # line 151 "scan_c.l"
- { if (comment_caller == C_lang)
- {
- ECHO;
- }
- BEGIN_MODE(comment_caller);
- }
- YY_BREAK
- /*********************************************
- * lexics of embedded SQL in C *
- *********************************************/
- case 16:
- # line 161 "scan_c.l"
- { if(esql_caller==C_lang)
- {
- comment_caller=ESQL;
- BEGIN_MODE(c_comment);
- }
- else
- yyerror("Lex: Unrecognizable literal'/*'n");
- }
- YY_BREAK
- case 17:
- # line 169 "scan_c.l"
- {
- BEGIN_MODE(esql_caller);
- POP_BUFFER;
- SQL_PROC(ESQL);
- }
- YY_BREAK
- /*********************************************
- * embedded SQL lexics *
- *********************************************/
- case 18:
- *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
- yy_c_buf_p = yy_cp = yy_bp + 6;
- YY_DO_BEFORE_ACTION; /* set up yytext again */
- # line 178 "scan_c.l"
- {
- BEGIN_MODE(MOD);
- APPEND_BUFFER;
- }
- YY_BREAK
- case 19:
- *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
- yy_c_buf_p = yy_cp = yy_bp + 7;
- YY_DO_BEFORE_ACTION; /* set up yytext again */
- # line 182 "scan_c.l"
- {
- POP_BUFFER;
- APPEND_BUFFER;
- SQL_PROC(MOD);
- }
- YY_BREAK
- case 20:
- *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
- yy_c_buf_p = yy_cp = yy_bp + 9;
- YY_DO_BEFORE_ACTION; /* set up yytext again */
- # line 187 "scan_c.l"
- {
- rout_title=1;
- POP_BUFFER;
- APPEND_BUFFER;
- SQL_PROC(MOD);
- }
- YY_BREAK
- case 21:
- # line 193 "scan_c.l"
- {
- APPEND_BUFFER;
- if(rout_title)
- rout_title=0;
- else
- {
- POP_BUFFER;
- SQL_PROC(MOD);
- }
- }
- YY_BREAK
- /*********************************************
- * clean SQL SCH lexic *
- *********************************************/
- case 22:
- *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
- yy_c_buf_p = yy_cp -= 1;
- YY_DO_BEFORE_ACTION; /* set up yytext again */
- # line 207 "scan_c.l"
- {
- {
- BEGIN_MODE(SCH);
- POP_BUFFER;
- APPEND_BUFFER;
- if(first_start)
- first_start=0;
- else
- {
- SQL_PROC(SCH);
- }
- } }
- YY_BREAK
- case 23:
- *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
- yy_c_buf_p = yy_cp = yy_bp + 4;
- YY_DO_BEFORE_ACTION; /* set up yytext again */
- # line 219 "scan_c.l"
- {
- APPEND_BUFFER;
- with_grant_options=1;
- }
- YY_BREAK
- case 24:
- *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
- yy_c_buf_p = yy_cp = yy_bp + 5;
- YY_DO_BEFORE_ACTION; /* set up yytext again */
- # line 223 "scan_c.l"
- {
- if(with_grant_options)
- {
- APPEND_BUFFER;
- with_grant_options=0;
- }
- else
- {
- POP_BUFFER;
- APPEND_BUFFER;
- SQL_PROC(SCH);
- }
- }
- YY_BREAK
- case 25:
- *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
- yy_c_buf_p = yy_cp = yy_bp + 6;
- YY_DO_BEFORE_ACTION; /* set up yytext again */
- # line 236 "scan_c.l"
- {
- POP_BUFFER;
- APPEND_BUFFER;
- SQL_PROC(SCH);
- }
- YY_BREAK
- case YY_STATE_EOF(SCH):
- # line 241 "scan_c.l"
- {
- POP_BUFFER;
- BEGIN(INITIAL);
- SQL_PROC(SCH);
- }
- YY_BREAK
- /*********************************************
- * common SQL keywords *
- *********************************************/
- case 27:
- # line 250 "scan_c.l"
- /* do nothing */;
- YY_BREAK
- case 28:
- # line 251 "scan_c.l"
- { APPEND_BUFFER; }
- YY_BREAK
- case 29:
- # line 252 "scan_c.l"
- {
- APPEND_BUFFER;
- SWITCH_COND(SQL_str);
- }
- YY_BREAK
- case 30:
- # line 256 "scan_c.l"
- {
- APPEND_BUFFER;
- SWITCH_COND(SQL_ident);
- }
- YY_BREAK
- case 31:
- # line 260 "scan_c.l"
- {
- SWITCH_COND(SQL_comment);
- }
- YY_BREAK
- case 32:
- # line 263 "scan_c.l"
- {
- APPEND_BUFFER;
- line_num++;
- }
- YY_BREAK
- case 33:
- # line 267 "scan_c.l"
- {
- APPEND_BUFFER;
- }
- YY_BREAK
- /*********************************************
- * SQL string recognizer *
- *********************************************/
- case 34:
- # line 273 "scan_c.l"
- { APPEND_BUFFER; }
- YY_BREAK
- case 35:
- # line 274 "scan_c.l"
- {
- yyerror(" Unterminated SQL string ");
- line_num++;
- REST_COND;
- }
- YY_BREAK
- case 36:
- # line 279 "scan_c.l"
- { APPEND_BUFFER; }
- YY_BREAK
- case 37:
- # line 280 "scan_c.l"
- {
- APPEND_BUFFER;
- REST_COND;
- }
- YY_BREAK
- /*********************************************
- * SQL string recognizer *
- *********************************************/
- case 38:
- # line 287 "scan_c.l"
- {
- yyerror(" Unterminated SQL identifier ");
- line_num++;
- REST_COND;
- }
- YY_BREAK
- case 39:
- # line 292 "scan_c.l"
- { APPEND_BUFFER; }
- YY_BREAK
- case 40:
- # line 293 "scan_c.l"
- { APPEND_BUFFER; }
- YY_BREAK
- case 41:
- # line 294 "scan_c.l"
- {
- APPEND_BUFFER ;
- REST_COND;
- }
- YY_BREAK
- /*********************************************
- * SQL comment recognizer *
- *********************************************/
- case 42:
- # line 301 "scan_c.l"
- /* do nothing */;
- YY_BREAK
- case 43:
- # line 302 "scan_c.l"
- {
- line_num++;
- REST_COND;
- }
- YY_BREAK
- case 44:
- # line 306 "scan_c.l"
- {
- ECHO;
- BEGIN_MODE(C_lang);
- }
- YY_BREAK
- case 45:
- # line 310 "scan_c.l"
- ECHO;
- YY_BREAK
- case YY_STATE_EOF(INITIAL):
- case YY_STATE_EOF(C_lang):
- case YY_STATE_EOF(c_comment):
- case YY_STATE_EOF(C_str):
- case YY_STATE_EOF(ESQL):
- case YY_STATE_EOF(MOD):
- case YY_STATE_EOF(SQL):
- case YY_STATE_EOF(SQL_str):
- case YY_STATE_EOF(SQL_ident):
- case YY_STATE_EOF(SQL_comment):
- yyterminate();
- case YY_END_OF_BUFFER:
- {
- /* amount of text matched not including the EOB char */
- int yy_amount_of_matched_text = yy_cp - yytext - 1;
- /* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = yy_hold_char;
- /* note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the end-
- * of-buffer state). Contrast this with the test in yyinput().
- */
- if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
- /* this was really a NUL */
- {
- yy_state_type yy_next_state;
- yy_c_buf_p = yytext + yy_amount_of_matched_text;
- yy_current_state = yy_get_previous_state();
- /* okay, we're now positioned to make the
- * NUL transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we
- * don't want to build jamming into it because
- * then it will run more slowly)
- */
- yy_next_state = yy_try_NUL_trans( yy_current_state );
- yy_bp = yytext + YY_MORE_ADJ;
- if ( yy_next_state )
- {
- /* consume the NUL */
- yy_cp = ++yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
- else
- {
- yy_cp = yy_last_accepting_cpos;
- yy_current_state = yy_last_accepting_state;
- goto yy_find_action;
- }
- }
- else switch ( yy_get_next_buffer() )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yy_did_buffer_switch_on_eof = 0;
- if ( yywrap() )
- {
- /* note: because we've taken care in
- * yy_get_next_buffer() to have set up yytext,
- * we can now set up yy_c_buf_p so that if some
- * total hoser (like flex itself) wants
- * to call the scanner after we return the
- * YY_NULL, it'll still work - another YY_NULL
- * will get returned.
- */
- yy_c_buf_p = yytext + YY_MORE_ADJ;
- yy_act = YY_STATE_EOF((yy_start - 1) / 2);
- goto do_action;
- }
- else
- {
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- }
- break;
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p = yytext + yy_amount_of_matched_text;
- yy_current_state = yy_get_previous_state();
- yy_cp = yy_c_buf_p;
- yy_bp = yytext + YY_MORE_ADJ;
- goto yy_match;
- case EOB_ACT_LAST_MATCH:
- yy_c_buf_p =
- &yy_current_buffer->yy_ch_buf[yy_n_chars];
- yy_current_state = yy_get_previous_state();
- yy_cp = yy_c_buf_p;
- yy_bp = yytext + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
- default:
- #ifdef FLEX_DEBUG
- printf( "action # %dn", yy_act );
- #endif
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- }
- }
- }
- /* yy_get_next_buffer - try to read in a new buffer
- *
- * synopsis
- * int yy_get_next_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 yy_get_next_buffer()
- {
- register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
- register YY_CHAR *source = yytext - 1; /* copy prev. char, too */
- register int number_to_move, i;
- int ret_val;
- if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
- /* try to read more data */
- /* first move last chars to start of buffer */
- number_to_move = yy_c_buf_p - yytext;
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
- if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- yy_n_chars = 0;
- else
- {
- int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
- else if ( num_to_read <= 0 )
- YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" );
- /* read in more data */
- YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
- yy_n_chars, num_to_read );
- }
- if ( yy_n_chars == 0 )
- {
- if ( number_to_move - YY_MORE_ADJ == 1 )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- yy_current_buffer->yy_eof_status = EOF_DONE;
- }
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- yy_current_buffer->yy_eof_status = EOF_PENDING;
- }
- }
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
- yy_n_chars += number_to_move;
- yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
- /* yytext begins at the second character in yy_ch_buf; the first
- * character is the one which preceded it before reading in the latest
- * buffer; it needs to be kept around in case it's a newline, so
- * yy_get_previous_state() will have with '^' rules active
- */
- yytext = &yy_current_buffer->yy_ch_buf[1];
- return ( ret_val );
- }
- /* yy_get_previous_state - get the state just before the EOB char was reached
- *
- * synopsis
- * yy_state_type yy_get_previous_state();
- */
- static yy_state_type yy_get_previous_state()
- {
- register yy_state_type yy_current_state;
- register YY_CHAR *yy_cp;
- register YY_CHAR *yy_bp = yytext;
- yy_current_state = yy_start;
- if ( yy_bp[-1] == 'n' )
- ++yy_current_state;
- for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
- {
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 1);
- if ( yy_accept[yy_current_state] )
- {
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = yy_def[yy_current_state];
- if ( yy_current_state >= 158 )
- yy_c = yy_meta[yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- }
- return ( yy_current_state );
- }
- /* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
- #ifdef YY_USE_PROTOS
- static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
- #else
- static yy_state_type yy_try_NUL_trans( yy_current_state )
- register yy_state_type yy_current_state;
- #endif
- {
- register int yy_is_jam;
- register YY_CHAR *yy_cp = yy_c_buf_p;
- register YY_CHAR yy_c = 1;
- if ( yy_accept[yy_current_state] )
- {
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = yy_def[yy_current_state];
- if ( yy_current_state >= 158 )
- yy_c = yy_meta[yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- yy_is_jam = (yy_current_state == 157);
- return ( yy_is_jam ? 0 : yy_current_state );
- }
- #ifdef YY_USE_PROTOS
- static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
- #else
- static void yyunput( c, yy_bp )
- YY_CHAR c;
- register YY_CHAR *yy_bp;
- #endif
- {
- register YY_CHAR *yy_cp = yy_c_buf_p;
- /* undo effects of setting up yytext */
- *yy_cp = yy_hold_char;
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- { /* need to shift things up to make room */
- register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
- register YY_CHAR *dest =
- &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2];
- register YY_CHAR *source =
- &yy_current_buffer->yy_ch_buf[number_to_move];
- while ( source > yy_current_buffer->yy_ch_buf )
- *--dest = *--source;
- yy_cp += dest - source;
- yy_bp += dest - source;
- yy_n_chars = yy_current_buffer->yy_buf_size;
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- YY_FATAL_ERROR( "flex scanner push-back overflow" );
- }
- if ( yy_cp > yy_bp && yy_cp[-1] == 'n' )
- yy_cp[-2] = 'n';
- *--yy_cp = c;
- /* note: the formal parameter *must* be called "yy_bp" for this
- * macro to now work correctly
- */
- YY_DO_BEFORE_ACTION; /* set up yytext again */
- }
- #ifdef __cplusplus
- static int yyinput()
- #else
- static int input()
- #endif
- {
- int c;
- YY_CHAR *yy_cp = yy_c_buf_p;
- *yy_cp = yy_hold_char;
- if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
- /* this was really a NUL */
- *yy_c_buf_p = ' ';
- else
- { /* need more input */
- yytext = yy_c_buf_p;
- ++yy_c_buf_p;
- switch ( yy_get_next_buffer() )
- {
- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap() )
- {
- yy_c_buf_p = yytext + YY_MORE_ADJ;
- return ( EOF );
- }
- YY_NEW_FILE;
- #ifdef __cplusplus
- return ( yyinput() );
- #else
- return ( input() );
- #endif
- }
- break;
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p = yytext + YY_MORE_ADJ;
- break;
- case EOB_ACT_LAST_MATCH:
- #ifdef __cplusplus
- YY_FATAL_ERROR( "unexpected last match in yyinput()" );
- #else
- YY_FATAL_ERROR( "unexpected last match in input()" );
- #endif
- }
- }
- }
- c = *yy_c_buf_p;
- yy_hold_char = *++yy_c_buf_p;
- return ( c );
- }
- #ifdef YY_USE_PROTOS
- void yyrestart( FILE *input_file )
- #else
- void yyrestart( input_file )
- FILE *input_file;
- #endif
- {
- yy_init_buffer( yy_current_buffer, input_file );
- yy_load_buffer_state();
- }
- #ifdef YY_USE_PROTOS
- void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
- #else
- void yy_switch_to_buffer( new_buffer )
- YY_BUFFER_STATE new_buffer;
- #endif
- {
- if ( yy_current_buffer == new_buffer )
- return;
- if ( yy_current_buffer )
- {
- /* flush out information for old buffer */
- *yy_c_buf_p = yy_hold_char;
- yy_current_buffer->yy_buf_pos = yy_c_buf_p;
- yy_current_buffer->yy_n_chars = yy_n_chars;
- }
- yy_current_buffer = new_buffer;
- yy_load_buffer_state();
- /* we don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yy_did_buffer_switch_on_eof = 1;
- }
- #ifdef YY_USE_PROTOS
- void yy_load_buffer_state( void )
- #else
- void yy_load_buffer_state()
- #endif
- {
- yy_n_chars = yy_current_buffer->yy_n_chars;
- yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
- yyin = yy_current_buffer->yy_input_file;
- yy_hold_char = *yy_c_buf_p;
- }
- #ifdef YY_USE_PROTOS
- YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
- #else
- YY_BUFFER_STATE yy_create_buffer( file, size )
- FILE *file;
- int size;
- #endif
- {
- YY_BUFFER_STATE b;
- b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
- b->yy_buf_size = size;
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
- yy_init_buffer( b, file );
- return ( b );
- }
- #ifdef YY_USE_PROTOS
- void yy_delete_buffer( YY_BUFFER_STATE b )
- #else
- void yy_delete_buffer( b )
- YY_BUFFER_STATE b;
- #endif
- {
- if ( b == yy_current_buffer )
- yy_current_buffer = (YY_BUFFER_STATE) 0;
- free( (char *) b->yy_ch_buf );
- free( (char *) b );
- }
- #ifdef YY_USE_PROTOS
- void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
- #else
- void yy_init_buffer( b, file )
- YY_BUFFER_STATE b;
- FILE *file;
- #endif
- {
- b->yy_input_file = file;
- /* we put in the 'n' and start reading from [1] so that an
- * initial match-at-newline will be true.
- */
- b->yy_ch_buf[0] = 'n';
- b->yy_n_chars = 1;
- /* we always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
- b->yy_buf_pos = &b->yy_ch_buf[1];
- b->yy_eof_status = EOF_NOT_SEEN;
- }
- # line 310 "scan_c.l"
- typedef struct save_yy_cond {
- int yy_cond;
- struct save_yy_cond *nxt;
- } *sv_ys_ptr;
- static sv_ys_ptr save_yy_start=NULL;
- static void
- save_condition (void)
- {
- register sv_ys_ptr nptr=(sv_ys_ptr)xmalloc(sizeof(struct save_yy_cond));
- nptr->yy_cond=yy_start;
- nptr->nxt=save_yy_start;
- save_yy_start=nptr;
- #ifdef FLEX_DEBUG
- if(yy_flex_debug)
- fprintf(stderr,"n Lex: save condition :%d => (%d)n",
- yy_start,nptr->yy_cond);
- #endif
- }
- static void
- rest_condition(void)
- {
- register sv_ys_ptr nptr=save_yy_start;
- if(nptr==NULL)
- fatal("Lex: Impossible restore conditions before save it !",NULL);
- yy_start=nptr->yy_cond;
- save_yy_start=nptr->nxt;
- #ifdef FLEX_DEBUG
- if(yy_flex_debug)
- fprintf(stderr,"n Lex: restore condition :%d <=(%d)n",
- yy_start,nptr->yy_cond);
- #endif
- xfree(nptr);
- }
- static struct
- {
- char *mode;
- char *ext;
- int state;
- } scan_modes[] =
- {
- {"0" ,"? ?",INITIAL},
- {"SQL" ,"sql",SQL},
- {"MODULE","sql",MOD},
- {"SCHEMA","sql",SCH},
- {"C" ,"ec" ,C_lang},
- {"DMP" ,"trl",-1}
- };
- void
- client_scan_mode(int *p,char *s)
- {
- register int k;
- if(!s)
- return;
- for(k=sizeof(scan_modes)/sizeof(*scan_modes);k--;)
- if(0==strcmp(s,scan_modes[k].mode))
- break;
- *p=scan_modes[k].state;
- }
- static void
- outtype(char *text,int ins_directives)
- {
- char *p;
- if (ins_directives & 1)
- fprintf (yyout,"
- progname_out);
- if (text)
- for (p = text; *p ; p++)
- if (*p != 'n')
- putc(*p,yyout);
- else
- {
- if (ins_directives & 4)
- {
- #if __STDC__ /* we assume produced code will be compiled by the same compiler */
- fputs(""nt"",yyout);
- io_diff++;
- #else
- while (*p == ' ' || *p == 'n' || *p == 't') p++;
- putc(' ',yyout); p--;
- #endif
- }
- else
- {
- putc('n',yyout);
- io_diff++;
- }
- }
- if (ins_directives & 2)
- {
- fprintf(yyout,"
- io_diff++;
- }
- }
- int
- scanner (void)
- {
- extern int open_file __P((FILE ** f, char *ext));
- int sm, oldsm;
- sm = 0;
- oldsm = scan_mode_state;
-
- if ( ( yyin = fopen (progname, "r") ) == NULL )
- {
- yyerror ("can't open input file");
- return 0;
- }
- if (open_file (&yyout, "c") )
- {
- char b[120];
- strcpy (b, sql_prg);
- strcat (b, ".c");
- progname_out = savestring (b);
- }
- else
- yyfatal ("Can't create .c output file");
- if (scan_mode_state == INITIAL)
- {
- register i4_t k;
- register char *pn = progname+strlen(progname);
- for (k = sizeof(scan_modes)/sizeof(*scan_modes); k--; )
- if (0 == strcmp(pn - strlen(scan_modes[k].ext),scan_modes[k].ext))
- break;
- scan_mode_state = scan_modes[k].state;
- }
- #if 0
- /*
- * analyzing for dump extension -
- * may be load tree dump and continue processing from dumping point
- */
- if (scan_mode_state == INITIAL)
- {
- register int k;
- register char *pn = progname+strlen(progname);
- for (k = 0; compiler_passes[k].sname; k++)
- if (0 == strcmp(pn - strlen(compiler_passes[k].ext),compiler_passes[k].ext))
- {
- scan_mode_state = -1;
- break;
- }
- }
- #endif
- yy_init = 1;
- io_diff = 0;
- line_num = 1;
- outtype ("/* This file is created automatically by gsql compiler */n"
- "#include <gnusql/sql.h>n"
- "#include "",0);
- outtype (sql_prg,0);
- outtype (".Sc"nn",2);
- while (SCANNER_NAME () )
- {
- extern char *prepare_statement(char *a,i4_t b,char **repl);
- char *repl = NULL;
- if (sm == 0)
- {
- if(scan_mode_state == SCH)
- {
- int ln = line_num;
- line_num = 1;
- outtype ("n"
- "#include "dyn_funcs.h"n"
- "n"
- "int main(int argc, char **argv) {n", 1);
- line_num = ln ;
- }
- sm = scan_mode_state;
- }
- else
- assert ((sm == scan_mode_state) || (sm == INITIAL));
- if (statement_scanner_buffer == NULL)
- yyfatal ( "Unexpected null input line");
- if (sm == SCH) /* if we scan schema - there is no need to compile */
- { /* anything now - let's do it all at run time */
- outtype (" SQL__execute_immediate ("", 0);
- outtype (statement_scanner_buffer, 4);
- outtype (" ");n"
- " if(SQLCODE>0)n"
- " fprintf(stderr,"SQL warning:%s\n",gsqlca.errmsg);n"
- " if(SQLCODE<0){n"
- " fprintf(stderr,"SQL error:%s\n",gsqlca.errmsg);n"
- " goto errexit;n"
- " }n"
- , 0);
- }
- else if ( ! prepare_statement (statement_scanner_buffer, bline,
- (sm == MOD? NULL:&repl)) )
- return 0;
- io_diff -= line_num - bline;
- if (sm != MOD)
- outtype (repl, (sm == SCH) ? 0 : 3 );
- bline = line_num;
- }
- if (sm == SCH)
- outtype ("n"
- " " CALL_COMMIT_str "n"
- " return 0;n"
- " errexit:n"
- " " CALL_ROLLBACK_str "n"
- " return SQLCODE;n"
- "}n"
- "/* end of create schema routine */n"
- "n", 0);
- scan_mode_state = oldsm;
- if (yyin != stdin )
- fclose (yyin);
- fclose (yyout);
- return 1;
- }
- int yywrap() { return 1; }