⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tcldate.c

📁 tcl是工具命令语言
💻 C
📖 第 1 页 / 共 4 页
字号:
-1, 1,	0, -1,	-2, 0,	};# define YYNPROD 56# define YYLAST 261static CONST TclDatetabelem TclDateact[]={    24,    40,    23,    36,    54,    81,    41,    28,    53,    26,    37,    42,    58,    38,    56,    28,    27,    26,    28,    33,    26,    32,    61,    50,    27,    80,    76,    27,    51,    75,    74,    73,    30,    72,    71,    70,    69,    52,    49,    48,    47,    45,    39,    62,    78,    46,    79,    68,    25,    65,    60,    67,    66,    55,    44,    21,    63,    11,    10,     9,     8,    35,     7,     6,     5,     4,     3,    43,     2,     1,    20,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,    57,     0,     0,    59,    77,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,    19,    14,     0,     0,     0,    16,    28,    22,    26,     0,    12,    13,    17,     0,    15,    27,    18,    31,     0,     0,    29,     0,    34,    28,     0,    26,     0,     0,     0,     0,     0,     0,    27,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,    64,    64 };static CONST TclDatetabelem TclDatepact[]={-10000000,   -43,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,   -26,  -268,-10000000,  -259,  -226,-10000000,  -257,    10,  -227,  -212,  -228,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,  -229,-10000000,  -230,  -240,  -231,-10000000,-10000000,  -264,-10000000,     9,-10000000,-10000000,  -249,-10000000,-10000000,  -246,-10000000,     4,    -2,     2,     7,     6,-10000000,-10000000,   -11,  -232,-10000000,-10000000,-10000000,-10000000,  -233,-10000000,  -234,  -235,-10000000,  -237,  -238,  -239,  -242,-10000000,-10000000,-10000000,    -1,-10000000,-10000000,-10000000,   -12,-10000000,  -243,  -263,-10000000,-10000000 };static CONST TclDatetabelem TclDatepgo[]={     0,    48,    70,    22,    69,    68,    66,    65,    64,    63,    62,    60,    59,    58,    57,    55 };static CONST TclDatetabelem TclDater1[]={     0,     4,     4,     5,     5,     5,     5,     5,     5,     5,     5,     5,     6,     6,     6,     6,     6,     7,     7,     7,    10,    10,    10,    10,    10,     8,     8,     8,     8,     8,     8,     8,     8,     8,     8,     9,     9,    12,    12,    12,    13,    11,    11,    15,    15,    15,    15,    15,     2,     2,     1,     1,     1,    14,     3,     3 };static CONST TclDatetabelem TclDater2[]={     0,     0,     4,     3,     3,     3,     3,     3,     3,     3,     3,     2,     5,     9,    11,    13,    15,     5,     3,     3,     3,     5,     5,     7,     5,     7,    11,     3,    11,    11,     5,     9,     5,     3,     7,     5,     7,     7,    15,     5,     9,     5,     2,     7,     5,     5,     7,     3,     3,     3,     3,     3,     3,     3,     1,     3 };static CONST TclDatetabelem TclDatechk[]={-10000000,    -4,    -5,    -6,    -7,    -8,    -9,   -10,   -11,   -12,   -13,   -14,   268,   269,   259,   272,   263,   270,   274,   258,    -2,   -15,   265,    45,    43,    -1,   266,   273,   264,   261,    58,   258,    47,    45,   263,    -1,   271,   269,   272,   268,   258,   263,   268,    -1,    44,   268,   257,   268,   268,   268,   263,   268,   268,   272,   268,    44,   263,    -1,   258,    -1,    46,    -3,    45,    58,   261,    47,    45,    45,    58,   268,   268,   268,   268,   268,   268,   268,   268,    -3,    45,    58,   268,   268 };static CONST TclDatetabelem TclDatedef[]={     1,    -2,     2,     3,     4,     5,     6,     7,     8,     9,    10,    11,    53,    18,    19,    27,     0,    33,     0,    20,     0,    42,     0,    48,    49,    47,    50,    51,    52,    12,     0,    22,     0,     0,    32,    44,    17,     0,    39,    30,    24,    35,     0,    45,    21,     0,    41,     0,    54,    25,     0,     0,    34,    37,     0,     0,    36,    46,    23,    43,     0,    13,     0,     0,    55,     0,     0,     0,     0,    31,    40,    14,    54,    26,    28,    29,     0,    15,     0,     0,    16,    38 };typedef struct#ifdef __cplusplus	TclDatetoktype#endif{ char *t_name; int t_val; } TclDatetoktype;#ifndef YYDEBUG#	define YYDEBUG	0	/* don't allow debugging */#endif#if YYDEBUGTclDatetoktype TclDatetoks[] ={	"tAGO",	257,	"tDAY",	258,	"tDAYZONE",	259,	"tID",	260,	"tMERIDIAN",	261,	"tMINUTE_UNIT",	262,	"tMONTH",	263,	"tMONTH_UNIT",	264,	"tSTARDATE",	265,	"tSEC_UNIT",	266,	"tSNUMBER",	267,	"tUNUMBER",	268,	"tZONE",	269,	"tEPOCH",	270,	"tDST",	271,	"tISOBASE",	272,	"tDAY_UNIT",	273,	"tNEXT",	274,	"-unknown-",	-1	/* ends search */};char * TclDatereds[] ={	"-no such reduction-",	"spec : /* empty */",	"spec : spec item",	"item : time",	"item : zone",	"item : date",	"item : ordMonth",	"item : day",	"item : relspec",	"item : iso",	"item : trek",	"item : number",	"time : tUNUMBER tMERIDIAN",	"time : tUNUMBER ':' tUNUMBER o_merid",	"time : tUNUMBER ':' tUNUMBER '-' tUNUMBER",	"time : tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid",	"time : tUNUMBER ':' tUNUMBER ':' tUNUMBER '-' tUNUMBER",	"zone : tZONE tDST",	"zone : tZONE",	"zone : tDAYZONE",	"day : tDAY",	"day : tDAY ','",	"day : tUNUMBER tDAY",	"day : sign tUNUMBER tDAY",	"day : tNEXT tDAY",	"date : tUNUMBER '/' tUNUMBER",	"date : tUNUMBER '/' tUNUMBER '/' tUNUMBER",	"date : tISOBASE",	"date : tUNUMBER '-' tMONTH '-' tUNUMBER",	"date : tUNUMBER '-' tUNUMBER '-' tUNUMBER",	"date : tMONTH tUNUMBER",	"date : tMONTH tUNUMBER ',' tUNUMBER",	"date : tUNUMBER tMONTH",	"date : tEPOCH",	"date : tUNUMBER tMONTH tUNUMBER",	"ordMonth : tNEXT tMONTH",	"ordMonth : tNEXT tUNUMBER tMONTH",	"iso : tISOBASE tZONE tISOBASE",	"iso : tISOBASE tZONE tUNUMBER ':' tUNUMBER ':' tUNUMBER",	"iso : tISOBASE tISOBASE",	"trek : tSTARDATE tUNUMBER '.' tUNUMBER",	"relspec : relunits tAGO",	"relspec : relunits",	"relunits : sign tUNUMBER unit",	"relunits : tUNUMBER unit",	"relunits : tNEXT unit",	"relunits : tNEXT tUNUMBER unit",	"relunits : unit",	"sign : '-'",	"sign : '+'",	"unit : tSEC_UNIT",	"unit : tDAY_UNIT",	"unit : tMONTH_UNIT",	"number : tUNUMBER",	"o_merid : /* empty */",	"o_merid : tMERIDIAN",};#endif /* YYDEBUG *//* * Copyright (c) 1993 by Sun Microsystems, Inc. *//*** Skeleton parser driver for yacc output*//*** yacc user known macros and defines*/#define YYERROR		goto TclDateerrlab#define YYACCEPT	return(0)#define YYABORT		return(1)#define YYBACKUP( newtoken, newvalue )\{\	if ( TclDatechar >= 0 || ( TclDater2[ TclDatetmp ] >> 1 ) != 1 )\	{\		TclDateerror( "syntax error - cannot backup" );\		goto TclDateerrlab;\	}\	TclDatechar = newtoken;\	TclDatestate = *TclDateps;\	TclDatelval = newvalue;\	goto TclDatenewstate;\}#define YYRECOVERING()	(!!TclDateerrflag)#define YYNEW(type)	malloc(sizeof(type) * TclDatenewmax)#define YYCOPY(to, from, type) \	(type *) memcpy(to, (char *) from, TclDatemaxdepth * sizeof (type))#define YYENLARGE( from, type) \	(type *) realloc((char *) from, TclDatenewmax * sizeof(type))#ifndef YYDEBUG#	define YYDEBUG	1	/* make debugging available */#endif/*** user known globals*/int TclDatedebug;			/* set to 1 to get debugging *//*** driver internal defines*/#define YYFLAG		(-10000000)/*** global variables used by the parser*/YYSTYPE *TclDatepv;			/* top of value stack */int *TclDateps;			/* top of state stack */int TclDatestate;			/* current state */int TclDatetmp;			/* extra var (lasts between blocks) */int TclDatenerrs;			/* number of errors */int TclDateerrflag;			/* error recovery flag */int TclDatechar;			/* current input token number */#ifdef YYNMBCHARS#define YYLEX()		TclDatecvtok(TclDatelex())/*** TclDatecvtok - return a token if i is a wchar_t value that exceeds 255.**	If i<255, i itself is the token.  If i>255 but the neither **	of the 30th or 31st bit is on, i is already a token.*/#if defined(__STDC__) || defined(__cplusplus)int TclDatecvtok(int i)#elseint TclDatecvtok(i) int i;#endif{	int first = 0;	int last = YYNMBCHARS - 1;	int mid;	wchar_t j;	if(i&0x60000000){/*Must convert to a token. */		if( TclDatembchars[last].character < i ){			return i;/*Giving up*/		}		while ((last>=first)&&(first>=0)) {/*Binary search loop*/			mid = (first+last)/2;			j = TclDatembchars[mid].character;			if( j==i ){/*Found*/ 				return TclDatembchars[mid].tvalue;			}else if( j<i ){				first = mid + 1;			}else{				last = mid -1;			}		}		/*No entry in the table.*/		return i;/* Giving up.*/	}else{/* i is already a token. */		return i;	}}#else/*!YYNMBCHARS*/#define YYLEX()		TclDatelex()#endif/*!YYNMBCHARS*//*** TclDateparse - return 0 if worked, 1 if syntax error not recovered from*/#if defined(__STDC__) || defined(__cplusplus)int TclDateparse(void)#elseint TclDateparse()#endif{	register YYSTYPE *TclDatepvt = 0;	/* top of value stack for $vars */#if defined(__cplusplus) || defined(lint)/*	hacks to please C++ and lint - goto's inside	switch should never be executed*/	static int __yaccpar_lint_hack__ = 0;	switch (__yaccpar_lint_hack__)	{		case 1: goto TclDateerrlab;		case 2: goto TclDatenewstate;	}#endif	/*	** Initialize externals - TclDateparse may be called more than once	*/	TclDatepv = &TclDatev[-1];	TclDateps = &TclDates[-1];	TclDatestate = 0;	TclDatetmp = 0;	TclDatenerrs = 0;	TclDateerrflag = 0;	TclDatechar = -1;#if YYMAXDEPTH <= 0	if (TclDatemaxdepth <= 0)	{		if ((TclDatemaxdepth = YYEXPAND(0)) <= 0)		{			TclDateerror("yacc initialization error");			YYABORT;		}	}#endif	{		register YYSTYPE *TclDate_pv;	/* top of value stack */		register int *TclDate_ps;		/* top of state stack */		register int TclDate_state;		/* current state */		register int  TclDate_n;		/* internal state number info */	goto TclDatestack;	/* moved from 6 lines above to here to please C++ */		/*		** get globals into registers.		** branch to here only if YYBACKUP was called.		*/		TclDate_pv = TclDatepv;		TclDate_ps = TclDateps;		TclDate_state = TclDatestate;		goto TclDate_newstate;		/*		** get globals into registers.		** either we just started, or we just finished a reduction		*/	TclDatestack:		TclDate_pv = TclDatepv;		TclDate_ps = TclDateps;		TclDate_state = TclDatestate;		/*		** top of for (;;) loop while no reductions done		*/	TclDate_stack:		/*		** put a state and value onto the stacks		*/#if YYDEBUG		/*		** if debugging, look up token value in list of value vs.		** name pairs.  0 and negative (-1) are special values.		** Note: linear search is used since time is not a real		** consideration while debugging.		*/		if ( TclDatedebug )		{			register int TclDate_i;			printf( "State %d, token ", TclDate_state );			if ( TclDatechar == 0 )				printf( "end-of-file\n" );			else if ( TclDatechar < 0 )				printf( "-none-\n" );			else			{				for ( TclDate_i = 0; TclDatetoks[TclDate_i].t_val >= 0;					TclDate_i++ )				{					if ( TclDatetoks[TclDate_i].t_val == TclDatechar )						break;				}				printf( "%s\n", TclDatetoks[TclDate_i].t_name );			}		}#endif /* YYDEBUG */		if ( ++TclDate_ps >= &TclDates[ TclDatemaxdepth ] )	/* room on stack? */		{			/*			** reallocate and recover.  Note that pointers			** have to be reset, or bad things will happen			*/			long TclDateps_index = (TclDate_ps - TclDates);			long TclDatepv_index = (TclDate_pv - TclDatev);			long TclDatepvt_index = (TclDatepvt - TclDatev);			int TclDatenewmax;#ifdef YYEXPAND			TclDatenewmax = YYEXPAND(TclDatemaxdepth);#else			TclDatenewmax = 2 * TclDatemaxdepth;	/* double table size */			if (TclDatemaxdepth == YYMAXDEPTH)	/* first time growth */			{				char *newTclDates = (char *)YYNEW(int);				char *newTclDatev = (char *)YYNEW(YYSTYPE);				if (newTclDates != 0 && newTclDatev != 0)				{					TclDates = YYCOPY(newTclDates, TclDates, int);					TclDatev = YYCOPY(newTclDatev, TclDatev, YYSTYPE);				}				else					TclDatenewmax = 0;	/* failed */			}			else				/* not first time */			{				TclDates = YYENLARGE(TclDates, int);				TclDatev = YYENLARGE(TclDatev, YYSTYPE);				if (TclDates == 0 || TclDatev == 0)					TclDatenewmax = 0;	/* failed */			}#endif			if (TclDatenewmax <= TclDatemaxdepth)	/* tables not expanded */			{				TclDateerror( "yacc stack overflow" );				YYABORT;			}			TclDatemaxdepth = TclDatenewmax;			TclDate_ps = TclDates + TclDateps_index;			TclDate_pv = TclDatev + TclDatepv_index;			TclDatepvt = TclDatev + TclDatepvt_index;		}		*TclDate_ps = TclDate_state;		*++TclDate_pv = TclDateval;		/*		** we have a new state - find out what to do		*/	TclDate_newstate:		if ( ( TclDate_n = TclDatepact[ TclDate_state ] ) <= YYFLAG )			goto TclDatedefault;		/* simple state */#if YYDEBUG		/*		** if debugging, need to mark whether new token grabbed		*/		TclDatetmp = TclDatechar < 0;#endif		if ( ( TclDatechar < 0 ) && ( ( TclDatechar = YYLEX() ) < 0 ) )			TclDatechar = 0;		/* reached EOF */#if YYDEBUG		if ( TclDatedebug && TclDatetmp )		{			register int TclDate_i;			printf( "Received token " );			if ( TclDatechar == 0 )				printf( "end-of-file\n" );			else if ( TclDatechar < 0 )				printf( "-none-\n" );			else			{				for ( TclDate_i = 0; TclDatetoks[TclDate_i].t_val >= 0;					TclDate_i++ )

⌨️ 快捷键说明

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