diff options
author | Eugene Sandulenko | 2016-08-02 19:49:24 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 8a29870a8a15912c6238635fc260eb873e8aa5dc (patch) | |
tree | e5998065744363a8ba9488213879627c4ab30e0b /engines/director/lingo | |
parent | 62c0700588d1414446a02222fcd9a14fb387f837 (diff) | |
download | scummvm-rg350-8a29870a8a15912c6238635fc260eb873e8aa5dc.tar.gz scummvm-rg350-8a29870a8a15912c6238635fc260eb873e8aa5dc.tar.bz2 scummvm-rg350-8a29870a8a15912c6238635fc260eb873e8aa5dc.zip |
DIRECTOR: Lingo: Put codeFunc into separate function
Diffstat (limited to 'engines/director/lingo')
-rw-r--r-- | engines/director/lingo/lingo-codegen.cpp | 9 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.cpp | 139 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.y | 7 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 1 |
4 files changed, 78 insertions, 78 deletions
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp index 00875dec27..e59f57ab4f 100644 --- a/engines/director/lingo/lingo-codegen.cpp +++ b/engines/director/lingo/lingo-codegen.cpp @@ -206,6 +206,15 @@ void Lingo::codeArgStore() { } } +int Lingo::codeFunc(Common::String *s, int numpar) { + g_lingo->code1(g_lingo->c_call); + g_lingo->codeString(s->c_str()); + + inst num = 0; + WRITE_UINT32(&num, numpar); + g_lingo->code1(num); +} + void Lingo::codeLabel(int label) { _labelstack.push_back(label); } diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index ccbf35533e..c38e774b08 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -608,13 +608,13 @@ static const yytype_uint16 yyrline[] = 172, 174, 175, 180, 191, 207, 219, 224, 231, 240, 249, 259, 269, 280, 281, 284, 285, 288, 289, 292, 300, 301, 309, 310, 311, 313, 315, 321, 327, 334, - 336, 338, 339, 340, 343, 348, 351, 354, 358, 366, - 370, 377, 383, 384, 385, 386, 387, 388, 389, 390, - 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 407, 408, 409, 410, 411, 413, - 416, 417, 428, 429, 430, 431, 436, 442, 449, 450, - 451, 452, 455, 456, 457, 485, 485, 491, 494, 494, - 500, 501, 502, 503, 505, 509, 517, 518, 519 + 336, 338, 339, 340, 343, 348, 351, 354, 358, 361, + 365, 372, 378, 379, 380, 381, 382, 383, 384, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, 402, 403, 404, 405, 406, 408, + 411, 412, 423, 424, 425, 426, 431, 437, 444, 445, + 446, 447, 450, 451, 452, 480, 480, 486, 489, 489, + 495, 496, 497, 498, 500, 504, 512, 513, 514 }; #endif @@ -2128,17 +2128,12 @@ yyreduce: case 58: #line 358 "engines/director/lingo/lingo-gr.y" { - (yyval.code) = g_lingo->code1(g_lingo->c_call); - g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str()); - - inst numpar = 0; - WRITE_UINT32(&numpar, (yyvsp[(3) - (4)].narg)); - g_lingo->code1(numpar); + (yyval.code) = g_lingo->codeFunc((yyvsp[(1) - (4)].s), (yyvsp[(3) - (4)].narg)); delete (yyvsp[(1) - (4)].s); ;} break; case 59: -#line 366 "engines/director/lingo/lingo-gr.y" +#line 361 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_eval); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); @@ -2146,7 +2141,7 @@ yyreduce: break; case 60: -#line 370 "engines/director/lingo/lingo-gr.y" +#line 365 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id g_lingo->code1(g_lingo->c_theentitypush); @@ -2157,7 +2152,7 @@ yyreduce: break; case 61: -#line 377 "engines/director/lingo/lingo-gr.y" +#line 372 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_theentitypush); inst e = 0, f = 0; @@ -2167,158 +2162,158 @@ yyreduce: break; case 63: -#line 384 "engines/director/lingo/lingo-gr.y" +#line 379 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_add); ;} break; case 64: -#line 385 "engines/director/lingo/lingo-gr.y" +#line 380 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_sub); ;} break; case 65: -#line 386 "engines/director/lingo/lingo-gr.y" +#line 381 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_mul); ;} break; case 66: -#line 387 "engines/director/lingo/lingo-gr.y" +#line 382 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_div); ;} break; case 67: -#line 388 "engines/director/lingo/lingo-gr.y" +#line 383 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gt); ;} break; case 68: -#line 389 "engines/director/lingo/lingo-gr.y" +#line 384 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_lt); ;} break; case 69: -#line 390 "engines/director/lingo/lingo-gr.y" +#line 385 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_neq); ;} break; case 70: -#line 391 "engines/director/lingo/lingo-gr.y" +#line 386 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_ge); ;} break; case 71: -#line 392 "engines/director/lingo/lingo-gr.y" +#line 387 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_le); ;} break; case 72: -#line 393 "engines/director/lingo/lingo-gr.y" +#line 388 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_and); ;} break; case 73: -#line 394 "engines/director/lingo/lingo-gr.y" +#line 389 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_or); ;} break; case 74: -#line 395 "engines/director/lingo/lingo-gr.y" +#line 390 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_not); ;} break; case 75: -#line 396 "engines/director/lingo/lingo-gr.y" +#line 391 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_ampersand); ;} break; case 76: -#line 397 "engines/director/lingo/lingo-gr.y" +#line 392 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_concat); ;} break; case 77: -#line 398 "engines/director/lingo/lingo-gr.y" +#line 393 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_contains); ;} break; case 78: -#line 399 "engines/director/lingo/lingo-gr.y" +#line 394 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_starts); ;} break; case 79: -#line 400 "engines/director/lingo/lingo-gr.y" +#line 395 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (2)].code); ;} break; case 80: -#line 401 "engines/director/lingo/lingo-gr.y" +#line 396 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;} break; case 81: -#line 402 "engines/director/lingo/lingo-gr.y" +#line 397 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (3)].code); ;} break; case 82: -#line 403 "engines/director/lingo/lingo-gr.y" +#line 398 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_intersects); ;} break; case 83: -#line 404 "engines/director/lingo/lingo-gr.y" +#line 399 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_within); ;} break; case 84: -#line 407 "engines/director/lingo/lingo-gr.y" +#line 402 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;} break; case 85: -#line 408 "engines/director/lingo/lingo-gr.y" +#line 403 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;} break; case 86: -#line 409 "engines/director/lingo/lingo-gr.y" +#line 404 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_printtop); ;} break; case 88: -#line 411 "engines/director/lingo/lingo-gr.y" +#line 406 "engines/director/lingo/lingo-gr.y" { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack g_lingo->code1(g_lingo->c_procret); ;} break; case 90: -#line 416 "engines/director/lingo/lingo-gr.y" +#line 411 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;} break; case 91: -#line 417 "engines/director/lingo/lingo-gr.y" +#line 412 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(3) - (3)].s); ;} break; case 92: -#line 428 "engines/director/lingo/lingo-gr.y" +#line 423 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoloop); ;} break; case 93: -#line 429 "engines/director/lingo/lingo-gr.y" +#line 424 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotonext); ;} break; case 94: -#line 430 "engines/director/lingo/lingo-gr.y" +#line 425 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoprevious); ;} break; case 95: -#line 431 "engines/director/lingo/lingo-gr.y" +#line 426 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); @@ -2327,7 +2322,7 @@ yyreduce: break; case 96: -#line 436 "engines/director/lingo/lingo-gr.y" +#line 431 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); @@ -2337,7 +2332,7 @@ yyreduce: break; case 97: -#line 442 "engines/director/lingo/lingo-gr.y" +#line 437 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); @@ -2346,47 +2341,47 @@ yyreduce: break; case 98: -#line 449 "engines/director/lingo/lingo-gr.y" +#line 444 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; case 99: -#line 450 "engines/director/lingo/lingo-gr.y" +#line 445 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; case 100: -#line 451 "engines/director/lingo/lingo-gr.y" +#line 446 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; case 101: -#line 452 "engines/director/lingo/lingo-gr.y" +#line 447 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(1) - (1)].s); ;} break; case 102: -#line 455 "engines/director/lingo/lingo-gr.y" +#line 450 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; case 103: -#line 456 "engines/director/lingo/lingo-gr.y" +#line 451 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; case 104: -#line 457 "engines/director/lingo/lingo-gr.y" +#line 452 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; case 105: -#line 485 "engines/director/lingo/lingo-gr.y" +#line 480 "engines/director/lingo/lingo-gr.y" { g_lingo->_indef = true; ;} break; case 106: -#line 486 "engines/director/lingo/lingo-gr.y" +#line 481 "engines/director/lingo/lingo-gr.y" { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack g_lingo->code1(g_lingo->c_procret); @@ -2395,19 +2390,19 @@ yyreduce: break; case 107: -#line 491 "engines/director/lingo/lingo-gr.y" +#line 486 "engines/director/lingo/lingo-gr.y" { g_lingo->codeFactory(*(yyvsp[(2) - (2)].s)); ;} break; case 108: -#line 494 "engines/director/lingo/lingo-gr.y" +#line 489 "engines/director/lingo/lingo-gr.y" { g_lingo->_indef = true; ;} break; case 109: -#line 495 "engines/director/lingo/lingo-gr.y" +#line 490 "engines/director/lingo/lingo-gr.y" { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack g_lingo->code1(g_lingo->c_procret); @@ -2416,32 +2411,32 @@ yyreduce: break; case 110: -#line 500 "engines/director/lingo/lingo-gr.y" +#line 495 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 0; ;} break; case 111: -#line 501 "engines/director/lingo/lingo-gr.y" +#line 496 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;} break; case 112: -#line 502 "engines/director/lingo/lingo-gr.y" +#line 497 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; case 113: -#line 503 "engines/director/lingo/lingo-gr.y" +#line 498 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;} break; case 114: -#line 505 "engines/director/lingo/lingo-gr.y" +#line 500 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArgStore(); ;} break; case 115: -#line 509 "engines/director/lingo/lingo-gr.y" +#line 504 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_call); g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str()); @@ -2451,23 +2446,23 @@ yyreduce: break; case 116: -#line 517 "engines/director/lingo/lingo-gr.y" +#line 512 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 0; ;} break; case 117: -#line 518 "engines/director/lingo/lingo-gr.y" +#line 513 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 1; ;} break; case 118: -#line 519 "engines/director/lingo/lingo-gr.y" +#line 514 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; /* Line 1267 of yacc.c. */ -#line 2471 "engines/director/lingo/lingo-gr.cpp" +#line 2466 "engines/director/lingo/lingo-gr.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2681,6 +2676,6 @@ yyreturn: } -#line 522 "engines/director/lingo/lingo-gr.y" +#line 517 "engines/director/lingo/lingo-gr.y" diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y index e718d4806a..2726d523cd 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -356,12 +356,7 @@ expr: INT { $$ = g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy value delete $1; } | ID '(' arglist ')' { - $$ = g_lingo->code1(g_lingo->c_call); - g_lingo->codeString($1->c_str()); - - inst numpar = 0; - WRITE_UINT32(&numpar, $3); - g_lingo->code1(numpar); + $$ = g_lingo->codeFunc($1, $3); delete $1; } | ID { $$ = g_lingo->code1(g_lingo->c_eval); diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index c80d6ee1ac..3bec29832e 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -184,6 +184,7 @@ public: void codeArg(Common::String *s); void codeArgStore(); + int codeFunc(Common::String *s, int numpar); int codeFloat(double f); void codeFactory(Common::String &s); |