From 3a4fbc936793d6e70f9a2eb2e1f8100895dc8dfa Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 11 Jul 2016 15:55:10 +0200 Subject: DIRECTOR: Lingo: Initial code for 'the' entity handling --- engines/director/lingo/lingo-lex.cpp | 413 ++++++++++++++++++----------------- engines/director/lingo/lingo-lex.l | 9 + engines/director/lingo/lingo-the.cpp | 50 +++-- engines/director/lingo/lingo-the.h | 16 +- engines/director/lingo/lingo.h | 18 +- 5 files changed, 278 insertions(+), 228 deletions(-) diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp index f3d80d6ddf..668e7835b9 100644 --- a/engines/director/lingo/lingo-lex.cpp +++ b/engines/director/lingo/lingo-lex.cpp @@ -364,8 +364,8 @@ static void yy_fatal_error (yyconst char msg[] ); *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 46 -#define YY_END_OF_BUFFER 47 +#define YY_NUM_RULES 47 +#define YY_END_OF_BUFFER 48 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -373,25 +373,25 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[152] = +static yyconst flex_int16_t yy_accept[154] = { 0, - 0, 0, 47, 45, 3, 43, 43, 45, 45, 42, - 42, 42, 41, 42, 42, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 2, 2, 3, 43, 0, 0, 43, 0, - 0, 44, 38, 1, 40, 41, 37, 35, 36, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 15, 7, - 39, 39, 39, 39, 39, 39, 39, 24, 25, 39, - 39, 39, 39, 39, 39, 32, 39, 39, 2, 2, - 0, 1, 40, 4, 39, 39, 39, 11, 39, 39, - 39, 39, 39, 39, 19, 39, 39, 23, 39, 27, - - 39, 29, 39, 39, 39, 39, 0, 39, 6, 10, - 12, 39, 39, 16, 17, 39, 39, 39, 22, 39, - 39, 39, 31, 39, 33, 9, 39, 13, 39, 18, - 39, 21, 39, 39, 39, 34, 0, 39, 14, 39, - 39, 28, 30, 0, 39, 20, 39, 8, 5, 26, - 0 + 0, 0, 48, 46, 3, 44, 44, 46, 46, 43, + 43, 43, 42, 43, 43, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 2, 2, 3, 44, 0, 0, 44, 0, + 0, 45, 39, 1, 41, 42, 38, 36, 37, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 15, 7, + 40, 40, 40, 40, 40, 40, 40, 24, 25, 40, + 40, 40, 40, 40, 40, 33, 40, 40, 2, 2, + 0, 1, 41, 4, 40, 40, 40, 11, 40, 40, + 40, 40, 40, 40, 19, 40, 40, 23, 40, 27, + + 40, 29, 40, 40, 40, 40, 0, 40, 6, 10, + 12, 40, 40, 16, 17, 40, 40, 40, 22, 40, + 40, 40, 0, 32, 40, 34, 9, 40, 13, 40, + 18, 40, 21, 40, 40, 40, 31, 35, 0, 40, + 14, 40, 40, 28, 30, 0, 40, 20, 40, 8, + 5, 26, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -401,15 +401,15 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 6, 1, 1, 7, 8, 1, 7, 7, 7, 7, 7, 9, 10, 7, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 7, 1, 12, - 13, 14, 1, 1, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 24, 25, 26, 27, 28, 29, - 24, 30, 31, 32, 33, 34, 35, 36, 24, 24, - 1, 1, 1, 7, 24, 1, 37, 38, 39, 40, - - 41, 42, 43, 44, 45, 24, 24, 46, 47, 48, - 49, 50, 24, 51, 52, 53, 54, 55, 56, 57, - 24, 24, 1, 1, 1, 1, 1, 1, 1, 1, + 11, 11, 11, 11, 11, 11, 11, 12, 1, 13, + 14, 15, 1, 1, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 25, 26, 27, 28, 29, 30, + 25, 31, 32, 33, 34, 35, 36, 37, 25, 25, + 1, 1, 1, 7, 25, 1, 38, 39, 40, 41, + + 42, 43, 44, 45, 46, 25, 25, 47, 48, 49, + 50, 51, 25, 52, 53, 54, 55, 56, 57, 58, + 25, 25, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -426,156 +426,158 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[58] = +static yyconst flex_int32_t yy_meta[59] = { 0, - 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, - 4, 1, 1, 1, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4 + 1, 2, 3, 4, 2, 1, 1, 1, 1, 1, + 5, 2, 1, 1, 1, 6, 5, 5, 5, 5, + 5, 5, 6, 5, 5, 6, 5, 5, 5, 6, + 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, + 5, 5, 5, 5, 6, 5, 6, 5, 5, 5, + 6, 5, 5, 5, 5, 5, 5, 5 } ; -static yyconst flex_int16_t yy_base[155] = +static yyconst flex_int16_t yy_base[158] = { 0, - 0, 56, 187, 354, 60, 64, 68, 72, 146, 354, - 142, 127, 49, 65, 121, 53, 0, 53, 54, 64, - 55, 65, 77, 58, 98, 89, 98, 90, 75, 110, - 111, 109, 154, 162, 166, 92, 170, 143, 174, 97, - 121, 354, 354, 0, 81, 88, 354, 354, 354, 0, - 106, 134, 145, 150, 165, 162, 171, 160, 0, 0, - 157, 162, 174, 169, 161, 160, 165, 0, 0, 179, - 168, 174, 172, 191, 193, 0, 196, 190, 227, 233, - 192, 0, 77, 0, 194, 200, 214, 0, 207, 214, - 226, 217, 217, 219, 215, 228, 221, 0, 220, 0, - - 237, 0, 228, 232, 237, 241, 246, 253, 0, 0, - 0, 250, 257, 0, 0, 248, 262, 262, 0, 259, - 269, 254, 0, 269, 0, 287, 270, 0, 270, 0, - 273, 0, 270, 268, 270, 0, 300, 281, 0, 277, - 278, 0, 0, 292, 283, 0, 286, 354, 0, 0, - 354, 345, 80, 349 + 0, 57, 202, 367, 61, 65, 69, 73, 188, 367, + 180, 168, 50, 65, 136, 53, 0, 53, 54, 68, + 56, 62, 71, 66, 103, 81, 97, 93, 64, 80, + 106, 113, 158, 162, 166, 94, 170, 137, 178, 99, + 132, 367, 367, 0, 122, 144, 367, 367, 367, 0, + 111, 148, 142, 152, 166, 162, 171, 160, 0, 0, + 157, 162, 174, 169, 160, 159, 167, 0, 0, 181, + 170, 174, 173, 197, 198, 0, 195, 189, 226, 234, + 194, 0, 75, 0, 199, 205, 214, 0, 209, 217, + 228, 219, 219, 219, 215, 222, 219, 0, 220, 0, + + 237, 0, 228, 256, 234, 241, 246, 258, 0, 0, + 0, 255, 261, 0, 0, 233, 262, 262, 0, 261, + 271, 256, 88, 0, 270, 0, 142, 267, 0, 267, + 0, 270, 0, 269, 268, 270, 290, 0, 301, 280, + 0, 278, 281, 0, 0, 296, 288, 0, 289, 367, + 0, 0, 367, 347, 349, 355, 360 } ; -static yyconst flex_int16_t yy_def[155] = +static yyconst flex_int16_t yy_def[158] = { 0, - 151, 1, 151, 151, 151, 151, 151, 151, 152, 151, - 151, 151, 151, 151, 151, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 151, 151, 151, 151, 151, 151, 151, 151, - 152, 151, 151, 154, 151, 151, 151, 151, 151, 153, + 153, 1, 153, 153, 153, 153, 153, 153, 154, 153, + 153, 153, 153, 153, 153, 155, 155, 155, 155, 155, + 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, + 155, 155, 153, 153, 153, 153, 153, 153, 153, 153, + 154, 153, 153, 156, 153, 153, 153, 153, 153, 155, + 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, + 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, + 155, 155, 155, 155, 155, 155, 155, 155, 153, 153, + 153, 156, 153, 155, 155, 155, 155, 155, 155, 155, + 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, + + 155, 155, 155, 155, 155, 155, 153, 155, 155, 155, + 155, 155, 155, 155, 155, 155, 155, 155, 155, 155, + 155, 155, 157, 155, 155, 155, 153, 155, 155, 155, + 155, 155, 155, 155, 155, 155, 157, 155, 153, 155, + 155, 155, 155, 155, 155, 153, 155, 155, 155, 153, + 155, 155, 0, 153, 153, 153, 153 + } ; + +static yyconst flex_int16_t yy_nxt[426] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 4, + 13, 10, 14, 10, 15, 16, 17, 18, 19, 20, + 21, 22, 17, 23, 17, 24, 25, 26, 27, 28, + 29, 30, 31, 17, 17, 32, 17, 16, 17, 18, + 19, 20, 21, 22, 17, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 17, 17, 32, 17, 33, 45, + 46, 34, 35, 36, 36, 37, 38, 39, 39, 38, + 38, 39, 39, 38, 37, 36, 36, 37, 47, 48, + 51, 52, 53, 72, 40, 83, 57, 58, 40, 123, + 59, 60, 123, 54, 62, 55, 36, 36, 61, 73, + + 66, 51, 52, 53, 56, 72, 40, 57, 58, 67, + 40, 59, 74, 60, 54, 62, 55, 68, 63, 61, + 64, 73, 66, 70, 81, 56, 71, 69, 75, 84, + 67, 65, 83, 74, 76, 77, 78, 42, 38, 68, + 63, 38, 64, 139, 70, 81, 139, 71, 69, 49, + 75, 84, 65, 45, 46, 76, 40, 77, 78, 79, + 36, 36, 80, 80, 36, 36, 80, 35, 36, 36, + 37, 37, 36, 36, 37, 85, 44, 86, 40, 38, + 39, 39, 38, 87, 88, 89, 90, 43, 91, 92, + 93, 94, 95, 42, 96, 97, 85, 40, 86, 98, + + 99, 153, 100, 101, 87, 102, 88, 89, 90, 91, + 92, 93, 103, 94, 95, 96, 97, 104, 105, 40, + 98, 106, 99, 100, 101, 107, 102, 79, 36, 36, + 80, 108, 109, 110, 103, 80, 36, 36, 80, 104, + 105, 111, 106, 112, 113, 118, 107, 114, 115, 116, + 117, 119, 108, 109, 120, 110, 121, 123, 122, 125, + 123, 131, 111, 126, 112, 127, 113, 118, 114, 115, + 116, 117, 119, 128, 129, 120, 130, 132, 121, 122, + 125, 133, 131, 124, 134, 126, 135, 127, 136, 138, + 140, 153, 141, 142, 153, 128, 129, 143, 130, 132, + + 144, 145, 139, 133, 124, 139, 134, 147, 135, 136, + 148, 138, 140, 141, 149, 142, 150, 153, 143, 151, + 152, 144, 145, 153, 146, 153, 153, 153, 147, 153, + 153, 148, 153, 153, 153, 149, 153, 153, 150, 153, + 151, 152, 153, 153, 153, 153, 146, 41, 41, 153, + 41, 41, 41, 50, 50, 82, 82, 153, 153, 82, + 82, 137, 153, 153, 153, 137, 3, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 151, 151, - 151, 154, 151, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 151, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 151, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 153, 151, 153, 153, 153, - 153, 153, 153, 151, 153, 153, 153, 151, 153, 153, - 0, 151, 151, 151 - } ; - -static yyconst flex_int16_t yy_nxt[412] = - { 0, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 4, - 13, 14, 10, 15, 16, 17, 18, 19, 20, 21, - 22, 17, 23, 17, 24, 25, 26, 27, 28, 29, - 30, 31, 17, 17, 32, 17, 16, 17, 18, 19, - 20, 21, 22, 17, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 17, 17, 32, 17, 33, 45, 46, - 34, 35, 36, 36, 37, 38, 39, 39, 38, 38, - 39, 39, 38, 37, 36, 36, 37, 47, 48, 51, - 52, 53, 40, 50, 57, 62, 40, 83, 54, 58, - 55, 83, 59, 72, 36, 36, 60, 45, 46, 56, - - 51, 52, 53, 61, 40, 57, 62, 66, 40, 54, - 58, 55, 63, 59, 64, 72, 67, 68, 60, 70, - 56, 81, 71, 84, 61, 65, 42, 69, 73, 66, - 77, 78, 75, 49, 63, 44, 64, 67, 76, 68, - 70, 74, 81, 71, 38, 84, 65, 38, 69, 43, - 73, 42, 77, 78, 75, 79, 36, 36, 80, 76, - 85, 40, 74, 80, 36, 36, 80, 35, 36, 36, - 37, 37, 36, 36, 37, 38, 39, 39, 38, 86, - 87, 85, 88, 40, 89, 90, 151, 91, 92, 93, - 94, 95, 40, 151, 96, 97, 98, 99, 151, 100, - - 86, 87, 101, 102, 88, 103, 89, 90, 91, 92, - 93, 104, 94, 95, 40, 96, 97, 98, 105, 99, - 100, 106, 107, 101, 102, 108, 109, 103, 79, 36, - 36, 80, 110, 104, 80, 36, 36, 80, 111, 112, - 105, 113, 106, 107, 114, 115, 108, 109, 116, 117, - 118, 151, 119, 120, 110, 121, 151, 122, 123, 111, - 112, 124, 125, 113, 126, 114, 115, 127, 128, 116, - 117, 129, 118, 119, 120, 130, 131, 121, 122, 123, - 132, 133, 124, 134, 125, 135, 126, 136, 137, 127, - 128, 137, 138, 129, 139, 140, 130, 141, 131, 142, - - 143, 137, 132, 133, 137, 134, 135, 145, 146, 136, - 147, 148, 151, 149, 138, 139, 150, 140, 141, 151, - 142, 143, 144, 151, 151, 151, 151, 151, 145, 146, - 151, 147, 151, 148, 149, 151, 151, 150, 151, 151, - 151, 151, 151, 151, 144, 41, 151, 41, 41, 82, - 151, 151, 82, 3, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151 + 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, + 153, 153, 153, 153, 153 } ; -static yyconst flex_int16_t yy_chk[412] = +static yyconst flex_int16_t yy_chk[426] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, 13, 13, - 2, 5, 5, 5, 5, 6, 6, 6, 6, 7, - 7, 7, 7, 8, 8, 8, 8, 14, 14, 16, - 18, 19, 6, 153, 21, 24, 7, 83, 20, 22, - 20, 45, 22, 29, 36, 36, 23, 46, 46, 20, - - 16, 18, 19, 23, 6, 21, 24, 26, 7, 20, - 22, 20, 25, 22, 25, 29, 26, 27, 23, 28, - 20, 40, 28, 51, 23, 25, 41, 27, 30, 26, - 32, 32, 31, 15, 25, 12, 25, 26, 31, 27, - 28, 30, 40, 28, 38, 51, 25, 38, 27, 11, - 30, 9, 32, 32, 31, 33, 33, 33, 33, 31, - 52, 38, 30, 34, 34, 34, 34, 35, 35, 35, - 35, 37, 37, 37, 37, 39, 39, 39, 39, 53, - 54, 52, 55, 38, 56, 57, 3, 58, 61, 62, - 63, 64, 39, 0, 65, 66, 67, 70, 0, 71, - - 53, 54, 72, 73, 55, 74, 56, 57, 58, 61, - 62, 75, 63, 64, 39, 65, 66, 67, 77, 70, - 71, 78, 81, 72, 73, 85, 86, 74, 79, 79, - 79, 79, 87, 75, 80, 80, 80, 80, 89, 90, - 77, 91, 78, 81, 92, 93, 85, 86, 94, 95, - 96, 0, 97, 99, 87, 101, 0, 103, 104, 89, - 90, 105, 106, 91, 107, 92, 93, 108, 112, 94, - 95, 113, 96, 97, 99, 116, 117, 101, 103, 104, - 118, 120, 105, 121, 106, 122, 107, 124, 126, 108, - 112, 126, 127, 113, 129, 131, 116, 133, 117, 134, - - 135, 137, 118, 120, 137, 121, 122, 138, 140, 124, - 141, 144, 0, 145, 127, 129, 147, 131, 133, 0, - 134, 135, 137, 0, 0, 0, 0, 0, 138, 140, - 0, 141, 0, 144, 145, 0, 0, 147, 0, 0, - 0, 0, 0, 0, 137, 152, 0, 152, 152, 154, - 0, 0, 154, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - - 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, - 151 + 1, 1, 1, 1, 1, 1, 1, 1, 2, 13, + 13, 2, 5, 5, 5, 5, 6, 6, 6, 6, + 7, 7, 7, 7, 8, 8, 8, 8, 14, 14, + 16, 18, 19, 29, 6, 83, 21, 22, 7, 123, + 22, 23, 123, 20, 24, 20, 36, 36, 23, 30, + + 26, 16, 18, 19, 20, 29, 6, 21, 22, 26, + 7, 22, 30, 23, 20, 24, 20, 27, 25, 23, + 25, 30, 26, 28, 40, 20, 28, 27, 31, 51, + 26, 25, 45, 30, 31, 32, 32, 41, 38, 27, + 25, 38, 25, 127, 28, 40, 127, 28, 27, 15, + 31, 51, 25, 46, 46, 31, 38, 32, 32, 33, + 33, 33, 33, 34, 34, 34, 34, 35, 35, 35, + 35, 37, 37, 37, 37, 52, 12, 53, 38, 39, + 39, 39, 39, 54, 55, 56, 57, 11, 58, 61, + 62, 63, 64, 9, 65, 66, 52, 39, 53, 67, + + 70, 3, 71, 72, 54, 73, 55, 56, 57, 58, + 61, 62, 74, 63, 64, 65, 66, 75, 77, 39, + 67, 78, 70, 71, 72, 81, 73, 79, 79, 79, + 79, 85, 86, 87, 74, 80, 80, 80, 80, 75, + 77, 89, 78, 90, 91, 96, 81, 92, 93, 94, + 95, 97, 85, 86, 99, 87, 101, 104, 103, 105, + 104, 116, 89, 106, 90, 107, 91, 96, 92, 93, + 94, 95, 97, 108, 112, 99, 113, 117, 101, 103, + 105, 118, 116, 104, 120, 106, 121, 107, 122, 125, + 128, 137, 130, 132, 137, 108, 112, 134, 113, 117, + + 135, 136, 139, 118, 104, 139, 120, 140, 121, 122, + 142, 125, 128, 130, 143, 132, 146, 0, 134, 147, + 149, 135, 136, 0, 139, 0, 0, 0, 140, 0, + 0, 142, 0, 0, 0, 143, 0, 0, 146, 0, + 147, 149, 0, 0, 0, 0, 139, 154, 154, 0, + 154, 154, 154, 155, 155, 156, 156, 0, 0, 156, + 156, 157, 0, 0, 0, 157, 153, 153, 153, 153, + 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, + 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, + 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, + + 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, + 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, + 153, 153, 153, 153, 153 } ; static yy_state_type yy_last_accepting_state; @@ -638,7 +640,7 @@ static void countnl() { Director::g_lingo->_colnumber = strlen(p); } -#line 642 "engines/director/lingo/lingo-lex.cpp" +#line 644 "engines/director/lingo/lingo-lex.cpp" #define INITIAL 0 @@ -826,7 +828,7 @@ YY_DECL #line 58 "engines/director/lingo/lingo-lex.l" -#line 830 "engines/director/lingo/lingo-lex.cpp" +#line 832 "engines/director/lingo/lingo-lex.cpp" if ( !(yy_init) ) { @@ -880,13 +882,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 152 ) + if ( yy_current_state >= 154 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 354 ); + while ( yy_base[yy_current_state] != 367 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1065,46 +1067,59 @@ YY_RULE_SETUP case 31: YY_RULE_SETUP #line 91 "engines/director/lingo/lingo-lex.l" -{ count(); return tTHEN; } +{ + count(); + + const char *ptr = &yytext[4]; // Skip 'the ' + while (*ptr == ' ' || *ptr == '\t') + ptr++; + + return tTHEN; + } YY_BREAK case 32: YY_RULE_SETUP -#line 92 "engines/director/lingo/lingo-lex.l" -{ count(); return tTO; } +#line 100 "engines/director/lingo/lingo-lex.l" +{ count(); return tTHEN; } YY_BREAK case 33: YY_RULE_SETUP -#line 93 "engines/director/lingo/lingo-lex.l" -{ count(); return tWITH; } +#line 101 "engines/director/lingo/lingo-lex.l" +{ count(); return tTO; } YY_BREAK case 34: YY_RULE_SETUP -#line 94 "engines/director/lingo/lingo-lex.l" -{ count(); return tWHILE; } +#line 102 "engines/director/lingo/lingo-lex.l" +{ count(); return tWITH; } YY_BREAK case 35: YY_RULE_SETUP -#line 96 "engines/director/lingo/lingo-lex.l" -{ count(); return tNEQ; } +#line 103 "engines/director/lingo/lingo-lex.l" +{ count(); return tWHILE; } YY_BREAK case 36: YY_RULE_SETUP -#line 97 "engines/director/lingo/lingo-lex.l" -{ count(); return tGE; } +#line 105 "engines/director/lingo/lingo-lex.l" +{ count(); return tNEQ; } YY_BREAK case 37: YY_RULE_SETUP -#line 98 "engines/director/lingo/lingo-lex.l" -{ count(); return tLE; } +#line 106 "engines/director/lingo/lingo-lex.l" +{ count(); return tGE; } YY_BREAK case 38: YY_RULE_SETUP -#line 99 "engines/director/lingo/lingo-lex.l" -{ count(); return tCONCAT; } +#line 107 "engines/director/lingo/lingo-lex.l" +{ count(); return tLE; } YY_BREAK case 39: YY_RULE_SETUP -#line 101 "engines/director/lingo/lingo-lex.l" +#line 108 "engines/director/lingo/lingo-lex.l" +{ count(); return tCONCAT; } + YY_BREAK +case 40: +YY_RULE_SETUP +#line 110 "engines/director/lingo/lingo-lex.l" { count(); yylval.s = new Common::String(yytext); @@ -1115,43 +1130,43 @@ YY_RULE_SETUP return ID; } YY_BREAK -case 40: +case 41: YY_RULE_SETUP -#line 110 "engines/director/lingo/lingo-lex.l" +#line 119 "engines/director/lingo/lingo-lex.l" { count(); yylval.f = atof(yytext); return FLOAT; } YY_BREAK -case 41: +case 42: YY_RULE_SETUP -#line 111 "engines/director/lingo/lingo-lex.l" +#line 120 "engines/director/lingo/lingo-lex.l" { count(); yylval.i = strtol(yytext, NULL, 10); return INT; } YY_BREAK -case 42: +case 43: YY_RULE_SETUP -#line 112 "engines/director/lingo/lingo-lex.l" +#line 121 "engines/director/lingo/lingo-lex.l" { count(); return *yytext; } YY_BREAK -case 43: -/* rule 43 can match eol */ +case 44: +/* rule 44 can match eol */ YY_RULE_SETUP -#line 113 "engines/director/lingo/lingo-lex.l" +#line 122 "engines/director/lingo/lingo-lex.l" { return '\n'; } YY_BREAK -case 44: +case 45: YY_RULE_SETUP -#line 114 "engines/director/lingo/lingo-lex.l" +#line 123 "engines/director/lingo/lingo-lex.l" { count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; } YY_BREAK -case 45: +case 46: YY_RULE_SETUP -#line 115 "engines/director/lingo/lingo-lex.l" +#line 124 "engines/director/lingo/lingo-lex.l" YY_BREAK -case 46: +case 47: YY_RULE_SETUP -#line 117 "engines/director/lingo/lingo-lex.l" +#line 126 "engines/director/lingo/lingo-lex.l" ECHO; YY_BREAK -#line 1155 "engines/director/lingo/lingo-lex.cpp" +#line 1170 "engines/director/lingo/lingo-lex.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1444,7 +1459,7 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 152 ) + if ( yy_current_state >= 154 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1472,11 +1487,11 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 152 ) + if ( yy_current_state >= 154 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 151); + yy_is_jam = (yy_current_state == 153); return yy_is_jam ? 0 : yy_current_state; } @@ -2151,7 +2166,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 117 "engines/director/lingo/lingo-lex.l" +#line 126 "engines/director/lingo/lingo-lex.l" diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l index b7dfecb803..6b14bfccd9 100644 --- a/engines/director/lingo/lingo-lex.l +++ b/engines/director/lingo/lingo-lex.l @@ -88,6 +88,15 @@ whitespace [\t ] (?i:repeat) { count(); return tREPEAT; } (?i:set) { count(); return tSET; } (?i:starts) { count(); return tSTARTS; } +(?i:the[ \t]+[:alpha:]+) { + count(); + + const char *ptr = &yytext[4]; // Skip 'the ' + while (*ptr == ' ' || *ptr == '\t') + ptr++; + + return tTHEN; + } (?i:then) { count(); return tTHEN; } (?i:to) { count(); return tTO; } (?i:with) { count(); return tWITH; } diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp index 410be8ed4f..b631732d09 100644 --- a/engines/director/lingo/lingo-the.cpp +++ b/engines/director/lingo/lingo-the.cpp @@ -26,11 +26,7 @@ namespace Director { class Sprite; -static struct TheEntityProto { - TheEntity entity; - const char *name; - int hasID; -} entities[] = { +TheEntity entities[] = { { kTheCast, "cast", INT }, // string? { kTheClickOn, "clickOn", VOID }, { kTheColorDepth, "colorDepth", VOID }, @@ -76,11 +72,7 @@ static struct TheEntityProto { { kTheNOEntity, NULL, false } }; -static struct TheEntityFieldProto { - TheEntity entity; - const char *name; - TheField field; -} fields[] = { +TheEntityField fields[] = { { kTheSprite, "backColor", kTheBackColor }, { kTheSprite, "blend", kTheBlend }, { kTheSprite, "bottom", kTheBottom }, @@ -110,7 +102,7 @@ static struct TheEntityFieldProto { { kTheSprite, "volume", kTheVolume }, { kTheSprite, "width", kTheWidth }, - //Common cast fields + // Common cast fields { kTheCast, "castType", kTheCastType }, { kTheCast, "filename", kTheFilename }, { kTheCast, "height", kTheHeight }, @@ -123,11 +115,11 @@ static struct TheEntityFieldProto { { kTheCast, "scriptText", kTheScriptText }, { kTheCast, "width", kTheWidth }, - //Shape fields + // Shape fields { kTheCast, "backColor", kTheBackColor }, { kTheCast, "foreColor", kTheForeColor }, - //Digital video fields + // Digital video fields { kTheCast, "controller", kTheController }, { kTheCast, "directToStage",kTheDirectToStage }, { kTheCast, "frameRate", kTheFrameRate }, @@ -136,13 +128,13 @@ static struct TheEntityFieldProto { { kTheCast, "preload", kThePreload }, { kTheCast, "sound", kTheSound }, // 0-1 off-on - //Bitmap fields + // Bitmap fields { kTheCast, "depth", kTheDepth }, { kTheCast, "regPoint", kTheRegPoint }, { kTheCast, "palette", kThePalette }, { kTheCast, "picture", kThePicture }, - //TextCast fields + // TextCast fields { kTheCast, "hilite", kTheHilite }, { kTheCast, "size", kTheSize }, { kTheCast, "text", kTheText }, @@ -165,7 +157,23 @@ static struct TheEntityFieldProto { { kTheNOEntity, NULL, kTheNOField } }; -void Lingo::setTheEntity(TheEntity entity, int id, TheField field, Datum &d) { +void Lingo::initTheEntities() { + TheEntity *e = entities; + + while (e->entity != kTheNOEntity) { + _theEntities[e->name] = e; + e++; + } + + TheEntityField *f = fields; + + while (f->entity != kTheNOEntity) { + _theEntityFields[f->name] = f; + f++; + } +} + +void Lingo::setTheEntity(TheEntityType entity, int id, TheFieldType field, Datum &d) { switch (entity) { case kTheSprite: setTheSprite(id, field, d); @@ -183,7 +191,7 @@ void Lingo::setTheEntity(TheEntity entity, int id, TheField field, Datum &d) { } } -void Lingo::setTheSprite(int id, TheField field, Datum &d) { +void Lingo::setTheSprite(int id, TheFieldType field, Datum &d) { Sprite *sprite = _vm->_currentScore->getSpriteById(id); d.toInt(); // Enforce Integer @@ -222,7 +230,7 @@ void Lingo::setTheSprite(int id, TheField field, Datum &d) { } } -Datum Lingo::getTheEntity(TheEntity entity, int id, TheField field) { +Datum Lingo::getTheEntity(TheEntityType entity, int id, TheFieldType field) { Datum d; switch (entity) { @@ -245,7 +253,7 @@ Datum Lingo::getTheEntity(TheEntity entity, int id, TheField field) { return d; } -Datum Lingo::getTheSprite(int id, TheField field) { +Datum Lingo::getTheSprite(int id, TheFieldType field) { Datum d; Sprite *sprite = _vm->_currentScore->getSpriteById(id); @@ -283,7 +291,7 @@ Datum Lingo::getTheSprite(int id, TheField field) { return d; } -Datum Lingo::getTheCast(int id, TheField field) { +Datum Lingo::getTheCast(int id, TheFieldType field) { Datum d; d.type = INT; @@ -335,7 +343,7 @@ Datum Lingo::getTheCast(int id, TheField field) { } } -void Lingo::setTheCast(int id, TheField field, Datum &d) { +void Lingo::setTheCast(int id, TheFieldType field, Datum &d) { Cast *cast = _vm->_currentScore->_casts[id]; switch (field) { case kTheCastType: diff --git a/engines/director/lingo/lingo-the.h b/engines/director/lingo/lingo-the.h index c3ee20fb04..c867b8dfc6 100644 --- a/engines/director/lingo/lingo-the.h +++ b/engines/director/lingo/lingo-the.h @@ -25,7 +25,7 @@ namespace Director { -enum TheEntity { +enum TheEntityType { kTheNOEntity = 0, kTheFrame = 1, kThePathName, @@ -74,7 +74,7 @@ enum TheEntity { kTheStage }; -enum TheField { +enum TheFieldType { kTheNOField = 0, kTheCastNum = 1, kTheCastType, @@ -135,6 +135,18 @@ enum TheField { kTheWidth }; +struct TheEntity { + TheEntityType entity; + const char *name; + int idType; +}; + +struct TheEntityField { + TheEntityType entity; + const char *name; + TheFieldType field; +}; + } // End of namespace Director #endif diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index 9e8e6f1280..5dc6c07d82 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -123,6 +123,9 @@ typedef Common::Array StackData; typedef Common::HashMap SymbolHash; typedef Common::HashMap BuiltinHash; +typedef Common::HashMap TheEntityHash; +typedef Common::HashMap TheEntityFieldHash; + struct CFrame { /* proc/func call stack frame */ Symbol *sp; /* symbol table entry */ int retpc; /* where to resume after return */ @@ -141,6 +144,7 @@ public: void processEvent(LEvent event, int entityId); void initBuiltIns(); + void initTheEntities(); Common::String *toLowercaseMac(Common::String *s); @@ -247,12 +251,12 @@ public: void func_gotoprevious(); public: - void setTheEntity(TheEntity entity, int id, TheField field, Datum &d); - void setTheSprite(int id, TheField field, Datum &d); - void setTheCast(int id, TheField field, Datum &d); - Datum getTheEntity(TheEntity entity, int id, TheField field); - Datum getTheSprite(int id, TheField field); - Datum getTheCast(int id, TheField field); + void setTheEntity(TheEntityType entity, int id, TheFieldType field, Datum &d); + void setTheSprite(int id, TheFieldType field, Datum &d); + void setTheCast(int id, TheFieldType field, Datum &d); + Datum getTheEntity(TheEntityType entity, int id, TheFieldType field); + Datum getTheSprite(int id, TheFieldType field); + Datum getTheCast(int id, TheFieldType field); public: ScriptData *_currentScript; @@ -263,6 +267,8 @@ public: Common::Array _callstack; Common::Array _argstack; BuiltinHash _builtins; + TheEntityHash _theEntities; + TheEntityFieldHash _theEntityFields; Common::Array _labelstack; int _linenumber; -- cgit v1.2.3