aboutsummaryrefslogtreecommitdiff
path: root/engines/director
diff options
context:
space:
mode:
authorEugene Sandulenko2017-02-22 13:42:01 +0100
committerEugene Sandulenko2017-02-22 13:42:01 +0100
commitbb4b96bcab8059044abbe25918005ea68150179b (patch)
tree09ad06f7c27dc61a355d747b5ddf1321b188d70e /engines/director
parent58d393b314d95082612193838be86b24e09c3b30 (diff)
downloadscummvm-rg350-bb4b96bcab8059044abbe25918005ea68150179b.tar.gz
scummvm-rg350-bb4b96bcab8059044abbe25918005ea68150179b.tar.bz2
scummvm-rg350-bb4b96bcab8059044abbe25918005ea68150179b.zip
DIRECTOR: Lingo: Avoid pushing fake values on stack
Diffstat (limited to 'engines/director')
-rw-r--r--engines/director/lingo/lingo-gr.cpp124
-rw-r--r--engines/director/lingo/lingo-gr.y7
2 files changed, 60 insertions, 71 deletions
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 453c92652c..da928f7c09 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -701,13 +701,13 @@ static const yytype_uint16 yyrline[] =
438, 444, 445, 446, 447, 448, 449, 450, 451, 452,
453, 454, 455, 456, 457, 458, 459, 460, 461, 462,
463, 464, 465, 466, 467, 468, 469, 470, 471, 472,
- 473, 474, 475, 478, 483, 484, 485, 486, 487, 489,
- 490, 491, 492, 495, 498, 501, 505, 506, 507, 508,
- 509, 510, 511, 514, 515, 518, 519, 522, 523, 534,
- 535, 536, 537, 540, 543, 548, 549, 552, 553, 556,
- 557, 560, 563, 566, 566, 596, 596, 602, 605, 605,
- 610, 611, 610, 621, 622, 623, 624, 627, 631, 639,
- 640, 641, 644, 645
+ 473, 474, 475, 478, 483, 484, 485, 486, 487, 488,
+ 489, 490, 491, 494, 497, 500, 504, 505, 506, 507,
+ 508, 509, 510, 513, 514, 517, 518, 521, 522, 533,
+ 534, 535, 536, 539, 542, 547, 548, 551, 552, 555,
+ 556, 559, 562, 565, 565, 595, 595, 600, 603, 603,
+ 608, 609, 608, 618, 619, 620, 621, 624, 628, 636,
+ 637, 638, 641, 642
};
#endif
@@ -2261,11 +2261,6 @@ yyreduce:
(yyval.code) = (yyvsp[(5) - (5)].code); ;}
break;
- case 20:
-#line 191 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_xpop); ;}
- break;
-
case 24:
#line 201 "engines/director/lingo/lingo-gr.y"
{
@@ -2790,33 +2785,32 @@ yyreduce:
case 108:
#line 487 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeConst(0); // Push fake value on stack
- g_lingo->code1(g_lingo->c_procret); ;}
+ { g_lingo->code1(g_lingo->c_procret); ;}
break;
case 112:
-#line 492 "engines/director/lingo/lingo-gr.y"
+#line 491 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeFunc((yyvsp[(1) - (1)].s), 0);
delete (yyvsp[(1) - (1)].s); ;}
break;
case 113:
-#line 495 "engines/director/lingo/lingo-gr.y"
+#line 494 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeFunc((yyvsp[(1) - (2)].s), 1);
delete (yyvsp[(1) - (2)].s); ;}
break;
case 114:
-#line 498 "engines/director/lingo/lingo-gr.y"
+#line 497 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeFunc((yyvsp[(1) - (2)].s), 1);
delete (yyvsp[(1) - (2)].s); ;}
break;
case 115:
-#line 501 "engines/director/lingo/lingo-gr.y"
+#line 500 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_voidpush);
g_lingo->codeFunc((yyvsp[(1) - (1)].s), 1);
@@ -2824,172 +2818,171 @@ yyreduce:
break;
case 116:
-#line 505 "engines/director/lingo/lingo-gr.y"
+#line 504 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeFunc((yyvsp[(1) - (2)].s), (yyvsp[(2) - (2)].narg)); ;}
break;
case 117:
-#line 506 "engines/director/lingo/lingo-gr.y"
+#line 505 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeFunc((yyvsp[(1) - (4)].s), (yyvsp[(3) - (4)].narg)); ;}
break;
case 118:
-#line 507 "engines/director/lingo/lingo-gr.y"
+#line 506 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeMe((yyvsp[(3) - (4)].s), 0); ;}
break;
case 119:
-#line 508 "engines/director/lingo/lingo-gr.y"
+#line 507 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeMe((yyvsp[(3) - (6)].s), (yyvsp[(5) - (6)].narg)); ;}
break;
case 120:
-#line 509 "engines/director/lingo/lingo-gr.y"
+#line 508 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_open); ;}
break;
case 121:
-#line 510 "engines/director/lingo/lingo-gr.y"
+#line 509 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_voidpush, g_lingo->c_open); ;}
break;
case 122:
-#line 511 "engines/director/lingo/lingo-gr.y"
+#line 510 "engines/director/lingo/lingo-gr.y"
{ Common::String s(*(yyvsp[(1) - (3)].s)); s += '-'; s += *(yyvsp[(2) - (3)].s); g_lingo->codeFunc(&s, (yyvsp[(3) - (3)].narg)); ;}
break;
case 123:
-#line 514 "engines/director/lingo/lingo-gr.y"
+#line 513 "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 124:
-#line 515 "engines/director/lingo/lingo-gr.y"
+#line 514 "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 125:
-#line 518 "engines/director/lingo/lingo-gr.y"
+#line 517 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_property); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;}
break;
case 126:
-#line 519 "engines/director/lingo/lingo-gr.y"
+#line 518 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_property); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(3) - (3)].s); ;}
break;
case 127:
-#line 522 "engines/director/lingo/lingo-gr.y"
+#line 521 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_instance); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;}
break;
case 128:
-#line 523 "engines/director/lingo/lingo-gr.y"
+#line 522 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_instance); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(3) - (3)].s); ;}
break;
case 129:
-#line 534 "engines/director/lingo/lingo-gr.y"
+#line 533 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 130:
-#line 535 "engines/director/lingo/lingo-gr.y"
+#line 534 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 131:
-#line 536 "engines/director/lingo/lingo-gr.y"
+#line 535 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 132:
-#line 537 "engines/director/lingo/lingo-gr.y"
+#line 536 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeConst(1);
g_lingo->code1(g_lingo->c_goto); ;}
break;
case 133:
-#line 540 "engines/director/lingo/lingo-gr.y"
+#line 539 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeConst(3);
g_lingo->code1(g_lingo->c_goto); ;}
break;
case 134:
-#line 543 "engines/director/lingo/lingo-gr.y"
+#line 542 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeConst(2);
g_lingo->code1(g_lingo->c_goto); ;}
break;
case 139:
-#line 556 "engines/director/lingo/lingo-gr.y"
+#line 555 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_playdone); ;}
break;
case 140:
-#line 557 "engines/director/lingo/lingo-gr.y"
+#line 556 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeConst(1);
g_lingo->code1(g_lingo->c_play); ;}
break;
case 141:
-#line 560 "engines/director/lingo/lingo-gr.y"
+#line 559 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeConst(3);
g_lingo->code1(g_lingo->c_play); ;}
break;
case 142:
-#line 563 "engines/director/lingo/lingo-gr.y"
+#line 562 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeConst(2);
g_lingo->code1(g_lingo->c_play); ;}
break;
case 143:
-#line 566 "engines/director/lingo/lingo-gr.y"
+#line 565 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeSetImmediate(true); ;}
break;
case 144:
-#line 566 "engines/director/lingo/lingo-gr.y"
+#line 565 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeSetImmediate(false);
g_lingo->codeFunc((yyvsp[(1) - (3)].s), (yyvsp[(3) - (3)].narg)); ;}
break;
case 145:
-#line 596 "engines/director/lingo/lingo-gr.y"
+#line 595 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; g_lingo->_currentFactory.clear(); ;}
break;
case 146:
-#line 597 "engines/director/lingo/lingo-gr.y"
+#line 596 "engines/director/lingo/lingo-gr.y"
{
- g_lingo->codeConst(0); // Push fake value on stack
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*(yyvsp[(2) - (8)].s), (yyvsp[(4) - (8)].code), (yyvsp[(5) - (8)].narg));
g_lingo->_indef = false; ;}
break;
case 147:
-#line 602 "engines/director/lingo/lingo-gr.y"
+#line 600 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeFactory(*(yyvsp[(2) - (2)].s));
;}
break;
case 148:
-#line 605 "engines/director/lingo/lingo-gr.y"
+#line 603 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 149:
-#line 606 "engines/director/lingo/lingo-gr.y"
+#line 604 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*(yyvsp[(2) - (8)].s), (yyvsp[(4) - (8)].code), (yyvsp[(5) - (8)].narg) + 1, &g_lingo->_currentFactory);
@@ -2997,19 +2990,18 @@ yyreduce:
break;
case 150:
-#line 610 "engines/director/lingo/lingo-gr.y"
+#line 608 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; g_lingo->_currentFactory.clear(); ;}
break;
case 151:
-#line 611 "engines/director/lingo/lingo-gr.y"
+#line 609 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_ignoreMe = true; ;}
break;
case 152:
-#line 611 "engines/director/lingo/lingo-gr.y"
+#line 609 "engines/director/lingo/lingo-gr.y"
{
- g_lingo->codeConst(0); // Push fake value on stack
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*(yyvsp[(2) - (10)].s), (yyvsp[(4) - (10)].code), (yyvsp[(6) - (10)].narg));
g_lingo->_indef = false;
@@ -3020,32 +3012,32 @@ yyreduce:
break;
case 153:
-#line 621 "engines/director/lingo/lingo-gr.y"
+#line 618 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 154:
-#line 622 "engines/director/lingo/lingo-gr.y"
+#line 619 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 155:
-#line 623 "engines/director/lingo/lingo-gr.y"
+#line 620 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 156:
-#line 624 "engines/director/lingo/lingo-gr.y"
+#line 621 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 157:
-#line 627 "engines/director/lingo/lingo-gr.y"
+#line 624 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
case 158:
-#line 631 "engines/director/lingo/lingo-gr.y"
+#line 628 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (2)].s)->c_str());
@@ -3055,33 +3047,33 @@ yyreduce:
break;
case 159:
-#line 639 "engines/director/lingo/lingo-gr.y"
+#line 636 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 160:
-#line 640 "engines/director/lingo/lingo-gr.y"
+#line 637 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
case 161:
-#line 641 "engines/director/lingo/lingo-gr.y"
+#line 638 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 162:
-#line 644 "engines/director/lingo/lingo-gr.y"
+#line 641 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
case 163:
-#line 645 "engines/director/lingo/lingo-gr.y"
+#line 642 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 3085 "engines/director/lingo/lingo-gr.cpp"
+#line 3077 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -3295,6 +3287,6 @@ yyreturn:
}
-#line 648 "engines/director/lingo/lingo-gr.y"
+#line 645 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 150cad6c49..35290c67eb 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -188,7 +188,7 @@ asgn: tPUT expr tINTO ID {
$$ = $5; }
;
-stmtoneliner: expr { g_lingo->code1(g_lingo->c_xpop); }
+stmtoneliner: expr
| proc
;
@@ -484,8 +484,7 @@ proc: tPUT expr { g_lingo->code1(g_lingo->c_printtop); }
| gotofunc
| playfunc
| tEXIT tREPEAT { g_lingo->code1(g_lingo->c_exitRepeat); }
- | tEXIT { g_lingo->codeConst(0); // Push fake value on stack
- g_lingo->code1(g_lingo->c_procret); }
+ | tEXIT { g_lingo->code1(g_lingo->c_procret); }
| tGLOBAL globallist
| tPROPERTY propertylist
| tINSTANCE instancelist
@@ -595,7 +594,6 @@ playfunc: tPLAY tDONE { g_lingo->code1(g_lingo->c_playdone); }
// on keyword
defn: tMACRO ID { g_lingo->_indef = true; g_lingo->_currentFactory.clear(); }
begin argdef nl argstore stmtlist {
- g_lingo->codeConst(0); // Push fake value on stack
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$2, $4, $5);
g_lingo->_indef = false; }
@@ -609,7 +607,6 @@ defn: tMACRO ID { g_lingo->_indef = true; g_lingo->_currentFactory.clear(); }
g_lingo->_indef = false; } ;
| tON ID { g_lingo->_indef = true; g_lingo->_currentFactory.clear(); } // D3
begin { g_lingo->_ignoreMe = true; } argdef nl argstore stmtlist ENDCLAUSE {
- g_lingo->codeConst(0); // Push fake value on stack
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$2, $4, $6);
g_lingo->_indef = false;