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