aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/director/lingo/lingo-funcs.cpp3
-rw-r--r--engines/director/lingo/lingo-gr.cpp151
-rw-r--r--engines/director/lingo/lingo-gr.y4
3 files changed, 73 insertions, 85 deletions
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 8664f74a6b..c9c14a5c9e 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -191,7 +191,8 @@ void Lingo::func_printtop(void) {
void Lingo::func_constpush() {
Datum d;
- d.val = ((Symbol *)*g_lingo->_pc++)->u.val;
+ inst i = *g_lingo->_pc++;
+ d.val = READ_LE_UINT32(&i);
g_lingo->push(d);
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 27c18515d1..fcf3bd9b96 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -369,16 +369,16 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 63
+#define YYLAST 59
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 23
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 6
+#define YYNNTS 5
/* YYNRULES -- Number of rules. */
-#define YYNRULES 22
+#define YYNRULES 20
/* YYNRULES -- Number of states. */
-#define YYNSTATES 43
+#define YYNSTATES 41
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -424,30 +424,29 @@ static const yytype_uint8 yytranslate[] =
YYRHS. */
static const yytype_uint8 yyprhs[] =
{
- 0, 0, 3, 4, 7, 11, 15, 19, 23, 28,
- 33, 38, 40, 42, 44, 48, 52, 56, 60, 63,
- 66, 70, 73
+ 0, 0, 3, 4, 7, 11, 15, 19, 24, 29,
+ 34, 36, 38, 42, 46, 50, 54, 57, 60, 64,
+ 67
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 24, 0, -1, -1, 24, 20, -1, 24, 28, 20,
- -1, 24, 25, 20, -1, 24, 26, 20, -1, 24,
- 27, 20, -1, 12, 27, 8, 6, -1, 13, 6,
- 14, 27, -1, 13, 6, 9, 27, -1, 27, -1,
- 4, -1, 6, -1, 27, 15, 27, -1, 27, 16,
- 27, -1, 27, 17, 27, -1, 27, 18, 27, -1,
- 15, 27, -1, 16, 27, -1, 21, 27, 22, -1,
- 10, 7, -1, 11, 6, -1
+ 24, 0, -1, -1, 24, 20, -1, 24, 27, 20,
+ -1, 24, 25, 20, -1, 24, 26, 20, -1, 12,
+ 26, 8, 6, -1, 13, 6, 14, 26, -1, 13,
+ 6, 9, 26, -1, 4, -1, 6, -1, 26, 15,
+ 26, -1, 26, 16, 26, -1, 26, 17, 26, -1,
+ 26, 18, 26, -1, 15, 26, -1, 16, 26, -1,
+ 21, 26, 22, -1, 10, 7, -1, 11, 6, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 66, 66, 67, 68, 69, 70, 71, 74, 75,
- 76, 79, 82, 83, 84, 85, 86, 87, 88, 89,
- 90, 93, 94
+ 0, 66, 66, 67, 68, 69, 71, 74, 75, 76,
+ 82, 83, 84, 85, 86, 87, 88, 89, 90, 93,
+ 94
};
#endif
@@ -459,7 +458,7 @@ static const char *const yytname[] =
"$end", "error", "$undefined", "UNARY", "INT", "FLOAT", "VAR", "STRING",
"OP_INTO", "OP_TO", "FUNC_MCI", "FUNC_MCIWAIT", "FUNC_PUT", "FUNC_SET",
"'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'",
- "$accept", "list", "assign", "statement", "expr", "func", 0
+ "$accept", "list", "assign", "expr", "func", 0
};
#endif
@@ -477,17 +476,17 @@ static const yytype_uint16 yytoknum[] =
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 23, 24, 24, 24, 24, 24, 24, 25, 25,
- 25, 26, 27, 27, 27, 27, 27, 27, 27, 27,
- 27, 28, 28
+ 0, 23, 24, 24, 24, 24, 24, 25, 25, 25,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 27,
+ 27
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
- 0, 2, 0, 2, 3, 3, 3, 3, 4, 4,
- 4, 1, 1, 1, 3, 3, 3, 3, 2, 2,
- 3, 2, 2
+ 0, 2, 0, 2, 3, 3, 3, 4, 4, 4,
+ 1, 1, 3, 3, 3, 3, 2, 2, 3, 2,
+ 2
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -495,35 +494,35 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 2, 0, 1, 12, 13, 0, 0, 0, 0, 0,
- 0, 3, 0, 0, 0, 0, 0, 21, 22, 0,
- 0, 18, 19, 0, 5, 6, 0, 0, 0, 0,
- 7, 4, 0, 0, 0, 20, 14, 15, 16, 17,
- 8, 10, 9
+ 2, 0, 1, 10, 11, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 0, 19, 20, 0, 0,
+ 16, 17, 0, 5, 0, 0, 0, 0, 6, 4,
+ 0, 0, 0, 18, 12, 13, 14, 15, 7, 9,
+ 8
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 1, 13, 14, 15, 16
+ -1, 1, 13, 14, 15
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -14
+#define YYPACT_NINF -9
static const yytype_int8 yypact[] =
{
- -14, 24, -14, -14, -14, -6, 3, 2, 10, 2,
- 2, -14, 2, -13, 5, 39, 9, -14, -14, -4,
- 1, -14, -14, 31, -14, -14, 2, 2, 2, 2,
- -14, -14, 27, 2, 2, -14, 14, 14, -14, -14,
- -14, 45, 45
+ -9, 22, -9, -9, -9, 6, -5, 0, 17, 0,
+ 0, -9, 0, 7, 35, 9, -9, -9, 31, 27,
+ -9, -9, -8, -9, 0, 0, 0, 0, -9, -9,
+ 24, 0, 0, -9, -6, -6, -9, -9, -9, 41,
+ 41
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -14, -14, -14, -14, -7, -14
+ -9, -9, -9, -7, -9
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -533,24 +532,22 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
- 19, 17, 21, 22, 32, 23, 3, 24, 4, 18,
- 33, 26, 27, 28, 29, 34, 20, 9, 10, 36,
- 37, 38, 39, 12, 2, 25, 41, 42, 3, 31,
- 4, 28, 29, 40, 5, 6, 7, 8, 0, 9,
- 10, 0, 0, 0, 11, 12, 26, 27, 28, 29,
- 0, 0, 0, 35, 26, 27, 28, 29, 0, 30,
- 26, 27, 28, 29
+ 18, 17, 20, 21, 3, 22, 4, 24, 25, 26,
+ 27, 26, 27, 16, 33, 9, 10, 34, 35, 36,
+ 37, 12, 2, 19, 39, 40, 3, 23, 4, 29,
+ 38, 0, 5, 6, 7, 8, 31, 9, 10, 30,
+ 0, 32, 11, 12, 0, 0, 24, 25, 26, 27,
+ 24, 25, 26, 27, 0, 28, 24, 25, 26, 27
};
static const yytype_int8 yycheck[] =
{
- 7, 7, 9, 10, 8, 12, 4, 20, 6, 6,
- 9, 15, 16, 17, 18, 14, 6, 15, 16, 26,
- 27, 28, 29, 21, 0, 20, 33, 34, 4, 20,
- 6, 17, 18, 6, 10, 11, 12, 13, -1, 15,
- 16, -1, -1, -1, 20, 21, 15, 16, 17, 18,
- -1, -1, -1, 22, 15, 16, 17, 18, -1, 20,
- 15, 16, 17, 18
+ 7, 6, 9, 10, 4, 12, 6, 15, 16, 17,
+ 18, 17, 18, 7, 22, 15, 16, 24, 25, 26,
+ 27, 21, 0, 6, 31, 32, 4, 20, 6, 20,
+ 6, -1, 10, 11, 12, 13, 9, 15, 16, 8,
+ -1, 14, 20, 21, -1, -1, 15, 16, 17, 18,
+ 15, 16, 17, 18, -1, 20, 15, 16, 17, 18
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -558,10 +555,10 @@ static const yytype_int8 yycheck[] =
static const yytype_uint8 yystos[] =
{
0, 24, 0, 4, 6, 10, 11, 12, 13, 15,
- 16, 20, 21, 25, 26, 27, 28, 7, 6, 27,
- 6, 27, 27, 27, 20, 20, 15, 16, 17, 18,
- 20, 20, 8, 9, 14, 22, 27, 27, 27, 27,
- 6, 27, 27
+ 16, 20, 21, 25, 26, 27, 7, 6, 26, 6,
+ 26, 26, 26, 20, 15, 16, 17, 18, 20, 20,
+ 8, 9, 14, 22, 26, 26, 26, 26, 6, 26,
+ 26
};
#define yyerrok (yyerrstatus = 0)
@@ -1381,93 +1378,83 @@ yyreduce:
break;
case 6:
-#line 70 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(STOP); return 1; ;}
- break;
-
- case 7:
#line 71 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->func_printtop, STOP); return 1; ;}
break;
- case 8:
+ case 7:
#line 74 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
break;
- case 9:
+ case 8:
#line 75 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
- case 10:
+ case 9:
#line 76 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
- case 11:
-#line 79 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_xpop); ;}
- break;
-
- case 12:
+ case 10:
#line 82 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->code2(g_lingo->func_constpush, (inst)(yyvsp[(1) - (1)].i)); ;}
+ { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
break;
- case 13:
+ case 11:
#line 83 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
- case 14:
+ case 12:
#line 84 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_add); ;}
break;
- case 15:
+ case 13:
#line 85 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_sub); ;}
break;
- case 16:
+ case 14:
#line 86 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mul); ;}
break;
- case 17:
+ case 15:
#line 87 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_div); ;}
break;
- case 18:
+ case 16:
#line 88 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 19:
+ case 17:
#line 89 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
break;
- case 20:
+ case 18:
#line 90 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 21:
+ case 19:
#line 93 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 22:
+ case 20:
#line 94 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1471 "engines/director/lingo/lingo-gr.cpp"
+#line 1458 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 86ae2f1e60..c8ccafd9f1 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -67,7 +67,7 @@ list: /* empty */
| list '\n'
| list func '\n'
| list assign '\n' { g_lingo->code2(g_lingo->func_xpop, STOP); return 1; }
- | list statement '\n' { g_lingo->code1(STOP); return 1; }
+// | list statement '\n' { g_lingo->code1(STOP); return 1; }
| list expr '\n' { g_lingo->code2(g_lingo->func_printtop, STOP); return 1; }
;
@@ -79,7 +79,7 @@ assign: FUNC_PUT expr OP_INTO VAR { g_lingo->code1(g_lingo->func_varpush); g_lin
statement: expr { g_lingo->code1(g_lingo->func_xpop); }
;
-expr: INT { $$ = g_lingo->code2(g_lingo->func_constpush, (inst)$1); }
+expr: INT { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, $1); $$ = g_lingo->code1(i); };
| VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($1->c_str()); $$ = g_lingo->code1(g_lingo->func_eval); delete $1; }
| expr '+' expr { g_lingo->code1(g_lingo->func_add); }
| expr '-' expr { g_lingo->code1(g_lingo->func_sub); }