diff options
author | Eugene Sandulenko | 2016-08-16 23:58:30 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-16 23:58:30 +0200 |
commit | 9c0d9106509900c7faa42f2952474095a4bbbf11 (patch) | |
tree | 74597bcd0dbb4f69ae54819bdd3a15a469408110 /engines | |
parent | 4423bb0f1ddeafb19aabd3fb4e83c83ecb8fc0bb (diff) | |
download | scummvm-rg350-9c0d9106509900c7faa42f2952474095a4bbbf11.tar.gz scummvm-rg350-9c0d9106509900c7faa42f2952474095a4bbbf11.tar.bz2 scummvm-rg350-9c0d9106509900c7faa42f2952474095a4bbbf11.zip |
DIRECTOR: Lingo: Implement D2 version of 'the sqrt'
Diffstat (limited to 'engines')
-rw-r--r-- | engines/director/lingo/lingo-lex.cpp | 499 | ||||
-rw-r--r-- | engines/director/lingo/lingo-lex.l | 8 | ||||
-rw-r--r-- | engines/director/lingo/lingo-the.cpp | 6 | ||||
-rw-r--r-- | engines/director/lingo/lingo-the.h | 1 | ||||
-rw-r--r-- | engines/director/lingo/tests/math.lingo | 2 |
5 files changed, 281 insertions, 235 deletions
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp index 5fbd8d8653..6953c2b96f 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 56 -#define YY_END_OF_BUFFER 57 +#define YY_NUM_RULES 57 +#define YY_END_OF_BUFFER 58 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -373,28 +373,30 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[191] = +static yyconst flex_int16_t yy_accept[199] = { 0, - 0, 0, 57, 55, 3, 53, 53, 55, 55, 52, - 52, 52, 51, 52, 52, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 2, 2, 3, 53, 0, 0, 0, 0, - 0, 54, 48, 1, 50, 51, 47, 45, 46, 49, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 18, - 8, 49, 49, 49, 49, 49, 49, 49, 27, 49, - 29, 49, 49, 49, 49, 49, 49, 49, 49, 39, - 49, 49, 2, 2, 0, 1, 50, 4, 49, 49, - 49, 49, 12, 49, 49, 49, 49, 0, 49, 49, - - 49, 49, 49, 49, 26, 49, 49, 49, 32, 49, - 34, 49, 49, 49, 49, 49, 49, 0, 49, 6, - 7, 11, 14, 49, 49, 49, 0, 49, 20, 21, - 49, 49, 49, 25, 28, 30, 49, 49, 49, 49, - 0, 38, 43, 49, 41, 10, 49, 49, 15, 49, - 17, 49, 22, 49, 24, 49, 49, 49, 49, 37, - 44, 49, 0, 49, 49, 16, 49, 23, 49, 33, - 40, 35, 0, 42, 0, 49, 13, 49, 49, 0, - 9, 5, 49, 31, 0, 49, 0, 19, 36, 0 + 0, 0, 58, 56, 3, 54, 54, 56, 56, 53, + 53, 53, 52, 53, 53, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 2, 2, 3, 54, 0, 0, 0, 0, + 0, 55, 49, 1, 51, 52, 48, 46, 47, 50, + 50, 50, 50, 50, 50, 50, 50, 50, 50, 18, + 8, 50, 50, 50, 50, 50, 50, 50, 27, 50, + 29, 50, 50, 50, 50, 50, 50, 50, 50, 40, + 50, 50, 2, 2, 0, 1, 51, 4, 50, 50, + 50, 50, 12, 50, 50, 50, 50, 0, 50, 50, + + 50, 50, 50, 50, 26, 50, 50, 50, 32, 50, + 34, 50, 50, 50, 50, 50, 50, 0, 50, 6, + 7, 11, 14, 50, 50, 50, 0, 50, 20, 21, + 50, 50, 50, 25, 28, 30, 50, 50, 50, 50, + 0, 39, 44, 50, 42, 10, 50, 50, 15, 50, + 17, 50, 22, 50, 24, 50, 50, 50, 50, 38, + 38, 45, 50, 0, 50, 50, 16, 50, 23, 50, + 33, 41, 35, 0, 38, 43, 0, 50, 13, 50, + 50, 0, 38, 9, 5, 50, 31, 0, 38, 50, + 0, 0, 19, 37, 0, 0, 36, 0 + } ; static yyconst flex_int32_t yy_ec[256] = @@ -407,12 +409,12 @@ static yyconst flex_int32_t yy_ec[256] = 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, 37, 24, - 1, 1, 1, 7, 38, 1, 39, 40, 41, 42, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 24, + 1, 1, 1, 7, 39, 1, 40, 41, 42, 43, - 43, 44, 45, 46, 47, 24, 24, 48, 49, 50, - 51, 52, 24, 53, 54, 55, 56, 57, 58, 59, - 60, 24, 1, 1, 1, 1, 1, 1, 1, 1, + 44, 45, 46, 47, 48, 24, 24, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 24, 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, @@ -429,130 +431,139 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[61] = +static yyconst flex_int32_t yy_meta[63] = { 0, 1, 2, 3, 3, 2, 1, 1, 1, 1, 1, 4, 1, 1, 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 4, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 4, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 + 5, 5 } ; -static yyconst flex_int16_t yy_base[196] = +static yyconst flex_int16_t yy_base[204] = { 0, - 0, 59, 203, 452, 63, 67, 71, 75, 167, 452, - 157, 154, 52, 68, 143, 56, 0, 56, 57, 67, - 72, 68, 68, 69, 85, 102, 102, 104, 80, 119, - 113, 120, 173, 177, 181, 452, 185, 189, 193, 102, - 99, 452, 452, 0, 80, 129, 452, 452, 452, 0, - 91, 120, 165, 118, 126, 146, 184, 187, 171, 96, - 0, 172, 177, 189, 178, 177, 178, 184, 0, 188, - 0, 202, 199, 188, 192, 192, 199, 220, 219, 0, - 226, 208, 251, 262, 217, 0, 78, 0, 219, 227, - 230, 239, 0, 228, 229, 242, 256, 273, 257, 250, - - 251, 255, 263, 256, 0, 262, 253, 258, 0, 274, - 0, 271, 267, 304, 271, 274, 273, 284, 299, 0, - 0, 0, 0, 279, 297, 308, 297, 296, 0, 0, - 301, 304, 314, 0, 0, 0, 311, 320, 305, 307, - 156, 0, 0, 322, 319, 341, 321, 320, 0, 326, - 452, 322, 0, 327, 0, 328, 329, 344, 336, 370, - 0, 343, 375, 344, 341, 0, 345, 0, 348, 0, - 0, 0, 380, 0, 363, 355, 0, 372, 360, 372, - 452, 0, 363, 0, 394, 366, 398, 0, 400, 452, - 431, 433, 438, 442, 446 - + 0, 61, 156, 509, 65, 69, 73, 77, 148, 509, + 104, 99, 54, 70, 91, 58, 0, 58, 59, 69, + 74, 70, 70, 71, 88, 105, 105, 110, 82, 118, + 117, 130, 177, 181, 185, 509, 189, 193, 197, 106, + 94, 509, 509, 0, 82, 132, 509, 509, 509, 0, + 84, 119, 169, 116, 120, 174, 186, 191, 180, 171, + 0, 176, 182, 194, 181, 180, 181, 186, 0, 202, + 0, 208, 205, 193, 198, 197, 204, 225, 225, 0, + 233, 214, 258, 270, 223, 0, 80, 0, 225, 226, + 237, 234, 0, 233, 234, 242, 260, 278, 265, 257, + + 258, 265, 271, 263, 0, 270, 260, 264, 0, 281, + 0, 279, 273, 303, 280, 289, 293, 297, 303, 0, + 0, 0, 0, 296, 307, 317, 301, 303, 0, 0, + 308, 309, 320, 0, 0, 0, 319, 329, 313, 314, + 347, 0, 0, 331, 332, 202, 333, 328, 0, 337, + 509, 331, 0, 347, 0, 340, 339, 347, 341, 301, + 372, 0, 349, 383, 357, 351, 0, 363, 0, 359, + 0, 0, 0, 393, 399, 0, 374, 367, 0, 392, + 373, 390, 409, 509, 0, 379, 0, 413, 420, 384, + 422, 436, 0, 441, 408, 442, 446, 509, 488, 490, + + 495, 499, 503 } ; -static yyconst flex_int16_t yy_def[196] = +static yyconst flex_int16_t yy_def[204] = { 0, - 190, 1, 190, 190, 190, 190, 190, 190, 191, 190, - 190, 190, 190, 190, 190, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 190, 190, 190, 190, 190, 190, 190, 190, - 191, 190, 190, 193, 190, 190, 190, 190, 190, 192, - 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 190, 190, 190, 193, 190, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 190, 192, 192, - - 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 190, 192, 192, - 192, 192, 192, 192, 192, 192, 190, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 192, 192, 192, - 194, 192, 192, 192, 192, 190, 192, 192, 192, 192, - 190, 192, 192, 192, 192, 192, 192, 192, 192, 194, - 192, 192, 190, 192, 192, 192, 192, 192, 192, 192, - 192, 192, 190, 192, 190, 192, 192, 192, 192, 190, - 190, 192, 192, 192, 190, 192, 195, 192, 195, 0, - 190, 190, 190, 190, 190 - + 198, 1, 198, 198, 198, 198, 198, 198, 199, 198, + 198, 198, 198, 198, 198, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 198, 198, 198, 198, 198, 198, 198, 198, + 199, 198, 198, 201, 198, 198, 198, 198, 198, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 198, 198, 198, 201, 198, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 198, 200, 200, + + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 198, 200, 200, + 200, 200, 200, 200, 200, 200, 198, 200, 200, 200, + 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, + 202, 200, 200, 200, 200, 198, 200, 200, 200, 200, + 198, 200, 200, 200, 200, 200, 200, 200, 200, 202, + 202, 200, 200, 198, 200, 200, 200, 200, 200, 200, + 200, 200, 200, 198, 202, 200, 198, 200, 200, 200, + 200, 198, 202, 198, 200, 200, 200, 198, 202, 200, + 203, 198, 200, 203, 198, 198, 203, 0, 198, 198, + + 198, 198, 198 } ; -static yyconst flex_int16_t yy_nxt[513] = +static yyconst flex_int16_t yy_nxt[572] = { 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, 17, 17, 16, 17, - 18, 19, 20, 21, 22, 17, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 17, 17, 32, 17, 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, 57, 61, 87, 40, - 87, 54, 59, 55, 62, 60, 63, 98, 75, 64, - - 98, 58, 56, 65, 42, 51, 52, 53, 88, 40, - 57, 61, 66, 40, 54, 59, 55, 62, 60, 63, - 67, 69, 75, 64, 58, 56, 85, 65, 72, 68, - 70, 71, 88, 73, 79, 66, 74, 76, 45, 46, - 80, 81, 82, 93, 67, 69, 89, 77, 92, 85, - 78, 72, 68, 70, 71, 49, 73, 141, 79, 74, - 141, 76, 44, 80, 43, 81, 82, 93, 94, 89, - 77, 92, 42, 78, 83, 36, 36, 84, 84, 36, - 36, 84, 35, 36, 36, 37, 37, 36, 36, 37, - 38, 90, 94, 38, 38, 39, 39, 38, 97, 91, - - 95, 96, 190, 99, 100, 101, 106, 40, 190, 102, - 103, 40, 190, 104, 90, 105, 107, 108, 190, 109, - 110, 97, 91, 111, 95, 96, 99, 100, 112, 101, - 106, 40, 102, 103, 113, 40, 104, 114, 105, 117, - 107, 108, 109, 110, 115, 120, 111, 118, 116, 190, - 119, 112, 83, 36, 36, 84, 121, 122, 113, 123, - 124, 114, 117, 84, 36, 36, 84, 125, 115, 120, - 118, 126, 116, 119, 98, 128, 132, 98, 130, 121, - 131, 122, 123, 124, 129, 133, 190, 134, 135, 136, - 125, 137, 138, 139, 145, 126, 140, 143, 144, 128, - - 132, 130, 146, 131, 127, 141, 148, 129, 141, 133, - 134, 135, 136, 147, 137, 149, 138, 139, 145, 140, - 143, 144, 150, 190, 151, 152, 146, 127, 153, 148, - 142, 154, 155, 156, 157, 190, 158, 147, 159, 149, - 161, 162, 163, 164, 168, 163, 150, 151, 152, 165, - 166, 153, 167, 142, 154, 169, 155, 156, 157, 158, - 170, 159, 171, 178, 161, 162, 172, 164, 168, 174, - 176, 173, 165, 166, 173, 167, 163, 177, 169, 163, - 179, 173, 181, 170, 173, 182, 171, 178, 183, 172, - 184, 185, 174, 176, 186, 187, 188, 175, 187, 187, - - 177, 190, 187, 179, 190, 190, 181, 180, 182, 190, - 190, 190, 183, 184, 190, 185, 190, 186, 190, 188, - 190, 175, 190, 190, 190, 190, 190, 190, 190, 190, - 180, 41, 41, 190, 41, 41, 50, 50, 86, 86, - 190, 86, 86, 160, 190, 190, 160, 189, 190, 190, - 189, 3, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190 + 22, 17, 23, 17, 24, 25, 26, 27, 28, 17, + 29, 30, 31, 17, 17, 32, 17, 17, 17, 16, + 17, 18, 19, 20, 21, 22, 17, 23, 24, 25, + 26, 27, 28, 17, 29, 30, 31, 17, 17, 32, + 17, 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, 57, 61, + 87, 40, 87, 54, 59, 55, 62, 60, 63, 42, + + 75, 88, 64, 49, 58, 56, 65, 44, 51, 52, + 53, 43, 40, 57, 61, 66, 40, 54, 59, 55, + 62, 60, 63, 67, 69, 75, 88, 64, 58, 56, + 85, 65, 68, 70, 72, 71, 76, 93, 79, 66, + 73, 45, 46, 74, 80, 89, 77, 92, 67, 69, + 78, 81, 82, 42, 85, 198, 68, 70, 72, 71, + 198, 76, 93, 79, 73, 198, 198, 74, 80, 89, + 77, 92, 98, 198, 78, 98, 81, 82, 83, 36, + 36, 84, 84, 36, 36, 84, 35, 36, 36, 37, + 37, 36, 36, 37, 38, 90, 94, 38, 38, 39, + + 39, 38, 95, 164, 91, 96, 164, 97, 99, 100, + 101, 40, 198, 102, 103, 40, 198, 104, 105, 90, + 106, 94, 107, 108, 198, 109, 110, 95, 91, 111, + 96, 97, 99, 100, 112, 101, 40, 102, 103, 113, + 40, 104, 105, 114, 120, 106, 117, 107, 108, 109, + 110, 115, 122, 111, 118, 116, 198, 119, 112, 83, + 36, 36, 84, 121, 113, 123, 124, 125, 114, 120, + 117, 84, 36, 36, 84, 126, 115, 122, 118, 98, + 116, 119, 98, 128, 198, 130, 132, 121, 131, 123, + 124, 125, 129, 133, 198, 134, 135, 136, 137, 138, + + 126, 139, 174, 140, 141, 174, 143, 141, 128, 130, + 127, 132, 131, 144, 145, 146, 129, 147, 133, 134, + 135, 136, 137, 148, 138, 149, 139, 140, 151, 142, + 143, 150, 198, 152, 127, 153, 154, 144, 155, 145, + 146, 156, 147, 157, 198, 158, 159, 148, 141, 162, + 149, 141, 151, 142, 163, 165, 150, 152, 166, 153, + 154, 167, 168, 155, 169, 172, 156, 170, 157, 158, + 159, 171, 173, 174, 162, 176, 174, 198, 161, 163, + 165, 180, 166, 178, 164, 167, 168, 164, 179, 169, + 172, 170, 181, 184, 174, 171, 173, 174, 185, 176, + + 174, 175, 161, 174, 187, 177, 180, 178, 186, 188, + 174, 190, 179, 174, 191, 193, 181, 191, 184, 198, + 182, 192, 185, 191, 192, 175, 191, 196, 187, 183, + 177, 198, 198, 186, 188, 190, 198, 192, 198, 193, + 192, 189, 198, 197, 182, 198, 197, 197, 198, 198, + 197, 198, 196, 183, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 195, 198, 189, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 195, 41, 41, + 198, 41, 41, 50, 50, 86, 86, 198, 86, 86, + + 160, 198, 198, 160, 194, 198, 198, 194, 3, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198 } ; -static yyconst flex_int16_t yy_chk[513] = +static yyconst flex_int16_t yy_chk[572] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -560,57 +571,63 @@ static yyconst flex_int16_t yy_chk[513] = 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, 21, 23, 87, 7, - 45, 20, 22, 20, 23, 22, 24, 60, 29, 25, - - 60, 21, 20, 25, 41, 16, 18, 19, 51, 6, - 21, 23, 25, 7, 20, 22, 20, 23, 22, 24, - 26, 27, 29, 25, 21, 20, 40, 25, 28, 26, - 27, 27, 51, 28, 31, 25, 28, 30, 46, 46, - 31, 32, 32, 55, 26, 27, 52, 30, 54, 40, - 30, 28, 26, 27, 27, 15, 28, 141, 31, 28, - 141, 30, 12, 31, 11, 32, 32, 55, 56, 52, - 30, 54, 9, 30, 33, 33, 33, 33, 34, 34, - 34, 34, 35, 35, 35, 35, 37, 37, 37, 37, - 38, 53, 56, 38, 39, 39, 39, 39, 59, 53, - - 57, 58, 3, 62, 63, 64, 70, 38, 0, 65, - 66, 39, 0, 67, 53, 68, 72, 73, 0, 74, - 75, 59, 53, 76, 57, 58, 62, 63, 77, 64, - 70, 38, 65, 66, 78, 39, 67, 79, 68, 82, - 72, 73, 74, 75, 81, 90, 76, 85, 81, 0, - 89, 77, 83, 83, 83, 83, 91, 92, 78, 94, - 95, 79, 82, 84, 84, 84, 84, 96, 81, 90, - 85, 97, 81, 89, 98, 99, 102, 98, 100, 91, - 101, 92, 94, 95, 99, 103, 0, 104, 106, 107, - 96, 108, 110, 112, 117, 97, 113, 115, 116, 99, - - 102, 100, 118, 101, 98, 114, 124, 99, 114, 103, - 104, 106, 107, 119, 108, 125, 110, 112, 117, 113, - 115, 116, 126, 0, 127, 128, 118, 98, 131, 124, - 114, 132, 133, 137, 138, 0, 139, 119, 140, 125, - 144, 145, 146, 147, 154, 146, 126, 127, 128, 148, - 150, 131, 152, 114, 132, 156, 133, 137, 138, 139, - 157, 140, 158, 167, 144, 145, 159, 147, 154, 162, - 164, 160, 148, 150, 160, 152, 163, 165, 156, 163, - 169, 173, 175, 157, 173, 176, 158, 167, 178, 159, - 179, 180, 162, 164, 183, 185, 186, 163, 185, 187, - - 165, 189, 187, 169, 189, 0, 175, 173, 176, 0, - 0, 0, 178, 179, 0, 180, 0, 183, 0, 186, - 0, 163, 0, 0, 0, 0, 0, 0, 0, 0, - 173, 191, 191, 0, 191, 191, 192, 192, 193, 193, - 0, 193, 193, 194, 0, 0, 194, 195, 0, 0, - 195, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - - 190, 190, 190, 190, 190, 190, 190, 190, 190, 190, - 190, 190 + 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, 21, 23, + 87, 7, 45, 20, 22, 20, 23, 22, 24, 41, + + 29, 51, 25, 15, 21, 20, 25, 12, 16, 18, + 19, 11, 6, 21, 23, 25, 7, 20, 22, 20, + 23, 22, 24, 26, 27, 29, 51, 25, 21, 20, + 40, 25, 26, 27, 28, 27, 30, 55, 31, 25, + 28, 46, 46, 28, 31, 52, 30, 54, 26, 27, + 30, 32, 32, 9, 40, 3, 26, 27, 28, 27, + 0, 30, 55, 31, 28, 0, 0, 28, 31, 52, + 30, 54, 60, 0, 30, 60, 32, 32, 33, 33, + 33, 33, 34, 34, 34, 34, 35, 35, 35, 35, + 37, 37, 37, 37, 38, 53, 56, 38, 39, 39, + + 39, 39, 57, 146, 53, 58, 146, 59, 62, 63, + 64, 38, 0, 65, 66, 39, 0, 67, 68, 53, + 70, 56, 72, 73, 0, 74, 75, 57, 53, 76, + 58, 59, 62, 63, 77, 64, 38, 65, 66, 78, + 39, 67, 68, 79, 90, 70, 82, 72, 73, 74, + 75, 81, 92, 76, 85, 81, 0, 89, 77, 83, + 83, 83, 83, 91, 78, 94, 95, 96, 79, 90, + 82, 84, 84, 84, 84, 97, 81, 92, 85, 98, + 81, 89, 98, 99, 0, 100, 102, 91, 101, 94, + 95, 96, 99, 103, 0, 104, 106, 107, 108, 110, + + 97, 112, 160, 113, 114, 160, 115, 114, 99, 100, + 98, 102, 101, 116, 117, 118, 99, 119, 103, 104, + 106, 107, 108, 124, 110, 125, 112, 113, 127, 114, + 115, 126, 0, 128, 98, 131, 132, 116, 133, 117, + 118, 137, 119, 138, 0, 139, 140, 124, 141, 144, + 125, 141, 127, 114, 145, 147, 126, 128, 148, 131, + 132, 150, 152, 133, 154, 158, 137, 156, 138, 139, + 140, 157, 159, 161, 144, 163, 161, 0, 141, 145, + 147, 168, 148, 165, 164, 150, 152, 164, 166, 154, + 158, 156, 170, 177, 174, 157, 159, 174, 178, 163, + + 175, 161, 141, 175, 181, 164, 168, 165, 180, 182, + 183, 186, 166, 183, 188, 190, 170, 188, 177, 0, + 174, 189, 178, 191, 189, 161, 191, 195, 181, 175, + 164, 0, 0, 180, 182, 186, 0, 192, 0, 190, + 192, 183, 194, 196, 174, 194, 196, 197, 0, 0, + 197, 0, 195, 175, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 192, 0, 183, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 192, 199, 199, + 0, 199, 199, 200, 200, 201, 201, 0, 201, 201, + + 202, 0, 0, 202, 203, 0, 0, 203, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198 } ; static yy_state_type yy_last_accepting_state; @@ -684,7 +701,7 @@ static void countnl() { g_lingo->_colnumber = strlen(p); } -#line 688 "engines/director/lingo/lingo-lex.cpp" +#line 705 "engines/director/lingo/lingo-lex.cpp" #define INITIAL 0 @@ -872,7 +889,7 @@ YY_DECL #line 69 "engines/director/lingo/lingo-lex.l" -#line 876 "engines/director/lingo/lingo-lex.cpp" +#line 893 "engines/director/lingo/lingo-lex.cpp" if ( !(yy_init) ) { @@ -926,13 +943,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 >= 191 ) + if ( yy_current_state >= 199 ) 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] != 452 ); + while ( yy_base[yy_current_state] != 509 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1139,6 +1156,18 @@ YY_RULE_SETUP { count(); + yylval.e[0] = g_lingo->_theEntities["sqrt"]->entity; + yylval.e[1] = 0; // No field + + return THEENTITYWITHID; + } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 115 "engines/director/lingo/lingo-lex.l" +{ + count(); + const char *ptr = &yytext[4]; // Skip 'the ' while (*ptr == ' ' || *ptr == '\t') ptr++; @@ -1177,9 +1206,9 @@ YY_RULE_SETUP warning("Unhandled the entity %s", ptr); } YY_BREAK -case 37: +case 38: YY_RULE_SETUP -#line 147 "engines/director/lingo/lingo-lex.l" +#line 155 "engines/director/lingo/lingo-lex.l" { count(); @@ -1200,64 +1229,64 @@ YY_RULE_SETUP warning("Unhandled the entity %s", ptr); } YY_BREAK -case 38: +case 39: YY_RULE_SETUP -#line 166 "engines/director/lingo/lingo-lex.l" +#line 174 "engines/director/lingo/lingo-lex.l" { count(); return tTHEN; } YY_BREAK -case 39: +case 40: YY_RULE_SETUP -#line 167 "engines/director/lingo/lingo-lex.l" +#line 175 "engines/director/lingo/lingo-lex.l" { count(); return tTO; } YY_BREAK -case 40: +case 41: YY_RULE_SETUP -#line 168 "engines/director/lingo/lingo-lex.l" +#line 176 "engines/director/lingo/lingo-lex.l" { count(); return tSPRITE; } YY_BREAK -case 41: +case 42: YY_RULE_SETUP -#line 169 "engines/director/lingo/lingo-lex.l" +#line 177 "engines/director/lingo/lingo-lex.l" { count(); return tWITH; } YY_BREAK -case 42: +case 43: YY_RULE_SETUP -#line 170 "engines/director/lingo/lingo-lex.l" +#line 178 "engines/director/lingo/lingo-lex.l" { count(); return tWITHIN; } YY_BREAK -case 43: +case 44: YY_RULE_SETUP -#line 171 "engines/director/lingo/lingo-lex.l" +#line 179 "engines/director/lingo/lingo-lex.l" { count(); return tWHEN; } YY_BREAK -case 44: +case 45: YY_RULE_SETUP -#line 172 "engines/director/lingo/lingo-lex.l" +#line 180 "engines/director/lingo/lingo-lex.l" { count(); return tWHILE; } YY_BREAK -case 45: +case 46: YY_RULE_SETUP -#line 174 "engines/director/lingo/lingo-lex.l" +#line 182 "engines/director/lingo/lingo-lex.l" { count(); return tNEQ; } YY_BREAK -case 46: +case 47: YY_RULE_SETUP -#line 175 "engines/director/lingo/lingo-lex.l" +#line 183 "engines/director/lingo/lingo-lex.l" { count(); return tGE; } YY_BREAK -case 47: +case 48: YY_RULE_SETUP -#line 176 "engines/director/lingo/lingo-lex.l" +#line 184 "engines/director/lingo/lingo-lex.l" { count(); return tLE; } YY_BREAK -case 48: +case 49: YY_RULE_SETUP -#line 177 "engines/director/lingo/lingo-lex.l" +#line 185 "engines/director/lingo/lingo-lex.l" { count(); return tCONCAT; } YY_BREAK -case 49: +case 50: YY_RULE_SETUP -#line 179 "engines/director/lingo/lingo-lex.l" +#line 187 "engines/director/lingo/lingo-lex.l" { count(); yylval.s = new Common::String(yytext); @@ -1285,43 +1314,43 @@ YY_RULE_SETUP return ID; } YY_BREAK -case 50: +case 51: YY_RULE_SETUP -#line 205 "engines/director/lingo/lingo-lex.l" +#line 213 "engines/director/lingo/lingo-lex.l" { count(); yylval.f = atof(yytext); return FLOAT; } YY_BREAK -case 51: +case 52: YY_RULE_SETUP -#line 206 "engines/director/lingo/lingo-lex.l" +#line 214 "engines/director/lingo/lingo-lex.l" { count(); yylval.i = strtol(yytext, NULL, 10); return INT; } YY_BREAK -case 52: +case 53: YY_RULE_SETUP -#line 207 "engines/director/lingo/lingo-lex.l" +#line 215 "engines/director/lingo/lingo-lex.l" { count(); return *yytext; } YY_BREAK -case 53: -/* rule 53 can match eol */ +case 54: +/* rule 54 can match eol */ YY_RULE_SETUP -#line 208 "engines/director/lingo/lingo-lex.l" +#line 216 "engines/director/lingo/lingo-lex.l" { return '\n'; } YY_BREAK -case 54: +case 55: YY_RULE_SETUP -#line 209 "engines/director/lingo/lingo-lex.l" +#line 217 "engines/director/lingo/lingo-lex.l" { count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; } YY_BREAK -case 55: +case 56: YY_RULE_SETUP -#line 210 "engines/director/lingo/lingo-lex.l" +#line 218 "engines/director/lingo/lingo-lex.l" YY_BREAK -case 56: +case 57: YY_RULE_SETUP -#line 212 "engines/director/lingo/lingo-lex.l" +#line 220 "engines/director/lingo/lingo-lex.l" ECHO; YY_BREAK -#line 1325 "engines/director/lingo/lingo-lex.cpp" +#line 1354 "engines/director/lingo/lingo-lex.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1614,7 +1643,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 >= 191 ) + if ( yy_current_state >= 199 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1642,11 +1671,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 >= 191 ) + if ( yy_current_state >= 199 ) 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 == 190); + yy_is_jam = (yy_current_state == 198); return yy_is_jam ? 0 : yy_current_state; } @@ -2321,7 +2350,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 212 "engines/director/lingo/lingo-lex.l" +#line 220 "engines/director/lingo/lingo-lex.l" diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l index 8c89a99764..3fca137e38 100644 --- a/engines/director/lingo/lingo-lex.l +++ b/engines/director/lingo/lingo-lex.l @@ -104,6 +104,14 @@ whitespace [\t ] (?i:repeat) { count(); return tREPEAT; } (?i:set) { count(); return tSET; } (?i:starts) { count(); return tSTARTS; } +(?i:the[ \t]+sqrt[\t ]+of[\t ]+) { + count(); + + yylval.e[0] = g_lingo->_theEntities["sqrt"]->entity; + yylval.e[1] = 0; // No field + + return THEENTITYWITHID; + } (?i:the[ \t]+[[:alpha:]]+[\t ]+of[\t ]+[[:alpha:]]+) { count(); diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp index 20bccf35ac..6579de2f94 100644 --- a/engines/director/lingo/lingo-the.cpp +++ b/engines/director/lingo/lingo-the.cpp @@ -73,6 +73,7 @@ TheEntity entities[] = { { kTheSelection, "selection", false }, { kTheShiftDown, "shiftDown", false }, { kTheSprite, "sprite", true }, + { kTheSqrt, "sqrt", false }, { kTheStage, "stage", false }, { kTheStillDown, "stillDown", false }, { kTheTicks, "ticks", false }, @@ -327,6 +328,11 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) { d.type = INT; d.u.i = _floatPrecision; break; + case kTheSqrt: + id.toFloat(); + d.type = FLOAT; + d.u.f = sqrt(id.u.f); + break; default: warning("Unprocessed getting field %d of entity %d", field, entity); d.type = VOID; diff --git a/engines/director/lingo/lingo-the.h b/engines/director/lingo/lingo-the.h index 0649ebe0b0..9ce8e6fb17 100644 --- a/engines/director/lingo/lingo-the.h +++ b/engines/director/lingo/lingo-the.h @@ -71,6 +71,7 @@ enum TheEntityType { kTheResult, kTheSelection, kTheShiftDown, + kTheSqrt, kTheOptionDown, kTheColorDepth, diff --git a/engines/director/lingo/tests/math.lingo b/engines/director/lingo/tests/math.lingo index 6f8ecc374f..f38b061b6a 100644 --- a/engines/director/lingo/tests/math.lingo +++ b/engines/director/lingo/tests/math.lingo @@ -20,3 +20,5 @@ updatestage put (1024/4096)*100 -- 0 put (1024/4096)*100.0 -- 0.0 put ((1024*1.0)/4096)*100.0 -- 25.0 + +put the sqrt of 9 |