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

📄 parsedate.c

📁 php-4.4.7学习linux时下载的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
    break;  case 41:    {	    ((struct date_yy *)parm)->yyRelDay += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);	}    break;  case 42:    {	    ((struct date_yy *)parm)->yyRelDay += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);	}    break;  case 43:    {	    ((struct date_yy *)parm)->yyRelDay += (yyvsp[(1) - (1)].Number);	}    break;  case 44:    {	    ((struct date_yy *)parm)->yyRelHour += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);	}    break;  case 45:    {	    ((struct date_yy *)parm)->yyRelHour += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);	}    break;  case 46:    {	    ((struct date_yy *)parm)->yyRelHour += (yyvsp[(1) - (1)].Number);	}    break;  case 47:    {	    ((struct date_yy *)parm)->yyRelMinutes += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);	}    break;  case 48:    {	    ((struct date_yy *)parm)->yyRelMinutes += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);	}    break;  case 49:    {	    ((struct date_yy *)parm)->yyRelMinutes += (yyvsp[(1) - (1)].Number);	}    break;  case 50:    {	    ((struct date_yy *)parm)->yyRelSeconds += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);	}    break;  case 51:    {	    ((struct date_yy *)parm)->yyRelSeconds += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);	}    break;  case 52:    {	    ((struct date_yy *)parm)->yyRelSeconds += (yyvsp[(1) - (1)].Number);	}    break;  case 53:    {	    if (((struct date_yy *)parm)->yyHaveTime && 			((struct date_yy *)parm)->yyHaveDate && 			!((struct date_yy *)parm)->yyHaveRel)	      ((struct date_yy *)parm)->yyYear = (yyvsp[(1) - (1)].Number);	    else	      {		if ((yyvsp[(1) - (1)].Number)>10000)		  {		    ((struct date_yy *)parm)->yyHaveDate++;		    ((struct date_yy *)parm)->yyDay= ((yyvsp[(1) - (1)].Number))%100;		    ((struct date_yy *)parm)->yyMonth= ((yyvsp[(1) - (1)].Number)/100)%100;		    ((struct date_yy *)parm)->yyYear = (yyvsp[(1) - (1)].Number)/10000;		  }		else		  {		    ((struct date_yy *)parm)->yyHaveTime++;		    if ((yyvsp[(1) - (1)].Number) < 100)		      {			((struct date_yy *)parm)->yyHour = (yyvsp[(1) - (1)].Number);			((struct date_yy *)parm)->yyMinutes = 0;		      }		    else		      {		    	((struct date_yy *)parm)->yyHour = (yyvsp[(1) - (1)].Number) / 100;		    	((struct date_yy *)parm)->yyMinutes = (yyvsp[(1) - (1)].Number) % 100;		      }		    ((struct date_yy *)parm)->yySeconds = 0;		    ((struct date_yy *)parm)->yyMeridian = MER24;		  }	      }	  }    break;  case 54:    {	    (yyval.Meridian) = MER24;	  }    break;  case 55:    {	    (yyval.Meridian) = (yyvsp[(1) - (1)].Meridian);	  }    break;/* Line 1267 of yacc.c.  */      default: break;    }  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);  YYPOPSTACK (yylen);  yylen = 0;  YY_STACK_PRINT (yyss, yyssp);  *++yyvsp = yyval;  /* Now `shift' the result of the reduction.  Determine what state     that goes to, based on the state we popped back to and the rule     number reduced by.  */  yyn = yyr1[yyn];  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)    yystate = yytable[yystate];  else    yystate = yydefgoto[yyn - YYNTOKENS];  goto yynewstate;/*------------------------------------.| yyerrlab -- here on detecting error |`------------------------------------*/yyerrlab:  /* If not already recovering from an error, report this error.  */  if (!yyerrstatus)    {      ++yynerrs;#if ! YYERROR_VERBOSE      yyerror (YY_("syntax error"));#else      {	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)	  {	    YYSIZE_T yyalloc = 2 * yysize;	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))	      yyalloc = YYSTACK_ALLOC_MAXIMUM;	    if (yymsg != yymsgbuf)	      YYSTACK_FREE (yymsg);	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);	    if (yymsg)	      yymsg_alloc = yyalloc;	    else	      {		yymsg = yymsgbuf;		yymsg_alloc = sizeof yymsgbuf;	      }	  }	if (0 < yysize && yysize <= yymsg_alloc)	  {	    (void) yysyntax_error (yymsg, yystate, yychar);	    yyerror (yymsg);	  }	else	  {	    yyerror (YY_("syntax error"));	    if (yysize != 0)	      goto yyexhaustedlab;	  }      }#endif    }  if (yyerrstatus == 3)    {      /* If just tried and failed to reuse look-ahead token after an	 error, discard it.  */      if (yychar <= YYEOF)	{	  /* Return failure if at end of input.  */	  if (yychar == YYEOF)	    YYABORT;	}      else	{	  yydestruct ("Error: discarding",		      yytoken, &yylval);	  yychar = YYEMPTY;	}    }  /* Else will try to reuse look-ahead token after shifting the error     token.  */  goto yyerrlab1;/*---------------------------------------------------.| yyerrorlab -- error raised explicitly by YYERROR.  |`---------------------------------------------------*/yyerrorlab:  /* Pacify compilers like GCC when the user code never invokes     YYERROR and the label yyerrorlab therefore never appears in user     code.  */  if (/*CONSTCOND*/ 0)     goto yyerrorlab;  /* Do not reclaim the symbols of the rule which action triggered     this YYERROR.  */  YYPOPSTACK (yylen);  yylen = 0;  YY_STACK_PRINT (yyss, yyssp);  yystate = *yyssp;  goto yyerrlab1;/*-------------------------------------------------------------.| yyerrlab1 -- common code for both syntax error and YYERROR.  |`-------------------------------------------------------------*/yyerrlab1:  yyerrstatus = 3;	/* Each real token shifted decrements this.  */  for (;;)    {      yyn = yypact[yystate];      if (yyn != YYPACT_NINF)	{	  yyn += YYTERROR;	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)	    {	      yyn = yytable[yyn];	      if (0 < yyn)		break;	    }	}      /* Pop the current state because it cannot handle the error token.  */      if (yyssp == yyss)	YYABORT;      yydestruct ("Error: popping",		  yystos[yystate], yyvsp);      YYPOPSTACK (1);      yystate = *yyssp;      YY_STACK_PRINT (yyss, yyssp);    }  if (yyn == YYFINAL)    YYACCEPT;  *++yyvsp = yylval;  /* Shift the error token.  */  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);  yystate = yyn;  goto yynewstate;/*-------------------------------------.| yyacceptlab -- YYACCEPT comes here.  |`-------------------------------------*/yyacceptlab:  yyresult = 0;  goto yyreturn;/*-----------------------------------.| yyabortlab -- YYABORT comes here.  |`-----------------------------------*/yyabortlab:  yyresult = 1;  goto yyreturn;#ifndef yyoverflow/*-------------------------------------------------.| yyexhaustedlab -- memory exhaustion comes here.  |`-------------------------------------------------*/yyexhaustedlab:  yyerror (YY_("memory exhausted"));  yyresult = 2;  /* Fall through.  */#endifyyreturn:  if (yychar != YYEOF && yychar != YYEMPTY)     yydestruct ("Cleanup: discarding lookahead",		 yytoken, &yylval);  /* Do not reclaim the symbols of the rule which action triggered     this YYABORT or YYACCEPT.  */  YYPOPSTACK (yylen);  YY_STACK_PRINT (yyss, yyssp);  while (yyssp != yyss)    {      yydestruct ("Cleanup: popping",		  yystos[*yyssp], yyvsp);      YYPOPSTACK (1);    }#ifndef yyoverflow  if (yyss != yyssa)    YYSTACK_FREE (yyss);#endif#if YYERROR_VERBOSE  if (yymsg != yymsgbuf)    YYSTACK_FREE (yymsg);#endif  /* Make sure YYID is used.  */  return YYID (yyresult);}time_t get_date (char *p, time_t *now);#ifndef PHP_WIN32extern struct tm	*gmtime();extern struct tm	*localtime();extern time_t		mktime();#endif/* Month and day table. */static TABLE const MonthDayTable[] = {    { "january",	tMONTH,  1 },    { "february",	tMONTH,  2 },    { "march",		tMONTH,  3 },    { "april",		tMONTH,  4 },    { "may",		tMONTH,  5 },    { "june",		tMONTH,  6 },    { "july",		tMONTH,  7 },    { "august",		tMONTH,  8 },    { "september",	tMONTH,  9 },    { "sept",		tMONTH,  9 },    { "october",	tMONTH, 10 },    { "november",	tMONTH, 11 },    { "december",	tMONTH, 12 },    { "sunday",		tDAY, 0 },    { "monday",		tDAY, 1 },    { "tuesday",	tDAY, 2 },    { "tues",		tDAY, 2 },    { "wednesday",	tDAY, 3 },    { "wednes",		tDAY, 3 },    { "thursday",	tDAY, 4 },    { "thur",		tDAY, 4 },    { "thurs",		tDAY, 4 },    { "friday",		tDAY, 5 },    { "saturday",	tDAY, 6 },    { NULL, 0, 0 }};/* Time units table. */static TABLE const UnitsTable[] = {    { "year",		tYEAR_UNIT,	1 },    { "month",		tMONTH_UNIT,	1 },    { "fortnight",	tDAY_UNIT,	14 },    { "week",		tDAY_UNIT,	7 },    { "day",		tDAY_UNIT,	1 },    { "hour",		tHOUR_UNIT,	1 },    { "minute",		tMINUTE_UNIT,	1 },    { "min",		tMINUTE_UNIT,	1 },    { "second",		tSEC_UNIT,	1 },    { "sec",		tSEC_UNIT,	1 },    { NULL, 0, 0 }};/* Assorted relative-time words. */static TABLE const OtherTable[] = {    { "tomorrow",	tDAY_UNIT,	1 },    { "yesterday",	tDAY_UNIT,	-1 },    { "today",		tDAY_UNIT,	0 },    { "now",		tDAY_UNIT,	0 },    { "last",		tUNUMBER,	-1 },    { "this",		tUNUMBER,	0 },    { "next",		tUNUMBER,	1 },    { "first",		tUNUMBER,	1 },/*  { "second",		tUNUMBER,	2 }, */    { "third",		tUNUMBER,	3 },    { "fourth",		tUNUMBER,	4 },    { "fifth",		tUNUMBER,	5 },    { "sixth",		tUNUMBER,	6 },    { "seventh",	tUNUMBER,	7 },    { "eighth",		tUNUMBER,	8 },    { "ninth",		tUNUMBER,	9 },    { "tenth",		tUNUMBER,	10 },    { "eleventh",	tUNUMBER,	11 },    { "twelfth",	tUNUMBER,	12 },    { "ago",		tAGO,	1 },    { NULL, 0, 0 }};/* The timezone table. */static TABLE const TimezoneTable[] = {    { "gmt",	tZONE,     HOUR ( 0) },	/* Greenwich Mean */    { "ut",	tZONE,     HOUR ( 0) },	/* Universal (Coordinated) */    { "utc",	tZONE,     HOUR ( 0) },    { "wet",	tZONE,     HOUR ( 0) },	/* Western European */    { "bst",	tDAYZONE,  HOUR ( 0) },	/* British Summer */    { "wat",	tZONE,     HOUR ( 1) },	/* West Africa */    { "at",	tZONE,     HOUR ( 2) },	/* Azores */#if	0    /* For completeness.  BST is also British Summer, and GST is     * also Guam Standard. */    { "bst",	tZONE,     HOUR ( 3) },	/* Brazil Standard */    { "gst",	tZONE,     HOUR ( 3) },	/* Greenland Standard */#endif#if 0    { "nft",	tZONE,     HOUR (3.5) },	/* Newfoundland */    { "nst",	tZONE,     HOUR (3.5) },	/* Newfoundland Standard */    { "ndt",	tDAYZONE,  HOUR (3.5) },	/* Newfoundland Daylight */#endif    { "ast",	tZONE,     HOUR ( 4) },	/* Atlantic Standard */    { "adt",	tDAYZONE,  HOUR ( 4) },	/* Atlantic Daylight */    { "est",	tZONE,     HOUR ( 5) },	/* Eastern Standard */    { "edt",	tDAYZONE,  HOUR ( 5) },	/* Eastern Daylight */    { "cst",	tZONE,     HOUR ( 6) },	/* Central Standard */    { "cdt",	tDAYZONE,  HOUR ( 6) },	/* Central Daylight */    { "mst",	tZONE,     HOUR ( 7) },	/* Mountain Standard */    { "mdt",	tDAYZONE,  HOUR ( 7) },	/* Mountain Daylight */    { "pst",	tZONE,     HOUR ( 8) },	/* Pacific Standard */    { "pdt",	tDAYZONE,  HOUR ( 8) },	/* Pacific Daylight */    { "yst",	tZONE,     HOUR ( 9) },	/* Yukon Standard */    { "ydt",	tDAYZONE,  HOUR ( 9) },	/* Yukon Daylight */    { "hst",	tZONE,     HOUR (10) },	/* Hawaii Standard */    { "hdt",	tDAYZONE,  HOUR (10) },	/* Hawaii Daylight */    { "cat",	tZONE,     HOUR (10) },	/* Central Alaska */    { "akst",	tZONE,     HOUR (10) }, /* Alaska Standard */    { "akdt",	tZONE,     HOUR (10) }, /* Alaska Daylight */    { "ahst",	tZONE,     HOUR (10) },	/* Alaska-Hawaii Standard */    { "nt",	tZONE,     HOUR (11) },	/* Nome */    { "idlw",	tZONE,     HOUR (12) },	/* International Date Line West */    { "cet",	tZONE,     -HOUR (1) },	/* Central

⌨️ 快捷键说明

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