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

📄 getdate.c

📁 Linux下文件工具。
💻 C
📖 第 1 页 / 共 5 页
字号:
    }  YYDPRINTF ((stderr, "Entering state %d\n", yystate));  goto yybackup;/*-----------.| yybackup.  |`-----------*/yybackup:/* Do appropriate processing given the current state.  *//* Read a lookahead token if we need one and don't already have one.  *//* yyresume: */  /* First try to decide what to do without reference to lookahead token.  */  yyn = yypact[yystate];  if (yyn == YYFLAG)    goto yydefault;  /* Not known => get a lookahead token if don't already have one.  */  /* yychar is either YYEMPTY or YYEOF     or a valid token in external form.  */  if (yychar == YYEMPTY)    {      YYDPRINTF ((stderr, "Reading a token: "));      yychar = YYLEX;    }  /* Convert token to internal form (in yychar1) for indexing tables with */  if (yychar <= 0)		/* This means end of input. */    {      yychar1 = 0;      yychar = YYEOF;		/* Don't call YYLEX any more */      YYDPRINTF ((stderr, "Now at end of input.\n"));    }  else    {      yychar1 = YYTRANSLATE (yychar);#if YYDEBUG     /* We have to keep this `#if YYDEBUG', since we use variables	which are defined only if `YYDEBUG' is set.  */      if (yydebug)	{	  YYFPRINTF (stderr, "Next token is %d (%s",		     yychar, yytname[yychar1]);	  /* Give the individual parser a way to print the precise	     meaning of a token, for further debugging info.  */# ifdef YYPRINT	  YYPRINT (stderr, yychar, yylval);# endif	  YYFPRINTF (stderr, ")\n");	}#endif    }  yyn += yychar1;  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)    goto yydefault;  yyn = yytable[yyn];  /* yyn is what to do for this token type in this state.     Negative => reduce, -yyn is rule number.     Positive => shift, yyn is new state.       New state is final state => don't bother to shift,       just return success.     0, or most negative number => error.  */  if (yyn < 0)    {      if (yyn == YYFLAG)	goto yyerrlab;      yyn = -yyn;      goto yyreduce;    }  else if (yyn == 0)    goto yyerrlab;  if (yyn == YYFINAL)    YYACCEPT;  /* Shift the lookahead token.  */  YYDPRINTF ((stderr, "Shifting token %d (%s), ",	      yychar, yytname[yychar1]));  /* Discard the token being shifted unless it is eof.  */  if (yychar != YYEOF)    yychar = YYEMPTY;  *++yyvsp = yylval;#if YYLSP_NEEDED  *++yylsp = yylloc;#endif  /* Count tokens shifted since error; after three, turn off error     status.  */  if (yyerrstatus)    yyerrstatus--;  yystate = yyn;  goto yynewstate;/*-----------------------------------------------------------.| yydefault -- do the default action for the current state.  |`-----------------------------------------------------------*/yydefault:  yyn = yydefact[yystate];  if (yyn == 0)    goto yyerrlab;  goto yyreduce;/*-----------------------------.| yyreduce -- Do a reduction.  |`-----------------------------*/yyreduce:  /* yyn is the number of a rule to reduce with.  */  yylen = yyr2[yyn];  /* If YYLEN is nonzero, implement the default value of the action:     `$$ = $1'.     Otherwise, the following line sets YYVAL to the semantic value of     the lookahead token.  This behavior is undocumented and Bison     users should not rely upon it.  Assigning to YYVAL     unconditionally makes the parser a bit smaller, and it avoids a     GCC warning that YYVAL may be used uninitialized.  */  yyval = yyvsp[1-yylen];#if YYLSP_NEEDED  /* Similarly for the default location.  Let the user run additional     commands if for instance locations are ranges.  */  yyloc = yylsp[1-yylen];  YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);#endif#if YYDEBUG  /* We have to keep this `#if YYDEBUG', since we use variables which     are defined only if `YYDEBUG' is set.  */  if (yydebug)    {      int yyi;      YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",		 yyn, yyrline[yyn]);      /* Print the symbols being reduced, and their result.  */      for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)	YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);      YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);    }#endif  switch (yyn) {case 3:#line 195 "getdate.y"{ PC.times_seen++; }    break;case 4:#line 197 "getdate.y"{ PC.local_zones_seen++; }    break;case 5:#line 199 "getdate.y"{ PC.zones_seen++; }    break;case 6:#line 201 "getdate.y"{ PC.dates_seen++; }    break;case 7:#line 203 "getdate.y"{ PC.days_seen++; }    break;case 8:#line 205 "getdate.y"{ PC.rels_seen++; }    break;case 10:#line 211 "getdate.y"{	PC.hour = yyvsp[-1].textintval.value;	PC.minutes = 0;	PC.seconds = 0;	PC.meridian = yyvsp[0].intval;      }    break;case 11:#line 218 "getdate.y"{	PC.hour = yyvsp[-3].textintval.value;	PC.minutes = yyvsp[-1].textintval.value;	PC.seconds = 0;	PC.meridian = yyvsp[0].intval;      }    break;case 12:#line 225 "getdate.y"{	PC.hour = yyvsp[-3].textintval.value;	PC.minutes = yyvsp[-1].textintval.value;	PC.meridian = MER24;	PC.zones_seen++;	PC.time_zone = yyvsp[0].textintval.value % 100 + (yyvsp[0].textintval.value / 100) * 60;      }    break;case 13:#line 233 "getdate.y"{	PC.hour = yyvsp[-5].textintval.value;	PC.minutes = yyvsp[-3].textintval.value;	PC.seconds = yyvsp[-1].textintval.value;	PC.meridian = yyvsp[0].intval;      }    break;case 14:#line 240 "getdate.y"{	PC.hour = yyvsp[-5].textintval.value;	PC.minutes = yyvsp[-3].textintval.value;	PC.seconds = yyvsp[-1].textintval.value;	PC.meridian = MER24;	PC.zones_seen++;	PC.time_zone = yyvsp[0].textintval.value % 100 + (yyvsp[0].textintval.value / 100) * 60;      }    break;case 15:#line 252 "getdate.y"{ PC.local_isdst = yyvsp[0].intval; }    break;case 16:#line 254 "getdate.y"{ PC.local_isdst = yyvsp[-1].intval < 0 ? 1 : yyvsp[-1].intval + 1; }    break;case 17:#line 259 "getdate.y"{ PC.time_zone = yyvsp[0].intval; }    break;case 18:#line 261 "getdate.y"{ PC.time_zone = yyvsp[0].intval + 60; }    break;case 19:#line 263 "getdate.y"{ PC.time_zone = yyvsp[-1].intval + 60; }    break;case 20:#line 268 "getdate.y"{	PC.day_ordinal = 1;	PC.day_number = yyvsp[0].intval;      }    break;case 21:#line 273 "getdate.y"{	PC.day_ordinal = 1;	PC.day_number = yyvsp[-1].intval;      }    break;case 22:#line 278 "getdate.y"{	PC.day_ordinal = yyvsp[-1].textintval.value;	PC.day_number = yyvsp[0].intval;      }    break;case 23:#line 286 "getdate.y"{	PC.month = yyvsp[-2].textintval.value;	PC.day = yyvsp[0].textintval.value;      }    break;case 24:#line 291 "getdate.y"{	/* Interpret as YYYY/MM/DD if the first value has 4 or more digits,	   otherwise as MM/DD/YY.	   The goal in recognizing YYYY/MM/DD is solely to support legacy	   machine-generated dates like those in an RCS log listing.  If	   you want portability, use the ISO 8601 format.  */	if (4 <= yyvsp[-4].textintval.digits)	  {	    PC.year = yyvsp[-4].textintval;	    PC.month = yyvsp[-2].textintval.value;	    PC.day = yyvsp[0].textintval.value;	  }	else	  {	    PC.month = yyvsp[-4].textintval.value;	    PC.day = yyvsp[-2].textintval.value;	    PC.year = yyvsp[0].textintval;	  }      }    break;case 25:#line 311 "getdate.y"{	/* ISO 8601 format.  YYYY-MM-DD.  */	PC.year = yyvsp[-2].textintval;	PC.month = -yyvsp[-1].textintval.value;	PC.day = -yyvsp[0].textintval.value;      }    break;case 26:#line 318 "getdate.y"{	/* e.g. 17-JUN-1992.  */	PC.day = yyvsp[-2].textintval.value;	PC.month = yyvsp[-1].intval;	PC.year.value = -yyvsp[0].textintval.value;	PC.year.digits = yyvsp[0].textintval.digits;      }    break;case 27:#line 326 "getdate.y"{	PC.month = yyvsp[-1].intval;	PC.day = yyvsp[0].textintval.value;      }    break;case 28:#line 331 "getdate.y"{	PC.month = yyvsp[-3].intval;	PC.day = yyvsp[-2].textintval.value;	PC.year = yyvsp[0].textintval;      }    break;case 29:#line 337 "getdate.y"{	PC.day = yyvsp[-1].textintval.value;	PC.month = yyvsp[0].intval;      }    break;case 30:#line 342 "getdate.y"{	PC.day = yyvsp[-2].textintval.value;	PC.month = yyvsp[-1].intval;	PC.year = yyvsp[0].textintval;      }    break;case 31:#line 351 "getdate.y"{	PC.rel_seconds = -PC.rel_seconds;	PC.rel_minutes = -PC.rel_minutes;	PC.rel_hour = -PC.rel_hour;	PC.rel_day = -PC.rel_day;	PC.rel_month = -PC.rel_month;	PC.rel_year = -PC.rel_year;      }    break;case 33:#line 364 "getdate.y"{ PC.rel_year += yyvsp[-1].textintval.value * yyvsp[0].intval; }    break;case 34:#line 366 "getdate.y"{ PC.rel_year += yyvsp[-1].textintval.value * yyvsp[0].intval; }    break;case 35:#line 368 "getdate.y"{ PC.rel_year += yyvsp[0].intval; }    break;case 36:#line 370 "getdate.y"{ PC.rel_month += yyvsp[-1].textintval.value * yyvsp[0].intval; }    break;case 37:#line 372 "getdate.y"{ PC.rel_month += yyvsp[-1].textintval.value * yyvsp[0].intval; }    break;case 38:#line 374 "getdate.y"{ PC.rel_month += yyvsp[0].intval; }    break;case 39:#line 376 "getdate.y"{ PC.rel_day += yyvsp[-1].textintval.value * yyvsp[0].intval; }    break;case 40:#line 378 "getdate.y"{ PC.rel_day += yyvsp[-1].textintval.value * yyvsp[0].intval; }    break;case 41:#line 380 "getdate.y"{ PC.rel_day += yyvsp[0].intval; }    break;case 42:#line 382 "getdate.y"{ PC.rel_hour += yyvsp[-1].textintval.value * yyvsp[0].intval; }    break;case 43:#line 384 "getdate.y"{ PC.rel_hour += yyvsp[-1].textintval.value * yyvsp[0].intval; }    break;case 44:#line 386 "getdate.y"{ PC.rel_hour += yyvsp[0].intval; }    break;case 45:#line 388 "getdate.y"{ PC.rel_minutes += yyvsp[-1].textintval.value * yyvsp[0].intval; }    break;case 46:#line 390 "getdate.y"{ PC.rel_minutes += yyvsp[-1].textintval.value * yyvsp[0].intval; }    break;case 47:#line 392 "getdate.y"{ PC.rel_minutes += yyvsp[0].intval; }    break;case 48:#line 394 "getdate.y"{ PC.rel_seconds += yyvsp[-1].textintval.value * yyvsp[0].intval; }    break;case 49:#line 396 "getdate.y"{ PC.rel_seconds += yyvsp[-1].textintval.value * yyvsp[0].intval; }    break;case 50:#line 398 "getdate.y"{ PC.rel_seconds += yyvsp[0].intval; }    break;case 51:#line 403 "getdate.y"{	if (PC.dates_seen	    && ! PC.rels_seen && (PC.times_seen || 2 < yyvsp[0].textintval.digits))	  PC.year = yyvsp[0].textintval;	else	  {	    if (4 < yyvsp[0].textintval.digits)	      {		PC.dates_seen++;		PC.day = yyvsp[0].textintval.value % 100;		PC.month = (yyvsp[0].textintval.value / 100) % 100;		PC.year.value = yyvsp[0].textintval.value / 10000;		PC.year.digits = yyvsp[0].textintval.digits - 4;	      }	    else	      {		PC.times_seen++;		if (yyvsp[0].textintval.digits <= 2)		  {		    PC.hour = yyvsp[0].textintval.value;		    PC.minutes = 0;		  }		else		  {

⌨️ 快捷键说明

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