1 2 # line 2 "att1.y" 3 /* 4 * CDDL HEADER START 5 * 6 * The contents of this file are subject to the terms of the 7 * Common Development and Distribution License, Version 1.0 only 8 * (the "License"). You may not use this file except in compliance 9 * with the License. 10 * 11 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 12 * or http://www.opensolaris.org/os/licensing. 13 * See the License for the specific language governing permissions 14 * and limitations under the License. 15 * 16 * When distributing Covered Code, include this CDDL HEADER in each 17 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 18 * If applicable, add the following below this CDDL HEADER, with the 19 * fields enclosed by brackets "[]" replaced with your own identifying 20 * information: Portions Copyright [yyyy] [name of copyright owner] 21 * 22 * CDDL HEADER END 23 */ 24 25 # line 29 "att1.y" 26 #ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */ 27 28 # line 32 "att1.y" 29 30 #include "stdio.h" 31 #include "ctype.h" 32 #include "time.h" 33 34 extern int yylex(void); 35 extern void yyerror(); 36 extern void atabort(char *); 37 int yyparse(void); 38 extern int gmtflag; 39 extern int mday[]; 40 extern struct tm *tp, at, rt; 41 # define TIME 257 42 # define NOW 258 43 # define NOON 259 44 # define MIDNIGHT 260 45 # define MINUTE 261 46 # define HOUR 262 47 # define DAY 263 48 # define WEEK 264 49 # define MONTH 265 50 # define YEAR 266 51 # define UNIT 267 52 # define SUFF 268 53 # define ZONE 269 54 # define AM 270 55 # define PM 271 56 # define ZULU 272 57 # define NEXT 273 58 # define NUMB 274 59 # define COLON 275 60 # define COMMA 276 61 # define PLUS 277 62 # define UNKNOWN 278 63 64 #include <inttypes.h> 65 66 #ifdef __STDC__ 67 #include <stdlib.h> 68 #include <string.h> 69 #define YYCONST const 70 #else 71 #include <malloc.h> 72 #include <memory.h> 73 #define YYCONST 74 #endif 75 76 #include <values.h> 77 78 #if defined(__cplusplus) || defined(__STDC__) 79 80 #if defined(__cplusplus) && defined(__EXTERN_C__) 81 extern "C" { 82 #endif 83 #ifndef yyerror 84 #if defined(__cplusplus) 85 void yyerror(YYCONST char *); 86 #endif 87 #endif 88 #ifndef yylex 89 int yylex(void); 90 #endif 91 int yyparse(void); 92 #if defined(__cplusplus) && defined(__EXTERN_C__) 93 } 94 #endif 95 96 #endif 97 98 #define yyclearin yychar = -1 99 #define yyerrok yyerrflag = 0 100 extern int yychar; 101 extern int yyerrflag; 102 #ifndef YYSTYPE 103 #define YYSTYPE int 104 #endif 105 YYSTYPE yylval; 106 YYSTYPE yyval; 107 typedef int yytabelem; 108 #ifndef YYMAXDEPTH 109 #define YYMAXDEPTH 150 110 #endif 111 #if YYMAXDEPTH > 0 112 int yy_yys[YYMAXDEPTH], *yys = yy_yys; 113 YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv; 114 #else /* user does initial allocation */ 115 int *yys; 116 YYSTYPE *yyv; 117 #endif 118 static int yymaxdepth = YYMAXDEPTH; 119 # define YYERRCODE 256 120 121 # line 227 "att1.y" 122 123 static YYCONST yytabelem yyexca[] ={ 124 -1, 1, 125 0, -1, 126 -2, 0, 127 }; 128 # define YYNPROD 25 129 # define YYLAST 44 130 static YYCONST yytabelem yyact[]={ 131 132 25, 22, 4, 20, 20, 23, 29, 10, 8, 15, 133 16, 11, 13, 14, 7, 30, 26, 27, 19, 5, 134 18, 9, 3, 21, 17, 12, 6, 2, 1, 0, 135 0, 0, 24, 0, 0, 0, 0, 28, 0, 0, 136 0, 0, 0, 31 }; 137 static YYCONST yytabelem yypact[]={ 138 139 -255,-10000000, -254, -267,-10000000, -263, -257,-10000000, -265,-10000000, 140 -264,-10000000, -245,-10000000, -271,-10000000,-10000000, -272, -265,-10000000, 141 -10000000, -278, -251, -265, -270,-10000000,-10000000, -252, -271, -265, 142 -10000000, -271 }; 143 static YYCONST yytabelem yypgo[]={ 144 145 0, 28, 27, 26, 25, 24, 23, 22, 13, 21, 146 17 }; 147 static YYCONST yytabelem yyr1[]={ 148 149 0, 1, 1, 2, 2, 2, 2, 3, 3, 4, 150 4, 5, 5, 5, 5, 6, 6, 6, 7, 7, 151 9, 8, 8, 10, 10 }; 152 static YYCONST yytabelem yyr2[]={ 153 154 0, 11, 13, 3, 7, 5, 3, 1, 3, 1, 155 3, 1, 5, 9, 3, 0, 5, 7, 3, 5, 156 5, 3, 5, 1, 3 }; 157 static YYCONST yytabelem yychk[]={ 158 159 -10000000, -1, -2, -7, 257, 274, -3, 268, 275, -9, 160 274, 274, -4, 269, -8, 274, 274, -5, 265, 263, 161 274, -6, 273, 277, -8, 278, 267, -10, -8, 276, 162 267, -8 }; 163 static YYCONST yytabelem yydef[]={ 164 165 0, -2, 7, 3, 6, 18, 9, 8, 0, 5, 166 0, 19, 11, 10, 4, 21, 20, 15, 0, 14, 167 22, 1, 0, 23, 12, 2, 16, 0, 24, 0, 168 17, 13 }; 169 typedef struct 170 #ifdef __cplusplus 171 yytoktype 172 #endif 173 { 174 #ifdef __cplusplus 175 const 176 #endif 177 char *t_name; int t_val; } yytoktype; 178 #ifndef YYDEBUG 179 # define YYDEBUG 0 /* don't allow debugging */ 180 #endif 181 182 #if YYDEBUG 183 184 yytoktype yytoks[] = 185 { 186 "TIME", 257, 187 "NOW", 258, 188 "NOON", 259, 189 "MIDNIGHT", 260, 190 "MINUTE", 261, 191 "HOUR", 262, 192 "DAY", 263, 193 "WEEK", 264, 194 "MONTH", 265, 195 "YEAR", 266, 196 "UNIT", 267, 197 "SUFF", 268, 198 "ZONE", 269, 199 "AM", 270, 200 "PM", 271, 201 "ZULU", 272, 202 "NEXT", 273, 203 "NUMB", 274, 204 "COLON", 275, 205 "COMMA", 276, 206 "PLUS", 277, 207 "UNKNOWN", 278, 208 "-unknown-", -1 /* ends search */ 209 }; 210 211 #ifdef __cplusplus 212 const 213 #endif 214 char * yyreds[] = 215 { 216 "-no such reduction-", 217 "args : time ampm timezone date incr", 218 "args : time ampm timezone date incr UNKNOWN", 219 "time : hour", 220 "time : hour COLON number", 221 "time : hour minute", 222 "time : TIME", 223 "ampm : /* empty */", 224 "ampm : SUFF", 225 "timezone : /* empty */", 226 "timezone : ZONE", 227 "date : /* empty */", 228 "date : MONTH number", 229 "date : MONTH number COMMA number", 230 "date : DAY", 231 "incr : /* empty */", 232 "incr : NEXT UNIT", 233 "incr : PLUS opt_number UNIT", 234 "hour : NUMB", 235 "hour : NUMB NUMB", 236 "minute : NUMB NUMB", 237 "number : NUMB", 238 "number : number NUMB", 239 "opt_number : /* empty */", 240 "opt_number : number", 241 }; 242 #endif /* YYDEBUG */ 243 # line 1 "/usr/share/lib/ccs/yaccpar" 244 /* 245 * CDDL HEADER START 246 * 247 * The contents of this file are subject to the terms of the 248 * Common Development and Distribution License, Version 1.0 only 249 * (the "License"). You may not use this file except in compliance 250 * with the License. 251 * 252 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 253 * or http://www.opensolaris.org/os/licensing. 254 * See the License for the specific language governing permissions 255 * and limitations under the License. 256 * 257 * When distributing Covered Code, include this CDDL HEADER in each 258 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 259 * If applicable, add the following below this CDDL HEADER, with the 260 * fields enclosed by brackets "[]" replaced with your own identifying 261 * information: Portions Copyright [yyyy] [name of copyright owner] 262 * 263 * CDDL HEADER END 264 */ 265 /* 266 * Copyright 1993 Sun Microsystems, Inc. All rights reserved. 267 * Use is subject to license terms. 268 */ 269 270 /* Copyright (c) 1988 AT&T */ 271 /* All Rights Reserved */ 272 273 #pragma ident "%Z%%M% %I% %E% SMI" 274 275 /* 276 ** Skeleton parser driver for yacc output 277 */ 278 279 /* 280 ** yacc user known macros and defines 281 */ 282 #define YYERROR goto yyerrlab 283 #define YYACCEPT return(0) 284 #define YYABORT return(1) 285 #define YYBACKUP( newtoken, newvalue )\ 286 {\ 287 if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\ 288 {\ 289 yyerror( "syntax error - cannot backup" );\ 290 goto yyerrlab;\ 291 }\ 292 yychar = newtoken;\ 293 yystate = *yyps;\ 294 yylval = newvalue;\ 295 goto yynewstate;\ 296 } 297 #define YYRECOVERING() (!!yyerrflag) 298 #define YYNEW(type) malloc(sizeof(type) * yynewmax) 299 #define YYCOPY(to, from, type) \ 300 (type *) memcpy(to, (char *) from, yymaxdepth * sizeof (type)) 301 #define YYENLARGE( from, type) \ 302 (type *) realloc((char *) from, yynewmax * sizeof(type)) 303 #ifndef YYDEBUG 304 # define YYDEBUG 1 /* make debugging available */ 305 #endif 306 307 /* 308 ** user known globals 309 */ 310 int yydebug; /* set to 1 to get debugging */ 311 312 /* 313 ** driver internal defines 314 */ 315 #define YYFLAG (-10000000) 316 317 /* 318 ** global variables used by the parser 319 */ 320 YYSTYPE *yypv; /* top of value stack */ 321 int *yyps; /* top of state stack */ 322 323 int yystate; /* current state */ 324 int yytmp; /* extra var (lasts between blocks) */ 325 326 int yynerrs; /* number of errors */ 327 int yyerrflag; /* error recovery flag */ 328 int yychar; /* current input token number */ 329 330 331 332 #ifdef YYNMBCHARS 333 #define YYLEX() yycvtok(yylex()) 334 /* 335 ** yycvtok - return a token if i is a wchar_t value that exceeds 255. 336 ** If i<255, i itself is the token. If i>255 but the neither 337 ** of the 30th or 31st bit is on, i is already a token. 338 */ 339 #if defined(__STDC__) || defined(__cplusplus) 340 int yycvtok(int i) 341 #else 342 int yycvtok(i) int i; 343 #endif 344 { 345 int first = 0; 346 int last = YYNMBCHARS - 1; 347 int mid; 348 wchar_t j; 349 350 if(i&0x60000000){/*Must convert to a token. */ 351 if( yymbchars[last].character < i ){ 352 return i;/*Giving up*/ 353 } 354 while ((last>=first)&&(first>=0)) {/*Binary search loop*/ 355 mid = (first+last)/2; 356 j = yymbchars[mid].character; 357 if( j==i ){/*Found*/ 358 return yymbchars[mid].tvalue; 359 }else if( j<i ){ 360 first = mid + 1; 361 }else{ 362 last = mid -1; 363 } 364 } 365 /*No entry in the table.*/ 366 return i;/* Giving up.*/ 367 }else{/* i is already a token. */ 368 return i; 369 } 370 } 371 #else/*!YYNMBCHARS*/ 372 #define YYLEX() yylex() 373 #endif/*!YYNMBCHARS*/ 374 375 /* 376 ** yyparse - return 0 if worked, 1 if syntax error not recovered from 377 */ 378 #if defined(__STDC__) || defined(__cplusplus) 379 int yyparse(void) 380 #else 381 int yyparse() 382 #endif 383 { 384 register YYSTYPE *yypvt = 0; /* top of value stack for $vars */ 385 386 #if defined(__cplusplus) || defined(lint) 387 /* 388 hacks to please C++ and lint - goto's inside 389 switch should never be executed 390 */ 391 static int __yaccpar_lint_hack__ = 0; 392 switch (__yaccpar_lint_hack__) 393 { 394 case 1: goto yyerrlab; 395 case 2: goto yynewstate; 396 } 397 #endif 398 399 /* 400 ** Initialize externals - yyparse may be called more than once 401 */ 402 yypv = &yyv[-1]; 403 yyps = &yys[-1]; 404 yystate = 0; 405 yytmp = 0; 406 yynerrs = 0; 407 yyerrflag = 0; 408 yychar = -1; 409 410 #if YYMAXDEPTH <= 0 411 if (yymaxdepth <= 0) 412 { 413 if ((yymaxdepth = YYEXPAND(0)) <= 0) 414 { 415 yyerror("yacc initialization error"); 416 YYABORT; 417 } 418 } 419 #endif 420 421 { 422 register YYSTYPE *yy_pv; /* top of value stack */ 423 register int *yy_ps; /* top of state stack */ 424 register int yy_state; /* current state */ 425 register int yy_n; /* internal state number info */ 426 goto yystack; /* moved from 6 lines above to here to please C++ */ 427 428 /* 429 ** get globals into registers. 430 ** branch to here only if YYBACKUP was called. 431 */ 432 yynewstate: 433 yy_pv = yypv; 434 yy_ps = yyps; 435 yy_state = yystate; 436 goto yy_newstate; 437 438 /* 439 ** get globals into registers. 440 ** either we just started, or we just finished a reduction 441 */ 442 yystack: 443 yy_pv = yypv; 444 yy_ps = yyps; 445 yy_state = yystate; 446 447 /* 448 ** top of for (;;) loop while no reductions done 449 */ 450 yy_stack: 451 /* 452 ** put a state and value onto the stacks 453 */ 454 #if YYDEBUG 455 /* 456 ** if debugging, look up token value in list of value vs. 457 ** name pairs. 0 and negative (-1) are special values. 458 ** Note: linear search is used since time is not a real 459 ** consideration while debugging. 460 */ 461 if ( yydebug ) 462 { 463 register int yy_i; 464 465 printf( "State %d, token ", yy_state ); 466 if ( yychar == 0 ) 467 printf( "end-of-file\n" ); 468 else if ( yychar < 0 ) 469 printf( "-none-\n" ); 470 else 471 { 472 for ( yy_i = 0; yytoks[yy_i].t_val >= 0; 473 yy_i++ ) 474 { 475 if ( yytoks[yy_i].t_val == yychar ) 476 break; 477 } 478 printf( "%s\n", yytoks[yy_i].t_name ); 479 } 480 } 481 #endif /* YYDEBUG */ 482 if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */ 483 { 484 /* 485 ** reallocate and recover. Note that pointers 486 ** have to be reset, or bad things will happen 487 */ 488 long yyps_index = (yy_ps - yys); 489 long yypv_index = (yy_pv - yyv); 490 long yypvt_index = (yypvt - yyv); 491 int yynewmax; 492 #ifdef YYEXPAND 493 yynewmax = YYEXPAND(yymaxdepth); 494 #else 495 yynewmax = 2 * yymaxdepth; /* double table size */ 496 if (yymaxdepth == YYMAXDEPTH) /* first time growth */ 497 { 498 char *newyys = (char *)YYNEW(int); 499 char *newyyv = (char *)YYNEW(YYSTYPE); 500 if (newyys != 0 && newyyv != 0) 501 { 502 yys = YYCOPY(newyys, yys, int); 503 yyv = YYCOPY(newyyv, yyv, YYSTYPE); 504 } 505 else 506 yynewmax = 0; /* failed */ 507 } 508 else /* not first time */ 509 { 510 yys = YYENLARGE(yys, int); 511 yyv = YYENLARGE(yyv, YYSTYPE); 512 if (yys == 0 || yyv == 0) 513 yynewmax = 0; /* failed */ 514 } 515 #endif 516 if (yynewmax <= yymaxdepth) /* tables not expanded */ 517 { 518 yyerror( "yacc stack overflow" ); 519 YYABORT; 520 } 521 yymaxdepth = yynewmax; 522 523 yy_ps = yys + yyps_index; 524 yy_pv = yyv + yypv_index; 525 yypvt = yyv + yypvt_index; 526 } 527 *yy_ps = yy_state; 528 *++yy_pv = yyval; 529 530 /* 531 ** we have a new state - find out what to do 532 */ 533 yy_newstate: 534 if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG ) 535 goto yydefault; /* simple state */ 536 #if YYDEBUG 537 /* 538 ** if debugging, need to mark whether new token grabbed 539 */ 540 yytmp = yychar < 0; 541 #endif 542 if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) 543 yychar = 0; /* reached EOF */ 544 #if YYDEBUG 545 if ( yydebug && yytmp ) 546 { 547 register int yy_i; 548 549 printf( "Received token " ); 550 if ( yychar == 0 ) 551 printf( "end-of-file\n" ); 552 else if ( yychar < 0 ) 553 printf( "-none-\n" ); 554 else 555 { 556 for ( yy_i = 0; yytoks[yy_i].t_val >= 0; 557 yy_i++ ) 558 { 559 if ( yytoks[yy_i].t_val == yychar ) 560 break; 561 } 562 printf( "%s\n", yytoks[yy_i].t_name ); 563 } 564 } 565 #endif /* YYDEBUG */ 566 if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) ) 567 goto yydefault; 568 if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/ 569 { 570 yychar = -1; 571 yyval = yylval; 572 yy_state = yy_n; 573 if ( yyerrflag > 0 ) 574 yyerrflag--; 575 goto yy_stack; 576 } 577 578 yydefault: 579 if ( ( yy_n = yydef[ yy_state ] ) == -2 ) 580 { 581 #if YYDEBUG 582 yytmp = yychar < 0; 583 #endif 584 if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) 585 yychar = 0; /* reached EOF */ 586 #if YYDEBUG 587 if ( yydebug && yytmp ) 588 { 589 register int yy_i; 590 591 printf( "Received token " ); 592 if ( yychar == 0 ) 593 printf( "end-of-file\n" ); 594 else if ( yychar < 0 ) 595 printf( "-none-\n" ); 596 else 597 { 598 for ( yy_i = 0; 599 yytoks[yy_i].t_val >= 0; 600 yy_i++ ) 601 { 602 if ( yytoks[yy_i].t_val 603 == yychar ) 604 { 605 break; 606 } 607 } 608 printf( "%s\n", yytoks[yy_i].t_name ); 609 } 610 } 611 #endif /* YYDEBUG */ 612 /* 613 ** look through exception table 614 */ 615 { 616 register YYCONST int *yyxi = yyexca; 617 618 while ( ( *yyxi != -1 ) || 619 ( yyxi[1] != yy_state ) ) 620 { 621 yyxi += 2; 622 } 623 while ( ( *(yyxi += 2) >= 0 ) && 624 ( *yyxi != yychar ) ) 625 ; 626 if ( ( yy_n = yyxi[1] ) < 0 ) 627 YYACCEPT; 628 } 629 } 630 631 /* 632 ** check for syntax error 633 */ 634 if ( yy_n == 0 ) /* have an error */ 635 { 636 /* no worry about speed here! */ 637 switch ( yyerrflag ) 638 { 639 case 0: /* new error */ 640 yyerror( "syntax error" ); 641 goto skip_init; 642 yyerrlab: 643 /* 644 ** get globals into registers. 645 ** we have a user generated syntax type error 646 */ 647 yy_pv = yypv; 648 yy_ps = yyps; 649 yy_state = yystate; 650 skip_init: 651 yynerrs++; 652 /* FALLTHRU */ 653 case 1: 654 case 2: /* incompletely recovered error */ 655 /* try again... */ 656 yyerrflag = 3; 657 /* 658 ** find state where "error" is a legal 659 ** shift action 660 */ 661 while ( yy_ps >= yys ) 662 { 663 yy_n = yypact[ *yy_ps ] + YYERRCODE; 664 if ( yy_n >= 0 && yy_n < YYLAST && 665 yychk[yyact[yy_n]] == YYERRCODE) { 666 /* 667 ** simulate shift of "error" 668 */ 669 yy_state = yyact[ yy_n ]; 670 goto yy_stack; 671 } 672 /* 673 ** current state has no shift on 674 ** "error", pop stack 675 */ 676 #if YYDEBUG 677 # define _POP_ "Error recovery pops state %d, uncovers state %d\n" 678 if ( yydebug ) 679 printf( _POP_, *yy_ps, 680 yy_ps[-1] ); 681 # undef _POP_ 682 #endif 683 yy_ps--; 684 yy_pv--; 685 } 686 /* 687 ** there is no state on stack with "error" as 688 ** a valid shift. give up. 689 */ 690 YYABORT; 691 case 3: /* no shift yet; eat a token */ 692 #if YYDEBUG 693 /* 694 ** if debugging, look up token in list of 695 ** pairs. 0 and negative shouldn't occur, 696 ** but since timing doesn't matter when 697 ** debugging, it doesn't hurt to leave the 698 ** tests here. 699 */ 700 if ( yydebug ) 701 { 702 register int yy_i; 703 704 printf( "Error recovery discards " ); 705 if ( yychar == 0 ) 706 printf( "token end-of-file\n" ); 707 else if ( yychar < 0 ) 708 printf( "token -none-\n" ); 709 else 710 { 711 for ( yy_i = 0; 712 yytoks[yy_i].t_val >= 0; 713 yy_i++ ) 714 { 715 if ( yytoks[yy_i].t_val 716 == yychar ) 717 { 718 break; 719 } 720 } 721 printf( "token %s\n", 722 yytoks[yy_i].t_name ); 723 } 724 } 725 #endif /* YYDEBUG */ 726 if ( yychar == 0 ) /* reached EOF. quit */ 727 YYABORT; 728 yychar = -1; 729 goto yy_newstate; 730 } 731 }/* end if ( yy_n == 0 ) */ 732 /* 733 ** reduction by production yy_n 734 ** put stack tops, etc. so things right after switch 735 */ 736 #if YYDEBUG 737 /* 738 ** if debugging, print the string that is the user's 739 ** specification of the reduction which is just about 740 ** to be done. 741 */ 742 if ( yydebug ) 743 printf( "Reduce by (%d) \"%s\"\n", 744 yy_n, yyreds[ yy_n ] ); 745 #endif 746 yytmp = yy_n; /* value to switch over */ 747 yypvt = yy_pv; /* $vars top of value stack */ 748 /* 749 ** Look in goto table for next state 750 ** Sorry about using yy_state here as temporary 751 ** register variable, but why not, if it works... 752 ** If yyr2[ yy_n ] doesn't have the low order bit 753 ** set, then there is no action to be done for 754 ** this reduction. So, no saving & unsaving of 755 ** registers done. The only difference between the 756 ** code just after the if and the body of the if is 757 ** the goto yy_stack in the body. This way the test 758 ** can be made before the choice of what to do is needed. 759 */ 760 { 761 /* length of production doubled with extra bit */ 762 register int yy_len = yyr2[ yy_n ]; 763 764 if ( !( yy_len & 01 ) ) 765 { 766 yy_len >>= 1; 767 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ 768 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + 769 *( yy_ps -= yy_len ) + 1; 770 if ( yy_state >= YYLAST || 771 yychk[ yy_state = 772 yyact[ yy_state ] ] != -yy_n ) 773 { 774 yy_state = yyact[ yypgo[ yy_n ] ]; 775 } 776 goto yy_stack; 777 } 778 yy_len >>= 1; 779 yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ 780 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + 781 *( yy_ps -= yy_len ) + 1; 782 if ( yy_state >= YYLAST || 783 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) 784 { 785 yy_state = yyact[ yypgo[ yy_n ] ]; 786 } 787 } 788 /* save until reenter driver code */ 789 yystate = yy_state; 790 yyps = yy_ps; 791 yypv = yy_pv; 792 } 793 /* 794 ** code supplied by user is placed in this switch 795 */ 796 switch( yytmp ) 797 { 798 799 case 1: 800 # line 71 "att1.y" 801 { 802 if (at.tm_min >= 60 || at.tm_hour >= 24) 803 atabort("bad time"); 804 if (at.tm_mon >= 12 || at.tm_mday > mday[at.tm_mon]) 805 atabort("bad date"); 806 if (at.tm_year >= 1900) 807 at.tm_year -= 1900; 808 if (at.tm_year < 70 || at.tm_year >= 139) 809 atabort("bad year"); 810 } break; 811 case 2: 812 # line 81 "att1.y" 813 { 814 yyerror(); 815 } break; 816 case 3: 817 # line 87 "att1.y" 818 { 819 at.tm_hour = yypvt[-0]; 820 } break; 821 case 4: 822 # line 90 "att1.y" 823 { 824 at.tm_hour = yypvt[-2]; 825 at.tm_min = yypvt[-0]; 826 yypvt[-0] = yypvt[-2]; 827 } break; 828 case 5: 829 # line 95 "att1.y" 830 { 831 at.tm_hour = yypvt[-1]; 832 at.tm_min = yypvt[-0]; 833 yypvt[-0] = yypvt[-1]; 834 } break; 835 case 6: 836 # line 100 "att1.y" 837 { 838 switch (yypvt[-0]) { 839 case NOON: 840 at.tm_hour = 12; 841 break; 842 case MIDNIGHT: 843 at.tm_hour = 0; 844 break; 845 case NOW: 846 at.tm_hour = tp->tm_hour; 847 at.tm_min = tp->tm_min; 848 at.tm_sec = tp->tm_sec; 849 break; 850 } 851 } break; 852 case 7: 853 # line 119 "att1.y" 854 { 855 } break; 856 case 8: 857 # line 121 "att1.y" 858 { 859 switch (yypvt[-0]) { 860 case PM: 861 if (at.tm_hour < 1 || at.tm_hour > 12) 862 atabort("bad hour"); 863 at.tm_hour %= 12; 864 at.tm_hour += 12; 865 break; 866 case AM: 867 if (at.tm_hour < 1 || at.tm_hour > 12) 868 atabort("bad hour"); 869 at.tm_hour %= 12; 870 break; 871 } 872 } break; 873 case 9: 874 # line 140 "att1.y" 875 { 876 } break; 877 case 10: 878 # line 142 "att1.y" 879 { 880 if (at.tm_hour == 24 && at.tm_min != 0) 881 atabort("bad time"); 882 at.tm_hour %= 24; 883 gmtflag = 1; 884 } break; 885 case 11: 886 # line 151 "att1.y" 887 { 888 at.tm_mday = tp->tm_mday; 889 at.tm_mon = tp->tm_mon; 890 at.tm_year = tp->tm_year; 891 if ((at.tm_hour < tp->tm_hour) 892 || ((at.tm_hour==tp->tm_hour)&&(at.tm_min<tp->tm_min))) 893 rt.tm_mday++; 894 } break; 895 case 12: 896 # line 159 "att1.y" 897 { 898 at.tm_mon = yypvt[-1]; 899 at.tm_mday = yypvt[-0]; 900 at.tm_year = tp->tm_year; 901 if (at.tm_mon < tp->tm_mon) 902 at.tm_year++; 903 } break; 904 case 13: 905 # line 166 "att1.y" 906 { 907 at.tm_mon = yypvt[-3]; 908 at.tm_mday = yypvt[-2]; 909 at.tm_year = yypvt[-0]; 910 } break; 911 case 14: 912 # line 171 "att1.y" 913 { 914 at.tm_mon = tp->tm_mon; 915 at.tm_mday = tp->tm_mday; 916 at.tm_year = tp->tm_year; 917 if (yypvt[-0] < 7) { 918 rt.tm_mday = yypvt[-0] - tp->tm_wday; 919 if (rt.tm_mday < 0) 920 rt.tm_mday += 7; 921 } else if (yypvt[-0] == 8) 922 rt.tm_mday += 1; 923 } break; 924 case 16: 925 # line 186 "att1.y" 926 { addincr: 927 switch (yypvt[-0]) { 928 case MINUTE: 929 rt.tm_min += yypvt[-1]; 930 break; 931 case HOUR: 932 rt.tm_hour += yypvt[-1]; 933 break; 934 case DAY: 935 rt.tm_mday += yypvt[-1]; 936 break; 937 case WEEK: 938 rt.tm_mday += yypvt[-1] * 7; 939 break; 940 case MONTH: 941 rt.tm_mon += yypvt[-1]; 942 break; 943 case YEAR: 944 rt.tm_year += yypvt[-1]; 945 break; 946 } 947 } break; 948 case 17: 949 # line 208 "att1.y" 950 { goto addincr; } break; 951 case 18: 952 # line 212 "att1.y" 953 { yyval = yypvt[-0]; } break; 954 case 19: 955 # line 213 "att1.y" 956 { yyval = 10 * yypvt[-1] + yypvt[-0]; } break; 957 case 20: 958 # line 216 "att1.y" 959 { yyval = 10 * yypvt[-1] + yypvt[-0]; } break; 960 case 21: 961 # line 219 "att1.y" 962 { yyval = yypvt[-0]; } break; 963 case 22: 964 # line 220 "att1.y" 965 { yyval = 10 * yypvt[-1] + yypvt[-0]; } break; 966 case 23: 967 # line 223 "att1.y" 968 { yyval = 1; } break; 969 case 24: 970 # line 224 "att1.y" 971 { yyval = yypvt[-0]; } break; 972 # line 556 "/usr/share/lib/ccs/yaccpar" 973 } 974 goto yystack; /* reset registers in driver code */ 975 } 976 977