diff options
author | Eugene Sandulenko | 2016-06-22 11:34:54 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | 82756b34fe118ed7fdc946df95b58fdcdd3d1a76 (patch) | |
tree | cd1ff50e960b70956a19ddddbe280e856acca8a3 | |
parent | 8362f79329a0b414f3d89917b1c9ac0489fd5809 (diff) | |
download | scummvm-rg350-82756b34fe118ed7fdc946df95b58fdcdd3d1a76.tar.gz scummvm-rg350-82756b34fe118ed7fdc946df95b58fdcdd3d1a76.tar.bz2 scummvm-rg350-82756b34fe118ed7fdc946df95b58fdcdd3d1a76.zip |
DIRECTOR: Lingo: Fix 'repeat with' control keyword implementation
-rw-r--r-- | engines/director/director.cpp | 4 | ||||
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 9 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.cpp | 211 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.y | 20 |
4 files changed, 124 insertions, 120 deletions
diff --git a/engines/director/director.cpp b/engines/director/director.cpp index 9a5fbabd3e..ef578c3591 100644 --- a/engines/director/director.cpp +++ b/engines/director/director.cpp @@ -97,6 +97,10 @@ repeat while (y < 5)\n\ set y = y + 1\n\ put y\n\ end repeat\n\ +\n\ +repeat with z = 10 to 15\n\ + put z\n\ +end repeat\n\ ", kMovieScript, 3); _lingo->executeScript(kMovieScript, 3); diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index d83a7d3f07..6e3f4373db 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -280,15 +280,16 @@ void Lingo::c_repeatwithcode(void) { int savepc = g_lingo->_pc; int init = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc]); - int finish = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 2]); - int body = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 3]); - int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 4]); - Common::String countername((char *)&(*g_lingo->_currentScript)[savepc + 5]); + int finish = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 1]); + int body = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 2]); + int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 3]); + Common::String countername((char *)&(*g_lingo->_currentScript)[savepc + 4]); Symbol *counter = g_lingo->lookupVar(countername.c_str()); g_lingo->execute(init); /* condition */ d = g_lingo->pop(); counter->u.val = d.val; + counter->type = VAR; while (true) { g_lingo->execute(body); /* body */ diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index d6f01b6539..04a3a0626c 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -413,7 +413,7 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 45 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 226 +#define YYLAST 218 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 47 @@ -422,7 +422,7 @@ union yyalloc /* YYNRULES -- Number of rules. */ #define YYNRULES 61 /* YYNRULES -- Number of states. */ -#define YYNSTATES 123 +#define YYNSTATES 125 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -473,11 +473,11 @@ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 7, 9, 10, 12, 14, 16, 18, 20, 21, 26, 31, 36, 38, 40, 48, 59, 68, - 78, 80, 84, 88, 91, 95, 97, 98, 99, 102, - 105, 107, 109, 111, 115, 119, 123, 127, 131, 135, - 139, 143, 147, 150, 153, 157, 160, 163, 166, 168, - 171, 174, 177, 180, 184, 187, 191, 194, 197, 199, - 203, 206 + 80, 82, 86, 90, 93, 97, 99, 100, 101, 104, + 107, 109, 111, 113, 117, 121, 125, 129, 133, 137, + 141, 145, 149, 152, 155, 159, 162, 165, 168, 170, + 173, 176, 179, 182, 186, 189, 193, 196, 199, 201, + 205, 208 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -490,20 +490,21 @@ static const yytype_int8 yyrhs[] = 55, 52, 26, 57, 56, 11, 14, -1, 55, 52, 26, 57, 56, 10, 57, 56, 11, 14, -1, 53, 43, 52, 44, 57, 56, 11, 24, -1, 54, 36, - 58, 27, 58, 57, 56, 11, 24, -1, 58, -1, - 58, 36, 58, -1, 43, 52, 44, -1, 24, 29, - -1, 24, 28, 7, -1, 14, -1, -1, -1, 57, - 42, -1, 57, 51, -1, 5, -1, 7, -1, 50, - -1, 58, 37, 58, -1, 58, 38, 58, -1, 58, - 39, 58, -1, 58, 40, 58, -1, 58, 45, 58, - -1, 58, 46, 58, -1, 58, 35, 58, -1, 58, - 30, 58, -1, 58, 31, 58, -1, 37, 58, -1, - 38, 58, -1, 43, 58, 44, -1, 17, 8, -1, - 18, 7, -1, 23, 58, -1, 60, -1, 13, 16, - -1, 13, 20, -1, 13, 22, -1, 13, 61, -1, - 13, 61, 62, -1, 13, 62, -1, 27, 12, 8, - -1, 12, 8, -1, 27, 8, -1, 8, -1, 21, - 19, 8, -1, 19, 8, -1, 27, 19, 8, -1 + 58, 56, 27, 58, 56, 57, 56, 11, 24, -1, + 58, -1, 58, 36, 58, -1, 43, 52, 44, -1, + 24, 29, -1, 24, 28, 7, -1, 14, -1, -1, + -1, 57, 42, -1, 57, 51, -1, 5, -1, 7, + -1, 50, -1, 58, 37, 58, -1, 58, 38, 58, + -1, 58, 39, 58, -1, 58, 40, 58, -1, 58, + 45, 58, -1, 58, 46, 58, -1, 58, 35, 58, + -1, 58, 30, 58, -1, 58, 31, 58, -1, 37, + 58, -1, 38, 58, -1, 43, 58, 44, -1, 17, + 8, -1, 18, 7, -1, 23, 58, -1, 60, -1, + 13, 16, -1, 13, 20, -1, 13, 22, -1, 13, + 61, -1, 13, 61, 62, -1, 13, 62, -1, 27, + 12, 8, -1, 12, 8, -1, 27, 8, -1, 8, + -1, 21, 19, 8, -1, 19, 8, -1, 27, 19, + 8, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -564,7 +565,7 @@ static const yytype_uint8 yyr1[] = static const yytype_uint8 yyr2[] = { 0, 2, 3, 1, 0, 1, 1, 1, 1, 1, - 0, 4, 4, 4, 1, 1, 7, 10, 8, 9, + 0, 4, 4, 4, 1, 1, 7, 10, 8, 11, 1, 3, 3, 2, 3, 1, 0, 0, 2, 2, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 3, 2, 2, 2, 1, 2, @@ -584,46 +585,46 @@ static const yytype_uint8 yydefact[] = 23, 0, 42, 43, 0, 1, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 60, 0, 57, 0, 0, 0, 53, 0, - 0, 24, 0, 0, 44, 2, 0, 0, 0, 0, + 0, 24, 0, 0, 44, 2, 0, 26, 0, 0, 27, 0, 40, 41, 39, 33, 34, 35, 36, 37, 38, 59, 55, 61, 11, 13, 12, 27, 0, 22, - 26, 21, 26, 27, 28, 29, 0, 14, 15, 0, - 26, 27, 0, 0, 0, 26, 16, 18, 0, 0, - 19, 0, 17 + 26, 21, 26, 0, 28, 29, 0, 14, 15, 0, + 26, 27, 0, 0, 27, 26, 16, 18, 26, 0, + 0, 0, 0, 17, 19 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 14, 15, 37, 105, 50, 18, 19, 20, 106, + -1, 14, 15, 37, 105, 50, 18, 19, 20, 98, 100, 107, 108, 23, 32, 33 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -97 +#define YYPACT_NINF -96 static const yytype_int16 yypact[] = { - 62, -97, -97, -97, 10, -97, 30, 16, 2, -26, - 34, 2, 2, 2, 44, 22, 1, -97, 27, 29, - 85, 168, -97, -97, -97, 63, -97, 69, -97, 59, - -97, 9, 47, -97, -97, -97, 2, -97, 103, 76, - -97, 6, 180, 180, 144, -97, 62, 85, 2, 85, - 65, 156, 2, 2, 2, 2, 2, 2, 2, 2, - 2, -97, -97, 80, -97, 81, 87, 74, -97, 103, - 94, -97, 2, 2, -97, -97, 53, 120, 67, 132, - -97, 2, 168, 168, 168, 90, 90, 180, 180, 168, - 168, -97, -97, -97, -97, 168, 168, -97, 2, -97, - 89, 168, 89, 168, -97, -97, 24, 168, -97, 98, - 89, -97, 101, 92, 106, 89, -97, -97, 95, 113, - -97, 123, -97 + 62, -96, -96, -96, 10, -96, 13, -4, 2, 36, + 17, 2, 2, 2, 28, -8, 1, -96, 23, 38, + 87, 154, -96, -96, -96, 30, -96, 69, -96, 49, + -96, -2, 14, -96, -96, -96, 2, -96, 98, 71, + -96, -13, 172, 172, 130, -96, 62, 87, 2, 87, + 56, 142, 2, 2, 2, 2, 2, 2, 2, 2, + 2, -96, -96, 75, -96, 76, 80, 74, -96, 98, + 83, -96, 2, 2, -96, -96, 51, 154, 52, 118, + -96, 2, 154, 154, 154, 166, 166, 172, 172, 154, + 154, -96, -96, -96, -96, 154, 154, -96, 79, -96, + 84, 154, 84, 2, -96, -96, 60, 154, -96, 100, + 154, -96, 101, 90, -96, 84, -96, -96, 84, 105, + 106, 104, 95, -96, -96 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -97, 93, -97, 4, 5, 35, -97, -97, -97, -96, - -87, 0, 15, -97, -97, 112 + -96, 77, -96, 4, 5, -5, -96, -96, -96, 32, + -95, 0, 15, -96, -96, 88 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -633,56 +634,54 @@ static const yytype_int8 yypgoto[] = #define YYTABLE_NINF -7 static const yytype_int8 yytable[] = { - 21, -6, 39, 40, 16, 17, 109, 2, 38, 3, - 102, 42, 43, 44, 114, 22, 110, 64, 24, 119, - 51, 65, 25, 35, 115, 36, 26, 10, 66, 27, - 28, 29, 30, 72, 111, 112, 69, 31, 34, 11, - 12, 41, 73, -6, 45, 13, 21, 51, 77, 79, + 21, -6, 102, 35, 16, 17, 64, 2, 38, 3, + 65, 42, 43, 44, 72, 22, 115, 66, 24, 118, + 51, 34, 25, 73, 41, 36, 26, 10, 45, 27, + 28, 29, 30, 27, 46, 29, 69, 31, 61, 11, + 12, 67, 76, -6, 78, 13, 21, 51, 77, 79, 16, 17, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 22, -4, 1, 46, 48, 27, 2, 29, 3, - 47, 61, 95, 96, 67, 4, 5, 62, 63, 6, - 7, 101, 76, 71, 78, 8, 9, 10, 91, 92, - 2, 80, 3, 66, 2, 93, 3, 97, 103, 11, - 12, 94, 4, 5, -4, 13, 6, 7, 36, 113, - 10, 99, 8, 9, 10, 116, 117, 118, 70, 120, - 52, 53, 11, 12, 121, 54, 11, 12, 49, 57, - 58, 104, 13, 52, 53, 59, 60, 122, 54, 75, - 55, 56, 57, 58, 68, 0, 0, 98, 59, 60, - 52, 53, 0, 0, 0, 54, 0, 55, 56, 57, - 58, 0, 52, 53, 0, 59, 60, 54, 81, 55, - 56, 57, 58, 0, 52, 53, 74, 59, 60, 54, - 0, 55, 56, 57, 58, 0, 52, 53, 74, 59, - 60, 54, 81, 55, 56, 57, 58, 0, 52, 53, - 0, 59, 60, 54, 0, 55, 56, 57, 58, 0, - 52, 53, 0, 59, 60, 54, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 59, 60 + 90, 22, -4, 1, 39, 40, 47, 2, 63, 3, + 111, 112, 95, 96, 48, 4, 5, 62, 71, 6, + 7, 101, 80, 91, 92, 8, 9, 10, 93, 2, + 94, 3, 2, 66, 3, 97, 99, 4, 5, 11, + 12, 6, 7, 110, -4, 13, 103, 8, 9, 10, + 36, 113, 10, 70, 117, 116, 121, 122, 123, 124, + 68, 11, 12, 75, 11, 12, 104, 13, 52, 53, + 49, 0, 106, 54, 109, 55, 56, 57, 58, 0, + 0, 0, 114, 59, 60, 0, 0, 119, 52, 53, + 120, 0, 0, 54, 81, 55, 56, 57, 58, 0, + 52, 53, 74, 59, 60, 54, 0, 55, 56, 57, + 58, 0, 52, 53, 74, 59, 60, 54, 81, 55, + 56, 57, 58, 0, 52, 53, 0, 59, 60, 54, + 0, 55, 56, 57, 58, 0, 52, 53, 0, 59, + 60, 54, 52, 53, 0, 57, 58, 54, 0, 0, + 0, 59, 60, 0, 0, 0, 0, 59, 60 }; static const yytype_int8 yycheck[] = { - 0, 0, 28, 29, 0, 0, 102, 5, 8, 7, - 97, 11, 12, 13, 110, 0, 103, 8, 8, 115, - 20, 12, 12, 7, 111, 23, 16, 25, 19, 19, - 20, 21, 22, 27, 10, 11, 36, 27, 8, 37, - 38, 7, 36, 42, 0, 43, 46, 47, 48, 49, + 0, 0, 97, 7, 0, 0, 8, 5, 8, 7, + 12, 11, 12, 13, 27, 0, 111, 19, 8, 114, + 20, 8, 12, 36, 7, 23, 16, 25, 0, 19, + 20, 21, 22, 19, 42, 21, 36, 27, 8, 37, + 38, 27, 47, 42, 49, 43, 46, 47, 48, 49, 46, 46, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 46, 0, 1, 42, 36, 19, 5, 21, 7, - 43, 8, 72, 73, 27, 13, 14, 8, 19, 17, - 18, 81, 47, 7, 49, 23, 24, 25, 8, 8, - 5, 26, 7, 19, 5, 8, 7, 44, 98, 37, - 38, 7, 13, 14, 42, 43, 17, 18, 23, 11, - 25, 44, 23, 24, 25, 14, 24, 11, 15, 24, - 30, 31, 37, 38, 11, 35, 37, 38, 43, 39, - 40, 42, 43, 30, 31, 45, 46, 14, 35, 46, - 37, 38, 39, 40, 32, -1, -1, 27, 45, 46, - 30, 31, -1, -1, -1, 35, -1, 37, 38, 39, - 40, -1, 30, 31, -1, 45, 46, 35, 36, 37, - 38, 39, 40, -1, 30, 31, 44, 45, 46, 35, - -1, 37, 38, 39, 40, -1, 30, 31, 44, 45, - 46, 35, 36, 37, 38, 39, 40, -1, 30, 31, - -1, 45, 46, 35, -1, 37, 38, 39, 40, -1, - 30, 31, -1, 45, 46, 35, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 45, 46 + 60, 46, 0, 1, 28, 29, 43, 5, 19, 7, + 10, 11, 72, 73, 36, 13, 14, 8, 7, 17, + 18, 81, 26, 8, 8, 23, 24, 25, 8, 5, + 7, 7, 5, 19, 7, 44, 44, 13, 14, 37, + 38, 17, 18, 103, 42, 43, 27, 23, 24, 25, + 23, 11, 25, 15, 24, 14, 11, 11, 14, 24, + 32, 37, 38, 46, 37, 38, 42, 43, 30, 31, + 43, -1, 100, 35, 102, 37, 38, 39, 40, -1, + -1, -1, 110, 45, 46, -1, -1, 115, 30, 31, + 118, -1, -1, 35, 36, 37, 38, 39, 40, -1, + 30, 31, 44, 45, 46, 35, -1, 37, 38, 39, + 40, -1, 30, 31, 44, 45, 46, 35, 36, 37, + 38, 39, 40, -1, 30, 31, -1, 45, 46, 35, + -1, 37, 38, 39, 40, -1, 30, 31, -1, 45, + 46, 35, 30, 31, -1, 39, 40, 35, -1, -1, + -1, 45, 46, -1, -1, -1, -1, 45, 46 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -698,10 +697,10 @@ static const yytype_uint8 yystos[] = 46, 8, 8, 19, 8, 12, 19, 27, 62, 58, 15, 7, 27, 36, 44, 48, 52, 58, 52, 58, 26, 36, 58, 58, 58, 58, 58, 58, 58, 58, - 58, 8, 8, 8, 7, 58, 58, 44, 27, 44, - 57, 58, 57, 58, 42, 51, 56, 58, 59, 56, - 57, 10, 11, 11, 56, 57, 14, 24, 11, 56, - 24, 11, 14 + 58, 8, 8, 8, 7, 58, 58, 44, 56, 44, + 57, 58, 57, 27, 42, 51, 56, 58, 59, 56, + 58, 10, 11, 11, 56, 57, 14, 24, 57, 56, + 56, 11, 11, 14, 24 }; #define yyerrok (yyerrstatus = 0) @@ -1553,7 +1552,7 @@ yyreduce: case 16: #line 110 "engines/director/lingo/lingo-gr.y" { - inst then, end; + inst then = 0, end = 0; WRITE_LE_UINT32(&then, (yyvsp[(4) - (7)].code)); WRITE_LE_UINT32(&end, (yyvsp[(5) - (7)].code)); (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */ @@ -1563,7 +1562,7 @@ yyreduce: case 17: #line 116 "engines/director/lingo/lingo-gr.y" { - inst then, else1, end; + inst then = 0, else1 = 0, end = 0; WRITE_LE_UINT32(&then, (yyvsp[(4) - (10)].code)); WRITE_LE_UINT32(&else1, (yyvsp[(7) - (10)].code)); WRITE_LE_UINT32(&end, (yyvsp[(8) - (10)].code)); @@ -1575,7 +1574,7 @@ yyreduce: case 18: #line 128 "engines/director/lingo/lingo-gr.y" { - inst body, end; + inst body = 0, end = 0; WRITE_LE_UINT32(&body, (yyvsp[(5) - (8)].code)); WRITE_LE_UINT32(&end, (yyvsp[(6) - (8)].code)); (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = body; /* body of loop */ @@ -1585,15 +1584,15 @@ yyreduce: case 19: #line 143 "engines/director/lingo/lingo-gr.y" { - inst init, finish, body, end; - WRITE_LE_UINT32(&init, (yyvsp[(3) - (9)].code)); - WRITE_LE_UINT32(&finish, (yyvsp[(5) - (9)].code)); - WRITE_LE_UINT32(&body, (yyvsp[(6) - (9)].code)); - WRITE_LE_UINT32(&end, (yyvsp[(7) - (9)].code)); - (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 1] = init; /* initial count value */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 2] = finish;/* final count value */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 3] = body; /* body of loop */ - (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 4] = end; ;} + inst init = 0, finish = 0, body = 0, end = 0; + WRITE_LE_UINT32(&init, (yyvsp[(3) - (11)].code)); + WRITE_LE_UINT32(&finish, (yyvsp[(6) - (11)].code)); + WRITE_LE_UINT32(&body, (yyvsp[(8) - (11)].code)); + WRITE_LE_UINT32(&end, (yyvsp[(9) - (11)].code)); + (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = init; /* initial count value */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = finish;/* final count value */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = body; /* body of loop */ + (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 4] = end; ;} break; case 20: @@ -1637,12 +1636,12 @@ yyreduce: case 30: #line 176 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;} + { (yyval.code) = g_lingo->code1(g_lingo->c_constpush); inst i = 0; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); g_lingo->code1(i); ;} break; case 31: #line 177 "engines/director/lingo/lingo-gr.y" - { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;} + { (yyval.code) = g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;} break; case 33: @@ -1787,7 +1786,7 @@ yyreduce: /* Line 1267 of yacc.c. */ -#line 1791 "engines/director/lingo/lingo-gr.cpp" +#line 1790 "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 eb584609d0..5601d2b1da 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -108,13 +108,13 @@ asgn: tPUT expr tINTO VAR { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeSt stmt: expr { g_lingo->code1(g_lingo->c_xpop); } | func | if cond tTHEN stmtlist end tEND tIF { - inst then, end; + inst then = 0, end = 0; WRITE_LE_UINT32(&then, $4); WRITE_LE_UINT32(&end, $5); (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */ (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */ | if cond tTHEN stmtlist end tELSE stmtlist end tEND tIF { - inst then, else1, end; + inst then = 0, else1 = 0, end = 0; WRITE_LE_UINT32(&then, $4); WRITE_LE_UINT32(&else1, $7); WRITE_LE_UINT32(&end, $8); @@ -126,7 +126,7 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); } // end repeat // | repeatwhile '(' cond ')' stmtlist end tEND tREPEAT { - inst body, end; + inst body = 0, end = 0; WRITE_LE_UINT32(&body, $5); WRITE_LE_UINT32(&end, $6); (*g_lingo->_currentScript)[$1 + 1] = body; /* body of loop */ @@ -140,12 +140,12 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); } // statements // end repeat // - | repeatwith '=' expr tTO expr stmtlist end tEND tREPEAT { - inst init, finish, body, end; + | repeatwith '=' expr end tTO expr end stmtlist end tEND tREPEAT { + inst init = 0, finish = 0, body = 0, end = 0; WRITE_LE_UINT32(&init, $3); - WRITE_LE_UINT32(&finish, $5); - WRITE_LE_UINT32(&body, $6); - WRITE_LE_UINT32(&end, $7); + WRITE_LE_UINT32(&finish, $6); + WRITE_LE_UINT32(&body, $8); + WRITE_LE_UINT32(&end, $9); (*g_lingo->_currentScript)[$1 + 1] = init; /* initial count value */ (*g_lingo->_currentScript)[$1 + 2] = finish;/* final count value */ (*g_lingo->_currentScript)[$1 + 3] = body; /* body of loop */ @@ -173,8 +173,8 @@ stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); } | stmtlist stmt ; -expr: INT { g_lingo->code1(g_lingo->c_constpush); inst i; WRITE_LE_UINT32(&i, $1); $$ = g_lingo->code1(i); }; - | VAR { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($1->c_str()); $$ = g_lingo->code1(g_lingo->c_eval); delete $1; } +expr: INT { $$ = g_lingo->code1(g_lingo->c_constpush); inst i = 0; WRITE_LE_UINT32(&i, $1); g_lingo->code1(i); }; + | VAR { $$ = g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($1->c_str()); g_lingo->code1(g_lingo->c_eval); delete $1; } | asgn | expr '+' expr { g_lingo->code1(g_lingo->c_add); } | expr '-' expr { g_lingo->code1(g_lingo->c_sub); } |