Changeset 2415 in kBuild
- Timestamp:
- Sep 13, 2010 11:13:20 PM (15 years ago)
- Location:
- trunk/src/kash
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/arith.y
r2382 r2415 57 57 int main(int , char *[]); 58 58 int error(char *); 59 #else 60 # undef malloc 61 # define malloc(cb) sh_malloc(NULL, (cb)) 62 # undef realloc 63 # define realloc(pv,cb) sh_realloc(NULL, (pv), (cb)) 64 # undef free 65 # define free(pv) sh_free(NULL, (pv)) 59 66 #endif 60 67 -
trunk/src/kash/arith_lex.l
r1233 r2415 1 %option never-interactive 1 2 %option noyywrap 3 %option noinput 4 %option nounput 5 %option noyyget_out 6 %option noyy_push_state 7 %option noyy_pop_state 8 %option noyy_top_state 9 %option noyy_scan_buffer 10 %option noyy_scan_bytes 11 %option noyy_scan_string 12 %option noyyget_extra 13 %option noyyset_extra 14 %option noyyget_leng 15 %option noyyget_text 16 %option noyyget_lineno 17 %option noyyset_lineno 18 %option noyyget_in 19 %option noyyset_in 20 %option noyyget_out 21 %option noyyset_out 22 %option noyyget_lval 23 %option noyyset_lval 24 %option noyyget_lloc 25 %option noyyset_lloc 26 %option noyyget_debug 27 %option noyyset_debug 28 %option noyyalloc 29 %option noyyrealloc 30 %option noyyfree 31 /** @todo %option reentrant */ 2 32 %{ 3 33 /* $NetBSD: arith_lex.l,v 1.13 2005/03/21 22:37:09 dsl Exp $ */ … … 43 73 #endif 44 74 75 #include <stdio.h> 45 76 #include "arith.h" 46 77 #include "error.h" … … 56 87 result = (*buf = *arith_buf++) ? 1 : YY_NULL; 57 88 #define YY_NO_UNPUT 89 90 /* Avoid unnecessary libc bits. */ 91 #undef ECHO 92 #define ECHO \ 93 do {} while (0) 94 #undef stdin 95 #define stdin \ 96 NULL 97 #undef stdout 98 #define stdout \ 99 NULL 100 #undef fprintf 101 #define fprintf(a, b, c) \ 102 ((void)0) 103 #undef exit 104 #define exit(rc) \ 105 do {} while (0) 106 #define YY_FATAL_ERROR(msg) \ 107 error(arith_psh, "arith: fatal error: %s", msg) 58 108 %} 59 109 … … 102 152 #endif 103 153 } 154 155 void * 156 yyalloc(yy_size_t cb) 157 { 158 return sh_malloc(NULL, cb); 159 } 160 161 void * 162 yyrealloc(void *pv, yy_size_t cb) 163 { 164 return sh_realloc(NULL, pv, cb); 165 } 166 167 void 168 yyfree(void *pv) 169 { 170 sh_free(NULL, pv); 171 } 172 -
trunk/src/kash/exec.h
r2298 r2415 46 46 47 47 48 union param { 49 int index; 50 int (*bltin)(struct shinstance*, int, char**); 51 union node *func; 52 }; 53 48 54 struct cmdentry { 49 55 int cmdtype; 50 union param { 51 int index; 52 int (*bltin)(struct shinstance*, int, char**); 53 union node *func; 54 } u; 56 union param u; 55 57 }; 56 58 -
trunk/src/kash/generated/arith.c
r1233 r2415 1 1 #ifndef lint 2 /*static char yysccsid[] = "from: @(#)yaccpar 1.9 (Berkeley) 02/21/93";*/ 3 static char yyrcsid[] = "$Id$"; 4 #endif 2 static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; 3 #endif 4 5 #include <stdlib.h> 6 #include <string.h> 7 5 8 #define YYBYACC 1 6 9 #define YYMAJOR 1 7 10 #define YYMINOR 9 8 #define yyclearin (yychar=(-1)) 9 #define yyerrok (yyerrflag=0) 10 #define YYRECOVERING (yyerrflag!=0) 11 #define YYPATCH 20091027 12 13 #define YYEMPTY (-1) 14 #define yyclearin (yychar = YYEMPTY) 15 #define yyerrok (yyerrflag = 0) 16 #define YYRECOVERING() (yyerrflag != 0) 17 18 /* compatibility with bison */ 19 #ifdef YYPARSE_PARAM 20 /* compatibility with FreeBSD */ 21 #ifdef YYPARSE_PARAM_TYPE 22 #define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) 23 #else 24 #define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) 25 #endif 26 #else 27 #define YYPARSE_DECL() yyparse(void) 28 #endif /* YYPARSE_PARAM */ 29 30 extern int YYPARSE_DECL(); 31 32 static int yygrowstack(void); 11 33 #define YYPREFIX "yy" 12 34 /* $NetBSD: arith.y,v 1.17 2003/09/17 17:33:36 jmmv Exp $ */ … … 67 89 int main(int , char *[]); 68 90 int error(char *); 91 #else 92 # undef malloc 93 # define malloc(cb) sh_malloc(NULL, (cb)) 94 # undef realloc 95 # define realloc(pv,cb) sh_realloc(NULL, (pv), (cb)) 96 # undef free 97 # define free(pv) sh_free(NULL, (pv)) 69 98 #endif 70 99 … … 95 124 #define ARITH_BNOT 281 96 125 #define YYERRCODE 256 97 s hort yylhs[] = {-1,126 static const short yylhs[] = { -1, 98 127 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 99 128 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 100 129 1, 1, 1, 1, 1, 101 130 }; 102 s hort yylen[] = {2,131 static const short yylen[] = { 2, 103 132 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 104 133 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 105 134 2, 2, 2, 2, 1, 106 135 }; 107 s hort yydefred[] = {0,136 static const short yydefred[] = { 0, 108 137 25, 0, 0, 0, 0, 0, 0, 0, 0, 24, 109 138 23, 21, 22, 0, 0, 0, 0, 0, 0, 0, … … 112 141 0, 0, 0, 0, 0, 0, 0, 18, 19, 20, 113 142 }; 114 s hort yydgoto[] = {7,143 static const short yydgoto[] = { 7, 115 144 8, 116 145 }; 117 s hort yysindex[] = {-255,146 static const short yysindex[] = { -255, 118 147 0, -255, -255, -255, -255, -255, 0, -67, -85, 0, 119 148 0, 0, 0, -255, -255, -255, -255, -255, -255, -255, … … 122 151 -223, -223, -223, -253, -253, -248, -248, 0, 0, 0, 123 152 }; 124 s hort yyrindex[] = {0,153 static const short yyrindex[] = { 0, 125 154 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 126 155 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … … 129 158 73, 85, 97, 33, 47, 1, 17, 0, 0, 0, 130 159 }; 131 s hort yygindex[] = {0,160 static const short yygindex[] = { 0, 132 161 142, 133 162 }; 134 163 #define YYTABLESIZE 418 135 s hort yytable[] = {0,164 static const short yytable[] = { 0, 136 165 16, 1, 2, 19, 20, 21, 22, 23, 24, 25, 137 166 26, 27, 28, 29, 30, 31, 17, 3, 4, 27, … … 177 206 24, 25, 26, 27, 28, 29, 30, 31, 178 207 }; 179 s hort yycheck[] = {-1,208 static const short yycheck[] = { -1, 180 209 0, 257, 258, 265, 266, 267, 268, 269, 270, 271, 181 210 272, 273, 274, 275, 276, 277, 0, 273, 274, 273, … … 227 256 #define YYMAXTOKEN 281 228 257 #if YYDEBUG 229 char *yyname[] = { 258 static const char *yyname[] = { 259 230 260 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 231 261 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, … … 240 270 "ARITH_REM","ARITH_UNARYMINUS","ARITH_UNARYPLUS","ARITH_NOT","ARITH_BNOT", 241 271 }; 242 char *yyrule[] = {272 static const char *yyrule[] = { 243 273 "$accept : exp", 244 274 "exp : expr", … … 267 297 "expr : ARITH_ADD expr", 268 298 "expr : ARITH_NUM", 299 269 300 }; 270 301 #endif … … 272 303 typedef int YYSTYPE; 273 304 #endif 305 #if YYDEBUG 306 #include <stdio.h> 307 #endif 308 309 /* define the initial stack-sizes */ 274 310 #ifdef YYSTACKSIZE 275 311 #undef YYMAXDEPTH 276 #define YYMAXDEPTH YYSTACKSIZE312 #define YYMAXDEPTH YYSTACKSIZE 277 313 #else 278 314 #ifdef YYMAXDEPTH … … 280 316 #else 281 317 #define YYSTACKSIZE 500 282 #define YYMAXDEPTH 500 283 #endif 284 #endif 285 int yydebug; 286 int yynerrs; 287 int yyerrflag; 288 int yychar; 289 short *yyssp; 318 #define YYMAXDEPTH 500 319 #endif 320 #endif 321 322 #define YYINITSTACKSIZE 500 323 324 int yydebug; 325 int yynerrs; 326 int yyerrflag; 327 int yychar; 328 short *yyssp; 290 329 YYSTYPE *yyvsp; 291 YYSTYPE yyval; 292 YYSTYPE yylval; 293 short yyss[YYSTACKSIZE]; 294 YYSTYPE yyvs[YYSTACKSIZE]; 295 #define yystacksize YYSTACKSIZE 330 YYSTYPE yyval; 331 YYSTYPE yylval; 332 333 /* variables for the parser stack */ 334 static short *yyss; 335 static short *yysslim; 336 static YYSTYPE *yyvs; 337 static unsigned yystacksize; 296 338 int 297 339 arith(shinstance *psh, const char *s) … … 370 412 yyerror(const char *s) 371 413 { 372 shinstance *psh = arith_psh; 414 shinstance *psh = arith_psh; 415 #ifndef YYBISON /* yyerrok references yyerrstatus which is a local variable in yyparse().*/ 373 416 yyerrok; 417 #endif 374 418 yyclearin; 375 419 arith_lex_reset(); /* reprime lex */ … … 378 422 /* NOTREACHED */ 379 423 } 380 #define YYABORT goto yyabort 424 /* allocate initial stack or double stack size, up to YYMAXDEPTH */ 425 static int yygrowstack(void) 426 { 427 int i; 428 unsigned newsize; 429 short *newss; 430 YYSTYPE *newvs; 431 432 if ((newsize = yystacksize) == 0) 433 newsize = YYINITSTACKSIZE; 434 else if (newsize >= YYMAXDEPTH) 435 return -1; 436 else if ((newsize *= 2) > YYMAXDEPTH) 437 newsize = YYMAXDEPTH; 438 439 i = yyssp - yyss; 440 newss = (yyss != 0) 441 ? (short *)realloc(yyss, newsize * sizeof(*newss)) 442 : (short *)malloc(newsize * sizeof(*newss)); 443 if (newss == 0) 444 return -1; 445 446 yyss = newss; 447 yyssp = newss + i; 448 newvs = (yyvs != 0) 449 ? (YYSTYPE *)realloc(yyvs, newsize * sizeof(*newvs)) 450 : (YYSTYPE *)malloc(newsize * sizeof(*newvs)); 451 if (newvs == 0) 452 return -1; 453 454 yyvs = newvs; 455 yyvsp = newvs + i; 456 yystacksize = newsize; 457 yysslim = yyss + newsize - 1; 458 return 0; 459 } 460 461 #define YYABORT goto yyabort 381 462 #define YYREJECT goto yyabort 382 463 #define YYACCEPT goto yyaccept 383 #define YYERROR goto yyerrlab 384 #ifdef __cplusplus 385 extern "C" { 386 char * getenv(); 387 int yylex(); 388 int yyparse(); 389 } 390 391 #endif 464 #define YYERROR goto yyerrlab 465 392 466 int 393 #if defined(__STDC__) 394 yyparse(void) 395 #else 396 yyparse() 397 #endif 467 YYPARSE_DECL() 398 468 { 399 register int yym, yyn, yystate; 400 #if YYDEBUG 401 register char *yys; 402 #ifndef __cplusplus 403 extern char *getenv(); 404 #endif 405 406 if (yys = getenv("YYDEBUG")) 469 int yym, yyn, yystate; 470 #if YYDEBUG 471 const char *yys; 472 473 if ((yys = getenv("YYDEBUG")) != 0) 407 474 { 408 475 yyn = *yys; … … 414 481 yynerrs = 0; 415 482 yyerrflag = 0; 416 yychar = (-1); 417 483 yychar = YYEMPTY; 484 yystate = 0; 485 486 if (yyss == NULL && yygrowstack()) goto yyoverflow; 418 487 yyssp = yyss; 419 488 yyvsp = yyvs; 420 *yyssp = yystate = 0; 489 yystate = 0; 490 *yyssp = 0; 421 491 422 492 yyloop: … … 444 514 YYPREFIX, yystate, yytable[yyn]); 445 515 #endif 446 if (yyssp >= yyss + yystacksize - 1)516 if (yyssp >= yysslim && yygrowstack()) 447 517 { 448 518 goto yyoverflow; 449 519 } 450 *++yyssp = yystate = yytable[yyn]; 520 yystate = yytable[yyn]; 521 *++yyssp = yytable[yyn]; 451 522 *++yyvsp = yylval; 452 yychar = (-1);523 yychar = YYEMPTY; 453 524 if (yyerrflag > 0) --yyerrflag; 454 525 goto yyloop; … … 461 532 } 462 533 if (yyerrflag) goto yyinrecovery; 534 463 535 yyerror("syntax error"); 464 #ifdef lint 536 465 537 goto yyerrlab; 466 #endif 538 467 539 yyerrlab: 468 540 ++yynerrs; 541 469 542 yyinrecovery: 470 543 if (yyerrflag < 3) … … 481 554 to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); 482 555 #endif 483 if (yyssp >= yyss + yystacksize - 1)556 if (yyssp >= yysslim && yygrowstack()) 484 557 { 485 558 goto yyoverflow; 486 559 } 487 *++yyssp = yystate = yytable[yyn]; 560 yystate = yytable[yyn]; 561 *++yyssp = yytable[yyn]; 488 562 *++yyvsp = yylval; 489 563 goto yyloop; … … 515 589 } 516 590 #endif 517 yychar = (-1);591 yychar = YYEMPTY; 518 592 goto yyloop; 519 593 } 594 520 595 yyreduce: 521 596 #if YYDEBUG … … 525 600 #endif 526 601 yym = yylen[yyn]; 527 yyval = yyvsp[1-yym]; 602 if (yym) 603 yyval = yyvsp[1-yym]; 604 else 605 memset(&yyval, 0, sizeof yyval); 528 606 switch (yyn) 529 607 { 530 608 case 1: 531 {609 { 532 610 return (yyvsp[0]); 533 611 } 534 612 break; 535 613 case 2: 536 { yyval = yyvsp[-1]; }614 { yyval = yyvsp[-1]; } 537 615 break; 538 616 case 3: 539 { yyval = yyvsp[-2] ? yyvsp[-2] : yyvsp[0] ? yyvsp[0] : 0; }617 { yyval = yyvsp[-2] ? yyvsp[-2] : yyvsp[0] ? yyvsp[0] : 0; } 540 618 break; 541 619 case 4: 542 { yyval = yyvsp[-2] ? ( yyvsp[0] ? yyvsp[0] : 0 ) : 0; }620 { yyval = yyvsp[-2] ? ( yyvsp[0] ? yyvsp[0] : 0 ) : 0; } 543 621 break; 544 622 case 5: 545 { yyval = yyvsp[-2] | yyvsp[0]; }623 { yyval = yyvsp[-2] | yyvsp[0]; } 546 624 break; 547 625 case 6: 548 { yyval = yyvsp[-2] ^ yyvsp[0]; }626 { yyval = yyvsp[-2] ^ yyvsp[0]; } 549 627 break; 550 628 case 7: 551 { yyval = yyvsp[-2] & yyvsp[0]; }629 { yyval = yyvsp[-2] & yyvsp[0]; } 552 630 break; 553 631 case 8: 554 { yyval = yyvsp[-2] == yyvsp[0]; }632 { yyval = yyvsp[-2] == yyvsp[0]; } 555 633 break; 556 634 case 9: 557 { yyval = yyvsp[-2] > yyvsp[0]; }635 { yyval = yyvsp[-2] > yyvsp[0]; } 558 636 break; 559 637 case 10: 560 { yyval = yyvsp[-2] >= yyvsp[0]; }638 { yyval = yyvsp[-2] >= yyvsp[0]; } 561 639 break; 562 640 case 11: 563 { yyval = yyvsp[-2] < yyvsp[0]; }641 { yyval = yyvsp[-2] < yyvsp[0]; } 564 642 break; 565 643 case 12: 566 { yyval = yyvsp[-2] <= yyvsp[0]; }644 { yyval = yyvsp[-2] <= yyvsp[0]; } 567 645 break; 568 646 case 13: 569 { yyval = yyvsp[-2] != yyvsp[0]; }647 { yyval = yyvsp[-2] != yyvsp[0]; } 570 648 break; 571 649 case 14: 572 { yyval = yyvsp[-2] << yyvsp[0]; }650 { yyval = yyvsp[-2] << yyvsp[0]; } 573 651 break; 574 652 case 15: 575 { yyval = yyvsp[-2] >> yyvsp[0]; }653 { yyval = yyvsp[-2] >> yyvsp[0]; } 576 654 break; 577 655 case 16: 578 { yyval = yyvsp[-2] + yyvsp[0]; }656 { yyval = yyvsp[-2] + yyvsp[0]; } 579 657 break; 580 658 case 17: 581 { yyval = yyvsp[-2] - yyvsp[0]; }659 { yyval = yyvsp[-2] - yyvsp[0]; } 582 660 break; 583 661 case 18: 584 { yyval = yyvsp[-2] * yyvsp[0]; }662 { yyval = yyvsp[-2] * yyvsp[0]; } 585 663 break; 586 664 case 19: 587 {665 { 588 666 if (yyvsp[0] == 0) 589 667 yyerror("division by zero"); … … 592 670 break; 593 671 case 20: 594 {672 { 595 673 if (yyvsp[0] == 0) 596 674 yyerror("division by zero"); … … 599 677 break; 600 678 case 21: 601 { yyval = !(yyvsp[0]); }679 { yyval = !(yyvsp[0]); } 602 680 break; 603 681 case 22: 604 { yyval = ~(yyvsp[0]); }682 { yyval = ~(yyvsp[0]); } 605 683 break; 606 684 case 23: 607 { yyval = -(yyvsp[0]); }685 { yyval = -(yyvsp[0]); } 608 686 break; 609 687 case 24: 610 { yyval = yyvsp[0]; }688 { yyval = yyvsp[0]; } 611 689 break; 612 690 } … … 652 730 to state %d\n", YYPREFIX, *yyssp, yystate); 653 731 #endif 654 if (yyssp >= yyss + yystacksize - 1)732 if (yyssp >= yysslim && yygrowstack()) 655 733 { 656 734 goto yyoverflow; 657 735 } 658 *++yyssp = yystate;736 *++yyssp = (short) yystate; 659 737 *++yyvsp = yyval; 660 738 goto yyloop; 739 661 740 yyoverflow: 662 741 yyerror("yacc stack overflow"); 742 663 743 yyabort: 664 744 return (1); 745 665 746 yyaccept: 666 747 return (0); -
trunk/src/kash/generated/arith_lex.c
r1233 r2415 1 #line 2 "/ home/bird/vax/gdrive/coding/kbuild/svn/trunk/out/linux.x86/release/obj/src/kash/arith_lex.c"2 3 #line 4 "/ home/bird/vax/gdrive/coding/kbuild/svn/trunk/out/linux.x86/release/obj/src/kash/arith_lex.c"1 #line 2 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c" 2 3 #line 4 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c" 4 4 5 5 #define YY_INT_ALIGNED short int … … 478 478 #define YY_RESTORE_YY_MORE_OFFSET 479 479 char *yytext; 480 #line 1 "arith_lex.l" 481 #line 3 "arith_lex.l" 480 #line 1 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 481 #define YY_NO_INPUT 1 482 /** @todo %option reentrant */ 483 #line 33 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 482 484 /* $NetBSD: arith_lex.l,v 1.13 2005/03/21 22:37:09 dsl Exp $ */ 483 485 … … 522 524 #endif 523 525 526 #include <stdio.h> 524 527 #include "arith.h" 525 528 #include "error.h" … … 535 538 result = (*buf = *arith_buf++) ? 1 : YY_NULL; 536 539 #define YY_NO_UNPUT 537 #line 538 "/home/bird/vax/gdrive/coding/kbuild/svn/trunk/out/linux.x86/release/obj/src/kash/arith_lex.c" 540 541 /* Avoid unnecessary libc bits. */ 542 #undef ECHO 543 #define ECHO \ 544 do {} while (0) 545 #undef stdin 546 #define stdin \ 547 NULL 548 #undef stdout 549 #define stdout \ 550 NULL 551 #define YY_FATAL_ERROR(msg) \ 552 error(arith_psh, "arith: fatal error: %s", msg) 553 #line 554 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c" 538 554 539 555 #define INITIAL 0 … … 565 581 #endif 566 582 567 static void yyunput (int c,char *buf_ptr );568 569 583 #ifndef yytext_ptr 570 584 static void yy_flex_strncpy (char *,yyconst char *,int ); … … 688 702 register int yy_act; 689 703 690 #line 60 "arith_lex.l"691 692 #line 693 "/home/bird/vax/gdrive/coding/kbuild/svn/trunk/out/linux.x86/release/obj/src/kash/arith_lex.c"704 #line 104 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 705 706 #line 707 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c" 693 707 694 708 if ( !(yy_init) ) … … 749 763 ++yy_cp; 750 764 } 751 while ( yy_base[yy_current_state] != 48 ); 765 while ( yy_current_state != 38 ); 766 yy_cp = (yy_last_accepting_cpos); 767 yy_current_state = (yy_last_accepting_state); 752 768 753 769 yy_find_action: 754 770 yy_act = yy_accept[yy_current_state]; 755 if ( yy_act == 0 )756 { /* have to back up */757 yy_cp = (yy_last_accepting_cpos);758 yy_current_state = (yy_last_accepting_state);759 yy_act = yy_accept[yy_current_state];760 }761 771 762 772 YY_DO_BEFORE_ACTION; … … 776 786 /* rule 1 can match eol */ 777 787 YY_RULE_SETUP 778 #line 61 "arith_lex.l"788 #line 105 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 779 789 { ; } 780 790 YY_BREAK 781 791 case 2: 782 792 YY_RULE_SETUP 783 #line 62 "arith_lex.l"793 #line 106 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 784 794 { yylval = strtol(yytext, 0, 0); return(ARITH_NUM); } 785 795 YY_BREAK 786 796 case 3: 787 797 YY_RULE_SETUP 788 #line 63 "arith_lex.l"798 #line 107 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 789 799 { yylval = strtol(yytext, 0, 0); return(ARITH_NUM); } 790 800 YY_BREAK 791 801 case 4: 792 802 YY_RULE_SETUP 793 #line 64 "arith_lex.l"803 #line 108 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 794 804 { yylval = strtol(yytext, 0, 0); return(ARITH_NUM); } 795 805 YY_BREAK 796 806 case 5: 797 807 YY_RULE_SETUP 798 #line 65 "arith_lex.l"808 #line 109 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 799 809 { char *v = lookupvar(arith_psh, yytext); 800 810 if (v) { … … 808 818 case 6: 809 819 YY_RULE_SETUP 810 #line 73 "arith_lex.l"820 #line 117 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 811 821 { return(ARITH_LPAREN); } 812 822 YY_BREAK 813 823 case 7: 814 824 YY_RULE_SETUP 815 #line 74 "arith_lex.l"825 #line 118 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 816 826 { return(ARITH_RPAREN); } 817 827 YY_BREAK 818 828 case 8: 819 829 YY_RULE_SETUP 820 #line 75 "arith_lex.l"830 #line 119 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 821 831 { return(ARITH_OR); } 822 832 YY_BREAK 823 833 case 9: 824 834 YY_RULE_SETUP 825 #line 76 "arith_lex.l"835 #line 120 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 826 836 { return(ARITH_AND); } 827 837 YY_BREAK 828 838 case 10: 829 839 YY_RULE_SETUP 830 #line 77 "arith_lex.l"840 #line 121 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 831 841 { return(ARITH_BOR); } 832 842 YY_BREAK 833 843 case 11: 834 844 YY_RULE_SETUP 835 #line 78 "arith_lex.l"845 #line 122 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 836 846 { return(ARITH_BXOR); } 837 847 YY_BREAK 838 848 case 12: 839 849 YY_RULE_SETUP 840 #line 79 "arith_lex.l"850 #line 123 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 841 851 { return(ARITH_BAND); } 842 852 YY_BREAK 843 853 case 13: 844 854 YY_RULE_SETUP 845 #line 80 "arith_lex.l"855 #line 124 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 846 856 { return(ARITH_EQ); } 847 857 YY_BREAK 848 858 case 14: 849 859 YY_RULE_SETUP 850 #line 81 "arith_lex.l"860 #line 125 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 851 861 { return(ARITH_NE); } 852 862 YY_BREAK 853 863 case 15: 854 864 YY_RULE_SETUP 855 #line 82 "arith_lex.l"865 #line 126 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 856 866 { return(ARITH_GT); } 857 867 YY_BREAK 858 868 case 16: 859 869 YY_RULE_SETUP 860 #line 83 "arith_lex.l"870 #line 127 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 861 871 { return(ARITH_GE); } 862 872 YY_BREAK 863 873 case 17: 864 874 YY_RULE_SETUP 865 #line 84 "arith_lex.l"875 #line 128 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 866 876 { return(ARITH_LT); } 867 877 YY_BREAK 868 878 case 18: 869 879 YY_RULE_SETUP 870 #line 85 "arith_lex.l"880 #line 129 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 871 881 { return(ARITH_LE); } 872 882 YY_BREAK 873 883 case 19: 874 884 YY_RULE_SETUP 875 #line 86 "arith_lex.l"885 #line 130 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 876 886 { return(ARITH_LSHIFT); } 877 887 YY_BREAK 878 888 case 20: 879 889 YY_RULE_SETUP 880 #line 87 "arith_lex.l"890 #line 131 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 881 891 { return(ARITH_RSHIFT); } 882 892 YY_BREAK 883 893 case 21: 884 894 YY_RULE_SETUP 885 #line 88 "arith_lex.l"895 #line 132 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 886 896 { return(ARITH_MUL); } 887 897 YY_BREAK 888 898 case 22: 889 899 YY_RULE_SETUP 890 #line 89 "arith_lex.l"900 #line 133 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 891 901 { return(ARITH_DIV); } 892 902 YY_BREAK 893 903 case 23: 894 904 YY_RULE_SETUP 895 #line 90 "arith_lex.l"905 #line 134 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 896 906 { return(ARITH_REM); } 897 907 YY_BREAK 898 908 case 24: 899 909 YY_RULE_SETUP 900 #line 91 "arith_lex.l"910 #line 135 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 901 911 { return(ARITH_ADD); } 902 912 YY_BREAK 903 913 case 25: 904 914 YY_RULE_SETUP 905 #line 92 "arith_lex.l"915 #line 136 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 906 916 { return(ARITH_SUB); } 907 917 YY_BREAK 908 918 case 26: 909 919 YY_RULE_SETUP 910 #line 93 "arith_lex.l"920 #line 137 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 911 921 { return(ARITH_BNOT); } 912 922 YY_BREAK 913 923 case 27: 914 924 YY_RULE_SETUP 915 #line 94 "arith_lex.l"925 #line 138 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 916 926 { return(ARITH_NOT); } 917 927 YY_BREAK 918 928 case 28: 919 929 YY_RULE_SETUP 920 #line 95 "arith_lex.l"930 #line 139 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 921 931 { error(arith_psh, "arith: syntax error: \"%s\"", arith_startbuf); } 922 932 YY_BREAK 923 933 case 29: 924 934 YY_RULE_SETUP 925 #line 96 "arith_lex.l"935 #line 140 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 926 936 ECHO; 927 937 YY_BREAK 928 #line 9 29 "/home/bird/vax/gdrive/coding/kbuild/svn/trunk/out/linux.x86/release/obj/src/kash/arith_lex.c"938 #line 939 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c" 929 939 case YY_STATE_EOF(INITIAL): 930 940 yyterminate(); … … 993 1003 else 994 1004 { 995 yy_cp = (yy_c_buf_p); 1005 yy_cp = (yy_last_accepting_cpos); 1006 yy_current_state = (yy_last_accepting_state); 996 1007 goto yy_find_action; 997 1008 } … … 1247 1258 } 1248 1259 1249 static void yyunput (int c, register char * yy_bp )1250 {1251 register char *yy_cp;1252 1253 yy_cp = (yy_c_buf_p);1254 1255 /* undo effects of setting up yytext */1256 *yy_cp = (yy_hold_char);1257 1258 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )1259 { /* need to shift things up to make room */1260 /* +2 for EOB chars. */1261 register int number_to_move = (yy_n_chars) + 2;1262 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[1263 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];1264 register char *source =1265 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];1266 1267 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )1268 *--dest = *--source;1269 1270 yy_cp += (int) (dest - source);1271 yy_bp += (int) (dest - source);1272 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =1273 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;1274 1275 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )1276 YY_FATAL_ERROR( "flex scanner push-back overflow" );1277 }1278 1279 *--yy_cp = (char) c;1280 1281 (yytext_ptr) = yy_bp;1282 (yy_hold_char) = *yy_cp;1283 (yy_c_buf_p) = yy_cp;1284 }1285 1286 1260 #ifndef YY_NO_INPUT 1287 1261 #ifdef __cplusplus … … 1332 1306 { 1333 1307 if ( yywrap( ) ) 1334 return EOF;1308 return 0; 1335 1309 1336 1310 if ( ! (yy_did_buffer_switch_on_eof) ) … … 1468 1442 } 1469 1443 1470 #ifndef _UNISTD_H /* assume unistd.h has isatty() for us */1471 #ifdef __cplusplus1472 extern "C" {1473 #endif1474 #ifdef __THROW /* this is a gnuism */1475 extern int isatty (int ) __THROW;1476 #else1477 extern int isatty (int );1478 #endif1479 #ifdef __cplusplus1480 }1481 #endif1482 #endif1483 1484 1444 /* Initializes or reinitializes a buffer. 1485 1445 * This function is sometimes called more than once on the same buffer, … … 1505 1465 } 1506 1466 1507 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) :0;1467 b->yy_is_interactive = 0; 1508 1468 1509 1469 errno = oerrno; … … 1631 1591 } 1632 1592 1633 /** Setup the input buffer state to scan directly from a user-specified character buffer.1634 * @param base the character buffer1635 * @param size the size in bytes of the character buffer1636 *1637 * @return the newly allocated buffer state object.1638 */1639 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )1640 {1641 YY_BUFFER_STATE b;1642 1643 if ( size < 2 ||1644 base[size-2] != YY_END_OF_BUFFER_CHAR ||1645 base[size-1] != YY_END_OF_BUFFER_CHAR )1646 /* They forgot to leave room for the EOB's. */1647 return 0;1648 1649 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );1650 if ( ! b )1651 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );1652 1653 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */1654 b->yy_buf_pos = b->yy_ch_buf = base;1655 b->yy_is_our_buffer = 0;1656 b->yy_input_file = 0;1657 b->yy_n_chars = b->yy_buf_size;1658 b->yy_is_interactive = 0;1659 b->yy_at_bol = 1;1660 b->yy_fill_buffer = 0;1661 b->yy_buffer_status = YY_BUFFER_NEW;1662 1663 yy_switch_to_buffer(b );1664 1665 return b;1666 }1667 1668 /** Setup the input buffer state to scan a string. The next call to yylex() will1669 * scan from a @e copy of @a str.1670 * @param str a NUL-terminated string to scan1671 *1672 * @return the newly allocated buffer state object.1673 * @note If you want to scan bytes that may contain NUL values, then use1674 * yy_scan_bytes() instead.1675 */1676 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )1677 {1678 1679 return yy_scan_bytes(yystr,strlen(yystr) );1680 }1681 1682 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will1683 * scan from a @e copy of @a bytes.1684 * @param bytes the byte buffer to scan1685 * @param len the number of bytes in the buffer pointed to by @a bytes.1686 *1687 * @return the newly allocated buffer state object.1688 */1689 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )1690 {1691 YY_BUFFER_STATE b;1692 char *buf;1693 yy_size_t n;1694 int i;1695 1696 /* Get memory for full buffer, including space for trailing EOB's. */1697 n = _yybytes_len + 2;1698 buf = (char *) yyalloc(n );1699 if ( ! buf )1700 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );1701 1702 for ( i = 0; i < _yybytes_len; ++i )1703 buf[i] = yybytes[i];1704 1705 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;1706 1707 b = yy_scan_buffer(buf,n );1708 if ( ! b )1709 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );1710 1711 /* It's okay to grow etc. this buffer, and we should throw it1712 * away when we're done.1713 */1714 b->yy_is_our_buffer = 1;1715 1716 return b;1717 }1718 1719 1593 #ifndef YY_EXIT_FAILURE 1720 1594 #define YY_EXIT_FAILURE 2 … … 1746 1620 /* Accessor methods (get/set functions) to struct members. */ 1747 1621 1748 /** Get the current line number.1749 *1750 */1751 int yyget_lineno (void)1752 {1753 1754 return yylineno;1755 }1756 1757 /** Get the input stream.1758 *1759 */1760 FILE *yyget_in (void)1761 {1762 return yyin;1763 }1764 1765 /** Get the output stream.1766 *1767 */1768 FILE *yyget_out (void)1769 {1770 return yyout;1771 }1772 1773 /** Get the length of the current token.1774 *1775 */1776 int yyget_leng (void)1777 {1778 return yyleng;1779 }1780 1781 1622 /** Get the current token. 1782 1623 * 1783 1624 */ 1784 1785 char *yyget_text (void)1786 {1787 return yytext;1788 }1789 1790 /** Set the current line number.1791 * @param line_number1792 *1793 */1794 void yyset_lineno (int line_number )1795 {1796 1797 yylineno = line_number;1798 }1799 1800 /** Set the input stream. This does not discard the current1801 * input buffer.1802 * @param in_str A readable stream.1803 *1804 * @see yy_switch_to_buffer1805 */1806 void yyset_in (FILE * in_str )1807 {1808 yyin = in_str ;1809 }1810 1811 void yyset_out (FILE * out_str )1812 {1813 yyout = out_str ;1814 }1815 1816 int yyget_debug (void)1817 {1818 return yy_flex_debug;1819 }1820 1821 void yyset_debug (int bdebug )1822 {1823 yy_flex_debug = bdebug ;1824 }1825 1625 1826 1626 static int yy_init_globals (void) … … 1898 1698 #endif 1899 1699 1900 void *yyalloc (yy_size_t size )1901 {1902 return (void *) malloc( size );1903 }1904 1905 void *yyrealloc (void * ptr, yy_size_t size )1906 {1907 /* The cast to (char *) in the following accommodates both1908 * implementations that use char* generic pointers, and those1909 * that use void* generic pointers. It works with the latter1910 * because both ANSI C and C++ allow castless assignment from1911 * any pointer type to void*, and deal with argument conversions1912 * as though doing an assignment.1913 */1914 return (void *) realloc( (char *) ptr, size );1915 }1916 1917 void yyfree (void * ptr )1918 {1919 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */1920 }1921 1922 1700 #define YYTABLES_NAME "yytables" 1923 1701 1924 #line 96 "arith_lex.l"1702 #line 140 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l" 1925 1703 1926 1704 … … 1933 1711 } 1934 1712 1713 void * 1714 yyalloc(yy_size_t cb) 1715 { 1716 return sh_malloc(NULL, cb); 1717 } 1718 1719 void * 1720 yyrealloc(void *pv,yy_size_t cb) 1721 { 1722 return sh_realloc(NULL, pv, cb); 1723 } 1724 1725 void 1726 yyfree(void *pv) 1727 { 1728 sh_free(NULL, pv); 1729 } 1730 1731 -
trunk/src/kash/generated/init.c
r2290 r2415 110 110 #undef STANDARD_BITS 111 111 #define STANDARD_BITS (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO) 112 #undef SHMEMHDR_MAGIC_FREE 113 #define SHMEMHDR_MAGIC_FREE 0xbeeff00d 114 #undef SHMEMHDR_MAGIC_USED 115 #define SHMEMHDR_MAGIC_USED 0xfeedface 116 #undef SHMEMCHUNK_MAGIC 117 #define SHMEMCHUNK_MAGIC 0x12345678 118 #undef SHHEAP_MIN_CHUNK 119 #define SHHEAP_MIN_CHUNK 0x80000 //(1024*1024) 120 #undef SHFILE_MAX 121 #define SHFILE_MAX 1024 122 #undef SHFILE_GROW 123 #define SHFILE_GROW 64 124 #undef SHFILE_UNIX_MIN_FD 125 #define SHFILE_UNIX_MIN_FD 32 126 #undef SHFILE_MAX_PATH 127 #define SHFILE_MAX_PATH 4096 128 #undef YY_NO_UNPUT 129 #define YY_NO_UNPUT 112 130 113 131 … … 132 150 init(shinstance *psh) { 133 151 134 /* from exec.c: */152 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/exec.c: */ 135 153 { 136 154 hash_special_builtins(psh); 137 155 } 138 156 139 /* from input.c: */157 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/input.c: */ 140 158 { 141 159 psh->basepf.nextc = psh->basepf.buf = psh->basebuf; 142 160 } 143 161 144 /* from options.c: */162 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/options.c: */ 145 163 { 146 164 memcpy(&psh->optlist[0], &ro_optlist[0], sizeof(psh->optlist)); 147 165 } 148 166 149 /* from var.c: */167 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/var.c: */ 150 168 { 151 169 char **envp; … … 170 188 reset(shinstance *psh) { 171 189 172 /* from eval.c: */190 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/eval.c: */ 173 191 { 174 192 psh->evalskip = 0; … … 177 195 } 178 196 179 /* from input.c: */197 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/input.c: */ 180 198 { 181 199 if (psh->exception != EXSHELLPROC) … … 184 202 } 185 203 186 /* from output.c: */204 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/output.c: */ 187 205 { 188 206 psh->out1 = &psh->output; … … 194 212 } 195 213 196 /* from parser.c: */214 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/parser.c: */ 197 215 { 198 216 psh->tokpushback = 0; … … 200 218 } 201 219 202 /* from redir.c: */220 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/redir.c: */ 203 221 { 204 222 while (psh->redirlist) … … 216 234 initshellproc(shinstance *psh) { 217 235 218 /* from alias.c: */236 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/alias.c: */ 219 237 { 220 238 rmaliases(psh); 221 239 } 222 240 223 /* from eval.c: */241 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/eval.c: */ 224 242 { 225 243 psh->exitstatus = 0; 226 244 } 227 245 228 /* from exec.c: */246 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/exec.c: */ 229 247 { 230 248 deletefuncs(psh); 231 249 } 232 250 233 /* from input.c: */251 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/input.c: */ 234 252 { 235 253 popallfiles(psh); 236 254 } 237 255 238 /* from jobs.c: */256 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/jobs.c: */ 239 257 { 240 258 psh->backgndpid = -1; … … 244 262 } 245 263 246 /* from options.c: */264 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/options.c: */ 247 265 { 248 266 int i; … … 254 272 } 255 273 256 /* from redir.c: */274 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/redir.c: */ 257 275 { 258 276 clearredir(psh, 0); 259 277 } 260 278 261 /* from trap.c: */279 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/trap.c: */ 262 280 { 263 281 char *sm; … … 270 288 } 271 289 272 /* from var.c: */290 /* from /Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/var.c: */ 273 291 { 274 292 shprocvar(psh); -
trunk/src/kash/shfile.h
r2413 r2415 173 173 typedef struct shdir 174 174 { 175 shfdtab * shfdtab;175 shfdtab *pshfdtab; 176 176 void *native; 177 177 shdirent ent;
Note:
See TracChangeset
for help on using the changeset viewer.