bootscanner.c

来自「PostgreSQL 8.1.4的源码 适用于Linux下的开源数据库系统」· C语言 代码 · 共 1,876 行 · 第 1/4 页

C
1,876
字号
       34,   64,   68,   69,   69,   70,   71,   70,   72,   73,       71,   73,   71,   70,   75,   32,   74,   73,   72,   74,       75,   78,   74,   78,   72,   29,   75,   78,   74,   76,       76,   77,   79,   79,   77,   18,   76,   77,   80,   79,       81,   81,   80,   84,   88,   84,   88,   84,   80,   81,       89,   90,   88,   91,   89,   92,   89,   93,   90,   91,       92,   92,   94,   95,   90,   91,   96,   93,   94,   96,       94,   95,   96,   93,   97,   98,   99,   95,  100,  101,       97,   98,   99,  100,  104,  101,  105,   98,  106,  100,      107,  105,  105,  108,  106,  104,  107,  109,  110,  108,      109,  104,  111,  109,  110,  108,  112,  114,  111,  113,       13,  112,  112,  114,  111,  115,  113,  116,  117,  114,      119,  115,  113,  116,  117,  118,  119,  120,  118,  122,      121,  118,  123,  120,  121,  122,  121,  126,  124,  120,      125,  130,  127,  123,  124,  125,  125,  126,  127,  123,      128,  129,  130,  126,  129,  132,  128,  129,  130,  131,      131,  132,  133,  134,  135,  131,  135,  132,  133,  134,      136,  137,  135,  136,    8,  138,    3,  141,  139,  136,      141,  137,  138,  139,  139,  140,  141,  137,  138,  140,      142,  140,  143,  144,  144,  145,  142,    2,  143,    0,      144,  145,  147,  147,  147,  147,  149,  149,  150,    0,      150,  150,  146,  146,  146,  146,  146,  146,  146,  146,      146,  146,  146,  146,  146,  146,  146,  146,  146,  146,      146,  146,  146,  146,  146,  146,  146,  146,  146,  146,      146,  146,  146,  146,  146,  146,  146,  146,  146,  146,      146,  146,  146,  146,  146    } ;static Int_yy_state_type Int_yy_last_accepting_state;static char *Int_yy_last_accepting_cpos;/* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */#define REJECT reject_used_but_not_detected#define Int_yymore() Int_yymore_used_but_not_detected#define YY_MORE_ADJ 0#define YY_RESTORE_YY_MORE_OFFSETchar *Int_yytext;#line 1 "bootscanner.l"#define INITIAL 0#line 2 "bootscanner.l"/*------------------------------------------------------------------------- * * bootscanner.l *	  a lexical scanner for the bootstrap parser * * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION *	  $PostgreSQL: pgsql/src/backend/bootstrap/bootscanner.l,v 1.40 2005/06/29 22:51:54 tgl Exp $ * *------------------------------------------------------------------------- */#include "postgres.h"#include "access/attnum.h"#include "access/htup.h"#include "access/itup.h"#include "access/skey.h"#include "access/tupdesc.h"#include "bootstrap/bootstrap.h"#include "catalog/pg_am.h"#include "catalog/pg_attribute.h"#include "catalog/pg_class.h"#include "nodes/nodes.h"#include "nodes/parsenodes.h"#include "nodes/pg_list.h"#include "nodes/primnodes.h"#include "parser/scansup.h"#include "rewrite/prs2lock.h"#include "storage/block.h"#include "storage/fd.h"#include "storage/itemptr.h"#include "storage/off.h"#include "utils/rel.h"/* Not needed now that this file is compiled as part of bootparse. *//* #include "bootstrap_tokens.h" *//* Avoid exit() on fatal scanner errors (a bit ugly -- see Int_yy_fatal_error) */#undef fprintf#define fprintf(file, fmt, msg)  ereport(ERROR, (errmsg_internal("%s", msg)))static int	Int_yyline = 1;			/* line number for error reporting */#define YY_NEVER_INTERACTIVE 1#define YY_NO_UNPUT 1#line 565 "lex.Int_yy.c"/* Macros after this point can all be overridden by user definitions in * section 1. */#ifndef YY_SKIP_YYWRAP#ifdef __cplusplusextern "C" int Int_yywrap YY_PROTO(( void ));#elseextern int Int_yywrap YY_PROTO(( void ));#endif#endif#ifndef YY_NO_UNPUTstatic void Int_yyunput YY_PROTO(( int c, char *buf_ptr ));#endif#ifndef Int_yytext_ptrstatic void Int_yy_flex_strncpy YY_PROTO(( char *, Int_yyconst char *, int ));#endif#ifdef YY_NEED_STRLENstatic int Int_yy_flex_strlen YY_PROTO(( Int_yyconst char * ));#endif#ifndef YY_NO_INPUT#ifdef __cplusplusstatic int Int_yyinput YY_PROTO(( void ));#elsestatic int input YY_PROTO(( void ));#endif#endif#if YY_STACK_USEDstatic int Int_yy_start_stack_ptr = 0;static int Int_yy_start_stack_depth = 0;static int *Int_yy_start_stack = 0;#ifndef YY_NO_PUSH_STATEstatic void Int_yy_push_state YY_PROTO(( int new_state ));#endif#ifndef YY_NO_POP_STATEstatic void Int_yy_pop_state YY_PROTO(( void ));#endif#ifndef YY_NO_TOP_STATEstatic int Int_yy_top_state YY_PROTO(( void ));#endif#else#define YY_NO_PUSH_STATE 1#define YY_NO_POP_STATE 1#define YY_NO_TOP_STATE 1#endif#ifdef YY_MALLOC_DECLYY_MALLOC_DECL#else#if __STDC__#ifndef __cplusplus#include <stdlib.h>#endif#else/* Just try to get by without declaring the routines.  This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */#endif#endif/* Amount of stuff to slurp up with each read. */#ifndef YY_READ_BUF_SIZE#define YY_READ_BUF_SIZE 8192#endif/* Copy whatever the last rule matched to the standard output. */#ifndef ECHO/* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */#define ECHO (void) fwrite( Int_yytext, Int_yyleng, 1, Int_yyout )#endif/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL, * is returned in "result". */#ifndef YY_INPUT#define YY_INPUT(buf,result,max_size) \	if ( Int_yy_current_buffer->Int_yy_is_interactive ) \		{ \		int c = '*', n; \		for ( n = 0; n < max_size && \			     (c = getc( Int_yyin )) != EOF && c != '\n'; ++n ) \			buf[n] = (char) c; \		if ( c == '\n' ) \			buf[n++] = (char) c; \		if ( c == EOF && ferror( Int_yyin ) ) \			YY_FATAL_ERROR( "input in flex scanner failed" ); \		result = n; \		} \	else if ( ((result = fread( buf, 1, max_size, Int_yyin )) == 0) \		  && ferror( Int_yyin ) ) \		YY_FATAL_ERROR( "input in flex scanner failed" );#endif/* No semi-colon after return; correct usage is to write "Int_yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */#ifndef Int_yyterminate#define Int_yyterminate() return YY_NULL#endif/* Number of entries by which start-condition stack grows. */#ifndef YY_START_STACK_INCR#define YY_START_STACK_INCR 25#endif/* Report a fatal error. */#ifndef YY_FATAL_ERROR#define YY_FATAL_ERROR(msg) Int_yy_fatal_error( msg )#endif/* Default declaration of generated scanner - a define so the user can * easily add parameters. */#ifndef YY_DECL#define YY_DECL int Int_yylex YY_PROTO(( void ))#endif/* Code executed at the beginning of each rule, after Int_yytext and Int_yyleng * have been set up. */#ifndef YY_USER_ACTION#define YY_USER_ACTION#endif/* Code executed at the end of each rule. */#ifndef YY_BREAK#define YY_BREAK break;#endif#define YY_RULE_SETUP \	if ( Int_yyleng > 0 ) \		Int_yy_current_buffer->Int_yy_at_bol = \				(Int_yytext[Int_yyleng - 1] == '\n'); \	YY_USER_ACTIONYY_DECL	{	register Int_yy_state_type Int_yy_current_state;	register char *Int_yy_cp, *Int_yy_bp;	register int Int_yy_act;#line 66 "bootscanner.l"#line 722 "lex.Int_yy.c"	if ( Int_yy_init )		{		Int_yy_init = 0;#ifdef YY_USER_INIT		YY_USER_INIT;#endif		if ( ! Int_yy_start )			Int_yy_start = 1;	/* first start state */		if ( ! Int_yyin )			Int_yyin = stdin;		if ( ! Int_yyout )			Int_yyout = stdout;		if ( ! Int_yy_current_buffer )			Int_yy_current_buffer =				Int_yy_create_buffer( Int_yyin, YY_BUF_SIZE );		Int_yy_load_buffer_state();		}	while ( 1 )		/* loops until end-of-file is reached */		{		Int_yy_cp = Int_yy_c_buf_p;		/* Support of Int_yytext. */		*Int_yy_cp = Int_yy_hold_char;		/* Int_yy_bp points to the position in Int_yy_ch_buf of the start of		 * the current run.		 */		Int_yy_bp = Int_yy_cp;		Int_yy_current_state = Int_yy_start;		Int_yy_current_state += YY_AT_BOL();Int_yy_match:		do			{			register YY_CHAR Int_yy_c = Int_yy_ec[YY_SC_TO_UI(*Int_yy_cp)];			if ( Int_yy_accept[Int_yy_current_state] )				{				Int_yy_last_accepting_state = Int_yy_current_state;				Int_yy_last_accepting_cpos = Int_yy_cp;				}			while ( Int_yy_chk[Int_yy_base[Int_yy_current_state] + Int_yy_c] != Int_yy_current_state )				{				Int_yy_current_state = (int) Int_yy_def[Int_yy_current_state];				if ( Int_yy_current_state >= 147 )					Int_yy_c = Int_yy_meta[(unsigned int) Int_yy_c];				}			Int_yy_current_state = Int_yy_nxt[Int_yy_base[Int_yy_current_state] + (unsigned int) Int_yy_c];			++Int_yy_cp;			}		while ( Int_yy_base[Int_yy_current_state] != 413 );Int_yy_find_action:		Int_yy_act = Int_yy_accept[Int_yy_current_state];		if ( Int_yy_act == 0 )			{ /* have to back up */			Int_yy_cp = Int_yy_last_accepting_cpos;			Int_yy_current_state = Int_yy_last_accepting_state;			Int_yy_act = Int_yy_accept[Int_yy_current_state];			}		YY_DO_BEFORE_ACTION;do_action:	/* This label is used only to access EOF actions. */		switch ( Int_yy_act )	{ /* beginning of action switch */			case 0: /* must back up */			/* undo the effects of YY_DO_BEFORE_ACTION */			*Int_yy_cp = Int_yy_hold_char;			Int_yy_cp = Int_yy_last_accepting_cpos;			Int_yy_current_state = Int_yy_last_accepting_state;			goto Int_yy_find_action;case 1:YY_RULE_SETUP#line 68 "bootscanner.l"{ return(OPEN); }	YY_BREAKcase 2:YY_RULE_SETUP#line 70 "bootscanner.l"{ return(XCLOSE); }	YY_BREAKcase 3:YY_RULE_SETUP#line 72 "bootscanner.l"{ return(XCREATE); }	YY_BREAKcase 4:YY_RULE_SETUP#line 74 "bootscanner.l"{ return(OBJ_ID); }	YY_BREAKcase 5:YY_RULE_SETUP#line 75 "bootscanner.l"{ return(XBOOTSTRAP); }	YY_BREAKcase 6:YY_RULE_SETUP#line 76 "bootscanner.l"{ return(XSHARED_RELATION); }	YY_BREAKcase 7:YY_RULE_SETUP#line 77 "bootscanner.l"{ return(XWITHOUT_OIDS); }	YY_BREAKcase 8:YY_RULE_SETUP#line 78 "bootscanner.l"{ return(NULLVAL); }	YY_BREAKcase 9:YY_RULE_SETUP#line 80 "bootscanner.l"{ return(INSERT_TUPLE); }	YY_BREAKcase 10:YY_RULE_SETUP#line 82 "bootscanner.l"{ return(COMMA); }	YY_BREAKcase 11:YY_RULE_SETUP#line 83 "bootscanner.l"{ return(EQUALS); }	YY_BREAKcase 12:YY_RULE_SETUP#line 84 "bootscanner.l"{ return(LPAREN); }	YY_BREAKcase 13:YY_RULE_SETUP#line 85 "bootscanner.l"{ return(RPAREN); }	YY_BREAKcase 14:YY_RULE_SETUP#line 87 "bootscanner.l"{ Int_yyline++; }	YY_BREAKcase 15:YY_RULE_SETUP#line 88 "bootscanner.l";	YY_BREAKcase 16:YY_RULE_SETUP#line 89 "bootscanner.l";	YY_BREAKcase 17:YY_RULE_SETUP#line 91 "bootscanner.l"; /* drop everything after "#" for comments */	YY_BREAKcase 18:YY_RULE_SETUP#line 94 "bootscanner.l"{ return(XDECLARE); }	YY_BREAKcase 19:YY_RULE_SETUP#line 95 "bootscanner.l"{ return(XBUILD); }	YY_BREAKcase 20:YY_RULE_SETUP#line 96 "bootscanner.l"{ return(INDICES); }	YY_BREAKcase 21:YY_RULE_SETUP#line 97 "bootscanner.l"{ return(UNIQUE); }	YY_BREAKcase 22:YY_RULE_SETUP#line 98 "bootscanner.l"{ return(INDEX); }	YY_BREAKcase 23:YY_RULE_SETUP#line 99 "bootscanner.l"{ return(ON); }	YY_BREAKcase 24:YY_RULE_SETUP#line 100 "bootscanner.l"{ return(USING); }	YY_BREAKcase 25:YY_RULE_SETUP#line 102 "bootscanner.l"{					Int_yylval.ival = EnterString(MapArrayTypeName((char*)Int_yytext));					return(ID);				}	YY_BREAKcase 26:YY_RULE_SETUP#line 106 "bootscanner.l"{					char   *newid = scanstr((char*)Int_yytext);					Int_yylval.ival = EnterString(newid);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?