| 441 | // back to the caller of yyparse(). |
| 442 | |
| 443 | int |
| 444 | yy_parse::yyparse(yy_scan* ps) |
| 445 | { |
| 446 | int wReturnValue; |
| 447 | HANDLE hRes_table; |
| 448 | short far *old_yydef; // the following are used for saving |
| 449 | short far *old_yyex; // the current pointers |
| 450 | short far *old_yyact; |
| 451 | short far *old_yypact; |
| 452 | short far *old_yygo; |
| 453 | short far *old_yypgo; |
| 454 | short far *old_yyrlen; |
| 455 | |
| 456 | // the following code will load the required |
| 457 | // resources for a Windows based parser. |
| 458 | |
| 459 | hRes_table = LoadResource (hInst, |
| 460 | FindResource (hInst, "UD_RES_yyYACC", "yyYACCTBL")); |
| 461 | |
| 462 | // return an error code if any |
| 463 | // of the resources did not load |
| 464 | |
| 465 | if (hRes_table == (HANDLE)NULL) |
| 466 | return (1); |
| 467 | |
| 468 | // the following code will lock the resources |
| 469 | // into fixed memory locations for the parser |
| 470 | // (also, save away the old pointer values) |
| 471 | |
| 472 | old_yydef = yydef; |
| 473 | old_yyex = yyex; |
| 474 | old_yyact = yyact; |
| 475 | old_yypact = yypact; |
| 476 | old_yygo = yygo; |
| 477 | old_yypgo = yypgo; |
| 478 | old_yyrlen = yyrlen; |
| 479 | |
| 480 | yydef = (short far *)LockResource (hRes_table); |
| 481 | yyex = (short far *)(yydef + Sizeof_yydef); |
| 482 | yyact = (short far *)(yyex + Sizeof_yyex); |
| 483 | yypact = (short far *)(yyact + Sizeof_yyact); |
| 484 | yygo = (short far *)(yypact + Sizeof_yypact); |
| 485 | yypgo = (short far *)(yygo + Sizeof_yygo); |
| 486 | yyrlen = (short far *)(yypgo + Sizeof_yypgo); |
| 487 | |
| 488 | // call the official yyparse() function |
| 489 | |
| 490 | wReturnValue = win_yyparse (ps); |
| 491 | |
| 492 | // unlock the resources |
| 493 | |
| 494 | UnlockResource (hRes_table); |
| 495 | |
| 496 | // and now free the resource |
| 497 | |
| 498 | FreeResource (hRes_table); |
| 499 | |
| 500 | // |