home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / GETDATE.ZIP / GETDATE.C next >
Text File  |  1991-08-20  |  42KB  |  1,215 lines

  1.  
  2.  
  3. # define ID 257
  4. # define MONTH 258
  5. # define DAY 259
  6. # define MERIDIAN 260
  7. # define SNUMBER 261
  8. # define UNUMBER 262
  9. # define UNIT 263
  10. # define MUNIT 264
  11. # define SUNIT 265
  12. # define ZONE 266
  13. # define DAYZONE 267
  14. # define AGO 268
  15.  
  16. # line 3 "getdate.y"
  17.         /*      Originally from: Steven M. Bellovin (unc!smb)   */
  18.         /*      Dept. of Computer Science                       */
  19.         /*      University of North Carolina at Chapel Hill     */
  20.         /*      @(#)getdate.y   2.20    9/1/89  */
  21.  
  22. #ifdef COMMENT
  23. #include "defs.h"
  24. #endif
  25.  
  26. #include <sys/types.h>
  27. #ifdef USG
  28. struct timeb
  29. {
  30.         time_t  time;
  31.         unsigned short millitm;
  32.         short   timezone;
  33.         short   dstflag;
  34. };
  35. #else
  36. #include <sys/timeb.h>
  37. #endif
  38. #include <ctype.h>
  39.  
  40. #if defined(BSD4_2)
  41. #include <sys/time.h>
  42. #else /* sane */
  43. #include <time.h>
  44. #endif /* sane */
  45.  
  46. #define NULL    0
  47. #define daysec (24L*60L*60L)
  48.         static int timeflag, zoneflag, dateflag, dayflag, relflag;
  49.         static time_t relsec, relmonth;
  50.         static int hh, mm, ss, merid, daylght;
  51.         static int dayord, dayreq;
  52.         static int month, day, year;
  53.         static int ourzone;
  54. #define AM 1
  55. #define PM 2
  56. #define DAYLIGHT 1
  57. #define STANDARD 2
  58. #define MAYBE    3
  59. #define yyclearin yychar = -1
  60. #define yyerrok yyerrflag = 0
  61. extern int yychar;
  62. extern int yyerrflag;
  63. #ifndef YYMAXDEPTH
  64. #define YYMAXDEPTH 150
  65. #endif
  66. #ifndef YYSTYPE
  67. #define YYSTYPE int
  68. #endif
  69. YYSTYPE yylval, yyval;
  70. typedef int yytabelem;
  71. # define YYERRCODE 256
  72.  
  73. # line 126 "getdate.y"
  74.  
  75.  
  76. static int mdays[12] =
  77.         {31, 0, 31,  30, 31, 30,  31, 31, 30,  31, 30, 31};
  78. #define epoch 1970
  79.  
  80. extern struct tm *localtime();
  81.  
  82. time_t
  83. dateconv(mm, dd, yy, h, m, s, mer, zone, dayflag)
  84. int mm, dd, yy, h, m, s, mer, zone, dayflag;
  85. {
  86.         time_t tod, jdate;
  87.         register int i;
  88.         time_t timeconv();
  89.  
  90.         if (yy < 0) yy = -yy;
  91.         if (yy < 100) yy += 1900;
  92.         mdays[1] = 28 + (yy%4 == 0 && (yy%100 != 0 || yy%400 == 0));
  93.         if (yy < epoch || yy > 1999 || mm < 1 || mm > 12 ||
  94.                 dd < 1 || dd > mdays[--mm]) return (-1);
  95.         jdate = dd-1;
  96.         for (i=0; i<mm; i++) jdate += mdays[i];
  97.         for (i = epoch; i < yy; i++) jdate += 365 + (i%4 == 0);
  98.         jdate *= daysec;
  99.         jdate += zone * 60L;
  100.         if ((tod = timeconv(h, m, s, mer)) < 0) return (-1);
  101.         jdate += tod;
  102.         if (dayflag==DAYLIGHT || (dayflag==MAYBE&&localtime(&jdate)->tm_isdst))
  103.                 jdate += -1*60*60;
  104.         return (jdate);
  105. }
  106.  
  107. time_t
  108. dayconv(ord, day, now)
  109. int ord, day; time_t now;
  110. {
  111.         register struct tm *loctime;
  112.         time_t tod;
  113.         time_t daylcorr();
  114.  
  115.         tod = now;
  116.         loctime = localtime(&tod);
  117.         tod += daysec * ((day - loctime->tm_wday + 7) % 7);
  118.         tod += 7*daysec*(ord<=0?ord:ord-1);
  119.         return daylcorr(tod, now);
  120. }
  121.  
  122. time_t
  123. timeconv(hh, mm, ss, mer)
  124. register int hh, mm, ss, mer;
  125. {
  126.         if (mm < 0 || mm > 59 || ss < 0 || ss > 59) return (-1);
  127.         switch (mer) {
  128.                 case AM: if (hh < 1 || hh > 12) return(-1);
  129.                          return (60L * ((hh%12)*60L + mm)+ss);
  130.                 case PM: if (hh < 1 || hh > 12) return(-1);
  131.                          return (60L * ((hh%12 +12)*60L + mm)+ss);
  132.                 case 24: if (hh < 0 || hh > 23) return (-1);
  133.                          return (60L * (hh*60L + mm)+ss);
  134.                 default: return (-1);
  135.         }
  136. }
  137. time_t
  138. monthadd(sdate, relmonth)
  139. time_t sdate, relmonth;
  140. {
  141.         struct tm *ltime;
  142.         time_t dateconv();
  143.         time_t daylcorr();
  144.         int mm, yy;
  145.  
  146.         if (relmonth == 0) return 0;
  147.         ltime = localtime(&sdate);
  148.         mm = 12*ltime->tm_year + ltime->tm_mon + relmonth;
  149.         yy = mm/12;
  150.         mm = mm%12 + 1;
  151.         return daylcorr(dateconv(mm, ltime->tm_mday, yy, ltime->tm_hour,
  152.                 ltime->tm_min, ltime->tm_sec, 24, ourzone, MAYBE), sdate);
  153. }
  154.  
  155. time_t
  156. daylcorr(future, now)
  157. time_t future, now;
  158. {
  159.         int fdayl, nowdayl;
  160.  
  161.         nowdayl = (localtime(&now)->tm_hour+1) % 24;
  162.         fdayl = (localtime(&future)->tm_hour+1) % 24;
  163.         return (future-now) + 60L*60L*(nowdayl-fdayl);
  164. }
  165.  
  166. static char *lptr;
  167.  
  168. yylex()
  169. {
  170.         extern int yylval;
  171.         int sign = 0;
  172.         register char c;
  173.         register char *p;
  174.         char idbuf[20];
  175.         int pcnt;
  176.  
  177.         for (;;) {
  178.                 while (isspace(*lptr))
  179.                         lptr++;
  180.  
  181.                 if (isdigit(c = *lptr) || c == '-' || c == '+') {
  182.                         if (c== '-' || c == '+') {
  183.                                 if (c=='-') sign = -1;
  184.                                 else sign = 1;
  185.                                 if (!isdigit(*++lptr)) {
  186.                                         /* yylval = sign; return (UNUMBER); */
  187.                                         return yylex(); /* skip the '-' sign */
  188.                                 }
  189.                         }
  190.                         yylval = 0;
  191.                         while (isdigit(c = *lptr++))
  192.                                 yylval = 10*yylval + c - '0';
  193.                         lptr--;
  194.                         if (sign < 0)
  195.                                 yylval = -yylval;
  196.                         if (sign != 0)
  197.                                 return SNUMBER;
  198.                          else
  199.                                 return UNUMBER;
  200.  
  201.                 } else if (isalpha(c)) {
  202.                         p = idbuf;
  203.                         while (isalpha(c = *lptr++) || c=='.')
  204.                                 if (p < &idbuf[sizeof(idbuf)-1]) *p++ = c;
  205.                         *p = '\0';
  206.                         lptr--;
  207.                         return (lookup(idbuf));
  208.                 }
  209.  
  210.                 else if (c == '(') {
  211.                         pcnt = 0;
  212.                         do {
  213.                                 c = *lptr++;
  214.                                 if (c == '\0') return(c);
  215.                                 else if (c == '(') pcnt++;
  216.                                 else if (c == ')') pcnt--;
  217.                         } while (pcnt > 0);
  218.                 }
  219.  
  220.                 else return (*lptr++);
  221.         }
  222. }
  223.  
  224. struct table {
  225.         char *name;
  226.         int type;
  227.         long value;
  228. };
  229.  
  230. struct table mdtab[] = {
  231.         {"january", MONTH, 1},
  232.         {"february", MONTH, 2},
  233.         {"march", MONTH, 3},
  234.         {"april", MONTH, 4},
  235.         {"may", MONTH, 5},
  236.         {"june", MONTH, 6},
  237.         {"july", MONTH, 7},
  238.         {"august", MONTH, 8},
  239.         {"september", MONTH, 9},
  240.         {"sept", MONTH, 9},
  241.         {"october", MONTH, 10},
  242.         {"november", MONTH, 11},
  243.         {"december", MONTH, 12},
  244.  
  245.         {"sunday", DAY, 0},
  246.         {"monday", DAY, 1},
  247.         {"tuesday", DAY, 2},
  248.         {"tues", DAY, 2},
  249.         {"wednesday", DAY, 3},
  250.         {"wednes", DAY, 3},
  251.         {"thursday", DAY, 4},
  252.         {"thur", DAY, 4},
  253.         {"thurs", DAY, 4},
  254.         {"friday", DAY, 5},
  255.         {"saturday", DAY, 6},
  256.         {0, 0, 0}};
  257.  
  258. #define HRS *60
  259. #define HALFHR 30
  260. struct table mztab[] = {
  261.         {"a.m.", MERIDIAN, AM},
  262.         {"am", MERIDIAN, AM},
  263.         {"p.m.", MERIDIAN, PM},
  264.         {"pm", MERIDIAN, PM},
  265.         {"nst", ZONE, 3 HRS + HALFHR},          /* Newfoundland */
  266.         {"n.s.t.", ZONE, 3 HRS + HALFHR},
  267.         {"ast", ZONE, 4 HRS},           /* Atlantic */
  268.         {"a.s.t.", ZONE, 4 HRS},
  269.         {"adt", DAYZONE, 4 HRS},
  270.         {"a.d.t.", DAYZONE, 4 HRS},
  271.         {"est", ZONE, 5 HRS},           /* Eastern */
  272.         {"e.s.t.", ZONE, 5 HRS},
  273.         {"edt", DAYZONE, 5 HRS},
  274.         {"e.d.t.", DAYZONE, 5 HRS},
  275.         {"cst", ZONE, 6 HRS},           /* Central */
  276.         {"c.s.t.", ZONE, 6 HRS},
  277.         {"cdt", DAYZONE, 6 HRS},
  278.         {"c.d.t.", DAYZONE, 6 HRS},
  279.         {"mst", ZONE, 7 HRS},           /* Mountain */
  280.         {"m.s.t.", ZONE, 7 HRS},
  281.         {"mdt", DAYZONE, 7 HRS},
  282.         {"m.d.t.", DAYZONE, 7 HRS},
  283.         {"pst", ZONE, 8 HRS},           /* Pacific */
  284.         {"p.s.t.", ZONE, 8 HRS},
  285.         {"pdt", DAYZONE, 8 HRS},
  286.         {"p.d.t.", DAYZONE, 8 HRS},
  287.         {"yst", ZONE, 9 HRS},           /* Yukon */
  288.         {"y.s.t.", ZONE, 9 HRS},
  289.         {"ydt", DAYZONE, 9 HRS},
  290.         {"y.d.t.", DAYZONE, 9 HRS},
  291.         {"hst", ZONE, 10 HRS},          /* Hawaii */
  292.         {"h.s.t.", ZONE, 10 HRS},
  293.         {"hdt", DAYZONE, 10 HRS},
  294.         {"h.d.t.", DAYZONE, 10 HRS},
  295.  
  296.         {"gmt", ZONE, 0 HRS},
  297.         {"g.m.t.", ZONE, 0 HRS},
  298.         {"bst", DAYZONE, 0 HRS},                /* British Summer Time */
  299.         {"b.s.t.", DAYZONE, 0 HRS},
  300.         {"eet", ZONE, 0 HRS},           /* European Eastern Time */
  301.         {"e.e.t.", ZONE, 0 HRS},
  302.         {"eest", DAYZONE, 0 HRS},       /* European Eastern Summer Time */
  303.         {"e.e.s.t.", DAYZONE, 0 HRS},
  304.         {"met", ZONE, -1 HRS},          /* Middle European Time */
  305.         {"m.e.t.", ZONE, -1 HRS},
  306.         {"mest", DAYZONE, -1 HRS},      /* Middle European Summer Time */
  307.         {"m.e.s.t.", DAYZONE, -1 HRS},
  308.         {"wet", ZONE, -2 HRS },         /* Western European Time */
  309.         {"w.e.t.", ZONE, -2 HRS },
  310.         {"west", DAYZONE, -2 HRS},      /* Western European Summer Time */
  311.         {"w.e.s.t.", DAYZONE, -2 HRS},
  312.  
  313.         {"jst", ZONE, -9 HRS},          /* Japan Standard Time */
  314.         {"j.s.t.", ZONE, -9 HRS},       /* Japan Standard Time */
  315.                                         /* No daylight savings time */
  316.  
  317.         {"aest", ZONE, -10 HRS},        /* Australian Eastern Time */
  318.         {"a.e.s.t.", ZONE, -10 HRS},
  319.         {"aesst", DAYZONE, -10 HRS},    /* Australian Eastern Summer Time */
  320.         {"a.e.s.s.t.", DAYZONE, -10 HRS},
  321.         {"acst", ZONE, -(9 HRS + HALFHR)},      /* Australian Central Time */
  322.         {"a.c.s.t.", ZONE, -(9 HRS + HALFHR)},
  323.         {"acsst", DAYZONE, -(9 HRS + HALFHR)},  /* Australian Central Summer */
  324.         {"a.c.s.s.t.", DAYZONE, -(9 HRS + HALFHR)},
  325.         {"awst", ZONE, -8 HRS},         /* Australian Western Time */
  326.         {"a.w.s.t.", ZONE, -8 HRS},     /* (no daylight time there, I'm told */
  327.         {0, 0, 0}};
  328.  
  329. struct table unittb[] = {
  330.         {"year", MUNIT, 12},
  331.         {"month", MUNIT, 1},
  332.         {"fortnight", UNIT, 14*24*60},
  333.         {"week", UNIT, 7*24*60},
  334.         {"day", UNIT, 1*24*60},
  335.         {"hour", UNIT, 60},
  336.         {"minute", UNIT, 1},
  337.         {"min", UNIT, 1},
  338.         {"second", SUNIT, 1},
  339.         {"sec", SUNIT, 1},
  340.         {0, 0, 0}};
  341.  
  342. struct table othertb[] = {
  343.         {"tomorrow", UNIT, 1*24*60},
  344.         {"yesterday", UNIT, -1*24*60},
  345.         {"today", UNIT, 0},
  346.         {"now", UNIT, 0},
  347.         {"last", UNUMBER, -1},
  348.         {"this", UNIT, 0},
  349.         {"next", UNUMBER, 2},
  350.         {"first", UNUMBER, 1},
  351.         /* {"second", UNUMBER, 2}, */
  352.         {"third", UNUMBER, 3},
  353.         {"fourth", UNUMBER, 4},
  354.         {"fifth", UNUMBER, 5},
  355.         {"sixth", UNUMBER, 6},
  356.         {"seventh", UNUMBER, 7},
  357.         {"eighth", UNUMBER, 8},
  358.         {"ninth", UNUMBER, 9},
  359.         {"tenth", UNUMBER, 10},
  360.         {"eleventh", UNUMBER, 11},
  361.         {"twelfth", UNUMBER, 12},
  362.         {"ago", AGO, 1},
  363.         {0, 0, 0}};
  364.  
  365. struct table milzone[] = {
  366.         {"a", ZONE, 1 HRS},
  367.         {"b", ZONE, 2 HRS},
  368.         {"c", ZONE, 3 HRS},
  369.         {"d", ZONE, 4 HRS},
  370.         {"e", ZONE, 5 HRS},
  371.         {"f", ZONE, 6 HRS},
  372.         {"g", ZONE, 7 HRS},
  373.         {"h", ZONE, 8 HRS},
  374.         {"i", ZONE, 9 HRS},
  375.         {"k", ZONE, 10 HRS},
  376.         {"l", ZONE, 11 HRS},
  377.         {"m", ZONE, 12 HRS},
  378.         {"n", ZONE, -1 HRS},
  379.         {"o", ZONE, -2 HRS},
  380.         {"p", ZONE, -3 HRS},
  381.         {"q", ZONE, -4 HRS},
  382.         {"r", ZONE, -5 HRS},
  383.         {"s", ZONE, -6 HRS},
  384.         {"t", ZONE, -7 HRS},
  385.         {"u", ZONE, -8 HRS},
  386.         {"v", ZONE, -9 HRS},
  387.         {"w", ZONE, -10 HRS},
  388.         {"x", ZONE, -11 HRS},
  389.         {"y", ZONE, -12 HRS},
  390.         {"z", ZONE, 0 HRS},
  391.         {0, 0, 0}};
  392.  
  393. lookup(id)
  394. char *id;
  395. {
  396. #define gotit (yylval=i->value,  i->type)
  397.  
  398.         char idvar[128];
  399.         register char *j, *k;
  400.         register struct table *i;
  401.         int abbrev;
  402.  
  403.         (void) strcpy(idvar, id);
  404.         j = idvar;
  405.         k = id - 1;
  406.         while (*++k)
  407.                 *j++ = isupper(*k) ? tolower(*k) : *k;
  408.         *j = '\0';
  409.  
  410.         if (strlen(idvar) == 3)
  411.                 abbrev = 1;
  412.         else
  413.                 if (strlen(idvar) == 4 && idvar[3] == '.') {
  414.                         abbrev = 1;
  415.                         idvar[3] = '\0';
  416.                 }
  417.         else
  418.                 abbrev = 0;
  419.  
  420.         for (i = mdtab; i->name; i++) {
  421.                 k = idvar;
  422.                 for (j = i->name; *j++ == *k++;) {
  423.                         if (abbrev && j == i->name+3)
  424.                                 return gotit;
  425.                         if (j[-1] == 0)
  426.                                 return gotit;
  427.                 }
  428.         }
  429.  
  430.         for (i = mztab; i->name; i++)
  431.                 if (strcmp(i->name, idvar) == 0)
  432.                         return gotit;
  433.  
  434.         for (i=mztab; i->name; i++)
  435.                 if (strcmp(i->name, idvar) == 0)
  436.                         return gotit;
  437.  
  438.         for (i=unittb; i->name; i++)
  439.                 if (strcmp(i->name, idvar) == 0)
  440.                         return gotit;
  441.  
  442.         if (idvar[strlen(idvar)-1] == 's')
  443.                 idvar[strlen(idvar)-1] = '\0';
  444.  
  445.         for (i=unittb; i->name; i++)
  446.                 if (strcmp(i->name, idvar) == 0)
  447.                         return gotit;
  448.  
  449.         for (i = othertb; i->name; i++)
  450.                 if (strcmp(i->name, idvar) == 0)
  451.                         return gotit;
  452.  
  453.         if (strlen(idvar) == 1 && isalpha(*idvar)) {
  454.                 for (i = milzone; i->name; i++)
  455.                         if (strcmp(i->name, idvar) == 0)
  456.                                 return gotit;
  457.         }
  458.  
  459.         return ID;
  460. }
  461.  
  462. time_t
  463. getdate(p, now)
  464. char *p;
  465. struct timeb *now;
  466. {
  467. #define mcheck(f)       if (f>1) err++
  468.         time_t monthadd();
  469.         int err;
  470.         struct tm *lt;
  471.         struct timeb ftz;
  472.  
  473.         time_t sdate, tod;
  474.  
  475.         lptr = p;
  476.         if (now == ((struct timeb *) NULL)) {
  477.                 now = &ftz;
  478.                 ftime(&ftz);
  479.         }
  480.         lt = localtime(&now->time);
  481.         year = lt->tm_year;
  482.         month = lt->tm_mon+1;
  483.         day = lt->tm_mday;
  484.         relsec = 0; relmonth = 0;
  485.         timeflag=zoneflag=dateflag=dayflag=relflag=0;
  486.         ourzone = now->timezone;
  487.         daylght = MAYBE;
  488.         hh = mm = ss = 0;
  489.         merid = 24;
  490.  
  491.         if (err = yyparse()) return (-1);
  492.  
  493.         mcheck(timeflag);
  494.         mcheck(zoneflag);
  495.         mcheck(dateflag);
  496.         mcheck(dayflag);
  497.  
  498.         if (err) return (-1);
  499.         if (dateflag || timeflag || dayflag) {
  500.                 sdate = dateconv(month,day,year,hh,mm,ss,merid,ourzone,daylght);
  501.                 if (sdate < 0) return -1;
  502.         }
  503.         else {
  504.                 sdate = now->time;
  505.                 if (relflag == 0)
  506.                         sdate -= (lt->tm_sec + lt->tm_min*60 +
  507.                                 lt->tm_hour*(60L*60L));
  508.         }
  509.  
  510.         sdate += relsec;
  511.         sdate += monthadd(sdate, relmonth);
  512.  
  513.         if (dayflag && !dateflag) {
  514.                 tod = dayconv(dayord, dayreq, sdate);
  515.                 sdate += tod;
  516.         }
  517.  
  518.         /*
  519.         ** Have to do *something* with a legitimate -1 so it's distinguishable
  520.         ** from the error return value.  (Alternately could set errno on error.)
  521.         */
  522.         return (sdate == -1) ? 0 : sdate;
  523. }
  524.  
  525. yyerror(s) char *s;
  526. {}
  527. yytabelem yyexca[] ={
  528. -1, 1,
  529.         0, -1,
  530.         -2, 0,
  531.         };
  532. # define YYNPROD 38
  533. # define YYLAST 223
  534. yytabelem yyact[]={
  535.  
  536.     12,    13,    22,    14,     9,    15,    16,    17,    10,    11,
  537.     42,    18,    41,    20,    29,    30,    31,    43,    44,    38,
  538.     40,    34,    33,    32,    27,    39,    35,    28,     8,     7,
  539.      6,     5,     4,     3,     2,     1,     0,     0,     0,     0,
  540.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  541.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  542.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  543.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  544.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  545.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  546.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  547.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  548.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  549.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  550.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  551.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  552.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  553.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  554.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  555.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  556.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  557.      0,     0,     0,    23,    21,    19,     0,     0,    24,    25,
  558.     26,    36,    37 };
  559. yytabelem yypact[]={
  560.  
  561.  -1000,  -258, -1000, -1000, -1000, -1000, -1000,  -257, -1000,   -45,
  562.  -1000, -1000,  -238,   -17,  -249, -1000, -1000, -1000, -1000, -1000,
  563.   -239, -1000,  -240,  -241, -1000, -1000, -1000,   -18, -1000, -1000,
  564.  -1000, -1000,   -39,   -22, -1000,  -242, -1000, -1000,  -250,  -252,
  565.  -1000,  -243, -1000, -1000, -1000 };
  566. yytabelem yypgo[]={
  567.  
  568.      0,    35,    34,    33,    32,    31,    30,    29,    28 };
  569. yytabelem yyr1[]={
  570.  
  571.      0,     1,     1,     2,     2,     2,     2,     2,     2,     8,
  572.      3,     3,     3,     3,     3,     3,     3,     4,     4,     6,
  573.      6,     6,     5,     5,     5,     5,     5,     5,     7,     7,
  574.      7,     7,     7,     7,     7,     7,     7,     7 };
  575. yytabelem yyr2[]={
  576.  
  577.      0,     0,     4,     3,     3,     3,     3,     3,     2,     3,
  578.      5,     7,     9,     9,    11,    13,    13,     3,     3,     3,
  579.      5,     5,     7,    11,     5,     9,     5,     7,     5,     5,
  580.      5,     5,     5,     5,     3,     3,     3,     5 };
  581. yytabelem yychk[]={
  582.  
  583.  -1000,    -1,    -2,    -3,    -4,    -5,    -6,    -7,    -8,   262,
  584.    266,   267,   258,   259,   261,   263,   264,   265,   268,   260,
  585.     58,   259,    47,   258,   263,   264,   265,   262,    44,   263,
  586.    264,   265,   262,   262,   262,    44,   260,   261,    58,    47,
  587.    262,   262,   262,   260,   261 };
  588. yytabelem yydef[]={
  589.  
  590.      1,    -2,     2,     3,     4,     5,     6,     7,     8,     9,
  591.     17,    18,     0,    19,     0,    34,    35,    36,    37,    10,
  592.      0,    21,     0,    26,    29,    31,    33,    24,    20,    28,
  593.     30,    32,    11,    22,    27,     0,    12,    13,     0,     0,
  594.     25,    14,    23,    15,    16 };
  595. typedef struct { char *t_name; int t_val; } yytoktype;
  596. #ifndef YYDEBUG
  597. #       define YYDEBUG  0       /* don't allow debugging */
  598. #endif
  599.  
  600. #if YYDEBUG
  601.  
  602. yytoktype yytoks[] =
  603. {
  604.         "ID",   257,
  605.         "MONTH",        258,
  606.         "DAY",  259,
  607.         "MERIDIAN",     260,
  608.         "SNUMBER",      261,
  609.         "UNUMBER",      262,
  610.         "UNIT", 263,
  611.         "MUNIT",        264,
  612.         "SUNIT",        265,
  613.         "ZONE", 266,
  614.         "DAYZONE",      267,
  615.         "AGO",  268,
  616.         "-unknown-",    -1      /* ends search */
  617. };
  618.  
  619. char * yyreds[] =
  620. {
  621.         "-no such reduction-",
  622.         "timedate : /* empty */",
  623.         "timedate : timedate item",
  624.         "item : tspec",
  625.         "item : zone",
  626.         "item : dtspec",
  627.         "item : dyspec",
  628.         "item : rspec",
  629.         "item : nspec",
  630.         "nspec : UNUMBER",
  631.         "tspec : UNUMBER MERIDIAN",
  632.         "tspec : UNUMBER ':' UNUMBER",
  633.         "tspec : UNUMBER ':' UNUMBER MERIDIAN",
  634.         "tspec : UNUMBER ':' UNUMBER SNUMBER",
  635.         "tspec : UNUMBER ':' UNUMBER ':' UNUMBER",
  636.         "tspec : UNUMBER ':' UNUMBER ':' UNUMBER MERIDIAN",
  637.         "tspec : UNUMBER ':' UNUMBER ':' UNUMBER SNUMBER",
  638.         "zone : ZONE",
  639.         "zone : DAYZONE",
  640.         "dyspec : DAY",
  641.         "dyspec : DAY ','",
  642.         "dyspec : UNUMBER DAY",
  643.         "dtspec : UNUMBER '/' UNUMBER",
  644.         "dtspec : UNUMBER '/' UNUMBER '/' UNUMBER",
  645.         "dtspec : MONTH UNUMBER",
  646.         "dtspec : MONTH UNUMBER ',' UNUMBER",
  647.         "dtspec : UNUMBER MONTH",
  648.         "dtspec : UNUMBER MONTH UNUMBER",
  649.         "rspec : SNUMBER UNIT",
  650.         "rspec : UNUMBER UNIT",
  651.         "rspec : SNUMBER MUNIT",
  652.         "rspec : UNUMBER MUNIT",
  653.         "rspec : SNUMBER SUNIT",
  654.         "rspec : UNUMBER SUNIT",
  655.         "rspec : UNIT",
  656.         "rspec : MUNIT",
  657.         "rspec : SUNIT",
  658.         "rspec : rspec AGO",
  659. };
  660. #endif /* YYDEBUG */
  661.  
  662. /*
  663. ** Skeleton parser driver for yacc output
  664. */
  665.  
  666. /*
  667. ** yacc user known macros and defines
  668. */
  669. #define YYERROR         goto yyerrlab
  670. #define YYACCEPT        return(0)
  671. #define YYABORT         return(1)
  672. #define YYBACKUP( newtoken, newvalue )\
  673. {\
  674.         if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
  675.         {\
  676.                 yyerror( "syntax error - cannot backup" );\
  677.                 goto yyerrlab;\
  678.         }\
  679.         yychar = newtoken;\
  680.         yystate = *yyps;\
  681.         yylval = newvalue;\
  682.         goto yynewstate;\
  683. }
  684. #define YYRECOVERING()  (!!yyerrflag)
  685. #ifndef YYDEBUG
  686. #       define YYDEBUG  1       /* make debugging available */
  687. #endif
  688.  
  689. /*
  690. ** user known globals
  691. */
  692. int yydebug;                    /* set to 1 to get debugging */
  693.  
  694. /*
  695. ** driver internal defines
  696. */
  697. #define YYFLAG          (-1000)
  698.  
  699. /*
  700. ** global variables used by the parser
  701. */
  702. YYSTYPE yyv[ YYMAXDEPTH ];      /* value stack */
  703. int yys[ YYMAXDEPTH ];          /* state stack */
  704.  
  705. YYSTYPE *yypv;                  /* top of value stack */
  706. int *yyps;                      /* top of state stack */
  707.  
  708. int yystate;                    /* current state */
  709. int yytmp;                      /* extra var (lasts between blocks) */
  710.  
  711. int yynerrs;                    /* number of errors */
  712. int yyerrflag;                  /* error recovery flag */
  713. int yychar;                     /* current input token number */
  714.  
  715.  
  716.  
  717. /*
  718. ** yyparse - return 0 if worked, 1 if syntax error not recovered from
  719. */
  720. int
  721. yyparse()
  722. {
  723.         register YYSTYPE *yypvt;        /* top of value stack for $vars */
  724.  
  725.         /*
  726.         ** Initialize externals - yyparse may be called more than once
  727.         */
  728.         yypv = &yyv[-1];
  729.         yyps = &yys[-1];
  730.         yystate = 0;
  731.         yytmp = 0;
  732.         yynerrs = 0;
  733.         yyerrflag = 0;
  734.         yychar = -1;
  735.  
  736.         goto yystack;
  737.         {
  738.                 register YYSTYPE *yy_pv;        /* top of value stack */
  739.                 register int *yy_ps;            /* top of state stack */
  740.                 register int yy_state;          /* current state */
  741.                 register int  yy_n;             /* internal state number info */
  742.  
  743.                 /*
  744.                 ** get globals into registers.
  745.                 ** branch to here only if YYBACKUP was called.
  746.                 */
  747.         yynewstate:
  748.                 yy_pv = yypv;
  749.                 yy_ps = yyps;
  750.                 yy_state = yystate;
  751.                 goto yy_newstate;
  752.  
  753.                 /*
  754.                 ** get globals into registers.
  755.                 ** either we just started, or we just finished a reduction
  756.                 */
  757.         yystack:
  758.                 yy_pv = yypv;
  759.                 yy_ps = yyps;
  760.                 yy_state = yystate;
  761.  
  762.                 /*
  763.                 ** top of for (;;) loop while no reductions done
  764.                 */
  765.         yy_stack:
  766.                 /*
  767.                 ** put a state and value onto the stacks
  768.                 */
  769. #if YYDEBUG
  770.                 /*
  771.                 ** if debugging, look up token value in list of value vs.
  772.                 ** name pairs.  0 and negative (-1) are special values.
  773.                 ** Note: linear search is used since time is not a real
  774.                 ** consideration while debugging.
  775.                 */
  776.                 if ( yydebug )
  777.                 {
  778.                         register int yy_i;
  779.  
  780.                         printf( "State %d, token ", yy_state );
  781.                         if ( yychar == 0 )
  782.                                 printf( "end-of-file\n" );
  783.                         else if ( yychar < 0 )
  784.                                 printf( "-none-\n" );
  785.                         else
  786.                         {
  787.                                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  788.                                         yy_i++ )
  789.                                 {
  790.                                         if ( yytoks[yy_i].t_val == yychar )
  791.                                                 break;
  792.                                 }
  793.                                 printf( "%s\n", yytoks[yy_i].t_name );
  794.                         }
  795.                 }
  796. #endif /* YYDEBUG */
  797.                 if ( ++yy_ps >= &yys[ YYMAXDEPTH ] )    /* room on stack? */
  798.                 {
  799.                         yyerror( "yacc stack overflow" );
  800.                         YYABORT;
  801.                 }
  802.                 *yy_ps = yy_state;
  803.                 *++yy_pv = yyval;
  804.  
  805.                 /*
  806.                 ** we have a new state - find out what to do
  807.                 */
  808.         yy_newstate:
  809.                 if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
  810.                         goto yydefault;         /* simple state */
  811. #if YYDEBUG
  812.                 /*
  813.                 ** if debugging, need to mark whether new token grabbed
  814.                 */
  815.                 yytmp = yychar < 0;
  816. #endif
  817.                 if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  818.                         yychar = 0;             /* reached EOF */
  819. #if YYDEBUG
  820.                 if ( yydebug && yytmp )
  821.                 {
  822.                         register int yy_i;
  823.  
  824.                         printf( "Received token " );
  825.                         if ( yychar == 0 )
  826.                                 printf( "end-of-file\n" );
  827.                         else if ( yychar < 0 )
  828.                                 printf( "-none-\n" );
  829.                         else
  830.                         {
  831.                                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  832.                                         yy_i++ )
  833.                                 {
  834.                                         if ( yytoks[yy_i].t_val == yychar )
  835.                                                 break;
  836.                                 }
  837.                                 printf( "%s\n", yytoks[yy_i].t_name );
  838.                         }
  839.                 }
  840. #endif /* YYDEBUG */
  841.                 if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
  842.                         goto yydefault;
  843.                 if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )  /*valid shift*/
  844.                 {
  845.                         yychar = -1;
  846.                         yyval = yylval;
  847.                         yy_state = yy_n;
  848.                         if ( yyerrflag > 0 )
  849.                                 yyerrflag--;
  850.                         goto yy_stack;
  851.                 }
  852.  
  853.         yydefault:
  854.                 if ( ( yy_n = yydef[ yy_state ] ) == -2 )
  855.                 {
  856. #if YYDEBUG
  857.                         yytmp = yychar < 0;
  858. #endif
  859.                         if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  860.                                 yychar = 0;             /* reached EOF */
  861. #if YYDEBUG
  862.                         if ( yydebug && yytmp )
  863.                         {
  864.                                 register int yy_i;
  865.  
  866.                                 printf( "Received token " );
  867.                                 if ( yychar == 0 )
  868.                                         printf( "end-of-file\n" );
  869.                                 else if ( yychar < 0 )
  870.                                         printf( "-none-\n" );
  871.                                 else
  872.                                 {
  873.                                         for ( yy_i = 0;
  874.                                                 yytoks[yy_i].t_val >= 0;
  875.                                                 yy_i++ )
  876.                                         {
  877.                                                 if ( yytoks[yy_i].t_val
  878.                                                         == yychar )
  879.                                                 {
  880.                                                         break;
  881.                                                 }
  882.                                         }
  883.                                         printf( "%s\n", yytoks[yy_i].t_name );
  884.                                 }
  885.                         }
  886. #endif /* YYDEBUG */
  887.                         /*
  888.                         ** look through exception table
  889.                         */
  890.                         {
  891.                                 register int *yyxi = yyexca;
  892.  
  893.                                 while ( ( *yyxi != -1 ) ||
  894.                                         ( yyxi[1] != yy_state ) )
  895.                                 {
  896.                                         yyxi += 2;
  897.                                 }
  898.                                 while ( ( *(yyxi += 2) >= 0 ) &&
  899.                                         ( *yyxi != yychar ) )
  900.                                         ;
  901.                                 if ( ( yy_n = yyxi[1] ) < 0 )
  902.                                         YYACCEPT;
  903.                         }
  904.                 }
  905.  
  906.                 /*
  907.                 ** check for syntax error
  908.                 */
  909.                 if ( yy_n == 0 )        /* have an error */
  910.                 {
  911.                         /* no worry about speed here! */
  912.                         switch ( yyerrflag )
  913.                         {
  914.                         case 0:         /* new error */
  915.                                 yyerror( "syntax error" );
  916.                                 goto skip_init;
  917.                         yyerrlab:
  918.                                 /*
  919.                                 ** get globals into registers.
  920.                                 ** we have a user generated syntax type error
  921.                                 */
  922.                                 yy_pv = yypv;
  923.                                 yy_ps = yyps;
  924.                                 yy_state = yystate;
  925.                                 yynerrs++;
  926.                         skip_init:
  927.                         case 1:
  928.                         case 2:         /* incompletely recovered error */
  929.                                         /* try again... */
  930.                                 yyerrflag = 3;
  931.                                 /*
  932.                                 ** find state where "error" is a legal
  933.                                 ** shift action
  934.                                 */
  935.                                 while ( yy_ps >= yys )
  936.                                 {
  937.                                         yy_n = yypact[ *yy_ps ] + YYERRCODE;
  938.                                         if ( yy_n >= 0 && yy_n < YYLAST &&
  939.                                                 yychk[yyact[yy_n]] == YYERRCODE)                                        {
  940.                                                 /*
  941.                                                 ** simulate shift of "error"
  942.                                                 */
  943.                                                 yy_state = yyact[ yy_n ];
  944.                                                 goto yy_stack;
  945.                                         }
  946.                                         /*
  947.                                         ** current state has no shift on
  948.                                         ** "error", pop stack
  949.                                         */
  950. #if YYDEBUG
  951. #       define _POP_ "Error recovery pops state %d, uncovers state %d\n"
  952.                                         if ( yydebug )
  953.                                                 printf( _POP_, *yy_ps,
  954.                                                         yy_ps[-1] );
  955. #       undef _POP_
  956. #endif
  957.                                         yy_ps--;
  958.                                         yy_pv--;
  959.                                 }
  960.                                 /*
  961.                                 ** there is no state on stack with "error" as
  962.                                 ** a valid shift.  give up.
  963.                                 */
  964.                                 YYABORT;
  965.                         case 3:         /* no shift yet; eat a token */
  966. #if YYDEBUG
  967.                                 /*
  968.                                 ** if debugging, look up token in list of
  969.                                 ** pairs.  0 and negative shouldn't occur,
  970.                                 ** but since timing doesn't matter when
  971.                                 ** debugging, it doesn't hurt to leave the
  972.                                 ** tests here.
  973.                                 */
  974.                                 if ( yydebug )
  975.                                 {
  976.                                         register int yy_i;
  977.  
  978.                                         printf( "Error recovery discards " );
  979.                                         if ( yychar == 0 )
  980.                                                 printf( "token end-of-file\n" );
  981.                                         else if ( yychar < 0 )
  982.                                                 printf( "token -none-\n" );
  983.                                         else
  984.                                         {
  985.                                                 for ( yy_i = 0;
  986.                                                         yytoks[yy_i].t_val >= 0;
  987.                                                         yy_i++ )
  988.                                                 {
  989.                                                         if ( yytoks[yy_i].t_val
  990.                                                                 == yychar )
  991.                                                         {
  992.                                                                 break;
  993.                                                         }
  994.                                                 }
  995.                                                 printf( "token %s\n",
  996.                                                         yytoks[yy_i].t_name );
  997.                                         }
  998.                                 }
  999. #endif /* YYDEBUG */
  1000.                                 if ( yychar == 0 )      /* reached EOF. quit */
  1001.                                         YYABORT;
  1002.                                 yychar = -1;
  1003.                                 goto yy_newstate;
  1004.                         }
  1005.                 }/* end if ( yy_n == 0 ) */
  1006.                 /*
  1007.                 ** reduction by production yy_n
  1008.                 ** put stack tops, etc. so things right after switch
  1009.                 */
  1010. #if YYDEBUG
  1011.                 /*
  1012.                 ** if debugging, print the string that is the user's
  1013.                 ** specification of the reduction which is just about
  1014.                 ** to be done.
  1015.                 */
  1016.                 if ( yydebug )
  1017.                         printf( "Reduce by (%d) \"%s\"\n",
  1018.                                 yy_n, yyreds[ yy_n ] );
  1019. #endif
  1020.                 yytmp = yy_n;                   /* value to switch over */
  1021.                 yypvt = yy_pv;                  /* $vars top of value stack */
  1022.                 /*
  1023.                 ** Look in goto table for next state
  1024.                 ** Sorry about using yy_state here as temporary
  1025.                 ** register variable, but why not, if it works...
  1026.                 ** If yyr2[ yy_n ] doesn't have the low order bit
  1027.                 ** set, then there is no action to be done for
  1028.                 ** this reduction.  So, no saving & unsaving of
  1029.                 ** registers done.  The only difference between the
  1030.                 ** code just after the if and the body of the if is
  1031.                 ** the goto yy_stack in the body.  This way the test
  1032.                 ** can be made before the choice of what to do is needed.
  1033.                 */
  1034.                 {
  1035.                         /* length of production doubled with extra bit */
  1036.                         register int yy_len = yyr2[ yy_n ];
  1037.  
  1038.                         if ( !( yy_len & 01 ) )
  1039.                         {
  1040.                                 yy_len >>= 1;
  1041.                                 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
  1042.                                 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  1043.                                         *( yy_ps -= yy_len ) + 1;
  1044.                                 if ( yy_state >= YYLAST ||
  1045.                                         yychk[ yy_state =
  1046.                                         yyact[ yy_state ] ] != -yy_n )
  1047.                                 {
  1048.                                         yy_state = yyact[ yypgo[ yy_n ] ];
  1049.                                 }
  1050.                                 goto yy_stack;
  1051.                         }
  1052.                         yy_len >>= 1;
  1053.                         yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
  1054.                         yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  1055.                                 *( yy_ps -= yy_len ) + 1;
  1056.                         if ( yy_state >= YYLAST ||
  1057.                                 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
  1058.                         {
  1059.                                 yy_state = yyact[ yypgo[ yy_n ] ];
  1060.                         }
  1061.                 }
  1062.                                         /* save until reenter driver code */
  1063.                 yystate = yy_state;
  1064.                 yyps = yy_ps;
  1065.                 yypv = yy_pv;
  1066.         }
  1067.         /*
  1068.         ** code supplied by user is placed in this switch
  1069.         */
  1070.         switch( yytmp )
  1071.         {
  1072.  
  1073. case 3:
  1074. # line 48 "getdate.y"
  1075.  
  1076.                 {timeflag++;} break;
  1077. case 4:
  1078. # line 50 "getdate.y"
  1079.  
  1080.                 {zoneflag++;} break;
  1081. case 5:
  1082. # line 52 "getdate.y"
  1083.  
  1084.                 {dateflag++;} break;
  1085. case 6:
  1086. # line 54 "getdate.y"
  1087.  
  1088.                 {dayflag++;} break;
  1089. case 7:
  1090. # line 56 "getdate.y"
  1091.  
  1092.                 {relflag++;} break;
  1093. case 9:
  1094. # line 60 "getdate.y"
  1095.  
  1096.                 {if (timeflag && dateflag && !relflag) year = yypvt[-0];
  1097.                 else {timeflag++;hh = yypvt[-0]/100;mm = yypvt[-0]%100;ss = 0;merid = 24;}} break;
  1098. case 10:
  1099. # line 64 "getdate.y"
  1100.  
  1101.                 {hh = yypvt[-1]; mm = 0; ss = 0; merid = yypvt[-0];} break;
  1102. case 11:
  1103. # line 66 "getdate.y"
  1104.  
  1105.                 {hh = yypvt[-2]; mm = yypvt[-0]; merid = 24;} break;
  1106. case 12:
  1107. # line 68 "getdate.y"
  1108.  
  1109.                 {hh = yypvt[-3]; mm = yypvt[-1]; merid = yypvt[-0];} break;
  1110. case 13:
  1111. # line 70 "getdate.y"
  1112.  
  1113.                 {hh = yypvt[-3]; mm = yypvt[-1]; merid = 24;
  1114.                 daylght = STANDARD; ourzone = -(yypvt[-0]%100 + 60*(yypvt[-0]/100));} break;
  1115. case 14:
  1116. # line 73 "getdate.y"
  1117.  
  1118.                 {hh = yypvt[-4]; mm = yypvt[-2]; ss = yypvt[-0]; merid = 24;} break;
  1119. case 15:
  1120. # line 75 "getdate.y"
  1121.  
  1122.                 {hh = yypvt[-5]; mm = yypvt[-3]; ss = yypvt[-1]; merid = yypvt[-0];} break;
  1123. case 16:
  1124. # line 77 "getdate.y"
  1125.  
  1126.                 {hh = yypvt[-5]; mm = yypvt[-3]; ss = yypvt[-1]; merid = 24;
  1127.                 daylght = STANDARD; ourzone = -(yypvt[-0]%100 + 60*(yypvt[-0]/100));} break;
  1128. case 17:
  1129. # line 81 "getdate.y"
  1130.  
  1131.                 {ourzone = yypvt[-0]; daylght = STANDARD;} break;
  1132. case 18:
  1133. # line 83 "getdate.y"
  1134.  
  1135.                 {ourzone = yypvt[-0]; daylght = DAYLIGHT;} break;
  1136. case 19:
  1137. # line 86 "getdate.y"
  1138.  
  1139.                 {dayord = 1; dayreq = yypvt[-0];} break;
  1140. case 20:
  1141. # line 88 "getdate.y"
  1142.  
  1143.                 {dayord = 1; dayreq = yypvt[-1];} break;
  1144. case 21:
  1145. # line 90 "getdate.y"
  1146.  
  1147.                 {dayord = yypvt[-1]; dayreq = yypvt[-0];} break;
  1148. case 22:
  1149. # line 93 "getdate.y"
  1150.  
  1151.                 {month = yypvt[-2]; day = yypvt[-0];} break;
  1152. case 23:
  1153. # line 95 "getdate.y"
  1154.  
  1155.                 {month = yypvt[-4]; day = yypvt[-2]; year = yypvt[-0];} break;
  1156. case 24:
  1157. # line 97 "getdate.y"
  1158.  
  1159.                 {month = yypvt[-1]; day = yypvt[-0];} break;
  1160. case 25:
  1161. # line 99 "getdate.y"
  1162.  
  1163.                 {month = yypvt[-3]; day = yypvt[-2]; year = yypvt[-0];} break;
  1164. case 26:
  1165. # line 101 "getdate.y"
  1166.  
  1167.                 {month = yypvt[-0]; day = yypvt[-1];} break;
  1168. case 27:
  1169. # line 103 "getdate.y"
  1170.  
  1171.                 {month = yypvt[-1]; day = yypvt[-2]; year = yypvt[-0];} break;
  1172. case 28:
  1173. # line 106 "getdate.y"
  1174.  
  1175.                 {relsec +=  60L * yypvt[-1] * yypvt[-0];} break;
  1176. case 29:
  1177. # line 108 "getdate.y"
  1178.  
  1179.                 {relsec +=  60L * yypvt[-1] * yypvt[-0];} break;
  1180. case 30:
  1181. # line 110 "getdate.y"
  1182.  
  1183.                 {relmonth += yypvt[-1] * yypvt[-0];} break;
  1184. case 31:
  1185. # line 112 "getdate.y"
  1186.  
  1187.                 {relmonth += yypvt[-1] * yypvt[-0];} break;
  1188. case 32:
  1189. # line 114 "getdate.y"
  1190.  
  1191.                 {relsec += yypvt[-1];} break;
  1192. case 33:
  1193. # line 116 "getdate.y"
  1194.  
  1195.                 {relsec += yypvt[-1];} break;
  1196. case 34:
  1197. # line 118 "getdate.y"
  1198.  
  1199.                 {relsec +=  60L * yypvt[-0];} break;
  1200. case 35:
  1201. # line 120 "getdate.y"
  1202.  
  1203.                 {relmonth += yypvt[-0];} break;
  1204. case 36:
  1205. # line 122 "getdate.y"
  1206.  
  1207.                 {relsec++;} break;
  1208. case 37:
  1209. # line 124 "getdate.y"
  1210.  
  1211.                 {relsec = -relsec; relmonth = -relmonth;} break;
  1212.         }
  1213.         goto yystack;           /* reset registers in driver code */
  1214. }
  1215.