diff options
-rw-r--r-- | engines/director/lingo/lingo-builtins.cpp | 10 | ||||
-rw-r--r-- | engines/director/lingo/lingo-code.cpp | 6 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.cpp | 804 | ||||
-rw-r--r-- | engines/director/lingo/lingo-gr.y | 9 | ||||
-rw-r--r-- | engines/director/lingo/lingo-lex.cpp | 24 | ||||
-rw-r--r-- | engines/director/lingo/lingo-lex.l | 6 | ||||
-rw-r--r-- | engines/director/lingo/lingo.h | 5 | ||||
-rw-r--r-- | engines/director/lingo/tests/math.lingo | 3 |
8 files changed, 431 insertions, 436 deletions
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp index 0c103370cf..e44fc69c51 100644 --- a/engines/director/lingo/lingo-builtins.cpp +++ b/engines/director/lingo/lingo-builtins.cpp @@ -58,7 +58,15 @@ static struct BuiltinProto { void Lingo::initBuiltIns() { for (BuiltinProto *blt = builtins; blt->name; blt++) { - _builtins[blt->name] = new Builtin(blt->func, blt->nparams); + Symbol *sym = new Symbol; + + sym->name = (char *)calloc(strlen(blt->name) + 1, 1); + Common::strlcpy(sym->name, blt->name, strlen(blt->name)); + sym->type = BLTIN; + sym->nargs = blt->nparams; + sym->u.func = blt->func; + + _handlers[blt->name] = sym; } } diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index 0bc6c9d0b6..7b367d9720 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -702,6 +702,12 @@ void Lingo::c_call() { Symbol *sym = g_lingo->_handlers[name]; + if (sym->type == BLTIN) { + (*sym->u.func)(); + + return; + } + for (int i = nargs; i < sym->nargs; i++) { Datum d; diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp index ed4f5a4358..a26ecfdd3a 100644 --- a/engines/director/lingo/lingo-gr.cpp +++ b/engines/director/lingo/lingo-gr.cpp @@ -474,18 +474,18 @@ union yyalloc #endif /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 79 +#define YYFINAL 77 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 731 +#define YYLAST 712 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 77 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 34 /* YYNRULES -- Number of rules. */ -#define YYNRULES 119 +#define YYNRULES 118 /* YYNRULES -- Number of states. */ -#define YYNSTATES 258 +#define YYNSTATES 254 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -541,13 +541,13 @@ static const yytype_uint16 yyprhs[] = 64, 66, 68, 70, 79, 91, 104, 109, 118, 130, 142, 149, 160, 171, 172, 176, 179, 181, 184, 186, 193, 195, 201, 203, 207, 211, 214, 218, 220, 222, - 223, 224, 225, 228, 231, 233, 235, 237, 242, 244, - 249, 251, 253, 256, 258, 262, 266, 270, 274, 278, - 282, 286, 290, 294, 298, 302, 305, 309, 313, 317, - 321, 324, 327, 331, 336, 341, 344, 347, 350, 352, - 354, 357, 359, 363, 366, 369, 372, 375, 379, 382, - 386, 389, 392, 394, 398, 401, 405, 406, 415, 418, - 419, 428, 429, 431, 435, 440, 441, 445, 446, 448 + 223, 224, 225, 228, 231, 233, 235, 237, 239, 244, + 246, 248, 251, 253, 257, 261, 265, 269, 273, 277, + 281, 285, 289, 293, 297, 300, 304, 308, 312, 316, + 319, 322, 326, 331, 336, 339, 342, 345, 347, 349, + 352, 354, 358, 361, 364, 367, 370, 374, 377, 381, + 384, 387, 389, 393, 396, 400, 401, 410, 413, 414, + 423, 424, 426, 430, 435, 436, 440, 441, 443 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -576,29 +576,28 @@ static const yytype_int8 yyrhs[] = -1, 98, -1, 98, 64, 98, -1, 71, 90, 72, -1, 39, 45, -1, 39, 44, 17, -1, 28, -1, 22, -1, -1, -1, -1, 97, 79, -1, 97, 83, - -1, 11, -1, 14, -1, 18, -1, 15, 71, 110, - 72, -1, 16, -1, 17, 71, 110, 72, -1, 17, - -1, 12, -1, 13, 98, -1, 81, -1, 98, 65, - 98, -1, 98, 66, 98, -1, 98, 67, 98, -1, - 98, 68, 98, -1, 98, 73, 98, -1, 98, 74, - 98, -1, 98, 54, 98, -1, 98, 49, 98, -1, - 98, 50, 98, -1, 98, 55, 98, -1, 98, 56, - 98, -1, 57, 98, -1, 98, 75, 98, -1, 98, - 58, 98, -1, 98, 59, 98, -1, 98, 60, 98, - -1, 65, 98, -1, 66, 98, -1, 71, 98, 72, - -1, 61, 98, 62, 98, -1, 61, 98, 63, 98, - -1, 32, 18, -1, 33, 17, -1, 38, 98, -1, - 101, -1, 24, -1, 26, 100, -1, 17, -1, 100, - 76, 17, -1, 27, 30, -1, 27, 35, -1, 27, - 37, -1, 27, 102, -1, 27, 102, 103, -1, 27, - 103, -1, 42, 25, 18, -1, 25, 18, -1, 42, - 18, -1, 18, -1, 36, 34, 18, -1, 34, 18, - -1, 42, 34, 18, -1, -1, 31, 17, 105, 95, - 107, 79, 108, 97, -1, 47, 17, -1, -1, 48, - 17, 106, 95, 107, 79, 108, 97, -1, -1, 17, - -1, 107, 76, 17, -1, 107, 79, 76, 17, -1, - -1, 17, 95, 110, -1, -1, 98, -1, 110, 76, - 98, -1 + -1, 11, -1, 14, -1, 18, -1, 16, -1, 17, + 71, 110, 72, -1, 17, -1, 12, -1, 13, 98, + -1, 81, -1, 98, 65, 98, -1, 98, 66, 98, + -1, 98, 67, 98, -1, 98, 68, 98, -1, 98, + 73, 98, -1, 98, 74, 98, -1, 98, 54, 98, + -1, 98, 49, 98, -1, 98, 50, 98, -1, 98, + 55, 98, -1, 98, 56, 98, -1, 57, 98, -1, + 98, 75, 98, -1, 98, 58, 98, -1, 98, 59, + 98, -1, 98, 60, 98, -1, 65, 98, -1, 66, + 98, -1, 71, 98, 72, -1, 61, 98, 62, 98, + -1, 61, 98, 63, 98, -1, 32, 18, -1, 33, + 17, -1, 38, 98, -1, 101, -1, 24, -1, 26, + 100, -1, 17, -1, 100, 76, 17, -1, 27, 30, + -1, 27, 35, -1, 27, 37, -1, 27, 102, -1, + 27, 102, 103, -1, 27, 103, -1, 42, 25, 18, + -1, 25, 18, -1, 42, 18, -1, 18, -1, 36, + 34, 18, -1, 34, 18, -1, 42, 34, 18, -1, + -1, 31, 17, 105, 95, 107, 79, 108, 97, -1, + 47, 17, -1, -1, 48, 17, 106, 95, 107, 79, + 108, 97, -1, -1, 17, -1, 107, 76, 17, -1, + 107, 79, 76, 17, -1, -1, 17, 95, 110, -1, + -1, 98, -1, 110, 76, 98, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -609,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, 360, 363, - 371, 374, 381, 387, 388, 389, 390, 391, 392, 393, - 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, - 404, 405, 406, 407, 408, 411, 412, 413, 414, 415, - 417, 420, 421, 432, 433, 434, 435, 440, 446, 453, - 454, 455, 456, 459, 460, 461, 489, 489, 495, 498, - 498, 504, 505, 506, 507, 509, 513, 521, 522, 523 + 336, 338, 339, 340, 343, 348, 351, 354, 358, 366, + 369, 376, 382, 383, 384, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + 400, 401, 402, 403, 406, 407, 408, 409, 410, 412, + 415, 416, 427, 428, 429, 430, 435, 441, 448, 449, + 450, 451, 454, 455, 456, 484, 484, 490, 493, 493, + 499, 500, 501, 502, 504, 508, 516, 517, 518 }; #endif @@ -671,10 +670,10 @@ static const yytype_uint8 yyr1[] = 96, 97, 97, 97, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, - 98, 98, 98, 98, 98, 99, 99, 99, 99, 99, - 99, 100, 100, 101, 101, 101, 101, 101, 101, 102, - 102, 102, 102, 103, 103, 103, 105, 104, 104, 106, - 104, 107, 107, 107, 107, 108, 109, 110, 110, 110 + 98, 98, 98, 98, 99, 99, 99, 99, 99, 99, + 100, 100, 101, 101, 101, 101, 101, 101, 102, 102, + 102, 102, 103, 103, 103, 105, 104, 104, 106, 104, + 107, 107, 107, 107, 108, 109, 110, 110, 110 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -685,13 +684,13 @@ static const yytype_uint8 yyr2[] = 1, 1, 1, 8, 11, 12, 4, 8, 11, 11, 6, 10, 10, 0, 3, 2, 1, 2, 1, 6, 1, 5, 1, 3, 3, 2, 3, 1, 1, 0, - 0, 0, 2, 2, 1, 1, 1, 4, 1, 4, - 1, 1, 2, 1, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, - 2, 2, 3, 4, 4, 2, 2, 2, 1, 1, - 2, 1, 3, 2, 2, 2, 2, 3, 2, 3, - 2, 2, 1, 3, 2, 3, 0, 8, 2, 0, - 8, 0, 1, 3, 4, 0, 3, 0, 1, 3 + 0, 0, 2, 2, 1, 1, 1, 1, 4, 1, + 1, 2, 1, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 2, 3, 3, 3, 3, 2, + 2, 3, 4, 4, 2, 2, 2, 1, 1, 2, + 1, 3, 2, 2, 2, 2, 3, 2, 3, 2, + 2, 1, 3, 2, 3, 0, 8, 2, 0, 8, + 0, 1, 3, 4, 0, 3, 0, 1, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -699,276 +698,272 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 0, 0, 54, 61, 0, 55, 0, 58, 49, 56, - 89, 0, 0, 47, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, - 63, 21, 11, 22, 0, 0, 0, 19, 8, 88, - 7, 9, 4, 60, 0, 63, 62, 117, 117, 117, - 91, 90, 102, 0, 93, 0, 94, 0, 95, 0, - 96, 98, 106, 85, 86, 87, 0, 45, 0, 0, - 0, 0, 108, 109, 75, 0, 80, 81, 0, 1, - 5, 6, 0, 0, 0, 0, 42, 0, 0, 0, + 0, 0, 54, 60, 0, 55, 57, 49, 56, 88, + 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 3, 62, + 21, 11, 22, 0, 0, 0, 19, 8, 87, 7, + 9, 4, 59, 0, 62, 61, 116, 116, 90, 89, + 101, 0, 92, 0, 93, 0, 94, 0, 95, 97, + 105, 84, 85, 86, 0, 45, 0, 0, 0, 0, + 107, 108, 74, 0, 79, 80, 0, 1, 5, 6, + 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 0, 0, 116, 0, 100, 104, - 0, 101, 0, 0, 0, 97, 49, 0, 46, 0, - 0, 0, 0, 0, 0, 49, 0, 0, 82, 2, - 0, 50, 0, 0, 49, 0, 71, 72, 70, 73, - 74, 77, 78, 79, 64, 65, 66, 67, 68, 69, - 76, 57, 0, 59, 92, 103, 99, 105, 111, 12, - 17, 14, 0, 0, 16, 13, 26, 111, 83, 84, - 51, 0, 44, 51, 0, 43, 119, 112, 0, 18, - 15, 0, 50, 0, 0, 50, 50, 20, 0, 115, - 115, 52, 53, 0, 0, 50, 49, 30, 113, 0, - 51, 51, 0, 50, 51, 0, 51, 0, 48, 49, - 50, 38, 0, 114, 107, 110, 23, 51, 50, 27, - 50, 50, 40, 36, 0, 0, 37, 33, 0, 50, - 0, 0, 35, 0, 0, 50, 49, 50, 49, 0, - 0, 0, 0, 49, 31, 0, 32, 0, 0, 24, - 28, 29, 50, 34, 50, 25, 41, 39 + 0, 117, 0, 115, 0, 99, 103, 0, 100, 0, + 0, 0, 96, 49, 0, 46, 0, 0, 0, 0, + 0, 0, 49, 0, 0, 81, 2, 0, 50, 0, + 0, 49, 0, 70, 71, 69, 72, 73, 76, 77, + 78, 63, 64, 65, 66, 67, 68, 75, 58, 0, + 91, 102, 98, 104, 110, 12, 17, 14, 0, 0, + 16, 13, 26, 110, 82, 83, 51, 0, 44, 51, + 0, 43, 118, 111, 0, 18, 15, 0, 50, 0, + 0, 50, 50, 20, 0, 114, 114, 52, 53, 0, + 0, 50, 49, 30, 112, 0, 51, 51, 0, 50, + 51, 0, 51, 0, 48, 49, 50, 38, 0, 113, + 106, 109, 23, 51, 50, 27, 50, 50, 40, 36, + 0, 0, 37, 33, 0, 50, 0, 0, 35, 0, + 0, 50, 49, 50, 49, 0, 0, 0, 0, 49, + 31, 0, 32, 0, 0, 24, 28, 29, 50, 34, + 50, 25, 41, 39 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 28, 191, 29, 45, 31, 192, 33, 237, 221, - 222, 211, 223, 85, 34, 35, 36, 212, 247, 171, - 182, 37, 187, 51, 39, 60, 61, 40, 116, 125, - 178, 200, 41, 104 + -1, 27, 187, 28, 44, 30, 188, 32, 233, 217, + 218, 207, 219, 83, 33, 34, 35, 208, 243, 167, + 178, 36, 183, 49, 38, 58, 59, 39, 113, 122, + 174, 196, 40, 102 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -192 +#define YYPACT_NINF -189 static const yytype_int16 yypact[] = { - 222, -25, -192, -192, 446, -192, -14, -192, 656, -192, - -192, 50, 142, -192, 51, 52, 55, 446, -30, 48, - 56, 59, 60, 446, 446, 446, 446, 446, 9, -192, - 10, -192, -192, -192, -2, 18, 478, 634, -192, -192, - -192, -192, -192, 3, 446, -192, 634, 446, 446, 446, - -192, 34, -192, 65, -192, 69, -192, 71, -192, 29, - 22, -192, -192, -192, -192, 492, 97, -192, -22, 446, - -21, 78, -192, -192, 57, 536, 57, 57, 585, -192, - -192, 283, 478, 446, 478, 79, 612, 446, 446, 446, - 446, 446, 446, 446, 446, 446, 446, 446, 446, 446, - 446, 446, 492, 634, -28, -10, 47, 117, -192, -192, - 118, -192, 122, 123, 108, -192, -192, 126, -192, 446, - 446, 514, 446, 446, 446, -192, 446, 446, -192, -192, - 72, 634, 74, 558, 77, 446, 634, 634, 634, 634, - 634, 634, 634, 634, 278, 278, 57, 57, 634, 634, - 634, -192, 446, -192, -192, -192, -192, -192, 132, -192, - 634, 634, 446, 446, 634, 634, 634, 132, 634, 634, - -192, 11, -192, -192, 416, 634, 634, -192, -52, 634, - 634, -52, 344, 109, 446, 344, -192, -192, 133, 81, - 81, -192, -192, 130, 446, 634, -6, -9, -192, 141, - -192, -192, 120, 634, -192, 134, -192, 139, -192, -192, - 139, -192, 478, -192, 344, 344, -192, -192, 344, -192, - 344, 139, 139, -192, 478, 416, -192, 124, 125, 344, - 145, 146, -192, 152, 140, -192, -192, -192, -192, 157, - 144, 159, 163, -11, -192, 416, -192, 380, 153, -192, - -192, -192, 344, -192, -192, -192, -192, -192 + 201, -49, -189, -189, 420, -189, -189, 610, -189, -189, + 6, 17, -189, 15, 18, 48, 420, 29, 59, 50, + 52, 58, 420, 420, 420, 420, 420, 10, -189, 16, + -189, -189, -189, 7, 39, 432, 588, -189, -189, -189, + -189, -189, 35, 420, -189, 588, 420, 420, -189, 36, + -189, 99, -189, 100, -189, 87, -189, 30, 24, -189, + -189, -189, -189, 446, 115, -189, -27, 420, -20, 92, + -189, -189, 55, 490, 55, 55, 539, -189, -189, 262, + 432, 420, 432, 93, 566, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 446, 588, -52, 60, 121, -189, -189, 124, -189, 126, + 127, 105, -189, -189, 129, -189, 420, 420, 468, 420, + 420, 420, -189, 420, 420, -189, -189, 75, 588, 76, + 512, 79, 420, 588, 588, 588, 588, 588, 588, 588, + 588, 637, 637, 55, 55, 588, 588, 588, -189, 420, + -189, -189, -189, -189, 136, -189, 588, 588, 420, 420, + 588, 588, 588, 136, 588, 588, -189, 21, -189, -189, + 390, 588, 588, -189, -8, 588, 588, -8, 318, 113, + 420, 318, -189, -189, 139, 81, 81, -189, -189, 137, + 420, 588, -12, -13, -189, 142, -189, -189, 125, 588, + -189, 135, -189, 144, -189, -189, 144, -189, 432, -189, + 318, 318, -189, -189, 318, -189, 318, 144, 144, -189, + 432, 390, -189, 122, 128, 318, 147, 148, -189, 149, + 133, -189, -189, -189, -189, 154, 140, 150, 152, -9, + -189, 390, -189, 354, 143, -189, -189, -189, 318, -189, + -189, -189, -189, -189 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -192, -192, -26, 104, 7, -170, 0, -192, -192, -192, - -4, -188, -27, -79, -192, -192, -192, -191, -7, -47, - -165, 2, 23, -192, -192, -192, 135, -192, -192, -192, - 30, 8, -192, -16 + -189, -189, -23, 88, 2, -164, 0, -189, -189, -189, + -5, -188, -36, -77, -189, -189, -189, -186, -6, -41, + -157, 3, 8, -189, -189, -189, 131, -189, -189, -189, + 22, 1, -189, 151 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -61 +#define YYTABLE_NINF -60 static const yytype_int16 yytable[] = { - 32, 49, 81, 130, 186, 132, 46, 30, 185, 79, - -10, -51, -51, 208, 66, 67, 224, 205, 80, 65, - 119, 122, 226, 38, 188, 74, 75, 76, 77, 78, - 224, 183, 105, 106, 226, 214, 215, 209, 86, 218, - 206, 220, 120, 123, 151, 42, 102, 111, 152, 103, - 103, 103, 229, 184, 112, 235, 55, 47, 57, -51, - 68, 69, 153, 113, 114, 70, 152, 50, 62, 82, - 63, 121, 64, 71, 48, 253, 72, 73, 252, 80, - -10, 32, 83, 108, 86, 131, 133, 109, 30, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 38, 110, 87, 88, 173, 158, - 107, 89, 90, 91, 118, 92, 93, 94, 167, 124, - 134, 160, 161, 152, 164, 165, 166, 174, 168, 169, - 99, 100, 101, 228, 154, 193, 155, 175, 196, 197, - 156, 157, 113, 159, 170, 234, 172, 80, 204, 177, - 198, 194, 189, 202, 176, 190, 217, 199, 213, 216, - 52, 208, 219, 227, 179, 180, 238, 53, 240, 241, - 236, 230, 54, 231, 233, 242, 55, 56, 57, 58, - 248, 243, 239, 249, 59, 129, 195, 250, 244, 207, - 246, 251, 255, 210, 232, 115, 203, 181, 201, 0, - 0, 0, 225, 0, 0, 256, 0, 257, 0, 0, - 0, 0, 0, 0, 86, 0, 0, 0, 0, 0, - 0, 0, -6, 1, 0, 0, 86, 0, 0, 245, - 0, 0, 0, 2, 3, 4, 5, 6, 7, 8, - 9, 0, 0, 0, 0, 0, 10, 254, 11, 12, - 13, 0, 0, 14, 15, 16, 0, 0, 0, 0, - 17, 18, 19, 0, 0, 20, 0, 0, 0, 21, - 22, 0, 0, 0, 0, 0, 0, 0, 0, 23, - 0, 0, 0, 24, 0, 0, 0, 25, 26, 0, - 0, 0, -6, 27, 2, 3, 4, 5, 6, 7, - 8, 9, 0, 0, 0, 0, 0, 10, 0, 11, - 12, 13, 0, 0, 14, 15, 16, 0, 0, 0, - 0, 17, 18, 19, 0, 0, 20, 87, 88, 0, - 21, 22, 89, 90, 91, 0, 92, 93, 94, 0, - 23, 0, 0, 0, 24, 97, 98, 0, 25, 26, - 0, 99, 100, 101, 27, 2, 3, 4, 5, 6, - 7, 43, 9, 0, 0, 0, 0, 0, 10, 0, - 11, 12, 13, 0, 0, 0, 15, 16, 0, 0, - 0, 0, 17, 18, 19, 0, 0, 20, 0, 0, - 0, 2, 3, 4, 5, 6, 7, 43, 9, 0, - 0, 23, 0, 0, 10, 24, 11, 12, 13, 25, - 26, 0, 15, 16, 80, 27, 0, 0, 17, 18, - 19, 0, 0, 20, 0, 0, 0, 2, 3, 4, - 5, 6, 7, 43, 9, 0, 0, 23, 0, 0, - 10, 24, 11, 12, 0, 25, 26, 0, 15, 16, - 0, 27, 0, 0, 17, 0, 19, 2, 3, 4, - 5, 6, 7, 43, 9, 0, 0, 0, 0, 0, - 0, 0, 0, 23, 0, 0, 0, 24, 0, 0, - 0, 25, 26, 0, 44, 0, 19, 27, 0, 2, - 3, 4, 5, 6, 7, 43, 9, 0, 0, 0, - 0, 0, 0, 23, 0, 0, 0, 24, 0, 0, - 0, 25, 26, 0, 0, 0, 44, 27, 19, 0, - 0, 117, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 23, 0, 0, 0, 24, - 0, 87, 88, 25, 26, 0, 89, 90, 91, 84, - 92, 93, 94, 0, 0, 0, 162, 95, 96, 97, - 98, 0, 0, 87, 88, 99, 100, 101, 89, 90, - 91, 0, 92, 93, 94, 0, 0, 0, 163, 95, - 96, 97, 98, 0, 0, 87, 88, 99, 100, 101, - 89, 90, 91, 0, 92, 93, 94, 0, 126, 127, - 0, 95, 96, 97, 98, 0, 0, 87, 88, 99, - 100, 101, 89, 90, 91, 0, 92, 93, 94, 0, - 0, 0, 135, 95, 96, 97, 98, 0, 0, 0, - 128, 99, 100, 101, 87, 88, 0, 0, 0, 89, - 90, 91, 0, 92, 93, 94, 0, 0, 0, 0, - 95, 96, 97, 98, 0, 0, 0, 128, 99, 100, - 101, 87, 88, 0, 0, 0, 89, 90, 91, 0, - 92, 93, 94, 0, 0, 0, 135, 95, 96, 97, - 98, 0, 0, 87, 88, 99, 100, 101, 89, 90, - 91, 0, 92, 93, 94, 0, 0, 0, 0, 95, - 96, 97, 98, 0, 0, -60, -60, 99, 100, 101, - -60, -60, -60, 0, -60, -60, -60, 0, 0, 0, - 0, 0, 0, -60, -60, 0, 0, 48, 0, -60, - -60, -60 + 31, 47, 29, 127, 79, 129, 182, 45, 37, 204, + 77, 201, 181, -51, -51, 116, -10, 220, 222, 63, + 148, 41, 119, 48, 149, 72, 73, 74, 75, 76, + 222, 220, 60, 205, 202, 50, 61, 117, 84, 210, + 211, 179, 51, 214, 120, 216, 100, 52, 108, 101, + 101, 53, 54, 55, 56, 109, 225, 231, 53, 57, + 55, -51, 78, 180, 110, 62, 111, 69, 184, 70, + 118, 66, 67, 64, 65, 71, 68, 249, 80, 31, + 78, 29, 248, 84, 128, 130, -10, 37, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 81, 85, 86, 46, 154, 169, 87, + 88, 89, 104, 90, 91, 92, 163, 105, 106, 156, + 157, 107, 160, 161, 162, 170, 164, 165, 97, 98, + 99, 224, 115, 121, 131, 171, 149, 189, 150, 110, + 192, 193, 151, 230, 152, 153, 155, 166, 168, 78, + 200, 185, 172, 173, 186, 190, 194, 195, 213, 209, + 198, 175, 176, 215, 212, 223, 204, 126, 232, 234, + 236, 237, 238, 226, 239, 227, 229, 244, 246, 245, + 247, 228, 251, 191, 235, 177, 203, 197, 206, 112, + 240, 0, 242, 199, 0, 0, 0, 0, 103, 221, + 0, -6, 1, 0, 0, 0, 0, 252, 0, 253, + 0, 84, 2, 3, 4, 5, 0, 6, 7, 8, + 0, 0, 0, 84, 0, 9, 241, 10, 11, 12, + 0, 0, 13, 14, 15, 0, 0, 0, 0, 16, + 17, 18, 0, 250, 19, 0, 0, 0, 20, 21, + 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, + 0, 0, 23, 0, 0, 0, 24, 25, 0, 0, + 0, -6, 26, 2, 3, 4, 5, 0, 6, 7, + 8, 0, 0, 0, 0, 0, 9, 0, 10, 11, + 12, 0, 0, 13, 14, 15, 0, 0, 0, 0, + 16, 17, 18, 0, 0, 19, 0, 0, 0, 20, + 21, 0, 0, 0, 0, 0, 0, 0, 0, 22, + 0, 0, 0, 23, 0, 0, 0, 24, 25, 2, + 3, 4, 5, 26, 6, 42, 8, 0, 0, 0, + 0, 0, 9, 0, 10, 11, 12, 0, 0, 0, + 14, 15, 0, 0, 0, 0, 16, 17, 18, 0, + 0, 19, 0, 0, 0, 2, 3, 4, 5, 0, + 6, 42, 8, 0, 0, 22, 0, 0, 9, 23, + 10, 11, 12, 24, 25, 0, 14, 15, 78, 26, + 0, 0, 16, 17, 18, 0, 0, 19, 0, 0, + 0, 2, 3, 4, 5, 0, 6, 42, 8, 0, + 0, 22, 0, 0, 9, 23, 10, 11, 0, 24, + 25, 0, 14, 15, 0, 26, 0, 0, 16, 0, + 18, 2, 3, 4, 5, 0, 6, 42, 8, 0, + 0, 0, 0, 2, 3, 4, 5, 22, 6, 42, + 8, 23, 0, 0, 0, 24, 25, 0, 43, 0, + 18, 26, 0, 0, 0, 0, 0, 0, 0, 0, + 43, 0, 18, 0, 0, 114, 0, 22, 0, 0, + 0, 23, 0, 0, 0, 24, 25, 0, 0, 22, + 0, 26, 0, 23, 0, 85, 86, 24, 25, 0, + 87, 88, 89, 82, 90, 91, 92, 0, 0, 0, + 158, 93, 94, 95, 96, 0, 0, 85, 86, 97, + 98, 99, 87, 88, 89, 0, 90, 91, 92, 0, + 0, 0, 159, 93, 94, 95, 96, 0, 0, 85, + 86, 97, 98, 99, 87, 88, 89, 0, 90, 91, + 92, 0, 123, 124, 0, 93, 94, 95, 96, 0, + 0, 85, 86, 97, 98, 99, 87, 88, 89, 0, + 90, 91, 92, 0, 0, 0, 132, 93, 94, 95, + 96, 0, 0, 0, 125, 97, 98, 99, 85, 86, + 0, 0, 0, 87, 88, 89, 0, 90, 91, 92, + 0, 0, 0, 0, 93, 94, 95, 96, 0, 0, + 0, 125, 97, 98, 99, 85, 86, 0, 0, 0, + 87, 88, 89, 0, 90, 91, 92, 0, 0, 0, + 132, 93, 94, 95, 96, 0, 0, 85, 86, 97, + 98, 99, 87, 88, 89, 0, 90, 91, 92, 0, + 0, 0, 0, 93, 94, 95, 96, 0, 0, -59, + -59, 97, 98, 99, -59, -59, -59, 0, -59, -59, + -59, 0, 0, 0, 0, 0, 0, -59, -59, 0, + 0, 46, 0, -59, -59, -59, 85, 86, 0, 0, + 0, 87, 88, 89, 0, 90, 91, 92, 0, 0, + 0, 0, 0, 0, 95, 96, 0, 0, 0, 0, + 97, 98, 99 }; static const yytype_int16 yycheck[] = { - 0, 8, 28, 82, 174, 84, 4, 0, 173, 0, - 0, 22, 23, 22, 44, 45, 207, 23, 70, 17, - 42, 42, 210, 0, 76, 23, 24, 25, 26, 27, - 221, 20, 48, 49, 222, 200, 201, 46, 36, 204, - 46, 206, 64, 64, 72, 70, 44, 18, 76, 47, - 48, 49, 217, 42, 25, 225, 34, 71, 36, 70, - 12, 13, 72, 34, 42, 17, 76, 17, 17, 71, - 18, 69, 17, 17, 71, 245, 17, 17, 243, 70, - 70, 81, 64, 18, 82, 83, 84, 18, 81, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, - 98, 99, 100, 101, 81, 34, 49, 50, 134, 116, - 76, 54, 55, 56, 17, 58, 59, 60, 125, 41, - 41, 119, 120, 76, 122, 123, 124, 134, 126, 127, - 73, 74, 75, 212, 17, 182, 18, 135, 185, 186, - 18, 18, 34, 17, 72, 224, 72, 70, 195, 17, - 17, 42, 178, 23, 152, 181, 203, 76, 17, 39, - 18, 22, 28, 210, 162, 163, 41, 25, 23, 23, - 46, 218, 30, 220, 221, 23, 34, 35, 36, 37, - 23, 41, 229, 39, 42, 81, 184, 28, 235, 196, - 237, 28, 39, 197, 221, 60, 194, 167, 190, -1, - -1, -1, 209, -1, -1, 252, -1, 254, -1, -1, - -1, -1, -1, -1, 212, -1, -1, -1, -1, -1, - -1, -1, 0, 1, -1, -1, 224, -1, -1, 236, - -1, -1, -1, 11, 12, 13, 14, 15, 16, 17, - 18, -1, -1, -1, -1, -1, 24, 247, 26, 27, + 0, 7, 0, 80, 27, 82, 170, 4, 0, 22, + 0, 23, 169, 22, 23, 42, 0, 203, 206, 16, + 72, 70, 42, 17, 76, 22, 23, 24, 25, 26, + 218, 217, 17, 46, 46, 18, 18, 64, 35, 196, + 197, 20, 25, 200, 64, 202, 43, 30, 18, 46, + 47, 34, 35, 36, 37, 25, 213, 221, 34, 42, + 36, 70, 70, 42, 34, 17, 42, 17, 76, 17, + 67, 12, 13, 44, 45, 17, 17, 241, 71, 79, + 70, 79, 239, 80, 81, 82, 70, 79, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 64, 49, 50, 71, 113, 131, 54, + 55, 56, 76, 58, 59, 60, 122, 18, 18, 116, + 117, 34, 119, 120, 121, 131, 123, 124, 73, 74, + 75, 208, 17, 41, 41, 132, 76, 178, 17, 34, + 181, 182, 18, 220, 18, 18, 17, 72, 72, 70, + 191, 174, 149, 17, 177, 42, 17, 76, 199, 17, + 23, 158, 159, 28, 39, 206, 22, 79, 46, 41, + 23, 23, 23, 214, 41, 216, 217, 23, 28, 39, + 28, 217, 39, 180, 225, 163, 192, 186, 193, 58, + 231, -1, 233, 190, -1, -1, -1, -1, 47, 205, + -1, 0, 1, -1, -1, -1, -1, 248, -1, 250, + -1, 208, 11, 12, 13, 14, -1, 16, 17, 18, + -1, -1, -1, 220, -1, 24, 232, 26, 27, 28, + -1, -1, 31, 32, 33, -1, -1, -1, -1, 38, + 39, 40, -1, 243, 43, -1, -1, -1, 47, 48, + -1, -1, -1, -1, -1, -1, -1, -1, 57, -1, + -1, -1, 61, -1, -1, -1, 65, 66, -1, -1, + -1, 70, 71, 11, 12, 13, 14, -1, 16, 17, + 18, -1, -1, -1, -1, -1, 24, -1, 26, 27, 28, -1, -1, 31, 32, 33, -1, -1, -1, -1, 38, 39, 40, -1, -1, 43, -1, -1, -1, 47, 48, -1, -1, -1, -1, -1, -1, -1, -1, 57, - -1, -1, -1, 61, -1, -1, -1, 65, 66, -1, - -1, -1, 70, 71, 11, 12, 13, 14, 15, 16, - 17, 18, -1, -1, -1, -1, -1, 24, -1, 26, - 27, 28, -1, -1, 31, 32, 33, -1, -1, -1, - -1, 38, 39, 40, -1, -1, 43, 49, 50, -1, - 47, 48, 54, 55, 56, -1, 58, 59, 60, -1, - 57, -1, -1, -1, 61, 67, 68, -1, 65, 66, - -1, 73, 74, 75, 71, 11, 12, 13, 14, 15, - 16, 17, 18, -1, -1, -1, -1, -1, 24, -1, - 26, 27, 28, -1, -1, -1, 32, 33, -1, -1, + -1, -1, -1, 61, -1, -1, -1, 65, 66, 11, + 12, 13, 14, 71, 16, 17, 18, -1, -1, -1, + -1, -1, 24, -1, 26, 27, 28, -1, -1, -1, + 32, 33, -1, -1, -1, -1, 38, 39, 40, -1, + -1, 43, -1, -1, -1, 11, 12, 13, 14, -1, + 16, 17, 18, -1, -1, 57, -1, -1, 24, 61, + 26, 27, 28, 65, 66, -1, 32, 33, 70, 71, -1, -1, 38, 39, 40, -1, -1, 43, -1, -1, - -1, 11, 12, 13, 14, 15, 16, 17, 18, -1, - -1, 57, -1, -1, 24, 61, 26, 27, 28, 65, - 66, -1, 32, 33, 70, 71, -1, -1, 38, 39, - 40, -1, -1, 43, -1, -1, -1, 11, 12, 13, - 14, 15, 16, 17, 18, -1, -1, 57, -1, -1, - 24, 61, 26, 27, -1, 65, 66, -1, 32, 33, - -1, 71, -1, -1, 38, -1, 40, 11, 12, 13, - 14, 15, 16, 17, 18, -1, -1, -1, -1, -1, - -1, -1, -1, 57, -1, -1, -1, 61, -1, -1, - -1, 65, 66, -1, 38, -1, 40, 71, -1, 11, - 12, 13, 14, 15, 16, 17, 18, -1, -1, -1, - -1, -1, -1, 57, -1, -1, -1, 61, -1, -1, - -1, 65, 66, -1, -1, -1, 38, 71, 40, -1, - -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 57, -1, -1, -1, 61, - -1, 49, 50, 65, 66, -1, 54, 55, 56, 71, - 58, 59, 60, -1, -1, -1, 42, 65, 66, 67, - 68, -1, -1, 49, 50, 73, 74, 75, 54, 55, - 56, -1, 58, 59, 60, -1, -1, -1, 64, 65, - 66, 67, 68, -1, -1, 49, 50, 73, 74, 75, - 54, 55, 56, -1, 58, 59, 60, -1, 62, 63, - -1, 65, 66, 67, 68, -1, -1, 49, 50, 73, + -1, 11, 12, 13, 14, -1, 16, 17, 18, -1, + -1, 57, -1, -1, 24, 61, 26, 27, -1, 65, + 66, -1, 32, 33, -1, 71, -1, -1, 38, -1, + 40, 11, 12, 13, 14, -1, 16, 17, 18, -1, + -1, -1, -1, 11, 12, 13, 14, 57, 16, 17, + 18, 61, -1, -1, -1, 65, 66, -1, 38, -1, + 40, 71, -1, -1, -1, -1, -1, -1, -1, -1, + 38, -1, 40, -1, -1, 29, -1, 57, -1, -1, + -1, 61, -1, -1, -1, 65, 66, -1, -1, 57, + -1, 71, -1, 61, -1, 49, 50, 65, 66, -1, + 54, 55, 56, 71, 58, 59, 60, -1, -1, -1, + 42, 65, 66, 67, 68, -1, -1, 49, 50, 73, 74, 75, 54, 55, 56, -1, 58, 59, 60, -1, - -1, -1, 64, 65, 66, 67, 68, -1, -1, -1, - 72, 73, 74, 75, 49, 50, -1, -1, -1, 54, - 55, 56, -1, 58, 59, 60, -1, -1, -1, -1, - 65, 66, 67, 68, -1, -1, -1, 72, 73, 74, - 75, 49, 50, -1, -1, -1, 54, 55, 56, -1, + -1, -1, 64, 65, 66, 67, 68, -1, -1, 49, + 50, 73, 74, 75, 54, 55, 56, -1, 58, 59, + 60, -1, 62, 63, -1, 65, 66, 67, 68, -1, + -1, 49, 50, 73, 74, 75, 54, 55, 56, -1, 58, 59, 60, -1, -1, -1, 64, 65, 66, 67, - 68, -1, -1, 49, 50, 73, 74, 75, 54, 55, - 56, -1, 58, 59, 60, -1, -1, -1, -1, 65, - 66, 67, 68, -1, -1, 49, 50, 73, 74, 75, + 68, -1, -1, -1, 72, 73, 74, 75, 49, 50, + -1, -1, -1, 54, 55, 56, -1, 58, 59, 60, + -1, -1, -1, -1, 65, 66, 67, 68, -1, -1, + -1, 72, 73, 74, 75, 49, 50, -1, -1, -1, 54, 55, 56, -1, 58, 59, 60, -1, -1, -1, - -1, -1, -1, 67, 68, -1, -1, 71, -1, 73, - 74, 75 + 64, 65, 66, 67, 68, -1, -1, 49, 50, 73, + 74, 75, 54, 55, 56, -1, 58, 59, 60, -1, + -1, -1, -1, 65, 66, 67, 68, -1, -1, 49, + 50, 73, 74, 75, 54, 55, 56, -1, 58, 59, + 60, -1, -1, -1, -1, -1, -1, 67, 68, -1, + -1, 71, -1, 73, 74, 75, 49, 50, -1, -1, + -1, 54, 55, 56, -1, 58, 59, 60, -1, -1, + -1, -1, -1, -1, 67, 68, -1, -1, -1, -1, + 73, 74, 75 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 1, 11, 12, 13, 14, 15, 16, 17, 18, - 24, 26, 27, 28, 31, 32, 33, 38, 39, 40, - 43, 47, 48, 57, 61, 65, 66, 71, 78, 80, - 81, 82, 83, 84, 91, 92, 93, 98, 99, 101, - 104, 109, 70, 17, 38, 81, 98, 71, 71, 95, - 17, 100, 18, 25, 30, 34, 35, 36, 37, 42, - 102, 103, 17, 18, 17, 98, 44, 45, 12, 13, - 17, 17, 17, 17, 98, 98, 98, 98, 98, 0, - 70, 79, 71, 64, 71, 90, 98, 49, 50, 54, - 55, 56, 58, 59, 60, 65, 66, 67, 68, 73, - 74, 75, 98, 98, 110, 110, 110, 76, 18, 18, - 34, 18, 25, 34, 42, 103, 105, 29, 17, 42, - 64, 98, 42, 64, 41, 106, 62, 63, 72, 80, - 90, 98, 90, 98, 41, 64, 98, 98, 98, 98, - 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, - 98, 72, 76, 72, 17, 18, 18, 18, 95, 17, - 98, 98, 42, 64, 98, 98, 98, 95, 98, 98, - 72, 96, 72, 79, 95, 98, 98, 17, 107, 98, - 98, 107, 97, 20, 42, 97, 82, 99, 76, 79, - 79, 79, 83, 96, 42, 98, 96, 96, 17, 76, - 108, 108, 23, 98, 96, 23, 46, 95, 22, 46, - 87, 88, 94, 17, 97, 97, 39, 96, 97, 28, - 97, 86, 87, 89, 94, 95, 88, 96, 90, 97, - 96, 96, 89, 96, 90, 82, 46, 85, 41, 96, - 23, 23, 23, 41, 96, 95, 96, 95, 23, 39, - 28, 28, 97, 82, 83, 39, 96, 96 + 0, 1, 11, 12, 13, 14, 16, 17, 18, 24, + 26, 27, 28, 31, 32, 33, 38, 39, 40, 43, + 47, 48, 57, 61, 65, 66, 71, 78, 80, 81, + 82, 83, 84, 91, 92, 93, 98, 99, 101, 104, + 109, 70, 17, 38, 81, 98, 71, 95, 17, 100, + 18, 25, 30, 34, 35, 36, 37, 42, 102, 103, + 17, 18, 17, 98, 44, 45, 12, 13, 17, 17, + 17, 17, 98, 98, 98, 98, 98, 0, 70, 79, + 71, 64, 71, 90, 98, 49, 50, 54, 55, 56, + 58, 59, 60, 65, 66, 67, 68, 73, 74, 75, + 98, 98, 110, 110, 76, 18, 18, 34, 18, 25, + 34, 42, 103, 105, 29, 17, 42, 64, 98, 42, + 64, 41, 106, 62, 63, 72, 80, 90, 98, 90, + 98, 41, 64, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 72, 76, + 17, 18, 18, 18, 95, 17, 98, 98, 42, 64, + 98, 98, 98, 95, 98, 98, 72, 96, 72, 79, + 95, 98, 98, 17, 107, 98, 98, 107, 97, 20, + 42, 97, 82, 99, 76, 79, 79, 79, 83, 96, + 42, 98, 96, 96, 17, 76, 108, 108, 23, 98, + 96, 23, 46, 95, 22, 46, 87, 88, 94, 17, + 97, 97, 39, 96, 97, 28, 97, 86, 87, 89, + 94, 95, 88, 96, 90, 97, 96, 96, 89, 96, + 90, 82, 46, 85, 41, 96, 23, 23, 23, 41, + 96, 95, 96, 95, 23, 39, 28, 28, 97, 82, + 83, 39, 96, 96 }; #define yyerrok (yyerrstatus = 0) @@ -2125,22 +2120,13 @@ yyreduce: case 57: #line 354 "engines/director/lingo/lingo-gr.y" { - if ((yyvsp[(3) - (4)].narg) != g_lingo->_builtins[*(yyvsp[(1) - (4)].s)]->nargs) - error("Built-in function %s expects %d arguments but got %d", (yyvsp[(1) - (4)].s)->c_str(), g_lingo->_builtins[*(yyvsp[(1) - (4)].s)]->nargs, (yyvsp[(3) - (4)].narg)); - - (yyval.code) = g_lingo->code1(g_lingo->_builtins[*(yyvsp[(1) - (4)].s)]->func); - delete (yyvsp[(1) - (4)].s); ;} - break; - - case 58: -#line 360 "engines/director/lingo/lingo-gr.y" - { - (yyval.code) = g_lingo->code1(g_lingo->_builtins[*(yyvsp[(1) - (1)].s)]->func); + (yyval.code) = g_lingo->code1(g_lingo->_handlers[*(yyvsp[(1) - (1)].s)]->u.func); + (yyval.code) = g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy value delete (yyvsp[(1) - (1)].s); ;} break; - case 59: -#line 363 "engines/director/lingo/lingo-gr.y" + 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()); @@ -2151,15 +2137,15 @@ yyreduce: delete (yyvsp[(1) - (4)].s); ;} break; - case 60: -#line 371 "engines/director/lingo/lingo-gr.y" + case 59: +#line 366 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); ;} break; - case 61: -#line 374 "engines/director/lingo/lingo-gr.y" + case 60: +#line 369 "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); @@ -2169,8 +2155,8 @@ yyreduce: g_lingo->code2(e, f); ;} break; - case 62: -#line 381 "engines/director/lingo/lingo-gr.y" + case 61: +#line 376 "engines/director/lingo/lingo-gr.y" { (yyval.code) = g_lingo->code1(g_lingo->c_theentitypush); inst e = 0, f = 0; @@ -2179,159 +2165,159 @@ yyreduce: g_lingo->code2(e, f); ;} break; - case 64: -#line 388 "engines/director/lingo/lingo-gr.y" + case 63: +#line 383 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_add); ;} break; - case 65: -#line 389 "engines/director/lingo/lingo-gr.y" + case 64: +#line 384 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_sub); ;} break; - case 66: -#line 390 "engines/director/lingo/lingo-gr.y" + case 65: +#line 385 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_mul); ;} break; - case 67: -#line 391 "engines/director/lingo/lingo-gr.y" + case 66: +#line 386 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_div); ;} break; - case 68: -#line 392 "engines/director/lingo/lingo-gr.y" + case 67: +#line 387 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gt); ;} break; - case 69: -#line 393 "engines/director/lingo/lingo-gr.y" + case 68: +#line 388 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_lt); ;} break; - case 70: -#line 394 "engines/director/lingo/lingo-gr.y" + case 69: +#line 389 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_neq); ;} break; - case 71: -#line 395 "engines/director/lingo/lingo-gr.y" + case 70: +#line 390 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_ge); ;} break; - case 72: -#line 396 "engines/director/lingo/lingo-gr.y" + case 71: +#line 391 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_le); ;} break; - case 73: -#line 397 "engines/director/lingo/lingo-gr.y" + case 72: +#line 392 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_and); ;} break; - case 74: -#line 398 "engines/director/lingo/lingo-gr.y" + case 73: +#line 393 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_or); ;} break; - case 75: -#line 399 "engines/director/lingo/lingo-gr.y" + case 74: +#line 394 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_not); ;} break; - case 76: -#line 400 "engines/director/lingo/lingo-gr.y" + case 75: +#line 395 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_ampersand); ;} break; - case 77: -#line 401 "engines/director/lingo/lingo-gr.y" + case 76: +#line 396 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_concat); ;} break; - case 78: -#line 402 "engines/director/lingo/lingo-gr.y" + case 77: +#line 397 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_contains); ;} break; - case 79: -#line 403 "engines/director/lingo/lingo-gr.y" + case 78: +#line 398 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_starts); ;} break; - case 80: -#line 404 "engines/director/lingo/lingo-gr.y" + case 79: +#line 399 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (2)].code); ;} break; - case 81: -#line 405 "engines/director/lingo/lingo-gr.y" + case 80: +#line 400 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;} break; - case 82: -#line 406 "engines/director/lingo/lingo-gr.y" + case 81: +#line 401 "engines/director/lingo/lingo-gr.y" { (yyval.code) = (yyvsp[(2) - (3)].code); ;} break; - case 83: -#line 407 "engines/director/lingo/lingo-gr.y" + case 82: +#line 402 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_intersects); ;} break; - case 84: -#line 408 "engines/director/lingo/lingo-gr.y" + case 83: +#line 403 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_within); ;} break; - case 85: -#line 411 "engines/director/lingo/lingo-gr.y" + case 84: +#line 406 "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 86: -#line 412 "engines/director/lingo/lingo-gr.y" + case 85: +#line 407 "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 87: -#line 413 "engines/director/lingo/lingo-gr.y" + case 86: +#line 408 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_printtop); ;} break; - case 89: -#line 415 "engines/director/lingo/lingo-gr.y" + case 88: +#line 410 "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 91: -#line 420 "engines/director/lingo/lingo-gr.y" + case 90: +#line 415 "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 92: -#line 421 "engines/director/lingo/lingo-gr.y" + case 91: +#line 416 "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 93: -#line 432 "engines/director/lingo/lingo-gr.y" + case 92: +#line 427 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoloop); ;} break; - case 94: -#line 433 "engines/director/lingo/lingo-gr.y" + case 93: +#line 428 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotonext); ;} break; - case 95: -#line 434 "engines/director/lingo/lingo-gr.y" + case 94: +#line 429 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_gotoprevious); ;} break; - case 96: -#line 435 "engines/director/lingo/lingo-gr.y" + case 95: +#line 430 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); @@ -2339,8 +2325,8 @@ yyreduce: delete (yyvsp[(2) - (2)].s); ;} break; - case 97: -#line 440 "engines/director/lingo/lingo-gr.y" + case 96: +#line 435 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); @@ -2349,8 +2335,8 @@ yyreduce: delete (yyvsp[(3) - (3)].s); ;} break; - case 98: -#line 446 "engines/director/lingo/lingo-gr.y" + case 97: +#line 441 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); @@ -2358,48 +2344,48 @@ yyreduce: delete (yyvsp[(2) - (2)].s); ;} break; - case 99: -#line 453 "engines/director/lingo/lingo-gr.y" + case 98: +#line 448 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 100: -#line 454 "engines/director/lingo/lingo-gr.y" + case 99: +#line 449 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 101: -#line 455 "engines/director/lingo/lingo-gr.y" + case 100: +#line 450 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 102: -#line 456 "engines/director/lingo/lingo-gr.y" + case 101: +#line 451 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(1) - (1)].s); ;} break; - case 103: -#line 459 "engines/director/lingo/lingo-gr.y" + case 102: +#line 454 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 104: -#line 460 "engines/director/lingo/lingo-gr.y" + case 103: +#line 455 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(2) - (2)].s); ;} break; - case 105: -#line 461 "engines/director/lingo/lingo-gr.y" + case 104: +#line 456 "engines/director/lingo/lingo-gr.y" { (yyval.s) = (yyvsp[(3) - (3)].s); ;} break; - case 106: -#line 489 "engines/director/lingo/lingo-gr.y" + case 105: +#line 484 "engines/director/lingo/lingo-gr.y" { g_lingo->_indef = true; ;} break; - case 107: -#line 490 "engines/director/lingo/lingo-gr.y" + case 106: +#line 485 "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); @@ -2407,20 +2393,20 @@ yyreduce: g_lingo->_indef = false; ;} break; - case 108: -#line 495 "engines/director/lingo/lingo-gr.y" + case 107: +#line 490 "engines/director/lingo/lingo-gr.y" { g_lingo->codeFactory(*(yyvsp[(2) - (2)].s)); ;} break; - case 109: -#line 498 "engines/director/lingo/lingo-gr.y" + case 108: +#line 493 "engines/director/lingo/lingo-gr.y" { g_lingo->_indef = true; ;} break; - case 110: -#line 499 "engines/director/lingo/lingo-gr.y" + case 109: +#line 494 "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); @@ -2428,33 +2414,33 @@ yyreduce: g_lingo->_indef = false; ;} break; - case 111: -#line 504 "engines/director/lingo/lingo-gr.y" + case 110: +#line 499 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 0; ;} break; - case 112: -#line 505 "engines/director/lingo/lingo-gr.y" + case 111: +#line 500 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;} break; - case 113: -#line 506 "engines/director/lingo/lingo-gr.y" + case 112: +#line 501 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; - case 114: -#line 507 "engines/director/lingo/lingo-gr.y" + case 113: +#line 502 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;} break; - case 115: -#line 509 "engines/director/lingo/lingo-gr.y" + case 114: +#line 504 "engines/director/lingo/lingo-gr.y" { g_lingo->codeArgStore(); ;} break; - case 116: -#line 513 "engines/director/lingo/lingo-gr.y" + case 115: +#line 508 "engines/director/lingo/lingo-gr.y" { g_lingo->code1(g_lingo->c_call); g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str()); @@ -2463,24 +2449,24 @@ yyreduce: g_lingo->code1(numpar); ;} break; - case 117: -#line 521 "engines/director/lingo/lingo-gr.y" + case 116: +#line 516 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 0; ;} break; - case 118: -#line 522 "engines/director/lingo/lingo-gr.y" + case 117: +#line 517 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = 1; ;} break; - case 119: -#line 523 "engines/director/lingo/lingo-gr.y" + case 118: +#line 518 "engines/director/lingo/lingo-gr.y" { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;} break; /* Line 1267 of yacc.c. */ -#line 2484 "engines/director/lingo/lingo-gr.cpp" +#line 2470 "engines/director/lingo/lingo-gr.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2694,6 +2680,6 @@ yyreturn: } -#line 526 "engines/director/lingo/lingo-gr.y" +#line 521 "engines/director/lingo/lingo-gr.y" diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y index 6df71f9ea7..cfed29a6d3 100644 --- a/engines/director/lingo/lingo-gr.y +++ b/engines/director/lingo/lingo-gr.y @@ -351,14 +351,9 @@ expr: INT { | STRING { $$ = g_lingo->code1(g_lingo->c_stringpush); g_lingo->codeString($1->c_str()); } - | BLTIN '(' arglist ')' { - if ($3 != g_lingo->_builtins[*$1]->nargs) - error("Built-in function %s expects %d arguments but got %d", $1->c_str(), g_lingo->_builtins[*$1]->nargs, $3); - - $$ = g_lingo->code1(g_lingo->_builtins[*$1]->func); - delete $1; } | BLTINNOARGS { - $$ = g_lingo->code1(g_lingo->_builtins[*$1]->func); + $$ = g_lingo->code1(g_lingo->_handlers[*$1]->u.func); + $$ = g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy value delete $1; } | ID '(' arglist ')' { $$ = g_lingo->code1(g_lingo->c_call); diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp index 4ffa450000..f4e3541dfa 100644 --- a/engines/director/lingo/lingo-lex.cpp +++ b/engines/director/lingo/lingo-lex.cpp @@ -1237,11 +1237,9 @@ YY_RULE_SETUP count(); yylval.s = new Common::String(yytext); - if (g_lingo->_builtins.contains(yytext)) { - if (g_lingo->_builtins[yytext]->nargs == -1) + if (g_lingo->_handlers.contains(yytext)) { + if (g_lingo->_handlers[yytext]->type == BLTIN && g_lingo->_handlers[yytext]->nargs == -1) return BLTINNOARGS; - else - return BLTIN; } return ID; @@ -1249,41 +1247,41 @@ YY_RULE_SETUP YY_BREAK case 48: YY_RULE_SETUP -#line 181 "engines/director/lingo/lingo-lex.l" +#line 179 "engines/director/lingo/lingo-lex.l" { count(); yylval.f = atof(yytext); return FLOAT; } YY_BREAK case 49: YY_RULE_SETUP -#line 182 "engines/director/lingo/lingo-lex.l" +#line 180 "engines/director/lingo/lingo-lex.l" { count(); yylval.i = strtol(yytext, NULL, 10); return INT; } YY_BREAK case 50: YY_RULE_SETUP -#line 183 "engines/director/lingo/lingo-lex.l" +#line 181 "engines/director/lingo/lingo-lex.l" { count(); return *yytext; } YY_BREAK case 51: /* rule 51 can match eol */ YY_RULE_SETUP -#line 184 "engines/director/lingo/lingo-lex.l" +#line 182 "engines/director/lingo/lingo-lex.l" { return '\n'; } YY_BREAK case 52: YY_RULE_SETUP -#line 185 "engines/director/lingo/lingo-lex.l" +#line 183 "engines/director/lingo/lingo-lex.l" { count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; } YY_BREAK case 53: YY_RULE_SETUP -#line 186 "engines/director/lingo/lingo-lex.l" +#line 184 "engines/director/lingo/lingo-lex.l" YY_BREAK case 54: YY_RULE_SETUP -#line 188 "engines/director/lingo/lingo-lex.l" +#line 186 "engines/director/lingo/lingo-lex.l" ECHO; YY_BREAK -#line 1287 "engines/director/lingo/lingo-lex.cpp" +#line 1285 "engines/director/lingo/lingo-lex.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2283,7 +2281,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 188 "engines/director/lingo/lingo-lex.l" +#line 186 "engines/director/lingo/lingo-lex.l" diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l index 56703160e5..9532da4fcb 100644 --- a/engines/director/lingo/lingo-lex.l +++ b/engines/director/lingo/lingo-lex.l @@ -169,11 +169,9 @@ whitespace [\t ] count(); yylval.s = new Common::String(yytext); - if (g_lingo->_builtins.contains(yytext)) { - if (g_lingo->_builtins[yytext]->nargs == -1) + if (g_lingo->_handlers.contains(yytext)) { + if (g_lingo->_handlers[yytext]->type == BLTIN && g_lingo->_handlers[yytext]->nargs == -1) return BLTINNOARGS; - else - return BLTIN; } return ID; diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index c61f38abfb..e15e979bd9 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -85,6 +85,7 @@ struct Symbol { /* symbol table entry */ int i; /* VAR */ double f; /* FLOAT */ ScriptData *defn; /* FUNCTION, PROCEDURE */ + void (*func)(void); /* BUILTIN */ Common::String *s; /* STRING */ FloatArray *arr; /* ARRAY, POINT, RECT */ } u; @@ -288,11 +289,12 @@ public: Common::Array<CFrame *> _callstack; Common::Array<Common::String *> _argstack; - BuiltinHash _builtins; TheEntityHash _theEntities; TheEntityFieldHash _theEntityFields; Common::Array<int> _labelstack; + SymbolHash _handlers; + int _linenumber; int _colnumber; @@ -315,7 +317,6 @@ private: SymbolHash _globalvars; SymbolHash *_localvars; - SymbolHash _handlers; int _pc; diff --git a/engines/director/lingo/tests/math.lingo b/engines/director/lingo/tests/math.lingo index e1a877a4a4..9c0b2d57a3 100644 --- a/engines/director/lingo/tests/math.lingo +++ b/engines/director/lingo/tests/math.lingo @@ -11,6 +11,9 @@ put cos(z2) set x = 2 + 3 * (4 / 2) put x +put power(2, 8) +updatestage + -- Type conversion put (1024/4096)*100 -- 0 put (1024/4096)*100.0 -- 0.0 |