[Scummvm-cvs-logs] scummvm master -> 902d49ce099df7ce8bb5eb1b6ea4c00f63d69c86
sev-
sev at scummvm.org
Thu Aug 4 13:26:49 CEST 2016
This automated email contains information about 354 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a243b5cb33 DIRECTOR: Add engine skeleton
8c252aa830 DIRECTOR: Add basic resource code
50c52ab3fb DIRECTOR: Fix RIFX files inside of EXE's
a24668ff79 DIRECTOR: Add majestic detection
eb16a726e9 DIRECTOR: Add basic v3-5 exe parsing
45a387c481 DIRECTOR: Add detection for Spy Club
60ba99ac41 DIRECTOR: Fix RIFF offsets
0f7fb5ad65 DIRECTOR: Parse the main MMM file in v3 Windows games
f6399b7d13 DIRECTOR: Fix some v3 exe fields
09f6949cbc DIRECTOR: Add JMP Turbo Mac detection
9a9df86fde DIRECTOR: Parse the RIFX from v4 Mac versions
d870127ddb DIRECTOR: Mac v3 games just use the resource fork of the executable to start
bba8bb4c33 DIRECTOR: Add v5 Mac data fork parsing
b4cf46486d DIRECTOR: Add gundam0079 mac detection
c607b85a46 DIRECTOR: Add parsing support for v7
387833ace4 DIRECTOR: Add detection for Jewels of the Oracle
4a334980e1 DIRECTOR: Add some simple Windows version fallback detection
649ef2af67 DIRECTOR: Fix stupid mistake in v3 fallback
5e08747978 DIRECTOR: Add detection for jman Japanese
30de1f34ca DIRECTOR: Fix getting RIFF resources
a9849314e8 DIRECTOR: Change tag comparison to be case-insensitive
de61313e94 DIRECTOR: Fix RIFX support to actually be useful
c5379909e2 DIRECTOR: Add detection for AMBER.
0deda5b8b1 DIRECTOR: Add detection for The Vampire's Coffin.
8d8c9b3e87 DIRECTOR: Fix version in error message.
04ea338dac DIRECTOR: Add detection for The Last Dinosaur Egg.
14450b017f DIRECTOR: Rename variables to match changes to AdvancedMetaEngine.
2d7d95bc19 DIRECTOR: Add initial for support DIB resource
fc4f6087ac GIT: Add a basic .gitignore file
b621fd7762 DIRECTOR: Add detection for "Masters of the Elements"
1ebb5d2b07 DIRECTOR: Add ADGF_MACRESFORK to melements target
acc0d70054 DIRECTOR: Add bookshelf example
75a01e0ea0 DIRECTOR: Refactoring palette loading
c2414ae381 DIRECTOR: Display test bitmap resource
1a3d44edc9 DIRECTOR: Fix image loading, moved displaying to the engine
9ed9a60116 DIRECTOR: Fix DIB file reading
08641d688d DIRECTOR: FIX load palette
2de66ee083 DIRECTOR: Add score data loader
11c9bbd9cb DIRECTOR: Play score, display DIB sprites
60348aa02a DIRECTOR: Read movie version
5718268106 DIRECTOR: Load cast data and movie config
d17805e132 DIRECTOR: Add cast pointers to sprites
ce2889bbf4 DIRECTOR: Display objects with offsets
8cd7deb476 DIRECTOR: Add support for tempo channel
5ffd839bf3 DIRECTOR: Improve detection of Masters of the Elements
604fa102ff DIRECTOR: Fix frame playback
44e46db5de DIRECTOR: Refactor cast data loading
d7f1c98f29 DIRECTOR: Remove extra movie archive open
6299055098 DIRECTOR: Add ink types parsing
fb6e06231c DIRECTOR: Move sprite display to ManagedSurface
2e87ca4954 DIRECTOR: Fix cast data reading
c42f4060a1 DIRECTOR: Fix display sprite bug
961adeee7f DIRECTOR: Add support for background trans, matte ink types
f858362284 DIRECTOR: Move score loading resource to constructor
254b1e3c1f DIRECTOR: Load labels
4819a4e857 DIRECTOR: Load actions
1b71712b15 DIRECTOR: Display draw rects for debug
910803a914 DIRECTOR: Change matte function, use FloodFill
f954105320 DIRECTOR: Switch Matte Ink to using flood fill mask mode.
bd345ce81c DIRECTOR: Parse mac name
06a655ff9d DIRECTOR: Fix bitmap cast reading
cc2abbbb9c DIRECTOR: Use pixel(0,0) for Matte ink
14d0bb6844 DIRECTOR: Find CLUT table in score initialization
e17de45075 DIRECTOR: Fix tempo channel parsing, add missed events
1b6b24740e DIRECTOR: Add cast info loading
414a0b1c35 DIRECTOR: Add file info loading, fix strings loading
61f15f16da DIRECTOR: Add font map loading
f471b48cf4 DIRECTOR: Fix guard includes
fd7b2f33bf DIRECTOR: Added stub for Lingo interpreter
bc2e73c20b DIRECTOR: Add dump scripts
cd0e04f672 DIRECTOR: Check if file is open, rename dump folder
a0276402d0 DIRECTOR: Add user actions, sprite, movie events to lingo events
1099838bbd DIRECTOR: Fix load actions
d01fddfa6b DIRECTOR: Add transition types
fd3c336860 DIRECTOR: Refactor in accordance with Director Loop, generate main lingo events
c9ac498cf0 DIRECTOR: Add initial sound playback support
8064274d3b DIRECTOR: Change order events (Director 4.0)
2b57a711f6 DIRECTOR: Fix palette loading
c7657b994a DIRECTOR: Generate mouse events
51843bc3b3 DIRECTOR: Fix memory leak
0c7f2cedd7 DIRECTOR: Storage CastInfo, format strings
049500d5ba DIRECTOR: Added stub parser. Now just arithmetic expressions.
e4428587b7 DIRECTOR: Support 2 tracking sound system
824c3fb661 DIRECTOR: Added stub for 'mci' Lingo command
f2b0abbafc DIRECTOR: Lingo, added put/set functions and support for multiline input
45a57ce9b7 DIRECTOR: Lingo: Add support for '--' comments
4e2b3f449e DIRECTOR: Lingo: Moved func_mci() to a separate file
df50e60b1a DIRECTOR: Lingo: fixed String passing from lexer to parser
75d759c4d8 DIRECTOR: Lingo: Implement MCI command parsing
106e629210 DIRECTOR: Lingo: Add support for boolean flags in MCI
23b289f2f8 DIRECTOR: Add support for trail sprites
e51e28cf7e DIRECTOR: Parse transition flags
055fb9e1bf DIRECTOR: Handle cover up/down transitions
487ce6a02c DIRECTOR: Read palette info, handle wait sound events
82094ed5c9 DIRECTOR: Process events in transitions
2387e72104 DIRECTOR: Play sound from MCI command
bd05d98fa5 DIRECTOR: Add support for to/from MCI play options
82daeb9e62 DIRECTOR: Add stub for storage code
c520b45247 DIRECTOR: Fix Matte Ink.
d3b49ba509 DIRECTOR: Format code, send movie, sprite scripts to Lingo
16a2b7e7c3 DIRECTOR: Add other cover transitions such as cover left, right, down right, down left, up right, up left
ddcaad4a11 DIRECTOR: Parse common STXT scripts
511c0d9f7b DIRECTOR: Dump movie scripts, and scripts from cast info
d90a8605d2 DIRECTOR: Fix sprite draw rects issues
4b56951d30 DIRECTOR: Started work on converting Lingo into compiler
7607ba926c DIRECTOR: Whitespace fixes
2f8640c33a DIRECTOR: Parse movie archive separately Load mac name and labels in the constructor
23c79a2786 DIRECTOR: Add parsing mac names from folder
f58de432c5 DIRECTOR: Lingo: Fix script compilation
612a480f9b DIRECTOR: Lingo: Added mciwait function stub
57e092ab8f DIRECTOR: Fix indentation
6b5c0626f7 DIRECTOR: Load palette directly to engine
6a0e3945cf DIRECTOR: Set engine pointer in Frame
36df662863 DIRECTOR: Handle transition chunk size exception
dfdb194957 DIRECTOR: Fix Matte ink rendering
0fa5505d65 DIRECTOR: Hide noisy debug messages
9d72e0137b DIRECTOR: Fix trail surface bug
bb7125620d DIRECTOR: Lingo: Move all functions to compiler
6cb2a3cd00 DIRECTOR: Fix crash on exit
53dceb95f7 DIRECTOR: Lingo: Swithc to warning() on syntax error, and avoid printing values
6d2a7aa759 DIRECTOR: Lingo: Fix codeString() method
7760ea8d86 DIRECTOR: Lingo: Beginning of the stack definition
5bbfea01fe DIRECTOR: Lingo: Added some lingo-func code
f675f9be93 DIRECTOR: Add initial code for QuickTime video
632a07500f DIRECTOR: Fix trans initialization
952c2ceabd DIRECTOR: Add some enums for cast structures
a5b69ca37d DIRECTOR: Handle Ghost, Reverse ink types
76282dc9d7 DIRECTOR: Lingo: Added printing func
b3676907c5 DIRECTOR: Lingo: Implemented script execution
3476761be6 DIRECTOR: Lingo: Fix func_constpush() and made it portable
c0a3e652eb DIRECTOR: Lingo: Enable parse debug
238d150f41 DIRECTOR: Lingo: Fix multiline statements, fix leading whitespace handling
4a536c57f1 DIRECTOR: Lingo: Implement func_neg()
81b056ffc1 DIRECTOR: Lingo: Add missing funcs
5db0d15bc2 DIRECTOR: Lingo: Simpler token constants
4109e85890 DIRECTOR: Lingo: Fix string alignment computation
da4db91941 DIRECTOR: Lingo: Implement 'go' and 'go to' functions
d5587eb45d DIRECTOR: Lingo: Rearrange 'go to' grammar for better readability
cd7a6abe78 DIRECTOR: Lingo: Attempt to start basic error recovery implementation
bdbb5582aa DIRECTOR: Lingo: Updated copyright and added 'macro' keyword documentation
908bcf2065 DIRECTOR: Lingo: Initial code for 'if' statements
0567ac9707 DIRECTOR: Lingo: Fix variable accessing
31329a62a9 DIRECTOR: Lingo: Implement 'put' function
a7ec15f77a DIRECTOR: Lingvo: Fix 'put' function
db2380077f DIRECTOR: Lingo: Implement logical operators
34acb99ec5 DIRECTOR: Lingo: Fix 'if' statement
f2920602e5 DIRECTOR: Lingo: Make 'if' statement functional. Added 'if-else' statement.
79a91588b8 DIRECTOR: Lingo: Split out opcodes from actual function implementations
6983f3f68b DIRECTOR: Lingo: Renamed func_->c_ and exec_->func_->
fc144c716c DIRECTOR: Lingo: Documented 'repeat' control commands
8fb7aaf4a0 DIRECTOR: Lingo: Renamed UNDEF -> VOID
46d60a7941 DIRECTOR: Lingo: Implement 'repeat while' control keyword
db8e68c6b6 DIRECTOR: Lingo: Fix code generation
ad9e2fd0e5 DIRECTOR: Lingo: Fix subexpressions
0f3295c98f DIRECTOR: Lingo: Initial code for 'repeat with' control keyword
8362f79329 DIRECTOR: Lingo: Further work on the 'repeat with' control keyword
82756b34fe DIRECTOR: Lingo: Fix 'repeat with' control keyword implementation
587461108e DIRECTOR: Lingo: Implement 'repeat with down' control keyword
cd133e7e0c DIRECTOR: Lingo: Initial grammar for 'macro' keyword
c376b12d6b DIRECTOR: Lingo: Fix parsing multiple macros
a06e794a94 DIRECTOR: Lingo: Added named parameter assignment for macros
1cf381db2a DIRECTOR: Lingo: Generate STOP at the macro end
0f3f6ba7eb DIRECTOR: Lingo: Initial implementation of the handler define() method
61e80e158b DIRECTOR: Lingo: Made the unassigned variable match the original
2451bed128 DIRECTOR: Lingo: Renamed VAR->ID in the grammar for clarity
2b6f00fc1a DIRECTOR: Lingo: Removed redundant endianness specification in READ/WRITE
0c4d0155d5 DIRECTOR: Lingo: Avoid printing out unrecognizet tokens in lexer
327e625507 DIRECTOR: Lingo: Make all keywords case-insensitive
aee02d7282 DIRECTOR: Lingo: Initial code for function call grammar
a910fe22db DIRECTOR: Lingo: Refactoring for ID-related code generation
c48f1b5756 DIRECTOR: Lingo: Implement calling user-defined functions without parameters
6dc858a041 DIRECTOR: Lingo: Issue warning on handler redefinition
3d543c62ba DIRECTOR: Lingo: Initial code for c_call()
125600a91f DIRECTOR: Lingo: Initial implementation of c_procret()
9524980508 DIRECTOR: Lingo: Disable debugging code
cc9d17c5eb DIRECTOR: Support goto command in Score
9ba86b960c DIRECTOR: Refactoring renderSprite
b2a152dd54 DIRECTOR: Lingo: Fix handler calling
8a884ad08c DIRECTOR: Change ReadStream to ReadStreamEndian
e93960e200 DIRECTOR: Add to Score jump labels commands
d440a73a41 DIRECTOR: Lingo: Fix handler parameter assigning. Added more debug output.
840487d2ef DIRECTOR: Lingo: Parse macro definitions reliably
825a9fb29f DIRECTOR: Load shared casts in engine
e1e7051bf2 DIRECTOR: Support goto frame jump
29e8752fca DIRECTOR: Lingo: Parse continuation arguments in macros
2523bed5db DIRECTOR: Lingo: Split out the code gen functions into a separate file.
24a25820e8 DIRECTOR: Fix warning
3e0bf3a03c DIRECTOR: Lingo: Parsing of macro calls without parens.
ad9e955b1e DIRECTOR: Lingo: Add type to stack
9d46e4587b DIRECTOR: Lingo: Ignore trailing spaces in scripts
16cca8054a DIRECTOR: Lingo: Move macro grammar to more logical spot in the file
9319eee100 DIRECTOR: Loading shared DIB, STXT
aac6c9695a DIRECTOR: Execute goto scripts
0b9e3607a0 DIRECTOR: Using shared casts for rendering
30ced4a4e2 DIRECTOR: Lingo: Fix warning
839ac90f61 DIRECTOR: Lingo: Fixed argument order in macros, simplified grammar.
9fff6529a3 DIRECTOR: Lingo: SImplified arg processing at macro definition.
19ae959bdd DIRECTOR: Lingo: Actually let VOID vars to pass.
038a3ca293 DIRECTOR: Change Labels HashMap to SortedArray
4b871b62e5 DIRECTOR: Renew shared resources when loading new folder
7013f6bb40 DIRECTOR: Lingo: Implemented 'global' keyword. Start of local/global var implementation
7164b1531c DIRECTOR: Fix code style violation
aaf8448cbc DIRECTOR: Add loading shared casts for Director version > 3
b208b8e5ff DIRECTOR: Fix memory corruption
30db02c87e DIRECTOR: Handle some differences beetwen D1-3 and D4-6
256727964c DIRECTOR: Render bitmaps
bba7efff11 DIRECTOR: Lingo: C++-ify structs
0f65b9abb3 DIRECTOR: Lingo: Stub for context creation
a279faf251 DIRECTOR: Fix warning
0b6d950729 DIRECTOR: Lingo: Store and restore local variables in scope.
c53e4b579a DIRECTOR: Lingo: Make global/local vars work
d70a76f1d6 DIRECTOR: Lingo: Make 'global' accept list of variables
0f58203c02 DIRECTOR: Fix rendering resource, loading shared BMP
b460a7c036 DIRECTOR: Calculate values for text rendering
2ad3d3a236 DIRECTOR: Simple text rendering
061f868d79 DIRECTOR: Free memory, fix render text ID
8cc88b6fca DIRECTOR: Lingo: Initial code for built-in functions
610075cc15 DIRECTOR: Lingo: Make built-in functions work (sometimes)
953c57944e DIRECTOR: Make built-in functions work (always)
50163b3c44 DIRECTOR: Lingo: Implement one-line version of 'if' statement
2d08b87524 DIRECTOR: Added random source
8a7411fb97 DIRECTOR: Lingo: Complete Rand() function implementation
56d51f9c1d DIRECTOR: Loading Classic Mac fonts
1b0e546745 DIRECTOR: Assignment some TextCast unknows
32fb9a3344 DIRECTOR: Draw string with mac fonts
ca40ccd9d1 DIRECTOR: Lingo: Added float constants and automatic type conversion
95c14371e7 DIRECTOR: Lingo: Differentiate built-in function from IDs
4b9b1f3c2d DIRECTOR: Fix crash on deinitialization
36d7addda9 DIRECTOR: Fix another crash on exit
196044aeae DIRECTOR: Lingo: Implement 'exit' command
e08f8bbe43 DIRECTOR: Lingo: Fix toInt()
7327f0b86e DIRECTOR: Lingo: Implement more built-in math functions
48b9ae7d69 DIRECTOR: Lingo: Implemented rest of math functions
3cf8510c41 DIRECTOR: Lingo: Process D3-style cast references
260c44beed DIRECTOR: Handle text gutter/border box
b62089ed95 DIRECTOR: Fix image resource checking
f4325f30ef DIRECTOR: Lingo: Started 'else if' implementation
350f81635f DIRECTOR: Render checkbox and button rectangles
eb724af3ea DIRECTOR: Lingo: Parse basic 'else if' clause
05f89c2a1b DIRECTOR: Lingo: Parsing one-liner 'else if'
97e80a0c7a DIRECTOR: Lingo: Added support for two line if/else
22baf62312 DIRECTOR: Lingo: Added stub for 'the' entities
78555a4d3f DIRECTOR: Lingo: Stub for labelstack
7ecc1f8da7 DIRECTOR: Lingo: Initial code for processIf()
6d3f596a25 DIRECTOR: Lingo: Add Cast, Window, Sprite fields enum
fb51685b07 DIRECTOR: Lingo: Add Menu, MenuItem, key, script entity enum
bb469dc84d DIRECTOR: Lingo: Set/Get common sprite fields
22f72fc2a7 DIRECTOR: Lingo: Optimise 'the' setters and getters.
2dba6126b7 DIRECTOR: Lingo: Eat all leading whitespaces
eb4ef6db56 DIRECTOR: Lingo: Fix if() generation
df62619363 DIRECTOR: Properly initialize class variables
b4670f6029 JANITORIAL: Whitespace fixes
207609ac09 DIRECTOR: Lingo: Fix 'else if' statement execution
b5cfcd05f6 DIRECTOR: Lingo: Switched right recursion to left in program rule
aac3497b73 DIRECTOR: Lingo: Switched elsestmt rule to left recursion for more effectiveness
445bf8f5da DIRECTOR: Add sprite controlling fields
98603a48d5 DIRECTOR: Lingo: Change hasID to int
1808dcdc30 DIRECTOR: Add modified flag, Lingo: Handle some common cast fields
d7bdda559d DIRECTOR: Lingo: Merged if and oneline if grammar
e7a4f22b59 DIRECTOR: Lingo: More work on if statement overhaul
7710390ab4 Revert "DIRECTOR: Lingo: More work on if statement overhaul"
a6ded367c8 DIRECTOR: Lingo: Further work on one-liner ifs
2415a4cb41 DIRECTOR: Lingo: Fix mixing of one-line and multi-line ifs
1745917752 DIRECTOR: Lingo: Further work on combined if statements
6636c9006b DIRECTOR: Lingo: Provide error position in the file
bfe252edac DIRECTOR: Lingo: Fix multiline if statements
336f0bee9d DIRECTOR: Lingo: Suport multiple one-line 'else if' statements
4763228ef3 DIRECTOR: Lingo: Added string constants as expressions
598be95ab4 DIRECTOR: Lingo: Support string Datum printing
cca71376b7 DIRECTOR: Lingo: Implemented '&' string operator
caa2988293 DIRECTOR: Lingo: Fixed c_eval and made correctly processing different types
458d1e5f78 DIRECTOR: Lingo: Aligned Datum and Symbol union member names
82f78708e7 DIRECTOR: Lingo: Fixed <> operator, added logical operations and &&
a8498f41a0 DIRECTOR: Lingo: Made & and && work with any type
40856e6d06 DIRECTOR: Lingo: Implemented string() built-in function
bb8fd6a899 DIRECTOR: Lingo: Implemented length() built-in function
8084989605 DIRECTOR: Lingo: Implemented chars() function and added more debug for type printing
da408c0ad0 DIRECTOR: Lingo: Implement 'contains' and 'starts' string operators
0b64438dbd DIRECTOR: Lingo: Added more 'the' entities. Implemented the floatPrecision entity
996b909b0e DIRECTOR: Lingo: FLOAT actually has to have double precision. Switching.
4552b2b056 JANITORIAL: Fix whitespaces
1673eeba70 DIRECTOR: Lingo: Print VOID type
e11c036ba8 DIRECTOR: Lingo: Fix multiline if() statements
31ec69c0e8 DIRECTOR: Added detection for Spaceship Warlock
6b4cff2645 DIRECTOR: Added detection for Windows JMP version
1f0005c4e2 DIRECTOR: Lingo: Initial code for Lingo test suite. Uses special game target
46138a2c9d DIRECTOR: Lingo: Made addCode() accept const char *
9c8848b8ff DIRECTOR: Dump scripts before execution, not after
bb7e9b64b6 DIRECTOR: Unify dumpScript() signature
855db111fc DIRECTOR: Lingo: Execute test suite
aa45e48355 DIRECTOR: Lingo: Better error recovery and further work on if() statements
dff575bea4 DIRECTOR: Lingo: Further work on if() statement
c4e1d08d4a DIRECTOR: Added default Mac palette
7f87a90179 DIRECTOR: Lingo: Fix crash on parse error
d86b95b307 DIRECTOR: Lingo: Fix compilation for scripts with no leading spaces
ffdb3f9d0f DIRECTOR: Lingo: Fix if() statement code generation
4d2e4a8c73 DIRECTOR: Lingo: Nicer error recovery during execution
5e99a9858b DIRECTOR: Lingo: Gracefully return when movie does not exits
903f57ab2d DIRECTOR: Lingo: Fix loop test
847b1c0a03 DIRECTOR: Lingo: Do not error out on unacceptable characters in toLowercaseMac()
fa4c1710d1 DIRECTOR: Lingo: Smoother tests handling
d72670e29d DIRECTOR: Lingo: Fix multiline if() statement
52fa9646b0 DIRECTOR: Lingo: Improved support for multiple 'else if' statements
3a4fbc9367 DIRECTOR: Lingo: Initial code for 'the' entity handling
8136267ada DIRECTOR: Lingo: Use namespace in lexer
e15915b6a3 DIRECTOR: Lingo: Process simple 'the' entities
9763b62a78 DIRECTOR: Lingo: Implement getting the entity fields
d08e030da6 DIRECTOR: Lingo: Implement setting the entity fields
0ad467f832 DIRECTOR: Lingo: Do not error out on non-existent sprites/casts
fb81d0b823 DIRECTOR: Lingo: Better error handling for 'the' entities
c6406042af DIRECTOR: Lingo: Extended 'the' test
8b20d3d67b DIRECTOR: Lingo: Distinguish same name the fields for different the entities
a84d8c44e4 DIRECTOR: Lingo: Initial code for splitting factory and method input
7c0bb9e6a1 DIRECTOR: Lingo: Added 'factory' keyword test
2676e252e4 DIRECTOR: Lingo: Added bytecode doc from http://fileformats.archiveteam.org/wiki/Lingo_bytecode
e1b2759d06 DIRECTOR: Lingo: Initial code for factory/method definition
5f0f0193f9 DIRECTOR: Lingo: Fix splitting code to sections
78b198cee9 DIRECTOR: Lingo: Added support for parameter-less built-ins
2e0078ef06 DIRECTOR: Lingo: Fix line counting in code chunks
29b6f3edbb DIRECTOR: Lingo: Stub for when/then statement
d53ff7b180 DIRECTOR: Lingo: Initial stub for 'intersects' operator
9172820158 DIRECTOR: Lingo: Fix 'intersects' operator parsing and added 'within' operator
21730e9d7e DIRECTOR: Lingo: Cast references could be lowercase too
e56295df63 DIRECTOR: Lingo: Use M_PI constant instead of hardcode
7fd25e98f1 DIRECTOR: Lingo: Added basic support for points
ba3cf6181c DIRECTOR: Lingo: Implemented ilk() function
3fb7f5ac7b DIRECTOR: Lingo: Plug memory leak at assignment
06dd3651c7 DIRECTOR: Lingo: Issue warning instead of error at unhandled types
3882a54ade DIRECTOR: Lingo: Added updateStage stub
f7009628cc DIRECTOR: Lingo: Added tests for type conversion
991e58b177 BUILD: Added *.output to git ignore list
36fa951f60 DIRECTOR: Remove leftover .gitignore
f0990e7221 DIRECTOR: Add extra fields for sprites
240988fad4 DIRECTOR: Add enum for sprite types
d9db9863ce DIRECTOR: Lingo: Add extra sprite and string fields to "the entities"
c8f0b74a63 JANITORIAL: Whitespace fixes
783ff8f8f2 DIRECTOR: Lingo: Turn builtins into normal symbols
dc498881ef DIRECTOR: Lingo: Process extra or too few arguments for built-ins
fa7725a5f5 DIRECTOR: Lingo: Fix stack underflow on not enough parameters
f67bcdc141 DIRECTOR: Lingo: Simplify CodeId
62c0700588 DIRECTOR: Lingo: Extended factory test to one from Warlock D5.safe-movie-1
8a29870a8a DIRECTOR: Lingo: Put codeFunc into separate function
0bda622337 DIRECTOR: Lingo: Implemented 'me' function support for factories
503ff47b0b DIRECTOR: Added detection for 'The Apartment'
9067257cf0 DIRECTOR: Fix Mac archive reading.
af3ca5ba0d DIRECTOR: Correct startup sequence
b2d5c25e2f DIRECTOR: Lingo: Do not error() on syntax errors
5414a0ec2c DIRECTOR: Lingo: Added stub fot 'the keycode' entity
d9cf5af9f0 DIRECTOR: Lingo: Do not error out on unknown entities
0aba35e266 DIRECTOR: More debug output
8618cbb6cb DIRECTOR: Fix engine initialization
59ebb0c68f DIRECTOR: Switch Mac font loading to the common code
96e288c4c9 DIRECTOR: Update font generation
902d49ce09 Merge pull request #787 from sev-/director
Commit: a243b5cb33b36b6cc0f3e92b76dad5714a87942e
https://github.com/scummvm/scummvm/commit/a243b5cb33b36b6cc0f3e92b76dad5714a87942e
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add engine skeleton
Changed paths:
A engines/director/configure.engine
A engines/director/detection.cpp
A engines/director/detection_tables.h
A engines/director/director.cpp
A engines/director/director.h
A engines/director/module.mk
diff --git a/engines/director/configure.engine b/engines/director/configure.engine
new file mode 100644
index 0000000..41f9a62
--- /dev/null
+++ b/engines/director/configure.engine
@@ -0,0 +1,3 @@
+# This file is included from the main "configure" script
+# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
+add_engine director "Macromedia Director" no
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
new file mode 100644
index 0000000..0a7af66
--- /dev/null
+++ b/engines/director/detection.cpp
@@ -0,0 +1,102 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "base/plugins.h"
+
+#include "engines/advancedDetector.h"
+#include "common/savefile.h"
+#include "common/system.h"
+#include "common/textconsole.h"
+
+#include "director/director.h"
+
+namespace Director {
+
+struct DirectorGameDescription {
+ ADGameDescription desc;
+
+ DirectorGameID gameID;
+ uint16 version;
+};
+
+DirectorGameID DirectorEngine::getGameID() const {
+ return _gameDescription->gameID;
+}
+
+Common::Platform DirectorEngine::getPlatform() const {
+ return _gameDescription->desc.platform;
+}
+
+uint16 DirectorEngine::getVersion() const {
+ return _gameDescription->version;
+}
+
+Common::Language DirectorEngine::getLanguage() const {
+ return _gameDescription->desc.language;
+}
+
+bool DirectorEngine::hasFeature(EngineFeature f) const {
+ return
+ (f == kSupportsRTL);
+}
+
+} // End of Namespace Director
+
+static const PlainGameDescriptor directorGames[] = {
+ { "director", "Macromedia Director Game" },
+ { "gundam0079", "Gundam 0079: The War for Earth" },
+ { 0, 0 }
+};
+
+#include "director/detection_tables.h"
+
+class DirectorMetaEngine : public AdvancedMetaEngine {
+public:
+ DirectorMetaEngine() : AdvancedMetaEngine(Director::gameDescriptions, sizeof(Director::DirectorGameDescription), directorGames) {
+ _singleid = "director";
+ }
+
+ virtual const char *getName() const {
+ return "Macromedia Director";
+ }
+
+ virtual const char *getOriginalCopyright() const {
+ return "Macromedia Director (C) Macromedia";
+ }
+
+ virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
+};
+
+bool DirectorMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ const Director::DirectorGameDescription *gd = (const Director::DirectorGameDescription *)desc;
+
+ if (gd)
+ *engine = new Director::DirectorEngine(syst, gd);
+
+ return (gd != 0);
+}
+
+#if PLUGIN_ENABLED_DYNAMIC(DIRECTOR)
+ REGISTER_PLUGIN_DYNAMIC(DIRECTOR, PLUGIN_TYPE_ENGINE, DirectorMetaEngine);
+#else
+ REGISTER_PLUGIN_STATIC(DIRECTOR, PLUGIN_TYPE_ENGINE, DirectorMetaEngine);
+#endif
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
new file mode 100644
index 0000000..7bb2c33
--- /dev/null
+++ b/engines/director/detection_tables.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DIRECTOR_DETECTION_TABLES_H
+#define DIRECTOR_DETECTION_TABLES_H
+
+namespace Director {
+
+static const DirectorGameDescription gameDescriptions[] = {
+ {
+ {
+ "gundam0079",
+ "",
+ AD_ENTRY1("Gundam0079.exe", "1a7acbba10a7246ba58c1d53fc7203f5"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 5
+ },
+
+ { AD_TABLE_END_MARKER, GID_GENERIC, 0 }
+};
+
+} // End of Namespace Director
+
+#endif
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
new file mode 100644
index 0000000..840692a
--- /dev/null
+++ b/engines/director/director.cpp
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "audio/mixer.h"
+
+#include "common/scummsys.h"
+#include "common/error.h"
+#include "common/system.h"
+#include "common/textconsole.h"
+
+#include "director/director.h"
+
+namespace Director {
+
+DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
+ if (!_mixer->isReady())
+ error("Sound initialization failed");
+
+ // Setup mixer
+ syncSoundSettings();
+}
+
+DirectorEngine::~DirectorEngine() {
+}
+
+Common::Error DirectorEngine::run() {
+ return Common::kNoError;
+}
+
+} // End of namespace Director
diff --git a/engines/director/director.h b/engines/director/director.h
new file mode 100644
index 0000000..6fe173c
--- /dev/null
+++ b/engines/director/director.h
@@ -0,0 +1,63 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DIRECTOR_DIRECTOR_H
+#define DIRECTOR_DIRECTOR_H
+
+#include "common/scummsys.h"
+
+#include "engines/engine.h"
+
+class OSystem;
+
+namespace Director {
+
+enum DirectorGameID {
+ GID_GENERIC
+};
+
+struct DirectorGameDescription;
+
+class DirectorEngine : public ::Engine {
+public:
+ DirectorEngine(OSystem *syst, const DirectorGameDescription *gameDesc);
+ ~DirectorEngine();
+
+ // Detection related functions
+
+ DirectorGameID getGameID() const;
+ uint16 getVersion() const;
+ Common::Platform getPlatform() const;
+ Common::Language getLanguage() const;
+
+ bool hasFeature(EngineFeature f) const;
+
+protected:
+ virtual Common::Error run();
+
+private:
+ const DirectorGameDescription *_gameDescription;
+};
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/module.mk b/engines/director/module.mk
new file mode 100644
index 0000000..122ff6c
--- /dev/null
+++ b/engines/director/module.mk
@@ -0,0 +1,13 @@
+MODULE := engines/director
+
+MODULE_OBJS = \
+ detection.o \
+ director.o
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_DIRECTOR), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
Commit: 8c252aa830296fa138a892baf6fee121807c0797
https://github.com/scummvm/scummvm/commit/8c252aa830296fa138a892baf6fee121807c0797
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add basic resource code
Changed paths:
A engines/director/resource.cpp
A engines/director/resource.h
engines/director/module.mk
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 122ff6c..ef47485 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -2,7 +2,8 @@ MODULE := engines/director
MODULE_OBJS = \
detection.o \
- director.o
+ director.o \
+ resource.o
# This module can be built as a plugin
ifeq ($(ENABLE_DIRECTOR), DYNAMIC_PLUGIN)
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
new file mode 100644
index 0000000..da664a4
--- /dev/null
+++ b/engines/director/resource.cpp
@@ -0,0 +1,307 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "director/resource.h"
+
+#include "common/debug.h"
+#include "common/macresman.h"
+#include "common/substream.h"
+#include "common/util.h"
+#include "common/textconsole.h"
+
+namespace Director {
+
+// Base Archive code
+
+Archive::Archive() {
+ _stream = 0;
+}
+
+Archive::~Archive() {
+ close();
+}
+
+bool Archive::openFile(const Common::String &fileName) {
+ Common::File *file = new Common::File();
+
+ if (!file->open(fileName)) {
+ delete file;
+ return false;
+ }
+
+ if (!openStream(file)) {
+ close();
+ return false;
+ }
+
+ return true;
+}
+
+void Archive::close() {
+ _types.clear();
+ delete _stream; _stream = 0;
+}
+
+bool Archive::hasResource(uint32 tag, uint16 id) const {
+ if (!_types.contains(tag))
+ return false;
+
+ return _types[tag].contains(id);
+}
+
+bool Archive::hasResource(uint32 tag, const Common::String &resName) const {
+ if (!_types.contains(tag) || resName.empty())
+ return false;
+
+ const ResourceMap &resMap = _types[tag];
+
+ for (ResourceMap::const_iterator it = resMap.begin(); it != resMap.end(); it++)
+ if (it->_value.name.matchString(resName))
+ return true;
+
+ return false;
+}
+
+Common::SeekableReadStream *Archive::getResource(uint32 tag, uint16 id) {
+ if (!_types.contains(tag))
+ error("Archive does not contain '%s' %04x", tag2str(tag), id);
+
+ const ResourceMap &resMap = _types[tag];
+
+ if (!resMap.contains(id))
+ error("Archive does not contain '%s' %04x", tag2str(tag), id);
+
+ const Resource &res = resMap[id];
+
+ return new Common::SeekableSubReadStream(_stream, res.offset, res.offset + res.size);
+}
+
+uint32 Archive::getOffset(uint32 tag, uint16 id) const {
+ if (!_types.contains(tag))
+ error("Archive does not contain '%s' %04x", tag2str(tag), id);
+
+ const ResourceMap &resMap = _types[tag];
+
+ if (!resMap.contains(id))
+ error("Archive does not contain '%s' %04x", tag2str(tag), id);
+
+ return resMap[id].offset;
+}
+
+uint16 Archive::findResourceID(uint32 tag, const Common::String &resName) const {
+ if (!_types.contains(tag) || resName.empty())
+ return 0xFFFF;
+
+ const ResourceMap &resMap = _types[tag];
+
+ for (ResourceMap::const_iterator it = resMap.begin(); it != resMap.end(); it++)
+ if (it->_value.name.matchString(resName))
+ return it->_key;
+
+ return 0xFFFF;
+}
+
+Common::String Archive::getName(uint32 tag, uint16 id) const {
+ if (!_types.contains(tag))
+ error("Archive does not contain '%s' %04x", tag2str(tag), id);
+
+ const ResourceMap &resMap = _types[tag];
+
+ if (!resMap.contains(id))
+ error("Archive does not contain '%s' %04x", tag2str(tag), id);
+
+ return resMap[id].name;
+}
+
+Common::Array<uint32> Archive::getResourceTypeList() const {
+ Common::Array<uint32> typeList;
+
+ for (TypeMap::const_iterator it = _types.begin(); it != _types.end(); it++)
+ typeList.push_back(it->_key);
+
+ return typeList;
+}
+
+Common::Array<uint16> Archive::getResourceIDList(uint32 type) const {
+ Common::Array<uint16> idList;
+
+ if (!_types.contains(type))
+ return idList;
+
+ const ResourceMap &resMap = _types[type];
+
+ for (ResourceMap::const_iterator it = resMap.begin(); it != resMap.end(); it++)
+ idList.push_back(it->_key);
+
+ return idList;
+}
+
+// Mac Archive code
+
+MacArchive::MacArchive() : Archive(), _resFork(0) {
+}
+
+MacArchive::~MacArchive() {
+ delete _resFork;
+}
+
+void MacArchive::close() {
+ Archive::close();
+ delete _resFork;
+ _resFork = 0;
+}
+
+bool MacArchive::openFile(const Common::String &fileName) {
+ close();
+
+ _resFork = new Common::MacResManager();
+
+ if (!_resFork->open(fileName) || !_resFork->hasResFork()) {
+ close();
+ return false;
+ }
+
+ Common::MacResTagArray tagArray = _resFork->getResTagArray();
+
+ for (uint32 i = 0; i < tagArray.size(); i++) {
+ ResourceMap &resMap = _types[tagArray[i]];
+ Common::MacResIDArray idArray = _resFork->getResIDArray(tagArray[i]);
+
+ for (uint32 j = 0; j < idArray.size(); j++) {
+ Resource &res = resMap[idArray[j]];
+ res.offset = res.size = 0; // unused
+ res.name = _resFork->getResName(tagArray[i], idArray[j]);
+ }
+ }
+
+
+ return true;
+}
+
+bool MacArchive::openStream(Common::SeekableReadStream *stream) {
+ // TODO: Add support for this (v4 Windows games)
+ return false;
+}
+
+Common::SeekableReadStream *MacArchive::getResource(uint32 tag, uint16 id) {
+ assert(_resFork);
+ return _resFork->getResource(tag, id);
+}
+
+// RIFF Archive code
+
+bool RIFFArchive::openStream(Common::SeekableReadStream *stream) {
+ close();
+
+ if (stream->readUint32BE() != MKTAG('R', 'I', 'F', 'F'))
+ return false;
+
+ stream->readUint32LE(); // size
+
+ if (stream->readUint32BE() != MKTAG('R', 'M', 'M', 'P'))
+ return false;
+
+ if (stream->readUint32BE() != MKTAG('C', 'F', 'T', 'C'))
+ return false;
+
+ uint32 cftcSize = stream->readUint32LE();
+ uint32 startPos = stream->pos();
+
+ while ((uint32)stream->pos() < startPos + cftcSize) {
+ uint32 offset = stream->readUint32LE();
+ uint32 tag = stream->readUint32BE();
+ uint32 size = stream->readUint32LE();
+ uint32 id = stream->readUint32LE();
+
+ if (tag == 0)
+ break;
+
+ ResourceMap &resMap = _types[tag];
+ Resource &res = resMap[id];
+ res.offset = offset;
+ res.size = size;
+ }
+
+ _stream = stream;
+ return true;
+}
+
+
+// RIFX Archive code
+
+bool RIFXArchive::openStream(Common::SeekableReadStream *stream) {
+ close();
+
+ uint32 tag = stream->readUint32BE();
+ bool isBigEndian;
+
+ if (tag == MKTAG('R', 'I', 'F', 'X'))
+ isBigEndian = true;
+ else if (SWAP_BYTES_32(tag) == MKTAG('R', 'I', 'F', 'X'))
+ isBigEndian = false;
+ else
+ return false;
+
+ Common::SeekableSubReadStreamEndian subStream(stream, 4, stream->size(), isBigEndian, DisposeAfterUse::NO);
+
+ subStream.readUint32(); // size
+
+ if (subStream.readUint32() != MKTAG('M', 'V', '9', '3'))
+ return false;
+
+ if (subStream.readUint32() != MKTAG('i', 'm', 'a', 'p'))
+ return false;
+
+ subStream.readUint32(); // imap length
+ subStream.readUint32(); // unknown
+ uint32 mmapOffset = subStream.readUint32() - 4;
+
+ subStream.seek(mmapOffset);
+
+ if (subStream.readUint32() != MKTAG('m', 'm', 'a', 'p'))
+ return false;
+
+ subStream.readUint32(); // mmap length
+ subStream.readUint16(); // unknown
+ subStream.readUint16(); // unknown
+ subStream.readUint32(); // resCount + empty entries
+ uint32 resCount = subStream.readUint32();
+ subStream.skip(8); // all 0xFF
+ subStream.readUint32(); // unknown
+
+ for (uint32 i = 0; i < resCount; i++) {
+ tag = subStream.readUint32();
+ uint32 size = subStream.readUint32();
+ uint32 offset = subStream.readUint32();
+ subStream.skip(8); // always 0?
+
+ ResourceMap &resMap = _types[tag];
+ Resource &res = resMap[i]; // FIXME: What is the ID? Is this setup even viable?
+ res.offset = offset;
+ res.size = size;
+ }
+
+ _stream = stream;
+ return true;
+}
+
+} // End of namespace Director
diff --git a/engines/director/resource.h b/engines/director/resource.h
new file mode 100644
index 0000000..f757c9c
--- /dev/null
+++ b/engines/director/resource.h
@@ -0,0 +1,107 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/scummsys.h"
+#include "common/endian.h"
+#include "common/hashmap.h"
+#include "common/file.h"
+#include "common/str.h"
+
+#ifndef DIRECTOR_RESOURCE_H
+#define DIRECTOR_RESOURCE_H
+
+namespace Common {
+class MacResManager;
+}
+
+namespace Director {
+
+// Completely ripped off of Mohawk's Archive code
+
+class Archive {
+public:
+ Archive();
+ virtual ~Archive();
+
+ virtual bool openFile(const Common::String &fileName);
+ virtual bool openStream(Common::SeekableReadStream *stream) = 0;
+ virtual void close();
+
+ bool isOpen() const { return _stream != 0; }
+
+ bool hasResource(uint32 tag, uint16 id) const;
+ bool hasResource(uint32 tag, const Common::String &resName) const;
+ virtual Common::SeekableReadStream *getResource(uint32 tag, uint16 id);
+ uint32 getOffset(uint32 tag, uint16 id) const;
+ uint16 findResourceID(uint32 tag, const Common::String &resName) const;
+ Common::String getName(uint32 tag, uint16 id) const;
+
+ Common::Array<uint32> getResourceTypeList() const;
+ Common::Array<uint16> getResourceIDList(uint32 type) const;
+
+protected:
+ Common::SeekableReadStream *_stream;
+
+ struct Resource {
+ uint32 offset;
+ uint32 size;
+ Common::String name;
+ };
+
+ typedef Common::HashMap<uint16, Resource> ResourceMap;
+ typedef Common::HashMap<uint32, ResourceMap> TypeMap;
+ TypeMap _types;
+};
+
+class MacArchive : public Archive {
+public:
+ MacArchive();
+ ~MacArchive();
+
+ void close();
+ bool openFile(const Common::String &fileName);
+ bool openStream(Common::SeekableReadStream *stream);
+ Common::SeekableReadStream *getResource(uint32 tag, uint16 id);
+
+private:
+ Common::MacResManager *_resFork;
+};
+
+class RIFFArchive : public Archive {
+public:
+ RIFFArchive() : Archive() {}
+ ~RIFFArchive() {}
+
+ bool openStream(Common::SeekableReadStream *stream);
+};
+
+class RIFXArchive : public Archive {
+public:
+ RIFXArchive() : Archive() {}
+ ~RIFXArchive() {}
+
+ bool openStream(Common::SeekableReadStream *stream);
+};
+
+} // End of namespace Director
+
+#endif
Commit: 50c52ab3fb74f2994e02dbcac5337dfffbefbafd
https://github.com/scummvm/scummvm/commit/50c52ab3fb74f2994e02dbcac5337dfffbefbafd
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix RIFX files inside of EXE's
Changed paths:
engines/director/resource.cpp
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index da664a4..d348d12 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -251,6 +251,8 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream) {
bool RIFXArchive::openStream(Common::SeekableReadStream *stream) {
close();
+ uint32 startPos = stream->pos();
+
uint32 tag = stream->readUint32BE();
bool isBigEndian;
@@ -261,11 +263,12 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream) {
else
return false;
- Common::SeekableSubReadStreamEndian subStream(stream, 4, stream->size(), isBigEndian, DisposeAfterUse::NO);
+ Common::SeekableSubReadStreamEndian subStream(stream, startPos + 4, stream->size(), isBigEndian, DisposeAfterUse::NO);
subStream.readUint32(); // size
- if (subStream.readUint32() != MKTAG('M', 'V', '9', '3'))
+ uint32 type = subStream.readUint32();
+ if (type != MKTAG('M', 'V', '9', '3') && type != MKTAG('A', 'P', 'P', 'L'))
return false;
if (subStream.readUint32() != MKTAG('i', 'm', 'a', 'p'))
@@ -273,7 +276,7 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream) {
subStream.readUint32(); // imap length
subStream.readUint32(); // unknown
- uint32 mmapOffset = subStream.readUint32() - 4;
+ uint32 mmapOffset = subStream.readUint32() - startPos - 4;
subStream.seek(mmapOffset);
@@ -294,6 +297,8 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream) {
uint32 offset = subStream.readUint32();
subStream.skip(8); // always 0?
+ debug(0, "Found RIFX resource %d: '%s', %d @ 0x%08x", i, tag2str(tag), size, offset);
+
ResourceMap &resMap = _types[tag];
Resource &res = resMap[i]; // FIXME: What is the ID? Is this setup even viable?
res.offset = offset;
Commit: a24668ff797675039135c4aeb2b4b78c800abe3e
https://github.com/scummvm/scummvm/commit/a24668ff797675039135c4aeb2b4b78c800abe3e
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add majestic detection
Changed paths:
engines/director/detection.cpp
engines/director/detection_tables.h
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index 0a7af66..18e6009 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -64,6 +64,7 @@ bool DirectorEngine::hasFeature(EngineFeature f) const {
static const PlainGameDescriptor directorGames[] = {
{ "director", "Macromedia Director Game" },
{ "gundam0079", "Gundam 0079: The War for Earth" },
+ { "majestic", "Majestic Part I: Alien Encounter" },
{ 0, 0 }
};
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index 7bb2c33..3218635 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -40,6 +40,20 @@ static const DirectorGameDescription gameDescriptions[] = {
5
},
+ {
+ {
+ "majestic",
+ "",
+ AD_ENTRY1("MAJESTIC.EXE", "624267f70253e5327981003a6fc0aeba"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 4
+ },
+
{ AD_TABLE_END_MARKER, GID_GENERIC, 0 }
};
Commit: eb16a726e90133592f0ea0bde2bb94dab99d3911
https://github.com/scummvm/scummvm/commit/eb16a726e90133592f0ea0bde2bb94dab99d3911
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add basic v3-5 exe parsing
Changed paths:
engines/director/detection.cpp
engines/director/director.cpp
engines/director/director.h
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index 18e6009..e553c57 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -54,6 +54,10 @@ Common::Language DirectorEngine::getLanguage() const {
return _gameDescription->desc.language;
}
+Common::String DirectorEngine::getEXEName() const {
+ return _gameDescription->desc.filesDescriptions[0].fileName;
+}
+
bool DirectorEngine::hasFeature(EngineFeature f) const {
return
(f == kSupportsRTL);
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 840692a..7fe0c69 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -22,12 +22,15 @@
#include "audio/mixer.h"
+#include "common/debug.h"
#include "common/scummsys.h"
#include "common/error.h"
+#include "common/stream.h"
#include "common/system.h"
#include "common/textconsole.h"
#include "director/director.h"
+#include "director/resource.h"
namespace Director {
@@ -37,13 +40,111 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
// Setup mixer
syncSoundSettings();
+
+ _mainArchive = 0;
}
DirectorEngine::~DirectorEngine() {
+ delete _mainArchive;
}
Common::Error DirectorEngine::run() {
+ debug("Starting v%d Director game", getVersion());
+
+ if (getPlatform() == Common::kPlatformWindows)
+ loadEXE();
+
return Common::kNoError;
}
+void DirectorEngine::loadEXE() {
+ Common::SeekableReadStream *exeStream = SearchMan.createReadStreamForMember(getEXEName());
+ if (!exeStream)
+ error("Failed to open EXE '%s'", getEXEName().c_str());
+
+ exeStream->seek(-4, SEEK_END);
+ exeStream->seek(exeStream->readUint32LE());
+
+ switch (getVersion()) {
+ case 3:
+ loadEXEv3(exeStream);
+ break;
+ case 4:
+ loadEXEv4(exeStream);
+ break;
+ case 5:
+ loadEXEv5(exeStream);
+ break;
+ }
+}
+
+void DirectorEngine::loadEXEv3(Common::SeekableReadStream *stream) {
+ stream->readUint32LE(); // unknown
+ stream->readUint16LE(); // unknown
+ stream->readUint32LE(); // Main MMM size
+ stream->readByte(); // zero
+ Common::String mmmFileName = readPascalString(*stream);
+ Common::String directoryName = readPascalString(*stream);
+
+ debug("Main MMM: '%s'", mmmFileName.c_str());
+ debug("Directory Name: '%s'", directoryName.c_str());
+
+ _mainArchive = new RIFFArchive();
+
+ // TODO: Convert MMM name and load
+
+ delete stream;
+}
+
+void DirectorEngine::loadEXEv4(Common::SeekableReadStream *stream) {
+ if (stream->readUint32BE() != MKTAG('P', 'J', '9', '3'))
+ error("Invalid projector tag found in v4 EXE");
+
+ uint32 rifxOffset = stream->readUint32LE();
+ /* uint32 fontMapOffset = */ stream->readUint32LE();
+ /* uint32 resourceForkOffset1 = */ stream->readUint32LE();
+ /* uint32 resourceForkOffset2 = */ stream->readUint32LE();
+ stream->readUint32LE(); // graphics DLL offset
+ stream->readUint32LE(); // sound DLL offset
+ /* uint32 rifxOffsetAlt = */ stream->readUint32LE(); // equivalent to rifxOffset
+
+ loadEXERIFX(stream, rifxOffset);
+}
+
+void DirectorEngine::loadEXEv5(Common::SeekableReadStream *stream) {
+ if (stream->readUint32LE() != MKTAG('P', 'J', '9', '5'))
+ error("Invalid projector tag found in v5 EXE");
+
+ uint32 rifxOffset = stream->readUint32LE();
+ stream->readUint32LE(); // unknown
+ stream->readUint32LE(); // unknown
+ stream->readUint32LE(); // unknown
+ /* uint16 screenWidth = */ stream->readUint16LE();
+ /* uint16 screenHeight = */ stream->readUint16LE();
+ stream->readUint32LE(); // unknown
+ stream->readUint32LE(); // unknown
+ /* uint32 fontMapOffset = */ stream->readUint32LE();
+
+ loadEXERIFX(stream, rifxOffset);
+}
+
+void DirectorEngine::loadEXERIFX(Common::SeekableReadStream *stream, uint32 offset) {
+ stream->seek(offset);
+
+ _mainArchive = new RIFXArchive();
+
+ if (!_mainArchive->openStream(stream))
+ error("Failed to load RIFX from EXE");
+}
+
+Common::String DirectorEngine::readPascalString(Common::SeekableReadStream &stream) {
+ byte length = stream.readByte();
+ Common::String x;
+
+ while (length--)
+ x += (char)stream.readByte();
+
+ return x;
+}
+
} // End of namespace Director
diff --git a/engines/director/director.h b/engines/director/director.h
index 6fe173c..f1186f3 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -35,6 +35,7 @@ enum DirectorGameID {
GID_GENERIC
};
+class Archive;
struct DirectorGameDescription;
class DirectorEngine : public ::Engine {
@@ -48,6 +49,7 @@ public:
uint16 getVersion() const;
Common::Platform getPlatform() const;
Common::Language getLanguage() const;
+ Common::String getEXEName() const;
bool hasFeature(EngineFeature f) const;
@@ -56,6 +58,16 @@ protected:
private:
const DirectorGameDescription *_gameDescription;
+
+ void loadEXE();
+ void loadEXEv3(Common::SeekableReadStream *stream);
+ void loadEXEv4(Common::SeekableReadStream *stream);
+ void loadEXEv5(Common::SeekableReadStream *stream);
+ void loadEXERIFX(Common::SeekableReadStream *stream, uint32 offset);
+
+ Common::String readPascalString(Common::SeekableReadStream &stream);
+
+ Archive *_mainArchive;
};
} // End of namespace Director
Commit: 45a387c48144d98cfaf3aba3f9245bc79564d1c3
https://github.com/scummvm/scummvm/commit/45a387c48144d98cfaf3aba3f9245bc79564d1c3
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add detection for Spy Club
Changed paths:
engines/director/detection.cpp
engines/director/detection_tables.h
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index e553c57..50e6323 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -69,6 +69,7 @@ static const PlainGameDescriptor directorGames[] = {
{ "director", "Macromedia Director Game" },
{ "gundam0079", "Gundam 0079: The War for Earth" },
{ "majestic", "Majestic Part I: Alien Encounter" },
+ { "spyclub", "Spy Club" },
{ 0, 0 }
};
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index 3218635..bc53465 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -54,6 +54,20 @@ static const DirectorGameDescription gameDescriptions[] = {
4
},
+ {
+ {
+ "spyclub",
+ "",
+ AD_ENTRY1("SPYCLUB.EXE", "65d06b5fef155a2473434571aff5bc29"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 3
+ },
+
{ AD_TABLE_END_MARKER, GID_GENERIC, 0 }
};
Commit: 60ba99ac4182366cef3dcbf0e56719f538920084
https://github.com/scummvm/scummvm/commit/60ba99ac4182366cef3dcbf0e56719f538920084
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix RIFF offsets
Changed paths:
engines/director/resource.cpp
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index d348d12..b9e6b1d 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -225,16 +225,19 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream) {
uint32 cftcSize = stream->readUint32LE();
uint32 startPos = stream->pos();
+ stream->readUint32LE(); // unknown (always 0?)
while ((uint32)stream->pos() < startPos + cftcSize) {
- uint32 offset = stream->readUint32LE();
uint32 tag = stream->readUint32BE();
uint32 size = stream->readUint32LE();
uint32 id = stream->readUint32LE();
+ uint32 offset = stream->readUint32LE();
if (tag == 0)
break;
+ debug(0, "Found RIFF resource '%s' %d: %d @ 0x%08x", tag2str(tag), id, size, offset);
+
ResourceMap &resMap = _types[tag];
Resource &res = resMap[id];
res.offset = offset;
Commit: 0f7fb5ad65780f7617f850ce5f9a3930c69a2929
https://github.com/scummvm/scummvm/commit/0f7fb5ad65780f7617f850ce5f9a3930c69a2929
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Parse the main MMM file in v3 Windows games
Changed paths:
engines/director/director.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 7fe0c69..ea21986 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -91,7 +91,8 @@ void DirectorEngine::loadEXEv3(Common::SeekableReadStream *stream) {
_mainArchive = new RIFFArchive();
- // TODO: Convert MMM name and load
+ if (!_mainArchive->openFile(mmmFileName))
+ error("Could not open '%s'", mmmFileName.c_str());
delete stream;
}
Commit: f6399b7d13976d703590ba667b02c806c905209b
https://github.com/scummvm/scummvm/commit/f6399b7d13976d703590ba667b02c806c905209b
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix some v3 exe fields
Thanks, fuzzie
Changed paths:
engines/director/director.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index ea21986..4df959d 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -79,10 +79,14 @@ void DirectorEngine::loadEXE() {
}
void DirectorEngine::loadEXEv3(Common::SeekableReadStream *stream) {
- stream->readUint32LE(); // unknown
- stream->readUint16LE(); // unknown
+ uint16 entryCount = stream->readUint16LE();
+
+ if (entryCount != 1)
+ error("Unhandled multiple entry v3 EXE");
+
+ stream->skip(5); // unknown
+
stream->readUint32LE(); // Main MMM size
- stream->readByte(); // zero
Common::String mmmFileName = readPascalString(*stream);
Common::String directoryName = readPascalString(*stream);
Commit: 09f6949cbc7e5943b7b6920cd39ac24bfd87bad5
https://github.com/scummvm/scummvm/commit/09f6949cbc7e5943b7b6920cd39ac24bfd87bad5
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add JMP Turbo Mac detection
Changed paths:
engines/director/detection.cpp
engines/director/detection_tables.h
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index 50e6323..762ce20 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -68,6 +68,7 @@ bool DirectorEngine::hasFeature(EngineFeature f) const {
static const PlainGameDescriptor directorGames[] = {
{ "director", "Macromedia Director Game" },
{ "gundam0079", "Gundam 0079: The War for Earth" },
+ { "jman", "The Journeyman Project" },
{ "majestic", "Majestic Part I: Alien Encounter" },
{ "spyclub", "Spy Club" },
{ 0, 0 }
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index bc53465..d8d44b6 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -33,7 +33,7 @@ static const DirectorGameDescription gameDescriptions[] = {
AD_ENTRY1("Gundam0079.exe", "1a7acbba10a7246ba58c1d53fc7203f5"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_NO_FLAGS,
GUIO1(GUIO_NOASPECT)
},
GID_GENERIC,
@@ -42,12 +42,26 @@ static const DirectorGameDescription gameDescriptions[] = {
{
{
+ "jman",
+ "Turbo!",
+ AD_ENTRY1("JMP Turbo\xE2\x84\xA2", "cc3321069072b90f091f220bba16e4d4"), // Trademark symbol (UTF-8)
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_MACRESFORK,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 4
+ },
+
+ {
+ {
"majestic",
"",
AD_ENTRY1("MAJESTIC.EXE", "624267f70253e5327981003a6fc0aeba"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_NO_FLAGS,
GUIO1(GUIO_NOASPECT)
},
GID_GENERIC,
@@ -61,7 +75,7 @@ static const DirectorGameDescription gameDescriptions[] = {
AD_ENTRY1("SPYCLUB.EXE", "65d06b5fef155a2473434571aff5bc29"),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_UNSTABLE,
+ ADGF_NO_FLAGS,
GUIO1(GUIO_NOASPECT)
},
GID_GENERIC,
Commit: 9a9df86fded26b253e8d1c02a5a048839084f0e7
https://github.com/scummvm/scummvm/commit/9a9df86fded26b253e8d1c02a5a048839084f0e7
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Parse the RIFX from v4 Mac versions
Changed paths:
engines/director/director.cpp
engines/director/director.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 4df959d..5cb5f20 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -25,6 +25,7 @@
#include "common/debug.h"
#include "common/scummsys.h"
#include "common/error.h"
+#include "common/macresman.h"
#include "common/stream.h"
#include "common/system.h"
#include "common/textconsole.h"
@@ -42,10 +43,12 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
syncSoundSettings();
_mainArchive = 0;
+ _macBinary = 0;
}
DirectorEngine::~DirectorEngine() {
delete _mainArchive;
+ delete _macBinary;
}
Common::Error DirectorEngine::run() {
@@ -53,6 +56,8 @@ Common::Error DirectorEngine::run() {
if (getPlatform() == Common::kPlatformWindows)
loadEXE();
+ else
+ loadMac();
return Common::kNoError;
}
@@ -142,6 +147,34 @@ void DirectorEngine::loadEXERIFX(Common::SeekableReadStream *stream, uint32 offs
error("Failed to load RIFX from EXE");
}
+void DirectorEngine::loadMac() {
+ if (getVersion() < 4)
+ error("Unhandled pre-v4 Mac version");
+
+ _macBinary = new Common::MacResManager();
+
+ if (!_macBinary->open(getEXEName()) || !_macBinary->hasDataFork())
+ error("Failed to open Mac binary '%s'", getEXEName().c_str());
+
+ Common::SeekableReadStream *dataFork = _macBinary->getDataFork();
+ _mainArchive = new RIFXArchive();
+
+ // First we need to detect PPC vs. 68k
+
+ uint32 tag = dataFork->readUint32LE();
+
+ if (tag == MKTAG('P', 'J', '9', '3')) {
+ // PPC: The RIFX shares the data fork with the binary
+ dataFork->seek(dataFork->readUint32BE());
+ } else {
+ // 68k: The RIFX is the only thing in the data fork
+ dataFork->seek(0);
+ }
+
+ if (!_mainArchive->openStream(dataFork))
+ error("Failed to load RIFX from Mac binary");
+}
+
Common::String DirectorEngine::readPascalString(Common::SeekableReadStream &stream) {
byte length = stream.readByte();
Common::String x;
diff --git a/engines/director/director.h b/engines/director/director.h
index f1186f3..0019801 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -29,6 +29,10 @@
class OSystem;
+namespace Common {
+class MacResManager;
+}
+
namespace Director {
enum DirectorGameID {
@@ -65,9 +69,12 @@ private:
void loadEXEv5(Common::SeekableReadStream *stream);
void loadEXERIFX(Common::SeekableReadStream *stream, uint32 offset);
+ void loadMac();
+
Common::String readPascalString(Common::SeekableReadStream &stream);
Archive *_mainArchive;
+ Common::MacResManager *_macBinary;
};
} // End of namespace Director
Commit: d870127ddb766be5d599b054ab1e4102aa9632ff
https://github.com/scummvm/scummvm/commit/d870127ddb766be5d599b054ab1e4102aa9632ff
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Mac v3 games just use the resource fork of the executable to start
Changed paths:
engines/director/director.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 5cb5f20..0b6b626 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -148,31 +148,37 @@ void DirectorEngine::loadEXERIFX(Common::SeekableReadStream *stream, uint32 offs
}
void DirectorEngine::loadMac() {
- if (getVersion() < 4)
- error("Unhandled pre-v4 Mac version");
+ if (getVersion() < 4) {
+ // The data is part of the resource fork of the executable
+ _mainArchive = new MacArchive();
- _macBinary = new Common::MacResManager();
+ if (!_mainArchive->openFile(getEXEName()))
+ error("Failed to open Mac binary '%s'", getEXEName().c_str());
+ } else {
+ // The RIFX is located in the data fork of the executable
+ _macBinary = new Common::MacResManager();
- if (!_macBinary->open(getEXEName()) || !_macBinary->hasDataFork())
- error("Failed to open Mac binary '%s'", getEXEName().c_str());
+ if (!_macBinary->open(getEXEName()) || !_macBinary->hasDataFork())
+ error("Failed to open Mac binary '%s'", getEXEName().c_str());
- Common::SeekableReadStream *dataFork = _macBinary->getDataFork();
- _mainArchive = new RIFXArchive();
+ Common::SeekableReadStream *dataFork = _macBinary->getDataFork();
+ _mainArchive = new RIFXArchive();
- // First we need to detect PPC vs. 68k
+ // First we need to detect PPC vs. 68k
- uint32 tag = dataFork->readUint32LE();
+ uint32 tag = dataFork->readUint32LE();
- if (tag == MKTAG('P', 'J', '9', '3')) {
- // PPC: The RIFX shares the data fork with the binary
- dataFork->seek(dataFork->readUint32BE());
- } else {
- // 68k: The RIFX is the only thing in the data fork
- dataFork->seek(0);
- }
+ if (tag == MKTAG('P', 'J', '9', '3')) {
+ // PPC: The RIFX shares the data fork with the binary
+ dataFork->seek(dataFork->readUint32BE());
+ } else {
+ // 68k: The RIFX is the only thing in the data fork
+ dataFork->seek(0);
+ }
- if (!_mainArchive->openStream(dataFork))
- error("Failed to load RIFX from Mac binary");
+ if (!_mainArchive->openStream(dataFork))
+ error("Failed to load RIFX from Mac binary");
+ }
}
Common::String DirectorEngine::readPascalString(Common::SeekableReadStream &stream) {
Commit: bba8bb4c3357ea72b64a498afd47e54e05c7d2f2
https://github.com/scummvm/scummvm/commit/bba8bb4c3357ea72b64a498afd47e54e05c7d2f2
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add v5 Mac data fork parsing
Changed paths:
engines/director/director.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 0b6b626..10dce67 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -166,9 +166,9 @@ void DirectorEngine::loadMac() {
// First we need to detect PPC vs. 68k
- uint32 tag = dataFork->readUint32LE();
+ uint32 tag = dataFork->readUint32BE();
- if (tag == MKTAG('P', 'J', '9', '3')) {
+ if (SWAP_BYTES_32(tag) == MKTAG('P', 'J', '9', '3') || tag == MKTAG('P', 'J', '9', '5')) {
// PPC: The RIFX shares the data fork with the binary
dataFork->seek(dataFork->readUint32BE());
} else {
Commit: b4cf46486de25caa8df84de6b78fc85e0aaec581
https://github.com/scummvm/scummvm/commit/b4cf46486de25caa8df84de6b78fc85e0aaec581
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add gundam0079 mac detection
Changed paths:
engines/director/detection_tables.h
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index d8d44b6..f8fb3f0 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -42,6 +42,20 @@ static const DirectorGameDescription gameDescriptions[] = {
{
{
+ "gundam0079",
+ "",
+ AD_ENTRY1("Gundam0079", "4c38a51a21a1ad231f218c4786ff771d"),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_MACRESFORK,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 5
+ },
+
+ {
+ {
"jman",
"Turbo!",
AD_ENTRY1("JMP Turbo\xE2\x84\xA2", "cc3321069072b90f091f220bba16e4d4"), // Trademark symbol (UTF-8)
Commit: c607b85a4653ad18de81df0128688e9e537fa5ba
https://github.com/scummvm/scummvm/commit/c607b85a4653ad18de81df0128688e9e537fa5ba
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add parsing support for v7
Changed paths:
engines/director/director.cpp
engines/director/director.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 10dce67..f759312 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -80,6 +80,11 @@ void DirectorEngine::loadEXE() {
case 5:
loadEXEv5(exeStream);
break;
+ case 7:
+ loadEXEv7(exeStream);
+ break;
+ default:
+ error("Unhandled Windows EXE version %d", getVersion());
}
}
@@ -138,6 +143,20 @@ void DirectorEngine::loadEXEv5(Common::SeekableReadStream *stream) {
loadEXERIFX(stream, rifxOffset);
}
+void DirectorEngine::loadEXEv7(Common::SeekableReadStream *stream) {
+ if (stream->readUint32LE() != MKTAG('P', 'J', '0', '0'))
+ error("Invalid projector tag found in v5 EXE");
+
+ uint32 rifxOffset = stream->readUint32LE();
+ stream->readUint32LE(); // unknown
+ stream->readUint32LE(); // unknown
+ stream->readUint32LE(); // unknown
+ stream->readUint32LE(); // unknown
+ stream->readUint32LE(); // some DLL offset
+
+ loadEXERIFX(stream, rifxOffset);
+}
+
void DirectorEngine::loadEXERIFX(Common::SeekableReadStream *stream, uint32 offset) {
stream->seek(offset);
@@ -168,7 +187,7 @@ void DirectorEngine::loadMac() {
uint32 tag = dataFork->readUint32BE();
- if (SWAP_BYTES_32(tag) == MKTAG('P', 'J', '9', '3') || tag == MKTAG('P', 'J', '9', '5')) {
+ if (SWAP_BYTES_32(tag) == MKTAG('P', 'J', '9', '3') || tag == MKTAG('P', 'J', '9', '5') || tag == MKTAG('P', 'J', '0', '0')) {
// PPC: The RIFX shares the data fork with the binary
dataFork->seek(dataFork->readUint32BE());
} else {
diff --git a/engines/director/director.h b/engines/director/director.h
index 0019801..2d1c395 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -67,6 +67,7 @@ private:
void loadEXEv3(Common::SeekableReadStream *stream);
void loadEXEv4(Common::SeekableReadStream *stream);
void loadEXEv5(Common::SeekableReadStream *stream);
+ void loadEXEv7(Common::SeekableReadStream *stream);
void loadEXERIFX(Common::SeekableReadStream *stream, uint32 offset);
void loadMac();
Commit: 387833ace4c176a5a47acae8e6e6a9764b08f235
https://github.com/scummvm/scummvm/commit/387833ace4c176a5a47acae8e6e6a9764b08f235
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add detection for Jewels of the Oracle
Changed paths:
engines/director/detection.cpp
engines/director/detection_tables.h
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index 762ce20..3e3d6ca 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -66,11 +66,12 @@ bool DirectorEngine::hasFeature(EngineFeature f) const {
} // End of Namespace Director
static const PlainGameDescriptor directorGames[] = {
- { "director", "Macromedia Director Game" },
+ { "director", "Macromedia Director Game" },
{ "gundam0079", "Gundam 0079: The War for Earth" },
- { "jman", "The Journeyman Project" },
- { "majestic", "Majestic Part I: Alien Encounter" },
- { "spyclub", "Spy Club" },
+ { "jewels", "Jewels of the Oracle" },
+ { "jman", "The Journeyman Project" },
+ { "majestic", "Majestic Part I: Alien Encounter" },
+ { "spyclub", "Spy Club" },
{ 0, 0 }
};
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index f8fb3f0..19fb892 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -56,6 +56,106 @@ static const DirectorGameDescription gameDescriptions[] = {
{
{
+ "jewels",
+ "",
+ AD_ENTRY1("JEWELS.EXE", "bb6d81471d166088260090472c6c3a87"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 4
+ },
+
+ {
+ {
+ "jewels",
+ "",
+ AD_ENTRY1("Jewels.exe", "c1a2e8b7e41fa204009324a9c7db1030"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 7
+ },
+
+ {
+ {
+ "jewels",
+ "Two-Minute Demo",
+ AD_ENTRY1("DEMO.EXE", "ebee52d3c4280674c600177df5b09da0"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_DEMO,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 4
+ },
+
+ // Note: There are four versions of the binary included on the disc.
+ // 5.6, 6, and 9 Meg variants all exist too.
+ {
+ {
+ "jewels",
+ "",
+ AD_ENTRY1("Jewels 11 Meg", "339c89a148c4ff2c5c815c62ac006325"),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_MACRESFORK,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 4
+ },
+
+ {
+ {
+ "jewels",
+ "Two-Minute Demo",
+ AD_ENTRY1("Two-Minute Demo", "01be45e7241194dad07938e7059b88e3"),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_MACRESFORK | ADGF_DEMO,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 4
+ },
+
+ {
+ {
+ "jewels",
+ "",
+ AD_ENTRY1("Jewels of the Oracle", "fa52f0136cde568a46249ce74f01a324"),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_MACRESFORK,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 7
+ },
+
+ {
+ {
+ "jewels",
+ "Demo",
+ AD_ENTRY1("JEWELS.EXE", "abcc448c035e88d4edb4a29034fd1e34"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS | ADGF_DEMO,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 4
+ },
+
+ {
+ {
"jman",
"Turbo!",
AD_ENTRY1("JMP Turbo\xE2\x84\xA2", "cc3321069072b90f091f220bba16e4d4"), // Trademark symbol (UTF-8)
Commit: 4a334980e1121d310948fbd497298d24d07011ac
https://github.com/scummvm/scummvm/commit/4a334980e1121d310948fbd497298d24d07011ac
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add some simple Windows version fallback detection
Changed paths:
engines/director/detection.cpp
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index 3e3d6ca..63d6b4e 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -91,6 +91,7 @@ public:
return "Macromedia Director (C) Macromedia";
}
+ const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const;
virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
};
@@ -103,6 +104,131 @@ bool DirectorMetaEngine::createInstance(OSystem *syst, Engine **engine, const AD
return (gd != 0);
}
+static Director::DirectorGameDescription s_fallbackDesc = {
+ {
+ "director",
+ "",
+ AD_ENTRY1(0, 0),
+ Common::UNK_LANG,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO0()
+ },
+ Director::GID_GENERIC,
+ 0
+};
+
+static char s_fallbackFileNameBuffer[51];
+
+const ADGameDescription *DirectorMetaEngine::fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
+ // TODO: Handle Mac fallback
+
+ // reset fallback description
+ Director::DirectorGameDescription *desc = &s_fallbackDesc;
+ desc->desc.gameid = "director";
+ desc->desc.extra = "";
+ desc->desc.language = Common::UNK_LANG;
+ desc->desc.flags = ADGF_NO_FLAGS;
+ desc->desc.platform = Common::kPlatformWindows;
+ desc->desc.guioptions = GUIO0();
+ desc->desc.filesDescriptions[0].fileName = 0;
+ desc->version = 0;
+ desc->gameID = Director::GID_GENERIC;
+
+ for (Common::FSList::const_iterator file = fslist.begin(); file != fslist.end(); ++file) {
+ if (file->isDirectory())
+ continue;
+
+ Common::String fileName = file->getName();
+ fileName.toLowercase();
+ if (!fileName.hasSuffix(".exe"))
+ continue;
+
+ SearchMan.clear();
+ SearchMan.addDirectory(file->getParent().getName(), file->getParent());
+
+ Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember(file->getName());
+
+ if (!stream)
+ continue;
+
+ stream->seek(-4, SEEK_END);
+
+ uint32 offset = stream->readUint32LE();
+
+ if (stream->eos() || offset == 0 || offset >= (uint32)(stream->size() - 4)) {
+ delete stream;
+ continue;
+ }
+
+ stream->seek(offset);
+
+ uint32 tag = stream->readUint32LE();
+
+ switch (tag) {
+ case MKTAG('3', '9', 'J', 'P'):
+ desc->version = 4;
+ break;
+ case MKTAG('P', 'J', '9', '5'):
+ desc->version = 5;
+ break;
+ case MKTAG('P', 'J', '0', '0'):
+ desc->version = 7;
+ break;
+ default:
+ // Prior to version 4, there was no tag here. So we'll use a bit of a
+ // heuristic to detect. The first field is the entry count, of which
+ // there should only be one.
+ if ((tag & 0xFFFF) != 1) {
+ delete stream;
+ continue;
+ }
+
+ stream->skip(3);
+
+ uint32 mmmSize = stream->readUint32LE();
+
+ if (stream->eos() || mmmSize == 0) {
+ delete stream;
+ continue;
+ }
+
+ byte fileNameSize = stream->readByte();
+
+ if (stream->eos()) {
+ delete stream;
+ continue;
+ }
+
+ stream->skip(fileNameSize);
+ byte directoryNameSize = stream->readByte();
+
+ if (stream->eos()) {
+ delete stream;
+ continue;
+ }
+
+ stream->skip(directoryNameSize);
+
+ if ((uint32)stream->pos() != offset) {
+ delete stream;
+ continue;
+ }
+
+ // Assume v3 at this point (for now at least)
+ desc->version = 3;
+ }
+
+ strncpy(s_fallbackFileNameBuffer, fileName.c_str(), 50);
+ s_fallbackFileNameBuffer[50] = '\0';
+ desc->desc.filesDescriptions[0].fileName = s_fallbackFileNameBuffer;
+
+ return (ADGameDescription *)desc;
+ }
+
+ return 0;
+}
+
#if PLUGIN_ENABLED_DYNAMIC(DIRECTOR)
REGISTER_PLUGIN_DYNAMIC(DIRECTOR, PLUGIN_TYPE_ENGINE, DirectorMetaEngine);
#else
Commit: 649ef2af6799bdae858d3056e7f24de6419623f4
https://github.com/scummvm/scummvm/commit/649ef2af6799bdae858d3056e7f24de6419623f4
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix stupid mistake in v3 fallback
Changed paths:
engines/director/detection.cpp
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index 63d6b4e..f0670b3 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -210,7 +210,7 @@ const ADGameDescription *DirectorMetaEngine::fallbackDetect(const FileMap &allFi
stream->skip(directoryNameSize);
- if ((uint32)stream->pos() != offset) {
+ if (stream->pos() != stream->size() - 4) {
delete stream;
continue;
}
Commit: 5e0874797817ac62e583963ff0bb16f5766070f1
https://github.com/scummvm/scummvm/commit/5e0874797817ac62e583963ff0bb16f5766070f1
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add detection for jman Japanese
Changed paths:
engines/director/detection.cpp
engines/director/detection_tables.h
engines/director/director.cpp
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index f0670b3..1e7d7f1 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -77,10 +77,17 @@ static const PlainGameDescriptor directorGames[] = {
#include "director/detection_tables.h"
+static const char *directoryGlobs[] = {
+ "install",
+ 0
+};
+
class DirectorMetaEngine : public AdvancedMetaEngine {
public:
DirectorMetaEngine() : AdvancedMetaEngine(Director::gameDescriptions, sizeof(Director::DirectorGameDescription), directorGames) {
_singleid = "director";
+ _maxScanDepth = 2,
+ _directoryGlobs = directoryGlobs;
}
virtual const char *getName() const {
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index 19fb892..6b469fa 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -157,6 +157,20 @@ static const DirectorGameDescription gameDescriptions[] = {
{
{
"jman",
+ "",
+ AD_ENTRY1("JOURNEY.EXE", "65d06b5fef155a2473434571aff5bc29"),
+ Common::JA_JPN,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 3
+ },
+
+ {
+ {
+ "jman",
"Turbo!",
AD_ENTRY1("JMP Turbo\xE2\x84\xA2", "cc3321069072b90f091f220bba16e4d4"), // Trademark symbol (UTF-8)
Common::EN_ANY,
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index f759312..2664497 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -22,6 +22,7 @@
#include "audio/mixer.h"
+#include "common/config-manager.h"
#include "common/debug.h"
#include "common/scummsys.h"
#include "common/error.h"
@@ -44,6 +45,10 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
_mainArchive = 0;
_macBinary = 0;
+
+ const Common::FSNode gameDataDir(ConfMan.get("path"));
+ SearchMan.addSubDirectoryMatching(gameDataDir, "data");
+ SearchMan.addSubDirectoryMatching(gameDataDir, "install");
}
DirectorEngine::~DirectorEngine() {
Commit: 30de1f34ca9c5816dd17f452fbc59c785ca42c93
https://github.com/scummvm/scummvm/commit/30de1f34ca9c5816dd17f452fbc59c785ca42c93
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix getting RIFF resources
Changed paths:
engines/director/resource.cpp
engines/director/resource.h
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index b9e6b1d..1c4bd33 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -248,6 +248,36 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream) {
return true;
}
+Common::SeekableReadStream *RIFFArchive::getResource(uint32 tag, uint16 id) {
+ if (!_types.contains(tag))
+ error("Archive does not contain '%s' %04x", tag2str(tag), id);
+
+ const ResourceMap &resMap = _types[tag];
+
+ if (!resMap.contains(id))
+ error("Archive does not contain '%s' %04x", tag2str(tag), id);
+
+ const Resource &res = resMap[id];
+
+ // Adjust to skip the resource header
+ uint32 offset = res.offset + 12;
+ uint32 size = res.size - 12;
+
+ // Skip the Pascal string
+ _stream->seek(offset);
+ byte stringSize = _stream->readByte() + 1; // 1 for this byte
+ offset += stringSize;
+ size -= stringSize;
+
+ // Align to nearest word boundary
+ if (offset & 1) {
+ offset++;
+ size--;
+ }
+
+ return new Common::SeekableSubReadStream(_stream, offset, offset + size);
+}
+
// RIFX Archive code
diff --git a/engines/director/resource.h b/engines/director/resource.h
index f757c9c..055abe9 100644
--- a/engines/director/resource.h
+++ b/engines/director/resource.h
@@ -92,6 +92,7 @@ public:
~RIFFArchive() {}
bool openStream(Common::SeekableReadStream *stream);
+ Common::SeekableReadStream *getResource(uint32 tag, uint16 id);
};
class RIFXArchive : public Archive {
Commit: a9849314e8c6b78029f9ecaab0bce1016d232dd6
https://github.com/scummvm/scummvm/commit/a9849314e8c6b78029f9ecaab0bce1016d232dd6
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Change tag comparison to be case-insensitive
Changed paths:
engines/director/resource.cpp
engines/director/resource.h
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 1c4bd33..2c0b478 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -155,6 +155,13 @@ Common::Array<uint16> Archive::getResourceIDList(uint32 type) const {
return idList;
}
+uint32 Archive::convertTagToUppercase(uint32 tag) {
+ uint32 newTag = toupper(tag >> 24) << 24;
+ newTag |= toupper((tag >> 16) & 0xFF) << 16;
+ newTag |= toupper((tag >> 8) & 0xFF) << 8;
+ return newTag | toupper(tag & 0xFF);
+}
+
// Mac Archive code
MacArchive::MacArchive() : Archive(), _resFork(0) {
@@ -212,15 +219,15 @@ Common::SeekableReadStream *MacArchive::getResource(uint32 tag, uint16 id) {
bool RIFFArchive::openStream(Common::SeekableReadStream *stream) {
close();
- if (stream->readUint32BE() != MKTAG('R', 'I', 'F', 'F'))
+ if (convertTagToUppercase(stream->readUint32BE()) != MKTAG('R', 'I', 'F', 'F'))
return false;
stream->readUint32LE(); // size
- if (stream->readUint32BE() != MKTAG('R', 'M', 'M', 'P'))
+ if (convertTagToUppercase(stream->readUint32BE()) != MKTAG('R', 'M', 'M', 'P'))
return false;
- if (stream->readUint32BE() != MKTAG('C', 'F', 'T', 'C'))
+ if (convertTagToUppercase(stream->readUint32BE()) != MKTAG('C', 'F', 'T', 'C'))
return false;
uint32 cftcSize = stream->readUint32LE();
diff --git a/engines/director/resource.h b/engines/director/resource.h
index 055abe9..0068912 100644
--- a/engines/director/resource.h
+++ b/engines/director/resource.h
@@ -20,15 +20,16 @@
*
*/
+#ifndef DIRECTOR_RESOURCE_H
+#define DIRECTOR_RESOURCE_H
+
#include "common/scummsys.h"
#include "common/endian.h"
+#include "common/func.h"
#include "common/hashmap.h"
#include "common/file.h"
#include "common/str.h"
-#ifndef DIRECTOR_RESOURCE_H
-#define DIRECTOR_RESOURCE_H
-
namespace Common {
class MacResManager;
}
@@ -58,6 +59,8 @@ public:
Common::Array<uint32> getResourceTypeList() const;
Common::Array<uint16> getResourceIDList(uint32 type) const;
+ static uint32 convertTagToUppercase(uint32 tag);
+
protected:
Common::SeekableReadStream *_stream;
@@ -67,8 +70,20 @@ protected:
Common::String name;
};
+ // Have separate hash/equals functions for tags to make them
+ // case-insensitive.
+ struct HashTag : public Common::UnaryFunction<uint32, uint> { // Insert Twitter joke
+ uint operator()(uint32 val) const { return (uint)Archive::convertTagToUppercase(val); }
+ };
+
+ struct EqualsTag : public Common::BinaryFunction<uint32, uint32, uint> {
+ bool operator()(const uint32 &val1, const uint32 &val2) const {
+ return Archive::convertTagToUppercase(val1) == Archive::convertTagToUppercase(val2);
+ }
+ };
+
typedef Common::HashMap<uint16, Resource> ResourceMap;
- typedef Common::HashMap<uint32, ResourceMap> TypeMap;
+ typedef Common::HashMap<uint32, ResourceMap, HashTag, EqualsTag> TypeMap;
TypeMap _types;
};
Commit: de61313e949ad2fe8eb076493fd4990f54a69555
https://github.com/scummvm/scummvm/commit/de61313e949ad2fe8eb076493fd4990f54a69555
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix RIFX support to actually be useful
Changed paths:
engines/director/director.cpp
engines/director/resource.cpp
engines/director/resource.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 2664497..1ae6f54 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -163,11 +163,9 @@ void DirectorEngine::loadEXEv7(Common::SeekableReadStream *stream) {
}
void DirectorEngine::loadEXERIFX(Common::SeekableReadStream *stream, uint32 offset) {
- stream->seek(offset);
-
_mainArchive = new RIFXArchive();
- if (!_mainArchive->openStream(stream))
+ if (!_mainArchive->openStream(stream, offset))
error("Failed to load RIFX from EXE");
}
@@ -191,16 +189,17 @@ void DirectorEngine::loadMac() {
// First we need to detect PPC vs. 68k
uint32 tag = dataFork->readUint32BE();
+ uint32 startOffset;
if (SWAP_BYTES_32(tag) == MKTAG('P', 'J', '9', '3') || tag == MKTAG('P', 'J', '9', '5') || tag == MKTAG('P', 'J', '0', '0')) {
// PPC: The RIFX shares the data fork with the binary
- dataFork->seek(dataFork->readUint32BE());
+ startOffset = dataFork->readUint32BE();
} else {
// 68k: The RIFX is the only thing in the data fork
- dataFork->seek(0);
+ startOffset = 0;
}
- if (!_mainArchive->openStream(dataFork))
+ if (!_mainArchive->openStream(dataFork, startOffset))
error("Failed to load RIFX from Mac binary");
}
}
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 2c0b478..39a9282 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -204,7 +204,7 @@ bool MacArchive::openFile(const Common::String &fileName) {
return true;
}
-bool MacArchive::openStream(Common::SeekableReadStream *stream) {
+bool MacArchive::openStream(Common::SeekableReadStream *stream, uint32 startOffset) {
// TODO: Add support for this (v4 Windows games)
return false;
}
@@ -216,9 +216,11 @@ Common::SeekableReadStream *MacArchive::getResource(uint32 tag, uint16 id) {
// RIFF Archive code
-bool RIFFArchive::openStream(Common::SeekableReadStream *stream) {
+bool RIFFArchive::openStream(Common::SeekableReadStream *stream, uint32 startOffset) {
close();
+ stream->seek(startOffset);
+
if (convertTagToUppercase(stream->readUint32BE()) != MKTAG('R', 'I', 'F', 'F'))
return false;
@@ -235,7 +237,7 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream) {
stream->readUint32LE(); // unknown (always 0?)
while ((uint32)stream->pos() < startPos + cftcSize) {
- uint32 tag = stream->readUint32BE();
+ uint32 tag = convertTagToUppercase(stream->readUint32BE());
uint32 size = stream->readUint32LE();
uint32 id = stream->readUint32LE();
uint32 offset = stream->readUint32LE();
@@ -288,27 +290,26 @@ Common::SeekableReadStream *RIFFArchive::getResource(uint32 tag, uint16 id) {
// RIFX Archive code
-bool RIFXArchive::openStream(Common::SeekableReadStream *stream) {
+bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOffset) {
close();
- uint32 startPos = stream->pos();
+ stream->seek(startOffset);
- uint32 tag = stream->readUint32BE();
- bool isBigEndian;
+ uint32 headerTag = stream->readUint32BE();
- if (tag == MKTAG('R', 'I', 'F', 'X'))
- isBigEndian = true;
- else if (SWAP_BYTES_32(tag) == MKTAG('R', 'I', 'F', 'X'))
- isBigEndian = false;
+ if (headerTag == MKTAG('R', 'I', 'F', 'X'))
+ _isBigEndian = true;
+ else if (SWAP_BYTES_32(headerTag) == MKTAG('R', 'I', 'F', 'X'))
+ _isBigEndian = false;
else
return false;
- Common::SeekableSubReadStreamEndian subStream(stream, startPos + 4, stream->size(), isBigEndian, DisposeAfterUse::NO);
+ Common::SeekableSubReadStreamEndian subStream(stream, startOffset + 4, stream->size(), _isBigEndian, DisposeAfterUse::NO);
subStream.readUint32(); // size
- uint32 type = subStream.readUint32();
- if (type != MKTAG('M', 'V', '9', '3') && type != MKTAG('A', 'P', 'P', 'L'))
+ uint32 rifxType = subStream.readUint32();
+ if (rifxType != MKTAG('M', 'V', '9', '3') && rifxType != MKTAG('A', 'P', 'P', 'L'))
return false;
if (subStream.readUint32() != MKTAG('i', 'm', 'a', 'p'))
@@ -316,7 +317,7 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream) {
subStream.readUint32(); // imap length
subStream.readUint32(); // unknown
- uint32 mmapOffset = subStream.readUint32() - startPos - 4;
+ uint32 mmapOffset = subStream.readUint32() - startOffset - 4;
subStream.seek(mmapOffset);
@@ -331,18 +332,84 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream) {
subStream.skip(8); // all 0xFF
subStream.readUint32(); // unknown
+ Common::Array<Resource> resources;
+
+ // Need to look for these two resources
+ const Resource *keyRes = 0;
+ const Resource *casRes = 0;
+
for (uint32 i = 0; i < resCount; i++) {
- tag = subStream.readUint32();
+ uint32 tag = subStream.readUint32();
uint32 size = subStream.readUint32();
uint32 offset = subStream.readUint32();
- subStream.skip(8); // always 0?
+ /*uint16 flags = */ subStream.readUint16();
+ /*uint16 unk1 = */ subStream.readUint16();
+ /*uint32 unk2 = */ subStream.readUint32();
- debug(0, "Found RIFX resource %d: '%s', %d @ 0x%08x", i, tag2str(tag), size, offset);
+ debug(0, "Found RIFX resource index %d: '%s', %d @ 0x%08x", i, tag2str(tag), size, offset);
- ResourceMap &resMap = _types[tag];
- Resource &res = resMap[i]; // FIXME: What is the ID? Is this setup even viable?
+ Resource res;
res.offset = offset;
res.size = size;
+ resources.push_back(res);
+
+ // APPL is a special case; it has an embedded "normal" archive
+ if (rifxType == MKTAG('A', 'P', 'P', 'L') && tag == MKTAG('F', 'i', 'l', 'e'))
+ return openStream(stream, offset);
+
+ // Looking for two types here
+ if (tag == MKTAG('K', 'E', 'Y', '*'))
+ keyRes = &resources[resources.size() - 1];
+ else if (tag == MKTAG('C', 'A', 'S', '*'))
+ casRes = &resources[resources.size() - 1];
+ }
+
+ // We need to have found the 'File' resource already
+ if (rifxType == MKTAG('A', 'P', 'P', 'L')) {
+ warning("No 'File' resource present in APPL archive");
+ return false;
+ }
+
+ // A KEY* must be present
+ if (!keyRes) {
+ warning("No 'KEY*' resource present");
+ return false;
+ }
+
+ // Parse the CAS*, if present
+ Common::Array<uint32> casEntries;
+ if (casRes) {
+ Common::SeekableSubReadStreamEndian casStream(stream, casRes->offset + 8, casRes->offset + 8 + casRes->size, _isBigEndian, DisposeAfterUse::NO);
+ casEntries.resize(casRes->size / 4);
+ for (uint32 i = 0; i < casEntries.size(); i++)
+ casEntries[i] = casStream.readUint32();
+ }
+
+ // Parse the KEY*
+ Common::SeekableSubReadStreamEndian keyStream(stream, keyRes->offset + 8, keyRes->offset + 8 + keyRes->size, _isBigEndian, DisposeAfterUse::NO);
+ /*uint16 unk1 = */ keyStream.readUint16();
+ /*uint16 unk2 = */ keyStream.readUint16();
+ /*uint32 unk3 = */ keyStream.readUint32();
+ uint32 keyCount = keyStream.readUint32();
+
+ for (uint32 i = 0; i < keyCount; i++) {
+ uint32 index = keyStream.readUint32();
+ uint32 id = keyStream.readUint32();
+ uint32 resTag = keyStream.readUint32();
+
+ // Handle CAS*/CASt nonsense
+ if (resTag == MKTAG('C', 'A', 'S', 't')) {
+ for (uint32 j = 0; j < casEntries.size(); j++) {
+ if (casEntries[j] == index) {
+ id += j + 1;
+ break;
+ }
+ }
+ }
+
+ const Resource &res = resources[index];
+ debug(0, "Found RIFX resource: '%s' 0x%04x, %d @ 0x%08x", tag2str(resTag), id, res.size, res.offset);
+ _types[resTag][id] = res;
}
_stream = stream;
diff --git a/engines/director/resource.h b/engines/director/resource.h
index 0068912..93b1bd9 100644
--- a/engines/director/resource.h
+++ b/engines/director/resource.h
@@ -44,7 +44,7 @@ public:
virtual ~Archive();
virtual bool openFile(const Common::String &fileName);
- virtual bool openStream(Common::SeekableReadStream *stream) = 0;
+ virtual bool openStream(Common::SeekableReadStream *stream, uint32 offset = 0) = 0;
virtual void close();
bool isOpen() const { return _stream != 0; }
@@ -70,20 +70,8 @@ protected:
Common::String name;
};
- // Have separate hash/equals functions for tags to make them
- // case-insensitive.
- struct HashTag : public Common::UnaryFunction<uint32, uint> { // Insert Twitter joke
- uint operator()(uint32 val) const { return (uint)Archive::convertTagToUppercase(val); }
- };
-
- struct EqualsTag : public Common::BinaryFunction<uint32, uint32, uint> {
- bool operator()(const uint32 &val1, const uint32 &val2) const {
- return Archive::convertTagToUppercase(val1) == Archive::convertTagToUppercase(val2);
- }
- };
-
typedef Common::HashMap<uint16, Resource> ResourceMap;
- typedef Common::HashMap<uint32, ResourceMap, HashTag, EqualsTag> TypeMap;
+ typedef Common::HashMap<uint32, ResourceMap> TypeMap;
TypeMap _types;
};
@@ -94,7 +82,7 @@ public:
void close();
bool openFile(const Common::String &fileName);
- bool openStream(Common::SeekableReadStream *stream);
+ bool openStream(Common::SeekableReadStream *stream, uint32 startOffset = 0);
Common::SeekableReadStream *getResource(uint32 tag, uint16 id);
private:
@@ -106,16 +94,19 @@ public:
RIFFArchive() : Archive() {}
~RIFFArchive() {}
- bool openStream(Common::SeekableReadStream *stream);
+ bool openStream(Common::SeekableReadStream *stream, uint32 startOffset = 0);
Common::SeekableReadStream *getResource(uint32 tag, uint16 id);
};
class RIFXArchive : public Archive {
public:
- RIFXArchive() : Archive() {}
+ RIFXArchive() : Archive(), _isBigEndian(true) {}
~RIFXArchive() {}
- bool openStream(Common::SeekableReadStream *stream);
+ bool openStream(Common::SeekableReadStream *stream, uint32 startOffset = 0);
+
+private:
+ bool _isBigEndian;
};
} // End of namespace Director
Commit: c5379909e2e73a9174ca8dad8b9fcbf50d519894
https://github.com/scummvm/scummvm/commit/c5379909e2e73a9174ca8dad8b9fcbf50d519894
Author: Joseph Davies (deledrius at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add detection for AMBER.
Changed paths:
engines/director/detection.cpp
engines/director/detection_tables.h
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index 1e7d7f1..b857bf6 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -72,6 +72,7 @@ static const PlainGameDescriptor directorGames[] = {
{ "jman", "The Journeyman Project" },
{ "majestic", "Majestic Part I: Alien Encounter" },
{ "spyclub", "Spy Club" },
+ { "amber", "AMBER: Journeys Beyond"},
{ 0, 0 }
};
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index 6b469fa..793cc60 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -210,6 +210,20 @@ static const DirectorGameDescription gameDescriptions[] = {
3
},
+ {
+ {
+ "amber",
+ "",
+ AD_ENTRY1("amber_jb.exe", "1a7acbba10a7246ba58c1d53fc7203f5"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 5
+ },
+
{ AD_TABLE_END_MARKER, GID_GENERIC, 0 }
};
Commit: 0deda5b8b105ff95cf72956a0e62696a2149dc30
https://github.com/scummvm/scummvm/commit/0deda5b8b105ff95cf72956a0e62696a2149dc30
Author: Joseph Davies (deledrius at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add detection for The Vampire's Coffin.
Detection for Windows and Macintosh versions of
Victor Vector & Yondo: The Vampire's Coffin.
Changed paths:
engines/director/detection.cpp
engines/director/detection_tables.h
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index b857bf6..84dbed4b 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -73,6 +73,7 @@ static const PlainGameDescriptor directorGames[] = {
{ "majestic", "Majestic Part I: Alien Encounter" },
{ "spyclub", "Spy Club" },
{ "amber", "AMBER: Journeys Beyond"},
+ { "vvvampire", "Victor Vector & Yondo: The Vampire's Coffin"},
{ 0, 0 }
};
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index 793cc60..db61c6e 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -224,6 +224,34 @@ static const DirectorGameDescription gameDescriptions[] = {
5
},
+ {
+ {
+ "vvvampire",
+ "",
+ AD_ENTRY1("VAMPIRE.EXE", "88f4f7406f34ec36e751a64f7c76f2c4"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 3
+ },
+
+ {
+ {
+ "vvvampire",
+ "",
+ AD_ENTRY1("The Vampire's Coffin", "d41d8cd98f00b204e9800998ecf8427e"),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_MACRESFORK,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 3
+ },
+
{ AD_TABLE_END_MARKER, GID_GENERIC, 0 }
};
Commit: 8d8c9b3e87486f02e81d158db58c4de442edc9d0
https://github.com/scummvm/scummvm/commit/8d8c9b3e87486f02e81d158db58c4de442edc9d0
Author: Joseph Davies (deledrius at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix version in error message.
Changed paths:
engines/director/director.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 1ae6f54..b6d6c19 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -150,7 +150,7 @@ void DirectorEngine::loadEXEv5(Common::SeekableReadStream *stream) {
void DirectorEngine::loadEXEv7(Common::SeekableReadStream *stream) {
if (stream->readUint32LE() != MKTAG('P', 'J', '0', '0'))
- error("Invalid projector tag found in v5 EXE");
+ error("Invalid projector tag found in v7 EXE");
uint32 rifxOffset = stream->readUint32LE();
stream->readUint32LE(); // unknown
Commit: 04ea338dacb0d85de5cb1bcc8410bf47e2c80e78
https://github.com/scummvm/scummvm/commit/04ea338dacb0d85de5cb1bcc8410bf47e2c80e78
Author: Joseph Davies (deledrius at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add detection for The Last Dinosaur Egg.
Detection for Windows and Macintosh versions of
Victor Vector & Yondo: The Last Dinosaur Egg.
Changed paths:
engines/director/detection.cpp
engines/director/detection_tables.h
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index 84dbed4b..8479abc 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -74,6 +74,7 @@ static const PlainGameDescriptor directorGames[] = {
{ "spyclub", "Spy Club" },
{ "amber", "AMBER: Journeys Beyond"},
{ "vvvampire", "Victor Vector & Yondo: The Vampire's Coffin"},
+ { "vvdinosaur", "Victor Vector & Yondo: The Last Dinosaur Egg"},
{ 0, 0 }
};
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index db61c6e..9e64aef 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -252,6 +252,34 @@ static const DirectorGameDescription gameDescriptions[] = {
3
},
+ {
+ {
+ "vvdinosaur",
+ "",
+ AD_ENTRY1("DINOSAUR.EXE", "4e6303630f4dd588e730d09241cf7e76"),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 3
+ },
+
+ {
+ {
+ "vvdinosaur",
+ "",
+ AD_ENTRY1("Start Game", "d41d8cd98f00b204e9800998ecf8427e"),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_MACRESFORK,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 3
+ },
+
{ AD_TABLE_END_MARKER, GID_GENERIC, 0 }
};
Commit: 14450b017f7d792b0bfb9e524608437b4e79eb33
https://github.com/scummvm/scummvm/commit/14450b017f7d792b0bfb9e524608437b4e79eb33
Author: Joseph Davies (deledrius at gmail.com)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Rename variables to match changes to AdvancedMetaEngine.
Follows guideline-conforming changes in 0b6befdcc5f5f.
Changed paths:
engines/director/detection.cpp
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index 8479abc..f31535e 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -88,7 +88,7 @@ static const char *directoryGlobs[] = {
class DirectorMetaEngine : public AdvancedMetaEngine {
public:
DirectorMetaEngine() : AdvancedMetaEngine(Director::gameDescriptions, sizeof(Director::DirectorGameDescription), directorGames) {
- _singleid = "director";
+ _singleId = "director";
_maxScanDepth = 2,
_directoryGlobs = directoryGlobs;
}
@@ -135,12 +135,12 @@ const ADGameDescription *DirectorMetaEngine::fallbackDetect(const FileMap &allFi
// reset fallback description
Director::DirectorGameDescription *desc = &s_fallbackDesc;
- desc->desc.gameid = "director";
+ desc->desc.gameId = "director";
desc->desc.extra = "";
desc->desc.language = Common::UNK_LANG;
desc->desc.flags = ADGF_NO_FLAGS;
desc->desc.platform = Common::kPlatformWindows;
- desc->desc.guioptions = GUIO0();
+ desc->desc.guiOptions = GUIO0();
desc->desc.filesDescriptions[0].fileName = 0;
desc->version = 0;
desc->gameID = Director::GID_GENERIC;
Commit: 2d7d95bc19288a010395421053e4f3d913154aee
https://github.com/scummvm/scummvm/commit/2d7d95bc19288a010395421053e4f3d913154aee
Author: Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add initial for support DIB resource
Changed paths:
A engines/director/dib.cpp
A engines/director/dib.h
engines/director/director.cpp
engines/director/module.mk
engines/director/resource.cpp
diff --git a/engines/director/dib.cpp b/engines/director/dib.cpp
new file mode 100644
index 0000000..3cf23d6
--- /dev/null
+++ b/engines/director/dib.cpp
@@ -0,0 +1,108 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "director/dib.h"
+
+#include "common/stream.h"
+#include "common/substream.h"
+#include "common/textconsole.h"
+#include "graphics/pixelformat.h"
+#include "graphics/surface.h"
+#include "image/codecs/codec.h"
+#include "common/debug.h"
+
+namespace Director {
+
+DIBDecoder::DIBDecoder() {
+ _surface = 0;
+ _palette = 0;
+ _paletteColorCount = 0;
+ _codec = 0;
+}
+
+DIBDecoder::~DIBDecoder() {
+ destroy();
+}
+
+void DIBDecoder::destroy() {
+ _surface = 0;
+
+ delete[] _palette;
+ _palette = 0;
+
+ _paletteColorCount = 0;
+
+ delete _codec;
+ _codec = 0;
+}
+
+void DIBDecoder::loadPalette(Common::SeekableReadStream &stream) {
+ uint16 palentries = 256;
+ _palette = new byte[1024];
+
+ uint16 size = stream.size();
+ uint16 index = 0;
+ for (int i = 6; i < stream.size() + 6; i+=6) {
+ uint16 n = size - i;
+ if (i >= palentries) {
+ break;
+ }
+ stream.seek(n + 4);
+ _palette[index] = stream.readByte();
+ ++index;
+ stream.seek(n + 2);
+ _palette[index] = stream.readByte();
+ ++index;
+ stream.seek(n);
+ _palette[index] = stream.readByte();
+ ++index;
+ _palette[index] = 0;
+ ++index;
+ }
+ while (index < 1024) {
+ _palette[index] = 0;
+ ++index;
+ }
+}
+
+bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
+ destroy();
+ if (stream.readByte() != 40)
+ return false;
+ if (stream.readByte() != 0)
+ return false;
+
+ stream.seek(4);
+ uint16 width = stream.readUint32LE();
+ uint16 height = stream.readUint32LE();
+ _paletteColorCount = (stream.readUint32LE() + stream.readUint32LE()) << 8;
+ _paletteColorCount = (_paletteColorCount == 0) ? 255: _paletteColorCount;
+ uint16 totalsize = 14 + stream.size() + sizeof(_palette)/sizeof(byte);
+
+ debug("%d", _paletteColorCount);
+ debug("%d", width);
+ debug("%d", height);
+ debug("%d", totalsize);
+ return true;
+}
+
+} // End of namespace Director
diff --git a/engines/director/dib.h b/engines/director/dib.h
new file mode 100644
index 0000000..c22b205
--- /dev/null
+++ b/engines/director/dib.h
@@ -0,0 +1,74 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+/**
+ * @file
+ * Image decoder used in engines:
+ * - hugo
+ * - mohawk
+ * - wintermute
+ */
+
+#ifndef IMAGE_BMP_H
+#define IMAGE_BMP_H
+
+#include "common/scummsys.h"
+#include "common/str.h"
+#include "image/image_decoder.h"
+
+namespace Common {
+class SeekableReadStream;
+}
+
+namespace Graphics {
+struct Surface;
+}
+
+namespace Image {
+class Codec;
+}
+
+namespace Director {
+
+class DIBDecoder : public Image::ImageDecoder {
+public:
+ DIBDecoder();
+ virtual ~DIBDecoder();
+
+ // ImageDecoder API
+ void destroy();
+ virtual bool loadStream(Common::SeekableReadStream &stream);
+ virtual const Graphics::Surface *getSurface() const { return _surface; }
+ const byte *getPalette() const { return _palette; }
+ void loadPalette(Common::SeekableReadStream &stream);
+ uint16 getPaletteColorCount() const { return _paletteColorCount; }
+
+private:
+ Image::Codec *_codec;
+ const Graphics::Surface *_surface;
+ byte *_palette;
+ uint8 _paletteColorCount;
+};
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index b6d6c19..5d30ea7 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -30,6 +30,7 @@
#include "common/stream.h"
#include "common/system.h"
#include "common/textconsole.h"
+#include "director/dib.h"
#include "director/director.h"
#include "director/resource.h"
diff --git a/engines/director/module.mk b/engines/director/module.mk
index ef47485..dbb60ee 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -3,8 +3,8 @@ MODULE := engines/director
MODULE_OBJS = \
detection.o \
director.o \
- resource.o
-
+ resource.o \
+ dib.o
# This module can be built as a plugin
ifeq ($(ENABLE_DIRECTOR), DYNAMIC_PLUGIN)
PLUGIN := 1
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 39a9282..8eb4b92 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -235,9 +235,9 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
uint32 cftcSize = stream->readUint32LE();
uint32 startPos = stream->pos();
stream->readUint32LE(); // unknown (always 0?)
-
while ((uint32)stream->pos() < startPos + cftcSize) {
uint32 tag = convertTagToUppercase(stream->readUint32BE());
+
uint32 size = stream->readUint32LE();
uint32 id = stream->readUint32LE();
uint32 offset = stream->readUint32LE();
@@ -270,8 +270,7 @@ Common::SeekableReadStream *RIFFArchive::getResource(uint32 tag, uint16 id) {
// Adjust to skip the resource header
uint32 offset = res.offset + 12;
- uint32 size = res.size - 12;
-
+ uint32 size = res.size - 4;
// Skip the Pascal string
_stream->seek(offset);
byte stringSize = _stream->readByte() + 1; // 1 for this byte
Commit: fc4f6087acfcfa08c490206d0f719adcc22f4388
https://github.com/scummvm/scummvm/commit/fc4f6087acfcfa08c490206d0f719adcc22f4388
Author: rootfather (scummvm at rootfather.de)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
GIT: Add a basic .gitignore file
Changed paths:
A engines/director/.gitignore
diff --git a/engines/director/.gitignore b/engines/director/.gitignore
new file mode 100644
index 0000000..ba6aed1
--- /dev/null
+++ b/engines/director/.gitignore
@@ -0,0 +1,4 @@
+*~
+*.o
+lib*.a
+.deps
\ No newline at end of file
Commit: b621fd7762ee520b29f43160068d003148d7f14c
https://github.com/scummvm/scummvm/commit/b621fd7762ee520b29f43160068d003148d7f14c
Author: rootfather (scummvm at rootfather.de)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add detection for "Masters of the Elements"
Currently, only the German Windows and Mac release are detected.
Changed paths:
engines/director/detection.cpp
engines/director/detection_tables.h
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index f31535e..0815dd9 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -71,6 +71,7 @@ static const PlainGameDescriptor directorGames[] = {
{ "jewels", "Jewels of the Oracle" },
{ "jman", "The Journeyman Project" },
{ "majestic", "Majestic Part I: Alien Encounter" },
+ { "melements", "Masters of the Elements" },
{ "spyclub", "Spy Club" },
{ "amber", "AMBER: Journeys Beyond"},
{ "vvvampire", "Victor Vector & Yondo: The Vampire's Coffin"},
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index 9e64aef..d0c3597 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -198,6 +198,44 @@ static const DirectorGameDescription gameDescriptions[] = {
{
{
+ // Masters of the Elements - German (from rootfather)
+ // Released in Germany as "Meister Zufall und die Herrscher der Elemente"
+ // Developed by IJsfontein, published by Tivola
+ // File version of MVM.EXE is 6.0.2.32
+ // The game disc is a hybrid CD-ROM containing both the Windows and the Macintosh release.
+
+ "melements",
+ "",
+ AD_ENTRY1("MVM.EXE", "518a98696fe1122e08410b0f157f21bf"),
+ Common::DE_DEU,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 5
+ },
+
+ {
+ {
+ // Masters of the Elements - German (from rootfather)
+ // Released in Germany as "Meister Zufall und die Herrscher der Elemente"
+ // Released on the same CD-ROM as the Windows release.
+
+ "melements",
+ "",
+ AD_ENTRY1("Meister Zufall", "65063397536553c4f6ff2a6c07194bf7"),
+ Common::DE_DEU,
+ Common::kPlatformMacintosh,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 5
+ },
+
+ {
+ {
"spyclub",
"",
AD_ENTRY1("SPYCLUB.EXE", "65d06b5fef155a2473434571aff5bc29"),
Commit: 1ebb5d2b072e7347dee3308cb1c50f6079bc5847
https://github.com/scummvm/scummvm/commit/1ebb5d2b072e7347dee3308cb1c50f6079bc5847
Author: rootfather (scummvm at rootfather.de)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add ADGF_MACRESFORK to melements target
Changed paths:
engines/director/detection_tables.h
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index d0c3597..be8f17c 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -227,7 +227,7 @@ static const DirectorGameDescription gameDescriptions[] = {
AD_ENTRY1("Meister Zufall", "65063397536553c4f6ff2a6c07194bf7"),
Common::DE_DEU,
Common::kPlatformMacintosh,
- ADGF_NO_FLAGS,
+ ADGF_MACRESFORK,
GUIO1(GUIO_NOASPECT)
},
GID_GENERIC,
Commit: acc0d70054f34f8acd2cc2e4647156c238cd2181
https://github.com/scummvm/scummvm/commit/acc0d70054f34f8acd2cc2e4647156c238cd2181
Author: Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add bookshelf example
Changed paths:
engines/director/director.cpp
engines/director/module.mk
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 5d30ea7..e064591 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -50,6 +50,15 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "data");
SearchMan.addSubDirectoryMatching(gameDataDir, "install");
+
+ //FIXME
+ RIFFArchive riff;
+ riff.openFile("bookshelf_example.mmm");
+ Common::SeekableReadStream *dib = riff.getResource(1145651744, 1103);
+ Common::SeekableReadStream *pal = riff.getResource(1129076052, 1025);
+ Director::DIBDecoder img;
+ img.loadPalette(*pal);
+ img.loadStream(*dib);
}
DirectorEngine::~DirectorEngine() {
diff --git a/engines/director/module.mk b/engines/director/module.mk
index dbb60ee..2e0dd04 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -2,9 +2,9 @@ MODULE := engines/director
MODULE_OBJS = \
detection.o \
+ dib.o \
director.o \
- resource.o \
- dib.o
+ resource.o
# This module can be built as a plugin
ifeq ($(ENABLE_DIRECTOR), DYNAMIC_PLUGIN)
PLUGIN := 1
Commit: 75a01e0ea096c17bb6809140c3c69026362ccbe2
https://github.com/scummvm/scummvm/commit/75a01e0ea096c17bb6809140c3c69026362ccbe2
Author: Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Refactoring palette loading
Changed paths:
engines/director/dib.cpp
engines/director/director.cpp
diff --git a/engines/director/dib.cpp b/engines/director/dib.cpp
index 3cf23d6..af7ef6c 100644
--- a/engines/director/dib.cpp
+++ b/engines/director/dib.cpp
@@ -28,6 +28,7 @@
#include "graphics/pixelformat.h"
#include "graphics/surface.h"
#include "image/codecs/codec.h"
+#include "common/util.h"
#include "common/debug.h"
namespace Director {
@@ -48,7 +49,6 @@ void DIBDecoder::destroy() {
delete[] _palette;
_palette = 0;
-
_paletteColorCount = 0;
delete _codec;
@@ -56,31 +56,28 @@ void DIBDecoder::destroy() {
}
void DIBDecoder::loadPalette(Common::SeekableReadStream &stream) {
- uint16 palentries = 256;
_palette = new byte[1024];
- uint16 size = stream.size();
- uint16 index = 0;
- for (int i = 6; i < stream.size() + 6; i+=6) {
- uint16 n = size - i;
- if (i >= palentries) {
- break;
- }
- stream.seek(n + 4);
- _palette[index] = stream.readByte();
- ++index;
- stream.seek(n + 2);
- _palette[index] = stream.readByte();
- ++index;
- stream.seek(n);
- _palette[index] = stream.readByte();
- ++index;
- _palette[index] = 0;
- ++index;
+ uint16 steps = stream.size()/6;
+ uint16 index = (steps * 4) - 1;
+
+ for (uint8 i = 0; i < steps; i++) {
+ _palette[index--] = 0;
+
+ _palette[index--] = stream.readByte();
+ stream.readByte();
+
+ _palette[index--] = stream.readByte();
+ stream.readByte();
+
+ _palette[index--] = stream.readByte();
+ stream.readByte();
}
+
+ index = (steps * 4) - 1;
+
while (index < 1024) {
- _palette[index] = 0;
- ++index;
+ _palette[index++] = 0;
}
}
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index e064591..0ddb8a7 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -54,11 +54,11 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
//FIXME
RIFFArchive riff;
riff.openFile("bookshelf_example.mmm");
- Common::SeekableReadStream *dib = riff.getResource(1145651744, 1103);
- Common::SeekableReadStream *pal = riff.getResource(1129076052, 1025);
Director::DIBDecoder img;
- img.loadPalette(*pal);
+ Common::SeekableReadStream *dib = riff.getResource(MKTAG('D', 'I', 'B', ' '), 1103);
img.loadStream(*dib);
+ Common::SeekableReadStream *pal = riff.getResource(MKTAG('C', 'L', 'U', 'T'), 1025);
+ img.loadPalette(*pal);
}
DirectorEngine::~DirectorEngine() {
Commit: c2414ae3815e92b768f194c8e353405e6b532919
https://github.com/scummvm/scummvm/commit/c2414ae3815e92b768f194c8e353405e6b532919
Author: Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Display test bitmap resource
Changed paths:
engines/director/dib.cpp
engines/director/dib.h
engines/director/director.cpp
diff --git a/engines/director/dib.cpp b/engines/director/dib.cpp
index af7ef6c..30c3234 100644
--- a/engines/director/dib.cpp
+++ b/engines/director/dib.cpp
@@ -27,10 +27,13 @@
#include "common/textconsole.h"
#include "graphics/pixelformat.h"
#include "graphics/surface.h"
+ #include "graphics/palette.h"
#include "image/codecs/codec.h"
#include "common/util.h"
#include "common/debug.h"
-
+#include "image/codecs/bmp_raw.h"
+#include "common/system.h"
+#include "common/events.h"
namespace Director {
DIBDecoder::DIBDecoder() {
@@ -56,14 +59,11 @@ void DIBDecoder::destroy() {
}
void DIBDecoder::loadPalette(Common::SeekableReadStream &stream) {
- _palette = new byte[1024];
-
+ _palette = new byte[768];
uint16 steps = stream.size()/6;
- uint16 index = (steps * 4) - 1;
+ uint16 index = (steps * 3) - 1;
for (uint8 i = 0; i < steps; i++) {
- _palette[index--] = 0;
-
_palette[index--] = stream.readByte();
stream.readByte();
@@ -74,15 +74,19 @@ void DIBDecoder::loadPalette(Common::SeekableReadStream &stream) {
stream.readByte();
}
- index = (steps * 4) - 1;
-
- while (index < 1024) {
+ index = (steps * 3) - 1;
+ while (index < 768) {
_palette[index++] = 0;
}
}
bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
- destroy();
+
+ byte *buf = (byte *)malloc(stream.size());
+ stream.read(buf, stream.size());
+ Common::hexdump(buf, stream.size());
+ stream.seek(0);
+
if (stream.readByte() != 40)
return false;
if (stream.readByte() != 0)
@@ -91,14 +95,28 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
stream.seek(4);
uint16 width = stream.readUint32LE();
uint16 height = stream.readUint32LE();
- _paletteColorCount = (stream.readUint32LE() + stream.readUint32LE()) << 8;
+ stream.seek(32);
+ _paletteColorCount = stream.readByte() + (stream.readByte() << 8);
_paletteColorCount = (_paletteColorCount == 0) ? 255: _paletteColorCount;
- uint16 totalsize = 14 + stream.size() + sizeof(_palette)/sizeof(byte);
+ uint16 totalsize = 14 + stream.size() + 1024;
+ uint16 imageRawSize = stream.size() - 40;
+ Common::SeekableSubReadStream subStream(&stream, 40, imageRawSize);
+
+ _codec = new Image::BitmapRawDecoder(width, height, 4);
+ _surface = _codec->decodeFrame(subStream);
+
+ //FIXME
+ g_system->getPaletteManager()->setPalette(_palette, 0, _paletteColorCount - 1);
+ g_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, 100, 100, 24, 24);
+ g_system->updateScreen();
- debug("%d", _paletteColorCount);
- debug("%d", width);
- debug("%d", height);
- debug("%d", totalsize);
+ int stop = 0;
+
+ while (stop < 100) {
+ g_system->delayMillis(50);
+ g_system->updateScreen();
+ stop++;
+ }
return true;
}
diff --git a/engines/director/dib.h b/engines/director/dib.h
index c22b205..c3243df 100644
--- a/engines/director/dib.h
+++ b/engines/director/dib.h
@@ -34,7 +34,7 @@
#include "common/scummsys.h"
#include "common/str.h"
#include "image/image_decoder.h"
-
+#include "image/codecs/bmp_raw.h"
namespace Common {
class SeekableReadStream;
}
@@ -63,7 +63,7 @@ public:
uint16 getPaletteColorCount() const { return _paletteColorCount; }
private:
- Image::Codec *_codec;
+ Image::BitmapRawDecoder *_codec;
const Graphics::Surface *_surface;
byte *_palette;
uint8 _paletteColorCount;
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 0ddb8a7..f64af75 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -34,6 +34,7 @@
#include "director/director.h"
#include "director/resource.h"
+#include "graphics/surface.h"
namespace Director {
@@ -55,10 +56,14 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
RIFFArchive riff;
riff.openFile("bookshelf_example.mmm");
Director::DIBDecoder img;
- Common::SeekableReadStream *dib = riff.getResource(MKTAG('D', 'I', 'B', ' '), 1103);
- img.loadStream(*dib);
+
Common::SeekableReadStream *pal = riff.getResource(MKTAG('C', 'L', 'U', 'T'), 1025);
img.loadPalette(*pal);
+
+ Common::SeekableReadStream *dib = riff.getResource(MKTAG('D', 'I', 'B', ' '), 1103);
+ img.loadStream(*dib);
+
+
}
DirectorEngine::~DirectorEngine() {
Commit: 1a3d44edc9b97c97b4ff9dc80747703a952f2409
https://github.com/scummvm/scummvm/commit/1a3d44edc9b97c97b4ff9dc80747703a952f2409
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix image loading, moved displaying to the engine
Changed paths:
engines/director/dib.cpp
engines/director/dib.h
engines/director/director.cpp
diff --git a/engines/director/dib.cpp b/engines/director/dib.cpp
index 30c3234..a8fc754 100644
--- a/engines/director/dib.cpp
+++ b/engines/director/dib.cpp
@@ -27,13 +27,13 @@
#include "common/textconsole.h"
#include "graphics/pixelformat.h"
#include "graphics/surface.h"
- #include "graphics/palette.h"
+#include "graphics/palette.h"
#include "image/codecs/codec.h"
#include "common/util.h"
#include "common/debug.h"
#include "image/codecs/bmp_raw.h"
#include "common/system.h"
-#include "common/events.h"
+
namespace Director {
DIBDecoder::DIBDecoder() {
@@ -78,7 +78,7 @@ void DIBDecoder::loadPalette(Common::SeekableReadStream &stream) {
while (index < 768) {
_palette[index++] = 0;
}
-}
+}
bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
@@ -87,36 +87,37 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
Common::hexdump(buf, stream.size());
stream.seek(0);
- if (stream.readByte() != 40)
- return false;
- if (stream.readByte() != 0)
+ uint32 headerSize = stream.readUint32LE();
+ if (headerSize != 40)
return false;
- stream.seek(4);
- uint16 width = stream.readUint32LE();
- uint16 height = stream.readUint32LE();
- stream.seek(32);
- _paletteColorCount = stream.readByte() + (stream.readByte() << 8);
+ uint32 width = stream.readUint32LE();
+ uint32 height = stream.readUint32LE();
+ stream.readUint16LE(); // planes
+ uint16 bitsPerPixel = stream.readUint16LE();
+ uint32 compression = stream.readUint32LE();
+ uint32 imageSize = stream.readUint32LE();
+ /* uint32 pixelsPerMeterX = */ stream.readUint32LE();
+ /* uint32 pixelsPerMeterY = */ stream.readUint32LE();
+ _paletteColorCount = stream.readUint32LE();
+ /* uint32 colorsImportant = */ stream.readUint32LE();
+
_paletteColorCount = (_paletteColorCount == 0) ? 255: _paletteColorCount;
- uint16 totalsize = 14 + stream.size() + 1024;
+
uint16 imageRawSize = stream.size() - 40;
Common::SeekableSubReadStream subStream(&stream, 40, imageRawSize);
- _codec = new Image::BitmapRawDecoder(width, height, 4);
+ warning("w: %d h: %d bpp: %d pal: %d size: %d (size rep: %d) comp: %x", width, height, bitsPerPixel, _paletteColorCount, imageRawSize, imageSize, compression);
+
+ _codec = Image::createBitmapCodec(compression, width, height, bitsPerPixel);
+ if (!_codec)
+ return false;
_surface = _codec->decodeFrame(subStream);
//FIXME
g_system->getPaletteManager()->setPalette(_palette, 0, _paletteColorCount - 1);
- g_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, 100, 100, 24, 24);
- g_system->updateScreen();
+ g_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, 0, 0, width, height);
- int stop = 0;
-
- while (stop < 100) {
- g_system->delayMillis(50);
- g_system->updateScreen();
- stop++;
- }
return true;
}
diff --git a/engines/director/dib.h b/engines/director/dib.h
index c3243df..e81b32b 100644
--- a/engines/director/dib.h
+++ b/engines/director/dib.h
@@ -63,7 +63,7 @@ public:
uint16 getPaletteColorCount() const { return _paletteColorCount; }
private:
- Image::BitmapRawDecoder *_codec;
+ Image::Codec *_codec;
const Graphics::Surface *_surface;
byte *_palette;
uint8 _paletteColorCount;
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index f64af75..bf4d4c5 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -26,12 +26,15 @@
#include "common/debug.h"
#include "common/scummsys.h"
#include "common/error.h"
+#include "common/events.h"
#include "common/macresman.h"
#include "common/stream.h"
#include "common/system.h"
#include "common/textconsole.h"
#include "director/dib.h"
+#include "engines/util.h"
+
#include "director/director.h"
#include "director/resource.h"
#include "graphics/surface.h"
@@ -51,6 +54,17 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "data");
SearchMan.addSubDirectoryMatching(gameDataDir, "install");
+}
+
+DirectorEngine::~DirectorEngine() {
+ delete _mainArchive;
+ delete _macBinary;
+}
+
+Common::Error DirectorEngine::run() {
+ debug("Starting v%d Director game", getVersion());
+
+ initGraphics(640, 480, true);
//FIXME
RIFFArchive riff;
@@ -63,16 +77,21 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
Common::SeekableReadStream *dib = riff.getResource(MKTAG('D', 'I', 'B', ' '), 1103);
img.loadStream(*dib);
+ bool stop = false;
-}
+ while (!stop) {
+ Common::Event event;
-DirectorEngine::~DirectorEngine() {
- delete _mainArchive;
- delete _macBinary;
-}
+ while (_eventMan->pollEvent(event)) {
+ if (event.type == Common::EVENT_QUIT)
+ stop = true;
+ }
-Common::Error DirectorEngine::run() {
- debug("Starting v%d Director game", getVersion());
+ g_system->updateScreen();
+ g_system->delayMillis(50);
+ }
+
+ return Common::kNoError;
if (getPlatform() == Common::kPlatformWindows)
loadEXE();
Commit: 9ed9a601165977780c45a562f38f36787918fe6d
https://github.com/scummvm/scummvm/commit/9ed9a601165977780c45a562f38f36787918fe6d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix DIB file reading
Changed paths:
engines/director/dib.cpp
diff --git a/engines/director/dib.cpp b/engines/director/dib.cpp
index a8fc754..b59d688 100644
--- a/engines/director/dib.cpp
+++ b/engines/director/dib.cpp
@@ -95,7 +95,7 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
uint32 height = stream.readUint32LE();
stream.readUint16LE(); // planes
uint16 bitsPerPixel = stream.readUint16LE();
- uint32 compression = stream.readUint32LE();
+ uint32 compression = stream.readUint32BE();
uint32 imageSize = stream.readUint32LE();
/* uint32 pixelsPerMeterX = */ stream.readUint32LE();
/* uint32 pixelsPerMeterY = */ stream.readUint32LE();
@@ -105,7 +105,7 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
_paletteColorCount = (_paletteColorCount == 0) ? 255: _paletteColorCount;
uint16 imageRawSize = stream.size() - 40;
- Common::SeekableSubReadStream subStream(&stream, 40, imageRawSize);
+ Common::SeekableSubReadStream subStream(&stream, 40, stream.size());
warning("w: %d h: %d bpp: %d pal: %d size: %d (size rep: %d) comp: %x", width, height, bitsPerPixel, _paletteColorCount, imageRawSize, imageSize, compression);
Commit: 08641d688dfb003af01a342a27a847f8cf75f192
https://github.com/scummvm/scummvm/commit/08641d688dfb003af01a342a27a847f8cf75f192
Author: Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: FIX load palette
Changed paths:
engines/director/dib.cpp
diff --git a/engines/director/dib.cpp b/engines/director/dib.cpp
index b59d688..733d666 100644
--- a/engines/director/dib.cpp
+++ b/engines/director/dib.cpp
@@ -59,24 +59,20 @@ void DIBDecoder::destroy() {
}
void DIBDecoder::loadPalette(Common::SeekableReadStream &stream) {
- _palette = new byte[768];
uint16 steps = stream.size()/6;
uint16 index = (steps * 3) - 1;
+ _palette = new byte[index];
for (uint8 i = 0; i < steps; i++) {
- _palette[index--] = stream.readByte();
+ _palette[index - 2] = stream.readByte();
stream.readByte();
- _palette[index--] = stream.readByte();
+ _palette[index - 1] = stream.readByte();
stream.readByte();
- _palette[index--] = stream.readByte();
+ _palette[index] = stream.readByte();
stream.readByte();
- }
-
- index = (steps * 3) - 1;
- while (index < 768) {
- _palette[index++] = 0;
+ index -= 3;
}
}
Commit: 2de66ee08396ca70bdb75e47867e7bd386c5bb9b
https://github.com/scummvm/scummvm/commit/2de66ee08396ca70bdb75e47867e7bd386c5bb9b
Author: Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add score data loader
Changed paths:
A engines/director/score.cpp
A engines/director/score.h
engines/director/dib.cpp
engines/director/director.cpp
engines/director/module.mk
diff --git a/engines/director/dib.cpp b/engines/director/dib.cpp
index 733d666..4310e54 100644
--- a/engines/director/dib.cpp
+++ b/engines/director/dib.cpp
@@ -78,10 +78,7 @@ void DIBDecoder::loadPalette(Common::SeekableReadStream &stream) {
bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
- byte *buf = (byte *)malloc(stream.size());
- stream.read(buf, stream.size());
- Common::hexdump(buf, stream.size());
- stream.seek(0);
+
uint32 headerSize = stream.readUint32LE();
if (headerSize != 40)
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index bf4d4c5..a4366b5 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -36,9 +36,11 @@
#include "engines/util.h"
#include "director/director.h"
+#include "director/score.h"
#include "director/resource.h"
#include "graphics/surface.h"
+
namespace Director {
DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
@@ -74,9 +76,12 @@ Common::Error DirectorEngine::run() {
Common::SeekableReadStream *pal = riff.getResource(MKTAG('C', 'L', 'U', 'T'), 1025);
img.loadPalette(*pal);
- Common::SeekableReadStream *dib = riff.getResource(MKTAG('D', 'I', 'B', ' '), 1103);
+ Common::SeekableReadStream *dib = riff.getResource(MKTAG('D', 'I', 'B', ' '), 1026);
img.loadStream(*dib);
+ Common::SeekableReadStream *scr = riff.getResource(MKTAG('V','W','S','C'),1024);
+ Director::Score score = Director::Score(*scr);
+
bool stop = false;
while (!stop) {
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 2e0dd04..cf4a587 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -4,7 +4,8 @@ MODULE_OBJS = \
detection.o \
dib.o \
director.o \
- resource.o
+ resource.o \
+ score.o
# This module can be built as a plugin
ifeq ($(ENABLE_DIRECTOR), DYNAMIC_PLUGIN)
PLUGIN := 1
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
new file mode 100644
index 0000000..299ef34
--- /dev/null
+++ b/engines/director/score.cpp
@@ -0,0 +1,270 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+#include "director/score.h"
+#include "common/stream.h"
+#include "common/debug.h"
+
+namespace Director {
+
+Score::Score(Common::SeekableReadStream &stream) {
+
+ uint32 size = stream.readUint32BE();
+ size -= 4;
+ uint16 channelSize;
+ uint16 channelOffset;
+
+ Frame* initial = new Frame();
+ frames.push_back(initial);
+
+ while (size != 0) {
+ uint16 frameSize = stream.readUint16BE();
+ size -= frameSize;
+ frameSize -= 2;
+ Frame* frame = new Frame(*frames.back());
+ while(frameSize != 0) {
+ channelSize = stream.readByte() * 2;
+ channelOffset = stream.readByte() * 2;
+ frame->readChannel(stream, channelOffset, channelSize);
+ frameSize -= channelSize + 2;
+ }
+ frames.push_back(frame);
+ debug("*************FRAME %d****************", frames.size() - 1);
+ for (byte i = 0; i < CHANNEL_COUNT; i++) {
+ debug("Channel %d, enabled %d, castId %d, X %d, Y %d, width %d, height %d",
+ i, frame->sprites[i]->enabled,
+ frame->sprites[i]->castId,
+ frame->sprites[i]->startPoint.x,
+ frame->sprites[i]->startPoint.y,
+ frame->sprites[i]->width,
+ frame->sprites[i]->height);
+ }
+ }
+ //remove initial frame
+ frames.remove_at(0);
+}
+
+Frame::Frame() {
+ transFlags = 0;
+ transChunkSize = 0;
+ tempo = 0;
+
+ sound1 = 0;
+ sound2 = 0;
+ soundType1 = 0;
+ soundType2 = 0;
+
+ actionId = 0;
+ skipFrameFlag = 0;
+ blend = 0;
+
+ sprites.resize(CHANNEL_COUNT);
+ for (uint16 i = 0; i < sprites.size(); i++) {
+ Sprite* sp = new Sprite();
+ sprites[i] = sp;
+ }
+}
+
+Frame::Frame(const Frame& frame) {
+ actionId = frame.actionId;
+ transFlags = frame.transFlags;
+ transType = frame.transType;
+ tempo = frame.tempo;
+ sound1 = frame.sound1;
+ sound2 = frame.sound2;
+ soundType1 = frame.soundType1;
+ soundType2 = frame.soundType2;
+ skipFrameFlag = frame.skipFrameFlag;
+ blend = frame.blend;
+
+ sprites.resize(CHANNEL_COUNT);
+ for (uint16 i = 0; i < CHANNEL_COUNT; i++) {
+ sprites[i] = new Sprite(*frame.sprites[i]);;
+ }
+}
+
+Frame::~Frame() {
+ for (uint16 i = 0; i < sprites.size(); i++) {
+ delete sprites[i];
+ }
+}
+
+void Frame::readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size) {
+ if (offset >= 32) {
+ if (size <= 16)
+ readSprite(stream, offset, size);
+ else {
+ //read > 1 sprites channel
+ while (size > 16) {
+ byte spritePosition = (offset - 32) / 16;
+ uint16 nextStart = (spritePosition + 1) * 16 + 32;
+ uint16 needSize = nextStart - offset;
+ readSprite(stream, offset, needSize);
+ offset += needSize;
+ size -= needSize;
+ }
+ readSprite(stream, offset, size);
+ }
+ } else {
+ readMainChannels(stream, offset, size);
+ }
+
+}
+
+void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset, uint16 size) {
+ uint16 finishPosition = offset + size;
+
+ while (offset < finishPosition) {
+ switch(offset) {
+ case kScriptIdPosition:
+ actionId = stream.readByte();
+ offset++;
+ break;
+ case kSoundType1Position:
+ soundType1 = stream.readByte();
+ offset++;
+ break;
+ case kTransFlagsPosition:
+ transFlags = stream.readByte();
+ offset++;
+ break;
+ case kTransChunkSizePosition:
+ transChunkSize = stream.readByte();
+ offset++;
+ break;
+ case kTempoPosition:
+ tempo = stream.readByte();
+ offset++;
+ break;
+ case kTransTypePosition:
+ transType = stream.readByte();
+ offset++;
+ break;
+ case kSound1Position:
+ sound1 = stream.readUint16BE();
+ offset+=2;
+ break;
+ case kSkipFrameFlagsPosition:
+ skipFrameFlag = stream.readByte();
+ offset++;
+ break;
+ case kBlendPosition:
+ blend = stream.readByte();
+ offset++;
+ break;
+ case kSound2Position:
+ sound2 = stream.readUint16BE();
+ offset += 2;
+ break;
+ case kSound2TypePosition:
+ soundType2 = stream.readByte();
+ offset += 1;
+ break;
+ case kPaletePosition:
+ //TODO palette channel
+ stream.skip(16);
+ offset += 16;
+ default:
+ offset++;
+ stream.readByte();
+ debug("Field Position %d, Finish Position %d", offset, finishPosition);
+ break;
+ }
+ }
+
+}
+
+void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size) {
+ uint16 spritePosition = (offset - 32) / 16;
+ uint16 spriteStart = spritePosition * 16 + 32;
+
+ uint16 fieldPosition = offset - spriteStart;
+ uint16 finishPosition = fieldPosition + size;
+
+ Sprite& sprite = *sprites[spritePosition];
+
+ while (fieldPosition < finishPosition) {
+ switch (fieldPosition) {
+ case kSpritePositionUnk1:
+ /*byte x1 = */ stream.readByte();
+ fieldPosition++;
+ break;
+ case kSpritePositionEnabled:
+ sprite.enabled = (stream.readByte() != 0);
+ fieldPosition++;
+ break;
+ case kSpritePositionUnk2:
+ /*byte x2 = */ stream.readUint16BE();
+ fieldPosition += 2;
+ break;
+ case kSpritePositionFlags:
+ sprite.flags = stream.readUint16BE();
+ fieldPosition += 2;
+ break;
+ case kSpritePositionCastId:
+ sprite.castId = stream.readUint16BE();
+ fieldPosition += 2;
+ break;
+ case kSpritePositionY:
+ sprite.startPoint.y = stream.readUint16BE();
+ fieldPosition += 2;
+ break;
+ case kSpritePositionX:
+ sprite.startPoint.x = stream.readUint16BE();
+ fieldPosition += 2;
+ break;
+ case kSpritePositionWidth:
+ sprite.width = stream.readUint16BE();
+ fieldPosition += 2;
+ break;
+ case kSpritePositionHeight:
+ sprite.height = stream.readUint16BE();
+ fieldPosition += 2;
+ break;
+ default:
+ //end cycle, go to next sprite channel
+ readSprite(stream, spriteStart + 16, finishPosition - fieldPosition);
+ fieldPosition = finishPosition;
+ break;
+ }
+ }
+}
+
+Sprite::Sprite() {
+ enabled = false;
+ width = 0;
+ flags = 0;
+ height = 0;
+ castId = 0;
+ castId = 0;
+}
+
+Sprite::Sprite(const Sprite& sprite) {
+ enabled = sprite.enabled;
+ castId = sprite.castId;
+ flags = sprite.flags;
+ width = sprite.width;
+ height = sprite.height;
+ startPoint.x = sprite.startPoint.x;
+ startPoint.y = sprite.startPoint.y;
+}
+
+} //End of namespace Director
\ No newline at end of file
diff --git a/engines/director/score.h b/engines/director/score.h
new file mode 100644
index 0000000..25d6cdd
--- /dev/null
+++ b/engines/director/score.h
@@ -0,0 +1,117 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/rect.h"
+#include "common/stream.h"
+#include "common/array.h"
+namespace Director {
+
+#define CHANNEL_COUNT 24
+
+enum castType {
+ kCastBitmap = 1,
+ kCastFilmLoop,
+ kCastText,
+ kCastPalette,
+ kCastPicture,
+ kCastSound,
+ kCastButton,
+ kCastShape,
+ kCastMovie,
+ kCastDigitalVideo,
+ kCastScript
+};
+
+enum spritePositions {
+ kSpritePositionUnk1 = 0,
+ kSpritePositionEnabled,
+ kSpritePositionUnk2,
+ kSpritePositionFlags = 4,
+ kSpritePositionCastId = 6,
+ kSpritePositionY = 8,
+ kSpritePositionX = 10,
+ kSpritePositionWidth = 12,
+ kSpritePositionHeight = 14
+};
+
+enum mainChannelsPosition {
+ kScriptIdPosition = 0,
+ kSoundType1Position,
+ kTransFlagsPosition,
+ kTransChunkSizePosition,
+ kTempoPosition,
+ kTransTypePosition,
+ kSound1Position,
+ kSkipFrameFlagsPosition = 8,
+ kBlendPosition,
+ kSound2Position,
+ kSound2TypePosition = 11,
+ kPaletePosition = 15
+};
+
+struct Sprite {
+public:
+ bool enabled;
+ uint8 castId;
+ //castType type;
+ uint16 flags;
+ Common::Point startPoint;
+ uint16 width;
+ uint16 height;
+ Sprite();
+ Sprite(const Sprite& sprite);
+};
+
+struct Frame {
+public:
+ uint8 actionId;
+
+ uint8 transFlags;
+ uint8 transChunkSize;
+ uint8 transType;
+ uint8 tempo;
+
+ uint16 sound1;
+ uint8 soundType1;
+ uint16 sound2;
+ uint8 soundType2;
+
+ uint8 skipFrameFlag;
+ uint8 blend;
+ Common::Array<Sprite*> sprites;
+
+ Frame();
+ ~Frame();
+ Frame(const Frame& frame);
+ void readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
+private:
+ void readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
+ void readMainChannels(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
+};
+
+struct Score {
+public:
+ Score(Common::SeekableReadStream &stream);
+ Common::Array<Frame*> frames;
+};
+
+} //End of namespace Director
\ No newline at end of file
Commit: 11c9bbd9cb78ea4229e9cd64ad1d31e46d32ec41
https://github.com/scummvm/scummvm/commit/11c9bbd9cb78ea4229e9cd64ad1d31e46d32ec41
Author: Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Play score, display DIB sprites
Changed paths:
engines/director/dib.cpp
engines/director/director.cpp
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/dib.cpp b/engines/director/dib.cpp
index 4310e54..6053d55 100644
--- a/engines/director/dib.cpp
+++ b/engines/director/dib.cpp
@@ -100,17 +100,10 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
uint16 imageRawSize = stream.size() - 40;
Common::SeekableSubReadStream subStream(&stream, 40, stream.size());
- warning("w: %d h: %d bpp: %d pal: %d size: %d (size rep: %d) comp: %x", width, height, bitsPerPixel, _paletteColorCount, imageRawSize, imageSize, compression);
-
_codec = Image::createBitmapCodec(compression, width, height, bitsPerPixel);
if (!_codec)
return false;
_surface = _codec->decodeFrame(subStream);
-
- //FIXME
- g_system->getPaletteManager()->setPalette(_palette, 0, _paletteColorCount - 1);
- g_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, 0, 0, width, height);
-
return true;
}
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index a4366b5..5c2c7ad 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -66,37 +66,13 @@ DirectorEngine::~DirectorEngine() {
Common::Error DirectorEngine::run() {
debug("Starting v%d Director game", getVersion());
- initGraphics(640, 480, true);
-
//FIXME
- RIFFArchive riff;
- riff.openFile("bookshelf_example.mmm");
- Director::DIBDecoder img;
-
- Common::SeekableReadStream *pal = riff.getResource(MKTAG('C', 'L', 'U', 'T'), 1025);
- img.loadPalette(*pal);
-
- Common::SeekableReadStream *dib = riff.getResource(MKTAG('D', 'I', 'B', ' '), 1026);
- img.loadStream(*dib);
-
- Common::SeekableReadStream *scr = riff.getResource(MKTAG('V','W','S','C'),1024);
- Director::Score score = Director::Score(*scr);
-
- bool stop = false;
-
- while (!stop) {
- Common::Event event;
-
- while (_eventMan->pollEvent(event)) {
- if (event.type == Common::EVENT_QUIT)
- stop = true;
- }
-
- g_system->updateScreen();
- g_system->delayMillis(50);
- }
+ _mainArchive = new RIFFArchive();
+ _mainArchive->openFile("bookshelf_example.mmm");
- return Common::kNoError;
+ Common::SeekableReadStream *scr = _mainArchive->getResource(MKTAG('V','W','S','C'), 1024);
+ Score score(*scr);
+ score.play();
if (getPlatform() == Common::kPlatformWindows)
loadEXE();
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 299ef34..964ea39 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -19,10 +19,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
+
#include "director/score.h"
#include "common/stream.h"
#include "common/debug.h"
+#include "common/system.h"
+#include "director/dib.h"
+#include "director/resource.h"
+
+#include "graphics/palette.h"
+#include "common/events.h"
+#include "engines/util.h"
+
namespace Director {
Score::Score(Common::SeekableReadStream &stream) {
@@ -32,78 +41,88 @@ Score::Score(Common::SeekableReadStream &stream) {
uint16 channelSize;
uint16 channelOffset;
- Frame* initial = new Frame();
- frames.push_back(initial);
+ Frame *initial = new Frame();
+ _frames.push_back(initial);
while (size != 0) {
uint16 frameSize = stream.readUint16BE();
size -= frameSize;
frameSize -= 2;
- Frame* frame = new Frame(*frames.back());
- while(frameSize != 0) {
+ Frame *frame = new Frame(*_frames.back());
+ while (frameSize != 0) {
channelSize = stream.readByte() * 2;
channelOffset = stream.readByte() * 2;
frame->readChannel(stream, channelOffset, channelSize);
frameSize -= channelSize + 2;
}
- frames.push_back(frame);
- debug("*************FRAME %d****************", frames.size() - 1);
- for (byte i = 0; i < CHANNEL_COUNT; i++) {
- debug("Channel %d, enabled %d, castId %d, X %d, Y %d, width %d, height %d",
- i, frame->sprites[i]->enabled,
- frame->sprites[i]->castId,
- frame->sprites[i]->startPoint.x,
- frame->sprites[i]->startPoint.y,
- frame->sprites[i]->width,
- frame->sprites[i]->height);
- }
+ _frames.push_back(frame);
}
//remove initial frame
- frames.remove_at(0);
+ _frames.remove_at(0);
+}
+
+void Score::play() {
+ initGraphics(800, 800, true);
+ uint32 frameId = 0;
+
+ bool stop = false;
+
+ while (frameId != _frames.size() && !stop) {
+ Common::Event event;
+
+ while (g_system->getEventManager()->pollEvent(event)) {
+ if (event.type == Common::EVENT_QUIT)
+ stop = true;
+ }
+ _frames[frameId]->display();
+ frameId++;
+ g_system->updateScreen();
+ g_system->delayMillis(200);
+ }
}
Frame::Frame() {
- transFlags = 0;
- transChunkSize = 0;
- tempo = 0;
+ _transFlags = 0;
+ _transChunkSize = 0;
+ _tempo = 0;
- sound1 = 0;
- sound2 = 0;
- soundType1 = 0;
- soundType2 = 0;
+ _sound1 = 0;
+ _sound2 = 0;
+ _soundType1 = 0;
+ _soundType2 = 0;
- actionId = 0;
- skipFrameFlag = 0;
- blend = 0;
+ _actionId = 0;
+ _skipFrameFlag = 0;
+ _blend = 0;
- sprites.resize(CHANNEL_COUNT);
- for (uint16 i = 0; i < sprites.size(); i++) {
- Sprite* sp = new Sprite();
- sprites[i] = sp;
+ _sprites.resize(CHANNEL_COUNT);
+ for (uint16 i = 0; i < _sprites.size(); i++) {
+ Sprite *sp = new Sprite();
+ _sprites[i] = sp;
}
}
-Frame::Frame(const Frame& frame) {
- actionId = frame.actionId;
- transFlags = frame.transFlags;
- transType = frame.transType;
- tempo = frame.tempo;
- sound1 = frame.sound1;
- sound2 = frame.sound2;
- soundType1 = frame.soundType1;
- soundType2 = frame.soundType2;
- skipFrameFlag = frame.skipFrameFlag;
- blend = frame.blend;
+Frame::Frame(const Frame &frame) {
+ _actionId = frame._actionId;
+ _transFlags = frame._transFlags;
+ _transType = frame._transType;
+ _tempo = frame._tempo;
+ _sound1 = frame._sound1;
+ _sound2 = frame._sound2;
+ _soundType1 = frame._soundType1;
+ _soundType2 = frame._soundType2;
+ _skipFrameFlag = frame._skipFrameFlag;
+ _blend = frame._blend;
- sprites.resize(CHANNEL_COUNT);
+ _sprites.resize(CHANNEL_COUNT);
for (uint16 i = 0; i < CHANNEL_COUNT; i++) {
- sprites[i] = new Sprite(*frame.sprites[i]);;
+ _sprites[i] = new Sprite(*frame._sprites[i]);
}
}
Frame::~Frame() {
- for (uint16 i = 0; i < sprites.size(); i++) {
- delete sprites[i];
+ for (uint16 i = 0; i < _sprites.size(); i++) {
+ delete _sprites[i];
}
}
@@ -126,7 +145,6 @@ void Frame::readChannel(Common::SeekableReadStream &stream, uint16 offset, uint1
} else {
readMainChannels(stream, offset, size);
}
-
}
void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset, uint16 size) {
@@ -135,47 +153,47 @@ void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset,
while (offset < finishPosition) {
switch(offset) {
case kScriptIdPosition:
- actionId = stream.readByte();
+ _actionId = stream.readByte();
offset++;
break;
case kSoundType1Position:
- soundType1 = stream.readByte();
+ _soundType1 = stream.readByte();
offset++;
break;
case kTransFlagsPosition:
- transFlags = stream.readByte();
+ _transFlags = stream.readByte();
offset++;
break;
case kTransChunkSizePosition:
- transChunkSize = stream.readByte();
+ _transChunkSize = stream.readByte();
offset++;
break;
case kTempoPosition:
- tempo = stream.readByte();
+ _tempo = stream.readByte();
offset++;
break;
case kTransTypePosition:
- transType = stream.readByte();
+ _transType = stream.readByte();
offset++;
break;
case kSound1Position:
- sound1 = stream.readUint16BE();
+ _sound1 = stream.readUint16BE();
offset+=2;
break;
case kSkipFrameFlagsPosition:
- skipFrameFlag = stream.readByte();
+ _skipFrameFlag = stream.readByte();
offset++;
break;
case kBlendPosition:
- blend = stream.readByte();
+ _blend = stream.readByte();
offset++;
break;
case kSound2Position:
- sound2 = stream.readUint16BE();
+ _sound2 = stream.readUint16BE();
offset += 2;
break;
case kSound2TypePosition:
- soundType2 = stream.readByte();
+ _soundType2 = stream.readByte();
offset += 1;
break;
case kPaletePosition:
@@ -188,18 +206,17 @@ void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset,
debug("Field Position %d, Finish Position %d", offset, finishPosition);
break;
}
- }
-
+ }
}
void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size) {
uint16 spritePosition = (offset - 32) / 16;
uint16 spriteStart = spritePosition * 16 + 32;
-
+
uint16 fieldPosition = offset - spriteStart;
uint16 finishPosition = fieldPosition + size;
- Sprite& sprite = *sprites[spritePosition];
+ Sprite &sprite = *_sprites[spritePosition];
while (fieldPosition < finishPosition) {
switch (fieldPosition) {
@@ -208,7 +225,7 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
fieldPosition++;
break;
case kSpritePositionEnabled:
- sprite.enabled = (stream.readByte() != 0);
+ sprite._enabled = (stream.readByte() != 0);
fieldPosition++;
break;
case kSpritePositionUnk2:
@@ -216,27 +233,27 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
fieldPosition += 2;
break;
case kSpritePositionFlags:
- sprite.flags = stream.readUint16BE();
+ sprite._flags = stream.readUint16BE();
fieldPosition += 2;
break;
case kSpritePositionCastId:
- sprite.castId = stream.readUint16BE();
+ sprite._castId = stream.readUint16BE();
fieldPosition += 2;
break;
case kSpritePositionY:
- sprite.startPoint.y = stream.readUint16BE();
+ sprite._startPoint.y = stream.readUint16BE();
fieldPosition += 2;
break;
case kSpritePositionX:
- sprite.startPoint.x = stream.readUint16BE();
+ sprite._startPoint.x = stream.readUint16BE();
fieldPosition += 2;
break;
case kSpritePositionWidth:
- sprite.width = stream.readUint16BE();
+ sprite._width = stream.readUint16BE();
fieldPosition += 2;
break;
case kSpritePositionHeight:
- sprite.height = stream.readUint16BE();
+ sprite._height = stream.readUint16BE();
fieldPosition += 2;
break;
default:
@@ -248,23 +265,47 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
}
}
+void Frame::display() {
+ //FIXME
+ RIFFArchive riff;
+ riff.openFile("bookshelf_example.mmm");
+
+ DIBDecoder palette;
+ Common::SeekableReadStream *pal = riff.getResource(MKTAG('C', 'L', 'U', 'T'), 1025);
+ palette.loadPalette(*pal);
+ g_system->getPaletteManager()->setPalette(palette.getPalette(), 0, 255);
+
+ for (uint16 i = 0; i < CHANNEL_COUNT; i++) {
+ if (_sprites[i]->_enabled) {
+ DIBDecoder img;
+ uint32 castId = 1024 + _sprites[i]->_castId;
+ img.loadStream(*riff.getResource(MKTAG('D', 'I', 'B', ' '), castId));
+ g_system->copyRectToScreen(img.getSurface()->getPixels(), img.getSurface()->pitch,
+ _sprites[i]->_startPoint.x,
+ _sprites[i]->_startPoint.y,
+ _sprites[i]->_height,
+ _sprites[i]->_width);
+ }
+ }
+}
+
Sprite::Sprite() {
- enabled = false;
- width = 0;
- flags = 0;
- height = 0;
- castId = 0;
- castId = 0;
+ _enabled = false;
+ _width = 0;
+ _flags = 0;
+ _height = 0;
+ _castId = 0;
+ _castId = 0;
}
-Sprite::Sprite(const Sprite& sprite) {
- enabled = sprite.enabled;
- castId = sprite.castId;
- flags = sprite.flags;
- width = sprite.width;
- height = sprite.height;
- startPoint.x = sprite.startPoint.x;
- startPoint.y = sprite.startPoint.y;
+Sprite::Sprite(const Sprite &sprite) {
+ _enabled = sprite._enabled;
+ _castId = sprite._castId;
+ _flags = sprite._flags;
+ _width = sprite._width;
+ _height = sprite._height;
+ _startPoint.x = sprite._startPoint.x;
+ _startPoint.y = sprite._startPoint.y;
}
-} //End of namespace Director
\ No newline at end of file
+} //End of namespace Director
diff --git a/engines/director/score.h b/engines/director/score.h
index 25d6cdd..cadd130 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -23,6 +23,8 @@
#include "common/rect.h"
#include "common/stream.h"
#include "common/array.h"
+#include "director/resource.h"
+
namespace Director {
#define CHANNEL_COUNT 24
@@ -68,50 +70,56 @@ enum mainChannelsPosition {
kPaletePosition = 15
};
-struct Sprite {
+class Sprite {
public:
- bool enabled;
- uint8 castId;
- //castType type;
- uint16 flags;
- Common::Point startPoint;
- uint16 width;
- uint16 height;
Sprite();
- Sprite(const Sprite& sprite);
+ Sprite(const Sprite &sprite);
+ bool _enabled;
+ uint8 _castId;
+ //castType type;
+ uint16 _flags;
+ Common::Point _startPoint;
+ uint16 _width;
+ uint16 _height;
};
-struct Frame {
+class Frame {
public:
- uint8 actionId;
-
- uint8 transFlags;
- uint8 transChunkSize;
- uint8 transType;
- uint8 tempo;
-
- uint16 sound1;
- uint8 soundType1;
- uint16 sound2;
- uint8 soundType2;
-
- uint8 skipFrameFlag;
- uint8 blend;
- Common::Array<Sprite*> sprites;
-
Frame();
~Frame();
- Frame(const Frame& frame);
+ Frame(const Frame &frame);
void readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
+ void display();
+
private:
void readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
void readMainChannels(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
+
+public:
+ uint8 _actionId;
+ uint8 _transFlags;
+ uint8 _transChunkSize;
+ uint8 _transType;
+ uint8 _tempo;
+
+ uint16 _sound1;
+ uint8 _soundType1;
+ uint16 _sound2;
+ uint8 _soundType2;
+
+ uint8 _skipFrameFlag;
+ uint8 _blend;
+ Common::Array<Sprite *> _sprites;
+
};
-struct Score {
+class Score {
+public:
+ Common::Array<Frame *> _frames;
+
public:
- Score(Common::SeekableReadStream &stream);
- Common::Array<Frame*> frames;
+ Score(Common::SeekableReadStream &stream);
+ void play();
};
-} //End of namespace Director
\ No newline at end of file
+} //End of namespace Director
Commit: 60348aa02a95154f6a0b36b9a9097b4255c85888
https://github.com/scummvm/scummvm/commit/60348aa02a95154f6a0b36b9a9097b4255c85888
Author: Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Read movie version
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 964ea39..733e96a 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -61,6 +61,12 @@ Score::Score(Common::SeekableReadStream &stream) {
_frames.remove_at(0);
}
+void Score::readVersion(uint32 rid) {
+ _versionMinor = rid & 0xffff;
+ _versionMajor = rid >> 16;
+ debug("%d.%d", _versionMajor, _versionMinor);
+}
+
void Score::play() {
initGraphics(800, 800, true);
uint32 frameId = 0;
diff --git a/engines/director/score.h b/engines/director/score.h
index cadd130..fe09b1c 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -117,8 +117,13 @@ class Score {
public:
Common::Array<Frame *> _frames;
+private:
+ uint16 _versionMinor;
+ uint16 _versionMajor;
+
public:
Score(Common::SeekableReadStream &stream);
+ void readVersion(uint32 rid);
void play();
};
Commit: 5718268106a463a2f58af92856f1ceb72ad4f3cb
https://github.com/scummvm/scummvm/commit/5718268106a463a2f58af92856f1ceb72ad4f3cb
Author: Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Load cast data and movie config
Changed paths:
engines/director/director.cpp
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 5c2c7ad..ff294a7 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -72,6 +72,13 @@ Common::Error DirectorEngine::run() {
Common::SeekableReadStream *scr = _mainArchive->getResource(MKTAG('V','W','S','C'), 1024);
Score score(*scr);
+
+ Common::SeekableReadStream *conf = _mainArchive->getResource(MKTAG('V','W','C','F'), 1024);
+ score.loadConfig(*conf);
+
+ Common::SeekableReadStream *records = _mainArchive->getResource(MKTAG('V','W','C','R'), 1024);
+ score.loadCastData(*records);
+
score.play();
if (getPlatform() == Common::kPlatformWindows)
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 733e96a..c83ff5a 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -61,12 +61,146 @@ Score::Score(Common::SeekableReadStream &stream) {
_frames.remove_at(0);
}
+void Score::loadConfig(Common::SeekableReadStream &stream) {
+ /*uint16 unk1 = */ stream.readUint16BE();
+ /*ver1 = */ stream.readUint16BE();
+ _movieRect.top = stream.readUint16BE();
+ _movieRect.left = stream.readUint16BE();
+ _movieRect.bottom = stream.readUint16BE();
+ _movieRect.right = stream.readUint16BE();
+
+ _castArrayStart = stream.readUint16BE();
+ _castArrayEnd = stream.readUint16BE();
+ _initialFrameRate = stream.readByte();
+ stream.skip(9);
+ /*uint16 stageColor = */ stream.readUint16BE();
+}
+
void Score::readVersion(uint32 rid) {
_versionMinor = rid & 0xffff;
_versionMajor = rid >> 16;
debug("%d.%d", _versionMajor, _versionMinor);
}
+void Score::loadCastData(Common::SeekableReadStream &stream) {
+ for (uint16 id = _castArrayStart; id < _castArrayEnd; id++) {
+ byte size = stream.readByte();
+ if (size > 0) {
+ debug("%d", stream.pos());
+ uint8 castType = stream.readByte();
+ switch (castType) {
+ case kCastBitmap:
+ _casts[id] = getBitmapCast(stream);
+ _casts[id]->type = kCastBitmap;
+ break;
+ case kCastText:
+ _casts[id] = getTextCast(stream);
+ _casts[id]->type = kCastText;
+ break;
+ case kCastShape:
+ _casts[id] = getShapeCast(stream);
+ _casts[id]->type = kCastShape;
+ break;
+ case kCastButton:
+ _casts[id] = getButtonCast(stream);
+ _casts[id]->type = kCastButton;
+ break;
+ default:
+ warning("Unhandled cast type: %d", castType);
+ stream.skip(size - 1);
+ break;
+ }
+ }
+ }
+}
+
+BitmapCast *Score::getBitmapCast(Common::SeekableReadStream &stream) {
+ BitmapCast *cast = new BitmapCast();
+ /*byte flags = */ stream.readByte();
+ /*uint16 someFlaggyThing = */ stream.readUint16BE();
+
+ cast->initialRect.top = stream.readUint16BE();
+ cast->initialRect.left = stream.readUint16BE();
+ cast->initialRect.bottom = stream.readUint16BE();
+ cast->initialRect.right = stream.readUint16BE();
+
+ cast->boundingRect.top = stream.readUint16BE();
+ cast->boundingRect.left = stream.readUint16BE();
+ cast->boundingRect.bottom = stream.readUint16BE();
+ cast->boundingRect.right = stream.readUint16BE();
+
+ cast->regX = stream.readUint16BE();
+ cast->regY = stream.readUint16BE();
+ /*uint16 unk1 =*/ stream.readUint16BE();
+ /*uint16 unk2 =*/ stream.readUint16BE();
+ return cast;
+}
+
+TextCast *Score::getTextCast(Common::SeekableReadStream &stream) {
+ TextCast *cast = new TextCast();
+ /*byte flags =*/ stream.readByte();
+ cast->borderSize = stream.readByte();
+ cast->gutterSize = stream.readByte();
+ cast->boxShadow = stream.readByte();
+ cast->textType = stream.readByte();
+ cast->textAlign = stream.readUint16BE();
+ stream.skip(6); //palinfo
+ /*uint32 unk1 = */ stream.readUint32BE();
+
+ cast->initialRect.top = stream.readUint16BE();
+ cast->initialRect.left = stream.readUint16BE();
+ cast->initialRect.bottom = stream.readUint16BE();
+ cast->initialRect.right = stream.readUint16BE();
+
+ cast->textShadow = stream.readByte();
+ cast->textFlags = stream.readByte();
+ /*uint16 unk2 =*/ stream.readUint16BE();
+ return cast;
+}
+
+ShapeCast *Score::getShapeCast(Common::SeekableReadStream &stream) {
+ ShapeCast *cast = new ShapeCast();
+ /*byte flags = */ stream.readByte();
+ /*unk1 = */ stream.readByte();
+ cast->shapeType = stream.readByte();
+
+ cast->initialRect.top = stream.readUint16BE();
+ cast->initialRect.left = stream.readUint16BE();
+ cast->initialRect.bottom = stream.readUint16BE();
+ cast->initialRect.right = stream.readUint16BE();
+
+ cast->pattern = stream.readUint16BE();
+ cast->fgCol = stream.readByte();
+ cast->bgCol = stream.readByte();
+ cast->fillType = stream.readByte();
+ cast->lineThickness = stream.readByte();
+ cast->lineDirection = stream.readByte();
+ return cast;
+}
+
+ButtonCast *Score::getButtonCast(Common::SeekableReadStream &stream) {
+ ButtonCast *cast = new ButtonCast();
+ /*byte flags =*/ stream.readByte();
+ cast->borderSize = stream.readByte();
+ cast->gutterSize = stream.readByte();
+ cast->boxShadow = stream.readByte();
+ cast->textType = stream.readByte();
+ cast->textAlign = stream.readUint16BE();
+ stream.skip(6); //palinfo
+ /*uint32 unk1 = */ stream.readUint32BE();
+
+ cast->initialRect.top = stream.readUint16BE();
+ cast->initialRect.left = stream.readUint16BE();
+ cast->initialRect.bottom = stream.readUint16BE();
+ cast->initialRect.right = stream.readUint16BE();
+
+ cast->textShadow = stream.readByte();
+ cast->textFlags = stream.readByte();
+ /*uint16 unk2 =*/ stream.readUint16BE();
+ cast->buttonType = stream.readUint16BE();
+ return cast;
+}
+
void Score::play() {
initGraphics(800, 800, true);
uint32 frameId = 0;
diff --git a/engines/director/score.h b/engines/director/score.h
index fe09b1c..e35b742 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -70,6 +70,45 @@ enum mainChannelsPosition {
kPaletePosition = 15
};
+struct Cast {
+ castType type;
+ Common::Rect initialRect;
+};
+
+struct BitmapCast : Cast {
+ Common::Rect boundingRect;
+ uint16 regX;
+ uint16 regY;
+ uint8 flags;
+};
+
+struct ShapeCast : Cast {
+ byte shapeType;
+ uint16 pattern;
+ byte fgCol;
+ byte bgCol;
+ byte fillType;
+ byte lineThickness;
+ byte lineDirection;
+};
+
+struct TextCast : Cast {
+ byte borderSize;
+ byte gutterSize;
+ byte boxShadow;
+
+ byte textType;
+ byte textAlign;
+ byte textShadow;
+ byte textFlags;
+};
+
+struct ButtonCast : TextCast {
+ //TODO types?
+ uint16 buttonType;
+};
+
+
class Sprite {
public:
Sprite();
@@ -115,16 +154,29 @@ public:
class Score {
public:
+ Score(Common::SeekableReadStream &stream);
+ void readVersion(uint32 rid);
+ void loadConfig(Common::SeekableReadStream &stream);
+ void loadCastData(Common::SeekableReadStream &stream);
+ void play();
+
+private:
+ BitmapCast *getBitmapCast(Common::SeekableReadStream &stream);
+ TextCast *getTextCast(Common::SeekableReadStream &stream);
+ ButtonCast *getButtonCast(Common::SeekableReadStream &stream);
+ ShapeCast *getShapeCast(Common::SeekableReadStream &stream);
+
+public:
Common::Array<Frame *> _frames;
+ Common::HashMap<int, Cast *> _casts;
private:
uint16 _versionMinor;
uint16 _versionMajor;
-
-public:
- Score(Common::SeekableReadStream &stream);
- void readVersion(uint32 rid);
- void play();
+ byte _initialFrameRate;
+ uint16 _castArrayStart;
+ uint16 _castArrayEnd;
+ Common::Rect _movieRect;
};
} //End of namespace Director
Commit: d17805e132bfb54988351e1ecb1a596066815e63
https://github.com/scummvm/scummvm/commit/d17805e132bfb54988351e1ecb1a596066815e63
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add cast pointers to sprites
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index c83ff5a..7e03c74 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -64,10 +64,7 @@ Score::Score(Common::SeekableReadStream &stream) {
void Score::loadConfig(Common::SeekableReadStream &stream) {
/*uint16 unk1 = */ stream.readUint16BE();
/*ver1 = */ stream.readUint16BE();
- _movieRect.top = stream.readUint16BE();
- _movieRect.left = stream.readUint16BE();
- _movieRect.bottom = stream.readUint16BE();
- _movieRect.right = stream.readUint16BE();
+ _movieRect = readRect(stream);
_castArrayStart = stream.readUint16BE();
_castArrayEnd = stream.readUint16BE();
@@ -85,31 +82,38 @@ void Score::readVersion(uint32 rid) {
void Score::loadCastData(Common::SeekableReadStream &stream) {
for (uint16 id = _castArrayStart; id < _castArrayEnd; id++) {
byte size = stream.readByte();
- if (size > 0) {
- debug("%d", stream.pos());
- uint8 castType = stream.readByte();
- switch (castType) {
- case kCastBitmap:
- _casts[id] = getBitmapCast(stream);
- _casts[id]->type = kCastBitmap;
- break;
- case kCastText:
- _casts[id] = getTextCast(stream);
- _casts[id]->type = kCastText;
- break;
- case kCastShape:
- _casts[id] = getShapeCast(stream);
- _casts[id]->type = kCastShape;
- break;
- case kCastButton:
- _casts[id] = getButtonCast(stream);
- _casts[id]->type = kCastButton;
- break;
- default:
- warning("Unhandled cast type: %d", castType);
- stream.skip(size - 1);
- break;
- }
+ if (size == 0)
+ continue;
+
+ uint8 castType = stream.readByte();
+ switch (castType) {
+ case kCastBitmap:
+ _casts[id] = getBitmapCast(stream);
+ _casts[id]->type = kCastBitmap;
+ break;
+ case kCastText:
+ _casts[id] = getTextCast(stream);
+ _casts[id]->type = kCastText;
+ break;
+ case kCastShape:
+ _casts[id] = getShapeCast(stream);
+ _casts[id]->type = kCastShape;
+ break;
+ case kCastButton:
+ _casts[id] = getButtonCast(stream);
+ _casts[id]->type = kCastButton;
+ break;
+ default:
+ warning("Unhandled cast type: %d", castType);
+ stream.skip(size - 1);
+ break;
+ }
+ }
+ //Set cast pointers to sprites
+ for (uint16 i = 0; i < _frames.size(); i++) {
+ for (uint16 j = 0; j < _frames[i]->_sprites.size(); j++) {
+ byte castId = _frames[i]->_sprites[j]->_castId;
+ _frames[i]->_sprites[j]->_cast = _casts[castId];
}
}
}
@@ -118,17 +122,8 @@ BitmapCast *Score::getBitmapCast(Common::SeekableReadStream &stream) {
BitmapCast *cast = new BitmapCast();
/*byte flags = */ stream.readByte();
/*uint16 someFlaggyThing = */ stream.readUint16BE();
-
- cast->initialRect.top = stream.readUint16BE();
- cast->initialRect.left = stream.readUint16BE();
- cast->initialRect.bottom = stream.readUint16BE();
- cast->initialRect.right = stream.readUint16BE();
-
- cast->boundingRect.top = stream.readUint16BE();
- cast->boundingRect.left = stream.readUint16BE();
- cast->boundingRect.bottom = stream.readUint16BE();
- cast->boundingRect.right = stream.readUint16BE();
-
+ cast->initialRect = readRect(stream);
+ cast->boundingRect = readRect(stream);
cast->regX = stream.readUint16BE();
cast->regY = stream.readUint16BE();
/*uint16 unk1 =*/ stream.readUint16BE();
@@ -146,12 +141,7 @@ TextCast *Score::getTextCast(Common::SeekableReadStream &stream) {
cast->textAlign = stream.readUint16BE();
stream.skip(6); //palinfo
/*uint32 unk1 = */ stream.readUint32BE();
-
- cast->initialRect.top = stream.readUint16BE();
- cast->initialRect.left = stream.readUint16BE();
- cast->initialRect.bottom = stream.readUint16BE();
- cast->initialRect.right = stream.readUint16BE();
-
+ cast->initialRect = readRect(stream);
cast->textShadow = stream.readByte();
cast->textFlags = stream.readByte();
/*uint16 unk2 =*/ stream.readUint16BE();
@@ -163,12 +153,7 @@ ShapeCast *Score::getShapeCast(Common::SeekableReadStream &stream) {
/*byte flags = */ stream.readByte();
/*unk1 = */ stream.readByte();
cast->shapeType = stream.readByte();
-
- cast->initialRect.top = stream.readUint16BE();
- cast->initialRect.left = stream.readUint16BE();
- cast->initialRect.bottom = stream.readUint16BE();
- cast->initialRect.right = stream.readUint16BE();
-
+ cast->initialRect = readRect(stream);
cast->pattern = stream.readUint16BE();
cast->fgCol = stream.readByte();
cast->bgCol = stream.readByte();
@@ -188,12 +173,7 @@ ButtonCast *Score::getButtonCast(Common::SeekableReadStream &stream) {
cast->textAlign = stream.readUint16BE();
stream.skip(6); //palinfo
/*uint32 unk1 = */ stream.readUint32BE();
-
- cast->initialRect.top = stream.readUint16BE();
- cast->initialRect.left = stream.readUint16BE();
- cast->initialRect.bottom = stream.readUint16BE();
- cast->initialRect.right = stream.readUint16BE();
-
+ cast->initialRect = readRect(stream);
cast->textShadow = stream.readByte();
cast->textFlags = stream.readByte();
/*uint16 unk2 =*/ stream.readUint16BE();
@@ -201,6 +181,15 @@ ButtonCast *Score::getButtonCast(Common::SeekableReadStream &stream) {
return cast;
}
+Common::Rect Score::readRect(Common::SeekableReadStream &stream) {
+ Common::Rect rect;
+ rect.top = stream.readUint16BE();
+ rect.left = stream.readUint16BE();
+ rect.bottom = stream.readUint16BE();
+ rect.right = stream.readUint16BE();
+ return rect;
+}
+
void Score::play() {
initGraphics(800, 800, true);
uint32 frameId = 0;
@@ -418,8 +407,10 @@ void Frame::display() {
for (uint16 i = 0; i < CHANNEL_COUNT; i++) {
if (_sprites[i]->_enabled) {
DIBDecoder img;
+ //TODO check cast type
uint32 castId = 1024 + _sprites[i]->_castId;
img.loadStream(*riff.getResource(MKTAG('D', 'I', 'B', ' '), castId));
+
g_system->copyRectToScreen(img.getSurface()->getPixels(), img.getSurface()->pitch,
_sprites[i]->_startPoint.x,
_sprites[i]->_startPoint.y,
diff --git a/engines/director/score.h b/engines/director/score.h
index e35b742..7696089 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -114,8 +114,9 @@ public:
Sprite();
Sprite(const Sprite &sprite);
bool _enabled;
- uint8 _castId;
+ byte _castId;
//castType type;
+ Cast *_cast;
uint16 _flags;
Common::Point _startPoint;
uint16 _width;
@@ -165,6 +166,7 @@ private:
TextCast *getTextCast(Common::SeekableReadStream &stream);
ButtonCast *getButtonCast(Common::SeekableReadStream &stream);
ShapeCast *getShapeCast(Common::SeekableReadStream &stream);
+ Common::Rect readRect(Common::SeekableReadStream &stream);
public:
Common::Array<Frame *> _frames;
Commit: ce2889bbf41ec56984019626657f025c1003a66a
https://github.com/scummvm/scummvm/commit/ce2889bbf41ec56984019626657f025c1003a66a
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Display objects with offsets
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 7e03c74..6dfd16b 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -113,7 +113,8 @@ void Score::loadCastData(Common::SeekableReadStream &stream) {
for (uint16 i = 0; i < _frames.size(); i++) {
for (uint16 j = 0; j < _frames[i]->_sprites.size(); j++) {
byte castId = _frames[i]->_sprites[j]->_castId;
- _frames[i]->_sprites[j]->_cast = _casts[castId];
+ if (_casts.contains(castId))
+ _frames[i]->_sprites[j]->_cast = _casts.find(castId)->_value;
}
}
}
@@ -124,8 +125,8 @@ BitmapCast *Score::getBitmapCast(Common::SeekableReadStream &stream) {
/*uint16 someFlaggyThing = */ stream.readUint16BE();
cast->initialRect = readRect(stream);
cast->boundingRect = readRect(stream);
- cast->regX = stream.readUint16BE();
cast->regY = stream.readUint16BE();
+ cast->regX = stream.readUint16BE();
/*uint16 unk1 =*/ stream.readUint16BE();
/*uint16 unk2 =*/ stream.readUint16BE();
return cast;
@@ -182,12 +183,12 @@ ButtonCast *Score::getButtonCast(Common::SeekableReadStream &stream) {
}
Common::Rect Score::readRect(Common::SeekableReadStream &stream) {
- Common::Rect rect;
- rect.top = stream.readUint16BE();
- rect.left = stream.readUint16BE();
- rect.bottom = stream.readUint16BE();
- rect.right = stream.readUint16BE();
- return rect;
+ Common::Rect *rect = new Common::Rect();
+ rect->top = stream.readUint16BE();
+ rect->left = stream.readUint16BE();
+ rect->bottom = stream.readUint16BE();
+ rect->right = stream.readUint16BE();
+ return *rect;
}
void Score::play() {
@@ -206,7 +207,7 @@ void Score::play() {
_frames[frameId]->display();
frameId++;
g_system->updateScreen();
- g_system->delayMillis(200);
+ g_system->delayMillis(50);
}
}
@@ -408,14 +409,26 @@ void Frame::display() {
if (_sprites[i]->_enabled) {
DIBDecoder img;
//TODO check cast type
- uint32 castId = 1024 + _sprites[i]->_castId;
- img.loadStream(*riff.getResource(MKTAG('D', 'I', 'B', ' '), castId));
-
- g_system->copyRectToScreen(img.getSurface()->getPixels(), img.getSurface()->pitch,
- _sprites[i]->_startPoint.x,
- _sprites[i]->_startPoint.y,
- _sprites[i]->_height,
- _sprites[i]->_width);
+ uint32 imgId = 1024 + _sprites[i]->_castId;
+ img.loadStream(*riff.getResource(MKTAG('D', 'I', 'B', ' '), imgId));
+ uint32 regX = static_cast<BitmapCast *>(_sprites[i]->_cast)->regX;
+ uint32 regY = static_cast<BitmapCast *>(_sprites[i]->_cast)->regY;
+ uint32 rectLeft = static_cast<BitmapCast *>(_sprites[i]->_cast)->initialRect.left;
+ uint32 rectTop = static_cast<BitmapCast *>(_sprites[i]->_cast)->initialRect.top;
+
+ int x = _sprites[i]->_startPoint.x - regX + rectLeft;
+ int y = _sprites[i]->_startPoint.y - regY + rectTop;
+ int height = _sprites[i]->_height;
+ int width = _sprites[i]->_width;
+ if (x < 0) {
+ width += x;
+ x = 0;
+ }
+ if (y < 0) {
+ height += y;
+ y = 0;
+ }
+ g_system->copyRectToScreen(img.getSurface()->getPixels(), img.getSurface()->pitch, x, y, height, width);
}
}
}
Commit: 8cd7deb4763ab662c3844722e7360aea18513219
https://github.com/scummvm/scummvm/commit/8cd7deb4763ab662c3844722e7360aea18513219
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add support for tempo channel
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 6dfd16b..aef9c86 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -68,7 +68,7 @@ void Score::loadConfig(Common::SeekableReadStream &stream) {
_castArrayStart = stream.readUint16BE();
_castArrayEnd = stream.readUint16BE();
- _initialFrameRate = stream.readByte();
+ _currentFrameRate = stream.readByte();
stream.skip(9);
/*uint16 stageColor = */ stream.readUint16BE();
}
@@ -193,21 +193,43 @@ Common::Rect Score::readRect(Common::SeekableReadStream &stream) {
void Score::play() {
initGraphics(800, 800, true);
- uint32 frameId = 0;
- bool stop = false;
-
- while (frameId != _frames.size() && !stop) {
- Common::Event event;
+ _currentFrame = 1;
+ _stopPlay = false;
+ _nextFrameTime = g_system->getMillis() + (float)_currentFrameRate / 60 * 1000;
+ while (!_stopPlay) {
+ display();
+ processEvents();
+ g_system->delayMillis(10);
+ }
+}
- while (g_system->getEventManager()->pollEvent(event)) {
- if (event.type == Common::EVENT_QUIT)
- stop = true;
+void Score::display() {
+ if (g_system->getMillis() < _nextFrameTime)
+ return;
+
+ _frames[_currentFrame]->display();
+ g_system->updateScreen();
+ _currentFrame++;
+ byte tempo = _frames[_currentFrame]->_tempo;
+ if (tempo) {
+ if (tempo > 161) {
+ //Delay
+ _nextFrameTime = g_system->getMillis() + (256 - tempo) * 1000;
+ } else {
+ //FPS
+ _nextFrameTime = g_system->getMillis() + (float)tempo / 60 * 1000;
+ _currentFrameRate = tempo;
}
- _frames[frameId]->display();
- frameId++;
- g_system->updateScreen();
- g_system->delayMillis(50);
+ }
+ _nextFrameTime = g_system->getMillis() + (float)_currentFrameRate / 60 * 1000;
+}
+
+void Score::processEvents() {
+ Common::Event event;
+ while (g_system->getEventManager()->pollEvent(event)) {
+ if (event.type == Common::EVENT_QUIT)
+ _stopPlay = true;
}
}
diff --git a/engines/director/score.h b/engines/director/score.h
index 7696089..9e729c2 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -167,6 +167,8 @@ private:
ButtonCast *getButtonCast(Common::SeekableReadStream &stream);
ShapeCast *getShapeCast(Common::SeekableReadStream &stream);
Common::Rect readRect(Common::SeekableReadStream &stream);
+ void processEvents();
+ void display();
public:
Common::Array<Frame *> _frames;
@@ -175,8 +177,11 @@ public:
private:
uint16 _versionMinor;
uint16 _versionMajor;
- byte _initialFrameRate;
+ byte _currentFrameRate;
uint16 _castArrayStart;
+ uint16 _currentFrame;
+ uint32 _nextFrameTime;
+ bool _stopPlay;
uint16 _castArrayEnd;
Common::Rect _movieRect;
};
Commit: 5ffd839bf3c4eb996866148adb4a4fcbef6947db
https://github.com/scummvm/scummvm/commit/5ffd839bf3c4eb996866148adb4a4fcbef6947db
Author: rootfather (scummvm at rootfather.de)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Improve detection of Masters of the Elements
This commit adds detection for the English release of
"Masters of the Elements".
To avoid hash collisions, I had to add another file to the
detection table. The Projector Skeleton is too big for the
standard 5000 bytes we use for creating the MD5 hashes.
Many thanks to sev- for his great help!
Changed paths:
engines/director/detection_tables.h
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index be8f17c..f451641 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -198,15 +198,59 @@ static const DirectorGameDescription gameDescriptions[] = {
{
{
+ // Masters of the Elements - English (from rootfather)
+ // Developed by IJsfontein, published by Tivola
+ // File version of MVM.EXE is 6.0.2.32
+ // The game disc is a hybrid CD-ROM containing both the Windows and the Macintosh release.
+
+ "melements", "",
+ {
+ {"CHECK.DXR", 0, "c31ee30eebd24a8cf31691fc9926daa4", 901820},
+ {"MVM.EXE", 0, 0, 2565921},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 5
+ },
+
+ {
+ {
+ // Masters of the Elements - English (from rootfather)
+
+ "melements", "",
+ {
+ {"check.dxr", 0, "36f42340e819d1532c850880afe16581", 898206},
+ {"Masters of the Elements", 0, 0, 1034962},
+ AD_LISTEND
+ },
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_MACRESFORK,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 5
+ },
+
+ {
+ {
// Masters of the Elements - German (from rootfather)
// Released in Germany as "Meister Zufall und die Herrscher der Elemente"
// Developed by IJsfontein, published by Tivola
// File version of MVM.EXE is 6.0.2.32
// The game disc is a hybrid CD-ROM containing both the Windows and the Macintosh release.
- "melements",
- "",
- AD_ENTRY1("MVM.EXE", "518a98696fe1122e08410b0f157f21bf"),
+ "melements", "",
+ {
+ {"CHECK.DXR", 0, "d1cd0ed95b0e30597e0089bf3e5caf0f", 575414},
+ {"MVM.EXE", 0, 0, 1512503},
+ AD_LISTEND
+ },
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
@@ -219,12 +263,13 @@ static const DirectorGameDescription gameDescriptions[] = {
{
{
// Masters of the Elements - German (from rootfather)
- // Released in Germany as "Meister Zufall und die Herrscher der Elemente"
- // Released on the same CD-ROM as the Windows release.
- "melements",
- "",
- AD_ENTRY1("Meister Zufall", "65063397536553c4f6ff2a6c07194bf7"),
+ "melements", "",
+ {
+ {"check.dxr", 0, "9c81934b7616ab077f44825b8afaa83e", 575426},
+ {"Meister Zufall", 0, 0, 1034962},
+ AD_LISTEND
+ },
Common::DE_DEU,
Common::kPlatformMacintosh,
ADGF_MACRESFORK,
Commit: 604fa102ff35f02b71506fa0b67283ed00139872
https://github.com/scummvm/scummvm/commit/604fa102ff35f02b71506fa0b67283ed00139872
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix frame playback
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index aef9c86..1b75414 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -192,14 +192,15 @@ Common::Rect Score::readRect(Common::SeekableReadStream &stream) {
}
void Score::play() {
- initGraphics(800, 800, true);
+ initGraphics(800, 600, true);
- _currentFrame = 1;
+ _currentFrame = 0;
_stopPlay = false;
- _nextFrameTime = g_system->getMillis() + (float)_currentFrameRate / 60 * 1000;
+ _nextFrameTime = 0;
while (!_stopPlay) {
display();
processEvents();
+ g_system->updateScreen();
g_system->delayMillis(10);
}
}
@@ -209,7 +210,6 @@ void Score::display() {
return;
_frames[_currentFrame]->display();
- g_system->updateScreen();
_currentFrame++;
byte tempo = _frames[_currentFrame]->_tempo;
if (tempo) {
Commit: 44e46db5de4211c8056962531fb6483ffe7bebeb
https://github.com/scummvm/scummvm/commit/44e46db5de4211c8056962531fb6483ffe7bebeb
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Refactor cast data loading
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 1b75414..658f1e7 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -64,7 +64,7 @@ Score::Score(Common::SeekableReadStream &stream) {
void Score::loadConfig(Common::SeekableReadStream &stream) {
/*uint16 unk1 = */ stream.readUint16BE();
/*ver1 = */ stream.readUint16BE();
- _movieRect = readRect(stream);
+ _movieRect = Score::readRect(stream);
_castArrayStart = stream.readUint16BE();
_castArrayEnd = stream.readUint16BE();
@@ -88,19 +88,19 @@ void Score::loadCastData(Common::SeekableReadStream &stream) {
uint8 castType = stream.readByte();
switch (castType) {
case kCastBitmap:
- _casts[id] = getBitmapCast(stream);
+ _casts[id] = new BitmapCast(stream);
_casts[id]->type = kCastBitmap;
break;
case kCastText:
- _casts[id] = getTextCast(stream);
+ _casts[id] = new TextCast(stream);
_casts[id]->type = kCastText;
break;
case kCastShape:
- _casts[id] = getShapeCast(stream);
+ _casts[id] = new ShapeCast(stream);
_casts[id]->type = kCastShape;
break;
case kCastButton:
- _casts[id] = getButtonCast(stream);
+ _casts[id] = new ButtonCast(stream);
_casts[id]->type = kCastButton;
break;
default:
@@ -119,67 +119,43 @@ void Score::loadCastData(Common::SeekableReadStream &stream) {
}
}
-BitmapCast *Score::getBitmapCast(Common::SeekableReadStream &stream) {
- BitmapCast *cast = new BitmapCast();
+BitmapCast::BitmapCast(Common::SeekableReadStream &stream) {
/*byte flags = */ stream.readByte();
/*uint16 someFlaggyThing = */ stream.readUint16BE();
- cast->initialRect = readRect(stream);
- cast->boundingRect = readRect(stream);
- cast->regY = stream.readUint16BE();
- cast->regX = stream.readUint16BE();
+ initialRect = Score::readRect(stream);
+ boundingRect = Score::readRect(stream);
+ regY = stream.readUint16BE();
+ regX = stream.readUint16BE();
/*uint16 unk1 =*/ stream.readUint16BE();
/*uint16 unk2 =*/ stream.readUint16BE();
- return cast;
}
-TextCast *Score::getTextCast(Common::SeekableReadStream &stream) {
- TextCast *cast = new TextCast();
+TextCast::TextCast(Common::SeekableReadStream &stream) {
/*byte flags =*/ stream.readByte();
- cast->borderSize = stream.readByte();
- cast->gutterSize = stream.readByte();
- cast->boxShadow = stream.readByte();
- cast->textType = stream.readByte();
- cast->textAlign = stream.readUint16BE();
+ borderSize = stream.readByte();
+ gutterSize = stream.readByte();
+ boxShadow = stream.readByte();
+ textType = stream.readByte();
+ textAlign = stream.readUint16BE();
stream.skip(6); //palinfo
/*uint32 unk1 = */ stream.readUint32BE();
- cast->initialRect = readRect(stream);
- cast->textShadow = stream.readByte();
- cast->textFlags = stream.readByte();
+ initialRect = Score::readRect(stream);
+ textShadow = stream.readByte();
+ textFlags = stream.readByte();
/*uint16 unk2 =*/ stream.readUint16BE();
- return cast;
}
-ShapeCast *Score::getShapeCast(Common::SeekableReadStream &stream) {
- ShapeCast *cast = new ShapeCast();
+ShapeCast::ShapeCast(Common::SeekableReadStream &stream) {
/*byte flags = */ stream.readByte();
/*unk1 = */ stream.readByte();
- cast->shapeType = stream.readByte();
- cast->initialRect = readRect(stream);
- cast->pattern = stream.readUint16BE();
- cast->fgCol = stream.readByte();
- cast->bgCol = stream.readByte();
- cast->fillType = stream.readByte();
- cast->lineThickness = stream.readByte();
- cast->lineDirection = stream.readByte();
- return cast;
-}
-
-ButtonCast *Score::getButtonCast(Common::SeekableReadStream &stream) {
- ButtonCast *cast = new ButtonCast();
- /*byte flags =*/ stream.readByte();
- cast->borderSize = stream.readByte();
- cast->gutterSize = stream.readByte();
- cast->boxShadow = stream.readByte();
- cast->textType = stream.readByte();
- cast->textAlign = stream.readUint16BE();
- stream.skip(6); //palinfo
- /*uint32 unk1 = */ stream.readUint32BE();
- cast->initialRect = readRect(stream);
- cast->textShadow = stream.readByte();
- cast->textFlags = stream.readByte();
- /*uint16 unk2 =*/ stream.readUint16BE();
- cast->buttonType = stream.readUint16BE();
- return cast;
+ shapeType = stream.readByte();
+ initialRect = Score::readRect(stream);
+ pattern = stream.readUint16BE();
+ fgCol = stream.readByte();
+ bgCol = stream.readByte();
+ fillType = stream.readByte();
+ lineThickness = stream.readByte();
+ lineDirection = stream.readByte();
}
Common::Rect Score::readRect(Common::SeekableReadStream &stream) {
diff --git a/engines/director/score.h b/engines/director/score.h
index 9e729c2..299a26c 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -76,6 +76,7 @@ struct Cast {
};
struct BitmapCast : Cast {
+ BitmapCast(Common::SeekableReadStream &stream);
Common::Rect boundingRect;
uint16 regX;
uint16 regY;
@@ -83,6 +84,7 @@ struct BitmapCast : Cast {
};
struct ShapeCast : Cast {
+ ShapeCast(Common::SeekableReadStream &stream);
byte shapeType;
uint16 pattern;
byte fgCol;
@@ -93,6 +95,7 @@ struct ShapeCast : Cast {
};
struct TextCast : Cast {
+ TextCast(Common::SeekableReadStream &stream);
byte borderSize;
byte gutterSize;
byte boxShadow;
@@ -104,6 +107,9 @@ struct TextCast : Cast {
};
struct ButtonCast : TextCast {
+ ButtonCast(Common::SeekableReadStream &stream) : TextCast(stream) {
+ buttonType = stream.readUint16BE();
+ }
//TODO types?
uint16 buttonType;
};
@@ -150,7 +156,6 @@ public:
uint8 _skipFrameFlag;
uint8 _blend;
Common::Array<Sprite *> _sprites;
-
};
class Score {
@@ -159,14 +164,10 @@ public:
void readVersion(uint32 rid);
void loadConfig(Common::SeekableReadStream &stream);
void loadCastData(Common::SeekableReadStream &stream);
+ static Common::Rect readRect(Common::SeekableReadStream &stream);
void play();
private:
- BitmapCast *getBitmapCast(Common::SeekableReadStream &stream);
- TextCast *getTextCast(Common::SeekableReadStream &stream);
- ButtonCast *getButtonCast(Common::SeekableReadStream &stream);
- ShapeCast *getShapeCast(Common::SeekableReadStream &stream);
- Common::Rect readRect(Common::SeekableReadStream &stream);
void processEvents();
void display();
Commit: d7f1c98f29e3eacd2eb25456878eed5a0dd7d78a
https://github.com/scummvm/scummvm/commit/d7f1c98f29e3eacd2eb25456878eed5a0dd7d78a
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Remove extra movie archive open
Changed paths:
engines/director/director.cpp
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index ff294a7..bd08adf 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -71,7 +71,7 @@ Common::Error DirectorEngine::run() {
_mainArchive->openFile("bookshelf_example.mmm");
Common::SeekableReadStream *scr = _mainArchive->getResource(MKTAG('V','W','S','C'), 1024);
- Score score(*scr);
+ Score score(*scr, *_mainArchive);
Common::SeekableReadStream *conf = _mainArchive->getResource(MKTAG('V','W','C','F'), 1024);
score.loadConfig(*conf);
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 658f1e7..625c4b1 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -34,8 +34,8 @@
namespace Director {
-Score::Score(Common::SeekableReadStream &stream) {
-
+Score::Score(Common::SeekableReadStream &stream, Archive &movie) {
+ _movieArchive = &movie;
uint32 size = stream.readUint32BE();
size -= 4;
uint16 channelSize;
@@ -43,7 +43,7 @@ Score::Score(Common::SeekableReadStream &stream) {
Frame *initial = new Frame();
_frames.push_back(initial);
-
+
while (size != 0) {
uint16 frameSize = stream.readUint16BE();
size -= frameSize;
@@ -185,7 +185,7 @@ void Score::display() {
if (g_system->getMillis() < _nextFrameTime)
return;
- _frames[_currentFrame]->display();
+ _frames[_currentFrame]->display(*_movieArchive);
_currentFrame++;
byte tempo = _frames[_currentFrame]->_tempo;
if (tempo) {
@@ -393,13 +393,10 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
}
}
-void Frame::display() {
- //FIXME
- RIFFArchive riff;
- riff.openFile("bookshelf_example.mmm");
+void Frame::display(Archive &_movie) {
DIBDecoder palette;
- Common::SeekableReadStream *pal = riff.getResource(MKTAG('C', 'L', 'U', 'T'), 1025);
+ Common::SeekableReadStream *pal = _movie.getResource(MKTAG('C', 'L', 'U', 'T'), 1025);
palette.loadPalette(*pal);
g_system->getPaletteManager()->setPalette(palette.getPalette(), 0, 255);
@@ -408,7 +405,7 @@ void Frame::display() {
DIBDecoder img;
//TODO check cast type
uint32 imgId = 1024 + _sprites[i]->_castId;
- img.loadStream(*riff.getResource(MKTAG('D', 'I', 'B', ' '), imgId));
+ img.loadStream(*_movie.getResource(MKTAG('D', 'I', 'B', ' '), imgId));
uint32 regX = static_cast<BitmapCast *>(_sprites[i]->_cast)->regX;
uint32 regY = static_cast<BitmapCast *>(_sprites[i]->_cast)->regY;
uint32 rectLeft = static_cast<BitmapCast *>(_sprites[i]->_cast)->initialRect.left;
diff --git a/engines/director/score.h b/engines/director/score.h
index 299a26c..2fcb62a 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -135,7 +135,7 @@ public:
~Frame();
Frame(const Frame &frame);
void readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
- void display();
+ void display(Archive &_movie);
private:
void readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
@@ -160,7 +160,7 @@ public:
class Score {
public:
- Score(Common::SeekableReadStream &stream);
+ Score(Common::SeekableReadStream &stream, Archive &movie);
void readVersion(uint32 rid);
void loadConfig(Common::SeekableReadStream &stream);
void loadCastData(Common::SeekableReadStream &stream);
@@ -185,6 +185,7 @@ private:
bool _stopPlay;
uint16 _castArrayEnd;
Common::Rect _movieRect;
+ Archive *_movieArchive;
};
} //End of namespace Director
Commit: 6299055098cf09e174344c43d421b935f5a50a6b
https://github.com/scummvm/scummvm/commit/6299055098cf09e174344c43d421b935f5a50a6b
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add ink types parsing
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 625c4b1..477d850 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -362,6 +362,7 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
break;
case kSpritePositionFlags:
sprite._flags = stream.readUint16BE();
+ sprite._ink = static_cast<inkType>(sprite._flags & 0x3f); //TODO more flags?
fieldPosition += 2;
break;
case kSpritePositionCastId:
@@ -431,6 +432,7 @@ void Frame::display(Archive &_movie) {
Sprite::Sprite() {
_enabled = false;
_width = 0;
+ _ink = kInkTypeCopy;
_flags = 0;
_height = 0;
_castId = 0;
@@ -441,6 +443,7 @@ Sprite::Sprite(const Sprite &sprite) {
_enabled = sprite._enabled;
_castId = sprite._castId;
_flags = sprite._flags;
+ _ink = sprite._ink;
_width = sprite._width;
_height = sprite._height;
_startPoint.x = sprite._startPoint.x;
diff --git a/engines/director/score.h b/engines/director/score.h
index 2fcb62a..d3293da 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -43,7 +43,7 @@ enum castType {
kCastScript
};
-enum spritePositions {
+enum spritePositions {
kSpritePositionUnk1 = 0,
kSpritePositionEnabled,
kSpritePositionUnk2,
@@ -70,6 +70,28 @@ enum mainChannelsPosition {
kPaletePosition = 15
};
+enum inkType {
+ kInkTypeCopy,
+ kInkTypeTransparent,
+ kInkTypeReverse,
+ kInkTypeGhost,
+ kInkTypeNotCopy,
+ kInkTypeNotTrans,
+ kInkTypeNotReverse,
+ kInkTypeNotGhost,
+ kIntTypeMatte,
+ kInkTypeMask,
+ //10-31 Not used (Lingo in a Nutshell)
+ kInkTypeBlend = 32,
+ kInkTypeAddPin,
+ kInkTypeAdd,
+ kInkTypeSubPin,
+ kInkTypeBackgndTrans,
+ kInkTypeLight,
+ kInkTypeSub,
+ kInkTypeDark
+};
+
struct Cast {
castType type;
Common::Rect initialRect;
@@ -121,7 +143,7 @@ public:
Sprite(const Sprite &sprite);
bool _enabled;
byte _castId;
- //castType type;
+ inkType _ink;
Cast *_cast;
uint16 _flags;
Common::Point _startPoint;
Commit: fb6e06231c20bec264e8c54be4dfb662b9d08fd7
https://github.com/scummvm/scummvm/commit/fb6e06231c20bec264e8c54be4dfb662b9d08fd7
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Move sprite display to ManagedSurface
Changed paths:
engines/director/dib.cpp
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/dib.cpp b/engines/director/dib.cpp
index 6053d55..4e2a21d 100644
--- a/engines/director/dib.cpp
+++ b/engines/director/dib.cpp
@@ -77,9 +77,6 @@ void DIBDecoder::loadPalette(Common::SeekableReadStream &stream) {
}
bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
-
-
-
uint32 headerSize = stream.readUint32LE();
if (headerSize != 40)
return false;
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 477d850..e921037 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -31,10 +31,14 @@
#include "graphics/palette.h"
#include "common/events.h"
#include "engines/util.h"
+#include "graphics/managed_surface.h"
namespace Director {
Score::Score(Common::SeekableReadStream &stream, Archive &movie) {
+
+ _surface = new Graphics::ManagedSurface;
+
_movieArchive = &movie;
uint32 size = stream.readUint32BE();
size -= 4;
@@ -169,7 +173,7 @@ Common::Rect Score::readRect(Common::SeekableReadStream &stream) {
void Score::play() {
initGraphics(800, 600, true);
-
+ _surface->create(800, 600);
_currentFrame = 0;
_stopPlay = false;
_nextFrameTime = 0;
@@ -185,7 +189,7 @@ void Score::display() {
if (g_system->getMillis() < _nextFrameTime)
return;
- _frames[_currentFrame]->display(*_movieArchive);
+ _frames[_currentFrame]->display(*_movieArchive, *_surface, _movieRect);
_currentFrame++;
byte tempo = _frames[_currentFrame]->_tempo;
if (tempo) {
@@ -394,8 +398,8 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
}
}
-void Frame::display(Archive &_movie) {
-
+void Frame::display(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect moviRect) {
+ surface.clear();
DIBDecoder palette;
Common::SeekableReadStream *pal = _movie.getResource(MKTAG('C', 'L', 'U', 'T'), 1025);
palette.loadPalette(*pal);
@@ -407,6 +411,7 @@ void Frame::display(Archive &_movie) {
//TODO check cast type
uint32 imgId = 1024 + _sprites[i]->_castId;
img.loadStream(*_movie.getResource(MKTAG('D', 'I', 'B', ' '), imgId));
+
uint32 regX = static_cast<BitmapCast *>(_sprites[i]->_cast)->regX;
uint32 regY = static_cast<BitmapCast *>(_sprites[i]->_cast)->regY;
uint32 rectLeft = static_cast<BitmapCast *>(_sprites[i]->_cast)->initialRect.left;
@@ -416,6 +421,7 @@ void Frame::display(Archive &_movie) {
int y = _sprites[i]->_startPoint.y - regY + rectTop;
int height = _sprites[i]->_height;
int width = _sprites[i]->_width;
+
if (x < 0) {
width += x;
x = 0;
@@ -424,7 +430,9 @@ void Frame::display(Archive &_movie) {
height += y;
y = 0;
}
- g_system->copyRectToScreen(img.getSurface()->getPixels(), img.getSurface()->pitch, x, y, height, width);
+ Common::Rect drawRect = Common::Rect(x, y, x + width, y + height);
+ surface.blitFrom(*img.getSurface());
+ g_system->copyRectToScreen(surface.getPixels(), surface.pitch, drawRect.left, drawRect.top, drawRect.height(), drawRect.width());
}
}
}
diff --git a/engines/director/score.h b/engines/director/score.h
index d3293da..f15afa0 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -24,6 +24,7 @@
#include "common/stream.h"
#include "common/array.h"
#include "director/resource.h"
+#include "graphics/managed_surface.h"
namespace Director {
@@ -79,7 +80,7 @@ enum inkType {
kInkTypeNotTrans,
kInkTypeNotReverse,
kInkTypeNotGhost,
- kIntTypeMatte,
+ kInkTypeMatte,
kInkTypeMask,
//10-31 Not used (Lingo in a Nutshell)
kInkTypeBlend = 32,
@@ -157,7 +158,7 @@ public:
~Frame();
Frame(const Frame &frame);
void readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
- void display(Archive &_movie);
+ void display(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect moviRect);
private:
void readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
@@ -208,6 +209,7 @@ private:
uint16 _castArrayEnd;
Common::Rect _movieRect;
Archive *_movieArchive;
+ Graphics::ManagedSurface *_surface;
};
} //End of namespace Director
Commit: 2e87ca495459341499a3fdead70b6410b6501a71
https://github.com/scummvm/scummvm/commit/2e87ca495459341499a3fdead70b6410b6501a71
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix cast data reading
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index e921037..b42fd2c 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -84,11 +84,10 @@ void Score::readVersion(uint32 rid) {
}
void Score::loadCastData(Common::SeekableReadStream &stream) {
- for (uint16 id = _castArrayStart; id < _castArrayEnd; id++) {
+ for (uint16 id = _castArrayStart; id <= _castArrayEnd; id++) {
byte size = stream.readByte();
if (size == 0)
continue;
-
uint8 castType = stream.readByte();
switch (castType) {
case kCastBitmap:
@@ -410,6 +409,11 @@ void Frame::display(Archive &_movie, Graphics::ManagedSurface &surface, Common::
DIBDecoder img;
//TODO check cast type
uint32 imgId = 1024 + _sprites[i]->_castId;
+ //TODO looks like bad file?
+ if (!_movie.hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
+ continue;
+ }
+
img.loadStream(*_movie.getResource(MKTAG('D', 'I', 'B', ' '), imgId));
uint32 regX = static_cast<BitmapCast *>(_sprites[i]->_cast)->regX;
Commit: c42f4060a1a3848a247f354cd8c1229b5f83058b
https://github.com/scummvm/scummvm/commit/c42f4060a1a3848a247f354cd8c1229b5f83058b
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix display sprite bug
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index b42fd2c..c7a84e4 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -171,12 +171,12 @@ Common::Rect Score::readRect(Common::SeekableReadStream &stream) {
}
void Score::play() {
- initGraphics(800, 600, true);
- _surface->create(800, 600);
+ initGraphics(_movieRect.width(), _movieRect.height(), true);
+ _surface->create(_movieRect.width(), _movieRect.height());
_currentFrame = 0;
_stopPlay = false;
_nextFrameTime = 0;
- while (!_stopPlay) {
+ while (!_stopPlay && _currentFrame < _frames.size() - 2) {
display();
processEvents();
g_system->updateScreen();
@@ -434,11 +434,10 @@ void Frame::display(Archive &_movie, Graphics::ManagedSurface &surface, Common::
height += y;
y = 0;
}
- Common::Rect drawRect = Common::Rect(x, y, x + width, y + height);
- surface.blitFrom(*img.getSurface());
- g_system->copyRectToScreen(surface.getPixels(), surface.pitch, drawRect.left, drawRect.top, drawRect.height(), drawRect.width());
+ surface.blitFrom(*img.getSurface(), Common::Point(x, y));
}
}
+ g_system->copyRectToScreen(surface.getPixels(), surface.pitch, 0, 0, surface.getBounds().width(), surface.getBounds().height());
}
Sprite::Sprite() {
Commit: 961adeee7f0ff24f435a3db91e7298c98accaac5
https://github.com/scummvm/scummvm/commit/961adeee7f0ff24f435a3db91e7298c98accaac5
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add support for background trans, matte ink types
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index c7a84e4..abeb894 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -381,11 +381,11 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
fieldPosition += 2;
break;
case kSpritePositionWidth:
- sprite._width = stream.readUint16BE();
+ sprite._height = stream.readUint16BE();
fieldPosition += 2;
break;
case kSpritePositionHeight:
- sprite._height = stream.readUint16BE();
+ sprite._width = stream.readUint16BE();
fieldPosition += 2;
break;
default:
@@ -434,12 +434,72 @@ void Frame::display(Archive &_movie, Graphics::ManagedSurface &surface, Common::
height += y;
y = 0;
}
- surface.blitFrom(*img.getSurface(), Common::Point(x, y));
+
+ Common::Rect drawRect = Common::Rect(x, y, x + width, y + height);
+
+ switch(_sprites[i]->_ink) {
+ case kInkTypeCopy:
+ surface.blitFrom(*img.getSurface(), Common::Point(x, y));
+ break;
+ case kInkTypeBackgndTrans:
+ drawBackgndTransSprite(surface, *img.getSurface(), drawRect);
+ break;
+ case kInkTypeMatte:
+ drawMatteSprite(surface, *img.getSurface(), drawRect);
+ break;
+ default:
+ warning("Unhandled ink type %d", _sprites[i]->_ink);
+ surface.blitFrom(*img.getSurface(), Common::Point(x, y));
+ break;
+ }
}
}
g_system->copyRectToScreen(surface.getPixels(), surface.pitch, 0, 0, surface.getBounds().width(), surface.getBounds().height());
}
+void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
+ uint8 skipColor = 15; //FIXME is it always white (last entry in pallette) ?
+ for (int ii = 0; ii < sprite.h; ii++) {
+ const byte *src = (const byte *)sprite.getBasePtr(0, ii);
+ byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + ii);
+ for (int j = 0; j < drawRect.width(); j++) {
+ if (*src != skipColor)
+ *dst = *src;
+ src++;
+ dst++;
+ }
+ }
+}
+
+void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
+ //Like background trans, but all white pixels NOT ENCLOSED by coloured pixels are transparent
+ uint8 skipColor = 15;
+ for (int ii = 0; ii < sprite.h; ii++) {
+ const byte *leftSrc = (const byte *)sprite.getBasePtr(0, ii);
+ byte *leftDst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + ii);
+ bool skip = true;
+ for (int j = 0; j < drawRect.width() / 2; j++) {
+ if ((*leftSrc != skipColor) || !skip) {
+ *leftDst = *leftSrc;
+ skip = false;
+ }
+ leftSrc++;
+ leftDst++;
+ }
+ skip = true;
+ const byte *rightSrc = (const byte *)sprite.getBasePtr(sprite.w - 1, ii);
+ byte *rightDst = (byte *)target.getBasePtr(drawRect.right - 1, drawRect.top + ii);
+ for (int j = 0; j <= drawRect.width() / 2; j++) {
+ if ((*rightSrc != skipColor) || !skip) {
+ *rightDst = *rightSrc;
+ skip = false;
+ }
+ rightSrc--;
+ rightDst--;
+ }
+ }
+}
+
Sprite::Sprite() {
_enabled = false;
_width = 0;
diff --git a/engines/director/score.h b/engines/director/score.h
index f15afa0..0656ed1 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -163,7 +163,8 @@ public:
private:
void readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
void readMainChannels(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
-
+ void drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
+ void drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
public:
uint8 _actionId;
uint8 _transFlags;
Commit: f8583622848e1d3d451871ad944645b38714b3ce
https://github.com/scummvm/scummvm/commit/f8583622848e1d3d451871ad944645b38714b3ce
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Move score loading resource to constructor
Changed paths:
engines/director/director.cpp
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index bd08adf..a044f23 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -70,15 +70,7 @@ Common::Error DirectorEngine::run() {
_mainArchive = new RIFFArchive();
_mainArchive->openFile("bookshelf_example.mmm");
- Common::SeekableReadStream *scr = _mainArchive->getResource(MKTAG('V','W','S','C'), 1024);
- Score score(*scr, *_mainArchive);
-
- Common::SeekableReadStream *conf = _mainArchive->getResource(MKTAG('V','W','C','F'), 1024);
- score.loadConfig(*conf);
-
- Common::SeekableReadStream *records = _mainArchive->getResource(MKTAG('V','W','C','R'), 1024);
- score.loadCastData(*records);
-
+ Score score(*_mainArchive);
score.play();
if (getPlatform() == Common::kPlatformWindows)
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index abeb894..ed4d11f 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -35,11 +35,20 @@
namespace Director {
-Score::Score(Common::SeekableReadStream &stream, Archive &movie) {
+Score::Score(Archive &movie) {
_surface = new Graphics::ManagedSurface;
-
_movieArchive = &movie;
+ assert(_movieArchive->hasResource(MKTAG('V','W','S','C'), 1024));
+ assert(_movieArchive->hasResource(MKTAG('V','W','C','F'), 1024));
+ assert(_movieArchive->hasResource(MKTAG('V','W','C','R'), 1024));
+
+ loadFrames(*_movieArchive->getResource(MKTAG('V','W','S','C'), 1024));
+ loadConfig(*_movieArchive->getResource(MKTAG('V','W','C','F'), 1024));
+ loadCastData(*_movieArchive->getResource(MKTAG('V','W','C','R'), 1024));
+}
+
+void Score::loadFrames(Common::SeekableReadStream &stream) {
uint32 size = stream.readUint32BE();
size -= 4;
uint16 channelSize;
diff --git a/engines/director/score.h b/engines/director/score.h
index 0656ed1..ba10f2d 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -184,17 +184,17 @@ public:
class Score {
public:
- Score(Common::SeekableReadStream &stream, Archive &movie);
- void readVersion(uint32 rid);
- void loadConfig(Common::SeekableReadStream &stream);
- void loadCastData(Common::SeekableReadStream &stream);
+ Score(Archive &movie);
static Common::Rect readRect(Common::SeekableReadStream &stream);
void play();
private:
void processEvents();
void display();
-
+ void readVersion(uint32 rid);
+ void loadConfig(Common::SeekableReadStream &stream);
+ void loadCastData(Common::SeekableReadStream &stream);
+ void loadFrames(Common::SeekableReadStream &stream);
public:
Common::Array<Frame *> _frames;
Common::HashMap<int, Cast *> _casts;
Commit: 254b1e3c1f888ed48b745a93da23c4c3b3d02d38
https://github.com/scummvm/scummvm/commit/254b1e3c1f888ed48b745a93da23c4c3b3d02d38
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Load labels
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index ed4d11f..28aed23 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -46,6 +46,10 @@ Score::Score(Archive &movie) {
loadFrames(*_movieArchive->getResource(MKTAG('V','W','S','C'), 1024));
loadConfig(*_movieArchive->getResource(MKTAG('V','W','C','F'), 1024));
loadCastData(*_movieArchive->getResource(MKTAG('V','W','C','R'), 1024));
+
+ if (_movieArchive->hasResource(MKTAG('V','W','L','B'), 1024)) {
+ loadLabels(*_movieArchive->getResource(MKTAG('V','W','L','B'), 1024));
+ }
}
void Score::loadFrames(Common::SeekableReadStream &stream) {
@@ -131,6 +135,37 @@ void Score::loadCastData(Common::SeekableReadStream &stream) {
}
}
+void Score::loadLabels(Common::SeekableReadStream &stream) {
+ uint16 count = stream.readUint16BE() + 1;
+ uint16 offset = count * 4 + 2;
+
+ uint16 frame = stream.readUint16BE();
+ uint16 stringPos = stream.readUint16BE() + offset;
+
+ for (uint16 i = 0; i < count; i++) {
+
+ uint16 nextFrame = stream.readUint16BE();
+ uint16 nextStringPos = stream.readUint16BE() + offset;
+ uint16 streamPos = stream.pos();
+
+ stream.seek(stringPos);
+
+ for (uint16 j = stringPos; j < nextStringPos; j++) {
+ _labels[frame] += stream.readByte();
+ }
+
+ stream.seek(streamPos);
+
+ frame = nextFrame;
+ stringPos = nextStringPos;
+ }
+
+ Common::HashMap<uint16, Common::String>::iterator j;
+ for (j = _labels.begin(); j != _labels.end(); ++j) {
+ debug("Frame %d, Label %s", j->_key, j->_value.c_str());
+ }
+}
+
BitmapCast::BitmapCast(Common::SeekableReadStream &stream) {
/*byte flags = */ stream.readByte();
/*uint16 someFlaggyThing = */ stream.readUint16BE();
diff --git a/engines/director/score.h b/engines/director/score.h
index ba10f2d..fae6ea8 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -25,6 +25,7 @@
#include "common/array.h"
#include "director/resource.h"
#include "graphics/managed_surface.h"
+#include "common/str.h"
namespace Director {
@@ -195,9 +196,11 @@ private:
void loadConfig(Common::SeekableReadStream &stream);
void loadCastData(Common::SeekableReadStream &stream);
void loadFrames(Common::SeekableReadStream &stream);
+ void loadLabels(Common::SeekableReadStream &stream);
public:
Common::Array<Frame *> _frames;
Common::HashMap<int, Cast *> _casts;
+ Common::HashMap<uint16, Common::String> _labels;
private:
uint16 _versionMinor;
Commit: 4819a4e8572e49a14c83b41312e7f1791408b072
https://github.com/scummvm/scummvm/commit/4819a4e8572e49a14c83b41312e7f1791408b072
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Load actions
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 28aed23..7a3e886 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -50,6 +50,10 @@ Score::Score(Archive &movie) {
if (_movieArchive->hasResource(MKTAG('V','W','L','B'), 1024)) {
loadLabels(*_movieArchive->getResource(MKTAG('V','W','L','B'), 1024));
}
+
+ if (_movieArchive->hasResource(MKTAG('V','W','A','C'), 1024)) {
+ loadActions(*_movieArchive->getResource(MKTAG('V','W','A','C'), 1024));
+ }
}
void Score::loadFrames(Common::SeekableReadStream &stream) {
@@ -166,6 +170,39 @@ void Score::loadLabels(Common::SeekableReadStream &stream) {
}
}
+void Score::loadActions(Common::SeekableReadStream &stream) {
+ uint16 count = stream.readUint16BE() + 1;
+ uint16 offset = count * 4 + 2;
+
+ byte id = stream.readByte();
+ /*byte subId = */ stream.readByte(); //I couldn't find how it used in continuity (except print). Frame actionId = 1 byte.
+ uint16 stringPos = stream.readUint16BE() + offset;
+
+ for (uint16 i = 0; i < count; i++) {
+
+ uint16 nextId = stream.readByte();
+ /*byte subId = */ stream.readByte();
+ uint16 nextStringPos = stream.readUint16BE() + offset;
+ uint16 streamPos = stream.pos();
+
+ stream.seek(stringPos);
+
+ for (uint16 j = stringPos; j < nextStringPos; j++) {
+ _actions[id] += stream.readByte();
+ }
+
+ stream.seek(streamPos);
+
+ id = nextId;
+ stringPos = nextStringPos;
+ }
+
+ Common::HashMap<uint16, Common::String>::iterator j;
+ for (j = _actions.begin(); j != _actions.end(); ++j) {
+ debug("Id %d, Script %s", j->_key, j->_value.c_str());
+ }
+}
+
BitmapCast::BitmapCast(Common::SeekableReadStream &stream) {
/*byte flags = */ stream.readByte();
/*uint16 someFlaggyThing = */ stream.readUint16BE();
diff --git a/engines/director/score.h b/engines/director/score.h
index fae6ea8..21756be 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -197,10 +197,13 @@ private:
void loadCastData(Common::SeekableReadStream &stream);
void loadFrames(Common::SeekableReadStream &stream);
void loadLabels(Common::SeekableReadStream &stream);
+ void loadActions(Common::SeekableReadStream &stream);
+
public:
Common::Array<Frame *> _frames;
Common::HashMap<int, Cast *> _casts;
Common::HashMap<uint16, Common::String> _labels;
+ Common::HashMap<uint16, Common::String> _actions;
private:
uint16 _versionMinor;
Commit: 1b71712b15f13e3c82d43df08d50dbfd191704d0
https://github.com/scummvm/scummvm/commit/1b71712b15f13e3c82d43df08d50dbfd191704d0
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Display draw rects for debug
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 7a3e886..e184b71 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -462,11 +462,11 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
fieldPosition += 2;
break;
case kSpritePositionWidth:
- sprite._height = stream.readUint16BE();
+ sprite._width = stream.readUint16BE();
fieldPosition += 2;
break;
case kSpritePositionHeight:
- sprite._width = stream.readUint16BE();
+ sprite._height = stream.readUint16BE();
fieldPosition += 2;
break;
default:
@@ -518,7 +518,7 @@ void Frame::display(Archive &_movie, Graphics::ManagedSurface &surface, Common::
Common::Rect drawRect = Common::Rect(x, y, x + width, y + height);
- switch(_sprites[i]->_ink) {
+ switch (_sprites[i]->_ink) {
case kInkTypeCopy:
surface.blitFrom(*img.getSurface(), Common::Point(x, y));
break;
@@ -533,6 +533,7 @@ void Frame::display(Archive &_movie, Graphics::ManagedSurface &surface, Common::
surface.blitFrom(*img.getSurface(), Common::Point(x, y));
break;
}
+ surface.frameRect(drawRect, 0);
}
}
g_system->copyRectToScreen(surface.getPixels(), surface.pitch, 0, 0, surface.getBounds().width(), surface.getBounds().height());
diff --git a/engines/director/score.h b/engines/director/score.h
index 21756be..7c2a75f 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -53,8 +53,8 @@ enum spritePositions {
kSpritePositionCastId = 6,
kSpritePositionY = 8,
kSpritePositionX = 10,
- kSpritePositionWidth = 12,
- kSpritePositionHeight = 14
+ kSpritePositionHeight = 12,
+ kSpritePositionWidth = 14
};
enum mainChannelsPosition {
Commit: 910803a914b1c1503dafc86a742ca39ee190aa0a
https://github.com/scummvm/scummvm/commit/910803a914b1c1503dafc86a742ca39ee190aa0a
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Change matte function, use FloodFill
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index e184b71..eb33ef5 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -556,30 +556,35 @@ void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graph
void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
//Like background trans, but all white pixels NOT ENCLOSED by coloured pixels are transparent
uint8 skipColor = 15;
- for (int ii = 0; ii < sprite.h; ii++) {
- const byte *leftSrc = (const byte *)sprite.getBasePtr(0, ii);
- byte *leftDst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + ii);
- bool skip = true;
- for (int j = 0; j < drawRect.width() / 2; j++) {
- if ((*leftSrc != skipColor) || !skip) {
- *leftDst = *leftSrc;
- skip = false;
- }
- leftSrc++;
- leftDst++;
- }
- skip = true;
- const byte *rightSrc = (const byte *)sprite.getBasePtr(sprite.w - 1, ii);
- byte *rightDst = (byte *)target.getBasePtr(drawRect.right - 1, drawRect.top + ii);
- for (int j = 0; j <= drawRect.width() / 2; j++) {
- if ((*rightSrc != skipColor) || !skip) {
- *rightDst = *rightSrc;
- skip = false;
- }
- rightSrc--;
- rightDst--;
+ uint8 toColor = 16;
+
+ Graphics::Surface tmp;
+ tmp.copyFrom(sprite);
+
+ Graphics::FloodFill ff(&tmp, skipColor, toColor);
+
+ for (int yy = 0; yy < tmp.h; yy++) {
+ ff.addSeed(0, yy);
+ ff.addSeed(tmp.w - 1, yy);
+ }
+ for (int xx = 0; xx < tmp.w; xx++) {
+ ff.addSeed(xx, 0);
+ ff.addSeed(xx, tmp.h - 1);
+ }
+ ff.fill();
+
+ for (int yy = 0; yy < tmp.h; yy++) {
+ const byte *src = (const byte *)tmp.getBasePtr(0, yy);
+ byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + yy);
+ for (int xx = 0; xx < drawRect.width(); xx++) {
+ if (*src != toColor)
+ *dst = *src;
+ src++;
+ dst++;
}
}
+
+ tmp.free();
}
Sprite::Sprite() {
Commit: f95410532015363eb158537637147cb97081eee9
https://github.com/scummvm/scummvm/commit/f95410532015363eb158537637147cb97081eee9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Switch Matte Ink to using flood fill mask mode.
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index eb33ef5..bd07f78 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -297,12 +297,12 @@ Frame::Frame() {
_transFlags = 0;
_transChunkSize = 0;
_tempo = 0;
-
+
_sound1 = 0;
_sound2 = 0;
_soundType1 = 0;
_soundType2 = 0;
-
+
_actionId = 0;
_skipFrameFlag = 0;
_blend = 0;
@@ -556,7 +556,7 @@ void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graph
void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
//Like background trans, but all white pixels NOT ENCLOSED by coloured pixels are transparent
uint8 skipColor = 15;
- uint8 toColor = 16;
+ uint8 toColor = 0; // Could be anything, not used.
Graphics::Surface tmp;
tmp.copyFrom(sprite);
@@ -571,23 +571,22 @@ void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Su
ff.addSeed(xx, 0);
ff.addSeed(xx, tmp.h - 1);
}
- ff.fill();
+ ff.fillMask();
for (int yy = 0; yy < tmp.h; yy++) {
const byte *src = (const byte *)tmp.getBasePtr(0, yy);
+ const byte *mask = (const byte *)ff.getMask()->getBasePtr(0, yy);
byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + yy);
- for (int xx = 0; xx < drawRect.width(); xx++) {
- if (*src != toColor)
+
+ for (int xx = 0; xx < drawRect.width(); xx++, src++, dst++, mask++)
+ if (*mask == 0)
*dst = *src;
- src++;
- dst++;
- }
}
tmp.free();
}
-Sprite::Sprite() {
+Sprite::Sprite() {
_enabled = false;
_width = 0;
_ink = kInkTypeCopy;
Commit: bd345ce81c0edd1267909b0bcac7bcf65dea834b
https://github.com/scummvm/scummvm/commit/bd345ce81c0edd1267909b0bcac7bcf65dea834b
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Parse mac name
Changed paths:
engines/director/resource.cpp
engines/director/score.cpp
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 8eb4b92..2c90dfd 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -244,6 +244,18 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
if (tag == 0)
break;
+ uint16 startResPos = stream->pos();
+ stream->seek(offset + 12);
+
+ Common::String name = "";
+ byte nameSize = stream->readByte();
+ if (nameSize) {
+ for (uint8 i = 0; i < nameSize; i++) {
+ name += stream->readByte();
+ }
+ }
+
+ stream->seek(startResPos);
debug(0, "Found RIFF resource '%s' %d: %d @ 0x%08x", tag2str(tag), id, size, offset);
@@ -251,6 +263,7 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
Resource &res = resMap[id];
res.offset = offset;
res.size = size;
+ res.name = name;
}
_stream = stream;
@@ -273,9 +286,10 @@ Common::SeekableReadStream *RIFFArchive::getResource(uint32 tag, uint16 id) {
uint32 size = res.size - 4;
// Skip the Pascal string
_stream->seek(offset);
- byte stringSize = _stream->readByte() + 1; // 1 for this byte
- offset += stringSize;
- size -= stringSize;
+ byte stringSize = _stream->readByte(); // 1 for this byte
+
+ offset += stringSize + 1;
+ size -= stringSize + 1;
// Align to nearest word boundary
if (offset & 1) {
@@ -286,7 +300,6 @@ Common::SeekableReadStream *RIFFArchive::getResource(uint32 tag, uint16 id) {
return new Common::SeekableSubReadStream(_stream, offset, offset + size);
}
-
// RIFX Archive code
bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOffset) {
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index bd07f78..889020c 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -54,6 +54,10 @@ Score::Score(Archive &movie) {
if (_movieArchive->hasResource(MKTAG('V','W','A','C'), 1024)) {
loadActions(*_movieArchive->getResource(MKTAG('V','W','A','C'), 1024));
}
+
+ if (_movieArchive->hasResource(MKTAG('M','C','N','M'), 0)) {
+ debug("Mac name %s", _movieArchive->getName(MKTAG('M','C','N','M'), 0).c_str());
+ }
}
void Score::loadFrames(Common::SeekableReadStream &stream) {
Commit: 06a655ff9d9ca6bead06408b12fd1f76cc5a62cf
https://github.com/scummvm/scummvm/commit/06a655ff9d9ca6bead06408b12fd1f76cc5a62cf
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix bitmap cast reading
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 889020c..b8d4e3d 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -209,13 +209,15 @@ void Score::loadActions(Common::SeekableReadStream &stream) {
BitmapCast::BitmapCast(Common::SeekableReadStream &stream) {
/*byte flags = */ stream.readByte();
- /*uint16 someFlaggyThing = */ stream.readUint16BE();
+ uint16 someFlaggyThing = stream.readUint16BE();
initialRect = Score::readRect(stream);
boundingRect = Score::readRect(stream);
regY = stream.readUint16BE();
regX = stream.readUint16BE();
- /*uint16 unk1 =*/ stream.readUint16BE();
- /*uint16 unk2 =*/ stream.readUint16BE();
+ if (someFlaggyThing & 0x8000) {
+ /*uint16 unk1 =*/ stream.readUint16BE();
+ /*uint16 unk2 =*/ stream.readUint16BE();
+ }
}
TextCast::TextCast(Common::SeekableReadStream &stream) {
Commit: cc2abbbb9c7190a567aee9babc2073757a4edc0f
https://github.com/scummvm/scummvm/commit/cc2abbbb9c7190a567aee9babc2073757a4edc0f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Use pixel(0,0) for Matte ink
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index b8d4e3d..b896665 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -539,7 +539,6 @@ void Frame::display(Archive &_movie, Graphics::ManagedSurface &surface, Common::
surface.blitFrom(*img.getSurface(), Common::Point(x, y));
break;
}
- surface.frameRect(drawRect, 0);
}
}
g_system->copyRectToScreen(surface.getPixels(), surface.pitch, 0, 0, surface.getBounds().width(), surface.getBounds().height());
@@ -561,13 +560,10 @@ void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graph
void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
//Like background trans, but all white pixels NOT ENCLOSED by coloured pixels are transparent
- uint8 skipColor = 15;
- uint8 toColor = 0; // Could be anything, not used.
-
Graphics::Surface tmp;
tmp.copyFrom(sprite);
- Graphics::FloodFill ff(&tmp, skipColor, toColor);
+ Graphics::FloodFill ff(&tmp, *(byte *)tmp.getBasePtr(0, 0), 0);
for (int yy = 0; yy < tmp.h; yy++) {
ff.addSeed(0, yy);
Commit: 14d0bb6844accf4cb3d840d5ff01c25298bd7483
https://github.com/scummvm/scummvm/commit/14d0bb6844accf4cb3d840d5ff01c25298bd7483
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Find CLUT table in score initialization
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index b896665..1e9ea19 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -58,6 +58,17 @@ Score::Score(Archive &movie) {
if (_movieArchive->hasResource(MKTAG('M','C','N','M'), 0)) {
debug("Mac name %s", _movieArchive->getName(MKTAG('M','C','N','M'), 0).c_str());
}
+ DIBDecoder palette;
+ Common::Array<uint16> clutList = _movieArchive->getResourceIDList(MKTAG('C','L','U','T'));
+
+ if (clutList.size() > 1)
+ error("More than one palette was found");
+ if (clutList.size() == 0)
+ error("CLUT not found");
+
+ Common::SeekableReadStream *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]);
+ palette.loadPalette(*pal);
+ g_system->getPaletteManager()->setPalette(palette.getPalette(), 0, 255);
}
void Score::loadFrames(Common::SeekableReadStream &stream) {
@@ -486,10 +497,6 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
void Frame::display(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect moviRect) {
surface.clear();
- DIBDecoder palette;
- Common::SeekableReadStream *pal = _movie.getResource(MKTAG('C', 'L', 'U', 'T'), 1025);
- palette.loadPalette(*pal);
- g_system->getPaletteManager()->setPalette(palette.getPalette(), 0, 255);
for (uint16 i = 0; i < CHANNEL_COUNT; i++) {
if (_sprites[i]->_enabled) {
Commit: e17de45075f75cf9657764c31a7893dd73a1822f
https://github.com/scummvm/scummvm/commit/e17de45075f75cf9657764c31a7893dd73a1822f
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix tempo channel parsing, add missed events
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 1e9ea19..d8d76ff 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -293,10 +293,18 @@ void Score::display() {
if (tempo > 161) {
//Delay
_nextFrameTime = g_system->getMillis() + (256 - tempo) * 1000;
- } else {
+ } else if (tempo <= 60) {
//FPS
_nextFrameTime = g_system->getMillis() + (float)tempo / 60 * 1000;
_currentFrameRate = tempo;
+ } else if (tempo >= 136) {
+ //TODO Wait for channel tempo - 135
+ } else if (tempo == 128) {
+ //TODO Wait for Click/Key
+ } else if (tempo == 135) {
+ //TODO Wait for sound channel 1
+ } else if (tempo == 134) {
+ //TODO Wait for sound channel 2
}
}
_nextFrameTime = g_system->getMillis() + (float)_currentFrameRate / 60 * 1000;
Commit: 1b6b24740e91cb6a3191728e0e2f01c4d475cc84
https://github.com/scummvm/scummvm/commit/1b6b24740e91cb6a3191728e0e2f01c4d475cc84
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add cast info loading
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index d8d76ff..59e3f9e 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -58,6 +58,15 @@ Score::Score(Archive &movie) {
if (_movieArchive->hasResource(MKTAG('M','C','N','M'), 0)) {
debug("Mac name %s", _movieArchive->getName(MKTAG('M','C','N','M'), 0).c_str());
}
+
+
+ Common::Array<uint16> vwci = _movieArchive->getResourceIDList(MKTAG('V','W','C','I'));
+ if (vwci.size() > 0) {
+ Common::Array<uint16>::iterator iterator;
+ for (iterator = vwci.begin(); iterator != vwci.end(); ++iterator)
+ loadCastInfo(*_movieArchive->getResource(MKTAG('V','W','C','I'), *iterator));
+ }
+
DIBDecoder palette;
Common::Array<uint16> clutList = _movieArchive->getResourceIDList(MKTAG('C','L','U','T'));
@@ -218,6 +227,52 @@ void Score::loadActions(Common::SeekableReadStream &stream) {
}
}
+void Score::loadCastInfo(Common::SeekableReadStream &stream) {
+ uint32 entryType = 0;
+ Common::Array<Common::String> castStrings = loadStrings(stream, entryType);
+ CastInfo ci;
+ ci.script = castStrings[0];
+ ci.name = castStrings[1];
+ ci.directory = castStrings[2];
+ ci.fileName = castStrings[3];
+ ci.type = castStrings[4];
+ //TODO storage in array, and use this info
+}
+
+Common::Array<Common::String> Score::loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader) {
+ Common::Array<Common::String> strings;
+ uint32 offset = 0;
+ if (hasHeader) {
+ offset = stream.readUint32BE();
+ /*uint32 unk1 = */ stream.readUint32BE();
+ /*uint32 unk2 = */ stream.readUint32BE();
+ entryType = stream.readUint32BE();
+ stream.seek(offset);
+ }
+
+ uint16 count = stream.readUint16BE();
+ offset += count * 2 + 16; //positions info + header info
+ uint32 startPos = stream.readUint32BE() + offset;
+ for (uint16 i = 0; i < count; i++) {
+ Common::String entryString;
+ uint32 nextPos = stream.readUint32BE() + offset;
+ uint32 streamPos = stream.pos();
+
+ stream.seek(startPos);
+
+ while (startPos != nextPos) {
+ entryString += stream.readByte();
+ ++startPos;
+ }
+
+ strings.push_back(entryString);
+
+ stream.seek(streamPos);
+ startPos = nextPos;
+ }
+ return strings;
+}
+
BitmapCast::BitmapCast(Common::SeekableReadStream &stream) {
/*byte flags = */ stream.readByte();
uint16 someFlaggyThing = stream.readUint16BE();
diff --git a/engines/director/score.h b/engines/director/score.h
index 7c2a75f..b8312df 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -138,6 +138,13 @@ struct ButtonCast : TextCast {
uint16 buttonType;
};
+struct CastInfo {
+ Common::String script;
+ Common::String name;
+ Common::String directory;
+ Common::String fileName;
+ Common::String type;
+};
class Sprite {
public:
@@ -198,7 +205,8 @@ private:
void loadFrames(Common::SeekableReadStream &stream);
void loadLabels(Common::SeekableReadStream &stream);
void loadActions(Common::SeekableReadStream &stream);
-
+ void loadCastInfo(Common::SeekableReadStream &stream);
+ Common::Array<Common::String> loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader = true);
public:
Common::Array<Frame *> _frames;
Common::HashMap<int, Cast *> _casts;
Commit: 414a0b1c3505cba60696d294371ddb6022cb4af1
https://github.com/scummvm/scummvm/commit/414a0b1c3505cba60696d294371ddb6022cb4af1
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add file info loading, fix strings loading
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 59e3f9e..315d431 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -59,6 +59,9 @@ Score::Score(Archive &movie) {
debug("Mac name %s", _movieArchive->getName(MKTAG('M','C','N','M'), 0).c_str());
}
+ if (_movieArchive->hasResource(MKTAG('V','W','F','I'), 1024)) {
+ loadFileInfo(*_movieArchive->getResource(MKTAG('V','W','F','I'), 1024));
+ }
Common::Array<uint16> vwci = _movieArchive->getResourceIDList(MKTAG('V','W','C','I'));
if (vwci.size() > 0) {
@@ -239,6 +242,14 @@ void Score::loadCastInfo(Common::SeekableReadStream &stream) {
//TODO storage in array, and use this info
}
+void Score::loadFileInfo(Common::SeekableReadStream &stream) {
+ Common::Array<Common::String> fileInfoStrings = loadStrings(stream, _flags);
+ _script = fileInfoStrings[0];
+ _changedBy = fileInfoStrings[1];
+ _createdBy = fileInfoStrings[2];
+ _directory = fileInfoStrings[3];
+}
+
Common::Array<Common::String> Score::loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader) {
Common::Array<Common::String> strings;
uint32 offset = 0;
@@ -251,7 +262,7 @@ Common::Array<Common::String> Score::loadStrings(Common::SeekableReadStream &str
}
uint16 count = stream.readUint16BE();
- offset += count * 2 + 16; //positions info + header info
+ offset += (count + 1) * 4 + 2; //positions info + uint16 count
uint32 startPos = stream.readUint32BE() + offset;
for (uint16 i = 0; i < count; i++) {
Common::String entryString;
diff --git a/engines/director/score.h b/engines/director/score.h
index b8312df..e93b6ba 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -206,6 +206,7 @@ private:
void loadLabels(Common::SeekableReadStream &stream);
void loadActions(Common::SeekableReadStream &stream);
void loadCastInfo(Common::SeekableReadStream &stream);
+ void loadFileInfo(Common::SeekableReadStream &stream);
Common::Array<Common::String> loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader = true);
public:
Common::Array<Frame *> _frames;
@@ -216,6 +217,10 @@ public:
private:
uint16 _versionMinor;
uint16 _versionMajor;
+ Common::String _createdBy;
+ Common::String _changedBy;
+ Common::String _script;
+ Common::String _directory;
byte _currentFrameRate;
uint16 _castArrayStart;
uint16 _currentFrame;
Commit: 61f15f16da5a88cc70522556d0a470371937eb76
https://github.com/scummvm/scummvm/commit/61f15f16da5a88cc70522556d0a470371937eb76
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add font map loading
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 315d431..6d6f295 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -63,6 +63,10 @@ Score::Score(Archive &movie) {
loadFileInfo(*_movieArchive->getResource(MKTAG('V','W','F','I'), 1024));
}
+ if (_movieArchive->hasResource(MKTAG('V','W','F','M'), 1024)) {
+ loadFontMap(*_movieArchive->getResource(MKTAG('V','W','F','M'), 1024));
+ }
+
Common::Array<uint16> vwci = _movieArchive->getResourceIDList(MKTAG('V','W','C','I'));
if (vwci.size() > 0) {
Common::Array<uint16>::iterator iterator;
@@ -284,6 +288,30 @@ Common::Array<Common::String> Score::loadStrings(Common::SeekableReadStream &str
return strings;
}
+void Score::loadFontMap(Common::SeekableReadStream &stream) {
+ uint16 count = stream.readUint16BE();
+ uint32 offset = (count * 2) + 2;
+ uint16 currentRawPosition = offset;
+
+ for (uint16 i = 0; i < count; i++) {
+ uint16 id = stream.readUint16BE();
+ uint32 positionInfo = stream.pos();
+
+ stream.seek(currentRawPosition);
+
+ uint16 size = stream.readByte();
+ Common::String font;
+
+ for (uint16 k = 0; k < size; k++) {
+ font += stream.readByte();
+ }
+
+ _fontMap[id] = font;
+ currentRawPosition = stream.pos();
+ stream.seek(positionInfo);
+ }
+}
+
BitmapCast::BitmapCast(Common::SeekableReadStream &stream) {
/*byte flags = */ stream.readByte();
uint16 someFlaggyThing = stream.readUint16BE();
diff --git a/engines/director/score.h b/engines/director/score.h
index e93b6ba..eea9bb9 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -207,13 +207,14 @@ private:
void loadActions(Common::SeekableReadStream &stream);
void loadCastInfo(Common::SeekableReadStream &stream);
void loadFileInfo(Common::SeekableReadStream &stream);
+ void loadFontMap(Common::SeekableReadStream &stream);
Common::Array<Common::String> loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader = true);
public:
Common::Array<Frame *> _frames;
Common::HashMap<int, Cast *> _casts;
Common::HashMap<uint16, Common::String> _labels;
Common::HashMap<uint16, Common::String> _actions;
-
+ Common::HashMap<uint16, Common::String> _fontMap;
private:
uint16 _versionMinor;
uint16 _versionMajor;
@@ -225,6 +226,7 @@ private:
uint16 _castArrayStart;
uint16 _currentFrame;
uint32 _nextFrameTime;
+ uint32 _flags;
bool _stopPlay;
uint16 _castArrayEnd;
Common::Rect _movieRect;
Commit: f471b48cf44a63aaa7f035b1fd3dfe22cc9ebfa1
https://github.com/scummvm/scummvm/commit/f471b48cf44a63aaa7f035b1fd3dfe22cc9ebfa1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix guard includes
Changed paths:
engines/director/dib.h
engines/director/score.h
diff --git a/engines/director/dib.h b/engines/director/dib.h
index e81b32b..e3763be 100644
--- a/engines/director/dib.h
+++ b/engines/director/dib.h
@@ -20,21 +20,14 @@
*
*/
-/**
- * @file
- * Image decoder used in engines:
- * - hugo
- * - mohawk
- * - wintermute
- */
-
-#ifndef IMAGE_BMP_H
-#define IMAGE_BMP_H
+#ifndef DIRECTOR_DIB_H
+#define DIRECTOR_DIB_H
#include "common/scummsys.h"
#include "common/str.h"
#include "image/image_decoder.h"
#include "image/codecs/bmp_raw.h"
+
namespace Common {
class SeekableReadStream;
}
diff --git a/engines/director/score.h b/engines/director/score.h
index eea9bb9..b0d53b2 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -20,6 +20,9 @@
*
*/
+ #ifndef DIRECTOR_SCORE_H
+ #define DIRECTOR_SCORE_H
+
#include "common/rect.h"
#include "common/stream.h"
#include "common/array.h"
@@ -235,3 +238,5 @@ private:
};
} //End of namespace Director
+
+#endif
Commit: fd7b2f33bf3600f091a6aea1dd4499db5f963424
https://github.com/scummvm/scummvm/commit/fd7b2f33bf3600f091a6aea1dd4499db5f963424
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Added stub for Lingo interpreter
Changed paths:
A engines/director/lingo/lingo.cpp
A engines/director/lingo/lingo.h
engines/director/director.cpp
engines/director/director.h
engines/director/module.mk
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index a044f23..9108225 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -31,15 +31,16 @@
#include "common/stream.h"
#include "common/system.h"
#include "common/textconsole.h"
-#include "director/dib.h"
#include "engines/util.h"
-#include "director/director.h"
-#include "director/score.h"
-#include "director/resource.h"
#include "graphics/surface.h"
+#include "director/director.h"
+#include "director/dib.h"
+#include "director/resource.h"
+#include "director/score.h"
+#include "director/lingo/lingo.h"
namespace Director {
@@ -66,6 +67,8 @@ DirectorEngine::~DirectorEngine() {
Common::Error DirectorEngine::run() {
debug("Starting v%d Director game", getVersion());
+ _lingo = new Lingo();
+
//FIXME
_mainArchive = new RIFFArchive();
_mainArchive->openFile("bookshelf_example.mmm");
@@ -86,6 +89,8 @@ void DirectorEngine::loadEXE() {
if (!exeStream)
error("Failed to open EXE '%s'", getEXEName().c_str());
+ _lingo->processEvent(kEventStart, 0);
+
exeStream->seek(-4, SEEK_END);
exeStream->seek(exeStream->readUint32LE());
diff --git a/engines/director/director.h b/engines/director/director.h
index 2d1c395..205495a 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -41,6 +41,7 @@ enum DirectorGameID {
class Archive;
struct DirectorGameDescription;
+class Lingo;
class DirectorEngine : public ::Engine {
public:
@@ -76,6 +77,8 @@ private:
Archive *_mainArchive;
Common::MacResManager *_macBinary;
+
+ Lingo *_lingo;
};
} // End of namespace Director
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
new file mode 100644
index 0000000..94e23fa
--- /dev/null
+++ b/engines/director/lingo/lingo.cpp
@@ -0,0 +1,61 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "director/lingo/lingo.h"
+
+namespace Director {
+
+struct EventHandlerType {
+ LEvent handler;
+ const char *name;
+} static const eventHanlerDescs[] = {
+ { kEventEnterFrame, "enterFrame" },
+ { kEventPrepareFrame, "prepareFrame" },
+ { kEventExitFrame, "exitFrame" },
+
+ { kEventActivateWindow, "activateWindow" },
+ { kEventDeactivateWindow, "deactivateWindow" },
+ { kEventMoveWindow, "moveWindow" },
+ { kEventResizeWindow, "resizeWindow" },
+ { kEventOpenWindow, "openWindow" },
+ { kEventCloseWindow, "closeWindow" },
+ { kEventStart, "start" },
+ { kEventNone, 0 },
+};
+
+Lingo::Lingo() {
+ for (const EventHandlerType *t = &eventHanlerDescs[0]; t->handler != kEventNone; ++t)
+ _eventHandlerTypes[t->handler] = t->name;
+}
+
+Lingo::~Lingo() {
+}
+
+void Lingo::processEvent(LEvent event, int entityId) {
+ if (!_eventHandlerTypes.contains(event))
+ error("processEvent: Unknown event %d for entity %d", event, entityId);
+
+ debug(0, "processEvent(%s) for %d", _eventHandlerTypes[event], entityId);
+}
+
+
+} // End of namespace Director
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
new file mode 100644
index 0000000..b3810a6
--- /dev/null
+++ b/engines/director/lingo/lingo.h
@@ -0,0 +1,60 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DIRECTOR_LINGO_LINGO_H
+#define DIRECTOR_LINGO_LINGO_H
+
+#include "common/debug.h"
+#include "common/hashmap.h"
+
+namespace Director {
+
+enum LEvent {
+ kEventNone,
+ kEventEnterFrame,
+ kEventPrepareFrame,
+ kEventExitFrame,
+
+ kEventActivateWindow,
+ kEventDeactivateWindow,
+ kEventMoveWindow,
+ kEventResizeWindow,
+ kEventOpenWindow,
+ kEventCloseWindow,
+
+ kEventStart
+};
+
+class Lingo {
+public:
+ Lingo();
+ ~Lingo();
+
+ void processEvent(LEvent event, int entityId);
+
+private:
+ Common::HashMap<uint32, const char *> _eventHandlerTypes;
+};
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/module.mk b/engines/director/module.mk
index cf4a587..6f2e216 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -5,7 +5,9 @@ MODULE_OBJS = \
dib.o \
director.o \
resource.o \
- score.o
+ score.o \
+ lingo/lingo.o
+
# This module can be built as a plugin
ifeq ($(ENABLE_DIRECTOR), DYNAMIC_PLUGIN)
PLUGIN := 1
Commit: bc2e73c20b28d4582c1a8a17ce03a8d6beda0ca9
https://github.com/scummvm/scummvm/commit/bc2e73c20b28d4582c1a8a17ce03a8d6beda0ca9
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add dump scripts
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 6d6f295..cfd4a43 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -23,6 +23,8 @@
#include "director/score.h"
#include "common/stream.h"
#include "common/debug.h"
+#include "common/file.h"
+#include "common/config-manager.h"
#include "common/system.h"
#include "director/dib.h"
@@ -47,6 +49,10 @@ Score::Score(Archive &movie) {
loadConfig(*_movieArchive->getResource(MKTAG('V','W','C','F'), 1024));
loadCastData(*_movieArchive->getResource(MKTAG('V','W','C','R'), 1024));
+ if (_movieArchive->hasResource(MKTAG('M','C','N','M'), 0)) {
+ _macName = _movieArchive->getName(MKTAG('M','C','N','M'), 0).c_str();
+ }
+
if (_movieArchive->hasResource(MKTAG('V','W','L','B'), 1024)) {
loadLabels(*_movieArchive->getResource(MKTAG('V','W','L','B'), 1024));
}
@@ -55,10 +61,6 @@ Score::Score(Archive &movie) {
loadActions(*_movieArchive->getResource(MKTAG('V','W','A','C'), 1024));
}
- if (_movieArchive->hasResource(MKTAG('M','C','N','M'), 0)) {
- debug("Mac name %s", _movieArchive->getName(MKTAG('M','C','N','M'), 0).c_str());
- }
-
if (_movieArchive->hasResource(MKTAG('V','W','F','I'), 1024)) {
loadFileInfo(*_movieArchive->getResource(MKTAG('V','W','F','I'), 1024));
}
@@ -202,6 +204,7 @@ void Score::loadLabels(Common::SeekableReadStream &stream) {
}
void Score::loadActions(Common::SeekableReadStream &stream) {
+
uint16 count = stream.readUint16BE() + 1;
uint16 offset = count * 4 + 2;
@@ -229,9 +232,40 @@ void Score::loadActions(Common::SeekableReadStream &stream) {
}
Common::HashMap<uint16, Common::String>::iterator j;
+
+ debug("%d", ConfMan.getBool("dump_scripts"));
+ if (!ConfMan.getBool("dump_scripts"))
+ return;
+
for (j = _actions.begin(); j != _actions.end(); ++j) {
- debug("Id %d, Script %s", j->_key, j->_value.c_str());
+ dumpScript(j->_key, kFrameScript, j->_value);
+ }
+}
+
+void Score::dumpScript(uint16 id, scriptType type, Common::String script) {
+ Common::DumpFile out;
+ Common::String typeName;
+ char buf[256];
+
+ switch (type) {
+ case kFrameScript:
+ typeName = "frame";
+ break;
+ case kMovieScript:
+ typeName = "movie";
+ break;
+ case kSpriteScript:
+ typeName = "sprite";
+ break;
}
+
+ sprintf(buf, "./dump/%s-%s-%d.txt", _macName.c_str(), typeName.c_str(), id);
+
+ out.open(buf);
+ out.writeString(script);
+
+ out.flush();
+ out.close();
}
void Score::loadCastInfo(Common::SeekableReadStream &stream) {
diff --git a/engines/director/score.h b/engines/director/score.h
index b0d53b2..60fa0e7 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -97,6 +97,12 @@ enum inkType {
kInkTypeDark
};
+enum scriptType {
+ kMovieScript,
+ kSpriteScript,
+ kFrameScript
+};
+
struct Cast {
castType type;
Common::Rect initialRect;
@@ -211,6 +217,7 @@ private:
void loadCastInfo(Common::SeekableReadStream &stream);
void loadFileInfo(Common::SeekableReadStream &stream);
void loadFontMap(Common::SeekableReadStream &stream);
+ void dumpScript(uint16 id, scriptType type, Common::String script);
Common::Array<Common::String> loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader = true);
public:
Common::Array<Frame *> _frames;
@@ -221,6 +228,7 @@ public:
private:
uint16 _versionMinor;
uint16 _versionMajor;
+ Common::String _macName;
Common::String _createdBy;
Common::String _changedBy;
Common::String _script;
Commit: cd0e04f672656bdf32e23334e4768d4bece56636
https://github.com/scummvm/scummvm/commit/cd0e04f672656bdf32e23334e4768d4bece56636
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Check if file is open, rename dump folder
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index cfd4a43..f01ff4e 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -259,9 +259,12 @@ void Score::dumpScript(uint16 id, scriptType type, Common::String script) {
break;
}
- sprintf(buf, "./dump/%s-%s-%d.txt", _macName.c_str(), typeName.c_str(), id);
+ sprintf(buf, "./dumps/%s-%s-%d.txt", _macName.c_str(), typeName.c_str(), id);
- out.open(buf);
+ if (!out.open(buf)) {
+ warning("Can not open dump file %s", buf);
+ return;
+ }
out.writeString(script);
out.flush();
Commit: a0276402d0f68e51187249c7c47f375e7bf73f32
https://github.com/scummvm/scummvm/commit/a0276402d0f68e51187249c7c47f375e7bf73f32
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add user actions, sprite, movie events to lingo events
Changed paths:
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 94e23fa..ca2aaf8 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -28,6 +28,14 @@ struct EventHandlerType {
LEvent handler;
const char *name;
} static const eventHanlerDescs[] = {
+ { kEventPrepareMovie, "prepareMovie" },
+ { kEventStartMovie, "startMovie" },
+ { kEventStopMovie, "stopMovie" },
+
+ { kEventNew, "newSprite" },
+ { kEventBeginSprite, "beginSprite" },
+ { kEventEndSprite, "endSprite" },
+
{ kEventEnterFrame, "enterFrame" },
{ kEventPrepareFrame, "prepareFrame" },
{ kEventExitFrame, "exitFrame" },
@@ -39,6 +47,18 @@ struct EventHandlerType {
{ kEventOpenWindow, "openWindow" },
{ kEventCloseWindow, "closeWindow" },
{ kEventStart, "start" },
+
+ { kEventKeyUp, "keyUp" },
+ { kEventKeyDown, "keyDown" },
+ { kEventMouseUp, "mouseUp" },
+ { kEventMouseDown, "mouseDown" },
+ { kEventRightMouseDown, "rightMouseDown" },
+ { kEventRightMouseUp, "rightMouseUp" },
+ { kEventMouseEnter, "mouseEnter" },
+ { kEventMouseLeave, "mouseLeave" },
+ { kEventMouseUpOutSide, "mouseUpOutSide" },
+ { kEventMouseWithin "mouseWithin" },
+
{ kEventNone, 0 },
};
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index b3810a6..7aa11fb 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -29,6 +29,14 @@
namespace Director {
enum LEvent {
+ kEventPrepareMovie,
+ kEventStartMovie,
+ kEventStopMovie,
+
+ kEventNew,
+ kEventBeginSprite,
+ kEventEndSprite,
+
kEventNone,
kEventEnterFrame,
kEventPrepareFrame,
@@ -41,6 +49,17 @@ enum LEvent {
kEventOpenWindow,
kEventCloseWindow,
+ kEventKeyUp,
+ kEventKeyDown,
+ kEventMouseUp,
+ kEventMouseDown,
+ kEventRightMouseUp,
+ kEventRightMouseDown,
+ kEventMouseEnter,
+ kEventMouseLeave,
+ kEventMouseUpOutSide,
+ kEventMouseWithin,
+
kEventStart
};
Commit: 1099838bbd5580019d164cdeebc22d9228f995a5
https://github.com/scummvm/scummvm/commit/1099838bbd5580019d164cdeebc22d9228f995a5
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix load actions
Changed paths:
engines/director/lingo/lingo.cpp
engines/director/score.cpp
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index ca2aaf8..bf06f45 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -57,7 +57,7 @@ struct EventHandlerType {
{ kEventMouseEnter, "mouseEnter" },
{ kEventMouseLeave, "mouseLeave" },
{ kEventMouseUpOutSide, "mouseUpOutSide" },
- { kEventMouseWithin "mouseWithin" },
+ { kEventMouseWithin, "mouseWithin" },
{ kEventNone, 0 },
};
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index f01ff4e..beb0c97 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -229,11 +229,12 @@ void Score::loadActions(Common::SeekableReadStream &stream) {
id = nextId;
stringPos = nextStringPos;
+ if (stringPos == stream.size())
+ break;
}
Common::HashMap<uint16, Common::String>::iterator j;
- debug("%d", ConfMan.getBool("dump_scripts"));
if (!ConfMan.getBool("dump_scripts"))
return;
Commit: d01fddfa6b39afa897cb1e1d694db127298da5cc
https://github.com/scummvm/scummvm/commit/d01fddfa6b39afa897cb1e1d694db127298da5cc
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add transition types
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index beb0c97..bc79ee9 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -475,6 +475,7 @@ Frame::Frame(const Frame &frame) {
_actionId = frame._actionId;
_transFlags = frame._transFlags;
_transType = frame._transType;
+ _transChunkSize = frame._transChunkSize;
_tempo = frame._tempo;
_sound1 = frame._sound1;
_sound2 = frame._sound2;
@@ -542,7 +543,7 @@ void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset,
offset++;
break;
case kTransTypePosition:
- _transType = stream.readByte();
+ _transType = static_cast<transitionType>(stream.readByte());
offset++;
break;
case kSound1Position:
diff --git a/engines/director/score.h b/engines/director/score.h
index 60fa0e7..09e3377 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -103,6 +103,61 @@ enum scriptType {
kFrameScript
};
+enum transitionType {
+ kTransWipeRight = 1,
+ kTransWipeLeft,
+ kTransWipeDown,
+ kTransWipeUp,
+ kTransCenterOutHorizontal,
+ kTransEdgesInHorizontal,
+ kTransCenterOutVertical,
+ kTransEdgesInVertical,
+ kTransCenterOutSquare,
+ kTransEdgesInSquare,
+ kTransPushLeft,
+ kTransPushRight,
+ kTransPushDown,
+ kTransPushUp,
+ kTransRevealUp,
+ kTransRevealUpRight,
+ kTransRevealRight,
+ kTransRevealDown,
+ kTransRevealDownRight,
+ kTransRevealDownLeft,
+ kTransRevealLeft,
+ kTransRevealUpLeft,
+ kTransDisolvePixelsFast,
+ kTransDisolveBoxyRects,
+ kTransDisolveBoxySquares,
+ kTransDisolvePatterns,
+ kTransRandomRows,
+ kTransRandomColumns,
+ kTransCoverDown,
+ kTransCoverDownLeft,
+ kTransCoverDownRight,
+ kTransCoverLeft,
+ kTransCoverRight,
+ kTransCoverUp,
+ kTransCoverUpLeft,
+ kTransCoverUpRight,
+ kTransTypeVenitianBlind,
+ kTransTypeCheckerboard,
+ kTransTypeStripsBottomBuildLeft,
+ kTransTypeStripsBottomBuildRight,
+ kTransTypeStripsLeftBuildDown,
+ kTransTypeStripsLeftBuildUp,
+ kTransTypeStripsRightBuildDown,
+ kTransTypeStripsRightBuildUp,
+ kTransTypeStripsTopBuildLeft,
+ kTransTypeStripsTopBuildRight,
+ kTransZoomOpen,
+ kTransZoomClose,
+ kTransVerticalBinds,
+ kTransDisolveBitsTrans,
+ kTransDisolvePixels,
+ kTransDisolveBits
+};
+
struct Cast {
castType type;
Common::Rect initialRect;
@@ -186,7 +241,7 @@ public:
uint8 _actionId;
uint8 _transFlags;
uint8 _transChunkSize;
- uint8 _transType;
+ transitionType _transType;
uint8 _tempo;
uint16 _sound1;
Commit: fd3c3368600337d837b5a9d3e886a4674e475174
https://github.com/scummvm/scummvm/commit/fd3c3368600337d837b5a9d3e886a4674e475174
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Refactor in accordance with Director Loop, generate main lingo events
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 9108225..50c4fbd 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -73,8 +73,8 @@ Common::Error DirectorEngine::run() {
_mainArchive = new RIFFArchive();
_mainArchive->openFile("bookshelf_example.mmm");
- Score score(*_mainArchive);
- score.play();
+ Score score(*_mainArchive, *_lingo);
+ score.startLoop();
if (getPlatform() == Common::kPlatformWindows)
loadEXE();
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index bf06f45..fe192cc 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -38,6 +38,7 @@ struct EventHandlerType {
{ kEventEnterFrame, "enterFrame" },
{ kEventPrepareFrame, "prepareFrame" },
+ { kEventStepFrame, "stepFrame"},
{ kEventExitFrame, "exitFrame" },
{ kEventActivateWindow, "activateWindow" },
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 7aa11fb..65ead5f 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -40,6 +40,7 @@ enum LEvent {
kEventNone,
kEventEnterFrame,
kEventPrepareFrame,
+ kEventStepFrame,
kEventExitFrame,
kEventActivateWindow,
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index bc79ee9..b95a50e 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -29,6 +29,7 @@
#include "common/system.h"
#include "director/dib.h"
#include "director/resource.h"
+#include "lingo/lingo.h"
#include "graphics/palette.h"
#include "common/events.h"
@@ -37,10 +38,14 @@
namespace Director {
-Score::Score(Archive &movie) {
+Score::Score(Archive &movie, Lingo &lingo) {
_surface = new Graphics::ManagedSurface;
_movieArchive = &movie;
+ _lingo = &lingo;
+
+ _lingo->processEvent(kEventPrepareMovie, 0);
+
assert(_movieArchive->hasResource(MKTAG('V','W','S','C'), 1024));
assert(_movieArchive->hasResource(MKTAG('V','W','C','F'), 1024));
assert(_movieArchive->hasResource(MKTAG('V','W','C','R'), 1024));
@@ -124,7 +129,7 @@ void Score::loadConfig(Common::SeekableReadStream &stream) {
_castArrayEnd = stream.readUint16BE();
_currentFrameRate = stream.readByte();
stream.skip(9);
- /*uint16 stageColor = */ stream.readUint16BE();
+ _stageColor = stream.readUint16BE();
}
void Score::readVersion(uint32 rid) {
@@ -400,27 +405,48 @@ Common::Rect Score::readRect(Common::SeekableReadStream &stream) {
return *rect;
}
-void Score::play() {
+void Score::startLoop() {
initGraphics(_movieRect.width(), _movieRect.height(), true);
_surface->create(_movieRect.width(), _movieRect.height());
_currentFrame = 0;
_stopPlay = false;
_nextFrameTime = 0;
+
+ _lingo->processEvent(kEventStartMovie, 0);
+
while (!_stopPlay && _currentFrame < _frames.size() - 2) {
- display();
+ update();
processEvents();
g_system->updateScreen();
g_system->delayMillis(10);
}
}
-void Score::display() {
+void Score::update() {
if (g_system->getMillis() < _nextFrameTime)
return;
- _frames[_currentFrame]->display(*_movieArchive, *_surface, _movieRect);
+ _surface->clear(_stageColor);
+
+ //Exit from previous frame, and step to next
+ _lingo->processEvent(kEventExitFrame, _currentFrame - 1);
+ _lingo->processEvent(kEventStepFrame, _currentFrame);
+
+ //Director step: send beginSprite event to any sprites whose span begin in the upcoming frame
+ for (uint16 i = 0; i < CHANNEL_COUNT; i++) {
+ if (_frames[_currentFrame]->_sprites[i]->_enabled)
+ _lingo->processEvent(kEventBeginSprite, i);
+ }
+
+ //Director step: send prepareFrame event to all sprites and the script channel in upcoming frame
+ _lingo->processEvent(kEventPrepareFrame, _currentFrame);
+ _frames[_currentFrame]->prepareFrame(*_movieArchive, *_surface, _movieRect);
+ //Stage is drawn between the prepareFrame and enterFrame events (Lingo in a Nutshell)
+ _lingo->processEvent(kEventEnterFrame, _currentFrame);
+
_currentFrame++;
byte tempo = _frames[_currentFrame]->_tempo;
+
if (tempo) {
if (tempo > 161) {
//Delay
@@ -605,6 +631,8 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
case kSpritePositionFlags:
sprite._flags = stream.readUint16BE();
sprite._ink = static_cast<inkType>(sprite._flags & 0x3f); //TODO more flags?
+ sprite._trails = sprite._flags & 0x40;
+ debug("%d", sprite._trails);
fieldPosition += 2;
break;
case kSpritePositionCastId:
@@ -636,15 +664,31 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
}
}
-void Frame::display(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect moviRect) {
- surface.clear();
+void Frame::prepareFrame(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect) {
+ renderSprites(_movie, surface, movieRect);
+ renderTrailSprites(_movie, surface, movieRect);
+ if (_transType != 0)
+ playTranisition();
+ if (_sound1 != 0)
+ playSoundChannel(_sound1);
+ if (_sound2 != 0)
+ playSoundChannel(_sound2);
+}
+
+void Frame::playSoundChannel(uint16 id) {
+ warning("STUB: playSound(%d)", id);
+}
+
+void Frame::playTranisition() {
+ warning("STUB: playTranisition(%d, %d, %d)", _transType, _transFlags, _transChunkSize);
+}
+void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect) {
for (uint16 i = 0; i < CHANNEL_COUNT; i++) {
+ //TODO if trails == 0 -> render as trail sprite
if (_sprites[i]->_enabled) {
DIBDecoder img;
- //TODO check cast type
uint32 imgId = 1024 + _sprites[i]->_castId;
- //TODO looks like bad file?
if (!_movie.hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
continue;
}
@@ -669,7 +713,6 @@ void Frame::display(Archive &_movie, Graphics::ManagedSurface &surface, Common::
height += y;
y = 0;
}
-
Common::Rect drawRect = Common::Rect(x, y, x + width, y + height);
switch (_sprites[i]->_ink) {
@@ -692,6 +735,13 @@ void Frame::display(Archive &_movie, Graphics::ManagedSurface &surface, Common::
g_system->copyRectToScreen(surface.getPixels(), surface.pitch, 0, 0, surface.getBounds().width(), surface.getBounds().height());
}
+void Frame::renderTrailSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect) {
+ for (uint16 i = 0; i < CHANNEL_COUNT; i++) {
+ if (_sprites[i]->_enabled && _sprites[i]->_trails != 0)
+ warning("STUB: renderTrailSprites(%d)", i);
+ }
+}
+
void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
uint8 skipColor = 15; //FIXME is it always white (last entry in pallette) ?
for (int ii = 0; ii < sprite.h; ii++) {
diff --git a/engines/director/score.h b/engines/director/score.h
index 09e3377..9f0be8a 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -29,6 +29,7 @@
#include "director/resource.h"
#include "graphics/managed_surface.h"
#include "common/str.h"
+#include "lingo/lingo.h"
namespace Director {
@@ -217,6 +218,7 @@ public:
bool _enabled;
byte _castId;
inkType _ink;
+ uint16 _trails;
Cast *_cast;
uint16 _flags;
Common::Point _startPoint;
@@ -230,9 +232,13 @@ public:
~Frame();
Frame(const Frame &frame);
void readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
- void display(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect moviRect);
+ void prepareFrame(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect);
private:
+ void playTranisition();
+ void playSoundChannel(uint16 id);
+ void renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect);
+ void renderTrailSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect);
void readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
void readMainChannels(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
void drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
@@ -256,13 +262,13 @@ public:
class Score {
public:
- Score(Archive &movie);
+ Score(Archive &movie, Lingo &lingo);
static Common::Rect readRect(Common::SeekableReadStream &stream);
- void play();
+ void startLoop();
private:
void processEvents();
- void display();
+ void update();
void readVersion(uint32 rid);
void loadConfig(Common::SeekableReadStream &stream);
void loadCastData(Common::SeekableReadStream &stream);
@@ -296,8 +302,10 @@ private:
bool _stopPlay;
uint16 _castArrayEnd;
Common::Rect _movieRect;
+ uint16 _stageColor;
Archive *_movieArchive;
Graphics::ManagedSurface *_surface;
+ Lingo *_lingo;
};
} //End of namespace Director
Commit: c9ac498cf0255c373abd67df96fa213b3bea0aeb
https://github.com/scummvm/scummvm/commit/c9ac498cf0255c373abd67df96fa213b3bea0aeb
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add initial sound playback support
Changed paths:
A engines/director/sound.cpp
A engines/director/sound.h
engines/director/director.cpp
engines/director/director.h
engines/director/module.mk
engines/director/score.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 50c4fbd..28651fa 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -41,6 +41,7 @@
#include "director/resource.h"
#include "director/score.h"
#include "director/lingo/lingo.h"
+#include "director/sound.h"
namespace Director {
@@ -69,6 +70,8 @@ Common::Error DirectorEngine::run() {
_lingo = new Lingo();
+ _soundManager = new DirectorSound();
+
//FIXME
_mainArchive = new RIFFArchive();
_mainArchive->openFile("bookshelf_example.mmm");
diff --git a/engines/director/director.h b/engines/director/director.h
index 205495a..9750ad9 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -42,6 +42,7 @@ enum DirectorGameID {
class Archive;
struct DirectorGameDescription;
class Lingo;
+class DirectorSound;
class DirectorEngine : public ::Engine {
public:
@@ -77,6 +78,7 @@ private:
Archive *_mainArchive;
Common::MacResManager *_macBinary;
+ DirectorSound *_soundManager;
Lingo *_lingo;
};
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 6f2e216..4c2628c 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS = \
director.o \
resource.o \
score.o \
+ sound.o \
lingo/lingo.o
# This module can be built as a plugin
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index b95a50e..25631d5 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -632,7 +632,6 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
sprite._flags = stream.readUint16BE();
sprite._ink = static_cast<inkType>(sprite._flags & 0x3f); //TODO more flags?
sprite._trails = sprite._flags & 0x40;
- debug("%d", sprite._trails);
fieldPosition += 2;
break;
case kSpritePositionCastId:
diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
new file mode 100644
index 0000000..35071c8
--- /dev/null
+++ b/engines/director/sound.cpp
@@ -0,0 +1,67 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+*/
+
+#include "director/sound.h"
+#include "audio/decoders/wave.h"
+#include "common/file.h"
+#include "audio/decoders/aiff.h"
+#include "common/system.h"
+#include "common/debug.h"
+
+namespace Director {
+
+DirectorSound::DirectorSound() {
+ _soundHandle = new Audio::SoundHandle();
+ _mixer = g_system->getMixer();
+}
+
+void DirectorSound::playWAV(Common::String filename) {
+ Common::File *file = new Common::File();
+
+ if (!file->open(filename)) {
+ warning("Failed to open %s", filename.c_str());
+ delete file;
+ return;
+ }
+
+ Audio::RewindableAudioStream *sound = Audio::makeWAVStream(file, DisposeAfterUse::YES);
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, _soundHandle, sound);
+}
+
+void DirectorSound::playAIFF(Common::String filename) {
+
+ Common::File *file = new Common::File();
+ if (!file->open(filename)) {
+ warning("Failed to open %s", filename.c_str());
+ delete file;
+ return;
+ }
+
+ Audio::RewindableAudioStream *sound = Audio::makeAIFFStream(file, DisposeAfterUse::YES);
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, _soundHandle, sound);
+}
+
+void DirectorSound::stopSound() {
+ _mixer->stopHandle(*_soundHandle);
+}
+
+} //End of namespace Director
diff --git a/engines/director/sound.h b/engines/director/sound.h
new file mode 100644
index 0000000..3d842c8
--- /dev/null
+++ b/engines/director/sound.h
@@ -0,0 +1,48 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* as published by the Free Software Foundation; either version 2
+* of the License, or (at your option) any later version.
+
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*
+*/
+
+#include "audio/audiostream.h"
+#include "audio/mixer.h"
+#include "common/str.h"
+
+
+#ifndef DIRECTOR_SOUND_H
+#define DIRECTOR_SOUND_H
+namespace Director {
+
+class DirectorSound {
+
+private:
+ Audio::SoundHandle *_soundHandle;
+ Audio::Mixer *_mixer;
+
+public:
+ DirectorSound();
+
+ void playWAV(Common::String filename);
+ void playAIFF(Common::String filename);
+ void stopSound();
+};
+
+} // End of namespace Director
+
+#endif
Commit: 8064274d3b80e853feb54eb7552d1a5f35e5d4fe
https://github.com/scummvm/scummvm/commit/8064274d3b80e853feb54eb7552d1a5f35e5d4fe
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Change order events (Director 4.0)
Changed paths:
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index fe192cc..2bbf5f8 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -38,6 +38,7 @@ struct EventHandlerType {
{ kEventEnterFrame, "enterFrame" },
{ kEventPrepareFrame, "prepareFrame" },
+ { kEventIdle, "idle" },
{ kEventStepFrame, "stepFrame"},
{ kEventExitFrame, "exitFrame" },
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 65ead5f..a4f9805 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -40,6 +40,7 @@ enum LEvent {
kEventNone,
kEventEnterFrame,
kEventPrepareFrame,
+ kEventIdle,
kEventStepFrame,
kEventExitFrame,
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 25631d5..55b3740 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -29,7 +29,7 @@
#include "common/system.h"
#include "director/dib.h"
#include "director/resource.h"
-#include "lingo/lingo.h"
+#include "director/lingo/lingo.h"
#include "graphics/palette.h"
#include "common/events.h"
@@ -428,21 +428,23 @@ void Score::update() {
_surface->clear(_stageColor);
- //Exit from previous frame, and step to next
- _lingo->processEvent(kEventExitFrame, _currentFrame - 1);
- _lingo->processEvent(kEventStepFrame, _currentFrame);
-
- //Director step: send beginSprite event to any sprites whose span begin in the upcoming frame
- for (uint16 i = 0; i < CHANNEL_COUNT; i++) {
- if (_frames[_currentFrame]->_sprites[i]->_enabled)
- _lingo->processEvent(kEventBeginSprite, i);
+ if (_currentFrame > 0) {
+ //Enter and exit from previous frame (Director 4)
+ _lingo->processEvent(kEventEnterFrame, _currentFrame - 1);
+ _lingo->processEvent(kEventExitFrame, _currentFrame - 1);
+ //TODO Director 6 - another order
}
- //Director step: send prepareFrame event to all sprites and the script channel in upcoming frame
- _lingo->processEvent(kEventPrepareFrame, _currentFrame);
+ //TODO Director 6 step: send beginSprite event to any sprites whose span begin in the upcoming frame
+ //for (uint16 i = 0; i < CHANNEL_COUNT; i++) {
+ // if (_frames[_currentFrame]->_sprites[i]->_enabled)
+ // _lingo->processEvent(kEventBeginSprite, i);
+ //}
+
+ //TODO Director 6 step: send prepareFrame event to all sprites and the script channel in upcoming frame
+ //_lingo->processEvent(kEventPrepareFrame, _currentFrame);
_frames[_currentFrame]->prepareFrame(*_movieArchive, *_surface, _movieRect);
//Stage is drawn between the prepareFrame and enterFrame events (Lingo in a Nutshell)
- _lingo->processEvent(kEventEnterFrame, _currentFrame);
_currentFrame++;
byte tempo = _frames[_currentFrame]->_tempo;
@@ -451,6 +453,7 @@ void Score::update() {
if (tempo > 161) {
//Delay
_nextFrameTime = g_system->getMillis() + (256 - tempo) * 1000;
+ return;
} else if (tempo <= 60) {
//FPS
_nextFrameTime = g_system->getMillis() + (float)tempo / 60 * 1000;
@@ -469,6 +472,9 @@ void Score::update() {
}
void Score::processEvents() {
+ if (_currentFrame > 0)
+ _lingo->processEvent(kEventIdle, _currentFrame - 1);
+
Common::Event event;
while (g_system->getEventManager()->pollEvent(event)) {
if (event.type == Common::EVENT_QUIT)
diff --git a/engines/director/score.h b/engines/director/score.h
index 9f0be8a..4a5075e 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -29,10 +29,11 @@
#include "director/resource.h"
#include "graphics/managed_surface.h"
#include "common/str.h"
-#include "lingo/lingo.h"
namespace Director {
+class Lingo;
+
#define CHANNEL_COUNT 24
enum castType {
Commit: 2b57a711f6275d0a9b6b09caebbfda7c8cc89d4c
https://github.com/scummvm/scummvm/commit/2b57a711f6275d0a9b6b09caebbfda7c8cc89d4c
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix palette loading
Changed paths:
engines/director/dib.cpp
engines/director/score.cpp
diff --git a/engines/director/dib.cpp b/engines/director/dib.cpp
index 4e2a21d..912f083 100644
--- a/engines/director/dib.cpp
+++ b/engines/director/dib.cpp
@@ -61,8 +61,8 @@ void DIBDecoder::destroy() {
void DIBDecoder::loadPalette(Common::SeekableReadStream &stream) {
uint16 steps = stream.size()/6;
uint16 index = (steps * 3) - 1;
+ _paletteColorCount = steps;
_palette = new byte[index];
-
for (uint8 i = 0; i < steps; i++) {
_palette[index - 2] = stream.readByte();
stream.readByte();
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 55b3740..b3494b6 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -91,7 +91,8 @@ Score::Score(Archive &movie, Lingo &lingo) {
Common::SeekableReadStream *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]);
palette.loadPalette(*pal);
- g_system->getPaletteManager()->setPalette(palette.getPalette(), 0, 255);
+ g_system->getPaletteManager()->setPalette(palette.getPalette(), 0, palette.getPaletteColorCount());
+
}
void Score::loadFrames(Common::SeekableReadStream &stream) {
Commit: c7657b994ac490138c27006a24c0f8561e8d5a13
https://github.com/scummvm/scummvm/commit/c7657b994ac490138c27006a24c0f8561e8d5a13
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Generate mouse events
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index b3494b6..d1c198f 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -414,7 +414,7 @@ void Score::startLoop() {
_nextFrameTime = 0;
_lingo->processEvent(kEventStartMovie, 0);
-
+ _frames[_currentFrame]->prepareFrame(*_movieArchive, *_surface, _movieRect);
while (!_stopPlay && _currentFrame < _frames.size() - 2) {
update();
processEvents();
@@ -426,15 +426,15 @@ void Score::startLoop() {
void Score::update() {
if (g_system->getMillis() < _nextFrameTime)
return;
+ //FIXME 0 - default white? (Still believe that last color in palette everywhere white)
+ if (_stageColor == 0)
+ _surface->clear(15);
- _surface->clear(_stageColor);
+ //Enter and exit from previous frame (Director 4)
+ _lingo->processEvent(kEventEnterFrame, _currentFrame);
+ _lingo->processEvent(kEventExitFrame, _currentFrame);
+ //TODO Director 6 - another order
- if (_currentFrame > 0) {
- //Enter and exit from previous frame (Director 4)
- _lingo->processEvent(kEventEnterFrame, _currentFrame - 1);
- _lingo->processEvent(kEventExitFrame, _currentFrame - 1);
- //TODO Director 6 - another order
- }
//TODO Director 6 step: send beginSprite event to any sprites whose span begin in the upcoming frame
//for (uint16 i = 0; i < CHANNEL_COUNT; i++) {
@@ -444,10 +444,10 @@ void Score::update() {
//TODO Director 6 step: send prepareFrame event to all sprites and the script channel in upcoming frame
//_lingo->processEvent(kEventPrepareFrame, _currentFrame);
+ _currentFrame++;
_frames[_currentFrame]->prepareFrame(*_movieArchive, *_surface, _movieRect);
//Stage is drawn between the prepareFrame and enterFrame events (Lingo in a Nutshell)
- _currentFrame++;
byte tempo = _frames[_currentFrame]->_tempo;
if (tempo) {
@@ -480,6 +480,17 @@ void Score::processEvents() {
while (g_system->getEventManager()->pollEvent(event)) {
if (event.type == Common::EVENT_QUIT)
_stopPlay = true;
+
+ if (event.type == Common::EVENT_LBUTTONDOWN) {
+ Common::Point pos = g_system->getEventManager()->getMousePos();
+ //TODO there is dont send frame id
+ _lingo->processEvent(kEventMouseDown, _frames[_currentFrame]->getSpriteIDFromPos(pos));
+ }
+
+ if (event.type == Common::EVENT_LBUTTONUP) {
+ Common::Point pos = g_system->getEventManager()->getMousePos();
+ _lingo->processEvent(kEventMouseUp, _frames[_currentFrame]->getSpriteIDFromPos(pos));
+ }
}
}
@@ -710,7 +721,6 @@ void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Co
int y = _sprites[i]->_startPoint.y - regY + rectTop;
int height = _sprites[i]->_height;
int width = _sprites[i]->_width;
-
if (x < 0) {
width += x;
x = 0;
@@ -720,6 +730,7 @@ void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Co
y = 0;
}
Common::Rect drawRect = Common::Rect(x, y, x + width, y + height);
+ _drawRects.push_back(drawRect);
switch (_sprites[i]->_ink) {
case kInkTypeCopy:
@@ -792,6 +803,15 @@ void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Su
tmp.free();
}
+uint16 Frame::getSpriteIDFromPos(Common::Point pos) {
+ //Find first from top to bottom
+ for (uint16 i = _drawRects.size() - 1; i > 0; i--) {
+ if (_drawRects[i].contains(pos))
+ return i;
+ }
+ return 0;
+}
+
Sprite::Sprite() {
_enabled = false;
_width = 0;
diff --git a/engines/director/score.h b/engines/director/score.h
index 4a5075e..00c3294 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -234,7 +234,7 @@ public:
Frame(const Frame &frame);
void readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
void prepareFrame(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect);
-
+ uint16 getSpriteIDFromPos(Common::Point pos);
private:
void playTranisition();
void playSoundChannel(uint16 id);
@@ -259,6 +259,7 @@ public:
uint8 _skipFrameFlag;
uint8 _blend;
Common::Array<Sprite *> _sprites;
+ Common::Array<Common::Rect > _drawRects;
};
class Score {
Commit: 51843bc3b367eda4f7c3cdcbee7c007c5574b706
https://github.com/scummvm/scummvm/commit/51843bc3b367eda4f7c3cdcbee7c007c5574b706
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix memory leak
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index d1c198f..2f9f619 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -95,6 +95,14 @@ Score::Score(Archive &movie, Lingo &lingo) {
}
+Score::~Score() {
+ _surface->free();
+ delete _surface;
+
+ _movieArchive->close();
+ delete _movieArchive;
+}
+
void Score::loadFrames(Common::SeekableReadStream &stream) {
uint32 size = stream.readUint32BE();
size -= 4;
@@ -538,6 +546,10 @@ Frame::~Frame() {
for (uint16 i = 0; i < _sprites.size(); i++) {
delete _sprites[i];
}
+
+ for (uint16 i = 0; i < _drawRects.size(); i++) {
+ delete _drawRects[i];
+ }
}
void Frame::readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size) {
diff --git a/engines/director/score.h b/engines/director/score.h
index 00c3294..3cebbbf 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -265,6 +265,7 @@ public:
class Score {
public:
Score(Archive &movie, Lingo &lingo);
+ ~Score();
static Common::Rect readRect(Common::SeekableReadStream &stream);
void startLoop();
Commit: 0c7f2cedd78fab862c0bbb716f0b41c692245750
https://github.com/scummvm/scummvm/commit/0c7f2cedd78fab862c0bbb716f0b41c692245750
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Storage CastInfo, format strings
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 2f9f619..948d83d 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -78,7 +78,7 @@ Score::Score(Archive &movie, Lingo &lingo) {
if (vwci.size() > 0) {
Common::Array<uint16>::iterator iterator;
for (iterator = vwci.begin(); iterator != vwci.end(); ++iterator)
- loadCastInfo(*_movieArchive->getResource(MKTAG('V','W','C','I'), *iterator));
+ loadCastInfo(*_movieArchive->getResource(MKTAG('V','W','C','I'), *iterator), *iterator);
}
DIBDecoder palette;
@@ -87,11 +87,11 @@ Score::Score(Archive &movie, Lingo &lingo) {
if (clutList.size() > 1)
error("More than one palette was found");
if (clutList.size() == 0)
- error("CLUT not found");
+ warning("CLUT not found");
- Common::SeekableReadStream *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]);
- palette.loadPalette(*pal);
- g_system->getPaletteManager()->setPalette(palette.getPalette(), 0, palette.getPaletteColorCount());
+ //Common::SeekableReadStream *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]);
+ //palette.loadPalette(*pal);
+ //g_system->getPaletteManager()->setPalette(palette.getPalette(), 0, palette.getPaletteColorCount());
}
@@ -286,16 +286,32 @@ void Score::dumpScript(uint16 id, scriptType type, Common::String script) {
out.close();
}
-void Score::loadCastInfo(Common::SeekableReadStream &stream) {
+void Score::loadCastInfo(Common::SeekableReadStream &stream, uint16 id) {
uint32 entryType = 0;
Common::Array<Common::String> castStrings = loadStrings(stream, entryType);
- CastInfo ci;
- ci.script = castStrings[0];
- ci.name = castStrings[1];
- ci.directory = castStrings[2];
- ci.fileName = castStrings[3];
- ci.type = castStrings[4];
- //TODO storage in array, and use this info
+ CastInfo *ci = new CastInfo();
+ ci->script = castStrings[0];
+ ci->name = getString(castStrings[1]);
+ ci->directory = getString(castStrings[2]);
+ ci->fileName = getString(castStrings[3]);
+ ci->type = castStrings[4];
+ _castsInfo[id] = ci;
+}
+
+Common::String Score::getString(Common::String str) {
+ if (str.size() == 0) {
+ return str;
+ }
+ uint8 f = static_cast<uint8>(str.firstChar());
+
+ if (f == 0) {
+ return "";
+ }
+ str.deleteChar(0);
+ if (str.lastChar() == '\x00') {
+ str.deleteLastChar();
+ }
+ return str;
}
void Score::loadFileInfo(Common::SeekableReadStream &stream) {
@@ -546,10 +562,6 @@ Frame::~Frame() {
for (uint16 i = 0; i < _sprites.size(); i++) {
delete _sprites[i];
}
-
- for (uint16 i = 0; i < _drawRects.size(); i++) {
- delete _drawRects[i];
- }
}
void Frame::readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size) {
@@ -603,7 +615,7 @@ void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset,
offset++;
break;
case kSound1Position:
- _sound1 = stream.readUint16BE();
+ _sound1 = stream.readUint16LE();
offset+=2;
break;
case kSkipFrameFlagsPosition:
@@ -615,7 +627,7 @@ void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset,
offset++;
break;
case kSound2Position:
- _sound2 = stream.readUint16BE();
+ _sound2 = stream.readUint16LE();
offset += 2;
break;
case kSound2TypePosition:
@@ -698,14 +710,14 @@ void Frame::prepareFrame(Archive &_movie, Graphics::ManagedSurface &surface, Com
renderTrailSprites(_movie, surface, movieRect);
if (_transType != 0)
playTranisition();
- if (_sound1 != 0)
- playSoundChannel(_sound1);
- if (_sound2 != 0)
- playSoundChannel(_sound2);
+ if (_sound1 != 0 || _sound2 != 0) {
+ playSoundChannel();
+ }
}
-void Frame::playSoundChannel(uint16 id) {
- warning("STUB: playSound(%d)", id);
+void Frame::playSoundChannel() {
+ debug(0, "Sound2 %d", _sound2);
+ debug(0, "Sound1 %d", _sound1);
}
void Frame::playTranisition() {
diff --git a/engines/director/score.h b/engines/director/score.h
index 3cebbbf..ac43c1a 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -237,7 +237,7 @@ public:
uint16 getSpriteIDFromPos(Common::Point pos);
private:
void playTranisition();
- void playSoundChannel(uint16 id);
+ void playSoundChannel();
void renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect);
void renderTrailSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect);
void readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
@@ -278,14 +278,16 @@ private:
void loadFrames(Common::SeekableReadStream &stream);
void loadLabels(Common::SeekableReadStream &stream);
void loadActions(Common::SeekableReadStream &stream);
- void loadCastInfo(Common::SeekableReadStream &stream);
+ void loadCastInfo(Common::SeekableReadStream &stream, uint16 id);
void loadFileInfo(Common::SeekableReadStream &stream);
void loadFontMap(Common::SeekableReadStream &stream);
void dumpScript(uint16 id, scriptType type, Common::String script);
+ Common::String getString(Common::String str);
Common::Array<Common::String> loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader = true);
public:
Common::Array<Frame *> _frames;
Common::HashMap<int, Cast *> _casts;
+ Common::HashMap<uint16, CastInfo *> _castsInfo;
Common::HashMap<uint16, Common::String> _labels;
Common::HashMap<uint16, Common::String> _actions;
Common::HashMap<uint16, Common::String> _fontMap;
Commit: 049500d5ba26854034a04b6cd1a0305f79c8da24
https://github.com/scummvm/scummvm/commit/049500d5ba26854034a04b6cd1a0305f79c8da24
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Added stub parser. Now just arithmetic expressions.
Changed paths:
A engines/director/lingo/lingo-gr.cpp
A engines/director/lingo/lingo-gr.h
A engines/director/lingo/lingo-gr.y
A engines/director/lingo/lingo-lex.cpp
A engines/director/lingo/lingo-lex.l
engines/director/director.cpp
engines/director/lingo/lingo.h
engines/director/module.mk
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 28651fa..3a39886 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -70,6 +70,8 @@ Common::Error DirectorEngine::run() {
_lingo = new Lingo();
+ _lingo->parse("test = 2 + 2 * 6, test:");
+
_soundManager = new DirectorSound();
//FIXME
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
new file mode 100644
index 0000000..56aa787
--- /dev/null
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -0,0 +1,1615 @@
+/* A Bison parser, made by GNU Bison 2.3. */
+
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/* C LALR(1) parser skeleton written by Richard Stallman, by
+ simplifying the original so-called "semantic" parser. */
+
+/* All symbols defined below should begin with yy or YY, to avoid
+ infringing on user name space. This should be done even for local
+ variables, as they might otherwise be expanded by user macros.
+ There are some unavoidable exceptions within include files to
+ define necessary library symbols; they are noted "INFRINGES ON
+ USER NAME SPACE" below. */
+
+/* Identify Bison output. */
+#define YYBISON 1
+
+/* Bison version. */
+#define YYBISON_VERSION "2.3"
+
+/* Skeleton name. */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers. */
+#define YYPURE 0
+
+/* Using locations. */
+#define YYLSP_NEEDED 0
+
+
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ UNARY = 258,
+ INT = 259,
+ VAR = 260
+ };
+#endif
+/* Tokens. */
+#define UNARY 258
+#define INT 259
+#define VAR 260
+
+
+
+
+/* Copy the first part of user declarations. */
+#line 23 "engines/director/lingo/lingo-gr.y"
+
+#include "common/hash-str.h"
+
+#include "director/lingo/lingo.h"
+#include "director/lingo/lingo-gr.h"
+
+Common::HashMap<Common::String, int, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> vars;
+
+extern int yylex();
+extern int yyparse();
+void yyerror(char *s) { error("%s", s); }
+
+
+
+/* Enabling traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+
+/* Enabling verbose error messages. */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* Enabling the token table. */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 0
+#endif
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+#line 37 "engines/director/lingo/lingo-gr.y"
+{ int i; Common::String *s; }
+/* Line 193 of yacc.c. */
+#line 122 "engines/director/lingo/lingo-gr.cpp"
+ YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+
+
+/* Copy the second part of user declarations. */
+
+
+/* Line 216 of yacc.c. */
+#line 135 "engines/director/lingo/lingo-gr.cpp"
+
+#ifdef short
+# undef short
+#endif
+
+#ifdef YYTYPE_UINT8
+typedef YYTYPE_UINT8 yytype_uint8;
+#else
+typedef unsigned char yytype_uint8;
+#endif
+
+#ifdef YYTYPE_INT8
+typedef YYTYPE_INT8 yytype_int8;
+#elif (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+typedef signed char yytype_int8;
+#else
+typedef short int yytype_int8;
+#endif
+
+#ifdef YYTYPE_UINT16
+typedef YYTYPE_UINT16 yytype_uint16;
+#else
+typedef unsigned short int yytype_uint16;
+#endif
+
+#ifdef YYTYPE_INT16
+typedef YYTYPE_INT16 yytype_int16;
+#else
+typedef short int yytype_int16;
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+# define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+# define YYSIZE_T size_t
+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# else
+# define YYSIZE_T unsigned int
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+
+#ifndef YY_
+# if defined YYENABLE_NLS && YYENABLE_NLS
+# if ENABLE_NLS
+# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_(msgid) dgettext ("bison-runtime", msgid)
+# endif
+# endif
+# ifndef YY_
+# define YY_(msgid) msgid
+# endif
+#endif
+
+/* Suppress unused-variable warnings by "using" E. */
+#if ! defined lint || defined __GNUC__
+# define YYUSE(e) ((void) (e))
+#else
+# define YYUSE(e) /* empty */
+#endif
+
+/* Identity function, used to suppress warnings about constant conditions. */
+#ifndef lint
+# define YYID(n) (n)
+#else
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static int
+YYID (int i)
+#else
+static int
+YYID (i)
+ int i;
+#endif
+{
+ return i;
+}
+#endif
+
+#if ! defined yyoverflow || YYERROR_VERBOSE
+
+/* The parser invokes alloca or malloc; define the necessary symbols. */
+
+# ifdef YYSTACK_USE_ALLOCA
+# if YYSTACK_USE_ALLOCA
+# ifdef __GNUC__
+# define YYSTACK_ALLOC __builtin_alloca
+# elif defined __BUILTIN_VA_ARG_INCR
+# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
+# elif defined _AIX
+# define YYSTACK_ALLOC __alloca
+# elif defined _MSC_VER
+# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
+# define alloca _alloca
+# else
+# define YYSTACK_ALLOC alloca
+# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef _STDLIB_H
+# define _STDLIB_H 1
+# endif
+# endif
+# endif
+# endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+ /* Pacify GCC's `empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+# ifndef YYSTACK_ALLOC_MAXIMUM
+ /* The OS might guarantee only one guard page at the bottom of the stack,
+ and a page size can be as small as 4096 bytes. So we cannot safely
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
+ to allow for a few compiler-allocated temporary stack slots. */
+# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
+# endif
+# else
+# define YYSTACK_ALLOC YYMALLOC
+# define YYSTACK_FREE YYFREE
+# ifndef YYSTACK_ALLOC_MAXIMUM
+# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
+# endif
+# if (defined __cplusplus && ! defined _STDLIB_H \
+ && ! ((defined YYMALLOC || defined malloc) \
+ && (defined YYFREE || defined free)))
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# ifndef _STDLIB_H
+# define _STDLIB_H 1
+# endif
+# endif
+# ifndef YYMALLOC
+# define YYMALLOC malloc
+# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# ifndef YYFREE
+# define YYFREE free
+# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+# endif
+# endif
+# endif
+#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
+
+
+#if (! defined yyoverflow \
+ && (! defined __cplusplus \
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member. */
+union yyalloc
+{
+ yytype_int16 yyss;
+ YYSTYPE yyvs;
+ };
+
+/* The size of the maximum gap between one aligned stack and the next. */
+# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+ N elements. */
+# define YYSTACK_BYTES(N) \
+ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ + YYSTACK_GAP_MAXIMUM)
+
+/* Copy COUNT objects from FROM to TO. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(To, From, Count) \
+ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# else
+# define YYCOPY(To, From, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (To)[yyi] = (From)[yyi]; \
+ } \
+ while (YYID (0))
+# endif
+# endif
+
+/* Relocate STACK from its old location to the new one. The
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
+ elements in the stack, and YYPTR gives the new location of the
+ stack. Advance YYPTR to a properly aligned location for the next
+ stack. */
+# define YYSTACK_RELOCATE(Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack, Stack, yysize); \
+ Stack = &yyptr->Stack; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (YYID (0))
+
+#endif
+
+/* YYFINAL -- State number of the termination state. */
+#define YYFINAL 13
+/* YYLAST -- Last index in YYTABLE. */
+#define YYLAST 46
+
+/* YYNTOKENS -- Number of terminals. */
+#define YYNTOKENS 16
+/* YYNNTS -- Number of nonterminals. */
+#define YYNNTS 4
+/* YYNRULES -- Number of rules. */
+#define YYNRULES 16
+/* YYNRULES -- Number of states. */
+#define YYNSTATES 29
+
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+#define YYUNDEFTOK 2
+#define YYMAXUTOK 260
+
+#define YYTRANSLATE(YYX) \
+ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
+static const yytype_uint8 yytranslate[] =
+{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 11, 2, 2,
+ 14, 15, 9, 7, 12, 8, 2, 10, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 13, 2,
+ 2, 6, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
+ 5
+};
+
+#if YYDEBUG
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+ YYRHS. */
+static const yytype_uint8 yyprhs[] =
+{
+ 0, 0, 3, 5, 8, 11, 14, 16, 18, 22,
+ 26, 30, 34, 38, 42, 45, 48
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS. */
+static const yytype_int8 yyrhs[] =
+{
+ 17, 0, -1, 18, -1, 17, 18, -1, 19, 12,
+ -1, 19, 13, -1, 4, -1, 5, -1, 5, 6,
+ 19, -1, 19, 7, 19, -1, 19, 8, 19, -1,
+ 19, 9, 19, -1, 19, 10, 19, -1, 19, 11,
+ 19, -1, 7, 19, -1, 8, 19, -1, 14, 19,
+ 15, -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+static const yytype_uint8 yyrline[] =
+{
+ 0, 51, 51, 52, 55, 56, 59, 60, 61, 62,
+ 63, 64, 65, 66, 67, 68, 69
+};
+#endif
+
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+ First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+static const char *const yytname[] =
+{
+ "$end", "error", "$undefined", "UNARY", "INT", "VAR", "'='", "'+'",
+ "'-'", "'*'", "'/'", "'%'", "','", "':'", "'('", "')'", "$accept",
+ "list", "statement", "expr", 0
+};
+#endif
+
+# ifdef YYPRINT
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+ token YYLEX-NUM. */
+static const yytype_uint16 yytoknum[] =
+{
+ 0, 256, 257, 258, 259, 260, 61, 43, 45, 42,
+ 47, 37, 44, 58, 40, 41
+};
+# endif
+
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 16, 17, 17, 18, 18, 19, 19, 19, 19,
+ 19, 19, 19, 19, 19, 19, 19
+};
+
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
+{
+ 0, 2, 1, 2, 2, 2, 1, 1, 3, 3,
+ 3, 3, 3, 3, 2, 2, 3
+};
+
+/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
+ STATE-NUM when YYTABLE doesn't specify something else to do. Zero
+ means the default is an error. */
+static const yytype_uint8 yydefact[] =
+{
+ 0, 6, 7, 0, 0, 0, 0, 2, 0, 0,
+ 14, 15, 0, 1, 3, 0, 0, 0, 0, 0,
+ 4, 5, 8, 16, 9, 10, 11, 12, 13
+};
+
+/* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int8 yydefgoto[] =
+{
+ -1, 6, 7, 8
+};
+
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
+#define YYPACT_NINF -4
+static const yytype_int8 yypact[] =
+{
+ 14, -4, -2, 14, 14, 14, 3, -4, 25, 14,
+ -4, -4, 16, -4, -4, 14, 14, 14, 14, 14,
+ -4, -4, 32, -4, 35, 35, -4, -4, -4
+};
+
+/* YYPGOTO[NTERM-NUM]. */
+static const yytype_int8 yypgoto[] =
+{
+ -4, -4, -1, -3
+};
+
+/* 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 -1
+static const yytype_uint8 yytable[] =
+{
+ 10, 11, 12, 13, 9, 14, 22, 1, 2, 0,
+ 3, 4, 24, 25, 26, 27, 28, 5, 1, 2,
+ 0, 3, 4, 15, 16, 17, 18, 19, 5, 0,
+ 0, 23, 15, 16, 17, 18, 19, 20, 21, 15,
+ 16, 17, 18, 19, 17, 18, 19
+};
+
+static const yytype_int8 yycheck[] =
+{
+ 3, 4, 5, 0, 6, 6, 9, 4, 5, -1,
+ 7, 8, 15, 16, 17, 18, 19, 14, 4, 5,
+ -1, 7, 8, 7, 8, 9, 10, 11, 14, -1,
+ -1, 15, 7, 8, 9, 10, 11, 12, 13, 7,
+ 8, 9, 10, 11, 9, 10, 11
+};
+
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
+static const yytype_uint8 yystos[] =
+{
+ 0, 4, 5, 7, 8, 14, 17, 18, 19, 6,
+ 19, 19, 19, 0, 18, 7, 8, 9, 10, 11,
+ 12, 13, 19, 15, 19, 19, 19, 19, 19
+};
+
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
+#define YYEMPTY (-2)
+#define YYEOF 0
+
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+
+
+/* Like YYERROR except do call yyerror. This remains here temporarily
+ to ease the transition to the new meaning of YYERROR, for GCC.
+ Once GCC version 2 has supplanted version 1, this can go. */
+
+#define YYFAIL goto yyerrlab
+
+#define YYRECOVERING() (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY && yylen == 1) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ yytoken = YYTRANSLATE (yychar); \
+ YYPOPSTACK (1); \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+while (YYID (0))
+
+
+#define YYTERROR 1
+#define YYERRCODE 256
+
+
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+ If N is 0, then set CURRENT to the empty location which ends
+ the previous symbol: RHS[0] (always defined). */
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ do \
+ if (YYID (N)) \
+ { \
+ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
+ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
+ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
+ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
+ } \
+ else \
+ { \
+ (Current).first_line = (Current).last_line = \
+ YYRHSLOC (Rhs, 0).last_line; \
+ (Current).first_column = (Current).last_column = \
+ YYRHSLOC (Rhs, 0).last_column; \
+ } \
+ while (YYID (0))
+#endif
+
+
+/* YY_LOCATION_PRINT -- Print the location on the stream.
+ This macro was not mandated originally: define only if we know
+ we won't break user code: when these are the locations we know. */
+
+#ifndef YY_LOCATION_PRINT
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
+# define YY_LOCATION_PRINT(File, Loc) \
+ fprintf (File, "%d.%d-%d.%d", \
+ (Loc).first_line, (Loc).first_column, \
+ (Loc).last_line, (Loc).last_column)
+# else
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# endif
+#endif
+
+
+/* YYLEX -- calling `yylex' with the right arguments. */
+
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (YYLEX_PARAM)
+#else
+# define YYLEX yylex ()
+#endif
+
+/* Enable debugging if requested. */
+#if YYDEBUG
+
+# ifndef YYFPRINTF
+# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
+# define YYFPRINTF fprintf
+# endif
+
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (YYID (0))
+
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (YYID (0))
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_value_print (yyoutput, yytype, yyvaluep)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+#endif
+{
+ if (!yyvaluep)
+ return;
+# ifdef YYPRINT
+ if (yytype < YYNTOKENS)
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# else
+ YYUSE (yyoutput);
+# endif
+ switch (yytype)
+ {
+ default:
+ break;
+ }
+}
+
+
+/*--------------------------------.
+| Print this symbol on YYOUTPUT. |
+`--------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_print (yyoutput, yytype, yyvaluep)
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+#endif
+{
+ if (yytype < YYNTOKENS)
+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+ else
+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep);
+ YYFPRINTF (yyoutput, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included). |
+`------------------------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+#else
+static void
+yy_stack_print (bottom, top)
+ yytype_int16 *bottom;
+ yytype_int16 *top;
+#endif
+{
+ YYFPRINTF (stderr, "Stack now");
+ for (; bottom <= top; ++bottom)
+ YYFPRINTF (stderr, " %d", *bottom);
+ YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (YYID (0))
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced. |
+`------------------------------------------------*/
+
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
+#else
+static void
+yy_reduce_print (yyvsp, yyrule)
+ YYSTYPE *yyvsp;
+ int yyrule;
+#endif
+{
+ int yynrhs = yyr2[yyrule];
+ int yyi;
+ unsigned long int yylno = yyrline[yyrule];
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+ yyrule - 1, yylno);
+ /* The symbols being reduced. */
+ for (yyi = 0; yyi < yynrhs; yyi++)
+ {
+ fprintf (stderr, " $%d = ", yyi + 1);
+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ );
+ fprintf (stderr, "\n");
+ }
+}
+
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyvsp, Rule); \
+} while (YYID (0))
+
+/* Nonzero means print parse trace. It is left uninitialized so that
+ multiple parsers can coexist. */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YY_STACK_PRINT(Bottom, Top)
+# define YY_REDUCE_PRINT(Rule)
+#endif /* !YYDEBUG */
+
+
+/* YYINITDEPTH -- initial size of the parser's stacks. */
+#ifndef YYINITDEPTH
+# define YYINITDEPTH 200
+#endif
+
+/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
+ if the built-in stack extension method is used).
+
+ Do not make this value too large; the results are undefined if
+ YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+ evaluated with infinite-precision integer arithmetic. */
+
+#ifndef YYMAXDEPTH
+# define YYMAXDEPTH 10000
+#endif
+
+
+
+#if YYERROR_VERBOSE
+
+# ifndef yystrlen
+# if defined __GLIBC__ && defined _STRING_H
+# define yystrlen strlen
+# else
+/* Return the length of YYSTR. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static YYSIZE_T
+yystrlen (const char *yystr)
+#else
+static YYSIZE_T
+yystrlen (yystr)
+ const char *yystr;
+#endif
+{
+ YYSIZE_T yylen;
+ for (yylen = 0; yystr[yylen]; yylen++)
+ continue;
+ return yylen;
+}
+# endif
+# endif
+
+# ifndef yystpcpy
+# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+# define yystpcpy stpcpy
+# else
+/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
+ YYDEST. */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static char *
+yystpcpy (char *yydest, const char *yysrc)
+#else
+static char *
+yystpcpy (yydest, yysrc)
+ char *yydest;
+ const char *yysrc;
+#endif
+{
+ char *yyd = yydest;
+ const char *yys = yysrc;
+
+ while ((*yyd++ = *yys++) != '\0')
+ continue;
+
+ return yyd - 1;
+}
+# endif
+# endif
+
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+ quotes and backslashes, so that it's suitable for yyerror. The
+ heuristic is that double-quoting is unnecessary unless the string
+ contains an apostrophe, a comma, or backslash (other than
+ backslash-backslash). YYSTR is taken from yytname. If YYRES is
+ null, do not copy; instead, return the length of what the result
+ would have been. */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+ if (*yystr == '"')
+ {
+ YYSIZE_T yyn = 0;
+ char const *yyp = yystr;
+
+ for (;;)
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
+ do_not_strip_quotes: ;
+ }
+
+ if (! yyres)
+ return yystrlen (yystr);
+
+ return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+/* Copy into YYRESULT an error message about the unexpected token
+ YYCHAR while in state YYSTATE. Return the number of bytes copied,
+ including the terminating null byte. If YYRESULT is null, do not
+ copy anything; just return the number of bytes that would be
+ copied. As a special case, return 0 if an ordinary "syntax error"
+ message will do. Return YYSIZE_MAXIMUM if overflow occurs during
+ size calculation. */
+static YYSIZE_T
+yysyntax_error (char *yyresult, int yystate, int yychar)
+{
+ int yyn = yypact[yystate];
+
+ if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
+ return 0;
+ else
+ {
+ int yytype = YYTRANSLATE (yychar);
+ YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
+ YYSIZE_T yysize = yysize0;
+ YYSIZE_T yysize1;
+ int yysize_overflow = 0;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ int yyx;
+
+# if 0
+ /* This is so xgettext sees the translatable formats that are
+ constructed on the fly. */
+ YY_("syntax error, unexpected %s");
+ YY_("syntax error, unexpected %s, expecting %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s");
+ YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
+# endif
+ char *yyfmt;
+ char const *yyf;
+ static char const yyunexpected[] = "syntax error, unexpected %s";
+ static char const yyexpecting[] = ", expecting %s";
+ static char const yyor[] = " or %s";
+ char yyformat[sizeof yyunexpected
+ + sizeof yyexpecting - 1
+ + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
+ * (sizeof yyor - 1))];
+ char const *yyprefix = yyexpecting;
+
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yycount = 1;
+
+ yyarg[0] = yytname[yytype];
+ yyfmt = yystpcpy (yyformat, yyunexpected);
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ yyformat[sizeof yyunexpected - 1] = '\0';
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+ yysize_overflow |= (yysize1 < yysize);
+ yysize = yysize1;
+ yyfmt = yystpcpy (yyfmt, yyprefix);
+ yyprefix = yyor;
+ }
+
+ yyf = YY_(yyformat);
+ yysize1 = yysize + yystrlen (yyf);
+ yysize_overflow |= (yysize1 < yysize);
+ yysize = yysize1;
+
+ if (yysize_overflow)
+ return YYSIZE_MAXIMUM;
+
+ if (yyresult)
+ {
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ char *yyp = yyresult;
+ int yyi = 0;
+ while ((*yyp = *yyf) != '\0')
+ {
+ if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyf += 2;
+ }
+ else
+ {
+ yyp++;
+ yyf++;
+ }
+ }
+ }
+ return yysize;
+ }
+}
+#endif /* YYERROR_VERBOSE */
+
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol. |
+`-----------------------------------------------*/
+
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static void
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+#else
+static void
+yydestruct (yymsg, yytype, yyvaluep)
+ const char *yymsg;
+ int yytype;
+ YYSTYPE *yyvaluep;
+#endif
+{
+ YYUSE (yyvaluep);
+
+ if (!yymsg)
+ yymsg = "Deleting";
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+
+ switch (yytype)
+ {
+
+ default:
+ break;
+ }
+}
+
+
+/* Prevent warnings from -Wmissing-prototypes. */
+
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void *YYPARSE_PARAM);
+#else
+int yyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
+
+
+
+/* The look-ahead symbol. */
+int yychar;
+
+/* The semantic value of the look-ahead symbol. */
+YYSTYPE yylval;
+
+/* Number of syntax errors so far. */
+int yynerrs;
+
+
+
+/*----------.
+| yyparse. |
+`----------*/
+
+#ifdef YYPARSE_PARAM
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void *YYPARSE_PARAM)
+#else
+int
+yyparse (YYPARSE_PARAM)
+ void *YYPARSE_PARAM;
+#endif
+#else /* ! YYPARSE_PARAM */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void)
+#else
+int
+yyparse ()
+
+#endif
+#endif
+{
+
+ int yystate;
+ int yyn;
+ int yyresult;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+ /* Look-ahead token as an internal (translated) token number. */
+ int yytoken = 0;
+#if YYERROR_VERBOSE
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+ /* Three stacks and their tools:
+ `yyss': related to states,
+ `yyvs': related to semantic values,
+ `yyls': related to locations.
+
+ Refer to the stacks thru separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss = yyssa;
+ yytype_int16 *yyssp;
+
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs = yyvsa;
+ YYSTYPE *yyvsp;
+
+
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
+
+ YYSIZE_T yystacksize = YYINITDEPTH;
+
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ YYSTYPE yyval;
+
+
+ /* The number of symbols on the RHS of the reduced rule.
+ Keep to zero when no symbol should be popped. */
+ int yylen = 0;
+
+ YYDPRINTF ((stderr, "Starting parse\n"));
+
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+
+ /* Initialize stack pointers.
+ Waste one element of value and location stack
+ so that they stay on the same level as the state stack.
+ The wasted elements are never initialized. */
+
+ yyssp = yyss;
+ yyvsp = yyvs;
+
+ goto yysetstate;
+
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate. |
+`------------------------------------------------------------*/
+ yynewstate:
+ /* In all cases, when you get here, the value and location stacks
+ have just been pushed. So pushing a state here evens the stacks. */
+ yyssp++;
+
+ yysetstate:
+ *yyssp = yystate;
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ {
+ /* Get the current used size of the three stacks, in elements. */
+ YYSIZE_T yysize = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+ {
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
+#else /* no yyoverflow */
+# ifndef YYSTACK_RELOCATE
+ goto yyexhaustedlab;
+# else
+ /* Extend the stack our own way. */
+ if (YYMAXDEPTH <= yystacksize)
+ goto yyexhaustedlab;
+ yystacksize *= 2;
+ if (YYMAXDEPTH < yystacksize)
+ yystacksize = YYMAXDEPTH;
+
+ {
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss);
+ YYSTACK_RELOCATE (yyvs);
+
+# undef YYSTACK_RELOCATE
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
+ }
+# endif
+#endif /* no yyoverflow */
+
+ yyssp = yyss + yysize - 1;
+ yyvsp = yyvs + yysize - 1;
+
+
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+ (unsigned long int) yystacksize));
+
+ if (yyss + yystacksize - 1 <= yyssp)
+ YYABORT;
+ }
+
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+ goto yybackup;
+
+/*-----------.
+| yybackup. |
+`-----------*/
+yybackup:
+
+ /* Do appropriate processing given the current state. Read a
+ look-ahead token if we need one and don't already have one. */
+
+ /* First try to decide what to do without reference to look-ahead token. */
+ yyn = yypact[yystate];
+ if (yyn == YYPACT_NINF)
+ goto yydefault;
+
+ /* Not known => get a look-ahead token if don't already have one. */
+
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
+ if (yychar == YYEMPTY)
+ {
+ YYDPRINTF ((stderr, "Reading a token: "));
+ yychar = YYLEX;
+ }
+
+ if (yychar <= YYEOF)
+ {
+ yychar = yytoken = YYEOF;
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
+ }
+ else
+ {
+ yytoken = YYTRANSLATE (yychar);
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+ }
+
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
+ detect an error, take that action. */
+ yyn += yytoken;
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ goto yydefault;
+ yyn = yytable[yyn];
+ if (yyn <= 0)
+ {
+ if (yyn == 0 || yyn == YYTABLE_NINF)
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (yyerrstatus)
+ yyerrstatus--;
+
+ /* Shift the look-ahead token. */
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+ /* Discard the shifted token unless it is eof. */
+ if (yychar != YYEOF)
+ yychar = YYEMPTY;
+
+ yystate = yyn;
+ *++yyvsp = yylval;
+
+ goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state. |
+`-----------------------------------------------------------*/
+yydefault:
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+ goto yyreduce;
+
+
+/*-----------------------------.
+| yyreduce -- Do a reduction. |
+`-----------------------------*/
+yyreduce:
+ /* yyn is the number of a rule to reduce with. */
+ yylen = yyr2[yyn];
+
+ /* If YYLEN is nonzero, implement the default value of the action:
+ `$$ = $1'.
+
+ Otherwise, the following line sets YYVAL to garbage.
+ This behavior is undocumented and Bison
+ users should not rely upon it. Assigning to YYVAL
+ unconditionally makes the parser a bit smaller, and it avoids a
+ GCC warning that YYVAL may be used uninitialized. */
+ yyval = yyvsp[1-yylen];
+
+
+ YY_REDUCE_PRINT (yyn);
+ switch (yyn)
+ {
+ case 5:
+#line 56 "engines/director/lingo/lingo-gr.y"
+ { warning("%d", (yyvsp[(1) - (2)].i)); ;}
+ break;
+
+ case 6:
+#line 59 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(1) - (1)].i); ;}
+ break;
+
+ case 7:
+#line 60 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = vars[*(yyvsp[(1) - (1)].s)]; delete (yyvsp[(1) - (1)].s); ;}
+ break;
+
+ case 8:
+#line 61 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = vars[*(yyvsp[(1) - (3)].s)] = (yyvsp[(3) - (3)].i); delete (yyvsp[(1) - (3)].s); ;}
+ break;
+
+ case 9:
+#line 62 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(1) - (3)].i) + (yyvsp[(3) - (3)].i); ;}
+ break;
+
+ case 10:
+#line 63 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(1) - (3)].i) - (yyvsp[(3) - (3)].i); ;}
+ break;
+
+ case 11:
+#line 64 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(1) - (3)].i) * (yyvsp[(3) - (3)].i); ;}
+ break;
+
+ case 12:
+#line 65 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(1) - (3)].i) / (yyvsp[(3) - (3)].i); ;}
+ break;
+
+ case 13:
+#line 66 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(1) - (3)].i) % (yyvsp[(3) - (3)].i); ;}
+ break;
+
+ case 14:
+#line 67 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(2) - (2)].i); ;}
+ break;
+
+ case 15:
+#line 68 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = -(yyvsp[(2) - (2)].i); ;}
+ break;
+
+ case 16:
+#line 69 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(2) - (3)].i); ;}
+ break;
+
+
+/* Line 1267 of yacc.c. */
+#line 1400 "engines/director/lingo/lingo-gr.cpp"
+ default: break;
+ }
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+
+ *++yyvsp = yyval;
+
+
+ /* Now `shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+ number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTOKENS];
+
+ goto yynewstate;
+
+
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
+yyerrlab:
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus)
+ {
+ ++yynerrs;
+#if ! YYERROR_VERBOSE
+ yyerror (YY_("syntax error"));
+#else
+ {
+ YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
+ if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
+ {
+ YYSIZE_T yyalloc = 2 * yysize;
+ if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
+ yyalloc = YYSTACK_ALLOC_MAXIMUM;
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yyalloc);
+ if (yymsg)
+ yymsg_alloc = yyalloc;
+ else
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ }
+ }
+
+ if (0 < yysize && yysize <= yymsg_alloc)
+ {
+ (void) yysyntax_error (yymsg, yystate, yychar);
+ yyerror (yymsg);
+ }
+ else
+ {
+ yyerror (YY_("syntax error"));
+ if (yysize != 0)
+ goto yyexhaustedlab;
+ }
+ }
+#endif
+ }
+
+
+
+ if (yyerrstatus == 3)
+ {
+ /* If just tried and failed to reuse look-ahead token after an
+ error, discard it. */
+
+ if (yychar <= YYEOF)
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
+ else
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval);
+ yychar = YYEMPTY;
+ }
+ }
+
+ /* Else will try to reuse look-ahead token after shifting the error
+ token. */
+ goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR. |
+`---------------------------------------------------*/
+yyerrorlab:
+
+ /* Pacify compilers like GCC when the user code never invokes
+ YYERROR and the label yyerrorlab therefore never appears in user
+ code. */
+ if (/*CONSTCOND*/ 0)
+ goto yyerrorlab;
+
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYERROR. */
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+ yystate = *yyssp;
+ goto yyerrlab1;
+
+
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR. |
+`-------------------------------------------------------------*/
+yyerrlab1:
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
+
+ for (;;)
+ {
+ yyn = yypact[yystate];
+ if (yyn != YYPACT_NINF)
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
+
+ /* Pop the current state because it cannot handle the error token. */
+ if (yyssp == yyss)
+ YYABORT;
+
+
+ yydestruct ("Error: popping",
+ yystos[yystate], yyvsp);
+ YYPOPSTACK (1);
+ yystate = *yyssp;
+ YY_STACK_PRINT (yyss, yyssp);
+ }
+
+ if (yyn == YYFINAL)
+ YYACCEPT;
+
+ *++yyvsp = yylval;
+
+
+ /* Shift the error token. */
+ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+ yystate = yyn;
+ goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here. |
+`-------------------------------------*/
+yyacceptlab:
+ yyresult = 0;
+ goto yyreturn;
+
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here. |
+`-----------------------------------*/
+yyabortlab:
+ yyresult = 1;
+ goto yyreturn;
+
+#ifndef yyoverflow
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here. |
+`-------------------------------------------------*/
+yyexhaustedlab:
+ yyerror (YY_("memory exhausted"));
+ yyresult = 2;
+ /* Fall through. */
+#endif
+
+yyreturn:
+ if (yychar != YYEOF && yychar != YYEMPTY)
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval);
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYABORT or YYACCEPT. */
+ YYPOPSTACK (yylen);
+ YY_STACK_PRINT (yyss, yyssp);
+ while (yyssp != yyss)
+ {
+ yydestruct ("Cleanup: popping",
+ yystos[*yyssp], yyvsp);
+ YYPOPSTACK (1);
+ }
+#ifndef yyoverflow
+ if (yyss != yyssa)
+ YYSTACK_FREE (yyss);
+#endif
+#if YYERROR_VERBOSE
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+#endif
+ /* Make sure YYID is used. */
+ return YYID (yyresult);
+}
+
+
+#line 72 "engines/director/lingo/lingo-gr.y"
+
+
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
new file mode 100644
index 0000000..82c4454
--- /dev/null
+++ b/engines/director/lingo/lingo-gr.h
@@ -0,0 +1,68 @@
+/* A Bison parser, made by GNU Bison 2.3. */
+
+/* Skeleton interface for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+ Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+/* As a special exception, you may create a larger work that contains
+ part or all of the Bison parser skeleton and distribute that work
+ under terms of your choice, so long as that work isn't itself a
+ parser generator using the skeleton or a modified version thereof
+ as a parser skeleton. Alternatively, if you modify or redistribute
+ the parser skeleton itself, you may (at your option) remove this
+ special exception, which will cause the skeleton and the resulting
+ Bison output files to be licensed under the GNU General Public
+ License without this special exception.
+
+ This special exception was added by the Free Software Foundation in
+ version 2.2 of Bison. */
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ UNARY = 258,
+ INT = 259,
+ VAR = 260
+ };
+#endif
+/* Tokens. */
+#define UNARY 258
+#define INT 259
+#define VAR 260
+
+
+
+
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+typedef union YYSTYPE
+#line 37 "engines/director/lingo/lingo-gr.y"
+{ int i; Common::String *s; }
+/* Line 1529 of yacc.c. */
+#line 61 "engines/director/lingo/lingo-gr.hpp"
+ YYSTYPE;
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
+# define YYSTYPE_IS_DECLARED 1
+# define YYSTYPE_IS_TRIVIAL 1
+#endif
+
+extern YYSTYPE yylval;
+
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
new file mode 100644
index 0000000..49149cb
--- /dev/null
+++ b/engines/director/lingo/lingo-gr.y
@@ -0,0 +1,72 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+%{
+#include "common/hash-str.h"
+
+#include "director/lingo/lingo.h"
+#include "director/lingo/lingo-gr.h"
+
+Common::HashMap<Common::String, int, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> vars;
+
+extern int yylex();
+extern int yyparse();
+void yyerror(char *s) { error("%s", s); }
+
+%}
+
+%union { int i; Common::String *s; }
+
+%token UNARY
+%token<i> INT
+%token<s> VAR
+%type<i> expr
+
+%right '='
+%left '+' '-'
+%left '*' '/' '%'
+%right UNARY
+
+%%
+
+list: statement
+ | list statement
+ ;
+
+statement: expr ','
+ | expr ':' { warning("%d", $1); }
+ ;
+
+expr: INT { $$ = $1; }
+ | VAR { $$ = vars[*$1]; delete $1; }
+ | VAR '=' expr { $$ = vars[*$1] = $3; delete $1; }
+ | expr '+' expr { $$ = $1 + $3; }
+ | expr '-' expr { $$ = $1 - $3; }
+ | expr '*' expr { $$ = $1 * $3; }
+ | expr '/' expr { $$ = $1 / $3; }
+ | expr '%' expr { $$ = $1 % $3; }
+ | '+' expr %prec UNARY { $$ = $2; }
+ | '-' expr %prec UNARY { $$ = -$2; }
+ | '(' expr ')' { $$ = $2; }
+ ;
+
+%%
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
new file mode 100644
index 0000000..5379ceb
--- /dev/null
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -0,0 +1,1800 @@
+#line 2 "engines/director/lingo/lingo-lex.cpp"
+
+#line 4 "engines/director/lingo/lingo-lex.cpp"
+
+#define YY_INT_ALIGNED short int
+
+/* A lexical scanner generated by flex */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+#define YY_FLEX_SUBMINOR_VERSION 35
+#if YY_FLEX_SUBMINOR_VERSION > 0
+#define FLEX_BETA
+#endif
+
+/* First, we deal with platform-specific or compiler-specific issues. */
+
+/* begin standard C headers. */
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+
+/* end standard C headers. */
+
+/* flex integer type definitions */
+
+#ifndef FLEXINT_H
+#define FLEXINT_H
+
+/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
+/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
+ * if you want the limit (max/min) macros for int types.
+ */
+#ifndef __STDC_LIMIT_MACROS
+#define __STDC_LIMIT_MACROS 1
+#endif
+
+#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
+typedef uint64_t flex_uint64_t;
+#else
+typedef signed char flex_int8_t;
+typedef short int flex_int16_t;
+typedef int flex_int32_t;
+typedef unsigned char flex_uint8_t;
+typedef unsigned short int flex_uint16_t;
+typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
+
+/* Limits of integral types. */
+#ifndef INT8_MIN
+#define INT8_MIN (-128)
+#endif
+#ifndef INT16_MIN
+#define INT16_MIN (-32767-1)
+#endif
+#ifndef INT32_MIN
+#define INT32_MIN (-2147483647-1)
+#endif
+#ifndef INT8_MAX
+#define INT8_MAX (127)
+#endif
+#ifndef INT16_MAX
+#define INT16_MAX (32767)
+#endif
+#ifndef INT32_MAX
+#define INT32_MAX (2147483647)
+#endif
+#ifndef UINT8_MAX
+#define UINT8_MAX (255U)
+#endif
+#ifndef UINT16_MAX
+#define UINT16_MAX (65535U)
+#endif
+#ifndef UINT32_MAX
+#define UINT32_MAX (4294967295U)
+#endif
+
+#endif /* ! FLEXINT_H */
+
+#ifdef __cplusplus
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
+
+#define YY_USE_CONST
+
+#endif /* defined (__STDC__) */
+#endif /* ! __cplusplus */
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN (yy_start) = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START (((yy_start) - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart(yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#ifndef YY_BUF_SIZE
+#define YY_BUF_SIZE 16384
+#endif
+
+/* The state buf must be large enough to hold one state per character in the main buffer.
+ */
+#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+extern yy_size_t yyleng;
+
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+ #define YY_LESS_LINENO(n)
+
+/* Return all but the first "n" matched characters back to the input stream. */
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ *yy_cp = (yy_hold_char); \
+ YY_RESTORE_YY_MORE_OFFSET \
+ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+
+#define unput(c) yyunput( c, (yytext_ptr) )
+
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
+struct yy_buffer_state
+ {
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ yy_size_t yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ int yy_bs_lineno; /**< The line count. */
+ int yy_bs_column; /**< The column count. */
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+
+ };
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+
+/* Stack of input buffers. */
+static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
+static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
+static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ *
+ * Returns the top of the stack, or NULL.
+ */
+#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
+ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
+ : NULL)
+
+/* Same as previous macro, but useful when we know that the buffer stack is not
+ * NULL or when we need an lvalue. For internal use only.
+ */
+#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
+yy_size_t yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 0; /* whether we need to initialize */
+static int yy_start = 0; /* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin. A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart (FILE *input_file );
+void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
+YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
+void yy_delete_buffer (YY_BUFFER_STATE b );
+void yy_flush_buffer (YY_BUFFER_STATE b );
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
+void yypop_buffer_state (void );
+
+static void yyensure_buffer_stack (void );
+static void yy_load_buffer_state (void );
+static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
+
+#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
+
+YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
+YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
+YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );
+
+void *yyalloc (yy_size_t );
+void *yyrealloc (void *,yy_size_t );
+void yyfree (void * );
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){ \
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer(yyin,YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+ }
+
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! YY_CURRENT_BUFFER ){\
+ yyensure_buffer_stack (); \
+ YY_CURRENT_BUFFER_LVALUE = \
+ yy_create_buffer(yyin,YY_BUF_SIZE ); \
+ } \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+ }
+
+#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
+
+/* Begin user sect3 */
+
+#define yywrap(n) 1
+#define YY_SKIP_YYWRAP
+
+typedef unsigned char YY_CHAR;
+
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+
+typedef int yy_state_type;
+
+extern int yylineno;
+
+int yylineno = 1;
+
+extern char *yytext;
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state (void );
+static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
+static int yy_get_next_buffer (void );
+static void yy_fatal_error (yyconst char msg[] );
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ (yytext_ptr) = yy_bp; \
+ yyleng = (yy_size_t) (yy_cp - yy_bp); \
+ (yy_hold_char) = *yy_cp; \
+ *yy_cp = '\0'; \
+ (yy_c_buf_p) = yy_cp;
+
+#define YY_NUM_RULES 5
+#define YY_END_OF_BUFFER 6
+/* This struct is not used in this scanner,
+ but its presence is necessary. */
+struct yy_trans_info
+ {
+ flex_int32_t yy_verify;
+ flex_int32_t yy_nxt;
+ };
+static yyconst flex_int16_t yy_accept[11] =
+ { 0,
+ 0, 0, 6, 4, 3, 2, 1, 2, 1, 0
+ } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 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, 3, 1, 1, 1,
+ 1, 3, 3, 3, 3, 1, 3, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 3, 1, 1,
+ 3, 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, 5, 5, 5,
+ 1, 1, 1, 3, 5, 1, 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, 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, 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, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static yyconst flex_int32_t yy_meta[6] =
+ { 0,
+ 1, 1, 1, 2, 3
+ } ;
+
+static yyconst flex_int16_t yy_base[13] =
+ { 0,
+ 0, 0, 9, 10, 10, 0, 0, 0, 0, 10,
+ 6, 4
+ } ;
+
+static yyconst flex_int16_t yy_def[13] =
+ { 0,
+ 10, 1, 10, 10, 10, 11, 12, 11, 12, 0,
+ 10, 10
+ } ;
+
+static yyconst flex_int16_t yy_nxt[16] =
+ { 0,
+ 4, 4, 5, 6, 7, 9, 9, 8, 10, 3,
+ 10, 10, 10, 10, 10
+ } ;
+
+static yyconst flex_int16_t yy_chk[16] =
+ { 0,
+ 1, 1, 1, 1, 1, 12, 12, 11, 3, 10,
+ 10, 10, 10, 10, 10
+ } ;
+
+static yy_state_type yy_last_accepting_state;
+static char *yy_last_accepting_cpos;
+
+extern int yy_flex_debug;
+int yy_flex_debug = 0;
+
+/* The intent behind this definition is that it'll catch
+ * any uses of REJECT which flex missed.
+ */
+#define REJECT reject_used_but_not_detected
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "engines/director/lingo/lingo-lex.l"
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+#line 25 "engines/director/lingo/lingo-lex.l"
+
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#include "common/str.h"
+
+#include "director/lingo/lingo.h"
+#include "director/lingo/lingo-gr.h"
+
+void yyparse();
+
+#line 490 "engines/director/lingo/lingo-lex.cpp"
+
+#define INITIAL 0
+
+#ifndef YY_NO_UNISTD_H
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#include <unistd.h>
+#endif
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+static int yy_init_globals (void );
+
+/* Accessor methods to globals.
+ These are made visible to non-reentrant scanners for convenience. */
+
+int yylex_destroy (void );
+
+int yyget_debug (void );
+
+void yyset_debug (int debug_flag );
+
+YY_EXTRA_TYPE yyget_extra (void );
+
+void yyset_extra (YY_EXTRA_TYPE user_defined );
+
+FILE *yyget_in (void );
+
+void yyset_in (FILE * in_str );
+
+FILE *yyget_out (void );
+
+void yyset_out (FILE * out_str );
+
+yy_size_t yyget_leng (void );
+
+char *yyget_text (void );
+
+int yyget_lineno (void );
+
+void yyset_lineno (int line_number );
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap (void );
+#else
+extern int yywrap (void );
+#endif
+#endif
+
+ static void yyunput (int c,char *buf_ptr );
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char *,yyconst char *,int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * );
+#endif
+
+#ifndef YY_NO_INPUT
+
+#ifdef __cplusplus
+static int yyinput (void );
+#else
+static int input (void );
+#endif
+
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+ { \
+ int c = '*'; \
+ yy_size_t n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else \
+ { \
+ errno=0; \
+ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+ { \
+ if( errno != EINTR) \
+ { \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ break; \
+ } \
+ errno=0; \
+ clearerr(yyin); \
+ } \
+ }\
+\
+
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* end tables serialization structures and prototypes */
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL_IS_OURS 1
+
+extern int yylex (void);
+
+#define YY_DECL int yylex (void)
+#endif /* !YY_DECL */
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+ YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+ register yy_state_type yy_current_state;
+ register char *yy_cp, *yy_bp;
+ register int yy_act;
+
+#line 37 "engines/director/lingo/lingo-lex.l"
+
+
+#line 675 "engines/director/lingo/lingo-lex.cpp"
+
+ if ( !(yy_init) )
+ {
+ (yy_init) = 1;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ if ( ! (yy_start) )
+ (yy_start) = 1; /* first start state */
+
+ if ( ! yyin )
+ yyin = stdin;
+
+ if ( ! yyout )
+ yyout = stdout;
+
+ if ( ! YY_CURRENT_BUFFER ) {
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer(yyin,YY_BUF_SIZE );
+ }
+
+ yy_load_buffer_state( );
+ }
+
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+ yy_cp = (yy_c_buf_p);
+
+ /* Support of yytext. */
+ *yy_cp = (yy_hold_char);
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+ yy_current_state = (yy_start);
+yy_match:
+ do
+ {
+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ 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 >= 11 )
+ 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] != 10 );
+
+yy_find_action:
+ yy_act = yy_accept[yy_current_state];
+ if ( yy_act == 0 )
+ { /* have to back up */
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ yy_act = yy_accept[yy_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+do_action: /* This label is used only to access EOF actions. */
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+ case 0: /* must back up */
+ /* undo the effects of YY_DO_BEFORE_ACTION */
+ *yy_cp = (yy_hold_char);
+ yy_cp = (yy_last_accepting_cpos);
+ yy_current_state = (yy_last_accepting_state);
+ goto yy_find_action;
+
+case 1:
+YY_RULE_SETUP
+#line 39 "engines/director/lingo/lingo-lex.l"
+yylval.s = new Common::String(yytext); return VAR;
+ YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 40 "engines/director/lingo/lingo-lex.l"
+yylval.i = strtol(yytext, NULL, 10); return INT;
+ YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 41 "engines/director/lingo/lingo-lex.l"
+return *yytext;
+ YY_BREAK
+case 4:
+/* rule 4 can match eol */
+YY_RULE_SETUP
+#line 42 "engines/director/lingo/lingo-lex.l"
+; /* ignore all the rest */
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 44 "engines/director/lingo/lingo-lex.l"
+ECHO;
+ YY_BREAK
+#line 784 "engines/director/lingo/lingo-lex.cpp"
+case YY_STATE_EOF(INITIAL):
+ yyterminate();
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = (yy_hold_char);
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between YY_CURRENT_BUFFER and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++(yy_c_buf_p);
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = (yy_c_buf_p);
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ (yy_did_buffer_switch_on_eof) = 0;
+
+ if ( yywrap( ) )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) =
+ (yytext_ptr) + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ (yy_c_buf_p) =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+
+ yy_current_state = yy_get_previous_state( );
+
+ yy_cp = (yy_c_buf_p);
+ yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+} /* end of yylex */
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+static int yy_get_next_buffer (void)
+{
+ register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ register char *source = (yytext_ptr);
+ register int number_to_move, i;
+ int ret_val;
+
+ if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+
+ else
+ {
+ yy_size_t num_to_read =
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+
+ int yy_c_buf_p_offset =
+ (int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ yy_size_t new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = 0;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+ number_to_move - 1;
+
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
+ (yy_n_chars), num_to_read );
+
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ if ( (yy_n_chars) == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart(yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ /* Extend the array by 50%, plus the number we really need. */
+ yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+ }
+
+ (yy_n_chars) += number_to_move;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+
+ (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+
+ return ret_val;
+}
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+ static yy_state_type yy_get_previous_state (void)
+{
+ register yy_state_type yy_current_state;
+ register char *yy_cp;
+
+ yy_current_state = (yy_start);
+
+ for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+ {
+ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ 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 >= 11 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ }
+
+ return yy_current_state;
+}
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
+{
+ register int yy_is_jam;
+ register char *yy_cp = (yy_c_buf_p);
+
+ register YY_CHAR yy_c = 1;
+ if ( yy_accept[yy_current_state] )
+ {
+ (yy_last_accepting_state) = yy_current_state;
+ (yy_last_accepting_cpos) = yy_cp;
+ }
+ 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 >= 11 )
+ 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 == 10);
+
+ return yy_is_jam ? 0 : yy_current_state;
+}
+
+ static void yyunput (int c, register char * yy_bp )
+{
+ register char *yy_cp;
+
+ yy_cp = (yy_c_buf_p);
+
+ /* undo effects of setting up yytext */
+ *yy_cp = (yy_hold_char);
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ register yy_size_t number_to_move = (yy_n_chars) + 2;
+ register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+ register char *source =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+
+ while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ *--dest = *--source;
+
+ yy_cp += (int) (dest - source);
+ yy_bp += (int) (dest - source);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+ (yytext_ptr) = yy_bp;
+ (yy_hold_char) = *yy_cp;
+ (yy_c_buf_p) = yy_cp;
+}
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+ static int yyinput (void)
+#else
+ static int input (void)
+#endif
+
+{
+ int c;
+
+ *(yy_c_buf_p) = (yy_hold_char);
+
+ if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ /* This was really a NUL. */
+ *(yy_c_buf_p) = '\0';
+
+ else
+ { /* need more input */
+ yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
+ ++(yy_c_buf_p);
+
+ switch ( yy_get_next_buffer( ) )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart(yyin );
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap( ) )
+ return 0;
+
+ if ( ! (yy_did_buffer_switch_on_eof) )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput();
+#else
+ return input();
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ (yy_c_buf_p) = (yytext_ptr) + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
+ *(yy_c_buf_p) = '\0'; /* preserve yytext */
+ (yy_hold_char) = *++(yy_c_buf_p);
+
+ return c;
+}
+#endif /* ifndef YY_NO_INPUT */
+
+/** Immediately switch to a different input stream.
+ * @param input_file A readable stream.
+ *
+ * @note This function does not reset the start condition to @c INITIAL .
+ */
+ void yyrestart (FILE * input_file )
+{
+
+ if ( ! YY_CURRENT_BUFFER ){
+ yyensure_buffer_stack ();
+ YY_CURRENT_BUFFER_LVALUE =
+ yy_create_buffer(yyin,YY_BUF_SIZE );
+ }
+
+ yy_init_buffer(YY_CURRENT_BUFFER,input_file );
+ yy_load_buffer_state( );
+}
+
+/** Switch to a different input buffer.
+ * @param new_buffer The new input buffer.
+ *
+ */
+ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
+{
+
+ /* TODO. We should be able to replace this entire function body
+ * with
+ * yypop_buffer_state();
+ * yypush_buffer_state(new_buffer);
+ */
+ yyensure_buffer_stack ();
+ if ( YY_CURRENT_BUFFER == new_buffer )
+ return;
+
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+ yy_load_buffer_state( );
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+
+static void yy_load_buffer_state (void)
+{
+ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
+ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
+ (yy_hold_char) = *(yy_c_buf_p);
+}
+
+/** Allocate and initialize an input buffer state.
+ * @param file A readable stream.
+ * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
+ *
+ * @return the allocated buffer state.
+ */
+ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
+{
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer(b,file );
+
+ return b;
+}
+
+/** Destroy the buffer.
+ * @param b a buffer created with yy_create_buffer()
+ *
+ */
+ void yy_delete_buffer (YY_BUFFER_STATE b )
+{
+
+ if ( ! b )
+ return;
+
+ if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
+ YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yyfree((void *) b->yy_ch_buf );
+
+ yyfree((void *) b );
+}
+
+#ifndef __cplusplus
+extern int isatty (int );
+#endif /* __cplusplus */
+
+/* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+ * such as during a yyrestart() or at EOF.
+ */
+ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
+
+{
+ int oerrno = errno;
+
+ yy_flush_buffer(b );
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+ /* If b is the current buffer, then yy_init_buffer was _probably_
+ * called from yyrestart() or through yy_get_next_buffer.
+ * In that case, we don't want to reset the lineno or column.
+ */
+ if (b != YY_CURRENT_BUFFER){
+ b->yy_bs_lineno = 1;
+ b->yy_bs_column = 0;
+ }
+
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+
+ errno = oerrno;
+}
+
+/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
+ * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
+ *
+ */
+ void yy_flush_buffer (YY_BUFFER_STATE b )
+{
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == YY_CURRENT_BUFFER )
+ yy_load_buffer_state( );
+}
+
+/** Pushes the new state onto the stack. The new state becomes
+ * the current state. This function will allocate the stack
+ * if necessary.
+ * @param new_buffer The new state.
+ *
+ */
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
+{
+ if (new_buffer == NULL)
+ return;
+
+ yyensure_buffer_stack();
+
+ /* This block is copied from yy_switch_to_buffer. */
+ if ( YY_CURRENT_BUFFER )
+ {
+ /* Flush out information for old buffer. */
+ *(yy_c_buf_p) = (yy_hold_char);
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ }
+
+ /* Only push if top exists. Otherwise, replace top. */
+ if (YY_CURRENT_BUFFER)
+ (yy_buffer_stack_top)++;
+ YY_CURRENT_BUFFER_LVALUE = new_buffer;
+
+ /* copied from yy_switch_to_buffer. */
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+}
+
+/** Removes and deletes the top of the stack, if present.
+ * The next element becomes the new top.
+ *
+ */
+void yypop_buffer_state (void)
+{
+ if (!YY_CURRENT_BUFFER)
+ return;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ if ((yy_buffer_stack_top) > 0)
+ --(yy_buffer_stack_top);
+
+ if (YY_CURRENT_BUFFER) {
+ yy_load_buffer_state( );
+ (yy_did_buffer_switch_on_eof) = 1;
+ }
+}
+
+/* Allocates the stack if it does not exist.
+ * Guarantees space for at least one push.
+ */
+static void yyensure_buffer_stack (void)
+{
+ yy_size_t num_to_alloc;
+
+ if (!(yy_buffer_stack)) {
+
+ /* First allocation is just for 2 elements, since we don't know if this
+ * scanner will even need a stack. We use 2 instead of 1 to avoid an
+ * immediate realloc on the next call.
+ */
+ num_to_alloc = 1;
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+ memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
+
+ (yy_buffer_stack_max) = num_to_alloc;
+ (yy_buffer_stack_top) = 0;
+ return;
+ }
+
+ if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
+
+ /* Increase the buffer to prepare for a possible push. */
+ int grow_size = 8 /* arbitrary grow size */;
+
+ num_to_alloc = (yy_buffer_stack_max) + grow_size;
+ (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
+ ((yy_buffer_stack),
+ num_to_alloc * sizeof(struct yy_buffer_state*)
+ );
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
+ /* zero only the new slots.*/
+ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
+ (yy_buffer_stack_max) = num_to_alloc;
+ }
+}
+
+/** Setup the input buffer state to scan directly from a user-specified character buffer.
+ * @param base the character buffer
+ * @param size the size in bytes of the character buffer
+ *
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
+{
+ YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = 0;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ yy_switch_to_buffer(b );
+
+ return b;
+}
+
+/** Setup the input buffer state to scan a string. The next call to yylex() will
+ * scan from a @e copy of @a str.
+ * @param yystr a NUL-terminated string to scan
+ *
+ * @return the newly allocated buffer state object.
+ * @note If you want to scan bytes that may contain NUL values, then use
+ * yy_scan_bytes() instead.
+ */
+YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
+{
+
+ return yy_scan_bytes(yystr,strlen(yystr) );
+}
+
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
+ * scan from a @e copy of @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
+ *
+ * @return the newly allocated buffer state object.
+ */
+YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
+{
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n, i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = _yybytes_len + 2;
+ buf = (char *) yyalloc(n );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+ for ( i = 0; i < _yybytes_len; ++i )
+ buf[i] = yybytes[i];
+
+ buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer(buf,n );
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+}
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+static void yy_fatal_error (yyconst char* msg )
+{
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+}
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ int yyless_macro_arg = (n); \
+ YY_LESS_LINENO(yyless_macro_arg);\
+ yytext[yyleng] = (yy_hold_char); \
+ (yy_c_buf_p) = yytext + yyless_macro_arg; \
+ (yy_hold_char) = *(yy_c_buf_p); \
+ *(yy_c_buf_p) = '\0'; \
+ yyleng = yyless_macro_arg; \
+ } \
+ while ( 0 )
+
+/* Accessor methods (get/set functions) to struct members. */
+
+/** Get the current line number.
+ *
+ */
+int yyget_lineno (void)
+{
+
+ return yylineno;
+}
+
+/** Get the input stream.
+ *
+ */
+FILE *yyget_in (void)
+{
+ return yyin;
+}
+
+/** Get the output stream.
+ *
+ */
+FILE *yyget_out (void)
+{
+ return yyout;
+}
+
+/** Get the length of the current token.
+ *
+ */
+yy_size_t yyget_leng (void)
+{
+ return yyleng;
+}
+
+/** Get the current token.
+ *
+ */
+
+char *yyget_text (void)
+{
+ return yytext;
+}
+
+/** Set the current line number.
+ * @param line_number
+ *
+ */
+void yyset_lineno (int line_number )
+{
+
+ yylineno = line_number;
+}
+
+/** Set the input stream. This does not discard the current
+ * input buffer.
+ * @param in_str A readable stream.
+ *
+ * @see yy_switch_to_buffer
+ */
+void yyset_in (FILE * in_str )
+{
+ yyin = in_str ;
+}
+
+void yyset_out (FILE * out_str )
+{
+ yyout = out_str ;
+}
+
+int yyget_debug (void)
+{
+ return yy_flex_debug;
+}
+
+void yyset_debug (int bdebug )
+{
+ yy_flex_debug = bdebug ;
+}
+
+static int yy_init_globals (void)
+{
+ /* Initialization is the same as for the non-reentrant scanner.
+ * This function is called from yylex_destroy(), so don't allocate here.
+ */
+
+ (yy_buffer_stack) = 0;
+ (yy_buffer_stack_top) = 0;
+ (yy_buffer_stack_max) = 0;
+ (yy_c_buf_p) = (char *) 0;
+ (yy_init) = 0;
+ (yy_start) = 0;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+ yyin = stdin;
+ yyout = stdout;
+#else
+ yyin = (FILE *) 0;
+ yyout = (FILE *) 0;
+#endif
+
+ /* For future reference: Set errno on error, since we are called by
+ * yylex_init()
+ */
+ return 0;
+}
+
+/* yylex_destroy is for both reentrant and non-reentrant scanners. */
+int yylex_destroy (void)
+{
+
+ /* Pop the buffer stack, destroying each element. */
+ while(YY_CURRENT_BUFFER){
+ yy_delete_buffer(YY_CURRENT_BUFFER );
+ YY_CURRENT_BUFFER_LVALUE = NULL;
+ yypop_buffer_state();
+ }
+
+ /* Destroy the stack itself. */
+ yyfree((yy_buffer_stack) );
+ (yy_buffer_stack) = NULL;
+
+ /* Reset the globals. This is important in a non-reentrant scanner so the next time
+ * yylex() is called, initialization will occur. */
+ yy_init_globals( );
+
+ return 0;
+}
+
+/*
+ * Internal utility routines.
+ */
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
+{
+ register int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (yyconst char * s )
+{
+ register int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+}
+#endif
+
+void *yyalloc (yy_size_t size )
+{
+ return (void *) malloc( size );
+}
+
+void *yyrealloc (void * ptr, yy_size_t size )
+{
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+}
+
+void yyfree (void * ptr )
+{
+ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#line 44 "engines/director/lingo/lingo-lex.l"
+
+
+
+namespace Director {
+
+int Lingo::parse(char *code) {
+ YY_BUFFER_STATE bp;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER);
+
+ bp = yy_scan_string(code);
+ yy_switch_to_buffer(bp);
+ yyparse();
+ yy_delete_buffer(bp);
+
+ return 0;
+}
+
+}
+
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
new file mode 100644
index 0000000..081a505
--- /dev/null
+++ b/engines/director/lingo/lingo-lex.l
@@ -0,0 +1,61 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+%option noyywrap
+%{
+
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#include "common/str.h"
+
+#include "director/lingo/lingo.h"
+#include "director/lingo/lingo-gr.h"
+
+void yyparse();
+
+%}
+
+%%
+
+[_[:alpha:]][_[:alnum:]]* yylval.s = new Common::String(yytext); return VAR;
+[[:digit:]]+ yylval.i = strtol(yytext, NULL, 10); return INT;
+[-+*/%=^:,] return *yytext;
+.|\n ; /* ignore all the rest */
+
+%%
+
+namespace Director {
+
+int Lingo::parse(char *code) {
+ YY_BUFFER_STATE bp;
+
+ yy_delete_buffer(YY_CURRENT_BUFFER);
+
+ bp = yy_scan_string(code);
+ yy_switch_to_buffer(bp);
+ yyparse();
+ yy_delete_buffer(bp);
+
+ return 0;
+}
+
+}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index a4f9805..4cb175b 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -72,6 +72,8 @@ public:
void processEvent(LEvent event, int entityId);
+ int parse(char *code);
+
private:
Common::HashMap<uint32, const char *> _eventHandlerTypes;
};
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 4c2628c..de6a605 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -7,7 +7,16 @@ MODULE_OBJS = \
resource.o \
score.o \
sound.o \
- lingo/lingo.o
+ lingo/lingo.o \
+ lingo/lingo-gr.o \
+ lingo/lingo-lex.o
+
+engines/director/lingo/lingo-lex.cpp: engines/director/lingo/lingo-lex.l
+ flex -o engines/director/lingo/lingo-lex.cpp engines/director/lingo/lingo-lex.l
+
+engines/director/lingo/lingo-gr.cpp: engines/director/lingo/lingo-gr.y
+ bison -dv -o engines/director/lingo/lingo-gr.cpp engines/director/lingo/lingo-gr.y
+ mv engines/director/lingo/lingo-gr.hpp engines/director/lingo/lingo-gr.h
# This module can be built as a plugin
ifeq ($(ENABLE_DIRECTOR), DYNAMIC_PLUGIN)
Commit: e4428587b763b0f1da48de9decf251f98ddd3f00
https://github.com/scummvm/scummvm/commit/e4428587b763b0f1da48de9decf251f98ddd3f00
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Support 2 tracking sound system
Changed paths:
engines/director/director.cpp
engines/director/score.cpp
engines/director/score.h
engines/director/sound.cpp
engines/director/sound.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 3a39886..00bf7b9 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -78,7 +78,7 @@ Common::Error DirectorEngine::run() {
_mainArchive = new RIFFArchive();
_mainArchive->openFile("bookshelf_example.mmm");
- Score score(*_mainArchive, *_lingo);
+ Score score(*_mainArchive, *_lingo, *_soundManager);
score.startLoop();
if (getPlatform() == Common::kPlatformWindows)
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 948d83d..a426e2b 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -30,6 +30,7 @@
#include "director/dib.h"
#include "director/resource.h"
#include "director/lingo/lingo.h"
+#include "director/sound.h"
#include "graphics/palette.h"
#include "common/events.h"
@@ -38,12 +39,12 @@
namespace Director {
-Score::Score(Archive &movie, Lingo &lingo) {
+Score::Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager) {
_surface = new Graphics::ManagedSurface;
_movieArchive = &movie;
_lingo = &lingo;
-
+ _soundManager = &soundManager;
_lingo->processEvent(kEventPrepareMovie, 0);
assert(_movieArchive->hasResource(MKTAG('V','W','S','C'), 1024));
diff --git a/engines/director/score.h b/engines/director/score.h
index ac43c1a..b68cc40 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -33,6 +33,7 @@
namespace Director {
class Lingo;
+class DirectorSound;
#define CHANNEL_COUNT 24
@@ -264,7 +265,7 @@ public:
class Score {
public:
- Score(Archive &movie, Lingo &lingo);
+ Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager);
~Score();
static Common::Rect readRect(Common::SeekableReadStream &stream);
void startLoop();
@@ -311,6 +312,7 @@ private:
Archive *_movieArchive;
Graphics::ManagedSurface *_surface;
Lingo *_lingo;
+ DirectorSound *_soundManager;
};
} //End of namespace Director
diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index 35071c8..8c757e2 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -30,11 +30,12 @@
namespace Director {
DirectorSound::DirectorSound() {
- _soundHandle = new Audio::SoundHandle();
+ _sound1 = new Audio::SoundHandle();
+ _sound2 = new Audio::SoundHandle();
_mixer = g_system->getMixer();
}
-void DirectorSound::playWAV(Common::String filename) {
+void DirectorSound::playWAV(Common::String filename, uint8 soundChannel) {
Common::File *file = new Common::File();
if (!file->open(filename)) {
@@ -43,12 +44,14 @@ void DirectorSound::playWAV(Common::String filename) {
return;
}
- Audio::RewindableAudioStream *sound = Audio::makeWAVStream(file, DisposeAfterUse::YES);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, _soundHandle, sound);
+ Audio::RewindableAudioStream *sound = Audio::makeWAVStream(file, DisposeAfterUse::YES);
+ if (soundChannel == 1)
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, _sound1, sound);
+ else
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, _sound2, sound);
}
-void DirectorSound::playAIFF(Common::String filename) {
-
+void DirectorSound::playAIFF(Common::String filename, uint8 soundChannel) {
Common::File *file = new Common::File();
if (!file->open(filename)) {
warning("Failed to open %s", filename.c_str());
@@ -57,11 +60,25 @@ void DirectorSound::playAIFF(Common::String filename) {
}
Audio::RewindableAudioStream *sound = Audio::makeAIFFStream(file, DisposeAfterUse::YES);
- _mixer->playStream(Audio::Mixer::kSFXSoundType, _soundHandle, sound);
+ if (soundChannel == 1)
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, _sound1, sound);
+ else
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, _sound2, sound);
+}
+
+bool DirectorSound::isChannelActive(uint8 channelID) {
+ if (channelID == 1) {
+ return _mixer->isSoundHandleActive(*_sound1);
+ } else if (channelID == 2) {
+ return _mixer->isSoundHandleActive(*_sound2);
+ }
+ error("Incorrect sound channel");
+ return false;
}
void DirectorSound::stopSound() {
- _mixer->stopHandle(*_soundHandle);
+ _mixer->stopHandle(*_sound1);
+ _mixer->stopHandle(*_sound2);
}
} //End of namespace Director
diff --git a/engines/director/sound.h b/engines/director/sound.h
index 3d842c8..8f36a3e 100644
--- a/engines/director/sound.h
+++ b/engines/director/sound.h
@@ -32,14 +32,17 @@ namespace Director {
class DirectorSound {
private:
- Audio::SoundHandle *_soundHandle;
+ Audio::SoundHandle *_sound1;
+ Audio::SoundHandle *_sound2;
+
Audio::Mixer *_mixer;
public:
DirectorSound();
- void playWAV(Common::String filename);
- void playAIFF(Common::String filename);
+ void playWAV(Common::String filename, uint8 channelID);
+ void playAIFF(Common::String filename, uint8 channelID);
+ bool isChannelActive(uint8 channelID);
void stopSound();
};
Commit: 824c3fb6616b9afa65ac3db5d2c8d97a26004dd8
https://github.com/scummvm/scummvm/commit/824c3fb6616b9afa65ac3db5d2c8d97a26004dd8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Added stub for 'mci' Lingo command
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 00bf7b9..a05884a 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -70,7 +70,7 @@ Common::Error DirectorEngine::run() {
_lingo = new Lingo();
- _lingo->parse("test = 2 + 2 * 6, test:");
+ _lingo->parse("mci \"open MM\\T005045a.wav type WaveAudio alias T005045a\"");
_soundManager = new DirectorSound();
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 56aa787..929bb4b 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -68,13 +68,17 @@
enum yytokentype {
UNARY = 258,
INT = 259,
- VAR = 260
+ VAR = 260,
+ STRING = 261,
+ FUNC_MCI = 262
};
#endif
/* Tokens. */
#define UNARY 258
#define INT 259
#define VAR 260
+#define STRING 261
+#define FUNC_MCI 262
@@ -93,6 +97,8 @@ extern int yylex();
extern int yyparse();
void yyerror(char *s) { error("%s", s); }
+int func_mci(Common::String *s);
+
/* Enabling traces. */
@@ -115,10 +121,10 @@ void yyerror(char *s) { error("%s", s); }
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 37 "engines/director/lingo/lingo-gr.y"
+#line 39 "engines/director/lingo/lingo-gr.y"
{ int i; Common::String *s; }
/* Line 193 of yacc.c. */
-#line 122 "engines/director/lingo/lingo-gr.cpp"
+#line 128 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -131,7 +137,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 135 "engines/director/lingo/lingo-gr.cpp"
+#line 141 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -344,22 +350,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 13
+#define YYFINAL 16
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 46
+#define YYLAST 52
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 16
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 4
+#define YYNNTS 5
/* YYNRULES -- Number of rules. */
-#define YYNRULES 16
+#define YYNRULES 18
/* YYNRULES -- Number of states. */
-#define YYNSTATES 29
+#define YYNSTATES 30
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 260
+#define YYMAXUTOK 262
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -370,10 +376,10 @@ static const yytype_uint8 yytranslate[] =
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 11, 2, 2,
- 14, 15, 9, 7, 12, 8, 2, 10, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 13, 2,
- 2, 6, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 13, 2, 2,
+ 14, 15, 11, 9, 2, 10, 2, 12, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 8, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -393,7 +399,7 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5
+ 5, 6, 7
};
#if YYDEBUG
@@ -401,26 +407,26 @@ static const yytype_uint8 yytranslate[] =
YYRHS. */
static const yytype_uint8 yyprhs[] =
{
- 0, 0, 3, 5, 8, 11, 14, 16, 18, 22,
- 26, 30, 34, 38, 42, 45, 48
+ 0, 0, 3, 5, 8, 10, 12, 14, 16, 20,
+ 24, 28, 32, 36, 40, 43, 46, 50, 51
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 17, 0, -1, 18, -1, 17, 18, -1, 19, 12,
- -1, 19, 13, -1, 4, -1, 5, -1, 5, 6,
- 19, -1, 19, 7, 19, -1, 19, 8, 19, -1,
+ 17, 0, -1, 18, -1, 17, 18, -1, 19, -1,
+ 20, -1, 4, -1, 5, -1, 5, 8, 19, -1,
19, 9, 19, -1, 19, 10, 19, -1, 19, 11,
- 19, -1, 7, 19, -1, 8, 19, -1, 14, 19,
- 15, -1
+ 19, -1, 19, 12, 19, -1, 19, 13, 19, -1,
+ 9, 19, -1, 10, 19, -1, 14, 19, 15, -1,
+ -1, 7, 6, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 51, 51, 52, 55, 56, 59, 60, 61, 62,
- 63, 64, 65, 66, 67, 68, 69
+ 0, 57, 57, 58, 61, 62, 65, 66, 67, 68,
+ 69, 70, 71, 72, 73, 74, 75, 76, 79
};
#endif
@@ -429,9 +435,9 @@ static const yytype_uint8 yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "UNARY", "INT", "VAR", "'='", "'+'",
- "'-'", "'*'", "'/'", "'%'", "','", "':'", "'('", "')'", "$accept",
- "list", "statement", "expr", 0
+ "$end", "error", "$undefined", "UNARY", "INT", "VAR", "STRING",
+ "FUNC_MCI", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'('", "')'",
+ "$accept", "list", "statement", "expr", "func", 0
};
#endif
@@ -440,8 +446,8 @@ static const char *const yytname[] =
token YYLEX-NUM. */
static const yytype_uint16 yytoknum[] =
{
- 0, 256, 257, 258, 259, 260, 61, 43, 45, 42,
- 47, 37, 44, 58, 40, 41
+ 0, 256, 257, 258, 259, 260, 261, 262, 61, 43,
+ 45, 42, 47, 37, 40, 41
};
# endif
@@ -449,14 +455,14 @@ static const yytype_uint16 yytoknum[] =
static const yytype_uint8 yyr1[] =
{
0, 16, 17, 17, 18, 18, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19
+ 19, 19, 19, 19, 19, 19, 19, 19, 20
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
- 0, 2, 1, 2, 2, 2, 1, 1, 3, 3,
- 3, 3, 3, 3, 2, 2, 3
+ 0, 2, 1, 2, 1, 1, 1, 1, 3, 3,
+ 3, 3, 3, 3, 2, 2, 3, 0, 2
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -464,31 +470,31 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 6, 7, 0, 0, 0, 0, 2, 0, 0,
- 14, 15, 0, 1, 3, 0, 0, 0, 0, 0,
- 4, 5, 8, 16, 9, 10, 11, 12, 13
+ 17, 6, 7, 0, 17, 17, 17, 17, 2, 4,
+ 5, 17, 18, 14, 15, 0, 1, 3, 17, 17,
+ 17, 17, 17, 8, 16, 9, 10, 11, 12, 13
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 6, 7, 8
+ -1, 7, 8, 9, 10
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -4
+#define YYPACT_NINF -5
static const yytype_int8 yypact[] =
{
- 14, -4, -2, 14, 14, 14, 3, -4, 25, 14,
- -4, -4, 16, -4, -4, 14, 14, 14, 14, 14,
- -4, -4, 32, -4, 35, 35, -4, -4, -4
+ -1, -5, -3, 4, 26, 26, 26, 19, -5, 39,
+ -5, 26, -5, -5, -5, 32, -5, -5, 26, 26,
+ 26, 26, 26, 39, -5, 9, 9, -5, -5, -5
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -4, -4, -1, -3
+ -5, -5, 5, -4, -5
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -498,29 +504,31 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
- 10, 11, 12, 13, 9, 14, 22, 1, 2, 0,
- 3, 4, 24, 25, 26, 27, 28, 5, 1, 2,
- 0, 3, 4, 15, 16, 17, 18, 19, 5, 0,
- 0, 23, 15, 16, 17, 18, 19, 20, 21, 15,
- 16, 17, 18, 19, 17, 18, 19
+ 13, 14, 15, 1, 2, 11, 3, 23, 4, 5,
+ 12, 0, 17, 6, 25, 26, 27, 28, 29, 16,
+ 20, 21, 22, 1, 2, 0, 3, 0, 4, 5,
+ 1, 2, 0, 6, 0, 4, 5, 0, 0, 0,
+ 6, 18, 19, 20, 21, 22, 0, 24, 18, 19,
+ 20, 21, 22
};
static const yytype_int8 yycheck[] =
{
- 3, 4, 5, 0, 6, 6, 9, 4, 5, -1,
- 7, 8, 15, 16, 17, 18, 19, 14, 4, 5,
- -1, 7, 8, 7, 8, 9, 10, 11, 14, -1,
- -1, 15, 7, 8, 9, 10, 11, 12, 13, 7,
- 8, 9, 10, 11, 9, 10, 11
+ 4, 5, 6, 4, 5, 8, 7, 11, 9, 10,
+ 6, -1, 7, 14, 18, 19, 20, 21, 22, 0,
+ 11, 12, 13, 4, 5, -1, 7, -1, 9, 10,
+ 4, 5, -1, 14, -1, 9, 10, -1, -1, -1,
+ 14, 9, 10, 11, 12, 13, -1, 15, 9, 10,
+ 11, 12, 13
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 4, 5, 7, 8, 14, 17, 18, 19, 6,
- 19, 19, 19, 0, 18, 7, 8, 9, 10, 11,
- 12, 13, 19, 15, 19, 19, 19, 19, 19
+ 0, 4, 5, 7, 9, 10, 14, 17, 18, 19,
+ 20, 8, 6, 19, 19, 19, 0, 18, 9, 10,
+ 11, 12, 13, 19, 15, 19, 19, 19, 19, 19
};
#define yyerrok (yyerrstatus = 0)
@@ -1334,69 +1342,79 @@ yyreduce:
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
- case 5:
-#line 56 "engines/director/lingo/lingo-gr.y"
- { warning("%d", (yyvsp[(1) - (2)].i)); ;}
+ case 4:
+#line 61 "engines/director/lingo/lingo-gr.y"
+ { warning("%d", (yyvsp[(1) - (1)].i)); ;}
+ break;
+
+ case 5:
+#line 62 "engines/director/lingo/lingo-gr.y"
+ { warning("%d", (yyvsp[(1) - (1)].i)); ;}
break;
case 6:
-#line 59 "engines/director/lingo/lingo-gr.y"
+#line 65 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); ;}
break;
case 7:
-#line 60 "engines/director/lingo/lingo-gr.y"
+#line 66 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = vars[*(yyvsp[(1) - (1)].s)]; delete (yyvsp[(1) - (1)].s); ;}
break;
case 8:
-#line 61 "engines/director/lingo/lingo-gr.y"
+#line 67 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = vars[*(yyvsp[(1) - (3)].s)] = (yyvsp[(3) - (3)].i); delete (yyvsp[(1) - (3)].s); ;}
break;
case 9:
-#line 62 "engines/director/lingo/lingo-gr.y"
+#line 68 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(1) - (3)].i) + (yyvsp[(3) - (3)].i); ;}
break;
case 10:
-#line 63 "engines/director/lingo/lingo-gr.y"
+#line 69 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(1) - (3)].i) - (yyvsp[(3) - (3)].i); ;}
break;
case 11:
-#line 64 "engines/director/lingo/lingo-gr.y"
+#line 70 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(1) - (3)].i) * (yyvsp[(3) - (3)].i); ;}
break;
case 12:
-#line 65 "engines/director/lingo/lingo-gr.y"
+#line 71 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(1) - (3)].i) / (yyvsp[(3) - (3)].i); ;}
break;
case 13:
-#line 66 "engines/director/lingo/lingo-gr.y"
+#line 72 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(1) - (3)].i) % (yyvsp[(3) - (3)].i); ;}
break;
case 14:
-#line 67 "engines/director/lingo/lingo-gr.y"
+#line 73 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(2) - (2)].i); ;}
break;
case 15:
-#line 68 "engines/director/lingo/lingo-gr.y"
+#line 74 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = -(yyvsp[(2) - (2)].i); ;}
break;
case 16:
-#line 69 "engines/director/lingo/lingo-gr.y"
+#line 75 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(2) - (3)].i); ;}
break;
+ case 18:
+#line 79 "engines/director/lingo/lingo-gr.y"
+ { func_mci((yyvsp[(2) - (2)].s)); delete (yyvsp[(2) - (2)].s); ;}
+ break;
+
/* Line 1267 of yacc.c. */
-#line 1400 "engines/director/lingo/lingo-gr.cpp"
+#line 1418 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1610,6 +1628,12 @@ yyreturn:
}
-#line 72 "engines/director/lingo/lingo-gr.y"
+#line 81 "engines/director/lingo/lingo-gr.y"
+int func_mci(Common::String *s) {
+ warning("mci: %s", s->c_str());
+
+ return 0;
+}
+
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 82c4454..5204868 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -41,23 +41,27 @@
enum yytokentype {
UNARY = 258,
INT = 259,
- VAR = 260
+ VAR = 260,
+ STRING = 261,
+ FUNC_MCI = 262
};
#endif
/* Tokens. */
#define UNARY 258
#define INT 259
#define VAR 260
+#define STRING 261
+#define FUNC_MCI 262
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 37 "engines/director/lingo/lingo-gr.y"
+#line 39 "engines/director/lingo/lingo-gr.y"
{ int i; Common::String *s; }
/* Line 1529 of yacc.c. */
-#line 61 "engines/director/lingo/lingo-gr.hpp"
+#line 65 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 49149cb..25b6736 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -32,6 +32,8 @@ extern int yylex();
extern int yyparse();
void yyerror(char *s) { error("%s", s); }
+int func_mci(Common::String *s);
+
%}
%union { int i; Common::String *s; }
@@ -39,7 +41,11 @@ void yyerror(char *s) { error("%s", s); }
%token UNARY
%token<i> INT
%token<s> VAR
+%token<s> STRING
+%token FUNC_MCI
+
%type<i> expr
+%type<i> func
%right '='
%left '+' '-'
@@ -49,24 +55,33 @@ void yyerror(char *s) { error("%s", s); }
%%
list: statement
- | list statement
- ;
-
-statement: expr ','
- | expr ':' { warning("%d", $1); }
- ;
-
-expr: INT { $$ = $1; }
- | VAR { $$ = vars[*$1]; delete $1; }
- | VAR '=' expr { $$ = vars[*$1] = $3; delete $1; }
- | expr '+' expr { $$ = $1 + $3; }
- | expr '-' expr { $$ = $1 - $3; }
- | expr '*' expr { $$ = $1 * $3; }
- | expr '/' expr { $$ = $1 / $3; }
- | expr '%' expr { $$ = $1 % $3; }
- | '+' expr %prec UNARY { $$ = $2; }
- | '-' expr %prec UNARY { $$ = -$2; }
- | '(' expr ')' { $$ = $2; }
- ;
+ | list statement
+ ;
+
+statement: expr { warning("%d", $1); }
+ | func { warning("%d", $1); }
+ ;
+
+expr: INT { $$ = $1; }
+ | VAR { $$ = vars[*$1]; delete $1; }
+ | VAR '=' expr { $$ = vars[*$1] = $3; delete $1; }
+ | expr '+' expr { $$ = $1 + $3; }
+ | expr '-' expr { $$ = $1 - $3; }
+ | expr '*' expr { $$ = $1 * $3; }
+ | expr '/' expr { $$ = $1 / $3; }
+ | expr '%' expr { $$ = $1 % $3; }
+ | '+' expr %prec UNARY { $$ = $2; }
+ | '-' expr %prec UNARY { $$ = -$2; }
+ | '(' expr ')' { $$ = $2; }
+ |
+ ;
+
+func: FUNC_MCI STRING { func_mci($2); delete $2; }
%%
+
+int func_mci(Common::String *s) {
+ warning("mci: %s", s->c_str());
+
+ return 0;
+}
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 5379ceb..d0391b6 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 5
-#define YY_END_OF_BUFFER 6
+#define YY_NUM_RULES 6
+#define YY_END_OF_BUFFER 7
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,9 +373,10 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[11] =
+static yyconst flex_int16_t yy_accept[17] =
{ 0,
- 0, 0, 6, 4, 3, 2, 1, 2, 1, 0
+ 0, 0, 7, 6, 6, 4, 3, 2, 2, 0,
+ 5, 3, 2, 2, 1, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -383,17 +384,17 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
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, 3, 1, 1, 1,
- 1, 3, 3, 3, 3, 1, 3, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 3, 1, 1,
- 3, 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, 5, 5, 5,
- 1, 1, 1, 3, 5, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 3, 1, 1, 4, 1, 1, 1,
+ 1, 4, 4, 4, 4, 1, 4, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 4, 1, 1,
+ 4, 1, 1, 1, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 1, 1, 1, 4, 6, 1, 6, 6, 7, 6,
+
+ 6, 6, 6, 6, 8, 6, 6, 6, 9, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 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,
@@ -410,33 +411,35 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[6] =
+static yyconst flex_int32_t yy_meta[10] =
{ 0,
- 1, 1, 1, 2, 3
+ 1, 2, 1, 1, 3, 3, 3, 3, 3
} ;
-static yyconst flex_int16_t yy_base[13] =
+static yyconst flex_int16_t yy_base[19] =
{ 0,
- 0, 0, 9, 10, 10, 0, 0, 0, 0, 10,
- 6, 4
+ 0, 0, 19, 20, 15, 20, 12, 0, 9, 12,
+ 20, 9, 0, 5, 0, 20, 9, 8
} ;
-static yyconst flex_int16_t yy_def[13] =
+static yyconst flex_int16_t yy_def[19] =
{ 0,
- 10, 1, 10, 10, 10, 11, 12, 11, 12, 0,
- 10, 10
+ 16, 1, 16, 16, 17, 16, 16, 18, 18, 17,
+ 16, 16, 18, 18, 18, 0, 16, 16
} ;
-static yyconst flex_int16_t yy_nxt[16] =
+static yyconst flex_int16_t yy_nxt[30] =
{ 0,
- 4, 4, 5, 6, 7, 9, 9, 8, 10, 3,
- 10, 10, 10, 10, 10
+ 4, 4, 5, 6, 7, 8, 8, 8, 9, 10,
+ 13, 10, 15, 12, 11, 14, 12, 11, 16, 3,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16
} ;
-static yyconst flex_int16_t yy_chk[16] =
+static yyconst flex_int16_t yy_chk[30] =
{ 0,
- 1, 1, 1, 1, 1, 12, 12, 11, 3, 10,
- 10, 10, 10, 10, 10
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 17,
+ 18, 17, 14, 12, 10, 9, 7, 5, 3, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16
} ;
static yy_state_type yy_last_accepting_state;
@@ -486,7 +489,7 @@ char *yytext;
void yyparse();
-#line 490 "engines/director/lingo/lingo-lex.cpp"
+#line 493 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -668,10 +671,10 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 37 "engines/director/lingo/lingo-lex.l"
+#line 42 "engines/director/lingo/lingo-lex.l"
-#line 675 "engines/director/lingo/lingo-lex.cpp"
+#line 678 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -724,13 +727,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 >= 11 )
+ if ( yy_current_state >= 17 )
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] != 10 );
+ while ( yy_base[yy_current_state] != 20 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -756,31 +759,35 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 39 "engines/director/lingo/lingo-lex.l"
-yylval.s = new Common::String(yytext); return VAR;
+#line 44 "engines/director/lingo/lingo-lex.l"
+{ return FUNC_MCI; }
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 40 "engines/director/lingo/lingo-lex.l"
-yylval.i = strtol(yytext, NULL, 10); return INT;
+#line 45 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(yytext); return VAR; }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 41 "engines/director/lingo/lingo-lex.l"
-return *yytext;
+#line 46 "engines/director/lingo/lingo-lex.l"
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 4:
-/* rule 4 can match eol */
YY_RULE_SETUP
-#line 42 "engines/director/lingo/lingo-lex.l"
-; /* ignore all the rest */
+#line 47 "engines/director/lingo/lingo-lex.l"
+{ return *yytext; }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 44 "engines/director/lingo/lingo-lex.l"
+#line 48 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(yytext); return STRING; }
+ YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 50 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 784 "engines/director/lingo/lingo-lex.cpp"
+#line 791 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1072,7 +1079,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 >= 11 )
+ if ( yy_current_state >= 17 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1100,11 +1107,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 >= 11 )
+ if ( yy_current_state >= 17 )
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 == 10);
+ yy_is_jam = (yy_current_state == 16);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1777,7 +1784,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 44 "engines/director/lingo/lingo-lex.l"
+#line 50 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 081a505..575d09e 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -34,12 +34,18 @@ void yyparse();
%}
+variable [_[:alpha:]][_[:alnum:]]*
+constinteger [[:digit:]]+
+conststring \"[^\"\n]*\"
+operator [-+*/%=^:,]
+
%%
-[_[:alpha:]][_[:alnum:]]* yylval.s = new Common::String(yytext); return VAR;
-[[:digit:]]+ yylval.i = strtol(yytext, NULL, 10); return INT;
-[-+*/%=^:,] return *yytext;
-.|\n ; /* ignore all the rest */
+mci { return FUNC_MCI; }
+{variable} { yylval.s = new Common::String(yytext); return VAR; }
+{constinteger} { yylval.i = strtol(yytext, NULL, 10); return INT; }
+{operator} { return *yytext; }
+{conststring} { yylval.s = new Common::String(yytext); return STRING; }
%%
Commit: f2b0abbafc0fe14d038b04c61eb03a481550bba0
https://github.com/scummvm/scummvm/commit/f2b0abbafc0fe14d038b04c61eb03a481550bba0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo, added put/set functions and support for multiline input
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index a05884a..0c1f023 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -71,6 +71,11 @@ Common::Error DirectorEngine::run() {
_lingo = new Lingo();
_lingo->parse("mci \"open MM\\T005045a.wav type WaveAudio alias T005045a\"");
+#if 0
+ _lingo->parse("set x = 1\n\
+ set y to 2\n\
+ put 5 into z\n");
+#endif
_soundManager = new DirectorSound();
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 929bb4b..79b9531 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -67,18 +67,28 @@
know about them. */
enum yytokentype {
UNARY = 258,
- INT = 259,
- VAR = 260,
- STRING = 261,
- FUNC_MCI = 262
+ FLOAT = 259,
+ INT = 260,
+ VAR = 261,
+ STRING = 262,
+ OP_INTO = 263,
+ OP_TO = 264,
+ FUNC_MCI = 265,
+ FUNC_PUT = 266,
+ FUNC_SET = 267
};
#endif
/* Tokens. */
#define UNARY 258
-#define INT 259
-#define VAR 260
-#define STRING 261
-#define FUNC_MCI 262
+#define FLOAT 259
+#define INT 260
+#define VAR 261
+#define STRING 262
+#define OP_INTO 263
+#define OP_TO 264
+#define FUNC_MCI 265
+#define FUNC_PUT 266
+#define FUNC_SET 267
@@ -122,9 +132,9 @@ int func_mci(Common::String *s);
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 39 "engines/director/lingo/lingo-gr.y"
-{ int i; Common::String *s; }
+{ float f; int i; Common::String *s; }
/* Line 193 of yacc.c. */
-#line 128 "engines/director/lingo/lingo-gr.cpp"
+#line 138 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -137,7 +147,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 141 "engines/director/lingo/lingo-gr.cpp"
+#line 151 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -350,22 +360,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 16
+#define YYFINAL 19
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 52
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 16
+#define YYNTOKENS 22
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 5
/* YYNRULES -- Number of rules. */
-#define YYNRULES 18
+#define YYNRULES 19
/* YYNRULES -- Number of states. */
-#define YYNSTATES 30
+#define YYNSTATES 37
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 262
+#define YYMAXUTOK 267
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -374,12 +384,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 19, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 18, 2, 2,
+ 20, 21, 16, 14, 2, 15, 2, 17, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 13, 2, 2,
- 14, 15, 11, 9, 2, 10, 2, 12, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 8, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 13, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -399,7 +409,7 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7
+ 5, 6, 7, 8, 9, 10, 11, 12
};
#if YYDEBUG
@@ -407,26 +417,27 @@ static const yytype_uint8 yytranslate[] =
YYRHS. */
static const yytype_uint8 yyprhs[] =
{
- 0, 0, 3, 5, 8, 10, 12, 14, 16, 20,
- 24, 28, 32, 36, 40, 43, 46, 50, 51
+ 0, 0, 3, 5, 9, 11, 13, 15, 17, 21,
+ 25, 29, 33, 36, 39, 43, 44, 47, 52, 57
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 17, 0, -1, 18, -1, 17, 18, -1, 19, -1,
- 20, -1, 4, -1, 5, -1, 5, 8, 19, -1,
- 19, 9, 19, -1, 19, 10, 19, -1, 19, 11,
- 19, -1, 19, 12, 19, -1, 19, 13, 19, -1,
- 9, 19, -1, 10, 19, -1, 14, 19, 15, -1,
- -1, 7, 6, -1
+ 23, 0, -1, 24, -1, 23, 19, 24, -1, 25,
+ -1, 26, -1, 5, -1, 6, -1, 25, 14, 25,
+ -1, 25, 15, 25, -1, 25, 16, 25, -1, 25,
+ 17, 25, -1, 14, 25, -1, 15, 25, -1, 20,
+ 25, 21, -1, -1, 10, 7, -1, 11, 25, 8,
+ 6, -1, 12, 6, 13, 25, -1, 12, 6, 9,
+ 25, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 57, 57, 58, 61, 62, 65, 66, 67, 68,
- 69, 70, 71, 72, 73, 74, 75, 76, 79
+ 0, 62, 62, 63, 66, 67, 70, 71, 72, 73,
+ 74, 75, 76, 77, 78, 79, 82, 83, 84, 85
};
#endif
@@ -435,9 +446,10 @@ static const yytype_uint8 yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "UNARY", "INT", "VAR", "STRING",
- "FUNC_MCI", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'('", "')'",
- "$accept", "list", "statement", "expr", "func", 0
+ "$end", "error", "$undefined", "UNARY", "FLOAT", "INT", "VAR", "STRING",
+ "OP_INTO", "OP_TO", "FUNC_MCI", "FUNC_PUT", "FUNC_SET", "'='", "'+'",
+ "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "$accept", "list",
+ "statement", "expr", "func", 0
};
#endif
@@ -446,23 +458,24 @@ static const char *const yytname[] =
token YYLEX-NUM. */
static const yytype_uint16 yytoknum[] =
{
- 0, 256, 257, 258, 259, 260, 261, 262, 61, 43,
- 45, 42, 47, 37, 40, 41
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
+ 265, 266, 267, 61, 43, 45, 42, 47, 37, 10,
+ 40, 41
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 16, 17, 17, 18, 18, 19, 19, 19, 19,
- 19, 19, 19, 19, 19, 19, 19, 19, 20
+ 0, 22, 23, 23, 24, 24, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 26, 26, 26, 26
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
- 0, 2, 1, 2, 1, 1, 1, 1, 3, 3,
- 3, 3, 3, 3, 2, 2, 3, 0, 2
+ 0, 2, 1, 3, 1, 1, 1, 1, 3, 3,
+ 3, 3, 2, 2, 3, 0, 2, 4, 4, 4
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -470,31 +483,33 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 17, 6, 7, 0, 17, 17, 17, 17, 2, 4,
- 5, 17, 18, 14, 15, 0, 1, 3, 17, 17,
- 17, 17, 17, 8, 16, 9, 10, 11, 12, 13
+ 15, 6, 7, 0, 15, 0, 15, 15, 15, 0,
+ 2, 4, 5, 16, 0, 0, 12, 13, 0, 1,
+ 15, 15, 15, 15, 15, 0, 15, 15, 14, 3,
+ 8, 9, 10, 11, 17, 19, 18
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 7, 8, 9, 10
+ -1, 9, 10, 11, 12
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -5
+#define YYPACT_NINF -9
static const yytype_int8 yypact[] =
{
- -1, -5, -3, 4, 26, 26, 26, 19, -5, 39,
- -5, 26, -5, -5, -5, 32, -5, -5, 26, 26,
- 26, 26, 26, 39, -5, 9, 9, -5, -5, -5
+ 1, -9, -9, -6, 20, 4, 20, 20, 20, 5,
+ -9, 35, -9, -9, 22, 18, -9, -9, 27, -9,
+ 1, 20, 20, 20, 20, 8, 20, 20, -9, -9,
+ -8, -8, -9, -9, -9, 35, 35
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -5, -5, 5, -4, -5
+ -9, -9, 9, -4, -9
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -504,31 +519,32 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
- 13, 14, 15, 1, 2, 11, 3, 23, 4, 5,
- 12, 0, 17, 6, 25, 26, 27, 28, 29, 16,
- 20, 21, 22, 1, 2, 0, 3, 0, 4, 5,
- 1, 2, 0, 6, 0, 4, 5, 0, 0, 0,
- 6, 18, 19, 20, 21, 22, 0, 24, 18, 19,
- 20, 21, 22
+ 14, 13, 16, 17, 18, 19, 1, 2, 23, 24,
+ 15, 3, 4, 5, 34, 6, 7, 30, 31, 32,
+ 33, 8, 35, 36, 20, 1, 2, 26, 0, 29,
+ 25, 27, 0, 0, 6, 7, 21, 22, 23, 24,
+ 8, 21, 22, 23, 24, 0, 0, 0, 28, 21,
+ 22, 23, 24
};
static const yytype_int8 yycheck[] =
{
- 4, 5, 6, 4, 5, 8, 7, 11, 9, 10,
- 6, -1, 7, 14, 18, 19, 20, 21, 22, 0,
- 11, 12, 13, 4, 5, -1, 7, -1, 9, 10,
- 4, 5, -1, 14, -1, 9, 10, -1, -1, -1,
- 14, 9, 10, 11, 12, 13, -1, 15, 9, 10,
- 11, 12, 13
+ 4, 7, 6, 7, 8, 0, 5, 6, 16, 17,
+ 6, 10, 11, 12, 6, 14, 15, 21, 22, 23,
+ 24, 20, 26, 27, 19, 5, 6, 9, -1, 20,
+ 8, 13, -1, -1, 14, 15, 14, 15, 16, 17,
+ 20, 14, 15, 16, 17, -1, -1, -1, 21, 14,
+ 15, 16, 17
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 4, 5, 7, 9, 10, 14, 17, 18, 19,
- 20, 8, 6, 19, 19, 19, 0, 18, 9, 10,
- 11, 12, 13, 19, 15, 19, 19, 19, 19, 19
+ 0, 5, 6, 10, 11, 12, 14, 15, 20, 23,
+ 24, 25, 26, 7, 25, 6, 25, 25, 25, 0,
+ 19, 14, 15, 16, 17, 8, 9, 13, 21, 24,
+ 25, 25, 25, 25, 6, 25, 25
};
#define yyerrok (yyerrstatus = 0)
@@ -1343,78 +1359,83 @@ yyreduce:
switch (yyn)
{
case 4:
-#line 61 "engines/director/lingo/lingo-gr.y"
+#line 66 "engines/director/lingo/lingo-gr.y"
{ warning("%d", (yyvsp[(1) - (1)].i)); ;}
break;
case 5:
-#line 62 "engines/director/lingo/lingo-gr.y"
+#line 67 "engines/director/lingo/lingo-gr.y"
{ warning("%d", (yyvsp[(1) - (1)].i)); ;}
break;
case 6:
-#line 65 "engines/director/lingo/lingo-gr.y"
+#line 70 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); ;}
break;
case 7:
-#line 66 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = vars[*(yyvsp[(1) - (1)].s)]; delete (yyvsp[(1) - (1)].s); ;}
+#line 71 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = vars[*(yyvsp[(1) - (1)].s)]; delete (yyvsp[(1) - (1)].s); ;}
break;
case 8:
-#line 67 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = vars[*(yyvsp[(1) - (3)].s)] = (yyvsp[(3) - (3)].i); delete (yyvsp[(1) - (3)].s); ;}
+#line 72 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(1) - (3)].i) + (yyvsp[(3) - (3)].i); ;}
break;
case 9:
-#line 68 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(1) - (3)].i) + (yyvsp[(3) - (3)].i); ;}
+#line 73 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(1) - (3)].i) - (yyvsp[(3) - (3)].i); ;}
break;
case 10:
-#line 69 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(1) - (3)].i) - (yyvsp[(3) - (3)].i); ;}
+#line 74 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(1) - (3)].i) * (yyvsp[(3) - (3)].i); ;}
break;
case 11:
-#line 70 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(1) - (3)].i) * (yyvsp[(3) - (3)].i); ;}
+#line 75 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(1) - (3)].i) / (yyvsp[(3) - (3)].i); ;}
break;
case 12:
-#line 71 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(1) - (3)].i) / (yyvsp[(3) - (3)].i); ;}
+#line 76 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(2) - (2)].i); ;}
break;
case 13:
-#line 72 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(1) - (3)].i) % (yyvsp[(3) - (3)].i); ;}
+#line 77 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = -(yyvsp[(2) - (2)].i); ;}
break;
case 14:
-#line 73 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(2) - (2)].i); ;}
+#line 78 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = (yyvsp[(2) - (3)].i); ;}
break;
- case 15:
-#line 74 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = -(yyvsp[(2) - (2)].i); ;}
+ case 16:
+#line 82 "engines/director/lingo/lingo-gr.y"
+ { func_mci((yyvsp[(2) - (2)].s)); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 16:
-#line 75 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(2) - (3)].i); ;}
+ case 17:
+#line 83 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = vars[*(yyvsp[(4) - (4)].s)] = (yyvsp[(2) - (4)].i); delete (yyvsp[(4) - (4)].s); ;}
break;
case 18:
-#line 79 "engines/director/lingo/lingo-gr.y"
- { func_mci((yyvsp[(2) - (2)].s)); delete (yyvsp[(2) - (2)].s); ;}
+#line 84 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = vars[*(yyvsp[(2) - (4)].s)] = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
+ break;
+
+ case 19:
+#line 85 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = vars[*(yyvsp[(2) - (4)].s)] = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1418 "engines/director/lingo/lingo-gr.cpp"
+#line 1439 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1628,11 +1649,11 @@ yyreturn:
}
-#line 81 "engines/director/lingo/lingo-gr.y"
+#line 88 "engines/director/lingo/lingo-gr.y"
int func_mci(Common::String *s) {
- warning("mci: %s", s->c_str());
+ warning("STUB: mci(\"%s\")", s->c_str());
return 0;
}
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 5204868..1cf31e0 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -40,18 +40,28 @@
know about them. */
enum yytokentype {
UNARY = 258,
- INT = 259,
- VAR = 260,
- STRING = 261,
- FUNC_MCI = 262
+ FLOAT = 259,
+ INT = 260,
+ VAR = 261,
+ STRING = 262,
+ OP_INTO = 263,
+ OP_TO = 264,
+ FUNC_MCI = 265,
+ FUNC_PUT = 266,
+ FUNC_SET = 267
};
#endif
/* Tokens. */
#define UNARY 258
-#define INT 259
-#define VAR 260
-#define STRING 261
-#define FUNC_MCI 262
+#define FLOAT 259
+#define INT 260
+#define VAR 261
+#define STRING 262
+#define OP_INTO 263
+#define OP_TO 264
+#define FUNC_MCI 265
+#define FUNC_PUT 266
+#define FUNC_SET 267
@@ -59,9 +69,9 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 39 "engines/director/lingo/lingo-gr.y"
-{ int i; Common::String *s; }
+{ float f; int i; Common::String *s; }
/* Line 1529 of yacc.c. */
-#line 65 "engines/director/lingo/lingo-gr.hpp"
+#line 75 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 25b6736..af0ad42 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -36,13 +36,18 @@ int func_mci(Common::String *s);
%}
-%union { int i; Common::String *s; }
+%union { float f; int i; Common::String *s; }
%token UNARY
+%token<f> FLOAT
%token<i> INT
%token<s> VAR
%token<s> STRING
+%token OP_INTO
+%token OP_TO
%token FUNC_MCI
+%token FUNC_PUT
+%token FUNC_SET
%type<i> expr
%type<i> func
@@ -55,7 +60,7 @@ int func_mci(Common::String *s);
%%
list: statement
- | list statement
+ | list '\n' statement
;
statement: expr { warning("%d", $1); }
@@ -63,25 +68,27 @@ statement: expr { warning("%d", $1); }
;
expr: INT { $$ = $1; }
- | VAR { $$ = vars[*$1]; delete $1; }
- | VAR '=' expr { $$ = vars[*$1] = $3; delete $1; }
+ | VAR { $$ = vars[*$1]; delete $1; }
| expr '+' expr { $$ = $1 + $3; }
| expr '-' expr { $$ = $1 - $3; }
| expr '*' expr { $$ = $1 * $3; }
| expr '/' expr { $$ = $1 / $3; }
- | expr '%' expr { $$ = $1 % $3; }
| '+' expr %prec UNARY { $$ = $2; }
| '-' expr %prec UNARY { $$ = -$2; }
| '(' expr ')' { $$ = $2; }
|
;
-func: FUNC_MCI STRING { func_mci($2); delete $2; }
+func: FUNC_MCI STRING { func_mci($2); delete $2; }
+ | FUNC_PUT expr OP_INTO VAR { $$ = vars[*$4] = $2; delete $4; }
+ | FUNC_SET VAR '=' expr { $$ = vars[*$2] = $4; delete $2; }
+ | FUNC_SET VAR OP_TO expr { $$ = vars[*$2] = $4; delete $2; }
+ ;
%%
int func_mci(Common::String *s) {
- warning("mci: %s", s->c_str());
+ warning("STUB: mci(\"%s\")", s->c_str());
return 0;
}
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index d0391b6..784e59d 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 6
-#define YY_END_OF_BUFFER 7
+#define YY_NUM_RULES 12
+#define YY_END_OF_BUFFER 13
/* 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[17] =
+static yyconst flex_int16_t yy_accept[33] =
{ 0,
- 0, 0, 7, 6, 6, 4, 3, 2, 2, 0,
- 5, 3, 2, 2, 1, 0
+ 0, 0, 13, 12, 10, 12, 9, 8, 6, 6,
+ 6, 6, 6, 6, 10, 0, 11, 7, 8, 6,
+ 6, 6, 6, 6, 5, 7, 6, 2, 3, 4,
+ 1, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 1, 1, 3, 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, 3, 1, 1, 4, 1, 1, 1,
- 1, 4, 4, 4, 4, 1, 4, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 4, 1, 1,
- 4, 1, 1, 1, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 1, 1, 1, 4, 6, 1, 6, 6, 7, 6,
-
- 6, 6, 6, 6, 8, 6, 6, 6, 9, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 4, 1, 1, 5, 1, 1, 1,
+ 1, 5, 5, 5, 5, 6, 5, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 5, 1, 1,
+ 5, 1, 1, 1, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 1, 1, 1, 5, 8, 1, 8, 8, 9, 8,
+
+ 10, 8, 8, 8, 11, 8, 8, 8, 12, 13,
+ 14, 15, 8, 8, 16, 17, 18, 8, 8, 8,
+ 8, 8, 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,
@@ -411,35 +413,48 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[10] =
+static yyconst flex_int32_t yy_meta[19] =
{ 0,
- 1, 2, 1, 1, 3, 3, 3, 3, 3
+ 1, 2, 1, 1, 1, 1, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3
} ;
-static yyconst flex_int16_t yy_base[19] =
+static yyconst flex_int16_t yy_base[35] =
{ 0,
- 0, 0, 19, 20, 15, 20, 12, 0, 9, 12,
- 20, 9, 0, 5, 0, 20, 9, 8
+ 0, 0, 44, 45, 17, 39, 45, 15, 0, 29,
+ 32, 22, 29, 24, 21, 33, 45, 29, 19, 0,
+ 18, 23, 16, 15, 0, 24, 16, 0, 0, 0,
+ 0, 45, 26, 25
} ;
-static yyconst flex_int16_t yy_def[19] =
+static yyconst flex_int16_t yy_def[35] =
{ 0,
- 16, 1, 16, 16, 17, 16, 16, 18, 18, 17,
- 16, 16, 18, 18, 18, 0, 16, 16
+ 32, 1, 32, 32, 32, 33, 32, 32, 34, 34,
+ 34, 34, 34, 34, 32, 33, 32, 32, 32, 34,
+ 34, 34, 34, 34, 34, 32, 34, 34, 34, 34,
+ 34, 0, 32, 32
} ;
-static yyconst flex_int16_t yy_nxt[30] =
+static yyconst flex_int16_t yy_nxt[64] =
{ 0,
- 4, 4, 5, 6, 7, 8, 8, 8, 9, 10,
- 13, 10, 15, 12, 11, 14, 12, 11, 16, 3,
- 16, 16, 16, 16, 16, 16, 16, 16, 16
+ 4, 5, 5, 6, 7, 4, 8, 9, 9, 9,
+ 10, 11, 9, 9, 12, 13, 14, 9, 15, 15,
+ 18, 19, 15, 15, 18, 19, 16, 20, 16, 31,
+ 26, 30, 29, 28, 27, 26, 17, 25, 24, 23,
+ 22, 21, 17, 32, 3, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32
} ;
-static yyconst flex_int16_t yy_chk[30] =
+static yyconst flex_int16_t yy_chk[64] =
{ 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 17,
- 18, 17, 14, 12, 10, 9, 7, 5, 3, 16,
- 16, 16, 16, 16, 16, 16, 16, 16, 16
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 5, 5,
+ 8, 8, 15, 15, 19, 19, 33, 34, 33, 27,
+ 26, 24, 23, 22, 21, 18, 16, 14, 13, 12,
+ 11, 10, 6, 3, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32
} ;
static yy_state_type yy_last_accepting_state;
@@ -489,7 +504,7 @@ char *yytext;
void yyparse();
-#line 493 "engines/director/lingo/lingo-lex.cpp"
+#line 508 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -671,10 +686,10 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 42 "engines/director/lingo/lingo-lex.l"
+#line 44 "engines/director/lingo/lingo-lex.l"
-#line 678 "engines/director/lingo/lingo-lex.cpp"
+#line 693 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -727,13 +742,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 >= 17 )
+ if ( yy_current_state >= 33 )
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] != 20 );
+ while ( yy_base[yy_current_state] != 45 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -759,35 +774,66 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 44 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_MCI; }
+#line 46 "engines/director/lingo/lingo-lex.l"
+{ return OP_INTO; }
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 45 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+#line 47 "engines/director/lingo/lingo-lex.l"
+{ return FUNC_MCI; }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 46 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+#line 48 "engines/director/lingo/lingo-lex.l"
+{ return FUNC_PUT; }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 47 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+#line 49 "engines/director/lingo/lingo-lex.l"
+{ return FUNC_SET; }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 48 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return STRING; }
+#line 50 "engines/director/lingo/lingo-lex.l"
+{ return OP_TO; }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 50 "engines/director/lingo/lingo-lex.l"
+#line 52 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(yytext); return VAR; }
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 53 "engines/director/lingo/lingo-lex.l"
+{ yylval.f = atof(yytext); return FLOAT; }
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 54 "engines/director/lingo/lingo-lex.l"
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 55 "engines/director/lingo/lingo-lex.l"
+{ return *yytext; }
+ YY_BREAK
+case 10:
+/* rule 10 can match eol */
+YY_RULE_SETUP
+#line 56 "engines/director/lingo/lingo-lex.l"
+{ return '\n'; }
+ YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 57 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(yytext); return STRING; }
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 59 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 791 "engines/director/lingo/lingo-lex.cpp"
+#line 837 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1079,7 +1125,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 >= 17 )
+ if ( yy_current_state >= 33 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1107,11 +1153,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 >= 17 )
+ if ( yy_current_state >= 33 )
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 == 16);
+ yy_is_jam = (yy_current_state == 32);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1784,7 +1830,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 50 "engines/director/lingo/lingo-lex.l"
+#line 59 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 575d09e..cf1078e 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -35,17 +35,26 @@ void yyparse();
%}
variable [_[:alpha:]][_[:alnum:]]*
+constfloat [[:digit:]]+\.[[:digit:]]*
constinteger [[:digit:]]+
conststring \"[^\"\n]*\"
operator [-+*/%=^:,]
+newline [\n\r]+
%%
-mci { return FUNC_MCI; }
-{variable} { yylval.s = new Common::String(yytext); return VAR; }
-{constinteger} { yylval.i = strtol(yytext, NULL, 10); return INT; }
-{operator} { return *yytext; }
-{conststring} { yylval.s = new Common::String(yytext); return STRING; }
+into { return OP_INTO; }
+mci { return FUNC_MCI; }
+put { return FUNC_PUT; }
+set { return FUNC_SET; }
+to { return OP_TO; }
+
+{variable} { yylval.s = new Common::String(yytext); return VAR; }
+{constfloat} { yylval.f = atof(yytext); return FLOAT; }
+{constinteger} { yylval.i = strtol(yytext, NULL, 10); return INT; }
+{operator} { return *yytext; }
+{newline} { return '\n'; }
+{conststring} { yylval.s = new Common::String(yytext); return STRING; }
%%
Commit: 45a57ce9b7387d74db20d7c260495d7fa9466d7c
https://github.com/scummvm/scummvm/commit/45a57ce9b7387d74db20d7c260495d7fa9466d7c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Add support for '--' comments
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 0c1f023..1d22edb 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -71,10 +71,12 @@ Common::Error DirectorEngine::run() {
_lingo = new Lingo();
_lingo->parse("mci \"open MM\\T005045a.wav type WaveAudio alias T005045a\"");
+
#if 0
_lingo->parse("set x = 1\n\
- set y to 2\n\
- put 5 into z\n");
+ set y to 2 -- this set y to 4\n\
+ put 5 into z\n\
+-- some more\n");
#endif
_soundManager = new DirectorSound();
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 784e59d..57202f0 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 12
-#define YY_END_OF_BUFFER 13
+#define YY_NUM_RULES 13
+#define YY_END_OF_BUFFER 14
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,12 +373,12 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[33] =
+static yyconst flex_int16_t yy_accept[36] =
{ 0,
- 0, 0, 13, 12, 10, 12, 9, 8, 6, 6,
- 6, 6, 6, 6, 10, 0, 11, 7, 8, 6,
- 6, 6, 6, 6, 5, 7, 6, 2, 3, 4,
- 1, 0
+ 0, 0, 14, 13, 11, 13, 10, 10, 9, 7,
+ 7, 7, 7, 7, 7, 11, 0, 12, 1, 8,
+ 9, 7, 7, 7, 7, 7, 6, 1, 8, 7,
+ 3, 4, 5, 2, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -387,16 +387,16 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 3, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 4, 1, 1, 5, 1, 1, 1,
- 1, 5, 5, 5, 5, 6, 5, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 5, 1, 1,
- 5, 1, 1, 1, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 1, 1, 1, 5, 8, 1, 8, 8, 9, 8,
-
- 10, 8, 8, 8, 11, 8, 8, 8, 12, 13,
- 14, 15, 8, 8, 16, 17, 18, 8, 8, 8,
- 8, 8, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 5, 5, 5, 6, 7, 5, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 5, 1, 1,
+ 5, 1, 1, 1, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ 1, 1, 1, 5, 9, 1, 9, 9, 10, 9,
+
+ 11, 9, 9, 9, 12, 9, 9, 9, 13, 14,
+ 15, 16, 9, 9, 17, 18, 19, 9, 9, 9,
+ 9, 9, 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,
@@ -413,48 +413,48 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[19] =
+static yyconst flex_int32_t yy_meta[20] =
{ 0,
- 1, 2, 1, 1, 1, 1, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3
+ 1, 2, 3, 1, 1, 1, 1, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[35] =
+static yyconst flex_int16_t yy_base[39] =
{ 0,
- 0, 0, 44, 45, 17, 39, 45, 15, 0, 29,
- 32, 22, 29, 24, 21, 33, 45, 29, 19, 0,
- 18, 23, 16, 15, 0, 24, 16, 0, 0, 0,
- 0, 45, 26, 25
+ 0, 0, 49, 50, 18, 44, 50, 41, 15, 0,
+ 32, 35, 25, 32, 27, 22, 37, 50, 0, 32,
+ 19, 0, 21, 26, 19, 18, 0, 0, 26, 18,
+ 0, 0, 0, 0, 50, 27, 25, 31
} ;
-static yyconst flex_int16_t yy_def[35] =
+static yyconst flex_int16_t yy_def[39] =
{ 0,
- 32, 1, 32, 32, 32, 33, 32, 32, 34, 34,
- 34, 34, 34, 34, 32, 33, 32, 32, 32, 34,
- 34, 34, 34, 34, 34, 32, 34, 34, 34, 34,
- 34, 0, 32, 32
+ 35, 1, 35, 35, 35, 36, 35, 35, 35, 37,
+ 37, 37, 37, 37, 37, 35, 36, 35, 38, 35,
+ 35, 37, 37, 37, 37, 37, 37, 38, 35, 37,
+ 37, 37, 37, 37, 0, 35, 35, 35
} ;
-static yyconst flex_int16_t yy_nxt[64] =
+static yyconst flex_int16_t yy_nxt[70] =
{ 0,
- 4, 5, 5, 6, 7, 4, 8, 9, 9, 9,
- 10, 11, 9, 9, 12, 13, 14, 9, 15, 15,
- 18, 19, 15, 15, 18, 19, 16, 20, 16, 31,
- 26, 30, 29, 28, 27, 26, 17, 25, 24, 23,
- 22, 21, 17, 32, 3, 32, 32, 32, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
- 32, 32, 32
+ 4, 5, 5, 6, 7, 8, 4, 9, 10, 10,
+ 10, 11, 12, 10, 10, 13, 14, 15, 10, 16,
+ 16, 20, 21, 16, 16, 20, 21, 17, 22, 17,
+ 17, 28, 34, 29, 28, 33, 32, 31, 30, 29,
+ 18, 27, 26, 25, 24, 23, 19, 18, 35, 3,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35
} ;
-static yyconst flex_int16_t yy_chk[64] =
+static yyconst flex_int16_t yy_chk[70] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 5, 5,
- 8, 8, 15, 15, 19, 19, 33, 34, 33, 27,
- 26, 24, 23, 22, 21, 18, 16, 14, 13, 12,
- 11, 10, 6, 3, 32, 32, 32, 32, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
- 32, 32, 32
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 5,
+ 5, 9, 9, 16, 16, 21, 21, 36, 37, 36,
+ 36, 38, 30, 29, 38, 26, 25, 24, 23, 20,
+ 17, 15, 14, 13, 12, 11, 8, 6, 3, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+ 35, 35, 35, 35, 35, 35, 35, 35, 35
} ;
static yy_state_type yy_last_accepting_state;
@@ -742,13 +742,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 >= 33 )
+ if ( yy_current_state >= 36 )
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] != 45 );
+ while ( yy_base[yy_current_state] != 50 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -775,65 +775,70 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
#line 46 "engines/director/lingo/lingo-lex.l"
-{ return OP_INTO; }
+
YY_BREAK
case 2:
YY_RULE_SETUP
#line 47 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_MCI; }
+{ return OP_INTO; }
YY_BREAK
case 3:
YY_RULE_SETUP
#line 48 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_PUT; }
+{ return FUNC_MCI; }
YY_BREAK
case 4:
YY_RULE_SETUP
#line 49 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_SET; }
+{ return FUNC_PUT; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 50 "engines/director/lingo/lingo-lex.l"
-{ return OP_TO; }
+{ return FUNC_SET; }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 52 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+#line 51 "engines/director/lingo/lingo-lex.l"
+{ return OP_TO; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 53 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+{ yylval.s = new Common::String(yytext); return VAR; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 54 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 55 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 10:
-/* rule 10 can match eol */
YY_RULE_SETUP
#line 56 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ return *yytext; }
YY_BREAK
case 11:
+/* rule 11 can match eol */
YY_RULE_SETUP
#line 57 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return STRING; }
+{ return '\n'; }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 59 "engines/director/lingo/lingo-lex.l"
+#line 58 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(yytext); return STRING; }
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 60 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 837 "engines/director/lingo/lingo-lex.cpp"
+#line 842 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1125,7 +1130,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 >= 33 )
+ if ( yy_current_state >= 36 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1153,11 +1158,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 >= 33 )
+ if ( yy_current_state >= 36 )
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 == 32);
+ yy_is_jam = (yy_current_state == 35);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1830,7 +1835,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 59 "engines/director/lingo/lingo-lex.l"
+#line 60 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index cf1078e..c0d104f 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -43,6 +43,7 @@ newline [\n\r]+
%%
+--[^\r\n]*
into { return OP_INTO; }
mci { return FUNC_MCI; }
put { return FUNC_PUT; }
Commit: 4e2b3f449e3ad7b15842067ce4ec5907bb4165b2
https://github.com/scummvm/scummvm/commit/4e2b3f449e3ad7b15842067ce4ec5907bb4165b2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Moved func_mci() to a separate file
Changed paths:
A engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
engines/director/module.mk
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
new file mode 100644
index 0000000..641a617
--- /dev/null
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -0,0 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "engines/director/lingo/lingo.h"
+
+namespace Director {
+
+int Lingo::func_mci(Common::String *s) {
+ warning("STUB: mci(\"%s\")", s->c_str());
+
+ return 0;
+}
+
+}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 79b9531..343817c 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -107,7 +107,11 @@ extern int yylex();
extern int yyparse();
void yyerror(char *s) { error("%s", s); }
-int func_mci(Common::String *s);
+using namespace Director;
+
+namespace Director {
+extern Lingo *g_lingo;
+}
@@ -131,10 +135,10 @@ int func_mci(Common::String *s);
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 39 "engines/director/lingo/lingo-gr.y"
+#line 43 "engines/director/lingo/lingo-gr.y"
{ float f; int i; Common::String *s; }
/* Line 193 of yacc.c. */
-#line 138 "engines/director/lingo/lingo-gr.cpp"
+#line 142 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -147,7 +151,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 151 "engines/director/lingo/lingo-gr.cpp"
+#line 155 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -436,8 +440,8 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 62, 62, 63, 66, 67, 70, 71, 72, 73,
- 74, 75, 76, 77, 78, 79, 82, 83, 84, 85
+ 0, 66, 66, 67, 70, 71, 74, 75, 76, 77,
+ 78, 79, 80, 81, 82, 83, 86, 87, 88, 89
};
#endif
@@ -1359,83 +1363,83 @@ yyreduce:
switch (yyn)
{
case 4:
-#line 66 "engines/director/lingo/lingo-gr.y"
+#line 70 "engines/director/lingo/lingo-gr.y"
{ warning("%d", (yyvsp[(1) - (1)].i)); ;}
break;
case 5:
-#line 67 "engines/director/lingo/lingo-gr.y"
+#line 71 "engines/director/lingo/lingo-gr.y"
{ warning("%d", (yyvsp[(1) - (1)].i)); ;}
break;
case 6:
-#line 70 "engines/director/lingo/lingo-gr.y"
+#line 74 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); ;}
break;
case 7:
-#line 71 "engines/director/lingo/lingo-gr.y"
+#line 75 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = vars[*(yyvsp[(1) - (1)].s)]; delete (yyvsp[(1) - (1)].s); ;}
break;
case 8:
-#line 72 "engines/director/lingo/lingo-gr.y"
+#line 76 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(1) - (3)].i) + (yyvsp[(3) - (3)].i); ;}
break;
case 9:
-#line 73 "engines/director/lingo/lingo-gr.y"
+#line 77 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(1) - (3)].i) - (yyvsp[(3) - (3)].i); ;}
break;
case 10:
-#line 74 "engines/director/lingo/lingo-gr.y"
+#line 78 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(1) - (3)].i) * (yyvsp[(3) - (3)].i); ;}
break;
case 11:
-#line 75 "engines/director/lingo/lingo-gr.y"
+#line 79 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(1) - (3)].i) / (yyvsp[(3) - (3)].i); ;}
break;
case 12:
-#line 76 "engines/director/lingo/lingo-gr.y"
+#line 80 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(2) - (2)].i); ;}
break;
case 13:
-#line 77 "engines/director/lingo/lingo-gr.y"
+#line 81 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = -(yyvsp[(2) - (2)].i); ;}
break;
case 14:
-#line 78 "engines/director/lingo/lingo-gr.y"
+#line 82 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(2) - (3)].i); ;}
break;
case 16:
-#line 82 "engines/director/lingo/lingo-gr.y"
- { func_mci((yyvsp[(2) - (2)].s)); delete (yyvsp[(2) - (2)].s); ;}
+#line 86 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->func_mci((yyvsp[(2) - (2)].s)); delete (yyvsp[(2) - (2)].s); ;}
break;
case 17:
-#line 83 "engines/director/lingo/lingo-gr.y"
+#line 87 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = vars[*(yyvsp[(4) - (4)].s)] = (yyvsp[(2) - (4)].i); delete (yyvsp[(4) - (4)].s); ;}
break;
case 18:
-#line 84 "engines/director/lingo/lingo-gr.y"
+#line 88 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = vars[*(yyvsp[(2) - (4)].s)] = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
break;
case 19:
-#line 85 "engines/director/lingo/lingo-gr.y"
+#line 89 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = vars[*(yyvsp[(2) - (4)].s)] = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1439 "engines/director/lingo/lingo-gr.cpp"
+#line 1443 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1649,12 +1653,6 @@ yyreturn:
}
-#line 88 "engines/director/lingo/lingo-gr.y"
-
+#line 92 "engines/director/lingo/lingo-gr.y"
-int func_mci(Common::String *s) {
- warning("STUB: mci(\"%s\")", s->c_str());
-
- return 0;
-}
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 1cf31e0..ae10d1f 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -68,7 +68,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 39 "engines/director/lingo/lingo-gr.y"
+#line 43 "engines/director/lingo/lingo-gr.y"
{ float f; int i; Common::String *s; }
/* Line 1529 of yacc.c. */
#line 75 "engines/director/lingo/lingo-gr.hpp"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index af0ad42..f6968b8 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -32,7 +32,11 @@ extern int yylex();
extern int yyparse();
void yyerror(char *s) { error("%s", s); }
-int func_mci(Common::String *s);
+using namespace Director;
+
+namespace Director {
+extern Lingo *g_lingo;
+}
%}
@@ -79,16 +83,10 @@ expr: INT { $$ = $1; }
|
;
-func: FUNC_MCI STRING { func_mci($2); delete $2; }
+func: FUNC_MCI STRING { g_lingo->func_mci($2); delete $2; }
| FUNC_PUT expr OP_INTO VAR { $$ = vars[*$4] = $2; delete $4; }
| FUNC_SET VAR '=' expr { $$ = vars[*$2] = $4; delete $2; }
| FUNC_SET VAR OP_TO expr { $$ = vars[*$2] = $4; delete $2; }
;
%%
-
-int func_mci(Common::String *s) {
- warning("STUB: mci(\"%s\")", s->c_str());
-
- return 0;
-}
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 57202f0..1c69d3f 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -502,7 +502,7 @@ char *yytext;
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-gr.h"
-void yyparse();
+int yyparse();
#line 508 "engines/director/lingo/lingo-lex.cpp"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index c0d104f..7eb3810 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -30,7 +30,7 @@
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-gr.h"
-void yyparse();
+int yyparse();
%}
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 2bbf5f8..3c80608 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -24,6 +24,8 @@
namespace Director {
+Lingo *g_lingo;
+
struct EventHandlerType {
LEvent handler;
const char *name;
@@ -65,6 +67,8 @@ struct EventHandlerType {
};
Lingo::Lingo() {
+ g_lingo = this;
+
for (const EventHandlerType *t = &eventHanlerDescs[0]; t->handler != kEventNone; ++t)
_eventHandlerTypes[t->handler] = t->name;
}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 4cb175b..4f66cee 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -74,6 +74,8 @@ public:
int parse(char *code);
+ int func_mci(Common::String *s);
+
private:
Common::HashMap<uint32, const char *> _eventHandlerTypes;
};
diff --git a/engines/director/module.mk b/engines/director/module.mk
index de6a605..c6f1f02 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -8,6 +8,7 @@ MODULE_OBJS = \
score.o \
sound.o \
lingo/lingo.o \
+ lingo/lingo-funcs.o \
lingo/lingo-gr.o \
lingo/lingo-lex.o
Commit: df50e60b1a2f165988f45286f7b0d8e04ddece37
https://github.com/scummvm/scummvm/commit/df50e60b1a2f165988f45286f7b0d8e04ddece37
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: fixed String passing from lexer to parser
Changed paths:
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 1c69d3f..534a13c 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -831,7 +831,7 @@ YY_RULE_SETUP
case 12:
YY_RULE_SETUP
#line 58 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return STRING; }
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
case 13:
YY_RULE_SETUP
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 7eb3810..6d97d17 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -55,7 +55,7 @@ to { return OP_TO; }
{constinteger} { yylval.i = strtol(yytext, NULL, 10); return INT; }
{operator} { return *yytext; }
{newline} { return '\n'; }
-{conststring} { yylval.s = new Common::String(yytext); return STRING; }
+{conststring} { yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
%%
Commit: 75d759c4d8cc05131270c720d9e86692bd5af199
https://github.com/scummvm/scummvm/commit/75d759c4d8cc05131270c720d9e86692bd5af199
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implement MCI command parsing
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-funcs.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 1d22edb..8a7cf7e 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -70,7 +70,8 @@ Common::Error DirectorEngine::run() {
_lingo = new Lingo();
- _lingo->parse("mci \"open MM\\T005045a.wav type WaveAudio alias T005045a\"");
+ _lingo->parse("mci \"open MM\\T005045a.wav type WaveAudio alias T005045a\"\n\
+ mci \"play T005045a from 22710 to 32872\"");
#if 0
_lingo->parse("set x = 1\n\
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 641a617..cf48d66 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -24,8 +24,103 @@
namespace Director {
+enum MCITokenType {
+ kMCITokenNone,
+
+ kMCITokenOpen,
+ kMCITokenWait,
+ kMCITokenPlay,
+
+ kMCITokenType,
+ kMCITokenAlias,
+ kMCITokenBuffer,
+ kMCITokenFrom,
+ kMCITokenTo
+};
+
+struct MCIToken {
+ MCITokenType command;
+ MCITokenType flag;
+ const char *token;
+ int pos;
+} MCITokens[] = {
+ { kMCITokenNone, kMCITokenOpen, "open", 0 },
+ { kMCITokenOpen, kMCITokenType, "type", 1 },
+ { kMCITokenOpen, kMCITokenAlias, "alias", 2 },
+ { kMCITokenOpen, kMCITokenBuffer, "buffer", 3 },
+
+ { kMCITokenNone, kMCITokenPlay, "play", 0 },
+ { kMCITokenPlay, kMCITokenFrom, "from", 1 },
+ { kMCITokenPlay, kMCITokenTo, "to", 2 },
+
+ { kMCITokenNone, kMCITokenWait, "wait", 0 },
+
+ { kMCITokenNone, kMCITokenNone, 0, 0 }
+};
+
int Lingo::func_mci(Common::String *s) {
- warning("STUB: mci(\"%s\")", s->c_str());
+ Common::String params[5];
+ MCITokenType command = kMCITokenNone;
+
+ s->trim();
+ s->toLowercase();
+
+ MCITokenType state = kMCITokenNone;
+ Common::String token;
+ const char *ptr = s->c_str();
+ int respos = -1;
+
+ while (*ptr) {
+ while (*ptr && *ptr == ' ')
+ ptr++;
+
+ token.clear();
+
+ while (*ptr && *ptr != ' ')
+ token += *ptr++;
+
+ switch (state) {
+ case kMCITokenNone:
+ {
+ MCIToken *f = MCITokens;
+
+ while (f->token) {
+ if (command == f->command && token == f->token)
+ break;
+
+ f++;
+ }
+
+ if (command == kMCITokenNone) { // We caught command
+ command = f->flag; // Switching to processing this command parameters
+ } else if (f->flag == kMCITokenNone) { // Unmatched token, parsing as filename
+ if (!params[0].empty())
+ warning("Duplicate filename in MCI command: %s -> %s", params[0].c_str(), token.c_str());
+ params[0] = token;
+ } else {
+ state = f->flag;
+ respos = f->pos;
+ }
+ break;
+ }
+ default:
+ params[respos] = token;
+ state = kMCITokenNone;
+ break;
+ }
+
+ }
+
+ switch (command) {
+ case kMCITokenOpen:
+ warning("MCI open file: %s, type: %s, alias: %s buffer: %s", params[0].c_str(), params[1].c_str(), params[2].c_str(), params[3].c_str());
+ break;
+ case kMCITokenPlay:
+ warning("MCI play file: %s, from: %s, to: %s", params[0].c_str(), params[1].c_str(), params[2].c_str());
+ break;
+ default:
+ warning("Unhandled MCI command: %s", s->c_str());
+ }
return 0;
}
Commit: 106e629210f7fceeea765c0aea1062058e48eb78
https://github.com/scummvm/scummvm/commit/106e629210f7fceeea765c0aea1062058e48eb78
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Add support for boolean flags in MCI
Changed paths:
engines/director/lingo/lingo-funcs.cpp
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index cf48d66..1a87886 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -35,14 +35,15 @@ enum MCITokenType {
kMCITokenAlias,
kMCITokenBuffer,
kMCITokenFrom,
- kMCITokenTo
+ kMCITokenTo,
+ kMCITokenRepeat
};
struct MCIToken {
- MCITokenType command;
+ MCITokenType command; // Command this flag belongs to
MCITokenType flag;
const char *token;
- int pos;
+ int pos; // Position of parameter to store. 0 is always filename. Negative parameters mean boolean
} MCITokens[] = {
{ kMCITokenNone, kMCITokenOpen, "open", 0 },
{ kMCITokenOpen, kMCITokenType, "type", 1 },
@@ -52,6 +53,7 @@ struct MCIToken {
{ kMCITokenNone, kMCITokenPlay, "play", 0 },
{ kMCITokenPlay, kMCITokenFrom, "from", 1 },
{ kMCITokenPlay, kMCITokenTo, "to", 2 },
+ { kMCITokenPlay, kMCITokenRepeat, "repeat", -3 }, // This is boolean parameter
{ kMCITokenNone, kMCITokenWait, "wait", 0 },
@@ -93,13 +95,18 @@ int Lingo::func_mci(Common::String *s) {
if (command == kMCITokenNone) { // We caught command
command = f->flag; // Switching to processing this command parameters
- } else if (f->flag == kMCITokenNone) { // Unmatched token, parsing as filename
+ } else if (f->flag == kMCITokenNone) { // Unmatched token, storing as filename
if (!params[0].empty())
warning("Duplicate filename in MCI command: %s -> %s", params[0].c_str(), token.c_str());
params[0] = token;
- } else {
- state = f->flag;
- respos = f->pos;
+ } else { // This is normal parameter, storing next token to designated position
+ if (f->pos > 0) { // This is normal parameter
+ state = f->flag;
+ respos = f->pos;
+ } else { // This is boolean
+ params[-f->pos] = "true";
+ state = kMCITokenNone;
+ }
}
break;
}
@@ -116,7 +123,7 @@ int Lingo::func_mci(Common::String *s) {
warning("MCI open file: %s, type: %s, alias: %s buffer: %s", params[0].c_str(), params[1].c_str(), params[2].c_str(), params[3].c_str());
break;
case kMCITokenPlay:
- warning("MCI play file: %s, from: %s, to: %s", params[0].c_str(), params[1].c_str(), params[2].c_str());
+ warning("MCI play file: %s, from: %s, to: %s, repeat: %s", params[0].c_str(), params[1].c_str(), params[2].c_str(), params[3].c_str());
break;
default:
warning("Unhandled MCI command: %s", s->c_str());
Commit: 23b289f2f8298a17271574c75a3d84b85cc742ac
https://github.com/scummvm/scummvm/commit/23b289f2f8298a17271574c75a3d84b85cc742ac
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add support for trail sprites
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index a426e2b..3fb8e98 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -42,6 +42,7 @@ namespace Director {
Score::Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager) {
_surface = new Graphics::ManagedSurface;
+ _trailSurface = new Graphics::ManagedSurface;
_movieArchive = &movie;
_lingo = &lingo;
_soundManager = &soundManager;
@@ -90,15 +91,17 @@ Score::Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager) {
if (clutList.size() == 0)
warning("CLUT not found");
- //Common::SeekableReadStream *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]);
- //palette.loadPalette(*pal);
- //g_system->getPaletteManager()->setPalette(palette.getPalette(), 0, palette.getPaletteColorCount());
+ Common::SeekableReadStream *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]);
+ palette.loadPalette(*pal);
+ g_system->getPaletteManager()->setPalette(palette.getPalette(), 0, palette.getPaletteColorCount());
}
Score::~Score() {
_surface->free();
+ _trailSurface->free();
delete _surface;
+ delete _trailSurface;
_movieArchive->close();
delete _movieArchive;
@@ -434,12 +437,17 @@ Common::Rect Score::readRect(Common::SeekableReadStream &stream) {
void Score::startLoop() {
initGraphics(_movieRect.width(), _movieRect.height(), true);
_surface->create(_movieRect.width(), _movieRect.height());
+ _trailSurface->create(_movieRect.width(), _movieRect.height());
+ if (_stageColor == 0)
+ _trailSurface->clear(15);
+ else
+ _trailSurface->clear(_stageColor);
_currentFrame = 0;
_stopPlay = false;
_nextFrameTime = 0;
_lingo->processEvent(kEventStartMovie, 0);
- _frames[_currentFrame]->prepareFrame(*_movieArchive, *_surface, _movieRect);
+ _frames[_currentFrame]->prepareFrame(*_movieArchive, *_surface, *_trailSurface, _movieRect);
while (!_stopPlay && _currentFrame < _frames.size() - 2) {
update();
processEvents();
@@ -451,9 +459,9 @@ void Score::startLoop() {
void Score::update() {
if (g_system->getMillis() < _nextFrameTime)
return;
- //FIXME 0 - default white? (Still believe that last color in palette everywhere white)
- if (_stageColor == 0)
- _surface->clear(15);
+
+ _surface->clear();
+ _surface->copyFrom(*_trailSurface);
//Enter and exit from previous frame (Director 4)
_lingo->processEvent(kEventEnterFrame, _currentFrame);
@@ -470,7 +478,7 @@ void Score::update() {
//TODO Director 6 step: send prepareFrame event to all sprites and the script channel in upcoming frame
//_lingo->processEvent(kEventPrepareFrame, _currentFrame);
_currentFrame++;
- _frames[_currentFrame]->prepareFrame(*_movieArchive, *_surface, _movieRect);
+ _frames[_currentFrame]->prepareFrame(*_movieArchive, *_surface, *_trailSurface, _movieRect);
//Stage is drawn between the prepareFrame and enterFrame events (Lingo in a Nutshell)
byte tempo = _frames[_currentFrame]->_tempo;
@@ -673,8 +681,11 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
break;
case kSpritePositionFlags:
sprite._flags = stream.readUint16BE();
- sprite._ink = static_cast<inkType>(sprite._flags & 0x3f); //TODO more flags?
- sprite._trails = sprite._flags & 0x40;
+ sprite._ink = static_cast<inkType>(sprite._flags & 0x3f);
+ if (sprite._flags & 0x40)
+ sprite._trails = 1;
+ else
+ sprite._trails = 0;
fieldPosition += 2;
break;
case kSpritePositionCastId:
@@ -706,14 +717,15 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
}
}
-void Frame::prepareFrame(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect) {
- renderSprites(_movie, surface, movieRect);
- renderTrailSprites(_movie, surface, movieRect);
+void Frame::prepareFrame(Archive &_movie, Graphics::ManagedSurface &surface, Graphics::ManagedSurface &trailSurface, Common::Rect movieRect) {
+ renderSprites(_movie, surface, movieRect, false);
+ renderSprites(_movie, trailSurface, movieRect, true);
if (_transType != 0)
playTranisition();
if (_sound1 != 0 || _sound2 != 0) {
playSoundChannel();
}
+ g_system->copyRectToScreen(surface.getPixels(), surface.pitch, 0, 0, surface.getBounds().width(), surface.getBounds().height());
}
void Frame::playSoundChannel() {
@@ -725,10 +737,12 @@ void Frame::playTranisition() {
warning("STUB: playTranisition(%d, %d, %d)", _transType, _transFlags, _transChunkSize);
}
-void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect) {
+void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect, bool renderTrail) {
for (uint16 i = 0; i < CHANNEL_COUNT; i++) {
- //TODO if trails == 0 -> render as trail sprite
if (_sprites[i]->_enabled) {
+ if ((_sprites[i]->_trails == 0 && renderTrail) || (_sprites[i]->_trails == 1 && !renderTrail))
+ continue;
+
DIBDecoder img;
uint32 imgId = 1024 + _sprites[i]->_castId;
if (!_movie.hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
@@ -774,14 +788,6 @@ void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Co
}
}
}
- g_system->copyRectToScreen(surface.getPixels(), surface.pitch, 0, 0, surface.getBounds().width(), surface.getBounds().height());
-}
-
-void Frame::renderTrailSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect) {
- for (uint16 i = 0; i < CHANNEL_COUNT; i++) {
- if (_sprites[i]->_enabled && _sprites[i]->_trails != 0)
- warning("STUB: renderTrailSprites(%d)", i);
- }
}
void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
Commit: e51e28cf7ed0019922911140743da4c4aa0f461d
https://github.com/scummvm/scummvm/commit/e51e28cf7ed0019922911140743da4c4aa0f461d
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Parse transition flags
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 3fb8e98..86cd5c6 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -528,7 +528,8 @@ void Score::processEvents() {
}
Frame::Frame() {
- _transFlags = 0;
+ _transDuration = 0;
+ _transArea = 0;
_transChunkSize = 0;
_tempo = 0;
@@ -550,7 +551,8 @@ Frame::Frame() {
Frame::Frame(const Frame &frame) {
_actionId = frame._actionId;
- _transFlags = frame._transFlags;
+ _transArea = frame._transArea;
+ _transDuration = frame._transDuration;
_transType = frame._transType;
_transChunkSize = frame._transChunkSize;
_tempo = frame._tempo;
@@ -607,9 +609,15 @@ void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset,
_soundType1 = stream.readByte();
offset++;
break;
- case kTransFlagsPosition:
- _transFlags = stream.readByte();
+ case kTransFlagsPosition: {
+ uint8 transFlags = stream.readByte();
+ if (transFlags & 0x80)
+ _transArea = 1;
+ else
+ _transArea = 0;
+ _transDuration = transFlags & 0x7f;
offset++;
+ }
break;
case kTransChunkSizePosition:
_transChunkSize = stream.readByte();
@@ -721,7 +729,7 @@ void Frame::prepareFrame(Archive &_movie, Graphics::ManagedSurface &surface, Gra
renderSprites(_movie, surface, movieRect, false);
renderSprites(_movie, trailSurface, movieRect, true);
if (_transType != 0)
- playTranisition();
+ playTransition();
if (_sound1 != 0 || _sound2 != 0) {
playSoundChannel();
}
@@ -733,8 +741,8 @@ void Frame::playSoundChannel() {
debug(0, "Sound1 %d", _sound1);
}
-void Frame::playTranisition() {
- warning("STUB: playTranisition(%d, %d, %d)", _transType, _transFlags, _transChunkSize);
+void Frame::playTransition() {
+ warning("STUB: playTransition(%d, %d, %d)", _transType, _transDuration, _transChunkSize);
}
void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect, bool renderTrail) {
diff --git a/engines/director/score.h b/engines/director/score.h
index b68cc40..1b64cca 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -234,20 +234,20 @@ public:
~Frame();
Frame(const Frame &frame);
void readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
- void prepareFrame(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect);
+ void prepareFrame(Archive &_movie, Graphics::ManagedSurface &surface, Graphics::ManagedSurface &trailSurface, Common::Rect movieRect);
uint16 getSpriteIDFromPos(Common::Point pos);
private:
- void playTranisition();
+ void playTransition();
void playSoundChannel();
- void renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect);
- void renderTrailSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect);
+ void renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect, bool renderTrail);
void readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
void readMainChannels(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
void drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
void drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
public:
uint8 _actionId;
- uint8 _transFlags;
+ uint8 _transDuration;
+ uint8 _transArea; //1 - Whole Stage, 0 - Changing Area
uint8 _transChunkSize;
transitionType _transType;
uint8 _tempo;
@@ -311,6 +311,7 @@ private:
uint16 _stageColor;
Archive *_movieArchive;
Graphics::ManagedSurface *_surface;
+ Graphics::ManagedSurface *_trailSurface;
Lingo *_lingo;
DirectorSound *_soundManager;
};
Commit: 055fb9e1bf62dd721de87d5e73ea5b351660f7f3
https://github.com/scummvm/scummvm/commit/055fb9e1bf62dd721de87d5e73ea5b351660f7f3
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Handle cover up/down transitions
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 86cd5c6..77cf084 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -729,7 +729,8 @@ void Frame::prepareFrame(Archive &_movie, Graphics::ManagedSurface &surface, Gra
renderSprites(_movie, surface, movieRect, false);
renderSprites(_movie, trailSurface, movieRect, true);
if (_transType != 0)
- playTransition();
+ //TODO Handle changing area case
+ playTransition(surface, movieRect);
if (_sound1 != 0 || _sound2 != 0) {
playSoundChannel();
}
@@ -741,8 +742,40 @@ void Frame::playSoundChannel() {
debug(0, "Sound1 %d", _sound1);
}
-void Frame::playTransition() {
- warning("STUB: playTransition(%d, %d, %d)", _transType, _transDuration, _transChunkSize);
+void Frame::playTransition(Graphics::ManagedSurface &frameSurface, Common::Rect transRect) {
+ uint16 duration = _transDuration * 250; // _transDuration in 1/4 of sec
+ duration = (duration == 0 ? 250 : duration); // director support transition duration = 0, but animation play like value = 1, idk.
+ uint16 stepDuration = duration / _transChunkSize;
+ uint16 steps = duration / stepDuration;
+
+ switch (_transType) {
+ case kTransCoverDown: {
+ uint16 stepSize = transRect.height() / steps;
+ Common::Rect r = transRect;
+ for (uint16 i = 1; i < steps; i++) {
+ r.setHeight(stepSize * i);
+ g_system->delayMillis(stepDuration);
+ g_system->copyRectToScreen(frameSurface.getPixels(), frameSurface.pitch, 0, 0, r.width(), r.height());
+ g_system->updateScreen();
+ }
+ }
+ break;
+ case kTransCoverUp: {
+ uint16 stepSize = transRect.height() / steps;
+ Common::Rect r = transRect;
+ for (uint16 i = 1; i < steps; i++) {
+ r.setHeight(stepSize*i);
+ g_system->delayMillis(stepDuration);
+ g_system->copyRectToScreen(frameSurface.getPixels(), frameSurface.pitch, 0, transRect.height() - stepSize * i, r.width(), r.height());
+ g_system->updateScreen();
+ }
+ }
+ break;
+ default:
+ warning("Unhandled transition type %d", _transType);
+ break;
+
+ }
}
void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect, bool renderTrail) {
diff --git a/engines/director/score.h b/engines/director/score.h
index 1b64cca..f9293f0 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -237,7 +237,7 @@ public:
void prepareFrame(Archive &_movie, Graphics::ManagedSurface &surface, Graphics::ManagedSurface &trailSurface, Common::Rect movieRect);
uint16 getSpriteIDFromPos(Common::Point pos);
private:
- void playTransition();
+ void playTransition(Graphics::ManagedSurface &frameSurface, Common::Rect transRect);
void playSoundChannel();
void renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect, bool renderTrail);
void readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
Commit: 487ce6a02c2aab7870dd64b01e25851d11812e87
https://github.com/scummvm/scummvm/commit/487ce6a02c2aab7870dd64b01e25851d11812e87
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Read palette info, handle wait sound events
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 77cf084..08f881e 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -497,9 +497,17 @@ void Score::update() {
} else if (tempo == 128) {
//TODO Wait for Click/Key
} else if (tempo == 135) {
- //TODO Wait for sound channel 1
+ //Wait for sound channel 1
+ while (_soundManager->isChannelActive(1)) {
+ processEvents();
+ g_system->delayMillis(10);
+ }
} else if (tempo == 134) {
- //TODO Wait for sound channel 2
+ //Wait for sound channel 2
+ while (_soundManager->isChannelActive(2)) {
+ processEvents();
+ g_system->delayMillis(10);
+ }
}
}
_nextFrameTime = g_system->getMillis() + (float)_currentFrameRate / 60 * 1000;
@@ -562,6 +570,7 @@ Frame::Frame(const Frame &frame) {
_soundType2 = frame._soundType2;
_skipFrameFlag = frame._skipFrameFlag;
_blend = frame._blend;
+ _palette = new PaletteInfo();
_sprites.resize(CHANNEL_COUNT);
for (uint16 i = 0; i < CHANNEL_COUNT; i++) {
@@ -652,8 +661,8 @@ void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset,
offset += 1;
break;
case kPaletePosition:
- //TODO palette channel
- stream.skip(16);
+ if (stream.readUint16LE())
+ readPaletteInfo(stream);
offset += 16;
default:
offset++;
@@ -663,6 +672,14 @@ void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset,
}
}
}
+void Frame::readPaletteInfo(Common::SeekableReadStream &stream) {
+ _palette->firstColor = stream.readByte();
+ _palette->lastColor = stream.readByte();
+ _palette->flags = stream.readByte();
+ _palette->speed = stream.readByte();
+ _palette->frameCount = stream.readUint16LE();
+ stream.skip(8); //unknown
+}
void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size) {
uint16 spritePosition = (offset - 32) / 16;
diff --git a/engines/director/score.h b/engines/director/score.h
index f9293f0..944a7e4 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -213,6 +213,14 @@ struct CastInfo {
Common::String type;
};
+struct PaletteInfo {
+ uint8 firstColor;
+ uint8 lastColor;
+ uint8 flags;
+ uint8 speed;
+ uint16 frameCount;
+};
+
class Sprite {
public:
Sprite();
@@ -240,6 +248,7 @@ private:
void playTransition(Graphics::ManagedSurface &frameSurface, Common::Rect transRect);
void playSoundChannel();
void renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect, bool renderTrail);
+ void readPaletteInfo(Common::SeekableReadStream &stream);
void readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
void readMainChannels(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
void drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
@@ -250,6 +259,7 @@ public:
uint8 _transArea; //1 - Whole Stage, 0 - Changing Area
uint8 _transChunkSize;
transitionType _transType;
+ PaletteInfo *_palette;
uint8 _tempo;
uint16 _sound1;
Commit: 82094ed5c99bc96418efdde1b75018482c61e888
https://github.com/scummvm/scummvm/commit/82094ed5c99bc96418efdde1b75018482c61e888
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Process events in transitions
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 08f881e..9639285 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -447,7 +447,7 @@ void Score::startLoop() {
_nextFrameTime = 0;
_lingo->processEvent(kEventStartMovie, 0);
- _frames[_currentFrame]->prepareFrame(*_movieArchive, *_surface, *_trailSurface, _movieRect);
+ _frames[_currentFrame]->prepareFrame(this);
while (!_stopPlay && _currentFrame < _frames.size() - 2) {
update();
processEvents();
@@ -478,7 +478,7 @@ void Score::update() {
//TODO Director 6 step: send prepareFrame event to all sprites and the script channel in upcoming frame
//_lingo->processEvent(kEventPrepareFrame, _currentFrame);
_currentFrame++;
- _frames[_currentFrame]->prepareFrame(*_movieArchive, *_surface, *_trailSurface, _movieRect);
+ _frames[_currentFrame]->prepareFrame(this);
//Stage is drawn between the prepareFrame and enterFrame events (Lingo in a Nutshell)
byte tempo = _frames[_currentFrame]->_tempo;
@@ -742,16 +742,16 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
}
}
-void Frame::prepareFrame(Archive &_movie, Graphics::ManagedSurface &surface, Graphics::ManagedSurface &trailSurface, Common::Rect movieRect) {
- renderSprites(_movie, surface, movieRect, false);
- renderSprites(_movie, trailSurface, movieRect, true);
+void Frame::prepareFrame(Score *score) {
+ renderSprites(*score->_movieArchive, *score->_surface, score->_movieRect, false);
+ renderSprites(*score->_movieArchive, *score->_trailSurface, score->_movieRect, true);
if (_transType != 0)
//TODO Handle changing area case
- playTransition(surface, movieRect);
+ playTransition(score);
if (_sound1 != 0 || _sound2 != 0) {
playSoundChannel();
}
- g_system->copyRectToScreen(surface.getPixels(), surface.pitch, 0, 0, surface.getBounds().width(), surface.getBounds().height());
+ g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, score->_surface->getBounds().width(), score->_surface->getBounds().height());
}
void Frame::playSoundChannel() {
@@ -759,7 +759,7 @@ void Frame::playSoundChannel() {
debug(0, "Sound1 %d", _sound1);
}
-void Frame::playTransition(Graphics::ManagedSurface &frameSurface, Common::Rect transRect) {
+void Frame::playTransition(Score *score) {
uint16 duration = _transDuration * 250; // _transDuration in 1/4 of sec
duration = (duration == 0 ? 250 : duration); // director support transition duration = 0, but animation play like value = 1, idk.
uint16 stepDuration = duration / _transChunkSize;
@@ -767,23 +767,25 @@ void Frame::playTransition(Graphics::ManagedSurface &frameSurface, Common::Rect
switch (_transType) {
case kTransCoverDown: {
- uint16 stepSize = transRect.height() / steps;
- Common::Rect r = transRect;
+ uint16 stepSize = score->_movieRect.height() / steps;
+ Common::Rect r = score->_movieRect;
for (uint16 i = 1; i < steps; i++) {
r.setHeight(stepSize * i);
g_system->delayMillis(stepDuration);
- g_system->copyRectToScreen(frameSurface.getPixels(), frameSurface.pitch, 0, 0, r.width(), r.height());
+ score->processEvents();
+ g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height());
g_system->updateScreen();
}
}
break;
case kTransCoverUp: {
- uint16 stepSize = transRect.height() / steps;
- Common::Rect r = transRect;
+ uint16 stepSize = score->_movieRect.height() / steps;
+ Common::Rect r = score->_movieRect;
for (uint16 i = 1; i < steps; i++) {
r.setHeight(stepSize*i);
g_system->delayMillis(stepDuration);
- g_system->copyRectToScreen(frameSurface.getPixels(), frameSurface.pitch, 0, transRect.height() - stepSize * i, r.width(), r.height());
+ score->processEvents();
+ g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, score->_movieRect.height() - stepSize * i, r.width(), r.height());
g_system->updateScreen();
}
}
diff --git a/engines/director/score.h b/engines/director/score.h
index 944a7e4..885df97 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -34,6 +34,7 @@ namespace Director {
class Lingo;
class DirectorSound;
+class Score;
#define CHANNEL_COUNT 24
@@ -242,10 +243,10 @@ public:
~Frame();
Frame(const Frame &frame);
void readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
- void prepareFrame(Archive &_movie, Graphics::ManagedSurface &surface, Graphics::ManagedSurface &trailSurface, Common::Rect movieRect);
+ void prepareFrame(Score *score);
uint16 getSpriteIDFromPos(Common::Point pos);
private:
- void playTransition(Graphics::ManagedSurface &frameSurface, Common::Rect transRect);
+ void playTransition(Score *score);
void playSoundChannel();
void renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect, bool renderTrail);
void readPaletteInfo(Common::SeekableReadStream &stream);
@@ -279,9 +280,9 @@ public:
~Score();
static Common::Rect readRect(Common::SeekableReadStream &stream);
void startLoop();
-
-private:
void processEvents();
+private:
+
void update();
void readVersion(uint32 rid);
void loadConfig(Common::SeekableReadStream &stream);
@@ -302,6 +303,10 @@ public:
Common::HashMap<uint16, Common::String> _labels;
Common::HashMap<uint16, Common::String> _actions;
Common::HashMap<uint16, Common::String> _fontMap;
+ Graphics::ManagedSurface *_surface;
+ Graphics::ManagedSurface *_trailSurface;
+ Archive *_movieArchive;
+ Common::Rect _movieRect;
private:
uint16 _versionMinor;
uint16 _versionMajor;
@@ -317,11 +322,7 @@ private:
uint32 _flags;
bool _stopPlay;
uint16 _castArrayEnd;
- Common::Rect _movieRect;
uint16 _stageColor;
- Archive *_movieArchive;
- Graphics::ManagedSurface *_surface;
- Graphics::ManagedSurface *_trailSurface;
Lingo *_lingo;
DirectorSound *_soundManager;
};
Commit: 2387e721040335db27a1f8f46a73cdf047c27a6e
https://github.com/scummvm/scummvm/commit/2387e721040335db27a1f8f46a73cdf047c27a6e
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Play sound from MCI command
Changed paths:
engines/director/director.cpp
engines/director/director.h
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
engines/director/sound.cpp
engines/director/sound.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 8a7cf7e..577b15d 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -68,8 +68,8 @@ DirectorEngine::~DirectorEngine() {
Common::Error DirectorEngine::run() {
debug("Starting v%d Director game", getVersion());
- _lingo = new Lingo();
-
+ _lingo = new Lingo(this);
+ _soundManager = new DirectorSound();
_lingo->parse("mci \"open MM\\T005045a.wav type WaveAudio alias T005045a\"\n\
mci \"play T005045a from 22710 to 32872\"");
@@ -80,7 +80,7 @@ Common::Error DirectorEngine::run() {
-- some more\n");
#endif
- _soundManager = new DirectorSound();
+
//FIXME
_mainArchive = new RIFFArchive();
diff --git a/engines/director/director.h b/engines/director/director.h
index 9750ad9..fa854f1 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -26,7 +26,7 @@
#include "common/scummsys.h"
#include "engines/engine.h"
-
+#include "engines/director/sound.h"
class OSystem;
namespace Common {
@@ -42,7 +42,7 @@ enum DirectorGameID {
class Archive;
struct DirectorGameDescription;
class Lingo;
-class DirectorSound;
+
class DirectorEngine : public ::Engine {
public:
@@ -56,7 +56,7 @@ public:
Common::Platform getPlatform() const;
Common::Language getLanguage() const;
Common::String getEXEName() const;
-
+ DirectorSound *getSoundManager() const { return _soundManager; }
bool hasFeature(EngineFeature f) const;
protected:
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 1a87886..059671b 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -21,9 +21,10 @@
*/
#include "engines/director/lingo/lingo.h"
+#include "common/file.h"
+#include "audio/decoders/wave.h"
namespace Director {
-
enum MCITokenType {
kMCITokenNone,
@@ -119,11 +120,31 @@ int Lingo::func_mci(Common::String *s) {
}
switch (command) {
- case kMCITokenOpen:
+ case kMCITokenOpen: {
warning("MCI open file: %s, type: %s, alias: %s buffer: %s", params[0].c_str(), params[1].c_str(), params[2].c_str(), params[3].c_str());
+ Common::File *file = new Common::File();
+ if (!file->open(params[0])) {
+ warning("Failed to open %s", params[0].c_str());
+ delete file;
+ return 0;
+ }
+ if (params[1] == "waveaudio") {
+ Audio::AudioStream *sound = Audio::makeWAVStream(file, DisposeAfterUse::YES);
+ _audioAliases[params[2]] = sound;
+ }
+ else
+ warning("Unhandled audio type %s", params[2].c_str());
+ }
break;
- case kMCITokenPlay:
+ case kMCITokenPlay: {
warning("MCI play file: %s, from: %s, to: %s, repeat: %s", params[0].c_str(), params[1].c_str(), params[2].c_str(), params[3].c_str());
+ if (!_audioAliases.contains(params[0])) {
+ warning("Unknown alias %s", params[0].c_str());
+ return 0;
+ }
+ //TODO seek
+ _vm->getSoundManager()->playMCI(*_audioAliases[params[0]]);
+ }
break;
default:
warning("Unhandled MCI command: %s", s->c_str());
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 3c80608..7296e74 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -66,7 +66,7 @@ struct EventHandlerType {
{ kEventNone, 0 },
};
-Lingo::Lingo() {
+Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
g_lingo = this;
for (const EventHandlerType *t = &eventHanlerDescs[0]; t->handler != kEventNone; ++t)
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 4f66cee..4f7f925 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -25,6 +25,10 @@
#include "common/debug.h"
#include "common/hashmap.h"
+#include "common/hash-str.h"
+#include "audio/audiostream.h"
+#include "common/str.h"
+#include "engines/director/director.h"
namespace Director {
@@ -67,7 +71,7 @@ enum LEvent {
class Lingo {
public:
- Lingo();
+ Lingo(DirectorEngine *vm);
~Lingo();
void processEvent(LEvent event, int entityId);
@@ -78,6 +82,8 @@ public:
private:
Common::HashMap<uint32, const char *> _eventHandlerTypes;
+ Common::HashMap<Common::String, Audio::AudioStream *> _audioAliases;
+ DirectorEngine *_vm;
};
} // End of namespace Director
diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index 8c757e2..ea8b78e 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -32,6 +32,7 @@ namespace Director {
DirectorSound::DirectorSound() {
_sound1 = new Audio::SoundHandle();
_sound2 = new Audio::SoundHandle();
+ _scriptSound = new Audio::SoundHandle();
_mixer = g_system->getMixer();
}
@@ -66,6 +67,10 @@ void DirectorSound::playAIFF(Common::String filename, uint8 soundChannel) {
_mixer->playStream(Audio::Mixer::kSFXSoundType, _sound2, sound);
}
+void DirectorSound::playMCI(Audio::AudioStream &stream) {
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, _scriptSound, &stream);
+}
+
bool DirectorSound::isChannelActive(uint8 channelID) {
if (channelID == 1) {
return _mixer->isSoundHandleActive(*_sound1);
diff --git a/engines/director/sound.h b/engines/director/sound.h
index 8f36a3e..3a56c98 100644
--- a/engines/director/sound.h
+++ b/engines/director/sound.h
@@ -34,7 +34,7 @@ class DirectorSound {
private:
Audio::SoundHandle *_sound1;
Audio::SoundHandle *_sound2;
-
+ Audio::SoundHandle *_scriptSound;
Audio::Mixer *_mixer;
public:
@@ -42,6 +42,7 @@ public:
void playWAV(Common::String filename, uint8 channelID);
void playAIFF(Common::String filename, uint8 channelID);
+ void playMCI(Audio::AudioStream &stream);
bool isChannelActive(uint8 channelID);
void stopSound();
};
Commit: bd05d98fa5a60b10831d0356d93a6c22755ddf5e
https://github.com/scummvm/scummvm/commit/bd05d98fa5a60b10831d0356d93a6c22755ddf5e
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add support for to/from MCI play options
Changed paths:
engines/director/lingo/lingo-funcs.cpp
engines/director/sound.cpp
engines/director/sound.h
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 059671b..6f4b1b2 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -142,8 +142,9 @@ int Lingo::func_mci(Common::String *s) {
warning("Unknown alias %s", params[0].c_str());
return 0;
}
- //TODO seek
- _vm->getSoundManager()->playMCI(*_audioAliases[params[0]]);
+ uint32 from = strtol(params[1].c_str(), 0, 10);
+ uint32 to = strtol(params[2].c_str(), 0, 10);
+ _vm->getSoundManager()->playMCI(*_audioAliases[params[0]], from, to);
}
break;
default:
diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index ea8b78e..5e32972 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -67,8 +67,10 @@ void DirectorSound::playAIFF(Common::String filename, uint8 soundChannel) {
_mixer->playStream(Audio::Mixer::kSFXSoundType, _sound2, sound);
}
-void DirectorSound::playMCI(Audio::AudioStream &stream) {
- _mixer->playStream(Audio::Mixer::kSFXSoundType, _scriptSound, &stream);
+void DirectorSound::playMCI(Audio::AudioStream &stream, uint32 from, uint32 to) {
+ Audio::SeekableAudioStream *seekStream = dynamic_cast<Audio::SeekableAudioStream *>(&stream);
+ Audio::SubSeekableAudioStream *subSeekStream = new Audio::SubSeekableAudioStream(seekStream, Audio::Timestamp(from, seekStream->getRate()), Audio::Timestamp(to, seekStream->getRate()));
+ _mixer->playStream(Audio::Mixer::kSFXSoundType, _scriptSound, subSeekStream);
}
bool DirectorSound::isChannelActive(uint8 channelID) {
diff --git a/engines/director/sound.h b/engines/director/sound.h
index 3a56c98..87fd04d 100644
--- a/engines/director/sound.h
+++ b/engines/director/sound.h
@@ -42,7 +42,7 @@ public:
void playWAV(Common::String filename, uint8 channelID);
void playAIFF(Common::String filename, uint8 channelID);
- void playMCI(Audio::AudioStream &stream);
+ void playMCI(Audio::AudioStream &stream, uint32 from, uint32 to);
bool isChannelActive(uint8 channelID);
void stopSound();
};
Commit: 82daeb9e62edb0901fe5b7dfb3f7197611fb7012
https://github.com/scummvm/scummvm/commit/82daeb9e62edb0901fe5b7dfb3f7197611fb7012
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add stub for storage code
Changed paths:
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
engines/director/score.cpp
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 7296e74..b17bb0d 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -76,6 +76,10 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
Lingo::~Lingo() {
}
+void Lingo::addCode(Common::String code, scriptType type, uint16 id) {
+ debug(0, "Add code %s for type %d with id %d", code.c_str(), type, id);
+}
+
void Lingo::processEvent(LEvent event, int entityId) {
if (!_eventHandlerTypes.contains(event))
error("processEvent: Unknown event %d for entity %d", event, entityId);
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 4f7f925..f7a25ea 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -29,6 +29,7 @@
#include "audio/audiostream.h"
#include "common/str.h"
#include "engines/director/director.h"
+#include "engines/director/score.h"
namespace Director {
@@ -74,6 +75,8 @@ public:
Lingo(DirectorEngine *vm);
~Lingo();
+ void addCode(Common::String code, scriptType type, uint16 id);
+
void processEvent(LEvent event, int entityId);
int parse(char *code);
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 9639285..00d12ad 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -252,6 +252,8 @@ void Score::loadActions(Common::SeekableReadStream &stream) {
}
Common::HashMap<uint16, Common::String>::iterator j;
+ for (j = _actions.begin(); j != _actions.end(); ++j)
+ _lingo->addCode(j->_value, kFrameScript, j->_key);
if (!ConfMan.getBool("dump_scripts"))
return;
Commit: c520b452475abd4584111d365dcd17738e20e6f0
https://github.com/scummvm/scummvm/commit/c520b452475abd4584111d365dcd17738e20e6f0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix Matte Ink.
Mask mode was not specified at the addSeed() time.
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 00d12ad..579eec1 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -871,7 +871,7 @@ void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Su
Graphics::Surface tmp;
tmp.copyFrom(sprite);
- Graphics::FloodFill ff(&tmp, *(byte *)tmp.getBasePtr(0, 0), 0);
+ Graphics::FloodFill ff(&tmp, *(byte *)tmp.getBasePtr(0, 0), 0, true);
for (int yy = 0; yy < tmp.h; yy++) {
ff.addSeed(0, yy);
Commit: d3b49ba5095af8af75555bd5609122ad2105f016
https://github.com/scummvm/scummvm/commit/d3b49ba5095af8af75555bd5609122ad2105f016
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Format code, send movie, sprite scripts to Lingo
Changed paths:
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index b17bb0d..3d166ac 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -76,7 +76,7 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
Lingo::~Lingo() {
}
-void Lingo::addCode(Common::String code, scriptType type, uint16 id) {
+void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
debug(0, "Add code %s for type %d with id %d", code.c_str(), type, id);
}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index f7a25ea..9fb024f 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -75,7 +75,7 @@ public:
Lingo(DirectorEngine *vm);
~Lingo();
- void addCode(Common::String code, scriptType type, uint16 id);
+ void addCode(Common::String code, ScriptType type, uint16 id);
void processEvent(LEvent event, int entityId);
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 579eec1..5bce536 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -263,7 +263,7 @@ void Score::loadActions(Common::SeekableReadStream &stream) {
}
}
-void Score::dumpScript(uint16 id, scriptType type, Common::String script) {
+void Score::dumpScript(uint16 id, ScriptType type, Common::String script) {
Common::DumpFile out;
Common::String typeName;
char buf[256];
@@ -297,6 +297,9 @@ void Score::loadCastInfo(Common::SeekableReadStream &stream, uint16 id) {
Common::Array<Common::String> castStrings = loadStrings(stream, entryType);
CastInfo *ci = new CastInfo();
ci->script = castStrings[0];
+ if (ci->script != "") {
+ _lingo->addCode(ci->script, kSpriteScript, id);
+ }
ci->name = getString(castStrings[1]);
ci->directory = getString(castStrings[2]);
ci->fileName = getString(castStrings[3]);
@@ -323,6 +326,9 @@ Common::String Score::getString(Common::String str) {
void Score::loadFileInfo(Common::SeekableReadStream &stream) {
Common::Array<Common::String> fileInfoStrings = loadStrings(stream, _flags);
_script = fileInfoStrings[0];
+ if (_script != "") {
+ _lingo->addCode(_script, kMovieScript, 0);
+ }
_changedBy = fileInfoStrings[1];
_createdBy = fileInfoStrings[2];
_directory = fileInfoStrings[3];
@@ -639,7 +645,7 @@ void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset,
offset++;
break;
case kTransTypePosition:
- _transType = static_cast<transitionType>(stream.readByte());
+ _transType = static_cast<TransitionType>(stream.readByte());
offset++;
break;
case kSound1Position:
@@ -708,7 +714,7 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
break;
case kSpritePositionFlags:
sprite._flags = stream.readUint16BE();
- sprite._ink = static_cast<inkType>(sprite._flags & 0x3f);
+ sprite._ink = static_cast<InkType>(sprite._flags & 0x3f);
if (sprite._flags & 0x40)
sprite._trails = 1;
else
@@ -853,7 +859,7 @@ void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Co
}
void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
- uint8 skipColor = 15; //FIXME is it always white (last entry in pallette) ?
+ uint8 skipColor = *(byte *)target.getBasePtr(0, 0); //FIXME is it always white (last entry in pallette) ?
for (int ii = 0; ii < sprite.h; ii++) {
const byte *src = (const byte *)sprite.getBasePtr(0, ii);
byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + ii);
diff --git a/engines/director/score.h b/engines/director/score.h
index 885df97..90226d7 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -38,7 +38,7 @@ class Score;
#define CHANNEL_COUNT 24
-enum castType {
+enum CastType {
kCastBitmap = 1,
kCastFilmLoop,
kCastText,
@@ -52,7 +52,7 @@ enum castType {
kCastScript
};
-enum spritePositions {
+enum SpritePosition {
kSpritePositionUnk1 = 0,
kSpritePositionEnabled,
kSpritePositionUnk2,
@@ -64,7 +64,7 @@ enum spritePositions {
kSpritePositionWidth = 14
};
-enum mainChannelsPosition {
+enum MainChannelsPosition {
kScriptIdPosition = 0,
kSoundType1Position,
kTransFlagsPosition,
@@ -79,7 +79,7 @@ enum mainChannelsPosition {
kPaletePosition = 15
};
-enum inkType {
+enum InkType {
kInkTypeCopy,
kInkTypeTransparent,
kInkTypeReverse,
@@ -101,13 +101,13 @@ enum inkType {
kInkTypeDark
};
-enum scriptType {
+enum ScriptType {
kMovieScript,
kSpriteScript,
kFrameScript
};
-enum transitionType {
+enum TransitionType {
kTransWipeRight = 1,
kTransWipeLeft,
kTransWipeDown,
@@ -163,7 +163,7 @@ enum transitionType {
};
struct Cast {
- castType type;
+ CastType type;
Common::Rect initialRect;
};
@@ -228,7 +228,7 @@ public:
Sprite(const Sprite &sprite);
bool _enabled;
byte _castId;
- inkType _ink;
+ InkType _ink;
uint16 _trails;
Cast *_cast;
uint16 _flags;
@@ -259,7 +259,7 @@ public:
uint8 _transDuration;
uint8 _transArea; //1 - Whole Stage, 0 - Changing Area
uint8 _transChunkSize;
- transitionType _transType;
+ TransitionType _transType;
PaletteInfo *_palette;
uint8 _tempo;
@@ -293,7 +293,7 @@ private:
void loadCastInfo(Common::SeekableReadStream &stream, uint16 id);
void loadFileInfo(Common::SeekableReadStream &stream);
void loadFontMap(Common::SeekableReadStream &stream);
- void dumpScript(uint16 id, scriptType type, Common::String script);
+ void dumpScript(uint16 id, ScriptType type, Common::String script);
Common::String getString(Common::String str);
Common::Array<Common::String> loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader = true);
public:
Commit: 16a2b7e7c3c89945c1e80702238e6cee5bbe4faa
https://github.com/scummvm/scummvm/commit/16a2b7e7c3c89945c1e80702238e6cee5bbe4faa
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add other cover transitions such as cover left, right, down right, down left, up right, up left
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 5bce536..4cbc4f2 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -790,7 +790,57 @@ void Frame::playTransition(Score *score) {
uint16 stepSize = score->_movieRect.height() / steps;
Common::Rect r = score->_movieRect;
for (uint16 i = 1; i < steps; i++) {
- r.setHeight(stepSize*i);
+ r.setHeight(stepSize * i);
+ g_system->delayMillis(stepDuration);
+ score->processEvents();
+ g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, score->_movieRect.height() - stepSize * i, r.width(), r.height());
+ g_system->updateScreen();
+ }
+ }
+ break;
+ case kTransCoverRight: {
+ uint16 stepSize = score->_movieRect.width() / steps;
+ Common::Rect r = score->_movieRect;
+ for (uint16 i = 1; i < steps; i++) {
+ r.setWidth(stepSize * i);
+ g_system->delayMillis(stepDuration);
+ score->processEvents();
+ g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height());
+ g_system->updateScreen();
+ }
+ }
+ break;
+ case kTransCoverLeft: {
+ uint16 stepSize = score->_movieRect.width() / steps;
+ Common::Rect r = score->_movieRect;
+ for (uint16 i = 1; i < steps; i++) {
+ r.setWidth(stepSize * i);
+ g_system->delayMillis(stepDuration);
+ score->processEvents();
+ g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, score->_movieRect.width() - stepSize * i, 0, r.width(), r.height());
+ g_system->updateScreen();
+ }
+ }
+ break;
+ case kTransCoverUpLeft: {
+ uint16 stepSize = score->_movieRect.width() / steps;
+ Common::Rect r = score->_movieRect;
+ for (uint16 i = 1; i < steps; i++) {
+ r.setWidth(stepSize * i);
+ r.setHeight(stepSize * i);
+ g_system->delayMillis(stepDuration);
+ score->processEvents();
+ g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, score->_movieRect.width() - stepSize * i, score->_movieRect.height() - stepSize * i, r.width(), r.height());
+ g_system->updateScreen();
+ }
+ }
+ break;
+ case kTransCoverUpRight: {
+ uint16 stepSize = score->_movieRect.width() / steps;
+ Common::Rect r = score->_movieRect;
+ for (uint16 i = 1; i < steps; i++) {
+ r.setWidth(stepSize * i);
+ r.setHeight(stepSize * i);
g_system->delayMillis(stepDuration);
score->processEvents();
g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, score->_movieRect.height() - stepSize * i, r.width(), r.height());
@@ -798,8 +848,34 @@ void Frame::playTransition(Score *score) {
}
}
break;
+ case kTransCoverDownLeft: {
+ uint16 stepSize = score->_movieRect.width() / steps;
+ Common::Rect r = score->_movieRect;
+ for (uint16 i = 1; i < steps; i++) {
+ r.setWidth(stepSize * i);
+ r.setHeight(stepSize * i);
+ g_system->delayMillis(stepDuration);
+ score->processEvents();
+ g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, score->_movieRect.width() - stepSize * i, 0, r.width(), r.height());
+ g_system->updateScreen();
+ }
+ }
+ break;
+ case kTransCoverDownRight: {
+ uint16 stepSize = score->_movieRect.width() / steps;
+ Common::Rect r = score->_movieRect;
+ for (uint16 i = 1; i < steps; i++) {
+ r.setWidth(stepSize * i);
+ r.setHeight(stepSize * i);
+ g_system->delayMillis(stepDuration);
+ score->processEvents();
+ g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height());
+ g_system->updateScreen();
+ }
+ }
+ break;
default:
- warning("Unhandled transition type %d", _transType);
+ warning("Unhandled transition type %d %d %d", _transType, duration, _transChunkSize);
break;
}
diff --git a/engines/director/score.h b/engines/director/score.h
index 90226d7..a05c6bb 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -130,10 +130,10 @@ enum TransitionType {
kTransRevealDownLeft,
kTransRevealLeft,
kTransRevealUpLeft,
- kTransDisolvePixelsFast,
- kTransDisolveBoxyRects,
- kTransDisolveBoxySquares,
- kTransDisolvePatterns,
+ kTransDissolvePixelsFast,
+ kTransDissolveBoxyRects,
+ kTransDissolveBoxySquares,
+ kTransDissolvePatterns,
kTransRandomRows,
kTransRandomColumns,
kTransCoverDown,
@@ -157,9 +157,9 @@ enum TransitionType {
kTransZoomOpen,
kTransZoomClose,
kTransVerticalBinds,
- kTransDisolveBitsTrans,
- kTransDisolvePixels,
- kTransDisolveBits
+ kTransDissolveBitsTrans,
+ kTransDissolvePixels,
+ kTransDissolveBits
};
struct Cast {
Commit: ddcaad4a11b8b9d542a01d2544283416a03ea80a
https://github.com/scummvm/scummvm/commit/ddcaad4a11b8b9d542a01d2544283416a03ea80a
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Parse common STXT scripts
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 4cbc4f2..16f85fc 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -83,13 +83,21 @@ Score::Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager) {
loadCastInfo(*_movieArchive->getResource(MKTAG('V','W','C','I'), *iterator), *iterator);
}
+ Common::Array<uint16> stxt = _movieArchive->getResourceIDList(MKTAG('S','T','X','T'));
+ if (stxt.size() > 0) {
+ Common::Array<uint16>::iterator iterator;
+ for (iterator = stxt.begin(); iterator != stxt.end(); ++iterator) {
+ loadScriptText(*_movieArchive->getResource(MKTAG('S','T','X','T'), *iterator));
+ }
+ }
+
DIBDecoder palette;
Common::Array<uint16> clutList = _movieArchive->getResourceIDList(MKTAG('C','L','U','T'));
if (clutList.size() > 1)
error("More than one palette was found");
if (clutList.size() == 0)
- warning("CLUT not found");
+ error("CLUT not found");
Common::SeekableReadStream *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]);
palette.loadPalette(*pal);
@@ -263,6 +271,22 @@ void Score::loadActions(Common::SeekableReadStream &stream) {
}
}
+void Score::loadScriptText(Common::SeekableReadStream &stream) {
+ /*uint32 unk1 = */ stream.readUint32BE();
+ uint32 strLen = stream.readUint32BE();
+ /*uin32 dataLen = */ stream.readUint32BE();
+ Common::String script;
+ for (uint32 i = 0; i < strLen; i++) {
+ byte ch = stream.readByte();
+ if (ch == 0x0d){
+ //in old Mac systems \r was the code for end-of-line instead.
+ ch = '\n';
+ }
+ script += ch;
+ }
+ _lingo->addCode(script, kMovieScript, 0);
+}
+
void Score::dumpScript(uint16 id, ScriptType type, Common::String script) {
Common::DumpFile out;
Common::String typeName;
diff --git a/engines/director/score.h b/engines/director/score.h
index a05c6bb..6156194 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -291,6 +291,7 @@ private:
void loadLabels(Common::SeekableReadStream &stream);
void loadActions(Common::SeekableReadStream &stream);
void loadCastInfo(Common::SeekableReadStream &stream, uint16 id);
+ void loadScriptText(Common::SeekableReadStream &stream);
void loadFileInfo(Common::SeekableReadStream &stream);
void loadFontMap(Common::SeekableReadStream &stream);
void dumpScript(uint16 id, ScriptType type, Common::String script);
Commit: 511c0d9f7b39964c683a5a071e6e2f44da105fa7
https://github.com/scummvm/scummvm/commit/511c0d9f7b39964c683a5a071e6e2f44da105fa7
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Dump movie scripts, and scripts from cast info
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 16f85fc..1240e9e 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -47,7 +47,7 @@ Score::Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager) {
_lingo = &lingo;
_soundManager = &soundManager;
_lingo->processEvent(kEventPrepareMovie, 0);
-
+ _movieScriptCount = 0;
assert(_movieArchive->hasResource(MKTAG('V','W','S','C'), 1024));
assert(_movieArchive->hasResource(MKTAG('V','W','C','F'), 1024));
assert(_movieArchive->hasResource(MKTAG('V','W','C','R'), 1024));
@@ -284,7 +284,11 @@ void Score::loadScriptText(Common::SeekableReadStream &stream) {
}
script += ch;
}
- _lingo->addCode(script, kMovieScript, 0);
+ _lingo->addCode(script, kMovieScript, _movieScriptCount);
+ if (ConfMan.getBool("dump_scripts")) {
+ dumpScript(_movieScriptCount, kMovieScript, script);
+ }
+ _movieScriptCount++;
}
void Score::dumpScript(uint16 id, ScriptType type, Common::String script) {
@@ -324,6 +328,10 @@ void Score::loadCastInfo(Common::SeekableReadStream &stream, uint16 id) {
if (ci->script != "") {
_lingo->addCode(ci->script, kSpriteScript, id);
}
+ if (!ConfMan.getBool("dump_scripts")) {
+ dumpScript(id, kSpriteScript, ci->script);
+ }
+
ci->name = getString(castStrings[1]);
ci->directory = getString(castStrings[2]);
ci->fileName = getString(castStrings[3]);
@@ -351,8 +359,12 @@ void Score::loadFileInfo(Common::SeekableReadStream &stream) {
Common::Array<Common::String> fileInfoStrings = loadStrings(stream, _flags);
_script = fileInfoStrings[0];
if (_script != "") {
- _lingo->addCode(_script, kMovieScript, 0);
+ _lingo->addCode(_script, kMovieScript, _movieScriptCount);
+ }
+ if (!ConfMan.getBool("dump_scripts")) {
+ dumpScript(_movieScriptCount, kMovieScript, _script);
}
+ _movieScriptCount++;
_changedBy = fileInfoStrings[1];
_createdBy = fileInfoStrings[2];
_directory = fileInfoStrings[3];
diff --git a/engines/director/score.h b/engines/director/score.h
index 6156194..ea24028 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -323,6 +323,7 @@ private:
uint32 _flags;
bool _stopPlay;
uint16 _castArrayEnd;
+ uint16 _movieScriptCount;
uint16 _stageColor;
Lingo *_lingo;
DirectorSound *_soundManager;
Commit: d90a8605d238786d53e645743d96b8c584ca3fb6
https://github.com/scummvm/scummvm/commit/d90a8605d238786d53e645743d96b8c584ca3fb6
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix sprite draw rects issues
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 1240e9e..2b619c3 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -940,14 +940,6 @@ void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Co
int y = _sprites[i]->_startPoint.y - regY + rectTop;
int height = _sprites[i]->_height;
int width = _sprites[i]->_width;
- if (x < 0) {
- width += x;
- x = 0;
- }
- if (y < 0) {
- height += y;
- y = 0;
- }
Common::Rect drawRect = Common::Rect(x, y, x + width, y + height);
_drawRects.push_back(drawRect);
@@ -971,7 +963,7 @@ void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Co
}
void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
- uint8 skipColor = *(byte *)target.getBasePtr(0, 0); //FIXME is it always white (last entry in pallette) ?
+ uint8 skipColor = 15; //FIXME is it always white (last entry in pallette) ?
for (int ii = 0; ii < sprite.h; ii++) {
const byte *src = (const byte *)sprite.getBasePtr(0, ii);
byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + ii);
Commit: 4b56951d3038836c32d8a1a0db3da856a720f1fc
https://github.com/scummvm/scummvm/commit/4b56951d3038836c32d8a1a0db3da856a720f1fc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Started work on converting Lingo into compiler
Changed paths:
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
engines/director/score.h
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 6f4b1b2..5422b3c 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -154,4 +154,22 @@ int Lingo::func_mci(Common::String *s) {
return 0;
}
+void Lingo::func_constpush() {
+}
+
+void Lingo::func_add() {
+}
+
+void Lingo::func_sub() {
+}
+
+void Lingo::func_mul() {
+}
+
+void Lingo::func_div() {
+}
+
+void Lingo::func_negate() {
+}
+
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 343817c..c34a25f 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -1374,7 +1374,7 @@ yyreduce:
case 6:
#line 74 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(1) - (1)].i); ;}
+ { (yyval.i) = g_lingo->code2(g_lingo->func_constpush, (inst)(yyvsp[(1) - (1)].i)); ;}
break;
case 7:
@@ -1384,22 +1384,22 @@ yyreduce:
case 8:
#line 76 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(1) - (3)].i) + (yyvsp[(3) - (3)].i); ;}
+ { g_lingo->code1(g_lingo->func_add); ;}
break;
case 9:
#line 77 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(1) - (3)].i) - (yyvsp[(3) - (3)].i); ;}
+ { g_lingo->code1(g_lingo->func_sub); ;}
break;
case 10:
#line 78 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(1) - (3)].i) * (yyvsp[(3) - (3)].i); ;}
+ { g_lingo->code1(g_lingo->func_mul); ;}
break;
case 11:
#line 79 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(1) - (3)].i) / (yyvsp[(3) - (3)].i); ;}
+ { g_lingo->code1(g_lingo->func_div); ;}
break;
case 12:
@@ -1409,7 +1409,7 @@ yyreduce:
case 13:
#line 81 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = -(yyvsp[(2) - (2)].i); ;}
+ { (yyval.i) = (yyvsp[(2) - (2)].i); g_lingo->code1(g_lingo->func_negate); ;}
break;
case 14:
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index f6968b8..14d80d3 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -71,14 +71,14 @@ statement: expr { warning("%d", $1); }
| func { warning("%d", $1); }
;
-expr: INT { $$ = $1; }
+expr: INT { $$ = g_lingo->code2(g_lingo->func_constpush, (inst)$1); }
| VAR { $$ = vars[*$1]; delete $1; }
- | expr '+' expr { $$ = $1 + $3; }
- | expr '-' expr { $$ = $1 - $3; }
- | expr '*' expr { $$ = $1 * $3; }
- | expr '/' expr { $$ = $1 / $3; }
+ | expr '+' expr { g_lingo->code1(g_lingo->func_add); }
+ | expr '-' expr { g_lingo->code1(g_lingo->func_sub); }
+ | expr '*' expr { g_lingo->code1(g_lingo->func_mul); }
+ | expr '/' expr { g_lingo->code1(g_lingo->func_div); }
| '+' expr %prec UNARY { $$ = $2; }
- | '-' expr %prec UNARY { $$ = -$2; }
+ | '-' expr %prec UNARY { $$ = $2; g_lingo->code1(g_lingo->func_negate); }
| '(' expr ')' { $$ = $2; }
|
;
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 534a13c..b639d53 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -1841,7 +1841,7 @@ void yyfree (void * ptr )
namespace Director {
-int Lingo::parse(char *code) {
+int Lingo::parse(const char *code) {
YY_BUFFER_STATE bp;
yy_delete_buffer(YY_CURRENT_BUFFER);
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 6d97d17..a206f96 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -61,7 +61,7 @@ to { return OP_TO; }
namespace Director {
-int Lingo::parse(char *code) {
+int Lingo::parse(const char *code) {
YY_BUFFER_STATE bp;
yy_delete_buffer(YY_CURRENT_BUFFER);
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 3d166ac..e338c3d 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -71,6 +71,8 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
for (const EventHandlerType *t = &eventHanlerDescs[0]; t->handler != kEventNone; ++t)
_eventHandlerTypes[t->handler] = t->name;
+
+ _currentScript = 0;
}
Lingo::~Lingo() {
@@ -78,6 +80,15 @@ Lingo::~Lingo() {
void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
debug(0, "Add code %s for type %d with id %d", code.c_str(), type, id);
+
+ if (_scripts[type].contains(id)) {
+ free(_scripts[type][id]);
+ }
+
+ _currentScript = new Common::Array<inst>();
+ _scripts[type][id] = _currentScript;
+
+ parse(code.c_str());
}
void Lingo::processEvent(LEvent event, int entityId) {
@@ -87,5 +98,4 @@ void Lingo::processEvent(LEvent event, int entityId) {
debug(0, "processEvent(%s) for %d", _eventHandlerTypes[event], entityId);
}
-
} // End of namespace Director
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 9fb024f..c819779 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -70,6 +70,9 @@ enum LEvent {
kEventStart
};
+typedef void (*inst)(void);
+#define STOP (inst)0
+
class Lingo {
public:
Lingo(DirectorEngine *vm);
@@ -79,13 +82,28 @@ public:
void processEvent(LEvent event, int entityId);
- int parse(char *code);
+ int parse(const char *code);
+
+ int code1(inst code) { _currentScript->push_back(code); return _currentScript->size(); }
+ int code2(inst code_1, inst code_2) { code1(code_1); return code1(code_2); }
+ int code3(inst code_1, inst code_2, inst code_3) { code1(code_1); code1(code_2); return code1(code_3); }
+public:
+ static void func_add();
+ static void func_sub();
+ static void func_mul();
+ static void func_div();
+ static void func_negate();
+ static void func_constpush();
int func_mci(Common::String *s);
private:
Common::HashMap<uint32, const char *> _eventHandlerTypes;
Common::HashMap<Common::String, Audio::AudioStream *> _audioAliases;
+
+ Common::HashMap<int32, Common::Array<inst> *> _scripts[kMaxScriptType];
+ Common::Array<inst> *_currentScript;
+
DirectorEngine *_vm;
};
diff --git a/engines/director/score.h b/engines/director/score.h
index ea24028..cd4985f 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -102,9 +102,10 @@ enum InkType {
};
enum ScriptType {
- kMovieScript,
- kSpriteScript,
- kFrameScript
+ kMovieScript = 0,
+ kSpriteScript = 1,
+ kFrameScript = 2,
+ kMaxScriptType = 2
};
enum TransitionType {
Commit: 7607ba926ce5d31bb877e8f4ca6fdceac7f492a4
https://github.com/scummvm/scummvm/commit/7607ba926ce5d31bb877e8f4ca6fdceac7f492a4
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Whitespace fixes
Changed paths:
engines/director/dib.cpp
engines/director/director.cpp
engines/director/director.h
engines/director/resource.cpp
engines/director/score.cpp
engines/director/score.h
engines/director/sound.cpp
engines/director/sound.h
diff --git a/engines/director/dib.cpp b/engines/director/dib.cpp
index 912f083..8c54ba5 100644
--- a/engines/director/dib.cpp
+++ b/engines/director/dib.cpp
@@ -59,10 +59,11 @@ void DIBDecoder::destroy() {
}
void DIBDecoder::loadPalette(Common::SeekableReadStream &stream) {
- uint16 steps = stream.size()/6;
+ uint16 steps = stream.size() / 6;
uint16 index = (steps * 3) - 1;
_paletteColorCount = steps;
_palette = new byte[index];
+
for (uint8 i = 0; i < steps; i++) {
_palette[index - 2] = stream.readByte();
stream.readByte();
@@ -98,9 +99,12 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
Common::SeekableSubReadStream subStream(&stream, 40, stream.size());
_codec = Image::createBitmapCodec(compression, width, height, bitsPerPixel);
+
if (!_codec)
return false;
+
_surface = _codec->decodeFrame(subStream);
+
return true;
}
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 577b15d..b7a6274 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -80,8 +80,6 @@ Common::Error DirectorEngine::run() {
-- some more\n");
#endif
-
-
//FIXME
_mainArchive = new RIFFArchive();
_mainArchive->openFile("bookshelf_example.mmm");
diff --git a/engines/director/director.h b/engines/director/director.h
index fa854f1..7e3117d 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -27,7 +27,6 @@
#include "engines/engine.h"
#include "engines/director/sound.h"
-class OSystem;
namespace Common {
class MacResManager;
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 2c90dfd..7d56fc0 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -159,6 +159,7 @@ uint32 Archive::convertTagToUppercase(uint32 tag) {
uint32 newTag = toupper(tag >> 24) << 24;
newTag |= toupper((tag >> 16) & 0xFF) << 16;
newTag |= toupper((tag >> 8) & 0xFF) << 8;
+
return newTag | toupper(tag & 0xFF);
}
@@ -195,6 +196,7 @@ bool MacArchive::openFile(const Common::String &fileName) {
for (uint32 j = 0; j < idArray.size(); j++) {
Resource &res = resMap[idArray[j]];
+
res.offset = res.size = 0; // unused
res.name = _resFork->getResName(tagArray[i], idArray[j]);
}
@@ -235,6 +237,7 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
uint32 cftcSize = stream->readUint32LE();
uint32 startPos = stream->pos();
stream->readUint32LE(); // unknown (always 0?)
+
while ((uint32)stream->pos() < startPos + cftcSize) {
uint32 tag = convertTagToUppercase(stream->readUint32BE());
@@ -244,11 +247,13 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
if (tag == 0)
break;
+
uint16 startResPos = stream->pos();
stream->seek(offset + 12);
Common::String name = "";
byte nameSize = stream->readByte();
+
if (nameSize) {
for (uint8 i = 0; i < nameSize; i++) {
name += stream->readByte();
@@ -321,6 +326,7 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
subStream.readUint32(); // size
uint32 rifxType = subStream.readUint32();
+
if (rifxType != MKTAG('M', 'V', '9', '3') && rifxType != MKTAG('A', 'P', 'P', 'L'))
return false;
@@ -393,6 +399,7 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
if (casRes) {
Common::SeekableSubReadStreamEndian casStream(stream, casRes->offset + 8, casRes->offset + 8 + casRes->size, _isBigEndian, DisposeAfterUse::NO);
casEntries.resize(casRes->size / 4);
+
for (uint32 i = 0; i < casEntries.size(); i++)
casEntries[i] = casStream.readUint32();
}
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 2b619c3..44242ec 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -40,7 +40,6 @@
namespace Director {
Score::Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager) {
-
_surface = new Graphics::ManagedSurface;
_trailSurface = new Graphics::ManagedSurface;
_movieArchive = &movie;
@@ -48,6 +47,7 @@ Score::Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager) {
_soundManager = &soundManager;
_lingo->processEvent(kEventPrepareMovie, 0);
_movieScriptCount = 0;
+
assert(_movieArchive->hasResource(MKTAG('V','W','S','C'), 1024));
assert(_movieArchive->hasResource(MKTAG('V','W','C','F'), 1024));
assert(_movieArchive->hasResource(MKTAG('V','W','C','R'), 1024));
@@ -77,15 +77,19 @@ Score::Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager) {
}
Common::Array<uint16> vwci = _movieArchive->getResourceIDList(MKTAG('V','W','C','I'));
+
if (vwci.size() > 0) {
Common::Array<uint16>::iterator iterator;
+
for (iterator = vwci.begin(); iterator != vwci.end(); ++iterator)
loadCastInfo(*_movieArchive->getResource(MKTAG('V','W','C','I'), *iterator), *iterator);
}
Common::Array<uint16> stxt = _movieArchive->getResourceIDList(MKTAG('S','T','X','T'));
+
if (stxt.size() > 0) {
Common::Array<uint16>::iterator iterator;
+
for (iterator = stxt.begin(); iterator != stxt.end(); ++iterator) {
loadScriptText(*_movieArchive->getResource(MKTAG('S','T','X','T'), *iterator));
}
@@ -96,18 +100,20 @@ Score::Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager) {
if (clutList.size() > 1)
error("More than one palette was found");
+
if (clutList.size() == 0)
error("CLUT not found");
Common::SeekableReadStream *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]);
+
palette.loadPalette(*pal);
g_system->getPaletteManager()->setPalette(palette.getPalette(), 0, palette.getPaletteColorCount());
-
}
Score::~Score() {
_surface->free();
_trailSurface->free();
+
delete _surface;
delete _trailSurface;
@@ -129,14 +135,17 @@ void Score::loadFrames(Common::SeekableReadStream &stream) {
size -= frameSize;
frameSize -= 2;
Frame *frame = new Frame(*_frames.back());
+
while (frameSize != 0) {
channelSize = stream.readByte() * 2;
channelOffset = stream.readByte() * 2;
frame->readChannel(stream, channelOffset, channelSize);
frameSize -= channelSize + 2;
}
+
_frames.push_back(frame);
}
+
//remove initial frame
_frames.remove_at(0);
}
@@ -156,15 +165,19 @@ void Score::loadConfig(Common::SeekableReadStream &stream) {
void Score::readVersion(uint32 rid) {
_versionMinor = rid & 0xffff;
_versionMajor = rid >> 16;
- debug("%d.%d", _versionMajor, _versionMinor);
+
+ debug("Version: %d.%d", _versionMajor, _versionMinor);
}
void Score::loadCastData(Common::SeekableReadStream &stream) {
for (uint16 id = _castArrayStart; id <= _castArrayEnd; id++) {
byte size = stream.readByte();
+
if (size == 0)
continue;
+
uint8 castType = stream.readByte();
+
switch (castType) {
case kCastBitmap:
_casts[id] = new BitmapCast(stream);
@@ -188,10 +201,12 @@ void Score::loadCastData(Common::SeekableReadStream &stream) {
break;
}
}
+
//Set cast pointers to sprites
for (uint16 i = 0; i < _frames.size(); i++) {
for (uint16 j = 0; j < _frames[i]->_sprites.size(); j++) {
byte castId = _frames[i]->_sprites[j]->_castId;
+
if (_casts.contains(castId))
_frames[i]->_sprites[j]->_cast = _casts.find(castId)->_value;
}
@@ -206,7 +221,6 @@ void Score::loadLabels(Common::SeekableReadStream &stream) {
uint16 stringPos = stream.readUint16BE() + offset;
for (uint16 i = 0; i < count; i++) {
-
uint16 nextFrame = stream.readUint16BE();
uint16 nextStringPos = stream.readUint16BE() + offset;
uint16 streamPos = stream.pos();
@@ -224,13 +238,13 @@ void Score::loadLabels(Common::SeekableReadStream &stream) {
}
Common::HashMap<uint16, Common::String>::iterator j;
+
for (j = _labels.begin(); j != _labels.end(); ++j) {
debug("Frame %d, Label %s", j->_key, j->_value.c_str());
}
}
void Score::loadActions(Common::SeekableReadStream &stream) {
-
uint16 count = stream.readUint16BE() + 1;
uint16 offset = count * 4 + 2;
@@ -239,7 +253,6 @@ void Score::loadActions(Common::SeekableReadStream &stream) {
uint16 stringPos = stream.readUint16BE() + offset;
for (uint16 i = 0; i < count; i++) {
-
uint16 nextId = stream.readByte();
/*byte subId = */ stream.readByte();
uint16 nextStringPos = stream.readUint16BE() + offset;
@@ -255,11 +268,13 @@ void Score::loadActions(Common::SeekableReadStream &stream) {
id = nextId;
stringPos = nextStringPos;
+
if (stringPos == stream.size())
break;
}
Common::HashMap<uint16, Common::String>::iterator j;
+
for (j = _actions.begin(); j != _actions.end(); ++j)
_lingo->addCode(j->_value, kFrameScript, j->_key);
@@ -276,18 +291,23 @@ void Score::loadScriptText(Common::SeekableReadStream &stream) {
uint32 strLen = stream.readUint32BE();
/*uin32 dataLen = */ stream.readUint32BE();
Common::String script;
+
for (uint32 i = 0; i < strLen; i++) {
byte ch = stream.readByte();
- if (ch == 0x0d){
+
+ if (ch == 0x0d) {
//in old Mac systems \r was the code for end-of-line instead.
ch = '\n';
}
script += ch;
}
+
_lingo->addCode(script, kMovieScript, _movieScriptCount);
+
if (ConfMan.getBool("dump_scripts")) {
dumpScript(_movieScriptCount, kMovieScript, script);
}
+
_movieScriptCount++;
}
@@ -314,6 +334,7 @@ void Score::dumpScript(uint16 id, ScriptType type, Common::String script) {
warning("Can not open dump file %s", buf);
return;
}
+
out.writeString(script);
out.flush();
@@ -324,10 +345,13 @@ void Score::loadCastInfo(Common::SeekableReadStream &stream, uint16 id) {
uint32 entryType = 0;
Common::Array<Common::String> castStrings = loadStrings(stream, entryType);
CastInfo *ci = new CastInfo();
+
ci->script = castStrings[0];
+
if (ci->script != "") {
_lingo->addCode(ci->script, kSpriteScript, id);
}
+
if (!ConfMan.getBool("dump_scripts")) {
dumpScript(id, kSpriteScript, ci->script);
}
@@ -336,6 +360,7 @@ void Score::loadCastInfo(Common::SeekableReadStream &stream, uint16 id) {
ci->directory = getString(castStrings[2]);
ci->fileName = getString(castStrings[3]);
ci->type = castStrings[4];
+
_castsInfo[id] = ci;
}
@@ -343,27 +368,34 @@ Common::String Score::getString(Common::String str) {
if (str.size() == 0) {
return str;
}
+
uint8 f = static_cast<uint8>(str.firstChar());
if (f == 0) {
return "";
}
+
str.deleteChar(0);
+
if (str.lastChar() == '\x00') {
str.deleteLastChar();
}
+
return str;
}
void Score::loadFileInfo(Common::SeekableReadStream &stream) {
Common::Array<Common::String> fileInfoStrings = loadStrings(stream, _flags);
_script = fileInfoStrings[0];
+
if (_script != "") {
_lingo->addCode(_script, kMovieScript, _movieScriptCount);
}
+
if (!ConfMan.getBool("dump_scripts")) {
dumpScript(_movieScriptCount, kMovieScript, _script);
}
+
_movieScriptCount++;
_changedBy = fileInfoStrings[1];
_createdBy = fileInfoStrings[2];
@@ -373,6 +405,7 @@ void Score::loadFileInfo(Common::SeekableReadStream &stream) {
Common::Array<Common::String> Score::loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader) {
Common::Array<Common::String> strings;
uint32 offset = 0;
+
if (hasHeader) {
offset = stream.readUint32BE();
/*uint32 unk1 = */ stream.readUint32BE();
@@ -384,6 +417,7 @@ Common::Array<Common::String> Score::loadStrings(Common::SeekableReadStream &str
uint16 count = stream.readUint16BE();
offset += (count + 1) * 4 + 2; //positions info + uint16 count
uint32 startPos = stream.readUint32BE() + offset;
+
for (uint16 i = 0; i < count; i++) {
Common::String entryString;
uint32 nextPos = stream.readUint32BE() + offset;
@@ -401,6 +435,7 @@ Common::Array<Common::String> Score::loadStrings(Common::SeekableReadStream &str
stream.seek(streamPos);
startPos = nextPos;
}
+
return strings;
}
@@ -435,6 +470,7 @@ BitmapCast::BitmapCast(Common::SeekableReadStream &stream) {
boundingRect = Score::readRect(stream);
regY = stream.readUint16BE();
regX = stream.readUint16BE();
+
if (someFlaggyThing & 0x8000) {
/*uint16 unk1 =*/ stream.readUint16BE();
/*uint16 unk2 =*/ stream.readUint16BE();
@@ -475,26 +511,32 @@ Common::Rect Score::readRect(Common::SeekableReadStream &stream) {
rect->left = stream.readUint16BE();
rect->bottom = stream.readUint16BE();
rect->right = stream.readUint16BE();
+
return *rect;
}
void Score::startLoop() {
initGraphics(_movieRect.width(), _movieRect.height(), true);
+
_surface->create(_movieRect.width(), _movieRect.height());
_trailSurface->create(_movieRect.width(), _movieRect.height());
+
if (_stageColor == 0)
_trailSurface->clear(15);
else
_trailSurface->clear(_stageColor);
+
_currentFrame = 0;
_stopPlay = false;
_nextFrameTime = 0;
_lingo->processEvent(kEventStartMovie, 0);
_frames[_currentFrame]->prepareFrame(this);
+
while (!_stopPlay && _currentFrame < _frames.size() - 2) {
update();
processEvents();
+
g_system->updateScreen();
g_system->delayMillis(10);
}
@@ -531,6 +573,7 @@ void Score::update() {
if (tempo > 161) {
//Delay
_nextFrameTime = g_system->getMillis() + (256 - tempo) * 1000;
+
return;
} else if (tempo <= 60) {
//FPS
@@ -562,18 +605,21 @@ void Score::processEvents() {
_lingo->processEvent(kEventIdle, _currentFrame - 1);
Common::Event event;
+
while (g_system->getEventManager()->pollEvent(event)) {
if (event.type == Common::EVENT_QUIT)
_stopPlay = true;
if (event.type == Common::EVENT_LBUTTONDOWN) {
Common::Point pos = g_system->getEventManager()->getMousePos();
+
//TODO there is dont send frame id
_lingo->processEvent(kEventMouseDown, _frames[_currentFrame]->getSpriteIDFromPos(pos));
}
if (event.type == Common::EVENT_LBUTTONUP) {
Common::Point pos = g_system->getEventManager()->getMousePos();
+
_lingo->processEvent(kEventMouseUp, _frames[_currentFrame]->getSpriteIDFromPos(pos));
}
}
@@ -595,6 +641,7 @@ Frame::Frame() {
_blend = 0;
_sprites.resize(CHANNEL_COUNT);
+
for (uint16 i = 0; i < _sprites.size(); i++) {
Sprite *sp = new Sprite();
_sprites[i] = sp;
@@ -617,6 +664,7 @@ Frame::Frame(const Frame &frame) {
_palette = new PaletteInfo();
_sprites.resize(CHANNEL_COUNT);
+
for (uint16 i = 0; i < CHANNEL_COUNT; i++) {
_sprites[i] = new Sprite(*frame._sprites[i]);
}
@@ -716,6 +764,7 @@ void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset,
}
}
}
+
void Frame::readPaletteInfo(Common::SeekableReadStream &stream) {
_palette->firstColor = stream.readByte();
_palette->lastColor = stream.readByte();
@@ -751,10 +800,12 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
case kSpritePositionFlags:
sprite._flags = stream.readUint16BE();
sprite._ink = static_cast<InkType>(sprite._flags & 0x3f);
+
if (sprite._flags & 0x40)
sprite._trails = 1;
else
sprite._trails = 0;
+
fieldPosition += 2;
break;
case kSpritePositionCastId:
@@ -789,12 +840,15 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
void Frame::prepareFrame(Score *score) {
renderSprites(*score->_movieArchive, *score->_surface, score->_movieRect, false);
renderSprites(*score->_movieArchive, *score->_trailSurface, score->_movieRect, true);
+
if (_transType != 0)
//TODO Handle changing area case
playTransition(score);
+
if (_sound1 != 0 || _sound2 != 0) {
playSoundChannel();
}
+
g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, score->_surface->getBounds().width(), score->_surface->getBounds().height());
}
@@ -810,25 +864,33 @@ void Frame::playTransition(Score *score) {
uint16 steps = duration / stepDuration;
switch (_transType) {
- case kTransCoverDown: {
+ case kTransCoverDown:
+ {
uint16 stepSize = score->_movieRect.height() / steps;
Common::Rect r = score->_movieRect;
+
for (uint16 i = 1; i < steps; i++) {
r.setHeight(stepSize * i);
+
g_system->delayMillis(stepDuration);
score->processEvents();
+
g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height());
g_system->updateScreen();
}
}
break;
- case kTransCoverUp: {
+ case kTransCoverUp:
+ {
uint16 stepSize = score->_movieRect.height() / steps;
Common::Rect r = score->_movieRect;
+
for (uint16 i = 1; i < steps; i++) {
r.setHeight(stepSize * i);
+
g_system->delayMillis(stepDuration);
score->processEvents();
+
g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, score->_movieRect.height() - stepSize * i, r.width(), r.height());
g_system->updateScreen();
}
@@ -837,10 +899,13 @@ void Frame::playTransition(Score *score) {
case kTransCoverRight: {
uint16 stepSize = score->_movieRect.width() / steps;
Common::Rect r = score->_movieRect;
+
for (uint16 i = 1; i < steps; i++) {
r.setWidth(stepSize * i);
+
g_system->delayMillis(stepDuration);
score->processEvents();
+
g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height());
g_system->updateScreen();
}
@@ -849,10 +914,13 @@ void Frame::playTransition(Score *score) {
case kTransCoverLeft: {
uint16 stepSize = score->_movieRect.width() / steps;
Common::Rect r = score->_movieRect;
+
for (uint16 i = 1; i < steps; i++) {
r.setWidth(stepSize * i);
+
g_system->delayMillis(stepDuration);
score->processEvents();
+
g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, score->_movieRect.width() - stepSize * i, 0, r.width(), r.height());
g_system->updateScreen();
}
@@ -861,11 +929,14 @@ void Frame::playTransition(Score *score) {
case kTransCoverUpLeft: {
uint16 stepSize = score->_movieRect.width() / steps;
Common::Rect r = score->_movieRect;
+
for (uint16 i = 1; i < steps; i++) {
r.setWidth(stepSize * i);
r.setHeight(stepSize * i);
+
g_system->delayMillis(stepDuration);
score->processEvents();
+
g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, score->_movieRect.width() - stepSize * i, score->_movieRect.height() - stepSize * i, r.width(), r.height());
g_system->updateScreen();
}
@@ -874,11 +945,14 @@ void Frame::playTransition(Score *score) {
case kTransCoverUpRight: {
uint16 stepSize = score->_movieRect.width() / steps;
Common::Rect r = score->_movieRect;
+
for (uint16 i = 1; i < steps; i++) {
r.setWidth(stepSize * i);
r.setHeight(stepSize * i);
+
g_system->delayMillis(stepDuration);
score->processEvents();
+
g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, score->_movieRect.height() - stepSize * i, r.width(), r.height());
g_system->updateScreen();
}
@@ -887,11 +961,14 @@ void Frame::playTransition(Score *score) {
case kTransCoverDownLeft: {
uint16 stepSize = score->_movieRect.width() / steps;
Common::Rect r = score->_movieRect;
+
for (uint16 i = 1; i < steps; i++) {
r.setWidth(stepSize * i);
r.setHeight(stepSize * i);
+
g_system->delayMillis(stepDuration);
score->processEvents();
+
g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, score->_movieRect.width() - stepSize * i, 0, r.width(), r.height());
g_system->updateScreen();
}
@@ -900,11 +977,14 @@ void Frame::playTransition(Score *score) {
case kTransCoverDownRight: {
uint16 stepSize = score->_movieRect.width() / steps;
Common::Rect r = score->_movieRect;
+
for (uint16 i = 1; i < steps; i++) {
r.setWidth(stepSize * i);
r.setHeight(stepSize * i);
+
g_system->delayMillis(stepDuration);
score->processEvents();
+
g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height());
g_system->updateScreen();
}
@@ -925,6 +1005,7 @@ void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Co
DIBDecoder img;
uint32 imgId = 1024 + _sprites[i]->_castId;
+
if (!_movie.hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
continue;
}
@@ -940,6 +1021,7 @@ void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Co
int y = _sprites[i]->_startPoint.y - regY + rectTop;
int height = _sprites[i]->_height;
int width = _sprites[i]->_width;
+
Common::Rect drawRect = Common::Rect(x, y, x + width, y + height);
_drawRects.push_back(drawRect);
@@ -964,12 +1046,15 @@ void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Co
void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
uint8 skipColor = 15; //FIXME is it always white (last entry in pallette) ?
+
for (int ii = 0; ii < sprite.h; ii++) {
const byte *src = (const byte *)sprite.getBasePtr(0, ii);
byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + ii);
+
for (int j = 0; j < drawRect.width(); j++) {
if (*src != skipColor)
*dst = *src;
+
src++;
dst++;
}
@@ -987,6 +1072,7 @@ void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Su
ff.addSeed(0, yy);
ff.addSeed(tmp.w - 1, yy);
}
+
for (int xx = 0; xx < tmp.w; xx++) {
ff.addSeed(xx, 0);
ff.addSeed(xx, tmp.h - 1);
@@ -1012,6 +1098,7 @@ uint16 Frame::getSpriteIDFromPos(Common::Point pos) {
if (_drawRects[i].contains(pos))
return i;
}
+
return 0;
}
diff --git a/engines/director/score.h b/engines/director/score.h
index cd4985f..9636dfb 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -20,8 +20,8 @@
*
*/
- #ifndef DIRECTOR_SCORE_H
- #define DIRECTOR_SCORE_H
+#ifndef DIRECTOR_SCORE_H
+#define DIRECTOR_SCORE_H
#include "common/rect.h"
#include "common/stream.h"
@@ -39,295 +39,306 @@ class Score;
#define CHANNEL_COUNT 24
enum CastType {
- kCastBitmap = 1,
- kCastFilmLoop,
- kCastText,
- kCastPalette,
- kCastPicture,
- kCastSound,
- kCastButton,
- kCastShape,
- kCastMovie,
- kCastDigitalVideo,
- kCastScript
+ kCastBitmap = 1,
+ kCastFilmLoop,
+ kCastText,
+ kCastPalette,
+ kCastPicture,
+ kCastSound,
+ kCastButton,
+ kCastShape,
+ kCastMovie,
+ kCastDigitalVideo,
+ kCastScript
};
enum SpritePosition {
- kSpritePositionUnk1 = 0,
- kSpritePositionEnabled,
- kSpritePositionUnk2,
- kSpritePositionFlags = 4,
- kSpritePositionCastId = 6,
- kSpritePositionY = 8,
- kSpritePositionX = 10,
- kSpritePositionHeight = 12,
- kSpritePositionWidth = 14
+ kSpritePositionUnk1 = 0,
+ kSpritePositionEnabled,
+ kSpritePositionUnk2,
+ kSpritePositionFlags = 4,
+ kSpritePositionCastId = 6,
+ kSpritePositionY = 8,
+ kSpritePositionX = 10,
+ kSpritePositionHeight = 12,
+ kSpritePositionWidth = 14
};
enum MainChannelsPosition {
- kScriptIdPosition = 0,
- kSoundType1Position,
- kTransFlagsPosition,
- kTransChunkSizePosition,
- kTempoPosition,
- kTransTypePosition,
- kSound1Position,
- kSkipFrameFlagsPosition = 8,
- kBlendPosition,
- kSound2Position,
- kSound2TypePosition = 11,
- kPaletePosition = 15
+ kScriptIdPosition = 0,
+ kSoundType1Position,
+ kTransFlagsPosition,
+ kTransChunkSizePosition,
+ kTempoPosition,
+ kTransTypePosition,
+ kSound1Position,
+ kSkipFrameFlagsPosition = 8,
+ kBlendPosition,
+ kSound2Position,
+ kSound2TypePosition = 11,
+ kPaletePosition = 15
};
enum InkType {
- kInkTypeCopy,
- kInkTypeTransparent,
- kInkTypeReverse,
- kInkTypeGhost,
- kInkTypeNotCopy,
- kInkTypeNotTrans,
- kInkTypeNotReverse,
- kInkTypeNotGhost,
- kInkTypeMatte,
- kInkTypeMask,
- //10-31 Not used (Lingo in a Nutshell)
- kInkTypeBlend = 32,
- kInkTypeAddPin,
- kInkTypeAdd,
- kInkTypeSubPin,
- kInkTypeBackgndTrans,
- kInkTypeLight,
- kInkTypeSub,
- kInkTypeDark
+ kInkTypeCopy,
+ kInkTypeTransparent,
+ kInkTypeReverse,
+ kInkTypeGhost,
+ kInkTypeNotCopy,
+ kInkTypeNotTrans,
+ kInkTypeNotReverse,
+ kInkTypeNotGhost,
+ kInkTypeMatte,
+ kInkTypeMask,
+ //10-31 Not used (Lingo in a Nutshell)
+ kInkTypeBlend = 32,
+ kInkTypeAddPin,
+ kInkTypeAdd,
+ kInkTypeSubPin,
+ kInkTypeBackgndTrans,
+ kInkTypeLight,
+ kInkTypeSub,
+ kInkTypeDark
};
enum ScriptType {
- kMovieScript = 0,
- kSpriteScript = 1,
- kFrameScript = 2,
+ kMovieScript = 0,
+ kSpriteScript = 1,
+ kFrameScript = 2,
kMaxScriptType = 2
};
enum TransitionType {
- kTransWipeRight = 1,
- kTransWipeLeft,
- kTransWipeDown,
- kTransWipeUp,
- kTransCenterOutHorizontal,
- kTransEdgesInHorizontal,
- kTransCenterOutVertical,
- kTransEdgesInVertical,
- kTransCenterOutSquare,
- kTransEdgesInSquare,
- kTransPushLeft,
- kTransPushRight,
- kTransPushDown,
- kTransPushUp,
- kTransRevealUp,
- kTransRevealUpRight,
- kTransRevealRight,
- kTransRevealDown,
- kTransRevealDownRight,
- kTransRevealDownLeft,
- kTransRevealLeft,
- kTransRevealUpLeft,
- kTransDissolvePixelsFast,
- kTransDissolveBoxyRects,
- kTransDissolveBoxySquares,
- kTransDissolvePatterns,
- kTransRandomRows,
- kTransRandomColumns,
- kTransCoverDown,
- kTransCoverDownLeft,
- kTransCoverDownRight,
- kTransCoverLeft,
- kTransCoverRight,
- kTransCoverUp,
- kTransCoverUpLeft,
- kTransCoverUpRight,
- kTransTypeVenitianBlind,
- kTransTypeCheckerboard,
- kTransTypeStripsBottomBuildLeft,
- kTransTypeStripsBottomBuildRight,
- kTransTypeStripsLeftBuildDown,
- kTransTypeStripsLeftBuildUp,
- kTransTypeStripsRightBuildDown,
- kTransTypeStripsRightBuildUp,
- kTransTypeStripsTopBuildLeft,
- kTransTypeStripsTopBuildRight,
- kTransZoomOpen,
- kTransZoomClose,
- kTransVerticalBinds,
- kTransDissolveBitsTrans,
- kTransDissolvePixels,
- kTransDissolveBits
+ kTransWipeRight = 1,
+ kTransWipeLeft,
+ kTransWipeDown,
+ kTransWipeUp,
+ kTransCenterOutHorizontal,
+ kTransEdgesInHorizontal,
+ kTransCenterOutVertical,
+ kTransEdgesInVertical,
+ kTransCenterOutSquare,
+ kTransEdgesInSquare,
+ kTransPushLeft,
+ kTransPushRight,
+ kTransPushDown,
+ kTransPushUp,
+ kTransRevealUp,
+ kTransRevealUpRight,
+ kTransRevealRight,
+ kTransRevealDown,
+ kTransRevealDownRight,
+ kTransRevealDownLeft,
+ kTransRevealLeft,
+ kTransRevealUpLeft,
+ kTransDissolvePixelsFast,
+ kTransDissolveBoxyRects,
+ kTransDissolveBoxySquares,
+ kTransDissolvePatterns,
+ kTransRandomRows,
+ kTransRandomColumns,
+ kTransCoverDown,
+ kTransCoverDownLeft,
+ kTransCoverDownRight,
+ kTransCoverLeft,
+ kTransCoverRight,
+ kTransCoverUp,
+ kTransCoverUpLeft,
+ kTransCoverUpRight,
+ kTransTypeVenitianBlind,
+ kTransTypeCheckerboard,
+ kTransTypeStripsBottomBuildLeft,
+ kTransTypeStripsBottomBuildRight,
+ kTransTypeStripsLeftBuildDown,
+ kTransTypeStripsLeftBuildUp,
+ kTransTypeStripsRightBuildDown,
+ kTransTypeStripsRightBuildUp,
+ kTransTypeStripsTopBuildLeft,
+ kTransTypeStripsTopBuildRight,
+ kTransZoomOpen,
+ kTransZoomClose,
+ kTransVerticalBinds,
+ kTransDissolveBitsTrans,
+ kTransDissolvePixels,
+ kTransDissolveBits
};
struct Cast {
- CastType type;
- Common::Rect initialRect;
+ CastType type;
+ Common::Rect initialRect;
};
struct BitmapCast : Cast {
- BitmapCast(Common::SeekableReadStream &stream);
- Common::Rect boundingRect;
- uint16 regX;
- uint16 regY;
- uint8 flags;
+ BitmapCast(Common::SeekableReadStream &stream);
+
+ Common::Rect boundingRect;
+ uint16 regX;
+ uint16 regY;
+ uint8 flags;
};
struct ShapeCast : Cast {
- ShapeCast(Common::SeekableReadStream &stream);
- byte shapeType;
- uint16 pattern;
- byte fgCol;
- byte bgCol;
- byte fillType;
- byte lineThickness;
- byte lineDirection;
+ ShapeCast(Common::SeekableReadStream &stream);
+
+ byte shapeType;
+ uint16 pattern;
+ byte fgCol;
+ byte bgCol;
+ byte fillType;
+ byte lineThickness;
+ byte lineDirection;
};
struct TextCast : Cast {
- TextCast(Common::SeekableReadStream &stream);
- byte borderSize;
- byte gutterSize;
- byte boxShadow;
-
- byte textType;
- byte textAlign;
- byte textShadow;
- byte textFlags;
+ TextCast(Common::SeekableReadStream &stream);
+
+ byte borderSize;
+ byte gutterSize;
+ byte boxShadow;
+
+ byte textType;
+ byte textAlign;
+ byte textShadow;
+ byte textFlags;
};
struct ButtonCast : TextCast {
- ButtonCast(Common::SeekableReadStream &stream) : TextCast(stream) {
- buttonType = stream.readUint16BE();
- }
- //TODO types?
- uint16 buttonType;
+ ButtonCast(Common::SeekableReadStream &stream) : TextCast(stream) {
+ buttonType = stream.readUint16BE();
+ }
+
+ //TODO types?
+ uint16 buttonType;
};
struct CastInfo {
- Common::String script;
- Common::String name;
- Common::String directory;
- Common::String fileName;
- Common::String type;
+ Common::String script;
+ Common::String name;
+ Common::String directory;
+ Common::String fileName;
+ Common::String type;
};
struct PaletteInfo {
- uint8 firstColor;
- uint8 lastColor;
- uint8 flags;
- uint8 speed;
- uint16 frameCount;
+ uint8 firstColor;
+ uint8 lastColor;
+ uint8 flags;
+ uint8 speed;
+ uint16 frameCount;
};
class Sprite {
public:
- Sprite();
- Sprite(const Sprite &sprite);
- bool _enabled;
- byte _castId;
- InkType _ink;
- uint16 _trails;
- Cast *_cast;
- uint16 _flags;
- Common::Point _startPoint;
- uint16 _width;
- uint16 _height;
+ Sprite();
+ Sprite(const Sprite &sprite);
+
+ bool _enabled;
+ byte _castId;
+ InkType _ink;
+ uint16 _trails;
+ Cast *_cast;
+ uint16 _flags;
+ Common::Point _startPoint;
+ uint16 _width;
+ uint16 _height;
};
class Frame {
public:
- Frame();
- ~Frame();
- Frame(const Frame &frame);
- void readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
- void prepareFrame(Score *score);
- uint16 getSpriteIDFromPos(Common::Point pos);
+ Frame();
+ Frame(const Frame &frame);
+ ~Frame();
+
+ void readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
+ void prepareFrame(Score *score);
+ uint16 getSpriteIDFromPos(Common::Point pos);
+
private:
- void playTransition(Score *score);
- void playSoundChannel();
- void renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect, bool renderTrail);
- void readPaletteInfo(Common::SeekableReadStream &stream);
- void readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
- void readMainChannels(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
- void drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
- void drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
+ void playTransition(Score *score);
+ void playSoundChannel();
+ void renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect, bool renderTrail);
+ void readPaletteInfo(Common::SeekableReadStream &stream);
+ void readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
+ void readMainChannels(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
+ void drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
+ void drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
+
public:
- uint8 _actionId;
- uint8 _transDuration;
- uint8 _transArea; //1 - Whole Stage, 0 - Changing Area
- uint8 _transChunkSize;
- TransitionType _transType;
- PaletteInfo *_palette;
- uint8 _tempo;
-
- uint16 _sound1;
- uint8 _soundType1;
- uint16 _sound2;
- uint8 _soundType2;
-
- uint8 _skipFrameFlag;
- uint8 _blend;
- Common::Array<Sprite *> _sprites;
- Common::Array<Common::Rect > _drawRects;
+ uint8 _actionId;
+ uint8 _transDuration;
+ uint8 _transArea; //1 - Whole Stage, 0 - Changing Area
+ uint8 _transChunkSize;
+ TransitionType _transType;
+ PaletteInfo *_palette;
+ uint8 _tempo;
+
+ uint16 _sound1;
+ uint8 _soundType1;
+ uint16 _sound2;
+ uint8 _soundType2;
+
+ uint8 _skipFrameFlag;
+ uint8 _blend;
+ Common::Array<Sprite *> _sprites;
+ Common::Array<Common::Rect > _drawRects;
};
class Score {
public:
- Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager);
- ~Score();
- static Common::Rect readRect(Common::SeekableReadStream &stream);
- void startLoop();
- void processEvents();
+ Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager);
+ ~Score();
+
+ static Common::Rect readRect(Common::SeekableReadStream &stream);
+ void startLoop();
+ void processEvents();
+
private:
+ void update();
+ void readVersion(uint32 rid);
+ void loadConfig(Common::SeekableReadStream &stream);
+ void loadCastData(Common::SeekableReadStream &stream);
+ void loadFrames(Common::SeekableReadStream &stream);
+ void loadLabels(Common::SeekableReadStream &stream);
+ void loadActions(Common::SeekableReadStream &stream);
+ void loadCastInfo(Common::SeekableReadStream &stream, uint16 id);
+ void loadScriptText(Common::SeekableReadStream &stream);
+ void loadFileInfo(Common::SeekableReadStream &stream);
+ void loadFontMap(Common::SeekableReadStream &stream);
+ void dumpScript(uint16 id, ScriptType type, Common::String script);
+ Common::String getString(Common::String str);
+ Common::Array<Common::String> loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader = true);
- void update();
- void readVersion(uint32 rid);
- void loadConfig(Common::SeekableReadStream &stream);
- void loadCastData(Common::SeekableReadStream &stream);
- void loadFrames(Common::SeekableReadStream &stream);
- void loadLabels(Common::SeekableReadStream &stream);
- void loadActions(Common::SeekableReadStream &stream);
- void loadCastInfo(Common::SeekableReadStream &stream, uint16 id);
- void loadScriptText(Common::SeekableReadStream &stream);
- void loadFileInfo(Common::SeekableReadStream &stream);
- void loadFontMap(Common::SeekableReadStream &stream);
- void dumpScript(uint16 id, ScriptType type, Common::String script);
- Common::String getString(Common::String str);
- Common::Array<Common::String> loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader = true);
public:
- Common::Array<Frame *> _frames;
- Common::HashMap<int, Cast *> _casts;
- Common::HashMap<uint16, CastInfo *> _castsInfo;
- Common::HashMap<uint16, Common::String> _labels;
- Common::HashMap<uint16, Common::String> _actions;
- Common::HashMap<uint16, Common::String> _fontMap;
- Graphics::ManagedSurface *_surface;
- Graphics::ManagedSurface *_trailSurface;
- Archive *_movieArchive;
- Common::Rect _movieRect;
+ Common::Array<Frame *> _frames;
+ Common::HashMap<int, Cast *> _casts;
+ Common::HashMap<uint16, CastInfo *> _castsInfo;
+ Common::HashMap<uint16, Common::String> _labels;
+ Common::HashMap<uint16, Common::String> _actions;
+ Common::HashMap<uint16, Common::String> _fontMap;
+ Graphics::ManagedSurface *_surface;
+ Graphics::ManagedSurface *_trailSurface;
+ Archive *_movieArchive;
+ Common::Rect _movieRect;
+
private:
- uint16 _versionMinor;
- uint16 _versionMajor;
- Common::String _macName;
- Common::String _createdBy;
- Common::String _changedBy;
- Common::String _script;
- Common::String _directory;
- byte _currentFrameRate;
- uint16 _castArrayStart;
- uint16 _currentFrame;
- uint32 _nextFrameTime;
- uint32 _flags;
- bool _stopPlay;
- uint16 _castArrayEnd;
- uint16 _movieScriptCount;
- uint16 _stageColor;
- Lingo *_lingo;
- DirectorSound *_soundManager;
+ uint16 _versionMinor;
+ uint16 _versionMajor;
+ Common::String _macName;
+ Common::String _createdBy;
+ Common::String _changedBy;
+ Common::String _script;
+ Common::String _directory;
+ byte _currentFrameRate;
+ uint16 _castArrayStart;
+ uint16 _currentFrame;
+ uint32 _nextFrameTime;
+ uint32 _flags;
+ bool _stopPlay;
+ uint16 _castArrayEnd;
+ uint16 _movieScriptCount;
+ uint16 _stageColor;
+ Lingo *_lingo;
+ DirectorSound *_soundManager;
};
} //End of namespace Director
diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index 5e32972..5f6d435 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -33,7 +33,7 @@ DirectorSound::DirectorSound() {
_sound1 = new Audio::SoundHandle();
_sound2 = new Audio::SoundHandle();
_scriptSound = new Audio::SoundHandle();
- _mixer = g_system->getMixer();
+ _mixer = g_system->getMixer();
}
void DirectorSound::playWAV(Common::String filename, uint8 soundChannel) {
@@ -41,26 +41,31 @@ void DirectorSound::playWAV(Common::String filename, uint8 soundChannel) {
if (!file->open(filename)) {
warning("Failed to open %s", filename.c_str());
+
delete file;
+
return;
}
Audio::RewindableAudioStream *sound = Audio::makeWAVStream(file, DisposeAfterUse::YES);
- if (soundChannel == 1)
+
+ if (soundChannel == 1)
_mixer->playStream(Audio::Mixer::kSFXSoundType, _sound1, sound);
- else
+ else
_mixer->playStream(Audio::Mixer::kSFXSoundType, _sound2, sound);
}
void DirectorSound::playAIFF(Common::String filename, uint8 soundChannel) {
Common::File *file = new Common::File();
+
if (!file->open(filename)) {
warning("Failed to open %s", filename.c_str());
delete file;
return;
}
- Audio::RewindableAudioStream *sound = Audio::makeAIFFStream(file, DisposeAfterUse::YES);
+ Audio::RewindableAudioStream *sound = Audio::makeAIFFStream(file, DisposeAfterUse::YES);
+
if (soundChannel == 1)
_mixer->playStream(Audio::Mixer::kSFXSoundType, _sound1, sound);
else
@@ -70,6 +75,7 @@ void DirectorSound::playAIFF(Common::String filename, uint8 soundChannel) {
void DirectorSound::playMCI(Audio::AudioStream &stream, uint32 from, uint32 to) {
Audio::SeekableAudioStream *seekStream = dynamic_cast<Audio::SeekableAudioStream *>(&stream);
Audio::SubSeekableAudioStream *subSeekStream = new Audio::SubSeekableAudioStream(seekStream, Audio::Timestamp(from, seekStream->getRate()), Audio::Timestamp(to, seekStream->getRate()));
+
_mixer->playStream(Audio::Mixer::kSFXSoundType, _scriptSound, subSeekStream);
}
@@ -79,7 +85,9 @@ bool DirectorSound::isChannelActive(uint8 channelID) {
} else if (channelID == 2) {
return _mixer->isSoundHandleActive(*_sound2);
}
+
error("Incorrect sound channel");
+
return false;
}
diff --git a/engines/director/sound.h b/engines/director/sound.h
index 87fd04d..87a989c 100644
--- a/engines/director/sound.h
+++ b/engines/director/sound.h
@@ -24,9 +24,9 @@
#include "audio/mixer.h"
#include "common/str.h"
-
#ifndef DIRECTOR_SOUND_H
#define DIRECTOR_SOUND_H
+
namespace Director {
class DirectorSound {
Commit: 2f8640c33a3bbff0dc8f6c8483211ac782297cb4
https://github.com/scummvm/scummvm/commit/2f8640c33a3bbff0dc8f6c8483211ac782297cb4
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Parse movie archive separately Load mac name and labels in the constructor
Changed paths:
engines/director/director.cpp
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index b7a6274..7b7227e 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -85,8 +85,9 @@ Common::Error DirectorEngine::run() {
_mainArchive->openFile("bookshelf_example.mmm");
Score score(*_mainArchive, *_lingo, *_soundManager);
+ score.loadArchive();
score.startLoop();
-
+ debug(0, "Score name %s", score.getMacName().c_str());
if (getPlatform() == Common::kPlatformWindows)
loadEXE();
else
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 44242ec..32ade8b 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -48,14 +48,6 @@ Score::Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager) {
_lingo->processEvent(kEventPrepareMovie, 0);
_movieScriptCount = 0;
- assert(_movieArchive->hasResource(MKTAG('V','W','S','C'), 1024));
- assert(_movieArchive->hasResource(MKTAG('V','W','C','F'), 1024));
- assert(_movieArchive->hasResource(MKTAG('V','W','C','R'), 1024));
-
- loadFrames(*_movieArchive->getResource(MKTAG('V','W','S','C'), 1024));
- loadConfig(*_movieArchive->getResource(MKTAG('V','W','C','F'), 1024));
- loadCastData(*_movieArchive->getResource(MKTAG('V','W','C','R'), 1024));
-
if (_movieArchive->hasResource(MKTAG('M','C','N','M'), 0)) {
_macName = _movieArchive->getName(MKTAG('M','C','N','M'), 0).c_str();
}
@@ -63,7 +55,15 @@ Score::Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager) {
if (_movieArchive->hasResource(MKTAG('V','W','L','B'), 1024)) {
loadLabels(*_movieArchive->getResource(MKTAG('V','W','L','B'), 1024));
}
+}
+void Score::loadArchive() {
+ assert(_movieArchive->hasResource(MKTAG('V','W','S','C'), 1024));
+ assert(_movieArchive->hasResource(MKTAG('V','W','C','F'), 1024));
+ assert(_movieArchive->hasResource(MKTAG('V','W','C','R'), 1024));
+ loadFrames(*_movieArchive->getResource(MKTAG('V','W','S','C'), 1024));
+ loadConfig(*_movieArchive->getResource(MKTAG('V','W','C','F'), 1024));
+ loadCastData(*_movieArchive->getResource(MKTAG('V','W','C','R'), 1024));
if (_movieArchive->hasResource(MKTAG('V','W','A','C'), 1024)) {
loadActions(*_movieArchive->getResource(MKTAG('V','W','A','C'), 1024));
}
diff --git a/engines/director/score.h b/engines/director/score.h
index 9636dfb..9490d5f 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -289,9 +289,11 @@ public:
~Score();
static Common::Rect readRect(Common::SeekableReadStream &stream);
+ void loadArchive();
void startLoop();
void processEvents();
+ Common::String getMacName() const { return _macName; }
private:
void update();
void readVersion(uint32 rid);
Commit: 23c79a2786aad39251768bd644779607a04682ca
https://github.com/scummvm/scummvm/commit/23c79a2786aad39251768bd644779607a04682ca
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add parsing mac names from folder
Changed paths:
engines/director/director.cpp
engines/director/director.h
engines/director/lingo/lingo.cpp
engines/director/score.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 7b7227e..7808d52 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -31,6 +31,7 @@
#include "common/stream.h"
#include "common/system.h"
#include "common/textconsole.h"
+#include "common/fs.h"
#include "engines/util.h"
@@ -85,9 +86,11 @@ Common::Error DirectorEngine::run() {
_mainArchive->openFile("bookshelf_example.mmm");
Score score(*_mainArchive, *_lingo, *_soundManager);
+ debug(0, "Score name %s", score.getMacName().c_str());
+
score.loadArchive();
score.startLoop();
- debug(0, "Score name %s", score.getMacName().c_str());
+
if (getPlatform() == Common::kPlatformWindows)
loadEXE();
else
@@ -96,6 +99,25 @@ Common::Error DirectorEngine::run() {
return Common::kNoError;
}
+Common::HashMap<Common::String, Score *> DirectorEngine::loadMMMNames(Common::String folder) {
+ Common::FSNode directory(folder);
+ Common::FSList movies;
+
+ Common::HashMap<Common::String, Score *> nameMap;
+ directory.getChildren(movies, Common::FSNode::kListFilesOnly);
+
+ if (!movies.empty()) {
+ for (Common::FSList::const_iterator i = movies.begin(); i != movies.end(); ++i) {
+ RIFFArchive *arc = new RIFFArchive();
+ arc->openFile(i->getPath());
+ Score *sc = new Score(*arc, *_lingo, *_soundManager);
+ nameMap[sc->getMacName()] = sc;
+ }
+ }
+
+ return nameMap;
+}
+
void DirectorEngine::loadEXE() {
Common::SeekableReadStream *exeStream = SearchMan.createReadStreamForMember(getEXEName());
if (!exeStream)
@@ -126,7 +148,6 @@ void DirectorEngine::loadEXE() {
void DirectorEngine::loadEXEv3(Common::SeekableReadStream *stream) {
uint16 entryCount = stream->readUint16LE();
-
if (entryCount != 1)
error("Unhandled multiple entry v3 EXE");
diff --git a/engines/director/director.h b/engines/director/director.h
index 7e3117d..9a961b7 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -25,6 +25,8 @@
#include "common/scummsys.h"
+#include "common/str.h"
+#include "common/hashmap.h"
#include "engines/engine.h"
#include "engines/director/sound.h"
@@ -41,6 +43,7 @@ enum DirectorGameID {
class Archive;
struct DirectorGameDescription;
class Lingo;
+class Score;
class DirectorEngine : public ::Engine {
@@ -64,6 +67,7 @@ protected:
private:
const DirectorGameDescription *_gameDescription;
+ Common::HashMap<Common::String, Score *> loadMMMNames(Common::String folder);
void loadEXE();
void loadEXEv3(Common::SeekableReadStream *stream);
void loadEXEv4(Common::SeekableReadStream *stream);
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index e338c3d..d7bd1dc 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -81,6 +81,8 @@ Lingo::~Lingo() {
void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
debug(0, "Add code %s for type %d with id %d", code.c_str(), type, id);
+ //FIXME
+ return;
if (_scripts[type].contains(id)) {
free(_scripts[type][id]);
}
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 32ade8b..7868353 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -261,7 +261,11 @@ void Score::loadActions(Common::SeekableReadStream &stream) {
stream.seek(stringPos);
for (uint16 j = stringPos; j < nextStringPos; j++) {
- _actions[id] += stream.readByte();
+ byte ch = stream.readByte();
+ if (ch == 0x0d) {
+ ch = '\n';
+ }
+ _actions[id] += ch;
}
stream.seek(streamPos);
@@ -276,13 +280,15 @@ void Score::loadActions(Common::SeekableReadStream &stream) {
Common::HashMap<uint16, Common::String>::iterator j;
for (j = _actions.begin(); j != _actions.end(); ++j)
- _lingo->addCode(j->_value, kFrameScript, j->_key);
+ if (j->_value != "")
+ _lingo->addCode(j->_value, kFrameScript, j->_key);
if (!ConfMan.getBool("dump_scripts"))
return;
for (j = _actions.begin(); j != _actions.end(); ++j) {
- dumpScript(j->_key, kFrameScript, j->_value);
+ if (j->_value != "")
+ dumpScript(j->_key, kFrameScript, j->_value);
}
}
@@ -301,10 +307,10 @@ void Score::loadScriptText(Common::SeekableReadStream &stream) {
}
script += ch;
}
+ if (script != "")
+ _lingo->addCode(script, kMovieScript, _movieScriptCount);
- _lingo->addCode(script, kMovieScript, _movieScriptCount);
-
- if (ConfMan.getBool("dump_scripts")) {
+ if (ConfMan.getBool("dump_scripts") && (script != "")) {
dumpScript(_movieScriptCount, kMovieScript, script);
}
Commit: f58de432c5d7ab1e465fccfe9a449fe955a7865b
https://github.com/scummvm/scummvm/commit/f58de432c5d7ab1e465fccfe9a449fe955a7865b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix script compilation
Changed paths:
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index d7bd1dc..ddb1cb1 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -73,21 +73,21 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
_eventHandlerTypes[t->handler] = t->name;
_currentScript = 0;
+
+ warning("Lingo Inited");
}
Lingo::~Lingo() {
}
void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
- debug(0, "Add code %s for type %d with id %d", code.c_str(), type, id);
+ debug(0, "Add code \"%s\" for type %d with id %d", code.c_str(), type, id);
- //FIXME
- return;
if (_scripts[type].contains(id)) {
- free(_scripts[type][id]);
+ delete _scripts[type][id];
}
- _currentScript = new Common::Array<inst>();
+ _currentScript = new ScriptData;
_scripts[type][id] = _currentScript;
parse(code.c_str());
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index c819779..2e5c7b4 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -73,6 +73,9 @@ enum LEvent {
typedef void (*inst)(void);
#define STOP (inst)0
+typedef Common::Array<inst> ScriptData;
+typedef Common::HashMap<int32, ScriptData *> ScriptHash;
+
class Lingo {
public:
Lingo(DirectorEngine *vm);
@@ -101,8 +104,8 @@ private:
Common::HashMap<uint32, const char *> _eventHandlerTypes;
Common::HashMap<Common::String, Audio::AudioStream *> _audioAliases;
- Common::HashMap<int32, Common::Array<inst> *> _scripts[kMaxScriptType];
- Common::Array<inst> *_currentScript;
+ ScriptHash _scripts[kMaxScriptType + 1];
+ ScriptData *_currentScript;
DirectorEngine *_vm;
};
Commit: 612a480f9b1342820d88fc66f513dc00f768f5d9
https://github.com/scummvm/scummvm/commit/612a480f9b1342820d88fc66f513dc00f768f5d9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Added mciwait function stub
Changed paths:
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 5422b3c..ee640de 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -154,6 +154,10 @@ int Lingo::func_mci(Common::String *s) {
return 0;
}
+void Lingo::func_mciwait(Common::String *s) {
+ warning("MCI wait file: %s", s->c_str());
+}
+
void Lingo::func_constpush() {
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index c34a25f..ff3513f 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -74,8 +74,9 @@
OP_INTO = 263,
OP_TO = 264,
FUNC_MCI = 265,
- FUNC_PUT = 266,
- FUNC_SET = 267
+ FUNC_MCIWAIT = 266,
+ FUNC_PUT = 267,
+ FUNC_SET = 268
};
#endif
/* Tokens. */
@@ -87,8 +88,9 @@
#define OP_INTO 263
#define OP_TO 264
#define FUNC_MCI 265
-#define FUNC_PUT 266
-#define FUNC_SET 267
+#define FUNC_MCIWAIT 266
+#define FUNC_PUT 267
+#define FUNC_SET 268
@@ -138,7 +140,7 @@ typedef union YYSTYPE
#line 43 "engines/director/lingo/lingo-gr.y"
{ float f; int i; Common::String *s; }
/* Line 193 of yacc.c. */
-#line 142 "engines/director/lingo/lingo-gr.cpp"
+#line 144 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -151,7 +153,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 155 "engines/director/lingo/lingo-gr.cpp"
+#line 157 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -364,22 +366,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 19
+#define YYFINAL 21
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 52
+#define YYLAST 54
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 22
+#define YYNTOKENS 23
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 5
/* YYNRULES -- Number of rules. */
-#define YYNRULES 19
+#define YYNRULES 20
/* YYNRULES -- Number of states. */
-#define YYNSTATES 37
+#define YYNSTATES 39
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 267
+#define YYMAXUTOK 268
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -388,12 +390,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 19, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 20, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 18, 2, 2,
- 20, 21, 16, 14, 2, 15, 2, 17, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 19, 2, 2,
+ 21, 22, 17, 15, 2, 16, 2, 18, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 13, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 14, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -413,7 +415,7 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12
+ 5, 6, 7, 8, 9, 10, 11, 12, 13
};
#if YYDEBUG
@@ -422,26 +424,28 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 5, 9, 11, 13, 15, 17, 21,
- 25, 29, 33, 36, 39, 43, 44, 47, 52, 57
+ 25, 29, 33, 36, 39, 43, 44, 47, 50, 55,
+ 60
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 23, 0, -1, 24, -1, 23, 19, 24, -1, 25,
- -1, 26, -1, 5, -1, 6, -1, 25, 14, 25,
- -1, 25, 15, 25, -1, 25, 16, 25, -1, 25,
- 17, 25, -1, 14, 25, -1, 15, 25, -1, 20,
- 25, 21, -1, -1, 10, 7, -1, 11, 25, 8,
- 6, -1, 12, 6, 13, 25, -1, 12, 6, 9,
- 25, -1
+ 24, 0, -1, 25, -1, 24, 20, 25, -1, 26,
+ -1, 27, -1, 5, -1, 6, -1, 26, 15, 26,
+ -1, 26, 16, 26, -1, 26, 17, 26, -1, 26,
+ 18, 26, -1, 15, 26, -1, 16, 26, -1, 21,
+ 26, 22, -1, -1, 10, 7, -1, 11, 6, -1,
+ 12, 26, 8, 6, -1, 13, 6, 14, 26, -1,
+ 13, 6, 9, 26, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 66, 66, 67, 70, 71, 74, 75, 76, 77,
- 78, 79, 80, 81, 82, 83, 86, 87, 88, 89
+ 0, 67, 67, 68, 71, 72, 75, 76, 77, 78,
+ 79, 80, 81, 82, 83, 84, 87, 88, 89, 90,
+ 91
};
#endif
@@ -451,9 +455,9 @@ static const yytype_uint8 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "UNARY", "FLOAT", "INT", "VAR", "STRING",
- "OP_INTO", "OP_TO", "FUNC_MCI", "FUNC_PUT", "FUNC_SET", "'='", "'+'",
- "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "$accept", "list",
- "statement", "expr", "func", 0
+ "OP_INTO", "OP_TO", "FUNC_MCI", "FUNC_MCIWAIT", "FUNC_PUT", "FUNC_SET",
+ "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'",
+ "$accept", "list", "statement", "expr", "func", 0
};
#endif
@@ -463,23 +467,25 @@ static const char *const yytname[] =
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 61, 43, 45, 42, 47, 37, 10,
- 40, 41
+ 265, 266, 267, 268, 61, 43, 45, 42, 47, 37,
+ 10, 40, 41
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 22, 23, 23, 24, 24, 25, 25, 25, 25,
- 25, 25, 25, 25, 25, 25, 26, 26, 26, 26
+ 0, 23, 24, 24, 25, 25, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 27, 27, 27, 27,
+ 27
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 1, 3, 1, 1, 1, 1, 3, 3,
- 3, 3, 2, 2, 3, 0, 2, 4, 4, 4
+ 3, 3, 2, 2, 3, 0, 2, 2, 4, 4,
+ 4
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -487,33 +493,33 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 15, 6, 7, 0, 15, 0, 15, 15, 15, 0,
- 2, 4, 5, 16, 0, 0, 12, 13, 0, 1,
- 15, 15, 15, 15, 15, 0, 15, 15, 14, 3,
- 8, 9, 10, 11, 17, 19, 18
+ 15, 6, 7, 0, 0, 15, 0, 15, 15, 15,
+ 0, 2, 4, 5, 16, 17, 0, 0, 12, 13,
+ 0, 1, 15, 15, 15, 15, 15, 0, 15, 15,
+ 14, 3, 8, 9, 10, 11, 18, 20, 19
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 9, 10, 11, 12
+ -1, 10, 11, 12, 13
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -9
+#define YYPACT_NINF -10
static const yytype_int8 yypact[] =
{
- 1, -9, -9, -6, 20, 4, 20, 20, 20, 5,
- -9, 35, -9, -9, 22, 18, -9, -9, 27, -9,
- 1, 20, 20, 20, 20, 8, 20, 20, -9, -9,
- -8, -8, -9, -9, -9, 35, 35
+ 1, -10, -10, -6, 4, 21, 9, 21, 21, 21,
+ 5, -10, 36, -10, -10, -10, 23, 19, -10, -10,
+ 28, -10, 1, 21, 21, 21, 21, 24, 21, 21,
+ -10, -10, -9, -9, -10, -10, -10, 36, 36
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -9, -9, 9, -4, -9
+ -10, -10, 7, -5, -10
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -523,32 +529,32 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
- 14, 13, 16, 17, 18, 19, 1, 2, 23, 24,
- 15, 3, 4, 5, 34, 6, 7, 30, 31, 32,
- 33, 8, 35, 36, 20, 1, 2, 26, 0, 29,
- 25, 27, 0, 0, 6, 7, 21, 22, 23, 24,
- 8, 21, 22, 23, 24, 0, 0, 0, 28, 21,
- 22, 23, 24
+ 16, 14, 18, 19, 20, 21, 1, 2, 25, 26,
+ 15, 3, 4, 5, 6, 17, 7, 8, 32, 33,
+ 34, 35, 9, 37, 38, 22, 1, 2, 28, 31,
+ 36, 27, 0, 29, 0, 0, 7, 8, 23, 24,
+ 25, 26, 9, 23, 24, 25, 26, 0, 0, 0,
+ 30, 23, 24, 25, 26
};
static const yytype_int8 yycheck[] =
{
- 4, 7, 6, 7, 8, 0, 5, 6, 16, 17,
- 6, 10, 11, 12, 6, 14, 15, 21, 22, 23,
- 24, 20, 26, 27, 19, 5, 6, 9, -1, 20,
- 8, 13, -1, -1, 14, 15, 14, 15, 16, 17,
- 20, 14, 15, 16, 17, -1, -1, -1, 21, 14,
- 15, 16, 17
+ 5, 7, 7, 8, 9, 0, 5, 6, 17, 18,
+ 6, 10, 11, 12, 13, 6, 15, 16, 23, 24,
+ 25, 26, 21, 28, 29, 20, 5, 6, 9, 22,
+ 6, 8, -1, 14, -1, -1, 15, 16, 15, 16,
+ 17, 18, 21, 15, 16, 17, 18, -1, -1, -1,
+ 22, 15, 16, 17, 18
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 5, 6, 10, 11, 12, 14, 15, 20, 23,
- 24, 25, 26, 7, 25, 6, 25, 25, 25, 0,
- 19, 14, 15, 16, 17, 8, 9, 13, 21, 24,
- 25, 25, 25, 25, 6, 25, 25
+ 0, 5, 6, 10, 11, 12, 13, 15, 16, 21,
+ 24, 25, 26, 27, 7, 6, 26, 6, 26, 26,
+ 26, 0, 20, 15, 16, 17, 18, 8, 9, 14,
+ 22, 25, 26, 26, 26, 26, 6, 26, 26
};
#define yyerrok (yyerrstatus = 0)
@@ -1363,83 +1369,88 @@ yyreduce:
switch (yyn)
{
case 4:
-#line 70 "engines/director/lingo/lingo-gr.y"
+#line 71 "engines/director/lingo/lingo-gr.y"
{ warning("%d", (yyvsp[(1) - (1)].i)); ;}
break;
case 5:
-#line 71 "engines/director/lingo/lingo-gr.y"
+#line 72 "engines/director/lingo/lingo-gr.y"
{ warning("%d", (yyvsp[(1) - (1)].i)); ;}
break;
case 6:
-#line 74 "engines/director/lingo/lingo-gr.y"
+#line 75 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = g_lingo->code2(g_lingo->func_constpush, (inst)(yyvsp[(1) - (1)].i)); ;}
break;
case 7:
-#line 75 "engines/director/lingo/lingo-gr.y"
+#line 76 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = vars[*(yyvsp[(1) - (1)].s)]; delete (yyvsp[(1) - (1)].s); ;}
break;
case 8:
-#line 76 "engines/director/lingo/lingo-gr.y"
+#line 77 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_add); ;}
break;
case 9:
-#line 77 "engines/director/lingo/lingo-gr.y"
+#line 78 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_sub); ;}
break;
case 10:
-#line 78 "engines/director/lingo/lingo-gr.y"
+#line 79 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mul); ;}
break;
case 11:
-#line 79 "engines/director/lingo/lingo-gr.y"
+#line 80 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_div); ;}
break;
case 12:
-#line 80 "engines/director/lingo/lingo-gr.y"
+#line 81 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(2) - (2)].i); ;}
break;
case 13:
-#line 81 "engines/director/lingo/lingo-gr.y"
+#line 82 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(2) - (2)].i); g_lingo->code1(g_lingo->func_negate); ;}
break;
case 14:
-#line 82 "engines/director/lingo/lingo-gr.y"
+#line 83 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(2) - (3)].i); ;}
break;
case 16:
-#line 86 "engines/director/lingo/lingo-gr.y"
+#line 87 "engines/director/lingo/lingo-gr.y"
{ g_lingo->func_mci((yyvsp[(2) - (2)].s)); delete (yyvsp[(2) - (2)].s); ;}
break;
case 17:
-#line 87 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = vars[*(yyvsp[(4) - (4)].s)] = (yyvsp[(2) - (4)].i); delete (yyvsp[(4) - (4)].s); ;}
+#line 88 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->func_mciwait((yyvsp[(2) - (2)].s)); ;}
break;
case 18:
-#line 88 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = vars[*(yyvsp[(2) - (4)].s)] = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
+#line 89 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = vars[*(yyvsp[(4) - (4)].s)] = (yyvsp[(2) - (4)].i); delete (yyvsp[(4) - (4)].s); ;}
break;
case 19:
-#line 89 "engines/director/lingo/lingo-gr.y"
+#line 90 "engines/director/lingo/lingo-gr.y"
+ { (yyval.i) = vars[*(yyvsp[(2) - (4)].s)] = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
+ break;
+
+ case 20:
+#line 91 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = vars[*(yyvsp[(2) - (4)].s)] = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1443 "engines/director/lingo/lingo-gr.cpp"
+#line 1454 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1653,6 +1664,6 @@ yyreturn:
}
-#line 92 "engines/director/lingo/lingo-gr.y"
+#line 94 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index ae10d1f..90f23d6 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -47,8 +47,9 @@
OP_INTO = 263,
OP_TO = 264,
FUNC_MCI = 265,
- FUNC_PUT = 266,
- FUNC_SET = 267
+ FUNC_MCIWAIT = 266,
+ FUNC_PUT = 267,
+ FUNC_SET = 268
};
#endif
/* Tokens. */
@@ -60,8 +61,9 @@
#define OP_INTO 263
#define OP_TO 264
#define FUNC_MCI 265
-#define FUNC_PUT 266
-#define FUNC_SET 267
+#define FUNC_MCIWAIT 266
+#define FUNC_PUT 267
+#define FUNC_SET 268
@@ -71,7 +73,7 @@ typedef union YYSTYPE
#line 43 "engines/director/lingo/lingo-gr.y"
{ float f; int i; Common::String *s; }
/* Line 1529 of yacc.c. */
-#line 75 "engines/director/lingo/lingo-gr.hpp"
+#line 77 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 14d80d3..d9a33f7 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -50,6 +50,7 @@ extern Lingo *g_lingo;
%token OP_INTO
%token OP_TO
%token FUNC_MCI
+%token FUNC_MCIWAIT
%token FUNC_PUT
%token FUNC_SET
@@ -84,6 +85,7 @@ expr: INT { $$ = g_lingo->code2(g_lingo->func_constpush, (inst)$1); }
;
func: FUNC_MCI STRING { g_lingo->func_mci($2); delete $2; }
+ | FUNC_MCIWAIT VAR { g_lingo->func_mciwait($2); }
| FUNC_PUT expr OP_INTO VAR { $$ = vars[*$4] = $2; delete $4; }
| FUNC_SET VAR '=' expr { $$ = vars[*$2] = $4; delete $2; }
| FUNC_SET VAR OP_TO expr { $$ = vars[*$2] = $4; delete $2; }
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index b639d53..e1130aa 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 13
-#define YY_END_OF_BUFFER 14
+#define YY_NUM_RULES 14
+#define YY_END_OF_BUFFER 15
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,12 +373,12 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[36] =
+static yyconst flex_int16_t yy_accept[40] =
{ 0,
- 0, 0, 14, 13, 11, 13, 10, 10, 9, 7,
- 7, 7, 7, 7, 7, 11, 0, 12, 1, 8,
- 9, 7, 7, 7, 7, 7, 6, 1, 8, 7,
- 3, 4, 5, 2, 0
+ 0, 0, 15, 14, 12, 14, 11, 11, 10, 8,
+ 8, 8, 8, 8, 8, 12, 0, 13, 1, 9,
+ 10, 8, 8, 8, 8, 8, 7, 1, 9, 8,
+ 3, 5, 6, 2, 8, 8, 8, 4, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -392,10 +392,10 @@ static yyconst flex_int32_t yy_ec[256] =
5, 1, 1, 1, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 1, 1, 1, 5, 9, 1, 9, 9, 10, 9,
+ 1, 1, 1, 5, 9, 1, 10, 9, 11, 9,
- 11, 9, 9, 9, 12, 9, 9, 9, 13, 14,
- 15, 16, 9, 9, 17, 18, 19, 9, 9, 9,
+ 12, 9, 9, 9, 13, 9, 9, 9, 14, 15,
+ 16, 17, 9, 9, 18, 19, 20, 9, 21, 9,
9, 9, 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,
@@ -413,48 +413,53 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[20] =
+static yyconst flex_int32_t yy_meta[22] =
{ 0,
1, 2, 3, 1, 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
} ;
-static yyconst flex_int16_t yy_base[39] =
+static yyconst flex_int16_t yy_base[43] =
{ 0,
- 0, 0, 49, 50, 18, 44, 50, 41, 15, 0,
- 32, 35, 25, 32, 27, 22, 37, 50, 0, 32,
- 19, 0, 21, 26, 19, 18, 0, 0, 26, 18,
- 0, 0, 0, 0, 50, 27, 25, 31
+ 0, 0, 55, 56, 20, 50, 56, 47, 17, 0,
+ 37, 40, 30, 37, 32, 24, 43, 56, 0, 38,
+ 21, 0, 26, 31, 24, 23, 0, 0, 33, 24,
+ 18, 0, 0, 0, 28, 23, 16, 0, 56, 29,
+ 27, 33
} ;
-static yyconst flex_int16_t yy_def[39] =
+static yyconst flex_int16_t yy_def[43] =
{ 0,
- 35, 1, 35, 35, 35, 36, 35, 35, 35, 37,
- 37, 37, 37, 37, 37, 35, 36, 35, 38, 35,
- 35, 37, 37, 37, 37, 37, 37, 38, 35, 37,
- 37, 37, 37, 37, 0, 35, 35, 35
+ 39, 1, 39, 39, 39, 40, 39, 39, 39, 41,
+ 41, 41, 41, 41, 41, 39, 40, 39, 42, 39,
+ 39, 41, 41, 41, 41, 41, 41, 42, 39, 41,
+ 41, 41, 41, 41, 41, 41, 41, 41, 0, 39,
+ 39, 39
} ;
-static yyconst flex_int16_t yy_nxt[70] =
+static yyconst flex_int16_t yy_nxt[78] =
{ 0,
4, 5, 5, 6, 7, 8, 4, 9, 10, 10,
- 10, 11, 12, 10, 10, 13, 14, 15, 10, 16,
- 16, 20, 21, 16, 16, 20, 21, 17, 22, 17,
- 17, 28, 34, 29, 28, 33, 32, 31, 30, 29,
- 18, 27, 26, 25, 24, 23, 19, 18, 35, 3,
- 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
- 35, 35, 35, 35, 35, 35, 35, 35, 35
+ 10, 10, 11, 12, 10, 10, 13, 14, 15, 10,
+ 10, 16, 16, 20, 21, 16, 16, 20, 21, 17,
+ 22, 17, 17, 28, 38, 37, 28, 36, 35, 34,
+ 29, 33, 32, 31, 30, 29, 18, 27, 26, 25,
+ 24, 23, 19, 18, 39, 3, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39
} ;
-static yyconst flex_int16_t yy_chk[70] =
+static yyconst flex_int16_t yy_chk[78] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 5,
- 5, 9, 9, 16, 16, 21, 21, 36, 37, 36,
- 36, 38, 30, 29, 38, 26, 25, 24, 23, 20,
- 17, 15, 14, 13, 12, 11, 8, 6, 3, 35,
- 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
- 35, 35, 35, 35, 35, 35, 35, 35, 35
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 5, 5, 9, 9, 16, 16, 21, 21, 40,
+ 41, 40, 40, 42, 37, 36, 42, 35, 31, 30,
+ 29, 26, 25, 24, 23, 20, 17, 15, 14, 13,
+ 12, 11, 8, 6, 3, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 39, 39
} ;
static yy_state_type yy_last_accepting_state;
@@ -504,7 +509,7 @@ char *yytext;
int yyparse();
-#line 508 "engines/director/lingo/lingo-lex.cpp"
+#line 513 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -689,7 +694,7 @@ YY_DECL
#line 44 "engines/director/lingo/lingo-lex.l"
-#line 693 "engines/director/lingo/lingo-lex.cpp"
+#line 698 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -742,13 +747,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 >= 36 )
+ if ( yy_current_state >= 40 )
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] != 50 );
+ while ( yy_base[yy_current_state] != 56 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -790,55 +795,60 @@ YY_RULE_SETUP
case 4:
YY_RULE_SETUP
#line 49 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_PUT; }
+{ return FUNC_MCIWAIT; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 50 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_SET; }
+{ return FUNC_PUT; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 51 "engines/director/lingo/lingo-lex.l"
-{ return OP_TO; }
+{ return FUNC_SET; }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 53 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+#line 52 "engines/director/lingo/lingo-lex.l"
+{ return OP_TO; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 54 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+{ yylval.s = new Common::String(yytext); return VAR; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 55 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 56 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 11:
-/* rule 11 can match eol */
YY_RULE_SETUP
#line 57 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ return *yytext; }
YY_BREAK
case 12:
+/* rule 12 can match eol */
YY_RULE_SETUP
#line 58 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return '\n'; }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 60 "engines/director/lingo/lingo-lex.l"
+#line 59 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+ YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 61 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 842 "engines/director/lingo/lingo-lex.cpp"
+#line 852 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1130,7 +1140,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 >= 36 )
+ if ( yy_current_state >= 40 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1158,11 +1168,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 >= 36 )
+ if ( yy_current_state >= 40 )
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 == 35);
+ yy_is_jam = (yy_current_state == 39);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1835,7 +1845,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 60 "engines/director/lingo/lingo-lex.l"
+#line 61 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index a206f96..e2a57d7 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -46,6 +46,7 @@ newline [\n\r]+
--[^\r\n]*
into { return OP_INTO; }
mci { return FUNC_MCI; }
+mciwait { return FUNC_MCIWAIT; }
put { return FUNC_PUT; }
set { return FUNC_SET; }
to { return OP_TO; }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 2e5c7b4..65a9fec 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -99,6 +99,7 @@ public:
static void func_negate();
static void func_constpush();
int func_mci(Common::String *s);
+ void func_mciwait(Common::String *s);
private:
Common::HashMap<uint32, const char *> _eventHandlerTypes;
Commit: 57e092ab8f4212b5fa3e549dcf45e8bd2f3237d9
https://github.com/scummvm/scummvm/commit/57e092ab8f4212b5fa3e549dcf45e8bd2f3237d9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix indentation
Changed paths:
engines/director/lingo/lingo-funcs.cpp
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index ee640de..4ff11a3 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -116,35 +116,42 @@ int Lingo::func_mci(Common::String *s) {
state = kMCITokenNone;
break;
}
-
}
switch (command) {
- case kMCITokenOpen: {
- warning("MCI open file: %s, type: %s, alias: %s buffer: %s", params[0].c_str(), params[1].c_str(), params[2].c_str(), params[3].c_str());
- Common::File *file = new Common::File();
- if (!file->open(params[0])) {
- warning("Failed to open %s", params[0].c_str());
- delete file;
- return 0;
- }
- if (params[1] == "waveaudio") {
- Audio::AudioStream *sound = Audio::makeWAVStream(file, DisposeAfterUse::YES);
- _audioAliases[params[2]] = sound;
- }
- else
- warning("Unhandled audio type %s", params[2].c_str());
+ case kMCITokenOpen:
+ {
+ warning("MCI open file: %s, type: %s, alias: %s buffer: %s", params[0].c_str(), params[1].c_str(), params[2].c_str(), params[3].c_str());
+
+ Common::File *file = new Common::File();
+
+ if (!file->open(params[0])) {
+ warning("Failed to open %s", params[0].c_str());
+ delete file;
+ return 0;
+ }
+
+ if (params[1] == "waveaudio") {
+ Audio::AudioStream *sound = Audio::makeWAVStream(file, DisposeAfterUse::YES);
+ _audioAliases[params[2]] = sound;
+ } else {
+ warning("Unhandled audio type %s", params[2].c_str());
+ }
}
break;
- case kMCITokenPlay: {
- warning("MCI play file: %s, from: %s, to: %s, repeat: %s", params[0].c_str(), params[1].c_str(), params[2].c_str(), params[3].c_str());
- if (!_audioAliases.contains(params[0])) {
- warning("Unknown alias %s", params[0].c_str());
- return 0;
- }
- uint32 from = strtol(params[1].c_str(), 0, 10);
- uint32 to = strtol(params[2].c_str(), 0, 10);
- _vm->getSoundManager()->playMCI(*_audioAliases[params[0]], from, to);
+ case kMCITokenPlay:
+ {
+ warning("MCI play file: %s, from: %s, to: %s, repeat: %s", params[0].c_str(), params[1].c_str(), params[2].c_str(), params[3].c_str());
+
+ if (!_audioAliases.contains(params[0])) {
+ warning("Unknown alias %s", params[0].c_str());
+ return 0;
+ }
+
+ uint32 from = strtol(params[1].c_str(), 0, 10);
+ uint32 to = strtol(params[2].c_str(), 0, 10);
+
+ _vm->getSoundManager()->playMCI(*_audioAliases[params[0]], from, to);
}
break;
default:
Commit: 6b5c0626f7318542726bacce75a56b93af59fbe5
https://github.com/scummvm/scummvm/commit/6b5c0626f7318542726bacce75a56b93af59fbe5
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Load palette directly to engine
Changed paths:
engines/director/director.cpp
engines/director/director.h
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 7808d52..dfb4928 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -64,6 +64,7 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
DirectorEngine::~DirectorEngine() {
delete _mainArchive;
delete _macBinary;
+ delete[] _currentPalette;
}
Common::Error DirectorEngine::run() {
@@ -85,7 +86,7 @@ Common::Error DirectorEngine::run() {
_mainArchive = new RIFFArchive();
_mainArchive->openFile("bookshelf_example.mmm");
- Score score(*_mainArchive, *_lingo, *_soundManager);
+ Score score(this);
debug(0, "Score name %s", score.getMacName().c_str());
score.loadArchive();
@@ -110,7 +111,7 @@ Common::HashMap<Common::String, Score *> DirectorEngine::loadMMMNames(Common::St
for (Common::FSList::const_iterator i = movies.begin(); i != movies.end(); ++i) {
RIFFArchive *arc = new RIFFArchive();
arc->openFile(i->getPath());
- Score *sc = new Score(*arc, *_lingo, *_soundManager);
+ Score *sc = new Score(this);
nameMap[sc->getMacName()] = sc;
}
}
@@ -266,4 +267,9 @@ Common::String DirectorEngine::readPascalString(Common::SeekableReadStream &stre
return x;
}
+void DirectorEngine::setPalette(byte *palette, uint16 count) {
+ _currentPalette = palette;
+ _currentPaletteLength = count;
+}
+
} // End of namespace Director
diff --git a/engines/director/director.h b/engines/director/director.h
index 9a961b7..7e32d5f 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -59,7 +59,12 @@ public:
Common::Language getLanguage() const;
Common::String getEXEName() const;
DirectorSound *getSoundManager() const { return _soundManager; }
+ Archive *getMainArchive() const { return _mainArchive; }
+ Lingo *getLingo() const { return _lingo; }
+ void setPalette(byte *palette, uint16 count);
bool hasFeature(EngineFeature f) const;
+ const byte *getPalette() const { return _currentPalette; }
+ uint16 getPaletteColorCount() const { return _currentPaletteLength; }
protected:
virtual Common::Error run();
@@ -74,7 +79,6 @@ private:
void loadEXEv5(Common::SeekableReadStream *stream);
void loadEXEv7(Common::SeekableReadStream *stream);
void loadEXERIFX(Common::SeekableReadStream *stream, uint32 offset);
-
void loadMac();
Common::String readPascalString(Common::SeekableReadStream &stream);
@@ -82,7 +86,8 @@ private:
Archive *_mainArchive;
Common::MacResManager *_macBinary;
DirectorSound *_soundManager;
-
+ byte *_currentPalette;
+ uint16 _currentPaletteLength;
Lingo *_lingo;
};
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 7868353..8a40670 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -39,12 +39,13 @@
namespace Director {
-Score::Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager) {
+Score::Score(DirectorEngine *vm) {
+ _vm = vm;
_surface = new Graphics::ManagedSurface;
_trailSurface = new Graphics::ManagedSurface;
- _movieArchive = &movie;
- _lingo = &lingo;
- _soundManager = &soundManager;
+ _movieArchive = _vm->getMainArchive();
+ _lingo = _vm->getLingo();
+ _soundManager = _vm->getSoundManager();
_lingo->processEvent(kEventPrepareMovie, 0);
_movieScriptCount = 0;
@@ -95,7 +96,7 @@ void Score::loadArchive() {
}
}
- DIBDecoder palette;
+
Common::Array<uint16> clutList = _movieArchive->getResourceIDList(MKTAG('C','L','U','T'));
if (clutList.size() > 1)
@@ -106,8 +107,8 @@ void Score::loadArchive() {
Common::SeekableReadStream *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]);
- palette.loadPalette(*pal);
- g_system->getPaletteManager()->setPalette(palette.getPalette(), 0, palette.getPaletteColorCount());
+ loadPalette(*pal);
+ g_system->getPaletteManager()->setPalette(_vm->getPalette(), 0, _vm->getPaletteColorCount());
}
Score::~Score() {
@@ -121,6 +122,26 @@ Score::~Score() {
delete _movieArchive;
}
+void Score::loadPalette(Common::SeekableReadStream &stream) {
+ uint16 steps = stream.size() / 6;
+ uint16 index = (steps * 3) - 1;
+ uint16 _paletteColorCount = steps;
+ byte *_palette = new byte[index];
+
+ for (uint8 i = 0; i < steps; i++) {
+ _palette[index - 2] = stream.readByte();
+ stream.readByte();
+
+ _palette[index - 1] = stream.readByte();
+ stream.readByte();
+
+ _palette[index] = stream.readByte();
+ stream.readByte();
+ index -= 3;
+ }
+ _vm->setPalette(_palette, _paletteColorCount);
+}
+
void Score::loadFrames(Common::SeekableReadStream &stream) {
uint32 size = stream.readUint32BE();
size -= 4;
diff --git a/engines/director/score.h b/engines/director/score.h
index 9490d5f..9ac8685 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -35,6 +35,7 @@ namespace Director {
class Lingo;
class DirectorSound;
class Score;
+class DirectorEngine;
#define CHANNEL_COUNT 24
@@ -285,7 +286,7 @@ public:
class Score {
public:
- Score(Archive &movie, Lingo &lingo, DirectorSound &soundManager);
+ Score(DirectorEngine *vm);
~Score();
static Common::Rect readRect(Common::SeekableReadStream &stream);
@@ -298,6 +299,7 @@ private:
void update();
void readVersion(uint32 rid);
void loadConfig(Common::SeekableReadStream &stream);
+ void loadPalette(Common::SeekableReadStream &stream);
void loadCastData(Common::SeekableReadStream &stream);
void loadFrames(Common::SeekableReadStream &stream);
void loadLabels(Common::SeekableReadStream &stream);
@@ -341,6 +343,7 @@ private:
uint16 _stageColor;
Lingo *_lingo;
DirectorSound *_soundManager;
+ DirectorEngine *_vm;
};
} //End of namespace Director
Commit: 6a0e3945cf220fb944599e20dbd3490aadb6673e
https://github.com/scummvm/scummvm/commit/6a0e3945cf220fb944599e20dbd3490aadb6673e
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Set engine pointer in Frame
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 8a40670..04b61a6 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -59,12 +59,25 @@ Score::Score(DirectorEngine *vm) {
}
void Score::loadArchive() {
+ Common::Array<uint16> clutList = _movieArchive->getResourceIDList(MKTAG('C','L','U','T'));
+
+ if (clutList.size() > 1)
+ error("More than one palette was found");
+
+ if (clutList.size() == 0)
+ error("CLUT not found");
+
+ Common::SeekableReadStream *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]);
+
+ loadPalette(*pal);
+ g_system->getPaletteManager()->setPalette(_vm->getPalette(), 0, _vm->getPaletteColorCount());
assert(_movieArchive->hasResource(MKTAG('V','W','S','C'), 1024));
assert(_movieArchive->hasResource(MKTAG('V','W','C','F'), 1024));
assert(_movieArchive->hasResource(MKTAG('V','W','C','R'), 1024));
loadFrames(*_movieArchive->getResource(MKTAG('V','W','S','C'), 1024));
loadConfig(*_movieArchive->getResource(MKTAG('V','W','C','F'), 1024));
loadCastData(*_movieArchive->getResource(MKTAG('V','W','C','R'), 1024));
+
if (_movieArchive->hasResource(MKTAG('V','W','A','C'), 1024)) {
loadActions(*_movieArchive->getResource(MKTAG('V','W','A','C'), 1024));
}
@@ -95,20 +108,6 @@ void Score::loadArchive() {
loadScriptText(*_movieArchive->getResource(MKTAG('S','T','X','T'), *iterator));
}
}
-
-
- Common::Array<uint16> clutList = _movieArchive->getResourceIDList(MKTAG('C','L','U','T'));
-
- if (clutList.size() > 1)
- error("More than one palette was found");
-
- if (clutList.size() == 0)
- error("CLUT not found");
-
- Common::SeekableReadStream *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]);
-
- loadPalette(*pal);
- g_system->getPaletteManager()->setPalette(_vm->getPalette(), 0, _vm->getPaletteColorCount());
}
Score::~Score() {
@@ -148,7 +147,7 @@ void Score::loadFrames(Common::SeekableReadStream &stream) {
uint16 channelSize;
uint16 channelOffset;
- Frame *initial = new Frame();
+ Frame *initial = new Frame(_vm);
_frames.push_back(initial);
while (size != 0) {
@@ -652,7 +651,8 @@ void Score::processEvents() {
}
}
-Frame::Frame() {
+Frame::Frame(DirectorEngine *vm) {
+ _vm = vm;
_transDuration = 0;
_transArea = 0;
_transChunkSize = 0;
@@ -676,6 +676,7 @@ Frame::Frame() {
}
Frame::Frame(const Frame &frame) {
+ _vm = frame._vm;
_actionId = frame._actionId;
_transArea = frame._transArea;
_transDuration = frame._transDuration;
diff --git a/engines/director/score.h b/engines/director/score.h
index 9ac8685..626e47b 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -246,7 +246,7 @@ public:
class Frame {
public:
- Frame();
+ Frame(DirectorEngine *vm);
Frame(const Frame &frame);
~Frame();
@@ -282,6 +282,7 @@ public:
uint8 _blend;
Common::Array<Sprite *> _sprites;
Common::Array<Common::Rect > _drawRects;
+ DirectorEngine *_vm;
};
class Score {
Commit: 36df662863add2b9d88b5ecdbc11d06b25b3ecb3
https://github.com/scummvm/scummvm/commit/36df662863add2b9d88b5ecdbc11d06b25b3ecb3
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Handle transition chunk size exception
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 04b61a6..9e10ede 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -888,6 +888,10 @@ void Frame::playSoundChannel() {
void Frame::playTransition(Score *score) {
uint16 duration = _transDuration * 250; // _transDuration in 1/4 of sec
duration = (duration == 0 ? 250 : duration); // director support transition duration = 0, but animation play like value = 1, idk.
+
+ if (_transChunkSize == 0)
+ _transChunkSize = 1; //equal 1 step
+
uint16 stepDuration = duration / _transChunkSize;
uint16 steps = duration / stepDuration;
Commit: dfdb194957e8b1634d1aa08bf2bc0659c038c9ac
https://github.com/scummvm/scummvm/commit/dfdb194957e8b1634d1aa08bf2bc0659c038c9ac
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix Matte ink rendering
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 9e10ede..3f0e37f 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1098,7 +1098,29 @@ void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Su
Graphics::Surface tmp;
tmp.copyFrom(sprite);
- Graphics::FloodFill ff(&tmp, *(byte *)tmp.getBasePtr(0, 0), 0, true);
+ // Searching white color in the corners
+ int whiteColor = -1;
+
+ for (int corner = 0; corner < 4; corner++) {
+ int x = (corner & 0x1) ? tmp.w - 1 : 0;
+ int y = (corner & 0x2) ? tmp.h - 1 : 0;
+
+ byte color = *(byte *)tmp.getBasePtr(x, y);
+
+ if (_vm->getPalette()[color * 3 + 0] == 0xff &&
+ _vm->getPalette()[color * 3 + 1] == 0xff &&
+ _vm->getPalette()[color * 3 + 2] == 0xff) {
+ whiteColor = color;
+ break;
+ }
+ }
+
+ if (whiteColor == -1) {
+ warning("No white color for Matte image");
+ whiteColor = *(byte *)tmp.getBasePtr(0, 0);
+ }
+
+ Graphics::FloodFill ff(&tmp, whiteColor, 0, true);
for (int yy = 0; yy < tmp.h; yy++) {
ff.addSeed(0, yy);
Commit: 0fa5505d659bcd0a3548f6c5d8fcfb84054b3cb8
https://github.com/scummvm/scummvm/commit/0fa5505d659bcd0a3548f6c5d8fcfb84054b3cb8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Hide noisy debug messages
Changed paths:
engines/director/lingo/lingo.cpp
engines/director/resource.cpp
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index ddb1cb1..8341d5a 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -81,7 +81,7 @@ Lingo::~Lingo() {
}
void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
- debug(0, "Add code \"%s\" for type %d with id %d", code.c_str(), type, id);
+ debug(2, "Add code \"%s\" for type %d with id %d", code.c_str(), type, id);
if (_scripts[type].contains(id)) {
delete _scripts[type][id];
@@ -97,7 +97,7 @@ void Lingo::processEvent(LEvent event, int entityId) {
if (!_eventHandlerTypes.contains(event))
error("processEvent: Unknown event %d for entity %d", event, entityId);
- debug(0, "processEvent(%s) for %d", _eventHandlerTypes[event], entityId);
+ debug(2, "processEvent(%s) for %d", _eventHandlerTypes[event], entityId);
}
} // End of namespace Director
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 7d56fc0..3ac9b4b 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -262,7 +262,7 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
stream->seek(startResPos);
- debug(0, "Found RIFF resource '%s' %d: %d @ 0x%08x", tag2str(tag), id, size, offset);
+ debug(3, "Found RIFF resource '%s' %d: %d @ 0x%08x", tag2str(tag), id, size, offset);
ResourceMap &resMap = _types[tag];
Resource &res = resMap[id];
@@ -364,7 +364,7 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
/*uint16 unk1 = */ subStream.readUint16();
/*uint32 unk2 = */ subStream.readUint32();
- debug(0, "Found RIFX resource index %d: '%s', %d @ 0x%08x", i, tag2str(tag), size, offset);
+ debug(3, "Found RIFX resource index %d: '%s', %d @ 0x%08x", i, tag2str(tag), size, offset);
Resource res;
res.offset = offset;
@@ -427,7 +427,7 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
}
const Resource &res = resources[index];
- debug(0, "Found RIFX resource: '%s' 0x%04x, %d @ 0x%08x", tag2str(resTag), id, res.size, res.offset);
+ debug(3, "Found RIFX resource: '%s' 0x%04x, %d @ 0x%08x", tag2str(resTag), id, res.size, res.offset);
_types[resTag][id] = res;
}
Commit: 9d72e0137b039b77271ff1f084290d647622c0bd
https://github.com/scummvm/scummvm/commit/9d72e0137b039b77271ff1f084290d647622c0bd
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix trail surface bug
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 3f0e37f..9bbb0d3 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -71,6 +71,7 @@ void Score::loadArchive() {
loadPalette(*pal);
g_system->getPaletteManager()->setPalette(_vm->getPalette(), 0, _vm->getPaletteColorCount());
+
assert(_movieArchive->hasResource(MKTAG('V','W','S','C'), 1024));
assert(_movieArchive->hasResource(MKTAG('V','W','C','F'), 1024));
assert(_movieArchive->hasResource(MKTAG('V','W','C','R'), 1024));
@@ -1158,6 +1159,7 @@ uint16 Frame::getSpriteIDFromPos(Common::Point pos) {
Sprite::Sprite() {
_enabled = false;
+ _trails = 0;
_width = 0;
_ink = kInkTypeCopy;
_flags = 0;
@@ -1170,6 +1172,7 @@ Sprite::Sprite(const Sprite &sprite) {
_enabled = sprite._enabled;
_castId = sprite._castId;
_flags = sprite._flags;
+ _trails = sprite._trails;
_ink = sprite._ink;
_width = sprite._width;
_height = sprite._height;
Commit: bb7125620d2f0919fcf671b50644af3acef39cbf
https://github.com/scummvm/scummvm/commit/bb7125620d2f0919fcf671b50644af3acef39cbf
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Move all functions to compiler
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index dfb4928..ce67329 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -72,14 +72,14 @@ Common::Error DirectorEngine::run() {
_lingo = new Lingo(this);
_soundManager = new DirectorSound();
- _lingo->parse("mci \"open MM\\T005045a.wav type WaveAudio alias T005045a\"\n\
- mci \"play T005045a from 22710 to 32872\"");
+ _lingo->addCode("mci \"open MM\\T005045a.wav type WaveAudio alias T005045a\"\n\
+ mci \"play T005045a from 22710 to 32872\"", kMovieScript, 1);
#if 0
- _lingo->parse("set x = 1\n\
+ _lingo->addCode("set x = 1\n\
set y to 2 -- this set y to 4\n\
put 5 into z\n\
--- some more\n");
+-- some more\n", kMovieScript, 2);
#endif
//FIXME
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 4ff11a3..1fb4c19 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -61,7 +61,7 @@ struct MCIToken {
{ kMCITokenNone, kMCITokenNone, 0, 0 }
};
-int Lingo::func_mci(Common::String *s) {
+int Lingo::exec_mci(Common::String *s) {
Common::String params[5];
MCITokenType command = kMCITokenNone;
@@ -161,13 +161,22 @@ int Lingo::func_mci(Common::String *s) {
return 0;
}
-void Lingo::func_mciwait(Common::String *s) {
+void Lingo::exec_mciwait(Common::String *s) {
warning("MCI wait file: %s", s->c_str());
}
void Lingo::func_constpush() {
}
+void Lingo::func_varpush() {
+}
+
+void Lingo::func_assign() {
+}
+
+void Lingo::func_eval() {
+}
+
void Lingo::func_add() {
}
@@ -183,4 +192,10 @@ void Lingo::func_div() {
void Lingo::func_negate() {
}
+void Lingo::func_mci() {
+}
+
+void Lingo::func_mciwait() {
+}
+
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index ff3513f..f8209be 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -1385,7 +1385,7 @@ yyreduce:
case 7:
#line 76 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = vars[*(yyvsp[(1) - (1)].s)]; delete (yyvsp[(1) - (1)].s); ;}
+ { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.i) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
case 8:
@@ -1410,7 +1410,7 @@ yyreduce:
case 12:
#line 81 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(2) - (2)].i); ;}
+ { (yyval.i) = (yyvsp[(2) - (2)].i); ;}
break;
case 13:
@@ -1420,32 +1420,32 @@ yyreduce:
case 14:
#line 83 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(2) - (3)].i); ;}
+ { (yyval.i) = (yyvsp[(2) - (3)].i); ;}
break;
case 16:
#line 87 "engines/director/lingo/lingo-gr.y"
- { g_lingo->func_mci((yyvsp[(2) - (2)].s)); delete (yyvsp[(2) - (2)].s); ;}
+ { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 17:
#line 88 "engines/director/lingo/lingo-gr.y"
- { g_lingo->func_mciwait((yyvsp[(2) - (2)].s)); ;}
+ { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 18:
#line 89 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = vars[*(yyvsp[(4) - (4)].s)] = (yyvsp[(2) - (4)].i); delete (yyvsp[(4) - (4)].s); ;}
+ { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.i) = (yyvsp[(2) - (4)].i); delete (yyvsp[(4) - (4)].s); ;}
break;
case 19:
#line 90 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = vars[*(yyvsp[(2) - (4)].s)] = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
+ { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.i) = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
break;
case 20:
#line 91 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = vars[*(yyvsp[(2) - (4)].s)] = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
+ { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.i) = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
break;
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index d9a33f7..e300c5c 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -73,22 +73,22 @@ statement: expr { warning("%d", $1); }
;
expr: INT { $$ = g_lingo->code2(g_lingo->func_constpush, (inst)$1); }
- | VAR { $$ = vars[*$1]; delete $1; }
+ | VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($1->c_str()); $$ = g_lingo->code1(g_lingo->func_eval); delete $1; }
| expr '+' expr { g_lingo->code1(g_lingo->func_add); }
| expr '-' expr { g_lingo->code1(g_lingo->func_sub); }
| expr '*' expr { g_lingo->code1(g_lingo->func_mul); }
| expr '/' expr { g_lingo->code1(g_lingo->func_div); }
- | '+' expr %prec UNARY { $$ = $2; }
+ | '+' expr %prec UNARY { $$ = $2; }
| '-' expr %prec UNARY { $$ = $2; g_lingo->code1(g_lingo->func_negate); }
- | '(' expr ')' { $$ = $2; }
+ | '(' expr ')' { $$ = $2; }
|
;
-func: FUNC_MCI STRING { g_lingo->func_mci($2); delete $2; }
- | FUNC_MCIWAIT VAR { g_lingo->func_mciwait($2); }
- | FUNC_PUT expr OP_INTO VAR { $$ = vars[*$4] = $2; delete $4; }
- | FUNC_SET VAR '=' expr { $$ = vars[*$2] = $4; delete $2; }
- | FUNC_SET VAR OP_TO expr { $$ = vars[*$2] = $4; delete $2; }
+func: FUNC_MCI STRING { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString($2->c_str()); delete $2; }
+ | FUNC_MCIWAIT VAR { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
+ | FUNC_PUT expr OP_INTO VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($4->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $2; delete $4; }
+ | FUNC_SET VAR '=' expr { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $4; delete $2; }
+ | FUNC_SET VAR OP_TO expr { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $4; delete $2; }
;
%%
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 8341d5a..c96e353 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -80,6 +80,22 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
Lingo::~Lingo() {
}
+int Lingo::codeString(const char *str) {
+ int instLen = sizeof(inst);
+ int numInsts = (strlen(str) + 1 + instLen - 1) % instLen;
+
+ // Allocate needed space in script
+ _currentScript->push_back(0);
+ char *start = (char *)(&_currentScript->back());
+
+ for (int i = 0; i < numInsts - 1; i++)
+ _currentScript->push_back(0);
+
+ Common::strlcpy(start, str, numInsts * instLen);
+
+ return _currentScript->size();
+}
+
void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
debug(2, "Add code \"%s\" for type %d with id %d", code.c_str(), type, id);
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 65a9fec..b209afb 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -85,11 +85,11 @@ public:
void processEvent(LEvent event, int entityId);
- int parse(const char *code);
-
int code1(inst code) { _currentScript->push_back(code); return _currentScript->size(); }
int code2(inst code_1, inst code_2) { code1(code_1); return code1(code_2); }
int code3(inst code_1, inst code_2, inst code_3) { code1(code_1); code1(code_2); return code1(code_3); }
+ int codeString(const char *s);
+
public:
static void func_add();
@@ -98,10 +98,17 @@ public:
static void func_div();
static void func_negate();
static void func_constpush();
- int func_mci(Common::String *s);
- void func_mciwait(Common::String *s);
+ static void func_varpush();
+ static void func_assign();
+ static void func_eval();
+ static void func_mci();
+ static void func_mciwait();
+ int exec_mci(Common::String *s);
+ void exec_mciwait(Common::String *s);
private:
+ int parse(const char *code);
+
Common::HashMap<uint32, const char *> _eventHandlerTypes;
Common::HashMap<Common::String, Audio::AudioStream *> _audioAliases;
Commit: 6cb2a3cd00ea2c88564ade88707e693102e661cf
https://github.com/scummvm/scummvm/commit/6cb2a3cd00ea2c88564ade88707e693102e661cf
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix crash on exit
Changed paths:
engines/director/director.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index ce67329..fb93400 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -55,6 +55,7 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
_mainArchive = 0;
_macBinary = 0;
+ _currentPalette = 0;
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "data");
@@ -75,12 +76,12 @@ Common::Error DirectorEngine::run() {
_lingo->addCode("mci \"open MM\\T005045a.wav type WaveAudio alias T005045a\"\n\
mci \"play T005045a from 22710 to 32872\"", kMovieScript, 1);
-#if 0
- _lingo->addCode("set x = 1\n\
+ _lingo->addCode("set x = 1 + 3\n\
set y to 2 -- this set y to 4\n\
put 5 into z\n\
-- some more\n", kMovieScript, 2);
-#endif
+
+ return Common::kNoError;
//FIXME
_mainArchive = new RIFFArchive();
Commit: 53dceb95f70774096a1653693286e86092f3bc0a
https://github.com/scummvm/scummvm/commit/53dceb95f70774096a1653693286e86092f3bc0a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Swithc to warning() on syntax error, and avoid printing values
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index f8209be..4950ee4 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -107,7 +107,7 @@ Common::HashMap<Common::String, int, Common::IgnoreCase_Hash, Common::IgnoreCase
extern int yylex();
extern int yyparse();
-void yyerror(char *s) { error("%s", s); }
+void yyerror(char *s) { warning("%s", s); }
using namespace Director;
@@ -1368,17 +1368,7 @@ yyreduce:
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
- case 4:
-#line 71 "engines/director/lingo/lingo-gr.y"
- { warning("%d", (yyvsp[(1) - (1)].i)); ;}
- break;
-
- case 5:
-#line 72 "engines/director/lingo/lingo-gr.y"
- { warning("%d", (yyvsp[(1) - (1)].i)); ;}
- break;
-
- case 6:
+ case 6:
#line 75 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = g_lingo->code2(g_lingo->func_constpush, (inst)(yyvsp[(1) - (1)].i)); ;}
break;
@@ -1450,7 +1440,7 @@ yyreduce:
/* Line 1267 of yacc.c. */
-#line 1454 "engines/director/lingo/lingo-gr.cpp"
+#line 1444 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index e300c5c..aadcd3c 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -30,7 +30,7 @@ Common::HashMap<Common::String, int, Common::IgnoreCase_Hash, Common::IgnoreCase
extern int yylex();
extern int yyparse();
-void yyerror(char *s) { error("%s", s); }
+void yyerror(char *s) { warning("%s", s); }
using namespace Director;
@@ -68,8 +68,8 @@ list: statement
| list '\n' statement
;
-statement: expr { warning("%d", $1); }
- | func { warning("%d", $1); }
+statement: expr
+ | func
;
expr: INT { $$ = g_lingo->code2(g_lingo->func_constpush, (inst)$1); }
Commit: 6d2a7aa7590775950aa76f363cb83d4844b4fe04
https://github.com/scummvm/scummvm/commit/6d2a7aa7590775950aa76f363cb83d4844b4fe04
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix codeString() method
Changed paths:
engines/director/lingo/lingo.cpp
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index c96e353..141f227 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -82,16 +82,18 @@ Lingo::~Lingo() {
int Lingo::codeString(const char *str) {
int instLen = sizeof(inst);
- int numInsts = (strlen(str) + 1 + instLen - 1) % instLen;
+ int numInsts = strlen(str) / instLen + (strlen(str) + 1 + instLen - 1) % instLen;
- // Allocate needed space in script
- _currentScript->push_back(0);
- char *start = (char *)(&_currentScript->back());
+ // Where we copy the string over
+ int pos = _currentScript->size();
- for (int i = 0; i < numInsts - 1; i++)
+ // Allocate needed space in script
+ for (int i = 0; i < numInsts; i++)
_currentScript->push_back(0);
- Common::strlcpy(start, str, numInsts * instLen);
+ byte *dst = (byte *)&_currentScript->front() + pos * sizeof(inst);
+
+ memcpy(dst, str, strlen(str) + 1);
return _currentScript->size();
}
@@ -107,6 +109,8 @@ void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
_scripts[type][id] = _currentScript;
parse(code.c_str());
+
+ Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst));
}
void Lingo::processEvent(LEvent event, int entityId) {
Commit: 7760ea8d86e92e448fd0a23fd7f7500d3454516f
https://github.com/scummvm/scummvm/commit/7760ea8d86e92e448fd0a23fd7f7500d3454516f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Beginning of the stack definition
Changed paths:
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index b209afb..34bb6b0 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -73,8 +73,25 @@ enum LEvent {
typedef void (*inst)(void);
#define STOP (inst)0
+typedef struct Symbol { /* symbol table entry */
+ char *name;
+ long type;
+ union {
+ int val; /* VAR */
+ float fval; /* FLOAT */
+ inst *defn; /* FUNCTION, PROCEDURE */
+ char *str; /* STRING */
+ } u;
+} Symbol;
+
+typedef union Datum { /* interpreter stack type */
+ double val;
+ Symbol *sym;
+} Datum;
+
typedef Common::Array<inst> ScriptData;
typedef Common::HashMap<int32, ScriptData *> ScriptHash;
+typedef Common::Array<Datum> StackData;
class Lingo {
public:
@@ -115,6 +132,8 @@ private:
ScriptHash _scripts[kMaxScriptType + 1];
ScriptData *_currentScript;
+ StackData _stack;
+
DirectorEngine *_vm;
};
Commit: 5bbfea01fef459e1fb6fb1f40780e94b78e720b1
https://github.com/scummvm/scummvm/commit/5bbfea01fef459e1fb6fb1f40780e94b78e720b1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Added some lingo-func code
Changed paths:
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 1fb4c19..4557ace 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -165,7 +165,24 @@ void Lingo::exec_mciwait(Common::String *s) {
warning("MCI wait file: %s", s->c_str());
}
+void Lingo::push(Datum d) {
+ _stack.push_back(d);
+}
+
+Datum Lingo::pop(void) {
+ if (_stack.size() == 0)
+ error("stack underflow");
+
+ Datum ret = _stack.back();
+ _stack.pop_back();
+
+ return ret;
+}
+
void Lingo::func_constpush() {
+ Datum d;
+ d.val = ((Symbol *)*g_lingo->_pc++)->u.val;
+ g_lingo->push(d);
}
void Lingo::func_varpush() {
@@ -178,15 +195,39 @@ void Lingo::func_eval() {
}
void Lingo::func_add() {
+ Datum d1, d2;
+ d2 = g_lingo->pop();
+ d1 = g_lingo->pop();
+ d1.val += d2.val;
+ g_lingo->push(d1);
}
void Lingo::func_sub() {
+ Datum d1, d2;
+ d2 = g_lingo->pop();
+ d1 = g_lingo->pop();
+ d1.val -= d2.val;
+ g_lingo->push(d1);
}
void Lingo::func_mul() {
+ Datum d1, d2;
+ d2 = g_lingo->pop();
+ d1 = g_lingo->pop();
+ d1.val *= d2.val;
+ g_lingo->push(d1);
}
void Lingo::func_div() {
+ Datum d1, d2;
+ d2 = g_lingo->pop();
+
+ if (d2.val == 0)
+ error("division by zero");
+
+ d1 = g_lingo->pop();
+ d1.val /= d2.val;
+ g_lingo->push(d1);
}
void Lingo::func_negate() {
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 4950ee4..21164ed 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -111,10 +111,6 @@ void yyerror(char *s) { warning("%s", s); }
using namespace Director;
-namespace Director {
-extern Lingo *g_lingo;
-}
-
/* Enabling traces. */
@@ -137,10 +133,10 @@ extern Lingo *g_lingo;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 43 "engines/director/lingo/lingo-gr.y"
+#line 39 "engines/director/lingo/lingo-gr.y"
{ float f; int i; Common::String *s; }
/* Line 193 of yacc.c. */
-#line 144 "engines/director/lingo/lingo-gr.cpp"
+#line 140 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -153,7 +149,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 157 "engines/director/lingo/lingo-gr.cpp"
+#line 153 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -443,9 +439,9 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 67, 67, 68, 71, 72, 75, 76, 77, 78,
- 79, 80, 81, 82, 83, 84, 87, 88, 89, 90,
- 91
+ 0, 63, 63, 64, 67, 68, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 83, 84, 85, 86,
+ 87
};
#endif
@@ -1369,78 +1365,78 @@ yyreduce:
switch (yyn)
{
case 6:
-#line 75 "engines/director/lingo/lingo-gr.y"
+#line 71 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = g_lingo->code2(g_lingo->func_constpush, (inst)(yyvsp[(1) - (1)].i)); ;}
break;
case 7:
-#line 76 "engines/director/lingo/lingo-gr.y"
+#line 72 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.i) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
case 8:
-#line 77 "engines/director/lingo/lingo-gr.y"
+#line 73 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_add); ;}
break;
case 9:
-#line 78 "engines/director/lingo/lingo-gr.y"
+#line 74 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_sub); ;}
break;
case 10:
-#line 79 "engines/director/lingo/lingo-gr.y"
+#line 75 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mul); ;}
break;
case 11:
-#line 80 "engines/director/lingo/lingo-gr.y"
+#line 76 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_div); ;}
break;
case 12:
-#line 81 "engines/director/lingo/lingo-gr.y"
+#line 77 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(2) - (2)].i); ;}
break;
case 13:
-#line 82 "engines/director/lingo/lingo-gr.y"
+#line 78 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(2) - (2)].i); g_lingo->code1(g_lingo->func_negate); ;}
break;
case 14:
-#line 83 "engines/director/lingo/lingo-gr.y"
+#line 79 "engines/director/lingo/lingo-gr.y"
{ (yyval.i) = (yyvsp[(2) - (3)].i); ;}
break;
case 16:
-#line 87 "engines/director/lingo/lingo-gr.y"
+#line 83 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 17:
-#line 88 "engines/director/lingo/lingo-gr.y"
+#line 84 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 18:
-#line 89 "engines/director/lingo/lingo-gr.y"
+#line 85 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.i) = (yyvsp[(2) - (4)].i); delete (yyvsp[(4) - (4)].s); ;}
break;
case 19:
-#line 90 "engines/director/lingo/lingo-gr.y"
+#line 86 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.i) = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
break;
case 20:
-#line 91 "engines/director/lingo/lingo-gr.y"
+#line 87 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.i) = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1444 "engines/director/lingo/lingo-gr.cpp"
+#line 1440 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1654,6 +1650,6 @@ yyreturn:
}
-#line 94 "engines/director/lingo/lingo-gr.y"
+#line 90 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 90f23d6..81753f7 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -70,7 +70,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 43 "engines/director/lingo/lingo-gr.y"
+#line 39 "engines/director/lingo/lingo-gr.y"
{ float f; int i; Common::String *s; }
/* Line 1529 of yacc.c. */
#line 77 "engines/director/lingo/lingo-gr.hpp"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index aadcd3c..7d73f67 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -34,10 +34,6 @@ void yyerror(char *s) { warning("%s", s); }
using namespace Director;
-namespace Director {
-extern Lingo *g_lingo;
-}
-
%}
%union { float f; int i; Common::String *s; }
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 141f227..4ac9c12 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -73,6 +73,7 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
_eventHandlerTypes[t->handler] = t->name;
_currentScript = 0;
+ _pc = 0;
warning("Lingo Inited");
}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 34bb6b0..bfb5a76 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -125,6 +125,8 @@ public:
private:
int parse(const char *code);
+ void push(Datum d);
+ Datum pop(void);
Common::HashMap<uint32, const char *> _eventHandlerTypes;
Common::HashMap<Common::String, Audio::AudioStream *> _audioAliases;
@@ -132,11 +134,15 @@ private:
ScriptHash _scripts[kMaxScriptType + 1];
ScriptData *_currentScript;
+ inst *_pc;
+
StackData _stack;
DirectorEngine *_vm;
};
+extern Lingo *g_lingo;
+
} // End of namespace Director
#endif
Commit: f675f9be936e89bcf9985d660c17510bb497dcf7
https://github.com/scummvm/scummvm/commit/f675f9be936e89bcf9985d660c17510bb497dcf7
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add initial code for QuickTime video
Changed paths:
A engines/director/movie.cpp
A engines/director/movie.h
engines/director/director.cpp
engines/director/director.h
engines/director/module.mk
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index fb93400..25a0e3f 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -87,11 +87,11 @@ Common::Error DirectorEngine::run() {
_mainArchive = new RIFFArchive();
_mainArchive->openFile("bookshelf_example.mmm");
- Score score(this);
- debug(0, "Score name %s", score.getMacName().c_str());
+ _currentScore = new Score(this);
+ debug(0, "Score name %s", _currentScore->getMacName().c_str());
- score.loadArchive();
- score.startLoop();
+ _currentScore->loadArchive();
+ _currentScore->startLoop();
if (getPlatform() == Common::kPlatformWindows)
loadEXE();
diff --git a/engines/director/director.h b/engines/director/director.h
index 7e32d5f..8a35ac0 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -61,6 +61,7 @@ public:
DirectorSound *getSoundManager() const { return _soundManager; }
Archive *getMainArchive() const { return _mainArchive; }
Lingo *getLingo() const { return _lingo; }
+ Score *getCurrentScore() const { return _currentScore; }
void setPalette(byte *palette, uint16 count);
bool hasFeature(EngineFeature f) const;
const byte *getPalette() const { return _currentPalette; }
@@ -89,6 +90,7 @@ private:
byte *_currentPalette;
uint16 _currentPaletteLength;
Lingo *_lingo;
+ Score *_currentScore;
};
} // End of namespace Director
diff --git a/engines/director/module.mk b/engines/director/module.mk
index c6f1f02..2d0bb51 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -4,6 +4,7 @@ MODULE_OBJS = \
detection.o \
dib.o \
director.o \
+ movie.o \
resource.o \
score.o \
sound.o \
diff --git a/engines/director/movie.cpp b/engines/director/movie.cpp
new file mode 100644
index 0000000..3c34e2d
--- /dev/null
+++ b/engines/director/movie.cpp
@@ -0,0 +1,66 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "video/qt_decoder.h"
+#include "director/movie.h"
+#include "director/score.h"
+#include "common/debug.h"
+#include "common/system.h"
+namespace Director {
+
+Movie::Movie(Common::String fileName, DirectorEngine *vm) {
+ _vm = vm;
+ _currentVideo = new Video::QuickTimeDecoder();
+ if (!_currentVideo->loadFile(fileName)) {
+ warning("Can not open file %s", fileName.c_str());
+ return;
+ }
+}
+
+void Movie::play(Common::Point dest) {
+
+ _currentVideo->start();
+
+ uint16 width = _currentVideo->getWidth();
+ uint16 height = _currentVideo->getHeight();
+
+ while (!_currentVideo->endOfVideo()) {
+ if (_currentVideo->needsUpdate()) {
+ const Graphics::Surface *frame = _currentVideo->decodeNextFrame();
+ g_system->copyRectToScreen(frame->getPixels(), frame->pitch, dest.x, dest.y, width, height);
+ g_system->updateScreen();
+ }
+ g_system->delayMillis(10);
+ _vm->getCurrentScore()->processEvents();
+ }
+}
+
+void Movie::stop() {
+ _currentVideo->stop();
+}
+
+Movie::~Movie() {
+ delete _currentVideo;
+}
+
+} //End of namespace Director
diff --git a/engines/director/movie.h b/engines/director/movie.h
new file mode 100644
index 0000000..e26d10a
--- /dev/null
+++ b/engines/director/movie.h
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * Additional copyright for this file:
+ * Copyright (C) 1995-1997 Presto Studios, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef DIRECTOR_MOVIE_H
+#define DIRECTOR_MOVIE_H
+
+#include "common/str.h"
+#include "common/rect.h"
+#include "graphics/managed_surface.h"
+#include "director/director.h"
+
+namespace Video {
+class VideoDecoder;
+}
+
+namespace Director {
+
+class Movie {
+public:
+ Movie(Common::String fileName, DirectorEngine *vm);
+ ~Movie();
+ void play(Common::Point dest);
+ void stop();
+
+private:
+ Video::VideoDecoder *_currentVideo;
+ DirectorEngine *_vm;
+};
+} //End of namespace Director
+
+#endif
Commit: 632a07500fb16fbaa3c82f0ba95e803efee471de
https://github.com/scummvm/scummvm/commit/632a07500fb16fbaa3c82f0ba95e803efee471de
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix trans initialization
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 9bbb0d3..7b56e55 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -655,6 +655,7 @@ void Score::processEvents() {
Frame::Frame(DirectorEngine *vm) {
_vm = vm;
_transDuration = 0;
+ _transType = kTransNone;
_transArea = 0;
_transChunkSize = 0;
_tempo = 0;
diff --git a/engines/director/score.h b/engines/director/score.h
index 626e47b..4546b42 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -110,7 +110,8 @@ enum ScriptType {
};
enum TransitionType {
- kTransWipeRight = 1,
+ kTransNone,
+ kTransWipeRight,
kTransWipeLeft,
kTransWipeDown,
kTransWipeUp,
Commit: 952c2ceabdfe52105147d4625a820f97c64819f1
https://github.com/scummvm/scummvm/commit/952c2ceabdfe52105147d4625a820f97c64819f1
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add some enums for cast structures
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 7b56e55..14965d4 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -506,23 +506,30 @@ BitmapCast::BitmapCast(Common::SeekableReadStream &stream) {
TextCast::TextCast(Common::SeekableReadStream &stream) {
/*byte flags =*/ stream.readByte();
- borderSize = stream.readByte();
- gutterSize = stream.readByte();
- boxShadow = stream.readByte();
- textType = stream.readByte();
- textAlign = stream.readUint16BE();
+ borderSize = static_cast<SizeType>(stream.readByte());
+ gutterSize = static_cast<SizeType>(stream.readByte());
+ boxShadow = static_cast<SizeType>(stream.readByte());
+ textType = static_cast<TextType>(stream.readByte());
+ textAlign = static_cast<TextAlignType>(stream.readUint16BE());
stream.skip(6); //palinfo
/*uint32 unk1 = */ stream.readUint32BE();
initialRect = Score::readRect(stream);
- textShadow = stream.readByte();
- textFlags = stream.readByte();
+ textShadow = static_cast<SizeType>(stream.readByte());
+ byte flags = stream.readByte();
+ if (flags & 0x1)
+ textFlags.push_back(kTextFlagEditable);
+ if (flags & 0x2)
+ textFlags.push_back(kTextFlagAutoTab);
+ if (flags & 0x4)
+ textFlags.push_back(kTextFlagDoNotWrap);
+
/*uint16 unk2 =*/ stream.readUint16BE();
}
ShapeCast::ShapeCast(Common::SeekableReadStream &stream) {
/*byte flags = */ stream.readByte();
/*unk1 = */ stream.readByte();
- shapeType = stream.readByte();
+ shapeType = static_cast<ShapeType>(stream.readByte());
initialRect = Score::readRect(stream);
pattern = stream.readUint16BE();
fgCol = stream.readByte();
diff --git a/engines/director/score.h b/engines/director/score.h
index 4546b42..79eeae0 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -179,10 +179,17 @@ struct BitmapCast : Cast {
uint8 flags;
};
+enum ShapeType {
+ kShapeRectangle,
+ kShapeRoundRect,
+ kShapeOval,
+ kShapeLine
+};
+
struct ShapeCast : Cast {
ShapeCast(Common::SeekableReadStream &stream);
- byte shapeType;
+ ShapeType shapeType;
uint16 pattern;
byte fgCol;
byte bgCol;
@@ -191,26 +198,58 @@ struct ShapeCast : Cast {
byte lineDirection;
};
+enum TextType {
+ kTextTypeAdjustToFit,
+ kTextTypeScrolling,
+ kTextTypeFixed
+};
+
+enum TextAlignType {
+ kTextAlignRight = -1,
+ kTextAlignLeft,
+ kTextAlignCenter
+};
+
+enum TextFlag {
+ kTextFlagEditable,
+ kTextFlagAutoTab,
+ kTextFlagDoNotWrap
+};
+
+enum SizeType {
+ kSizeNone,
+ kSizeSmallest,
+ kSizeSmall,
+ kSizeMedium,
+ kSizeLarge,
+ kSizeLargest
+};
+
struct TextCast : Cast {
TextCast(Common::SeekableReadStream &stream);
- byte borderSize;
- byte gutterSize;
- byte boxShadow;
+ SizeType borderSize;
+ SizeType gutterSize;
+ SizeType boxShadow;
+
+ TextType textType;
+ TextAlignType textAlign;
+ SizeType textShadow;
+ Common::Array<TextFlag> textFlags;
+};
- byte textType;
- byte textAlign;
- byte textShadow;
- byte textFlags;
+enum ButtonType {
+ kTypeButton,
+ kTypeCheckBox,
+ kTypeRadio
};
struct ButtonCast : TextCast {
ButtonCast(Common::SeekableReadStream &stream) : TextCast(stream) {
- buttonType = stream.readUint16BE();
+ buttonType = static_cast<ButtonType>(stream.readUint16BE());
}
- //TODO types?
- uint16 buttonType;
+ ButtonType buttonType;
};
struct CastInfo {
Commit: a5b69ca37d7f493d3d8f9380a4a4d0b78ab16b79
https://github.com/scummvm/scummvm/commit/a5b69ca37d7f493d3d8f9380a4a4d0b78ab16b79
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Handle Ghost, Reverse ink types
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 14965d4..74285a6 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1076,6 +1076,12 @@ void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Co
case kInkTypeMatte:
drawMatteSprite(surface, *img.getSurface(), drawRect);
break;
+ case kInkTypeGhost:
+ drawGhostSprite(surface, *img.getSurface(), drawRect);
+ break;
+ case kInkTypeReverse:
+ drawReverseSprite(surface, *img.getSurface(), drawRect);
+ break;
default:
warning("Unhandled ink type %d", _sprites[i]->_ink);
surface.blitFrom(*img.getSurface(), Common::Point(x, y));
@@ -1086,7 +1092,7 @@ void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Co
}
void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
- uint8 skipColor = 15; //FIXME is it always white (last entry in pallette) ?
+ uint8 skipColor = _vm->getPaletteColorCount() - 1; //FIXME is it always white (last entry in pallette) ?
for (int ii = 0; ii < sprite.h; ii++) {
const byte *src = (const byte *)sprite.getBasePtr(0, ii);
@@ -1102,6 +1108,39 @@ void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graph
}
}
+void Frame::drawGhostSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
+ uint8 skipColor = _vm->getPaletteColorCount() - 1;
+ for (int ii = 0; ii < sprite.h; ii++) {
+ const byte *src = (const byte *)sprite.getBasePtr(0, ii);
+ byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + ii);
+
+ for (int j = 0; j < drawRect.width(); j++) {
+ if ((getSpriteIDFromPos(Common::Point(drawRect.left + j, drawRect.top + ii)) != 0) && (*src != skipColor))
+ *dst = (_vm->getPaletteColorCount() - 1) - *src; //Oposite color
+
+ src++;
+ dst++;
+ }
+ }
+}
+
+void Frame::drawReverseSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
+ uint8 skipColor = _vm->getPaletteColorCount() - 1;
+ for (int ii = 0; ii < sprite.h; ii++) {
+ const byte *src = (const byte *)sprite.getBasePtr(0, ii);
+ byte *dst = (byte *)target.getBasePtr(drawRect.left, drawRect.top + ii);
+
+ for (int j = 0; j < drawRect.width(); j++) {
+ if ((getSpriteIDFromPos(Common::Point(drawRect.left + j, drawRect.top + ii)) != 0))
+ *dst = (_vm->getPaletteColorCount() - 1) - *src;
+ else if (*src != skipColor)
+ *dst = *src;
+ src++;
+ dst++;
+ }
+ }
+}
+
void Frame::drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
//Like background trans, but all white pixels NOT ENCLOSED by coloured pixels are transparent
Graphics::Surface tmp;
diff --git a/engines/director/score.h b/engines/director/score.h
index 79eeae0..a1d7281 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -303,7 +303,8 @@ private:
void readMainChannels(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
void drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
void drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
-
+ void drawGhostSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
+ void drawReverseSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
public:
uint8 _actionId;
uint8 _transDuration;
Commit: 76282dc9d75e7a4a3b3a05b4a376a536a1f48ad2
https://github.com/scummvm/scummvm/commit/76282dc9d75e7a4a3b3a05b4a376a536a1f48ad2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Added printing func
Changed paths:
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 4557ace..8664f74 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -179,6 +179,16 @@ Datum Lingo::pop(void) {
return ret;
}
+void Lingo::func_xpop() {
+ g_lingo->pop();
+}
+
+void Lingo::func_printtop(void) {
+ Datum d = g_lingo->pop();
+
+ warning("%d\n", d.val);
+}
+
void Lingo::func_constpush() {
Datum d;
d.val = ((Symbol *)*g_lingo->_pc++)->u.val;
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 21164ed..27c1851 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -67,8 +67,8 @@
know about them. */
enum yytokentype {
UNARY = 258,
- FLOAT = 259,
- INT = 260,
+ INT = 259,
+ FLOAT = 260,
VAR = 261,
STRING = 262,
OP_INTO = 263,
@@ -81,8 +81,8 @@
#endif
/* Tokens. */
#define UNARY 258
-#define FLOAT 259
-#define INT 260
+#define INT 259
+#define FLOAT 260
#define VAR 261
#define STRING 262
#define OP_INTO 263
@@ -134,9 +134,14 @@ using namespace Director;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 39 "engines/director/lingo/lingo-gr.y"
-{ float f; int i; Common::String *s; }
+{
+ Common::String *s;
+ int i;
+ float f;
+ int code;
+}
/* Line 193 of yacc.c. */
-#line 140 "engines/director/lingo/lingo-gr.cpp"
+#line 145 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -149,7 +154,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 153 "engines/director/lingo/lingo-gr.cpp"
+#line 158 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -362,18 +367,18 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 21
+#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 54
+#define YYLAST 63
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 23
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 5
+#define YYNNTS 6
/* YYNRULES -- Number of rules. */
-#define YYNRULES 20
+#define YYNRULES 22
/* YYNRULES -- Number of states. */
-#define YYNSTATES 39
+#define YYNSTATES 43
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -419,29 +424,30 @@ static const yytype_uint8 yytranslate[] =
YYRHS. */
static const yytype_uint8 yyprhs[] =
{
- 0, 0, 3, 5, 9, 11, 13, 15, 17, 21,
- 25, 29, 33, 36, 39, 43, 44, 47, 50, 55,
- 60
+ 0, 0, 3, 4, 7, 11, 15, 19, 23, 28,
+ 33, 38, 40, 42, 44, 48, 52, 56, 60, 63,
+ 66, 70, 73
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 24, 0, -1, 25, -1, 24, 20, 25, -1, 26,
- -1, 27, -1, 5, -1, 6, -1, 26, 15, 26,
- -1, 26, 16, 26, -1, 26, 17, 26, -1, 26,
- 18, 26, -1, 15, 26, -1, 16, 26, -1, 21,
- 26, 22, -1, -1, 10, 7, -1, 11, 6, -1,
- 12, 26, 8, 6, -1, 13, 6, 14, 26, -1,
- 13, 6, 9, 26, -1
+ 24, 0, -1, -1, 24, 20, -1, 24, 28, 20,
+ -1, 24, 25, 20, -1, 24, 26, 20, -1, 24,
+ 27, 20, -1, 12, 27, 8, 6, -1, 13, 6,
+ 14, 27, -1, 13, 6, 9, 27, -1, 27, -1,
+ 4, -1, 6, -1, 27, 15, 27, -1, 27, 16,
+ 27, -1, 27, 17, 27, -1, 27, 18, 27, -1,
+ 15, 27, -1, 16, 27, -1, 21, 27, 22, -1,
+ 10, 7, -1, 11, 6, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 63, 63, 64, 67, 68, 71, 72, 73, 74,
- 75, 76, 77, 78, 79, 80, 83, 84, 85, 86,
- 87
+ 0, 66, 66, 67, 68, 69, 70, 71, 74, 75,
+ 76, 79, 82, 83, 84, 85, 86, 87, 88, 89,
+ 90, 93, 94
};
#endif
@@ -450,10 +456,10 @@ static const yytype_uint8 yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "UNARY", "FLOAT", "INT", "VAR", "STRING",
+ "$end", "error", "$undefined", "UNARY", "INT", "FLOAT", "VAR", "STRING",
"OP_INTO", "OP_TO", "FUNC_MCI", "FUNC_MCIWAIT", "FUNC_PUT", "FUNC_SET",
"'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'",
- "$accept", "list", "statement", "expr", "func", 0
+ "$accept", "list", "assign", "statement", "expr", "func", 0
};
#endif
@@ -471,17 +477,17 @@ static const yytype_uint16 yytoknum[] =
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 23, 24, 24, 25, 25, 26, 26, 26, 26,
- 26, 26, 26, 26, 26, 26, 27, 27, 27, 27,
- 27
+ 0, 23, 24, 24, 24, 24, 24, 24, 25, 25,
+ 25, 26, 27, 27, 27, 27, 27, 27, 27, 27,
+ 27, 28, 28
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
- 0, 2, 1, 3, 1, 1, 1, 1, 3, 3,
- 3, 3, 2, 2, 3, 0, 2, 2, 4, 4,
- 4
+ 0, 2, 0, 2, 3, 3, 3, 3, 4, 4,
+ 4, 1, 1, 1, 3, 3, 3, 3, 2, 2,
+ 3, 2, 2
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -489,33 +495,35 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 15, 6, 7, 0, 0, 15, 0, 15, 15, 15,
- 0, 2, 4, 5, 16, 17, 0, 0, 12, 13,
- 0, 1, 15, 15, 15, 15, 15, 0, 15, 15,
- 14, 3, 8, 9, 10, 11, 18, 20, 19
+ 2, 0, 1, 12, 13, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 0, 0, 21, 22, 0,
+ 0, 18, 19, 0, 5, 6, 0, 0, 0, 0,
+ 7, 4, 0, 0, 0, 20, 14, 15, 16, 17,
+ 8, 10, 9
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 10, 11, 12, 13
+ -1, 1, 13, 14, 15, 16
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -10
+#define YYPACT_NINF -14
static const yytype_int8 yypact[] =
{
- 1, -10, -10, -6, 4, 21, 9, 21, 21, 21,
- 5, -10, 36, -10, -10, -10, 23, 19, -10, -10,
- 28, -10, 1, 21, 21, 21, 21, 24, 21, 21,
- -10, -10, -9, -9, -10, -10, -10, 36, 36
+ -14, 24, -14, -14, -14, -6, 3, 2, 10, 2,
+ 2, -14, 2, -13, 5, 39, 9, -14, -14, -4,
+ 1, -14, -14, 31, -14, -14, 2, 2, 2, 2,
+ -14, -14, 27, 2, 2, -14, 14, 14, -14, -14,
+ -14, 45, 45
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -10, -10, 7, -5, -10
+ -14, -14, -14, -14, -7, -14
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -525,32 +533,35 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
- 16, 14, 18, 19, 20, 21, 1, 2, 25, 26,
- 15, 3, 4, 5, 6, 17, 7, 8, 32, 33,
- 34, 35, 9, 37, 38, 22, 1, 2, 28, 31,
- 36, 27, 0, 29, 0, 0, 7, 8, 23, 24,
- 25, 26, 9, 23, 24, 25, 26, 0, 0, 0,
- 30, 23, 24, 25, 26
+ 19, 17, 21, 22, 32, 23, 3, 24, 4, 18,
+ 33, 26, 27, 28, 29, 34, 20, 9, 10, 36,
+ 37, 38, 39, 12, 2, 25, 41, 42, 3, 31,
+ 4, 28, 29, 40, 5, 6, 7, 8, 0, 9,
+ 10, 0, 0, 0, 11, 12, 26, 27, 28, 29,
+ 0, 0, 0, 35, 26, 27, 28, 29, 0, 30,
+ 26, 27, 28, 29
};
static const yytype_int8 yycheck[] =
{
- 5, 7, 7, 8, 9, 0, 5, 6, 17, 18,
- 6, 10, 11, 12, 13, 6, 15, 16, 23, 24,
- 25, 26, 21, 28, 29, 20, 5, 6, 9, 22,
- 6, 8, -1, 14, -1, -1, 15, 16, 15, 16,
- 17, 18, 21, 15, 16, 17, 18, -1, -1, -1,
- 22, 15, 16, 17, 18
+ 7, 7, 9, 10, 8, 12, 4, 20, 6, 6,
+ 9, 15, 16, 17, 18, 14, 6, 15, 16, 26,
+ 27, 28, 29, 21, 0, 20, 33, 34, 4, 20,
+ 6, 17, 18, 6, 10, 11, 12, 13, -1, 15,
+ 16, -1, -1, -1, 20, 21, 15, 16, 17, 18,
+ -1, -1, -1, 22, 15, 16, 17, 18, -1, 20,
+ 15, 16, 17, 18
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 5, 6, 10, 11, 12, 13, 15, 16, 21,
- 24, 25, 26, 27, 7, 6, 26, 6, 26, 26,
- 26, 0, 20, 15, 16, 17, 18, 8, 9, 14,
- 22, 25, 26, 26, 26, 26, 6, 26, 26
+ 0, 24, 0, 4, 6, 10, 11, 12, 13, 15,
+ 16, 20, 21, 25, 26, 27, 28, 7, 6, 27,
+ 6, 27, 27, 27, 20, 20, 15, 16, 17, 18,
+ 20, 20, 8, 9, 14, 22, 27, 27, 27, 27,
+ 6, 27, 27
};
#define yyerrok (yyerrstatus = 0)
@@ -1364,79 +1375,99 @@ yyreduce:
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
- case 6:
-#line 71 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = g_lingo->code2(g_lingo->func_constpush, (inst)(yyvsp[(1) - (1)].i)); ;}
+ case 5:
+#line 69 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code2(g_lingo->func_xpop, STOP); return 1; ;}
+ break;
+
+ case 6:
+#line 70 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(STOP); return 1; ;}
break;
case 7:
-#line 72 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.i) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
+#line 71 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code2(g_lingo->func_printtop, STOP); return 1; ;}
break;
case 8:
-#line 73 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_add); ;}
+#line 74 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
break;
case 9:
-#line 74 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_sub); ;}
+#line 75 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 10:
-#line 75 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_mul); ;}
+#line 76 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 11:
-#line 76 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_div); ;}
+#line 79 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_xpop); ;}
break;
case 12:
-#line 77 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(2) - (2)].i); ;}
+#line 82 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = g_lingo->code2(g_lingo->func_constpush, (inst)(yyvsp[(1) - (1)].i)); ;}
break;
case 13:
-#line 78 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(2) - (2)].i); g_lingo->code1(g_lingo->func_negate); ;}
+#line 83 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
case 14:
-#line 79 "engines/director/lingo/lingo-gr.y"
- { (yyval.i) = (yyvsp[(2) - (3)].i); ;}
+#line 84 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_add); ;}
+ break;
+
+ case 15:
+#line 85 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_sub); ;}
break;
case 16:
-#line 83 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+#line 86 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_mul); ;}
break;
case 17:
-#line 84 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+#line 87 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_div); ;}
break;
case 18:
-#line 85 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.i) = (yyvsp[(2) - (4)].i); delete (yyvsp[(4) - (4)].s); ;}
+#line 88 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 19:
-#line 86 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.i) = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
+#line 89 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
break;
case 20:
-#line 87 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.i) = (yyvsp[(4) - (4)].i); delete (yyvsp[(2) - (4)].s); ;}
+#line 90 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+ break;
+
+ case 21:
+#line 93 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 22:
+#line 94 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1440 "engines/director/lingo/lingo-gr.cpp"
+#line 1471 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1650,6 +1681,6 @@ yyreturn:
}
-#line 90 "engines/director/lingo/lingo-gr.y"
+#line 97 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 81753f7..6da4c9f 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -40,8 +40,8 @@
know about them. */
enum yytokentype {
UNARY = 258,
- FLOAT = 259,
- INT = 260,
+ INT = 259,
+ FLOAT = 260,
VAR = 261,
STRING = 262,
OP_INTO = 263,
@@ -54,8 +54,8 @@
#endif
/* Tokens. */
#define UNARY 258
-#define FLOAT 259
-#define INT 260
+#define INT 259
+#define FLOAT 260
#define VAR 261
#define STRING 262
#define OP_INTO 263
@@ -71,9 +71,14 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 39 "engines/director/lingo/lingo-gr.y"
-{ float f; int i; Common::String *s; }
+{
+ Common::String *s;
+ int i;
+ float f;
+ int code;
+}
/* Line 1529 of yacc.c. */
-#line 77 "engines/director/lingo/lingo-gr.hpp"
+#line 82 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 7d73f67..86ae2f1 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -36,13 +36,17 @@ using namespace Director;
%}
-%union { float f; int i; Common::String *s; }
+%union {
+ Common::String *s;
+ int i;
+ float f;
+ int code;
+}
%token UNARY
-%token<f> FLOAT
%token<i> INT
-%token<s> VAR
-%token<s> STRING
+%token<f> FLOAT
+%token<s> VAR STRING
%token OP_INTO
%token OP_TO
%token FUNC_MCI
@@ -50,8 +54,7 @@ using namespace Director;
%token FUNC_PUT
%token FUNC_SET
-%type<i> expr
-%type<i> func
+%type<code> assign expr
%right '='
%left '+' '-'
@@ -60,12 +63,20 @@ using namespace Director;
%%
-list: statement
- | list '\n' statement
+list: /* empty */
+ | list '\n'
+ | list func '\n'
+ | list assign '\n' { g_lingo->code2(g_lingo->func_xpop, STOP); return 1; }
+ | list statement '\n' { g_lingo->code1(STOP); return 1; }
+ | list expr '\n' { g_lingo->code2(g_lingo->func_printtop, STOP); return 1; }
+ ;
+
+assign: FUNC_PUT expr OP_INTO VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($4->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $2; delete $4; }
+ | FUNC_SET VAR '=' expr { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $4; delete $2; }
+ | FUNC_SET VAR OP_TO expr { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $4; delete $2; }
;
-statement: expr
- | func
+statement: expr { g_lingo->code1(g_lingo->func_xpop); }
;
expr: INT { $$ = g_lingo->code2(g_lingo->func_constpush, (inst)$1); }
@@ -77,14 +88,10 @@ expr: INT { $$ = g_lingo->code2(g_lingo->func_constpush, (inst)$1); }
| '+' expr %prec UNARY { $$ = $2; }
| '-' expr %prec UNARY { $$ = $2; g_lingo->code1(g_lingo->func_negate); }
| '(' expr ')' { $$ = $2; }
- |
;
func: FUNC_MCI STRING { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString($2->c_str()); delete $2; }
| FUNC_MCIWAIT VAR { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
- | FUNC_PUT expr OP_INTO VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($4->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $2; delete $4; }
- | FUNC_SET VAR '=' expr { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $4; delete $2; }
- | FUNC_SET VAR OP_TO expr { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $4; delete $2; }
;
%%
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index bfb5a76..c00d239 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -85,7 +85,7 @@ typedef struct Symbol { /* symbol table entry */
} Symbol;
typedef union Datum { /* interpreter stack type */
- double val;
+ int val;
Symbol *sym;
} Datum;
@@ -109,6 +109,8 @@ public:
public:
+ static void func_xpop();
+ static void func_printtop();
static void func_add();
static void func_sub();
static void func_mul();
Commit: b3676907c5acd43e0cf7667e168809514e54498e
https://github.com/scummvm/scummvm/commit/b3676907c5acd43e0cf7667e168809514e54498e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implemented script execution
Changed paths:
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 4ac9c12..fc79167 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -100,6 +100,8 @@ int Lingo::codeString(const char *str) {
}
void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
+ code += '\n';
+
debug(2, "Add code \"%s\" for type %d with id %d", code.c_str(), type, id);
if (_scripts[type].contains(id)) {
@@ -114,6 +116,17 @@ void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst));
}
+void Lingo::executeScript(ScriptType type, uint16 id) {
+ if (!_scripts[type].contains(id)) {
+ warning("Request to execute non-existant script type %d id %d", type, id);
+ return;
+ }
+
+ for(_pc = &_scripts[type][id]->front(); *_pc != STOP;) {
+ (*((++_pc)[-1]))();
+ }
+}
+
void Lingo::processEvent(LEvent event, int entityId) {
if (!_eventHandlerTypes.contains(event))
error("processEvent: Unknown event %d for entity %d", event, entityId);
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index c00d239..fba82a2 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -99,6 +99,7 @@ public:
~Lingo();
void addCode(Common::String code, ScriptType type, uint16 id);
+ void executeScript(ScriptType type, uint16 id);
void processEvent(LEvent event, int entityId);
Commit: 3476761be6351b316ff90c24a2e7ca0ae5827d5b
https://github.com/scummvm/scummvm/commit/3476761be6351b316ff90c24a2e7ca0ae5827d5b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix func_constpush() and made it portable
Changed paths:
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 8664f74..c9c14a5 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -191,7 +191,8 @@ void Lingo::func_printtop(void) {
void Lingo::func_constpush() {
Datum d;
- d.val = ((Symbol *)*g_lingo->_pc++)->u.val;
+ inst i = *g_lingo->_pc++;
+ d.val = READ_LE_UINT32(&i);
g_lingo->push(d);
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 27c1851..fcf3bd9 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -369,16 +369,16 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 63
+#define YYLAST 59
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 23
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 6
+#define YYNNTS 5
/* YYNRULES -- Number of rules. */
-#define YYNRULES 22
+#define YYNRULES 20
/* YYNRULES -- Number of states. */
-#define YYNSTATES 43
+#define YYNSTATES 41
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -424,30 +424,29 @@ static const yytype_uint8 yytranslate[] =
YYRHS. */
static const yytype_uint8 yyprhs[] =
{
- 0, 0, 3, 4, 7, 11, 15, 19, 23, 28,
- 33, 38, 40, 42, 44, 48, 52, 56, 60, 63,
- 66, 70, 73
+ 0, 0, 3, 4, 7, 11, 15, 19, 24, 29,
+ 34, 36, 38, 42, 46, 50, 54, 57, 60, 64,
+ 67
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 24, 0, -1, -1, 24, 20, -1, 24, 28, 20,
- -1, 24, 25, 20, -1, 24, 26, 20, -1, 24,
- 27, 20, -1, 12, 27, 8, 6, -1, 13, 6,
- 14, 27, -1, 13, 6, 9, 27, -1, 27, -1,
- 4, -1, 6, -1, 27, 15, 27, -1, 27, 16,
- 27, -1, 27, 17, 27, -1, 27, 18, 27, -1,
- 15, 27, -1, 16, 27, -1, 21, 27, 22, -1,
- 10, 7, -1, 11, 6, -1
+ 24, 0, -1, -1, 24, 20, -1, 24, 27, 20,
+ -1, 24, 25, 20, -1, 24, 26, 20, -1, 12,
+ 26, 8, 6, -1, 13, 6, 14, 26, -1, 13,
+ 6, 9, 26, -1, 4, -1, 6, -1, 26, 15,
+ 26, -1, 26, 16, 26, -1, 26, 17, 26, -1,
+ 26, 18, 26, -1, 15, 26, -1, 16, 26, -1,
+ 21, 26, 22, -1, 10, 7, -1, 11, 6, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 66, 66, 67, 68, 69, 70, 71, 74, 75,
- 76, 79, 82, 83, 84, 85, 86, 87, 88, 89,
- 90, 93, 94
+ 0, 66, 66, 67, 68, 69, 71, 74, 75, 76,
+ 82, 83, 84, 85, 86, 87, 88, 89, 90, 93,
+ 94
};
#endif
@@ -459,7 +458,7 @@ static const char *const yytname[] =
"$end", "error", "$undefined", "UNARY", "INT", "FLOAT", "VAR", "STRING",
"OP_INTO", "OP_TO", "FUNC_MCI", "FUNC_MCIWAIT", "FUNC_PUT", "FUNC_SET",
"'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'",
- "$accept", "list", "assign", "statement", "expr", "func", 0
+ "$accept", "list", "assign", "expr", "func", 0
};
#endif
@@ -477,17 +476,17 @@ static const yytype_uint16 yytoknum[] =
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 23, 24, 24, 24, 24, 24, 24, 25, 25,
- 25, 26, 27, 27, 27, 27, 27, 27, 27, 27,
- 27, 28, 28
+ 0, 23, 24, 24, 24, 24, 24, 25, 25, 25,
+ 26, 26, 26, 26, 26, 26, 26, 26, 26, 27,
+ 27
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
- 0, 2, 0, 2, 3, 3, 3, 3, 4, 4,
- 4, 1, 1, 1, 3, 3, 3, 3, 2, 2,
- 3, 2, 2
+ 0, 2, 0, 2, 3, 3, 3, 4, 4, 4,
+ 1, 1, 3, 3, 3, 3, 2, 2, 3, 2,
+ 2
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -495,35 +494,35 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 2, 0, 1, 12, 13, 0, 0, 0, 0, 0,
- 0, 3, 0, 0, 0, 0, 0, 21, 22, 0,
- 0, 18, 19, 0, 5, 6, 0, 0, 0, 0,
- 7, 4, 0, 0, 0, 20, 14, 15, 16, 17,
- 8, 10, 9
+ 2, 0, 1, 10, 11, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 0, 19, 20, 0, 0,
+ 16, 17, 0, 5, 0, 0, 0, 0, 6, 4,
+ 0, 0, 0, 18, 12, 13, 14, 15, 7, 9,
+ 8
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 1, 13, 14, 15, 16
+ -1, 1, 13, 14, 15
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -14
+#define YYPACT_NINF -9
static const yytype_int8 yypact[] =
{
- -14, 24, -14, -14, -14, -6, 3, 2, 10, 2,
- 2, -14, 2, -13, 5, 39, 9, -14, -14, -4,
- 1, -14, -14, 31, -14, -14, 2, 2, 2, 2,
- -14, -14, 27, 2, 2, -14, 14, 14, -14, -14,
- -14, 45, 45
+ -9, 22, -9, -9, -9, 6, -5, 0, 17, 0,
+ 0, -9, 0, 7, 35, 9, -9, -9, 31, 27,
+ -9, -9, -8, -9, 0, 0, 0, 0, -9, -9,
+ 24, 0, 0, -9, -6, -6, -9, -9, -9, 41,
+ 41
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -14, -14, -14, -14, -7, -14
+ -9, -9, -9, -7, -9
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -533,24 +532,22 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
- 19, 17, 21, 22, 32, 23, 3, 24, 4, 18,
- 33, 26, 27, 28, 29, 34, 20, 9, 10, 36,
- 37, 38, 39, 12, 2, 25, 41, 42, 3, 31,
- 4, 28, 29, 40, 5, 6, 7, 8, 0, 9,
- 10, 0, 0, 0, 11, 12, 26, 27, 28, 29,
- 0, 0, 0, 35, 26, 27, 28, 29, 0, 30,
- 26, 27, 28, 29
+ 18, 17, 20, 21, 3, 22, 4, 24, 25, 26,
+ 27, 26, 27, 16, 33, 9, 10, 34, 35, 36,
+ 37, 12, 2, 19, 39, 40, 3, 23, 4, 29,
+ 38, 0, 5, 6, 7, 8, 31, 9, 10, 30,
+ 0, 32, 11, 12, 0, 0, 24, 25, 26, 27,
+ 24, 25, 26, 27, 0, 28, 24, 25, 26, 27
};
static const yytype_int8 yycheck[] =
{
- 7, 7, 9, 10, 8, 12, 4, 20, 6, 6,
- 9, 15, 16, 17, 18, 14, 6, 15, 16, 26,
- 27, 28, 29, 21, 0, 20, 33, 34, 4, 20,
- 6, 17, 18, 6, 10, 11, 12, 13, -1, 15,
- 16, -1, -1, -1, 20, 21, 15, 16, 17, 18,
- -1, -1, -1, 22, 15, 16, 17, 18, -1, 20,
- 15, 16, 17, 18
+ 7, 6, 9, 10, 4, 12, 6, 15, 16, 17,
+ 18, 17, 18, 7, 22, 15, 16, 24, 25, 26,
+ 27, 21, 0, 6, 31, 32, 4, 20, 6, 20,
+ 6, -1, 10, 11, 12, 13, 9, 15, 16, 8,
+ -1, 14, 20, 21, -1, -1, 15, 16, 17, 18,
+ 15, 16, 17, 18, -1, 20, 15, 16, 17, 18
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -558,10 +555,10 @@ static const yytype_int8 yycheck[] =
static const yytype_uint8 yystos[] =
{
0, 24, 0, 4, 6, 10, 11, 12, 13, 15,
- 16, 20, 21, 25, 26, 27, 28, 7, 6, 27,
- 6, 27, 27, 27, 20, 20, 15, 16, 17, 18,
- 20, 20, 8, 9, 14, 22, 27, 27, 27, 27,
- 6, 27, 27
+ 16, 20, 21, 25, 26, 27, 7, 6, 26, 6,
+ 26, 26, 26, 20, 15, 16, 17, 18, 20, 20,
+ 8, 9, 14, 22, 26, 26, 26, 26, 6, 26,
+ 26
};
#define yyerrok (yyerrstatus = 0)
@@ -1381,93 +1378,83 @@ yyreduce:
break;
case 6:
-#line 70 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(STOP); return 1; ;}
- break;
-
- case 7:
#line 71 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->func_printtop, STOP); return 1; ;}
break;
- case 8:
+ case 7:
#line 74 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
break;
- case 9:
+ case 8:
#line 75 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
- case 10:
+ case 9:
#line 76 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
- case 11:
-#line 79 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_xpop); ;}
- break;
-
- case 12:
+ case 10:
#line 82 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->code2(g_lingo->func_constpush, (inst)(yyvsp[(1) - (1)].i)); ;}
+ { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
break;
- case 13:
+ case 11:
#line 83 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
- case 14:
+ case 12:
#line 84 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_add); ;}
break;
- case 15:
+ case 13:
#line 85 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_sub); ;}
break;
- case 16:
+ case 14:
#line 86 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mul); ;}
break;
- case 17:
+ case 15:
#line 87 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_div); ;}
break;
- case 18:
+ case 16:
#line 88 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 19:
+ case 17:
#line 89 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
break;
- case 20:
+ case 18:
#line 90 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 21:
+ case 19:
#line 93 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 22:
+ case 20:
#line 94 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1471 "engines/director/lingo/lingo-gr.cpp"
+#line 1458 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 86ae2f1..c8ccafd 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -67,7 +67,7 @@ list: /* empty */
| list '\n'
| list func '\n'
| list assign '\n' { g_lingo->code2(g_lingo->func_xpop, STOP); return 1; }
- | list statement '\n' { g_lingo->code1(STOP); return 1; }
+// | list statement '\n' { g_lingo->code1(STOP); return 1; }
| list expr '\n' { g_lingo->code2(g_lingo->func_printtop, STOP); return 1; }
;
@@ -79,7 +79,7 @@ assign: FUNC_PUT expr OP_INTO VAR { g_lingo->code1(g_lingo->func_varpush); g_lin
statement: expr { g_lingo->code1(g_lingo->func_xpop); }
;
-expr: INT { $$ = g_lingo->code2(g_lingo->func_constpush, (inst)$1); }
+expr: INT { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, $1); $$ = g_lingo->code1(i); };
| VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($1->c_str()); $$ = g_lingo->code1(g_lingo->func_eval); delete $1; }
| expr '+' expr { g_lingo->code1(g_lingo->func_add); }
| expr '-' expr { g_lingo->code1(g_lingo->func_sub); }
Commit: c0a3e652eb4da666a1ef6afc102db99b86f8c5fd
https://github.com/scummvm/scummvm/commit/c0a3e652eb4da666a1ef6afc102db99b86f8c5fd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Enable parse debug
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 25a0e3f..a347d22 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -77,10 +77,13 @@ Common::Error DirectorEngine::run() {
mci \"play T005045a from 22710 to 32872\"", kMovieScript, 1);
_lingo->addCode("set x = 1 + 3\n\
- set y to 2 -- this set y to 4\n\
+ set y to 2 + 3 * 2 -- this set y to 4\n\
put 5 into z\n\
-- some more\n", kMovieScript, 2);
+ _lingo->addCode("2 + 3 * 2 / (5 - 2)", kMovieScript, 3);
+ _lingo->executeScript(kMovieScript, 3);
+
return Common::kNoError;
//FIXME
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index fcf3bd9..99b976d 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -96,7 +96,9 @@
/* Copy the first part of user declarations. */
-#line 23 "engines/director/lingo/lingo-gr.y"
+#line 25 "engines/director/lingo/lingo-gr.y"
+
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "common/hash-str.h"
@@ -115,7 +117,7 @@ using namespace Director;
/* Enabling traces. */
#ifndef YYDEBUG
-# define YYDEBUG 0
+# define YYDEBUG 1
#endif
/* Enabling verbose error messages. */
@@ -133,7 +135,7 @@ using namespace Director;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 39 "engines/director/lingo/lingo-gr.y"
+#line 43 "engines/director/lingo/lingo-gr.y"
{
Common::String *s;
int i;
@@ -141,7 +143,7 @@ typedef union YYSTYPE
int code;
}
/* Line 193 of yacc.c. */
-#line 145 "engines/director/lingo/lingo-gr.cpp"
+#line 147 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -154,7 +156,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 158 "engines/director/lingo/lingo-gr.cpp"
+#line 160 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -369,16 +371,16 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 59
+#define YYLAST 55
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 23
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 5
+#define YYNNTS 6
/* YYNRULES -- Number of rules. */
-#define YYNRULES 20
+#define YYNRULES 21
/* YYNRULES -- Number of states. */
-#define YYNSTATES 41
+#define YYNSTATES 42
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -425,28 +427,29 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 4, 7, 11, 15, 19, 24, 29,
- 34, 36, 38, 42, 46, 50, 54, 57, 60, 64,
- 67
+ 34, 36, 38, 40, 44, 48, 52, 56, 59, 62,
+ 66, 69
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 24, 0, -1, -1, 24, 20, -1, 24, 27, 20,
+ 24, 0, -1, -1, 24, 20, -1, 24, 28, 20,
-1, 24, 25, 20, -1, 24, 26, 20, -1, 12,
- 26, 8, 6, -1, 13, 6, 14, 26, -1, 13,
- 6, 9, 26, -1, 4, -1, 6, -1, 26, 15,
- 26, -1, 26, 16, 26, -1, 26, 17, 26, -1,
- 26, 18, 26, -1, 15, 26, -1, 16, 26, -1,
- 21, 26, 22, -1, 10, 7, -1, 11, 6, -1
+ 27, 8, 6, -1, 13, 6, 14, 27, -1, 13,
+ 6, 9, 27, -1, 27, -1, 4, -1, 6, -1,
+ 27, 15, 27, -1, 27, 16, 27, -1, 27, 17,
+ 27, -1, 27, 18, 27, -1, 15, 27, -1, 16,
+ 27, -1, 21, 27, 22, -1, 10, 7, -1, 11,
+ 6, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 66, 66, 67, 68, 69, 71, 74, 75, 76,
- 82, 83, 84, 85, 86, 87, 88, 89, 90, 93,
- 94
+ 0, 70, 70, 71, 72, 73, 74, 78, 79, 80,
+ 83, 86, 87, 88, 89, 90, 91, 92, 93, 94,
+ 97, 98
};
#endif
@@ -458,7 +461,7 @@ static const char *const yytname[] =
"$end", "error", "$undefined", "UNARY", "INT", "FLOAT", "VAR", "STRING",
"OP_INTO", "OP_TO", "FUNC_MCI", "FUNC_MCIWAIT", "FUNC_PUT", "FUNC_SET",
"'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'",
- "$accept", "list", "assign", "expr", "func", 0
+ "$accept", "list", "assign", "statement", "expr", "func", 0
};
#endif
@@ -477,16 +480,16 @@ static const yytype_uint16 yytoknum[] =
static const yytype_uint8 yyr1[] =
{
0, 23, 24, 24, 24, 24, 24, 25, 25, 25,
- 26, 26, 26, 26, 26, 26, 26, 26, 26, 27,
- 27
+ 26, 27, 27, 27, 27, 27, 27, 27, 27, 27,
+ 28, 28
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 0, 2, 3, 3, 3, 4, 4, 4,
- 1, 1, 3, 3, 3, 3, 2, 2, 3, 2,
- 2
+ 1, 1, 1, 3, 3, 3, 3, 2, 2, 3,
+ 2, 2
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -494,35 +497,35 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 2, 0, 1, 10, 11, 0, 0, 0, 0, 0,
- 0, 3, 0, 0, 0, 0, 19, 20, 0, 0,
- 16, 17, 0, 5, 0, 0, 0, 0, 6, 4,
- 0, 0, 0, 18, 12, 13, 14, 15, 7, 9,
- 8
+ 2, 0, 1, 11, 12, 0, 0, 0, 0, 0,
+ 0, 3, 0, 0, 0, 10, 0, 20, 21, 0,
+ 0, 17, 18, 0, 5, 6, 0, 0, 0, 0,
+ 4, 0, 0, 0, 19, 13, 14, 15, 16, 7,
+ 9, 8
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 1, 13, 14, 15
+ -1, 1, 13, 14, 15, 16
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -9
+#define YYPACT_NINF -11
static const yytype_int8 yypact[] =
{
- -9, 22, -9, -9, -9, 6, -5, 0, 17, 0,
- 0, -9, 0, 7, 35, 9, -9, -9, 31, 27,
- -9, -9, -8, -9, 0, 0, 0, 0, -9, -9,
- 24, 0, 0, -9, -6, -6, -9, -9, -9, 41,
- 41
+ -11, 23, -11, -11, -11, 2, 4, 26, 18, 26,
+ 26, -11, 26, 8, 11, 0, 17, -11, -11, -4,
+ -8, -11, -11, 33, -11, -11, 26, 26, 26, 26,
+ -11, 34, 26, 26, -11, -10, -10, -11, -11, -11,
+ 0, 0
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -9, -9, -9, -7, -9
+ -11, -11, -11, -11, -7, -11
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -532,22 +535,22 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
- 18, 17, 20, 21, 3, 22, 4, 24, 25, 26,
- 27, 26, 27, 16, 33, 9, 10, 34, 35, 36,
- 37, 12, 2, 19, 39, 40, 3, 23, 4, 29,
- 38, 0, 5, 6, 7, 8, 31, 9, 10, 30,
- 0, 32, 11, 12, 0, 0, 24, 25, 26, 27,
- 24, 25, 26, 27, 0, 28, 24, 25, 26, 27
+ 19, 32, 21, 22, 31, 23, 33, 28, 29, 17,
+ 18, 26, 27, 28, 29, 26, 27, 28, 29, 35,
+ 36, 37, 38, 2, 20, 40, 41, 3, 24, 4,
+ 3, 25, 4, 5, 6, 7, 8, 30, 9, 10,
+ 39, 9, 10, 11, 12, 0, 0, 12, 26, 27,
+ 28, 29, 0, 0, 0, 34
};
static const yytype_int8 yycheck[] =
{
- 7, 6, 9, 10, 4, 12, 6, 15, 16, 17,
- 18, 17, 18, 7, 22, 15, 16, 24, 25, 26,
- 27, 21, 0, 6, 31, 32, 4, 20, 6, 20,
- 6, -1, 10, 11, 12, 13, 9, 15, 16, 8,
- -1, 14, 20, 21, -1, -1, 15, 16, 17, 18,
- 15, 16, 17, 18, -1, 20, 15, 16, 17, 18
+ 7, 9, 9, 10, 8, 12, 14, 17, 18, 7,
+ 6, 15, 16, 17, 18, 15, 16, 17, 18, 26,
+ 27, 28, 29, 0, 6, 32, 33, 4, 20, 6,
+ 4, 20, 6, 10, 11, 12, 13, 20, 15, 16,
+ 6, 15, 16, 20, 21, -1, -1, 21, 15, 16,
+ 17, 18, -1, -1, -1, 22
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -555,10 +558,10 @@ static const yytype_int8 yycheck[] =
static const yytype_uint8 yystos[] =
{
0, 24, 0, 4, 6, 10, 11, 12, 13, 15,
- 16, 20, 21, 25, 26, 27, 7, 6, 26, 6,
- 26, 26, 26, 20, 15, 16, 17, 18, 20, 20,
- 8, 9, 14, 22, 26, 26, 26, 26, 6, 26,
- 26
+ 16, 20, 21, 25, 26, 27, 28, 7, 6, 27,
+ 6, 27, 27, 27, 20, 20, 15, 16, 17, 18,
+ 20, 8, 9, 14, 22, 27, 27, 27, 27, 6,
+ 27, 27
};
#define yyerrok (yyerrstatus = 0)
@@ -1373,88 +1376,93 @@ yyreduce:
switch (yyn)
{
case 5:
-#line 69 "engines/director/lingo/lingo-gr.y"
+#line 73 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->func_xpop, STOP); return 1; ;}
break;
case 6:
-#line 71 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code2(g_lingo->func_printtop, STOP); return 1; ;}
+#line 74 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(STOP); return 1; ;}
break;
case 7:
-#line 74 "engines/director/lingo/lingo-gr.y"
+#line 78 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
break;
case 8:
-#line 75 "engines/director/lingo/lingo-gr.y"
+#line 79 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 9:
-#line 76 "engines/director/lingo/lingo-gr.y"
+#line 80 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 10:
-#line 82 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
+#line 83 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_xpop); ;}
break;
case 11:
-#line 83 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
+#line 86 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
break;
case 12:
-#line 84 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_add); ;}
+#line 87 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
case 13:
-#line 85 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_sub); ;}
+#line 88 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_add); ;}
break;
case 14:
-#line 86 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_mul); ;}
+#line 89 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_sub); ;}
break;
case 15:
-#line 87 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_div); ;}
+#line 90 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_mul); ;}
break;
case 16:
-#line 88 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+#line 91 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_div); ;}
break;
case 17:
-#line 89 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
+#line 92 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 18:
-#line 90 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+#line 93 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
break;
case 19:
-#line 93 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+#line 94 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 20:
-#line 94 "engines/director/lingo/lingo-gr.y"
+#line 97 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 21:
+#line 98 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1458 "engines/director/lingo/lingo-gr.cpp"
+#line 1466 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1668,6 +1676,6 @@ yyreturn:
}
-#line 97 "engines/director/lingo/lingo-gr.y"
+#line 101 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 6da4c9f..ddf0c48 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -70,7 +70,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 39 "engines/director/lingo/lingo-gr.y"
+#line 43 "engines/director/lingo/lingo-gr.y"
{
Common::String *s;
int i;
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index c8ccafd..e0dc00f 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -20,7 +20,11 @@
*
*/
+%debug
+
%{
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
#include "common/hash-str.h"
#include "director/lingo/lingo.h"
@@ -67,8 +71,8 @@ list: /* empty */
| list '\n'
| list func '\n'
| list assign '\n' { g_lingo->code2(g_lingo->func_xpop, STOP); return 1; }
-// | list statement '\n' { g_lingo->code1(STOP); return 1; }
- | list expr '\n' { g_lingo->code2(g_lingo->func_printtop, STOP); return 1; }
+ | list statement '\n' { g_lingo->code1(STOP); return 1; }
+// | list expr '\n' { g_lingo->code2(g_lingo->func_printtop, STOP); return 1; }
;
assign: FUNC_PUT expr OP_INTO VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($4->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $2; delete $4; }
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index e1130aa..20b8485 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 14
-#define YY_END_OF_BUFFER 15
+#define YY_NUM_RULES 15
+#define YY_END_OF_BUFFER 16
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,30 +373,30 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[40] =
+static yyconst flex_int16_t yy_accept[41] =
{ 0,
- 0, 0, 15, 14, 12, 14, 11, 11, 10, 8,
- 8, 8, 8, 8, 8, 12, 0, 13, 1, 9,
- 10, 8, 8, 8, 8, 8, 7, 1, 9, 8,
- 3, 5, 6, 2, 8, 8, 8, 4, 0
+ 0, 0, 16, 15, 2, 13, 15, 12, 12, 11,
+ 9, 9, 9, 9, 9, 9, 13, 0, 14, 1,
+ 10, 11, 9, 9, 9, 9, 9, 8, 1, 10,
+ 9, 4, 6, 7, 3, 9, 9, 9, 5, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
{ 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
- 1, 1, 3, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 4, 1, 1, 5, 1, 1, 1,
- 1, 5, 5, 5, 6, 7, 5, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 5, 1, 1,
- 5, 1, 1, 1, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 1, 1, 1, 5, 9, 1, 10, 9, 11, 9,
-
- 12, 9, 9, 9, 13, 9, 9, 9, 14, 15,
- 16, 17, 9, 9, 18, 19, 20, 9, 21, 9,
- 9, 9, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 5, 1, 1, 6, 1, 1, 6,
+ 6, 6, 6, 6, 7, 8, 6, 9, 9, 9,
+ 9, 9, 9, 9, 9, 9, 9, 6, 1, 1,
+ 6, 1, 1, 1, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 1, 1, 1, 6, 10, 1, 11, 10, 12, 10,
+
+ 13, 10, 10, 10, 14, 10, 10, 10, 15, 16,
+ 17, 18, 10, 10, 19, 20, 21, 10, 22, 10,
+ 10, 10, 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,
@@ -413,53 +413,53 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[22] =
+static yyconst flex_int32_t yy_meta[23] =
{ 0,
- 1, 2, 3, 1, 1, 1, 1, 4, 4, 4,
+ 1, 1, 2, 3, 1, 1, 1, 1, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4
+ 4, 4
} ;
-static yyconst flex_int16_t yy_base[43] =
+static yyconst flex_int16_t yy_base[44] =
{ 0,
- 0, 0, 55, 56, 20, 50, 56, 47, 17, 0,
- 37, 40, 30, 37, 32, 24, 43, 56, 0, 38,
- 21, 0, 26, 31, 24, 23, 0, 0, 33, 24,
- 18, 0, 0, 0, 28, 23, 16, 0, 56, 29,
- 27, 33
+ 0, 0, 56, 57, 57, 20, 50, 57, 47, 17,
+ 0, 37, 40, 30, 37, 32, 24, 43, 57, 0,
+ 38, 21, 0, 26, 31, 24, 23, 0, 0, 33,
+ 24, 18, 0, 0, 0, 28, 23, 16, 0, 57,
+ 30, 28, 34
} ;
-static yyconst flex_int16_t yy_def[43] =
+static yyconst flex_int16_t yy_def[44] =
{ 0,
- 39, 1, 39, 39, 39, 40, 39, 39, 39, 41,
- 41, 41, 41, 41, 41, 39, 40, 39, 42, 39,
- 39, 41, 41, 41, 41, 41, 41, 42, 39, 41,
- 41, 41, 41, 41, 41, 41, 41, 41, 0, 39,
- 39, 39
+ 40, 1, 40, 40, 40, 40, 41, 40, 40, 40,
+ 42, 42, 42, 42, 42, 42, 40, 41, 40, 43,
+ 40, 40, 42, 42, 42, 42, 42, 42, 43, 40,
+ 42, 42, 42, 42, 42, 42, 42, 42, 42, 0,
+ 40, 40, 40
} ;
-static yyconst flex_int16_t yy_nxt[78] =
+static yyconst flex_int16_t yy_nxt[80] =
{ 0,
- 4, 5, 5, 6, 7, 8, 4, 9, 10, 10,
- 10, 10, 11, 12, 10, 10, 13, 14, 15, 10,
- 10, 16, 16, 20, 21, 16, 16, 20, 21, 17,
- 22, 17, 17, 28, 38, 37, 28, 36, 35, 34,
- 29, 33, 32, 31, 30, 29, 18, 27, 26, 25,
- 24, 23, 19, 18, 39, 3, 39, 39, 39, 39,
- 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
- 39, 39, 39, 39, 39, 39, 39
+ 4, 5, 6, 6, 7, 8, 9, 4, 10, 11,
+ 11, 11, 11, 12, 13, 11, 11, 14, 15, 16,
+ 11, 11, 17, 17, 21, 22, 17, 17, 21, 22,
+ 18, 23, 18, 18, 29, 39, 38, 29, 37, 36,
+ 35, 30, 34, 33, 32, 31, 30, 19, 28, 27,
+ 26, 25, 24, 20, 19, 40, 3, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40
} ;
-static yyconst flex_int16_t yy_chk[78] =
+static yyconst flex_int16_t yy_chk[80] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 5, 5, 9, 9, 16, 16, 21, 21, 40,
- 41, 40, 40, 42, 37, 36, 42, 35, 31, 30,
- 29, 26, 25, 24, 23, 20, 17, 15, 14, 13,
- 12, 11, 8, 6, 3, 39, 39, 39, 39, 39,
- 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
- 39, 39, 39, 39, 39, 39, 39
+ 1, 1, 6, 6, 10, 10, 17, 17, 22, 22,
+ 41, 42, 41, 41, 43, 38, 37, 43, 36, 32,
+ 31, 30, 27, 26, 25, 24, 21, 18, 16, 15,
+ 14, 13, 12, 9, 7, 3, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 40, 40
} ;
static yy_state_type yy_last_accepting_state;
@@ -747,13 +747,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 >= 40 )
+ if ( yy_current_state >= 41 )
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] != 56 );
+ while ( yy_base[yy_current_state] != 57 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -785,70 +785,75 @@ YY_RULE_SETUP
case 2:
YY_RULE_SETUP
#line 47 "engines/director/lingo/lingo-lex.l"
-{ return OP_INTO; }
+{ return ' '; }
YY_BREAK
case 3:
YY_RULE_SETUP
#line 48 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_MCI; }
+{ return OP_INTO; }
YY_BREAK
case 4:
YY_RULE_SETUP
#line 49 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_MCIWAIT; }
+{ return FUNC_MCI; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 50 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_PUT; }
+{ return FUNC_MCIWAIT; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 51 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_SET; }
+{ return FUNC_PUT; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 52 "engines/director/lingo/lingo-lex.l"
-{ return OP_TO; }
+{ return FUNC_SET; }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 54 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+#line 53 "engines/director/lingo/lingo-lex.l"
+{ return OP_TO; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 55 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+{ yylval.s = new Common::String(yytext); return VAR; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 56 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 57 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 12:
-/* rule 12 can match eol */
YY_RULE_SETUP
#line 58 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ return *yytext; }
YY_BREAK
case 13:
+/* rule 13 can match eol */
YY_RULE_SETUP
#line 59 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return '\n'; }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 61 "engines/director/lingo/lingo-lex.l"
+#line 60 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+ YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 62 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 852 "engines/director/lingo/lingo-lex.cpp"
+#line 857 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1140,7 +1145,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 >= 40 )
+ if ( yy_current_state >= 41 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1168,11 +1173,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 >= 40 )
+ if ( yy_current_state >= 41 )
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 == 39);
+ yy_is_jam = (yy_current_state == 40);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1845,15 +1850,19 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 61 "engines/director/lingo/lingo-lex.l"
+#line 62 "engines/director/lingo/lingo-lex.l"
+
+extern int yydebug;
namespace Director {
int Lingo::parse(const char *code) {
YY_BUFFER_STATE bp;
+ yydebug = 1;
+
yy_delete_buffer(YY_CURRENT_BUFFER);
bp = yy_scan_string(code);
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index e2a57d7..ed61cae 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -38,12 +38,13 @@ variable [_[:alpha:]][_[:alnum:]]*
constfloat [[:digit:]]+\.[[:digit:]]*
constinteger [[:digit:]]+
conststring \"[^\"\n]*\"
-operator [-+*/%=^:,]
+operator [-+*/%=^:,()]
newline [\n\r]+
%%
--[^\r\n]*
+[\t] { return ' '; }
into { return OP_INTO; }
mci { return FUNC_MCI; }
mciwait { return FUNC_MCIWAIT; }
@@ -60,11 +61,15 @@ to { return OP_TO; }
%%
+extern int yydebug;
+
namespace Director {
int Lingo::parse(const char *code) {
YY_BUFFER_STATE bp;
+ yydebug = 1;
+
yy_delete_buffer(YY_CURRENT_BUFFER);
bp = yy_scan_string(code);
Commit: 238d150f41c23c8682a5c08ba7cfbcff23964bba
https://github.com/scummvm/scummvm/commit/238d150f41c23c8682a5c08ba7cfbcff23964bba
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix multiline statements, fix leading whitespace handling
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index a347d22..fa3a409 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -84,8 +84,6 @@ Common::Error DirectorEngine::run() {
_lingo->addCode("2 + 3 * 2 / (5 - 2)", kMovieScript, 3);
_lingo->executeScript(kMovieScript, 3);
- return Common::kNoError;
-
//FIXME
_mainArchive = new RIFFArchive();
_mainArchive->openFile("bookshelf_example.mmm");
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 99b976d..b6874ec 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -369,18 +369,18 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 2
+#define YYFINAL 23
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 55
+#define YYLAST 52
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 23
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 6
+#define YYNNTS 7
/* YYNRULES -- Number of rules. */
-#define YYNRULES 21
+#define YYNRULES 24
/* YYNRULES -- Number of states. */
-#define YYNSTATES 42
+#define YYNSTATES 41
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -426,30 +426,30 @@ static const yytype_uint8 yytranslate[] =
YYRHS. */
static const yytype_uint8 yyprhs[] =
{
- 0, 0, 3, 4, 7, 11, 15, 19, 24, 29,
- 34, 36, 38, 40, 44, 48, 52, 56, 59, 62,
- 66, 69
+ 0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
+ 19, 24, 29, 34, 36, 38, 40, 44, 48, 52,
+ 56, 59, 62, 66, 69
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 24, 0, -1, -1, 24, 20, -1, 24, 28, 20,
- -1, 24, 25, 20, -1, 24, 26, 20, -1, 12,
- 27, 8, 6, -1, 13, 6, 14, 27, -1, 13,
- 6, 9, 27, -1, 27, -1, 4, -1, 6, -1,
- 27, 15, 27, -1, 27, 16, 27, -1, 27, 17,
- 27, -1, 27, 18, 27, -1, 15, 27, -1, 16,
- 27, -1, 21, 27, 22, -1, 10, 7, -1, 11,
+ 24, 0, -1, 25, 20, 24, -1, 25, -1, -1,
+ 29, -1, 26, -1, 27, -1, 28, -1, -1, 12,
+ 28, 8, 6, -1, 13, 6, 14, 28, -1, 13,
+ 6, 9, 28, -1, 28, -1, 4, -1, 6, -1,
+ 28, 15, 28, -1, 28, 16, 28, -1, 28, 17,
+ 28, -1, 28, 18, 28, -1, 15, 28, -1, 16,
+ 28, -1, 21, 28, 22, -1, 10, 7, -1, 11,
6, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 70, 70, 71, 72, 73, 74, 78, 79, 80,
- 83, 86, 87, 88, 89, 90, 91, 92, 93, 94,
- 97, 98
+ 0, 70, 70, 71, 74, 75, 76, 77, 78, 79,
+ 82, 83, 84, 87, 90, 91, 92, 93, 94, 95,
+ 96, 97, 98, 101, 102
};
#endif
@@ -461,7 +461,8 @@ static const char *const yytname[] =
"$end", "error", "$undefined", "UNARY", "INT", "FLOAT", "VAR", "STRING",
"OP_INTO", "OP_TO", "FUNC_MCI", "FUNC_MCIWAIT", "FUNC_PUT", "FUNC_SET",
"'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'",
- "$accept", "list", "assign", "statement", "expr", "func", 0
+ "$accept", "program", "programline", "assign", "statement", "expr",
+ "func", 0
};
#endif
@@ -479,17 +480,17 @@ static const yytype_uint16 yytoknum[] =
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 23, 24, 24, 24, 24, 24, 25, 25, 25,
- 26, 27, 27, 27, 27, 27, 27, 27, 27, 27,
- 28, 28
+ 0, 23, 24, 24, 25, 25, 25, 25, 25, 25,
+ 26, 26, 26, 27, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 29, 29
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
- 0, 2, 0, 2, 3, 3, 3, 4, 4, 4,
- 1, 1, 1, 3, 3, 3, 3, 2, 2, 3,
- 2, 2
+ 0, 2, 3, 1, 0, 1, 1, 1, 1, 0,
+ 4, 4, 4, 1, 1, 1, 3, 3, 3, 3,
+ 2, 2, 3, 2, 2
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -497,35 +498,35 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 2, 0, 1, 11, 12, 0, 0, 0, 0, 0,
- 0, 3, 0, 0, 0, 10, 0, 20, 21, 0,
- 0, 17, 18, 0, 5, 6, 0, 0, 0, 0,
- 4, 0, 0, 0, 19, 13, 14, 15, 16, 7,
- 9, 8
+ 4, 14, 15, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 6, 7, 8, 5, 23, 24, 0, 0,
+ 20, 21, 0, 1, 4, 0, 0, 0, 0, 0,
+ 0, 0, 22, 2, 16, 17, 18, 19, 10, 12,
+ 11
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 1, 13, 14, 15, 16
+ -1, 10, 11, 12, 13, 14, 15
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -11
+#define YYPACT_NINF -9
static const yytype_int8 yypact[] =
{
- -11, 23, -11, -11, -11, 2, 4, 26, 18, 26,
- 26, -11, 26, 8, 11, 0, 17, -11, -11, -4,
- -8, -11, -11, 33, -11, -11, 26, 26, 26, 26,
- -11, 34, 26, 26, -11, -10, -10, -11, -11, -11,
- 0, 0
+ 3, -9, -9, -2, 2, 23, 6, 23, 23, 23,
+ 17, 8, -9, -9, 19, -9, -9, -9, 25, -8,
+ -9, -9, 30, -9, 3, 23, 23, 23, 23, 24,
+ 23, 23, -9, -9, -7, -7, -9, -9, -9, 19,
+ 19
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -11, -11, -11, -11, -7, -11
+ -9, 7, -9, -9, -9, -5, -9
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -535,33 +536,33 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
- 19, 32, 21, 22, 31, 23, 33, 28, 29, 17,
- 18, 26, 27, 28, 29, 26, 27, 28, 29, 35,
- 36, 37, 38, 2, 20, 40, 41, 3, 24, 4,
- 3, 25, 4, 5, 6, 7, 8, 30, 9, 10,
- 39, 9, 10, 11, 12, 0, 0, 12, 26, 27,
- 28, 29, 0, 0, 0, 34
+ 18, 30, 20, 21, 22, 16, 31, 1, 17, 2,
+ 27, 28, 19, 3, 4, 5, 6, 23, 7, 8,
+ 34, 35, 36, 37, 9, 39, 40, 1, 24, 2,
+ 38, 33, 0, 29, 25, 26, 27, 28, 7, 8,
+ 25, 26, 27, 28, 9, 25, 26, 27, 28, 0,
+ 0, 0, 32
};
static const yytype_int8 yycheck[] =
{
- 7, 9, 9, 10, 8, 12, 14, 17, 18, 7,
- 6, 15, 16, 17, 18, 15, 16, 17, 18, 26,
- 27, 28, 29, 0, 6, 32, 33, 4, 20, 6,
- 4, 20, 6, 10, 11, 12, 13, 20, 15, 16,
- 6, 15, 16, 20, 21, -1, -1, 21, 15, 16,
- 17, 18, -1, -1, -1, 22
+ 5, 9, 7, 8, 9, 7, 14, 4, 6, 6,
+ 17, 18, 6, 10, 11, 12, 13, 0, 15, 16,
+ 25, 26, 27, 28, 21, 30, 31, 4, 20, 6,
+ 6, 24, -1, 8, 15, 16, 17, 18, 15, 16,
+ 15, 16, 17, 18, 21, 15, 16, 17, 18, -1,
+ -1, -1, 22
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 24, 0, 4, 6, 10, 11, 12, 13, 15,
- 16, 20, 21, 25, 26, 27, 28, 7, 6, 27,
- 6, 27, 27, 27, 20, 20, 15, 16, 17, 18,
- 20, 8, 9, 14, 22, 27, 27, 27, 27, 6,
- 27, 27
+ 0, 4, 6, 10, 11, 12, 13, 15, 16, 21,
+ 24, 25, 26, 27, 28, 29, 7, 6, 28, 6,
+ 28, 28, 28, 0, 20, 15, 16, 17, 18, 8,
+ 9, 14, 22, 24, 28, 28, 28, 28, 6, 28,
+ 28
};
#define yyerrok (yyerrstatus = 0)
@@ -1375,94 +1376,94 @@ yyreduce:
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
- case 5:
-#line 73 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code2(g_lingo->func_xpop, STOP); return 1; ;}
+ case 6:
+#line 76 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_xpop); ;}
break;
- case 6:
-#line 74 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(STOP); return 1; ;}
+ case 8:
+#line 78 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_printtop); ;}
break;
- case 7:
-#line 78 "engines/director/lingo/lingo-gr.y"
+ case 10:
+#line 82 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
break;
- case 8:
-#line 79 "engines/director/lingo/lingo-gr.y"
+ case 11:
+#line 83 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
- case 9:
-#line 80 "engines/director/lingo/lingo-gr.y"
+ case 12:
+#line 84 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
- case 10:
-#line 83 "engines/director/lingo/lingo-gr.y"
+ case 13:
+#line 87 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_xpop); ;}
break;
- case 11:
-#line 86 "engines/director/lingo/lingo-gr.y"
+ case 14:
+#line 90 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
break;
- case 12:
-#line 87 "engines/director/lingo/lingo-gr.y"
+ case 15:
+#line 91 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
- case 13:
-#line 88 "engines/director/lingo/lingo-gr.y"
+ case 16:
+#line 92 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_add); ;}
break;
- case 14:
-#line 89 "engines/director/lingo/lingo-gr.y"
+ case 17:
+#line 93 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_sub); ;}
break;
- case 15:
-#line 90 "engines/director/lingo/lingo-gr.y"
+ case 18:
+#line 94 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mul); ;}
break;
- case 16:
-#line 91 "engines/director/lingo/lingo-gr.y"
+ case 19:
+#line 95 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_div); ;}
break;
- case 17:
-#line 92 "engines/director/lingo/lingo-gr.y"
+ case 20:
+#line 96 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 18:
-#line 93 "engines/director/lingo/lingo-gr.y"
+ case 21:
+#line 97 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
break;
- case 19:
-#line 94 "engines/director/lingo/lingo-gr.y"
+ case 22:
+#line 98 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 20:
-#line 97 "engines/director/lingo/lingo-gr.y"
+ case 23:
+#line 101 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 21:
-#line 98 "engines/director/lingo/lingo-gr.y"
+ case 24:
+#line 102 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1466 "engines/director/lingo/lingo-gr.cpp"
+#line 1467 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1676,6 +1677,6 @@ yyreturn:
}
-#line 101 "engines/director/lingo/lingo-gr.y"
+#line 105 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index e0dc00f..c05e985 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -67,12 +67,16 @@ using namespace Director;
%%
-list: /* empty */
- | list '\n'
- | list func '\n'
- | list assign '\n' { g_lingo->code2(g_lingo->func_xpop, STOP); return 1; }
- | list statement '\n' { g_lingo->code1(STOP); return 1; }
-// | list expr '\n' { g_lingo->code2(g_lingo->func_printtop, STOP); return 1; }
+program: programline '\n' program
+ | programline
+ ;
+
+programline:
+ | func
+ | assign { g_lingo->code1(g_lingo->func_xpop); }
+ | statement
+ | expr { g_lingo->code1(g_lingo->func_printtop); }
+ | /* empty */
;
assign: FUNC_PUT expr OP_INTO VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($4->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $2; delete $4; }
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 20b8485..59796ce 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 15
-#define YY_END_OF_BUFFER 16
+#define YY_NUM_RULES 16
+#define YY_END_OF_BUFFER 17
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,12 +373,13 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[41] =
+static yyconst flex_int16_t yy_accept[44] =
{ 0,
- 0, 0, 16, 15, 2, 13, 15, 12, 12, 11,
- 9, 9, 9, 9, 9, 9, 13, 0, 14, 1,
- 10, 11, 9, 9, 9, 9, 9, 8, 1, 10,
- 9, 4, 6, 7, 3, 9, 9, 9, 5, 0
+ 0, 0, 17, 16, 3, 14, 16, 13, 13, 12,
+ 10, 10, 10, 10, 10, 10, 2, 2, 3, 14,
+ 0, 15, 1, 11, 12, 10, 10, 10, 10, 10,
+ 9, 1, 11, 10, 5, 7, 8, 4, 10, 10,
+ 10, 6, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -386,17 +387,17 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 5, 1, 1, 6, 1, 1, 6,
- 6, 6, 6, 6, 7, 8, 6, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 6, 1, 1,
- 6, 1, 1, 1, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
- 1, 1, 1, 6, 10, 1, 11, 10, 12, 10,
-
- 13, 10, 10, 10, 14, 10, 10, 10, 15, 16,
- 17, 18, 10, 10, 19, 20, 21, 10, 22, 10,
- 10, 10, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 5, 1, 6, 1, 1, 7, 1, 1, 7,
+ 7, 7, 7, 7, 8, 9, 7, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 7, 1, 1,
+ 7, 1, 1, 1, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 1, 1, 1, 7, 11, 1, 12, 11, 13, 11,
+
+ 14, 11, 11, 11, 15, 11, 11, 11, 16, 17,
+ 18, 19, 11, 11, 20, 21, 22, 11, 23, 11,
+ 11, 11, 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,
@@ -413,53 +414,55 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[23] =
+static yyconst flex_int32_t yy_meta[24] =
{ 0,
- 1, 1, 2, 3, 1, 1, 1, 1, 4, 4,
+ 1, 1, 2, 3, 1, 1, 1, 1, 1, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4
+ 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[44] =
+static yyconst flex_int16_t yy_base[47] =
{ 0,
- 0, 0, 56, 57, 57, 20, 50, 57, 47, 17,
- 0, 37, 40, 30, 37, 32, 24, 43, 57, 0,
- 38, 21, 0, 26, 31, 24, 23, 0, 0, 33,
- 24, 18, 0, 0, 0, 28, 23, 16, 0, 57,
- 30, 28, 34
+ 0, 22, 62, 63, 59, 22, 54, 63, 51, 19,
+ 0, 41, 44, 34, 41, 36, 51, 63, 50, 27,
+ 45, 63, 0, 40, 23, 0, 28, 33, 26, 25,
+ 0, 0, 35, 26, 20, 0, 0, 0, 30, 25,
+ 18, 0, 63, 33, 31, 37
} ;
-static yyconst flex_int16_t yy_def[44] =
+static yyconst flex_int16_t yy_def[47] =
{ 0,
- 40, 1, 40, 40, 40, 40, 41, 40, 40, 40,
- 42, 42, 42, 42, 42, 42, 40, 41, 40, 43,
- 40, 40, 42, 42, 42, 42, 42, 42, 43, 40,
- 42, 42, 42, 42, 42, 42, 42, 42, 42, 0,
- 40, 40, 40
+ 43, 1, 43, 43, 43, 43, 44, 43, 43, 43,
+ 45, 45, 45, 45, 45, 45, 43, 43, 43, 43,
+ 44, 43, 46, 43, 43, 45, 45, 45, 45, 45,
+ 45, 46, 43, 45, 45, 45, 45, 45, 45, 45,
+ 45, 45, 0, 43, 43, 43
} ;
-static yyconst flex_int16_t yy_nxt[80] =
+static yyconst flex_int16_t yy_nxt[87] =
{ 0,
- 4, 5, 6, 6, 7, 8, 9, 4, 10, 11,
- 11, 11, 11, 12, 13, 11, 11, 14, 15, 16,
- 11, 11, 17, 17, 21, 22, 17, 17, 21, 22,
- 18, 23, 18, 18, 29, 39, 38, 29, 37, 36,
- 35, 30, 34, 33, 32, 31, 30, 19, 28, 27,
- 26, 25, 24, 20, 19, 40, 3, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40
+ 4, 5, 6, 6, 4, 7, 8, 9, 4, 10,
+ 11, 11, 11, 11, 12, 13, 11, 11, 14, 15,
+ 16, 11, 11, 17, 20, 20, 18, 24, 25, 20,
+ 20, 24, 25, 21, 26, 21, 21, 32, 42, 41,
+ 32, 40, 39, 38, 33, 37, 36, 35, 34, 33,
+ 22, 19, 19, 31, 30, 29, 28, 27, 23, 22,
+ 19, 43, 3, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43
} ;
-static yyconst flex_int16_t yy_chk[80] =
+static yyconst flex_int16_t yy_chk[87] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 6, 6, 10, 10, 17, 17, 22, 22,
- 41, 42, 41, 41, 43, 38, 37, 43, 36, 32,
- 31, 30, 27, 26, 25, 24, 21, 18, 16, 15,
- 14, 13, 12, 9, 7, 3, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40
+ 1, 1, 1, 2, 6, 6, 2, 10, 10, 20,
+ 20, 25, 25, 44, 45, 44, 44, 46, 41, 40,
+ 46, 39, 35, 34, 33, 30, 29, 28, 27, 24,
+ 21, 19, 17, 16, 15, 14, 13, 12, 9, 7,
+ 5, 3, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43
} ;
static yy_state_type yy_last_accepting_state;
@@ -509,7 +512,7 @@ char *yytext;
int yyparse();
-#line 513 "engines/director/lingo/lingo-lex.cpp"
+#line 516 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -681,6 +684,9 @@ extern int yylex (void);
#endif
#define YY_RULE_SETUP \
+ if ( yyleng > 0 ) \
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
+ (yytext[yyleng - 1] == '\n'); \
YY_USER_ACTION
/** The main scanner function which does all the work.
@@ -694,7 +700,7 @@ YY_DECL
#line 44 "engines/director/lingo/lingo-lex.l"
-#line 698 "engines/director/lingo/lingo-lex.cpp"
+#line 704 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -735,6 +741,7 @@ YY_DECL
yy_bp = yy_cp;
yy_current_state = (yy_start);
+ yy_current_state += YY_AT_BOL();
yy_match:
do
{
@@ -747,13 +754,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 >= 41 )
+ if ( yy_current_state >= 44 )
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] != 57 );
+ while ( yy_base[yy_current_state] != 63 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -785,75 +792,80 @@ YY_RULE_SETUP
case 2:
YY_RULE_SETUP
#line 47 "engines/director/lingo/lingo-lex.l"
-{ return ' '; }
+
YY_BREAK
case 3:
YY_RULE_SETUP
#line 48 "engines/director/lingo/lingo-lex.l"
-{ return OP_INTO; }
+{ return ' '; }
YY_BREAK
case 4:
YY_RULE_SETUP
#line 49 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_MCI; }
+{ return OP_INTO; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 50 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_MCIWAIT; }
+{ return FUNC_MCI; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 51 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_PUT; }
+{ return FUNC_MCIWAIT; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 52 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_SET; }
+{ return FUNC_PUT; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 53 "engines/director/lingo/lingo-lex.l"
-{ return OP_TO; }
+{ return FUNC_SET; }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 55 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+#line 54 "engines/director/lingo/lingo-lex.l"
+{ return OP_TO; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 56 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+{ yylval.s = new Common::String(yytext); return VAR; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 57 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 58 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 13:
-/* rule 13 can match eol */
YY_RULE_SETUP
#line 59 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ return *yytext; }
YY_BREAK
case 14:
+/* rule 14 can match eol */
YY_RULE_SETUP
#line 60 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return '\n'; }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 62 "engines/director/lingo/lingo-lex.l"
+#line 61 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 63 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 857 "engines/director/lingo/lingo-lex.cpp"
+#line 869 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1133,6 +1145,7 @@ static int yy_get_next_buffer (void)
register char *yy_cp;
yy_current_state = (yy_start);
+ yy_current_state += YY_AT_BOL();
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
{
@@ -1145,7 +1158,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 >= 41 )
+ if ( yy_current_state >= 44 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1173,11 +1186,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 >= 41 )
+ if ( yy_current_state >= 44 )
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 == 40);
+ yy_is_jam = (yy_current_state == 43);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1289,6 +1302,8 @@ static int yy_get_next_buffer (void)
*(yy_c_buf_p) = '\0'; /* preserve yytext */
(yy_hold_char) = *++(yy_c_buf_p);
+ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
+
return c;
}
#endif /* ifndef YY_NO_INPUT */
@@ -1850,7 +1865,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 62 "engines/director/lingo/lingo-lex.l"
+#line 63 "engines/director/lingo/lingo-lex.l"
@@ -1861,7 +1876,7 @@ namespace Director {
int Lingo::parse(const char *code) {
YY_BUFFER_STATE bp;
- yydebug = 1;
+ yydebug = 0;
yy_delete_buffer(YY_CURRENT_BUFFER);
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index ed61cae..0d83249 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -44,7 +44,8 @@ newline [\n\r]+
%%
--[^\r\n]*
-[\t] { return ' '; }
+^[ \t]
+[\t]+ { return ' '; }
into { return OP_INTO; }
mci { return FUNC_MCI; }
mciwait { return FUNC_MCIWAIT; }
@@ -68,7 +69,7 @@ namespace Director {
int Lingo::parse(const char *code) {
YY_BUFFER_STATE bp;
- yydebug = 1;
+ yydebug = 0;
yy_delete_buffer(YY_CURRENT_BUFFER);
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index fc79167..51d5312 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -113,6 +113,8 @@ void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
parse(code.c_str());
+ code1(STOP);
+
Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst));
}
Commit: 4a536c57f1012c0bb4380d84ddc2ee72c3f3d332
https://github.com/scummvm/scummvm/commit/4a536c57f1012c0bb4380d84ddc2ee72c3f3d332
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implement func_neg()
Changed paths:
engines/director/lingo/lingo-funcs.cpp
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index c9c14a5..b28e709 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -206,42 +206,46 @@ void Lingo::func_eval() {
}
void Lingo::func_add() {
- Datum d1, d2;
- d2 = g_lingo->pop();
- d1 = g_lingo->pop();
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
d1.val += d2.val;
g_lingo->push(d1);
}
void Lingo::func_sub() {
- Datum d1, d2;
- d2 = g_lingo->pop();
- d1 = g_lingo->pop();
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
d1.val -= d2.val;
g_lingo->push(d1);
}
void Lingo::func_mul() {
- Datum d1, d2;
- d2 = g_lingo->pop();
- d1 = g_lingo->pop();
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
d1.val *= d2.val;
g_lingo->push(d1);
}
void Lingo::func_div() {
- Datum d1, d2;
- d2 = g_lingo->pop();
+ Datum d2 = g_lingo->pop();
if (d2.val == 0)
error("division by zero");
- d1 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
d1.val /= d2.val;
g_lingo->push(d1);
}
void Lingo::func_negate() {
+ Datum d = g_lingo->pop();
+
+ d.val -= d.val;
+ g_lingo->push(d);
}
void Lingo::func_mci() {
Commit: 81b056ffc1670dba3e46c42eb5d16263ab724f6e
https://github.com/scummvm/scummvm/commit/81b056ffc1670dba3e46c42eb5d16263ab724f6e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Add missing funcs
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
engines/director/module.mk
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index fa3a409..fccd3b5 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -79,10 +79,13 @@ Common::Error DirectorEngine::run() {
_lingo->addCode("set x = 1 + 3\n\
set y to 2 + 3 * 2 -- this set y to 4\n\
put 5 into z\n\
--- some more\n", kMovieScript, 2);
+-- some more\n\
+x\n\
+y\n\
+z\n", kMovieScript, 2);
_lingo->addCode("2 + 3 * 2 / (5 - 2)", kMovieScript, 3);
- _lingo->executeScript(kMovieScript, 3);
+ _lingo->executeScript(kMovieScript, 1);
//FIXME
_mainArchive = new RIFFArchive();
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index b28e709..71d1844 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -24,7 +24,10 @@
#include "common/file.h"
#include "audio/decoders/wave.h"
+#include "director/lingo/lingo-gr.h"
+
namespace Director {
+
enum MCITokenType {
kMCITokenNone,
@@ -186,7 +189,7 @@ void Lingo::func_xpop() {
void Lingo::func_printtop(void) {
Datum d = g_lingo->pop();
- warning("%d\n", d.val);
+ warning("%d", d.val);
}
void Lingo::func_constpush() {
@@ -197,12 +200,70 @@ void Lingo::func_constpush() {
}
void Lingo::func_varpush() {
+ Datum d;
+ Symbol *sym;
+ char *name = (char *)g_lingo->_pc;
+
+ if (!g_lingo->_vars.contains(name)) { // Create variable if it was not defined
+ sym = new Symbol;
+ sym->name = (char *)calloc(strlen(name) + 1, 1);
+ Common::strlcpy(sym->name, name, strlen(name) + 1);
+ sym->type = UNDEF;
+ sym->u.val = 0;
+
+ g_lingo->_vars[name] = sym;
+ } else {
+ sym = g_lingo->_vars[name];
+ }
+
+ d.sym = sym;
+
+ g_lingo->_pc += g_lingo->calcStringAlignment(name);
+
+ g_lingo->push(d);
}
void Lingo::func_assign() {
+ Datum d1, d2;
+ d1 = g_lingo->pop();
+ d2 = g_lingo->pop();
+
+ if (d1.sym->type != VAR && d1.sym->type != UNDEF) {
+ warning("assignment to non-variable '%s'", d1.sym->name);
+ return;
+ }
+
+ d1.sym->u.val = d2.val;
+ d1.sym->type = VAR;
+ g_lingo->push(d2);
+}
+
+bool Lingo::verify(Symbol *s) {
+ if (s->type != VAR && s->type != UNDEF) {
+ warning("attempt to evaluate non-variable '%s'", s->name);
+
+ return false;
+ }
+
+ if (s->type == UNDEF) {
+ warning("undefined variable '%s'", s->name);
+
+ return false;
+ }
+
+ return true;
}
void Lingo::func_eval() {
+ Datum d;
+ d = g_lingo->pop();
+
+ if (!g_lingo->verify(d.sym))
+ return;
+
+ d.val = d.sym->u.val;
+
+ g_lingo->push(d);
}
void Lingo::func_add() {
@@ -249,9 +310,19 @@ void Lingo::func_negate() {
}
void Lingo::func_mci() {
+ Common::String s((char *)g_lingo->_pc);
+
+ g_lingo->exec_mci(&s);
+
+ g_lingo->_pc += g_lingo->calcStringAlignment(s.c_str());
}
void Lingo::func_mciwait() {
+ Common::String s((char *)g_lingo->_pc);
+
+ g_lingo->exec_mciwait(&s);
+
+ g_lingo->_pc += g_lingo->calcStringAlignment(s.c_str());
}
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index b6874ec..ad7104c 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -67,30 +67,32 @@
know about them. */
enum yytokentype {
UNARY = 258,
- INT = 259,
- FLOAT = 260,
- VAR = 261,
- STRING = 262,
- OP_INTO = 263,
- OP_TO = 264,
- FUNC_MCI = 265,
- FUNC_MCIWAIT = 266,
- FUNC_PUT = 267,
- FUNC_SET = 268
+ UNDEF = 259,
+ INT = 260,
+ FLOAT = 261,
+ VAR = 262,
+ STRING = 263,
+ OP_INTO = 264,
+ OP_TO = 265,
+ FUNC_MCI = 266,
+ FUNC_MCIWAIT = 267,
+ FUNC_PUT = 268,
+ FUNC_SET = 269
};
#endif
/* Tokens. */
#define UNARY 258
-#define INT 259
-#define FLOAT 260
-#define VAR 261
-#define STRING 262
-#define OP_INTO 263
-#define OP_TO 264
-#define FUNC_MCI 265
-#define FUNC_MCIWAIT 266
-#define FUNC_PUT 267
-#define FUNC_SET 268
+#define UNDEF 259
+#define INT 260
+#define FLOAT 261
+#define VAR 262
+#define STRING 263
+#define OP_INTO 264
+#define OP_TO 265
+#define FUNC_MCI 266
+#define FUNC_MCIWAIT 267
+#define FUNC_PUT 268
+#define FUNC_SET 269
@@ -105,8 +107,6 @@
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-gr.h"
-Common::HashMap<Common::String, int, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> vars;
-
extern int yylex();
extern int yyparse();
void yyerror(char *s) { warning("%s", s); }
@@ -135,7 +135,7 @@ using namespace Director;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 43 "engines/director/lingo/lingo-gr.y"
+#line 41 "engines/director/lingo/lingo-gr.y"
{
Common::String *s;
int i;
@@ -374,7 +374,7 @@ union yyalloc
#define YYLAST 52
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 23
+#define YYNTOKENS 24
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 7
/* YYNRULES -- Number of rules. */
@@ -384,7 +384,7 @@ union yyalloc
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 268
+#define YYMAXUTOK 269
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -393,12 +393,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 20, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 21, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 19, 2, 2,
- 21, 22, 17, 15, 2, 16, 2, 18, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 20, 2, 2,
+ 22, 23, 18, 16, 2, 17, 2, 19, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 14, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 15, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -418,7 +418,7 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
};
#if YYDEBUG
@@ -434,22 +434,22 @@ static const yytype_uint8 yyprhs[] =
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 24, 0, -1, 25, 20, 24, -1, 25, -1, -1,
- 29, -1, 26, -1, 27, -1, 28, -1, -1, 12,
- 28, 8, 6, -1, 13, 6, 14, 28, -1, 13,
- 6, 9, 28, -1, 28, -1, 4, -1, 6, -1,
- 28, 15, 28, -1, 28, 16, 28, -1, 28, 17,
- 28, -1, 28, 18, 28, -1, 15, 28, -1, 16,
- 28, -1, 21, 28, 22, -1, 10, 7, -1, 11,
- 6, -1
+ 25, 0, -1, 26, 21, 25, -1, 26, -1, -1,
+ 30, -1, 27, -1, 28, -1, 29, -1, -1, 13,
+ 29, 9, 7, -1, 14, 7, 15, 29, -1, 14,
+ 7, 10, 29, -1, 29, -1, 5, -1, 7, -1,
+ 29, 16, 29, -1, 29, 17, 29, -1, 29, 18,
+ 29, -1, 29, 19, 29, -1, 16, 29, -1, 17,
+ 29, -1, 22, 29, 23, -1, 11, 8, -1, 12,
+ 7, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 70, 70, 71, 74, 75, 76, 77, 78, 79,
- 82, 83, 84, 87, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 101, 102
+ 0, 68, 68, 69, 72, 73, 74, 75, 76, 77,
+ 80, 81, 82, 85, 88, 89, 90, 91, 92, 93,
+ 94, 95, 96, 99, 100
};
#endif
@@ -458,11 +458,11 @@ static const yytype_uint8 yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "UNARY", "INT", "FLOAT", "VAR", "STRING",
- "OP_INTO", "OP_TO", "FUNC_MCI", "FUNC_MCIWAIT", "FUNC_PUT", "FUNC_SET",
- "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'",
- "$accept", "program", "programline", "assign", "statement", "expr",
- "func", 0
+ "$end", "error", "$undefined", "UNARY", "UNDEF", "INT", "FLOAT", "VAR",
+ "STRING", "OP_INTO", "OP_TO", "FUNC_MCI", "FUNC_MCIWAIT", "FUNC_PUT",
+ "FUNC_SET", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('",
+ "')'", "$accept", "program", "programline", "assign", "statement",
+ "expr", "func", 0
};
#endif
@@ -472,17 +472,17 @@ static const char *const yytname[] =
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 61, 43, 45, 42, 47, 37,
- 10, 40, 41
+ 265, 266, 267, 268, 269, 61, 43, 45, 42, 47,
+ 37, 10, 40, 41
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 23, 24, 24, 25, 25, 25, 25, 25, 25,
- 26, 26, 26, 27, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 29, 29
+ 0, 24, 25, 25, 26, 26, 26, 26, 26, 26,
+ 27, 27, 27, 28, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 30, 30
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -513,20 +513,20 @@ static const yytype_int8 yydefgoto[] =
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -9
+#define YYPACT_NINF -10
static const yytype_int8 yypact[] =
{
- 3, -9, -9, -2, 2, 23, 6, 23, 23, 23,
- 17, 8, -9, -9, 19, -9, -9, -9, 25, -8,
- -9, -9, 30, -9, 3, 23, 23, 23, 23, 24,
- 23, 23, -9, -9, -7, -7, -9, -9, -9, 19,
- 19
+ 2, -10, -10, -3, 1, 22, 5, 22, 22, 22,
+ 17, 7, -10, -10, 18, -10, -10, -10, 24, -9,
+ -10, -10, 29, -10, 2, 22, 22, 22, 22, 23,
+ 22, 22, -10, -10, -8, -8, -10, -10, -10, 18,
+ 18
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -9, 7, -9, -9, -9, -5, -9
+ -10, 8, -10, -10, -10, -5, -10
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -539,30 +539,30 @@ static const yytype_uint8 yytable[] =
18, 30, 20, 21, 22, 16, 31, 1, 17, 2,
27, 28, 19, 3, 4, 5, 6, 23, 7, 8,
34, 35, 36, 37, 9, 39, 40, 1, 24, 2,
- 38, 33, 0, 29, 25, 26, 27, 28, 7, 8,
+ 38, 0, 33, 29, 25, 26, 27, 28, 7, 8,
25, 26, 27, 28, 9, 25, 26, 27, 28, 0,
0, 0, 32
};
static const yytype_int8 yycheck[] =
{
- 5, 9, 7, 8, 9, 7, 14, 4, 6, 6,
- 17, 18, 6, 10, 11, 12, 13, 0, 15, 16,
- 25, 26, 27, 28, 21, 30, 31, 4, 20, 6,
- 6, 24, -1, 8, 15, 16, 17, 18, 15, 16,
- 15, 16, 17, 18, 21, 15, 16, 17, 18, -1,
- -1, -1, 22
+ 5, 10, 7, 8, 9, 8, 15, 5, 7, 7,
+ 18, 19, 7, 11, 12, 13, 14, 0, 16, 17,
+ 25, 26, 27, 28, 22, 30, 31, 5, 21, 7,
+ 7, -1, 24, 9, 16, 17, 18, 19, 16, 17,
+ 16, 17, 18, 19, 22, 16, 17, 18, 19, -1,
+ -1, -1, 23
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 4, 6, 10, 11, 12, 13, 15, 16, 21,
- 24, 25, 26, 27, 28, 29, 7, 6, 28, 6,
- 28, 28, 28, 0, 20, 15, 16, 17, 18, 8,
- 9, 14, 22, 24, 28, 28, 28, 28, 6, 28,
- 28
+ 0, 5, 7, 11, 12, 13, 14, 16, 17, 22,
+ 25, 26, 27, 28, 29, 30, 8, 7, 29, 7,
+ 29, 29, 29, 0, 21, 16, 17, 18, 19, 9,
+ 10, 15, 23, 25, 29, 29, 29, 29, 7, 29,
+ 29
};
#define yyerrok (yyerrstatus = 0)
@@ -1377,87 +1377,87 @@ yyreduce:
switch (yyn)
{
case 6:
-#line 76 "engines/director/lingo/lingo-gr.y"
+#line 74 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_xpop); ;}
break;
case 8:
-#line 78 "engines/director/lingo/lingo-gr.y"
+#line 76 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_printtop); ;}
break;
case 10:
-#line 82 "engines/director/lingo/lingo-gr.y"
+#line 80 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
break;
case 11:
-#line 83 "engines/director/lingo/lingo-gr.y"
+#line 81 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 12:
-#line 84 "engines/director/lingo/lingo-gr.y"
+#line 82 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 13:
-#line 87 "engines/director/lingo/lingo-gr.y"
+#line 85 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_xpop); ;}
break;
case 14:
-#line 90 "engines/director/lingo/lingo-gr.y"
+#line 88 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
break;
case 15:
-#line 91 "engines/director/lingo/lingo-gr.y"
+#line 89 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
case 16:
-#line 92 "engines/director/lingo/lingo-gr.y"
+#line 90 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_add); ;}
break;
case 17:
-#line 93 "engines/director/lingo/lingo-gr.y"
+#line 91 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_sub); ;}
break;
case 18:
-#line 94 "engines/director/lingo/lingo-gr.y"
+#line 92 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mul); ;}
break;
case 19:
-#line 95 "engines/director/lingo/lingo-gr.y"
+#line 93 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_div); ;}
break;
case 20:
-#line 96 "engines/director/lingo/lingo-gr.y"
+#line 94 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 21:
-#line 97 "engines/director/lingo/lingo-gr.y"
+#line 95 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
break;
case 22:
-#line 98 "engines/director/lingo/lingo-gr.y"
+#line 96 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 23:
-#line 101 "engines/director/lingo/lingo-gr.y"
+#line 99 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 24:
-#line 102 "engines/director/lingo/lingo-gr.y"
+#line 100 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
@@ -1677,6 +1677,6 @@ yyreturn:
}
-#line 105 "engines/director/lingo/lingo-gr.y"
+#line 103 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index ddf0c48..2de0733 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -40,37 +40,39 @@
know about them. */
enum yytokentype {
UNARY = 258,
- INT = 259,
- FLOAT = 260,
- VAR = 261,
- STRING = 262,
- OP_INTO = 263,
- OP_TO = 264,
- FUNC_MCI = 265,
- FUNC_MCIWAIT = 266,
- FUNC_PUT = 267,
- FUNC_SET = 268
+ UNDEF = 259,
+ INT = 260,
+ FLOAT = 261,
+ VAR = 262,
+ STRING = 263,
+ OP_INTO = 264,
+ OP_TO = 265,
+ FUNC_MCI = 266,
+ FUNC_MCIWAIT = 267,
+ FUNC_PUT = 268,
+ FUNC_SET = 269
};
#endif
/* Tokens. */
#define UNARY 258
-#define INT 259
-#define FLOAT 260
-#define VAR 261
-#define STRING 262
-#define OP_INTO 263
-#define OP_TO 264
-#define FUNC_MCI 265
-#define FUNC_MCIWAIT 266
-#define FUNC_PUT 267
-#define FUNC_SET 268
+#define UNDEF 259
+#define INT 260
+#define FLOAT 261
+#define VAR 262
+#define STRING 263
+#define OP_INTO 264
+#define OP_TO 265
+#define FUNC_MCI 266
+#define FUNC_MCIWAIT 267
+#define FUNC_PUT 268
+#define FUNC_SET 269
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 43 "engines/director/lingo/lingo-gr.y"
+#line 41 "engines/director/lingo/lingo-gr.y"
{
Common::String *s;
int i;
@@ -78,7 +80,7 @@ typedef union YYSTYPE
int code;
}
/* Line 1529 of yacc.c. */
-#line 82 "engines/director/lingo/lingo-gr.hpp"
+#line 84 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index c05e985..e79fab4 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -30,8 +30,6 @@
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-gr.h"
-Common::HashMap<Common::String, int, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> vars;
-
extern int yylex();
extern int yyparse();
void yyerror(char *s) { warning("%s", s); }
@@ -47,7 +45,7 @@ using namespace Director;
int code;
}
-%token UNARY
+%token UNARY UNDEF
%token<i> INT
%token<f> FLOAT
%token<s> VAR STRING
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 59796ce..8b27c5d 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -697,7 +697,7 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 44 "engines/director/lingo/lingo-lex.l"
+#line 45 "engines/director/lingo/lingo-lex.l"
#line 704 "engines/director/lingo/lingo-lex.cpp"
@@ -786,83 +786,83 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 46 "engines/director/lingo/lingo-lex.l"
+#line 47 "engines/director/lingo/lingo-lex.l"
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 47 "engines/director/lingo/lingo-lex.l"
+#line 48 "engines/director/lingo/lingo-lex.l"
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 48 "engines/director/lingo/lingo-lex.l"
+#line 49 "engines/director/lingo/lingo-lex.l"
{ return ' '; }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 49 "engines/director/lingo/lingo-lex.l"
+#line 50 "engines/director/lingo/lingo-lex.l"
{ return OP_INTO; }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 50 "engines/director/lingo/lingo-lex.l"
+#line 51 "engines/director/lingo/lingo-lex.l"
{ return FUNC_MCI; }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 51 "engines/director/lingo/lingo-lex.l"
+#line 52 "engines/director/lingo/lingo-lex.l"
{ return FUNC_MCIWAIT; }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 52 "engines/director/lingo/lingo-lex.l"
+#line 53 "engines/director/lingo/lingo-lex.l"
{ return FUNC_PUT; }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 53 "engines/director/lingo/lingo-lex.l"
+#line 54 "engines/director/lingo/lingo-lex.l"
{ return FUNC_SET; }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 54 "engines/director/lingo/lingo-lex.l"
+#line 55 "engines/director/lingo/lingo-lex.l"
{ return OP_TO; }
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 56 "engines/director/lingo/lingo-lex.l"
+#line 57 "engines/director/lingo/lingo-lex.l"
{ yylval.s = new Common::String(yytext); return VAR; }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 57 "engines/director/lingo/lingo-lex.l"
+#line 58 "engines/director/lingo/lingo-lex.l"
{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 58 "engines/director/lingo/lingo-lex.l"
+#line 59 "engines/director/lingo/lingo-lex.l"
{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 59 "engines/director/lingo/lingo-lex.l"
+#line 60 "engines/director/lingo/lingo-lex.l"
{ return *yytext; }
YY_BREAK
case 14:
/* rule 14 can match eol */
YY_RULE_SETUP
-#line 60 "engines/director/lingo/lingo-lex.l"
+#line 61 "engines/director/lingo/lingo-lex.l"
{ return '\n'; }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 61 "engines/director/lingo/lingo-lex.l"
+#line 62 "engines/director/lingo/lingo-lex.l"
{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 63 "engines/director/lingo/lingo-lex.l"
+#line 64 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
#line 869 "engines/director/lingo/lingo-lex.cpp"
@@ -1865,7 +1865,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 63 "engines/director/lingo/lingo-lex.l"
+#line 64 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 0d83249..c49dae9 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -40,11 +40,12 @@ constinteger [[:digit:]]+
conststring \"[^\"\n]*\"
operator [-+*/%=^:,()]
newline [\n\r]+
+whitespace [\t ]
%%
--[^\r\n]*
-^[ \t]
+^{whitespace}
[\t]+ { return ' '; }
into { return OP_INTO; }
mci { return FUNC_MCI; }
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 51d5312..1572685 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -21,6 +21,7 @@
*/
#include "director/lingo/lingo.h"
+#include "director/lingo/lingo-gr.h"
namespace Director {
@@ -66,6 +67,12 @@ struct EventHandlerType {
{ kEventNone, 0 },
};
+Symbol::Symbol() {
+ name = NULL;
+ type = UNDEF;
+ u.str = NULL;
+}
+
Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
g_lingo = this;
@@ -82,8 +89,7 @@ Lingo::~Lingo() {
}
int Lingo::codeString(const char *str) {
- int instLen = sizeof(inst);
- int numInsts = strlen(str) / instLen + (strlen(str) + 1 + instLen - 1) % instLen;
+ int numInsts = calcStringAlignment(str);
// Where we copy the string over
int pos = _currentScript->size();
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index fba82a2..2da23ce 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -82,11 +82,15 @@ typedef struct Symbol { /* symbol table entry */
inst *defn; /* FUNCTION, PROCEDURE */
char *str; /* STRING */
} u;
+
+ Symbol();
} Symbol;
typedef union Datum { /* interpreter stack type */
int val;
Symbol *sym;
+
+ Datum() { val = 0; sym = NULL; }
} Datum;
typedef Common::Array<inst> ScriptData;
@@ -108,6 +112,10 @@ public:
int code3(inst code_1, inst code_2, inst code_3) { code1(code_1); code1(code_2); return code1(code_3); }
int codeString(const char *s);
+ int calcStringAlignment(const char *s) {
+ int instLen = sizeof(inst);
+ int l = strlen(s); return l / instLen + (l + 1 + instLen - 1) % instLen;
+ }
public:
static void func_xpop();
@@ -120,6 +128,7 @@ public:
static void func_constpush();
static void func_varpush();
static void func_assign();
+ bool verify(Symbol *s);
static void func_eval();
static void func_mci();
static void func_mciwait();
@@ -137,6 +146,8 @@ private:
ScriptHash _scripts[kMaxScriptType + 1];
ScriptData *_currentScript;
+ Common::HashMap<Common::String, Symbol *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _vars;
+
inst *_pc;
StackData _stack;
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 2d0bb51..0d46b09 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -8,9 +8,9 @@ MODULE_OBJS = \
resource.o \
score.o \
sound.o \
+ lingo/lingo-gr.o \
lingo/lingo.o \
lingo/lingo-funcs.o \
- lingo/lingo-gr.o \
lingo/lingo-lex.o
engines/director/lingo/lingo-lex.cpp: engines/director/lingo/lingo-lex.l
Commit: 5db0d15bc2b6e2f3e08666ffa3184bd04619d49a
https://github.com/scummvm/scummvm/commit/5db0d15bc2b6e2f3e08666ffa3184bd04619d49a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Simpler token constants
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index ad7104c..5d2d2bf 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -72,12 +72,12 @@
FLOAT = 261,
VAR = 262,
STRING = 263,
- OP_INTO = 264,
- OP_TO = 265,
- FUNC_MCI = 266,
- FUNC_MCIWAIT = 267,
- FUNC_PUT = 268,
- FUNC_SET = 269
+ tINTO = 264,
+ tTO = 265,
+ tMCI = 266,
+ tMCIWAIT = 267,
+ tPUT = 268,
+ tSET = 269
};
#endif
/* Tokens. */
@@ -87,12 +87,12 @@
#define FLOAT 261
#define VAR 262
#define STRING 263
-#define OP_INTO 264
-#define OP_TO 265
-#define FUNC_MCI 266
-#define FUNC_MCIWAIT 267
-#define FUNC_PUT 268
-#define FUNC_SET 269
+#define tINTO 264
+#define tTO 265
+#define tMCI 266
+#define tMCIWAIT 267
+#define tPUT 268
+#define tSET 269
@@ -447,9 +447,9 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 68, 68, 69, 72, 73, 74, 75, 76, 77,
- 80, 81, 82, 85, 88, 89, 90, 91, 92, 93,
- 94, 95, 96, 99, 100
+ 0, 64, 64, 65, 68, 69, 70, 71, 72, 73,
+ 76, 77, 78, 81, 84, 85, 86, 87, 88, 89,
+ 90, 91, 92, 95, 96
};
#endif
@@ -459,10 +459,9 @@ static const yytype_uint8 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "UNARY", "UNDEF", "INT", "FLOAT", "VAR",
- "STRING", "OP_INTO", "OP_TO", "FUNC_MCI", "FUNC_MCIWAIT", "FUNC_PUT",
- "FUNC_SET", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('",
- "')'", "$accept", "program", "programline", "assign", "statement",
- "expr", "func", 0
+ "STRING", "tINTO", "tTO", "tMCI", "tMCIWAIT", "tPUT", "tSET", "'='",
+ "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "$accept",
+ "program", "programline", "assign", "statement", "expr", "func", 0
};
#endif
@@ -1377,93 +1376,93 @@ yyreduce:
switch (yyn)
{
case 6:
-#line 74 "engines/director/lingo/lingo-gr.y"
+#line 70 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_xpop); ;}
break;
case 8:
-#line 76 "engines/director/lingo/lingo-gr.y"
+#line 72 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_printtop); ;}
break;
case 10:
-#line 80 "engines/director/lingo/lingo-gr.y"
+#line 76 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
break;
case 11:
-#line 81 "engines/director/lingo/lingo-gr.y"
+#line 77 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 12:
-#line 82 "engines/director/lingo/lingo-gr.y"
+#line 78 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 13:
-#line 85 "engines/director/lingo/lingo-gr.y"
+#line 81 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_xpop); ;}
break;
case 14:
-#line 88 "engines/director/lingo/lingo-gr.y"
+#line 84 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
break;
case 15:
-#line 89 "engines/director/lingo/lingo-gr.y"
+#line 85 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
case 16:
-#line 90 "engines/director/lingo/lingo-gr.y"
+#line 86 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_add); ;}
break;
case 17:
-#line 91 "engines/director/lingo/lingo-gr.y"
+#line 87 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_sub); ;}
break;
case 18:
-#line 92 "engines/director/lingo/lingo-gr.y"
+#line 88 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mul); ;}
break;
case 19:
-#line 93 "engines/director/lingo/lingo-gr.y"
+#line 89 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_div); ;}
break;
case 20:
-#line 94 "engines/director/lingo/lingo-gr.y"
+#line 90 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 21:
-#line 95 "engines/director/lingo/lingo-gr.y"
+#line 91 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
break;
case 22:
-#line 96 "engines/director/lingo/lingo-gr.y"
+#line 92 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 23:
-#line 99 "engines/director/lingo/lingo-gr.y"
+#line 95 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 24:
-#line 100 "engines/director/lingo/lingo-gr.y"
+#line 96 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1467 "engines/director/lingo/lingo-gr.cpp"
+#line 1466 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1677,6 +1676,6 @@ yyreturn:
}
-#line 103 "engines/director/lingo/lingo-gr.y"
+#line 99 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 2de0733..40d2ddf 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -45,12 +45,12 @@
FLOAT = 261,
VAR = 262,
STRING = 263,
- OP_INTO = 264,
- OP_TO = 265,
- FUNC_MCI = 266,
- FUNC_MCIWAIT = 267,
- FUNC_PUT = 268,
- FUNC_SET = 269
+ tINTO = 264,
+ tTO = 265,
+ tMCI = 266,
+ tMCIWAIT = 267,
+ tPUT = 268,
+ tSET = 269
};
#endif
/* Tokens. */
@@ -60,12 +60,12 @@
#define FLOAT 261
#define VAR 262
#define STRING 263
-#define OP_INTO 264
-#define OP_TO 265
-#define FUNC_MCI 266
-#define FUNC_MCIWAIT 267
-#define FUNC_PUT 268
-#define FUNC_SET 269
+#define tINTO 264
+#define tTO 265
+#define tMCI 266
+#define tMCIWAIT 267
+#define tPUT 268
+#define tSET 269
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index e79fab4..28f2051 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -49,12 +49,8 @@ using namespace Director;
%token<i> INT
%token<f> FLOAT
%token<s> VAR STRING
-%token OP_INTO
-%token OP_TO
-%token FUNC_MCI
-%token FUNC_MCIWAIT
-%token FUNC_PUT
-%token FUNC_SET
+%token tINTO tTO
+%token tMCI tMCIWAIT tPUT tSET
%type<code> assign expr
@@ -77,9 +73,9 @@ programline:
| /* empty */
;
-assign: FUNC_PUT expr OP_INTO VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($4->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $2; delete $4; }
- | FUNC_SET VAR '=' expr { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $4; delete $2; }
- | FUNC_SET VAR OP_TO expr { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $4; delete $2; }
+assign: tPUT expr tINTO VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($4->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $2; delete $4; }
+ | tSET VAR '=' expr { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $4; delete $2; }
+ | tSET VAR tTO expr { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $4; delete $2; }
;
statement: expr { g_lingo->code1(g_lingo->func_xpop); }
@@ -96,8 +92,8 @@ expr: INT { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT3
| '(' expr ')' { $$ = $2; }
;
-func: FUNC_MCI STRING { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString($2->c_str()); delete $2; }
- | FUNC_MCIWAIT VAR { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
+func: tMCI STRING { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString($2->c_str()); delete $2; }
+ | tMCIWAIT VAR { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
;
%%
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 8b27c5d..6e292dc 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -802,32 +802,32 @@ YY_RULE_SETUP
case 4:
YY_RULE_SETUP
#line 50 "engines/director/lingo/lingo-lex.l"
-{ return OP_INTO; }
+{ return tINTO; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 51 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_MCI; }
+{ return tMCI; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 52 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_MCIWAIT; }
+{ return tMCIWAIT; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 53 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_PUT; }
+{ return tPUT; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 54 "engines/director/lingo/lingo-lex.l"
-{ return FUNC_SET; }
+{ return tSET; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 55 "engines/director/lingo/lingo-lex.l"
-{ return OP_TO; }
+{ return tTO; }
YY_BREAK
case 10:
YY_RULE_SETUP
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index c49dae9..2e21c7e 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -47,12 +47,12 @@ whitespace [\t ]
--[^\r\n]*
^{whitespace}
[\t]+ { return ' '; }
-into { return OP_INTO; }
-mci { return FUNC_MCI; }
-mciwait { return FUNC_MCIWAIT; }
-put { return FUNC_PUT; }
-set { return FUNC_SET; }
-to { return OP_TO; }
+into { return tINTO; }
+mci { return tMCI; }
+mciwait { return tMCIWAIT; }
+put { return tPUT; }
+set { return tSET; }
+to { return tTO; }
{variable} { yylval.s = new Common::String(yytext); return VAR; }
{constfloat} { yylval.f = atof(yytext); return FLOAT; }
Commit: 4109e8589077d035d76b7ed5bc3734f6a258eaf3
https://github.com/scummvm/scummvm/commit/4109e8589077d035d76b7ed5bc3734f6a258eaf3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix string alignment computation
Changed paths:
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 2da23ce..676f257 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -114,7 +114,7 @@ public:
int calcStringAlignment(const char *s) {
int instLen = sizeof(inst);
- int l = strlen(s); return l / instLen + (l + 1 + instLen - 1) % instLen;
+ int l = strlen(s); return (l + 1 + instLen - 1) / instLen;
}
public:
Commit: da4db91941a21f2ad1f5405dd406b0d2a19eb53d
https://github.com/scummvm/scummvm/commit/da4db91941a21f2ad1f5405dd406b0d2a19eb53d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implement 'go' and 'go to' functions
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index fccd3b5..86de72d 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -76,16 +76,14 @@ Common::Error DirectorEngine::run() {
_lingo->addCode("mci \"open MM\\T005045a.wav type WaveAudio alias T005045a\"\n\
mci \"play T005045a from 22710 to 32872\"", kMovieScript, 1);
- _lingo->addCode("set x = 1 + 3\n\
- set y to 2 + 3 * 2 -- this set y to 4\n\
- put 5 into z\n\
--- some more\n\
-x\n\
-y\n\
-z\n", kMovieScript, 2);
-
- _lingo->addCode("2 + 3 * 2 / (5 - 2)", kMovieScript, 3);
- _lingo->executeScript(kMovieScript, 1);
+ _lingo->addCode("go to frame \"Open23\" of movie \"OpenCabin23\"\n\
+go \"CARDBACK\"\n\
+go movie \"BAR 1\"\n\
+go to \"Open23\" of movie \"OpenCabin23\"\n\
+go to \"Chair\"\n\
+ ", kMovieScript, 2);
+
+ _lingo->executeScript(kMovieScript, 2);
//FIXME
_mainArchive = new RIFFArchive();
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 71d1844..bbe8d74 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -64,16 +64,16 @@ struct MCIToken {
{ kMCITokenNone, kMCITokenNone, 0, 0 }
};
-int Lingo::exec_mci(Common::String *s) {
+void Lingo::exec_mci(Common::String &s) {
Common::String params[5];
MCITokenType command = kMCITokenNone;
- s->trim();
- s->toLowercase();
+ s.trim();
+ s.toLowercase();
MCITokenType state = kMCITokenNone;
Common::String token;
- const char *ptr = s->c_str();
+ const char *ptr = s.c_str();
int respos = -1;
while (*ptr) {
@@ -131,7 +131,7 @@ int Lingo::exec_mci(Common::String *s) {
if (!file->open(params[0])) {
warning("Failed to open %s", params[0].c_str());
delete file;
- return 0;
+ return;
}
if (params[1] == "waveaudio") {
@@ -148,7 +148,7 @@ int Lingo::exec_mci(Common::String *s) {
if (!_audioAliases.contains(params[0])) {
warning("Unknown alias %s", params[0].c_str());
- return 0;
+ return;
}
uint32 from = strtol(params[1].c_str(), 0, 10);
@@ -158,14 +158,16 @@ int Lingo::exec_mci(Common::String *s) {
}
break;
default:
- warning("Unhandled MCI command: %s", s->c_str());
+ warning("Unhandled MCI command: %s", s.c_str());
}
+}
- return 0;
+void Lingo::exec_mciwait(Common::String &s) {
+ warning("STUB: MCI wait file: %s", s.c_str());
}
-void Lingo::exec_mciwait(Common::String *s) {
- warning("MCI wait file: %s", s->c_str());
+void Lingo::exec_goto(Common::String &frame, Common::String &movie) {
+ warning("STUB: go to %s movie %s", frame.c_str(), movie.c_str());
}
void Lingo::push(Datum d) {
@@ -312,7 +314,7 @@ void Lingo::func_negate() {
void Lingo::func_mci() {
Common::String s((char *)g_lingo->_pc);
- g_lingo->exec_mci(&s);
+ g_lingo->exec_mci(s);
g_lingo->_pc += g_lingo->calcStringAlignment(s.c_str());
}
@@ -320,9 +322,31 @@ void Lingo::func_mci() {
void Lingo::func_mciwait() {
Common::String s((char *)g_lingo->_pc);
- g_lingo->exec_mciwait(&s);
+ g_lingo->exec_mciwait(s);
g_lingo->_pc += g_lingo->calcStringAlignment(s.c_str());
}
+void Lingo::func_goto() {
+ Common::String frame((char *)g_lingo->_pc);
+ g_lingo->_pc += g_lingo->calcStringAlignment(frame.c_str());
+
+ Common::String movie((char *)g_lingo->_pc);
+ g_lingo->_pc += g_lingo->calcStringAlignment(movie.c_str());
+
+ g_lingo->exec_goto(frame, movie);
+}
+
+void Lingo::func_gotoloop() {
+ warning("STUB: func_gotoloop()");
+}
+
+void Lingo::func_gotonext() {
+ warning("STUB: func_gotonext()");
+}
+
+void Lingo::func_gotoprevious() {
+ warning("STUB: func_gotoprevious()");
+}
+
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 5d2d2bf..953d2b5 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -72,12 +72,19 @@
FLOAT = 261,
VAR = 262,
STRING = 263,
- tINTO = 264,
- tTO = 265,
- tMCI = 266,
- tMCIWAIT = 267,
- tPUT = 268,
- tSET = 269
+ tFRAME = 264,
+ tGO = 265,
+ tINTO = 266,
+ tLOOP = 267,
+ tMCI = 268,
+ tMCIWAIT = 269,
+ tMOVIE = 270,
+ tNEXT = 271,
+ tOF = 272,
+ tPREVIOUS = 273,
+ tPUT = 274,
+ tSET = 275,
+ tTO = 276
};
#endif
/* Tokens. */
@@ -87,12 +94,19 @@
#define FLOAT 261
#define VAR 262
#define STRING 263
-#define tINTO 264
-#define tTO 265
-#define tMCI 266
-#define tMCIWAIT 267
-#define tPUT 268
-#define tSET 269
+#define tFRAME 264
+#define tGO 265
+#define tINTO 266
+#define tLOOP 267
+#define tMCI 268
+#define tMCIWAIT 269
+#define tMOVIE 270
+#define tNEXT 271
+#define tOF 272
+#define tPREVIOUS 273
+#define tPUT 274
+#define tSET 275
+#define tTO 276
@@ -143,7 +157,7 @@ typedef union YYSTYPE
int code;
}
/* Line 193 of yacc.c. */
-#line 147 "engines/director/lingo/lingo-gr.cpp"
+#line 161 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -156,7 +170,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 160 "engines/director/lingo/lingo-gr.cpp"
+#line 174 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -369,22 +383,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 23
+#define YYFINAL 34
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 52
+#define YYLAST 77
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 24
+#define YYNTOKENS 31
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 7
+#define YYNNTS 9
/* YYNRULES -- Number of rules. */
-#define YYNRULES 24
+#define YYNRULES 37
/* YYNRULES -- Number of states. */
-#define YYNSTATES 41
+#define YYNSTATES 63
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 269
+#define YYMAXUTOK 276
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -393,12 +407,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 21, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 28, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 20, 2, 2,
- 22, 23, 18, 16, 2, 17, 2, 19, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 27, 2, 2,
+ 29, 30, 25, 23, 2, 24, 2, 26, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 15, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 22, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -418,7 +432,8 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21
};
#if YYDEBUG
@@ -428,20 +443,25 @@ static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
19, 24, 29, 34, 36, 38, 40, 44, 48, 52,
- 56, 59, 62, 66, 69
+ 56, 59, 62, 66, 69, 72, 75, 78, 81, 84,
+ 88, 91, 95, 98, 101, 103, 107, 110
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 25, 0, -1, 26, 21, 25, -1, 26, -1, -1,
- 30, -1, 27, -1, 28, -1, 29, -1, -1, 13,
- 29, 9, 7, -1, 14, 7, 15, 29, -1, 14,
- 7, 10, 29, -1, 29, -1, 5, -1, 7, -1,
- 29, 16, 29, -1, 29, 17, 29, -1, 29, 18,
- 29, -1, 29, 19, 29, -1, 16, 29, -1, 17,
- 29, -1, 22, 29, 23, -1, 11, 8, -1, 12,
- 7, -1
+ 32, 0, -1, 33, 28, 32, -1, 33, -1, -1,
+ 37, -1, 34, -1, 35, -1, 36, -1, -1, 19,
+ 36, 11, 7, -1, 20, 7, 22, 36, -1, 20,
+ 7, 21, 36, -1, 36, -1, 5, -1, 7, -1,
+ 36, 23, 36, -1, 36, 24, 36, -1, 36, 25,
+ 36, -1, 36, 26, 36, -1, 23, 36, -1, 24,
+ 36, -1, 29, 36, 30, -1, 13, 8, -1, 14,
+ 7, -1, 10, 12, -1, 10, 16, -1, 10, 18,
+ -1, 10, 38, -1, 10, 38, 39, -1, 10, 39,
+ -1, 21, 9, 8, -1, 9, 8, -1, 21, 8,
+ -1, 8, -1, 17, 15, 8, -1, 15, 8, -1,
+ 21, 15, 8, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -449,7 +469,8 @@ static const yytype_uint8 yyrline[] =
{
0, 64, 64, 65, 68, 69, 70, 71, 72, 73,
76, 77, 78, 81, 84, 85, 86, 87, 88, 89,
- 90, 91, 92, 95, 96
+ 90, 91, 92, 95, 96, 97, 98, 99, 100, 101,
+ 102, 114, 115, 116, 117, 120, 121, 122
};
#endif
@@ -459,9 +480,11 @@ static const yytype_uint8 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "UNARY", "UNDEF", "INT", "FLOAT", "VAR",
- "STRING", "tINTO", "tTO", "tMCI", "tMCIWAIT", "tPUT", "tSET", "'='",
+ "STRING", "tFRAME", "tGO", "tINTO", "tLOOP", "tMCI", "tMCIWAIT",
+ "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tSET", "tTO", "'='",
"'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "$accept",
- "program", "programline", "assign", "statement", "expr", "func", 0
+ "program", "programline", "assign", "statement", "expr", "func",
+ "gotoframe", "gotomovie", 0
};
#endif
@@ -471,17 +494,19 @@ static const char *const yytname[] =
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 61, 43, 45, 42, 47,
- 37, 10, 40, 41
+ 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
+ 275, 276, 61, 43, 45, 42, 47, 37, 10, 40,
+ 41
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 24, 25, 25, 26, 26, 26, 26, 26, 26,
- 27, 27, 27, 28, 29, 29, 29, 29, 29, 29,
- 29, 29, 29, 30, 30
+ 0, 31, 32, 32, 33, 33, 33, 33, 33, 33,
+ 34, 34, 34, 35, 36, 36, 36, 36, 36, 36,
+ 36, 36, 36, 37, 37, 37, 37, 37, 37, 37,
+ 37, 38, 38, 38, 38, 39, 39, 39
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -489,7 +514,8 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 0,
4, 4, 4, 1, 1, 1, 3, 3, 3, 3,
- 2, 2, 3, 2, 2
+ 2, 2, 3, 2, 2, 2, 2, 2, 2, 3,
+ 2, 3, 2, 2, 1, 3, 2, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -498,34 +524,38 @@ static const yytype_uint8 yyr2[] =
static const yytype_uint8 yydefact[] =
{
4, 14, 15, 0, 0, 0, 0, 0, 0, 0,
- 0, 3, 6, 7, 8, 5, 23, 24, 0, 0,
- 20, 21, 0, 1, 4, 0, 0, 0, 0, 0,
- 0, 0, 22, 2, 16, 17, 18, 19, 10, 12,
- 11
+ 0, 0, 3, 6, 7, 8, 5, 34, 0, 25,
+ 0, 26, 0, 27, 0, 28, 30, 23, 24, 0,
+ 0, 20, 21, 0, 1, 4, 0, 0, 0, 0,
+ 32, 36, 0, 33, 0, 0, 0, 29, 0, 0,
+ 0, 22, 2, 16, 17, 18, 19, 35, 31, 37,
+ 10, 12, 11
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 10, 11, 12, 13, 14, 15
+ -1, 11, 12, 13, 14, 15, 16, 25, 26
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -10
+#define YYPACT_NINF -18
static const yytype_int8 yypact[] =
{
- 2, -10, -10, -3, 1, 22, 5, 22, 22, 22,
- 17, 7, -10, -10, 18, -10, -10, -10, 24, -9,
- -10, -10, 29, -10, 2, 22, 22, 22, 22, 23,
- 22, 22, -10, -10, -8, -8, -10, -10, -10, 18,
- 18
+ 0, -18, -18, 44, -7, 2, 11, 8, 11, 11,
+ 11, 17, -17, -18, -18, 51, -18, -18, 19, -18,
+ 31, -18, 26, -18, 13, -9, -18, -18, -18, 25,
+ 4, -18, -18, 43, -18, 0, 11, 11, 11, 11,
+ -18, -18, 34, -18, 37, 38, 32, -18, 47, 11,
+ 11, -18, -18, 12, 12, -18, -18, -18, -18, -18,
+ -18, 51, 51
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -10, 8, -10, -10, -10, -5, -10
+ -18, 20, -18, -18, -18, -6, -18, -18, 33
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -535,33 +565,39 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
- 18, 30, 20, 21, 22, 16, 31, 1, 17, 2,
- 27, 28, 19, 3, 4, 5, 6, 23, 7, 8,
- 34, 35, 36, 37, 9, 39, 40, 1, 24, 2,
- 38, 0, 33, 29, 25, 26, 27, 28, 7, 8,
- 25, 26, 27, 28, 9, 25, 26, 27, 28, 0,
- 0, 0, 32
+ 29, 27, 31, 32, 33, 1, 20, 2, 22, 28,
+ 3, 35, 46, 4, 5, 30, 1, 34, 2, 6,
+ 7, 43, 44, 8, 9, 49, 50, 40, 45, 10,
+ 53, 54, 55, 56, 8, 9, 48, 38, 39, 41,
+ 10, 42, 57, 61, 62, 58, 59, 45, 36, 37,
+ 38, 39, 17, 18, 60, 52, 19, 0, 47, 20,
+ 21, 22, 23, 0, 0, 24, 36, 37, 38, 39,
+ 0, 0, 0, 51, 36, 37, 38, 39
};
static const yytype_int8 yycheck[] =
{
- 5, 10, 7, 8, 9, 8, 15, 5, 7, 7,
- 18, 19, 7, 11, 12, 13, 14, 0, 16, 17,
- 25, 26, 27, 28, 22, 30, 31, 5, 21, 7,
- 7, -1, 24, 9, 16, 17, 18, 19, 16, 17,
- 16, 17, 18, 19, 22, 16, 17, 18, 19, -1,
- -1, -1, 23
+ 6, 8, 8, 9, 10, 5, 15, 7, 17, 7,
+ 10, 28, 21, 13, 14, 7, 5, 0, 7, 19,
+ 20, 8, 9, 23, 24, 21, 22, 8, 15, 29,
+ 36, 37, 38, 39, 23, 24, 11, 25, 26, 8,
+ 29, 15, 8, 49, 50, 8, 8, 15, 23, 24,
+ 25, 26, 8, 9, 7, 35, 12, -1, 25, 15,
+ 16, 17, 18, -1, -1, 21, 23, 24, 25, 26,
+ -1, -1, -1, 30, 23, 24, 25, 26
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 5, 7, 11, 12, 13, 14, 16, 17, 22,
- 25, 26, 27, 28, 29, 30, 8, 7, 29, 7,
- 29, 29, 29, 0, 21, 16, 17, 18, 19, 9,
- 10, 15, 23, 25, 29, 29, 29, 29, 7, 29,
- 29
+ 0, 5, 7, 10, 13, 14, 19, 20, 23, 24,
+ 29, 32, 33, 34, 35, 36, 37, 8, 9, 12,
+ 15, 16, 17, 18, 21, 38, 39, 8, 7, 36,
+ 7, 36, 36, 36, 0, 28, 23, 24, 25, 26,
+ 8, 8, 15, 8, 9, 15, 21, 39, 11, 21,
+ 22, 30, 32, 36, 36, 36, 36, 8, 8, 8,
+ 7, 36, 36
};
#define yyerrok (yyerrstatus = 0)
@@ -1460,9 +1496,74 @@ yyreduce:
{ g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
+ case 25:
+#line 97 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_gotoloop); ;}
+ break;
+
+ case 26:
+#line 98 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_gotonext); ;}
+ break;
+
+ case 27:
+#line 99 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_gotoprevious); ;}
+ break;
+
+ case 28:
+#line 100 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 29:
+#line 101 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
+ break;
+
+ case 30:
+#line 102 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 31:
+#line 114 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ break;
+
+ case 32:
+#line 115 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 33:
+#line 116 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 34:
+#line 117 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+ break;
+
+ case 35:
+#line 120 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ break;
+
+ case 36:
+#line 121 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 37:
+#line 122 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ break;
+
/* Line 1267 of yacc.c. */
-#line 1466 "engines/director/lingo/lingo-gr.cpp"
+#line 1567 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1676,6 +1777,6 @@ yyreturn:
}
-#line 99 "engines/director/lingo/lingo-gr.y"
+#line 126 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 40d2ddf..845b39c 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -45,12 +45,19 @@
FLOAT = 261,
VAR = 262,
STRING = 263,
- tINTO = 264,
- tTO = 265,
- tMCI = 266,
- tMCIWAIT = 267,
- tPUT = 268,
- tSET = 269
+ tFRAME = 264,
+ tGO = 265,
+ tINTO = 266,
+ tLOOP = 267,
+ tMCI = 268,
+ tMCIWAIT = 269,
+ tMOVIE = 270,
+ tNEXT = 271,
+ tOF = 272,
+ tPREVIOUS = 273,
+ tPUT = 274,
+ tSET = 275,
+ tTO = 276
};
#endif
/* Tokens. */
@@ -60,12 +67,19 @@
#define FLOAT 261
#define VAR 262
#define STRING 263
-#define tINTO 264
-#define tTO 265
-#define tMCI 266
-#define tMCIWAIT 267
-#define tPUT 268
-#define tSET 269
+#define tFRAME 264
+#define tGO 265
+#define tINTO 266
+#define tLOOP 267
+#define tMCI 268
+#define tMCIWAIT 269
+#define tMOVIE 270
+#define tNEXT 271
+#define tOF 272
+#define tPREVIOUS 273
+#define tPUT 274
+#define tSET 275
+#define tTO 276
@@ -80,7 +94,7 @@ typedef union YYSTYPE
int code;
}
/* Line 1529 of yacc.c. */
-#line 84 "engines/director/lingo/lingo-gr.hpp"
+#line 98 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 28f2051..c3459e8 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -49,10 +49,10 @@ using namespace Director;
%token<i> INT
%token<f> FLOAT
%token<s> VAR STRING
-%token tINTO tTO
-%token tMCI tMCIWAIT tPUT tSET
+%token tFRAME tGO tINTO tLOOP tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tSET tTO
%type<code> assign expr
+%type<s> gotoframe gotomovie
%right '='
%left '+' '-'
@@ -94,6 +94,33 @@ expr: INT { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT3
func: tMCI STRING { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString($2->c_str()); delete $2; }
| tMCIWAIT VAR { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
+ | tGO tLOOP { g_lingo->code1(g_lingo->func_gotoloop); }
+ | tGO tNEXT { g_lingo->code1(g_lingo->func_gotonext); }
+ | tGO tPREVIOUS { g_lingo->code1(g_lingo->func_gotoprevious); }
+ | tGO gotoframe { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString($2->c_str()); g_lingo->codeString(""); delete $2; }
+ | tGO gotoframe gotomovie { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString($2->c_str()); g_lingo->codeString($3->c_str()); delete $2; delete $3; }
+ | tGO gotomovie { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString($2->c_str()); delete $2; }
;
+// go {to} {frame} whichFrame {of movie whichMovie}
+// go {to} {frame "Open23" of} movie whichMovie
+// go loop
+// go next
+// go previous
+// go to {frame} whichFrame {of movie whichMovie}
+// go to {frame whichFrame of} movie whichMovie
+
+
+gotoframe: tTO tFRAME STRING { $$ = $3; }
+ | tFRAME STRING { $$ = $2; }
+ | tTO STRING { $$ = $2; }
+ | STRING { $$ = $1; }
+ ;
+
+gotomovie: tOF tMOVIE STRING { $$ = $3; }
+ | tMOVIE STRING { $$ = $2; }
+ | tTO tMOVIE STRING { $$ = $3; }
+ ;
+
+
%%
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 6e292dc..8383d0c 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 16
-#define YY_END_OF_BUFFER 17
+#define YY_NUM_RULES 23
+#define YY_END_OF_BUFFER 24
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,13 +373,16 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[44] =
+static yyconst flex_int16_t yy_accept[72] =
{ 0,
- 0, 0, 17, 16, 3, 14, 16, 13, 13, 12,
- 10, 10, 10, 10, 10, 10, 2, 2, 3, 14,
- 0, 15, 1, 11, 12, 10, 10, 10, 10, 10,
- 9, 1, 11, 10, 5, 7, 8, 4, 10, 10,
- 10, 6, 0
+ 0, 0, 24, 23, 3, 21, 23, 20, 20, 19,
+ 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ 17, 2, 2, 3, 21, 0, 22, 1, 18, 19,
+ 17, 17, 5, 17, 17, 17, 17, 17, 12, 17,
+ 17, 17, 16, 1, 18, 17, 17, 17, 8, 17,
+ 17, 17, 14, 15, 17, 6, 7, 17, 17, 11,
+ 17, 4, 17, 10, 17, 17, 17, 9, 17, 13,
+ 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -395,8 +398,8 @@ static yyconst flex_int32_t yy_ec[256] =
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
1, 1, 1, 7, 11, 1, 12, 11, 13, 11,
- 14, 11, 11, 11, 15, 11, 11, 11, 16, 17,
- 18, 19, 11, 11, 20, 21, 22, 11, 23, 11,
+ 14, 15, 16, 11, 17, 11, 11, 18, 19, 20,
+ 21, 22, 11, 23, 24, 25, 26, 27, 28, 29,
11, 11, 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,
@@ -414,55 +417,71 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[24] =
+static yyconst flex_int32_t yy_meta[30] =
{ 0,
1, 1, 2, 3, 1, 1, 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
} ;
-static yyconst flex_int16_t yy_base[47] =
+static yyconst flex_int16_t yy_base[75] =
{ 0,
- 0, 22, 62, 63, 59, 22, 54, 63, 51, 19,
- 0, 41, 44, 34, 41, 36, 51, 63, 50, 27,
- 45, 63, 0, 40, 23, 0, 28, 33, 26, 25,
- 0, 0, 35, 26, 20, 0, 0, 0, 30, 25,
- 18, 0, 63, 33, 31, 37
+ 0, 28, 91, 92, 88, 28, 83, 92, 80, 25,
+ 0, 64, 65, 65, 63, 23, 69, 67, 14, 67,
+ 59, 77, 92, 76, 35, 71, 92, 0, 66, 32,
+ 0, 63, 0, 49, 52, 55, 44, 41, 0, 55,
+ 43, 42, 0, 0, 56, 46, 43, 41, 34, 44,
+ 35, 32, 0, 0, 44, 0, 0, 45, 42, 0,
+ 38, 0, 37, 0, 32, 26, 24, 0, 22, 0,
+ 92, 44, 39, 48
} ;
-static yyconst flex_int16_t yy_def[47] =
+static yyconst flex_int16_t yy_def[75] =
{ 0,
- 43, 1, 43, 43, 43, 43, 44, 43, 43, 43,
- 45, 45, 45, 45, 45, 45, 43, 43, 43, 43,
- 44, 43, 46, 43, 43, 45, 45, 45, 45, 45,
- 45, 46, 43, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 0, 43, 43, 43
+ 71, 1, 71, 71, 71, 71, 72, 71, 71, 71,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 73, 71, 71, 71, 71, 72, 71, 74, 71, 71,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 73, 73, 73, 74, 71, 73, 73, 73, 73, 73,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 0, 71, 71, 71
} ;
-static yyconst flex_int16_t yy_nxt[87] =
+static yyconst flex_int16_t yy_nxt[122] =
{ 0,
4, 5, 6, 6, 4, 7, 8, 9, 4, 10,
- 11, 11, 11, 11, 12, 13, 11, 11, 14, 15,
- 16, 11, 11, 17, 20, 20, 18, 24, 25, 20,
- 20, 24, 25, 21, 26, 21, 21, 32, 42, 41,
- 32, 40, 39, 38, 33, 37, 36, 35, 34, 33,
- 22, 19, 19, 31, 30, 29, 28, 27, 23, 22,
- 19, 43, 3, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43
+ 11, 11, 11, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 11, 20, 21, 11, 11, 11, 11, 22,
+ 25, 25, 23, 29, 30, 36, 40, 25, 25, 41,
+ 29, 30, 31, 37, 26, 70, 26, 26, 44, 69,
+ 68, 44, 67, 66, 65, 64, 63, 62, 61, 60,
+ 59, 58, 57, 56, 55, 45, 54, 53, 52, 51,
+ 50, 49, 48, 47, 46, 45, 27, 24, 24, 43,
+ 42, 39, 38, 35, 34, 33, 32, 28, 27, 24,
+ 71, 3, 71, 71, 71, 71, 71, 71, 71, 71,
+
+ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+ 71
} ;
-static yyconst flex_int16_t yy_chk[87] =
+static yyconst flex_int16_t yy_chk[122] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 2, 6, 6, 2, 10, 10, 20,
- 20, 25, 25, 44, 45, 44, 44, 46, 41, 40,
- 46, 39, 35, 34, 33, 30, 29, 28, 27, 24,
- 21, 19, 17, 16, 15, 14, 13, 12, 9, 7,
- 5, 3, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 6, 6, 2, 10, 10, 16, 19, 25, 25, 19,
+ 30, 30, 73, 16, 72, 69, 72, 72, 74, 67,
+ 66, 74, 65, 63, 61, 59, 58, 55, 52, 51,
+ 50, 49, 48, 47, 46, 45, 42, 41, 40, 38,
+ 37, 36, 35, 34, 32, 29, 26, 24, 22, 21,
+ 20, 18, 17, 15, 14, 13, 12, 9, 7, 5,
+ 3, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+
+ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+ 71
} ;
static yy_state_type yy_last_accepting_state;
@@ -512,7 +531,7 @@ char *yytext;
int yyparse();
-#line 516 "engines/director/lingo/lingo-lex.cpp"
+#line 535 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -700,7 +719,7 @@ YY_DECL
#line 45 "engines/director/lingo/lingo-lex.l"
-#line 704 "engines/director/lingo/lingo-lex.cpp"
+#line 723 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -754,13 +773,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 >= 44 )
+ if ( yy_current_state >= 72 )
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] != 63 );
+ while ( yy_base[yy_current_state] != 92 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -801,71 +820,106 @@ YY_RULE_SETUP
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 50 "engines/director/lingo/lingo-lex.l"
-{ return tINTO; }
+#line 51 "engines/director/lingo/lingo-lex.l"
+{ return tFRAME; }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 51 "engines/director/lingo/lingo-lex.l"
-{ return tMCI; }
+#line 52 "engines/director/lingo/lingo-lex.l"
+{ return tGO; }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 52 "engines/director/lingo/lingo-lex.l"
-{ return tMCIWAIT; }
+#line 53 "engines/director/lingo/lingo-lex.l"
+{ return tINTO; }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 53 "engines/director/lingo/lingo-lex.l"
-{ return tPUT; }
+#line 54 "engines/director/lingo/lingo-lex.l"
+{ return tLOOP; }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 54 "engines/director/lingo/lingo-lex.l"
-{ return tSET; }
+#line 55 "engines/director/lingo/lingo-lex.l"
+{ return tMCI; }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 55 "engines/director/lingo/lingo-lex.l"
-{ return tTO; }
+#line 56 "engines/director/lingo/lingo-lex.l"
+{ return tMCIWAIT; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 57 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+{ return tMOVIE; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 58 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+{ return tNEXT; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 59 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ return tOF; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 60 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ return tPREVIOUS; }
YY_BREAK
case 14:
-/* rule 14 can match eol */
YY_RULE_SETUP
#line 61 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ return tPUT; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 62 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return tSET; }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 64 "engines/director/lingo/lingo-lex.l"
+#line 63 "engines/director/lingo/lingo-lex.l"
+{ return tTO; }
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 65 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(yytext); return VAR; }
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 66 "engines/director/lingo/lingo-lex.l"
+{ yylval.f = atof(yytext); return FLOAT; }
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 67 "engines/director/lingo/lingo-lex.l"
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+ YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 68 "engines/director/lingo/lingo-lex.l"
+{ return *yytext; }
+ YY_BREAK
+case 21:
+/* rule 21 can match eol */
+YY_RULE_SETUP
+#line 69 "engines/director/lingo/lingo-lex.l"
+{ return '\n'; }
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 70 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 72 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 869 "engines/director/lingo/lingo-lex.cpp"
+#line 923 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1158,7 +1212,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 >= 44 )
+ if ( yy_current_state >= 72 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1186,11 +1240,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 >= 44 )
+ if ( yy_current_state >= 72 )
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 == 43);
+ yy_is_jam = (yy_current_state == 71);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1865,7 +1919,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 64 "engines/director/lingo/lingo-lex.l"
+#line 72 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 2e21c7e..5823a36 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -47,9 +47,17 @@ whitespace [\t ]
--[^\r\n]*
^{whitespace}
[\t]+ { return ' '; }
+
+frame { return tFRAME; }
+go { return tGO; }
into { return tINTO; }
+loop { return tLOOP; }
mci { return tMCI; }
mciwait { return tMCIWAIT; }
+movie { return tMOVIE; }
+next { return tNEXT; }
+of { return tOF; }
+previous { return tPREVIOUS; }
put { return tPUT; }
set { return tSET; }
to { return tTO; }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 676f257..5341aff 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -132,8 +132,14 @@ public:
static void func_eval();
static void func_mci();
static void func_mciwait();
- int exec_mci(Common::String *s);
- void exec_mciwait(Common::String *s);
+ static void func_goto();
+ static void func_gotoloop();
+ static void func_gotonext();
+ static void func_gotoprevious();
+
+ void exec_mci(Common::String &s);
+ void exec_mciwait(Common::String &s);
+ void exec_goto(Common::String &frame, Common::String &movie);
private:
int parse(const char *code);
Commit: d5587eb45dc1a5fc6036f1ccb617f00dfff7a0a6
https://github.com/scummvm/scummvm/commit/d5587eb45dc1a5fc6036f1ccb617f00dfff7a0a6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Rearrange 'go to' grammar for better readability
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 953d2b5..00f9574 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -383,18 +383,18 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 34
+#define YYFINAL 35
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 77
+#define YYLAST 71
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 31
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 9
+#define YYNNTS 10
/* YYNRULES -- Number of rules. */
-#define YYNRULES 37
+#define YYNRULES 38
/* YYNRULES -- Number of states. */
-#define YYNSTATES 63
+#define YYNSTATES 64
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -443,8 +443,8 @@ static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
19, 24, 29, 34, 36, 38, 40, 44, 48, 52,
- 56, 59, 62, 66, 69, 72, 75, 78, 81, 84,
- 88, 91, 95, 98, 101, 103, 107, 110
+ 56, 59, 62, 66, 69, 72, 74, 77, 80, 83,
+ 86, 90, 93, 97, 100, 103, 105, 109, 112
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -457,11 +457,11 @@ static const yytype_int8 yyrhs[] =
36, 23, 36, -1, 36, 24, 36, -1, 36, 25,
36, -1, 36, 26, 36, -1, 23, 36, -1, 24,
36, -1, 29, 36, 30, -1, 13, 8, -1, 14,
- 7, -1, 10, 12, -1, 10, 16, -1, 10, 18,
- -1, 10, 38, -1, 10, 38, 39, -1, 10, 39,
- -1, 21, 9, 8, -1, 9, 8, -1, 21, 8,
- -1, 8, -1, 17, 15, 8, -1, 15, 8, -1,
- 21, 15, 8, -1
+ 7, -1, 38, -1, 10, 12, -1, 10, 16, -1,
+ 10, 18, -1, 10, 39, -1, 10, 39, 40, -1,
+ 10, 40, -1, 21, 9, 8, -1, 9, 8, -1,
+ 21, 8, -1, 8, -1, 17, 15, 8, -1, 15,
+ 8, -1, 21, 15, 8, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -469,8 +469,8 @@ static const yytype_uint8 yyrline[] =
{
0, 64, 64, 65, 68, 69, 70, 71, 72, 73,
76, 77, 78, 81, 84, 85, 86, 87, 88, 89,
- 90, 91, 92, 95, 96, 97, 98, 99, 100, 101,
- 102, 114, 115, 116, 117, 120, 121, 122
+ 90, 91, 92, 95, 96, 97, 108, 109, 110, 111,
+ 112, 113, 116, 117, 118, 119, 122, 123, 124
};
#endif
@@ -484,7 +484,7 @@ static const char *const yytname[] =
"tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tSET", "tTO", "'='",
"'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "$accept",
"program", "programline", "assign", "statement", "expr", "func",
- "gotoframe", "gotomovie", 0
+ "gotofunc", "gotoframe", "gotomovie", 0
};
#endif
@@ -505,8 +505,8 @@ static const yytype_uint8 yyr1[] =
{
0, 31, 32, 32, 33, 33, 33, 33, 33, 33,
34, 34, 34, 35, 36, 36, 36, 36, 36, 36,
- 36, 36, 36, 37, 37, 37, 37, 37, 37, 37,
- 37, 38, 38, 38, 38, 39, 39, 39
+ 36, 36, 36, 37, 37, 37, 38, 38, 38, 38,
+ 38, 38, 39, 39, 39, 39, 40, 40, 40
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -514,8 +514,8 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 0,
4, 4, 4, 1, 1, 1, 3, 3, 3, 3,
- 2, 2, 3, 2, 2, 2, 2, 2, 2, 3,
- 2, 3, 2, 2, 1, 3, 2, 3
+ 2, 2, 3, 2, 2, 1, 2, 2, 2, 2,
+ 3, 2, 3, 2, 2, 1, 3, 2, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -524,38 +524,38 @@ static const yytype_uint8 yyr2[] =
static const yytype_uint8 yydefact[] =
{
4, 14, 15, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 3, 6, 7, 8, 5, 34, 0, 25,
- 0, 26, 0, 27, 0, 28, 30, 23, 24, 0,
- 0, 20, 21, 0, 1, 4, 0, 0, 0, 0,
- 32, 36, 0, 33, 0, 0, 0, 29, 0, 0,
- 0, 22, 2, 16, 17, 18, 19, 35, 31, 37,
- 10, 12, 11
+ 0, 0, 3, 6, 7, 8, 5, 25, 35, 0,
+ 26, 0, 27, 0, 28, 0, 29, 31, 23, 24,
+ 0, 0, 20, 21, 0, 1, 4, 0, 0, 0,
+ 0, 33, 37, 0, 34, 0, 0, 0, 30, 0,
+ 0, 0, 22, 2, 16, 17, 18, 19, 36, 32,
+ 38, 10, 12, 11
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 11, 12, 13, 14, 15, 16, 25, 26
+ -1, 11, 12, 13, 14, 15, 16, 17, 26, 27
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -18
+#define YYPACT_NINF -10
static const yytype_int8 yypact[] =
{
- 0, -18, -18, 44, -7, 2, 11, 8, 11, 11,
- 11, 17, -17, -18, -18, 51, -18, -18, 19, -18,
- 31, -18, 26, -18, 13, -9, -18, -18, -18, 25,
- 4, -18, -18, 43, -18, 0, 11, 11, 11, 11,
- -18, -18, 34, -18, 37, 38, 32, -18, 47, 11,
- 11, -18, -18, 12, 12, -18, -18, -18, -18, -18,
- -18, 51, 51
+ 0, -10, -10, 41, -7, 2, 23, 4, 23, 23,
+ 23, 21, 13, -10, -10, 40, -10, -10, -10, 35,
+ -10, 43, -10, 33, -10, 27, -9, -10, -10, -10,
+ 14, 5, -10, -10, -8, -10, 0, 23, 23, 23,
+ 23, -10, -10, 52, -10, 53, 59, 54, -10, 61,
+ 23, 23, -10, -10, 29, 29, -10, -10, -10, -10,
+ -10, -10, 40, 40
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -18, 20, -18, -18, -18, -6, -18, -18, 33
+ -10, 34, -10, -10, -10, -6, -10, -10, -10, 45
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -565,26 +565,26 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
- 29, 27, 31, 32, 33, 1, 20, 2, 22, 28,
- 3, 35, 46, 4, 5, 30, 1, 34, 2, 6,
- 7, 43, 44, 8, 9, 49, 50, 40, 45, 10,
- 53, 54, 55, 56, 8, 9, 48, 38, 39, 41,
- 10, 42, 57, 61, 62, 58, 59, 45, 36, 37,
- 38, 39, 17, 18, 60, 52, 19, 0, 47, 20,
- 21, 22, 23, 0, 0, 24, 36, 37, 38, 39,
- 0, 0, 0, 51, 36, 37, 38, 39
+ 30, 28, 32, 33, 34, 1, 21, 2, 23, 29,
+ 3, 31, 47, 4, 5, 37, 38, 39, 40, 6,
+ 7, 35, 52, 8, 9, 49, 50, 51, 1, 10,
+ 2, 54, 55, 56, 57, 44, 45, 37, 38, 39,
+ 40, 36, 46, 41, 62, 63, 8, 9, 43, 18,
+ 19, 42, 10, 20, 39, 40, 21, 22, 23, 24,
+ 58, 59, 25, 37, 38, 39, 40, 60, 61, 46,
+ 53, 48
};
-static const yytype_int8 yycheck[] =
+static const yytype_uint8 yycheck[] =
{
6, 8, 8, 9, 10, 5, 15, 7, 17, 7,
- 10, 28, 21, 13, 14, 7, 5, 0, 7, 19,
- 20, 8, 9, 23, 24, 21, 22, 8, 15, 29,
- 36, 37, 38, 39, 23, 24, 11, 25, 26, 8,
- 29, 15, 8, 49, 50, 8, 8, 15, 23, 24,
- 25, 26, 8, 9, 7, 35, 12, -1, 25, 15,
- 16, 17, 18, -1, -1, 21, 23, 24, 25, 26,
- -1, -1, -1, 30, 23, 24, 25, 26
+ 10, 7, 21, 13, 14, 23, 24, 25, 26, 19,
+ 20, 0, 30, 23, 24, 11, 21, 22, 5, 29,
+ 7, 37, 38, 39, 40, 8, 9, 23, 24, 25,
+ 26, 28, 15, 8, 50, 51, 23, 24, 15, 8,
+ 9, 8, 29, 12, 25, 26, 15, 16, 17, 18,
+ 8, 8, 21, 23, 24, 25, 26, 8, 7, 15,
+ 36, 26
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -592,12 +592,12 @@ static const yytype_int8 yycheck[] =
static const yytype_uint8 yystos[] =
{
0, 5, 7, 10, 13, 14, 19, 20, 23, 24,
- 29, 32, 33, 34, 35, 36, 37, 8, 9, 12,
- 15, 16, 17, 18, 21, 38, 39, 8, 7, 36,
- 7, 36, 36, 36, 0, 28, 23, 24, 25, 26,
- 8, 8, 15, 8, 9, 15, 21, 39, 11, 21,
- 22, 30, 32, 36, 36, 36, 36, 8, 8, 8,
- 7, 36, 36
+ 29, 32, 33, 34, 35, 36, 37, 38, 8, 9,
+ 12, 15, 16, 17, 18, 21, 39, 40, 8, 7,
+ 36, 7, 36, 36, 36, 0, 28, 23, 24, 25,
+ 26, 8, 8, 15, 8, 9, 15, 21, 40, 11,
+ 21, 22, 30, 32, 36, 36, 36, 36, 8, 8,
+ 8, 7, 36, 36
};
#define yyerrok (yyerrstatus = 0)
@@ -1496,68 +1496,68 @@ yyreduce:
{ g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 25:
-#line 97 "engines/director/lingo/lingo-gr.y"
+ case 26:
+#line 108 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_gotoloop); ;}
break;
- case 26:
-#line 98 "engines/director/lingo/lingo-gr.y"
+ case 27:
+#line 109 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_gotonext); ;}
break;
- case 27:
-#line 99 "engines/director/lingo/lingo-gr.y"
+ case 28:
+#line 110 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_gotoprevious); ;}
break;
- case 28:
-#line 100 "engines/director/lingo/lingo-gr.y"
+ case 29:
+#line 111 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 29:
-#line 101 "engines/director/lingo/lingo-gr.y"
+ case 30:
+#line 112 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
break;
- case 30:
-#line 102 "engines/director/lingo/lingo-gr.y"
+ case 31:
+#line 113 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 31:
-#line 114 "engines/director/lingo/lingo-gr.y"
+ case 32:
+#line 116 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 32:
-#line 115 "engines/director/lingo/lingo-gr.y"
+ case 33:
+#line 117 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 33:
-#line 116 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 118 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 34:
-#line 117 "engines/director/lingo/lingo-gr.y"
+ case 35:
+#line 119 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 35:
-#line 120 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 122 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 36:
-#line 121 "engines/director/lingo/lingo-gr.y"
+ case 37:
+#line 123 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 37:
-#line 122 "engines/director/lingo/lingo-gr.y"
+ case 38:
+#line 124 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
@@ -1777,6 +1777,6 @@ yyreturn:
}
-#line 126 "engines/director/lingo/lingo-gr.y"
+#line 128 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index c3459e8..1a6a23b 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -94,12 +94,7 @@ expr: INT { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT3
func: tMCI STRING { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString($2->c_str()); delete $2; }
| tMCIWAIT VAR { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
- | tGO tLOOP { g_lingo->code1(g_lingo->func_gotoloop); }
- | tGO tNEXT { g_lingo->code1(g_lingo->func_gotonext); }
- | tGO tPREVIOUS { g_lingo->code1(g_lingo->func_gotoprevious); }
- | tGO gotoframe { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString($2->c_str()); g_lingo->codeString(""); delete $2; }
- | tGO gotoframe gotomovie { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString($2->c_str()); g_lingo->codeString($3->c_str()); delete $2; delete $3; }
- | tGO gotomovie { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString($2->c_str()); delete $2; }
+ | gotofunc
;
// go {to} {frame} whichFrame {of movie whichMovie}
@@ -110,6 +105,13 @@ func: tMCI STRING { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString($2-
// go to {frame} whichFrame {of movie whichMovie}
// go to {frame whichFrame of} movie whichMovie
+gotofunc: tGO tLOOP { g_lingo->code1(g_lingo->func_gotoloop); }
+ | tGO tNEXT { g_lingo->code1(g_lingo->func_gotonext); }
+ | tGO tPREVIOUS { g_lingo->code1(g_lingo->func_gotoprevious); }
+ | tGO gotoframe { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString($2->c_str()); g_lingo->codeString(""); delete $2; }
+ | tGO gotoframe gotomovie { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString($2->c_str()); g_lingo->codeString($3->c_str()); delete $2; delete $3; }
+ | tGO gotomovie { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString($2->c_str()); delete $2; }
+ ;
gotoframe: tTO tFRAME STRING { $$ = $3; }
| tFRAME STRING { $$ = $2; }
Commit: cd7a6abe7844b615737d84d8027a4bccd39be91c
https://github.com/scummvm/scummvm/commit/cd7a6abe7844b615737d84d8027a4bccd39be91c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Attempt to start basic error recovery implementation
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 00f9574..a3e8cb5 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -383,18 +383,18 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 35
+#define YYFINAL 36
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 71
+#define YYLAST 75
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 31
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 10
/* YYNRULES -- Number of rules. */
-#define YYNRULES 38
+#define YYNRULES 39
/* YYNRULES -- Number of states. */
-#define YYNSTATES 64
+#define YYNSTATES 65
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -442,35 +442,35 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
- 19, 24, 29, 34, 36, 38, 40, 44, 48, 52,
- 56, 59, 62, 66, 69, 72, 74, 77, 80, 83,
- 86, 90, 93, 97, 100, 103, 105, 109, 112
+ 20, 21, 26, 31, 36, 38, 40, 42, 46, 50,
+ 54, 58, 61, 64, 68, 71, 74, 76, 79, 82,
+ 85, 88, 92, 95, 99, 102, 105, 107, 111, 114
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
32, 0, -1, 33, 28, 32, -1, 33, -1, -1,
- 37, -1, 34, -1, 35, -1, 36, -1, -1, 19,
- 36, 11, 7, -1, 20, 7, 22, 36, -1, 20,
- 7, 21, 36, -1, 36, -1, 5, -1, 7, -1,
- 36, 23, 36, -1, 36, 24, 36, -1, 36, 25,
- 36, -1, 36, 26, 36, -1, 23, 36, -1, 24,
- 36, -1, 29, 36, 30, -1, 13, 8, -1, 14,
- 7, -1, 38, -1, 10, 12, -1, 10, 16, -1,
- 10, 18, -1, 10, 39, -1, 10, 39, 40, -1,
- 10, 40, -1, 21, 9, 8, -1, 9, 8, -1,
- 21, 8, -1, 8, -1, 17, 15, 8, -1, 15,
- 8, -1, 21, 15, 8, -1
+ 37, -1, 34, -1, 35, -1, 36, -1, 1, -1,
+ -1, 19, 36, 11, 7, -1, 20, 7, 22, 36,
+ -1, 20, 7, 21, 36, -1, 36, -1, 5, -1,
+ 7, -1, 36, 23, 36, -1, 36, 24, 36, -1,
+ 36, 25, 36, -1, 36, 26, 36, -1, 23, 36,
+ -1, 24, 36, -1, 29, 36, 30, -1, 13, 8,
+ -1, 14, 7, -1, 38, -1, 10, 12, -1, 10,
+ 16, -1, 10, 18, -1, 10, 39, -1, 10, 39,
+ 40, -1, 10, 40, -1, 21, 9, 8, -1, 9,
+ 8, -1, 21, 8, -1, 8, -1, 17, 15, 8,
+ -1, 15, 8, -1, 21, 15, 8, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
0, 64, 64, 65, 68, 69, 70, 71, 72, 73,
- 76, 77, 78, 81, 84, 85, 86, 87, 88, 89,
- 90, 91, 92, 95, 96, 97, 108, 109, 110, 111,
- 112, 113, 116, 117, 118, 119, 122, 123, 124
+ 74, 77, 78, 79, 82, 85, 86, 87, 88, 89,
+ 90, 91, 92, 93, 96, 97, 98, 109, 110, 111,
+ 112, 113, 114, 117, 118, 119, 120, 123, 124, 125
};
#endif
@@ -504,18 +504,18 @@ static const yytype_uint16 yytoknum[] =
static const yytype_uint8 yyr1[] =
{
0, 31, 32, 32, 33, 33, 33, 33, 33, 33,
- 34, 34, 34, 35, 36, 36, 36, 36, 36, 36,
- 36, 36, 36, 37, 37, 37, 38, 38, 38, 38,
- 38, 38, 39, 39, 39, 39, 40, 40, 40
+ 33, 34, 34, 34, 35, 36, 36, 36, 36, 36,
+ 36, 36, 36, 36, 37, 37, 37, 38, 38, 38,
+ 38, 38, 38, 39, 39, 39, 39, 40, 40, 40
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
- 0, 2, 3, 1, 0, 1, 1, 1, 1, 0,
- 4, 4, 4, 1, 1, 1, 3, 3, 3, 3,
- 2, 2, 3, 2, 2, 1, 2, 2, 2, 2,
- 3, 2, 3, 2, 2, 1, 3, 2, 3
+ 0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
+ 0, 4, 4, 4, 1, 1, 1, 3, 3, 3,
+ 3, 2, 2, 3, 2, 2, 1, 2, 2, 2,
+ 2, 3, 2, 3, 2, 2, 1, 3, 2, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -523,81 +523,81 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 4, 14, 15, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 3, 6, 7, 8, 5, 25, 35, 0,
- 26, 0, 27, 0, 28, 0, 29, 31, 23, 24,
- 0, 0, 20, 21, 0, 1, 4, 0, 0, 0,
- 0, 33, 37, 0, 34, 0, 0, 0, 30, 0,
- 0, 0, 22, 2, 16, 17, 18, 19, 36, 32,
- 38, 10, 12, 11
+ 0, 9, 15, 16, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 3, 6, 7, 8, 5, 26, 36,
+ 0, 27, 0, 28, 0, 29, 0, 30, 32, 24,
+ 25, 0, 0, 21, 22, 0, 1, 0, 0, 0,
+ 0, 0, 34, 38, 0, 35, 0, 0, 0, 31,
+ 0, 0, 0, 23, 2, 17, 18, 19, 20, 37,
+ 33, 39, 11, 13, 12
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 11, 12, 13, 14, 15, 16, 17, 26, 27
+ -1, 12, 13, 14, 15, 16, 17, 18, 27, 28
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -10
+#define YYPACT_NINF -11
static const yytype_int8 yypact[] =
{
- 0, -10, -10, 41, -7, 2, 23, 4, 23, 23,
- 23, 21, 13, -10, -10, 40, -10, -10, -10, 35,
- -10, 43, -10, 33, -10, 27, -9, -10, -10, -10,
- 14, 5, -10, -10, -8, -10, 0, 23, 23, 23,
- 23, -10, -10, 52, -10, 53, 59, 54, -10, 61,
- 23, 23, -10, -10, 29, 29, -10, -10, -10, -10,
- -10, -10, 40, 40
+ 36, -11, -11, -11, 54, 1, 15, 0, 21, 0,
+ 0, 0, 30, 7, -11, -11, 28, -11, -11, -11,
+ 32, -11, 34, -11, 33, -11, 2, -9, -11, -11,
+ -11, -10, 5, -11, -11, -5, -11, 36, 0, 0,
+ 0, 0, -11, -11, 39, -11, 49, 50, 46, -11,
+ 60, 0, 0, -11, -11, 13, 13, -11, -11, -11,
+ -11, -11, -11, 28, 28
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -10, 34, -10, -10, -10, -6, -10, -10, -10, 45
+ -11, 31, -11, -11, -11, -7, -11, -11, -11, 47
};
/* 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 -1
-static const yytype_uint8 yytable[] =
+#define YYTABLE_NINF -5
+static const yytype_int8 yytable[] =
{
- 30, 28, 32, 33, 34, 1, 21, 2, 23, 29,
- 3, 31, 47, 4, 5, 37, 38, 39, 40, 6,
- 7, 35, 52, 8, 9, 49, 50, 51, 1, 10,
- 2, 54, 55, 56, 57, 44, 45, 37, 38, 39,
- 40, 36, 46, 41, 62, 63, 8, 9, 43, 18,
- 19, 42, 10, 20, 39, 40, 21, 22, 23, 24,
- 58, 59, 25, 37, 38, 39, 40, 60, 61, 46,
- 53, 48
+ 31, 50, 33, 34, 35, 2, 22, 3, 24, 29,
+ 45, 46, 48, 38, 39, 40, 41, 47, 38, 39,
+ 40, 41, 30, 9, 10, 53, 51, 52, 32, 11,
+ 36, 55, 56, 57, 58, 37, -4, 1, 40, 41,
+ 42, 2, 43, 3, 63, 64, 4, 59, 44, 5,
+ 6, 38, 39, 40, 41, 7, 8, 60, 61, 9,
+ 10, 47, 19, 20, -4, 11, 21, 62, 54, 22,
+ 23, 24, 25, 0, 49, 26
};
-static const yytype_uint8 yycheck[] =
+static const yytype_int8 yycheck[] =
{
- 6, 8, 8, 9, 10, 5, 15, 7, 17, 7,
- 10, 7, 21, 13, 14, 23, 24, 25, 26, 19,
- 20, 0, 30, 23, 24, 11, 21, 22, 5, 29,
- 7, 37, 38, 39, 40, 8, 9, 23, 24, 25,
- 26, 28, 15, 8, 50, 51, 23, 24, 15, 8,
- 9, 8, 29, 12, 25, 26, 15, 16, 17, 18,
- 8, 8, 21, 23, 24, 25, 26, 8, 7, 15,
- 36, 26
+ 7, 11, 9, 10, 11, 5, 15, 7, 17, 8,
+ 8, 9, 21, 23, 24, 25, 26, 15, 23, 24,
+ 25, 26, 7, 23, 24, 30, 21, 22, 7, 29,
+ 0, 38, 39, 40, 41, 28, 0, 1, 25, 26,
+ 8, 5, 8, 7, 51, 52, 10, 8, 15, 13,
+ 14, 23, 24, 25, 26, 19, 20, 8, 8, 23,
+ 24, 15, 8, 9, 28, 29, 12, 7, 37, 15,
+ 16, 17, 18, -1, 27, 21
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 5, 7, 10, 13, 14, 19, 20, 23, 24,
- 29, 32, 33, 34, 35, 36, 37, 38, 8, 9,
- 12, 15, 16, 17, 18, 21, 39, 40, 8, 7,
- 36, 7, 36, 36, 36, 0, 28, 23, 24, 25,
- 26, 8, 8, 15, 8, 9, 15, 21, 40, 11,
- 21, 22, 30, 32, 36, 36, 36, 36, 8, 8,
- 8, 7, 36, 36
+ 0, 1, 5, 7, 10, 13, 14, 19, 20, 23,
+ 24, 29, 32, 33, 34, 35, 36, 37, 38, 8,
+ 9, 12, 15, 16, 17, 18, 21, 39, 40, 8,
+ 7, 36, 7, 36, 36, 36, 0, 28, 23, 24,
+ 25, 26, 8, 8, 15, 8, 9, 15, 21, 40,
+ 11, 21, 22, 30, 32, 36, 36, 36, 36, 8,
+ 8, 8, 7, 36, 36
};
#define yyerrok (yyerrstatus = 0)
@@ -1421,14 +1421,14 @@ yyreduce:
{ g_lingo->code1(g_lingo->func_printtop); ;}
break;
- case 10:
-#line 76 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
+ case 9:
+#line 73 "engines/director/lingo/lingo-gr.y"
+ { yyerrok; ;}
break;
case 11:
#line 77 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
+ { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
break;
case 12:
@@ -1437,103 +1437,103 @@ yyreduce:
break;
case 13:
-#line 81 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_xpop); ;}
+#line 79 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 14:
-#line 84 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
+#line 82 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_xpop); ;}
break;
case 15:
#line 85 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
+ { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
break;
case 16:
#line 86 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_add); ;}
+ { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
case 17:
#line 87 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_sub); ;}
+ { g_lingo->code1(g_lingo->func_add); ;}
break;
case 18:
#line 88 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_mul); ;}
+ { g_lingo->code1(g_lingo->func_sub); ;}
break;
case 19:
#line 89 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_div); ;}
+ { g_lingo->code1(g_lingo->func_mul); ;}
break;
case 20:
#line 90 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+ { g_lingo->code1(g_lingo->func_div); ;}
break;
case 21:
#line 91 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 22:
#line 92 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
break;
case 23:
-#line 95 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+#line 93 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 24:
#line 96 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 26:
-#line 108 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_gotoloop); ;}
+ case 25:
+#line 97 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 27:
#line 109 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_gotonext); ;}
+ { g_lingo->code1(g_lingo->func_gotoloop); ;}
break;
case 28:
#line 110 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_gotoprevious); ;}
+ { g_lingo->code1(g_lingo->func_gotonext); ;}
break;
case 29:
#line 111 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
+ { g_lingo->code1(g_lingo->func_gotoprevious); ;}
break;
case 30:
#line 112 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
+ { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
break;
case 31:
#line 113 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
break;
case 32:
-#line 116 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 114 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 33:
#line 117 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 34:
@@ -1543,27 +1543,32 @@ yyreduce:
case 35:
#line 119 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 36:
-#line 122 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 120 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 37:
#line 123 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 38:
#line 124 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 39:
+#line 125 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1567 "engines/director/lingo/lingo-gr.cpp"
+#line 1572 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1777,6 +1782,6 @@ yyreturn:
}
-#line 128 "engines/director/lingo/lingo-gr.y"
+#line 129 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 1a6a23b..11cece8 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -70,6 +70,7 @@ programline:
| assign { g_lingo->code1(g_lingo->func_xpop); }
| statement
| expr { g_lingo->code1(g_lingo->func_printtop); }
+ | error { yyerrok; }
| /* empty */
;
Commit: bdbb5582aa200e79b71780c50460ab23d5bd7852
https://github.com/scummvm/scummvm/commit/bdbb5582aa200e79b71780c50460ab23d5bd7852
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Updated copyright and added 'macro' keyword documentation
Changed paths:
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index bbe8d74..cfcf46f 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -20,6 +20,29 @@
*
*/
+// Heavily inspired by hoc
+// Copyright (C) AT&T 1995
+// All Rights Reserved
+//
+// Permission to use, copy, modify, and distribute this software and
+// its documentation for any purpose and without fee is hereby
+// granted, provided that the above copyright notice appear in all
+// copies and that both that the copyright notice and this
+// permission notice and warranty disclaimer appear in supporting
+// documentation, and that the name of AT&T or any of its entities
+// not be used in advertising or publicity pertaining to
+// distribution of the software without specific, written prior
+// permission.
+//
+// AT&T DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+// INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+// IN NO EVENT SHALL AT&T OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
+// SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+// IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+// ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+// THIS SOFTWARE.
+
#include "engines/director/lingo/lingo.h"
#include "common/file.h"
#include "audio/decoders/wave.h"
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index a3e8cb5..5d3406d 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -112,7 +112,7 @@
/* Copy the first part of user declarations. */
-#line 25 "engines/director/lingo/lingo-gr.y"
+#line 49 "engines/director/lingo/lingo-gr.y"
#define FORBIDDEN_SYMBOL_ALLOW_ALL
@@ -149,7 +149,7 @@ using namespace Director;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 41 "engines/director/lingo/lingo-gr.y"
+#line 65 "engines/director/lingo/lingo-gr.y"
{
Common::String *s;
int i;
@@ -467,10 +467,10 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 64, 64, 65, 68, 69, 70, 71, 72, 73,
- 74, 77, 78, 79, 82, 85, 86, 87, 88, 89,
- 90, 91, 92, 93, 96, 97, 98, 109, 110, 111,
- 112, 113, 114, 117, 118, 119, 120, 123, 124, 125
+ 0, 88, 88, 89, 92, 93, 94, 95, 96, 97,
+ 98, 101, 102, 103, 106, 109, 110, 111, 112, 113,
+ 114, 115, 116, 117, 120, 121, 122, 133, 134, 135,
+ 136, 137, 138, 141, 142, 143, 144, 147, 148, 149
};
#endif
@@ -1412,157 +1412,157 @@ yyreduce:
switch (yyn)
{
case 6:
-#line 70 "engines/director/lingo/lingo-gr.y"
+#line 94 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_xpop); ;}
break;
case 8:
-#line 72 "engines/director/lingo/lingo-gr.y"
+#line 96 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_printtop); ;}
break;
case 9:
-#line 73 "engines/director/lingo/lingo-gr.y"
+#line 97 "engines/director/lingo/lingo-gr.y"
{ yyerrok; ;}
break;
case 11:
-#line 77 "engines/director/lingo/lingo-gr.y"
+#line 101 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
break;
case 12:
-#line 78 "engines/director/lingo/lingo-gr.y"
+#line 102 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 13:
-#line 79 "engines/director/lingo/lingo-gr.y"
+#line 103 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 14:
-#line 82 "engines/director/lingo/lingo-gr.y"
+#line 106 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_xpop); ;}
break;
case 15:
-#line 85 "engines/director/lingo/lingo-gr.y"
+#line 109 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
break;
case 16:
-#line 86 "engines/director/lingo/lingo-gr.y"
+#line 110 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
case 17:
-#line 87 "engines/director/lingo/lingo-gr.y"
+#line 111 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_add); ;}
break;
case 18:
-#line 88 "engines/director/lingo/lingo-gr.y"
+#line 112 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_sub); ;}
break;
case 19:
-#line 89 "engines/director/lingo/lingo-gr.y"
+#line 113 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mul); ;}
break;
case 20:
-#line 90 "engines/director/lingo/lingo-gr.y"
+#line 114 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_div); ;}
break;
case 21:
-#line 91 "engines/director/lingo/lingo-gr.y"
+#line 115 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 22:
-#line 92 "engines/director/lingo/lingo-gr.y"
+#line 116 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
break;
case 23:
-#line 93 "engines/director/lingo/lingo-gr.y"
+#line 117 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 24:
-#line 96 "engines/director/lingo/lingo-gr.y"
+#line 120 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 25:
-#line 97 "engines/director/lingo/lingo-gr.y"
+#line 121 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 27:
-#line 109 "engines/director/lingo/lingo-gr.y"
+#line 133 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_gotoloop); ;}
break;
case 28:
-#line 110 "engines/director/lingo/lingo-gr.y"
+#line 134 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_gotonext); ;}
break;
case 29:
-#line 111 "engines/director/lingo/lingo-gr.y"
+#line 135 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_gotoprevious); ;}
break;
case 30:
-#line 112 "engines/director/lingo/lingo-gr.y"
+#line 136 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
break;
case 31:
-#line 113 "engines/director/lingo/lingo-gr.y"
+#line 137 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
break;
case 32:
-#line 114 "engines/director/lingo/lingo-gr.y"
+#line 138 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 33:
-#line 117 "engines/director/lingo/lingo-gr.y"
+#line 141 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 34:
-#line 118 "engines/director/lingo/lingo-gr.y"
+#line 142 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 35:
-#line 119 "engines/director/lingo/lingo-gr.y"
+#line 143 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 36:
-#line 120 "engines/director/lingo/lingo-gr.y"
+#line 144 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 37:
-#line 123 "engines/director/lingo/lingo-gr.y"
+#line 147 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 38:
-#line 124 "engines/director/lingo/lingo-gr.y"
+#line 148 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 39:
-#line 125 "engines/director/lingo/lingo-gr.y"
+#line 149 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
@@ -1782,6 +1782,6 @@ yyreturn:
}
-#line 129 "engines/director/lingo/lingo-gr.y"
+#line 179 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 845b39c..eb90b75 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -86,7 +86,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 41 "engines/director/lingo/lingo-gr.y"
+#line 65 "engines/director/lingo/lingo-gr.y"
{
Common::String *s;
int i;
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 11cece8..0781bf8 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -20,6 +20,30 @@
*
*/
+// Heavily inspired by hoc
+// Copyright (C) AT&T 1995
+// All Rights Reserved
+//
+// Permission to use, copy, modify, and distribute this software and
+// its documentation for any purpose and without fee is hereby
+// granted, provided that the above copyright notice appear in all
+// copies and that both that the copyright notice and this
+// permission notice and warranty disclaimer appear in supporting
+// documentation, and that the name of AT&T or any of its entities
+// not be used in advertising or publicity pertaining to
+// distribution of the software without specific, written prior
+// permission.
+//
+// AT&T DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+// INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+// IN NO EVENT SHALL AT&T OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
+// SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+// IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+// ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+// THIS SOFTWARE.
+
+
%debug
%{
@@ -125,5 +149,31 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
| tTO tMOVIE STRING { $$ = $3; }
;
+// macro
+//
+// Special Note The macro keyword is retained in Director 3.0 to maintain compatibility
+// with scripts developed under Version 2.0. When writing new scripts, or editing old
+// scripts, you should use handlers instead of macros. (Handlers are defined with the on keyword.)
+//
+// Syntax:
+//
+// -- [comment]
+// macro macroName [argument1] [, argument2]
+// [, argument3]
+// [statement1]
+// [statement2]
+//
+// Keyword. Defines a macro. A macro is a multiple-line script defined
+// in the Text window. Macros can accept arguments (inputs) and
+// optionally return a result. Macros can call other macros and can be
+// called from any other script or factory.
+//
+// The first line of a castmember in the Text window that contains a macro must be
+// a comment (--). You can define more than one macro in a given text castmember.
+// The macro definition ends where the next macro (or factory) begins.
+//
+// See also:
+// on keyword
+
%%
Commit: 908bcf2065754411f3615b5f8eb505b6154e56fb
https://github.com/scummvm/scummvm/commit/908bcf2065754411f3615b5f8eb505b6154e56fb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Initial code for 'if' statements
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 86de72d..b184716 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -81,7 +81,8 @@ go \"CARDBACK\"\n\
go movie \"BAR 1\"\n\
go to \"Open23\" of movie \"OpenCabin23\"\n\
go to \"Chair\"\n\
- ", kMovieScript, 2);
+set x = 2 + 3 * (4 / 2)\n\
+x ", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index cfcf46f..8144270 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -193,6 +193,13 @@ void Lingo::exec_goto(Common::String &frame, Common::String &movie) {
warning("STUB: go to %s movie %s", frame.c_str(), movie.c_str());
}
+void Lingo::execute(int pc) {
+ for(_pc = pc; (*_currentScript)[_pc] != STOP;) {
+ _pc++;
+ (*((*_currentScript)[_pc - 1]))();
+ }
+}
+
void Lingo::push(Datum d) {
_stack.push_back(d);
}
@@ -219,7 +226,7 @@ void Lingo::func_printtop(void) {
void Lingo::func_constpush() {
Datum d;
- inst i = *g_lingo->_pc++;
+ inst i = (*g_lingo->_currentScript)[g_lingo->_pc++];
d.val = READ_LE_UINT32(&i);
g_lingo->push(d);
}
@@ -227,7 +234,7 @@ void Lingo::func_constpush() {
void Lingo::func_varpush() {
Datum d;
Symbol *sym;
- char *name = (char *)g_lingo->_pc;
+ char *name = (char *)(*g_lingo->_currentScript)[g_lingo->_pc];
if (!g_lingo->_vars.contains(name)) { // Create variable if it was not defined
sym = new Symbol;
@@ -334,8 +341,28 @@ void Lingo::func_negate() {
g_lingo->push(d);
}
+void Lingo::func_ifcode() {
+ Datum d;
+ int savepc = g_lingo->_pc; /* then part */
+
+ g_lingo->execute(savepc + 3); /* condition */
+
+ d = g_lingo->pop();
+
+ if (d.val)
+ g_lingo->execute(savepc);
+ else if ((*g_lingo->_currentScript)[savepc + 1]) /* else part? */
+ g_lingo->execute(savepc + 1);
+
+ //if (!returning)
+ g_lingo->_pc = savepc + 2; /* next stmt */
+}
+
+//************************
+// Built-in functions
+//************************
void Lingo::func_mci() {
- Common::String s((char *)g_lingo->_pc);
+ Common::String s((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
g_lingo->exec_mci(s);
@@ -343,7 +370,7 @@ void Lingo::func_mci() {
}
void Lingo::func_mciwait() {
- Common::String s((char *)g_lingo->_pc);
+ Common::String s((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
g_lingo->exec_mciwait(s);
@@ -351,10 +378,10 @@ void Lingo::func_mciwait() {
}
void Lingo::func_goto() {
- Common::String frame((char *)g_lingo->_pc);
+ Common::String frame((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
g_lingo->_pc += g_lingo->calcStringAlignment(frame.c_str());
- Common::String movie((char *)g_lingo->_pc);
+ Common::String movie((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
g_lingo->_pc += g_lingo->calcStringAlignment(movie.c_str());
g_lingo->exec_goto(frame, movie);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 5d3406d..9f971cb 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -72,19 +72,22 @@
FLOAT = 261,
VAR = 262,
STRING = 263,
- tFRAME = 264,
- tGO = 265,
- tINTO = 266,
- tLOOP = 267,
- tMCI = 268,
- tMCIWAIT = 269,
- tMOVIE = 270,
- tNEXT = 271,
- tOF = 272,
- tPREVIOUS = 273,
- tPUT = 274,
- tSET = 275,
- tTO = 276
+ tIF = 264,
+ tEND = 265,
+ tFRAME = 266,
+ tGO = 267,
+ tINTO = 268,
+ tLOOP = 269,
+ tMCI = 270,
+ tMCIWAIT = 271,
+ tMOVIE = 272,
+ tNEXT = 273,
+ tOF = 274,
+ tPREVIOUS = 275,
+ tPUT = 276,
+ tSET = 277,
+ tTHEN = 278,
+ tTO = 279
};
#endif
/* Tokens. */
@@ -94,19 +97,22 @@
#define FLOAT 261
#define VAR 262
#define STRING 263
-#define tFRAME 264
-#define tGO 265
-#define tINTO 266
-#define tLOOP 267
-#define tMCI 268
-#define tMCIWAIT 269
-#define tMOVIE 270
-#define tNEXT 271
-#define tOF 272
-#define tPREVIOUS 273
-#define tPUT 274
-#define tSET 275
-#define tTO 276
+#define tIF 264
+#define tEND 265
+#define tFRAME 266
+#define tGO 267
+#define tINTO 268
+#define tLOOP 269
+#define tMCI 270
+#define tMCIWAIT 271
+#define tMOVIE 272
+#define tNEXT 273
+#define tOF 274
+#define tPREVIOUS 275
+#define tPUT 276
+#define tSET 277
+#define tTHEN 278
+#define tTO 279
@@ -157,7 +163,7 @@ typedef union YYSTYPE
int code;
}
/* Line 193 of yacc.c. */
-#line 161 "engines/director/lingo/lingo-gr.cpp"
+#line 167 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -170,7 +176,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 174 "engines/director/lingo/lingo-gr.cpp"
+#line 180 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -383,22 +389,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 36
+#define YYFINAL 38
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 75
+#define YYLAST 89
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 31
+#define YYNTOKENS 34
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 10
+#define YYNNTS 14
/* YYNRULES -- Number of rules. */
-#define YYNRULES 39
+#define YYNRULES 46
/* YYNRULES -- Number of states. */
-#define YYNSTATES 65
+#define YYNSTATES 77
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 276
+#define YYMAXUTOK 279
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -407,12 +413,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 28, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 31, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 27, 2, 2,
- 29, 30, 25, 23, 2, 24, 2, 26, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 30, 2, 2,
+ 32, 33, 28, 26, 2, 27, 2, 29, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 22, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 25, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -433,7 +439,7 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24
};
#if YYDEBUG
@@ -442,35 +448,39 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
- 20, 21, 26, 31, 36, 38, 40, 42, 46, 50,
- 54, 58, 61, 64, 68, 71, 74, 76, 79, 82,
- 85, 88, 92, 95, 99, 102, 105, 107, 111, 114
+ 20, 21, 26, 31, 36, 38, 46, 48, 50, 54,
+ 58, 62, 66, 69, 72, 76, 78, 80, 81, 82,
+ 85, 88, 91, 94, 96, 99, 102, 105, 108, 112,
+ 115, 119, 122, 125, 127, 131, 134
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 32, 0, -1, 33, 28, 32, -1, 33, -1, -1,
- 37, -1, 34, -1, 35, -1, 36, -1, 1, -1,
- -1, 19, 36, 11, 7, -1, 20, 7, 22, 36,
- -1, 20, 7, 21, 36, -1, 36, -1, 5, -1,
- 7, -1, 36, 23, 36, -1, 36, 24, 36, -1,
- 36, 25, 36, -1, 36, 26, 36, -1, 23, 36,
- -1, 24, 36, -1, 29, 36, 30, -1, 13, 8,
- -1, 14, 7, -1, 38, -1, 10, 12, -1, 10,
- 16, -1, 10, 18, -1, 10, 39, -1, 10, 39,
- 40, -1, 10, 40, -1, 21, 9, 8, -1, 9,
- 8, -1, 21, 8, -1, 8, -1, 17, 15, 8,
- -1, 15, 8, -1, 21, 15, 8, -1
+ 35, 0, -1, 36, 31, 35, -1, 36, -1, -1,
+ 44, -1, 37, -1, 38, -1, 39, -1, 1, -1,
+ -1, 21, 39, 13, 7, -1, 22, 7, 25, 39,
+ -1, 22, 7, 24, 39, -1, 39, -1, 41, 40,
+ 23, 43, 42, 10, 9, -1, 5, -1, 7, -1,
+ 39, 26, 39, -1, 39, 27, 39, -1, 39, 28,
+ 39, -1, 39, 29, 39, -1, 26, 39, -1, 27,
+ 39, -1, 32, 39, 33, -1, 39, -1, 9, -1,
+ -1, -1, 43, 31, -1, 43, 38, -1, 15, 8,
+ -1, 16, 7, -1, 45, -1, 12, 14, -1, 12,
+ 18, -1, 12, 20, -1, 12, 46, -1, 12, 46,
+ 47, -1, 12, 47, -1, 24, 11, 8, -1, 11,
+ 8, -1, 24, 8, -1, 8, -1, 19, 17, 8,
+ -1, 17, 8, -1, 24, 17, 8, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 88, 88, 89, 92, 93, 94, 95, 96, 97,
- 98, 101, 102, 103, 106, 109, 110, 111, 112, 113,
- 114, 115, 116, 117, 120, 121, 122, 133, 134, 135,
- 136, 137, 138, 141, 142, 143, 144, 147, 148, 149
+ 0, 89, 89, 90, 93, 94, 95, 96, 97, 98,
+ 99, 102, 103, 104, 107, 108, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 127, 129, 131, 133, 134,
+ 135, 138, 139, 140, 151, 152, 153, 154, 155, 156,
+ 159, 160, 161, 162, 165, 166, 167
};
#endif
@@ -480,11 +490,12 @@ static const yytype_uint8 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "UNARY", "UNDEF", "INT", "FLOAT", "VAR",
- "STRING", "tFRAME", "tGO", "tINTO", "tLOOP", "tMCI", "tMCIWAIT",
- "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tSET", "tTO", "'='",
- "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "$accept",
- "program", "programline", "assign", "statement", "expr", "func",
- "gotofunc", "gotoframe", "gotomovie", 0
+ "STRING", "tIF", "tEND", "tFRAME", "tGO", "tINTO", "tLOOP", "tMCI",
+ "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tSET",
+ "tTHEN", "tTO", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('",
+ "')'", "$accept", "program", "programline", "assign", "stmt", "expr",
+ "cond", "if", "end", "stmtlist", "func", "gotofunc", "gotoframe",
+ "gotomovie", 0
};
#endif
@@ -495,27 +506,29 @@ static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
- 275, 276, 61, 43, 45, 42, 47, 37, 10, 40,
- 41
+ 275, 276, 277, 278, 279, 61, 43, 45, 42, 47,
+ 37, 10, 40, 41
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 31, 32, 32, 33, 33, 33, 33, 33, 33,
- 33, 34, 34, 34, 35, 36, 36, 36, 36, 36,
- 36, 36, 36, 36, 37, 37, 37, 38, 38, 38,
- 38, 38, 38, 39, 39, 39, 39, 40, 40, 40
+ 0, 34, 35, 35, 36, 36, 36, 36, 36, 36,
+ 36, 37, 37, 37, 38, 38, 39, 39, 39, 39,
+ 39, 39, 39, 39, 39, 40, 41, 42, 43, 43,
+ 43, 44, 44, 44, 45, 45, 45, 45, 45, 45,
+ 46, 46, 46, 46, 47, 47, 47
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 0, 4, 4, 4, 1, 1, 1, 3, 3, 3,
- 3, 2, 2, 3, 2, 2, 1, 2, 2, 2,
- 2, 3, 2, 3, 2, 2, 1, 3, 2, 3
+ 0, 4, 4, 4, 1, 7, 1, 1, 3, 3,
+ 3, 3, 2, 2, 3, 1, 1, 0, 0, 2,
+ 2, 2, 2, 1, 2, 2, 2, 2, 3, 2,
+ 3, 2, 2, 1, 3, 2, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -523,39 +536,43 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 9, 15, 16, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 6, 7, 8, 5, 26, 36,
- 0, 27, 0, 28, 0, 29, 0, 30, 32, 24,
- 25, 0, 0, 21, 22, 0, 1, 0, 0, 0,
- 0, 0, 34, 38, 0, 35, 0, 0, 0, 31,
- 0, 0, 0, 23, 2, 17, 18, 19, 20, 37,
- 33, 39, 11, 13, 12
+ 0, 9, 16, 17, 26, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 6, 7, 8, 0, 5,
+ 33, 43, 0, 34, 0, 35, 0, 36, 0, 37,
+ 39, 31, 32, 0, 0, 22, 23, 0, 1, 0,
+ 0, 0, 0, 0, 25, 0, 41, 45, 0, 42,
+ 0, 0, 0, 38, 0, 0, 0, 24, 2, 18,
+ 19, 20, 21, 28, 44, 40, 46, 11, 13, 12,
+ 27, 29, 30, 14, 0, 0, 15
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 12, 13, 14, 15, 16, 17, 18, 27, 28
+ -1, 13, 14, 15, 16, 17, 45, 18, 74, 70,
+ 19, 20, 29, 30
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -11
+#define YYPACT_NINF -19
static const yytype_int8 yypact[] =
{
- 36, -11, -11, -11, 54, 1, 15, 0, 21, 0,
- 0, 0, 30, 7, -11, -11, 28, -11, -11, -11,
- 32, -11, 34, -11, 33, -11, 2, -9, -11, -11,
- -11, -10, 5, -11, -11, -5, -11, 36, 0, 0,
- 0, 0, -11, -11, 39, -11, 49, 50, 46, -11,
- 60, 0, 0, -11, -11, 13, 13, -11, -11, -11,
- -11, -11, -11, 28, 28
+ 37, -19, -19, -19, -19, 5, -7, 8, 4, 13,
+ 4, 4, 4, 12, -10, -19, -19, 60, 4, -19,
+ -19, -19, 18, -19, 19, -19, 11, -19, -3, 61,
+ -19, -19, -19, 44, -18, -19, -19, 48, -19, 37,
+ 4, 4, 4, 4, 60, 17, -19, -19, 42, -19,
+ 43, 46, 28, -19, 49, 4, 4, -19, -19, -11,
+ -11, -19, -19, -19, -19, -19, -19, -19, 60, 60,
+ 34, -19, -19, 60, 45, 58, -19
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -11, 31, -11, -11, -11, -7, -11, -11, -11, 47
+ -19, 40, -19, -19, 14, -8, -19, -19, -19, -19,
+ -19, -19, -19, 53
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -565,39 +582,42 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -5
static const yytype_int8 yytable[] =
{
- 31, 50, 33, 34, 35, 2, 22, 3, 24, 29,
- 45, 46, 48, 38, 39, 40, 41, 47, 38, 39,
- 40, 41, 30, 9, 10, 53, 51, 52, 32, 11,
- 36, 55, 56, 57, 58, 37, -4, 1, 40, 41,
- 42, 2, 43, 3, 63, 64, 4, 59, 44, 5,
- 6, 38, 39, 40, 41, 7, 8, 60, 61, 9,
- 10, 47, 19, 20, -4, 11, 21, 62, 54, 22,
- 23, 24, 25, 0, 49, 26
+ 33, 31, 35, 36, 37, 49, 55, 56, 50, 2,
+ 44, 3, 38, 21, 51, 32, 22, 42, 43, 23,
+ 34, 39, 24, 25, 26, 27, 46, 47, 48, 28,
+ 10, 11, 59, 60, 61, 62, 12, -4, 1, 2,
+ 63, 3, 2, 4, 3, 51, 4, 68, 69, 5,
+ 64, 65, 6, 7, 66, 75, 67, 54, 8, 9,
+ 10, 11, 73, 10, 11, 71, 12, 76, -4, 12,
+ 40, 41, 42, 43, 40, 41, 42, 43, 24, 58,
+ 26, 57, 53, 0, 72, 52, 40, 41, 42, 43
};
static const yytype_int8 yycheck[] =
{
- 7, 11, 9, 10, 11, 5, 15, 7, 17, 8,
- 8, 9, 21, 23, 24, 25, 26, 15, 23, 24,
- 25, 26, 7, 23, 24, 30, 21, 22, 7, 29,
- 0, 38, 39, 40, 41, 28, 0, 1, 25, 26,
- 8, 5, 8, 7, 51, 52, 10, 8, 15, 13,
- 14, 23, 24, 25, 26, 19, 20, 8, 8, 23,
- 24, 15, 8, 9, 28, 29, 12, 7, 37, 15,
- 16, 17, 18, -1, 27, 21
+ 8, 8, 10, 11, 12, 8, 24, 25, 11, 5,
+ 18, 7, 0, 8, 17, 7, 11, 28, 29, 14,
+ 7, 31, 17, 18, 19, 20, 8, 8, 17, 24,
+ 26, 27, 40, 41, 42, 43, 32, 0, 1, 5,
+ 23, 7, 5, 9, 7, 17, 9, 55, 56, 12,
+ 8, 8, 15, 16, 8, 10, 7, 13, 21, 22,
+ 26, 27, 70, 26, 27, 31, 32, 9, 31, 32,
+ 26, 27, 28, 29, 26, 27, 28, 29, 17, 39,
+ 19, 33, 29, -1, 70, 24, 26, 27, 28, 29
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 5, 7, 10, 13, 14, 19, 20, 23,
- 24, 29, 32, 33, 34, 35, 36, 37, 38, 8,
- 9, 12, 15, 16, 17, 18, 21, 39, 40, 8,
- 7, 36, 7, 36, 36, 36, 0, 28, 23, 24,
- 25, 26, 8, 8, 15, 8, 9, 15, 21, 40,
- 11, 21, 22, 30, 32, 36, 36, 36, 36, 8,
- 8, 8, 7, 36, 36
+ 0, 1, 5, 7, 9, 12, 15, 16, 21, 22,
+ 26, 27, 32, 35, 36, 37, 38, 39, 41, 44,
+ 45, 8, 11, 14, 17, 18, 19, 20, 24, 46,
+ 47, 8, 7, 39, 7, 39, 39, 39, 0, 31,
+ 26, 27, 28, 29, 39, 40, 8, 8, 17, 8,
+ 11, 17, 24, 47, 13, 24, 25, 33, 35, 39,
+ 39, 39, 39, 23, 8, 8, 8, 7, 39, 39,
+ 43, 31, 38, 39, 42, 10, 9
};
#define yyerrok (yyerrstatus = 0)
@@ -1412,163 +1432,193 @@ yyreduce:
switch (yyn)
{
case 6:
-#line 94 "engines/director/lingo/lingo-gr.y"
+#line 95 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_xpop); ;}
break;
case 8:
-#line 96 "engines/director/lingo/lingo-gr.y"
+#line 97 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_printtop); ;}
break;
case 9:
-#line 97 "engines/director/lingo/lingo-gr.y"
+#line 98 "engines/director/lingo/lingo-gr.y"
{ yyerrok; ;}
break;
case 11:
-#line 101 "engines/director/lingo/lingo-gr.y"
+#line 102 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
break;
case 12:
-#line 102 "engines/director/lingo/lingo-gr.y"
+#line 103 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 13:
-#line 103 "engines/director/lingo/lingo-gr.y"
+#line 104 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 14:
-#line 106 "engines/director/lingo/lingo-gr.y"
+#line 107 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_xpop); ;}
break;
case 15:
-#line 109 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
+#line 108 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then, end;
+ WRITE_LE_UINT32(&then, (yyvsp[(4) - (7)].code));
+ WRITE_LE_UINT32(&end, (yyvsp[(5) - (7)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; ;}
break;
case 16:
-#line 110 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
+#line 116 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
break;
case 17:
-#line 111 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_add); ;}
+#line 117 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
case 18:
-#line 112 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_sub); ;}
+#line 118 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_add); ;}
break;
case 19:
-#line 113 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_mul); ;}
+#line 119 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_sub); ;}
break;
case 20:
-#line 114 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_div); ;}
+#line 120 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_mul); ;}
break;
case 21:
-#line 115 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+#line 121 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_div); ;}
break;
case 22:
-#line 116 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
+#line 122 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 23:
-#line 117 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+#line 123 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
break;
case 24:
-#line 120 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+#line 124 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 25:
-#line 121 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+#line 127 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(STOP); ;}
+ break;
+
+ case 26:
+#line 129 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = g_lingo->code1(g_lingo->func_ifcode); g_lingo->code3(STOP,STOP,STOP); ;}
break;
case 27:
+#line 131 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
+ break;
+
+ case 28:
#line 133 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = g_lingo->_currentScript->size(); ;}
+ break;
+
+ case 31:
+#line 138 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 32:
+#line 139 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 34:
+#line 151 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_gotoloop); ;}
break;
- case 28:
-#line 134 "engines/director/lingo/lingo-gr.y"
+ case 35:
+#line 152 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_gotonext); ;}
break;
- case 29:
-#line 135 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 153 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_gotoprevious); ;}
break;
- case 30:
-#line 136 "engines/director/lingo/lingo-gr.y"
+ case 37:
+#line 154 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 31:
-#line 137 "engines/director/lingo/lingo-gr.y"
+ case 38:
+#line 155 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
break;
- case 32:
-#line 138 "engines/director/lingo/lingo-gr.y"
+ case 39:
+#line 156 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 33:
-#line 141 "engines/director/lingo/lingo-gr.y"
+ case 40:
+#line 159 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 34:
-#line 142 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 160 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 35:
-#line 143 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 161 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 36:
-#line 144 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 162 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 37:
-#line 147 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 165 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 38:
-#line 148 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 166 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 39:
-#line 149 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 167 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1572 "engines/director/lingo/lingo-gr.cpp"
+#line 1622 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1782,6 +1832,6 @@ yyreturn:
}
-#line 179 "engines/director/lingo/lingo-gr.y"
+#line 197 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index eb90b75..6261f6c 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -45,19 +45,22 @@
FLOAT = 261,
VAR = 262,
STRING = 263,
- tFRAME = 264,
- tGO = 265,
- tINTO = 266,
- tLOOP = 267,
- tMCI = 268,
- tMCIWAIT = 269,
- tMOVIE = 270,
- tNEXT = 271,
- tOF = 272,
- tPREVIOUS = 273,
- tPUT = 274,
- tSET = 275,
- tTO = 276
+ tIF = 264,
+ tEND = 265,
+ tFRAME = 266,
+ tGO = 267,
+ tINTO = 268,
+ tLOOP = 269,
+ tMCI = 270,
+ tMCIWAIT = 271,
+ tMOVIE = 272,
+ tNEXT = 273,
+ tOF = 274,
+ tPREVIOUS = 275,
+ tPUT = 276,
+ tSET = 277,
+ tTHEN = 278,
+ tTO = 279
};
#endif
/* Tokens. */
@@ -67,19 +70,22 @@
#define FLOAT 261
#define VAR 262
#define STRING 263
-#define tFRAME 264
-#define tGO 265
-#define tINTO 266
-#define tLOOP 267
-#define tMCI 268
-#define tMCIWAIT 269
-#define tMOVIE 270
-#define tNEXT 271
-#define tOF 272
-#define tPREVIOUS 273
-#define tPUT 274
-#define tSET 275
-#define tTO 276
+#define tIF 264
+#define tEND 265
+#define tFRAME 266
+#define tGO 267
+#define tINTO 268
+#define tLOOP 269
+#define tMCI 270
+#define tMCIWAIT 271
+#define tMOVIE 272
+#define tNEXT 273
+#define tOF 274
+#define tPREVIOUS 275
+#define tPUT 276
+#define tSET 277
+#define tTHEN 278
+#define tTO 279
@@ -94,7 +100,7 @@ typedef union YYSTYPE
int code;
}
/* Line 1529 of yacc.c. */
-#line 98 "engines/director/lingo/lingo-gr.hpp"
+#line 104 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 0781bf8..21f3b44 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -42,7 +42,7 @@
// IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
// ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
// THIS SOFTWARE.
-
+
%debug
@@ -73,9 +73,10 @@ using namespace Director;
%token<i> INT
%token<f> FLOAT
%token<s> VAR STRING
-%token tFRAME tGO tINTO tLOOP tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tSET tTO
+%token tIF tEND tFRAME tGO tINTO tLOOP tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS
+%token tPUT tSET tTHEN tTO
-%type<code> assign expr
+%type<code> assign cond expr if end stmtlist
%type<s> gotoframe gotomovie
%right '='
@@ -92,7 +93,7 @@ program: programline '\n' program
programline:
| func
| assign { g_lingo->code1(g_lingo->func_xpop); }
- | statement
+ | stmt
| expr { g_lingo->code1(g_lingo->func_printtop); }
| error { yyerrok; }
| /* empty */
@@ -103,7 +104,13 @@ assign: tPUT expr tINTO VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->c
| tSET VAR tTO expr { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $4; delete $2; }
;
-statement: expr { g_lingo->code1(g_lingo->func_xpop); }
+stmt: expr { g_lingo->code1(g_lingo->func_xpop); }
+ | if cond tTHEN stmtlist end tEND tIF {
+ inst then, end;
+ WRITE_LE_UINT32(&then, $4);
+ WRITE_LE_UINT32(&end, $5);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
;
expr: INT { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, $1); $$ = g_lingo->code1(i); };
@@ -117,6 +124,17 @@ expr: INT { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT3
| '(' expr ')' { $$ = $2; }
;
+cond: expr { g_lingo->code1(STOP); }
+ ;
+if: tIF { $$ = g_lingo->code1(g_lingo->func_ifcode); g_lingo->code3(STOP,STOP,STOP); }
+ ;
+end: /* nothing */ { g_lingo->code1(STOP); $$ = g_lingo->_currentScript->size(); }
+ ;
+stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
+ | stmtlist '\n'
+ | stmtlist stmt
+ ;
+
func: tMCI STRING { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString($2->c_str()); delete $2; }
| tMCIWAIT VAR { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
| gotofunc
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 8383d0c..ef0fe50 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 23
-#define YY_END_OF_BUFFER 24
+#define YY_NUM_RULES 26
+#define YY_END_OF_BUFFER 27
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,16 +373,16 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[72] =
+static yyconst flex_int16_t yy_accept[79] =
{ 0,
- 0, 0, 24, 23, 3, 21, 23, 20, 20, 19,
- 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
- 17, 2, 2, 3, 21, 0, 22, 1, 18, 19,
- 17, 17, 5, 17, 17, 17, 17, 17, 12, 17,
- 17, 17, 16, 1, 18, 17, 17, 17, 8, 17,
- 17, 17, 14, 15, 17, 6, 7, 17, 17, 11,
- 17, 4, 17, 10, 17, 17, 17, 9, 17, 13,
- 0
+ 0, 0, 27, 26, 3, 24, 26, 23, 23, 22,
+ 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ 20, 20, 2, 2, 3, 24, 0, 25, 1, 21,
+ 22, 20, 20, 20, 7, 4, 20, 20, 20, 20,
+ 20, 14, 20, 20, 20, 20, 19, 1, 21, 5,
+ 20, 20, 20, 10, 20, 20, 20, 16, 17, 20,
+ 20, 8, 9, 20, 20, 13, 20, 18, 6, 20,
+ 12, 20, 20, 20, 11, 20, 15, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -396,10 +396,10 @@ static yyconst flex_int32_t yy_ec[256] =
7, 1, 1, 1, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
- 1, 1, 1, 7, 11, 1, 12, 11, 13, 11,
+ 1, 1, 1, 7, 11, 1, 12, 11, 13, 14,
- 14, 15, 16, 11, 17, 11, 11, 18, 19, 20,
- 21, 22, 11, 23, 24, 25, 26, 27, 28, 29,
+ 15, 16, 17, 18, 19, 11, 11, 20, 21, 22,
+ 23, 24, 11, 25, 26, 27, 28, 29, 30, 31,
11, 11, 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,
@@ -417,71 +417,76 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[30] =
+static yyconst flex_int32_t yy_meta[32] =
{ 0,
1, 1, 2, 3, 1, 1, 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
} ;
-static yyconst flex_int16_t yy_base[75] =
+static yyconst flex_int16_t yy_base[82] =
{ 0,
- 0, 28, 91, 92, 88, 28, 83, 92, 80, 25,
- 0, 64, 65, 65, 63, 23, 69, 67, 14, 67,
- 59, 77, 92, 76, 35, 71, 92, 0, 66, 32,
- 0, 63, 0, 49, 52, 55, 44, 41, 0, 55,
- 43, 42, 0, 0, 56, 46, 43, 41, 34, 44,
- 35, 32, 0, 0, 44, 0, 0, 45, 42, 0,
- 38, 0, 37, 0, 32, 26, 24, 0, 22, 0,
- 92, 44, 39, 48
+ 0, 30, 99, 100, 96, 30, 91, 100, 88, 27,
+ 0, 73, 69, 70, 22, 69, 26, 76, 74, 15,
+ 74, 23, 86, 100, 85, 44, 80, 100, 0, 75,
+ 41, 0, 70, 71, 0, 0, 55, 58, 61, 50,
+ 47, 0, 62, 49, 48, 59, 0, 0, 63, 0,
+ 51, 48, 46, 39, 49, 40, 37, 0, 0, 43,
+ 49, 0, 0, 51, 47, 0, 42, 0, 0, 41,
+ 0, 35, 30, 25, 0, 19, 0, 100, 51, 38,
+ 55
} ;
-static yyconst flex_int16_t yy_def[75] =
+static yyconst flex_int16_t yy_def[82] =
{ 0,
- 71, 1, 71, 71, 71, 71, 72, 71, 71, 71,
- 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
- 73, 71, 71, 71, 71, 72, 71, 74, 71, 71,
- 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 74, 71, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
- 0, 71, 71, 71
+ 78, 1, 78, 78, 78, 78, 79, 78, 78, 78,
+ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
+ 80, 80, 78, 78, 78, 78, 79, 78, 81, 78,
+ 78, 80, 80, 80, 80, 80, 80, 80, 80, 80,
+ 80, 80, 80, 80, 80, 80, 80, 81, 78, 80,
+ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
+ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
+ 80, 80, 80, 80, 80, 80, 80, 0, 78, 78,
+ 78
} ;
-static yyconst flex_int16_t yy_nxt[122] =
+static yyconst flex_int16_t yy_nxt[132] =
{ 0,
4, 5, 6, 6, 4, 7, 8, 9, 4, 10,
- 11, 11, 11, 11, 12, 13, 14, 15, 16, 17,
- 18, 19, 11, 20, 21, 11, 11, 11, 11, 22,
- 25, 25, 23, 29, 30, 36, 40, 25, 25, 41,
- 29, 30, 31, 37, 26, 70, 26, 26, 44, 69,
- 68, 44, 67, 66, 65, 64, 63, 62, 61, 60,
- 59, 58, 57, 56, 55, 45, 54, 53, 52, 51,
- 50, 49, 48, 47, 46, 45, 27, 24, 24, 43,
- 42, 39, 38, 35, 34, 33, 32, 28, 27, 24,
- 71, 3, 71, 71, 71, 71, 71, 71, 71, 71,
-
- 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
- 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
- 71
+ 11, 11, 11, 11, 12, 13, 14, 11, 15, 16,
+ 17, 18, 19, 20, 11, 21, 22, 11, 11, 11,
+ 11, 23, 26, 26, 24, 30, 31, 36, 39, 43,
+ 46, 32, 44, 37, 77, 47, 26, 26, 40, 30,
+ 31, 27, 76, 27, 27, 48, 75, 74, 48, 73,
+ 72, 71, 70, 69, 68, 67, 66, 65, 64, 63,
+ 62, 61, 49, 60, 59, 58, 57, 56, 55, 54,
+ 53, 52, 51, 50, 49, 28, 25, 25, 45, 42,
+ 41, 38, 35, 34, 33, 29, 28, 25, 78, 3,
+
+ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
+ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
+ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
+ 78
} ;
-static yyconst flex_int16_t yy_chk[122] =
+static yyconst flex_int16_t yy_chk[132] =
{ 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, 2,
- 6, 6, 2, 10, 10, 16, 19, 25, 25, 19,
- 30, 30, 73, 16, 72, 69, 72, 72, 74, 67,
- 66, 74, 65, 63, 61, 59, 58, 55, 52, 51,
- 50, 49, 48, 47, 46, 45, 42, 41, 40, 38,
- 37, 36, 35, 34, 32, 29, 26, 24, 22, 21,
- 20, 18, 17, 15, 14, 13, 12, 9, 7, 5,
- 3, 71, 71, 71, 71, 71, 71, 71, 71, 71,
-
- 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
- 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
- 71
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 6, 6, 2, 10, 10, 15, 17, 20,
+ 22, 80, 20, 15, 76, 22, 26, 26, 17, 31,
+ 31, 79, 74, 79, 79, 81, 73, 72, 81, 70,
+ 67, 65, 64, 61, 60, 57, 56, 55, 54, 53,
+ 52, 51, 49, 46, 45, 44, 43, 41, 40, 39,
+ 38, 37, 34, 33, 30, 27, 25, 23, 21, 19,
+ 18, 16, 14, 13, 12, 9, 7, 5, 3, 78,
+
+ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
+ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
+ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
+ 78
} ;
static yy_state_type yy_last_accepting_state;
@@ -531,7 +536,7 @@ char *yytext;
int yyparse();
-#line 535 "engines/director/lingo/lingo-lex.cpp"
+#line 540 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -719,7 +724,7 @@ YY_DECL
#line 45 "engines/director/lingo/lingo-lex.l"
-#line 723 "engines/director/lingo/lingo-lex.cpp"
+#line 728 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -773,13 +778,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 >= 72 )
+ if ( yy_current_state >= 79 )
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] != 92 );
+ while ( yy_base[yy_current_state] != 100 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -821,105 +826,120 @@ YY_RULE_SETUP
case 4:
YY_RULE_SETUP
#line 51 "engines/director/lingo/lingo-lex.l"
-{ return tFRAME; }
+{ return tIF; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 52 "engines/director/lingo/lingo-lex.l"
-{ return tGO; }
+{ return tEND; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 53 "engines/director/lingo/lingo-lex.l"
-{ return tINTO; }
+{ return tFRAME; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 54 "engines/director/lingo/lingo-lex.l"
-{ return tLOOP; }
+{ return tGO; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 55 "engines/director/lingo/lingo-lex.l"
-{ return tMCI; }
+{ return tINTO; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 56 "engines/director/lingo/lingo-lex.l"
-{ return tMCIWAIT; }
+{ return tLOOP; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 57 "engines/director/lingo/lingo-lex.l"
-{ return tMOVIE; }
+{ return tMCI; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 58 "engines/director/lingo/lingo-lex.l"
-{ return tNEXT; }
+{ return tMCIWAIT; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 59 "engines/director/lingo/lingo-lex.l"
-{ return tOF; }
+{ return tMOVIE; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 60 "engines/director/lingo/lingo-lex.l"
-{ return tPREVIOUS; }
+{ return tNEXT; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 61 "engines/director/lingo/lingo-lex.l"
-{ return tPUT; }
+{ return tOF; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 62 "engines/director/lingo/lingo-lex.l"
-{ return tSET; }
+{ return tPREVIOUS; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 63 "engines/director/lingo/lingo-lex.l"
-{ return tTO; }
+{ return tPUT; }
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 65 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+#line 64 "engines/director/lingo/lingo-lex.l"
+{ return tSET; }
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 66 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+#line 65 "engines/director/lingo/lingo-lex.l"
+{ return tTHEN; }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 67 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+#line 66 "engines/director/lingo/lingo-lex.l"
+{ return tTO; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 68 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ yylval.s = new Common::String(yytext); return VAR; }
YY_BREAK
case 21:
-/* rule 21 can match eol */
YY_RULE_SETUP
#line 69 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 70 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 23:
YY_RULE_SETUP
+#line 71 "engines/director/lingo/lingo-lex.l"
+{ return *yytext; }
+ YY_BREAK
+case 24:
+/* rule 24 can match eol */
+YY_RULE_SETUP
#line 72 "engines/director/lingo/lingo-lex.l"
+{ return '\n'; }
+ YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 73 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+ YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 75 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 923 "engines/director/lingo/lingo-lex.cpp"
+#line 943 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1212,7 +1232,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 >= 72 )
+ if ( yy_current_state >= 79 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1240,11 +1260,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 >= 72 )
+ if ( yy_current_state >= 79 )
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 == 71);
+ yy_is_jam = (yy_current_state == 78);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1919,7 +1939,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 72 "engines/director/lingo/lingo-lex.l"
+#line 75 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 5823a36..a6e644a 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -48,6 +48,8 @@ whitespace [\t ]
^{whitespace}
[\t]+ { return ' '; }
+if { return tIF; }
+end { return tEND; }
frame { return tFRAME; }
go { return tGO; }
into { return tINTO; }
@@ -60,6 +62,7 @@ of { return tOF; }
previous { return tPREVIOUS; }
put { return tPUT; }
set { return tSET; }
+then { return tTHEN; }
to { return tTO; }
{variable} { yylval.s = new Common::String(yytext); return VAR; }
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 1572685..25b4495 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -130,9 +130,10 @@ void Lingo::executeScript(ScriptType type, uint16 id) {
return;
}
- for(_pc = &_scripts[type][id]->front(); *_pc != STOP;) {
- (*((++_pc)[-1]))();
- }
+ _currentScript = _scripts[type][id];
+ _pc = 0;
+
+ execute(_pc);
}
void Lingo::processEvent(LEvent event, int entityId) {
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 5341aff..d4a1190 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -107,7 +107,7 @@ public:
void processEvent(LEvent event, int entityId);
- int code1(inst code) { _currentScript->push_back(code); return _currentScript->size(); }
+ int code1(inst code) { _currentScript->push_back(code); return _currentScript->size() - 1; }
int code2(inst code_1, inst code_2) { code1(code_1); return code1(code_2); }
int code3(inst code_1, inst code_2, inst code_3) { code1(code_1); code1(code_2); return code1(code_3); }
int codeString(const char *s);
@@ -118,6 +118,8 @@ public:
}
public:
+ void execute(int pc);
+
static void func_xpop();
static void func_printtop();
static void func_add();
@@ -130,6 +132,8 @@ public:
static void func_assign();
bool verify(Symbol *s);
static void func_eval();
+ static void func_ifcode();
+
static void func_mci();
static void func_mciwait();
static void func_goto();
@@ -141,6 +145,9 @@ public:
void exec_mciwait(Common::String &s);
void exec_goto(Common::String &frame, Common::String &movie);
+public:
+ ScriptData *_currentScript;
+
private:
int parse(const char *code);
void push(Datum d);
@@ -150,11 +157,10 @@ private:
Common::HashMap<Common::String, Audio::AudioStream *> _audioAliases;
ScriptHash _scripts[kMaxScriptType + 1];
- ScriptData *_currentScript;
Common::HashMap<Common::String, Symbol *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _vars;
- inst *_pc;
+ int _pc;
StackData _stack;
Commit: 0567ac97074a9db4799838e0aa6296d269dc1632
https://github.com/scummvm/scummvm/commit/0567ac97074a9db4799838e0aa6296d269dc1632
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix variable accessing
Changed paths:
engines/director/lingo/lingo-funcs.cpp
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 8144270..cd399f7 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -234,7 +234,7 @@ void Lingo::func_constpush() {
void Lingo::func_varpush() {
Datum d;
Symbol *sym;
- char *name = (char *)(*g_lingo->_currentScript)[g_lingo->_pc];
+ char *name = (char *)&(*g_lingo->_currentScript)[g_lingo->_pc];
if (!g_lingo->_vars.contains(name)) { // Create variable if it was not defined
sym = new Symbol;
Commit: 31329a62a9f59ec9a8b60963f51657124c2f9c92
https://github.com/scummvm/scummvm/commit/31329a62a9f59ec9a8b60963f51657124c2f9c92
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implement 'put' function
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index b184716..1ba7e96 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -82,7 +82,7 @@ go movie \"BAR 1\"\n\
go to \"Open23\" of movie \"OpenCabin23\"\n\
go to \"Chair\"\n\
set x = 2 + 3 * (4 / 2)\n\
-x ", kMovieScript, 2);
+put x\n", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 9f971cb..53d59df 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -389,18 +389,18 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 38
+#define YYFINAL 39
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 89
+#define YYLAST 98
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 34
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 14
/* YYNRULES -- Number of rules. */
-#define YYNRULES 46
+#define YYNRULES 47
/* YYNRULES -- Number of states. */
-#define YYNSTATES 77
+#define YYNSTATES 78
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -450,8 +450,8 @@ static const yytype_uint8 yyprhs[] =
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
20, 21, 26, 31, 36, 38, 46, 48, 50, 54,
58, 62, 66, 69, 72, 76, 78, 80, 81, 82,
- 85, 88, 91, 94, 96, 99, 102, 105, 108, 112,
- 115, 119, 122, 125, 127, 131, 134
+ 85, 88, 91, 94, 97, 99, 102, 105, 108, 111,
+ 115, 118, 122, 125, 128, 130, 134, 137
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -466,11 +466,12 @@ static const yytype_int8 yyrhs[] =
39, -1, 39, 29, 39, -1, 26, 39, -1, 27,
39, -1, 32, 39, 33, -1, 39, -1, 9, -1,
-1, -1, 43, 31, -1, 43, 38, -1, 15, 8,
- -1, 16, 7, -1, 45, -1, 12, 14, -1, 12,
- 18, -1, 12, 20, -1, 12, 46, -1, 12, 46,
- 47, -1, 12, 47, -1, 24, 11, 8, -1, 11,
- 8, -1, 24, 8, -1, 8, -1, 19, 17, 8,
- -1, 17, 8, -1, 24, 17, 8, -1
+ -1, 16, 7, -1, 21, 7, -1, 45, -1, 12,
+ 14, -1, 12, 18, -1, 12, 20, -1, 12, 46,
+ -1, 12, 46, 47, -1, 12, 47, -1, 24, 11,
+ 8, -1, 11, 8, -1, 24, 8, -1, 8, -1,
+ 19, 17, 8, -1, 17, 8, -1, 24, 17, 8,
+ -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -479,8 +480,8 @@ static const yytype_uint8 yyrline[] =
0, 89, 89, 90, 93, 94, 95, 96, 97, 98,
99, 102, 103, 104, 107, 108, 116, 117, 118, 119,
120, 121, 122, 123, 124, 127, 129, 131, 133, 134,
- 135, 138, 139, 140, 151, 152, 153, 154, 155, 156,
- 159, 160, 161, 162, 165, 166, 167
+ 135, 138, 139, 140, 141, 152, 153, 154, 155, 156,
+ 157, 160, 161, 162, 163, 166, 167, 168
};
#endif
@@ -517,8 +518,8 @@ static const yytype_uint8 yyr1[] =
0, 34, 35, 35, 36, 36, 36, 36, 36, 36,
36, 37, 37, 37, 38, 38, 39, 39, 39, 39,
39, 39, 39, 39, 39, 40, 41, 42, 43, 43,
- 43, 44, 44, 44, 45, 45, 45, 45, 45, 45,
- 46, 46, 46, 46, 47, 47, 47
+ 43, 44, 44, 44, 44, 45, 45, 45, 45, 45,
+ 45, 46, 46, 46, 46, 47, 47, 47
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -527,8 +528,8 @@ static const yytype_uint8 yyr2[] =
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
0, 4, 4, 4, 1, 7, 1, 1, 3, 3,
3, 3, 2, 2, 3, 1, 1, 0, 0, 2,
- 2, 2, 2, 1, 2, 2, 2, 2, 3, 2,
- 3, 2, 2, 1, 3, 2, 3
+ 2, 2, 2, 2, 1, 2, 2, 2, 2, 3,
+ 2, 3, 2, 2, 1, 3, 2, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -538,18 +539,18 @@ static const yytype_uint8 yydefact[] =
{
0, 9, 16, 17, 26, 0, 0, 0, 0, 0,
0, 0, 0, 0, 3, 6, 7, 8, 0, 5,
- 33, 43, 0, 34, 0, 35, 0, 36, 0, 37,
- 39, 31, 32, 0, 0, 22, 23, 0, 1, 0,
- 0, 0, 0, 0, 25, 0, 41, 45, 0, 42,
- 0, 0, 0, 38, 0, 0, 0, 24, 2, 18,
- 19, 20, 21, 28, 44, 40, 46, 11, 13, 12,
- 27, 29, 30, 14, 0, 0, 15
+ 34, 44, 0, 35, 0, 36, 0, 37, 0, 38,
+ 40, 31, 32, 17, 0, 0, 22, 23, 0, 1,
+ 0, 0, 0, 0, 0, 25, 0, 42, 46, 0,
+ 43, 0, 0, 0, 39, 0, 0, 0, 24, 2,
+ 18, 19, 20, 21, 28, 45, 41, 47, 11, 13,
+ 12, 27, 29, 30, 14, 0, 0, 15
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 13, 14, 15, 16, 17, 45, 18, 74, 70,
+ -1, 13, 14, 15, 16, 17, 46, 18, 75, 71,
19, 20, 29, 30
};
@@ -558,52 +559,54 @@ static const yytype_int8 yydefgoto[] =
#define YYPACT_NINF -19
static const yytype_int8 yypact[] =
{
- 37, -19, -19, -19, -19, 5, -7, 8, 4, 13,
- 4, 4, 4, 12, -10, -19, -19, 60, 4, -19,
- -19, -19, 18, -19, 19, -19, 11, -19, -3, 61,
- -19, -19, -19, 44, -18, -19, -19, 48, -19, 37,
- 4, 4, 4, 4, 60, 17, -19, -19, 42, -19,
- 43, 46, 28, -19, 49, 4, 4, -19, -19, -11,
- -11, -19, -19, -19, -19, -19, -19, -19, 60, 60,
- 34, -19, -19, 60, 45, 58, -19
+ 38, -19, -19, -19, -19, -3, 10, 12, 50, 13,
+ 66, 66, 66, 26, -2, -19, -19, 61, 66, -19,
+ -19, -19, 19, -19, 22, -19, 24, -19, 20, 67,
+ -19, -19, -19, 1, -4, -18, -19, -19, 52, -19,
+ 38, 66, 66, 66, 66, 61, 23, -19, -19, 43,
+ -19, 44, 48, 41, -19, 65, 66, 66, -19, -19,
+ -16, -16, -19, -19, -19, -19, -19, -19, -19, 61,
+ 61, 35, -19, -19, 61, 58, 74, -19
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -19, 40, -19, -19, 14, -8, -19, -19, -19, -19,
- -19, -19, -19, 53
+ -19, 34, -19, -19, 4, -8, -19, -19, -19, -19,
+ -19, -19, -19, 68
};
/* 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 -5
+#define YYTABLE_NINF -34
static const yytype_int8 yytable[] =
{
- 33, 31, 35, 36, 37, 49, 55, 56, 50, 2,
- 44, 3, 38, 21, 51, 32, 22, 42, 43, 23,
- 34, 39, 24, 25, 26, 27, 46, 47, 48, 28,
- 10, 11, 59, 60, 61, 62, 12, -4, 1, 2,
- 63, 3, 2, 4, 3, 51, 4, 68, 69, 5,
- 64, 65, 6, 7, 66, 75, 67, 54, 8, 9,
- 10, 11, 73, 10, 11, 71, 12, 76, -4, 12,
- 40, 41, 42, 43, 40, 41, 42, 43, 24, 58,
- 26, 57, 53, 0, 72, 52, 40, 41, 42, 43
+ 34, -33, 36, 37, 38, 21, 56, 57, 22, 55,
+ 45, 23, 43, 44, 24, 25, 26, 27, 31, 32,
+ 35, 28, 41, 42, 43, 44, 39, 47, 50, 40,
+ 48, 51, -33, 60, 61, 62, 63, 52, -4, 1,
+ 2, 49, 3, 2, 4, 3, 64, 4, 69, 70,
+ 5, 65, 66, 6, 7, 2, 67, 33, 52, 8,
+ 9, 10, 11, 74, 10, 11, 72, 12, 76, -4,
+ 12, 2, 68, 3, 59, 73, 10, 11, 41, 42,
+ 43, 44, 12, 77, 24, 58, 26, 41, 42, 43,
+ 44, 53, 10, 11, 0, 0, 0, 54, 12
};
static const yytype_int8 yycheck[] =
{
- 8, 8, 10, 11, 12, 8, 24, 25, 11, 5,
- 18, 7, 0, 8, 17, 7, 11, 28, 29, 14,
- 7, 31, 17, 18, 19, 20, 8, 8, 17, 24,
- 26, 27, 40, 41, 42, 43, 32, 0, 1, 5,
- 23, 7, 5, 9, 7, 17, 9, 55, 56, 12,
- 8, 8, 15, 16, 8, 10, 7, 13, 21, 22,
- 26, 27, 70, 26, 27, 31, 32, 9, 31, 32,
- 26, 27, 28, 29, 26, 27, 28, 29, 17, 39,
- 19, 33, 29, -1, 70, 24, 26, 27, 28, 29
+ 8, 0, 10, 11, 12, 8, 24, 25, 11, 13,
+ 18, 14, 28, 29, 17, 18, 19, 20, 8, 7,
+ 7, 24, 26, 27, 28, 29, 0, 8, 8, 31,
+ 8, 11, 31, 41, 42, 43, 44, 17, 0, 1,
+ 5, 17, 7, 5, 9, 7, 23, 9, 56, 57,
+ 12, 8, 8, 15, 16, 5, 8, 7, 17, 21,
+ 22, 26, 27, 71, 26, 27, 31, 32, 10, 31,
+ 32, 5, 7, 7, 40, 71, 26, 27, 26, 27,
+ 28, 29, 32, 9, 17, 33, 19, 26, 27, 28,
+ 29, 24, 26, 27, -1, -1, -1, 29, 32
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -613,11 +616,11 @@ static const yytype_uint8 yystos[] =
0, 1, 5, 7, 9, 12, 15, 16, 21, 22,
26, 27, 32, 35, 36, 37, 38, 39, 41, 44,
45, 8, 11, 14, 17, 18, 19, 20, 24, 46,
- 47, 8, 7, 39, 7, 39, 39, 39, 0, 31,
- 26, 27, 28, 29, 39, 40, 8, 8, 17, 8,
- 11, 17, 24, 47, 13, 24, 25, 33, 35, 39,
- 39, 39, 39, 23, 8, 8, 8, 7, 39, 39,
- 43, 31, 38, 39, 42, 10, 9
+ 47, 8, 7, 7, 39, 7, 39, 39, 39, 0,
+ 31, 26, 27, 28, 29, 39, 40, 8, 8, 17,
+ 8, 11, 17, 24, 47, 13, 24, 25, 33, 35,
+ 39, 39, 39, 39, 23, 8, 8, 8, 7, 39,
+ 39, 43, 31, 38, 39, 42, 10, 9
};
#define yyerrok (yyerrstatus = 0)
@@ -1551,44 +1554,44 @@ yyreduce:
{ g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 34:
-#line 151 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_gotoloop); ;}
+ case 33:
+#line 140 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->code1(g_lingo->func_eval); g_lingo->code1(g_lingo->func_printtop); delete (yyvsp[(2) - (2)].s); ;}
break;
case 35:
#line 152 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_gotonext); ;}
+ { g_lingo->code1(g_lingo->func_gotoloop); ;}
break;
case 36:
#line 153 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_gotoprevious); ;}
+ { g_lingo->code1(g_lingo->func_gotonext); ;}
break;
case 37:
#line 154 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
+ { g_lingo->code1(g_lingo->func_gotoprevious); ;}
break;
case 38:
#line 155 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
+ { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
break;
case 39:
#line 156 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
break;
case 40:
-#line 159 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 157 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 41:
#line 160 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 42:
@@ -1598,27 +1601,32 @@ yyreduce:
case 43:
#line 162 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 44:
-#line 165 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 163 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 45:
#line 166 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 46:
#line 167 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 47:
+#line 168 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1622 "engines/director/lingo/lingo-gr.cpp"
+#line 1630 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1832,6 +1840,6 @@ yyreturn:
}
-#line 197 "engines/director/lingo/lingo-gr.y"
+#line 198 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 21f3b44..eb90db1 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -137,6 +137,7 @@ stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
func: tMCI STRING { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString($2->c_str()); delete $2; }
| tMCIWAIT VAR { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
+ | tPUT VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_eval); g_lingo->code1(g_lingo->func_printtop); delete $2; }
| gotofunc
;
Commit: a7ec15f77affc6ec9ee6f08d3e4a4b4d697770ac
https://github.com/scummvm/scummvm/commit/a7ec15f77affc6ec9ee6f08d3e4a4b4d697770ac
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingvo: Fix 'put' function
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 53d59df..c4cddd3 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -389,9 +389,9 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 39
+#define YYFINAL 38
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 98
+#define YYLAST 89
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 34
@@ -400,7 +400,7 @@ union yyalloc
/* YYNRULES -- Number of rules. */
#define YYNRULES 47
/* YYNRULES -- Number of states. */
-#define YYNSTATES 78
+#define YYNSTATES 77
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -466,7 +466,7 @@ static const yytype_int8 yyrhs[] =
39, -1, 39, 29, 39, -1, 26, 39, -1, 27,
39, -1, 32, 39, 33, -1, 39, -1, 9, -1,
-1, -1, 43, 31, -1, 43, 38, -1, 15, 8,
- -1, 16, 7, -1, 21, 7, -1, 45, -1, 12,
+ -1, 16, 7, -1, 21, 39, -1, 45, -1, 12,
14, -1, 12, 18, -1, 12, 20, -1, 12, 46,
-1, 12, 46, 47, -1, 12, 47, -1, 24, 11,
8, -1, 11, 8, -1, 24, 8, -1, 8, -1,
@@ -540,17 +540,17 @@ static const yytype_uint8 yydefact[] =
0, 9, 16, 17, 26, 0, 0, 0, 0, 0,
0, 0, 0, 0, 3, 6, 7, 8, 0, 5,
34, 44, 0, 35, 0, 36, 0, 37, 0, 38,
- 40, 31, 32, 17, 0, 0, 22, 23, 0, 1,
- 0, 0, 0, 0, 0, 25, 0, 42, 46, 0,
- 43, 0, 0, 0, 39, 0, 0, 0, 24, 2,
- 18, 19, 20, 21, 28, 45, 41, 47, 11, 13,
- 12, 27, 29, 30, 14, 0, 0, 15
+ 40, 31, 32, 33, 0, 22, 23, 0, 1, 0,
+ 0, 0, 0, 0, 25, 0, 42, 46, 0, 43,
+ 0, 0, 0, 39, 0, 0, 0, 24, 2, 18,
+ 19, 20, 21, 28, 45, 41, 47, 11, 13, 12,
+ 27, 29, 30, 14, 0, 0, 15
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 13, 14, 15, 16, 17, 46, 18, 75, 71,
+ -1, 13, 14, 15, 16, 17, 45, 18, 74, 70,
19, 20, 29, 30
};
@@ -559,54 +559,52 @@ static const yytype_int8 yydefgoto[] =
#define YYPACT_NINF -19
static const yytype_int8 yypact[] =
{
- 38, -19, -19, -19, -19, -3, 10, 12, 50, 13,
- 66, 66, 66, 26, -2, -19, -19, 61, 66, -19,
- -19, -19, 19, -19, 22, -19, 24, -19, 20, 67,
- -19, -19, -19, 1, -4, -18, -19, -19, 52, -19,
- 38, 66, 66, 66, 66, 61, 23, -19, -19, 43,
- -19, 44, 48, 41, -19, 65, 66, 66, -19, -19,
- -16, -16, -19, -19, -19, -19, -19, -19, -19, 61,
- 61, 35, -19, -19, 61, 58, 74, -19
+ 37, -19, -19, -19, -19, 5, -7, 8, 4, 13,
+ 4, 4, 4, 12, -10, -19, -19, 60, 4, -19,
+ -19, -19, 18, -19, 19, -19, 11, -19, -3, 61,
+ -19, -19, -19, 44, -18, -19, -19, 48, -19, 37,
+ 4, 4, 4, 4, 60, 17, -19, -19, 42, -19,
+ 43, 46, 28, -19, 49, 4, 4, -19, -19, -11,
+ -11, -19, -19, -19, -19, -19, -19, -19, 60, 60,
+ 34, -19, -19, 60, 45, 58, -19
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -19, 34, -19, -19, 4, -8, -19, -19, -19, -19,
- -19, -19, -19, 68
+ -19, 40, -19, -19, 14, -8, -19, -19, -19, -19,
+ -19, -19, -19, 53
};
/* 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 -34
+#define YYTABLE_NINF -5
static const yytype_int8 yytable[] =
{
- 34, -33, 36, 37, 38, 21, 56, 57, 22, 55,
- 45, 23, 43, 44, 24, 25, 26, 27, 31, 32,
- 35, 28, 41, 42, 43, 44, 39, 47, 50, 40,
- 48, 51, -33, 60, 61, 62, 63, 52, -4, 1,
- 2, 49, 3, 2, 4, 3, 64, 4, 69, 70,
- 5, 65, 66, 6, 7, 2, 67, 33, 52, 8,
- 9, 10, 11, 74, 10, 11, 72, 12, 76, -4,
- 12, 2, 68, 3, 59, 73, 10, 11, 41, 42,
- 43, 44, 12, 77, 24, 58, 26, 41, 42, 43,
- 44, 53, 10, 11, 0, 0, 0, 54, 12
+ 33, 31, 35, 36, 37, 49, 55, 56, 50, 2,
+ 44, 3, 38, 21, 51, 32, 22, 42, 43, 23,
+ 34, 39, 24, 25, 26, 27, 46, 47, 48, 28,
+ 10, 11, 59, 60, 61, 62, 12, -4, 1, 2,
+ 63, 3, 2, 4, 3, 51, 4, 68, 69, 5,
+ 64, 65, 6, 7, 66, 75, 67, 54, 8, 9,
+ 10, 11, 73, 10, 11, 71, 12, 76, -4, 12,
+ 40, 41, 42, 43, 40, 41, 42, 43, 24, 58,
+ 26, 57, 53, 0, 72, 52, 40, 41, 42, 43
};
static const yytype_int8 yycheck[] =
{
- 8, 0, 10, 11, 12, 8, 24, 25, 11, 13,
- 18, 14, 28, 29, 17, 18, 19, 20, 8, 7,
- 7, 24, 26, 27, 28, 29, 0, 8, 8, 31,
- 8, 11, 31, 41, 42, 43, 44, 17, 0, 1,
- 5, 17, 7, 5, 9, 7, 23, 9, 56, 57,
- 12, 8, 8, 15, 16, 5, 8, 7, 17, 21,
- 22, 26, 27, 71, 26, 27, 31, 32, 10, 31,
- 32, 5, 7, 7, 40, 71, 26, 27, 26, 27,
- 28, 29, 32, 9, 17, 33, 19, 26, 27, 28,
- 29, 24, 26, 27, -1, -1, -1, 29, 32
+ 8, 8, 10, 11, 12, 8, 24, 25, 11, 5,
+ 18, 7, 0, 8, 17, 7, 11, 28, 29, 14,
+ 7, 31, 17, 18, 19, 20, 8, 8, 17, 24,
+ 26, 27, 40, 41, 42, 43, 32, 0, 1, 5,
+ 23, 7, 5, 9, 7, 17, 9, 55, 56, 12,
+ 8, 8, 15, 16, 8, 10, 7, 13, 21, 22,
+ 26, 27, 70, 26, 27, 31, 32, 9, 31, 32,
+ 26, 27, 28, 29, 26, 27, 28, 29, 17, 39,
+ 19, 33, 29, -1, 70, 24, 26, 27, 28, 29
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -616,11 +614,11 @@ static const yytype_uint8 yystos[] =
0, 1, 5, 7, 9, 12, 15, 16, 21, 22,
26, 27, 32, 35, 36, 37, 38, 39, 41, 44,
45, 8, 11, 14, 17, 18, 19, 20, 24, 46,
- 47, 8, 7, 7, 39, 7, 39, 39, 39, 0,
- 31, 26, 27, 28, 29, 39, 40, 8, 8, 17,
- 8, 11, 17, 24, 47, 13, 24, 25, 33, 35,
- 39, 39, 39, 39, 23, 8, 8, 8, 7, 39,
- 39, 43, 31, 38, 39, 42, 10, 9
+ 47, 8, 7, 39, 7, 39, 39, 39, 0, 31,
+ 26, 27, 28, 29, 39, 40, 8, 8, 17, 8,
+ 11, 17, 24, 47, 13, 24, 25, 33, 35, 39,
+ 39, 39, 39, 23, 8, 8, 8, 7, 39, 39,
+ 43, 31, 38, 39, 42, 10, 9
};
#define yyerrok (yyerrstatus = 0)
@@ -1556,7 +1554,7 @@ yyreduce:
case 33:
#line 140 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->code1(g_lingo->func_eval); g_lingo->code1(g_lingo->func_printtop); delete (yyvsp[(2) - (2)].s); ;}
+ { g_lingo->code1(g_lingo->func_printtop); ;}
break;
case 35:
@@ -1626,7 +1624,7 @@ yyreduce:
/* Line 1267 of yacc.c. */
-#line 1630 "engines/director/lingo/lingo-gr.cpp"
+#line 1628 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index eb90db1..76a706a 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -137,7 +137,7 @@ stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
func: tMCI STRING { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString($2->c_str()); delete $2; }
| tMCIWAIT VAR { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
- | tPUT VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_eval); g_lingo->code1(g_lingo->func_printtop); delete $2; }
+ | tPUT expr { g_lingo->code1(g_lingo->func_printtop); }
| gotofunc
;
Commit: db2380077fee7b6bccba4262fa25f55e50a2981a
https://github.com/scummvm/scummvm/commit/db2380077fee7b6bccba4262fa25f55e50a2981a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implement logical operators
Changed paths:
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index cd399f7..3e3d885 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -341,6 +341,55 @@ void Lingo::func_negate() {
g_lingo->push(d);
}
+void Lingo::func_eq() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.val = (d1.val == d2.val) ? 1 : 0;
+ g_lingo->push(d1);
+}
+
+void Lingo::func_neq() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.val = (d1.val != d2.val) ? 1 : 0;
+ g_lingo->push(d1);
+}
+
+void Lingo::func_gt() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.val = (d1.val > d2.val) ? 1 : 0;
+ g_lingo->push(d1);
+}
+
+void Lingo::func_lt() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.val = (d1.val < d2.val) ? 1 : 0;
+ g_lingo->push(d1);
+}
+
+void Lingo::func_ge() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.val = (d1.val >= d2.val) ? 1 : 0;
+ g_lingo->push(d1);
+}
+
+void Lingo::func_le() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.val = (d1.val <= d2.val) ? 1 : 0;
+ g_lingo->push(d1);
+}
+
+
void Lingo::func_ifcode() {
Datum d;
int savepc = g_lingo->_pc; /* then part */
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index c4cddd3..0e69b67 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -87,7 +87,13 @@
tPUT = 276,
tSET = 277,
tTHEN = 278,
- tTO = 279
+ tTO = 279,
+ tGE = 280,
+ tLE = 281,
+ tGT = 282,
+ tLT = 283,
+ tEQ = 284,
+ tNEQ = 285
};
#endif
/* Tokens. */
@@ -113,6 +119,12 @@
#define tSET 277
#define tTHEN 278
#define tTO 279
+#define tGE 280
+#define tLE 281
+#define tGT 282
+#define tLT 283
+#define tEQ 284
+#define tNEQ 285
@@ -163,7 +175,7 @@ typedef union YYSTYPE
int code;
}
/* Line 193 of yacc.c. */
-#line 167 "engines/director/lingo/lingo-gr.cpp"
+#line 179 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -176,7 +188,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 180 "engines/director/lingo/lingo-gr.cpp"
+#line 192 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -391,20 +403,20 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 38
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 89
+#define YYLAST 164
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 34
+#define YYNTOKENS 42
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 14
/* YYNRULES -- Number of rules. */
-#define YYNRULES 47
+#define YYNRULES 53
/* YYNRULES -- Number of states. */
-#define YYNSTATES 77
+#define YYNSTATES 89
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 279
+#define YYMAXUTOK 285
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -413,12 +425,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 31, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 37, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 30, 2, 2,
- 32, 33, 28, 26, 2, 27, 2, 29, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 36, 2, 2,
+ 40, 41, 34, 32, 2, 33, 2, 35, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 25, 2, 2, 2, 2, 2, 2, 2, 2,
+ 39, 31, 38, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -439,7 +451,8 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30
};
#if YYDEBUG
@@ -449,39 +462,43 @@ static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
20, 21, 26, 31, 36, 38, 46, 48, 50, 54,
- 58, 62, 66, 69, 72, 76, 78, 80, 81, 82,
- 85, 88, 91, 94, 97, 99, 102, 105, 108, 111,
- 115, 118, 122, 125, 128, 130, 134, 137
+ 58, 62, 66, 70, 74, 78, 82, 86, 89, 92,
+ 96, 98, 102, 104, 105, 106, 109, 112, 115, 118,
+ 121, 123, 126, 129, 132, 135, 139, 142, 146, 149,
+ 152, 154, 158, 161
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 35, 0, -1, 36, 31, 35, -1, 36, -1, -1,
- 44, -1, 37, -1, 38, -1, 39, -1, 1, -1,
- -1, 21, 39, 13, 7, -1, 22, 7, 25, 39,
- -1, 22, 7, 24, 39, -1, 39, -1, 41, 40,
- 23, 43, 42, 10, 9, -1, 5, -1, 7, -1,
- 39, 26, 39, -1, 39, 27, 39, -1, 39, 28,
- 39, -1, 39, 29, 39, -1, 26, 39, -1, 27,
- 39, -1, 32, 39, 33, -1, 39, -1, 9, -1,
- -1, -1, 43, 31, -1, 43, 38, -1, 15, 8,
- -1, 16, 7, -1, 21, 39, -1, 45, -1, 12,
- 14, -1, 12, 18, -1, 12, 20, -1, 12, 46,
- -1, 12, 46, 47, -1, 12, 47, -1, 24, 11,
- 8, -1, 11, 8, -1, 24, 8, -1, 8, -1,
- 19, 17, 8, -1, 17, 8, -1, 24, 17, 8,
- -1
+ 43, 0, -1, 44, 37, 43, -1, 44, -1, -1,
+ 52, -1, 45, -1, 46, -1, 47, -1, 1, -1,
+ -1, 21, 47, 13, 7, -1, 22, 7, 31, 47,
+ -1, 22, 7, 24, 47, -1, 47, -1, 49, 48,
+ 23, 51, 50, 10, 9, -1, 5, -1, 7, -1,
+ 47, 32, 47, -1, 47, 33, 47, -1, 47, 34,
+ 47, -1, 47, 35, 47, -1, 47, 38, 47, -1,
+ 47, 39, 47, -1, 47, 30, 47, -1, 47, 25,
+ 47, -1, 47, 26, 47, -1, 32, 47, -1, 33,
+ 47, -1, 40, 47, 41, -1, 47, -1, 47, 31,
+ 47, -1, 9, -1, -1, -1, 51, 37, -1, 51,
+ 46, -1, 15, 8, -1, 16, 7, -1, 21, 47,
+ -1, 53, -1, 12, 14, -1, 12, 18, -1, 12,
+ 20, -1, 12, 54, -1, 12, 54, 55, -1, 12,
+ 55, -1, 24, 11, 8, -1, 11, 8, -1, 24,
+ 8, -1, 8, -1, 19, 17, 8, -1, 17, 8,
+ -1, 24, 17, 8, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 89, 89, 90, 93, 94, 95, 96, 97, 98,
- 99, 102, 103, 104, 107, 108, 116, 117, 118, 119,
- 120, 121, 122, 123, 124, 127, 129, 131, 133, 134,
- 135, 138, 139, 140, 141, 152, 153, 154, 155, 156,
- 157, 160, 161, 162, 163, 166, 167, 168
+ 0, 90, 90, 91, 94, 95, 96, 97, 98, 99,
+ 100, 103, 104, 105, 108, 109, 117, 118, 119, 120,
+ 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
+ 133, 134, 136, 138, 140, 141, 142, 145, 146, 147,
+ 148, 159, 160, 161, 162, 163, 164, 167, 168, 169,
+ 170, 173, 174, 175
};
#endif
@@ -493,10 +510,10 @@ static const char *const yytname[] =
"$end", "error", "$undefined", "UNARY", "UNDEF", "INT", "FLOAT", "VAR",
"STRING", "tIF", "tEND", "tFRAME", "tGO", "tINTO", "tLOOP", "tMCI",
"tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tSET",
- "tTHEN", "tTO", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('",
- "')'", "$accept", "program", "programline", "assign", "stmt", "expr",
- "cond", "if", "end", "stmtlist", "func", "gotofunc", "gotoframe",
- "gotomovie", 0
+ "tTHEN", "tTO", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'",
+ "'-'", "'*'", "'/'", "'%'", "'\\n'", "'>'", "'<'", "'('", "')'",
+ "$accept", "program", "programline", "assign", "stmt", "expr", "cond",
+ "if", "end", "stmtlist", "func", "gotofunc", "gotoframe", "gotomovie", 0
};
#endif
@@ -507,19 +524,21 @@ static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 279, 61, 43, 45, 42, 47,
- 37, 10, 40, 41
+ 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
+ 285, 61, 43, 45, 42, 47, 37, 10, 62, 60,
+ 40, 41
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 34, 35, 35, 36, 36, 36, 36, 36, 36,
- 36, 37, 37, 37, 38, 38, 39, 39, 39, 39,
- 39, 39, 39, 39, 39, 40, 41, 42, 43, 43,
- 43, 44, 44, 44, 44, 45, 45, 45, 45, 45,
- 45, 46, 46, 46, 46, 47, 47, 47
+ 0, 42, 43, 43, 44, 44, 44, 44, 44, 44,
+ 44, 45, 45, 45, 46, 46, 47, 47, 47, 47,
+ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
+ 48, 48, 49, 50, 51, 51, 51, 52, 52, 52,
+ 52, 53, 53, 53, 53, 53, 53, 54, 54, 54,
+ 54, 55, 55, 55
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -527,9 +546,10 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
0, 4, 4, 4, 1, 7, 1, 1, 3, 3,
- 3, 3, 2, 2, 3, 1, 1, 0, 0, 2,
- 2, 2, 2, 2, 1, 2, 2, 2, 2, 3,
- 2, 3, 2, 2, 1, 3, 2, 3
+ 3, 3, 3, 3, 3, 3, 3, 2, 2, 3,
+ 1, 3, 1, 0, 0, 2, 2, 2, 2, 2,
+ 1, 2, 2, 2, 2, 3, 2, 3, 2, 2,
+ 1, 3, 2, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -537,43 +557,45 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 9, 16, 17, 26, 0, 0, 0, 0, 0,
+ 0, 9, 16, 17, 32, 0, 0, 0, 0, 0,
0, 0, 0, 0, 3, 6, 7, 8, 0, 5,
- 34, 44, 0, 35, 0, 36, 0, 37, 0, 38,
- 40, 31, 32, 33, 0, 22, 23, 0, 1, 0,
- 0, 0, 0, 0, 25, 0, 42, 46, 0, 43,
- 0, 0, 0, 39, 0, 0, 0, 24, 2, 18,
- 19, 20, 21, 28, 45, 41, 47, 11, 13, 12,
- 27, 29, 30, 14, 0, 0, 15
+ 40, 50, 0, 41, 0, 42, 0, 43, 0, 44,
+ 46, 37, 38, 39, 0, 27, 28, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 30,
+ 0, 48, 52, 0, 49, 0, 0, 0, 45, 0,
+ 0, 0, 29, 2, 25, 26, 24, 18, 19, 20,
+ 21, 22, 23, 0, 34, 51, 47, 53, 11, 13,
+ 12, 31, 33, 35, 36, 14, 0, 0, 15
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 13, 14, 15, 16, 17, 45, 18, 74, 70,
+ -1, 13, 14, 15, 16, 17, 50, 18, 86, 82,
19, 20, 29, 30
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -19
+#define YYPACT_NINF -24
static const yytype_int8 yypact[] =
{
- 37, -19, -19, -19, -19, 5, -7, 8, 4, 13,
- 4, 4, 4, 12, -10, -19, -19, 60, 4, -19,
- -19, -19, 18, -19, 19, -19, 11, -19, -3, 61,
- -19, -19, -19, 44, -18, -19, -19, 48, -19, 37,
- 4, 4, 4, 4, 60, 17, -19, -19, 42, -19,
- 43, 46, 28, -19, 49, 4, 4, -19, -19, -11,
- -11, -19, -19, -19, -19, -19, -19, -19, 60, 60,
- 34, -19, -19, 60, 45, 58, -19
+ 54, -24, -24, -24, -24, 107, -3, 2, 18, 6,
+ 18, 18, 18, 17, -11, -24, -24, 114, 18, -24,
+ -24, -24, 19, -24, 20, -24, 13, -24, 4, 5,
+ -24, -24, -24, 67, -23, -19, -19, 78, -24, 54,
+ 18, 18, 18, 18, 18, 18, 18, 18, 18, 103,
+ 8, -24, -24, 35, -24, 36, 37, 30, -24, 41,
+ 18, 18, -24, -24, 114, 114, 114, 125, 125, -19,
+ -19, 114, 114, 18, -24, -24, -24, -24, -24, 114,
+ 114, 114, 9, -24, -24, 114, 46, 48, -24
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -19, 40, -19, -19, 14, -8, -19, -19, -19, -19,
- -19, -19, -19, 53
+ -24, 21, -24, -24, -20, -8, -24, -24, -24, -24,
+ -24, -24, -24, 38
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -583,28 +605,44 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -5
static const yytype_int8 yytable[] =
{
- 33, 31, 35, 36, 37, 49, 55, 56, 50, 2,
- 44, 3, 38, 21, 51, 32, 22, 42, 43, 23,
- 34, 39, 24, 25, 26, 27, 46, 47, 48, 28,
- 10, 11, 59, 60, 61, 62, 12, -4, 1, 2,
- 63, 3, 2, 4, 3, 51, 4, 68, 69, 5,
- 64, 65, 6, 7, 66, 75, 67, 54, 8, 9,
- 10, 11, 73, 10, 11, 71, 12, 76, -4, 12,
- 40, 41, 42, 43, 40, 41, 42, 43, 24, 58,
- 26, 57, 53, 0, 72, 52, 40, 41, 42, 43
+ 33, 60, 35, 36, 37, 31, 40, 41, 61, 32,
+ 49, 42, 54, 34, 2, 55, 3, 38, 4, 47,
+ 48, 56, 24, 2, 26, 3, 39, 51, 52, 57,
+ 53, 74, 64, 65, 66, 67, 68, 69, 70, 71,
+ 72, 10, 11, 75, 76, 77, 83, 56, 78, 12,
+ 10, 11, 79, 80, -4, 1, 87, 88, 12, 2,
+ 63, 3, 84, 4, 0, 81, 5, 58, 0, 6,
+ 7, 0, 0, 0, 85, 8, 9, 0, 0, 0,
+ 59, 0, 0, 0, 0, 0, 10, 11, 0, 0,
+ 0, -4, 40, 41, 12, 0, 0, 42, 0, 43,
+ 44, 45, 46, 40, 41, 47, 48, 0, 42, 0,
+ 43, 44, 45, 46, 0, 21, 47, 48, 22, 62,
+ 0, 23, 0, 0, 24, 25, 26, 27, 40, 41,
+ 0, 28, 0, 42, 73, 43, 44, 45, 46, 40,
+ 41, 47, 48, 0, 42, 0, 43, 44, 45, 46,
+ 40, 41, 47, 48, 0, 42, 0, 0, 0, 45,
+ 46, 0, 0, 47, 48
};
static const yytype_int8 yycheck[] =
{
- 8, 8, 10, 11, 12, 8, 24, 25, 11, 5,
- 18, 7, 0, 8, 17, 7, 11, 28, 29, 14,
- 7, 31, 17, 18, 19, 20, 8, 8, 17, 24,
- 26, 27, 40, 41, 42, 43, 32, 0, 1, 5,
- 23, 7, 5, 9, 7, 17, 9, 55, 56, 12,
- 8, 8, 15, 16, 8, 10, 7, 13, 21, 22,
- 26, 27, 70, 26, 27, 31, 32, 9, 31, 32,
- 26, 27, 28, 29, 26, 27, 28, 29, 17, 39,
- 19, 33, 29, -1, 70, 24, 26, 27, 28, 29
+ 8, 24, 10, 11, 12, 8, 25, 26, 31, 7,
+ 18, 30, 8, 7, 5, 11, 7, 0, 9, 38,
+ 39, 17, 17, 5, 19, 7, 37, 8, 8, 24,
+ 17, 23, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 32, 33, 8, 8, 8, 37, 17, 7, 40,
+ 32, 33, 60, 61, 0, 1, 10, 9, 40, 5,
+ 39, 7, 82, 9, -1, 73, 12, 29, -1, 15,
+ 16, -1, -1, -1, 82, 21, 22, -1, -1, -1,
+ 13, -1, -1, -1, -1, -1, 32, 33, -1, -1,
+ -1, 37, 25, 26, 40, -1, -1, 30, -1, 32,
+ 33, 34, 35, 25, 26, 38, 39, -1, 30, -1,
+ 32, 33, 34, 35, -1, 8, 38, 39, 11, 41,
+ -1, 14, -1, -1, 17, 18, 19, 20, 25, 26,
+ -1, 24, -1, 30, 31, 32, 33, 34, 35, 25,
+ 26, 38, 39, -1, 30, -1, 32, 33, 34, 35,
+ 25, 26, 38, 39, -1, 30, -1, -1, -1, 34,
+ 35, -1, -1, 38, 39
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -612,13 +650,14 @@ static const yytype_int8 yycheck[] =
static const yytype_uint8 yystos[] =
{
0, 1, 5, 7, 9, 12, 15, 16, 21, 22,
- 26, 27, 32, 35, 36, 37, 38, 39, 41, 44,
- 45, 8, 11, 14, 17, 18, 19, 20, 24, 46,
- 47, 8, 7, 39, 7, 39, 39, 39, 0, 31,
- 26, 27, 28, 29, 39, 40, 8, 8, 17, 8,
- 11, 17, 24, 47, 13, 24, 25, 33, 35, 39,
- 39, 39, 39, 23, 8, 8, 8, 7, 39, 39,
- 43, 31, 38, 39, 42, 10, 9
+ 32, 33, 40, 43, 44, 45, 46, 47, 49, 52,
+ 53, 8, 11, 14, 17, 18, 19, 20, 24, 54,
+ 55, 8, 7, 47, 7, 47, 47, 47, 0, 37,
+ 25, 26, 30, 32, 33, 34, 35, 38, 39, 47,
+ 48, 8, 8, 17, 8, 11, 17, 24, 55, 13,
+ 24, 31, 41, 43, 47, 47, 47, 47, 47, 47,
+ 47, 47, 47, 31, 23, 8, 8, 8, 7, 47,
+ 47, 47, 51, 37, 46, 47, 50, 10, 9
};
#define yyerrok (yyerrstatus = 0)
@@ -1433,42 +1472,42 @@ yyreduce:
switch (yyn)
{
case 6:
-#line 95 "engines/director/lingo/lingo-gr.y"
+#line 96 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_xpop); ;}
break;
case 8:
-#line 97 "engines/director/lingo/lingo-gr.y"
+#line 98 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_printtop); ;}
break;
case 9:
-#line 98 "engines/director/lingo/lingo-gr.y"
+#line 99 "engines/director/lingo/lingo-gr.y"
{ yyerrok; ;}
break;
case 11:
-#line 102 "engines/director/lingo/lingo-gr.y"
+#line 103 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
break;
case 12:
-#line 103 "engines/director/lingo/lingo-gr.y"
+#line 104 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 13:
-#line 104 "engines/director/lingo/lingo-gr.y"
+#line 105 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 14:
-#line 107 "engines/director/lingo/lingo-gr.y"
+#line 108 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_xpop); ;}
break;
case 15:
-#line 108 "engines/director/lingo/lingo-gr.y"
+#line 109 "engines/director/lingo/lingo-gr.y"
{
inst then, end;
WRITE_LE_UINT32(&then, (yyvsp[(4) - (7)].code));
@@ -1478,153 +1517,183 @@ yyreduce:
break;
case 16:
-#line 116 "engines/director/lingo/lingo-gr.y"
+#line 117 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
break;
case 17:
-#line 117 "engines/director/lingo/lingo-gr.y"
+#line 118 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
case 18:
-#line 118 "engines/director/lingo/lingo-gr.y"
+#line 119 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_add); ;}
break;
case 19:
-#line 119 "engines/director/lingo/lingo-gr.y"
+#line 120 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_sub); ;}
break;
case 20:
-#line 120 "engines/director/lingo/lingo-gr.y"
+#line 121 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mul); ;}
break;
case 21:
-#line 121 "engines/director/lingo/lingo-gr.y"
+#line 122 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_div); ;}
break;
case 22:
-#line 122 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+#line 123 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_gt); ;}
break;
case 23:
-#line 123 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
+#line 124 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_lt); ;}
break;
case 24:
-#line 124 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+#line 125 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_neq); ;}
break;
case 25:
-#line 127 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(STOP); ;}
+#line 126 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_ge); ;}
break;
case 26:
-#line 129 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->code1(g_lingo->func_ifcode); g_lingo->code3(STOP,STOP,STOP); ;}
+#line 127 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_le); ;}
break;
case 27:
-#line 131 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
+#line 128 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 28:
+#line 129 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
+ break;
+
+ case 29:
+#line 130 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+ break;
+
+ case 30:
#line 133 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->_currentScript->size(); ;}
+ { g_lingo->code1(STOP); ;}
break;
case 31:
-#line 138 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+#line 134 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code2(g_lingo->func_eq, STOP); ;}
break;
case 32:
-#line 139 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+#line 136 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = g_lingo->code1(g_lingo->func_ifcode); g_lingo->code3(STOP,STOP,STOP); ;}
break;
case 33:
+#line 138 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
+ break;
+
+ case 34:
#line 140 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = g_lingo->_currentScript->size(); ;}
+ break;
+
+ case 37:
+#line 145 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 38:
+#line 146 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 39:
+#line 147 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_printtop); ;}
break;
- case 35:
-#line 152 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 159 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_gotoloop); ;}
break;
- case 36:
-#line 153 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 160 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_gotonext); ;}
break;
- case 37:
-#line 154 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 161 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_gotoprevious); ;}
break;
- case 38:
-#line 155 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 162 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 39:
-#line 156 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 163 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
break;
- case 40:
-#line 157 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 164 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 41:
-#line 160 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 167 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 42:
-#line 161 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 168 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 43:
-#line 162 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 169 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 44:
-#line 163 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 170 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 45:
-#line 166 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 173 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 46:
-#line 167 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 174 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 47:
-#line 168 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 175 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1628 "engines/director/lingo/lingo-gr.cpp"
+#line 1697 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1838,6 +1907,6 @@ yyreturn:
}
-#line 198 "engines/director/lingo/lingo-gr.y"
+#line 205 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 6261f6c..6f59a5f 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -60,7 +60,13 @@
tPUT = 276,
tSET = 277,
tTHEN = 278,
- tTO = 279
+ tTO = 279,
+ tGE = 280,
+ tLE = 281,
+ tGT = 282,
+ tLT = 283,
+ tEQ = 284,
+ tNEQ = 285
};
#endif
/* Tokens. */
@@ -86,6 +92,12 @@
#define tSET 277
#define tTHEN 278
#define tTO 279
+#define tGE 280
+#define tLE 281
+#define tGT 282
+#define tLT 283
+#define tEQ 284
+#define tNEQ 285
@@ -100,7 +112,7 @@ typedef union YYSTYPE
int code;
}
/* Line 1529 of yacc.c. */
-#line 104 "engines/director/lingo/lingo-gr.hpp"
+#line 116 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 76a706a..1bf3c9e 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -75,6 +75,7 @@ using namespace Director;
%token<s> VAR STRING
%token tIF tEND tFRAME tGO tINTO tLOOP tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS
%token tPUT tSET tTHEN tTO
+%token tGE tLE tGT tLT tEQ tNEQ
%type<code> assign cond expr if end stmtlist
%type<s> gotoframe gotomovie
@@ -119,12 +120,18 @@ expr: INT { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT3
| expr '-' expr { g_lingo->code1(g_lingo->func_sub); }
| expr '*' expr { g_lingo->code1(g_lingo->func_mul); }
| expr '/' expr { g_lingo->code1(g_lingo->func_div); }
+ | expr '>' expr { g_lingo->code1(g_lingo->func_gt); }
+ | expr '<' expr { g_lingo->code1(g_lingo->func_lt); }
+ | expr tNEQ expr { g_lingo->code1(g_lingo->func_neq); }
+ | expr tGE expr { g_lingo->code1(g_lingo->func_ge); }
+ | expr tLE expr { g_lingo->code1(g_lingo->func_le); }
| '+' expr %prec UNARY { $$ = $2; }
| '-' expr %prec UNARY { $$ = $2; g_lingo->code1(g_lingo->func_negate); }
| '(' expr ')' { $$ = $2; }
;
-cond: expr { g_lingo->code1(STOP); }
+cond: expr { g_lingo->code1(STOP); }
+ | expr '=' expr { g_lingo->code2(g_lingo->func_eq, STOP); }
;
if: tIF { $$ = g_lingo->code1(g_lingo->func_ifcode); g_lingo->code3(STOP,STOP,STOP); }
;
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index ef0fe50..1bde391 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 26
-#define YY_END_OF_BUFFER 27
+#define YY_NUM_RULES 29
+#define YY_END_OF_BUFFER 30
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,16 +373,17 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[79] =
+static yyconst flex_int16_t yy_accept[85] =
{ 0,
- 0, 0, 27, 26, 3, 24, 26, 23, 23, 22,
- 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 2, 2, 3, 24, 0, 25, 1, 21,
- 22, 20, 20, 20, 7, 4, 20, 20, 20, 20,
- 20, 14, 20, 20, 20, 20, 19, 1, 21, 5,
- 20, 20, 20, 10, 20, 20, 20, 16, 17, 20,
- 20, 8, 9, 20, 20, 13, 20, 18, 6, 20,
- 12, 20, 20, 20, 11, 20, 15, 0
+ 0, 0, 30, 29, 3, 27, 29, 29, 26, 26,
+ 25, 26, 26, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 2, 2, 3, 27, 20,
+ 0, 28, 1, 24, 25, 22, 21, 23, 23, 23,
+ 7, 4, 23, 23, 23, 23, 23, 14, 23, 23,
+ 23, 23, 19, 1, 24, 5, 23, 23, 23, 10,
+ 23, 23, 23, 16, 17, 23, 23, 8, 9, 23,
+ 23, 13, 23, 18, 6, 23, 12, 23, 23, 23,
+ 11, 23, 15, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -390,17 +391,17 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 5, 1, 6, 1, 1, 7, 1, 1, 7,
- 7, 7, 7, 7, 8, 9, 7, 10, 10, 10,
- 10, 10, 10, 10, 10, 10, 10, 7, 1, 1,
- 7, 1, 1, 1, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
- 1, 1, 1, 7, 11, 1, 12, 11, 13, 14,
-
- 15, 16, 17, 18, 19, 11, 11, 20, 21, 22,
- 23, 24, 11, 25, 26, 27, 28, 29, 30, 31,
- 11, 11, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 5, 6, 7, 1, 1, 8, 1, 1, 8,
+ 8, 8, 8, 8, 9, 10, 8, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 8, 1, 12,
+ 13, 14, 1, 1, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ 1, 1, 1, 8, 15, 1, 16, 15, 17, 18,
+
+ 19, 20, 21, 22, 23, 15, 15, 24, 25, 26,
+ 27, 28, 15, 29, 30, 31, 32, 33, 34, 35,
+ 15, 15, 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,
@@ -417,76 +418,78 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[32] =
+static yyconst flex_int32_t yy_meta[36] =
{ 0,
- 1, 1, 2, 3, 1, 1, 1, 1, 1, 4,
+ 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
} ;
-static yyconst flex_int16_t yy_base[82] =
+static yyconst flex_int16_t yy_base[88] =
{ 0,
- 0, 30, 99, 100, 96, 30, 91, 100, 88, 27,
- 0, 73, 69, 70, 22, 69, 26, 76, 74, 15,
- 74, 23, 86, 100, 85, 44, 80, 100, 0, 75,
- 41, 0, 70, 71, 0, 0, 55, 58, 61, 50,
- 47, 0, 62, 49, 48, 59, 0, 0, 63, 0,
- 51, 48, 46, 39, 49, 40, 37, 0, 0, 43,
- 49, 0, 0, 51, 47, 0, 42, 0, 0, 41,
- 0, 35, 30, 25, 0, 19, 0, 100, 51, 38,
- 55
+ 0, 34, 106, 107, 103, 34, 91, 96, 107, 93,
+ 30, 88, 87, 0, 73, 69, 70, 22, 69, 26,
+ 76, 74, 15, 74, 23, 90, 107, 89, 48, 107,
+ 83, 107, 0, 78, 44, 107, 107, 0, 70, 71,
+ 0, 0, 55, 58, 61, 50, 47, 0, 62, 49,
+ 48, 59, 0, 0, 66, 0, 51, 48, 46, 39,
+ 49, 40, 37, 0, 0, 43, 49, 0, 0, 51,
+ 47, 0, 42, 0, 0, 41, 0, 35, 30, 25,
+ 0, 19, 0, 107, 55, 42, 59
} ;
-static yyconst flex_int16_t yy_def[82] =
+static yyconst flex_int16_t yy_def[88] =
{ 0,
- 78, 1, 78, 78, 78, 78, 79, 78, 78, 78,
- 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 78, 78, 78, 78, 79, 78, 81, 78,
- 78, 80, 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 81, 78, 80,
- 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
- 80, 80, 80, 80, 80, 80, 80, 0, 78, 78,
- 78
+ 84, 1, 84, 84, 84, 84, 84, 85, 84, 84,
+ 84, 84, 84, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 84, 84, 84, 84, 84,
+ 85, 84, 87, 84, 84, 84, 84, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 87, 84, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 0, 84, 84, 84
} ;
-static yyconst flex_int16_t yy_nxt[132] =
+static yyconst flex_int16_t yy_nxt[143] =
{ 0,
- 4, 5, 6, 6, 4, 7, 8, 9, 4, 10,
- 11, 11, 11, 11, 12, 13, 14, 11, 15, 16,
- 17, 18, 19, 20, 11, 21, 22, 11, 11, 11,
- 11, 23, 26, 26, 24, 30, 31, 36, 39, 43,
- 46, 32, 44, 37, 77, 47, 26, 26, 40, 30,
- 31, 27, 76, 27, 27, 48, 75, 74, 48, 73,
- 72, 71, 70, 69, 68, 67, 66, 65, 64, 63,
- 62, 61, 49, 60, 59, 58, 57, 56, 55, 54,
- 53, 52, 51, 50, 49, 28, 25, 25, 45, 42,
- 41, 38, 35, 34, 33, 29, 28, 25, 78, 3,
-
- 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
- 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
- 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
- 78
+ 4, 5, 6, 6, 4, 7, 8, 9, 10, 4,
+ 11, 12, 9, 13, 14, 14, 14, 14, 15, 16,
+ 17, 14, 18, 19, 20, 21, 22, 23, 14, 24,
+ 25, 14, 14, 14, 14, 26, 29, 29, 27, 34,
+ 35, 42, 45, 49, 52, 38, 50, 43, 83, 53,
+ 29, 29, 46, 34, 35, 31, 82, 31, 31, 54,
+ 81, 80, 54, 79, 78, 77, 76, 75, 74, 73,
+ 72, 71, 70, 69, 68, 67, 55, 66, 65, 64,
+ 63, 62, 61, 60, 59, 58, 57, 56, 55, 32,
+ 28, 28, 51, 48, 47, 44, 41, 40, 39, 37,
+
+ 36, 33, 32, 30, 28, 84, 3, 84, 84, 84,
+ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
+ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
+ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
+ 84, 84
} ;
-static yyconst flex_int16_t yy_chk[132] =
+static yyconst flex_int16_t yy_chk[143] =
{ 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, 2, 6, 6, 2, 10, 10, 15, 17, 20,
- 22, 80, 20, 15, 76, 22, 26, 26, 17, 31,
- 31, 79, 74, 79, 79, 81, 73, 72, 81, 70,
- 67, 65, 64, 61, 60, 57, 56, 55, 54, 53,
- 52, 51, 49, 46, 45, 44, 43, 41, 40, 39,
- 38, 37, 34, 33, 30, 27, 25, 23, 21, 19,
- 18, 16, 14, 13, 12, 9, 7, 5, 3, 78,
-
- 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
- 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
- 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
- 78
+ 1, 1, 1, 1, 1, 2, 6, 6, 2, 11,
+ 11, 18, 20, 23, 25, 86, 23, 18, 82, 25,
+ 29, 29, 20, 35, 35, 85, 80, 85, 85, 87,
+ 79, 78, 87, 76, 73, 71, 70, 67, 66, 63,
+ 62, 61, 60, 59, 58, 57, 55, 52, 51, 50,
+ 49, 47, 46, 45, 44, 43, 40, 39, 34, 31,
+ 28, 26, 24, 22, 21, 19, 17, 16, 15, 13,
+
+ 12, 10, 8, 7, 5, 3, 84, 84, 84, 84,
+ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
+ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
+ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
+ 84, 84
} ;
static yy_state_type yy_last_accepting_state;
@@ -536,7 +539,7 @@ char *yytext;
int yyparse();
-#line 540 "engines/director/lingo/lingo-lex.cpp"
+#line 543 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -724,7 +727,7 @@ YY_DECL
#line 45 "engines/director/lingo/lingo-lex.l"
-#line 728 "engines/director/lingo/lingo-lex.cpp"
+#line 731 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -778,13 +781,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 >= 79 )
+ if ( yy_current_state >= 85 )
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] != 100 );
+ while ( yy_base[yy_current_state] != 107 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -906,40 +909,55 @@ YY_RULE_SETUP
case 20:
YY_RULE_SETUP
#line 68 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+{ return tNEQ; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 69 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+{ return tGE; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 70 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ return tLE; }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 71 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+#line 72 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(yytext); return VAR; }
YY_BREAK
case 24:
-/* rule 24 can match eol */
YY_RULE_SETUP
-#line 72 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+#line 73 "engines/director/lingo/lingo-lex.l"
+{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 73 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+#line 74 "engines/director/lingo/lingo-lex.l"
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 75 "engines/director/lingo/lingo-lex.l"
+{ return *yytext; }
+ YY_BREAK
+case 27:
+/* rule 27 can match eol */
+YY_RULE_SETUP
+#line 76 "engines/director/lingo/lingo-lex.l"
+{ return '\n'; }
+ YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 77 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+ YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 79 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 943 "engines/director/lingo/lingo-lex.cpp"
+#line 961 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1232,7 +1250,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 >= 79 )
+ if ( yy_current_state >= 85 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1260,11 +1278,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 >= 79 )
+ if ( yy_current_state >= 85 )
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 == 78);
+ yy_is_jam = (yy_current_state == 84);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1939,7 +1957,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 75 "engines/director/lingo/lingo-lex.l"
+#line 79 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index a6e644a..2408b19 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -38,7 +38,7 @@ variable [_[:alpha:]][_[:alnum:]]*
constfloat [[:digit:]]+\.[[:digit:]]*
constinteger [[:digit:]]+
conststring \"[^\"\n]*\"
-operator [-+*/%=^:,()]
+operator [-+*/%=^:,()><]
newline [\n\r]+
whitespace [\t ]
@@ -65,6 +65,10 @@ set { return tSET; }
then { return tTHEN; }
to { return tTO; }
+[!][=] { return tNEQ; }
+[>][=] { return tGE; }
+[<][=] { return tLE; }
+
{variable} { yylval.s = new Common::String(yytext); return VAR; }
{constfloat} { yylval.f = atof(yytext); return FLOAT; }
{constinteger} { yylval.i = strtol(yytext, NULL, 10); return INT; }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index d4a1190..aabf010 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -133,6 +133,12 @@ public:
bool verify(Symbol *s);
static void func_eval();
static void func_ifcode();
+ static void func_eq();
+ static void func_neq();
+ static void func_gt();
+ static void func_lt();
+ static void func_ge();
+ static void func_le();
static void func_mci();
static void func_mciwait();
Commit: 34acb99ec53684a37a035244b602c62868027497
https://github.com/scummvm/scummvm/commit/34acb99ec53684a37a035244b602c62868027497
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix 'if' statement
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 1ba7e96..8733bc9 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -84,7 +84,12 @@ go to \"Chair\"\n\
set x = 2 + 3 * (4 / 2)\n\
put x\n", kMovieScript, 2);
- _lingo->executeScript(kMovieScript, 2);
+_lingo->addCode("set x = 5\n\
+if 4 > 3 then x end if\n", kMovieScript, 3);
+
+ _lingo->executeScript(kMovieScript, 3);
+
+ return Common::kNoError;
//FIXME
_mainArchive = new RIFFArchive();
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 3e3d885..f9f2e5c 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -394,17 +394,25 @@ void Lingo::func_ifcode() {
Datum d;
int savepc = g_lingo->_pc; /* then part */
+ int then = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc]);
+ int elsep = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
+ int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
+
+ warning("cond: %d end: %d then: %d elesp: %d", savepc + 3, end, then, elsep);
+
g_lingo->execute(savepc + 3); /* condition */
d = g_lingo->pop();
+ warning("res: %d", d.val);
- if (d.val)
- g_lingo->execute(savepc);
- else if ((*g_lingo->_currentScript)[savepc + 1]) /* else part? */
- g_lingo->execute(savepc + 1);
+ if (d.val) {
+ g_lingo->execute(then);
+ } else if (elsep) { /* else part? */
+ g_lingo->execute(elsep);
+ }
//if (!returning)
- g_lingo->_pc = savepc + 2; /* next stmt */
+ g_lingo->_pc = end; /* next stmt */
}
//************************
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 0e69b67..b24c43e 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -141,7 +141,7 @@
extern int yylex();
extern int yyparse();
-void yyerror(char *s) { warning("%s", s); }
+void yyerror(char *s) { error("%s", s); }
using namespace Director;
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 1bf3c9e..d1e5d39 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -56,7 +56,7 @@
extern int yylex();
extern int yyparse();
-void yyerror(char *s) { warning("%s", s); }
+void yyerror(char *s) { error("%s", s); }
using namespace Director;
Commit: f2920602e52eb8b8c8c8cb783c95811952a4c0da
https://github.com/scummvm/scummvm/commit/f2920602e52eb8b8c8c8cb783c95811952a4c0da
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Make 'if' statement functional. Added 'if-else' statement.
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 8733bc9..dd1433b 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -85,7 +85,13 @@ set x = 2 + 3 * (4 / 2)\n\
put x\n", kMovieScript, 2);
_lingo->addCode("set x = 5\n\
-if 4 > 3 then x end if\n", kMovieScript, 3);
+if x <= 5 then set x = 6 end if\n\
+if (x = 5) then\n\
+ set x = 7\n\
+else\n\
+ set x = 8\n\
+end if\n\
+put x", kMovieScript, 3);
_lingo->executeScript(kMovieScript, 3);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index b24c43e..c182f3f 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -73,27 +73,28 @@
VAR = 262,
STRING = 263,
tIF = 264,
- tEND = 265,
- tFRAME = 266,
- tGO = 267,
- tINTO = 268,
- tLOOP = 269,
- tMCI = 270,
- tMCIWAIT = 271,
- tMOVIE = 272,
- tNEXT = 273,
- tOF = 274,
- tPREVIOUS = 275,
- tPUT = 276,
- tSET = 277,
- tTHEN = 278,
- tTO = 279,
- tGE = 280,
- tLE = 281,
- tGT = 282,
- tLT = 283,
- tEQ = 284,
- tNEQ = 285
+ tELSE = 265,
+ tEND = 266,
+ tFRAME = 267,
+ tGO = 268,
+ tINTO = 269,
+ tLOOP = 270,
+ tMCI = 271,
+ tMCIWAIT = 272,
+ tMOVIE = 273,
+ tNEXT = 274,
+ tOF = 275,
+ tPREVIOUS = 276,
+ tPUT = 277,
+ tSET = 278,
+ tTHEN = 279,
+ tTO = 280,
+ tGE = 281,
+ tLE = 282,
+ tGT = 283,
+ tLT = 284,
+ tEQ = 285,
+ tNEQ = 286
};
#endif
/* Tokens. */
@@ -104,27 +105,28 @@
#define VAR 262
#define STRING 263
#define tIF 264
-#define tEND 265
-#define tFRAME 266
-#define tGO 267
-#define tINTO 268
-#define tLOOP 269
-#define tMCI 270
-#define tMCIWAIT 271
-#define tMOVIE 272
-#define tNEXT 273
-#define tOF 274
-#define tPREVIOUS 275
-#define tPUT 276
-#define tSET 277
-#define tTHEN 278
-#define tTO 279
-#define tGE 280
-#define tLE 281
-#define tGT 282
-#define tLT 283
-#define tEQ 284
-#define tNEQ 285
+#define tELSE 265
+#define tEND 266
+#define tFRAME 267
+#define tGO 268
+#define tINTO 269
+#define tLOOP 270
+#define tMCI 271
+#define tMCIWAIT 272
+#define tMOVIE 273
+#define tNEXT 274
+#define tOF 275
+#define tPREVIOUS 276
+#define tPUT 277
+#define tSET 278
+#define tTHEN 279
+#define tTO 280
+#define tGE 281
+#define tLE 282
+#define tGT 283
+#define tLT 284
+#define tEQ 285
+#define tNEQ 286
@@ -175,7 +177,7 @@ typedef union YYSTYPE
int code;
}
/* Line 193 of yacc.c. */
-#line 179 "engines/director/lingo/lingo-gr.cpp"
+#line 181 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -188,7 +190,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 192 "engines/director/lingo/lingo-gr.cpp"
+#line 194 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -401,22 +403,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 38
+#define YYFINAL 40
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 164
+#define YYLAST 205
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 42
+#define YYNTOKENS 43
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 14
/* YYNRULES -- Number of rules. */
-#define YYNRULES 53
+#define YYNRULES 56
/* YYNRULES -- Number of states. */
-#define YYNSTATES 89
+#define YYNSTATES 101
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 285
+#define YYMAXUTOK 286
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -425,12 +427,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 37, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 38, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 36, 2, 2,
- 40, 41, 34, 32, 2, 33, 2, 35, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 37, 2, 2,
+ 41, 42, 35, 33, 2, 34, 2, 36, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 39, 31, 38, 2, 2, 2, 2, 2, 2, 2,
+ 40, 32, 39, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -452,7 +454,7 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30
+ 25, 26, 27, 28, 29, 30, 31
};
#if YYDEBUG
@@ -461,44 +463,46 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
- 20, 21, 26, 31, 36, 38, 46, 48, 50, 54,
- 58, 62, 66, 70, 74, 78, 82, 86, 89, 92,
- 96, 98, 102, 104, 105, 106, 109, 112, 115, 118,
- 121, 123, 126, 129, 132, 135, 139, 142, 146, 149,
- 152, 154, 158, 161
+ 20, 21, 26, 31, 36, 38, 46, 57, 59, 61,
+ 63, 67, 71, 75, 79, 83, 87, 91, 95, 99,
+ 102, 105, 109, 111, 115, 119, 121, 122, 123, 126,
+ 129, 132, 135, 138, 140, 143, 146, 149, 152, 156,
+ 159, 163, 166, 169, 171, 175, 178
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 43, 0, -1, 44, 37, 43, -1, 44, -1, -1,
- 52, -1, 45, -1, 46, -1, 47, -1, 1, -1,
- -1, 21, 47, 13, 7, -1, 22, 7, 31, 47,
- -1, 22, 7, 24, 47, -1, 47, -1, 49, 48,
- 23, 51, 50, 10, 9, -1, 5, -1, 7, -1,
- 47, 32, 47, -1, 47, 33, 47, -1, 47, 34,
- 47, -1, 47, 35, 47, -1, 47, 38, 47, -1,
- 47, 39, 47, -1, 47, 30, 47, -1, 47, 25,
- 47, -1, 47, 26, 47, -1, 32, 47, -1, 33,
- 47, -1, 40, 47, 41, -1, 47, -1, 47, 31,
- 47, -1, 9, -1, -1, -1, 51, 37, -1, 51,
- 46, -1, 15, 8, -1, 16, 7, -1, 21, 47,
- -1, 53, -1, 12, 14, -1, 12, 18, -1, 12,
- 20, -1, 12, 54, -1, 12, 54, 55, -1, 12,
- 55, -1, 24, 11, 8, -1, 11, 8, -1, 24,
- 8, -1, 8, -1, 19, 17, 8, -1, 17, 8,
- -1, 24, 17, 8, -1
+ 44, 0, -1, 45, 38, 44, -1, 45, -1, -1,
+ 53, -1, 46, -1, 47, -1, 48, -1, 1, -1,
+ -1, 22, 48, 14, 7, -1, 23, 7, 32, 48,
+ -1, 23, 7, 25, 48, -1, 48, -1, 50, 49,
+ 24, 52, 51, 11, 9, -1, 50, 49, 24, 52,
+ 51, 10, 52, 51, 11, 9, -1, 5, -1, 7,
+ -1, 46, -1, 48, 33, 48, -1, 48, 34, 48,
+ -1, 48, 35, 48, -1, 48, 36, 48, -1, 48,
+ 39, 48, -1, 48, 40, 48, -1, 48, 31, 48,
+ -1, 48, 26, 48, -1, 48, 27, 48, -1, 33,
+ 48, -1, 34, 48, -1, 41, 48, 42, -1, 48,
+ -1, 48, 32, 48, -1, 41, 49, 42, -1, 9,
+ -1, -1, -1, 52, 38, -1, 52, 47, -1, 16,
+ 8, -1, 17, 7, -1, 22, 48, -1, 54, -1,
+ 13, 15, -1, 13, 19, -1, 13, 21, -1, 13,
+ 55, -1, 13, 55, 56, -1, 13, 56, -1, 25,
+ 12, 8, -1, 12, 8, -1, 25, 8, -1, 8,
+ -1, 20, 18, 8, -1, 18, 8, -1, 25, 18,
+ 8, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
0, 90, 90, 91, 94, 95, 96, 97, 98, 99,
- 100, 103, 104, 105, 108, 109, 117, 118, 119, 120,
- 121, 122, 123, 124, 125, 126, 127, 128, 129, 130,
- 133, 134, 136, 138, 140, 141, 142, 145, 146, 147,
- 148, 159, 160, 161, 162, 163, 164, 167, 168, 169,
- 170, 173, 174, 175
+ 100, 103, 104, 105, 108, 109, 115, 125, 126, 127,
+ 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
+ 138, 139, 142, 143, 144, 146, 148, 150, 151, 152,
+ 155, 156, 157, 158, 169, 170, 171, 172, 173, 174,
+ 177, 178, 179, 180, 183, 184, 185
};
#endif
@@ -508,11 +512,11 @@ static const yytype_uint8 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "UNARY", "UNDEF", "INT", "FLOAT", "VAR",
- "STRING", "tIF", "tEND", "tFRAME", "tGO", "tINTO", "tLOOP", "tMCI",
- "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tSET",
- "tTHEN", "tTO", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'",
- "'-'", "'*'", "'/'", "'%'", "'\\n'", "'>'", "'<'", "'('", "')'",
- "$accept", "program", "programline", "assign", "stmt", "expr", "cond",
+ "STRING", "tIF", "tELSE", "tEND", "tFRAME", "tGO", "tINTO", "tLOOP",
+ "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT",
+ "tSET", "tTHEN", "tTO", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='",
+ "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'>'", "'<'", "'('", "')'",
+ "$accept", "program", "programline", "asgn", "stmt", "expr", "cond",
"if", "end", "stmtlist", "func", "gotofunc", "gotoframe", "gotomovie", 0
};
#endif
@@ -525,31 +529,31 @@ static const yytype_uint16 yytoknum[] =
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 61, 43, 45, 42, 47, 37, 10, 62, 60,
- 40, 41
+ 285, 286, 61, 43, 45, 42, 47, 37, 10, 62,
+ 60, 40, 41
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 42, 43, 43, 44, 44, 44, 44, 44, 44,
- 44, 45, 45, 45, 46, 46, 47, 47, 47, 47,
- 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
- 48, 48, 49, 50, 51, 51, 51, 52, 52, 52,
- 52, 53, 53, 53, 53, 53, 53, 54, 54, 54,
- 54, 55, 55, 55
+ 0, 43, 44, 44, 45, 45, 45, 45, 45, 45,
+ 45, 46, 46, 46, 47, 47, 47, 48, 48, 48,
+ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
+ 48, 48, 49, 49, 49, 50, 51, 52, 52, 52,
+ 53, 53, 53, 53, 54, 54, 54, 54, 54, 54,
+ 55, 55, 55, 55, 56, 56, 56
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 0, 4, 4, 4, 1, 7, 1, 1, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 2, 2, 3,
- 1, 3, 1, 0, 0, 2, 2, 2, 2, 2,
- 1, 2, 2, 2, 2, 3, 2, 3, 2, 2,
- 1, 3, 2, 3
+ 0, 4, 4, 4, 1, 7, 10, 1, 1, 1,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
+ 2, 3, 1, 3, 3, 1, 0, 0, 2, 2,
+ 2, 2, 2, 1, 2, 2, 2, 2, 3, 2,
+ 3, 2, 2, 1, 3, 2, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -557,107 +561,121 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 9, 16, 17, 32, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 3, 6, 7, 8, 0, 5,
- 40, 50, 0, 41, 0, 42, 0, 43, 0, 44,
- 46, 37, 38, 39, 0, 27, 28, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 30,
- 0, 48, 52, 0, 49, 0, 0, 0, 45, 0,
- 0, 0, 29, 2, 25, 26, 24, 18, 19, 20,
- 21, 22, 23, 0, 34, 51, 47, 53, 11, 13,
- 12, 31, 33, 35, 36, 14, 0, 0, 15
+ 0, 9, 17, 18, 35, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 19, 7, 8, 0, 5,
+ 43, 53, 0, 44, 0, 45, 0, 46, 0, 47,
+ 49, 40, 41, 0, 19, 42, 0, 29, 30, 0,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 32, 0, 51, 55, 0, 52, 0, 0,
+ 0, 48, 0, 0, 0, 0, 31, 2, 27, 28,
+ 26, 20, 21, 22, 23, 24, 25, 0, 0, 0,
+ 37, 54, 50, 56, 11, 13, 12, 34, 33, 36,
+ 38, 39, 14, 0, 37, 0, 36, 15, 0, 0,
+ 16
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 13, 14, 15, 16, 17, 50, 18, 86, 82,
+ -1, 13, 14, 34, 16, 17, 53, 18, 93, 89,
19, 20, 29, 30
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -24
-static const yytype_int8 yypact[] =
+#define YYPACT_NINF -42
+static const yytype_int16 yypact[] =
{
- 54, -24, -24, -24, -24, 107, -3, 2, 18, 6,
- 18, 18, 18, 17, -11, -24, -24, 114, 18, -24,
- -24, -24, 19, -24, 20, -24, 13, -24, 4, 5,
- -24, -24, -24, 67, -23, -19, -19, 78, -24, 54,
- 18, 18, 18, 18, 18, 18, 18, 18, 18, 103,
- 8, -24, -24, 35, -24, 36, 37, 30, -24, 41,
- 18, 18, -24, -24, 114, 114, 114, 125, 125, -19,
- -19, 114, 114, 18, -24, -24, -24, -24, -24, 114,
- 114, 114, 9, -24, -24, 114, 46, 48, -24
+ 45, -42, -42, -42, -42, 107, 0, 5, 70, 9,
+ 70, 70, 70, 7, -7, 11, -42, 148, 90, -42,
+ -42, -42, 22, -42, 24, -42, 15, -42, -3, -1,
+ -42, -42, -42, 70, -42, -13, 19, 165, 165, 120,
+ -42, 45, 70, 70, 70, 70, 70, 70, 70, 70,
+ 70, 90, 137, 29, -42, -42, 51, -42, 52, 55,
+ 46, -42, -13, 58, 70, 70, -42, -42, 148, 148,
+ 148, 159, 159, 165, 165, 148, 148, 103, 27, 70,
+ -42, -42, -42, -42, -42, 148, 148, -42, 148, 67,
+ -42, -42, 148, 18, -42, 57, 67, -42, 59, 64,
+ -42
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -24, 21, -24, -24, -20, -8, -24, -24, -24, -24,
- -24, -24, -24, 38
+ -42, 39, -42, 6, -41, -8, 31, -42, -12, -9,
+ -42, -42, -42, 62
};
/* 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 -5
+#define YYTABLE_NINF -7
static const yytype_int8 yytable[] =
{
- 33, 60, 35, 36, 37, 31, 40, 41, 61, 32,
- 49, 42, 54, 34, 2, 55, 3, 38, 4, 47,
- 48, 56, 24, 2, 26, 3, 39, 51, 52, 57,
- 53, 74, 64, 65, 66, 67, 68, 69, 70, 71,
- 72, 10, 11, 75, 76, 77, 83, 56, 78, 12,
- 10, 11, 79, 80, -4, 1, 87, 88, 12, 2,
- 63, 3, 84, 4, 0, 81, 5, 58, 0, 6,
- 7, 0, 0, 0, 85, 8, 9, 0, 0, 0,
- 59, 0, 0, 0, 0, 0, 10, 11, 0, 0,
- 0, -4, 40, 41, 12, 0, 0, 42, 0, 43,
- 44, 45, 46, 40, 41, 47, 48, 0, 42, 0,
- 43, 44, 45, 46, 0, 21, 47, 48, 22, 62,
- 0, 23, 0, 0, 24, 25, 26, 27, 40, 41,
- 0, 28, 0, 42, 73, 43, 44, 45, 46, 40,
- 41, 47, 48, 0, 42, 0, 43, 44, 45, 46,
- 40, 41, 47, 48, 0, 42, 0, 0, 0, 45,
- 46, 0, 0, 47, 48
+ 35, 63, 37, 38, 39, 57, 15, 40, 31, 58,
+ 52, -6, 32, 42, 43, 59, 36, 24, 44, 26,
+ 45, 46, 47, 48, 60, 62, 49, 50, 94, 95,
+ 54, 41, 55, 56, 68, 69, 70, 71, 72, 73,
+ 74, 75, 76, 77, 64, -4, 1, 15, 91, -6,
+ 2, 65, 3, 80, 4, 91, 85, 86, 5, 81,
+ 82, 6, 7, 83, 59, 84, 97, 8, 9, 87,
+ 99, 88, 2, 100, 3, 2, 4, 3, 10, 11,
+ 67, 92, 78, -4, 98, 96, 12, 0, 92, 33,
+ 9, 61, 33, 9, 0, 2, 0, 3, 0, 0,
+ 10, 11, 0, 10, 11, 90, 0, 0, 12, 0,
+ 0, 12, 33, 9, 0, 21, 0, 0, 0, 22,
+ 0, 0, 23, 10, 11, 24, 25, 26, 27, 42,
+ 43, 51, 28, 0, 44, 79, 45, 46, 47, 48,
+ 0, 0, 49, 50, 0, 66, 42, 43, 0, 0,
+ 0, 44, 0, 45, 46, 47, 48, 0, 0, 49,
+ 50, 0, 66, 42, 43, 0, 0, 0, 44, 79,
+ 45, 46, 47, 48, 42, 43, 49, 50, 0, 44,
+ 0, 45, 46, 47, 48, 42, 43, 49, 50, 0,
+ 44, 42, 43, 0, 47, 48, 44, 0, 49, 50,
+ 0, 0, 0, 0, 49, 50
};
static const yytype_int8 yycheck[] =
{
- 8, 24, 10, 11, 12, 8, 25, 26, 31, 7,
- 18, 30, 8, 7, 5, 11, 7, 0, 9, 38,
- 39, 17, 17, 5, 19, 7, 37, 8, 8, 24,
- 17, 23, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 32, 33, 8, 8, 8, 37, 17, 7, 40,
- 32, 33, 60, 61, 0, 1, 10, 9, 40, 5,
- 39, 7, 82, 9, -1, 73, 12, 29, -1, 15,
- 16, -1, -1, -1, 82, 21, 22, -1, -1, -1,
- 13, -1, -1, -1, -1, -1, 32, 33, -1, -1,
- -1, 37, 25, 26, 40, -1, -1, 30, -1, 32,
- 33, 34, 35, 25, 26, 38, 39, -1, 30, -1,
- 32, 33, 34, 35, -1, 8, 38, 39, 11, 41,
- -1, 14, -1, -1, 17, 18, 19, 20, 25, 26,
- -1, 24, -1, 30, 31, 32, 33, 34, 35, 25,
- 26, 38, 39, -1, 30, -1, 32, 33, 34, 35,
- 25, 26, 38, 39, -1, 30, -1, -1, -1, 34,
- 35, -1, -1, 38, 39
+ 8, 14, 10, 11, 12, 8, 0, 0, 8, 12,
+ 18, 0, 7, 26, 27, 18, 7, 18, 31, 20,
+ 33, 34, 35, 36, 25, 33, 39, 40, 10, 11,
+ 8, 38, 8, 18, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 25, 0, 1, 41, 89, 38,
+ 5, 32, 7, 24, 9, 96, 64, 65, 13, 8,
+ 8, 16, 17, 8, 18, 7, 9, 22, 23, 42,
+ 11, 79, 5, 9, 7, 5, 9, 7, 33, 34,
+ 41, 89, 51, 38, 96, 94, 41, -1, 96, 22,
+ 23, 29, 22, 23, -1, 5, -1, 7, -1, -1,
+ 33, 34, -1, 33, 34, 38, -1, -1, 41, -1,
+ -1, 41, 22, 23, -1, 8, -1, -1, -1, 12,
+ -1, -1, 15, 33, 34, 18, 19, 20, 21, 26,
+ 27, 41, 25, -1, 31, 32, 33, 34, 35, 36,
+ -1, -1, 39, 40, -1, 42, 26, 27, -1, -1,
+ -1, 31, -1, 33, 34, 35, 36, -1, -1, 39,
+ 40, -1, 42, 26, 27, -1, -1, -1, 31, 32,
+ 33, 34, 35, 36, 26, 27, 39, 40, -1, 31,
+ -1, 33, 34, 35, 36, 26, 27, 39, 40, -1,
+ 31, 26, 27, -1, 35, 36, 31, -1, 39, 40,
+ -1, -1, -1, -1, 39, 40
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 5, 7, 9, 12, 15, 16, 21, 22,
- 32, 33, 40, 43, 44, 45, 46, 47, 49, 52,
- 53, 8, 11, 14, 17, 18, 19, 20, 24, 54,
- 55, 8, 7, 47, 7, 47, 47, 47, 0, 37,
- 25, 26, 30, 32, 33, 34, 35, 38, 39, 47,
- 48, 8, 8, 17, 8, 11, 17, 24, 55, 13,
- 24, 31, 41, 43, 47, 47, 47, 47, 47, 47,
- 47, 47, 47, 31, 23, 8, 8, 8, 7, 47,
- 47, 47, 51, 37, 46, 47, 50, 10, 9
+ 0, 1, 5, 7, 9, 13, 16, 17, 22, 23,
+ 33, 34, 41, 44, 45, 46, 47, 48, 50, 53,
+ 54, 8, 12, 15, 18, 19, 20, 21, 25, 55,
+ 56, 8, 7, 22, 46, 48, 7, 48, 48, 48,
+ 0, 38, 26, 27, 31, 33, 34, 35, 36, 39,
+ 40, 41, 48, 49, 8, 8, 18, 8, 12, 18,
+ 25, 56, 48, 14, 25, 32, 42, 44, 48, 48,
+ 48, 48, 48, 48, 48, 48, 48, 48, 49, 32,
+ 24, 8, 8, 8, 7, 48, 48, 42, 48, 52,
+ 38, 47, 48, 51, 10, 11, 52, 9, 51, 11,
+ 9
};
#define yyerrok (yyerrstatus = 0)
@@ -1517,183 +1535,195 @@ yyreduce:
break;
case 16:
-#line 117 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
+#line 115 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then, else1, end;
+ WRITE_LE_UINT32(&then, (yyvsp[(4) - (10)].code));
+ WRITE_LE_UINT32(&else1, (yyvsp[(7) - (10)].code));
+ WRITE_LE_UINT32(&end, (yyvsp[(8) - (10)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
break;
case 17:
-#line 118 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
+#line 125 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
break;
case 18:
-#line 119 "engines/director/lingo/lingo-gr.y"
+#line 126 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
+ break;
+
+ case 20:
+#line 128 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_add); ;}
break;
- case 19:
-#line 120 "engines/director/lingo/lingo-gr.y"
+ case 21:
+#line 129 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_sub); ;}
break;
- case 20:
-#line 121 "engines/director/lingo/lingo-gr.y"
+ case 22:
+#line 130 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mul); ;}
break;
- case 21:
-#line 122 "engines/director/lingo/lingo-gr.y"
+ case 23:
+#line 131 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_div); ;}
break;
- case 22:
-#line 123 "engines/director/lingo/lingo-gr.y"
+ case 24:
+#line 132 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_gt); ;}
break;
- case 23:
-#line 124 "engines/director/lingo/lingo-gr.y"
+ case 25:
+#line 133 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_lt); ;}
break;
- case 24:
-#line 125 "engines/director/lingo/lingo-gr.y"
+ case 26:
+#line 134 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_neq); ;}
break;
- case 25:
-#line 126 "engines/director/lingo/lingo-gr.y"
+ case 27:
+#line 135 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_ge); ;}
break;
- case 26:
-#line 127 "engines/director/lingo/lingo-gr.y"
+ case 28:
+#line 136 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_le); ;}
break;
- case 27:
-#line 128 "engines/director/lingo/lingo-gr.y"
+ case 29:
+#line 137 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 28:
-#line 129 "engines/director/lingo/lingo-gr.y"
+ case 30:
+#line 138 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
break;
- case 29:
-#line 130 "engines/director/lingo/lingo-gr.y"
+ case 31:
+#line 139 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 30:
-#line 133 "engines/director/lingo/lingo-gr.y"
+ case 32:
+#line 142 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 31:
-#line 134 "engines/director/lingo/lingo-gr.y"
+ case 33:
+#line 143 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->func_eq, STOP); ;}
break;
- case 32:
-#line 136 "engines/director/lingo/lingo-gr.y"
+ case 35:
+#line 146 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->func_ifcode); g_lingo->code3(STOP,STOP,STOP); ;}
break;
- case 33:
-#line 138 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 148 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 34:
-#line 140 "engines/director/lingo/lingo-gr.y"
+ case 37:
+#line 150 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 37:
-#line 145 "engines/director/lingo/lingo-gr.y"
+ case 40:
+#line 155 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 38:
-#line 146 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 156 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 39:
-#line 147 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 157 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_printtop); ;}
break;
- case 41:
-#line 159 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 169 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_gotoloop); ;}
break;
- case 42:
-#line 160 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 170 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_gotonext); ;}
break;
- case 43:
-#line 161 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 171 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_gotoprevious); ;}
break;
- case 44:
-#line 162 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 172 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 45:
-#line 163 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 173 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
break;
- case 46:
-#line 164 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 174 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 47:
-#line 167 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 177 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 48:
-#line 168 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 178 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 49:
-#line 169 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 179 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 50:
-#line 170 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 180 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 51:
-#line 173 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 183 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 52:
-#line 174 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 184 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 53:
-#line 175 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 185 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1697 "engines/director/lingo/lingo-gr.cpp"
+#line 1727 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1907,6 +1937,6 @@ yyreturn:
}
-#line 205 "engines/director/lingo/lingo-gr.y"
+#line 215 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 6f59a5f..581f3d2 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -46,27 +46,28 @@
VAR = 262,
STRING = 263,
tIF = 264,
- tEND = 265,
- tFRAME = 266,
- tGO = 267,
- tINTO = 268,
- tLOOP = 269,
- tMCI = 270,
- tMCIWAIT = 271,
- tMOVIE = 272,
- tNEXT = 273,
- tOF = 274,
- tPREVIOUS = 275,
- tPUT = 276,
- tSET = 277,
- tTHEN = 278,
- tTO = 279,
- tGE = 280,
- tLE = 281,
- tGT = 282,
- tLT = 283,
- tEQ = 284,
- tNEQ = 285
+ tELSE = 265,
+ tEND = 266,
+ tFRAME = 267,
+ tGO = 268,
+ tINTO = 269,
+ tLOOP = 270,
+ tMCI = 271,
+ tMCIWAIT = 272,
+ tMOVIE = 273,
+ tNEXT = 274,
+ tOF = 275,
+ tPREVIOUS = 276,
+ tPUT = 277,
+ tSET = 278,
+ tTHEN = 279,
+ tTO = 280,
+ tGE = 281,
+ tLE = 282,
+ tGT = 283,
+ tLT = 284,
+ tEQ = 285,
+ tNEQ = 286
};
#endif
/* Tokens. */
@@ -77,27 +78,28 @@
#define VAR 262
#define STRING 263
#define tIF 264
-#define tEND 265
-#define tFRAME 266
-#define tGO 267
-#define tINTO 268
-#define tLOOP 269
-#define tMCI 270
-#define tMCIWAIT 271
-#define tMOVIE 272
-#define tNEXT 273
-#define tOF 274
-#define tPREVIOUS 275
-#define tPUT 276
-#define tSET 277
-#define tTHEN 278
-#define tTO 279
-#define tGE 280
-#define tLE 281
-#define tGT 282
-#define tLT 283
-#define tEQ 284
-#define tNEQ 285
+#define tELSE 265
+#define tEND 266
+#define tFRAME 267
+#define tGO 268
+#define tINTO 269
+#define tLOOP 270
+#define tMCI 271
+#define tMCIWAIT 272
+#define tMOVIE 273
+#define tNEXT 274
+#define tOF 275
+#define tPREVIOUS 276
+#define tPUT 277
+#define tSET 278
+#define tTHEN 279
+#define tTO 280
+#define tGE 281
+#define tLE 282
+#define tGT 283
+#define tLT 284
+#define tEQ 285
+#define tNEQ 286
@@ -112,7 +114,7 @@ typedef union YYSTYPE
int code;
}
/* Line 1529 of yacc.c. */
-#line 116 "engines/director/lingo/lingo-gr.hpp"
+#line 118 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index d1e5d39..1ba4cc9 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -73,11 +73,11 @@ using namespace Director;
%token<i> INT
%token<f> FLOAT
%token<s> VAR STRING
-%token tIF tEND tFRAME tGO tINTO tLOOP tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS
+%token tIF tELSE tEND tFRAME tGO tINTO tLOOP tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS
%token tPUT tSET tTHEN tTO
%token tGE tLE tGT tLT tEQ tNEQ
-%type<code> assign cond expr if end stmtlist
+%type<code> asgn cond expr if end stmtlist
%type<s> gotoframe gotomovie
%right '='
@@ -93,14 +93,14 @@ program: programline '\n' program
programline:
| func
- | assign { g_lingo->code1(g_lingo->func_xpop); }
+ | asgn { g_lingo->code1(g_lingo->func_xpop); }
| stmt
| expr { g_lingo->code1(g_lingo->func_printtop); }
| error { yyerrok; }
| /* empty */
;
-assign: tPUT expr tINTO VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($4->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $2; delete $4; }
+asgn: tPUT expr tINTO VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($4->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $2; delete $4; }
| tSET VAR '=' expr { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $4; delete $2; }
| tSET VAR tTO expr { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $4; delete $2; }
;
@@ -112,10 +112,19 @@ stmt: expr { g_lingo->code1(g_lingo->func_xpop); }
WRITE_LE_UINT32(&end, $5);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ | if cond tTHEN stmtlist end tELSE stmtlist end tEND tIF {
+ inst then, else1, end;
+ WRITE_LE_UINT32(&then, $4);
+ WRITE_LE_UINT32(&else1, $7);
+ WRITE_LE_UINT32(&end, $8);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
;
expr: INT { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, $1); $$ = g_lingo->code1(i); };
| VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($1->c_str()); $$ = g_lingo->code1(g_lingo->func_eval); delete $1; }
+ | asgn
| expr '+' expr { g_lingo->code1(g_lingo->func_add); }
| expr '-' expr { g_lingo->code1(g_lingo->func_sub); }
| expr '*' expr { g_lingo->code1(g_lingo->func_mul); }
@@ -132,6 +141,7 @@ expr: INT { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT3
cond: expr { g_lingo->code1(STOP); }
| expr '=' expr { g_lingo->code2(g_lingo->func_eq, STOP); }
+ | '(' cond ')'
;
if: tIF { $$ = g_lingo->code1(g_lingo->func_ifcode); g_lingo->code3(STOP,STOP,STOP); }
;
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 1bde391..c79d281 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 29
-#define YY_END_OF_BUFFER 30
+#define YY_NUM_RULES 30
+#define YY_END_OF_BUFFER 31
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,17 +373,17 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[85] =
+static yyconst flex_int16_t yy_accept[88] =
{ 0,
- 0, 0, 30, 29, 3, 27, 29, 29, 26, 26,
- 25, 26, 26, 23, 23, 23, 23, 23, 23, 23,
- 23, 23, 23, 23, 23, 2, 2, 3, 27, 20,
- 0, 28, 1, 24, 25, 22, 21, 23, 23, 23,
- 7, 4, 23, 23, 23, 23, 23, 14, 23, 23,
- 23, 23, 19, 1, 24, 5, 23, 23, 23, 10,
- 23, 23, 23, 16, 17, 23, 23, 8, 9, 23,
- 23, 13, 23, 18, 6, 23, 12, 23, 23, 23,
- 11, 23, 15, 0
+ 0, 0, 31, 30, 3, 28, 30, 30, 27, 27,
+ 26, 27, 27, 24, 24, 24, 24, 24, 24, 24,
+ 24, 24, 24, 24, 24, 2, 2, 3, 28, 21,
+ 0, 29, 1, 25, 26, 23, 22, 24, 24, 24,
+ 24, 8, 4, 24, 24, 24, 24, 24, 15, 24,
+ 24, 24, 24, 20, 1, 25, 24, 6, 24, 24,
+ 24, 11, 24, 24, 24, 17, 18, 24, 5, 24,
+ 9, 10, 24, 24, 14, 24, 19, 7, 24, 13,
+ 24, 24, 24, 12, 24, 16, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -426,70 +426,70 @@ static yyconst flex_int32_t yy_meta[36] =
4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[88] =
+static yyconst flex_int16_t yy_base[91] =
{ 0,
- 0, 34, 106, 107, 103, 34, 91, 96, 107, 93,
- 30, 88, 87, 0, 73, 69, 70, 22, 69, 26,
- 76, 74, 15, 74, 23, 90, 107, 89, 48, 107,
- 83, 107, 0, 78, 44, 107, 107, 0, 70, 71,
- 0, 0, 55, 58, 61, 50, 47, 0, 62, 49,
- 48, 59, 0, 0, 66, 0, 51, 48, 46, 39,
- 49, 40, 37, 0, 0, 43, 49, 0, 0, 51,
- 47, 0, 42, 0, 0, 41, 0, 35, 30, 25,
- 0, 19, 0, 107, 55, 42, 59
+ 0, 34, 109, 110, 106, 34, 94, 99, 110, 96,
+ 30, 91, 90, 0, 18, 73, 74, 23, 73, 28,
+ 80, 78, 18, 78, 24, 94, 110, 93, 49, 110,
+ 87, 110, 0, 82, 46, 110, 110, 0, 62, 73,
+ 74, 0, 0, 58, 61, 64, 53, 50, 0, 65,
+ 52, 51, 62, 0, 0, 69, 60, 0, 53, 50,
+ 48, 41, 51, 42, 39, 0, 0, 45, 0, 51,
+ 0, 0, 53, 49, 0, 44, 0, 0, 43, 0,
+ 37, 32, 27, 0, 24, 0, 110, 57, 44, 61
} ;
-static yyconst flex_int16_t yy_def[88] =
+static yyconst flex_int16_t yy_def[91] =
{ 0,
- 84, 1, 84, 84, 84, 84, 84, 85, 84, 84,
- 84, 84, 84, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 84, 84, 84, 84, 84,
- 85, 84, 87, 84, 84, 84, 84, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 87, 84, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 0, 84, 84, 84
+ 87, 1, 87, 87, 87, 87, 87, 88, 87, 87,
+ 87, 87, 87, 89, 89, 89, 89, 89, 89, 89,
+ 89, 89, 89, 89, 89, 87, 87, 87, 87, 87,
+ 88, 87, 90, 87, 87, 87, 87, 89, 89, 89,
+ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
+ 89, 89, 89, 89, 90, 87, 89, 89, 89, 89,
+ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
+ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
+ 89, 89, 89, 89, 89, 89, 0, 87, 87, 87
} ;
-static yyconst flex_int16_t yy_nxt[143] =
+static yyconst flex_int16_t yy_nxt[146] =
{ 0,
4, 5, 6, 6, 4, 7, 8, 9, 10, 4,
11, 12, 9, 13, 14, 14, 14, 14, 15, 16,
17, 14, 18, 19, 20, 21, 22, 23, 14, 24,
25, 14, 14, 14, 14, 26, 29, 29, 27, 34,
- 35, 42, 45, 49, 52, 38, 50, 43, 83, 53,
- 29, 29, 46, 34, 35, 31, 82, 31, 31, 54,
- 81, 80, 54, 79, 78, 77, 76, 75, 74, 73,
- 72, 71, 70, 69, 68, 67, 55, 66, 65, 64,
- 63, 62, 61, 60, 59, 58, 57, 56, 55, 32,
- 28, 28, 51, 48, 47, 44, 41, 40, 39, 37,
-
- 36, 33, 32, 30, 28, 84, 3, 84, 84, 84,
- 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
- 84, 84
+ 35, 39, 43, 40, 46, 53, 50, 38, 44, 51,
+ 54, 29, 29, 86, 47, 34, 35, 31, 85, 31,
+ 31, 55, 84, 83, 55, 82, 81, 80, 79, 78,
+ 77, 76, 75, 74, 73, 72, 71, 70, 69, 56,
+ 68, 67, 66, 65, 64, 63, 62, 61, 60, 59,
+ 58, 57, 56, 32, 28, 28, 52, 49, 48, 45,
+
+ 42, 41, 37, 36, 33, 32, 30, 28, 87, 3,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87
} ;
-static yyconst flex_int16_t yy_chk[143] =
+static yyconst flex_int16_t yy_chk[146] =
{ 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, 2, 6, 6, 2, 11,
- 11, 18, 20, 23, 25, 86, 23, 18, 82, 25,
- 29, 29, 20, 35, 35, 85, 80, 85, 85, 87,
- 79, 78, 87, 76, 73, 71, 70, 67, 66, 63,
- 62, 61, 60, 59, 58, 57, 55, 52, 51, 50,
- 49, 47, 46, 45, 44, 43, 40, 39, 34, 31,
- 28, 26, 24, 22, 21, 19, 17, 16, 15, 13,
-
- 12, 10, 8, 7, 5, 3, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
- 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
- 84, 84
+ 11, 15, 18, 15, 20, 25, 23, 89, 18, 23,
+ 25, 29, 29, 85, 20, 35, 35, 88, 83, 88,
+ 88, 90, 82, 81, 90, 79, 76, 74, 73, 70,
+ 68, 65, 64, 63, 62, 61, 60, 59, 57, 56,
+ 53, 52, 51, 50, 48, 47, 46, 45, 44, 41,
+ 40, 39, 34, 31, 28, 26, 24, 22, 21, 19,
+
+ 17, 16, 13, 12, 10, 8, 7, 5, 3, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87
} ;
static yy_state_type yy_last_accepting_state;
@@ -781,13 +781,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 >= 85 )
+ if ( yy_current_state >= 88 )
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] != 107 );
+ while ( yy_base[yy_current_state] != 110 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -834,130 +834,135 @@ YY_RULE_SETUP
case 5:
YY_RULE_SETUP
#line 52 "engines/director/lingo/lingo-lex.l"
-{ return tEND; }
+{ return tELSE; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 53 "engines/director/lingo/lingo-lex.l"
-{ return tFRAME; }
+{ return tEND; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 54 "engines/director/lingo/lingo-lex.l"
-{ return tGO; }
+{ return tFRAME; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 55 "engines/director/lingo/lingo-lex.l"
-{ return tINTO; }
+{ return tGO; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 56 "engines/director/lingo/lingo-lex.l"
-{ return tLOOP; }
+{ return tINTO; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 57 "engines/director/lingo/lingo-lex.l"
-{ return tMCI; }
+{ return tLOOP; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 58 "engines/director/lingo/lingo-lex.l"
-{ return tMCIWAIT; }
+{ return tMCI; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 59 "engines/director/lingo/lingo-lex.l"
-{ return tMOVIE; }
+{ return tMCIWAIT; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 60 "engines/director/lingo/lingo-lex.l"
-{ return tNEXT; }
+{ return tMOVIE; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 61 "engines/director/lingo/lingo-lex.l"
-{ return tOF; }
+{ return tNEXT; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 62 "engines/director/lingo/lingo-lex.l"
-{ return tPREVIOUS; }
+{ return tOF; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 63 "engines/director/lingo/lingo-lex.l"
-{ return tPUT; }
+{ return tPREVIOUS; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 64 "engines/director/lingo/lingo-lex.l"
-{ return tSET; }
+{ return tPUT; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 65 "engines/director/lingo/lingo-lex.l"
-{ return tTHEN; }
+{ return tSET; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 66 "engines/director/lingo/lingo-lex.l"
-{ return tTO; }
+{ return tTHEN; }
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 68 "engines/director/lingo/lingo-lex.l"
-{ return tNEQ; }
+#line 67 "engines/director/lingo/lingo-lex.l"
+{ return tTO; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 69 "engines/director/lingo/lingo-lex.l"
-{ return tGE; }
+{ return tNEQ; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 70 "engines/director/lingo/lingo-lex.l"
-{ return tLE; }
+{ return tGE; }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 72 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+#line 71 "engines/director/lingo/lingo-lex.l"
+{ return tLE; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 73 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+{ yylval.s = new Common::String(yytext); return VAR; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 74 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 75 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 27:
-/* rule 27 can match eol */
YY_RULE_SETUP
#line 76 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ return *yytext; }
YY_BREAK
case 28:
+/* rule 28 can match eol */
YY_RULE_SETUP
#line 77 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return '\n'; }
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 79 "engines/director/lingo/lingo-lex.l"
+#line 78 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+ YY_BREAK
+case 30:
+YY_RULE_SETUP
+#line 80 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 961 "engines/director/lingo/lingo-lex.cpp"
+#line 966 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1250,7 +1255,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 >= 85 )
+ if ( yy_current_state >= 88 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1278,11 +1283,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 >= 85 )
+ if ( yy_current_state >= 88 )
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 == 84);
+ yy_is_jam = (yy_current_state == 87);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1957,7 +1962,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 79 "engines/director/lingo/lingo-lex.l"
+#line 80 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 2408b19..a95303f 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -49,6 +49,7 @@ whitespace [\t ]
[\t]+ { return ' '; }
if { return tIF; }
+else { return tELSE; }
end { return tEND; }
frame { return tFRAME; }
go { return tGO; }
Commit: 79a91588b82af804bd809141782474758b158f82
https://github.com/scummvm/scummvm/commit/79a91588b82af804bd809141782474758b158f82
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Split out opcodes from actual function implementations
Changed paths:
A engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-funcs.cpp
engines/director/module.mk
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
new file mode 100644
index 0000000..a77d6fc
--- /dev/null
+++ b/engines/director/lingo/lingo-code.cpp
@@ -0,0 +1,317 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+// Heavily inspired by hoc
+// Copyright (C) AT&T 1995
+// All Rights Reserved
+//
+// Permission to use, copy, modify, and distribute this software and
+// its documentation for any purpose and without fee is hereby
+// granted, provided that the above copyright notice appear in all
+// copies and that both that the copyright notice and this
+// permission notice and warranty disclaimer appear in supporting
+// documentation, and that the name of AT&T or any of its entities
+// not be used in advertising or publicity pertaining to
+// distribution of the software without specific, written prior
+// permission.
+//
+// AT&T DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+// INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+// IN NO EVENT SHALL AT&T OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
+// SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+// IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+// ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+// THIS SOFTWARE.
+
+#include "engines/director/lingo/lingo.h"
+#include "common/file.h"
+#include "audio/decoders/wave.h"
+
+#include "director/lingo/lingo-gr.h"
+
+namespace Director {
+
+void Lingo::execute(int pc) {
+ for(_pc = pc; (*_currentScript)[_pc] != STOP;) {
+ _pc++;
+ (*((*_currentScript)[_pc - 1]))();
+ }
+}
+
+void Lingo::push(Datum d) {
+ _stack.push_back(d);
+}
+
+Datum Lingo::pop(void) {
+ if (_stack.size() == 0)
+ error("stack underflow");
+
+ Datum ret = _stack.back();
+ _stack.pop_back();
+
+ return ret;
+}
+
+void Lingo::func_xpop() {
+ g_lingo->pop();
+}
+
+void Lingo::func_printtop(void) {
+ Datum d = g_lingo->pop();
+
+ warning("%d", d.val);
+}
+
+void Lingo::func_constpush() {
+ Datum d;
+ inst i = (*g_lingo->_currentScript)[g_lingo->_pc++];
+ d.val = READ_LE_UINT32(&i);
+ g_lingo->push(d);
+}
+
+void Lingo::func_varpush() {
+ Datum d;
+ Symbol *sym;
+ char *name = (char *)&(*g_lingo->_currentScript)[g_lingo->_pc];
+
+ if (!g_lingo->_vars.contains(name)) { // Create variable if it was not defined
+ sym = new Symbol;
+ sym->name = (char *)calloc(strlen(name) + 1, 1);
+ Common::strlcpy(sym->name, name, strlen(name) + 1);
+ sym->type = UNDEF;
+ sym->u.val = 0;
+
+ g_lingo->_vars[name] = sym;
+ } else {
+ sym = g_lingo->_vars[name];
+ }
+
+ d.sym = sym;
+
+ g_lingo->_pc += g_lingo->calcStringAlignment(name);
+
+ g_lingo->push(d);
+}
+
+void Lingo::func_assign() {
+ Datum d1, d2;
+ d1 = g_lingo->pop();
+ d2 = g_lingo->pop();
+
+ if (d1.sym->type != VAR && d1.sym->type != UNDEF) {
+ warning("assignment to non-variable '%s'", d1.sym->name);
+ return;
+ }
+
+ d1.sym->u.val = d2.val;
+ d1.sym->type = VAR;
+ g_lingo->push(d2);
+}
+
+bool Lingo::verify(Symbol *s) {
+ if (s->type != VAR && s->type != UNDEF) {
+ warning("attempt to evaluate non-variable '%s'", s->name);
+
+ return false;
+ }
+
+ if (s->type == UNDEF) {
+ warning("undefined variable '%s'", s->name);
+
+ return false;
+ }
+
+ return true;
+}
+
+void Lingo::func_eval() {
+ Datum d;
+ d = g_lingo->pop();
+
+ if (!g_lingo->verify(d.sym))
+ return;
+
+ d.val = d.sym->u.val;
+
+ g_lingo->push(d);
+}
+
+void Lingo::func_add() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.val += d2.val;
+ g_lingo->push(d1);
+}
+
+void Lingo::func_sub() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.val -= d2.val;
+ g_lingo->push(d1);
+}
+
+void Lingo::func_mul() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.val *= d2.val;
+ g_lingo->push(d1);
+}
+
+void Lingo::func_div() {
+ Datum d2 = g_lingo->pop();
+
+ if (d2.val == 0)
+ error("division by zero");
+
+ Datum d1 = g_lingo->pop();
+
+ d1.val /= d2.val;
+ g_lingo->push(d1);
+}
+
+void Lingo::func_negate() {
+ Datum d = g_lingo->pop();
+
+ d.val -= d.val;
+ g_lingo->push(d);
+}
+
+void Lingo::func_eq() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.val = (d1.val == d2.val) ? 1 : 0;
+ g_lingo->push(d1);
+}
+
+void Lingo::func_neq() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.val = (d1.val != d2.val) ? 1 : 0;
+ g_lingo->push(d1);
+}
+
+void Lingo::func_gt() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.val = (d1.val > d2.val) ? 1 : 0;
+ g_lingo->push(d1);
+}
+
+void Lingo::func_lt() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.val = (d1.val < d2.val) ? 1 : 0;
+ g_lingo->push(d1);
+}
+
+void Lingo::func_ge() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.val = (d1.val >= d2.val) ? 1 : 0;
+ g_lingo->push(d1);
+}
+
+void Lingo::func_le() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.val = (d1.val <= d2.val) ? 1 : 0;
+ g_lingo->push(d1);
+}
+
+
+void Lingo::func_ifcode() {
+ Datum d;
+ int savepc = g_lingo->_pc; /* then part */
+
+ int then = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc]);
+ int elsep = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
+ int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
+
+ warning("cond: %d end: %d then: %d elesp: %d", savepc + 3, end, then, elsep);
+
+ g_lingo->execute(savepc + 3); /* condition */
+
+ d = g_lingo->pop();
+ warning("res: %d", d.val);
+
+ if (d.val) {
+ g_lingo->execute(then);
+ } else if (elsep) { /* else part? */
+ g_lingo->execute(elsep);
+ }
+
+ //if (!returning)
+ g_lingo->_pc = end; /* next stmt */
+}
+
+//************************
+// Built-in functions
+//************************
+void Lingo::func_mci() {
+ Common::String s((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
+
+ g_lingo->exec_mci(s);
+
+ g_lingo->_pc += g_lingo->calcStringAlignment(s.c_str());
+}
+
+void Lingo::func_mciwait() {
+ Common::String s((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
+
+ g_lingo->exec_mciwait(s);
+
+ g_lingo->_pc += g_lingo->calcStringAlignment(s.c_str());
+}
+
+void Lingo::func_goto() {
+ Common::String frame((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
+ g_lingo->_pc += g_lingo->calcStringAlignment(frame.c_str());
+
+ Common::String movie((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
+ g_lingo->_pc += g_lingo->calcStringAlignment(movie.c_str());
+
+ g_lingo->exec_goto(frame, movie);
+}
+
+void Lingo::func_gotoloop() {
+ warning("STUB: func_gotoloop()");
+}
+
+void Lingo::func_gotonext() {
+ warning("STUB: func_gotonext()");
+}
+
+void Lingo::func_gotoprevious() {
+ warning("STUB: func_gotoprevious()");
+}
+
+}
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index f9f2e5c..6fbd35c 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -193,267 +193,4 @@ void Lingo::exec_goto(Common::String &frame, Common::String &movie) {
warning("STUB: go to %s movie %s", frame.c_str(), movie.c_str());
}
-void Lingo::execute(int pc) {
- for(_pc = pc; (*_currentScript)[_pc] != STOP;) {
- _pc++;
- (*((*_currentScript)[_pc - 1]))();
- }
-}
-
-void Lingo::push(Datum d) {
- _stack.push_back(d);
-}
-
-Datum Lingo::pop(void) {
- if (_stack.size() == 0)
- error("stack underflow");
-
- Datum ret = _stack.back();
- _stack.pop_back();
-
- return ret;
-}
-
-void Lingo::func_xpop() {
- g_lingo->pop();
-}
-
-void Lingo::func_printtop(void) {
- Datum d = g_lingo->pop();
-
- warning("%d", d.val);
-}
-
-void Lingo::func_constpush() {
- Datum d;
- inst i = (*g_lingo->_currentScript)[g_lingo->_pc++];
- d.val = READ_LE_UINT32(&i);
- g_lingo->push(d);
-}
-
-void Lingo::func_varpush() {
- Datum d;
- Symbol *sym;
- char *name = (char *)&(*g_lingo->_currentScript)[g_lingo->_pc];
-
- if (!g_lingo->_vars.contains(name)) { // Create variable if it was not defined
- sym = new Symbol;
- sym->name = (char *)calloc(strlen(name) + 1, 1);
- Common::strlcpy(sym->name, name, strlen(name) + 1);
- sym->type = UNDEF;
- sym->u.val = 0;
-
- g_lingo->_vars[name] = sym;
- } else {
- sym = g_lingo->_vars[name];
- }
-
- d.sym = sym;
-
- g_lingo->_pc += g_lingo->calcStringAlignment(name);
-
- g_lingo->push(d);
-}
-
-void Lingo::func_assign() {
- Datum d1, d2;
- d1 = g_lingo->pop();
- d2 = g_lingo->pop();
-
- if (d1.sym->type != VAR && d1.sym->type != UNDEF) {
- warning("assignment to non-variable '%s'", d1.sym->name);
- return;
- }
-
- d1.sym->u.val = d2.val;
- d1.sym->type = VAR;
- g_lingo->push(d2);
-}
-
-bool Lingo::verify(Symbol *s) {
- if (s->type != VAR && s->type != UNDEF) {
- warning("attempt to evaluate non-variable '%s'", s->name);
-
- return false;
- }
-
- if (s->type == UNDEF) {
- warning("undefined variable '%s'", s->name);
-
- return false;
- }
-
- return true;
-}
-
-void Lingo::func_eval() {
- Datum d;
- d = g_lingo->pop();
-
- if (!g_lingo->verify(d.sym))
- return;
-
- d.val = d.sym->u.val;
-
- g_lingo->push(d);
-}
-
-void Lingo::func_add() {
- Datum d2 = g_lingo->pop();
- Datum d1 = g_lingo->pop();
-
- d1.val += d2.val;
- g_lingo->push(d1);
-}
-
-void Lingo::func_sub() {
- Datum d2 = g_lingo->pop();
- Datum d1 = g_lingo->pop();
-
- d1.val -= d2.val;
- g_lingo->push(d1);
-}
-
-void Lingo::func_mul() {
- Datum d2 = g_lingo->pop();
- Datum d1 = g_lingo->pop();
-
- d1.val *= d2.val;
- g_lingo->push(d1);
-}
-
-void Lingo::func_div() {
- Datum d2 = g_lingo->pop();
-
- if (d2.val == 0)
- error("division by zero");
-
- Datum d1 = g_lingo->pop();
-
- d1.val /= d2.val;
- g_lingo->push(d1);
-}
-
-void Lingo::func_negate() {
- Datum d = g_lingo->pop();
-
- d.val -= d.val;
- g_lingo->push(d);
-}
-
-void Lingo::func_eq() {
- Datum d2 = g_lingo->pop();
- Datum d1 = g_lingo->pop();
-
- d1.val = (d1.val == d2.val) ? 1 : 0;
- g_lingo->push(d1);
-}
-
-void Lingo::func_neq() {
- Datum d2 = g_lingo->pop();
- Datum d1 = g_lingo->pop();
-
- d1.val = (d1.val != d2.val) ? 1 : 0;
- g_lingo->push(d1);
-}
-
-void Lingo::func_gt() {
- Datum d2 = g_lingo->pop();
- Datum d1 = g_lingo->pop();
-
- d1.val = (d1.val > d2.val) ? 1 : 0;
- g_lingo->push(d1);
-}
-
-void Lingo::func_lt() {
- Datum d2 = g_lingo->pop();
- Datum d1 = g_lingo->pop();
-
- d1.val = (d1.val < d2.val) ? 1 : 0;
- g_lingo->push(d1);
-}
-
-void Lingo::func_ge() {
- Datum d2 = g_lingo->pop();
- Datum d1 = g_lingo->pop();
-
- d1.val = (d1.val >= d2.val) ? 1 : 0;
- g_lingo->push(d1);
-}
-
-void Lingo::func_le() {
- Datum d2 = g_lingo->pop();
- Datum d1 = g_lingo->pop();
-
- d1.val = (d1.val <= d2.val) ? 1 : 0;
- g_lingo->push(d1);
-}
-
-
-void Lingo::func_ifcode() {
- Datum d;
- int savepc = g_lingo->_pc; /* then part */
-
- int then = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc]);
- int elsep = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
- int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
-
- warning("cond: %d end: %d then: %d elesp: %d", savepc + 3, end, then, elsep);
-
- g_lingo->execute(savepc + 3); /* condition */
-
- d = g_lingo->pop();
- warning("res: %d", d.val);
-
- if (d.val) {
- g_lingo->execute(then);
- } else if (elsep) { /* else part? */
- g_lingo->execute(elsep);
- }
-
- //if (!returning)
- g_lingo->_pc = end; /* next stmt */
-}
-
-//************************
-// Built-in functions
-//************************
-void Lingo::func_mci() {
- Common::String s((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
-
- g_lingo->exec_mci(s);
-
- g_lingo->_pc += g_lingo->calcStringAlignment(s.c_str());
-}
-
-void Lingo::func_mciwait() {
- Common::String s((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
-
- g_lingo->exec_mciwait(s);
-
- g_lingo->_pc += g_lingo->calcStringAlignment(s.c_str());
-}
-
-void Lingo::func_goto() {
- Common::String frame((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
- g_lingo->_pc += g_lingo->calcStringAlignment(frame.c_str());
-
- Common::String movie((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
- g_lingo->_pc += g_lingo->calcStringAlignment(movie.c_str());
-
- g_lingo->exec_goto(frame, movie);
-}
-
-void Lingo::func_gotoloop() {
- warning("STUB: func_gotoloop()");
-}
-
-void Lingo::func_gotonext() {
- warning("STUB: func_gotonext()");
-}
-
-void Lingo::func_gotoprevious() {
- warning("STUB: func_gotoprevious()");
-}
-
}
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 0d46b09..d903223 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -10,6 +10,7 @@ MODULE_OBJS = \
sound.o \
lingo/lingo-gr.o \
lingo/lingo.o \
+ lingo/lingo-code.o \
lingo/lingo-funcs.o \
lingo/lingo-lex.o
Commit: 6983f3f68b00481905b8a0a53cd367da153a9da9
https://github.com/scummvm/scummvm/commit/6983f3f68b00481905b8a0a53cd367da153a9da9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Renamed func_->c_ and exec_->func_->
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index a77d6fc..7f51be5 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -72,24 +72,24 @@ Datum Lingo::pop(void) {
return ret;
}
-void Lingo::func_xpop() {
+void Lingo::c_xpop() {
g_lingo->pop();
}
-void Lingo::func_printtop(void) {
+void Lingo::c_printtop(void) {
Datum d = g_lingo->pop();
warning("%d", d.val);
}
-void Lingo::func_constpush() {
+void Lingo::c_constpush() {
Datum d;
inst i = (*g_lingo->_currentScript)[g_lingo->_pc++];
d.val = READ_LE_UINT32(&i);
g_lingo->push(d);
}
-void Lingo::func_varpush() {
+void Lingo::c_varpush() {
Datum d;
Symbol *sym;
char *name = (char *)&(*g_lingo->_currentScript)[g_lingo->_pc];
@@ -113,7 +113,7 @@ void Lingo::func_varpush() {
g_lingo->push(d);
}
-void Lingo::func_assign() {
+void Lingo::c_assign() {
Datum d1, d2;
d1 = g_lingo->pop();
d2 = g_lingo->pop();
@@ -144,7 +144,7 @@ bool Lingo::verify(Symbol *s) {
return true;
}
-void Lingo::func_eval() {
+void Lingo::c_eval() {
Datum d;
d = g_lingo->pop();
@@ -156,7 +156,7 @@ void Lingo::func_eval() {
g_lingo->push(d);
}
-void Lingo::func_add() {
+void Lingo::c_add() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
@@ -164,7 +164,7 @@ void Lingo::func_add() {
g_lingo->push(d1);
}
-void Lingo::func_sub() {
+void Lingo::c_sub() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
@@ -172,7 +172,7 @@ void Lingo::func_sub() {
g_lingo->push(d1);
}
-void Lingo::func_mul() {
+void Lingo::c_mul() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
@@ -180,7 +180,7 @@ void Lingo::func_mul() {
g_lingo->push(d1);
}
-void Lingo::func_div() {
+void Lingo::c_div() {
Datum d2 = g_lingo->pop();
if (d2.val == 0)
@@ -192,14 +192,14 @@ void Lingo::func_div() {
g_lingo->push(d1);
}
-void Lingo::func_negate() {
+void Lingo::c_negate() {
Datum d = g_lingo->pop();
d.val -= d.val;
g_lingo->push(d);
}
-void Lingo::func_eq() {
+void Lingo::c_eq() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
@@ -207,7 +207,7 @@ void Lingo::func_eq() {
g_lingo->push(d1);
}
-void Lingo::func_neq() {
+void Lingo::c_neq() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
@@ -215,7 +215,7 @@ void Lingo::func_neq() {
g_lingo->push(d1);
}
-void Lingo::func_gt() {
+void Lingo::c_gt() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
@@ -223,7 +223,7 @@ void Lingo::func_gt() {
g_lingo->push(d1);
}
-void Lingo::func_lt() {
+void Lingo::c_lt() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
@@ -231,7 +231,7 @@ void Lingo::func_lt() {
g_lingo->push(d1);
}
-void Lingo::func_ge() {
+void Lingo::c_ge() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
@@ -239,7 +239,7 @@ void Lingo::func_ge() {
g_lingo->push(d1);
}
-void Lingo::func_le() {
+void Lingo::c_le() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
@@ -248,7 +248,7 @@ void Lingo::func_le() {
}
-void Lingo::func_ifcode() {
+void Lingo::c_ifcode() {
Datum d;
int savepc = g_lingo->_pc; /* then part */
@@ -276,42 +276,42 @@ void Lingo::func_ifcode() {
//************************
// Built-in functions
//************************
-void Lingo::func_mci() {
+void Lingo::c_mci() {
Common::String s((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
- g_lingo->exec_mci(s);
+ g_lingo->func_mci(s);
g_lingo->_pc += g_lingo->calcStringAlignment(s.c_str());
}
-void Lingo::func_mciwait() {
+void Lingo::c_mciwait() {
Common::String s((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
- g_lingo->exec_mciwait(s);
+ g_lingo->func_mciwait(s);
g_lingo->_pc += g_lingo->calcStringAlignment(s.c_str());
}
-void Lingo::func_goto() {
+void Lingo::c_goto() {
Common::String frame((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
g_lingo->_pc += g_lingo->calcStringAlignment(frame.c_str());
Common::String movie((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
g_lingo->_pc += g_lingo->calcStringAlignment(movie.c_str());
- g_lingo->exec_goto(frame, movie);
+ g_lingo->func_goto(frame, movie);
}
-void Lingo::func_gotoloop() {
- warning("STUB: func_gotoloop()");
+void Lingo::c_gotoloop() {
+ warning("STUB: c_gotoloop()");
}
-void Lingo::func_gotonext() {
- warning("STUB: func_gotonext()");
+void Lingo::c_gotonext() {
+ warning("STUB: c_gotonext()");
}
-void Lingo::func_gotoprevious() {
- warning("STUB: func_gotoprevious()");
+void Lingo::c_gotoprevious() {
+ warning("STUB: c_gotoprevious()");
}
}
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 6fbd35c..6975df6 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -87,7 +87,7 @@ struct MCIToken {
{ kMCITokenNone, kMCITokenNone, 0, 0 }
};
-void Lingo::exec_mci(Common::String &s) {
+void Lingo::func_mci(Common::String &s) {
Common::String params[5];
MCITokenType command = kMCITokenNone;
@@ -185,11 +185,11 @@ void Lingo::exec_mci(Common::String &s) {
}
}
-void Lingo::exec_mciwait(Common::String &s) {
+void Lingo::func_mciwait(Common::String &s) {
warning("STUB: MCI wait file: %s", s.c_str());
}
-void Lingo::exec_goto(Common::String &frame, Common::String &movie) {
+void Lingo::func_goto(Common::String &frame, Common::String &movie) {
warning("STUB: go to %s movie %s", frame.c_str(), movie.c_str());
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index c182f3f..c8f1fab 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -1491,12 +1491,12 @@ yyreduce:
{
case 6:
#line 96 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_xpop); ;}
+ { g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 8:
#line 98 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_printtop); ;}
+ { g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 9:
@@ -1506,22 +1506,22 @@ yyreduce:
case 11:
#line 103 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
+ { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->c_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
break;
case 12:
#line 104 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
+ { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->c_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 13:
#line 105 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->func_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
+ { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->c_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 14:
#line 108 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_xpop); ;}
+ { g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 15:
@@ -1548,57 +1548,57 @@ yyreduce:
case 17:
#line 125 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
+ { g_lingo->code1(g_lingo->c_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
break;
case 18:
#line 126 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->func_eval); delete (yyvsp[(1) - (1)].s); ;}
+ { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
case 20:
#line 128 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_add); ;}
+ { g_lingo->code1(g_lingo->c_add); ;}
break;
case 21:
#line 129 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_sub); ;}
+ { g_lingo->code1(g_lingo->c_sub); ;}
break;
case 22:
#line 130 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_mul); ;}
+ { g_lingo->code1(g_lingo->c_mul); ;}
break;
case 23:
#line 131 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_div); ;}
+ { g_lingo->code1(g_lingo->c_div); ;}
break;
case 24:
#line 132 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_gt); ;}
+ { g_lingo->code1(g_lingo->c_gt); ;}
break;
case 25:
#line 133 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_lt); ;}
+ { g_lingo->code1(g_lingo->c_lt); ;}
break;
case 26:
#line 134 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_neq); ;}
+ { g_lingo->code1(g_lingo->c_neq); ;}
break;
case 27:
#line 135 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_ge); ;}
+ { g_lingo->code1(g_lingo->c_ge); ;}
break;
case 28:
#line 136 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_le); ;}
+ { g_lingo->code1(g_lingo->c_le); ;}
break;
case 29:
@@ -1608,7 +1608,7 @@ yyreduce:
case 30:
#line 138 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->func_negate); ;}
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 31:
@@ -1623,12 +1623,12 @@ yyreduce:
case 33:
#line 143 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code2(g_lingo->func_eq, STOP); ;}
+ { g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
case 35:
#line 146 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->code1(g_lingo->func_ifcode); g_lingo->code3(STOP,STOP,STOP); ;}
+ { (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP,STOP,STOP); ;}
break;
case 36:
@@ -1643,47 +1643,47 @@ yyreduce:
case 40:
#line 155 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 41:
#line 156 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 42:
#line 157 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_printtop); ;}
+ { g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 44:
#line 169 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_gotoloop); ;}
+ { g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 45:
#line 170 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_gotonext); ;}
+ { g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 46:
#line 171 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_gotoprevious); ;}
+ { g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 47:
#line 172 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
+ { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
break;
case 48:
#line 173 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
+ { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
break;
case 49:
#line 174 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 50:
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 1ba4cc9..1ab88ee 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -93,19 +93,19 @@ program: programline '\n' program
programline:
| func
- | asgn { g_lingo->code1(g_lingo->func_xpop); }
+ | asgn { g_lingo->code1(g_lingo->c_xpop); }
| stmt
- | expr { g_lingo->code1(g_lingo->func_printtop); }
+ | expr { g_lingo->code1(g_lingo->c_printtop); }
| error { yyerrok; }
| /* empty */
;
-asgn: tPUT expr tINTO VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($4->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $2; delete $4; }
- | tSET VAR '=' expr { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $4; delete $2; }
- | tSET VAR tTO expr { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->func_assign); $$ = $4; delete $2; }
+asgn: tPUT expr tINTO VAR { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($4->c_str()); g_lingo->code1(g_lingo->c_assign); $$ = $2; delete $4; }
+ | tSET VAR '=' expr { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->c_assign); $$ = $4; delete $2; }
+ | tSET VAR tTO expr { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->c_assign); $$ = $4; delete $2; }
;
-stmt: expr { g_lingo->code1(g_lingo->func_xpop); }
+stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
| if cond tTHEN stmtlist end tEND tIF {
inst then, end;
WRITE_LE_UINT32(&then, $4);
@@ -122,28 +122,28 @@ stmt: expr { g_lingo->code1(g_lingo->func_xpop); }
(*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
;
-expr: INT { g_lingo->code1(g_lingo->func_constpush); inst i; WRITE_LE_UINT32(&i, $1); $$ = g_lingo->code1(i); };
- | VAR { g_lingo->code1(g_lingo->func_varpush); g_lingo->codeString($1->c_str()); $$ = g_lingo->code1(g_lingo->func_eval); delete $1; }
+expr: INT { g_lingo->code1(g_lingo->c_constpush); inst i; WRITE_LE_UINT32(&i, $1); $$ = g_lingo->code1(i); };
+ | VAR { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($1->c_str()); $$ = g_lingo->code1(g_lingo->c_eval); delete $1; }
| asgn
- | expr '+' expr { g_lingo->code1(g_lingo->func_add); }
- | expr '-' expr { g_lingo->code1(g_lingo->func_sub); }
- | expr '*' expr { g_lingo->code1(g_lingo->func_mul); }
- | expr '/' expr { g_lingo->code1(g_lingo->func_div); }
- | expr '>' expr { g_lingo->code1(g_lingo->func_gt); }
- | expr '<' expr { g_lingo->code1(g_lingo->func_lt); }
- | expr tNEQ expr { g_lingo->code1(g_lingo->func_neq); }
- | expr tGE expr { g_lingo->code1(g_lingo->func_ge); }
- | expr tLE expr { g_lingo->code1(g_lingo->func_le); }
+ | expr '+' expr { g_lingo->code1(g_lingo->c_add); }
+ | expr '-' expr { g_lingo->code1(g_lingo->c_sub); }
+ | expr '*' expr { g_lingo->code1(g_lingo->c_mul); }
+ | expr '/' expr { g_lingo->code1(g_lingo->c_div); }
+ | expr '>' expr { g_lingo->code1(g_lingo->c_gt); }
+ | expr '<' expr { g_lingo->code1(g_lingo->c_lt); }
+ | expr tNEQ expr { g_lingo->code1(g_lingo->c_neq); }
+ | expr tGE expr { g_lingo->code1(g_lingo->c_ge); }
+ | expr tLE expr { g_lingo->code1(g_lingo->c_le); }
| '+' expr %prec UNARY { $$ = $2; }
- | '-' expr %prec UNARY { $$ = $2; g_lingo->code1(g_lingo->func_negate); }
+ | '-' expr %prec UNARY { $$ = $2; g_lingo->code1(g_lingo->c_negate); }
| '(' expr ')' { $$ = $2; }
;
cond: expr { g_lingo->code1(STOP); }
- | expr '=' expr { g_lingo->code2(g_lingo->func_eq, STOP); }
+ | expr '=' expr { g_lingo->code2(g_lingo->c_eq, STOP); }
| '(' cond ')'
;
-if: tIF { $$ = g_lingo->code1(g_lingo->func_ifcode); g_lingo->code3(STOP,STOP,STOP); }
+if: tIF { $$ = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP,STOP,STOP); }
;
end: /* nothing */ { g_lingo->code1(STOP); $$ = g_lingo->_currentScript->size(); }
;
@@ -152,9 +152,9 @@ stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
| stmtlist stmt
;
-func: tMCI STRING { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString($2->c_str()); delete $2; }
- | tMCIWAIT VAR { g_lingo->code1(g_lingo->func_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
- | tPUT expr { g_lingo->code1(g_lingo->func_printtop); }
+func: tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_str()); delete $2; }
+ | tMCIWAIT VAR { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
+ | tPUT expr { g_lingo->code1(g_lingo->c_printtop); }
| gotofunc
;
@@ -166,12 +166,12 @@ func: tMCI STRING { g_lingo->code1(g_lingo->func_mci); g_lingo->codeString($2-
// go to {frame} whichFrame {of movie whichMovie}
// go to {frame whichFrame of} movie whichMovie
-gotofunc: tGO tLOOP { g_lingo->code1(g_lingo->func_gotoloop); }
- | tGO tNEXT { g_lingo->code1(g_lingo->func_gotonext); }
- | tGO tPREVIOUS { g_lingo->code1(g_lingo->func_gotoprevious); }
- | tGO gotoframe { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString($2->c_str()); g_lingo->codeString(""); delete $2; }
- | tGO gotoframe gotomovie { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString($2->c_str()); g_lingo->codeString($3->c_str()); delete $2; delete $3; }
- | tGO gotomovie { g_lingo->code1(g_lingo->func_goto); g_lingo->codeString(""); g_lingo->codeString($2->c_str()); delete $2; }
+gotofunc: tGO tLOOP { g_lingo->code1(g_lingo->c_gotoloop); }
+ | tGO tNEXT { g_lingo->code1(g_lingo->c_gotonext); }
+ | tGO tPREVIOUS { g_lingo->code1(g_lingo->c_gotoprevious); }
+ | tGO gotoframe { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString($2->c_str()); g_lingo->codeString(""); delete $2; }
+ | tGO gotoframe gotomovie { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString($2->c_str()); g_lingo->codeString($3->c_str()); delete $2; delete $3; }
+ | tGO gotomovie { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString($2->c_str()); delete $2; }
;
gotoframe: tTO tFRAME STRING { $$ = $3; }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index aabf010..35ac6ae 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -120,36 +120,36 @@ public:
public:
void execute(int pc);
- static void func_xpop();
- static void func_printtop();
- static void func_add();
- static void func_sub();
- static void func_mul();
- static void func_div();
- static void func_negate();
- static void func_constpush();
- static void func_varpush();
- static void func_assign();
+ static void c_xpop();
+ static void c_printtop();
+ static void c_add();
+ static void c_sub();
+ static void c_mul();
+ static void c_div();
+ static void c_negate();
+ static void c_constpush();
+ static void c_varpush();
+ static void c_assign();
bool verify(Symbol *s);
- static void func_eval();
- static void func_ifcode();
- static void func_eq();
- static void func_neq();
- static void func_gt();
- static void func_lt();
- static void func_ge();
- static void func_le();
-
- static void func_mci();
- static void func_mciwait();
- static void func_goto();
- static void func_gotoloop();
- static void func_gotonext();
- static void func_gotoprevious();
-
- void exec_mci(Common::String &s);
- void exec_mciwait(Common::String &s);
- void exec_goto(Common::String &frame, Common::String &movie);
+ static void c_eval();
+ static void c_ifcode();
+ static void c_eq();
+ static void c_neq();
+ static void c_gt();
+ static void c_lt();
+ static void c_ge();
+ static void c_le();
+
+ static void c_mci();
+ static void c_mciwait();
+ static void c_goto();
+ static void c_gotoloop();
+ static void c_gotonext();
+ static void c_gotoprevious();
+
+ void func_mci(Common::String &s);
+ void func_mciwait(Common::String &s);
+ void func_goto(Common::String &frame, Common::String &movie);
public:
ScriptData *_currentScript;
Commit: fc144c716c057da05713120c8464f7114093e98e
https://github.com/scummvm/scummvm/commit/fc144c716c057da05713120c8464f7114093e98e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Documented 'repeat' control commands
Changed paths:
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 1ab88ee..582ff53 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -185,6 +185,19 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
| tTO tMOVIE STRING { $$ = $3; }
;
+// repeat while (expression = TRUE)
+// statements
+// end repeat
+//
+// repeat with index = start to end
+// statements
+// end repeat
+//
+// repeat with index = high down to low
+// statements
+// end repeat
+//
+
// macro
//
// Special Note The macro keyword is retained in Director 3.0 to maintain compatibility
Commit: 8fb7aaf4a0e76db7d1a2516a00d6946e6ee44693
https://github.com/scummvm/scummvm/commit/8fb7aaf4a0e76db7d1a2516a00d6946e6ee44693
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Renamed UNDEF -> VOID
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.cpp
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 7f51be5..11804c2 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -98,7 +98,7 @@ void Lingo::c_varpush() {
sym = new Symbol;
sym->name = (char *)calloc(strlen(name) + 1, 1);
Common::strlcpy(sym->name, name, strlen(name) + 1);
- sym->type = UNDEF;
+ sym->type = VOID;
sym->u.val = 0;
g_lingo->_vars[name] = sym;
@@ -118,7 +118,7 @@ void Lingo::c_assign() {
d1 = g_lingo->pop();
d2 = g_lingo->pop();
- if (d1.sym->type != VAR && d1.sym->type != UNDEF) {
+ if (d1.sym->type != VAR && d1.sym->type != VOID) {
warning("assignment to non-variable '%s'", d1.sym->name);
return;
}
@@ -129,13 +129,13 @@ void Lingo::c_assign() {
}
bool Lingo::verify(Symbol *s) {
- if (s->type != VAR && s->type != UNDEF) {
+ if (s->type != VAR && s->type != VOID) {
warning("attempt to evaluate non-variable '%s'", s->name);
return false;
}
- if (s->type == UNDEF) {
+ if (s->type == VOID) {
warning("undefined variable '%s'", s->name);
return false;
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index c8f1fab..7d7bf1d 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -67,7 +67,7 @@
know about them. */
enum yytokentype {
UNARY = 258,
- UNDEF = 259,
+ VOID = 259,
INT = 260,
FLOAT = 261,
VAR = 262,
@@ -99,7 +99,7 @@
#endif
/* Tokens. */
#define UNARY 258
-#define UNDEF 259
+#define VOID 259
#define INT 260
#define FLOAT 261
#define VAR 262
@@ -511,7 +511,7 @@ static const yytype_uint8 yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "UNARY", "UNDEF", "INT", "FLOAT", "VAR",
+ "$end", "error", "$undefined", "UNARY", "VOID", "INT", "FLOAT", "VAR",
"STRING", "tIF", "tELSE", "tEND", "tFRAME", "tGO", "tINTO", "tLOOP",
"tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT",
"tSET", "tTHEN", "tTO", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='",
@@ -1937,6 +1937,6 @@ yyreturn:
}
-#line 215 "engines/director/lingo/lingo-gr.y"
+#line 228 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 581f3d2..7978269 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -40,7 +40,7 @@
know about them. */
enum yytokentype {
UNARY = 258,
- UNDEF = 259,
+ VOID = 259,
INT = 260,
FLOAT = 261,
VAR = 262,
@@ -72,7 +72,7 @@
#endif
/* Tokens. */
#define UNARY 258
-#define UNDEF 259
+#define VOID 259
#define INT 260
#define FLOAT 261
#define VAR 262
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 582ff53..8d205b8 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -69,7 +69,7 @@ using namespace Director;
int code;
}
-%token UNARY UNDEF
+%token UNARY VOID
%token<i> INT
%token<f> FLOAT
%token<s> VAR STRING
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 25b4495..fee23d1 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -69,7 +69,7 @@ struct EventHandlerType {
Symbol::Symbol() {
name = NULL;
- type = UNDEF;
+ type = VOID;
u.str = NULL;
}
Commit: 46d60a794170489f4db8fdd3be5f8ee373b397ec
https://github.com/scummvm/scummvm/commit/46d60a794170489f4db8fdd3be5f8ee373b397ec
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implement 'repeat while' control keyword
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 11804c2..85da696 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -247,14 +247,36 @@ void Lingo::c_le() {
g_lingo->push(d1);
}
+void Lingo::c_whilecode(void) {
+ Datum d;
+ int savepc = g_lingo->_pc;
+
+ int body = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc]);
+ int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
+
+ g_lingo->execute(savepc + 2); /* condition */
+ d = g_lingo->pop();
+
+ while (d.val) {
+ g_lingo->execute(body); /* body */
+ if (0 /* returning */)
+ break;
+
+ g_lingo->execute(savepc + 2); /* condition */
+ d = g_lingo->pop();
+ }
+
+ //if (!returning)
+ g_lingo->_pc = end; /* next stmt */
+}
void Lingo::c_ifcode() {
Datum d;
int savepc = g_lingo->_pc; /* then part */
- int then = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc]);
+ int then = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc]);
int elsep = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
- int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
+ int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
warning("cond: %d end: %d then: %d elesp: %d", savepc + 3, end, then, elsep);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 7d7bf1d..17109ef 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -86,15 +86,17 @@
tOF = 275,
tPREVIOUS = 276,
tPUT = 277,
- tSET = 278,
- tTHEN = 279,
- tTO = 280,
- tGE = 281,
- tLE = 282,
- tGT = 283,
- tLT = 284,
- tEQ = 285,
- tNEQ = 286
+ tREPEAT = 278,
+ tSET = 279,
+ tTHEN = 280,
+ tTO = 281,
+ tWHILE = 282,
+ tGE = 283,
+ tLE = 284,
+ tGT = 285,
+ tLT = 286,
+ tEQ = 287,
+ tNEQ = 288
};
#endif
/* Tokens. */
@@ -118,15 +120,17 @@
#define tOF 275
#define tPREVIOUS 276
#define tPUT 277
-#define tSET 278
-#define tTHEN 279
-#define tTO 280
-#define tGE 281
-#define tLE 282
-#define tGT 283
-#define tLT 284
-#define tEQ 285
-#define tNEQ 286
+#define tREPEAT 278
+#define tSET 279
+#define tTHEN 280
+#define tTO 281
+#define tWHILE 282
+#define tGE 283
+#define tLE 284
+#define tGT 285
+#define tLT 286
+#define tEQ 287
+#define tNEQ 288
@@ -177,7 +181,7 @@ typedef union YYSTYPE
int code;
}
/* Line 193 of yacc.c. */
-#line 181 "engines/director/lingo/lingo-gr.cpp"
+#line 185 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -190,7 +194,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 194 "engines/director/lingo/lingo-gr.cpp"
+#line 198 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -403,22 +407,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 40
+#define YYFINAL 43
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 205
+#define YYLAST 178
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 43
+#define YYNTOKENS 45
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 14
+#define YYNNTS 15
/* YYNRULES -- Number of rules. */
-#define YYNRULES 56
+#define YYNRULES 58
/* YYNRULES -- Number of states. */
-#define YYNSTATES 101
+#define YYNSTATES 111
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 286
+#define YYMAXUTOK 288
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -427,12 +431,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 38, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 40, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 37, 2, 2,
- 41, 42, 35, 33, 2, 34, 2, 36, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 39, 2, 2,
+ 41, 42, 37, 35, 2, 36, 2, 38, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 40, 32, 39, 2, 2, 2, 2, 2, 2, 2,
+ 44, 34, 43, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -454,7 +458,7 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31
+ 25, 26, 27, 28, 29, 30, 31, 32, 33
};
#if YYDEBUG
@@ -463,46 +467,47 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
- 20, 21, 26, 31, 36, 38, 46, 57, 59, 61,
- 63, 67, 71, 75, 79, 83, 87, 91, 95, 99,
- 102, 105, 109, 111, 115, 119, 121, 122, 123, 126,
- 129, 132, 135, 138, 140, 143, 146, 149, 152, 156,
- 159, 163, 166, 169, 171, 175, 178
+ 20, 21, 26, 31, 36, 38, 46, 57, 66, 68,
+ 72, 76, 79, 81, 82, 83, 86, 89, 91, 93,
+ 95, 99, 103, 107, 111, 115, 119, 123, 127, 131,
+ 134, 137, 141, 144, 147, 150, 152, 155, 158, 161,
+ 164, 168, 171, 175, 178, 181, 183, 187, 190
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 44, 0, -1, 45, 38, 44, -1, 45, -1, -1,
- 53, -1, 46, -1, 47, -1, 48, -1, 1, -1,
- -1, 22, 48, 14, 7, -1, 23, 7, 32, 48,
- -1, 23, 7, 25, 48, -1, 48, -1, 50, 49,
- 24, 52, 51, 11, 9, -1, 50, 49, 24, 52,
- 51, 10, 52, 51, 11, 9, -1, 5, -1, 7,
- -1, 46, -1, 48, 33, 48, -1, 48, 34, 48,
- -1, 48, 35, 48, -1, 48, 36, 48, -1, 48,
- 39, 48, -1, 48, 40, 48, -1, 48, 31, 48,
- -1, 48, 26, 48, -1, 48, 27, 48, -1, 33,
- 48, -1, 34, 48, -1, 41, 48, 42, -1, 48,
- -1, 48, 32, 48, -1, 41, 49, 42, -1, 9,
- -1, -1, -1, 52, 38, -1, 52, 47, -1, 16,
- 8, -1, 17, 7, -1, 22, 48, -1, 54, -1,
- 13, 15, -1, 13, 19, -1, 13, 21, -1, 13,
- 55, -1, 13, 55, 56, -1, 13, 56, -1, 25,
- 12, 8, -1, 12, 8, -1, 25, 8, -1, 8,
- -1, 20, 18, 8, -1, 18, 8, -1, 25, 18,
- 8, -1
+ 46, 0, -1, 47, 40, 46, -1, 47, -1, -1,
+ 56, -1, 48, -1, 49, -1, 55, -1, 1, -1,
+ -1, 22, 55, 14, 7, -1, 24, 7, 34, 55,
+ -1, 24, 7, 26, 55, -1, 55, -1, 52, 50,
+ 25, 54, 53, 11, 9, -1, 52, 50, 25, 54,
+ 53, 10, 54, 53, 11, 9, -1, 51, 41, 50,
+ 42, 54, 53, 11, 23, -1, 55, -1, 55, 34,
+ 55, -1, 41, 50, 42, -1, 23, 27, -1, 9,
+ -1, -1, -1, 54, 40, -1, 54, 49, -1, 5,
+ -1, 7, -1, 48, -1, 55, 35, 55, -1, 55,
+ 36, 55, -1, 55, 37, 55, -1, 55, 38, 55,
+ -1, 55, 43, 55, -1, 55, 44, 55, -1, 55,
+ 33, 55, -1, 55, 28, 55, -1, 55, 29, 55,
+ -1, 35, 55, -1, 36, 55, -1, 41, 55, 42,
+ -1, 16, 8, -1, 17, 7, -1, 22, 55, -1,
+ 57, -1, 13, 15, -1, 13, 19, -1, 13, 21,
+ -1, 13, 58, -1, 13, 58, 59, -1, 13, 59,
+ -1, 26, 12, 8, -1, 12, 8, -1, 26, 8,
+ -1, 8, -1, 20, 18, 8, -1, 18, 8, -1,
+ 26, 18, 8, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
0, 90, 90, 91, 94, 95, 96, 97, 98, 99,
- 100, 103, 104, 105, 108, 109, 115, 125, 126, 127,
- 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
- 138, 139, 142, 143, 144, 146, 148, 150, 151, 152,
- 155, 156, 157, 158, 169, 170, 171, 172, 173, 174,
- 177, 178, 179, 180, 183, 184, 185
+ 100, 103, 104, 105, 108, 109, 115, 127, 135, 136,
+ 137, 139, 141, 143, 145, 146, 147, 150, 151, 152,
+ 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
+ 163, 164, 167, 168, 169, 170, 181, 182, 183, 184,
+ 185, 186, 189, 190, 191, 192, 195, 196, 197
};
#endif
@@ -514,10 +519,11 @@ static const char *const yytname[] =
"$end", "error", "$undefined", "UNARY", "VOID", "INT", "FLOAT", "VAR",
"STRING", "tIF", "tELSE", "tEND", "tFRAME", "tGO", "tINTO", "tLOOP",
"tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT",
- "tSET", "tTHEN", "tTO", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='",
- "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'>'", "'<'", "'('", "')'",
- "$accept", "program", "programline", "asgn", "stmt", "expr", "cond",
- "if", "end", "stmtlist", "func", "gotofunc", "gotoframe", "gotomovie", 0
+ "tREPEAT", "tSET", "tTHEN", "tTO", "tWHILE", "tGE", "tLE", "tGT", "tLT",
+ "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('",
+ "')'", "'>'", "'<'", "$accept", "program", "programline", "asgn", "stmt",
+ "cond", "while", "if", "end", "stmtlist", "expr", "func", "gotofunc",
+ "gotoframe", "gotomovie", 0
};
#endif
@@ -529,31 +535,31 @@ static const yytype_uint16 yytoknum[] =
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 61, 43, 45, 42, 47, 37, 10, 62,
- 60, 40, 41
+ 285, 286, 287, 288, 61, 43, 45, 42, 47, 37,
+ 10, 40, 41, 62, 60
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 43, 44, 44, 45, 45, 45, 45, 45, 45,
- 45, 46, 46, 46, 47, 47, 47, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 49, 49, 49, 50, 51, 52, 52, 52,
- 53, 53, 53, 53, 54, 54, 54, 54, 54, 54,
- 55, 55, 55, 55, 56, 56, 56
+ 0, 45, 46, 46, 47, 47, 47, 47, 47, 47,
+ 47, 48, 48, 48, 49, 49, 49, 49, 50, 50,
+ 50, 51, 52, 53, 54, 54, 54, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 56, 56, 56, 56, 57, 57, 57, 57,
+ 57, 57, 58, 58, 58, 58, 59, 59, 59
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 0, 4, 4, 4, 1, 7, 10, 1, 1, 1,
+ 0, 4, 4, 4, 1, 7, 10, 8, 1, 3,
+ 3, 2, 1, 0, 0, 2, 2, 1, 1, 1,
3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
- 2, 3, 1, 3, 3, 1, 0, 0, 2, 2,
- 2, 2, 2, 1, 2, 2, 2, 2, 3, 2,
- 3, 2, 2, 1, 3, 2, 3
+ 2, 3, 2, 2, 2, 1, 2, 2, 2, 2,
+ 3, 2, 3, 2, 2, 1, 3, 2, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -561,49 +567,51 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 9, 17, 18, 35, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 3, 19, 7, 8, 0, 5,
- 43, 53, 0, 44, 0, 45, 0, 46, 0, 47,
- 49, 40, 41, 0, 19, 42, 0, 29, 30, 0,
- 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 32, 0, 51, 55, 0, 52, 0, 0,
- 0, 48, 0, 0, 0, 0, 31, 2, 27, 28,
- 26, 20, 21, 22, 23, 24, 25, 0, 0, 0,
- 37, 54, 50, 56, 11, 13, 12, 34, 33, 36,
- 38, 39, 14, 0, 37, 0, 36, 15, 0, 0,
+ 0, 9, 27, 28, 22, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 3, 29, 7, 0, 0,
+ 8, 5, 45, 55, 0, 46, 0, 47, 0, 48,
+ 0, 49, 51, 42, 43, 0, 29, 44, 21, 0,
+ 39, 40, 0, 1, 0, 0, 0, 0, 18, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 53, 57,
+ 0, 54, 0, 0, 0, 50, 0, 0, 0, 0,
+ 41, 2, 0, 0, 0, 24, 0, 37, 38, 36,
+ 30, 31, 32, 33, 34, 35, 56, 52, 58, 11,
+ 13, 12, 24, 20, 23, 19, 23, 25, 26, 0,
+ 14, 0, 24, 0, 0, 23, 15, 17, 0, 0,
16
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 13, 14, 34, 16, 17, 53, 18, 93, 89,
- 19, 20, 29, 30
+ -1, 14, 15, 36, 98, 47, 18, 19, 99, 94,
+ 100, 21, 22, 31, 32
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -42
+#define YYPACT_NINF -61
static const yytype_int16 yypact[] =
{
- 45, -42, -42, -42, -42, 107, 0, 5, 70, 9,
- 70, 70, 70, 7, -7, 11, -42, 148, 90, -42,
- -42, -42, 22, -42, 24, -42, 15, -42, -3, -1,
- -42, -42, -42, 70, -42, -13, 19, 165, 165, 120,
- -42, 45, 70, 70, 70, 70, 70, 70, 70, 70,
- 70, 90, 137, 29, -42, -42, 51, -42, 52, 55,
- 46, -42, -13, 58, 70, 70, -42, -42, 148, 148,
- 148, 159, 159, 165, 165, 148, 148, 103, 27, 70,
- -42, -42, -42, -42, -42, 148, 148, -42, 148, 67,
- -42, -42, 148, 18, -42, 57, 67, -42, 59, 64,
- -42
+ 58, -61, -61, -61, -61, 10, 26, -5, 2, 34,
+ 59, 2, 2, 2, 73, 44, 1, -61, 45, 65,
+ 122, -61, -61, -61, 77, -61, 96, -61, 90, -61,
+ 15, 150, -61, -61, -61, 2, -61, 74, -61, 71,
+ 134, 134, 98, -61, 58, 65, 65, 88, 110, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, -61, -61,
+ 108, -61, 117, 124, 119, -61, 74, 142, 2, 2,
+ -61, -61, 114, 127, 86, -61, 2, 122, 122, 122,
+ -23, -23, 134, 134, 122, 122, -61, -61, -61, -61,
+ 122, 122, -61, -61, 55, 122, 55, -61, -61, 6,
+ 122, 141, -61, 152, 148, 55, -61, -61, 153, 163,
+ -61
};
/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int8 yypgoto[] =
+static const yytype_int16 yypgoto[] =
{
- -42, 39, -42, 6, -41, -8, 31, -42, -12, -9,
- -42, -42, -42, 62
+ -61, 129, -61, 3, 4, -6, -61, -61, -13, -60,
+ 0, -61, -61, -61, 143
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -613,52 +621,46 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -7
static const yytype_int8 yytable[] =
{
- 35, 63, 37, 38, 39, 57, 15, 40, 31, 58,
- 52, -6, 32, 42, 43, 59, 36, 24, 44, 26,
- 45, 46, 47, 48, 60, 62, 49, 50, 94, 95,
- 54, 41, 55, 56, 68, 69, 70, 71, 72, 73,
- 74, 75, 76, 77, 64, -4, 1, 15, 91, -6,
- 2, 65, 3, 80, 4, 91, 85, 86, 5, 81,
- 82, 6, 7, 83, 59, 84, 97, 8, 9, 87,
- 99, 88, 2, 100, 3, 2, 4, 3, 10, 11,
- 67, 92, 78, -4, 98, 96, 12, 0, 92, 33,
- 9, 61, 33, 9, 0, 2, 0, 3, 0, 0,
- 10, 11, 0, 10, 11, 90, 0, 0, 12, 0,
- 0, 12, 33, 9, 0, 21, 0, 0, 0, 22,
- 0, 0, 23, 10, 11, 24, 25, 26, 27, 42,
- 43, 51, 28, 0, 44, 79, 45, 46, 47, 48,
- 0, 0, 49, 50, 0, 66, 42, 43, 0, 0,
- 0, 44, 0, 45, 46, 47, 48, 0, 0, 49,
- 50, 0, 66, 42, 43, 0, 0, 0, 44, 79,
- 45, 46, 47, 48, 42, 43, 49, 50, 0, 44,
- 0, 45, 46, 47, 48, 42, 43, 49, 50, 0,
- 44, 42, 43, 0, 47, 48, 44, 0, 49, 50,
- 0, 0, 0, 0, 49, 50
+ 20, -6, 34, 16, 17, 49, 50, 2, 37, 3,
+ 51, 40, 41, 42, 54, 55, 102, 103, 23, 48,
+ 56, 57, 24, 61, 35, 25, 10, 62, 26, 27,
+ 28, 29, 96, 63, 33, 66, 30, 11, 12, 72,
+ 73, -6, 105, 13, 20, 48, 74, 16, 17, 77,
+ 78, 79, 80, 81, 82, 83, 84, 85, -4, 1,
+ 2, 38, 3, 2, 4, 3, 39, 4, 90, 91,
+ 2, 5, 3, 43, 6, 7, 95, 35, 9, 10,
+ 8, 9, 10, 101, 44, 58, 45, 35, 67, 10,
+ 11, 12, 108, 11, 12, 97, 13, 68, -4, 13,
+ 11, 12, 49, 50, 59, 69, 46, 51, 60, 52,
+ 53, 54, 55, 75, 49, 50, 86, 56, 57, 51,
+ 76, 52, 53, 54, 55, 87, 49, 50, 70, 56,
+ 57, 51, 88, 52, 53, 54, 55, 63, 49, 50,
+ 70, 56, 57, 51, 76, 52, 53, 54, 55, 89,
+ 49, 50, 104, 56, 57, 51, 92, 52, 53, 54,
+ 55, 106, 49, 50, 109, 56, 57, 51, 26, 93,
+ 28, 107, 110, 71, 65, 0, 64, 56, 57
};
static const yytype_int8 yycheck[] =
{
- 8, 14, 10, 11, 12, 8, 0, 0, 8, 12,
- 18, 0, 7, 26, 27, 18, 7, 18, 31, 20,
- 33, 34, 35, 36, 25, 33, 39, 40, 10, 11,
- 8, 38, 8, 18, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 25, 0, 1, 41, 89, 38,
- 5, 32, 7, 24, 9, 96, 64, 65, 13, 8,
- 8, 16, 17, 8, 18, 7, 9, 22, 23, 42,
- 11, 79, 5, 9, 7, 5, 9, 7, 33, 34,
- 41, 89, 51, 38, 96, 94, 41, -1, 96, 22,
- 23, 29, 22, 23, -1, 5, -1, 7, -1, -1,
- 33, 34, -1, 33, 34, 38, -1, -1, 41, -1,
- -1, 41, 22, 23, -1, 8, -1, -1, -1, 12,
- -1, -1, 15, 33, 34, 18, 19, 20, 21, 26,
- 27, 41, 25, -1, 31, 32, 33, 34, 35, 36,
- -1, -1, 39, 40, -1, 42, 26, 27, -1, -1,
- -1, 31, -1, 33, 34, 35, 36, -1, -1, 39,
- 40, -1, 42, 26, 27, -1, -1, -1, 31, 32,
- 33, 34, 35, 36, 26, 27, 39, 40, -1, 31,
- -1, 33, 34, 35, 36, 26, 27, 39, 40, -1,
- 31, 26, 27, -1, 35, 36, 31, -1, 39, 40,
- -1, -1, -1, -1, 39, 40
+ 0, 0, 7, 0, 0, 28, 29, 5, 8, 7,
+ 33, 11, 12, 13, 37, 38, 10, 11, 8, 19,
+ 43, 44, 12, 8, 22, 15, 24, 12, 18, 19,
+ 20, 21, 92, 18, 8, 35, 26, 35, 36, 45,
+ 46, 40, 102, 41, 44, 45, 46, 44, 44, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57, 0, 1,
+ 5, 27, 7, 5, 9, 7, 7, 9, 68, 69,
+ 5, 13, 7, 0, 16, 17, 76, 22, 23, 24,
+ 22, 23, 24, 96, 40, 8, 41, 22, 14, 24,
+ 35, 36, 105, 35, 36, 40, 41, 26, 40, 41,
+ 35, 36, 28, 29, 8, 34, 41, 33, 18, 35,
+ 36, 37, 38, 25, 28, 29, 8, 43, 44, 33,
+ 34, 35, 36, 37, 38, 8, 28, 29, 42, 43,
+ 44, 33, 8, 35, 36, 37, 38, 18, 28, 29,
+ 42, 43, 44, 33, 34, 35, 36, 37, 38, 7,
+ 28, 29, 11, 43, 44, 33, 42, 35, 36, 37,
+ 38, 9, 28, 29, 11, 43, 44, 33, 18, 42,
+ 20, 23, 9, 44, 31, -1, 26, 43, 44
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -666,15 +668,16 @@ static const yytype_int8 yycheck[] =
static const yytype_uint8 yystos[] =
{
0, 1, 5, 7, 9, 13, 16, 17, 22, 23,
- 33, 34, 41, 44, 45, 46, 47, 48, 50, 53,
- 54, 8, 12, 15, 18, 19, 20, 21, 25, 55,
- 56, 8, 7, 22, 46, 48, 7, 48, 48, 48,
- 0, 38, 26, 27, 31, 33, 34, 35, 36, 39,
- 40, 41, 48, 49, 8, 8, 18, 8, 12, 18,
- 25, 56, 48, 14, 25, 32, 42, 44, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 49, 32,
- 24, 8, 8, 8, 7, 48, 48, 42, 48, 52,
- 38, 47, 48, 51, 10, 11, 52, 9, 51, 11,
+ 24, 35, 36, 41, 46, 47, 48, 49, 51, 52,
+ 55, 56, 57, 8, 12, 15, 18, 19, 20, 21,
+ 26, 58, 59, 8, 7, 22, 48, 55, 27, 7,
+ 55, 55, 55, 0, 40, 41, 41, 50, 55, 28,
+ 29, 33, 35, 36, 37, 38, 43, 44, 8, 8,
+ 18, 8, 12, 18, 26, 59, 55, 14, 26, 34,
+ 42, 46, 50, 50, 55, 25, 34, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 8, 8, 8, 7,
+ 55, 55, 42, 42, 54, 55, 54, 40, 49, 53,
+ 55, 53, 10, 11, 11, 54, 9, 23, 53, 11,
9
};
@@ -1547,183 +1550,198 @@ yyreduce:
break;
case 17:
-#line 125 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
+#line 127 "engines/director/lingo/lingo-gr.y"
+ {
+ inst body, end;
+ WRITE_LE_UINT32(&body, (yyvsp[(5) - (8)].code));
+ WRITE_LE_UINT32(&end, (yyvsp[(6) - (8)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = body; /* body of loop */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
case 18:
-#line 126 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;}
+#line 135 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(STOP); ;}
break;
- case 20:
-#line 128 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_add); ;}
+ case 19:
+#line 136 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
case 21:
-#line 129 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_sub); ;}
+#line 139 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = g_lingo->code3(g_lingo->c_whilecode, STOP, STOP); ;}
break;
case 22:
-#line 130 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_mul); ;}
+#line 141 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
case 23:
-#line 131 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_div); ;}
+#line 143 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 24:
-#line 132 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gt); ;}
- break;
-
- case 25:
-#line 133 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_lt); ;}
- break;
-
- case 26:
-#line 134 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_neq); ;}
+#line 145 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 27:
-#line 135 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_ge); ;}
+#line 150 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
break;
case 28:
-#line 136 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_le); ;}
- break;
-
- case 29:
-#line 137 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+#line 151 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
case 30:
-#line 138 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
+#line 153 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_add); ;}
break;
case 31:
-#line 139 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+#line 154 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_sub); ;}
break;
case 32:
-#line 142 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(STOP); ;}
+#line 155 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_mul); ;}
break;
case 33:
-#line 143 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code2(g_lingo->c_eq, STOP); ;}
+#line 156 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_div); ;}
+ break;
+
+ case 34:
+#line 157 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gt); ;}
break;
case 35:
-#line 146 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP,STOP,STOP); ;}
+#line 158 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_lt); ;}
break;
case 36:
-#line 148 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
+#line 159 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_neq); ;}
break;
case 37:
-#line 150 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->_currentScript->size(); ;}
+#line 160 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_ge); ;}
+ break;
+
+ case 38:
+#line 161 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_le); ;}
+ break;
+
+ case 39:
+#line 162 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 40:
-#line 155 "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); ;}
+#line 163 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 41:
-#line 156 "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); ;}
+#line 164 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 42:
-#line 157 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_printtop); ;}
+#line 167 "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 43:
+#line 168 "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 44:
#line 169 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_printtop); ;}
+ break;
+
+ case 46:
+#line 181 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 45:
-#line 170 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 182 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 46:
-#line 171 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 183 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 47:
-#line 172 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 184 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 48:
-#line 173 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 185 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
break;
- case 49:
-#line 174 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 186 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 50:
-#line 177 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 189 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 51:
-#line 178 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 190 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 52:
-#line 179 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 191 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 53:
-#line 180 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 192 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 54:
-#line 183 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 195 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 55:
-#line 184 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 196 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 56:
-#line 185 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 197 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1727 "engines/director/lingo/lingo-gr.cpp"
+#line 1745 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1937,6 +1955,6 @@ yyreturn:
}
-#line 228 "engines/director/lingo/lingo-gr.y"
+#line 236 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 7978269..e3b6ea9 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -59,15 +59,17 @@
tOF = 275,
tPREVIOUS = 276,
tPUT = 277,
- tSET = 278,
- tTHEN = 279,
- tTO = 280,
- tGE = 281,
- tLE = 282,
- tGT = 283,
- tLT = 284,
- tEQ = 285,
- tNEQ = 286
+ tREPEAT = 278,
+ tSET = 279,
+ tTHEN = 280,
+ tTO = 281,
+ tWHILE = 282,
+ tGE = 283,
+ tLE = 284,
+ tGT = 285,
+ tLT = 286,
+ tEQ = 287,
+ tNEQ = 288
};
#endif
/* Tokens. */
@@ -91,15 +93,17 @@
#define tOF 275
#define tPREVIOUS 276
#define tPUT 277
-#define tSET 278
-#define tTHEN 279
-#define tTO 280
-#define tGE 281
-#define tLE 282
-#define tGT 283
-#define tLT 284
-#define tEQ 285
-#define tNEQ 286
+#define tREPEAT 278
+#define tSET 279
+#define tTHEN 280
+#define tTO 281
+#define tWHILE 282
+#define tGE 283
+#define tLE 284
+#define tGT 285
+#define tLT 286
+#define tEQ 287
+#define tNEQ 288
@@ -114,7 +118,7 @@ typedef union YYSTYPE
int code;
}
/* Line 1529 of yacc.c. */
-#line 118 "engines/director/lingo/lingo-gr.hpp"
+#line 122 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 8d205b8..8e4f96d 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -74,10 +74,10 @@ using namespace Director;
%token<f> FLOAT
%token<s> VAR STRING
%token tIF tELSE tEND tFRAME tGO tINTO tLOOP tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS
-%token tPUT tSET tTHEN tTO
+%token tPUT tREPEAT tSET tTHEN tTO tWHILE
%token tGE tLE tGT tLT tEQ tNEQ
-%type<code> asgn cond expr if end stmtlist
+%type<code> asgn cond expr if end stmtlist while
%type<s> gotoframe gotomovie
%right '='
@@ -120,6 +120,31 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ // repeat while (expression = TRUE)
+ // statements
+ // end repeat
+ //
+ | while '(' cond ')' stmtlist end tEND tREPEAT {
+ inst body, end;
+ WRITE_LE_UINT32(&body, $5);
+ WRITE_LE_UINT32(&end, $6);
+ (*g_lingo->_currentScript)[$1 + 1] = body; /* body of loop */
+ (*g_lingo->_currentScript)[$1 + 2] = end; } /* end, if cond fails */
+ ;
+
+cond: expr { g_lingo->code1(STOP); }
+ | expr '=' expr { g_lingo->code2(g_lingo->c_eq, STOP); }
+ | '(' cond ')'
+ ;
+while: tREPEAT tWHILE { $$ = g_lingo->code3(g_lingo->c_whilecode, STOP, STOP); }
+ ;
+if: tIF { $$ = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); }
+ ;
+end: /* nothing */ { g_lingo->code1(STOP); $$ = g_lingo->_currentScript->size(); }
+ ;
+stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
+ | stmtlist '\n'
+ | stmtlist stmt
;
expr: INT { g_lingo->code1(g_lingo->c_constpush); inst i; WRITE_LE_UINT32(&i, $1); $$ = g_lingo->code1(i); };
@@ -139,19 +164,6 @@ expr: INT { g_lingo->code1(g_lingo->c_constpush); inst i; WRITE_LE_UINT32(&
| '(' expr ')' { $$ = $2; }
;
-cond: expr { g_lingo->code1(STOP); }
- | expr '=' expr { g_lingo->code2(g_lingo->c_eq, STOP); }
- | '(' cond ')'
- ;
-if: tIF { $$ = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP,STOP,STOP); }
- ;
-end: /* nothing */ { g_lingo->code1(STOP); $$ = g_lingo->_currentScript->size(); }
- ;
-stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
- | stmtlist '\n'
- | stmtlist stmt
- ;
-
func: tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_str()); delete $2; }
| tMCIWAIT VAR { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
| tPUT expr { g_lingo->code1(g_lingo->c_printtop); }
@@ -185,10 +197,6 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
| tTO tMOVIE STRING { $$ = $3; }
;
-// repeat while (expression = TRUE)
-// statements
-// end repeat
-//
// repeat with index = start to end
// statements
// end repeat
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index c79d281..bf322e2 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 30
-#define YY_END_OF_BUFFER 31
+#define YY_NUM_RULES 32
+#define YY_END_OF_BUFFER 33
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,17 +373,19 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[88] =
+static yyconst flex_int16_t yy_accept[99] =
{ 0,
- 0, 0, 31, 30, 3, 28, 30, 30, 27, 27,
- 26, 27, 27, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 2, 2, 3, 28, 21,
- 0, 29, 1, 25, 26, 23, 22, 24, 24, 24,
- 24, 8, 4, 24, 24, 24, 24, 24, 15, 24,
- 24, 24, 24, 20, 1, 25, 24, 6, 24, 24,
- 24, 11, 24, 24, 24, 17, 18, 24, 5, 24,
- 9, 10, 24, 24, 14, 24, 19, 7, 24, 13,
- 24, 24, 24, 12, 24, 16, 0
+ 0, 0, 33, 32, 3, 30, 32, 32, 29, 29,
+ 28, 29, 29, 26, 26, 26, 26, 26, 26, 26,
+ 26, 26, 26, 26, 26, 26, 26, 2, 2, 3,
+ 30, 23, 0, 31, 1, 27, 28, 25, 24, 26,
+ 26, 26, 26, 8, 4, 26, 26, 26, 26, 26,
+ 15, 26, 26, 26, 26, 26, 21, 26, 1, 27,
+ 26, 6, 26, 26, 26, 11, 26, 26, 26, 17,
+ 26, 19, 26, 26, 5, 26, 9, 10, 26, 26,
+ 14, 26, 26, 20, 26, 7, 26, 13, 26, 26,
+ 22, 26, 26, 18, 12, 26, 16, 0
+
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -426,70 +428,78 @@ static yyconst flex_int32_t yy_meta[36] =
4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[91] =
+static yyconst flex_int16_t yy_base[102] =
{ 0,
- 0, 34, 109, 110, 106, 34, 94, 99, 110, 96,
- 30, 91, 90, 0, 18, 73, 74, 23, 73, 28,
- 80, 78, 18, 78, 24, 94, 110, 93, 49, 110,
- 87, 110, 0, 82, 46, 110, 110, 0, 62, 73,
- 74, 0, 0, 58, 61, 64, 53, 50, 0, 65,
- 52, 51, 62, 0, 0, 69, 60, 0, 53, 50,
- 48, 41, 51, 42, 39, 0, 0, 45, 0, 51,
- 0, 0, 53, 49, 0, 44, 0, 0, 43, 0,
- 37, 32, 27, 0, 24, 0, 110, 57, 44, 61
+ 0, 34, 118, 119, 115, 34, 103, 108, 119, 105,
+ 30, 100, 99, 0, 18, 82, 83, 23, 82, 28,
+ 89, 87, 18, 87, 86, 24, 82, 101, 119, 100,
+ 49, 119, 94, 119, 0, 89, 46, 119, 119, 0,
+ 69, 80, 81, 0, 0, 65, 68, 71, 60, 57,
+ 0, 72, 59, 61, 57, 68, 0, 63, 0, 74,
+ 65, 0, 58, 55, 53, 46, 56, 47, 44, 0,
+ 57, 0, 49, 50, 0, 54, 0, 0, 56, 52,
+ 0, 47, 53, 0, 49, 0, 44, 0, 39, 33,
+ 0, 32, 27, 0, 0, 24, 0, 119, 57, 44,
+
+ 61
} ;
-static yyconst flex_int16_t yy_def[91] =
+static yyconst flex_int16_t yy_def[102] =
{ 0,
- 87, 1, 87, 87, 87, 87, 87, 88, 87, 87,
- 87, 87, 87, 89, 89, 89, 89, 89, 89, 89,
- 89, 89, 89, 89, 89, 87, 87, 87, 87, 87,
- 88, 87, 90, 87, 87, 87, 87, 89, 89, 89,
- 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
- 89, 89, 89, 89, 90, 87, 89, 89, 89, 89,
- 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
- 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
- 89, 89, 89, 89, 89, 89, 0, 87, 87, 87
+ 98, 1, 98, 98, 98, 98, 98, 99, 98, 98,
+ 98, 98, 98, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 98, 98, 98,
+ 98, 98, 99, 98, 101, 98, 98, 98, 98, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100, 101, 98,
+ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+ 100, 100, 100, 100, 100, 100, 100, 0, 98, 98,
+
+ 98
} ;
-static yyconst flex_int16_t yy_nxt[146] =
+static yyconst flex_int16_t yy_nxt[155] =
{ 0,
4, 5, 6, 6, 4, 7, 8, 9, 10, 4,
11, 12, 9, 13, 14, 14, 14, 14, 15, 16,
- 17, 14, 18, 19, 20, 21, 22, 23, 14, 24,
- 25, 14, 14, 14, 14, 26, 29, 29, 27, 34,
- 35, 39, 43, 40, 46, 53, 50, 38, 44, 51,
- 54, 29, 29, 86, 47, 34, 35, 31, 85, 31,
- 31, 55, 84, 83, 55, 82, 81, 80, 79, 78,
- 77, 76, 75, 74, 73, 72, 71, 70, 69, 56,
- 68, 67, 66, 65, 64, 63, 62, 61, 60, 59,
- 58, 57, 56, 32, 28, 28, 52, 49, 48, 45,
-
- 42, 41, 37, 36, 33, 32, 30, 28, 87, 3,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87
+ 17, 14, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 14, 14, 27, 14, 28, 31, 31, 29, 36,
+ 37, 41, 45, 42, 48, 56, 52, 40, 46, 53,
+ 57, 31, 31, 97, 49, 36, 37, 33, 96, 33,
+ 33, 59, 95, 94, 59, 93, 92, 91, 90, 89,
+ 88, 87, 86, 85, 84, 83, 82, 81, 80, 79,
+ 78, 77, 76, 75, 60, 74, 73, 72, 71, 70,
+ 69, 68, 67, 66, 65, 64, 63, 62, 61, 60,
+
+ 34, 30, 30, 58, 55, 54, 51, 50, 47, 44,
+ 43, 39, 38, 35, 34, 32, 30, 98, 3, 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,
+ 98, 98, 98, 98
} ;
-static yyconst flex_int16_t yy_chk[146] =
+static yyconst flex_int16_t yy_chk[155] =
{ 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, 2, 6, 6, 2, 11,
- 11, 15, 18, 15, 20, 25, 23, 89, 18, 23,
- 25, 29, 29, 85, 20, 35, 35, 88, 83, 88,
- 88, 90, 82, 81, 90, 79, 76, 74, 73, 70,
- 68, 65, 64, 63, 62, 61, 60, 59, 57, 56,
- 53, 52, 51, 50, 48, 47, 46, 45, 44, 41,
- 40, 39, 34, 31, 28, 26, 24, 22, 21, 19,
-
- 17, 16, 13, 12, 10, 8, 7, 5, 3, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87
+ 11, 15, 18, 15, 20, 26, 23, 100, 18, 23,
+ 26, 31, 31, 96, 20, 37, 37, 99, 93, 99,
+ 99, 101, 92, 90, 101, 89, 87, 85, 83, 82,
+ 80, 79, 76, 74, 73, 71, 69, 68, 67, 66,
+ 65, 64, 63, 61, 60, 58, 56, 55, 54, 53,
+ 52, 50, 49, 48, 47, 46, 43, 42, 41, 36,
+
+ 33, 30, 28, 27, 25, 24, 22, 21, 19, 17,
+ 16, 13, 12, 10, 8, 7, 5, 3, 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, 98,
+ 98, 98, 98, 98
} ;
static yy_state_type yy_last_accepting_state;
@@ -539,7 +549,7 @@ char *yytext;
int yyparse();
-#line 543 "engines/director/lingo/lingo-lex.cpp"
+#line 553 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -727,7 +737,7 @@ YY_DECL
#line 45 "engines/director/lingo/lingo-lex.l"
-#line 731 "engines/director/lingo/lingo-lex.cpp"
+#line 741 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -781,13 +791,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 >= 88 )
+ if ( yy_current_state >= 99 )
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] != 110 );
+ while ( yy_base[yy_current_state] != 119 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -899,70 +909,80 @@ YY_RULE_SETUP
case 18:
YY_RULE_SETUP
#line 65 "engines/director/lingo/lingo-lex.l"
-{ return tSET; }
+{ return tREPEAT; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 66 "engines/director/lingo/lingo-lex.l"
-{ return tTHEN; }
+{ return tSET; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 67 "engines/director/lingo/lingo-lex.l"
-{ return tTO; }
+{ return tTHEN; }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 69 "engines/director/lingo/lingo-lex.l"
-{ return tNEQ; }
+#line 68 "engines/director/lingo/lingo-lex.l"
+{ return tTO; }
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 70 "engines/director/lingo/lingo-lex.l"
-{ return tGE; }
+#line 69 "engines/director/lingo/lingo-lex.l"
+{ return tWHILE; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 71 "engines/director/lingo/lingo-lex.l"
-{ return tLE; }
+{ return tNEQ; }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 73 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+#line 72 "engines/director/lingo/lingo-lex.l"
+{ return tGE; }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 74 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+#line 73 "engines/director/lingo/lingo-lex.l"
+{ return tLE; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 75 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ yylval.s = new Common::String(yytext); return VAR; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 76 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 28:
-/* rule 28 can match eol */
YY_RULE_SETUP
#line 77 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 78 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return *yytext; }
YY_BREAK
case 30:
+/* rule 30 can match eol */
+YY_RULE_SETUP
+#line 79 "engines/director/lingo/lingo-lex.l"
+{ return '\n'; }
+ YY_BREAK
+case 31:
YY_RULE_SETUP
#line 80 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+ YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 82 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 966 "engines/director/lingo/lingo-lex.cpp"
+#line 986 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1255,7 +1275,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 >= 88 )
+ if ( yy_current_state >= 99 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1283,11 +1303,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 >= 88 )
+ if ( yy_current_state >= 99 )
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 == 87);
+ yy_is_jam = (yy_current_state == 98);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1962,7 +1982,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 80 "engines/director/lingo/lingo-lex.l"
+#line 82 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index a95303f..07d9a63 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -62,9 +62,11 @@ next { return tNEXT; }
of { return tOF; }
previous { return tPREVIOUS; }
put { return tPUT; }
+repeat { return tREPEAT; }
set { return tSET; }
then { return tTHEN; }
to { return tTO; }
+while { return tWHILE; }
[!][=] { return tNEQ; }
[>][=] { return tGE; }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 35ac6ae..4cf5b99 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -132,6 +132,7 @@ public:
static void c_assign();
bool verify(Symbol *s);
static void c_eval();
+ static void c_whilecode();
static void c_ifcode();
static void c_eq();
static void c_neq();
Commit: db8e68c6b68373a0e8de4c5641485814d8777e82
https://github.com/scummvm/scummvm/commit/db8e68c6b68373a0e8de4c5641485814d8777e82
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix code generation
Changed paths:
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 4cf5b99..f167e28 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -108,8 +108,8 @@ public:
void processEvent(LEvent event, int entityId);
int code1(inst code) { _currentScript->push_back(code); return _currentScript->size() - 1; }
- int code2(inst code_1, inst code_2) { code1(code_1); return code1(code_2); }
- int code3(inst code_1, inst code_2, inst code_3) { code1(code_1); code1(code_2); return code1(code_3); }
+ int code2(inst code_1, inst code_2) { int o = code1(code_1); code1(code_2); return o; }
+ int code3(inst code_1, inst code_2, inst code_3) { int o = code1(code_1); code1(code_2); code1(code_3); return o; }
int codeString(const char *s);
int calcStringAlignment(const char *s) {
Commit: ad9e2fd0e5aa02f5d2ff08034a40f220c604c3cf
https://github.com/scummvm/scummvm/commit/ad9e2fd0e5aa02f5d2ff08034a40f220c604c3cf
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix subexpressions
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index dd1433b..9a5fbab 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -91,7 +91,13 @@ if (x = 5) then\n\
else\n\
set x = 8\n\
end if\n\
-put x", kMovieScript, 3);
+put x\n\
+set y = 1\n\
+repeat while (y < 5)\n\
+ set y = y + 1\n\
+ put y\n\
+end repeat\n\
+", kMovieScript, 3);
_lingo->executeScript(kMovieScript, 3);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 17109ef..7b0932b 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -409,16 +409,16 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 43
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 178
+#define YYLAST 204
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 45
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 15
/* YYNRULES -- Number of rules. */
-#define YYNRULES 58
+#define YYNRULES 59
/* YYNRULES -- Number of states. */
-#define YYNSTATES 111
+#define YYNSTATES 112
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -467,11 +467,11 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
- 20, 21, 26, 31, 36, 38, 46, 57, 66, 68,
- 72, 76, 79, 81, 82, 83, 86, 89, 91, 93,
- 95, 99, 103, 107, 111, 115, 119, 123, 127, 131,
- 134, 137, 141, 144, 147, 150, 152, 155, 158, 161,
- 164, 168, 171, 175, 178, 181, 183, 187, 190
+ 20, 21, 26, 31, 36, 38, 40, 48, 59, 68,
+ 70, 74, 78, 81, 83, 84, 85, 88, 91, 93,
+ 95, 97, 101, 105, 109, 113, 117, 121, 125, 129,
+ 133, 136, 139, 143, 146, 149, 152, 154, 157, 160,
+ 163, 166, 170, 173, 177, 180, 183, 185, 189, 192
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -480,34 +480,34 @@ static const yytype_int8 yyrhs[] =
46, 0, -1, 47, 40, 46, -1, 47, -1, -1,
56, -1, 48, -1, 49, -1, 55, -1, 1, -1,
-1, 22, 55, 14, 7, -1, 24, 7, 34, 55,
- -1, 24, 7, 26, 55, -1, 55, -1, 52, 50,
- 25, 54, 53, 11, 9, -1, 52, 50, 25, 54,
- 53, 10, 54, 53, 11, 9, -1, 51, 41, 50,
- 42, 54, 53, 11, 23, -1, 55, -1, 55, 34,
- 55, -1, 41, 50, 42, -1, 23, 27, -1, 9,
- -1, -1, -1, 54, 40, -1, 54, 49, -1, 5,
- -1, 7, -1, 48, -1, 55, 35, 55, -1, 55,
- 36, 55, -1, 55, 37, 55, -1, 55, 38, 55,
- -1, 55, 43, 55, -1, 55, 44, 55, -1, 55,
- 33, 55, -1, 55, 28, 55, -1, 55, 29, 55,
- -1, 35, 55, -1, 36, 55, -1, 41, 55, 42,
- -1, 16, 8, -1, 17, 7, -1, 22, 55, -1,
- 57, -1, 13, 15, -1, 13, 19, -1, 13, 21,
- -1, 13, 58, -1, 13, 58, 59, -1, 13, 59,
- -1, 26, 12, 8, -1, 12, 8, -1, 26, 8,
- -1, 8, -1, 20, 18, 8, -1, 18, 8, -1,
- 26, 18, 8, -1
+ -1, 24, 7, 26, 55, -1, 55, -1, 56, -1,
+ 52, 50, 25, 54, 53, 11, 9, -1, 52, 50,
+ 25, 54, 53, 10, 54, 53, 11, 9, -1, 51,
+ 41, 50, 42, 54, 53, 11, 23, -1, 55, -1,
+ 55, 34, 55, -1, 41, 50, 42, -1, 23, 27,
+ -1, 9, -1, -1, -1, 54, 40, -1, 54, 49,
+ -1, 5, -1, 7, -1, 48, -1, 55, 35, 55,
+ -1, 55, 36, 55, -1, 55, 37, 55, -1, 55,
+ 38, 55, -1, 55, 43, 55, -1, 55, 44, 55,
+ -1, 55, 33, 55, -1, 55, 28, 55, -1, 55,
+ 29, 55, -1, 35, 55, -1, 36, 55, -1, 41,
+ 55, 42, -1, 16, 8, -1, 17, 7, -1, 22,
+ 55, -1, 57, -1, 13, 15, -1, 13, 19, -1,
+ 13, 21, -1, 13, 58, -1, 13, 58, 59, -1,
+ 13, 59, -1, 26, 12, 8, -1, 12, 8, -1,
+ 26, 8, -1, 8, -1, 20, 18, 8, -1, 18,
+ 8, -1, 26, 18, 8, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
0, 90, 90, 91, 94, 95, 96, 97, 98, 99,
- 100, 103, 104, 105, 108, 109, 115, 127, 135, 136,
- 137, 139, 141, 143, 145, 146, 147, 150, 151, 152,
+ 100, 103, 104, 105, 108, 109, 110, 116, 128, 136,
+ 137, 138, 140, 142, 144, 146, 147, 148, 151, 152,
153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
- 163, 164, 167, 168, 169, 170, 181, 182, 183, 184,
- 185, 186, 189, 190, 191, 192, 195, 196, 197
+ 163, 164, 165, 168, 169, 170, 171, 182, 183, 184,
+ 185, 186, 187, 190, 191, 192, 193, 196, 197, 198
};
#endif
@@ -544,22 +544,22 @@ static const yytype_uint16 yytoknum[] =
static const yytype_uint8 yyr1[] =
{
0, 45, 46, 46, 47, 47, 47, 47, 47, 47,
- 47, 48, 48, 48, 49, 49, 49, 49, 50, 50,
- 50, 51, 52, 53, 54, 54, 54, 55, 55, 55,
+ 47, 48, 48, 48, 49, 49, 49, 49, 49, 50,
+ 50, 50, 51, 52, 53, 54, 54, 54, 55, 55,
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
- 55, 55, 56, 56, 56, 56, 57, 57, 57, 57,
- 57, 57, 58, 58, 58, 58, 59, 59, 59
+ 55, 55, 55, 56, 56, 56, 56, 57, 57, 57,
+ 57, 57, 57, 58, 58, 58, 58, 59, 59, 59
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 0, 4, 4, 4, 1, 7, 10, 8, 1, 3,
- 3, 2, 1, 0, 0, 2, 2, 1, 1, 1,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
- 2, 3, 2, 2, 2, 1, 2, 2, 2, 2,
- 3, 2, 3, 2, 2, 1, 3, 2, 3
+ 0, 4, 4, 4, 1, 1, 7, 10, 8, 1,
+ 3, 3, 2, 1, 0, 0, 2, 2, 1, 1,
+ 1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 2, 2, 3, 2, 2, 2, 1, 2, 2, 2,
+ 2, 3, 2, 3, 2, 2, 1, 3, 2, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -567,51 +567,51 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 9, 27, 28, 22, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 3, 29, 7, 0, 0,
- 8, 5, 45, 55, 0, 46, 0, 47, 0, 48,
- 0, 49, 51, 42, 43, 0, 29, 44, 21, 0,
- 39, 40, 0, 1, 0, 0, 0, 0, 18, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 53, 57,
- 0, 54, 0, 0, 0, 50, 0, 0, 0, 0,
- 41, 2, 0, 0, 0, 24, 0, 37, 38, 36,
- 30, 31, 32, 33, 34, 35, 56, 52, 58, 11,
- 13, 12, 24, 20, 23, 19, 23, 25, 26, 0,
- 14, 0, 24, 0, 0, 23, 15, 17, 0, 0,
- 16
+ 0, 9, 28, 29, 23, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 3, 30, 7, 0, 0,
+ 8, 5, 46, 56, 0, 47, 0, 48, 0, 49,
+ 0, 50, 52, 43, 44, 0, 30, 45, 22, 0,
+ 40, 41, 0, 1, 0, 0, 0, 0, 19, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 54, 58,
+ 0, 55, 0, 0, 0, 51, 0, 0, 0, 0,
+ 42, 2, 0, 0, 0, 25, 0, 38, 39, 37,
+ 31, 32, 33, 34, 35, 36, 57, 53, 59, 11,
+ 13, 12, 25, 21, 24, 20, 24, 26, 27, 0,
+ 14, 15, 0, 25, 0, 0, 24, 16, 18, 0,
+ 0, 17
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
-1, 14, 15, 36, 98, 47, 18, 19, 99, 94,
- 100, 21, 22, 31, 32
+ 100, 101, 22, 31, 32
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -61
+#define YYPACT_NINF -77
static const yytype_int16 yypact[] =
{
- 58, -61, -61, -61, -61, 10, 26, -5, 2, 34,
- 59, 2, 2, 2, 73, 44, 1, -61, 45, 65,
- 122, -61, -61, -61, 77, -61, 96, -61, 90, -61,
- 15, 150, -61, -61, -61, 2, -61, 74, -61, 71,
- 134, 134, 98, -61, 58, 65, 65, 88, 110, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, -61, -61,
- 108, -61, 117, 124, 119, -61, 74, 142, 2, 2,
- -61, -61, 114, 127, 86, -61, 2, 122, 122, 122,
- -23, -23, 134, 134, 122, 122, -61, -61, -61, -61,
- 122, 122, -61, -61, 55, 122, 55, -61, -61, 6,
- 122, 141, -61, 152, 148, 55, -61, -61, 153, 163,
- -61
+ 65, -77, -77, -77, -77, 10, -6, 8, 2, -10,
+ 27, 2, 2, 2, 39, 24, 1, -77, 30, 89,
+ 148, -77, -77, -77, 34, -77, 71, -77, 62, -77,
+ 55, 57, -77, -77, -77, 2, -77, 100, -77, 6,
+ -23, -23, 124, -77, 65, 89, 89, 59, 136, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, -77, -77,
+ 77, -77, 78, 82, 74, -77, 100, 90, 2, 2,
+ -77, -77, 56, 70, 112, -77, 2, 148, 148, 148,
+ 160, 160, -23, -23, 148, 148, -77, -77, -77, -77,
+ 148, 148, -77, -77, 86, 148, 86, -77, -77, 49,
+ 148, -77, 93, -77, 98, 92, 86, -77, -77, 105,
+ 108, -77
};
/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int16 yypgoto[] =
+static const yytype_int8 yypgoto[] =
{
- -61, 129, -61, 3, 4, -6, -61, -61, -13, -60,
- 0, -61, -61, -61, 143
+ -77, 75, -77, 3, 4, 16, -77, -77, -73, -76,
+ 0, 14, -77, -77, 87
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -621,46 +621,52 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -7
static const yytype_int8 yytable[] =
{
- 20, -6, 34, 16, 17, 49, 50, 2, 37, 3,
- 51, 40, 41, 42, 54, 55, 102, 103, 23, 48,
- 56, 57, 24, 61, 35, 25, 10, 62, 26, 27,
- 28, 29, 96, 63, 33, 66, 30, 11, 12, 72,
- 73, -6, 105, 13, 20, 48, 74, 16, 17, 77,
- 78, 79, 80, 81, 82, 83, 84, 85, -4, 1,
- 2, 38, 3, 2, 4, 3, 39, 4, 90, 91,
- 2, 5, 3, 43, 6, 7, 95, 35, 9, 10,
- 8, 9, 10, 101, 44, 58, 45, 35, 67, 10,
- 11, 12, 108, 11, 12, 97, 13, 68, -4, 13,
- 11, 12, 49, 50, 59, 69, 46, 51, 60, 52,
- 53, 54, 55, 75, 49, 50, 86, 56, 57, 51,
- 76, 52, 53, 54, 55, 87, 49, 50, 70, 56,
- 57, 51, 88, 52, 53, 54, 55, 63, 49, 50,
- 70, 56, 57, 51, 76, 52, 53, 54, 55, 89,
- 49, 50, 104, 56, 57, 51, 92, 52, 53, 54,
- 55, 106, 49, 50, 109, 56, 57, 51, 26, 93,
- 28, 107, 110, 71, 65, 0, 64, 56, 57
+ 20, -6, 33, 16, 17, 49, 50, 2, 37, 3,
+ 51, 40, 41, 42, 21, 34, 96, 38, 23, 48,
+ 56, 57, 24, 102, 35, 25, 10, 106, 26, 27,
+ 28, 29, 68, 109, 39, 66, 30, 11, 12, 43,
+ 69, -6, 58, 13, 20, 48, 74, 16, 17, 77,
+ 78, 79, 80, 81, 82, 83, 84, 85, 21, 103,
+ 104, 72, 73, 61, 44, -4, 1, 62, 90, 91,
+ 2, 45, 3, 63, 4, 26, 95, 28, 5, 59,
+ 60, 6, 7, 64, 75, 86, 87, 8, 9, 10,
+ 88, 2, 63, 3, 2, 4, 3, 89, 92, 5,
+ 11, 12, 6, 7, 105, -4, 13, 107, 8, 9,
+ 10, 35, 93, 10, 67, 108, 110, 111, 65, 71,
+ 0, 11, 12, 0, 11, 12, 97, 13, 49, 50,
+ 46, 0, 0, 51, 0, 52, 53, 54, 55, 0,
+ 49, 50, 0, 56, 57, 51, 76, 52, 53, 54,
+ 55, 0, 49, 50, 70, 56, 57, 51, 0, 52,
+ 53, 54, 55, 0, 49, 50, 70, 56, 57, 51,
+ 76, 52, 53, 54, 55, 0, 49, 50, 0, 56,
+ 57, 51, 0, 52, 53, 54, 55, 0, 49, 50,
+ 0, 56, 57, 51, 0, 0, 0, 54, 55, 0,
+ 0, 0, 0, 56, 57
};
static const yytype_int8 yycheck[] =
{
- 0, 0, 7, 0, 0, 28, 29, 5, 8, 7,
- 33, 11, 12, 13, 37, 38, 10, 11, 8, 19,
- 43, 44, 12, 8, 22, 15, 24, 12, 18, 19,
- 20, 21, 92, 18, 8, 35, 26, 35, 36, 45,
- 46, 40, 102, 41, 44, 45, 46, 44, 44, 49,
- 50, 51, 52, 53, 54, 55, 56, 57, 0, 1,
- 5, 27, 7, 5, 9, 7, 7, 9, 68, 69,
- 5, 13, 7, 0, 16, 17, 76, 22, 23, 24,
- 22, 23, 24, 96, 40, 8, 41, 22, 14, 24,
- 35, 36, 105, 35, 36, 40, 41, 26, 40, 41,
- 35, 36, 28, 29, 8, 34, 41, 33, 18, 35,
- 36, 37, 38, 25, 28, 29, 8, 43, 44, 33,
- 34, 35, 36, 37, 38, 8, 28, 29, 42, 43,
- 44, 33, 8, 35, 36, 37, 38, 18, 28, 29,
- 42, 43, 44, 33, 34, 35, 36, 37, 38, 7,
- 28, 29, 11, 43, 44, 33, 42, 35, 36, 37,
- 38, 9, 28, 29, 11, 43, 44, 33, 18, 42,
- 20, 23, 9, 44, 31, -1, 26, 43, 44
+ 0, 0, 8, 0, 0, 28, 29, 5, 8, 7,
+ 33, 11, 12, 13, 0, 7, 92, 27, 8, 19,
+ 43, 44, 12, 96, 22, 15, 24, 103, 18, 19,
+ 20, 21, 26, 106, 7, 35, 26, 35, 36, 0,
+ 34, 40, 8, 41, 44, 45, 46, 44, 44, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57, 44, 10,
+ 11, 45, 46, 8, 40, 0, 1, 12, 68, 69,
+ 5, 41, 7, 18, 9, 18, 76, 20, 13, 8,
+ 18, 16, 17, 26, 25, 8, 8, 22, 23, 24,
+ 8, 5, 18, 7, 5, 9, 7, 7, 42, 13,
+ 35, 36, 16, 17, 11, 40, 41, 9, 22, 23,
+ 24, 22, 42, 24, 14, 23, 11, 9, 31, 44,
+ -1, 35, 36, -1, 35, 36, 40, 41, 28, 29,
+ 41, -1, -1, 33, -1, 35, 36, 37, 38, -1,
+ 28, 29, -1, 43, 44, 33, 34, 35, 36, 37,
+ 38, -1, 28, 29, 42, 43, 44, 33, -1, 35,
+ 36, 37, 38, -1, 28, 29, 42, 43, 44, 33,
+ 34, 35, 36, 37, 38, -1, 28, 29, -1, 43,
+ 44, 33, -1, 35, 36, 37, 38, -1, 28, 29,
+ -1, 43, 44, 33, -1, -1, -1, 37, 38, -1,
+ -1, -1, -1, 43, 44
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -677,8 +683,8 @@ static const yytype_uint8 yystos[] =
42, 46, 50, 50, 55, 25, 34, 55, 55, 55,
55, 55, 55, 55, 55, 55, 8, 8, 8, 7,
55, 55, 42, 42, 54, 55, 54, 40, 49, 53,
- 55, 53, 10, 11, 11, 54, 9, 23, 53, 11,
- 9
+ 55, 56, 53, 10, 11, 11, 54, 9, 23, 53,
+ 11, 9
};
#define yyerrok (yyerrstatus = 0)
@@ -1527,8 +1533,8 @@ yyreduce:
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 15:
-#line 109 "engines/director/lingo/lingo-gr.y"
+ case 16:
+#line 110 "engines/director/lingo/lingo-gr.y"
{
inst then, end;
WRITE_LE_UINT32(&then, (yyvsp[(4) - (7)].code));
@@ -1537,8 +1543,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; ;}
break;
- case 16:
-#line 115 "engines/director/lingo/lingo-gr.y"
+ case 17:
+#line 116 "engines/director/lingo/lingo-gr.y"
{
inst then, else1, end;
WRITE_LE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1549,8 +1555,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
break;
- case 17:
-#line 127 "engines/director/lingo/lingo-gr.y"
+ case 18:
+#line 128 "engines/director/lingo/lingo-gr.y"
{
inst body, end;
WRITE_LE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1559,159 +1565,154 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
- case 18:
-#line 135 "engines/director/lingo/lingo-gr.y"
+ case 19:
+#line 136 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 19:
-#line 136 "engines/director/lingo/lingo-gr.y"
+ case 20:
+#line 137 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 21:
-#line 139 "engines/director/lingo/lingo-gr.y"
+ case 22:
+#line 140 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_whilecode, STOP, STOP); ;}
break;
- case 22:
-#line 141 "engines/director/lingo/lingo-gr.y"
+ case 23:
+#line 142 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
- case 23:
-#line 143 "engines/director/lingo/lingo-gr.y"
+ case 24:
+#line 144 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 24:
-#line 145 "engines/director/lingo/lingo-gr.y"
+ case 25:
+#line 146 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 27:
-#line 150 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
- break;
-
case 28:
#line 151 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;}
+ { g_lingo->code1(g_lingo->c_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
break;
- case 30:
-#line 153 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_add); ;}
+ case 29:
+#line 152 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
case 31:
#line 154 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_sub); ;}
+ { g_lingo->code1(g_lingo->c_add); ;}
break;
case 32:
#line 155 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_mul); ;}
+ { g_lingo->code1(g_lingo->c_sub); ;}
break;
case 33:
#line 156 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_div); ;}
+ { g_lingo->code1(g_lingo->c_mul); ;}
break;
case 34:
#line 157 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gt); ;}
+ { g_lingo->code1(g_lingo->c_div); ;}
break;
case 35:
#line 158 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_lt); ;}
+ { g_lingo->code1(g_lingo->c_gt); ;}
break;
case 36:
#line 159 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_neq); ;}
+ { g_lingo->code1(g_lingo->c_lt); ;}
break;
case 37:
#line 160 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_ge); ;}
+ { g_lingo->code1(g_lingo->c_neq); ;}
break;
case 38:
#line 161 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_le); ;}
+ { g_lingo->code1(g_lingo->c_ge); ;}
break;
case 39:
#line 162 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+ { g_lingo->code1(g_lingo->c_le); ;}
break;
case 40:
#line 163 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 41:
#line 164 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 42:
-#line 167 "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); ;}
+#line 165 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 43:
#line 168 "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); ;}
+ { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 44:
#line 169 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_printtop); ;}
+ { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 46:
-#line 181 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoloop); ;}
+ case 45:
+#line 170 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 47:
#line 182 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotonext); ;}
+ { g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 48:
#line 183 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoprevious); ;}
+ { g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 49:
#line 184 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
+ { g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 50:
#line 185 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
+ { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
break;
case 51:
#line 186 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
break;
case 52:
-#line 189 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 187 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 53:
#line 190 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 54:
@@ -1721,27 +1722,32 @@ yyreduce:
case 55:
#line 192 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 56:
-#line 195 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 193 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 57:
#line 196 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 58:
#line 197 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 59:
+#line 198 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1745 "engines/director/lingo/lingo-gr.cpp"
+#line 1751 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1955,6 +1961,6 @@ yyreturn:
}
-#line 236 "engines/director/lingo/lingo-gr.y"
+#line 237 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 8e4f96d..179359c 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -106,6 +106,7 @@ asgn: tPUT expr tINTO VAR { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeSt
;
stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
+ | func
| if cond tTHEN stmtlist end tEND tIF {
inst then, end;
WRITE_LE_UINT32(&then, $4);
Commit: 0f3295c98f1bf846e0e7183d4fbafb1a767de75f
https://github.com/scummvm/scummvm/commit/0f3295c98f1bf846e0e7183d4fbafb1a767de75f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Initial code for 'repeat with' control keyword
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 85da696..e0ec7e8 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -247,7 +247,7 @@ void Lingo::c_le() {
g_lingo->push(d1);
}
-void Lingo::c_whilecode(void) {
+void Lingo::c_repeatwhilecode(void) {
Datum d;
int savepc = g_lingo->_pc;
@@ -270,6 +270,32 @@ void Lingo::c_whilecode(void) {
g_lingo->_pc = end; /* next stmt */
}
+void Lingo::c_repeatwithcode(void) {
+ Datum d;
+ int savepc = g_lingo->_pc;
+
+ int init = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc]);
+ int finish = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
+ int body = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 3]);
+ int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 4]);
+ Common::String counter((char *)&(*g_lingo->_currentScript)[savepc + 5]);
+
+ g_lingo->execute(init); /* condition */
+ d = g_lingo->pop();
+
+ while (d.val) {
+ g_lingo->execute(body); /* body */
+ if (0 /* returning */)
+ break;
+
+ g_lingo->execute(finish); /* condition */
+ d = g_lingo->pop();
+ }
+
+ //if (!returning)
+ g_lingo->_pc = end; /* next stmt */
+}
+
void Lingo::c_ifcode() {
Datum d;
int savepc = g_lingo->_pc; /* then part */
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 7b0932b..d6f01b6 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -72,31 +72,33 @@
FLOAT = 261,
VAR = 262,
STRING = 263,
- tIF = 264,
+ tDOWN = 264,
tELSE = 265,
tEND = 266,
tFRAME = 267,
tGO = 268,
- tINTO = 269,
- tLOOP = 270,
- tMCI = 271,
- tMCIWAIT = 272,
- tMOVIE = 273,
- tNEXT = 274,
- tOF = 275,
- tPREVIOUS = 276,
- tPUT = 277,
- tREPEAT = 278,
- tSET = 279,
- tTHEN = 280,
- tTO = 281,
- tWHILE = 282,
- tGE = 283,
- tLE = 284,
- tGT = 285,
- tLT = 286,
- tEQ = 287,
- tNEQ = 288
+ tIF = 269,
+ tINTO = 270,
+ tLOOP = 271,
+ tMCI = 272,
+ tMCIWAIT = 273,
+ tMOVIE = 274,
+ tNEXT = 275,
+ tOF = 276,
+ tPREVIOUS = 277,
+ tPUT = 278,
+ tREPEAT = 279,
+ tSET = 280,
+ tTHEN = 281,
+ tTO = 282,
+ tWITH = 283,
+ tWHILE = 284,
+ tGE = 285,
+ tLE = 286,
+ tGT = 287,
+ tLT = 288,
+ tEQ = 289,
+ tNEQ = 290
};
#endif
/* Tokens. */
@@ -106,31 +108,33 @@
#define FLOAT 261
#define VAR 262
#define STRING 263
-#define tIF 264
+#define tDOWN 264
#define tELSE 265
#define tEND 266
#define tFRAME 267
#define tGO 268
-#define tINTO 269
-#define tLOOP 270
-#define tMCI 271
-#define tMCIWAIT 272
-#define tMOVIE 273
-#define tNEXT 274
-#define tOF 275
-#define tPREVIOUS 276
-#define tPUT 277
-#define tREPEAT 278
-#define tSET 279
-#define tTHEN 280
-#define tTO 281
-#define tWHILE 282
-#define tGE 283
-#define tLE 284
-#define tGT 285
-#define tLT 286
-#define tEQ 287
-#define tNEQ 288
+#define tIF 269
+#define tINTO 270
+#define tLOOP 271
+#define tMCI 272
+#define tMCIWAIT 273
+#define tMOVIE 274
+#define tNEXT 275
+#define tOF 276
+#define tPREVIOUS 277
+#define tPUT 278
+#define tREPEAT 279
+#define tSET 280
+#define tTHEN 281
+#define tTO 282
+#define tWITH 283
+#define tWHILE 284
+#define tGE 285
+#define tLE 286
+#define tGT 287
+#define tLT 288
+#define tEQ 289
+#define tNEQ 290
@@ -181,7 +185,7 @@ typedef union YYSTYPE
int code;
}
/* Line 193 of yacc.c. */
-#line 185 "engines/director/lingo/lingo-gr.cpp"
+#line 189 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -194,7 +198,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 198 "engines/director/lingo/lingo-gr.cpp"
+#line 202 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -407,22 +411,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 43
+#define YYFINAL 45
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 204
+#define YYLAST 226
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 45
+#define YYNTOKENS 47
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 15
+#define YYNNTS 16
/* YYNRULES -- Number of rules. */
-#define YYNRULES 59
+#define YYNRULES 61
/* YYNRULES -- Number of states. */
-#define YYNSTATES 112
+#define YYNSTATES 123
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 288
+#define YYMAXUTOK 290
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -431,12 +435,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 40, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 42, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 39, 2, 2,
- 41, 42, 37, 35, 2, 36, 2, 38, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 41, 2, 2,
+ 43, 44, 39, 37, 2, 38, 2, 40, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 44, 34, 43, 2, 2, 2, 2, 2, 2, 2,
+ 46, 36, 45, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -458,7 +462,8 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35
};
#if YYDEBUG
@@ -468,46 +473,49 @@ static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
20, 21, 26, 31, 36, 38, 40, 48, 59, 68,
- 70, 74, 78, 81, 83, 84, 85, 88, 91, 93,
- 95, 97, 101, 105, 109, 113, 117, 121, 125, 129,
- 133, 136, 139, 143, 146, 149, 152, 154, 157, 160,
- 163, 166, 170, 173, 177, 180, 183, 185, 189, 192
+ 78, 80, 84, 88, 91, 95, 97, 98, 99, 102,
+ 105, 107, 109, 111, 115, 119, 123, 127, 131, 135,
+ 139, 143, 147, 150, 153, 157, 160, 163, 166, 168,
+ 171, 174, 177, 180, 184, 187, 191, 194, 197, 199,
+ 203, 206
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 46, 0, -1, 47, 40, 46, -1, 47, -1, -1,
- 56, -1, 48, -1, 49, -1, 55, -1, 1, -1,
- -1, 22, 55, 14, 7, -1, 24, 7, 34, 55,
- -1, 24, 7, 26, 55, -1, 55, -1, 56, -1,
- 52, 50, 25, 54, 53, 11, 9, -1, 52, 50,
- 25, 54, 53, 10, 54, 53, 11, 9, -1, 51,
- 41, 50, 42, 54, 53, 11, 23, -1, 55, -1,
- 55, 34, 55, -1, 41, 50, 42, -1, 23, 27,
- -1, 9, -1, -1, -1, 54, 40, -1, 54, 49,
- -1, 5, -1, 7, -1, 48, -1, 55, 35, 55,
- -1, 55, 36, 55, -1, 55, 37, 55, -1, 55,
- 38, 55, -1, 55, 43, 55, -1, 55, 44, 55,
- -1, 55, 33, 55, -1, 55, 28, 55, -1, 55,
- 29, 55, -1, 35, 55, -1, 36, 55, -1, 41,
- 55, 42, -1, 16, 8, -1, 17, 7, -1, 22,
- 55, -1, 57, -1, 13, 15, -1, 13, 19, -1,
- 13, 21, -1, 13, 58, -1, 13, 58, 59, -1,
- 13, 59, -1, 26, 12, 8, -1, 12, 8, -1,
- 26, 8, -1, 8, -1, 20, 18, 8, -1, 18,
- 8, -1, 26, 18, 8, -1
+ 48, 0, -1, 49, 42, 48, -1, 49, -1, -1,
+ 59, -1, 50, -1, 51, -1, 58, -1, 1, -1,
+ -1, 23, 58, 15, 7, -1, 25, 7, 36, 58,
+ -1, 25, 7, 27, 58, -1, 58, -1, 59, -1,
+ 55, 52, 26, 57, 56, 11, 14, -1, 55, 52,
+ 26, 57, 56, 10, 57, 56, 11, 14, -1, 53,
+ 43, 52, 44, 57, 56, 11, 24, -1, 54, 36,
+ 58, 27, 58, 57, 56, 11, 24, -1, 58, -1,
+ 58, 36, 58, -1, 43, 52, 44, -1, 24, 29,
+ -1, 24, 28, 7, -1, 14, -1, -1, -1, 57,
+ 42, -1, 57, 51, -1, 5, -1, 7, -1, 50,
+ -1, 58, 37, 58, -1, 58, 38, 58, -1, 58,
+ 39, 58, -1, 58, 40, 58, -1, 58, 45, 58,
+ -1, 58, 46, 58, -1, 58, 35, 58, -1, 58,
+ 30, 58, -1, 58, 31, 58, -1, 37, 58, -1,
+ 38, 58, -1, 43, 58, 44, -1, 17, 8, -1,
+ 18, 7, -1, 23, 58, -1, 60, -1, 13, 16,
+ -1, 13, 20, -1, 13, 22, -1, 13, 61, -1,
+ 13, 61, 62, -1, 13, 62, -1, 27, 12, 8,
+ -1, 12, 8, -1, 27, 8, -1, 8, -1, 21,
+ 19, 8, -1, 19, 8, -1, 27, 19, 8, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
0, 90, 90, 91, 94, 95, 96, 97, 98, 99,
- 100, 103, 104, 105, 108, 109, 110, 116, 128, 136,
- 137, 138, 140, 142, 144, 146, 147, 148, 151, 152,
- 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
- 163, 164, 165, 168, 169, 170, 171, 182, 183, 184,
- 185, 186, 187, 190, 191, 192, 193, 196, 197, 198
+ 100, 103, 104, 105, 108, 109, 110, 116, 128, 143,
+ 155, 156, 157, 159, 161, 167, 169, 171, 172, 173,
+ 176, 177, 178, 179, 180, 181, 182, 183, 184, 185,
+ 186, 187, 188, 189, 190, 193, 194, 195, 196, 207,
+ 208, 209, 210, 211, 212, 215, 216, 217, 218, 221,
+ 222, 223
};
#endif
@@ -517,13 +525,13 @@ static const yytype_uint8 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "UNARY", "VOID", "INT", "FLOAT", "VAR",
- "STRING", "tIF", "tELSE", "tEND", "tFRAME", "tGO", "tINTO", "tLOOP",
- "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT",
- "tREPEAT", "tSET", "tTHEN", "tTO", "tWHILE", "tGE", "tLE", "tGT", "tLT",
- "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('",
- "')'", "'>'", "'<'", "$accept", "program", "programline", "asgn", "stmt",
- "cond", "while", "if", "end", "stmtlist", "expr", "func", "gotofunc",
- "gotoframe", "gotomovie", 0
+ "STRING", "tDOWN", "tELSE", "tEND", "tFRAME", "tGO", "tIF", "tINTO",
+ "tLOOP", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS",
+ "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tGE",
+ "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'",
+ "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "$accept", "program",
+ "programline", "asgn", "stmt", "cond", "repeatwhile", "repeatwith", "if",
+ "end", "stmtlist", "expr", "func", "gotofunc", "gotoframe", "gotomovie", 0
};
#endif
@@ -535,31 +543,33 @@ static const yytype_uint16 yytoknum[] =
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 287, 288, 61, 43, 45, 42, 47, 37,
- 10, 40, 41, 62, 60
+ 285, 286, 287, 288, 289, 290, 61, 43, 45, 42,
+ 47, 37, 10, 40, 41, 62, 60
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 45, 46, 46, 47, 47, 47, 47, 47, 47,
- 47, 48, 48, 48, 49, 49, 49, 49, 49, 50,
- 50, 50, 51, 52, 53, 54, 54, 54, 55, 55,
- 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
- 55, 55, 55, 56, 56, 56, 56, 57, 57, 57,
- 57, 57, 57, 58, 58, 58, 58, 59, 59, 59
+ 0, 47, 48, 48, 49, 49, 49, 49, 49, 49,
+ 49, 50, 50, 50, 51, 51, 51, 51, 51, 51,
+ 52, 52, 52, 53, 54, 55, 56, 57, 57, 57,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 59, 59, 59, 59, 60,
+ 60, 60, 60, 60, 60, 61, 61, 61, 61, 62,
+ 62, 62
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 0, 4, 4, 4, 1, 1, 7, 10, 8, 1,
- 3, 3, 2, 1, 0, 0, 2, 2, 1, 1,
- 1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 2, 2, 3, 2, 2, 2, 1, 2, 2, 2,
- 2, 3, 2, 3, 2, 2, 1, 3, 2, 3
+ 0, 4, 4, 4, 1, 1, 7, 10, 8, 9,
+ 1, 3, 3, 2, 3, 1, 0, 0, 2, 2,
+ 1, 1, 1, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 2, 2, 3, 2, 2, 2, 1, 2,
+ 2, 2, 2, 3, 2, 3, 2, 2, 1, 3,
+ 2, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -567,51 +577,53 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 9, 28, 29, 23, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 3, 30, 7, 0, 0,
- 8, 5, 46, 56, 0, 47, 0, 48, 0, 49,
- 0, 50, 52, 43, 44, 0, 30, 45, 22, 0,
- 40, 41, 0, 1, 0, 0, 0, 0, 19, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 54, 58,
- 0, 55, 0, 0, 0, 51, 0, 0, 0, 0,
- 42, 2, 0, 0, 0, 25, 0, 38, 39, 37,
- 31, 32, 33, 34, 35, 36, 57, 53, 59, 11,
- 13, 12, 25, 21, 24, 20, 24, 26, 27, 0,
- 14, 15, 0, 25, 0, 0, 24, 16, 18, 0,
- 0, 17
+ 0, 9, 30, 31, 0, 25, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 3, 32, 7, 0, 0,
+ 0, 8, 5, 48, 58, 0, 49, 0, 50, 0,
+ 51, 0, 52, 54, 45, 46, 0, 32, 47, 0,
+ 23, 0, 42, 43, 0, 1, 0, 0, 0, 0,
+ 0, 20, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 56, 60, 0, 57, 0, 0, 0, 53, 0,
+ 0, 24, 0, 0, 44, 2, 0, 0, 0, 0,
+ 27, 0, 40, 41, 39, 33, 34, 35, 36, 37,
+ 38, 59, 55, 61, 11, 13, 12, 27, 0, 22,
+ 26, 21, 26, 27, 28, 29, 0, 14, 15, 0,
+ 26, 27, 0, 0, 0, 26, 16, 18, 0, 0,
+ 19, 0, 17
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 14, 15, 36, 98, 47, 18, 19, 99, 94,
- 100, 101, 22, 31, 32
+ -1, 14, 15, 37, 105, 50, 18, 19, 20, 106,
+ 100, 107, 108, 23, 32, 33
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -77
+#define YYPACT_NINF -97
static const yytype_int16 yypact[] =
{
- 65, -77, -77, -77, -77, 10, -6, 8, 2, -10,
- 27, 2, 2, 2, 39, 24, 1, -77, 30, 89,
- 148, -77, -77, -77, 34, -77, 71, -77, 62, -77,
- 55, 57, -77, -77, -77, 2, -77, 100, -77, 6,
- -23, -23, 124, -77, 65, 89, 89, 59, 136, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, -77, -77,
- 77, -77, 78, 82, 74, -77, 100, 90, 2, 2,
- -77, -77, 56, 70, 112, -77, 2, 148, 148, 148,
- 160, 160, -23, -23, 148, 148, -77, -77, -77, -77,
- 148, 148, -77, -77, 86, 148, 86, -77, -77, 49,
- 148, -77, 93, -77, 98, 92, 86, -77, -77, 105,
- 108, -77
+ 62, -97, -97, -97, 10, -97, 30, 16, 2, -26,
+ 34, 2, 2, 2, 44, 22, 1, -97, 27, 29,
+ 85, 168, -97, -97, -97, 63, -97, 69, -97, 59,
+ -97, 9, 47, -97, -97, -97, 2, -97, 103, 76,
+ -97, 6, 180, 180, 144, -97, 62, 85, 2, 85,
+ 65, 156, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, -97, -97, 80, -97, 81, 87, 74, -97, 103,
+ 94, -97, 2, 2, -97, -97, 53, 120, 67, 132,
+ -97, 2, 168, 168, 168, 90, 90, 180, 180, 168,
+ 168, -97, -97, -97, -97, 168, 168, -97, 2, -97,
+ 89, 168, 89, 168, -97, -97, 24, 168, -97, 98,
+ 89, -97, 101, 92, 106, 89, -97, -97, 95, 113,
+ -97, 123, -97
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -77, 75, -77, 3, 4, 16, -77, -77, -73, -76,
- 0, 14, -77, -77, 87
+ -97, 93, -97, 4, 5, 35, -97, -97, -97, -96,
+ -87, 0, 15, -97, -97, 112
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -621,70 +633,75 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -7
static const yytype_int8 yytable[] =
{
- 20, -6, 33, 16, 17, 49, 50, 2, 37, 3,
- 51, 40, 41, 42, 21, 34, 96, 38, 23, 48,
- 56, 57, 24, 102, 35, 25, 10, 106, 26, 27,
- 28, 29, 68, 109, 39, 66, 30, 11, 12, 43,
- 69, -6, 58, 13, 20, 48, 74, 16, 17, 77,
- 78, 79, 80, 81, 82, 83, 84, 85, 21, 103,
- 104, 72, 73, 61, 44, -4, 1, 62, 90, 91,
- 2, 45, 3, 63, 4, 26, 95, 28, 5, 59,
- 60, 6, 7, 64, 75, 86, 87, 8, 9, 10,
- 88, 2, 63, 3, 2, 4, 3, 89, 92, 5,
- 11, 12, 6, 7, 105, -4, 13, 107, 8, 9,
- 10, 35, 93, 10, 67, 108, 110, 111, 65, 71,
- 0, 11, 12, 0, 11, 12, 97, 13, 49, 50,
- 46, 0, 0, 51, 0, 52, 53, 54, 55, 0,
- 49, 50, 0, 56, 57, 51, 76, 52, 53, 54,
- 55, 0, 49, 50, 70, 56, 57, 51, 0, 52,
- 53, 54, 55, 0, 49, 50, 70, 56, 57, 51,
- 76, 52, 53, 54, 55, 0, 49, 50, 0, 56,
- 57, 51, 0, 52, 53, 54, 55, 0, 49, 50,
- 0, 56, 57, 51, 0, 0, 0, 54, 55, 0,
- 0, 0, 0, 56, 57
+ 21, -6, 39, 40, 16, 17, 109, 2, 38, 3,
+ 102, 42, 43, 44, 114, 22, 110, 64, 24, 119,
+ 51, 65, 25, 35, 115, 36, 26, 10, 66, 27,
+ 28, 29, 30, 72, 111, 112, 69, 31, 34, 11,
+ 12, 41, 73, -6, 45, 13, 21, 51, 77, 79,
+ 16, 17, 82, 83, 84, 85, 86, 87, 88, 89,
+ 90, 22, -4, 1, 46, 48, 27, 2, 29, 3,
+ 47, 61, 95, 96, 67, 4, 5, 62, 63, 6,
+ 7, 101, 76, 71, 78, 8, 9, 10, 91, 92,
+ 2, 80, 3, 66, 2, 93, 3, 97, 103, 11,
+ 12, 94, 4, 5, -4, 13, 6, 7, 36, 113,
+ 10, 99, 8, 9, 10, 116, 117, 118, 70, 120,
+ 52, 53, 11, 12, 121, 54, 11, 12, 49, 57,
+ 58, 104, 13, 52, 53, 59, 60, 122, 54, 75,
+ 55, 56, 57, 58, 68, 0, 0, 98, 59, 60,
+ 52, 53, 0, 0, 0, 54, 0, 55, 56, 57,
+ 58, 0, 52, 53, 0, 59, 60, 54, 81, 55,
+ 56, 57, 58, 0, 52, 53, 74, 59, 60, 54,
+ 0, 55, 56, 57, 58, 0, 52, 53, 74, 59,
+ 60, 54, 81, 55, 56, 57, 58, 0, 52, 53,
+ 0, 59, 60, 54, 0, 55, 56, 57, 58, 0,
+ 52, 53, 0, 59, 60, 54, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 59, 60
};
static const yytype_int8 yycheck[] =
{
- 0, 0, 8, 0, 0, 28, 29, 5, 8, 7,
- 33, 11, 12, 13, 0, 7, 92, 27, 8, 19,
- 43, 44, 12, 96, 22, 15, 24, 103, 18, 19,
- 20, 21, 26, 106, 7, 35, 26, 35, 36, 0,
- 34, 40, 8, 41, 44, 45, 46, 44, 44, 49,
- 50, 51, 52, 53, 54, 55, 56, 57, 44, 10,
- 11, 45, 46, 8, 40, 0, 1, 12, 68, 69,
- 5, 41, 7, 18, 9, 18, 76, 20, 13, 8,
- 18, 16, 17, 26, 25, 8, 8, 22, 23, 24,
- 8, 5, 18, 7, 5, 9, 7, 7, 42, 13,
- 35, 36, 16, 17, 11, 40, 41, 9, 22, 23,
- 24, 22, 42, 24, 14, 23, 11, 9, 31, 44,
- -1, 35, 36, -1, 35, 36, 40, 41, 28, 29,
- 41, -1, -1, 33, -1, 35, 36, 37, 38, -1,
- 28, 29, -1, 43, 44, 33, 34, 35, 36, 37,
- 38, -1, 28, 29, 42, 43, 44, 33, -1, 35,
- 36, 37, 38, -1, 28, 29, 42, 43, 44, 33,
- 34, 35, 36, 37, 38, -1, 28, 29, -1, 43,
- 44, 33, -1, 35, 36, 37, 38, -1, 28, 29,
- -1, 43, 44, 33, -1, -1, -1, 37, 38, -1,
- -1, -1, -1, 43, 44
+ 0, 0, 28, 29, 0, 0, 102, 5, 8, 7,
+ 97, 11, 12, 13, 110, 0, 103, 8, 8, 115,
+ 20, 12, 12, 7, 111, 23, 16, 25, 19, 19,
+ 20, 21, 22, 27, 10, 11, 36, 27, 8, 37,
+ 38, 7, 36, 42, 0, 43, 46, 47, 48, 49,
+ 46, 46, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 46, 0, 1, 42, 36, 19, 5, 21, 7,
+ 43, 8, 72, 73, 27, 13, 14, 8, 19, 17,
+ 18, 81, 47, 7, 49, 23, 24, 25, 8, 8,
+ 5, 26, 7, 19, 5, 8, 7, 44, 98, 37,
+ 38, 7, 13, 14, 42, 43, 17, 18, 23, 11,
+ 25, 44, 23, 24, 25, 14, 24, 11, 15, 24,
+ 30, 31, 37, 38, 11, 35, 37, 38, 43, 39,
+ 40, 42, 43, 30, 31, 45, 46, 14, 35, 46,
+ 37, 38, 39, 40, 32, -1, -1, 27, 45, 46,
+ 30, 31, -1, -1, -1, 35, -1, 37, 38, 39,
+ 40, -1, 30, 31, -1, 45, 46, 35, 36, 37,
+ 38, 39, 40, -1, 30, 31, 44, 45, 46, 35,
+ -1, 37, 38, 39, 40, -1, 30, 31, 44, 45,
+ 46, 35, 36, 37, 38, 39, 40, -1, 30, 31,
+ -1, 45, 46, 35, -1, 37, 38, 39, 40, -1,
+ 30, 31, -1, 45, 46, 35, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 45, 46
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 5, 7, 9, 13, 16, 17, 22, 23,
- 24, 35, 36, 41, 46, 47, 48, 49, 51, 52,
- 55, 56, 57, 8, 12, 15, 18, 19, 20, 21,
- 26, 58, 59, 8, 7, 22, 48, 55, 27, 7,
- 55, 55, 55, 0, 40, 41, 41, 50, 55, 28,
- 29, 33, 35, 36, 37, 38, 43, 44, 8, 8,
- 18, 8, 12, 18, 26, 59, 55, 14, 26, 34,
- 42, 46, 50, 50, 55, 25, 34, 55, 55, 55,
- 55, 55, 55, 55, 55, 55, 8, 8, 8, 7,
- 55, 55, 42, 42, 54, 55, 54, 40, 49, 53,
- 55, 56, 53, 10, 11, 11, 54, 9, 23, 53,
- 11, 9
+ 0, 1, 5, 7, 13, 14, 17, 18, 23, 24,
+ 25, 37, 38, 43, 48, 49, 50, 51, 53, 54,
+ 55, 58, 59, 60, 8, 12, 16, 19, 20, 21,
+ 22, 27, 61, 62, 8, 7, 23, 50, 58, 28,
+ 29, 7, 58, 58, 58, 0, 42, 43, 36, 43,
+ 52, 58, 30, 31, 35, 37, 38, 39, 40, 45,
+ 46, 8, 8, 19, 8, 12, 19, 27, 62, 58,
+ 15, 7, 27, 36, 44, 48, 52, 58, 52, 58,
+ 26, 36, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 8, 8, 8, 7, 58, 58, 44, 27, 44,
+ 57, 58, 57, 58, 42, 51, 56, 58, 59, 56,
+ 57, 10, 11, 11, 56, 57, 14, 24, 11, 56,
+ 24, 11, 14
};
#define yyerrok (yyerrstatus = 0)
@@ -1566,188 +1583,211 @@ yyreduce:
break;
case 19:
-#line 136 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(STOP); ;}
+#line 143 "engines/director/lingo/lingo-gr.y"
+ {
+ inst init, finish, body, end;
+ WRITE_LE_UINT32(&init, (yyvsp[(3) - (9)].code));
+ WRITE_LE_UINT32(&finish, (yyvsp[(5) - (9)].code));
+ WRITE_LE_UINT32(&body, (yyvsp[(6) - (9)].code));
+ WRITE_LE_UINT32(&end, (yyvsp[(7) - (9)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 1] = init; /* initial count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 2] = finish;/* final count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 3] = body; /* body of loop */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 4] = end; ;}
break;
case 20:
-#line 137 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code2(g_lingo->c_eq, STOP); ;}
+#line 155 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(STOP); ;}
break;
- case 22:
-#line 140 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->code3(g_lingo->c_whilecode, STOP, STOP); ;}
+ case 21:
+#line 156 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
case 23:
-#line 142 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
+#line 159 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
case 24:
-#line 144 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
+#line 161 "engines/director/lingo/lingo-gr.y"
+ {
+ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
+ g_lingo->code2(STOP, STOP);
+ g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str());
+ delete (yyvsp[(3) - (3)].s); ;}
break;
case 25:
-#line 146 "engines/director/lingo/lingo-gr.y"
+#line 167 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
+ break;
+
+ case 26:
+#line 169 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
+ break;
+
+ case 27:
+#line 171 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 28:
-#line 151 "engines/director/lingo/lingo-gr.y"
+ case 30:
+#line 176 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
break;
- case 29:
-#line 152 "engines/director/lingo/lingo-gr.y"
+ case 31:
+#line 177 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
- case 31:
-#line 154 "engines/director/lingo/lingo-gr.y"
+ case 33:
+#line 179 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 32:
-#line 155 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 180 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 33:
-#line 156 "engines/director/lingo/lingo-gr.y"
+ case 35:
+#line 181 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 34:
-#line 157 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 182 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 35:
-#line 158 "engines/director/lingo/lingo-gr.y"
+ case 37:
+#line 183 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 36:
-#line 159 "engines/director/lingo/lingo-gr.y"
+ case 38:
+#line 184 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 37:
-#line 160 "engines/director/lingo/lingo-gr.y"
+ case 39:
+#line 185 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 38:
-#line 161 "engines/director/lingo/lingo-gr.y"
+ case 40:
+#line 186 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 39:
-#line 162 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 187 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 40:
-#line 163 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 188 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 41:
-#line 164 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 189 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 42:
-#line 165 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 190 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 43:
-#line 168 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 193 "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 44:
-#line 169 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 194 "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 45:
-#line 170 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 195 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 47:
-#line 182 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 207 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 48:
-#line 183 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 208 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 49:
-#line 184 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 209 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 50:
-#line 185 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 210 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 51:
-#line 186 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 211 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
break;
- case 52:
-#line 187 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 212 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 53:
-#line 190 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 215 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 54:
-#line 191 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 216 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 55:
-#line 192 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 217 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 56:
-#line 193 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 218 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 57:
-#line 196 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 221 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 58:
-#line 197 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 222 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 59:
-#line 198 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 223 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1751 "engines/director/lingo/lingo-gr.cpp"
+#line 1791 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -1961,6 +2001,6 @@ yyreturn:
}
-#line 237 "engines/director/lingo/lingo-gr.y"
+#line 253 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index e3b6ea9..732f084 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -45,31 +45,33 @@
FLOAT = 261,
VAR = 262,
STRING = 263,
- tIF = 264,
+ tDOWN = 264,
tELSE = 265,
tEND = 266,
tFRAME = 267,
tGO = 268,
- tINTO = 269,
- tLOOP = 270,
- tMCI = 271,
- tMCIWAIT = 272,
- tMOVIE = 273,
- tNEXT = 274,
- tOF = 275,
- tPREVIOUS = 276,
- tPUT = 277,
- tREPEAT = 278,
- tSET = 279,
- tTHEN = 280,
- tTO = 281,
- tWHILE = 282,
- tGE = 283,
- tLE = 284,
- tGT = 285,
- tLT = 286,
- tEQ = 287,
- tNEQ = 288
+ tIF = 269,
+ tINTO = 270,
+ tLOOP = 271,
+ tMCI = 272,
+ tMCIWAIT = 273,
+ tMOVIE = 274,
+ tNEXT = 275,
+ tOF = 276,
+ tPREVIOUS = 277,
+ tPUT = 278,
+ tREPEAT = 279,
+ tSET = 280,
+ tTHEN = 281,
+ tTO = 282,
+ tWITH = 283,
+ tWHILE = 284,
+ tGE = 285,
+ tLE = 286,
+ tGT = 287,
+ tLT = 288,
+ tEQ = 289,
+ tNEQ = 290
};
#endif
/* Tokens. */
@@ -79,31 +81,33 @@
#define FLOAT 261
#define VAR 262
#define STRING 263
-#define tIF 264
+#define tDOWN 264
#define tELSE 265
#define tEND 266
#define tFRAME 267
#define tGO 268
-#define tINTO 269
-#define tLOOP 270
-#define tMCI 271
-#define tMCIWAIT 272
-#define tMOVIE 273
-#define tNEXT 274
-#define tOF 275
-#define tPREVIOUS 276
-#define tPUT 277
-#define tREPEAT 278
-#define tSET 279
-#define tTHEN 280
-#define tTO 281
-#define tWHILE 282
-#define tGE 283
-#define tLE 284
-#define tGT 285
-#define tLT 286
-#define tEQ 287
-#define tNEQ 288
+#define tIF 269
+#define tINTO 270
+#define tLOOP 271
+#define tMCI 272
+#define tMCIWAIT 273
+#define tMOVIE 274
+#define tNEXT 275
+#define tOF 276
+#define tPREVIOUS 277
+#define tPUT 278
+#define tREPEAT 279
+#define tSET 280
+#define tTHEN 281
+#define tTO 282
+#define tWITH 283
+#define tWHILE 284
+#define tGE 285
+#define tLE 286
+#define tGT 287
+#define tLT 288
+#define tEQ 289
+#define tNEQ 290
@@ -118,7 +122,7 @@ typedef union YYSTYPE
int code;
}
/* Line 1529 of yacc.c. */
-#line 122 "engines/director/lingo/lingo-gr.hpp"
+#line 126 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 179359c..eb58460 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -73,11 +73,11 @@ using namespace Director;
%token<i> INT
%token<f> FLOAT
%token<s> VAR STRING
-%token tIF tELSE tEND tFRAME tGO tINTO tLOOP tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS
-%token tPUT tREPEAT tSET tTHEN tTO tWHILE
+%token tDOWN tELSE tEND tFRAME tGO tIF tINTO tLOOP tMCI tMCIWAIT tMOVIE tNEXT
+%token tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO tWITH tWHILE
%token tGE tLE tGT tLT tEQ tNEQ
-%type<code> asgn cond expr if end stmtlist while
+%type<code> asgn cond end expr if repeatwhile repeatwith stmtlist
%type<s> gotoframe gotomovie
%right '='
@@ -125,19 +125,44 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
// statements
// end repeat
//
- | while '(' cond ')' stmtlist end tEND tREPEAT {
+ | repeatwhile '(' cond ')' stmtlist end tEND tREPEAT {
inst body, end;
WRITE_LE_UINT32(&body, $5);
WRITE_LE_UINT32(&end, $6);
(*g_lingo->_currentScript)[$1 + 1] = body; /* body of loop */
(*g_lingo->_currentScript)[$1 + 2] = end; } /* end, if cond fails */
;
+ // repeat with index = start to end
+ // statements
+ // end repeat
+ //
+ // repeat with index = high down to low
+ // statements
+ // end repeat
+ //
+ | repeatwith '=' expr tTO expr stmtlist end tEND tREPEAT {
+ inst init, finish, body, end;
+ WRITE_LE_UINT32(&init, $3);
+ WRITE_LE_UINT32(&finish, $5);
+ WRITE_LE_UINT32(&body, $6);
+ WRITE_LE_UINT32(&end, $7);
+ (*g_lingo->_currentScript)[$1 + 1] = init; /* initial count value */
+ (*g_lingo->_currentScript)[$1 + 2] = finish;/* final count value */
+ (*g_lingo->_currentScript)[$1 + 3] = body; /* body of loop */
+ (*g_lingo->_currentScript)[$1 + 4] = end; } /* end, if cond fails */
+ ;
cond: expr { g_lingo->code1(STOP); }
| expr '=' expr { g_lingo->code2(g_lingo->c_eq, STOP); }
| '(' cond ')'
;
-while: tREPEAT tWHILE { $$ = g_lingo->code3(g_lingo->c_whilecode, STOP, STOP); }
+repeatwhile: tREPEAT tWHILE { $$ = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); }
+ ;
+repeatwith: tREPEAT tWITH VAR {
+ $$ = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
+ g_lingo->code2(STOP, STOP);
+ g_lingo->codeString($3->c_str());
+ delete $3; }
;
if: tIF { $$ = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); }
;
@@ -198,15 +223,6 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
| tTO tMOVIE STRING { $$ = $3; }
;
-// repeat with index = start to end
-// statements
-// end repeat
-//
-// repeat with index = high down to low
-// statements
-// end repeat
-//
-
// macro
//
// Special Note The macro keyword is retained in Director 3.0 to maintain compatibility
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index bf322e2..bbaf7dc 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 32
-#define YY_END_OF_BUFFER 33
+#define YY_NUM_RULES 34
+#define YY_END_OF_BUFFER 35
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,19 +373,20 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[99] =
+static yyconst flex_int16_t yy_accept[106] =
{ 0,
- 0, 0, 33, 32, 3, 30, 32, 32, 29, 29,
- 28, 29, 29, 26, 26, 26, 26, 26, 26, 26,
- 26, 26, 26, 26, 26, 26, 26, 2, 2, 3,
- 30, 23, 0, 31, 1, 27, 28, 25, 24, 26,
- 26, 26, 26, 8, 4, 26, 26, 26, 26, 26,
- 15, 26, 26, 26, 26, 26, 21, 26, 1, 27,
- 26, 6, 26, 26, 26, 11, 26, 26, 26, 17,
- 26, 19, 26, 26, 5, 26, 9, 10, 26, 26,
- 14, 26, 26, 20, 26, 7, 26, 13, 26, 26,
- 22, 26, 26, 18, 12, 26, 16, 0
-
+ 0, 0, 35, 34, 3, 32, 34, 34, 31, 31,
+ 30, 31, 31, 28, 28, 28, 28, 28, 28, 28,
+ 28, 28, 28, 28, 28, 28, 28, 28, 2, 2,
+ 3, 32, 25, 0, 33, 1, 29, 30, 27, 26,
+ 28, 28, 28, 28, 28, 9, 5, 28, 28, 28,
+ 28, 28, 16, 28, 28, 28, 28, 28, 22, 28,
+ 28, 1, 29, 28, 28, 7, 28, 28, 28, 12,
+ 28, 28, 28, 18, 28, 20, 28, 28, 28, 4,
+ 6, 28, 10, 11, 28, 28, 15, 28, 28, 21,
+ 28, 23, 8, 28, 14, 28, 28, 24, 28, 28,
+
+ 19, 13, 28, 17, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -428,78 +429,78 @@ static yyconst flex_int32_t yy_meta[36] =
4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[102] =
+static yyconst flex_int16_t yy_base[109] =
{ 0,
- 0, 34, 118, 119, 115, 34, 103, 108, 119, 105,
- 30, 100, 99, 0, 18, 82, 83, 23, 82, 28,
- 89, 87, 18, 87, 86, 24, 82, 101, 119, 100,
- 49, 119, 94, 119, 0, 89, 46, 119, 119, 0,
- 69, 80, 81, 0, 0, 65, 68, 71, 60, 57,
- 0, 72, 59, 61, 57, 68, 0, 63, 0, 74,
- 65, 0, 58, 55, 53, 46, 56, 47, 44, 0,
- 57, 0, 49, 50, 0, 54, 0, 0, 56, 52,
- 0, 47, 53, 0, 49, 0, 44, 0, 39, 33,
- 0, 32, 27, 0, 0, 24, 0, 119, 57, 44,
-
- 61
+ 0, 34, 124, 125, 121, 34, 109, 114, 125, 111,
+ 30, 106, 105, 0, 90, 18, 87, 88, 23, 87,
+ 28, 94, 92, 18, 92, 91, 24, 30, 107, 125,
+ 106, 53, 125, 100, 125, 0, 95, 48, 125, 125,
+ 0, 71, 74, 85, 86, 0, 0, 70, 73, 76,
+ 65, 62, 0, 77, 64, 66, 62, 73, 0, 68,
+ 59, 0, 78, 62, 68, 0, 61, 58, 56, 49,
+ 59, 50, 47, 0, 60, 0, 52, 53, 54, 0,
+ 0, 56, 0, 0, 58, 54, 0, 49, 55, 0,
+ 51, 0, 0, 46, 0, 41, 35, 0, 34, 29,
+
+ 0, 0, 24, 0, 125, 59, 44, 63
} ;
-static yyconst flex_int16_t yy_def[102] =
+static yyconst flex_int16_t yy_def[109] =
{ 0,
- 98, 1, 98, 98, 98, 98, 98, 99, 98, 98,
- 98, 98, 98, 100, 100, 100, 100, 100, 100, 100,
- 100, 100, 100, 100, 100, 100, 100, 98, 98, 98,
- 98, 98, 99, 98, 101, 98, 98, 98, 98, 100,
- 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
- 100, 100, 100, 100, 100, 100, 100, 100, 101, 98,
- 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
- 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
- 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
- 100, 100, 100, 100, 100, 100, 100, 0, 98, 98,
-
- 98
+ 105, 1, 105, 105, 105, 105, 105, 106, 105, 105,
+ 105, 105, 105, 107, 107, 107, 107, 107, 107, 107,
+ 107, 107, 107, 107, 107, 107, 107, 107, 105, 105,
+ 105, 105, 105, 106, 105, 108, 105, 105, 105, 105,
+ 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
+ 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
+ 107, 108, 105, 107, 107, 107, 107, 107, 107, 107,
+ 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
+ 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
+ 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
+
+ 107, 107, 107, 107, 0, 105, 105, 105
} ;
-static yyconst flex_int16_t yy_nxt[155] =
+static yyconst flex_int16_t yy_nxt[161] =
{ 0,
4, 5, 6, 6, 4, 7, 8, 9, 10, 4,
- 11, 12, 9, 13, 14, 14, 14, 14, 15, 16,
- 17, 14, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 14, 14, 27, 14, 28, 31, 31, 29, 36,
- 37, 41, 45, 42, 48, 56, 52, 40, 46, 53,
- 57, 31, 31, 97, 49, 36, 37, 33, 96, 33,
- 33, 59, 95, 94, 59, 93, 92, 91, 90, 89,
- 88, 87, 86, 85, 84, 83, 82, 81, 80, 79,
- 78, 77, 76, 75, 60, 74, 73, 72, 71, 70,
- 69, 68, 67, 66, 65, 64, 63, 62, 61, 60,
-
- 34, 30, 30, 58, 55, 54, 51, 50, 47, 44,
- 43, 39, 38, 35, 34, 32, 30, 98, 3, 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,
- 98, 98, 98, 98
+ 11, 12, 9, 13, 14, 14, 14, 15, 16, 17,
+ 18, 14, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 14, 14, 28, 14, 29, 32, 32, 30, 37,
+ 38, 43, 47, 44, 50, 58, 54, 41, 48, 55,
+ 59, 60, 61, 104, 51, 32, 32, 37, 38, 34,
+ 103, 34, 34, 62, 102, 101, 62, 100, 99, 98,
+ 97, 96, 95, 94, 93, 92, 91, 90, 89, 88,
+ 87, 86, 85, 84, 83, 82, 81, 80, 63, 79,
+ 78, 77, 76, 75, 74, 73, 72, 71, 70, 69,
+
+ 68, 67, 66, 65, 64, 63, 35, 31, 31, 57,
+ 56, 53, 52, 49, 46, 45, 42, 40, 39, 36,
+ 35, 33, 31, 105, 3, 105, 105, 105, 105, 105,
+ 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+ 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+ 105, 105, 105, 105, 105, 105, 105, 105, 105, 105
} ;
-static yyconst flex_int16_t yy_chk[155] =
+static yyconst flex_int16_t yy_chk[161] =
{ 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, 2, 6, 6, 2, 11,
- 11, 15, 18, 15, 20, 26, 23, 100, 18, 23,
- 26, 31, 31, 96, 20, 37, 37, 99, 93, 99,
- 99, 101, 92, 90, 101, 89, 87, 85, 83, 82,
- 80, 79, 76, 74, 73, 71, 69, 68, 67, 66,
- 65, 64, 63, 61, 60, 58, 56, 55, 54, 53,
- 52, 50, 49, 48, 47, 46, 43, 42, 41, 36,
-
- 33, 30, 28, 27, 25, 24, 22, 21, 19, 17,
- 16, 13, 12, 10, 8, 7, 5, 3, 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, 98,
- 98, 98, 98, 98
+ 11, 16, 19, 16, 21, 27, 24, 107, 19, 24,
+ 27, 28, 28, 103, 21, 32, 32, 38, 38, 106,
+ 100, 106, 106, 108, 99, 97, 108, 96, 94, 91,
+ 89, 88, 86, 85, 82, 79, 78, 77, 75, 73,
+ 72, 71, 70, 69, 68, 67, 65, 64, 63, 61,
+ 60, 58, 57, 56, 55, 54, 52, 51, 50, 49,
+
+ 48, 45, 44, 43, 42, 37, 34, 31, 29, 26,
+ 25, 23, 22, 20, 18, 17, 15, 13, 12, 10,
+ 8, 7, 5, 3, 105, 105, 105, 105, 105, 105,
+ 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+ 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
+ 105, 105, 105, 105, 105, 105, 105, 105, 105, 105
} ;
static yy_state_type yy_last_accepting_state;
@@ -549,7 +550,7 @@ char *yytext;
int yyparse();
-#line 553 "engines/director/lingo/lingo-lex.cpp"
+#line 554 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -737,7 +738,7 @@ YY_DECL
#line 45 "engines/director/lingo/lingo-lex.l"
-#line 741 "engines/director/lingo/lingo-lex.cpp"
+#line 742 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -791,13 +792,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 >= 99 )
+ if ( yy_current_state >= 106 )
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] != 119 );
+ while ( yy_base[yy_current_state] != 125 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -839,150 +840,160 @@ YY_RULE_SETUP
case 4:
YY_RULE_SETUP
#line 51 "engines/director/lingo/lingo-lex.l"
-{ return tIF; }
+{ return tDOWN; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 52 "engines/director/lingo/lingo-lex.l"
-{ return tELSE; }
+{ return tIF; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 53 "engines/director/lingo/lingo-lex.l"
-{ return tEND; }
+{ return tELSE; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 54 "engines/director/lingo/lingo-lex.l"
-{ return tFRAME; }
+{ return tEND; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 55 "engines/director/lingo/lingo-lex.l"
-{ return tGO; }
+{ return tFRAME; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 56 "engines/director/lingo/lingo-lex.l"
-{ return tINTO; }
+{ return tGO; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 57 "engines/director/lingo/lingo-lex.l"
-{ return tLOOP; }
+{ return tINTO; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 58 "engines/director/lingo/lingo-lex.l"
-{ return tMCI; }
+{ return tLOOP; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 59 "engines/director/lingo/lingo-lex.l"
-{ return tMCIWAIT; }
+{ return tMCI; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 60 "engines/director/lingo/lingo-lex.l"
-{ return tMOVIE; }
+{ return tMCIWAIT; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 61 "engines/director/lingo/lingo-lex.l"
-{ return tNEXT; }
+{ return tMOVIE; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 62 "engines/director/lingo/lingo-lex.l"
-{ return tOF; }
+{ return tNEXT; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 63 "engines/director/lingo/lingo-lex.l"
-{ return tPREVIOUS; }
+{ return tOF; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 64 "engines/director/lingo/lingo-lex.l"
-{ return tPUT; }
+{ return tPREVIOUS; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 65 "engines/director/lingo/lingo-lex.l"
-{ return tREPEAT; }
+{ return tPUT; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 66 "engines/director/lingo/lingo-lex.l"
-{ return tSET; }
+{ return tREPEAT; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 67 "engines/director/lingo/lingo-lex.l"
-{ return tTHEN; }
+{ return tSET; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 68 "engines/director/lingo/lingo-lex.l"
-{ return tTO; }
+{ return tTHEN; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 69 "engines/director/lingo/lingo-lex.l"
-{ return tWHILE; }
+{ return tTO; }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 71 "engines/director/lingo/lingo-lex.l"
-{ return tNEQ; }
+#line 70 "engines/director/lingo/lingo-lex.l"
+{ return tWITH; }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 72 "engines/director/lingo/lingo-lex.l"
-{ return tGE; }
+#line 71 "engines/director/lingo/lingo-lex.l"
+{ return tWHILE; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 73 "engines/director/lingo/lingo-lex.l"
-{ return tLE; }
+{ return tNEQ; }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 75 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+#line 74 "engines/director/lingo/lingo-lex.l"
+{ return tGE; }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 76 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+#line 75 "engines/director/lingo/lingo-lex.l"
+{ return tLE; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 77 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ yylval.s = new Common::String(yytext); return VAR; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 78 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 30:
-/* rule 30 can match eol */
YY_RULE_SETUP
#line 79 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 80 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return *yytext; }
YY_BREAK
case 32:
+/* rule 32 can match eol */
+YY_RULE_SETUP
+#line 81 "engines/director/lingo/lingo-lex.l"
+{ return '\n'; }
+ YY_BREAK
+case 33:
YY_RULE_SETUP
#line 82 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+ YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 84 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 986 "engines/director/lingo/lingo-lex.cpp"
+#line 997 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1275,7 +1286,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 >= 99 )
+ if ( yy_current_state >= 106 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1303,11 +1314,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 >= 99 )
+ if ( yy_current_state >= 106 )
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 == 98);
+ yy_is_jam = (yy_current_state == 105);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1982,7 +1993,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 82 "engines/director/lingo/lingo-lex.l"
+#line 84 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 07d9a63..2ae9960 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -48,6 +48,7 @@ whitespace [\t ]
^{whitespace}
[\t]+ { return ' '; }
+down { return tDOWN; }
if { return tIF; }
else { return tELSE; }
end { return tEND; }
@@ -66,6 +67,7 @@ repeat { return tREPEAT; }
set { return tSET; }
then { return tTHEN; }
to { return tTO; }
+with { return tWITH; }
while { return tWHILE; }
[!][=] { return tNEQ; }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index f167e28..cca423a 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -132,7 +132,8 @@ public:
static void c_assign();
bool verify(Symbol *s);
static void c_eval();
- static void c_whilecode();
+ static void c_repeatwhilecode();
+ static void c_repeatwithcode();
static void c_ifcode();
static void c_eq();
static void c_neq();
Commit: 8362f79329a0b414f3d89917b1c9ac0489fd5809
https://github.com/scummvm/scummvm/commit/8362f79329a0b414f3d89917b1c9ac0489fd5809
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Further work on the 'repeat with' control keyword
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index e0ec7e8..d83a7d3 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -52,12 +52,30 @@
namespace Director {
void Lingo::execute(int pc) {
- for(_pc = pc; (*_currentScript)[_pc] != STOP;) {
+ for(_pc = pc; (*_currentScript)[_pc] != STOP && !_returning;) {
_pc++;
(*((*_currentScript)[_pc - 1]))();
}
}
+Symbol *Lingo::lookupVar(const char *name) {
+ Symbol *sym;
+
+ if (!_vars.contains(name)) { // Create variable if it was not defined
+ sym = new Symbol;
+ sym->name = (char *)calloc(strlen(name) + 1, 1);
+ Common::strlcpy(sym->name, name, strlen(name) + 1);
+ sym->type = VOID;
+ sym->u.val = 0;
+
+ _vars[name] = sym;
+ } else {
+ sym = g_lingo->_vars[name];
+ }
+
+ return sym;
+}
+
void Lingo::push(Datum d) {
_stack.push_back(d);
}
@@ -90,23 +108,10 @@ void Lingo::c_constpush() {
}
void Lingo::c_varpush() {
- Datum d;
- Symbol *sym;
char *name = (char *)&(*g_lingo->_currentScript)[g_lingo->_pc];
+ Datum d;
- if (!g_lingo->_vars.contains(name)) { // Create variable if it was not defined
- sym = new Symbol;
- sym->name = (char *)calloc(strlen(name) + 1, 1);
- Common::strlcpy(sym->name, name, strlen(name) + 1);
- sym->type = VOID;
- sym->u.val = 0;
-
- g_lingo->_vars[name] = sym;
- } else {
- sym = g_lingo->_vars[name];
- }
-
- d.sym = sym;
+ d.sym = g_lingo->lookupVar(name);
g_lingo->_pc += g_lingo->calcStringAlignment(name);
@@ -259,15 +264,15 @@ void Lingo::c_repeatwhilecode(void) {
while (d.val) {
g_lingo->execute(body); /* body */
- if (0 /* returning */)
+ if (g_lingo->_returning)
break;
g_lingo->execute(savepc + 2); /* condition */
d = g_lingo->pop();
}
- //if (!returning)
- g_lingo->_pc = end; /* next stmt */
+ if (!g_lingo->_returning)
+ g_lingo->_pc = end; /* next stmt */
}
void Lingo::c_repeatwithcode(void) {
@@ -278,22 +283,28 @@ void Lingo::c_repeatwithcode(void) {
int finish = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
int body = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 3]);
int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 4]);
- Common::String counter((char *)&(*g_lingo->_currentScript)[savepc + 5]);
+ Common::String countername((char *)&(*g_lingo->_currentScript)[savepc + 5]);
+ Symbol *counter = g_lingo->lookupVar(countername.c_str());
g_lingo->execute(init); /* condition */
d = g_lingo->pop();
+ counter->u.val = d.val;
- while (d.val) {
+ while (true) {
g_lingo->execute(body); /* body */
- if (0 /* returning */)
+ if (g_lingo->_returning)
break;
+ counter->u.val++;
g_lingo->execute(finish); /* condition */
d = g_lingo->pop();
+
+ if (counter->u.val > d.val)
+ break;
}
- //if (!returning)
- g_lingo->_pc = end; /* next stmt */
+ if (!g_lingo->_returning)
+ g_lingo->_pc = end; /* next stmt */
}
void Lingo::c_ifcode() {
@@ -304,12 +315,9 @@ void Lingo::c_ifcode() {
int elsep = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
- warning("cond: %d end: %d then: %d elesp: %d", savepc + 3, end, then, elsep);
-
g_lingo->execute(savepc + 3); /* condition */
d = g_lingo->pop();
- warning("res: %d", d.val);
if (d.val) {
g_lingo->execute(then);
@@ -317,8 +325,8 @@ void Lingo::c_ifcode() {
g_lingo->execute(elsep);
}
- //if (!returning)
- g_lingo->_pc = end; /* next stmt */
+ if (!g_lingo->_returning)
+ g_lingo->_pc = end; /* next stmt */
}
//************************
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index fee23d1..2575a2b 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -132,6 +132,7 @@ void Lingo::executeScript(ScriptType type, uint16 id) {
_currentScript = _scripts[type][id];
_pc = 0;
+ _returning = false;
execute(_pc);
}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index cca423a..01fb6cc 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -119,6 +119,7 @@ public:
public:
void execute(int pc);
+ Symbol *lookupVar(const char *name);
static void c_xpop();
static void c_printtop();
@@ -155,6 +156,7 @@ public:
public:
ScriptData *_currentScript;
+ bool _returning;
private:
int parse(const char *code);
Commit: 82756b34fe118ed7fdc946df95b58fdcdd3d1a76
https://github.com/scummvm/scummvm/commit/82756b34fe118ed7fdc946df95b58fdcdd3d1a76
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix 'repeat with' control keyword implementation
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 9a5fbab..ef578c3 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -97,6 +97,10 @@ repeat while (y < 5)\n\
set y = y + 1\n\
put y\n\
end repeat\n\
+\n\
+repeat with z = 10 to 15\n\
+ put z\n\
+end repeat\n\
", kMovieScript, 3);
_lingo->executeScript(kMovieScript, 3);
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index d83a7d3..6e3f437 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -280,15 +280,16 @@ void Lingo::c_repeatwithcode(void) {
int savepc = g_lingo->_pc;
int init = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc]);
- int finish = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
- int body = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 3]);
- int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 4]);
- Common::String countername((char *)&(*g_lingo->_currentScript)[savepc + 5]);
+ int finish = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
+ int body = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
+ int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 3]);
+ Common::String countername((char *)&(*g_lingo->_currentScript)[savepc + 4]);
Symbol *counter = g_lingo->lookupVar(countername.c_str());
g_lingo->execute(init); /* condition */
d = g_lingo->pop();
counter->u.val = d.val;
+ counter->type = VAR;
while (true) {
g_lingo->execute(body); /* body */
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index d6f01b6..04a3a06 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -413,7 +413,7 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 45
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 226
+#define YYLAST 218
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 47
@@ -422,7 +422,7 @@ union yyalloc
/* YYNRULES -- Number of rules. */
#define YYNRULES 61
/* YYNRULES -- Number of states. */
-#define YYNSTATES 123
+#define YYNSTATES 125
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -473,11 +473,11 @@ static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
20, 21, 26, 31, 36, 38, 40, 48, 59, 68,
- 78, 80, 84, 88, 91, 95, 97, 98, 99, 102,
- 105, 107, 109, 111, 115, 119, 123, 127, 131, 135,
- 139, 143, 147, 150, 153, 157, 160, 163, 166, 168,
- 171, 174, 177, 180, 184, 187, 191, 194, 197, 199,
- 203, 206
+ 80, 82, 86, 90, 93, 97, 99, 100, 101, 104,
+ 107, 109, 111, 113, 117, 121, 125, 129, 133, 137,
+ 141, 145, 149, 152, 155, 159, 162, 165, 168, 170,
+ 173, 176, 179, 182, 186, 189, 193, 196, 199, 201,
+ 205, 208
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -490,20 +490,21 @@ static const yytype_int8 yyrhs[] =
55, 52, 26, 57, 56, 11, 14, -1, 55, 52,
26, 57, 56, 10, 57, 56, 11, 14, -1, 53,
43, 52, 44, 57, 56, 11, 24, -1, 54, 36,
- 58, 27, 58, 57, 56, 11, 24, -1, 58, -1,
- 58, 36, 58, -1, 43, 52, 44, -1, 24, 29,
- -1, 24, 28, 7, -1, 14, -1, -1, -1, 57,
- 42, -1, 57, 51, -1, 5, -1, 7, -1, 50,
- -1, 58, 37, 58, -1, 58, 38, 58, -1, 58,
- 39, 58, -1, 58, 40, 58, -1, 58, 45, 58,
- -1, 58, 46, 58, -1, 58, 35, 58, -1, 58,
- 30, 58, -1, 58, 31, 58, -1, 37, 58, -1,
- 38, 58, -1, 43, 58, 44, -1, 17, 8, -1,
- 18, 7, -1, 23, 58, -1, 60, -1, 13, 16,
- -1, 13, 20, -1, 13, 22, -1, 13, 61, -1,
- 13, 61, 62, -1, 13, 62, -1, 27, 12, 8,
- -1, 12, 8, -1, 27, 8, -1, 8, -1, 21,
- 19, 8, -1, 19, 8, -1, 27, 19, 8, -1
+ 58, 56, 27, 58, 56, 57, 56, 11, 24, -1,
+ 58, -1, 58, 36, 58, -1, 43, 52, 44, -1,
+ 24, 29, -1, 24, 28, 7, -1, 14, -1, -1,
+ -1, 57, 42, -1, 57, 51, -1, 5, -1, 7,
+ -1, 50, -1, 58, 37, 58, -1, 58, 38, 58,
+ -1, 58, 39, 58, -1, 58, 40, 58, -1, 58,
+ 45, 58, -1, 58, 46, 58, -1, 58, 35, 58,
+ -1, 58, 30, 58, -1, 58, 31, 58, -1, 37,
+ 58, -1, 38, 58, -1, 43, 58, 44, -1, 17,
+ 8, -1, 18, 7, -1, 23, 58, -1, 60, -1,
+ 13, 16, -1, 13, 20, -1, 13, 22, -1, 13,
+ 61, -1, 13, 61, 62, -1, 13, 62, -1, 27,
+ 12, 8, -1, 12, 8, -1, 27, 8, -1, 8,
+ -1, 21, 19, 8, -1, 19, 8, -1, 27, 19,
+ 8, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -564,7 +565,7 @@ static const yytype_uint8 yyr1[] =
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 0, 4, 4, 4, 1, 1, 7, 10, 8, 9,
+ 0, 4, 4, 4, 1, 1, 7, 10, 8, 11,
1, 3, 3, 2, 3, 1, 0, 0, 2, 2,
1, 1, 1, 3, 3, 3, 3, 3, 3, 3,
3, 3, 2, 2, 3, 2, 2, 2, 1, 2,
@@ -584,46 +585,46 @@ static const yytype_uint8 yydefact[] =
23, 0, 42, 43, 0, 1, 0, 0, 0, 0,
0, 20, 0, 0, 0, 0, 0, 0, 0, 0,
0, 56, 60, 0, 57, 0, 0, 0, 53, 0,
- 0, 24, 0, 0, 44, 2, 0, 0, 0, 0,
+ 0, 24, 0, 0, 44, 2, 0, 26, 0, 0,
27, 0, 40, 41, 39, 33, 34, 35, 36, 37,
38, 59, 55, 61, 11, 13, 12, 27, 0, 22,
- 26, 21, 26, 27, 28, 29, 0, 14, 15, 0,
- 26, 27, 0, 0, 0, 26, 16, 18, 0, 0,
- 19, 0, 17
+ 26, 21, 26, 0, 28, 29, 0, 14, 15, 0,
+ 26, 27, 0, 0, 27, 26, 16, 18, 26, 0,
+ 0, 0, 0, 17, 19
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 14, 15, 37, 105, 50, 18, 19, 20, 106,
+ -1, 14, 15, 37, 105, 50, 18, 19, 20, 98,
100, 107, 108, 23, 32, 33
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -97
+#define YYPACT_NINF -96
static const yytype_int16 yypact[] =
{
- 62, -97, -97, -97, 10, -97, 30, 16, 2, -26,
- 34, 2, 2, 2, 44, 22, 1, -97, 27, 29,
- 85, 168, -97, -97, -97, 63, -97, 69, -97, 59,
- -97, 9, 47, -97, -97, -97, 2, -97, 103, 76,
- -97, 6, 180, 180, 144, -97, 62, 85, 2, 85,
- 65, 156, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, -97, -97, 80, -97, 81, 87, 74, -97, 103,
- 94, -97, 2, 2, -97, -97, 53, 120, 67, 132,
- -97, 2, 168, 168, 168, 90, 90, 180, 180, 168,
- 168, -97, -97, -97, -97, 168, 168, -97, 2, -97,
- 89, 168, 89, 168, -97, -97, 24, 168, -97, 98,
- 89, -97, 101, 92, 106, 89, -97, -97, 95, 113,
- -97, 123, -97
+ 62, -96, -96, -96, 10, -96, 13, -4, 2, 36,
+ 17, 2, 2, 2, 28, -8, 1, -96, 23, 38,
+ 87, 154, -96, -96, -96, 30, -96, 69, -96, 49,
+ -96, -2, 14, -96, -96, -96, 2, -96, 98, 71,
+ -96, -13, 172, 172, 130, -96, 62, 87, 2, 87,
+ 56, 142, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, -96, -96, 75, -96, 76, 80, 74, -96, 98,
+ 83, -96, 2, 2, -96, -96, 51, 154, 52, 118,
+ -96, 2, 154, 154, 154, 166, 166, 172, 172, 154,
+ 154, -96, -96, -96, -96, 154, 154, -96, 79, -96,
+ 84, 154, 84, 2, -96, -96, 60, 154, -96, 100,
+ 154, -96, 101, 90, -96, 84, -96, -96, 84, 105,
+ 106, 104, 95, -96, -96
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -97, 93, -97, 4, 5, 35, -97, -97, -97, -96,
- -87, 0, 15, -97, -97, 112
+ -96, 77, -96, 4, 5, -5, -96, -96, -96, 32,
+ -95, 0, 15, -96, -96, 88
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -633,56 +634,54 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -7
static const yytype_int8 yytable[] =
{
- 21, -6, 39, 40, 16, 17, 109, 2, 38, 3,
- 102, 42, 43, 44, 114, 22, 110, 64, 24, 119,
- 51, 65, 25, 35, 115, 36, 26, 10, 66, 27,
- 28, 29, 30, 72, 111, 112, 69, 31, 34, 11,
- 12, 41, 73, -6, 45, 13, 21, 51, 77, 79,
+ 21, -6, 102, 35, 16, 17, 64, 2, 38, 3,
+ 65, 42, 43, 44, 72, 22, 115, 66, 24, 118,
+ 51, 34, 25, 73, 41, 36, 26, 10, 45, 27,
+ 28, 29, 30, 27, 46, 29, 69, 31, 61, 11,
+ 12, 67, 76, -6, 78, 13, 21, 51, 77, 79,
16, 17, 82, 83, 84, 85, 86, 87, 88, 89,
- 90, 22, -4, 1, 46, 48, 27, 2, 29, 3,
- 47, 61, 95, 96, 67, 4, 5, 62, 63, 6,
- 7, 101, 76, 71, 78, 8, 9, 10, 91, 92,
- 2, 80, 3, 66, 2, 93, 3, 97, 103, 11,
- 12, 94, 4, 5, -4, 13, 6, 7, 36, 113,
- 10, 99, 8, 9, 10, 116, 117, 118, 70, 120,
- 52, 53, 11, 12, 121, 54, 11, 12, 49, 57,
- 58, 104, 13, 52, 53, 59, 60, 122, 54, 75,
- 55, 56, 57, 58, 68, 0, 0, 98, 59, 60,
- 52, 53, 0, 0, 0, 54, 0, 55, 56, 57,
- 58, 0, 52, 53, 0, 59, 60, 54, 81, 55,
- 56, 57, 58, 0, 52, 53, 74, 59, 60, 54,
- 0, 55, 56, 57, 58, 0, 52, 53, 74, 59,
- 60, 54, 81, 55, 56, 57, 58, 0, 52, 53,
- 0, 59, 60, 54, 0, 55, 56, 57, 58, 0,
- 52, 53, 0, 59, 60, 54, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 59, 60
+ 90, 22, -4, 1, 39, 40, 47, 2, 63, 3,
+ 111, 112, 95, 96, 48, 4, 5, 62, 71, 6,
+ 7, 101, 80, 91, 92, 8, 9, 10, 93, 2,
+ 94, 3, 2, 66, 3, 97, 99, 4, 5, 11,
+ 12, 6, 7, 110, -4, 13, 103, 8, 9, 10,
+ 36, 113, 10, 70, 117, 116, 121, 122, 123, 124,
+ 68, 11, 12, 75, 11, 12, 104, 13, 52, 53,
+ 49, 0, 106, 54, 109, 55, 56, 57, 58, 0,
+ 0, 0, 114, 59, 60, 0, 0, 119, 52, 53,
+ 120, 0, 0, 54, 81, 55, 56, 57, 58, 0,
+ 52, 53, 74, 59, 60, 54, 0, 55, 56, 57,
+ 58, 0, 52, 53, 74, 59, 60, 54, 81, 55,
+ 56, 57, 58, 0, 52, 53, 0, 59, 60, 54,
+ 0, 55, 56, 57, 58, 0, 52, 53, 0, 59,
+ 60, 54, 52, 53, 0, 57, 58, 54, 0, 0,
+ 0, 59, 60, 0, 0, 0, 0, 59, 60
};
static const yytype_int8 yycheck[] =
{
- 0, 0, 28, 29, 0, 0, 102, 5, 8, 7,
- 97, 11, 12, 13, 110, 0, 103, 8, 8, 115,
- 20, 12, 12, 7, 111, 23, 16, 25, 19, 19,
- 20, 21, 22, 27, 10, 11, 36, 27, 8, 37,
- 38, 7, 36, 42, 0, 43, 46, 47, 48, 49,
+ 0, 0, 97, 7, 0, 0, 8, 5, 8, 7,
+ 12, 11, 12, 13, 27, 0, 111, 19, 8, 114,
+ 20, 8, 12, 36, 7, 23, 16, 25, 0, 19,
+ 20, 21, 22, 19, 42, 21, 36, 27, 8, 37,
+ 38, 27, 47, 42, 49, 43, 46, 47, 48, 49,
46, 46, 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 46, 0, 1, 42, 36, 19, 5, 21, 7,
- 43, 8, 72, 73, 27, 13, 14, 8, 19, 17,
- 18, 81, 47, 7, 49, 23, 24, 25, 8, 8,
- 5, 26, 7, 19, 5, 8, 7, 44, 98, 37,
- 38, 7, 13, 14, 42, 43, 17, 18, 23, 11,
- 25, 44, 23, 24, 25, 14, 24, 11, 15, 24,
- 30, 31, 37, 38, 11, 35, 37, 38, 43, 39,
- 40, 42, 43, 30, 31, 45, 46, 14, 35, 46,
- 37, 38, 39, 40, 32, -1, -1, 27, 45, 46,
- 30, 31, -1, -1, -1, 35, -1, 37, 38, 39,
- 40, -1, 30, 31, -1, 45, 46, 35, 36, 37,
- 38, 39, 40, -1, 30, 31, 44, 45, 46, 35,
- -1, 37, 38, 39, 40, -1, 30, 31, 44, 45,
- 46, 35, 36, 37, 38, 39, 40, -1, 30, 31,
- -1, 45, 46, 35, -1, 37, 38, 39, 40, -1,
- 30, 31, -1, 45, 46, 35, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 45, 46
+ 60, 46, 0, 1, 28, 29, 43, 5, 19, 7,
+ 10, 11, 72, 73, 36, 13, 14, 8, 7, 17,
+ 18, 81, 26, 8, 8, 23, 24, 25, 8, 5,
+ 7, 7, 5, 19, 7, 44, 44, 13, 14, 37,
+ 38, 17, 18, 103, 42, 43, 27, 23, 24, 25,
+ 23, 11, 25, 15, 24, 14, 11, 11, 14, 24,
+ 32, 37, 38, 46, 37, 38, 42, 43, 30, 31,
+ 43, -1, 100, 35, 102, 37, 38, 39, 40, -1,
+ -1, -1, 110, 45, 46, -1, -1, 115, 30, 31,
+ 118, -1, -1, 35, 36, 37, 38, 39, 40, -1,
+ 30, 31, 44, 45, 46, 35, -1, 37, 38, 39,
+ 40, -1, 30, 31, 44, 45, 46, 35, 36, 37,
+ 38, 39, 40, -1, 30, 31, -1, 45, 46, 35,
+ -1, 37, 38, 39, 40, -1, 30, 31, -1, 45,
+ 46, 35, 30, 31, -1, 39, 40, 35, -1, -1,
+ -1, 45, 46, -1, -1, -1, -1, 45, 46
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -698,10 +697,10 @@ static const yytype_uint8 yystos[] =
46, 8, 8, 19, 8, 12, 19, 27, 62, 58,
15, 7, 27, 36, 44, 48, 52, 58, 52, 58,
26, 36, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 8, 8, 8, 7, 58, 58, 44, 27, 44,
- 57, 58, 57, 58, 42, 51, 56, 58, 59, 56,
- 57, 10, 11, 11, 56, 57, 14, 24, 11, 56,
- 24, 11, 14
+ 58, 8, 8, 8, 7, 58, 58, 44, 56, 44,
+ 57, 58, 57, 27, 42, 51, 56, 58, 59, 56,
+ 58, 10, 11, 11, 56, 57, 14, 24, 57, 56,
+ 56, 11, 11, 14, 24
};
#define yyerrok (yyerrstatus = 0)
@@ -1553,7 +1552,7 @@ yyreduce:
case 16:
#line 110 "engines/director/lingo/lingo-gr.y"
{
- inst then, end;
+ inst then = 0, end = 0;
WRITE_LE_UINT32(&then, (yyvsp[(4) - (7)].code));
WRITE_LE_UINT32(&end, (yyvsp[(5) - (7)].code));
(*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
@@ -1563,7 +1562,7 @@ yyreduce:
case 17:
#line 116 "engines/director/lingo/lingo-gr.y"
{
- inst then, else1, end;
+ inst then = 0, else1 = 0, end = 0;
WRITE_LE_UINT32(&then, (yyvsp[(4) - (10)].code));
WRITE_LE_UINT32(&else1, (yyvsp[(7) - (10)].code));
WRITE_LE_UINT32(&end, (yyvsp[(8) - (10)].code));
@@ -1575,7 +1574,7 @@ yyreduce:
case 18:
#line 128 "engines/director/lingo/lingo-gr.y"
{
- inst body, end;
+ inst body = 0, end = 0;
WRITE_LE_UINT32(&body, (yyvsp[(5) - (8)].code));
WRITE_LE_UINT32(&end, (yyvsp[(6) - (8)].code));
(*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = body; /* body of loop */
@@ -1585,15 +1584,15 @@ yyreduce:
case 19:
#line 143 "engines/director/lingo/lingo-gr.y"
{
- inst init, finish, body, end;
- WRITE_LE_UINT32(&init, (yyvsp[(3) - (9)].code));
- WRITE_LE_UINT32(&finish, (yyvsp[(5) - (9)].code));
- WRITE_LE_UINT32(&body, (yyvsp[(6) - (9)].code));
- WRITE_LE_UINT32(&end, (yyvsp[(7) - (9)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 1] = init; /* initial count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 2] = finish;/* final count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 3] = body; /* body of loop */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 4] = end; ;}
+ inst init = 0, finish = 0, body = 0, end = 0;
+ WRITE_LE_UINT32(&init, (yyvsp[(3) - (11)].code));
+ WRITE_LE_UINT32(&finish, (yyvsp[(6) - (11)].code));
+ WRITE_LE_UINT32(&body, (yyvsp[(8) - (11)].code));
+ WRITE_LE_UINT32(&end, (yyvsp[(9) - (11)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = init; /* initial count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = finish;/* final count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = body; /* body of loop */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 4] = end; ;}
break;
case 20:
@@ -1637,12 +1636,12 @@ yyreduce:
case 30:
#line 176 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_constpush); inst i; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); (yyval.code) = g_lingo->code1(i); ;}
+ { (yyval.code) = g_lingo->code1(g_lingo->c_constpush); inst i = 0; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); g_lingo->code1(i); ;}
break;
case 31:
#line 177 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); (yyval.code) = g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;}
+ { (yyval.code) = g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
case 33:
@@ -1787,7 +1786,7 @@ yyreduce:
/* Line 1267 of yacc.c. */
-#line 1791 "engines/director/lingo/lingo-gr.cpp"
+#line 1790 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index eb58460..5601d2b 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -108,13 +108,13 @@ asgn: tPUT expr tINTO VAR { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeSt
stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
| func
| if cond tTHEN stmtlist end tEND tIF {
- inst then, end;
+ inst then = 0, end = 0;
WRITE_LE_UINT32(&then, $4);
WRITE_LE_UINT32(&end, $5);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
| if cond tTHEN stmtlist end tELSE stmtlist end tEND tIF {
- inst then, else1, end;
+ inst then = 0, else1 = 0, end = 0;
WRITE_LE_UINT32(&then, $4);
WRITE_LE_UINT32(&else1, $7);
WRITE_LE_UINT32(&end, $8);
@@ -126,7 +126,7 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
// end repeat
//
| repeatwhile '(' cond ')' stmtlist end tEND tREPEAT {
- inst body, end;
+ inst body = 0, end = 0;
WRITE_LE_UINT32(&body, $5);
WRITE_LE_UINT32(&end, $6);
(*g_lingo->_currentScript)[$1 + 1] = body; /* body of loop */
@@ -140,12 +140,12 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
// statements
// end repeat
//
- | repeatwith '=' expr tTO expr stmtlist end tEND tREPEAT {
- inst init, finish, body, end;
+ | repeatwith '=' expr end tTO expr end stmtlist end tEND tREPEAT {
+ inst init = 0, finish = 0, body = 0, end = 0;
WRITE_LE_UINT32(&init, $3);
- WRITE_LE_UINT32(&finish, $5);
- WRITE_LE_UINT32(&body, $6);
- WRITE_LE_UINT32(&end, $7);
+ WRITE_LE_UINT32(&finish, $6);
+ WRITE_LE_UINT32(&body, $8);
+ WRITE_LE_UINT32(&end, $9);
(*g_lingo->_currentScript)[$1 + 1] = init; /* initial count value */
(*g_lingo->_currentScript)[$1 + 2] = finish;/* final count value */
(*g_lingo->_currentScript)[$1 + 3] = body; /* body of loop */
@@ -173,8 +173,8 @@ stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
| stmtlist stmt
;
-expr: INT { g_lingo->code1(g_lingo->c_constpush); inst i; WRITE_LE_UINT32(&i, $1); $$ = g_lingo->code1(i); };
- | VAR { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($1->c_str()); $$ = g_lingo->code1(g_lingo->c_eval); delete $1; }
+expr: INT { $$ = g_lingo->code1(g_lingo->c_constpush); inst i = 0; WRITE_LE_UINT32(&i, $1); g_lingo->code1(i); };
+ | VAR { $$ = g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($1->c_str()); g_lingo->code1(g_lingo->c_eval); delete $1; }
| asgn
| expr '+' expr { g_lingo->code1(g_lingo->c_add); }
| expr '-' expr { g_lingo->code1(g_lingo->c_sub); }
Commit: 587461108e3c50c737002a57b8a2dd78f2e527fe
https://github.com/scummvm/scummvm/commit/587461108e3c50c737002a57b8a2dd78f2e527fe
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implement 'repeat with down' control keyword
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index ef578c3..641bfe2 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -101,6 +101,9 @@ end repeat\n\
repeat with z = 10 to 15\n\
put z\n\
end repeat\n\
+repeat with y = 5 down to 1\n\
+put y\n\
+end repeat\n\
", kMovieScript, 3);
_lingo->executeScript(kMovieScript, 3);
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 6e3f437..702f84c 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -282,8 +282,9 @@ void Lingo::c_repeatwithcode(void) {
int init = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc]);
int finish = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
int body = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
- int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 3]);
- Common::String countername((char *)&(*g_lingo->_currentScript)[savepc + 4]);
+ int inc = (int32)READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 3]);
+ int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 4]);
+ Common::String countername((char *)&(*g_lingo->_currentScript)[savepc + 5]);
Symbol *counter = g_lingo->lookupVar(countername.c_str());
g_lingo->execute(init); /* condition */
@@ -296,11 +297,11 @@ void Lingo::c_repeatwithcode(void) {
if (g_lingo->_returning)
break;
- counter->u.val++;
+ counter->u.val += inc;
g_lingo->execute(finish); /* condition */
d = g_lingo->pop();
- if (counter->u.val > d.val)
+ if (counter->u.val == d.val + inc)
break;
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 04a3a06..b3b8552 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -413,16 +413,16 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 45
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 218
+#define YYLAST 228
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 47
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 16
/* YYNRULES -- Number of rules. */
-#define YYNRULES 61
+#define YYNRULES 62
/* YYNRULES -- Number of states. */
-#define YYNSTATES 125
+#define YYNSTATES 133
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -473,11 +473,11 @@ static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
20, 21, 26, 31, 36, 38, 40, 48, 59, 68,
- 80, 82, 86, 90, 93, 97, 99, 100, 101, 104,
- 107, 109, 111, 113, 117, 121, 125, 129, 133, 137,
- 141, 145, 149, 152, 155, 159, 162, 165, 168, 170,
- 173, 176, 179, 182, 186, 189, 193, 196, 199, 201,
- 205, 208
+ 80, 93, 95, 99, 103, 106, 110, 112, 113, 114,
+ 117, 120, 122, 124, 126, 130, 134, 138, 142, 146,
+ 150, 154, 158, 162, 165, 168, 172, 175, 178, 181,
+ 183, 186, 189, 192, 195, 199, 202, 206, 209, 212,
+ 214, 218, 221
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -491,32 +491,33 @@ static const yytype_int8 yyrhs[] =
26, 57, 56, 10, 57, 56, 11, 14, -1, 53,
43, 52, 44, 57, 56, 11, 24, -1, 54, 36,
58, 56, 27, 58, 56, 57, 56, 11, 24, -1,
- 58, -1, 58, 36, 58, -1, 43, 52, 44, -1,
- 24, 29, -1, 24, 28, 7, -1, 14, -1, -1,
- -1, 57, 42, -1, 57, 51, -1, 5, -1, 7,
- -1, 50, -1, 58, 37, 58, -1, 58, 38, 58,
- -1, 58, 39, 58, -1, 58, 40, 58, -1, 58,
- 45, 58, -1, 58, 46, 58, -1, 58, 35, 58,
- -1, 58, 30, 58, -1, 58, 31, 58, -1, 37,
- 58, -1, 38, 58, -1, 43, 58, 44, -1, 17,
- 8, -1, 18, 7, -1, 23, 58, -1, 60, -1,
- 13, 16, -1, 13, 20, -1, 13, 22, -1, 13,
- 61, -1, 13, 61, 62, -1, 13, 62, -1, 27,
- 12, 8, -1, 12, 8, -1, 27, 8, -1, 8,
- -1, 21, 19, 8, -1, 19, 8, -1, 27, 19,
- 8, -1
+ 54, 36, 58, 56, 9, 27, 58, 56, 57, 56,
+ 11, 24, -1, 58, -1, 58, 36, 58, -1, 43,
+ 52, 44, -1, 24, 29, -1, 24, 28, 7, -1,
+ 14, -1, -1, -1, 57, 42, -1, 57, 51, -1,
+ 5, -1, 7, -1, 50, -1, 58, 37, 58, -1,
+ 58, 38, 58, -1, 58, 39, 58, -1, 58, 40,
+ 58, -1, 58, 45, 58, -1, 58, 46, 58, -1,
+ 58, 35, 58, -1, 58, 30, 58, -1, 58, 31,
+ 58, -1, 37, 58, -1, 38, 58, -1, 43, 58,
+ 44, -1, 17, 8, -1, 18, 7, -1, 23, 58,
+ -1, 60, -1, 13, 16, -1, 13, 20, -1, 13,
+ 22, -1, 13, 61, -1, 13, 61, 62, -1, 13,
+ 62, -1, 27, 12, 8, -1, 12, 8, -1, 27,
+ 8, -1, 8, -1, 21, 19, 8, -1, 19, 8,
+ -1, 27, 19, 8, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
0, 90, 90, 91, 94, 95, 96, 97, 98, 99,
- 100, 103, 104, 105, 108, 109, 110, 116, 128, 143,
- 155, 156, 157, 159, 161, 167, 169, 171, 172, 173,
- 176, 177, 178, 179, 180, 181, 182, 183, 184, 185,
- 186, 187, 188, 189, 190, 193, 194, 195, 196, 207,
- 208, 209, 210, 211, 212, 215, 216, 217, 218, 221,
- 222, 223
+ 100, 103, 104, 105, 108, 109, 110, 116, 128, 139,
+ 155, 169, 170, 171, 173, 175, 181, 183, 185, 186,
+ 187, 190, 191, 192, 193, 194, 195, 196, 197, 198,
+ 199, 200, 201, 202, 203, 204, 207, 208, 209, 210,
+ 221, 222, 223, 224, 225, 226, 229, 230, 231, 232,
+ 235, 236, 237
};
#endif
@@ -554,11 +555,11 @@ static const yytype_uint8 yyr1[] =
{
0, 47, 48, 48, 49, 49, 49, 49, 49, 49,
49, 50, 50, 50, 51, 51, 51, 51, 51, 51,
- 52, 52, 52, 53, 54, 55, 56, 57, 57, 57,
- 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 59, 59, 59, 59, 60,
- 60, 60, 60, 60, 60, 61, 61, 61, 61, 62,
- 62, 62
+ 51, 52, 52, 52, 53, 54, 55, 56, 57, 57,
+ 57, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 59, 59, 59, 59,
+ 60, 60, 60, 60, 60, 60, 61, 61, 61, 61,
+ 62, 62, 62
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -566,11 +567,11 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
0, 4, 4, 4, 1, 1, 7, 10, 8, 11,
- 1, 3, 3, 2, 3, 1, 0, 0, 2, 2,
- 1, 1, 1, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 2, 2, 3, 2, 2, 2, 1, 2,
- 2, 2, 2, 3, 2, 3, 2, 2, 1, 3,
- 2, 3
+ 12, 1, 3, 3, 2, 3, 1, 0, 0, 2,
+ 2, 1, 1, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 2, 3, 2, 2, 2, 1,
+ 2, 2, 2, 2, 3, 2, 3, 2, 2, 1,
+ 3, 2, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -578,26 +579,27 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 9, 30, 31, 0, 25, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 3, 32, 7, 0, 0,
- 0, 8, 5, 48, 58, 0, 49, 0, 50, 0,
- 51, 0, 52, 54, 45, 46, 0, 32, 47, 0,
- 23, 0, 42, 43, 0, 1, 0, 0, 0, 0,
- 0, 20, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 56, 60, 0, 57, 0, 0, 0, 53, 0,
- 0, 24, 0, 0, 44, 2, 0, 26, 0, 0,
- 27, 0, 40, 41, 39, 33, 34, 35, 36, 37,
- 38, 59, 55, 61, 11, 13, 12, 27, 0, 22,
- 26, 21, 26, 0, 28, 29, 0, 14, 15, 0,
- 26, 27, 0, 0, 27, 26, 16, 18, 26, 0,
- 0, 0, 0, 17, 19
+ 0, 9, 31, 32, 0, 26, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 3, 33, 7, 0, 0,
+ 0, 8, 5, 49, 59, 0, 50, 0, 51, 0,
+ 52, 0, 53, 55, 46, 47, 0, 33, 48, 0,
+ 24, 0, 43, 44, 0, 1, 0, 0, 0, 0,
+ 0, 21, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 57, 61, 0, 58, 0, 0, 0, 54, 0,
+ 0, 25, 0, 0, 45, 2, 0, 27, 0, 0,
+ 28, 0, 41, 42, 40, 34, 35, 36, 37, 38,
+ 39, 60, 56, 62, 11, 13, 12, 28, 0, 23,
+ 27, 22, 27, 0, 0, 29, 30, 0, 14, 15,
+ 0, 0, 27, 28, 0, 0, 27, 28, 27, 16,
+ 18, 28, 27, 0, 27, 0, 0, 0, 0, 17,
+ 0, 19, 20
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 14, 15, 37, 105, 50, 18, 19, 20, 98,
- 100, 107, 108, 23, 32, 33
+ -1, 14, 15, 37, 106, 50, 18, 19, 20, 98,
+ 100, 108, 109, 23, 32, 33
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
@@ -605,26 +607,27 @@ static const yytype_int8 yydefgoto[] =
#define YYPACT_NINF -96
static const yytype_int16 yypact[] =
{
- 62, -96, -96, -96, 10, -96, 13, -4, 2, 36,
- 17, 2, 2, 2, 28, -8, 1, -96, 23, 38,
- 87, 154, -96, -96, -96, 30, -96, 69, -96, 49,
- -96, -2, 14, -96, -96, -96, 2, -96, 98, 71,
- -96, -13, 172, 172, 130, -96, 62, 87, 2, 87,
- 56, 142, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, -96, -96, 75, -96, 76, 80, 74, -96, 98,
- 83, -96, 2, 2, -96, -96, 51, 154, 52, 118,
- -96, 2, 154, 154, 154, 166, 166, 172, 172, 154,
- 154, -96, -96, -96, -96, 154, 154, -96, 79, -96,
- 84, 154, 84, 2, -96, -96, 60, 154, -96, 100,
- 154, -96, 101, 90, -96, 84, -96, -96, 84, 105,
- 106, 104, 95, -96, -96
+ 70, -96, -96, -96, 141, -96, 8, 12, 2, 6,
+ 17, 2, 2, 2, 38, -1, 1, -96, 19, 29,
+ 95, 170, -96, -96, -96, 34, -96, 36, -96, 47,
+ -96, -2, 10, -96, -96, -96, 2, -96, 106, 60,
+ -96, -13, 33, 33, 146, -96, 70, 95, 2, 95,
+ 43, 158, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, -96, -96, 72, -96, 74, 77, 82, -96, 106,
+ 84, -96, 2, 2, -96, -96, 45, 170, 59, 134,
+ -96, 2, 170, 170, 170, 182, 182, 33, 33, 170,
+ 170, -96, -96, -96, -96, 170, 170, -96, -6, -96,
+ 92, 170, 92, 87, 2, -96, -96, 22, 170, -96,
+ 108, 2, 170, -96, 109, 98, 170, -96, 92, -96,
+ -96, -96, 92, 113, 92, 114, 112, 116, 104, -96,
+ 107, -96, -96
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -96, 77, -96, 4, 5, -5, -96, -96, -96, 32,
- -95, 0, 15, -96, -96, 88
+ -96, 93, -96, 4, 5, -19, -96, -96, -96, -26,
+ -95, 0, 15, -96, -96, 110
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -632,56 +635,58 @@ static const yytype_int8 yypgoto[] =
number is the opposite. If zero, do what YYDEFACT says.
If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -7
-static const yytype_int8 yytable[] =
+static const yytype_int16 yytable[] =
{
- 21, -6, 102, 35, 16, 17, 64, 2, 38, 3,
- 65, 42, 43, 44, 72, 22, 115, 66, 24, 118,
- 51, 34, 25, 73, 41, 36, 26, 10, 45, 27,
- 28, 29, 30, 27, 46, 29, 69, 31, 61, 11,
- 12, 67, 76, -6, 78, 13, 21, 51, 77, 79,
+ 21, -6, 102, 103, 16, 17, 64, 2, 38, 3,
+ 65, 42, 43, 44, 72, 22, 34, 66, 118, 35,
+ 51, 104, 122, 73, 41, 36, 124, 10, 76, 27,
+ 78, 29, 113, 114, 39, 40, 69, 67, 45, 11,
+ 12, 46, 61, -6, 62, 13, 21, 51, 77, 79,
16, 17, 82, 83, 84, 85, 86, 87, 88, 89,
- 90, 22, -4, 1, 39, 40, 47, 2, 63, 3,
- 111, 112, 95, 96, 48, 4, 5, 62, 71, 6,
- 7, 101, 80, 91, 92, 8, 9, 10, 93, 2,
- 94, 3, 2, 66, 3, 97, 99, 4, 5, 11,
- 12, 6, 7, 110, -4, 13, 103, 8, 9, 10,
- 36, 113, 10, 70, 117, 116, 121, 122, 123, 124,
- 68, 11, 12, 75, 11, 12, 104, 13, 52, 53,
- 49, 0, 106, 54, 109, 55, 56, 57, 58, 0,
- 0, 0, 114, 59, 60, 0, 0, 119, 52, 53,
- 120, 0, 0, 54, 81, 55, 56, 57, 58, 0,
- 52, 53, 74, 59, 60, 54, 0, 55, 56, 57,
- 58, 0, 52, 53, 74, 59, 60, 54, 81, 55,
- 56, 57, 58, 0, 52, 53, 0, 59, 60, 54,
- 0, 55, 56, 57, 58, 0, 52, 53, 0, 59,
- 60, 54, 52, 53, 0, 57, 58, 54, 0, 0,
- 0, 59, 60, 0, 0, 0, 0, 59, 60
+ 90, 22, 47, 52, 53, 48, 63, 71, 54, 80,
+ -4, 1, 95, 96, 107, 2, 110, 3, 59, 60,
+ 91, 101, 92, 4, 5, 93, 117, 6, 7, 97,
+ 121, 94, 123, 8, 9, 10, 125, 2, 127, 3,
+ 2, 66, 3, 99, 112, 4, 5, 11, 12, 6,
+ 7, 116, -4, 13, 111, 8, 9, 10, 36, 115,
+ 10, 70, 120, 119, 126, 128, 129, 130, 131, 11,
+ 12, 132, 11, 12, 105, 13, 52, 53, 49, 75,
+ 0, 54, 68, 55, 56, 57, 58, 0, 0, 24,
+ 0, 59, 60, 25, 0, 0, 0, 26, 0, 0,
+ 27, 28, 29, 30, 52, 53, 0, 0, 31, 54,
+ 81, 55, 56, 57, 58, 0, 52, 53, 74, 59,
+ 60, 54, 0, 55, 56, 57, 58, 0, 52, 53,
+ 74, 59, 60, 54, 81, 55, 56, 57, 58, 0,
+ 52, 53, 0, 59, 60, 54, 0, 55, 56, 57,
+ 58, 0, 52, 53, 0, 59, 60, 54, 0, 0,
+ 0, 57, 58, 0, 0, 0, 0, 59, 60
};
static const yytype_int8 yycheck[] =
{
- 0, 0, 97, 7, 0, 0, 8, 5, 8, 7,
- 12, 11, 12, 13, 27, 0, 111, 19, 8, 114,
- 20, 8, 12, 36, 7, 23, 16, 25, 0, 19,
- 20, 21, 22, 19, 42, 21, 36, 27, 8, 37,
- 38, 27, 47, 42, 49, 43, 46, 47, 48, 49,
+ 0, 0, 97, 9, 0, 0, 8, 5, 8, 7,
+ 12, 11, 12, 13, 27, 0, 8, 19, 113, 7,
+ 20, 27, 117, 36, 7, 23, 121, 25, 47, 19,
+ 49, 21, 10, 11, 28, 29, 36, 27, 0, 37,
+ 38, 42, 8, 42, 8, 43, 46, 47, 48, 49,
46, 46, 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 46, 0, 1, 28, 29, 43, 5, 19, 7,
- 10, 11, 72, 73, 36, 13, 14, 8, 7, 17,
- 18, 81, 26, 8, 8, 23, 24, 25, 8, 5,
- 7, 7, 5, 19, 7, 44, 44, 13, 14, 37,
- 38, 17, 18, 103, 42, 43, 27, 23, 24, 25,
- 23, 11, 25, 15, 24, 14, 11, 11, 14, 24,
- 32, 37, 38, 46, 37, 38, 42, 43, 30, 31,
- 43, -1, 100, 35, 102, 37, 38, 39, 40, -1,
- -1, -1, 110, 45, 46, -1, -1, 115, 30, 31,
- 118, -1, -1, 35, 36, 37, 38, 39, 40, -1,
- 30, 31, 44, 45, 46, 35, -1, 37, 38, 39,
- 40, -1, 30, 31, 44, 45, 46, 35, 36, 37,
- 38, 39, 40, -1, 30, 31, -1, 45, 46, 35,
- -1, 37, 38, 39, 40, -1, 30, 31, -1, 45,
- 46, 35, 30, 31, -1, 39, 40, 35, -1, -1,
- -1, 45, 46, -1, -1, -1, -1, 45, 46
+ 60, 46, 43, 30, 31, 36, 19, 7, 35, 26,
+ 0, 1, 72, 73, 100, 5, 102, 7, 45, 46,
+ 8, 81, 8, 13, 14, 8, 112, 17, 18, 44,
+ 116, 7, 118, 23, 24, 25, 122, 5, 124, 7,
+ 5, 19, 7, 44, 104, 13, 14, 37, 38, 17,
+ 18, 111, 42, 43, 27, 23, 24, 25, 23, 11,
+ 25, 15, 24, 14, 11, 11, 14, 11, 24, 37,
+ 38, 24, 37, 38, 42, 43, 30, 31, 43, 46,
+ -1, 35, 32, 37, 38, 39, 40, -1, -1, 8,
+ -1, 45, 46, 12, -1, -1, -1, 16, -1, -1,
+ 19, 20, 21, 22, 30, 31, -1, -1, 27, 35,
+ 36, 37, 38, 39, 40, -1, 30, 31, 44, 45,
+ 46, 35, -1, 37, 38, 39, 40, -1, 30, 31,
+ 44, 45, 46, 35, 36, 37, 38, 39, 40, -1,
+ 30, 31, -1, 45, 46, 35, -1, 37, 38, 39,
+ 40, -1, 30, 31, -1, 45, 46, 35, -1, -1,
+ -1, 39, 40, -1, -1, -1, -1, 45, 46
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -698,9 +703,10 @@ static const yytype_uint8 yystos[] =
15, 7, 27, 36, 44, 48, 52, 58, 52, 58,
26, 36, 58, 58, 58, 58, 58, 58, 58, 58,
58, 8, 8, 8, 7, 58, 58, 44, 56, 44,
- 57, 58, 57, 27, 42, 51, 56, 58, 59, 56,
- 58, 10, 11, 11, 56, 57, 14, 24, 57, 56,
- 56, 11, 11, 14, 24
+ 57, 58, 57, 9, 27, 42, 51, 56, 58, 59,
+ 56, 27, 58, 10, 11, 11, 58, 56, 57, 14,
+ 24, 56, 57, 56, 57, 56, 11, 56, 11, 14,
+ 11, 24, 24
};
#define yyerrok (yyerrstatus = 0)
@@ -1582,211 +1588,229 @@ yyreduce:
break;
case 19:
-#line 143 "engines/director/lingo/lingo-gr.y"
+#line 139 "engines/director/lingo/lingo-gr.y"
{
- inst init = 0, finish = 0, body = 0, end = 0;
+ inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_LE_UINT32(&init, (yyvsp[(3) - (11)].code));
WRITE_LE_UINT32(&finish, (yyvsp[(6) - (11)].code));
WRITE_LE_UINT32(&body, (yyvsp[(8) - (11)].code));
WRITE_LE_UINT32(&end, (yyvsp[(9) - (11)].code));
+ WRITE_LE_UINT32(&inc, 1);
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = init; /* initial count value */
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = finish;/* final count value */
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = body; /* body of loop */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 4] = end; ;}
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 4] = inc; /* increment */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
break;
case 20:
#line 155 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(STOP); ;}
+ {
+ inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
+ WRITE_LE_UINT32(&init, (yyvsp[(3) - (12)].code));
+ WRITE_LE_UINT32(&finish, (yyvsp[(7) - (12)].code));
+ WRITE_LE_UINT32(&body, (yyvsp[(9) - (12)].code));
+ WRITE_LE_UINT32(&end, (yyvsp[(10) - (12)].code));
+ WRITE_LE_UINT32(&inc, -1);
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = init; /* initial count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = finish;/* final count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = body; /* body of loop */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 4] = inc; /* increment */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
break;
case 21:
-#line 156 "engines/director/lingo/lingo-gr.y"
+#line 169 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(STOP); ;}
+ break;
+
+ case 22:
+#line 170 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 23:
-#line 159 "engines/director/lingo/lingo-gr.y"
+ case 24:
+#line 173 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 24:
-#line 161 "engines/director/lingo/lingo-gr.y"
+ case 25:
+#line 175 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
- g_lingo->code2(STOP, STOP);
+ g_lingo->code3(STOP, STOP, STOP);
g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str());
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 25:
-#line 167 "engines/director/lingo/lingo-gr.y"
+ case 26:
+#line 181 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
- case 26:
-#line 169 "engines/director/lingo/lingo-gr.y"
+ case 27:
+#line 183 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 27:
-#line 171 "engines/director/lingo/lingo-gr.y"
+ case 28:
+#line 185 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 30:
-#line 176 "engines/director/lingo/lingo-gr.y"
+ case 31:
+#line 190 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_constpush); inst i = 0; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); g_lingo->code1(i); ;}
break;
- case 31:
-#line 177 "engines/director/lingo/lingo-gr.y"
+ case 32:
+#line 191 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
- case 33:
-#line 179 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 193 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 34:
-#line 180 "engines/director/lingo/lingo-gr.y"
+ case 35:
+#line 194 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 35:
-#line 181 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 195 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 36:
-#line 182 "engines/director/lingo/lingo-gr.y"
+ case 37:
+#line 196 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 37:
-#line 183 "engines/director/lingo/lingo-gr.y"
+ case 38:
+#line 197 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 38:
-#line 184 "engines/director/lingo/lingo-gr.y"
+ case 39:
+#line 198 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 39:
-#line 185 "engines/director/lingo/lingo-gr.y"
+ case 40:
+#line 199 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 40:
-#line 186 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 200 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 41:
-#line 187 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 201 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 42:
-#line 188 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 202 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 43:
-#line 189 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 203 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 44:
-#line 190 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 204 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 45:
-#line 193 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 207 "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 46:
-#line 194 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 208 "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 47:
-#line 195 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 209 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 49:
-#line 207 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 221 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 50:
-#line 208 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 222 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 51:
-#line 209 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 223 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 52:
-#line 210 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 224 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 53:
-#line 211 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 225 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
break;
- case 54:
-#line 212 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 226 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 55:
-#line 215 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 229 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 56:
-#line 216 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 230 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 57:
-#line 217 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 231 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 58:
-#line 218 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 232 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 59:
-#line 221 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 235 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 60:
-#line 222 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 236 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 61:
-#line 223 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 237 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
/* Line 1267 of yacc.c. */
-#line 1790 "engines/director/lingo/lingo-gr.cpp"
+#line 1814 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2000,6 +2024,6 @@ yyreturn:
}
-#line 253 "engines/director/lingo/lingo-gr.y"
+#line 267 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 5601d2b..8e3c14f 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -136,20 +136,34 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
// statements
// end repeat
//
- // repeat with index = high down to low
- // statements
- // end repeat
- //
| repeatwith '=' expr end tTO expr end stmtlist end tEND tREPEAT {
- inst init = 0, finish = 0, body = 0, end = 0;
+ inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_LE_UINT32(&init, $3);
WRITE_LE_UINT32(&finish, $6);
WRITE_LE_UINT32(&body, $8);
WRITE_LE_UINT32(&end, $9);
+ WRITE_LE_UINT32(&inc, 1);
+ (*g_lingo->_currentScript)[$1 + 1] = init; /* initial count value */
+ (*g_lingo->_currentScript)[$1 + 2] = finish;/* final count value */
+ (*g_lingo->_currentScript)[$1 + 3] = body; /* body of loop */
+ (*g_lingo->_currentScript)[$1 + 4] = inc; /* increment */
+ (*g_lingo->_currentScript)[$1 + 5] = end; } /* end, if cond fails */
+ // repeat with index = high down to low
+ // statements
+ // end repeat
+ //
+ | repeatwith '=' expr end tDOWN tTO expr end stmtlist end tEND tREPEAT {
+ inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
+ WRITE_LE_UINT32(&init, $3);
+ WRITE_LE_UINT32(&finish, $7);
+ WRITE_LE_UINT32(&body, $9);
+ WRITE_LE_UINT32(&end, $10);
+ WRITE_LE_UINT32(&inc, -1);
(*g_lingo->_currentScript)[$1 + 1] = init; /* initial count value */
(*g_lingo->_currentScript)[$1 + 2] = finish;/* final count value */
(*g_lingo->_currentScript)[$1 + 3] = body; /* body of loop */
- (*g_lingo->_currentScript)[$1 + 4] = end; } /* end, if cond fails */
+ (*g_lingo->_currentScript)[$1 + 4] = inc; /* increment */
+ (*g_lingo->_currentScript)[$1 + 5] = end; } /* end, if cond fails */
;
cond: expr { g_lingo->code1(STOP); }
@@ -160,7 +174,7 @@ repeatwhile: tREPEAT tWHILE { $$ = g_lingo->code3(g_lingo->c_repeatwhilecode, S
;
repeatwith: tREPEAT tWITH VAR {
$$ = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
- g_lingo->code2(STOP, STOP);
+ g_lingo->code3(STOP, STOP, STOP);
g_lingo->codeString($3->c_str());
delete $3; }
;
Commit: cd133e7e0ccd25adeb1b068a9e3342acd712831e
https://github.com/scummvm/scummvm/commit/cd133e7e0ccd25adeb1b068a9e3342acd712831e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Initial grammar for 'macro' keyword
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 702f84c..cfdb257 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -372,4 +372,11 @@ void Lingo::c_gotoprevious() {
warning("STUB: c_gotoprevious()");
}
+void Lingo::define(Common::String &s, int nargs) {
+ warning("STUB: define(\"%s\", %d)", s.c_str(), nargs);
+}
+void Lingo::c_procret() {
+ warning("STUB: c_procret()");
+}
+
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index b3b8552..ccbd337 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -80,25 +80,26 @@
tIF = 269,
tINTO = 270,
tLOOP = 271,
- tMCI = 272,
- tMCIWAIT = 273,
- tMOVIE = 274,
- tNEXT = 275,
- tOF = 276,
- tPREVIOUS = 277,
- tPUT = 278,
- tREPEAT = 279,
- tSET = 280,
- tTHEN = 281,
- tTO = 282,
- tWITH = 283,
- tWHILE = 284,
- tGE = 285,
- tLE = 286,
- tGT = 287,
- tLT = 288,
- tEQ = 289,
- tNEQ = 290
+ tMACRO = 272,
+ tMCI = 273,
+ tMCIWAIT = 274,
+ tMOVIE = 275,
+ tNEXT = 276,
+ tOF = 277,
+ tPREVIOUS = 278,
+ tPUT = 279,
+ tREPEAT = 280,
+ tSET = 281,
+ tTHEN = 282,
+ tTO = 283,
+ tWITH = 284,
+ tWHILE = 285,
+ tGE = 286,
+ tLE = 287,
+ tGT = 288,
+ tLT = 289,
+ tEQ = 290,
+ tNEQ = 291
};
#endif
/* Tokens. */
@@ -116,25 +117,26 @@
#define tIF 269
#define tINTO 270
#define tLOOP 271
-#define tMCI 272
-#define tMCIWAIT 273
-#define tMOVIE 274
-#define tNEXT 275
-#define tOF 276
-#define tPREVIOUS 277
-#define tPUT 278
-#define tREPEAT 279
-#define tSET 280
-#define tTHEN 281
-#define tTO 282
-#define tWITH 283
-#define tWHILE 284
-#define tGE 285
-#define tLE 286
-#define tGT 287
-#define tLT 288
-#define tEQ 289
-#define tNEQ 290
+#define tMACRO 272
+#define tMCI 273
+#define tMCIWAIT 274
+#define tMOVIE 275
+#define tNEXT 276
+#define tOF 277
+#define tPREVIOUS 278
+#define tPUT 279
+#define tREPEAT 280
+#define tSET 281
+#define tTHEN 282
+#define tTO 283
+#define tWITH 284
+#define tWHILE 285
+#define tGE 286
+#define tLE 287
+#define tGT 288
+#define tLT 289
+#define tEQ 290
+#define tNEQ 291
@@ -183,9 +185,10 @@ typedef union YYSTYPE
int i;
float f;
int code;
+ int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 189 "engines/director/lingo/lingo-gr.cpp"
+#line 192 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -198,7 +201,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 202 "engines/director/lingo/lingo-gr.cpp"
+#line 205 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -411,22 +414,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 45
+#define YYFINAL 48
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 228
+#define YYLAST 226
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 47
+#define YYNTOKENS 49
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 16
+#define YYNNTS 19
/* YYNRULES -- Number of rules. */
-#define YYNRULES 62
+#define YYNRULES 69
/* YYNRULES -- Number of states. */
-#define YYNSTATES 133
+#define YYNSTATES 144
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 290
+#define YYMAXUTOK 291
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -435,12 +438,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 42, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 43, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 41, 2, 2,
- 43, 44, 39, 37, 2, 38, 2, 40, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 42, 2, 2,
+ 44, 45, 40, 38, 48, 39, 2, 41, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 46, 36, 45, 2, 2, 2, 2, 2, 2, 2,
+ 47, 37, 46, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -463,7 +466,7 @@ static const yytype_uint8 yytranslate[] =
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35
+ 35, 36
};
#if YYDEBUG
@@ -472,52 +475,54 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint8 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
- 20, 21, 26, 31, 36, 38, 40, 48, 59, 68,
- 80, 93, 95, 99, 103, 106, 110, 112, 113, 114,
- 117, 120, 122, 124, 126, 130, 134, 138, 142, 146,
- 150, 154, 158, 162, 165, 168, 172, 175, 178, 181,
- 183, 186, 189, 192, 195, 199, 202, 206, 209, 212,
- 214, 218, 221
+ 20, 22, 23, 28, 33, 38, 40, 42, 50, 61,
+ 70, 82, 95, 97, 101, 105, 108, 112, 114, 115,
+ 116, 119, 122, 124, 126, 128, 132, 136, 140, 144,
+ 148, 152, 156, 160, 164, 167, 170, 174, 177, 180,
+ 183, 185, 188, 191, 194, 197, 201, 204, 208, 211,
+ 214, 216, 220, 223, 227, 228, 234, 235, 237, 241
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 48, 0, -1, 49, 42, 48, -1, 49, -1, -1,
- 59, -1, 50, -1, 51, -1, 58, -1, 1, -1,
- -1, 23, 58, 15, 7, -1, 25, 7, 36, 58,
- -1, 25, 7, 27, 58, -1, 58, -1, 59, -1,
- 55, 52, 26, 57, 56, 11, 14, -1, 55, 52,
- 26, 57, 56, 10, 57, 56, 11, 14, -1, 53,
- 43, 52, 44, 57, 56, 11, 24, -1, 54, 36,
- 58, 56, 27, 58, 56, 57, 56, 11, 24, -1,
- 54, 36, 58, 56, 9, 27, 58, 56, 57, 56,
- 11, 24, -1, 58, -1, 58, 36, 58, -1, 43,
- 52, 44, -1, 24, 29, -1, 24, 28, 7, -1,
- 14, -1, -1, -1, 57, 42, -1, 57, 51, -1,
- 5, -1, 7, -1, 50, -1, 58, 37, 58, -1,
- 58, 38, 58, -1, 58, 39, 58, -1, 58, 40,
- 58, -1, 58, 45, 58, -1, 58, 46, 58, -1,
- 58, 35, 58, -1, 58, 30, 58, -1, 58, 31,
- 58, -1, 37, 58, -1, 38, 58, -1, 43, 58,
- 44, -1, 17, 8, -1, 18, 7, -1, 23, 58,
- -1, 60, -1, 13, 16, -1, 13, 20, -1, 13,
- 22, -1, 13, 61, -1, 13, 61, 62, -1, 13,
- 62, -1, 27, 12, 8, -1, 12, 8, -1, 27,
- 8, -1, 8, -1, 21, 19, 8, -1, 19, 8,
- -1, 27, 19, 8, -1
+ 50, 0, -1, 51, 43, 50, -1, 51, -1, -1,
+ 65, -1, 61, -1, 52, -1, 53, -1, 60, -1,
+ 1, -1, -1, 24, 60, 15, 7, -1, 26, 7,
+ 37, 60, -1, 26, 7, 28, 60, -1, 60, -1,
+ 61, -1, 57, 54, 27, 59, 58, 11, 14, -1,
+ 57, 54, 27, 59, 58, 10, 59, 58, 11, 14,
+ -1, 55, 44, 54, 45, 59, 58, 11, 25, -1,
+ 56, 37, 60, 58, 28, 60, 58, 59, 58, 11,
+ 25, -1, 56, 37, 60, 58, 9, 28, 60, 58,
+ 59, 58, 11, 25, -1, 60, -1, 60, 37, 60,
+ -1, 44, 54, 45, -1, 25, 30, -1, 25, 29,
+ 7, -1, 14, -1, -1, -1, 59, 43, -1, 59,
+ 53, -1, 5, -1, 7, -1, 52, -1, 60, 38,
+ 60, -1, 60, 39, 60, -1, 60, 40, 60, -1,
+ 60, 41, 60, -1, 60, 46, 60, -1, 60, 47,
+ 60, -1, 60, 36, 60, -1, 60, 31, 60, -1,
+ 60, 32, 60, -1, 38, 60, -1, 39, 60, -1,
+ 44, 60, 45, -1, 18, 8, -1, 19, 7, -1,
+ 24, 60, -1, 62, -1, 13, 16, -1, 13, 21,
+ -1, 13, 23, -1, 13, 63, -1, 13, 63, 64,
+ -1, 13, 64, -1, 28, 12, 8, -1, 12, 8,
+ -1, 28, 8, -1, 8, -1, 22, 20, 8, -1,
+ 20, 8, -1, 28, 20, 8, -1, -1, 17, 7,
+ 66, 67, 59, -1, -1, 7, -1, 67, 48, 7,
+ -1, 67, 48, 43, 7, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const yytype_uint8 yyrline[] =
+static const yytype_uint16 yyrline[] =
{
- 0, 90, 90, 91, 94, 95, 96, 97, 98, 99,
- 100, 103, 104, 105, 108, 109, 110, 116, 128, 139,
- 155, 169, 170, 171, 173, 175, 181, 183, 185, 186,
- 187, 190, 191, 192, 193, 194, 195, 196, 197, 198,
- 199, 200, 201, 202, 203, 204, 207, 208, 209, 210,
- 221, 222, 223, 224, 225, 226, 229, 230, 231, 232,
- 235, 236, 237
+ 0, 92, 92, 93, 96, 97, 98, 99, 100, 101,
+ 102, 103, 106, 107, 108, 111, 112, 113, 119, 131,
+ 142, 158, 172, 173, 174, 176, 178, 184, 186, 188,
+ 189, 190, 193, 194, 195, 196, 197, 198, 199, 200,
+ 201, 202, 203, 204, 205, 206, 207, 210, 211, 212,
+ 213, 224, 225, 226, 227, 228, 229, 232, 233, 234,
+ 235, 238, 239, 240, 268, 268, 271, 272, 273, 274
};
#endif
@@ -528,12 +533,13 @@ static const char *const yytname[] =
{
"$end", "error", "$undefined", "UNARY", "VOID", "INT", "FLOAT", "VAR",
"STRING", "tDOWN", "tELSE", "tEND", "tFRAME", "tGO", "tIF", "tINTO",
- "tLOOP", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS",
- "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tGE",
- "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'",
- "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "$accept", "program",
- "programline", "asgn", "stmt", "cond", "repeatwhile", "repeatwith", "if",
- "end", "stmtlist", "expr", "func", "gotofunc", "gotoframe", "gotomovie", 0
+ "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF",
+ "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH",
+ "tWHILE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'",
+ "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "','",
+ "$accept", "program", "programline", "asgn", "stmt", "cond",
+ "repeatwhile", "repeatwith", "if", "end", "stmtlist", "expr", "func",
+ "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "arglist", 0
};
#endif
@@ -545,33 +551,33 @@ static const yytype_uint16 yytoknum[] =
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 287, 288, 289, 290, 61, 43, 45, 42,
- 47, 37, 10, 40, 41, 62, 60
+ 285, 286, 287, 288, 289, 290, 291, 61, 43, 45,
+ 42, 47, 37, 10, 40, 41, 62, 60, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 47, 48, 48, 49, 49, 49, 49, 49, 49,
- 49, 50, 50, 50, 51, 51, 51, 51, 51, 51,
- 51, 52, 52, 52, 53, 54, 55, 56, 57, 57,
- 57, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 59, 59, 59, 59,
- 60, 60, 60, 60, 60, 60, 61, 61, 61, 61,
- 62, 62, 62
+ 0, 49, 50, 50, 51, 51, 51, 51, 51, 51,
+ 51, 51, 52, 52, 52, 53, 53, 53, 53, 53,
+ 53, 53, 54, 54, 54, 55, 56, 57, 58, 59,
+ 59, 59, 60, 60, 60, 60, 60, 60, 60, 60,
+ 60, 60, 60, 60, 60, 60, 60, 61, 61, 61,
+ 61, 62, 62, 62, 62, 62, 62, 63, 63, 63,
+ 63, 64, 64, 64, 66, 65, 67, 67, 67, 67
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 0, 4, 4, 4, 1, 1, 7, 10, 8, 11,
- 12, 1, 3, 3, 2, 3, 1, 0, 0, 2,
- 2, 1, 1, 1, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 2, 2, 3, 2, 2, 2, 1,
- 2, 2, 2, 2, 3, 2, 3, 2, 2, 1,
- 3, 2, 3
+ 1, 0, 4, 4, 4, 1, 1, 7, 10, 8,
+ 11, 12, 1, 3, 3, 2, 3, 1, 0, 0,
+ 2, 2, 1, 1, 1, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 2, 2, 3, 2, 2, 2,
+ 1, 2, 2, 2, 2, 3, 2, 3, 2, 2,
+ 1, 3, 2, 3, 0, 5, 0, 1, 3, 4
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -579,134 +585,137 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 9, 31, 32, 0, 26, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 3, 33, 7, 0, 0,
- 0, 8, 5, 49, 59, 0, 50, 0, 51, 0,
- 52, 0, 53, 55, 46, 47, 0, 33, 48, 0,
- 24, 0, 43, 44, 0, 1, 0, 0, 0, 0,
- 0, 21, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 57, 61, 0, 58, 0, 0, 0, 54, 0,
- 0, 25, 0, 0, 45, 2, 0, 27, 0, 0,
- 28, 0, 41, 42, 40, 34, 35, 36, 37, 38,
- 39, 60, 56, 62, 11, 13, 12, 28, 0, 23,
- 27, 22, 27, 0, 0, 29, 30, 0, 14, 15,
- 0, 0, 27, 28, 0, 0, 27, 28, 27, 16,
- 18, 28, 27, 0, 27, 0, 0, 0, 0, 17,
- 0, 19, 20
+ 0, 10, 32, 33, 0, 27, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 3, 34, 8, 0,
+ 0, 0, 9, 6, 50, 5, 60, 0, 51, 0,
+ 52, 0, 53, 0, 54, 56, 64, 47, 48, 0,
+ 34, 49, 0, 25, 0, 44, 45, 0, 1, 0,
+ 0, 0, 0, 0, 22, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 58, 62, 0, 59, 0, 0,
+ 0, 55, 66, 0, 0, 26, 0, 0, 46, 2,
+ 0, 28, 0, 0, 29, 0, 42, 43, 41, 35,
+ 36, 37, 38, 39, 40, 61, 57, 63, 67, 29,
+ 12, 14, 13, 29, 0, 24, 28, 23, 0, 65,
+ 28, 0, 0, 30, 31, 0, 15, 16, 68, 0,
+ 0, 0, 28, 29, 0, 69, 0, 28, 29, 28,
+ 17, 19, 29, 28, 0, 28, 0, 0, 0, 0,
+ 18, 0, 20, 21
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 14, 15, 37, 106, 50, 18, 19, 20, 98,
- 100, 108, 109, 23, 32, 33
+ -1, 15, 16, 40, 114, 53, 19, 20, 21, 104,
+ 106, 116, 117, 24, 34, 35, 25, 72, 99
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -96
+#define YYPACT_NINF -93
static const yytype_int16 yypact[] =
{
- 70, -96, -96, -96, 141, -96, 8, 12, 2, 6,
- 17, 2, 2, 2, 38, -1, 1, -96, 19, 29,
- 95, 170, -96, -96, -96, 34, -96, 36, -96, 47,
- -96, -2, 10, -96, -96, -96, 2, -96, 106, 60,
- -96, -13, 33, 33, 146, -96, 70, 95, 2, 95,
- 43, 158, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, -96, -96, 72, -96, 74, 77, 82, -96, 106,
- 84, -96, 2, 2, -96, -96, 45, 170, 59, 134,
- -96, 2, 170, 170, 170, 182, 182, 33, 33, 170,
- 170, -96, -96, -96, -96, 170, 170, -96, -6, -96,
- 92, 170, 92, 87, 2, -96, -96, 22, 170, -96,
- 108, 2, 170, -96, 109, 98, 170, -96, 92, -96,
- -96, -96, 92, 113, 92, 114, 112, 116, 104, -96,
- 107, -96, -96
+ 65, -93, -93, -93, 138, -93, -1, 27, 30, 3,
+ 44, 36, 3, 3, 3, 45, 25, 1, -93, 2,
+ 11, 91, 167, -93, -93, -93, -93, 63, -93, 72,
+ -93, 61, -93, 8, 47, -93, -93, -93, -93, 3,
+ -93, 101, 80, -93, -11, -13, -13, 143, -93, 65,
+ 91, 3, 91, 66, 155, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, -93, -93, 84, -93, 89, 93,
+ 82, -93, 103, 101, 104, -93, 3, 3, -93, -93,
+ 68, 167, 69, 131, -93, 3, 167, 167, 167, 179,
+ 179, -13, -13, 167, 167, -93, -93, -93, -93, 70,
+ -93, 167, 167, -93, -6, -93, 81, 167, -5, 81,
+ 81, 95, 3, -93, -93, 14, 167, -93, -93, 120,
+ 117, 3, 167, -93, 122, -93, 106, 167, -93, 81,
+ -93, -93, -93, 81, 123, 81, 133, 139, 141, 130,
+ -93, 132, -93, -93
};
/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int8 yypgoto[] =
+static const yytype_int16 yypgoto[] =
{
- -96, 93, -96, 4, 5, -19, -96, -96, -96, -26,
- -95, 0, 15, -96, -96, 110
+ -93, 107, -93, 4, 5, -20, -93, -93, -93, 16,
+ -92, 0, 15, -93, -93, 146, -93, -93, -93
};
/* 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 -7
+#define YYTABLE_NINF -8
static const yytype_int16 yytable[] =
{
- 21, -6, 102, 103, 16, 17, 64, 2, 38, 3,
- 65, 42, 43, 44, 72, 22, 34, 66, 118, 35,
- 51, 104, 122, 73, 41, 36, 124, 10, 76, 27,
- 78, 29, 113, 114, 39, 40, 69, 67, 45, 11,
- 12, 46, 61, -6, 62, 13, 21, 51, 77, 79,
- 16, 17, 82, 83, 84, 85, 86, 87, 88, 89,
- 90, 22, 47, 52, 53, 48, 63, 71, 54, 80,
- -4, 1, 95, 96, 107, 2, 110, 3, 59, 60,
- 91, 101, 92, 4, 5, 93, 117, 6, 7, 97,
- 121, 94, 123, 8, 9, 10, 125, 2, 127, 3,
- 2, 66, 3, 99, 112, 4, 5, 11, 12, 6,
- 7, 116, -4, 13, 111, 8, 9, 10, 36, 115,
- 10, 70, 120, 119, 126, 128, 129, 130, 131, 11,
- 12, 132, 11, 12, 105, 13, 52, 53, 49, 75,
- 0, 54, 68, 55, 56, 57, 58, 0, 0, 24,
- 0, 59, 60, 25, 0, 0, 0, 26, 0, 0,
- 27, 28, 29, 30, 52, 53, 0, 0, 31, 54,
- 81, 55, 56, 57, 58, 0, 52, 53, 74, 59,
- 60, 54, 0, 55, 56, 57, 58, 0, 52, 53,
- 74, 59, 60, 54, 81, 55, 56, 57, 58, 0,
- 52, 53, 0, 59, 60, 54, 0, 55, 56, 57,
- 58, 0, 52, 53, 0, 59, 60, 54, 0, 0,
- 0, 57, 58, 0, 0, 0, 0, 59, 60
+ 22, -7, 118, 111, 17, 18, 36, 109, 2, 41,
+ 3, 110, 45, 46, 47, 23, 67, 76, 55, 56,
+ 68, 54, 112, 57, 123, 124, 77, 39, 69, 11,
+ 80, 129, 82, 62, 63, 37, 133, 38, 119, 73,
+ 135, 12, 13, 44, -7, 48, 50, 14, 51, 22,
+ 54, 81, 83, 17, 18, 86, 87, 88, 89, 90,
+ 91, 92, 93, 94, 23, -4, 1, 29, 49, 31,
+ 2, 64, 3, 42, 43, 70, 101, 102, 4, 5,
+ 65, 66, 6, 7, 8, 107, 2, 75, 3, 9,
+ 10, 11, 95, 84, 4, 5, 2, 96, 3, 7,
+ 8, 97, 69, 12, 13, 9, 10, 11, -4, 14,
+ 98, 100, 122, 103, 105, 39, 74, 11, 108, 12,
+ 13, 127, 115, 121, 113, 14, 120, 125, 126, 12,
+ 13, 131, 55, 56, 137, 52, 130, 57, 128, 58,
+ 59, 60, 61, 132, 139, 134, 26, 62, 63, 136,
+ 27, 138, 141, 140, 28, 142, 79, 143, 29, 30,
+ 31, 32, 55, 56, 0, 0, 33, 57, 85, 58,
+ 59, 60, 61, 0, 55, 56, 78, 62, 63, 57,
+ 71, 58, 59, 60, 61, 0, 55, 56, 78, 62,
+ 63, 57, 85, 58, 59, 60, 61, 0, 55, 56,
+ 0, 62, 63, 57, 0, 58, 59, 60, 61, 0,
+ 55, 56, 0, 62, 63, 57, 0, 0, 0, 60,
+ 61, 0, 0, 0, 0, 62, 63
};
-static const yytype_int8 yycheck[] =
+static const yytype_int16 yycheck[] =
{
- 0, 0, 97, 9, 0, 0, 8, 5, 8, 7,
- 12, 11, 12, 13, 27, 0, 8, 19, 113, 7,
- 20, 27, 117, 36, 7, 23, 121, 25, 47, 19,
- 49, 21, 10, 11, 28, 29, 36, 27, 0, 37,
- 38, 42, 8, 42, 8, 43, 46, 47, 48, 49,
- 46, 46, 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 46, 43, 30, 31, 36, 19, 7, 35, 26,
- 0, 1, 72, 73, 100, 5, 102, 7, 45, 46,
- 8, 81, 8, 13, 14, 8, 112, 17, 18, 44,
- 116, 7, 118, 23, 24, 25, 122, 5, 124, 7,
- 5, 19, 7, 44, 104, 13, 14, 37, 38, 17,
- 18, 111, 42, 43, 27, 23, 24, 25, 23, 11,
- 25, 15, 24, 14, 11, 11, 14, 11, 24, 37,
- 38, 24, 37, 38, 42, 43, 30, 31, 43, 46,
- -1, 35, 32, 37, 38, 39, 40, -1, -1, 8,
- -1, 45, 46, 12, -1, -1, -1, 16, -1, -1,
- 19, 20, 21, 22, 30, 31, -1, -1, 27, 35,
- 36, 37, 38, 39, 40, -1, 30, 31, 44, 45,
- 46, 35, -1, 37, 38, 39, 40, -1, 30, 31,
- 44, 45, 46, 35, 36, 37, 38, 39, 40, -1,
- 30, 31, -1, 45, 46, 35, -1, 37, 38, 39,
- 40, -1, 30, 31, -1, 45, 46, 35, -1, -1,
- -1, 39, 40, -1, -1, -1, -1, 45, 46
+ 0, 0, 7, 9, 0, 0, 7, 99, 5, 9,
+ 7, 103, 12, 13, 14, 0, 8, 28, 31, 32,
+ 12, 21, 28, 36, 10, 11, 37, 24, 20, 26,
+ 50, 123, 52, 46, 47, 8, 128, 7, 43, 39,
+ 132, 38, 39, 7, 43, 0, 44, 44, 37, 49,
+ 50, 51, 52, 49, 49, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 49, 0, 1, 20, 43, 22,
+ 5, 8, 7, 29, 30, 28, 76, 77, 13, 14,
+ 8, 20, 17, 18, 19, 85, 5, 7, 7, 24,
+ 25, 26, 8, 27, 13, 14, 5, 8, 7, 18,
+ 19, 8, 20, 38, 39, 24, 25, 26, 43, 44,
+ 7, 7, 112, 45, 45, 24, 15, 26, 48, 38,
+ 39, 121, 106, 28, 43, 44, 110, 7, 11, 38,
+ 39, 25, 31, 32, 11, 44, 14, 36, 122, 38,
+ 39, 40, 41, 127, 11, 129, 8, 46, 47, 133,
+ 12, 135, 11, 14, 16, 25, 49, 25, 20, 21,
+ 22, 23, 31, 32, -1, -1, 28, 36, 37, 38,
+ 39, 40, 41, -1, 31, 32, 45, 46, 47, 36,
+ 34, 38, 39, 40, 41, -1, 31, 32, 45, 46,
+ 47, 36, 37, 38, 39, 40, 41, -1, 31, 32,
+ -1, 46, 47, 36, -1, 38, 39, 40, 41, -1,
+ 31, 32, -1, 46, 47, 36, -1, -1, -1, 40,
+ 41, -1, -1, -1, -1, 46, 47
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 5, 7, 13, 14, 17, 18, 23, 24,
- 25, 37, 38, 43, 48, 49, 50, 51, 53, 54,
- 55, 58, 59, 60, 8, 12, 16, 19, 20, 21,
- 22, 27, 61, 62, 8, 7, 23, 50, 58, 28,
- 29, 7, 58, 58, 58, 0, 42, 43, 36, 43,
- 52, 58, 30, 31, 35, 37, 38, 39, 40, 45,
- 46, 8, 8, 19, 8, 12, 19, 27, 62, 58,
- 15, 7, 27, 36, 44, 48, 52, 58, 52, 58,
- 26, 36, 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 8, 8, 8, 7, 58, 58, 44, 56, 44,
- 57, 58, 57, 9, 27, 42, 51, 56, 58, 59,
- 56, 27, 58, 10, 11, 11, 58, 56, 57, 14,
- 24, 56, 57, 56, 57, 56, 11, 56, 11, 14,
- 11, 24, 24
+ 0, 1, 5, 7, 13, 14, 17, 18, 19, 24,
+ 25, 26, 38, 39, 44, 50, 51, 52, 53, 55,
+ 56, 57, 60, 61, 62, 65, 8, 12, 16, 20,
+ 21, 22, 23, 28, 63, 64, 7, 8, 7, 24,
+ 52, 60, 29, 30, 7, 60, 60, 60, 0, 43,
+ 44, 37, 44, 54, 60, 31, 32, 36, 38, 39,
+ 40, 41, 46, 47, 8, 8, 20, 8, 12, 20,
+ 28, 64, 66, 60, 15, 7, 28, 37, 45, 50,
+ 54, 60, 54, 60, 27, 37, 60, 60, 60, 60,
+ 60, 60, 60, 60, 60, 8, 8, 8, 7, 67,
+ 7, 60, 60, 45, 58, 45, 59, 60, 48, 59,
+ 59, 9, 28, 43, 53, 58, 60, 61, 7, 43,
+ 58, 28, 60, 10, 11, 7, 11, 60, 58, 59,
+ 14, 25, 58, 59, 58, 59, 58, 11, 58, 11,
+ 14, 11, 25, 25
};
#define yyerrok (yyerrstatus = 0)
@@ -1520,43 +1529,43 @@ yyreduce:
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
- case 6:
-#line 96 "engines/director/lingo/lingo-gr.y"
+ case 7:
+#line 99 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 8:
-#line 98 "engines/director/lingo/lingo-gr.y"
+ case 9:
+#line 101 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 9:
-#line 99 "engines/director/lingo/lingo-gr.y"
+ case 10:
+#line 102 "engines/director/lingo/lingo-gr.y"
{ yyerrok; ;}
break;
- case 11:
-#line 103 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->c_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
- break;
-
case 12:
-#line 104 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->c_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
+#line 106 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->c_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
break;
case 13:
-#line 105 "engines/director/lingo/lingo-gr.y"
+#line 107 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->c_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
break;
case 14:
#line 108 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->c_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
+ break;
+
+ case 15:
+#line 111 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 16:
-#line 110 "engines/director/lingo/lingo-gr.y"
+ case 17:
+#line 113 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_LE_UINT32(&then, (yyvsp[(4) - (7)].code));
@@ -1565,8 +1574,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; ;}
break;
- case 17:
-#line 116 "engines/director/lingo/lingo-gr.y"
+ case 18:
+#line 119 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_LE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1577,8 +1586,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
break;
- case 18:
-#line 128 "engines/director/lingo/lingo-gr.y"
+ case 19:
+#line 131 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_LE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1587,8 +1596,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
- case 19:
-#line 139 "engines/director/lingo/lingo-gr.y"
+ case 20:
+#line 142 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_LE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1603,8 +1612,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
break;
- case 20:
-#line 155 "engines/director/lingo/lingo-gr.y"
+ case 21:
+#line 158 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_LE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1619,23 +1628,23 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
break;
- case 21:
-#line 169 "engines/director/lingo/lingo-gr.y"
+ case 22:
+#line 172 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 22:
-#line 170 "engines/director/lingo/lingo-gr.y"
+ case 23:
+#line 173 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 24:
-#line 173 "engines/director/lingo/lingo-gr.y"
+ case 25:
+#line 176 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 25:
-#line 175 "engines/director/lingo/lingo-gr.y"
+ case 26:
+#line 178 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1643,174 +1652,204 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 26:
-#line 181 "engines/director/lingo/lingo-gr.y"
+ case 27:
+#line 184 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
- case 27:
-#line 183 "engines/director/lingo/lingo-gr.y"
+ case 28:
+#line 186 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 28:
-#line 185 "engines/director/lingo/lingo-gr.y"
+ case 29:
+#line 188 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 31:
-#line 190 "engines/director/lingo/lingo-gr.y"
+ case 32:
+#line 193 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_constpush); inst i = 0; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); g_lingo->code1(i); ;}
break;
- case 32:
-#line 191 "engines/director/lingo/lingo-gr.y"
+ case 33:
+#line 194 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
- case 34:
-#line 193 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_add); ;}
- break;
-
case 35:
-#line 194 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_sub); ;}
+#line 196 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_add); ;}
break;
case 36:
-#line 195 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_mul); ;}
+#line 197 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_sub); ;}
break;
case 37:
-#line 196 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_div); ;}
+#line 198 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_mul); ;}
break;
case 38:
-#line 197 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gt); ;}
+#line 199 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_div); ;}
break;
case 39:
-#line 198 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_lt); ;}
+#line 200 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gt); ;}
break;
case 40:
-#line 199 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_neq); ;}
+#line 201 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_lt); ;}
break;
case 41:
-#line 200 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_ge); ;}
+#line 202 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_neq); ;}
break;
case 42:
-#line 201 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_le); ;}
+#line 203 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_ge); ;}
break;
case 43:
-#line 202 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+#line 204 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_le); ;}
break;
case 44:
-#line 203 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
+#line 205 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 45:
-#line 204 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+#line 206 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 46:
#line 207 "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); ;}
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 47:
-#line 208 "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); ;}
+#line 210 "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 48:
-#line 209 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_printtop); ;}
+#line 211 "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 50:
-#line 221 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoloop); ;}
+ case 49:
+#line 212 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 51:
-#line 222 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotonext); ;}
+#line 224 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 52:
-#line 223 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoprevious); ;}
+#line 225 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 53:
-#line 224 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
+#line 226 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 54:
-#line 225 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
+#line 227 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
break;
case 55:
-#line 226 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+#line 228 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
break;
case 56:
#line 229 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 57:
-#line 230 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+#line 232 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 58:
-#line 231 "engines/director/lingo/lingo-gr.y"
+#line 233 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 59:
-#line 232 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+#line 234 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 60:
#line 235 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 61:
-#line 236 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+#line 238 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 62:
-#line 237 "engines/director/lingo/lingo-gr.y"
+#line 239 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ break;
+
+ case 63:
+#line 240 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
+ case 64:
+#line 268 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->_indef = true; ;}
+ break;
+
+ case 65:
+#line 269 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_procret); g_lingo->define(*(yyvsp[(2) - (5)].s), (yyvsp[(4) - (5)].narg)); g_lingo->_indef = false; ;}
+ break;
+
+ case 66:
+#line 271 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = 0; ;}
+ break;
+
+ case 67:
+#line 272 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = 1; ;}
+ break;
+
+ case 68:
+#line 273 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
+ break;
+
+ case 69:
+#line 274 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
+ break;
+
/* Line 1267 of yacc.c. */
-#line 1814 "engines/director/lingo/lingo-gr.cpp"
+#line 1853 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2024,6 +2063,6 @@ yyreturn:
}
-#line 267 "engines/director/lingo/lingo-gr.y"
+#line 278 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 732f084..6982cf1 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -53,25 +53,26 @@
tIF = 269,
tINTO = 270,
tLOOP = 271,
- tMCI = 272,
- tMCIWAIT = 273,
- tMOVIE = 274,
- tNEXT = 275,
- tOF = 276,
- tPREVIOUS = 277,
- tPUT = 278,
- tREPEAT = 279,
- tSET = 280,
- tTHEN = 281,
- tTO = 282,
- tWITH = 283,
- tWHILE = 284,
- tGE = 285,
- tLE = 286,
- tGT = 287,
- tLT = 288,
- tEQ = 289,
- tNEQ = 290
+ tMACRO = 272,
+ tMCI = 273,
+ tMCIWAIT = 274,
+ tMOVIE = 275,
+ tNEXT = 276,
+ tOF = 277,
+ tPREVIOUS = 278,
+ tPUT = 279,
+ tREPEAT = 280,
+ tSET = 281,
+ tTHEN = 282,
+ tTO = 283,
+ tWITH = 284,
+ tWHILE = 285,
+ tGE = 286,
+ tLE = 287,
+ tGT = 288,
+ tLT = 289,
+ tEQ = 290,
+ tNEQ = 291
};
#endif
/* Tokens. */
@@ -89,25 +90,26 @@
#define tIF 269
#define tINTO 270
#define tLOOP 271
-#define tMCI 272
-#define tMCIWAIT 273
-#define tMOVIE 274
-#define tNEXT 275
-#define tOF 276
-#define tPREVIOUS 277
-#define tPUT 278
-#define tREPEAT 279
-#define tSET 280
-#define tTHEN 281
-#define tTO 282
-#define tWITH 283
-#define tWHILE 284
-#define tGE 285
-#define tLE 286
-#define tGT 287
-#define tLT 288
-#define tEQ 289
-#define tNEQ 290
+#define tMACRO 272
+#define tMCI 273
+#define tMCIWAIT 274
+#define tMOVIE 275
+#define tNEXT 276
+#define tOF 277
+#define tPREVIOUS 278
+#define tPUT 279
+#define tREPEAT 280
+#define tSET 281
+#define tTHEN 282
+#define tTO 283
+#define tWITH 284
+#define tWHILE 285
+#define tGE 286
+#define tLE 287
+#define tGT 288
+#define tLT 289
+#define tEQ 290
+#define tNEQ 291
@@ -120,9 +122,10 @@ typedef union YYSTYPE
int i;
float f;
int code;
+ int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 126 "engines/director/lingo/lingo-gr.hpp"
+#line 129 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 8e3c14f..defb98d 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -67,18 +67,20 @@ using namespace Director;
int i;
float f;
int code;
+ int narg; /* number of arguments */
}
%token UNARY VOID
%token<i> INT
%token<f> FLOAT
%token<s> VAR STRING
-%token tDOWN tELSE tEND tFRAME tGO tIF tINTO tLOOP tMCI tMCIWAIT tMOVIE tNEXT
+%token tDOWN tELSE tEND tFRAME tGO tIF tINTO tLOOP tMACRO tMCI tMCIWAIT tMOVIE tNEXT
%token tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO tWITH tWHILE
%token tGE tLE tGT tLT tEQ tNEQ
%type<code> asgn cond end expr if repeatwhile repeatwith stmtlist
%type<s> gotoframe gotomovie
+%type<narg> arglist
%right '='
%left '+' '-'
@@ -92,6 +94,7 @@ program: programline '\n' program
;
programline:
+ | defn
| func
| asgn { g_lingo->code1(g_lingo->c_xpop); }
| stmt
@@ -262,6 +265,14 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
//
// See also:
// on keyword
+defn: tMACRO VAR { g_lingo->_indef = true; }
+ arglist stmtlist { g_lingo->code1(g_lingo->c_procret); g_lingo->define(*$2, $4); g_lingo->_indef = false; }
+ ;
+arglist: /* nothing */ { $$ = 0; }
+ | VAR { $$ = 1; }
+ | arglist ',' VAR { $$ = $1 + 1; }
+ | arglist ',' '\n' VAR { $$ = $1 + 1; }
+ ;
%%
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index bbaf7dc..672109a 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 34
-#define YY_END_OF_BUFFER 35
+#define YY_NUM_RULES 35
+#define YY_END_OF_BUFFER 36
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,20 +373,20 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[106] =
+static yyconst flex_int16_t yy_accept[111] =
{ 0,
- 0, 0, 35, 34, 3, 32, 34, 34, 31, 31,
- 30, 31, 31, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28, 2, 2,
- 3, 32, 25, 0, 33, 1, 29, 30, 27, 26,
- 28, 28, 28, 28, 28, 9, 5, 28, 28, 28,
- 28, 28, 16, 28, 28, 28, 28, 28, 22, 28,
- 28, 1, 29, 28, 28, 7, 28, 28, 28, 12,
- 28, 28, 28, 18, 28, 20, 28, 28, 28, 4,
- 6, 28, 10, 11, 28, 28, 15, 28, 28, 21,
- 28, 23, 8, 28, 14, 28, 28, 24, 28, 28,
-
- 19, 13, 28, 17, 0
+ 0, 0, 36, 35, 3, 33, 35, 35, 32, 32,
+ 31, 32, 32, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29, 2, 2,
+ 3, 33, 26, 0, 34, 1, 30, 31, 28, 27,
+ 29, 29, 29, 29, 29, 10, 6, 29, 29, 29,
+ 29, 29, 17, 29, 29, 29, 29, 29, 23, 29,
+ 29, 1, 1, 30, 29, 29, 8, 29, 29, 29,
+ 13, 29, 29, 29, 19, 29, 21, 29, 29, 29,
+ 1, 5, 7, 29, 11, 12, 29, 29, 16, 29,
+ 29, 22, 29, 24, 1, 9, 29, 15, 29, 29,
+
+ 25, 1, 29, 29, 20, 1, 14, 29, 18, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -429,78 +429,84 @@ static yyconst flex_int32_t yy_meta[36] =
4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[109] =
+static yyconst flex_int16_t yy_base[114] =
{ 0,
- 0, 34, 124, 125, 121, 34, 109, 114, 125, 111,
- 30, 106, 105, 0, 90, 18, 87, 88, 23, 87,
- 28, 94, 92, 18, 92, 91, 24, 30, 107, 125,
- 106, 53, 125, 100, 125, 0, 95, 48, 125, 125,
- 0, 71, 74, 85, 86, 0, 0, 70, 73, 76,
- 65, 62, 0, 77, 64, 66, 62, 73, 0, 68,
- 59, 0, 78, 62, 68, 0, 61, 58, 56, 49,
- 59, 50, 47, 0, 60, 0, 52, 53, 54, 0,
- 0, 56, 0, 0, 58, 54, 0, 49, 55, 0,
- 51, 0, 0, 46, 0, 41, 35, 0, 34, 29,
-
- 0, 0, 24, 0, 125, 59, 44, 63
+ 0, 34, 135, 136, 132, 34, 120, 125, 136, 122,
+ 30, 117, 116, 0, 101, 18, 98, 99, 23, 98,
+ 28, 105, 103, 18, 103, 102, 24, 30, 118, 136,
+ 117, 53, 136, 111, 136, 92, 105, 48, 136, 136,
+ 0, 81, 84, 95, 96, 0, 0, 80, 83, 86,
+ 75, 72, 0, 87, 74, 76, 72, 83, 0, 78,
+ 69, 74, 38, 87, 71, 77, 0, 70, 67, 65,
+ 58, 68, 59, 56, 0, 69, 0, 61, 62, 63,
+ 43, 0, 0, 65, 0, 0, 67, 63, 0, 58,
+ 64, 0, 60, 0, 36, 0, 55, 0, 50, 44,
+
+ 0, 37, 43, 38, 0, 42, 0, 36, 0, 136,
+ 68, 44, 72
} ;
-static yyconst flex_int16_t yy_def[109] =
+static yyconst flex_int16_t yy_def[114] =
{ 0,
- 105, 1, 105, 105, 105, 105, 105, 106, 105, 105,
- 105, 105, 105, 107, 107, 107, 107, 107, 107, 107,
- 107, 107, 107, 107, 107, 107, 107, 107, 105, 105,
- 105, 105, 105, 106, 105, 108, 105, 105, 105, 105,
- 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
- 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
- 107, 108, 105, 107, 107, 107, 107, 107, 107, 107,
- 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
- 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
- 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
-
- 107, 107, 107, 107, 0, 105, 105, 105
+ 110, 1, 110, 110, 110, 110, 110, 111, 110, 110,
+ 110, 110, 110, 112, 112, 112, 112, 112, 112, 112,
+ 112, 112, 112, 112, 112, 112, 112, 112, 110, 110,
+ 110, 110, 110, 111, 110, 113, 110, 110, 110, 110,
+ 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
+ 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
+ 112, 113, 113, 110, 112, 112, 112, 112, 112, 112,
+ 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
+ 113, 112, 112, 112, 112, 112, 112, 112, 112, 112,
+ 112, 112, 112, 112, 113, 112, 112, 112, 112, 112,
+
+ 112, 113, 112, 112, 112, 113, 112, 112, 112, 0,
+ 110, 110, 110
} ;
-static yyconst flex_int16_t yy_nxt[161] =
+static yyconst flex_int16_t yy_nxt[172] =
{ 0,
4, 5, 6, 6, 4, 7, 8, 9, 10, 4,
11, 12, 9, 13, 14, 14, 14, 15, 16, 17,
18, 14, 19, 20, 21, 22, 23, 24, 25, 26,
27, 14, 14, 28, 14, 29, 32, 32, 30, 37,
38, 43, 47, 44, 50, 58, 54, 41, 48, 55,
- 59, 60, 61, 104, 51, 32, 32, 37, 38, 34,
- 103, 34, 34, 62, 102, 101, 62, 100, 99, 98,
- 97, 96, 95, 94, 93, 92, 91, 90, 89, 88,
- 87, 86, 85, 84, 83, 82, 81, 80, 63, 79,
- 78, 77, 76, 75, 74, 73, 72, 71, 70, 69,
-
- 68, 67, 66, 65, 64, 63, 35, 31, 31, 57,
- 56, 53, 52, 49, 46, 45, 42, 40, 39, 36,
- 35, 33, 31, 105, 3, 105, 105, 105, 105, 105,
- 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
- 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
- 105, 105, 105, 105, 105, 105, 105, 105, 105, 105
+ 59, 60, 61, 81, 51, 32, 32, 37, 38, 95,
+ 63, 63, 63, 106, 102, 109, 63, 63, 34, 108,
+ 34, 34, 62, 107, 105, 62, 104, 103, 101, 100,
+ 99, 98, 97, 96, 94, 93, 92, 91, 90, 89,
+ 88, 87, 86, 85, 84, 83, 82, 64, 63, 80,
+
+ 79, 78, 77, 76, 75, 74, 73, 72, 71, 70,
+ 69, 68, 67, 66, 65, 64, 63, 35, 31, 31,
+ 57, 56, 53, 52, 49, 46, 45, 42, 40, 39,
+ 36, 35, 33, 31, 110, 3, 110, 110, 110, 110,
+ 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
+ 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
+ 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
+ 110
} ;
-static yyconst flex_int16_t yy_chk[161] =
+static yyconst flex_int16_t yy_chk[172] =
{ 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, 2, 6, 6, 2, 11,
- 11, 16, 19, 16, 21, 27, 24, 107, 19, 24,
- 27, 28, 28, 103, 21, 32, 32, 38, 38, 106,
- 100, 106, 106, 108, 99, 97, 108, 96, 94, 91,
- 89, 88, 86, 85, 82, 79, 78, 77, 75, 73,
- 72, 71, 70, 69, 68, 67, 65, 64, 63, 61,
- 60, 58, 57, 56, 55, 54, 52, 51, 50, 49,
+ 11, 16, 19, 16, 21, 27, 24, 112, 19, 24,
+ 27, 28, 28, 63, 21, 32, 32, 38, 38, 81,
+ 95, 102, 63, 102, 95, 108, 106, 81, 111, 104,
+ 111, 111, 113, 103, 100, 113, 99, 97, 93, 91,
+ 90, 88, 87, 84, 80, 79, 78, 76, 74, 73,
+ 72, 71, 70, 69, 68, 66, 65, 64, 62, 61,
- 48, 45, 44, 43, 42, 37, 34, 31, 29, 26,
- 25, 23, 22, 20, 18, 17, 15, 13, 12, 10,
- 8, 7, 5, 3, 105, 105, 105, 105, 105, 105,
- 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
- 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
- 105, 105, 105, 105, 105, 105, 105, 105, 105, 105
+ 60, 58, 57, 56, 55, 54, 52, 51, 50, 49,
+ 48, 45, 44, 43, 42, 37, 36, 34, 31, 29,
+ 26, 25, 23, 22, 20, 18, 17, 15, 13, 12,
+ 10, 8, 7, 5, 3, 110, 110, 110, 110, 110,
+ 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
+ 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
+ 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
+ 110
} ;
static yy_state_type yy_last_accepting_state;
@@ -550,7 +556,7 @@ char *yytext;
int yyparse();
-#line 554 "engines/director/lingo/lingo-lex.cpp"
+#line 560 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -738,7 +744,7 @@ YY_DECL
#line 45 "engines/director/lingo/lingo-lex.l"
-#line 742 "engines/director/lingo/lingo-lex.cpp"
+#line 748 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -792,13 +798,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 >= 106 )
+ if ( yy_current_state >= 111 )
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] != 125 );
+ while ( yy_base[yy_current_state] != 136 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -840,160 +846,165 @@ YY_RULE_SETUP
case 4:
YY_RULE_SETUP
#line 51 "engines/director/lingo/lingo-lex.l"
-{ return tDOWN; }
+{ return tMACRO; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 52 "engines/director/lingo/lingo-lex.l"
-{ return tIF; }
+{ return tDOWN; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 53 "engines/director/lingo/lingo-lex.l"
-{ return tELSE; }
+{ return tIF; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 54 "engines/director/lingo/lingo-lex.l"
-{ return tEND; }
+{ return tELSE; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 55 "engines/director/lingo/lingo-lex.l"
-{ return tFRAME; }
+{ return tEND; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 56 "engines/director/lingo/lingo-lex.l"
-{ return tGO; }
+{ return tFRAME; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 57 "engines/director/lingo/lingo-lex.l"
-{ return tINTO; }
+{ return tGO; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 58 "engines/director/lingo/lingo-lex.l"
-{ return tLOOP; }
+{ return tINTO; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 59 "engines/director/lingo/lingo-lex.l"
-{ return tMCI; }
+{ return tLOOP; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 60 "engines/director/lingo/lingo-lex.l"
-{ return tMCIWAIT; }
+{ return tMCI; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 61 "engines/director/lingo/lingo-lex.l"
-{ return tMOVIE; }
+{ return tMCIWAIT; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 62 "engines/director/lingo/lingo-lex.l"
-{ return tNEXT; }
+{ return tMOVIE; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 63 "engines/director/lingo/lingo-lex.l"
-{ return tOF; }
+{ return tNEXT; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 64 "engines/director/lingo/lingo-lex.l"
-{ return tPREVIOUS; }
+{ return tOF; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 65 "engines/director/lingo/lingo-lex.l"
-{ return tPUT; }
+{ return tPREVIOUS; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 66 "engines/director/lingo/lingo-lex.l"
-{ return tREPEAT; }
+{ return tPUT; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 67 "engines/director/lingo/lingo-lex.l"
-{ return tSET; }
+{ return tREPEAT; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 68 "engines/director/lingo/lingo-lex.l"
-{ return tTHEN; }
+{ return tSET; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 69 "engines/director/lingo/lingo-lex.l"
-{ return tTO; }
+{ return tTHEN; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 70 "engines/director/lingo/lingo-lex.l"
-{ return tWITH; }
+{ return tTO; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 71 "engines/director/lingo/lingo-lex.l"
-{ return tWHILE; }
+{ return tWITH; }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 73 "engines/director/lingo/lingo-lex.l"
-{ return tNEQ; }
+#line 72 "engines/director/lingo/lingo-lex.l"
+{ return tWHILE; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 74 "engines/director/lingo/lingo-lex.l"
-{ return tGE; }
+{ return tNEQ; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 75 "engines/director/lingo/lingo-lex.l"
-{ return tLE; }
+{ return tGE; }
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 77 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+#line 76 "engines/director/lingo/lingo-lex.l"
+{ return tLE; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 78 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+{ yylval.s = new Common::String(yytext); return VAR; }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 79 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 80 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 32:
-/* rule 32 can match eol */
YY_RULE_SETUP
#line 81 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ return *yytext; }
YY_BREAK
case 33:
+/* rule 33 can match eol */
YY_RULE_SETUP
#line 82 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return '\n'; }
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 84 "engines/director/lingo/lingo-lex.l"
+#line 83 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+ YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 85 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 997 "engines/director/lingo/lingo-lex.cpp"
+#line 1008 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1286,7 +1297,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 >= 106 )
+ if ( yy_current_state >= 111 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1314,11 +1325,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 >= 106 )
+ if ( yy_current_state >= 111 )
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 == 105);
+ yy_is_jam = (yy_current_state == 110);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1993,7 +2004,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 84 "engines/director/lingo/lingo-lex.l"
+#line 85 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 2ae9960..e30f10b 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -48,6 +48,7 @@ whitespace [\t ]
^{whitespace}
[\t]+ { return ' '; }
+--[^\r\n]*macro { return tMACRO; }
down { return tDOWN; }
if { return tIF; }
else { return tELSE; }
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 2575a2b..c56cde8 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -81,6 +81,8 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
_currentScript = 0;
_pc = 0;
+ _returning = false;
+ _indef = false;
warning("Lingo Inited");
}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 01fb6cc..d316243 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -120,6 +120,7 @@ public:
public:
void execute(int pc);
Symbol *lookupVar(const char *name);
+ void define(Common::String &s, int nargs);
static void c_xpop();
static void c_printtop();
@@ -142,6 +143,7 @@ public:
static void c_lt();
static void c_ge();
static void c_le();
+ static void c_procret();
static void c_mci();
static void c_mciwait();
@@ -157,6 +159,7 @@ public:
public:
ScriptData *_currentScript;
bool _returning;
+ bool _indef;
private:
int parse(const char *code);
Commit: c376b12d6b82c6c2ca0d330bd1e7751aa1cd07f6
https://github.com/scummvm/scummvm/commit/c376b12d6b82c6c2ca0d330bd1e7751aa1cd07f6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix parsing multiple macros
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 641bfe2..d5bfa21 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -73,6 +73,29 @@ Common::Error DirectorEngine::run() {
_lingo = new Lingo(this);
_soundManager = new DirectorSound();
+ _lingo->addCode("--\n\
+macro SHIPX\n\
+set x = 5\n\
+if x = 1 then\n\
+go \"Zoom\"\n\
+exit\n\
+end if\n\
+if x >1 then\n\
+exit\n\
+end if\n\
+\n\
+--\n\
+macro ZIPX\n\
+set x = 5\n\
+if x = 1 then\n\
+go \"ZIP\"\n\
+exit\n\
+end if\n\
+if x >1 then\n\
+exit\n\
+end if\n\
+", kMovieScript, 1);
+
_lingo->addCode("mci \"open MM\\T005045a.wav type WaveAudio alias T005045a\"\n\
mci \"play T005045a from 22710 to 32872\"", kMovieScript, 1);
@@ -87,11 +110,13 @@ put x\n", kMovieScript, 2);
_lingo->addCode("set x = 5\n\
if x <= 5 then set x = 6 end if\n\
if (x = 5) then\n\
- set x = 7\n\
+ set x = 7 -- this is comment\n\
else\n\
set x = 8\n\
+ -- this is another comment\n\
end if\n\
put x\n\
+-- this is more comment\n\
set y = 1\n\
repeat while (y < 5)\n\
set y = y + 1\n\
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index cfdb257..5f98006 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -334,6 +334,10 @@ void Lingo::c_ifcode() {
//************************
// Built-in functions
//************************
+void Lingo::c_exit() {
+ warning("STUB: c_exit()");
+}
+
void Lingo::c_mci() {
Common::String s((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index ccbd337..251818d 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -75,31 +75,32 @@
tDOWN = 264,
tELSE = 265,
tEND = 266,
- tFRAME = 267,
- tGO = 268,
- tIF = 269,
- tINTO = 270,
- tLOOP = 271,
- tMACRO = 272,
- tMCI = 273,
- tMCIWAIT = 274,
- tMOVIE = 275,
- tNEXT = 276,
- tOF = 277,
- tPREVIOUS = 278,
- tPUT = 279,
- tREPEAT = 280,
- tSET = 281,
- tTHEN = 282,
- tTO = 283,
- tWITH = 284,
- tWHILE = 285,
- tGE = 286,
- tLE = 287,
- tGT = 288,
- tLT = 289,
- tEQ = 290,
- tNEQ = 291
+ tEXIT = 267,
+ tFRAME = 268,
+ tGO = 269,
+ tIF = 270,
+ tINTO = 271,
+ tLOOP = 272,
+ tMACRO = 273,
+ tMCI = 274,
+ tMCIWAIT = 275,
+ tMOVIE = 276,
+ tNEXT = 277,
+ tOF = 278,
+ tPREVIOUS = 279,
+ tPUT = 280,
+ tREPEAT = 281,
+ tSET = 282,
+ tTHEN = 283,
+ tTO = 284,
+ tWITH = 285,
+ tWHILE = 286,
+ tGE = 287,
+ tLE = 288,
+ tGT = 289,
+ tLT = 290,
+ tEQ = 291,
+ tNEQ = 292
};
#endif
/* Tokens. */
@@ -112,31 +113,32 @@
#define tDOWN 264
#define tELSE 265
#define tEND 266
-#define tFRAME 267
-#define tGO 268
-#define tIF 269
-#define tINTO 270
-#define tLOOP 271
-#define tMACRO 272
-#define tMCI 273
-#define tMCIWAIT 274
-#define tMOVIE 275
-#define tNEXT 276
-#define tOF 277
-#define tPREVIOUS 278
-#define tPUT 279
-#define tREPEAT 280
-#define tSET 281
-#define tTHEN 282
-#define tTO 283
-#define tWITH 284
-#define tWHILE 285
-#define tGE 286
-#define tLE 287
-#define tGT 288
-#define tLT 289
-#define tEQ 290
-#define tNEQ 291
+#define tEXIT 267
+#define tFRAME 268
+#define tGO 269
+#define tIF 270
+#define tINTO 271
+#define tLOOP 272
+#define tMACRO 273
+#define tMCI 274
+#define tMCIWAIT 275
+#define tMOVIE 276
+#define tNEXT 277
+#define tOF 278
+#define tPREVIOUS 279
+#define tPUT 280
+#define tREPEAT 281
+#define tSET 282
+#define tTHEN 283
+#define tTO 284
+#define tWITH 285
+#define tWHILE 286
+#define tGE 287
+#define tLE 288
+#define tGT 289
+#define tLT 290
+#define tEQ 291
+#define tNEQ 292
@@ -188,7 +190,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 192 "engines/director/lingo/lingo-gr.cpp"
+#line 194 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -201,7 +203,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 205 "engines/director/lingo/lingo-gr.cpp"
+#line 207 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -414,22 +416,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 48
+#define YYFINAL 49
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 226
+#define YYLAST 287
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 49
+#define YYNTOKENS 50
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 19
/* YYNRULES -- Number of rules. */
-#define YYNRULES 69
+#define YYNRULES 71
/* YYNRULES -- Number of states. */
-#define YYNSTATES 144
+#define YYNSTATES 146
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 291
+#define YYMAXUTOK 292
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -438,12 +440,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 43, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 44, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 42, 2, 2,
- 44, 45, 40, 38, 48, 39, 2, 41, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 43, 2, 2,
+ 45, 46, 41, 39, 49, 40, 2, 42, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 47, 37, 46, 2, 2, 2, 2, 2, 2, 2,
+ 48, 38, 47, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -466,7 +468,7 @@ static const yytype_uint8 yytranslate[] =
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36
+ 35, 36, 37
};
#if YYDEBUG
@@ -474,55 +476,58 @@ static const yytype_uint8 yytranslate[] =
YYRHS. */
static const yytype_uint8 yyprhs[] =
{
- 0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
- 20, 22, 23, 28, 33, 38, 40, 42, 50, 61,
- 70, 82, 95, 97, 101, 105, 108, 112, 114, 115,
- 116, 119, 122, 124, 126, 128, 132, 136, 140, 144,
- 148, 152, 156, 160, 164, 167, 170, 174, 177, 180,
- 183, 185, 188, 191, 194, 197, 201, 204, 208, 211,
- 214, 216, 220, 223, 227, 228, 234, 235, 237, 241
+ 0, 0, 3, 7, 10, 12, 13, 15, 17, 19,
+ 21, 23, 25, 26, 31, 36, 41, 43, 45, 53,
+ 64, 73, 85, 98, 100, 104, 108, 111, 115, 117,
+ 118, 119, 122, 125, 127, 129, 131, 135, 139, 143,
+ 147, 151, 155, 159, 163, 167, 170, 173, 177, 180,
+ 183, 186, 188, 190, 193, 196, 199, 202, 206, 209,
+ 213, 216, 219, 221, 225, 228, 232, 233, 239, 240,
+ 242, 246
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 50, 0, -1, 51, 43, 50, -1, 51, -1, -1,
- 65, -1, 61, -1, 52, -1, 53, -1, 60, -1,
- 1, -1, -1, 24, 60, 15, 7, -1, 26, 7,
- 37, 60, -1, 26, 7, 28, 60, -1, 60, -1,
- 61, -1, 57, 54, 27, 59, 58, 11, 14, -1,
- 57, 54, 27, 59, 58, 10, 59, 58, 11, 14,
- -1, 55, 44, 54, 45, 59, 58, 11, 25, -1,
- 56, 37, 60, 58, 28, 60, 58, 59, 58, 11,
- 25, -1, 56, 37, 60, 58, 9, 28, 60, 58,
- 59, 58, 11, 25, -1, 60, -1, 60, 37, 60,
- -1, 44, 54, 45, -1, 25, 30, -1, 25, 29,
- 7, -1, 14, -1, -1, -1, 59, 43, -1, 59,
- 53, -1, 5, -1, 7, -1, 52, -1, 60, 38,
- 60, -1, 60, 39, 60, -1, 60, 40, 60, -1,
- 60, 41, 60, -1, 60, 46, 60, -1, 60, 47,
- 60, -1, 60, 36, 60, -1, 60, 31, 60, -1,
- 60, 32, 60, -1, 38, 60, -1, 39, 60, -1,
- 44, 60, 45, -1, 18, 8, -1, 19, 7, -1,
- 24, 60, -1, 62, -1, 13, 16, -1, 13, 21,
- -1, 13, 23, -1, 13, 63, -1, 13, 63, 64,
- -1, 13, 64, -1, 28, 12, 8, -1, 12, 8,
- -1, 28, 8, -1, 8, -1, 22, 20, 8, -1,
- 20, 8, -1, 28, 20, 8, -1, -1, 17, 7,
- 66, 67, 59, -1, -1, 7, -1, 67, 48, 7,
- -1, 67, 48, 43, 7, -1
+ 51, 0, -1, 52, 44, 51, -1, 52, 51, -1,
+ 52, -1, -1, 66, -1, 62, -1, 53, -1, 54,
+ -1, 61, -1, 1, -1, -1, 25, 61, 16, 7,
+ -1, 27, 7, 38, 61, -1, 27, 7, 29, 61,
+ -1, 61, -1, 62, -1, 58, 55, 28, 60, 59,
+ 11, 15, -1, 58, 55, 28, 60, 59, 10, 60,
+ 59, 11, 15, -1, 56, 45, 55, 46, 60, 59,
+ 11, 26, -1, 57, 38, 61, 59, 29, 61, 59,
+ 60, 59, 11, 26, -1, 57, 38, 61, 59, 9,
+ 29, 61, 59, 60, 59, 11, 26, -1, 61, -1,
+ 61, 38, 61, -1, 45, 55, 46, -1, 26, 31,
+ -1, 26, 30, 7, -1, 15, -1, -1, -1, 60,
+ 44, -1, 60, 54, -1, 5, -1, 7, -1, 53,
+ -1, 61, 39, 61, -1, 61, 40, 61, -1, 61,
+ 41, 61, -1, 61, 42, 61, -1, 61, 47, 61,
+ -1, 61, 48, 61, -1, 61, 37, 61, -1, 61,
+ 32, 61, -1, 61, 33, 61, -1, 39, 61, -1,
+ 40, 61, -1, 45, 61, 46, -1, 19, 8, -1,
+ 20, 7, -1, 25, 61, -1, 63, -1, 12, -1,
+ 14, 17, -1, 14, 22, -1, 14, 24, -1, 14,
+ 64, -1, 14, 64, 65, -1, 14, 65, -1, 29,
+ 13, 8, -1, 13, 8, -1, 29, 8, -1, 8,
+ -1, 23, 21, 8, -1, 21, 8, -1, 29, 21,
+ 8, -1, -1, 18, 7, 67, 68, 60, -1, -1,
+ 7, -1, 68, 49, 7, -1, 68, 49, 44, 7,
+ -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 92, 92, 93, 96, 97, 98, 99, 100, 101,
- 102, 103, 106, 107, 108, 111, 112, 113, 119, 131,
- 142, 158, 172, 173, 174, 176, 178, 184, 186, 188,
- 189, 190, 193, 194, 195, 196, 197, 198, 199, 200,
- 201, 202, 203, 204, 205, 206, 207, 210, 211, 212,
- 213, 224, 225, 226, 227, 228, 229, 232, 233, 234,
- 235, 238, 239, 240, 268, 268, 271, 272, 273, 274
+ 0, 92, 92, 93, 94, 97, 98, 99, 100, 101,
+ 102, 103, 104, 107, 108, 109, 112, 113, 114, 120,
+ 132, 143, 159, 173, 174, 175, 177, 179, 185, 187,
+ 189, 190, 191, 194, 195, 196, 197, 198, 199, 200,
+ 201, 202, 203, 204, 205, 206, 207, 208, 211, 212,
+ 213, 214, 215, 226, 227, 228, 229, 230, 231, 234,
+ 235, 236, 237, 240, 241, 242, 270, 270, 273, 274,
+ 275, 276
};
#endif
@@ -532,8 +537,8 @@ static const yytype_uint16 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "UNARY", "VOID", "INT", "FLOAT", "VAR",
- "STRING", "tDOWN", "tELSE", "tEND", "tFRAME", "tGO", "tIF", "tINTO",
- "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF",
+ "STRING", "tDOWN", "tELSE", "tEND", "tEXIT", "tFRAME", "tGO", "tIF",
+ "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF",
"tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH",
"tWHILE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'",
"'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "','",
@@ -551,33 +556,35 @@ static const yytype_uint16 yytoknum[] =
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 287, 288, 289, 290, 291, 61, 43, 45,
- 42, 47, 37, 10, 40, 41, 62, 60, 44
+ 285, 286, 287, 288, 289, 290, 291, 292, 61, 43,
+ 45, 42, 47, 37, 10, 40, 41, 62, 60, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 49, 50, 50, 51, 51, 51, 51, 51, 51,
- 51, 51, 52, 52, 52, 53, 53, 53, 53, 53,
- 53, 53, 54, 54, 54, 55, 56, 57, 58, 59,
- 59, 59, 60, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 60, 61, 61, 61,
- 61, 62, 62, 62, 62, 62, 62, 63, 63, 63,
- 63, 64, 64, 64, 66, 65, 67, 67, 67, 67
+ 0, 50, 51, 51, 51, 52, 52, 52, 52, 52,
+ 52, 52, 52, 53, 53, 53, 54, 54, 54, 54,
+ 54, 54, 54, 55, 55, 55, 56, 57, 58, 59,
+ 60, 60, 60, 61, 61, 61, 61, 61, 61, 61,
+ 61, 61, 61, 61, 61, 61, 61, 61, 62, 62,
+ 62, 62, 62, 63, 63, 63, 63, 63, 63, 64,
+ 64, 64, 64, 65, 65, 65, 67, 66, 68, 68,
+ 68, 68
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
- 0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 1, 0, 4, 4, 4, 1, 1, 7, 10, 8,
- 11, 12, 1, 3, 3, 2, 3, 1, 0, 0,
- 2, 2, 1, 1, 1, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 2, 2, 3, 2, 2, 2,
- 1, 2, 2, 2, 2, 3, 2, 3, 2, 2,
- 1, 3, 2, 3, 0, 5, 0, 1, 3, 4
+ 0, 2, 3, 2, 1, 0, 1, 1, 1, 1,
+ 1, 1, 0, 4, 4, 4, 1, 1, 7, 10,
+ 8, 11, 12, 1, 3, 3, 2, 3, 1, 0,
+ 0, 2, 2, 1, 1, 1, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 2, 2, 3, 2, 2,
+ 2, 1, 1, 2, 2, 2, 2, 3, 2, 3,
+ 2, 2, 1, 3, 2, 3, 0, 5, 0, 1,
+ 3, 4
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -585,137 +592,149 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 10, 32, 33, 0, 27, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 3, 34, 8, 0,
- 0, 0, 9, 6, 50, 5, 60, 0, 51, 0,
- 52, 0, 53, 0, 54, 56, 64, 47, 48, 0,
- 34, 49, 0, 25, 0, 44, 45, 0, 1, 0,
- 0, 0, 0, 0, 22, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 58, 62, 0, 59, 0, 0,
- 0, 55, 66, 0, 0, 26, 0, 0, 46, 2,
- 0, 28, 0, 0, 29, 0, 42, 43, 41, 35,
- 36, 37, 38, 39, 40, 61, 57, 63, 67, 29,
- 12, 14, 13, 29, 0, 24, 28, 23, 0, 65,
- 28, 0, 0, 30, 31, 0, 15, 16, 68, 0,
- 0, 0, 28, 29, 0, 69, 0, 28, 29, 28,
- 17, 19, 29, 28, 0, 28, 0, 0, 0, 0,
- 18, 0, 20, 21
+ 0, 11, 33, 34, 52, 0, 28, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 8, 9,
+ 0, 0, 0, 10, 7, 51, 6, 62, 0, 53,
+ 0, 54, 0, 55, 0, 56, 58, 66, 48, 49,
+ 0, 35, 50, 0, 26, 0, 45, 46, 0, 1,
+ 0, 3, 0, 0, 0, 0, 23, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 60, 64, 0, 61,
+ 0, 0, 0, 57, 68, 0, 0, 27, 0, 0,
+ 47, 2, 0, 29, 0, 0, 30, 0, 43, 44,
+ 42, 36, 37, 38, 39, 40, 41, 63, 59, 65,
+ 69, 30, 13, 15, 14, 30, 0, 25, 29, 24,
+ 0, 67, 29, 0, 0, 31, 32, 0, 16, 17,
+ 70, 0, 0, 0, 29, 30, 0, 71, 0, 29,
+ 30, 29, 18, 20, 30, 29, 0, 29, 0, 0,
+ 0, 0, 19, 0, 21, 22
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 15, 16, 40, 114, 53, 19, 20, 21, 104,
- 106, 116, 117, 24, 34, 35, 25, 72, 99
+ -1, 16, 17, 41, 116, 55, 20, 21, 22, 106,
+ 108, 118, 119, 25, 35, 36, 26, 74, 101
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -93
+#define YYPACT_NINF -27
static const yytype_int16 yypact[] =
{
- 65, -93, -93, -93, 138, -93, -1, 27, 30, 3,
- 44, 36, 3, 3, 3, 45, 25, 1, -93, 2,
- 11, 91, 167, -93, -93, -93, -93, 63, -93, 72,
- -93, 61, -93, 8, 47, -93, -93, -93, -93, 3,
- -93, 101, 80, -93, -11, -13, -13, 143, -93, 65,
- 91, 3, 91, 66, 155, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, -93, -93, 84, -93, 89, 93,
- 82, -93, 103, 101, 104, -93, 3, 3, -93, -93,
- 68, 167, 69, 131, -93, 3, 167, 167, 167, 179,
- 179, -13, -13, 167, 167, -93, -93, -93, -93, 70,
- -93, 167, 167, -93, -6, -93, 81, 167, -5, 81,
- 81, 95, 3, -93, -93, 14, 167, -93, -93, 120,
- 117, 3, 167, -93, 122, -93, 106, 167, -93, 81,
- -93, -93, -93, 81, 123, 81, 133, 139, 141, 130,
- -93, 132, -93, -93
+ 76, -27, -27, -27, -27, 186, -27, -3, 3, 31,
+ 2, 13, 39, 2, 2, 2, 8, 92, 227, -27,
+ 10, 11, 119, 215, -27, -27, -27, -27, 40, -27,
+ 60, -27, 49, -27, 24, 46, -27, -27, -27, -27,
+ 2, -27, 144, 64, -27, -17, -13, -13, 191, -27,
+ 76, -27, 119, 2, 119, 44, 203, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, -27, -27, 65, -27,
+ 66, 72, 61, -27, 77, 144, 78, -27, 2, 2,
+ -27, -27, 43, 215, 52, 179, -27, 2, 215, 215,
+ 215, 239, 239, -13, -13, 215, 215, -27, -27, -27,
+ -27, 37, -27, 215, 215, -27, -4, -27, 128, 215,
+ -5, 128, 128, 71, 2, -27, -27, 20, 215, -27,
+ -27, 101, 102, 2, 215, -27, 107, -27, 99, 215,
+ -27, 128, -27, -27, -27, 128, 116, 128, 117, 115,
+ 130, 113, -27, 123, -27, -27
};
/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int16 yypgoto[] =
+static const yytype_int8 yypgoto[] =
{
- -93, 107, -93, 4, 5, -20, -93, -93, -93, 16,
- -92, 0, 15, -93, -93, 146, -93, -93, -93
+ -27, -14, -27, 1, 6, -26, -27, -27, -27, 58,
+ 4, 0, 16, -27, -27, 110, -27, -27, -27
};
/* 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 -8
+#define YYTABLE_NINF -36
static const yytype_int16 yytable[] =
{
- 22, -7, 118, 111, 17, 18, 36, 109, 2, 41,
- 3, 110, 45, 46, 47, 23, 67, 76, 55, 56,
- 68, 54, 112, 57, 123, 124, 77, 39, 69, 11,
- 80, 129, 82, 62, 63, 37, 133, 38, 119, 73,
- 135, 12, 13, 44, -7, 48, 50, 14, 51, 22,
- 54, 81, 83, 17, 18, 86, 87, 88, 89, 90,
- 91, 92, 93, 94, 23, -4, 1, 29, 49, 31,
- 2, 64, 3, 42, 43, 70, 101, 102, 4, 5,
- 65, 66, 6, 7, 8, 107, 2, 75, 3, 9,
- 10, 11, 95, 84, 4, 5, 2, 96, 3, 7,
- 8, 97, 69, 12, 13, 9, 10, 11, -4, 14,
- 98, 100, 122, 103, 105, 39, 74, 11, 108, 12,
- 13, 127, 115, 121, 113, 14, 120, 125, 126, 12,
- 13, 131, 55, 56, 137, 52, 130, 57, 128, 58,
- 59, 60, 61, 132, 139, 134, 26, 62, 63, 136,
- 27, 138, 141, 140, 28, 142, 79, 143, 29, 30,
- 31, 32, 55, 56, 0, 0, 33, 57, 85, 58,
- 59, 60, 61, 0, 55, 56, 78, 62, 63, 57,
- 71, 58, 59, 60, 61, 0, 55, 56, 78, 62,
- 63, 57, 85, 58, 59, 60, 61, 0, 55, 56,
- 0, 62, 63, 57, 0, 58, 59, 60, 61, 0,
- 55, 56, 0, 62, 63, 57, 0, 0, 0, 60,
- 61, 0, 0, 0, 0, 62, 63
+ 23, 18, 120, 51, 37, 113, 19, 2, 49, 3,
+ 42, 38, 78, 46, 47, 48, 24, 23, 18, 57,
+ 58, 79, 56, 19, 59, 114, 82, 40, 84, 12,
+ 125, 126, 69, 24, 64, 65, 81, 70, 39, 121,
+ 75, 13, 14, 43, 44, 71, 45, 15, 66, 53,
+ 23, 18, 56, 83, 85, 52, 19, 88, 89, 90,
+ 91, 92, 93, 94, 95, 96, 24, 30, 67, 32,
+ 68, 77, 86, 97, 98, 72, -5, 1, 103, 104,
+ 99, 2, 71, 3, 100, 102, 110, 109, 4, 105,
+ 5, 6, -4, 1, 7, 8, 9, 2, 107, 3,
+ 123, 10, 11, 12, 4, 111, 5, 6, 127, 112,
+ 7, 8, 9, 128, 124, 13, 14, 10, 11, 12,
+ -5, 15, 132, 129, 2, 133, 3, 139, 141, 131,
+ 142, 13, 14, 2, 135, 3, 50, 15, 137, 144,
+ 4, 143, 5, 6, 40, 73, 12, 8, 9, 145,
+ 0, 0, 0, 10, 11, 12, 0, 0, 13, 14,
+ 76, 0, 0, 0, 54, 0, 117, 13, 14, 0,
+ 122, 0, 115, 15, 0, 0, 57, 58, 0, 0,
+ 0, 59, 130, 60, 61, 62, 63, 134, 0, 136,
+ 0, 64, 65, 138, 27, 140, 0, 0, 0, 28,
+ 0, 0, 0, 29, 0, 0, 0, 30, 31, 32,
+ 33, 57, 58, 0, 0, 34, 59, 87, 60, 61,
+ 62, 63, 0, 57, 58, 80, 64, 65, 59, 0,
+ 60, 61, 62, 63, 0, 57, 58, 80, 64, 65,
+ 59, 87, 60, 61, 62, 63, 0, 57, 58, 0,
+ 64, 65, 59, 0, 60, 61, 62, 63, 0, -35,
+ -35, 0, 64, 65, -35, 0, 0, 0, -35, -35,
+ 0, 57, 58, 0, -35, -35, 59, 0, 0, 0,
+ 62, 63, 0, 0, 0, 0, 64, 65
};
static const yytype_int16 yycheck[] =
{
- 0, 0, 7, 9, 0, 0, 7, 99, 5, 9,
- 7, 103, 12, 13, 14, 0, 8, 28, 31, 32,
- 12, 21, 28, 36, 10, 11, 37, 24, 20, 26,
- 50, 123, 52, 46, 47, 8, 128, 7, 43, 39,
- 132, 38, 39, 7, 43, 0, 44, 44, 37, 49,
- 50, 51, 52, 49, 49, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 49, 0, 1, 20, 43, 22,
- 5, 8, 7, 29, 30, 28, 76, 77, 13, 14,
- 8, 20, 17, 18, 19, 85, 5, 7, 7, 24,
- 25, 26, 8, 27, 13, 14, 5, 8, 7, 18,
- 19, 8, 20, 38, 39, 24, 25, 26, 43, 44,
- 7, 7, 112, 45, 45, 24, 15, 26, 48, 38,
- 39, 121, 106, 28, 43, 44, 110, 7, 11, 38,
- 39, 25, 31, 32, 11, 44, 14, 36, 122, 38,
- 39, 40, 41, 127, 11, 129, 8, 46, 47, 133,
- 12, 135, 11, 14, 16, 25, 49, 25, 20, 21,
- 22, 23, 31, 32, -1, -1, 28, 36, 37, 38,
- 39, 40, 41, -1, 31, 32, 45, 46, 47, 36,
- 34, 38, 39, 40, 41, -1, 31, 32, 45, 46,
- 47, 36, 37, 38, 39, 40, 41, -1, 31, 32,
- -1, 46, 47, 36, -1, 38, 39, 40, 41, -1,
- 31, 32, -1, 46, 47, 36, -1, -1, -1, 40,
- 41, -1, -1, -1, -1, 46, 47
+ 0, 0, 7, 17, 7, 9, 0, 5, 0, 7,
+ 10, 8, 29, 13, 14, 15, 0, 17, 17, 32,
+ 33, 38, 22, 17, 37, 29, 52, 25, 54, 27,
+ 10, 11, 8, 17, 47, 48, 50, 13, 7, 44,
+ 40, 39, 40, 30, 31, 21, 7, 45, 8, 38,
+ 50, 50, 52, 53, 54, 45, 50, 57, 58, 59,
+ 60, 61, 62, 63, 64, 65, 50, 21, 8, 23,
+ 21, 7, 28, 8, 8, 29, 0, 1, 78, 79,
+ 8, 5, 21, 7, 7, 7, 49, 87, 12, 46,
+ 14, 15, 0, 1, 18, 19, 20, 5, 46, 7,
+ 29, 25, 26, 27, 12, 101, 14, 15, 7, 105,
+ 18, 19, 20, 11, 114, 39, 40, 25, 26, 27,
+ 44, 45, 15, 123, 5, 26, 7, 11, 11, 125,
+ 15, 39, 40, 5, 130, 7, 44, 45, 134, 26,
+ 12, 11, 14, 15, 25, 35, 27, 19, 20, 26,
+ -1, -1, -1, 25, 26, 27, -1, -1, 39, 40,
+ 16, -1, -1, -1, 45, -1, 108, 39, 40, -1,
+ 112, -1, 44, 45, -1, -1, 32, 33, -1, -1,
+ -1, 37, 124, 39, 40, 41, 42, 129, -1, 131,
+ -1, 47, 48, 135, 8, 137, -1, -1, -1, 13,
+ -1, -1, -1, 17, -1, -1, -1, 21, 22, 23,
+ 24, 32, 33, -1, -1, 29, 37, 38, 39, 40,
+ 41, 42, -1, 32, 33, 46, 47, 48, 37, -1,
+ 39, 40, 41, 42, -1, 32, 33, 46, 47, 48,
+ 37, 38, 39, 40, 41, 42, -1, 32, 33, -1,
+ 47, 48, 37, -1, 39, 40, 41, 42, -1, 32,
+ 33, -1, 47, 48, 37, -1, -1, -1, 41, 42,
+ -1, 32, 33, -1, 47, 48, 37, -1, -1, -1,
+ 41, 42, -1, -1, -1, -1, 47, 48
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 5, 7, 13, 14, 17, 18, 19, 24,
- 25, 26, 38, 39, 44, 50, 51, 52, 53, 55,
- 56, 57, 60, 61, 62, 65, 8, 12, 16, 20,
- 21, 22, 23, 28, 63, 64, 7, 8, 7, 24,
- 52, 60, 29, 30, 7, 60, 60, 60, 0, 43,
- 44, 37, 44, 54, 60, 31, 32, 36, 38, 39,
- 40, 41, 46, 47, 8, 8, 20, 8, 12, 20,
- 28, 64, 66, 60, 15, 7, 28, 37, 45, 50,
- 54, 60, 54, 60, 27, 37, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 8, 8, 8, 7, 67,
- 7, 60, 60, 45, 58, 45, 59, 60, 48, 59,
- 59, 9, 28, 43, 53, 58, 60, 61, 7, 43,
- 58, 28, 60, 10, 11, 7, 11, 60, 58, 59,
- 14, 25, 58, 59, 58, 59, 58, 11, 58, 11,
- 14, 11, 25, 25
+ 0, 1, 5, 7, 12, 14, 15, 18, 19, 20,
+ 25, 26, 27, 39, 40, 45, 51, 52, 53, 54,
+ 56, 57, 58, 61, 62, 63, 66, 8, 13, 17,
+ 21, 22, 23, 24, 29, 64, 65, 7, 8, 7,
+ 25, 53, 61, 30, 31, 7, 61, 61, 61, 0,
+ 44, 51, 45, 38, 45, 55, 61, 32, 33, 37,
+ 39, 40, 41, 42, 47, 48, 8, 8, 21, 8,
+ 13, 21, 29, 65, 67, 61, 16, 7, 29, 38,
+ 46, 51, 55, 61, 55, 61, 28, 38, 61, 61,
+ 61, 61, 61, 61, 61, 61, 61, 8, 8, 8,
+ 7, 68, 7, 61, 61, 46, 59, 46, 60, 61,
+ 49, 60, 60, 9, 29, 44, 54, 59, 61, 62,
+ 7, 44, 59, 29, 61, 10, 11, 7, 11, 61,
+ 59, 60, 15, 26, 59, 60, 59, 60, 59, 11,
+ 59, 11, 15, 11, 26, 26
};
#define yyerrok (yyerrstatus = 0)
@@ -1529,29 +1548,24 @@ yyreduce:
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
- case 7:
-#line 99 "engines/director/lingo/lingo-gr.y"
+ case 8:
+#line 100 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 9:
-#line 101 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_printtop); ;}
- break;
-
case 10:
#line 102 "engines/director/lingo/lingo-gr.y"
- { yyerrok; ;}
+ { g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 12:
-#line 106 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->c_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
+ case 11:
+#line 103 "engines/director/lingo/lingo-gr.y"
+ { yyerrok; ;}
break;
case 13:
#line 107 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->c_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
+ { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->c_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
break;
case 14:
@@ -1560,12 +1574,17 @@ yyreduce:
break;
case 15:
-#line 111 "engines/director/lingo/lingo-gr.y"
+#line 109 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->c_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
+ break;
+
+ case 16:
+#line 112 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 17:
-#line 113 "engines/director/lingo/lingo-gr.y"
+ case 18:
+#line 114 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_LE_UINT32(&then, (yyvsp[(4) - (7)].code));
@@ -1574,8 +1593,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; ;}
break;
- case 18:
-#line 119 "engines/director/lingo/lingo-gr.y"
+ case 19:
+#line 120 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_LE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1586,8 +1605,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
break;
- case 19:
-#line 131 "engines/director/lingo/lingo-gr.y"
+ case 20:
+#line 132 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_LE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1596,8 +1615,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
- case 20:
-#line 142 "engines/director/lingo/lingo-gr.y"
+ case 21:
+#line 143 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_LE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1612,8 +1631,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
break;
- case 21:
-#line 158 "engines/director/lingo/lingo-gr.y"
+ case 22:
+#line 159 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_LE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1628,23 +1647,23 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
break;
- case 22:
-#line 172 "engines/director/lingo/lingo-gr.y"
+ case 23:
+#line 173 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 23:
-#line 173 "engines/director/lingo/lingo-gr.y"
+ case 24:
+#line 174 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 25:
-#line 176 "engines/director/lingo/lingo-gr.y"
+ case 26:
+#line 177 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 26:
-#line 178 "engines/director/lingo/lingo-gr.y"
+ case 27:
+#line 179 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1652,164 +1671,159 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 27:
-#line 184 "engines/director/lingo/lingo-gr.y"
+ case 28:
+#line 185 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
- case 28:
-#line 186 "engines/director/lingo/lingo-gr.y"
+ case 29:
+#line 187 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 29:
-#line 188 "engines/director/lingo/lingo-gr.y"
+ case 30:
+#line 189 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 32:
-#line 193 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->code1(g_lingo->c_constpush); inst i = 0; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); g_lingo->code1(i); ;}
- break;
-
case 33:
#line 194 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;}
+ { (yyval.code) = g_lingo->code1(g_lingo->c_constpush); inst i = 0; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); g_lingo->code1(i); ;}
break;
- case 35:
-#line 196 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_add); ;}
+ case 34:
+#line 195 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
case 36:
#line 197 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_sub); ;}
+ { g_lingo->code1(g_lingo->c_add); ;}
break;
case 37:
#line 198 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_mul); ;}
+ { g_lingo->code1(g_lingo->c_sub); ;}
break;
case 38:
#line 199 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_div); ;}
+ { g_lingo->code1(g_lingo->c_mul); ;}
break;
case 39:
#line 200 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gt); ;}
+ { g_lingo->code1(g_lingo->c_div); ;}
break;
case 40:
#line 201 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_lt); ;}
+ { g_lingo->code1(g_lingo->c_gt); ;}
break;
case 41:
#line 202 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_neq); ;}
+ { g_lingo->code1(g_lingo->c_lt); ;}
break;
case 42:
#line 203 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_ge); ;}
+ { g_lingo->code1(g_lingo->c_neq); ;}
break;
case 43:
#line 204 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_le); ;}
+ { g_lingo->code1(g_lingo->c_ge); ;}
break;
case 44:
#line 205 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+ { g_lingo->code1(g_lingo->c_le); ;}
break;
case 45:
#line 206 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 46:
#line 207 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 47:
-#line 210 "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); ;}
+#line 208 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 48:
#line 211 "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); ;}
+ { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 49:
#line 212 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_printtop); ;}
+ { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
- case 51:
-#line 224 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoloop); ;}
+ case 50:
+#line 213 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 52:
-#line 225 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotonext); ;}
+#line 215 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_exit); ;}
break;
case 53:
#line 226 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoprevious); ;}
+ { g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 54:
#line 227 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
+ { g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 55:
#line 228 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
+ { g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 56:
#line 229 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
break;
case 57:
-#line 232 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 230 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
break;
case 58:
-#line 233 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+#line 231 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 59:
#line 234 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 60:
#line 235 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 61:
-#line 238 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 236 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 62:
-#line 239 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+#line 237 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 63:
@@ -1818,38 +1832,48 @@ yyreduce:
break;
case 64:
-#line 268 "engines/director/lingo/lingo-gr.y"
- { g_lingo->_indef = true; ;}
+#line 241 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 65:
-#line 269 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_procret); g_lingo->define(*(yyvsp[(2) - (5)].s), (yyvsp[(4) - (5)].narg)); g_lingo->_indef = false; ;}
+#line 242 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 66:
-#line 271 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 0; ;}
+#line 270 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->_indef = true; ;}
break;
case 67:
-#line 272 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 1; ;}
+#line 271 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_procret); g_lingo->define(*(yyvsp[(2) - (5)].s), (yyvsp[(4) - (5)].narg)); g_lingo->_indef = false; ;}
break;
case 68:
#line 273 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
+ { (yyval.narg) = 0; ;}
break;
case 69:
#line 274 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = 1; ;}
+ break;
+
+ case 70:
+#line 275 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
+ break;
+
+ case 71:
+#line 276 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 1853 "engines/director/lingo/lingo-gr.cpp"
+#line 1877 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2063,6 +2087,6 @@ yyreturn:
}
-#line 278 "engines/director/lingo/lingo-gr.y"
+#line 280 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 6982cf1..b590192 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -48,31 +48,32 @@
tDOWN = 264,
tELSE = 265,
tEND = 266,
- tFRAME = 267,
- tGO = 268,
- tIF = 269,
- tINTO = 270,
- tLOOP = 271,
- tMACRO = 272,
- tMCI = 273,
- tMCIWAIT = 274,
- tMOVIE = 275,
- tNEXT = 276,
- tOF = 277,
- tPREVIOUS = 278,
- tPUT = 279,
- tREPEAT = 280,
- tSET = 281,
- tTHEN = 282,
- tTO = 283,
- tWITH = 284,
- tWHILE = 285,
- tGE = 286,
- tLE = 287,
- tGT = 288,
- tLT = 289,
- tEQ = 290,
- tNEQ = 291
+ tEXIT = 267,
+ tFRAME = 268,
+ tGO = 269,
+ tIF = 270,
+ tINTO = 271,
+ tLOOP = 272,
+ tMACRO = 273,
+ tMCI = 274,
+ tMCIWAIT = 275,
+ tMOVIE = 276,
+ tNEXT = 277,
+ tOF = 278,
+ tPREVIOUS = 279,
+ tPUT = 280,
+ tREPEAT = 281,
+ tSET = 282,
+ tTHEN = 283,
+ tTO = 284,
+ tWITH = 285,
+ tWHILE = 286,
+ tGE = 287,
+ tLE = 288,
+ tGT = 289,
+ tLT = 290,
+ tEQ = 291,
+ tNEQ = 292
};
#endif
/* Tokens. */
@@ -85,31 +86,32 @@
#define tDOWN 264
#define tELSE 265
#define tEND 266
-#define tFRAME 267
-#define tGO 268
-#define tIF 269
-#define tINTO 270
-#define tLOOP 271
-#define tMACRO 272
-#define tMCI 273
-#define tMCIWAIT 274
-#define tMOVIE 275
-#define tNEXT 276
-#define tOF 277
-#define tPREVIOUS 278
-#define tPUT 279
-#define tREPEAT 280
-#define tSET 281
-#define tTHEN 282
-#define tTO 283
-#define tWITH 284
-#define tWHILE 285
-#define tGE 286
-#define tLE 287
-#define tGT 288
-#define tLT 289
-#define tEQ 290
-#define tNEQ 291
+#define tEXIT 267
+#define tFRAME 268
+#define tGO 269
+#define tIF 270
+#define tINTO 271
+#define tLOOP 272
+#define tMACRO 273
+#define tMCI 274
+#define tMCIWAIT 275
+#define tMOVIE 276
+#define tNEXT 277
+#define tOF 278
+#define tPREVIOUS 279
+#define tPUT 280
+#define tREPEAT 281
+#define tSET 282
+#define tTHEN 283
+#define tTO 284
+#define tWITH 285
+#define tWHILE 286
+#define tGE 287
+#define tLE 288
+#define tGT 289
+#define tLT 290
+#define tEQ 291
+#define tNEQ 292
@@ -125,7 +127,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 129 "engines/director/lingo/lingo-gr.hpp"
+#line 131 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index defb98d..cbb18de 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -74,8 +74,8 @@ using namespace Director;
%token<i> INT
%token<f> FLOAT
%token<s> VAR STRING
-%token tDOWN tELSE tEND tFRAME tGO tIF tINTO tLOOP tMACRO tMCI tMCIWAIT tMOVIE tNEXT
-%token tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO tWITH tWHILE
+%token tDOWN tELSE tEND tEXIT tFRAME tGO tIF tINTO tLOOP tMACRO tMCI tMCIWAIT
+%token tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO tWITH tWHILE
%token tGE tLE tGT tLT tEQ tNEQ
%type<code> asgn cond end expr if repeatwhile repeatwith stmtlist
@@ -90,6 +90,7 @@ using namespace Director;
%%
program: programline '\n' program
+ | programline program
| programline
;
@@ -211,6 +212,7 @@ func: tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_
| tMCIWAIT VAR { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
| tPUT expr { g_lingo->code1(g_lingo->c_printtop); }
| gotofunc
+ | tEXIT { g_lingo->code1(g_lingo->c_exit); }
;
// go {to} {frame} whichFrame {of movie whichMovie}
@@ -265,7 +267,7 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
//
// See also:
// on keyword
-defn: tMACRO VAR { g_lingo->_indef = true; }
+defn: tMACRO VAR { g_lingo->_indef = true; }
arglist stmtlist { g_lingo->code1(g_lingo->c_procret); g_lingo->define(*$2, $4); g_lingo->_indef = false; }
;
arglist: /* nothing */ { $$ = 0; }
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 672109a..421b407 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 35
-#define YY_END_OF_BUFFER 36
+#define YY_NUM_RULES 36
+#define YY_END_OF_BUFFER 37
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,20 +373,21 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[111] =
+static yyconst flex_int16_t yy_accept[113] =
{ 0,
- 0, 0, 36, 35, 3, 33, 35, 35, 32, 32,
- 31, 32, 32, 29, 29, 29, 29, 29, 29, 29,
- 29, 29, 29, 29, 29, 29, 29, 29, 2, 2,
- 3, 33, 26, 0, 34, 1, 30, 31, 28, 27,
- 29, 29, 29, 29, 29, 10, 6, 29, 29, 29,
- 29, 29, 17, 29, 29, 29, 29, 29, 23, 29,
- 29, 1, 1, 30, 29, 29, 8, 29, 29, 29,
- 13, 29, 29, 29, 19, 29, 21, 29, 29, 29,
- 1, 5, 7, 29, 11, 12, 29, 29, 16, 29,
- 29, 22, 29, 24, 1, 9, 29, 15, 29, 29,
-
- 25, 1, 29, 29, 20, 1, 14, 29, 18, 0
+ 0, 0, 37, 36, 3, 34, 36, 36, 33, 33,
+ 32, 33, 33, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 2, 2,
+ 3, 34, 27, 0, 35, 1, 31, 32, 29, 28,
+ 30, 30, 30, 30, 30, 30, 10, 5, 30, 30,
+ 30, 30, 30, 30, 18, 30, 30, 30, 30, 30,
+ 24, 30, 30, 1, 31, 30, 30, 7, 30, 30,
+ 30, 30, 30, 14, 30, 30, 30, 20, 30, 22,
+ 30, 30, 30, 4, 6, 8, 30, 11, 12, 30,
+ 30, 30, 17, 30, 30, 23, 30, 25, 9, 13,
+
+ 30, 16, 30, 30, 26, 30, 30, 21, 15, 30,
+ 19, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -429,84 +430,82 @@ static yyconst flex_int32_t yy_meta[36] =
4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[114] =
+static yyconst flex_int16_t yy_base[116] =
{ 0,
- 0, 34, 135, 136, 132, 34, 120, 125, 136, 122,
- 30, 117, 116, 0, 101, 18, 98, 99, 23, 98,
- 28, 105, 103, 18, 103, 102, 24, 30, 118, 136,
- 117, 53, 136, 111, 136, 92, 105, 48, 136, 136,
- 0, 81, 84, 95, 96, 0, 0, 80, 83, 86,
- 75, 72, 0, 87, 74, 76, 72, 83, 0, 78,
- 69, 74, 38, 87, 71, 77, 0, 70, 67, 65,
- 58, 68, 59, 56, 0, 69, 0, 61, 62, 63,
- 43, 0, 0, 65, 0, 0, 67, 63, 0, 58,
- 64, 0, 60, 0, 36, 0, 55, 0, 50, 44,
-
- 0, 37, 43, 38, 0, 42, 0, 36, 0, 136,
- 68, 44, 72
+ 0, 34, 131, 132, 128, 34, 116, 121, 132, 118,
+ 30, 113, 112, 0, 97, 18, 94, 95, 23, 94,
+ 29, 101, 99, 18, 99, 98, 30, 32, 114, 132,
+ 113, 55, 132, 107, 132, 0, 102, 50, 132, 132,
+ 0, 78, 81, 92, 86, 92, 0, 0, 76, 79,
+ 88, 81, 70, 67, 0, 82, 69, 71, 67, 78,
+ 0, 73, 64, 0, 83, 67, 73, 0, 60, 65,
+ 62, 60, 58, 52, 62, 53, 50, 0, 63, 0,
+ 55, 56, 57, 0, 0, 0, 59, 0, 0, 50,
+ 60, 56, 0, 51, 57, 0, 53, 0, 0, 0,
+
+ 48, 0, 43, 37, 0, 36, 31, 0, 0, 21,
+ 0, 132, 61, 44, 65
} ;
-static yyconst flex_int16_t yy_def[114] =
+static yyconst flex_int16_t yy_def[116] =
{ 0,
- 110, 1, 110, 110, 110, 110, 110, 111, 110, 110,
- 110, 110, 110, 112, 112, 112, 112, 112, 112, 112,
- 112, 112, 112, 112, 112, 112, 112, 112, 110, 110,
- 110, 110, 110, 111, 110, 113, 110, 110, 110, 110,
- 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
- 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
- 112, 113, 113, 110, 112, 112, 112, 112, 112, 112,
- 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
- 113, 112, 112, 112, 112, 112, 112, 112, 112, 112,
- 112, 112, 112, 112, 113, 112, 112, 112, 112, 112,
-
- 112, 113, 112, 112, 112, 113, 112, 112, 112, 0,
- 110, 110, 110
+ 112, 1, 112, 112, 112, 112, 112, 113, 112, 112,
+ 112, 112, 112, 114, 114, 114, 114, 114, 114, 114,
+ 114, 114, 114, 114, 114, 114, 114, 114, 112, 112,
+ 112, 112, 112, 113, 112, 115, 112, 112, 112, 112,
+ 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
+ 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
+ 114, 114, 114, 115, 112, 114, 114, 114, 114, 114,
+ 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
+ 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
+ 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
+
+ 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
+ 114, 0, 112, 112, 112
} ;
-static yyconst flex_int16_t yy_nxt[172] =
+static yyconst flex_int16_t yy_nxt[168] =
{ 0,
4, 5, 6, 6, 4, 7, 8, 9, 10, 4,
11, 12, 9, 13, 14, 14, 14, 15, 16, 17,
18, 14, 19, 20, 21, 22, 23, 24, 25, 26,
27, 14, 14, 28, 14, 29, 32, 32, 30, 37,
- 38, 43, 47, 44, 50, 58, 54, 41, 48, 55,
- 59, 60, 61, 81, 51, 32, 32, 37, 38, 95,
- 63, 63, 63, 106, 102, 109, 63, 63, 34, 108,
- 34, 34, 62, 107, 105, 62, 104, 103, 101, 100,
- 99, 98, 97, 96, 94, 93, 92, 91, 90, 89,
- 88, 87, 86, 85, 84, 83, 82, 64, 63, 80,
-
- 79, 78, 77, 76, 75, 74, 73, 72, 71, 70,
- 69, 68, 67, 66, 65, 64, 63, 35, 31, 31,
- 57, 56, 53, 52, 49, 46, 45, 42, 40, 39,
- 36, 35, 33, 31, 110, 3, 110, 110, 110, 110,
- 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
- 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
- 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
- 110
+ 38, 43, 48, 44, 51, 52, 56, 41, 49, 57,
+ 111, 60, 45, 62, 63, 53, 61, 32, 32, 37,
+ 38, 34, 110, 34, 34, 64, 109, 108, 64, 107,
+ 106, 105, 104, 103, 102, 101, 100, 99, 98, 97,
+ 96, 95, 94, 93, 92, 91, 90, 89, 88, 87,
+ 86, 85, 84, 65, 83, 82, 81, 80, 79, 78,
+
+ 77, 76, 75, 74, 73, 72, 71, 70, 69, 68,
+ 67, 66, 65, 35, 31, 31, 59, 58, 55, 54,
+ 50, 47, 46, 42, 40, 39, 36, 35, 33, 31,
+ 112, 3, 112, 112, 112, 112, 112, 112, 112, 112,
+ 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
+ 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
+ 112, 112, 112, 112, 112, 112, 112
} ;
-static yyconst flex_int16_t yy_chk[172] =
+static yyconst flex_int16_t yy_chk[168] =
{ 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, 2, 6, 6, 2, 11,
- 11, 16, 19, 16, 21, 27, 24, 112, 19, 24,
- 27, 28, 28, 63, 21, 32, 32, 38, 38, 81,
- 95, 102, 63, 102, 95, 108, 106, 81, 111, 104,
- 111, 111, 113, 103, 100, 113, 99, 97, 93, 91,
- 90, 88, 87, 84, 80, 79, 78, 76, 74, 73,
- 72, 71, 70, 69, 68, 66, 65, 64, 62, 61,
-
- 60, 58, 57, 56, 55, 54, 52, 51, 50, 49,
- 48, 45, 44, 43, 42, 37, 36, 34, 31, 29,
- 26, 25, 23, 22, 20, 18, 17, 15, 13, 12,
- 10, 8, 7, 5, 3, 110, 110, 110, 110, 110,
- 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
- 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
- 110, 110, 110, 110, 110, 110, 110, 110, 110, 110,
- 110
+ 11, 16, 19, 16, 21, 21, 24, 114, 19, 24,
+ 110, 27, 16, 28, 28, 21, 27, 32, 32, 38,
+ 38, 113, 107, 113, 113, 115, 106, 104, 115, 103,
+ 101, 97, 95, 94, 92, 91, 90, 87, 83, 82,
+ 81, 79, 77, 76, 75, 74, 73, 72, 71, 70,
+ 69, 67, 66, 65, 63, 62, 60, 59, 58, 57,
+
+ 56, 54, 53, 52, 51, 50, 49, 46, 45, 44,
+ 43, 42, 37, 34, 31, 29, 26, 25, 23, 22,
+ 20, 18, 17, 15, 13, 12, 10, 8, 7, 5,
+ 3, 112, 112, 112, 112, 112, 112, 112, 112, 112,
+ 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
+ 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
+ 112, 112, 112, 112, 112, 112, 112
} ;
static yy_state_type yy_last_accepting_state;
@@ -556,7 +555,7 @@ char *yytext;
int yyparse();
-#line 560 "engines/director/lingo/lingo-lex.cpp"
+#line 559 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -744,7 +743,7 @@ YY_DECL
#line 45 "engines/director/lingo/lingo-lex.l"
-#line 748 "engines/director/lingo/lingo-lex.cpp"
+#line 747 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -798,13 +797,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 >= 111 )
+ if ( yy_current_state >= 113 )
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] != 136 );
+ while ( yy_base[yy_current_state] != 132 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -846,27 +845,27 @@ YY_RULE_SETUP
case 4:
YY_RULE_SETUP
#line 51 "engines/director/lingo/lingo-lex.l"
-{ return tMACRO; }
+{ return tDOWN; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 52 "engines/director/lingo/lingo-lex.l"
-{ return tDOWN; }
+{ return tIF; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 53 "engines/director/lingo/lingo-lex.l"
-{ return tIF; }
+{ return tELSE; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 54 "engines/director/lingo/lingo-lex.l"
-{ return tELSE; }
+{ return tEND; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 55 "engines/director/lingo/lingo-lex.l"
-{ return tEND; }
+{ return tEXIT; }
YY_BREAK
case 9:
YY_RULE_SETUP
@@ -891,120 +890,125 @@ YY_RULE_SETUP
case 13:
YY_RULE_SETUP
#line 60 "engines/director/lingo/lingo-lex.l"
-{ return tMCI; }
+{ return tMACRO; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 61 "engines/director/lingo/lingo-lex.l"
-{ return tMCIWAIT; }
+{ return tMCI; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 62 "engines/director/lingo/lingo-lex.l"
-{ return tMOVIE; }
+{ return tMCIWAIT; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 63 "engines/director/lingo/lingo-lex.l"
-{ return tNEXT; }
+{ return tMOVIE; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 64 "engines/director/lingo/lingo-lex.l"
-{ return tOF; }
+{ return tNEXT; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 65 "engines/director/lingo/lingo-lex.l"
-{ return tPREVIOUS; }
+{ return tOF; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 66 "engines/director/lingo/lingo-lex.l"
-{ return tPUT; }
+{ return tPREVIOUS; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 67 "engines/director/lingo/lingo-lex.l"
-{ return tREPEAT; }
+{ return tPUT; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 68 "engines/director/lingo/lingo-lex.l"
-{ return tSET; }
+{ return tREPEAT; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 69 "engines/director/lingo/lingo-lex.l"
-{ return tTHEN; }
+{ return tSET; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 70 "engines/director/lingo/lingo-lex.l"
-{ return tTO; }
+{ return tTHEN; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 71 "engines/director/lingo/lingo-lex.l"
-{ return tWITH; }
+{ return tTO; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 72 "engines/director/lingo/lingo-lex.l"
-{ return tWHILE; }
+{ return tWITH; }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 74 "engines/director/lingo/lingo-lex.l"
-{ return tNEQ; }
+#line 73 "engines/director/lingo/lingo-lex.l"
+{ return tWHILE; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 75 "engines/director/lingo/lingo-lex.l"
-{ return tGE; }
+{ return tNEQ; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 76 "engines/director/lingo/lingo-lex.l"
-{ return tLE; }
+{ return tGE; }
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 78 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+#line 77 "engines/director/lingo/lingo-lex.l"
+{ return tLE; }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 79 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+{ yylval.s = new Common::String(yytext); return VAR; }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 80 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 32:
YY_RULE_SETUP
#line 81 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 33:
-/* rule 33 can match eol */
YY_RULE_SETUP
#line 82 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ return *yytext; }
YY_BREAK
case 34:
+/* rule 34 can match eol */
YY_RULE_SETUP
#line 83 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return '\n'; }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 85 "engines/director/lingo/lingo-lex.l"
+#line 84 "engines/director/lingo/lingo-lex.l"
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+ YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 86 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1008 "engines/director/lingo/lingo-lex.cpp"
+#line 1012 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1297,7 +1301,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 >= 111 )
+ if ( yy_current_state >= 113 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1325,11 +1329,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 >= 111 )
+ if ( yy_current_state >= 113 )
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 == 110);
+ yy_is_jam = (yy_current_state == 112);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2004,7 +2008,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 85 "engines/director/lingo/lingo-lex.l"
+#line 86 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index e30f10b..edabbf0 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -48,15 +48,16 @@ whitespace [\t ]
^{whitespace}
[\t]+ { return ' '; }
---[^\r\n]*macro { return tMACRO; }
down { return tDOWN; }
if { return tIF; }
else { return tELSE; }
end { return tEND; }
+exit { return tEXIT; }
frame { return tFRAME; }
go { return tGO; }
into { return tINTO; }
loop { return tLOOP; }
+macro { return tMACRO; }
mci { return tMCI; }
mciwait { return tMCIWAIT; }
movie { return tMOVIE; }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index d316243..7b1faed 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -145,6 +145,7 @@ public:
static void c_le();
static void c_procret();
+ static void c_exit();
static void c_mci();
static void c_mciwait();
static void c_goto();
Commit: a06e794a94002e63b9da75c92069fd7ca846df71
https://github.com/scummvm/scummvm/commit/a06e794a94002e63b9da75c92069fd7ca846df71
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Added named parameter assignment for macros
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index d5bfa21..4e3b1f3 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -94,8 +94,20 @@ end if\n\
if x >1 then\n\
exit\n\
end if\n\
+\n\
+--\n\
+macro check par1, par2\n\
+if par1 = 3 then\n\
+ put 8\n\
+else\n\
+ put 9\n\
+end if\n\
+\n\
", kMovieScript, 1);
+return Common::kNoError;
+
+
_lingo->addCode("mci \"open MM\\T005045a.wav type WaveAudio alias T005045a\"\n\
mci \"play T005045a from 22710 to 32872\"", kMovieScript, 1);
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 5f98006..8483861 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -379,6 +379,13 @@ void Lingo::c_gotoprevious() {
void Lingo::define(Common::String &s, int nargs) {
warning("STUB: define(\"%s\", %d)", s.c_str(), nargs);
}
+
+void Lingo::codeArg(Common::String &s) {
+ g_lingo->code1(g_lingo->c_varpush);
+ g_lingo->codeString(s.c_str());
+ g_lingo->code1(g_lingo->c_assign);
+}
+
void Lingo::c_procret() {
warning("STUB: c_procret()");
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 251818d..908c07b 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -526,8 +526,8 @@ static const yytype_uint16 yyrline[] =
189, 190, 191, 194, 195, 196, 197, 198, 199, 200,
201, 202, 203, 204, 205, 206, 207, 208, 211, 212,
213, 214, 215, 226, 227, 228, 229, 230, 231, 234,
- 235, 236, 237, 240, 241, 242, 270, 270, 273, 274,
- 275, 276
+ 235, 236, 237, 240, 241, 242, 270, 270, 276, 277,
+ 278, 279
};
#endif
@@ -1848,32 +1848,35 @@ yyreduce:
case 67:
#line 271 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_procret); g_lingo->define(*(yyvsp[(2) - (5)].s), (yyvsp[(4) - (5)].narg)); g_lingo->_indef = false; ;}
+ {
+ g_lingo->code1(g_lingo->c_procret);
+ g_lingo->define(*(yyvsp[(2) - (5)].s), (yyvsp[(4) - (5)].narg));
+ g_lingo->_indef = false; ;}
break;
case 68:
-#line 273 "engines/director/lingo/lingo-gr.y"
+#line 276 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 69:
-#line 274 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 1; ;}
+#line 277 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArg(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); (yyval.narg) = 1; ;}
break;
case 70:
-#line 275 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
+#line 278 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArg(*(yyvsp[(3) - (3)].s)); delete (yyvsp[(3) - (3)].s); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 71:
-#line 276 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
+#line 279 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArg(*(yyvsp[(4) - (4)].s)); delete (yyvsp[(4) - (4)].s); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 1877 "engines/director/lingo/lingo-gr.cpp"
+#line 1880 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2087,6 +2090,6 @@ yyreturn:
}
-#line 280 "engines/director/lingo/lingo-gr.y"
+#line 283 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index cbb18de..910cd80 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -268,12 +268,15 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
// See also:
// on keyword
defn: tMACRO VAR { g_lingo->_indef = true; }
- arglist stmtlist { g_lingo->code1(g_lingo->c_procret); g_lingo->define(*$2, $4); g_lingo->_indef = false; }
+ arglist stmtlist {
+ g_lingo->code1(g_lingo->c_procret);
+ g_lingo->define(*$2, $4);
+ g_lingo->_indef = false; }
;
arglist: /* nothing */ { $$ = 0; }
- | VAR { $$ = 1; }
- | arglist ',' VAR { $$ = $1 + 1; }
- | arglist ',' '\n' VAR { $$ = $1 + 1; }
+ | VAR { g_lingo->codeArg(*$1); delete $1; $$ = 1; }
+ | arglist ',' VAR { g_lingo->codeArg(*$3); delete $3; $$ = $1 + 1; }
+ | arglist ',' '\n' VAR { g_lingo->codeArg(*$4); delete $4; $$ = $1 + 1; }
;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 7b1faed..c4b720c 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -121,6 +121,7 @@ public:
void execute(int pc);
Symbol *lookupVar(const char *name);
void define(Common::String &s, int nargs);
+ void codeArg(Common::String &s);
static void c_xpop();
static void c_printtop();
Commit: 1cf381db2aab7567e977fdc34dfc2a4598080694
https://github.com/scummvm/scummvm/commit/1cf381db2aab7567e977fdc34dfc2a4598080694
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Generate STOP at the macro end
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 908c07b..524330d 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -418,7 +418,7 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 49
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 287
+#define YYLAST 302
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 50
@@ -427,7 +427,7 @@ union yyalloc
/* YYNRULES -- Number of rules. */
#define YYNRULES 71
/* YYNRULES -- Number of states. */
-#define YYNSTATES 146
+#define YYNSTATES 147
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -482,8 +482,8 @@ static const yytype_uint8 yyprhs[] =
118, 119, 122, 125, 127, 129, 131, 135, 139, 143,
147, 151, 155, 159, 163, 167, 170, 173, 177, 180,
183, 186, 188, 190, 193, 196, 199, 202, 206, 209,
- 213, 216, 219, 221, 225, 228, 232, 233, 239, 240,
- 242, 246
+ 213, 216, 219, 221, 225, 228, 232, 233, 240, 241,
+ 243, 247
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -512,9 +512,9 @@ static const yytype_int8 yyrhs[] =
64, -1, 14, 64, 65, -1, 14, 65, -1, 29,
13, 8, -1, 13, 8, -1, 29, 8, -1, 8,
-1, 23, 21, 8, -1, 21, 8, -1, 29, 21,
- 8, -1, -1, 18, 7, 67, 68, 60, -1, -1,
- 7, -1, 68, 49, 7, -1, 68, 49, 44, 7,
- -1
+ 8, -1, -1, 18, 7, 67, 68, 60, 59, -1,
+ -1, 7, -1, 68, 49, 7, -1, 68, 49, 44,
+ 7, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -583,7 +583,7 @@ static const yytype_uint8 yyr2[] =
0, 2, 2, 1, 1, 1, 3, 3, 3, 3,
3, 3, 3, 3, 3, 2, 2, 3, 2, 2,
2, 1, 1, 2, 2, 2, 2, 3, 2, 3,
- 2, 2, 1, 3, 2, 3, 0, 5, 0, 1,
+ 2, 2, 1, 3, 2, 3, 0, 6, 0, 1,
3, 4
};
@@ -603,10 +603,10 @@ static const yytype_uint8 yydefact[] =
47, 2, 0, 29, 0, 0, 30, 0, 43, 44,
42, 36, 37, 38, 39, 40, 41, 63, 59, 65,
69, 30, 13, 15, 14, 30, 0, 25, 29, 24,
- 0, 67, 29, 0, 0, 31, 32, 0, 16, 17,
- 70, 0, 0, 0, 29, 30, 0, 71, 0, 29,
- 30, 29, 18, 20, 30, 29, 0, 29, 0, 0,
- 0, 0, 19, 0, 21, 22
+ 0, 29, 29, 0, 0, 31, 32, 0, 16, 17,
+ 70, 0, 67, 0, 0, 29, 30, 0, 71, 0,
+ 29, 30, 29, 18, 20, 30, 29, 0, 29, 0,
+ 0, 0, 0, 19, 0, 21, 22
};
/* YYDEFGOTO[NTERM-NUM]. */
@@ -621,28 +621,28 @@ static const yytype_int8 yydefgoto[] =
#define YYPACT_NINF -27
static const yytype_int16 yypact[] =
{
- 76, -27, -27, -27, -27, 186, -27, -3, 3, 31,
- 2, 13, 39, 2, 2, 2, 8, 92, 227, -27,
- 10, 11, 119, 215, -27, -27, -27, -27, 40, -27,
+ 76, -27, -27, -27, -27, 192, -27, -3, 3, 31,
+ 2, 13, 39, 2, 2, 2, 8, 92, 242, -27,
+ 4, 10, 139, 230, -27, -27, -27, -27, 47, -27,
60, -27, 49, -27, 24, 46, -27, -27, -27, -27,
- 2, -27, 144, 64, -27, -17, -13, -13, 191, -27,
- 76, -27, 119, 2, 119, 44, 203, 2, 2, 2,
+ 2, -27, 149, 64, -27, -17, -13, -13, 206, -27,
+ 76, -27, 139, 2, 139, 44, 218, 2, 2, 2,
2, 2, 2, 2, 2, 2, -27, -27, 65, -27,
- 66, 72, 61, -27, 77, 144, 78, -27, 2, 2,
- -27, -27, 43, 215, 52, 179, -27, 2, 215, 215,
- 215, 239, 239, -13, -13, 215, 215, -27, -27, -27,
- -27, 37, -27, 215, 215, -27, -4, -27, 128, 215,
- -5, 128, 128, 71, 2, -27, -27, 20, 215, -27,
- -27, 101, 102, 2, 215, -27, 107, -27, 99, 215,
- -27, 128, -27, -27, -27, 128, 116, 128, 117, 115,
- 130, 113, -27, 123, -27, -27
+ 66, 72, 61, -27, 77, 149, 78, -27, 2, 2,
+ -27, -27, 40, 230, 43, 194, -27, 2, 230, 230,
+ 230, 254, 254, -13, -13, 230, 230, -27, -27, -27,
+ -27, 51, -27, 230, 230, -27, -4, -27, 128, 230,
+ -5, 128, 128, 69, 2, -27, -27, 20, 230, -27,
+ -27, 98, -27, 97, 2, 230, -27, 94, -27, 96,
+ 230, -27, 128, -27, -27, -27, 128, 102, 128, 112,
+ 110, 116, 103, -27, 108, -27, -27
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -27, -14, -27, 1, 6, -26, -27, -27, -27, 58,
- 4, 0, 16, -27, -27, 110, -27, -27, -27
+ -27, -14, -27, 1, 6, -26, -27, -27, -27, 87,
+ 25, 0, 16, -27, -27, 93, -27, -27, -27
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -655,32 +655,34 @@ static const yytype_int16 yytable[] =
23, 18, 120, 51, 37, 113, 19, 2, 49, 3,
42, 38, 78, 46, 47, 48, 24, 23, 18, 57,
58, 79, 56, 19, 59, 114, 82, 40, 84, 12,
- 125, 126, 69, 24, 64, 65, 81, 70, 39, 121,
- 75, 13, 14, 43, 44, 71, 45, 15, 66, 53,
- 23, 18, 56, 83, 85, 52, 19, 88, 89, 90,
+ 126, 127, 69, 24, 64, 65, 81, 70, 39, 121,
+ 75, 13, 14, 43, 44, 71, 45, 15, 53, 52,
+ 23, 18, 56, 83, 85, 66, 19, 88, 89, 90,
91, 92, 93, 94, 95, 96, 24, 30, 67, 32,
68, 77, 86, 97, 98, 72, -5, 1, 103, 104,
- 99, 2, 71, 3, 100, 102, 110, 109, 4, 105,
- 5, 6, -4, 1, 7, 8, 9, 2, 107, 3,
- 123, 10, 11, 12, 4, 111, 5, 6, 127, 112,
- 7, 8, 9, 128, 124, 13, 14, 10, 11, 12,
- -5, 15, 132, 129, 2, 133, 3, 139, 141, 131,
- 142, 13, 14, 2, 135, 3, 50, 15, 137, 144,
- 4, 143, 5, 6, 40, 73, 12, 8, 9, 145,
- 0, 0, 0, 10, 11, 12, 0, 0, 13, 14,
- 76, 0, 0, 0, 54, 0, 117, 13, 14, 0,
- 122, 0, 115, 15, 0, 0, 57, 58, 0, 0,
- 0, 59, 130, 60, 61, 62, 63, 134, 0, 136,
- 0, 64, 65, 138, 27, 140, 0, 0, 0, 28,
- 0, 0, 0, 29, 0, 0, 0, 30, 31, 32,
- 33, 57, 58, 0, 0, 34, 59, 87, 60, 61,
- 62, 63, 0, 57, 58, 80, 64, 65, 59, 0,
- 60, 61, 62, 63, 0, 57, 58, 80, 64, 65,
- 59, 87, 60, 61, 62, 63, 0, 57, 58, 0,
- 64, 65, 59, 0, 60, 61, 62, 63, 0, -35,
- -35, 0, 64, 65, -35, 0, 0, 0, -35, -35,
- 0, 57, 58, 0, -35, -35, 59, 0, 0, 0,
- 62, 63, 0, 0, 0, 0, 64, 65
+ 99, 2, 71, 3, 100, 102, 105, 109, 4, 107,
+ 5, 6, -4, 1, 7, 8, 9, 2, 124, 3,
+ 110, 10, 11, 12, 4, 128, 5, 6, 129, 133,
+ 7, 8, 9, 140, 125, 13, 14, 10, 11, 12,
+ -5, 15, 134, 142, 130, 143, 111, 144, 73, 145,
+ 112, 13, 14, 2, 146, 3, 50, 15, 0, 0,
+ 4, 0, 5, 6, 2, 0, 3, 8, 9, 0,
+ 0, 132, 0, 10, 11, 12, 136, 0, 0, 0,
+ 138, 0, 0, 0, 40, 76, 12, 13, 14, 0,
+ 0, 0, 115, 15, 0, 0, 0, 0, 13, 14,
+ 0, 57, 58, 0, 54, 0, 59, 0, 60, 61,
+ 62, 63, 0, 0, 0, 117, 64, 65, 122, 123,
+ 27, 0, 0, 0, 0, 28, 0, 0, 0, 29,
+ 0, 0, 131, 30, 31, 32, 33, 135, 0, 137,
+ 0, 34, 0, 139, 0, 141, 57, 58, 0, 0,
+ 0, 59, 87, 60, 61, 62, 63, 0, 57, 58,
+ 80, 64, 65, 59, 0, 60, 61, 62, 63, 0,
+ 57, 58, 80, 64, 65, 59, 87, 60, 61, 62,
+ 63, 0, 57, 58, 0, 64, 65, 59, 0, 60,
+ 61, 62, 63, 0, -35, -35, 0, 64, 65, -35,
+ 0, 0, 0, -35, -35, 0, 57, 58, 0, -35,
+ -35, 59, 0, 0, 0, 62, 63, 0, 0, 0,
+ 0, 64, 65
};
static const yytype_int16 yycheck[] =
@@ -689,31 +691,33 @@ static const yytype_int16 yycheck[] =
10, 8, 29, 13, 14, 15, 0, 17, 17, 32,
33, 38, 22, 17, 37, 29, 52, 25, 54, 27,
10, 11, 8, 17, 47, 48, 50, 13, 7, 44,
- 40, 39, 40, 30, 31, 21, 7, 45, 8, 38,
- 50, 50, 52, 53, 54, 45, 50, 57, 58, 59,
+ 40, 39, 40, 30, 31, 21, 7, 45, 38, 45,
+ 50, 50, 52, 53, 54, 8, 50, 57, 58, 59,
60, 61, 62, 63, 64, 65, 50, 21, 8, 23,
21, 7, 28, 8, 8, 29, 0, 1, 78, 79,
- 8, 5, 21, 7, 7, 7, 49, 87, 12, 46,
- 14, 15, 0, 1, 18, 19, 20, 5, 46, 7,
- 29, 25, 26, 27, 12, 101, 14, 15, 7, 105,
+ 8, 5, 21, 7, 7, 7, 46, 87, 12, 46,
+ 14, 15, 0, 1, 18, 19, 20, 5, 29, 7,
+ 49, 25, 26, 27, 12, 7, 14, 15, 11, 15,
18, 19, 20, 11, 114, 39, 40, 25, 26, 27,
- 44, 45, 15, 123, 5, 26, 7, 11, 11, 125,
- 15, 39, 40, 5, 130, 7, 44, 45, 134, 26,
- 12, 11, 14, 15, 25, 35, 27, 19, 20, 26,
- -1, -1, -1, 25, 26, 27, -1, -1, 39, 40,
- 16, -1, -1, -1, 45, -1, 108, 39, 40, -1,
- 112, -1, 44, 45, -1, -1, 32, 33, -1, -1,
- -1, 37, 124, 39, 40, 41, 42, 129, -1, 131,
- -1, 47, 48, 135, 8, 137, -1, -1, -1, 13,
- -1, -1, -1, 17, -1, -1, -1, 21, 22, 23,
- 24, 32, 33, -1, -1, 29, 37, 38, 39, 40,
- 41, 42, -1, 32, 33, 46, 47, 48, 37, -1,
- 39, 40, 41, 42, -1, 32, 33, 46, 47, 48,
- 37, 38, 39, 40, 41, 42, -1, 32, 33, -1,
- 47, 48, 37, -1, 39, 40, 41, 42, -1, 32,
- 33, -1, 47, 48, 37, -1, -1, -1, 41, 42,
- -1, 32, 33, -1, 47, 48, 37, -1, -1, -1,
- 41, 42, -1, -1, -1, -1, 47, 48
+ 44, 45, 26, 11, 124, 15, 101, 11, 35, 26,
+ 105, 39, 40, 5, 26, 7, 44, 45, -1, -1,
+ 12, -1, 14, 15, 5, -1, 7, 19, 20, -1,
+ -1, 126, -1, 25, 26, 27, 131, -1, -1, -1,
+ 135, -1, -1, -1, 25, 16, 27, 39, 40, -1,
+ -1, -1, 44, 45, -1, -1, -1, -1, 39, 40,
+ -1, 32, 33, -1, 45, -1, 37, -1, 39, 40,
+ 41, 42, -1, -1, -1, 108, 47, 48, 111, 112,
+ 8, -1, -1, -1, -1, 13, -1, -1, -1, 17,
+ -1, -1, 125, 21, 22, 23, 24, 130, -1, 132,
+ -1, 29, -1, 136, -1, 138, 32, 33, -1, -1,
+ -1, 37, 38, 39, 40, 41, 42, -1, 32, 33,
+ 46, 47, 48, 37, -1, 39, 40, 41, 42, -1,
+ 32, 33, 46, 47, 48, 37, 38, 39, 40, 41,
+ 42, -1, 32, 33, -1, 47, 48, 37, -1, 39,
+ 40, 41, 42, -1, 32, 33, -1, 47, 48, 37,
+ -1, -1, -1, 41, 42, -1, 32, 33, -1, 47,
+ 48, 37, -1, -1, -1, 41, 42, -1, -1, -1,
+ -1, 47, 48
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -732,9 +736,9 @@ static const yytype_uint8 yystos[] =
61, 61, 61, 61, 61, 61, 61, 8, 8, 8,
7, 68, 7, 61, 61, 46, 59, 46, 60, 61,
49, 60, 60, 9, 29, 44, 54, 59, 61, 62,
- 7, 44, 59, 29, 61, 10, 11, 7, 11, 61,
- 59, 60, 15, 26, 59, 60, 59, 60, 59, 11,
- 59, 11, 15, 11, 26, 26
+ 7, 44, 59, 59, 29, 61, 10, 11, 7, 11,
+ 61, 59, 60, 15, 26, 59, 60, 59, 60, 59,
+ 11, 59, 11, 15, 11, 26, 26
};
#define yyerrok (yyerrstatus = 0)
@@ -1850,7 +1854,7 @@ yyreduce:
#line 271 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_procret);
- g_lingo->define(*(yyvsp[(2) - (5)].s), (yyvsp[(4) - (5)].narg));
+ g_lingo->define(*(yyvsp[(2) - (6)].s), (yyvsp[(4) - (6)].narg));
g_lingo->_indef = false; ;}
break;
@@ -1876,7 +1880,7 @@ yyreduce:
/* Line 1267 of yacc.c. */
-#line 1880 "engines/director/lingo/lingo-gr.cpp"
+#line 1884 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 910cd80..c28fe66 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -268,7 +268,7 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
// See also:
// on keyword
defn: tMACRO VAR { g_lingo->_indef = true; }
- arglist stmtlist {
+ arglist stmtlist end {
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$2, $4);
g_lingo->_indef = false; }
Commit: 0f3f6ba7ebefa48071f2ddddc1f1f7febd4242fe
https://github.com/scummvm/scummvm/commit/0f3f6ba7ebefa48071f2ddddc1f1f7febd4242fe
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Initial implementation of the handler define() method
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 8483861..e3d1b16 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -376,8 +376,26 @@ void Lingo::c_gotoprevious() {
warning("STUB: c_gotoprevious()");
}
-void Lingo::define(Common::String &s, int nargs) {
- warning("STUB: define(\"%s\", %d)", s.c_str(), nargs);
+void Lingo::define(Common::String &name, int start, int end, int nargs) {
+ warning("STUB: define(\"%s\", %d, %d, %d)", name.c_str(), start, end, nargs);
+
+ Symbol *sym;
+
+ if (!_handlers.contains(name)) { // Create variable if it was not defined
+ sym = new Symbol;
+
+ delete sym->u.defn;
+
+ _handlers[name] = sym;
+ } else {
+ sym = g_lingo->_handlers[name];
+
+ sym->name = (char *)calloc(name.size() + 1, 1);
+ Common::strlcpy(sym->name, name.c_str(), name.size() + 1);
+ sym->type = HANDLER;
+ }
+
+ sym->u.defn = new ScriptData(&(*_currentScript)[start], end - start + 1);
}
void Lingo::codeArg(Common::String &s) {
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 524330d..3b4d2d8 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -72,35 +72,36 @@
FLOAT = 261,
VAR = 262,
STRING = 263,
- tDOWN = 264,
- tELSE = 265,
- tEND = 266,
- tEXIT = 267,
- tFRAME = 268,
- tGO = 269,
- tIF = 270,
- tINTO = 271,
- tLOOP = 272,
- tMACRO = 273,
- tMCI = 274,
- tMCIWAIT = 275,
- tMOVIE = 276,
- tNEXT = 277,
- tOF = 278,
- tPREVIOUS = 279,
- tPUT = 280,
- tREPEAT = 281,
- tSET = 282,
- tTHEN = 283,
- tTO = 284,
- tWITH = 285,
- tWHILE = 286,
- tGE = 287,
- tLE = 288,
- tGT = 289,
- tLT = 290,
- tEQ = 291,
- tNEQ = 292
+ HANDLER = 264,
+ tDOWN = 265,
+ tELSE = 266,
+ tEND = 267,
+ tEXIT = 268,
+ tFRAME = 269,
+ tGO = 270,
+ tIF = 271,
+ tINTO = 272,
+ tLOOP = 273,
+ tMACRO = 274,
+ tMCI = 275,
+ tMCIWAIT = 276,
+ tMOVIE = 277,
+ tNEXT = 278,
+ tOF = 279,
+ tPREVIOUS = 280,
+ tPUT = 281,
+ tREPEAT = 282,
+ tSET = 283,
+ tTHEN = 284,
+ tTO = 285,
+ tWITH = 286,
+ tWHILE = 287,
+ tGE = 288,
+ tLE = 289,
+ tGT = 290,
+ tLT = 291,
+ tEQ = 292,
+ tNEQ = 293
};
#endif
/* Tokens. */
@@ -110,35 +111,36 @@
#define FLOAT 261
#define VAR 262
#define STRING 263
-#define tDOWN 264
-#define tELSE 265
-#define tEND 266
-#define tEXIT 267
-#define tFRAME 268
-#define tGO 269
-#define tIF 270
-#define tINTO 271
-#define tLOOP 272
-#define tMACRO 273
-#define tMCI 274
-#define tMCIWAIT 275
-#define tMOVIE 276
-#define tNEXT 277
-#define tOF 278
-#define tPREVIOUS 279
-#define tPUT 280
-#define tREPEAT 281
-#define tSET 282
-#define tTHEN 283
-#define tTO 284
-#define tWITH 285
-#define tWHILE 286
-#define tGE 287
-#define tLE 288
-#define tGT 289
-#define tLT 290
-#define tEQ 291
-#define tNEQ 292
+#define HANDLER 264
+#define tDOWN 265
+#define tELSE 266
+#define tEND 267
+#define tEXIT 268
+#define tFRAME 269
+#define tGO 270
+#define tIF 271
+#define tINTO 272
+#define tLOOP 273
+#define tMACRO 274
+#define tMCI 275
+#define tMCIWAIT 276
+#define tMOVIE 277
+#define tNEXT 278
+#define tOF 279
+#define tPREVIOUS 280
+#define tPUT 281
+#define tREPEAT 282
+#define tSET 283
+#define tTHEN 284
+#define tTO 285
+#define tWITH 286
+#define tWHILE 287
+#define tGE 288
+#define tLE 289
+#define tGT 290
+#define tLT 291
+#define tEQ 292
+#define tNEQ 293
@@ -190,7 +192,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 194 "engines/director/lingo/lingo-gr.cpp"
+#line 196 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -203,7 +205,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 207 "engines/director/lingo/lingo-gr.cpp"
+#line 209 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -418,20 +420,20 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 49
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 302
+#define YYLAST 300
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 50
+#define YYNTOKENS 51
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 19
+#define YYNNTS 20
/* YYNRULES -- Number of rules. */
-#define YYNRULES 71
+#define YYNRULES 72
/* YYNRULES -- Number of states. */
-#define YYNSTATES 147
+#define YYNSTATES 148
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 292
+#define YYMAXUTOK 293
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -440,12 +442,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 44, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 45, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 43, 2, 2,
- 45, 46, 41, 39, 49, 40, 2, 42, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 44, 2, 2,
+ 46, 47, 42, 40, 50, 41, 2, 43, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 48, 38, 47, 2, 2, 2, 2, 2, 2, 2,
+ 49, 39, 48, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -468,7 +470,7 @@ static const yytype_uint8 yytranslate[] =
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37
+ 35, 36, 37, 38
};
#if YYDEBUG
@@ -479,42 +481,42 @@ static const yytype_uint8 yyprhs[] =
0, 0, 3, 7, 10, 12, 13, 15, 17, 19,
21, 23, 25, 26, 31, 36, 41, 43, 45, 53,
64, 73, 85, 98, 100, 104, 108, 111, 115, 117,
- 118, 119, 122, 125, 127, 129, 131, 135, 139, 143,
- 147, 151, 155, 159, 163, 167, 170, 173, 177, 180,
- 183, 186, 188, 190, 193, 196, 199, 202, 206, 209,
- 213, 216, 219, 221, 225, 228, 232, 233, 240, 241,
- 243, 247
+ 118, 119, 120, 123, 126, 128, 130, 132, 136, 140,
+ 144, 148, 152, 156, 160, 164, 168, 171, 174, 178,
+ 181, 184, 187, 189, 191, 194, 197, 200, 203, 207,
+ 210, 214, 217, 220, 222, 226, 229, 233, 234, 242,
+ 243, 245, 249
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 51, 0, -1, 52, 44, 51, -1, 52, 51, -1,
- 52, -1, -1, 66, -1, 62, -1, 53, -1, 54,
- -1, 61, -1, 1, -1, -1, 25, 61, 16, 7,
- -1, 27, 7, 38, 61, -1, 27, 7, 29, 61,
- -1, 61, -1, 62, -1, 58, 55, 28, 60, 59,
- 11, 15, -1, 58, 55, 28, 60, 59, 10, 60,
- 59, 11, 15, -1, 56, 45, 55, 46, 60, 59,
- 11, 26, -1, 57, 38, 61, 59, 29, 61, 59,
- 60, 59, 11, 26, -1, 57, 38, 61, 59, 9,
- 29, 61, 59, 60, 59, 11, 26, -1, 61, -1,
- 61, 38, 61, -1, 45, 55, 46, -1, 26, 31,
- -1, 26, 30, 7, -1, 15, -1, -1, -1, 60,
- 44, -1, 60, 54, -1, 5, -1, 7, -1, 53,
- -1, 61, 39, 61, -1, 61, 40, 61, -1, 61,
- 41, 61, -1, 61, 42, 61, -1, 61, 47, 61,
- -1, 61, 48, 61, -1, 61, 37, 61, -1, 61,
- 32, 61, -1, 61, 33, 61, -1, 39, 61, -1,
- 40, 61, -1, 45, 61, 46, -1, 19, 8, -1,
- 20, 7, -1, 25, 61, -1, 63, -1, 12, -1,
- 14, 17, -1, 14, 22, -1, 14, 24, -1, 14,
- 64, -1, 14, 64, 65, -1, 14, 65, -1, 29,
- 13, 8, -1, 13, 8, -1, 29, 8, -1, 8,
- -1, 23, 21, 8, -1, 21, 8, -1, 29, 21,
- 8, -1, -1, 18, 7, 67, 68, 60, 59, -1,
- -1, 7, -1, 68, 49, 7, -1, 68, 49, 44,
- 7, -1
+ 52, 0, -1, 53, 45, 52, -1, 53, 52, -1,
+ 53, -1, -1, 68, -1, 64, -1, 54, -1, 55,
+ -1, 63, -1, 1, -1, -1, 26, 63, 17, 7,
+ -1, 28, 7, 39, 63, -1, 28, 7, 30, 63,
+ -1, 63, -1, 64, -1, 59, 56, 29, 62, 61,
+ 12, 16, -1, 59, 56, 29, 62, 61, 11, 62,
+ 61, 12, 16, -1, 57, 46, 56, 47, 62, 61,
+ 12, 27, -1, 58, 39, 63, 61, 30, 63, 61,
+ 62, 61, 12, 27, -1, 58, 39, 63, 61, 10,
+ 30, 63, 61, 62, 61, 12, 27, -1, 63, -1,
+ 63, 39, 63, -1, 46, 56, 47, -1, 27, 32,
+ -1, 27, 31, 7, -1, 16, -1, -1, -1, -1,
+ 62, 45, -1, 62, 55, -1, 5, -1, 7, -1,
+ 54, -1, 63, 40, 63, -1, 63, 41, 63, -1,
+ 63, 42, 63, -1, 63, 43, 63, -1, 63, 48,
+ 63, -1, 63, 49, 63, -1, 63, 38, 63, -1,
+ 63, 33, 63, -1, 63, 34, 63, -1, 40, 63,
+ -1, 41, 63, -1, 46, 63, 47, -1, 20, 8,
+ -1, 21, 7, -1, 26, 63, -1, 65, -1, 13,
+ -1, 15, 18, -1, 15, 23, -1, 15, 25, -1,
+ 15, 66, -1, 15, 66, 67, -1, 15, 67, -1,
+ 30, 14, 8, -1, 14, 8, -1, 30, 8, -1,
+ 8, -1, 24, 22, 8, -1, 22, 8, -1, 30,
+ 22, 8, -1, -1, 19, 7, 69, 60, 70, 62,
+ 61, -1, -1, 7, -1, 70, 50, 7, -1, 70,
+ 50, 45, 7, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -523,11 +525,11 @@ static const yytype_uint16 yyrline[] =
0, 92, 92, 93, 94, 97, 98, 99, 100, 101,
102, 103, 104, 107, 108, 109, 112, 113, 114, 120,
132, 143, 159, 173, 174, 175, 177, 179, 185, 187,
- 189, 190, 191, 194, 195, 196, 197, 198, 199, 200,
- 201, 202, 203, 204, 205, 206, 207, 208, 211, 212,
- 213, 214, 215, 226, 227, 228, 229, 230, 231, 234,
- 235, 236, 237, 240, 241, 242, 270, 270, 276, 277,
- 278, 279
+ 189, 191, 192, 193, 196, 197, 198, 199, 200, 201,
+ 202, 203, 204, 205, 206, 207, 208, 209, 210, 213,
+ 214, 215, 216, 217, 228, 229, 230, 231, 232, 233,
+ 236, 237, 238, 239, 242, 243, 244, 272, 272, 278,
+ 279, 280, 281
};
#endif
@@ -537,14 +539,14 @@ static const yytype_uint16 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "UNARY", "VOID", "INT", "FLOAT", "VAR",
- "STRING", "tDOWN", "tELSE", "tEND", "tEXIT", "tFRAME", "tGO", "tIF",
- "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF",
- "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH",
+ "STRING", "HANDLER", "tDOWN", "tELSE", "tEND", "tEXIT", "tFRAME", "tGO",
+ "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT",
+ "tOF", "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH",
"tWHILE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'",
"'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "','",
"$accept", "program", "programline", "asgn", "stmt", "cond",
- "repeatwhile", "repeatwith", "if", "end", "stmtlist", "expr", "func",
- "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "arglist", 0
+ "repeatwhile", "repeatwith", "if", "begin", "end", "stmtlist", "expr",
+ "func", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "argdef", 0
};
#endif
@@ -556,22 +558,23 @@ static const yytype_uint16 yytoknum[] =
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 287, 288, 289, 290, 291, 292, 61, 43,
- 45, 42, 47, 37, 10, 40, 41, 62, 60, 44
+ 285, 286, 287, 288, 289, 290, 291, 292, 293, 61,
+ 43, 45, 42, 47, 37, 10, 40, 41, 62, 60,
+ 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 50, 51, 51, 51, 52, 52, 52, 52, 52,
- 52, 52, 52, 53, 53, 53, 54, 54, 54, 54,
- 54, 54, 54, 55, 55, 55, 56, 57, 58, 59,
- 60, 60, 60, 61, 61, 61, 61, 61, 61, 61,
- 61, 61, 61, 61, 61, 61, 61, 61, 62, 62,
- 62, 62, 62, 63, 63, 63, 63, 63, 63, 64,
- 64, 64, 64, 65, 65, 65, 67, 66, 68, 68,
- 68, 68
+ 0, 51, 52, 52, 52, 53, 53, 53, 53, 53,
+ 53, 53, 53, 54, 54, 54, 55, 55, 55, 55,
+ 55, 55, 55, 56, 56, 56, 57, 58, 59, 60,
+ 61, 62, 62, 62, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 66, 66, 66, 66, 67, 67, 67, 69, 68, 70,
+ 70, 70, 70
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -580,11 +583,11 @@ static const yytype_uint8 yyr2[] =
0, 2, 3, 2, 1, 0, 1, 1, 1, 1,
1, 1, 0, 4, 4, 4, 1, 1, 7, 10,
8, 11, 12, 1, 3, 3, 2, 3, 1, 0,
- 0, 2, 2, 1, 1, 1, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 2, 2, 3, 2, 2,
- 2, 1, 1, 2, 2, 2, 2, 3, 2, 3,
- 2, 2, 1, 3, 2, 3, 0, 6, 0, 1,
- 3, 4
+ 0, 0, 2, 2, 1, 1, 1, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 2, 2, 3, 2,
+ 2, 2, 1, 1, 2, 2, 2, 2, 3, 2,
+ 3, 2, 2, 1, 3, 2, 3, 0, 7, 0,
+ 1, 3, 4
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -592,153 +595,153 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 33, 34, 52, 0, 28, 0, 0, 0,
+ 0, 11, 34, 35, 53, 0, 28, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 8, 9,
- 0, 0, 0, 10, 7, 51, 6, 62, 0, 53,
- 0, 54, 0, 55, 0, 56, 58, 66, 48, 49,
- 0, 35, 50, 0, 26, 0, 45, 46, 0, 1,
+ 0, 0, 0, 10, 7, 52, 6, 63, 0, 54,
+ 0, 55, 0, 56, 0, 57, 59, 67, 49, 50,
+ 0, 36, 51, 0, 26, 0, 46, 47, 0, 1,
0, 3, 0, 0, 0, 0, 23, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 60, 64, 0, 61,
- 0, 0, 0, 57, 68, 0, 0, 27, 0, 0,
- 47, 2, 0, 29, 0, 0, 30, 0, 43, 44,
- 42, 36, 37, 38, 39, 40, 41, 63, 59, 65,
- 69, 30, 13, 15, 14, 30, 0, 25, 29, 24,
- 0, 29, 29, 0, 0, 31, 32, 0, 16, 17,
- 70, 0, 67, 0, 0, 29, 30, 0, 71, 0,
- 29, 30, 29, 18, 20, 30, 29, 0, 29, 0,
- 0, 0, 0, 19, 0, 21, 22
+ 0, 0, 0, 0, 0, 0, 61, 65, 0, 62,
+ 0, 0, 0, 58, 29, 0, 0, 27, 0, 0,
+ 48, 2, 0, 30, 0, 0, 31, 0, 44, 45,
+ 43, 37, 38, 39, 40, 41, 42, 64, 60, 66,
+ 69, 13, 15, 14, 31, 0, 25, 30, 24, 70,
+ 31, 30, 0, 0, 32, 33, 0, 16, 17, 0,
+ 30, 0, 0, 30, 31, 0, 71, 0, 68, 0,
+ 30, 31, 30, 18, 72, 20, 31, 30, 0, 30,
+ 0, 0, 0, 0, 19, 0, 21, 22
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 16, 17, 41, 116, 55, 20, 21, 22, 106,
- 108, 118, 119, 25, 35, 36, 26, 74, 101
+ -1, 16, 17, 41, 115, 55, 20, 21, 22, 100,
+ 105, 107, 117, 118, 25, 35, 36, 26, 74, 110
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -27
+#define YYPACT_NINF -34
static const yytype_int16 yypact[] =
{
- 76, -27, -27, -27, -27, 192, -27, -3, 3, 31,
- 2, 13, 39, 2, 2, 2, 8, 92, 242, -27,
- 4, 10, 139, 230, -27, -27, -27, -27, 47, -27,
- 60, -27, 49, -27, 24, 46, -27, -27, -27, -27,
- 2, -27, 149, 64, -27, -17, -13, -13, 206, -27,
- 76, -27, 139, 2, 139, 44, 218, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, -27, -27, 65, -27,
- 66, 72, 61, -27, 77, 149, 78, -27, 2, 2,
- -27, -27, 40, 230, 43, 194, -27, 2, 230, 230,
- 230, 254, 254, -13, -13, 230, 230, -27, -27, -27,
- -27, 51, -27, 230, 230, -27, -4, -27, 128, 230,
- -5, 128, 128, 69, 2, -27, -27, 20, 230, -27,
- -27, 98, -27, 97, 2, 230, -27, 94, -27, 96,
- 230, -27, 128, -27, -27, -27, 128, 102, 128, 112,
- 110, 116, 103, -27, 108, -27, -27
+ 69, -34, -34, -34, -34, 198, -34, -3, 24, 5,
+ -2, 15, 12, -2, -2, -2, 8, 111, 239, -34,
+ -12, 33, 2, 227, -34, -34, -34, -34, 28, -34,
+ 47, -34, 58, -34, 23, 51, -34, -34, -34, -34,
+ -2, -34, 162, 76, -34, -10, 87, 87, 203, -34,
+ 69, -34, 2, -2, 2, 57, 215, -2, -2, -2,
+ -2, -2, -2, -2, -2, -2, -34, -34, 84, -34,
+ 85, 86, 77, -34, -34, 162, 93, -34, -2, -2,
+ -34, -34, 54, 227, 55, 191, -34, -2, 227, 227,
+ 227, 251, 251, 87, 87, 227, 227, -34, -34, -34,
+ 97, -34, 227, 227, -34, 11, -34, 148, 227, -34,
+ 67, 148, 75, -2, -34, -34, 56, 227, -34, 4,
+ 148, 94, -2, 227, -34, 91, -34, 101, -34, 92,
+ 227, -34, 148, -34, -34, -34, -34, 148, 116, 148,
+ 117, 107, 121, 113, -34, 114, -34, -34
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -27, -14, -27, 1, 6, -26, -27, -27, -27, 87,
- 25, 0, 16, -27, -27, 93, -27, -27, -27
+ -34, -15, -34, 1, 6, -27, -34, -34, -34, -34,
+ 60, -33, 0, 16, -34, -34, 99, -34, -34, -34
};
/* 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 -36
+#define YYTABLE_NINF -37
static const yytype_int16 yytable[] =
{
- 23, 18, 120, 51, 37, 113, 19, 2, 49, 3,
- 42, 38, 78, 46, 47, 48, 24, 23, 18, 57,
- 58, 79, 56, 19, 59, 114, 82, 40, 84, 12,
- 126, 127, 69, 24, 64, 65, 81, 70, 39, 121,
- 75, 13, 14, 43, 44, 71, 45, 15, 53, 52,
- 23, 18, 56, 83, 85, 66, 19, 88, 89, 90,
- 91, 92, 93, 94, 95, 96, 24, 30, 67, 32,
- 68, 77, 86, 97, 98, 72, -5, 1, 103, 104,
- 99, 2, 71, 3, 100, 102, 105, 109, 4, 107,
- 5, 6, -4, 1, 7, 8, 9, 2, 124, 3,
- 110, 10, 11, 12, 4, 128, 5, 6, 129, 133,
- 7, 8, 9, 140, 125, 13, 14, 10, 11, 12,
- -5, 15, 134, 142, 130, 143, 111, 144, 73, 145,
- 112, 13, 14, 2, 146, 3, 50, 15, 0, 0,
- 4, 0, 5, 6, 2, 0, 3, 8, 9, 0,
- 0, 132, 0, 10, 11, 12, 136, 0, 0, 0,
- 138, 0, 0, 0, 40, 76, 12, 13, 14, 0,
- 0, 0, 115, 15, 0, 0, 0, 0, 13, 14,
- 0, 57, 58, 0, 54, 0, 59, 0, 60, 61,
- 62, 63, 0, 0, 0, 117, 64, 65, 122, 123,
- 27, 0, 0, 0, 0, 28, 0, 0, 0, 29,
- 0, 0, 131, 30, 31, 32, 33, 135, 0, 137,
- 0, 34, 0, 139, 0, 141, 57, 58, 0, 0,
- 0, 59, 87, 60, 61, 62, 63, 0, 57, 58,
- 80, 64, 65, 59, 0, 60, 61, 62, 63, 0,
- 57, 58, 80, 64, 65, 59, 87, 60, 61, 62,
- 63, 0, 57, 58, 0, 64, 65, 59, 0, 60,
- 61, 62, 63, 0, -35, -35, 0, 64, 65, -35,
- 0, 0, 0, -35, -35, 0, 57, 58, 0, -35,
- -35, 59, 0, 0, 0, 62, 63, 0, 0, 0,
- 0, 64, 65
+ 23, 18, 51, 2, 37, 3, 19, 2, 49, 3,
+ 42, 126, 39, 46, 47, 48, 24, 23, 18, 45,
+ 78, 112, 56, 19, 40, 82, 12, 84, 40, 79,
+ 12, 69, 38, 24, 52, 81, 66, 70, 13, 14,
+ 75, 113, 13, 14, 15, 71, 43, 44, 54, 127,
+ 23, 18, 56, 83, 85, 67, 19, 88, 89, 90,
+ 91, 92, 93, 94, 95, 96, 24, 124, 125, -5,
+ 1, 111, 53, 30, 2, 32, 3, 120, 102, 103,
+ 68, 72, 4, 77, 5, 6, 86, 108, 7, 8,
+ 9, 132, 97, 98, 99, 10, 11, 12, 137, 71,
+ 101, 104, 106, 139, 109, 122, 129, 133, 134, 13,
+ 14, -4, 1, 123, -5, 15, 2, 119, 3, 135,
+ 57, 58, 130, 144, 4, 59, 5, 6, 141, 143,
+ 7, 8, 9, 145, 73, 64, 65, 10, 11, 12,
+ 146, 147, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 13, 14, 2, 0, 3, 50, 15, 0, 0,
+ 0, 4, 0, 5, 6, 0, 0, 116, 8, 9,
+ 0, 121, 0, 0, 10, 11, 12, 0, 0, 76,
+ 128, 0, 0, 131, 0, 0, 0, 0, 13, 14,
+ 136, 0, 138, 114, 15, 57, 58, 140, 0, 142,
+ 59, 0, 60, 61, 62, 63, 27, 0, 0, 0,
+ 64, 65, 28, 0, 0, 0, 29, 0, 0, 0,
+ 30, 31, 32, 33, 57, 58, 0, 0, 34, 59,
+ 87, 60, 61, 62, 63, 0, 57, 58, 80, 64,
+ 65, 59, 0, 60, 61, 62, 63, 0, 57, 58,
+ 80, 64, 65, 59, 87, 60, 61, 62, 63, 0,
+ 57, 58, 0, 64, 65, 59, 0, 60, 61, 62,
+ 63, 0, -36, -36, 0, 64, 65, -36, 0, 0,
+ 0, -36, -36, 0, 57, 58, 0, -36, -36, 59,
+ 0, 0, 0, 62, 63, 0, 0, 0, 0, 64,
+ 65
};
static const yytype_int16 yycheck[] =
{
- 0, 0, 7, 17, 7, 9, 0, 5, 0, 7,
- 10, 8, 29, 13, 14, 15, 0, 17, 17, 32,
- 33, 38, 22, 17, 37, 29, 52, 25, 54, 27,
- 10, 11, 8, 17, 47, 48, 50, 13, 7, 44,
- 40, 39, 40, 30, 31, 21, 7, 45, 38, 45,
+ 0, 0, 17, 5, 7, 7, 0, 5, 0, 7,
+ 10, 7, 7, 13, 14, 15, 0, 17, 17, 7,
+ 30, 10, 22, 17, 26, 52, 28, 54, 26, 39,
+ 28, 8, 8, 17, 46, 50, 8, 14, 40, 41,
+ 40, 30, 40, 41, 46, 22, 31, 32, 46, 45,
50, 50, 52, 53, 54, 8, 50, 57, 58, 59,
- 60, 61, 62, 63, 64, 65, 50, 21, 8, 23,
- 21, 7, 28, 8, 8, 29, 0, 1, 78, 79,
- 8, 5, 21, 7, 7, 7, 46, 87, 12, 46,
- 14, 15, 0, 1, 18, 19, 20, 5, 29, 7,
- 49, 25, 26, 27, 12, 7, 14, 15, 11, 15,
- 18, 19, 20, 11, 114, 39, 40, 25, 26, 27,
- 44, 45, 26, 11, 124, 15, 101, 11, 35, 26,
- 105, 39, 40, 5, 26, 7, 44, 45, -1, -1,
- 12, -1, 14, 15, 5, -1, 7, 19, 20, -1,
- -1, 126, -1, 25, 26, 27, 131, -1, -1, -1,
- 135, -1, -1, -1, 25, 16, 27, 39, 40, -1,
- -1, -1, 44, 45, -1, -1, -1, -1, 39, 40,
- -1, 32, 33, -1, 45, -1, 37, -1, 39, 40,
- 41, 42, -1, -1, -1, 108, 47, 48, 111, 112,
- 8, -1, -1, -1, -1, 13, -1, -1, -1, 17,
- -1, -1, 125, 21, 22, 23, 24, 130, -1, 132,
- -1, 29, -1, 136, -1, 138, 32, 33, -1, -1,
- -1, 37, 38, 39, 40, 41, 42, -1, 32, 33,
- 46, 47, 48, 37, -1, 39, 40, 41, 42, -1,
- 32, 33, 46, 47, 48, 37, 38, 39, 40, 41,
- 42, -1, 32, 33, -1, 47, 48, 37, -1, 39,
- 40, 41, 42, -1, 32, 33, -1, 47, 48, 37,
- -1, -1, -1, 41, 42, -1, 32, 33, -1, 47,
- 48, 37, -1, -1, -1, 41, 42, -1, -1, -1,
- -1, 47, 48
+ 60, 61, 62, 63, 64, 65, 50, 11, 12, 0,
+ 1, 104, 39, 22, 5, 24, 7, 110, 78, 79,
+ 22, 30, 13, 7, 15, 16, 29, 87, 19, 20,
+ 21, 124, 8, 8, 8, 26, 27, 28, 131, 22,
+ 7, 47, 47, 136, 7, 30, 12, 16, 7, 40,
+ 41, 0, 1, 113, 45, 46, 5, 50, 7, 27,
+ 33, 34, 122, 16, 13, 38, 15, 16, 12, 12,
+ 19, 20, 21, 12, 35, 48, 49, 26, 27, 28,
+ 27, 27, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 40, 41, 5, -1, 7, 45, 46, -1, -1,
+ -1, 13, -1, 15, 16, -1, -1, 107, 20, 21,
+ -1, 111, -1, -1, 26, 27, 28, -1, -1, 17,
+ 120, -1, -1, 123, -1, -1, -1, -1, 40, 41,
+ 130, -1, 132, 45, 46, 33, 34, 137, -1, 139,
+ 38, -1, 40, 41, 42, 43, 8, -1, -1, -1,
+ 48, 49, 14, -1, -1, -1, 18, -1, -1, -1,
+ 22, 23, 24, 25, 33, 34, -1, -1, 30, 38,
+ 39, 40, 41, 42, 43, -1, 33, 34, 47, 48,
+ 49, 38, -1, 40, 41, 42, 43, -1, 33, 34,
+ 47, 48, 49, 38, 39, 40, 41, 42, 43, -1,
+ 33, 34, -1, 48, 49, 38, -1, 40, 41, 42,
+ 43, -1, 33, 34, -1, 48, 49, 38, -1, -1,
+ -1, 42, 43, -1, 33, 34, -1, 48, 49, 38,
+ -1, -1, -1, 42, 43, -1, -1, -1, -1, 48,
+ 49
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 5, 7, 12, 14, 15, 18, 19, 20,
- 25, 26, 27, 39, 40, 45, 51, 52, 53, 54,
- 56, 57, 58, 61, 62, 63, 66, 8, 13, 17,
- 21, 22, 23, 24, 29, 64, 65, 7, 8, 7,
- 25, 53, 61, 30, 31, 7, 61, 61, 61, 0,
- 44, 51, 45, 38, 45, 55, 61, 32, 33, 37,
- 39, 40, 41, 42, 47, 48, 8, 8, 21, 8,
- 13, 21, 29, 65, 67, 61, 16, 7, 29, 38,
- 46, 51, 55, 61, 55, 61, 28, 38, 61, 61,
- 61, 61, 61, 61, 61, 61, 61, 8, 8, 8,
- 7, 68, 7, 61, 61, 46, 59, 46, 60, 61,
- 49, 60, 60, 9, 29, 44, 54, 59, 61, 62,
- 7, 44, 59, 59, 29, 61, 10, 11, 7, 11,
- 61, 59, 60, 15, 26, 59, 60, 59, 60, 59,
- 11, 59, 11, 15, 11, 26, 26
+ 0, 1, 5, 7, 13, 15, 16, 19, 20, 21,
+ 26, 27, 28, 40, 41, 46, 52, 53, 54, 55,
+ 57, 58, 59, 63, 64, 65, 68, 8, 14, 18,
+ 22, 23, 24, 25, 30, 66, 67, 7, 8, 7,
+ 26, 54, 63, 31, 32, 7, 63, 63, 63, 0,
+ 45, 52, 46, 39, 46, 56, 63, 33, 34, 38,
+ 40, 41, 42, 43, 48, 49, 8, 8, 22, 8,
+ 14, 22, 30, 67, 69, 63, 17, 7, 30, 39,
+ 47, 52, 56, 63, 56, 63, 29, 39, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 8, 8, 8,
+ 60, 7, 63, 63, 47, 61, 47, 62, 63, 7,
+ 70, 62, 10, 30, 45, 55, 61, 63, 64, 50,
+ 62, 61, 30, 63, 11, 12, 7, 45, 61, 12,
+ 63, 61, 62, 16, 7, 27, 61, 62, 61, 62,
+ 61, 12, 61, 12, 16, 12, 27, 27
};
#define yyerrok (yyerrstatus = 0)
@@ -1682,205 +1685,210 @@ yyreduce:
case 29:
#line 187 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
+ { (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 30:
#line 189 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->_currentScript->size(); ;}
+ { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 33:
-#line 194 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->code1(g_lingo->c_constpush); inst i = 0; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); g_lingo->code1(i); ;}
+ case 31:
+#line 191 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 34:
-#line 195 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;}
+#line 196 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = g_lingo->code1(g_lingo->c_constpush); inst i = 0; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); g_lingo->code1(i); ;}
break;
- case 36:
+ case 35:
#line 197 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_add); ;}
+ { (yyval.code) = g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;}
break;
case 37:
-#line 198 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_sub); ;}
+#line 199 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_add); ;}
break;
case 38:
-#line 199 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_mul); ;}
+#line 200 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_sub); ;}
break;
case 39:
-#line 200 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_div); ;}
+#line 201 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_mul); ;}
break;
case 40:
-#line 201 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gt); ;}
+#line 202 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_div); ;}
break;
case 41:
-#line 202 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_lt); ;}
+#line 203 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gt); ;}
break;
case 42:
-#line 203 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_neq); ;}
+#line 204 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_lt); ;}
break;
case 43:
-#line 204 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_ge); ;}
+#line 205 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_neq); ;}
break;
case 44:
-#line 205 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_le); ;}
+#line 206 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_ge); ;}
break;
case 45:
-#line 206 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+#line 207 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_le); ;}
break;
case 46:
-#line 207 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
+#line 208 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 47:
-#line 208 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+#line 209 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 48:
-#line 211 "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); ;}
+#line 210 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 49:
-#line 212 "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); ;}
+#line 213 "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 50:
-#line 213 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_printtop); ;}
+#line 214 "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 52:
+ case 51:
#line 215 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_exit); ;}
+ { g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 53:
-#line 226 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoloop); ;}
+#line 217 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_exit); ;}
break;
case 54:
-#line 227 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotonext); ;}
+#line 228 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 55:
-#line 228 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoprevious); ;}
+#line 229 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 56:
-#line 229 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
+#line 230 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 57:
-#line 230 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
+#line 231 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
break;
case 58:
-#line 231 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+#line 232 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
break;
case 59:
-#line 234 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 233 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 60:
-#line 235 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+#line 236 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 61:
-#line 236 "engines/director/lingo/lingo-gr.y"
+#line 237 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 62:
-#line 237 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+#line 238 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 63:
-#line 240 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 239 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 64:
-#line 241 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+#line 242 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 65:
-#line 242 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 243 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 66:
-#line 270 "engines/director/lingo/lingo-gr.y"
- { g_lingo->_indef = true; ;}
+#line 244 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 67:
-#line 271 "engines/director/lingo/lingo-gr.y"
+#line 272 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->_indef = true; ;}
+ break;
+
+ case 68:
+#line 273 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_procret);
- g_lingo->define(*(yyvsp[(2) - (6)].s), (yyvsp[(4) - (6)].narg));
+ g_lingo->define(*(yyvsp[(2) - (7)].s), (yyvsp[(4) - (7)].code), (yyvsp[(7) - (7)].code), (yyvsp[(5) - (7)].narg));
g_lingo->_indef = false; ;}
break;
- case 68:
-#line 276 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 278 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 69:
-#line 277 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 279 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); (yyval.narg) = 1; ;}
break;
- case 70:
-#line 278 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 280 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(3) - (3)].s)); delete (yyvsp[(3) - (3)].s); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 71:
-#line 279 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 281 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(4) - (4)].s)); delete (yyvsp[(4) - (4)].s); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 1884 "engines/director/lingo/lingo-gr.cpp"
+#line 1892 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2094,6 +2102,6 @@ yyreturn:
}
-#line 283 "engines/director/lingo/lingo-gr.y"
+#line 285 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index b590192..3232523 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -45,35 +45,36 @@
FLOAT = 261,
VAR = 262,
STRING = 263,
- tDOWN = 264,
- tELSE = 265,
- tEND = 266,
- tEXIT = 267,
- tFRAME = 268,
- tGO = 269,
- tIF = 270,
- tINTO = 271,
- tLOOP = 272,
- tMACRO = 273,
- tMCI = 274,
- tMCIWAIT = 275,
- tMOVIE = 276,
- tNEXT = 277,
- tOF = 278,
- tPREVIOUS = 279,
- tPUT = 280,
- tREPEAT = 281,
- tSET = 282,
- tTHEN = 283,
- tTO = 284,
- tWITH = 285,
- tWHILE = 286,
- tGE = 287,
- tLE = 288,
- tGT = 289,
- tLT = 290,
- tEQ = 291,
- tNEQ = 292
+ HANDLER = 264,
+ tDOWN = 265,
+ tELSE = 266,
+ tEND = 267,
+ tEXIT = 268,
+ tFRAME = 269,
+ tGO = 270,
+ tIF = 271,
+ tINTO = 272,
+ tLOOP = 273,
+ tMACRO = 274,
+ tMCI = 275,
+ tMCIWAIT = 276,
+ tMOVIE = 277,
+ tNEXT = 278,
+ tOF = 279,
+ tPREVIOUS = 280,
+ tPUT = 281,
+ tREPEAT = 282,
+ tSET = 283,
+ tTHEN = 284,
+ tTO = 285,
+ tWITH = 286,
+ tWHILE = 287,
+ tGE = 288,
+ tLE = 289,
+ tGT = 290,
+ tLT = 291,
+ tEQ = 292,
+ tNEQ = 293
};
#endif
/* Tokens. */
@@ -83,35 +84,36 @@
#define FLOAT 261
#define VAR 262
#define STRING 263
-#define tDOWN 264
-#define tELSE 265
-#define tEND 266
-#define tEXIT 267
-#define tFRAME 268
-#define tGO 269
-#define tIF 270
-#define tINTO 271
-#define tLOOP 272
-#define tMACRO 273
-#define tMCI 274
-#define tMCIWAIT 275
-#define tMOVIE 276
-#define tNEXT 277
-#define tOF 278
-#define tPREVIOUS 279
-#define tPUT 280
-#define tREPEAT 281
-#define tSET 282
-#define tTHEN 283
-#define tTO 284
-#define tWITH 285
-#define tWHILE 286
-#define tGE 287
-#define tLE 288
-#define tGT 289
-#define tLT 290
-#define tEQ 291
-#define tNEQ 292
+#define HANDLER 264
+#define tDOWN 265
+#define tELSE 266
+#define tEND 267
+#define tEXIT 268
+#define tFRAME 269
+#define tGO 270
+#define tIF 271
+#define tINTO 272
+#define tLOOP 273
+#define tMACRO 274
+#define tMCI 275
+#define tMCIWAIT 276
+#define tMOVIE 277
+#define tNEXT 278
+#define tOF 279
+#define tPREVIOUS 280
+#define tPUT 281
+#define tREPEAT 282
+#define tSET 283
+#define tTHEN 284
+#define tTO 285
+#define tWITH 286
+#define tWHILE 287
+#define tGE 288
+#define tLE 289
+#define tGT 290
+#define tLT 291
+#define tEQ 292
+#define tNEQ 293
@@ -127,7 +129,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 131 "engines/director/lingo/lingo-gr.hpp"
+#line 133 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index c28fe66..8fdf825 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -73,14 +73,14 @@ using namespace Director;
%token UNARY VOID
%token<i> INT
%token<f> FLOAT
-%token<s> VAR STRING
+%token<s> VAR STRING HANDLER
%token tDOWN tELSE tEND tEXIT tFRAME tGO tIF tINTO tLOOP tMACRO tMCI tMCIWAIT
%token tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO tWITH tWHILE
%token tGE tLE tGT tLT tEQ tNEQ
-%type<code> asgn cond end expr if repeatwhile repeatwith stmtlist
+%type<code> asgn begin cond end expr if repeatwhile repeatwith stmtlist
%type<s> gotoframe gotomovie
-%type<narg> arglist
+%type<narg> argdef
%right '='
%left '+' '-'
@@ -184,6 +184,8 @@ repeatwith: tREPEAT tWITH VAR {
;
if: tIF { $$ = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); }
;
+begin: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
+ ;
end: /* nothing */ { g_lingo->code1(STOP); $$ = g_lingo->_currentScript->size(); }
;
stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
@@ -268,15 +270,15 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
// See also:
// on keyword
defn: tMACRO VAR { g_lingo->_indef = true; }
- arglist stmtlist end {
+ begin argdef stmtlist end {
g_lingo->code1(g_lingo->c_procret);
- g_lingo->define(*$2, $4);
+ g_lingo->define(*$2, $4, $7, $5);
g_lingo->_indef = false; }
;
-arglist: /* nothing */ { $$ = 0; }
+argdef: /* nothing */ { $$ = 0; }
| VAR { g_lingo->codeArg(*$1); delete $1; $$ = 1; }
- | arglist ',' VAR { g_lingo->codeArg(*$3); delete $3; $$ = $1 + 1; }
- | arglist ',' '\n' VAR { g_lingo->codeArg(*$4); delete $4; $$ = $1 + 1; }
+ | argdef ',' VAR { g_lingo->codeArg(*$3); delete $3; $$ = $1 + 1; }
+ | argdef ',' '\n' VAR { g_lingo->codeArg(*$4); delete $4; $$ = $1 + 1; }
;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index c4b720c..519b914 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -73,13 +73,15 @@ enum LEvent {
typedef void (*inst)(void);
#define STOP (inst)0
+typedef Common::Array<inst> ScriptData;
+
typedef struct Symbol { /* symbol table entry */
char *name;
long type;
union {
int val; /* VAR */
float fval; /* FLOAT */
- inst *defn; /* FUNCTION, PROCEDURE */
+ ScriptData *defn; /* FUNCTION, PROCEDURE */
char *str; /* STRING */
} u;
@@ -93,9 +95,9 @@ typedef union Datum { /* interpreter stack type */
Datum() { val = 0; sym = NULL; }
} Datum;
-typedef Common::Array<inst> ScriptData;
typedef Common::HashMap<int32, ScriptData *> ScriptHash;
typedef Common::Array<Datum> StackData;
+typedef Common::HashMap<Common::String, Symbol *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> SymbolHash;
class Lingo {
public:
@@ -120,7 +122,7 @@ public:
public:
void execute(int pc);
Symbol *lookupVar(const char *name);
- void define(Common::String &s, int nargs);
+ void define(Common::String &s, int start, int end, int nargs);
void codeArg(Common::String &s);
static void c_xpop();
@@ -173,7 +175,8 @@ private:
ScriptHash _scripts[kMaxScriptType + 1];
- Common::HashMap<Common::String, Symbol *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _vars;
+ SymbolHash _vars;
+ SymbolHash _handlers;
int _pc;
Commit: 61e80e158b48d84234c16304f8c3aeb76fd6e7b7
https://github.com/scummvm/scummvm/commit/61e80e158b48d84234c16304f8c3aeb76fd6e7b7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Made the unassigned variable match the original
Changed paths:
engines/director/lingo/lingo-code.cpp
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index e3d1b16..d1240ec 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -141,7 +141,7 @@ bool Lingo::verify(Symbol *s) {
}
if (s->type == VOID) {
- warning("undefined variable '%s'", s->name);
+ warning("Variable used before assigning a value '%s'", s->name);
return false;
}
Commit: 2451bed12822cd1996d616dc5c296cff5aecbcde
https://github.com/scummvm/scummvm/commit/2451bed12822cd1996d616dc5c296cff5aecbcde
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Renamed VAR->ID in the grammar for clarity
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index d1240ec..7a3c8c8 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -123,18 +123,18 @@ void Lingo::c_assign() {
d1 = g_lingo->pop();
d2 = g_lingo->pop();
- if (d1.sym->type != VAR && d1.sym->type != VOID) {
+ if (d1.sym->type != INT && d1.sym->type != VOID) {
warning("assignment to non-variable '%s'", d1.sym->name);
return;
}
d1.sym->u.val = d2.val;
- d1.sym->type = VAR;
+ d1.sym->type = INT;
g_lingo->push(d2);
}
bool Lingo::verify(Symbol *s) {
- if (s->type != VAR && s->type != VOID) {
+ if (s->type != INT && s->type != VOID) {
warning("attempt to evaluate non-variable '%s'", s->name);
return false;
@@ -290,7 +290,7 @@ void Lingo::c_repeatwithcode(void) {
g_lingo->execute(init); /* condition */
d = g_lingo->pop();
counter->u.val = d.val;
- counter->type = VAR;
+ counter->type = INT;
while (true) {
g_lingo->execute(body); /* body */
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 3b4d2d8..a02ba17 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -70,7 +70,7 @@
VOID = 259,
INT = 260,
FLOAT = 261,
- VAR = 262,
+ ID = 262,
STRING = 263,
HANDLER = 264,
tDOWN = 265,
@@ -109,7 +109,7 @@
#define VOID 259
#define INT 260
#define FLOAT 261
-#define VAR 262
+#define ID 262
#define STRING 263
#define HANDLER 264
#define tDOWN 265
@@ -525,11 +525,11 @@ static const yytype_uint16 yyrline[] =
0, 92, 92, 93, 94, 97, 98, 99, 100, 101,
102, 103, 104, 107, 108, 109, 112, 113, 114, 120,
132, 143, 159, 173, 174, 175, 177, 179, 185, 187,
- 189, 191, 192, 193, 196, 197, 198, 199, 200, 201,
- 202, 203, 204, 205, 206, 207, 208, 209, 210, 213,
- 214, 215, 216, 217, 228, 229, 230, 231, 232, 233,
- 236, 237, 238, 239, 242, 243, 244, 272, 272, 278,
- 279, 280, 281
+ 189, 191, 192, 193, 196, 201, 206, 207, 208, 209,
+ 210, 211, 212, 213, 214, 215, 216, 217, 218, 221,
+ 222, 223, 224, 225, 236, 237, 238, 239, 240, 241,
+ 244, 245, 246, 247, 250, 251, 252, 280, 280, 286,
+ 287, 288, 289
};
#endif
@@ -538,7 +538,7 @@ static const yytype_uint16 yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "UNARY", "VOID", "INT", "FLOAT", "VAR",
+ "$end", "error", "$undefined", "UNARY", "VOID", "INT", "FLOAT", "ID",
"STRING", "HANDLER", "tDOWN", "tELSE", "tEND", "tEXIT", "tFRAME", "tGO",
"tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT",
"tOF", "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH",
@@ -1700,166 +1700,174 @@ yyreduce:
case 34:
#line 196 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->code1(g_lingo->c_constpush); inst i = 0; WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i)); g_lingo->code1(i); ;}
+ {
+ (yyval.code) = g_lingo->code1(g_lingo->c_constpush);
+ inst i = 0;
+ WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i));
+ g_lingo->code1(i); ;}
break;
case 35:
-#line 197 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); g_lingo->code1(g_lingo->c_eval); delete (yyvsp[(1) - (1)].s); ;}
+#line 201 "engines/director/lingo/lingo-gr.y"
+ {
+ (yyval.code) = g_lingo->code1(g_lingo->c_varpush);
+ g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str());
+ g_lingo->code1(g_lingo->c_eval);
+ delete (yyvsp[(1) - (1)].s); ;}
break;
case 37:
-#line 199 "engines/director/lingo/lingo-gr.y"
+#line 207 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
case 38:
-#line 200 "engines/director/lingo/lingo-gr.y"
+#line 208 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
case 39:
-#line 201 "engines/director/lingo/lingo-gr.y"
+#line 209 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
case 40:
-#line 202 "engines/director/lingo/lingo-gr.y"
+#line 210 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
case 41:
-#line 203 "engines/director/lingo/lingo-gr.y"
+#line 211 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
case 42:
-#line 204 "engines/director/lingo/lingo-gr.y"
+#line 212 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
case 43:
-#line 205 "engines/director/lingo/lingo-gr.y"
+#line 213 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
case 44:
-#line 206 "engines/director/lingo/lingo-gr.y"
+#line 214 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
case 45:
-#line 207 "engines/director/lingo/lingo-gr.y"
+#line 215 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
case 46:
-#line 208 "engines/director/lingo/lingo-gr.y"
+#line 216 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 47:
-#line 209 "engines/director/lingo/lingo-gr.y"
+#line 217 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 48:
-#line 210 "engines/director/lingo/lingo-gr.y"
+#line 218 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 49:
-#line 213 "engines/director/lingo/lingo-gr.y"
+#line 221 "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 50:
-#line 214 "engines/director/lingo/lingo-gr.y"
+#line 222 "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 51:
-#line 215 "engines/director/lingo/lingo-gr.y"
+#line 223 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 53:
-#line 217 "engines/director/lingo/lingo-gr.y"
+#line 225 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_exit); ;}
break;
case 54:
-#line 228 "engines/director/lingo/lingo-gr.y"
+#line 236 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 55:
-#line 229 "engines/director/lingo/lingo-gr.y"
+#line 237 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 56:
-#line 230 "engines/director/lingo/lingo-gr.y"
+#line 238 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 57:
-#line 231 "engines/director/lingo/lingo-gr.y"
+#line 239 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
break;
case 58:
-#line 232 "engines/director/lingo/lingo-gr.y"
+#line 240 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
break;
case 59:
-#line 233 "engines/director/lingo/lingo-gr.y"
+#line 241 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 60:
-#line 236 "engines/director/lingo/lingo-gr.y"
+#line 244 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 61:
-#line 237 "engines/director/lingo/lingo-gr.y"
+#line 245 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 62:
-#line 238 "engines/director/lingo/lingo-gr.y"
+#line 246 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 63:
-#line 239 "engines/director/lingo/lingo-gr.y"
+#line 247 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 64:
-#line 242 "engines/director/lingo/lingo-gr.y"
+#line 250 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 65:
-#line 243 "engines/director/lingo/lingo-gr.y"
+#line 251 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 66:
-#line 244 "engines/director/lingo/lingo-gr.y"
+#line 252 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 67:
-#line 272 "engines/director/lingo/lingo-gr.y"
+#line 280 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 68:
-#line 273 "engines/director/lingo/lingo-gr.y"
+#line 281 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*(yyvsp[(2) - (7)].s), (yyvsp[(4) - (7)].code), (yyvsp[(7) - (7)].code), (yyvsp[(5) - (7)].narg));
@@ -1867,28 +1875,28 @@ yyreduce:
break;
case 69:
-#line 278 "engines/director/lingo/lingo-gr.y"
+#line 286 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 70:
-#line 279 "engines/director/lingo/lingo-gr.y"
+#line 287 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); (yyval.narg) = 1; ;}
break;
case 71:
-#line 280 "engines/director/lingo/lingo-gr.y"
+#line 288 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(3) - (3)].s)); delete (yyvsp[(3) - (3)].s); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 72:
-#line 281 "engines/director/lingo/lingo-gr.y"
+#line 289 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(4) - (4)].s)); delete (yyvsp[(4) - (4)].s); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 1892 "engines/director/lingo/lingo-gr.cpp"
+#line 1900 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2102,6 +2110,6 @@ yyreturn:
}
-#line 285 "engines/director/lingo/lingo-gr.y"
+#line 293 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 3232523..2bf7d7a 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -43,7 +43,7 @@
VOID = 259,
INT = 260,
FLOAT = 261,
- VAR = 262,
+ ID = 262,
STRING = 263,
HANDLER = 264,
tDOWN = 265,
@@ -82,7 +82,7 @@
#define VOID 259
#define INT 260
#define FLOAT 261
-#define VAR 262
+#define ID 262
#define STRING 263
#define HANDLER 264
#define tDOWN 265
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 8fdf825..5f775c4 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -73,7 +73,7 @@ using namespace Director;
%token UNARY VOID
%token<i> INT
%token<f> FLOAT
-%token<s> VAR STRING HANDLER
+%token<s> ID STRING HANDLER
%token tDOWN tELSE tEND tEXIT tFRAME tGO tIF tINTO tLOOP tMACRO tMCI tMCIWAIT
%token tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO tWITH tWHILE
%token tGE tLE tGT tLT tEQ tNEQ
@@ -104,9 +104,9 @@ programline:
| /* empty */
;
-asgn: tPUT expr tINTO VAR { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($4->c_str()); g_lingo->code1(g_lingo->c_assign); $$ = $2; delete $4; }
- | tSET VAR '=' expr { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->c_assign); $$ = $4; delete $2; }
- | tSET VAR tTO expr { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->c_assign); $$ = $4; delete $2; }
+asgn: tPUT expr tINTO ID { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($4->c_str()); g_lingo->code1(g_lingo->c_assign); $$ = $2; delete $4; }
+ | tSET ID '=' expr { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->c_assign); $$ = $4; delete $2; }
+ | tSET ID tTO expr { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->c_assign); $$ = $4; delete $2; }
;
stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
@@ -176,7 +176,7 @@ cond: expr { g_lingo->code1(STOP); }
;
repeatwhile: tREPEAT tWHILE { $$ = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); }
;
-repeatwith: tREPEAT tWITH VAR {
+repeatwith: tREPEAT tWITH ID {
$$ = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
g_lingo->codeString($3->c_str());
@@ -193,8 +193,16 @@ stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
| stmtlist stmt
;
-expr: INT { $$ = g_lingo->code1(g_lingo->c_constpush); inst i = 0; WRITE_LE_UINT32(&i, $1); g_lingo->code1(i); };
- | VAR { $$ = g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($1->c_str()); g_lingo->code1(g_lingo->c_eval); delete $1; }
+expr: INT {
+ $$ = g_lingo->code1(g_lingo->c_constpush);
+ inst i = 0;
+ WRITE_LE_UINT32(&i, $1);
+ g_lingo->code1(i); };
+ | ID {
+ $$ = g_lingo->code1(g_lingo->c_varpush);
+ g_lingo->codeString($1->c_str());
+ g_lingo->code1(g_lingo->c_eval);
+ delete $1; }
| asgn
| expr '+' expr { g_lingo->code1(g_lingo->c_add); }
| expr '-' expr { g_lingo->code1(g_lingo->c_sub); }
@@ -211,7 +219,7 @@ expr: INT { $$ = g_lingo->code1(g_lingo->c_constpush); inst i = 0; WRITE_LE
;
func: tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_str()); delete $2; }
- | tMCIWAIT VAR { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
+ | tMCIWAIT ID { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
| tPUT expr { g_lingo->code1(g_lingo->c_printtop); }
| gotofunc
| tEXIT { g_lingo->code1(g_lingo->c_exit); }
@@ -269,16 +277,16 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
//
// See also:
// on keyword
-defn: tMACRO VAR { g_lingo->_indef = true; }
+defn: tMACRO ID { g_lingo->_indef = true; }
begin argdef stmtlist end {
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$2, $4, $7, $5);
g_lingo->_indef = false; }
;
argdef: /* nothing */ { $$ = 0; }
- | VAR { g_lingo->codeArg(*$1); delete $1; $$ = 1; }
- | argdef ',' VAR { g_lingo->codeArg(*$3); delete $3; $$ = $1 + 1; }
- | argdef ',' '\n' VAR { g_lingo->codeArg(*$4); delete $4; $$ = $1 + 1; }
+ | ID { g_lingo->codeArg(*$1); delete $1; $$ = 1; }
+ | argdef ',' ID { g_lingo->codeArg(*$3); delete $3; $$ = $1 + 1; }
+ | argdef ',' '\n' ID { g_lingo->codeArg(*$4); delete $4; $$ = $1 + 1; }
;
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 421b407..953d7de 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -975,7 +975,7 @@ YY_RULE_SETUP
case 30:
YY_RULE_SETUP
#line 79 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return VAR; }
+{ yylval.s = new Common::String(yytext); return ID; }
YY_BREAK
case 31:
YY_RULE_SETUP
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index edabbf0..5f84fb9 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -34,7 +34,7 @@ int yyparse();
%}
-variable [_[:alpha:]][_[:alnum:]]*
+identifier [_[:alpha:]][_[:alnum:]]*
constfloat [[:digit:]]+\.[[:digit:]]*
constinteger [[:digit:]]+
conststring \"[^\"\n]*\"
@@ -76,7 +76,7 @@ while { return tWHILE; }
[>][=] { return tGE; }
[<][=] { return tLE; }
-{variable} { yylval.s = new Common::String(yytext); return VAR; }
+{identifier} { yylval.s = new Common::String(yytext); return ID; }
{constfloat} { yylval.f = atof(yytext); return FLOAT; }
{constinteger} { yylval.i = strtol(yytext, NULL, 10); return INT; }
{operator} { return *yytext; }
Commit: 2b6f00fc1a03cb8a6d5f1574851302c1380e3408
https://github.com/scummvm/scummvm/commit/2b6f00fc1a03cb8a6d5f1574851302c1380e3408
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Removed redundant endianness specification in READ/WRITE
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 7a3c8c8..e14ecfe 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -103,7 +103,7 @@ void Lingo::c_printtop(void) {
void Lingo::c_constpush() {
Datum d;
inst i = (*g_lingo->_currentScript)[g_lingo->_pc++];
- d.val = READ_LE_UINT32(&i);
+ d.val = READ_UINT32(&i);
g_lingo->push(d);
}
@@ -256,8 +256,8 @@ void Lingo::c_repeatwhilecode(void) {
Datum d;
int savepc = g_lingo->_pc;
- int body = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc]);
- int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
+ int body = READ_UINT32(&(*g_lingo->_currentScript)[savepc]);
+ int end = READ_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
g_lingo->execute(savepc + 2); /* condition */
d = g_lingo->pop();
@@ -279,11 +279,11 @@ void Lingo::c_repeatwithcode(void) {
Datum d;
int savepc = g_lingo->_pc;
- int init = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc]);
- int finish = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
- int body = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
- int inc = (int32)READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 3]);
- int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 4]);
+ int init = READ_UINT32(&(*g_lingo->_currentScript)[savepc]);
+ int finish = READ_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
+ int body = READ_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
+ int inc = (int32)READ_UINT32(&(*g_lingo->_currentScript)[savepc + 3]);
+ int end = READ_UINT32(&(*g_lingo->_currentScript)[savepc + 4]);
Common::String countername((char *)&(*g_lingo->_currentScript)[savepc + 5]);
Symbol *counter = g_lingo->lookupVar(countername.c_str());
@@ -313,9 +313,9 @@ void Lingo::c_ifcode() {
Datum d;
int savepc = g_lingo->_pc; /* then part */
- int then = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc]);
- int elsep = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
- int end = READ_LE_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
+ int then = READ_UINT32(&(*g_lingo->_currentScript)[savepc]);
+ int elsep = READ_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
+ int end = READ_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
g_lingo->execute(savepc + 3); /* condition */
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index a02ba17..d3980bd 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -523,13 +523,13 @@ static const yytype_int8 yyrhs[] =
static const yytype_uint16 yyrline[] =
{
0, 92, 92, 93, 94, 97, 98, 99, 100, 101,
- 102, 103, 104, 107, 108, 109, 112, 113, 114, 120,
- 132, 143, 159, 173, 174, 175, 177, 179, 185, 187,
- 189, 191, 192, 193, 196, 201, 206, 207, 208, 209,
- 210, 211, 212, 213, 214, 215, 216, 217, 218, 221,
- 222, 223, 224, 225, 236, 237, 238, 239, 240, 241,
- 244, 245, 246, 247, 250, 251, 252, 280, 280, 286,
- 287, 288, 289
+ 102, 103, 104, 107, 113, 119, 127, 128, 129, 135,
+ 147, 158, 174, 188, 189, 190, 192, 194, 200, 202,
+ 204, 206, 207, 208, 211, 216, 221, 222, 223, 224,
+ 225, 226, 227, 228, 229, 230, 231, 232, 233, 236,
+ 237, 238, 239, 240, 251, 252, 253, 254, 259, 265,
+ 272, 273, 274, 275, 278, 279, 280, 308, 308, 314,
+ 315, 316, 317
};
#endif
@@ -1572,65 +1572,80 @@ yyreduce:
case 13:
#line 107 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str()); g_lingo->code1(g_lingo->c_assign); (yyval.code) = (yyvsp[(2) - (4)].code); delete (yyvsp[(4) - (4)].s); ;}
+ {
+ g_lingo->code1(g_lingo->c_varpush);
+ g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str());
+ g_lingo->code1(g_lingo->c_assign);
+ (yyval.code) = (yyvsp[(2) - (4)].code);
+ delete (yyvsp[(4) - (4)].s); ;}
break;
case 14:
-#line 108 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->c_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
+#line 113 "engines/director/lingo/lingo-gr.y"
+ {
+ g_lingo->code1(g_lingo->c_varpush);
+ g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
+ g_lingo->code1(g_lingo->c_assign);
+ (yyval.code) = (yyvsp[(4) - (4)].code);
+ delete (yyvsp[(2) - (4)].s); ;}
break;
case 15:
-#line 109 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str()); g_lingo->code1(g_lingo->c_assign); (yyval.code) = (yyvsp[(4) - (4)].code); delete (yyvsp[(2) - (4)].s); ;}
+#line 119 "engines/director/lingo/lingo-gr.y"
+ {
+ g_lingo->code1(g_lingo->c_varpush);
+ g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
+ g_lingo->code1(g_lingo->c_assign);
+ (yyval.code) = (yyvsp[(4) - (4)].code);
+ delete (yyvsp[(2) - (4)].s); ;}
break;
case 16:
-#line 112 "engines/director/lingo/lingo-gr.y"
+#line 127 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 18:
-#line 114 "engines/director/lingo/lingo-gr.y"
+#line 129 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
- WRITE_LE_UINT32(&then, (yyvsp[(4) - (7)].code));
- WRITE_LE_UINT32(&end, (yyvsp[(5) - (7)].code));
+ WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
+ WRITE_UINT32(&end, (yyvsp[(5) - (7)].code));
(*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; ;}
break;
case 19:
-#line 120 "engines/director/lingo/lingo-gr.y"
+#line 135 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
- WRITE_LE_UINT32(&then, (yyvsp[(4) - (10)].code));
- WRITE_LE_UINT32(&else1, (yyvsp[(7) - (10)].code));
- WRITE_LE_UINT32(&end, (yyvsp[(8) - (10)].code));
+ WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
+ WRITE_UINT32(&else1, (yyvsp[(7) - (10)].code));
+ WRITE_UINT32(&end, (yyvsp[(8) - (10)].code));
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
break;
case 20:
-#line 132 "engines/director/lingo/lingo-gr.y"
+#line 147 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
- WRITE_LE_UINT32(&body, (yyvsp[(5) - (8)].code));
- WRITE_LE_UINT32(&end, (yyvsp[(6) - (8)].code));
+ WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
+ WRITE_UINT32(&end, (yyvsp[(6) - (8)].code));
(*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = body; /* body of loop */
(*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
case 21:
-#line 143 "engines/director/lingo/lingo-gr.y"
+#line 158 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
- WRITE_LE_UINT32(&init, (yyvsp[(3) - (11)].code));
- WRITE_LE_UINT32(&finish, (yyvsp[(6) - (11)].code));
- WRITE_LE_UINT32(&body, (yyvsp[(8) - (11)].code));
- WRITE_LE_UINT32(&end, (yyvsp[(9) - (11)].code));
- WRITE_LE_UINT32(&inc, 1);
+ WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
+ WRITE_UINT32(&finish, (yyvsp[(6) - (11)].code));
+ WRITE_UINT32(&body, (yyvsp[(8) - (11)].code));
+ WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
+ WRITE_UINT32(&inc, 1);
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = init; /* initial count value */
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = finish;/* final count value */
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = body; /* body of loop */
@@ -1639,14 +1654,14 @@ yyreduce:
break;
case 22:
-#line 159 "engines/director/lingo/lingo-gr.y"
+#line 174 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
- WRITE_LE_UINT32(&init, (yyvsp[(3) - (12)].code));
- WRITE_LE_UINT32(&finish, (yyvsp[(7) - (12)].code));
- WRITE_LE_UINT32(&body, (yyvsp[(9) - (12)].code));
- WRITE_LE_UINT32(&end, (yyvsp[(10) - (12)].code));
- WRITE_LE_UINT32(&inc, -1);
+ WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
+ WRITE_UINT32(&finish, (yyvsp[(7) - (12)].code));
+ WRITE_UINT32(&body, (yyvsp[(9) - (12)].code));
+ WRITE_UINT32(&end, (yyvsp[(10) - (12)].code));
+ WRITE_UINT32(&inc, -1);
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = init; /* initial count value */
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = finish;/* final count value */
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = body; /* body of loop */
@@ -1655,22 +1670,22 @@ yyreduce:
break;
case 23:
-#line 173 "engines/director/lingo/lingo-gr.y"
+#line 188 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
case 24:
-#line 174 "engines/director/lingo/lingo-gr.y"
+#line 189 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
case 26:
-#line 177 "engines/director/lingo/lingo-gr.y"
+#line 192 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
case 27:
-#line 179 "engines/director/lingo/lingo-gr.y"
+#line 194 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1679,36 +1694,36 @@ yyreduce:
break;
case 28:
-#line 185 "engines/director/lingo/lingo-gr.y"
+#line 200 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
case 29:
-#line 187 "engines/director/lingo/lingo-gr.y"
+#line 202 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 30:
-#line 189 "engines/director/lingo/lingo-gr.y"
+#line 204 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 31:
-#line 191 "engines/director/lingo/lingo-gr.y"
+#line 206 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 34:
-#line 196 "engines/director/lingo/lingo-gr.y"
+#line 211 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
- WRITE_LE_UINT32(&i, (yyvsp[(1) - (1)].i));
+ WRITE_UINT32(&i, (yyvsp[(1) - (1)].i));
g_lingo->code1(i); ;}
break;
case 35:
-#line 201 "engines/director/lingo/lingo-gr.y"
+#line 216 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str());
@@ -1717,157 +1732,170 @@ yyreduce:
break;
case 37:
-#line 207 "engines/director/lingo/lingo-gr.y"
+#line 222 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
case 38:
-#line 208 "engines/director/lingo/lingo-gr.y"
+#line 223 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
case 39:
-#line 209 "engines/director/lingo/lingo-gr.y"
+#line 224 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
case 40:
-#line 210 "engines/director/lingo/lingo-gr.y"
+#line 225 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
case 41:
-#line 211 "engines/director/lingo/lingo-gr.y"
+#line 226 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
case 42:
-#line 212 "engines/director/lingo/lingo-gr.y"
+#line 227 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
case 43:
-#line 213 "engines/director/lingo/lingo-gr.y"
+#line 228 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
case 44:
-#line 214 "engines/director/lingo/lingo-gr.y"
+#line 229 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
case 45:
-#line 215 "engines/director/lingo/lingo-gr.y"
+#line 230 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
case 46:
-#line 216 "engines/director/lingo/lingo-gr.y"
+#line 231 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 47:
-#line 217 "engines/director/lingo/lingo-gr.y"
+#line 232 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 48:
-#line 218 "engines/director/lingo/lingo-gr.y"
+#line 233 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 49:
-#line 221 "engines/director/lingo/lingo-gr.y"
+#line 236 "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 50:
-#line 222 "engines/director/lingo/lingo-gr.y"
+#line 237 "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 51:
-#line 223 "engines/director/lingo/lingo-gr.y"
+#line 238 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 53:
-#line 225 "engines/director/lingo/lingo-gr.y"
+#line 240 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_exit); ;}
break;
case 54:
-#line 236 "engines/director/lingo/lingo-gr.y"
+#line 251 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 55:
-#line 237 "engines/director/lingo/lingo-gr.y"
+#line 252 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 56:
-#line 238 "engines/director/lingo/lingo-gr.y"
+#line 253 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 57:
-#line 239 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); g_lingo->codeString(""); delete (yyvsp[(2) - (2)].s); ;}
+#line 254 "engines/director/lingo/lingo-gr.y"
+ {
+ g_lingo->code1(g_lingo->c_goto);
+ g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
+ g_lingo->codeString("");
+ delete (yyvsp[(2) - (2)].s); ;}
break;
case 58:
-#line 240 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str()); g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str()); delete (yyvsp[(2) - (3)].s); delete (yyvsp[(3) - (3)].s); ;}
+#line 259 "engines/director/lingo/lingo-gr.y"
+ {
+ g_lingo->code1(g_lingo->c_goto);
+ g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
+ g_lingo->codeString((yyvsp[(3) - (3)].s)->c_str());
+ delete (yyvsp[(2) - (3)].s);
+ delete (yyvsp[(3) - (3)].s); ;}
break;
case 59:
-#line 241 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+#line 265 "engines/director/lingo/lingo-gr.y"
+ {
+ g_lingo->code1(g_lingo->c_goto);
+ g_lingo->codeString("");
+ g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
+ delete (yyvsp[(2) - (2)].s); ;}
break;
case 60:
-#line 244 "engines/director/lingo/lingo-gr.y"
+#line 272 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 61:
-#line 245 "engines/director/lingo/lingo-gr.y"
+#line 273 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 62:
-#line 246 "engines/director/lingo/lingo-gr.y"
+#line 274 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 63:
-#line 247 "engines/director/lingo/lingo-gr.y"
+#line 275 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 64:
-#line 250 "engines/director/lingo/lingo-gr.y"
+#line 278 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 65:
-#line 251 "engines/director/lingo/lingo-gr.y"
+#line 279 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 66:
-#line 252 "engines/director/lingo/lingo-gr.y"
+#line 280 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 67:
-#line 280 "engines/director/lingo/lingo-gr.y"
+#line 308 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 68:
-#line 281 "engines/director/lingo/lingo-gr.y"
+#line 309 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*(yyvsp[(2) - (7)].s), (yyvsp[(4) - (7)].code), (yyvsp[(7) - (7)].code), (yyvsp[(5) - (7)].narg));
@@ -1875,28 +1903,28 @@ yyreduce:
break;
case 69:
-#line 286 "engines/director/lingo/lingo-gr.y"
+#line 314 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 70:
-#line 287 "engines/director/lingo/lingo-gr.y"
+#line 315 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); (yyval.narg) = 1; ;}
break;
case 71:
-#line 288 "engines/director/lingo/lingo-gr.y"
+#line 316 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(3) - (3)].s)); delete (yyvsp[(3) - (3)].s); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 72:
-#line 289 "engines/director/lingo/lingo-gr.y"
+#line 317 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(4) - (4)].s)); delete (yyvsp[(4) - (4)].s); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 1900 "engines/director/lingo/lingo-gr.cpp"
+#line 1928 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2110,6 +2138,6 @@ yyreturn:
}
-#line 293 "engines/director/lingo/lingo-gr.y"
+#line 321 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 5f775c4..5b02796 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -104,24 +104,39 @@ programline:
| /* empty */
;
-asgn: tPUT expr tINTO ID { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($4->c_str()); g_lingo->code1(g_lingo->c_assign); $$ = $2; delete $4; }
- | tSET ID '=' expr { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->c_assign); $$ = $4; delete $2; }
- | tSET ID tTO expr { g_lingo->code1(g_lingo->c_varpush); g_lingo->codeString($2->c_str()); g_lingo->code1(g_lingo->c_assign); $$ = $4; delete $2; }
+asgn: tPUT expr tINTO ID {
+ g_lingo->code1(g_lingo->c_varpush);
+ g_lingo->codeString($4->c_str());
+ g_lingo->code1(g_lingo->c_assign);
+ $$ = $2;
+ delete $4; }
+ | tSET ID '=' expr {
+ g_lingo->code1(g_lingo->c_varpush);
+ g_lingo->codeString($2->c_str());
+ g_lingo->code1(g_lingo->c_assign);
+ $$ = $4;
+ delete $2; }
+ | tSET ID tTO expr {
+ g_lingo->code1(g_lingo->c_varpush);
+ g_lingo->codeString($2->c_str());
+ g_lingo->code1(g_lingo->c_assign);
+ $$ = $4;
+ delete $2; }
;
stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
| func
| if cond tTHEN stmtlist end tEND tIF {
inst then = 0, end = 0;
- WRITE_LE_UINT32(&then, $4);
- WRITE_LE_UINT32(&end, $5);
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&end, $5);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
| if cond tTHEN stmtlist end tELSE stmtlist end tEND tIF {
inst then = 0, else1 = 0, end = 0;
- WRITE_LE_UINT32(&then, $4);
- WRITE_LE_UINT32(&else1, $7);
- WRITE_LE_UINT32(&end, $8);
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&else1, $7);
+ WRITE_UINT32(&end, $8);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
@@ -131,8 +146,8 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
//
| repeatwhile '(' cond ')' stmtlist end tEND tREPEAT {
inst body = 0, end = 0;
- WRITE_LE_UINT32(&body, $5);
- WRITE_LE_UINT32(&end, $6);
+ WRITE_UINT32(&body, $5);
+ WRITE_UINT32(&end, $6);
(*g_lingo->_currentScript)[$1 + 1] = body; /* body of loop */
(*g_lingo->_currentScript)[$1 + 2] = end; } /* end, if cond fails */
;
@@ -142,11 +157,11 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
//
| repeatwith '=' expr end tTO expr end stmtlist end tEND tREPEAT {
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
- WRITE_LE_UINT32(&init, $3);
- WRITE_LE_UINT32(&finish, $6);
- WRITE_LE_UINT32(&body, $8);
- WRITE_LE_UINT32(&end, $9);
- WRITE_LE_UINT32(&inc, 1);
+ WRITE_UINT32(&init, $3);
+ WRITE_UINT32(&finish, $6);
+ WRITE_UINT32(&body, $8);
+ WRITE_UINT32(&end, $9);
+ WRITE_UINT32(&inc, 1);
(*g_lingo->_currentScript)[$1 + 1] = init; /* initial count value */
(*g_lingo->_currentScript)[$1 + 2] = finish;/* final count value */
(*g_lingo->_currentScript)[$1 + 3] = body; /* body of loop */
@@ -158,11 +173,11 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
//
| repeatwith '=' expr end tDOWN tTO expr end stmtlist end tEND tREPEAT {
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
- WRITE_LE_UINT32(&init, $3);
- WRITE_LE_UINT32(&finish, $7);
- WRITE_LE_UINT32(&body, $9);
- WRITE_LE_UINT32(&end, $10);
- WRITE_LE_UINT32(&inc, -1);
+ WRITE_UINT32(&init, $3);
+ WRITE_UINT32(&finish, $7);
+ WRITE_UINT32(&body, $9);
+ WRITE_UINT32(&end, $10);
+ WRITE_UINT32(&inc, -1);
(*g_lingo->_currentScript)[$1 + 1] = init; /* initial count value */
(*g_lingo->_currentScript)[$1 + 2] = finish;/* final count value */
(*g_lingo->_currentScript)[$1 + 3] = body; /* body of loop */
@@ -196,7 +211,7 @@ stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
expr: INT {
$$ = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
- WRITE_LE_UINT32(&i, $1);
+ WRITE_UINT32(&i, $1);
g_lingo->code1(i); };
| ID {
$$ = g_lingo->code1(g_lingo->c_varpush);
@@ -236,9 +251,22 @@ func: tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_
gotofunc: tGO tLOOP { g_lingo->code1(g_lingo->c_gotoloop); }
| tGO tNEXT { g_lingo->code1(g_lingo->c_gotonext); }
| tGO tPREVIOUS { g_lingo->code1(g_lingo->c_gotoprevious); }
- | tGO gotoframe { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString($2->c_str()); g_lingo->codeString(""); delete $2; }
- | tGO gotoframe gotomovie { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString($2->c_str()); g_lingo->codeString($3->c_str()); delete $2; delete $3; }
- | tGO gotomovie { g_lingo->code1(g_lingo->c_goto); g_lingo->codeString(""); g_lingo->codeString($2->c_str()); delete $2; }
+ | tGO gotoframe {
+ g_lingo->code1(g_lingo->c_goto);
+ g_lingo->codeString($2->c_str());
+ g_lingo->codeString("");
+ delete $2; }
+ | tGO gotoframe gotomovie {
+ g_lingo->code1(g_lingo->c_goto);
+ g_lingo->codeString($2->c_str());
+ g_lingo->codeString($3->c_str());
+ delete $2;
+ delete $3; }
+ | tGO gotomovie {
+ g_lingo->code1(g_lingo->c_goto);
+ g_lingo->codeString("");
+ g_lingo->codeString($2->c_str());
+ delete $2; }
;
gotoframe: tTO tFRAME STRING { $$ = $3; }
Commit: 0c4d0155d5e1b5d0f3319eb9329e3b0e3e81ec39
https://github.com/scummvm/scummvm/commit/0c4d0155d5e1b5d0f3319eb9329e3b0e3e81ec39
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Avoid printing out unrecognizet tokens in lexer
Changed paths:
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 953d7de..106771a 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 36
-#define YY_END_OF_BUFFER 37
+#define YY_NUM_RULES 37
+#define YY_END_OF_BUFFER 38
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,21 +373,21 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[113] =
+static yyconst flex_int16_t yy_accept[114] =
{ 0,
- 0, 0, 37, 36, 3, 34, 36, 36, 33, 33,
- 32, 33, 33, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 2, 2,
- 3, 34, 27, 0, 35, 1, 31, 32, 29, 28,
- 30, 30, 30, 30, 30, 30, 10, 5, 30, 30,
- 30, 30, 30, 30, 18, 30, 30, 30, 30, 30,
- 24, 30, 30, 1, 31, 30, 30, 7, 30, 30,
- 30, 30, 30, 14, 30, 30, 30, 20, 30, 22,
- 30, 30, 30, 4, 6, 8, 30, 11, 12, 30,
- 30, 30, 17, 30, 30, 23, 30, 25, 9, 13,
-
- 30, 16, 30, 30, 26, 30, 30, 21, 15, 30,
- 19, 0
+ 0, 0, 38, 36, 3, 34, 34, 36, 36, 33,
+ 33, 32, 33, 33, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 2,
+ 2, 3, 34, 27, 0, 35, 1, 31, 32, 29,
+ 28, 30, 30, 30, 30, 30, 30, 10, 5, 30,
+ 30, 30, 30, 30, 30, 18, 30, 30, 30, 30,
+ 30, 24, 30, 30, 1, 31, 30, 30, 7, 30,
+ 30, 30, 30, 30, 14, 30, 30, 30, 20, 30,
+ 22, 30, 30, 30, 4, 6, 8, 30, 11, 12,
+ 30, 30, 30, 17, 30, 30, 23, 30, 25, 9,
+
+ 13, 30, 16, 30, 30, 26, 30, 30, 21, 15,
+ 30, 19, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -430,82 +430,82 @@ static yyconst flex_int32_t yy_meta[36] =
4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[116] =
+static yyconst flex_int16_t yy_base[117] =
{ 0,
- 0, 34, 131, 132, 128, 34, 116, 121, 132, 118,
- 30, 113, 112, 0, 97, 18, 94, 95, 23, 94,
- 29, 101, 99, 18, 99, 98, 30, 32, 114, 132,
- 113, 55, 132, 107, 132, 0, 102, 50, 132, 132,
- 0, 78, 81, 92, 86, 92, 0, 0, 76, 79,
- 88, 81, 70, 67, 0, 82, 69, 71, 67, 78,
- 0, 73, 64, 0, 83, 67, 73, 0, 60, 65,
- 62, 60, 58, 52, 62, 53, 50, 0, 63, 0,
- 55, 56, 57, 0, 0, 0, 59, 0, 0, 50,
- 60, 56, 0, 51, 57, 0, 53, 0, 0, 0,
-
- 48, 0, 43, 37, 0, 36, 31, 0, 0, 21,
- 0, 132, 61, 44, 65
+ 0, 34, 133, 134, 130, 34, 37, 118, 123, 134,
+ 120, 32, 115, 114, 0, 99, 20, 96, 97, 25,
+ 96, 31, 103, 101, 20, 101, 100, 32, 34, 116,
+ 134, 115, 57, 134, 109, 134, 0, 104, 52, 134,
+ 134, 0, 80, 83, 94, 88, 94, 0, 0, 78,
+ 81, 90, 83, 72, 69, 0, 84, 71, 73, 69,
+ 80, 0, 75, 66, 0, 85, 69, 75, 0, 62,
+ 67, 64, 62, 60, 54, 64, 55, 52, 0, 65,
+ 0, 57, 58, 59, 0, 0, 0, 61, 0, 0,
+ 52, 62, 58, 0, 53, 59, 0, 55, 0, 0,
+
+ 0, 50, 0, 45, 39, 0, 38, 33, 0, 0,
+ 23, 0, 134, 63, 46, 67
} ;
-static yyconst flex_int16_t yy_def[116] =
+static yyconst flex_int16_t yy_def[117] =
{ 0,
- 112, 1, 112, 112, 112, 112, 112, 113, 112, 112,
- 112, 112, 112, 114, 114, 114, 114, 114, 114, 114,
- 114, 114, 114, 114, 114, 114, 114, 114, 112, 112,
- 112, 112, 112, 113, 112, 115, 112, 112, 112, 112,
- 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
- 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
- 114, 114, 114, 115, 112, 114, 114, 114, 114, 114,
- 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
- 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
- 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
-
- 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
- 114, 0, 112, 112, 112
+ 113, 1, 113, 113, 113, 113, 113, 113, 114, 113,
+ 113, 113, 113, 113, 115, 115, 115, 115, 115, 115,
+ 115, 115, 115, 115, 115, 115, 115, 115, 115, 113,
+ 113, 113, 113, 113, 114, 113, 116, 113, 113, 113,
+ 113, 115, 115, 115, 115, 115, 115, 115, 115, 115,
+ 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
+ 115, 115, 115, 115, 116, 113, 115, 115, 115, 115,
+ 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
+ 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
+ 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
+
+ 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
+ 115, 115, 0, 113, 113, 113
} ;
-static yyconst flex_int16_t yy_nxt[168] =
+static yyconst flex_int16_t yy_nxt[170] =
{ 0,
- 4, 5, 6, 6, 4, 7, 8, 9, 10, 4,
- 11, 12, 9, 13, 14, 14, 14, 15, 16, 17,
- 18, 14, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 14, 14, 28, 14, 29, 32, 32, 30, 37,
- 38, 43, 48, 44, 51, 52, 56, 41, 49, 57,
- 111, 60, 45, 62, 63, 53, 61, 32, 32, 37,
- 38, 34, 110, 34, 34, 64, 109, 108, 64, 107,
- 106, 105, 104, 103, 102, 101, 100, 99, 98, 97,
- 96, 95, 94, 93, 92, 91, 90, 89, 88, 87,
- 86, 85, 84, 65, 83, 82, 81, 80, 79, 78,
-
- 77, 76, 75, 74, 73, 72, 71, 70, 69, 68,
- 67, 66, 65, 35, 31, 31, 59, 58, 55, 54,
- 50, 47, 46, 42, 40, 39, 36, 35, 33, 31,
- 112, 3, 112, 112, 112, 112, 112, 112, 112, 112,
- 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
- 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
- 112, 112, 112, 112, 112, 112, 112
+ 4, 5, 6, 7, 4, 8, 9, 10, 11, 4,
+ 12, 13, 10, 14, 15, 15, 15, 16, 17, 18,
+ 19, 15, 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 15, 15, 29, 15, 30, 33, 33, 31, 33,
+ 33, 38, 39, 44, 49, 45, 52, 53, 57, 42,
+ 50, 58, 112, 61, 46, 63, 64, 54, 62, 33,
+ 33, 38, 39, 35, 111, 35, 35, 65, 110, 109,
+ 65, 108, 107, 106, 105, 104, 103, 102, 101, 100,
+ 99, 98, 97, 96, 95, 94, 93, 92, 91, 90,
+ 89, 88, 87, 86, 85, 66, 84, 83, 82, 81,
+
+ 80, 79, 78, 77, 76, 75, 74, 73, 72, 71,
+ 70, 69, 68, 67, 66, 36, 32, 32, 60, 59,
+ 56, 55, 51, 48, 47, 43, 41, 40, 37, 36,
+ 34, 32, 113, 3, 113, 113, 113, 113, 113, 113,
+ 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
+ 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
+ 113, 113, 113, 113, 113, 113, 113, 113, 113
} ;
-static yyconst flex_int16_t yy_chk[168] =
+static yyconst flex_int16_t yy_chk[170] =
{ 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, 2, 6, 6, 2, 11,
- 11, 16, 19, 16, 21, 21, 24, 114, 19, 24,
- 110, 27, 16, 28, 28, 21, 27, 32, 32, 38,
- 38, 113, 107, 113, 113, 115, 106, 104, 115, 103,
- 101, 97, 95, 94, 92, 91, 90, 87, 83, 82,
- 81, 79, 77, 76, 75, 74, 73, 72, 71, 70,
- 69, 67, 66, 65, 63, 62, 60, 59, 58, 57,
-
- 56, 54, 53, 52, 51, 50, 49, 46, 45, 44,
- 43, 42, 37, 34, 31, 29, 26, 25, 23, 22,
- 20, 18, 17, 15, 13, 12, 10, 8, 7, 5,
- 3, 112, 112, 112, 112, 112, 112, 112, 112, 112,
- 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
- 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
- 112, 112, 112, 112, 112, 112, 112
+ 1, 1, 1, 1, 1, 2, 6, 6, 2, 7,
+ 7, 12, 12, 17, 20, 17, 22, 22, 25, 115,
+ 20, 25, 111, 28, 17, 29, 29, 22, 28, 33,
+ 33, 39, 39, 114, 108, 114, 114, 116, 107, 105,
+ 116, 104, 102, 98, 96, 95, 93, 92, 91, 88,
+ 84, 83, 82, 80, 78, 77, 76, 75, 74, 73,
+ 72, 71, 70, 68, 67, 66, 64, 63, 61, 60,
+
+ 59, 58, 57, 55, 54, 53, 52, 51, 50, 47,
+ 46, 45, 44, 43, 38, 35, 32, 30, 27, 26,
+ 24, 23, 21, 19, 18, 16, 14, 13, 11, 9,
+ 8, 5, 3, 113, 113, 113, 113, 113, 113, 113,
+ 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
+ 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
+ 113, 113, 113, 113, 113, 113, 113, 113, 113
} ;
static yy_state_type yy_last_accepting_state;
@@ -797,13 +797,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 >= 113 )
+ if ( yy_current_state >= 114 )
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] != 132 );
+ while ( yy_base[yy_current_state] != 134 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -1005,10 +1005,15 @@ YY_RULE_SETUP
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 86 "engines/director/lingo/lingo-lex.l"
+#line 85 "engines/director/lingo/lingo-lex.l"
+
+ YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 87 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1012 "engines/director/lingo/lingo-lex.cpp"
+#line 1017 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1301,7 +1306,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 >= 113 )
+ if ( yy_current_state >= 114 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1329,11 +1334,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 >= 113 )
+ if ( yy_current_state >= 114 )
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 == 112);
+ yy_is_jam = (yy_current_state == 113);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2008,7 +2013,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 86 "engines/director/lingo/lingo-lex.l"
+#line 87 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 5f84fb9..df33121 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -82,6 +82,7 @@ while { return tWHILE; }
{operator} { return *yytext; }
{newline} { return '\n'; }
{conststring} { yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+.
%%
Commit: 327e625507f34c5656e4392c07d1b73bab95b976
https://github.com/scummvm/scummvm/commit/327e625507f34c5656e4392c07d1b73bab95b976
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Make all keywords case-insensitive
Changed paths:
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 106771a..c7c7a7a 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -398,14 +398,14 @@ static yyconst flex_int32_t yy_ec[256] =
1, 5, 6, 7, 1, 1, 8, 1, 1, 8,
8, 8, 8, 8, 9, 10, 8, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 8, 1, 12,
- 13, 14, 1, 1, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
- 1, 1, 1, 8, 15, 1, 16, 15, 17, 18,
-
- 19, 20, 21, 22, 23, 15, 15, 24, 25, 26,
- 27, 28, 15, 29, 30, 31, 32, 33, 34, 35,
- 15, 15, 1, 1, 1, 1, 1, 1, 1, 1,
+ 13, 14, 1, 1, 15, 16, 17, 18, 19, 20,
+ 21, 22, 23, 16, 16, 24, 25, 26, 27, 28,
+ 16, 29, 30, 31, 32, 33, 34, 35, 16, 16,
+ 1, 1, 1, 8, 16, 1, 36, 16, 37, 38,
+
+ 39, 40, 41, 42, 43, 16, 16, 44, 45, 46,
+ 47, 48, 16, 49, 50, 51, 52, 53, 54, 55,
+ 16, 16, 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,
@@ -422,29 +422,31 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[36] =
+static yyconst flex_int32_t yy_meta[56] =
{ 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
} ;
static yyconst flex_int16_t yy_base[117] =
{ 0,
- 0, 34, 133, 134, 130, 34, 37, 118, 123, 134,
- 120, 32, 115, 114, 0, 99, 20, 96, 97, 25,
- 96, 31, 103, 101, 20, 101, 100, 32, 34, 116,
- 134, 115, 57, 134, 109, 134, 0, 104, 52, 134,
- 134, 0, 80, 83, 94, 88, 94, 0, 0, 78,
- 81, 90, 83, 72, 69, 0, 84, 71, 73, 69,
- 80, 0, 75, 66, 0, 85, 69, 75, 0, 62,
- 67, 64, 62, 60, 54, 64, 55, 52, 0, 65,
- 0, 57, 58, 59, 0, 0, 0, 61, 0, 0,
- 52, 62, 58, 0, 53, 59, 0, 55, 0, 0,
-
- 0, 50, 0, 45, 39, 0, 38, 33, 0, 0,
- 23, 0, 134, 63, 46, 67
+ 0, 54, 210, 227, 207, 54, 57, 195, 198, 227,
+ 194, 52, 188, 187, 0, 37, 41, 37, 41, 49,
+ 43, 56, 55, 57, 49, 60, 61, 80, 82, 197,
+ 227, 184, 105, 227, 109, 227, 0, 80, 100, 227,
+ 227, 0, 72, 82, 95, 91, 100, 0, 0, 86,
+ 91, 102, 97, 88, 88, 0, 109, 98, 102, 100,
+ 116, 0, 119, 113, 0, 71, 119, 127, 0, 116,
+ 127, 126, 126, 127, 123, 135, 128, 127, 0, 142,
+ 0, 137, 144, 147, 0, 0, 0, 151, 0, 0,
+ 144, 160, 163, 0, 161, 170, 0, 168, 0, 0,
+
+ 0, 169, 0, 166, 163, 0, 164, 165, 0, 0,
+ 168, 0, 227, 218, 68, 222
} ;
static yyconst flex_int16_t yy_def[117] =
@@ -464,48 +466,74 @@ static yyconst flex_int16_t yy_def[117] =
115, 115, 0, 113, 113, 113
} ;
-static yyconst flex_int16_t yy_nxt[170] =
+static yyconst flex_int16_t yy_nxt[283] =
{ 0,
4, 5, 6, 7, 4, 8, 9, 10, 11, 4,
12, 13, 10, 14, 15, 15, 15, 16, 17, 18,
19, 15, 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 15, 15, 29, 15, 15, 15, 16, 17, 18,
+ 19, 15, 20, 21, 22, 23, 24, 25, 26, 27,
28, 15, 15, 29, 15, 30, 33, 33, 31, 33,
- 33, 38, 39, 44, 49, 45, 52, 53, 57, 42,
- 50, 58, 112, 61, 46, 63, 64, 54, 62, 33,
- 33, 38, 39, 35, 111, 35, 35, 65, 110, 109,
- 65, 108, 107, 106, 105, 104, 103, 102, 101, 100,
- 99, 98, 97, 96, 95, 94, 93, 92, 91, 90,
- 89, 88, 87, 86, 85, 66, 84, 83, 82, 81,
-
- 80, 79, 78, 77, 76, 75, 74, 73, 72, 71,
- 70, 69, 68, 67, 66, 36, 32, 32, 60, 59,
- 56, 55, 51, 48, 47, 43, 41, 40, 37, 36,
- 34, 32, 113, 3, 113, 113, 113, 113, 113, 113,
+ 33, 38, 39, 43, 44, 47, 45, 48, 49, 51,
+ 52, 42, 53, 55, 50, 46, 56, 57, 59, 60,
+ 58, 66, 54, 43, 44, 47, 45, 48, 49, 51,
+ 66, 52, 53, 55, 50, 46, 56, 57, 59, 60,
+
+ 58, 61, 54, 63, 64, 67, 62, 33, 33, 38,
+ 39, 68, 69, 70, 71, 36, 72, 73, 74, 75,
+ 76, 61, 77, 63, 64, 67, 62, 78, 79, 80,
+ 81, 68, 69, 70, 82, 71, 72, 73, 74, 75,
+ 76, 83, 77, 84, 85, 86, 87, 78, 79, 80,
+ 81, 88, 89, 90, 82, 91, 92, 93, 94, 95,
+ 96, 83, 97, 84, 85, 86, 87, 98, 99, 100,
+ 101, 88, 89, 90, 102, 91, 92, 93, 94, 95,
+ 96, 103, 97, 104, 105, 32, 106, 98, 99, 100,
+ 101, 107, 108, 109, 110, 102, 111, 112, 32, 41,
+
+ 40, 103, 37, 104, 36, 105, 106, 34, 32, 113,
+ 113, 107, 108, 109, 110, 113, 111, 112, 35, 113,
+ 35, 35, 65, 113, 113, 65, 3, 113, 113, 113,
+ 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
+ 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
+ 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
- 113, 113, 113, 113, 113, 113, 113, 113, 113
+ 113, 113
} ;
-static yyconst flex_int16_t yy_chk[170] =
+static yyconst flex_int16_t yy_chk[283] =
{ 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, 2, 6, 6, 2, 7,
- 7, 12, 12, 17, 20, 17, 22, 22, 25, 115,
- 20, 25, 111, 28, 17, 29, 29, 22, 28, 33,
- 33, 39, 39, 114, 108, 114, 114, 116, 107, 105,
- 116, 104, 102, 98, 96, 95, 93, 92, 91, 88,
- 84, 83, 82, 80, 78, 77, 76, 75, 74, 73,
- 72, 71, 70, 68, 67, 66, 64, 63, 61, 60,
-
- 59, 58, 57, 55, 54, 53, 52, 51, 50, 47,
- 46, 45, 44, 43, 38, 35, 32, 30, 27, 26,
- 24, 23, 21, 19, 18, 16, 14, 13, 11, 9,
- 8, 5, 3, 113, 113, 113, 113, 113, 113, 113,
+ 7, 12, 12, 16, 17, 18, 17, 19, 20, 21,
+ 22, 115, 22, 23, 20, 17, 24, 25, 26, 27,
+ 25, 66, 22, 16, 17, 18, 17, 19, 20, 21,
+ 38, 22, 22, 23, 20, 17, 24, 25, 26, 27,
+
+ 25, 28, 22, 29, 29, 43, 28, 33, 33, 39,
+ 39, 44, 45, 46, 47, 35, 50, 51, 52, 53,
+ 54, 28, 55, 29, 29, 43, 28, 57, 58, 59,
+ 60, 44, 45, 46, 61, 47, 50, 51, 52, 53,
+ 54, 63, 55, 64, 67, 68, 70, 57, 58, 59,
+ 60, 71, 72, 73, 61, 74, 75, 76, 77, 78,
+ 80, 63, 82, 64, 67, 68, 70, 83, 84, 88,
+ 91, 71, 72, 73, 92, 74, 75, 76, 77, 78,
+ 80, 93, 82, 95, 96, 32, 98, 83, 84, 88,
+ 91, 102, 104, 105, 107, 92, 108, 111, 30, 14,
+
+ 13, 93, 11, 95, 9, 96, 98, 8, 5, 3,
+ 0, 102, 104, 105, 107, 0, 108, 111, 114, 0,
+ 114, 114, 116, 0, 0, 116, 113, 113, 113, 113,
+ 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
+ 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
+ 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
- 113, 113, 113, 113, 113, 113, 113, 113, 113
+ 113, 113
} ;
static yy_state_type yy_last_accepting_state;
@@ -555,7 +583,7 @@ char *yytext;
int yyparse();
-#line 559 "engines/director/lingo/lingo-lex.cpp"
+#line 587 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -743,7 +771,7 @@ YY_DECL
#line 45 "engines/director/lingo/lingo-lex.l"
-#line 747 "engines/director/lingo/lingo-lex.cpp"
+#line 775 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -803,7 +831,7 @@ yy_match:
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 134 );
+ while ( yy_base[yy_current_state] != 227 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -1013,7 +1041,7 @@ YY_RULE_SETUP
#line 87 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1017 "engines/director/lingo/lingo-lex.cpp"
+#line 1045 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index df33121..3634df8 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -48,29 +48,29 @@ whitespace [\t ]
^{whitespace}
[\t]+ { return ' '; }
-down { return tDOWN; }
-if { return tIF; }
-else { return tELSE; }
-end { return tEND; }
-exit { return tEXIT; }
-frame { return tFRAME; }
-go { return tGO; }
-into { return tINTO; }
-loop { return tLOOP; }
-macro { return tMACRO; }
-mci { return tMCI; }
-mciwait { return tMCIWAIT; }
-movie { return tMOVIE; }
-next { return tNEXT; }
-of { return tOF; }
-previous { return tPREVIOUS; }
-put { return tPUT; }
-repeat { return tREPEAT; }
-set { return tSET; }
-then { return tTHEN; }
-to { return tTO; }
-with { return tWITH; }
-while { return tWHILE; }
+(?i:down) { return tDOWN; }
+(?i:if) { return tIF; }
+(?i:else) { return tELSE; }
+(?i:end) { return tEND; }
+(?i:exit) { return tEXIT; }
+(?i:frame) { return tFRAME; }
+(?i:go) { return tGO; }
+(?i:into) { return tINTO; }
+(?i:loop) { return tLOOP; }
+(?i:macro) { return tMACRO; }
+(?i:mci) { return tMCI; }
+(?i:mciwait) { return tMCIWAIT; }
+(?i:movie) { return tMOVIE; }
+(?i:next) { return tNEXT; }
+(?i:of) { return tOF; }
+(?i:previous) { return tPREVIOUS; }
+(?i:put) { return tPUT; }
+(?i:repeat) { return tREPEAT; }
+(?i:set) { return tSET; }
+(?i:then) { return tTHEN; }
+(?i:to) { return tTO; }
+(?i:with) { return tWITH; }
+(?i:while) { return tWHILE; }
[!][=] { return tNEQ; }
[>][=] { return tGE; }
Commit: aee02d7282e696d68a01465b29c4d9da0018a76d
https://github.com/scummvm/scummvm/commit/aee02d7282e696d68a01465b29c4d9da0018a76d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Initial code for function call grammar
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index e14ecfe..ef134a0 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -404,6 +404,10 @@ void Lingo::codeArg(Common::String &s) {
g_lingo->code1(g_lingo->c_assign);
}
+void Lingo::c_call() {
+ warning("STUB: c_call()");
+}
+
void Lingo::c_procret() {
warning("STUB: c_procret()");
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index d3980bd..11f9de2 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -418,18 +418,18 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 49
+#define YYFINAL 51
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 300
+#define YYLAST 315
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 51
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 20
+#define YYNNTS 21
/* YYNRULES -- Number of rules. */
-#define YYNRULES 72
+#define YYNRULES 76
/* YYNRULES -- Number of states. */
-#define YYNSTATES 148
+#define YYNSTATES 156
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -476,16 +476,16 @@ static const yytype_uint8 yytranslate[] =
#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
YYRHS. */
-static const yytype_uint8 yyprhs[] =
+static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 10, 12, 13, 15, 17, 19,
21, 23, 25, 26, 31, 36, 41, 43, 45, 53,
64, 73, 85, 98, 100, 104, 108, 111, 115, 117,
118, 119, 120, 123, 126, 128, 130, 132, 136, 140,
144, 148, 152, 156, 160, 164, 168, 171, 174, 178,
- 181, 184, 187, 189, 191, 194, 197, 200, 203, 207,
- 210, 214, 217, 220, 222, 226, 229, 233, 234, 242,
- 243, 245, 249
+ 184, 187, 190, 193, 195, 197, 200, 203, 206, 209,
+ 213, 216, 220, 223, 226, 228, 232, 235, 239, 240,
+ 248, 249, 251, 255, 260, 261, 263
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -508,15 +508,16 @@ static const yytype_int8 yyrhs[] =
63, 42, 63, -1, 63, 43, 63, -1, 63, 48,
63, -1, 63, 49, 63, -1, 63, 38, 63, -1,
63, 33, 63, -1, 63, 34, 63, -1, 40, 63,
- -1, 41, 63, -1, 46, 63, 47, -1, 20, 8,
- -1, 21, 7, -1, 26, 63, -1, 65, -1, 13,
- -1, 15, 18, -1, 15, 23, -1, 15, 25, -1,
- 15, 66, -1, 15, 66, 67, -1, 15, 67, -1,
- 30, 14, 8, -1, 14, 8, -1, 30, 8, -1,
- 8, -1, 24, 22, 8, -1, 22, 8, -1, 30,
- 22, 8, -1, -1, 19, 7, 69, 60, 70, 62,
- 61, -1, -1, 7, -1, 70, 50, 7, -1, 70,
- 50, 45, 7, -1
+ -1, 41, 63, -1, 46, 63, 47, -1, 7, 60,
+ 46, 71, 47, -1, 20, 8, -1, 21, 7, -1,
+ 26, 63, -1, 65, -1, 13, -1, 15, 18, -1,
+ 15, 23, -1, 15, 25, -1, 15, 66, -1, 15,
+ 66, 67, -1, 15, 67, -1, 30, 14, 8, -1,
+ 14, 8, -1, 30, 8, -1, 8, -1, 24, 22,
+ 8, -1, 22, 8, -1, 30, 22, 8, -1, -1,
+ 19, 7, 69, 60, 70, 62, 61, -1, -1, 7,
+ -1, 70, 50, 7, -1, 70, 50, 45, 7, -1,
+ -1, 63, -1, 71, 50, 63, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -527,9 +528,9 @@ static const yytype_uint16 yyrline[] =
147, 158, 174, 188, 189, 190, 192, 194, 200, 202,
204, 206, 207, 208, 211, 216, 221, 222, 223, 224,
225, 226, 227, 228, 229, 230, 231, 232, 233, 236,
- 237, 238, 239, 240, 251, 252, 253, 254, 259, 265,
- 272, 273, 274, 275, 278, 279, 280, 308, 308, 314,
- 315, 316, 317
+ 242, 243, 244, 245, 246, 257, 258, 259, 260, 265,
+ 271, 278, 279, 280, 281, 284, 285, 286, 314, 314,
+ 320, 321, 322, 323, 326, 327, 328
};
#endif
@@ -546,7 +547,8 @@ static const char *const yytname[] =
"'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "','",
"$accept", "program", "programline", "asgn", "stmt", "cond",
"repeatwhile", "repeatwith", "if", "begin", "end", "stmtlist", "expr",
- "func", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "argdef", 0
+ "func", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "argdef",
+ "arglist", 0
};
#endif
@@ -572,9 +574,9 @@ static const yytype_uint8 yyr1[] =
55, 55, 55, 56, 56, 56, 57, 58, 59, 60,
61, 62, 62, 62, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 64,
- 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
- 66, 66, 66, 66, 67, 67, 67, 69, 68, 70,
- 70, 70, 70
+ 64, 64, 64, 64, 64, 65, 65, 65, 65, 65,
+ 65, 66, 66, 66, 66, 67, 67, 67, 69, 68,
+ 70, 70, 70, 70, 71, 71, 71
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -584,10 +586,10 @@ static const yytype_uint8 yyr2[] =
1, 1, 0, 4, 4, 4, 1, 1, 7, 10,
8, 11, 12, 1, 3, 3, 2, 3, 1, 0,
0, 0, 2, 2, 1, 1, 1, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 2, 2, 3, 2,
- 2, 2, 1, 1, 2, 2, 2, 2, 3, 2,
- 3, 2, 2, 1, 3, 2, 3, 0, 7, 0,
- 1, 3, 4
+ 3, 3, 3, 3, 3, 3, 2, 2, 3, 5,
+ 2, 2, 2, 1, 1, 2, 2, 2, 2, 3,
+ 2, 3, 2, 2, 1, 3, 2, 3, 0, 7,
+ 0, 1, 3, 4, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -595,57 +597,61 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 34, 35, 53, 0, 28, 0, 0, 0,
+ 0, 11, 34, 35, 54, 0, 28, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 8, 9,
- 0, 0, 0, 10, 7, 52, 6, 63, 0, 54,
- 0, 55, 0, 56, 0, 57, 59, 67, 49, 50,
- 0, 36, 51, 0, 26, 0, 46, 47, 0, 1,
- 0, 3, 0, 0, 0, 0, 23, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 61, 65, 0, 62,
- 0, 0, 0, 58, 29, 0, 0, 27, 0, 0,
- 48, 2, 0, 30, 0, 0, 31, 0, 44, 45,
- 43, 37, 38, 39, 40, 41, 42, 64, 60, 66,
- 69, 13, 15, 14, 31, 0, 25, 30, 24, 70,
- 31, 30, 0, 0, 32, 33, 0, 16, 17, 0,
- 30, 0, 0, 30, 31, 0, 71, 0, 68, 0,
- 30, 31, 30, 18, 72, 20, 31, 30, 0, 30,
- 0, 0, 0, 0, 19, 0, 21, 22
+ 0, 0, 0, 10, 7, 53, 6, 0, 64, 0,
+ 55, 0, 56, 0, 57, 0, 58, 60, 68, 50,
+ 51, 35, 0, 36, 52, 0, 26, 0, 46, 47,
+ 0, 1, 0, 3, 0, 0, 0, 0, 23, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 74, 62,
+ 66, 0, 63, 0, 0, 0, 59, 29, 0, 0,
+ 27, 0, 0, 48, 2, 0, 30, 0, 0, 31,
+ 0, 44, 45, 43, 37, 38, 39, 40, 41, 42,
+ 75, 0, 65, 61, 67, 70, 13, 15, 14, 31,
+ 0, 25, 30, 24, 49, 0, 71, 31, 30, 0,
+ 0, 32, 33, 0, 16, 17, 76, 0, 30, 0,
+ 0, 30, 31, 0, 72, 0, 69, 0, 30, 31,
+ 30, 18, 73, 20, 31, 30, 0, 30, 0, 0,
+ 0, 0, 19, 0, 21, 22
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 16, 17, 41, 115, 55, 20, 21, 22, 100,
- 105, 107, 117, 118, 25, 35, 36, 26, 74, 110
+ -1, 16, 17, 43, 122, 57, 20, 21, 22, 27,
+ 110, 112, 124, 125, 25, 36, 37, 26, 77, 117,
+ 101
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -34
+#define YYPACT_NINF -43
static const yytype_int16 yypact[] =
{
- 69, -34, -34, -34, -34, 198, -34, -3, 24, 5,
- -2, 15, 12, -2, -2, -2, 8, 111, 239, -34,
- -12, 33, 2, 227, -34, -34, -34, -34, 28, -34,
- 47, -34, 58, -34, 23, 51, -34, -34, -34, -34,
- -2, -34, 162, 76, -34, -10, 87, 87, 203, -34,
- 69, -34, 2, -2, 2, 57, 215, -2, -2, -2,
- -2, -2, -2, -2, -2, -2, -34, -34, 84, -34,
- 85, 86, 77, -34, -34, 162, 93, -34, -2, -2,
- -34, -34, 54, 227, 55, 191, -34, -2, 227, 227,
- 227, 251, 251, 87, 87, 227, 227, -34, -34, -34,
- 97, -34, 227, 227, -34, 11, -34, 148, 227, -34,
- 67, 148, 75, -2, -34, -34, 56, 227, -34, 4,
- 148, 94, -2, 227, -34, 91, -34, 101, -34, 92,
- 227, -34, 148, -34, -34, -34, -34, 148, 116, 148,
- 117, 107, 121, 113, -34, 114, -34, -34
+ 72, -43, -43, -42, -43, 213, -43, 9, 13, 18,
+ -2, 15, 22, -2, -2, -2, 32, 121, 254, -43,
+ -12, 12, 118, 242, -43, -43, -43, 4, -43, 49,
+ -43, 61, -43, 48, -43, 23, 11, -43, -43, -43,
+ -43, -43, -2, -43, 177, 67, -43, -19, 142, 142,
+ 218, -43, 72, -43, 118, -2, 118, 46, 230, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -43,
+ -43, 68, -43, 70, 75, 58, -43, -43, 177, 77,
+ -43, -2, -2, -43, -43, 39, 242, 42, 206, -43,
+ -2, 242, 242, 242, 266, 266, 142, 142, 242, 242,
+ 242, -38, -43, -43, -43, 87, -43, 242, 242, -43,
+ -3, -43, 158, 242, -43, -2, -43, 45, 158, 66,
+ -2, -43, -43, 37, 242, -43, 242, -5, 158, 85,
+ -2, 242, -43, 86, -43, 94, -43, 76, 242, -43,
+ 158, -43, -43, -43, -43, 158, 92, 158, 93, 90,
+ 95, 82, -43, 83, -43, -43
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -34, -15, -34, 1, 6, -27, -34, -34, -34, -34,
- 60, -33, 0, 16, -34, -34, 99, -34, -34, -34
+ -43, -9, -43, 1, 6, -26, -43, -43, -43, 34,
+ 69, -1, 0, 19, -43, -43, 78, -43, -43, -43,
+ -43
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -655,72 +661,74 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -37
static const yytype_int16 yytable[] =
{
- 23, 18, 51, 2, 37, 3, 19, 2, 49, 3,
- 42, 126, 39, 46, 47, 48, 24, 23, 18, 45,
- 78, 112, 56, 19, 40, 82, 12, 84, 40, 79,
- 12, 69, 38, 24, 52, 81, 66, 70, 13, 14,
- 75, 113, 13, 14, 15, 71, 43, 44, 54, 127,
- 23, 18, 56, 83, 85, 67, 19, 88, 89, 90,
- 91, 92, 93, 94, 95, 96, 24, 124, 125, -5,
- 1, 111, 53, 30, 2, 32, 3, 120, 102, 103,
- 68, 72, 4, 77, 5, 6, 86, 108, 7, 8,
- 9, 132, 97, 98, 99, 10, 11, 12, 137, 71,
- 101, 104, 106, 139, 109, 122, 129, 133, 134, 13,
- 14, -4, 1, 123, -5, 15, 2, 119, 3, 135,
- 57, 58, 130, 144, 4, 59, 5, 6, 141, 143,
- 7, 8, 9, 145, 73, 64, 65, 10, 11, 12,
- 146, 147, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 13, 14, 2, 0, 3, 50, 15, 0, 0,
- 0, 4, 0, 5, 6, 0, 0, 116, 8, 9,
- 0, 121, 0, 0, 10, 11, 12, 0, 0, 76,
- 128, 0, 0, 131, 0, 0, 0, 0, 13, 14,
- 136, 0, 138, 114, 15, 57, 58, 140, 0, 142,
- 59, 0, 60, 61, 62, 63, 27, 0, 0, 0,
- 64, 65, 28, 0, 0, 0, 29, 0, 0, 0,
- 30, 31, 32, 33, 57, 58, 0, 0, 34, 59,
- 87, 60, 61, 62, 63, 0, 57, 58, 80, 64,
- 65, 59, 0, 60, 61, 62, 63, 0, 57, 58,
- 80, 64, 65, 59, 87, 60, 61, 62, 63, 0,
- 57, 58, 0, 64, 65, 59, 0, 60, 61, 62,
- 63, 0, -36, -36, 0, 64, 65, -36, 0, 0,
- 0, -36, -36, 0, 57, 58, 0, -36, -36, 59,
- 0, 0, 0, 62, 63, 0, 0, 0, 0, 64,
- 65
+ 23, 18, 134, 2, -29, 41, 19, 119, 53, 114,
+ 44, 81, 115, 48, 49, 50, 38, 23, 18, 24,
+ 82, 39, 58, 19, 42, 40, 12, 120, 85, 47,
+ 87, 72, 51, 31, 54, 33, 24, 73, 13, 14,
+ 135, 75, 78, 84, 15, 74, 45, 46, 132, 133,
+ 68, 55, 23, 18, 58, 86, 88, 69, 19, 91,
+ 92, 93, 94, 95, 96, 97, 98, 99, 100, 70,
+ 71, 24, -5, 1, 80, 89, 102, 2, 103, 3,
+ 74, 107, 108, 104, 106, 4, 109, 5, 6, 111,
+ 113, 7, 8, 9, 116, 127, 130, 137, 10, 11,
+ 12, 142, 141, 143, 149, 151, 152, 153, 118, 154,
+ 155, 105, 13, 14, 76, 126, 128, -5, 15, 0,
+ 131, -4, 1, 2, 0, 41, 2, 0, 3, 0,
+ 138, 140, 0, 0, 4, 0, 5, 6, 145, 0,
+ 7, 8, 9, 147, 42, 0, 12, 10, 11, 12,
+ 0, 0, 0, 0, 0, 0, 0, 0, 13, 14,
+ 0, 13, 14, 2, 56, 3, 52, 15, 0, 0,
+ 0, 4, 0, 5, 6, 59, 60, 0, 8, 9,
+ 61, 123, 0, 0, 10, 11, 12, 129, 0, 0,
+ 66, 67, 0, 0, 79, 0, 0, 136, 13, 14,
+ 139, 0, 0, 121, 15, 0, 0, 144, 0, 146,
+ 59, 60, 0, 0, 148, 61, 150, 62, 63, 64,
+ 65, 28, 0, 0, 0, 66, 67, 29, 0, 0,
+ 0, 30, 0, 0, 0, 31, 32, 33, 34, 59,
+ 60, 0, 0, 35, 61, 90, 62, 63, 64, 65,
+ 0, 59, 60, 83, 66, 67, 61, 0, 62, 63,
+ 64, 65, 0, 59, 60, 83, 66, 67, 61, 90,
+ 62, 63, 64, 65, 0, 59, 60, 0, 66, 67,
+ 61, 0, 62, 63, 64, 65, 0, -36, -36, 0,
+ 66, 67, -36, 0, 0, 0, -36, -36, 0, 59,
+ 60, 0, -36, -36, 61, 0, 0, 0, 64, 65,
+ 0, 0, 0, 0, 66, 67
};
static const yytype_int16 yycheck[] =
{
- 0, 0, 17, 5, 7, 7, 0, 5, 0, 7,
- 10, 7, 7, 13, 14, 15, 0, 17, 17, 7,
- 30, 10, 22, 17, 26, 52, 28, 54, 26, 39,
- 28, 8, 8, 17, 46, 50, 8, 14, 40, 41,
- 40, 30, 40, 41, 46, 22, 31, 32, 46, 45,
- 50, 50, 52, 53, 54, 8, 50, 57, 58, 59,
- 60, 61, 62, 63, 64, 65, 50, 11, 12, 0,
- 1, 104, 39, 22, 5, 24, 7, 110, 78, 79,
- 22, 30, 13, 7, 15, 16, 29, 87, 19, 20,
- 21, 124, 8, 8, 8, 26, 27, 28, 131, 22,
- 7, 47, 47, 136, 7, 30, 12, 16, 7, 40,
- 41, 0, 1, 113, 45, 46, 5, 50, 7, 27,
- 33, 34, 122, 16, 13, 38, 15, 16, 12, 12,
- 19, 20, 21, 12, 35, 48, 49, 26, 27, 28,
- 27, 27, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 40, 41, 5, -1, 7, 45, 46, -1, -1,
- -1, 13, -1, 15, 16, -1, -1, 107, 20, 21,
- -1, 111, -1, -1, 26, 27, 28, -1, -1, 17,
- 120, -1, -1, 123, -1, -1, -1, -1, 40, 41,
- 130, -1, 132, 45, 46, 33, 34, 137, -1, 139,
- 38, -1, 40, 41, 42, 43, 8, -1, -1, -1,
- 48, 49, 14, -1, -1, -1, 18, -1, -1, -1,
- 22, 23, 24, 25, 33, 34, -1, -1, 30, 38,
- 39, 40, 41, 42, 43, -1, 33, 34, 47, 48,
- 49, 38, -1, 40, 41, 42, 43, -1, 33, 34,
- 47, 48, 49, 38, 39, 40, 41, 42, 43, -1,
- 33, 34, -1, 48, 49, 38, -1, 40, 41, 42,
- 43, -1, 33, 34, -1, 48, 49, 38, -1, -1,
- -1, 42, 43, -1, 33, 34, -1, 48, 49, 38,
- -1, -1, -1, 42, 43, -1, -1, -1, -1, 48,
- 49
+ 0, 0, 7, 5, 46, 7, 0, 10, 17, 47,
+ 10, 30, 50, 13, 14, 15, 7, 17, 17, 0,
+ 39, 8, 22, 17, 26, 7, 28, 30, 54, 7,
+ 56, 8, 0, 22, 46, 24, 17, 14, 40, 41,
+ 45, 30, 42, 52, 46, 22, 31, 32, 11, 12,
+ 46, 39, 52, 52, 54, 55, 56, 8, 52, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 8,
+ 22, 52, 0, 1, 7, 29, 8, 5, 8, 7,
+ 22, 81, 82, 8, 7, 13, 47, 15, 16, 47,
+ 90, 19, 20, 21, 7, 50, 30, 12, 26, 27,
+ 28, 7, 16, 27, 12, 12, 16, 12, 109, 27,
+ 27, 77, 40, 41, 36, 115, 117, 45, 46, -1,
+ 120, 0, 1, 5, -1, 7, 5, -1, 7, -1,
+ 130, 132, -1, -1, 13, -1, 15, 16, 139, -1,
+ 19, 20, 21, 144, 26, -1, 28, 26, 27, 28,
+ -1, -1, -1, -1, -1, -1, -1, -1, 40, 41,
+ -1, 40, 41, 5, 46, 7, 45, 46, -1, -1,
+ -1, 13, -1, 15, 16, 33, 34, -1, 20, 21,
+ 38, 112, -1, -1, 26, 27, 28, 118, -1, -1,
+ 48, 49, -1, -1, 17, -1, -1, 128, 40, 41,
+ 131, -1, -1, 45, 46, -1, -1, 138, -1, 140,
+ 33, 34, -1, -1, 145, 38, 147, 40, 41, 42,
+ 43, 8, -1, -1, -1, 48, 49, 14, -1, -1,
+ -1, 18, -1, -1, -1, 22, 23, 24, 25, 33,
+ 34, -1, -1, 30, 38, 39, 40, 41, 42, 43,
+ -1, 33, 34, 47, 48, 49, 38, -1, 40, 41,
+ 42, 43, -1, 33, 34, 47, 48, 49, 38, 39,
+ 40, 41, 42, 43, -1, 33, 34, -1, 48, 49,
+ 38, -1, 40, 41, 42, 43, -1, 33, 34, -1,
+ 48, 49, 38, -1, -1, -1, 42, 43, -1, 33,
+ 34, -1, 48, 49, 38, -1, -1, -1, 42, 43,
+ -1, -1, -1, -1, 48, 49
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -729,19 +737,20 @@ static const yytype_uint8 yystos[] =
{
0, 1, 5, 7, 13, 15, 16, 19, 20, 21,
26, 27, 28, 40, 41, 46, 52, 53, 54, 55,
- 57, 58, 59, 63, 64, 65, 68, 8, 14, 18,
- 22, 23, 24, 25, 30, 66, 67, 7, 8, 7,
- 26, 54, 63, 31, 32, 7, 63, 63, 63, 0,
- 45, 52, 46, 39, 46, 56, 63, 33, 34, 38,
- 40, 41, 42, 43, 48, 49, 8, 8, 22, 8,
- 14, 22, 30, 67, 69, 63, 17, 7, 30, 39,
- 47, 52, 56, 63, 56, 63, 29, 39, 63, 63,
- 63, 63, 63, 63, 63, 63, 63, 8, 8, 8,
- 60, 7, 63, 63, 47, 61, 47, 62, 63, 7,
- 70, 62, 10, 30, 45, 55, 61, 63, 64, 50,
- 62, 61, 30, 63, 11, 12, 7, 45, 61, 12,
- 63, 61, 62, 16, 7, 27, 61, 62, 61, 62,
- 61, 12, 61, 12, 16, 12, 27, 27
+ 57, 58, 59, 63, 64, 65, 68, 60, 8, 14,
+ 18, 22, 23, 24, 25, 30, 66, 67, 7, 8,
+ 7, 7, 26, 54, 63, 31, 32, 7, 63, 63,
+ 63, 0, 45, 52, 46, 39, 46, 56, 63, 33,
+ 34, 38, 40, 41, 42, 43, 48, 49, 46, 8,
+ 8, 22, 8, 14, 22, 30, 67, 69, 63, 17,
+ 7, 30, 39, 47, 52, 56, 63, 56, 63, 29,
+ 39, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 71, 8, 8, 8, 60, 7, 63, 63, 47,
+ 61, 47, 62, 63, 47, 50, 7, 70, 62, 10,
+ 30, 45, 55, 61, 63, 64, 63, 50, 62, 61,
+ 30, 63, 11, 12, 7, 45, 61, 12, 63, 61,
+ 62, 16, 7, 27, 61, 62, 61, 62, 61, 12,
+ 61, 12, 16, 12, 27, 27
};
#define yyerrok (yyerrstatus = 0)
@@ -1793,41 +1802,51 @@ yyreduce:
case 49:
#line 236 "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); ;}
+ {
+ g_lingo->code1(g_lingo->c_call);
+ g_lingo->codeString((yyvsp[(1) - (5)].s)->c_str());
+ inst numpar = 0;
+ WRITE_UINT32(&numpar, (yyvsp[(4) - (5)].narg));
+ g_lingo->code1(numpar); ;}
break;
case 50:
-#line 237 "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); ;}
+#line 242 "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 51:
-#line 238 "engines/director/lingo/lingo-gr.y"
+#line 243 "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 52:
+#line 244 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 53:
-#line 240 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 246 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_exit); ;}
break;
- case 54:
-#line 251 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 257 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 55:
-#line 252 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 258 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 56:
-#line 253 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 259 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 57:
-#line 254 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 260 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1835,8 +1854,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 58:
-#line 259 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 265 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1845,8 +1864,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 59:
-#line 265 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 271 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1854,77 +1873,92 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 60:
-#line 272 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 278 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 61:
-#line 273 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 279 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 62:
-#line 274 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 280 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 63:
-#line 275 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 281 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 64:
-#line 278 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 284 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 65:
-#line 279 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 285 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 66:
-#line 280 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 286 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 67:
-#line 308 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 314 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 68:
-#line 309 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 315 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*(yyvsp[(2) - (7)].s), (yyvsp[(4) - (7)].code), (yyvsp[(7) - (7)].code), (yyvsp[(5) - (7)].narg));
g_lingo->_indef = false; ;}
break;
- case 69:
-#line 314 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 320 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 70:
-#line 315 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 321 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); (yyval.narg) = 1; ;}
break;
- case 71:
-#line 316 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 322 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(3) - (3)].s)); delete (yyvsp[(3) - (3)].s); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 72:
-#line 317 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 323 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(4) - (4)].s)); delete (yyvsp[(4) - (4)].s); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
+ case 74:
+#line 326 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = 0; ;}
+ break;
+
+ case 75:
+#line 327 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = 1; ;}
+ break;
+
+ case 76:
+#line 328 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
+ break;
+
/* Line 1267 of yacc.c. */
-#line 1928 "engines/director/lingo/lingo-gr.cpp"
+#line 1962 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2138,6 +2172,6 @@ yyreturn:
}
-#line 321 "engines/director/lingo/lingo-gr.y"
+#line 331 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 5b02796..bd64f93 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -80,7 +80,7 @@ using namespace Director;
%type<code> asgn begin cond end expr if repeatwhile repeatwith stmtlist
%type<s> gotoframe gotomovie
-%type<narg> argdef
+%type<narg> argdef arglist
%right '='
%left '+' '-'
@@ -233,7 +233,13 @@ expr: INT {
| '(' expr ')' { $$ = $2; }
;
-func: tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_str()); delete $2; }
+func: ID begin '(' arglist ')' {
+ g_lingo->code1(g_lingo->c_call);
+ g_lingo->codeString($1->c_str());
+ inst numpar = 0;
+ WRITE_UINT32(&numpar, $4);
+ g_lingo->code1(numpar); };
+ | tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_str()); delete $2; }
| tMCIWAIT ID { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
| tPUT expr { g_lingo->code1(g_lingo->c_printtop); }
| gotofunc
@@ -311,11 +317,15 @@ defn: tMACRO ID { g_lingo->_indef = true; }
g_lingo->define(*$2, $4, $7, $5);
g_lingo->_indef = false; }
;
-argdef: /* nothing */ { $$ = 0; }
+argdef: /* nothing */ { $$ = 0; }
| ID { g_lingo->codeArg(*$1); delete $1; $$ = 1; }
| argdef ',' ID { g_lingo->codeArg(*$3); delete $3; $$ = $1 + 1; }
| argdef ',' '\n' ID { g_lingo->codeArg(*$4); delete $4; $$ = $1 + 1; }
;
+arglist: /* nothing */ { $$ = 0; }
+ | expr { $$ = 1; }
+ | arglist ',' expr { $$ = $1 + 1; }
+ ;
%%
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 519b914..bee9479 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -146,6 +146,7 @@ public:
static void c_lt();
static void c_ge();
static void c_le();
+ static void c_call();
static void c_procret();
static void c_exit();
Commit: a910fe22dbe5452acf8ad75ef5c66162c77f7733
https://github.com/scummvm/scummvm/commit/a910fe22dbe5452acf8ad75ef5c66162c77f7733
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Refactoring for ID-related code generation
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index ef134a0..cc5777a 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -404,6 +404,20 @@ void Lingo::codeArg(Common::String &s) {
g_lingo->code1(g_lingo->c_assign);
}
+int Lingo::codeId(Common::String &s) {
+ return g_lingo->codeId_(s);
+}
+
+int Lingo::codeId_(Common::String &s) {
+ int ret = code1(c_varpush);
+
+ codeString(s.c_str());
+ code1(c_eval);
+
+ return ret;
+}
+
+
void Lingo::c_call() {
warning("STUB: c_call()");
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 11f9de2..ec98d25 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -526,11 +526,11 @@ static const yytype_uint16 yyrline[] =
0, 92, 92, 93, 94, 97, 98, 99, 100, 101,
102, 103, 104, 107, 113, 119, 127, 128, 129, 135,
147, 158, 174, 188, 189, 190, 192, 194, 200, 202,
- 204, 206, 207, 208, 211, 216, 221, 222, 223, 224,
- 225, 226, 227, 228, 229, 230, 231, 232, 233, 236,
- 242, 243, 244, 245, 246, 257, 258, 259, 260, 265,
- 271, 278, 279, 280, 281, 284, 285, 286, 314, 314,
- 320, 321, 322, 323, 326, 327, 328
+ 204, 206, 207, 208, 211, 216, 219, 220, 221, 222,
+ 223, 224, 225, 226, 227, 228, 229, 230, 231, 234,
+ 240, 241, 242, 243, 244, 255, 256, 257, 258, 263,
+ 269, 276, 277, 278, 279, 282, 283, 284, 312, 312,
+ 318, 319, 320, 321, 324, 325, 326
};
#endif
@@ -1734,74 +1734,72 @@ yyreduce:
case 35:
#line 216 "engines/director/lingo/lingo-gr.y"
{
- (yyval.code) = g_lingo->code1(g_lingo->c_varpush);
- g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str());
- g_lingo->code1(g_lingo->c_eval);
+ (yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
case 37:
-#line 222 "engines/director/lingo/lingo-gr.y"
+#line 220 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
case 38:
-#line 223 "engines/director/lingo/lingo-gr.y"
+#line 221 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
case 39:
-#line 224 "engines/director/lingo/lingo-gr.y"
+#line 222 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
case 40:
-#line 225 "engines/director/lingo/lingo-gr.y"
+#line 223 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
case 41:
-#line 226 "engines/director/lingo/lingo-gr.y"
+#line 224 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
case 42:
-#line 227 "engines/director/lingo/lingo-gr.y"
+#line 225 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
case 43:
-#line 228 "engines/director/lingo/lingo-gr.y"
+#line 226 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
case 44:
-#line 229 "engines/director/lingo/lingo-gr.y"
+#line 227 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
case 45:
-#line 230 "engines/director/lingo/lingo-gr.y"
+#line 228 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
case 46:
-#line 231 "engines/director/lingo/lingo-gr.y"
+#line 229 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 47:
-#line 232 "engines/director/lingo/lingo-gr.y"
+#line 230 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 48:
-#line 233 "engines/director/lingo/lingo-gr.y"
+#line 231 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 49:
-#line 236 "engines/director/lingo/lingo-gr.y"
+#line 234 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (5)].s)->c_str());
@@ -1811,42 +1809,42 @@ yyreduce:
break;
case 50:
-#line 242 "engines/director/lingo/lingo-gr.y"
+#line 240 "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 51:
-#line 243 "engines/director/lingo/lingo-gr.y"
+#line 241 "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 52:
-#line 244 "engines/director/lingo/lingo-gr.y"
+#line 242 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 54:
-#line 246 "engines/director/lingo/lingo-gr.y"
+#line 244 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_exit); ;}
break;
case 55:
-#line 257 "engines/director/lingo/lingo-gr.y"
+#line 255 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 56:
-#line 258 "engines/director/lingo/lingo-gr.y"
+#line 256 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 57:
-#line 259 "engines/director/lingo/lingo-gr.y"
+#line 257 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 58:
-#line 260 "engines/director/lingo/lingo-gr.y"
+#line 258 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1855,7 +1853,7 @@ yyreduce:
break;
case 59:
-#line 265 "engines/director/lingo/lingo-gr.y"
+#line 263 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1865,7 +1863,7 @@ yyreduce:
break;
case 60:
-#line 271 "engines/director/lingo/lingo-gr.y"
+#line 269 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1874,47 +1872,47 @@ yyreduce:
break;
case 61:
-#line 278 "engines/director/lingo/lingo-gr.y"
+#line 276 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 62:
-#line 279 "engines/director/lingo/lingo-gr.y"
+#line 277 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 63:
-#line 280 "engines/director/lingo/lingo-gr.y"
+#line 278 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 64:
-#line 281 "engines/director/lingo/lingo-gr.y"
+#line 279 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 65:
-#line 284 "engines/director/lingo/lingo-gr.y"
+#line 282 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 66:
-#line 285 "engines/director/lingo/lingo-gr.y"
+#line 283 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 67:
-#line 286 "engines/director/lingo/lingo-gr.y"
+#line 284 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 68:
-#line 314 "engines/director/lingo/lingo-gr.y"
+#line 312 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 69:
-#line 315 "engines/director/lingo/lingo-gr.y"
+#line 313 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*(yyvsp[(2) - (7)].s), (yyvsp[(4) - (7)].code), (yyvsp[(7) - (7)].code), (yyvsp[(5) - (7)].narg));
@@ -1922,43 +1920,43 @@ yyreduce:
break;
case 70:
-#line 320 "engines/director/lingo/lingo-gr.y"
+#line 318 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 71:
-#line 321 "engines/director/lingo/lingo-gr.y"
+#line 319 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); (yyval.narg) = 1; ;}
break;
case 72:
-#line 322 "engines/director/lingo/lingo-gr.y"
+#line 320 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(3) - (3)].s)); delete (yyvsp[(3) - (3)].s); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 73:
-#line 323 "engines/director/lingo/lingo-gr.y"
+#line 321 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(4) - (4)].s)); delete (yyvsp[(4) - (4)].s); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 74:
-#line 326 "engines/director/lingo/lingo-gr.y"
+#line 324 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 75:
-#line 327 "engines/director/lingo/lingo-gr.y"
+#line 325 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
case 76:
-#line 328 "engines/director/lingo/lingo-gr.y"
+#line 326 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 1962 "engines/director/lingo/lingo-gr.cpp"
+#line 1960 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2172,6 +2170,6 @@ yyreturn:
}
-#line 331 "engines/director/lingo/lingo-gr.y"
+#line 329 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index bd64f93..cd3fc7a 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -208,15 +208,13 @@ stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
| stmtlist stmt
;
-expr: INT {
+expr: INT {
$$ = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
WRITE_UINT32(&i, $1);
g_lingo->code1(i); };
- | ID {
- $$ = g_lingo->code1(g_lingo->c_varpush);
- g_lingo->codeString($1->c_str());
- g_lingo->code1(g_lingo->c_eval);
+ | ID {
+ $$ = g_lingo->codeId(*$1);
delete $1; }
| asgn
| expr '+' expr { g_lingo->code1(g_lingo->c_add); }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index bee9479..ef07016 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -124,6 +124,8 @@ public:
Symbol *lookupVar(const char *name);
void define(Common::String &s, int start, int end, int nargs);
void codeArg(Common::String &s);
+ int codeId(Common::String &s);
+ int codeId_(Common::String &s);
static void c_xpop();
static void c_printtop();
Commit: c48f1b5756368f5c30c706c1861eac1d63b1ef22
https://github.com/scummvm/scummvm/commit/c48f1b5756368f5c30c706c1861eac1d63b1ef22
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implement calling user-defined functions without parameters
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 4e3b1f3..8c07214 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -102,7 +102,7 @@ if par1 = 3 then\n\
else\n\
put 9\n\
end if\n\
-\n\
+shipx\n\
", kMovieScript, 1);
return Common::kNoError;
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index cc5777a..d7cbe81 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -408,11 +408,19 @@ int Lingo::codeId(Common::String &s) {
return g_lingo->codeId_(s);
}
-int Lingo::codeId_(Common::String &s) {
- int ret = code1(c_varpush);
+int Lingo::codeId_(Common::String &name) {
+ int ret;
- codeString(s.c_str());
- code1(c_eval);
+ if (!_handlers.contains(name)) { // This is a call
+ ret = code1(c_call);
+ codeString(name.c_str());
+ code1((inst)0); // Zero arguments
+ } else {
+ ret = code1(c_varpush);
+
+ codeString(name.c_str());
+ code1(c_eval);
+ }
return ret;
}
Commit: 6dc858a041a41e01d466aa4e6d1527030ef93b85
https://github.com/scummvm/scummvm/commit/6dc858a041a41e01d466aa4e6d1527030ef93b85
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Issue warning on handler redefinition
Changed paths:
engines/director/lingo/lingo-code.cpp
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index d7cbe81..ed5e787 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -384,6 +384,7 @@ void Lingo::define(Common::String &name, int start, int end, int nargs) {
if (!_handlers.contains(name)) { // Create variable if it was not defined
sym = new Symbol;
+ warning("Redefining handler '%s'", name.c_str());
delete sym->u.defn;
_handlers[name] = sym;
Commit: 3d543c62ba44013d89af5bd0804147e1d6c6c56b
https://github.com/scummvm/scummvm/commit/3d543c62ba44013d89af5bd0804147e1d6c6c56b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Initial code for c_call()
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index ed5e787..d614612 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -397,6 +397,7 @@ void Lingo::define(Common::String &name, int start, int end, int nargs) {
}
sym->u.defn = new ScriptData(&(*_currentScript)[start], end - start + 1);
+ sym->nargs = nargs;
}
void Lingo::codeArg(Common::String &s) {
@@ -412,7 +413,7 @@ int Lingo::codeId(Common::String &s) {
int Lingo::codeId_(Common::String &name) {
int ret;
- if (!_handlers.contains(name)) { // This is a call
+ if (_handlers.contains(name)) { // This is a call
ret = code1(c_call);
codeString(name.c_str());
code1((inst)0); // Zero arguments
@@ -428,7 +429,36 @@ int Lingo::codeId_(Common::String &name) {
void Lingo::c_call() {
- warning("STUB: c_call()");
+ Common::String name((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
+ g_lingo->_pc += g_lingo->calcStringAlignment(name.c_str());
+
+ if (!g_lingo->_handlers.contains(name)) {
+ error("Call to undefined handler '%s'", name.c_str());
+ }
+
+ Symbol *sym = g_lingo->_handlers[name];
+
+ int nargs = READ_UINT32(&(*g_lingo->_currentScript)[g_lingo->_pc++]);
+
+ for (int i = nargs; i < sym->nargs; i++) {
+ Datum d;
+
+ d.val = 0; // TODO, FIXME: Must be VOID
+ g_lingo->push(d);
+ }
+
+ CFrame *fp = new CFrame;
+
+ fp->sp = sym;
+ fp->retpc = g_lingo->_pc;
+ fp->retscript = g_lingo->_currentScript;
+
+ g_lingo->_callstack.push_back(fp);
+
+ g_lingo->_currentScript = sym->u.defn;
+ g_lingo->execute(0);
+
+ g_lingo->_returning = 0;
}
void Lingo::c_procret() {
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index c56cde8..332ee93 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -71,6 +71,7 @@ Symbol::Symbol() {
name = NULL;
type = VOID;
u.str = NULL;
+ nargs = 0;
}
Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index ef07016..3bbac61 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -81,9 +81,10 @@ typedef struct Symbol { /* symbol table entry */
union {
int val; /* VAR */
float fval; /* FLOAT */
- ScriptData *defn; /* FUNCTION, PROCEDURE */
+ ScriptData *defn; /* FUNCTION, PROCEDURE */
char *str; /* STRING */
} u;
+ int nargs;
Symbol();
} Symbol;
@@ -95,6 +96,12 @@ typedef union Datum { /* interpreter stack type */
Datum() { val = 0; sym = NULL; }
} Datum;
+typedef struct CFrame { /* proc/func call stack frame */
+ Symbol *sp; /* symbol table entry */
+ int retpc; /* where to resume after return */
+ ScriptData *retscript; /* which script to resume after return */
+} CFrame;
+
typedef Common::HashMap<int32, ScriptData *> ScriptHash;
typedef Common::Array<Datum> StackData;
typedef Common::HashMap<Common::String, Symbol *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> SymbolHash;
@@ -168,6 +175,8 @@ public:
bool _returning;
bool _indef;
+ Common::Array<CFrame *> _callstack;
+
private:
int parse(const char *code);
void push(Datum d);
Commit: 125600a91f1770046ca9d3206282d73b1d3e31c5
https://github.com/scummvm/scummvm/commit/125600a91f1770046ca9d3206282d73b1d3e31c5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Initial implementation of c_procret()
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index d614612..1423534 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -458,11 +458,18 @@ void Lingo::c_call() {
g_lingo->_currentScript = sym->u.defn;
g_lingo->execute(0);
- g_lingo->_returning = 0;
+ g_lingo->_returning = false;
}
void Lingo::c_procret() {
- warning("STUB: c_procret()");
+ CFrame *fp = g_lingo->_callstack.back();
+
+ g_lingo->_currentScript = fp->retscript;
+ g_lingo->_pc = fp->retpc;
+
+ delete fp;
+
+ g_lingo->_returning = true;
}
}
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 332ee93..b65fd81 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -81,6 +81,7 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
_eventHandlerTypes[t->handler] = t->name;
_currentScript = 0;
+ _currentScriptType = kMovieScript;
_pc = 0;
_returning = false;
_indef = false;
@@ -118,6 +119,7 @@ void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
}
_currentScript = new ScriptData;
+ _currentScriptType = type;
_scripts[type][id] = _currentScript;
parse(code.c_str());
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 3bbac61..b270860 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -172,6 +172,7 @@ public:
public:
ScriptData *_currentScript;
+ ScriptType _currentScriptType;
bool _returning;
bool _indef;
Commit: 9524980508c0702ae9eb114fcddc1f0be3edfc50
https://github.com/scummvm/scummvm/commit/9524980508c0702ae9eb114fcddc1f0be3edfc50
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Disable debugging code
Changed paths:
engines/director/director.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 8c07214..cb18bf6 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -73,6 +73,8 @@ Common::Error DirectorEngine::run() {
_lingo = new Lingo(this);
_soundManager = new DirectorSound();
+
+#if 0
_lingo->addCode("--\n\
macro SHIPX\n\
set x = 5\n\
@@ -146,6 +148,7 @@ end repeat\n\
_lingo->executeScript(kMovieScript, 3);
return Common::kNoError;
+#endif
//FIXME
_mainArchive = new RIFFArchive();
Commit: cc9d17c5eb9db7fc52d8407e401a14072ab9c5d7
https://github.com/scummvm/scummvm/commit/cc9d17c5eb9db7fc52d8407e401a14072ab9c5d7
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Support goto command in Score
Changed paths:
engines/director/director.cpp
engines/director/director.h
engines/director/lingo/lingo-funcs.cpp
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index cb18bf6..3c82fd9 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -56,7 +56,7 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
_mainArchive = 0;
_macBinary = 0;
_currentPalette = 0;
-
+ _movies = new Common::HashMap<Common::String, Score *>();
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "data");
SearchMan.addSubDirectoryMatching(gameDataDir, "install");
diff --git a/engines/director/director.h b/engines/director/director.h
index 8a35ac0..74dc651 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -66,6 +66,8 @@ public:
bool hasFeature(EngineFeature f) const;
const byte *getPalette() const { return _currentPalette; }
uint16 getPaletteColorCount() const { return _currentPaletteLength; }
+ Common::HashMap<Common::String, Score *> *_movies;
+ Score *_currentScore;
protected:
virtual Common::Error run();
@@ -90,7 +92,6 @@ private:
byte *_currentPalette;
uint16 _currentPaletteLength;
Lingo *_lingo;
- Score *_currentScore;
};
} // End of namespace Director
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 6975df6..74897bd 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -191,6 +191,14 @@ void Lingo::func_mciwait(Common::String &s) {
void Lingo::func_goto(Common::String &frame, Common::String &movie) {
warning("STUB: go to %s movie %s", frame.c_str(), movie.c_str());
+ if (!_vm->_movies->contains(movie))
+ error("Movie %s does not exist", movie.c_str());
+
+ _vm->_currentScore = _vm->_movies->getVal(movie);
+ _vm->_currentScore->loadArchive();
+
+ if (frame.c_str() != "")
+ _vm->_currentScore->setStartToLabel(frame);
}
}
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 74285a6..da22043 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -338,6 +338,19 @@ void Score::loadScriptText(Common::SeekableReadStream &stream) {
_movieScriptCount++;
}
+void Score::setStartToLabel(Common::String label) {
+ Common::HashMap<uint16, Common::String>::iterator i;
+
+ for (i = _labels.begin(); i != _labels.end(); ++i) {
+ if (i->_value == label) {
+ _currentFrame = i->_key;
+ return;
+ }
+ }
+
+ warning("Label %s not found", label.c_str());
+}
+
void Score::dumpScript(uint16 id, ScriptType type, Common::String script) {
Common::DumpFile out;
Common::String typeName;
@@ -556,7 +569,7 @@ void Score::startLoop() {
_trailSurface->create(_movieRect.width(), _movieRect.height());
if (_stageColor == 0)
- _trailSurface->clear(15);
+ _trailSurface->clear(_vm->getPaletteColorCount() - 1);
else
_trailSurface->clear(_stageColor);
diff --git a/engines/director/score.h b/engines/director/score.h
index a1d7281..a876a66 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -333,6 +333,7 @@ public:
static Common::Rect readRect(Common::SeekableReadStream &stream);
void loadArchive();
+ void setStartToLabel(Common::String label);
void startLoop();
void processEvents();
Commit: 9ba86b960c9e18c2ee021e6ef81e4ca6e71803b1
https://github.com/scummvm/scummvm/commit/9ba86b960c9e18c2ee021e6ef81e4ca6e71803b1
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Refactoring renderSprite
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index da22043..6d5247f 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -328,6 +328,7 @@ void Score::loadScriptText(Common::SeekableReadStream &stream) {
}
script += ch;
}
+
if (script != "")
_lingo->addCode(script, kMovieScript, _movieScriptCount);
@@ -888,8 +889,8 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
}
void Frame::prepareFrame(Score *score) {
- renderSprites(*score->_movieArchive, *score->_surface, score->_movieRect, false);
- renderSprites(*score->_movieArchive, *score->_trailSurface, score->_movieRect, true);
+ renderSprites(*score->_surface, false);
+ renderSprites(*score->_trailSurface, true);
if (_transType != 0)
//TODO Handle changing area case
@@ -1051,20 +1052,26 @@ void Frame::playTransition(Score *score) {
}
}
-void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect, bool renderTrail) {
+void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
for (uint16 i = 0; i < CHANNEL_COUNT; i++) {
if (_sprites[i]->_enabled) {
if ((_sprites[i]->_trails == 0 && renderTrail) || (_sprites[i]->_trails == 1 && !renderTrail))
continue;
+ Cast *cast = _vm->_currentScore->_casts[_sprites[i]->_castId];
+ if (cast->type == kCastText) {
+ renderText(surface, i);
+ continue;
+ }
+
DIBDecoder img;
uint32 imgId = 1024 + _sprites[i]->_castId;
- if (!_movie.hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
+ if (!_vm->_currentScore->getArchive()->hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
continue;
}
- img.loadStream(*_movie.getResource(MKTAG('D', 'I', 'B', ' '), imgId));
+ img.loadStream(*_vm->_currentScore->getArchive()->getResource(MKTAG('D', 'I', 'B', ' '), imgId));
uint32 regX = static_cast<BitmapCast *>(_sprites[i]->_cast)->regX;
uint32 regY = static_cast<BitmapCast *>(_sprites[i]->_cast)->regY;
@@ -1104,6 +1111,10 @@ void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Co
}
}
+void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID) {
+ warning("STUB: renderText()");
+}
+
void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
uint8 skipColor = _vm->getPaletteColorCount() - 1; //FIXME is it always white (last entry in pallette) ?
diff --git a/engines/director/score.h b/engines/director/score.h
index a876a66..f276ff5 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -297,7 +297,8 @@ public:
private:
void playTransition(Score *score);
void playSoundChannel();
- void renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect, bool renderTrail);
+ void renderSprites(Graphics::ManagedSurface &surface, bool renderTrail);
+ void renderText(Graphics::ManagedSurface &surface, uint16 spriteID);
void readPaletteInfo(Common::SeekableReadStream &stream);
void readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
void readMainChannels(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
@@ -336,6 +337,7 @@ public:
void setStartToLabel(Common::String label);
void startLoop();
void processEvents();
+ Archive *getArchive() const { return _movieArchive; };
Common::String getMacName() const { return _macName; }
private:
Commit: b2a152dd54e86247a06fa91c5c0ff6f092acc943
https://github.com/scummvm/scummvm/commit/b2a152dd54e86247a06fa91c5c0ff6f092acc943
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix handler calling
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 3c82fd9..6d8e51c 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -85,6 +85,7 @@ end if\n\
if x >1 then\n\
exit\n\
end if\n\
+put 100\n\
\n\
--\n\
macro ZIPX\n\
@@ -104,9 +105,14 @@ if par1 = 3 then\n\
else\n\
put 9\n\
end if\n\
-shipx\n\
", kMovieScript, 1);
+_lingo->addCode("shipx\n\
+put x\n\
+", kMovieScript, 2);
+
+_lingo->executeScript(kMovieScript, 2);
+
return Common::kNoError;
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 1423534..8d047e4 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -376,27 +376,27 @@ void Lingo::c_gotoprevious() {
warning("STUB: c_gotoprevious()");
}
-void Lingo::define(Common::String &name, int start, int end, int nargs) {
- warning("STUB: define(\"%s\", %d, %d, %d)", name.c_str(), start, end, nargs);
+void Lingo::define(Common::String &name, int start, int nargs) {
+ debug(3, "define(\"%s\", %d, %d, %d)", name.c_str(), start, _currentScript->size() - 1, nargs);
Symbol *sym;
if (!_handlers.contains(name)) { // Create variable if it was not defined
sym = new Symbol;
- warning("Redefining handler '%s'", name.c_str());
- delete sym->u.defn;
+ sym->name = (char *)calloc(name.size() + 1, 1);
+ Common::strlcpy(sym->name, name.c_str(), name.size() + 1);
+ sym->type = HANDLER;
_handlers[name] = sym;
} else {
sym = g_lingo->_handlers[name];
- sym->name = (char *)calloc(name.size() + 1, 1);
- Common::strlcpy(sym->name, name.c_str(), name.size() + 1);
- sym->type = HANDLER;
+ warning("Redefining handler '%s'", name.c_str());
+ delete sym->u.defn;
}
- sym->u.defn = new ScriptData(&(*_currentScript)[start], end - start + 1);
+ sym->u.defn = new ScriptData(&(*_currentScript)[start], _currentScript->size() - start + 1);
sym->nargs = nargs;
}
@@ -427,7 +427,6 @@ int Lingo::codeId_(Common::String &name) {
return ret;
}
-
void Lingo::c_call() {
Common::String name((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
g_lingo->_pc += g_lingo->calcStringAlignment(name.c_str());
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index ec98d25..3968b56 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -420,7 +420,7 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 51
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 315
+#define YYLAST 298
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 51
@@ -429,7 +429,7 @@ union yyalloc
/* YYNRULES -- Number of rules. */
#define YYNRULES 76
/* YYNRULES -- Number of states. */
-#define YYNSTATES 156
+#define YYNSTATES 155
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -485,7 +485,7 @@ static const yytype_uint16 yyprhs[] =
144, 148, 152, 156, 160, 164, 168, 171, 174, 178,
184, 187, 190, 193, 195, 197, 200, 203, 206, 209,
213, 216, 220, 223, 226, 228, 232, 235, 239, 240,
- 248, 249, 251, 255, 260, 261, 263
+ 247, 248, 250, 254, 259, 260, 262
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -515,9 +515,9 @@ static const yytype_int8 yyrhs[] =
66, 67, -1, 15, 67, -1, 30, 14, 8, -1,
14, 8, -1, 30, 8, -1, 8, -1, 24, 22,
8, -1, 22, 8, -1, 30, 22, 8, -1, -1,
- 19, 7, 69, 60, 70, 62, 61, -1, -1, 7,
- -1, 70, 50, 7, -1, 70, 50, 45, 7, -1,
- -1, 63, -1, 71, 50, 63, -1
+ 19, 7, 69, 60, 70, 62, -1, -1, 7, -1,
+ 70, 50, 7, -1, 70, 50, 45, 7, -1, -1,
+ 63, -1, 71, 50, 63, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -588,7 +588,7 @@ static const yytype_uint8 yyr2[] =
0, 0, 2, 2, 1, 1, 1, 3, 3, 3,
3, 3, 3, 3, 3, 3, 2, 2, 3, 5,
2, 2, 2, 1, 1, 2, 2, 2, 2, 3,
- 2, 3, 2, 2, 1, 3, 2, 3, 0, 7,
+ 2, 3, 2, 2, 1, 3, 2, 3, 0, 6,
0, 1, 3, 4, 0, 1, 3
};
@@ -609,10 +609,10 @@ static const yytype_uint8 yydefact[] =
0, 44, 45, 43, 37, 38, 39, 40, 41, 42,
75, 0, 65, 61, 67, 70, 13, 15, 14, 31,
0, 25, 30, 24, 49, 0, 71, 31, 30, 0,
- 0, 32, 33, 0, 16, 17, 76, 0, 30, 0,
- 0, 30, 31, 0, 72, 0, 69, 0, 30, 31,
- 30, 18, 73, 20, 31, 30, 0, 30, 0, 0,
- 0, 0, 19, 0, 21, 22
+ 0, 32, 33, 0, 16, 17, 76, 0, 69, 0,
+ 0, 30, 31, 0, 72, 0, 0, 30, 31, 30,
+ 18, 73, 20, 31, 30, 0, 30, 0, 0, 0,
+ 0, 19, 0, 21, 22
};
/* YYDEFGOTO[NTERM-NUM]. */
@@ -625,33 +625,33 @@ static const yytype_int8 yydefgoto[] =
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -43
+#define YYPACT_NINF -98
static const yytype_int16 yypact[] =
{
- 72, -43, -43, -42, -43, 213, -43, 9, 13, 18,
- -2, 15, 22, -2, -2, -2, 32, 121, 254, -43,
- -12, 12, 118, 242, -43, -43, -43, 4, -43, 49,
- -43, 61, -43, 48, -43, 23, 11, -43, -43, -43,
- -43, -43, -2, -43, 177, 67, -43, -19, 142, 142,
- 218, -43, 72, -43, 118, -2, 118, 46, 230, -2,
- -2, -2, -2, -2, -2, -2, -2, -2, -2, -43,
- -43, 68, -43, 70, 75, 58, -43, -43, 177, 77,
- -43, -2, -2, -43, -43, 39, 242, 42, 206, -43,
- -2, 242, 242, 242, 266, 266, 142, 142, 242, 242,
- 242, -38, -43, -43, -43, 87, -43, 242, 242, -43,
- -3, -43, 158, 242, -43, -2, -43, 45, 158, 66,
- -2, -43, -43, 37, 242, -43, 242, -5, 158, 85,
- -2, 242, -43, 86, -43, 94, -43, 76, 242, -43,
- 158, -43, -43, -43, -43, 158, 92, 158, 93, 90,
- 95, 82, -43, 83, -43, -43
+ 72, -98, -98, -25, -98, 208, -98, 38, -4, 43,
+ -2, 74, 67, -2, -2, -2, 34, 121, 159, -98,
+ 32, 41, 118, 237, -98, -98, -98, 40, -98, 76,
+ -98, 86, -98, 79, -98, 61, 27, -98, -98, -98,
+ -98, -98, -2, -98, 172, 89, -98, -14, -1, -1,
+ 213, -98, 72, -98, 118, -2, 118, 78, 225, -2,
+ -2, -2, -2, -2, -2, -2, -2, -2, -2, -98,
+ -98, 95, -98, 100, 101, 88, -98, -98, 172, 104,
+ -98, -2, -2, -98, -98, 69, 237, 77, 201, -98,
+ -2, 237, 237, 237, 249, 249, -1, -1, 237, 237,
+ 237, -19, -98, -98, -98, 107, -98, 237, 237, -98,
+ -3, -98, 158, 237, -98, -2, -98, 81, 158, 97,
+ -2, -98, -98, 18, 237, -98, 237, -5, 158, 117,
+ -2, 237, -98, 103, -98, 125, 106, 237, -98, 158,
+ -98, -98, -98, -98, 158, 123, 158, 126, 127, 133,
+ 112, -98, 124, -98, -98
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -43, -9, -43, 1, 6, -26, -43, -43, -43, 34,
- 69, -1, 0, 19, -43, -43, 78, -43, -43, -43,
- -43
+ -98, -9, -98, 1, 6, -45, -98, -98, -98, 73,
+ -42, -97, 0, 19, -98, -98, 116, -98, -98, -98,
+ -98
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -661,74 +661,70 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -37
static const yytype_int16 yytable[] =
{
- 23, 18, 134, 2, -29, 41, 19, 119, 53, 114,
- 44, 81, 115, 48, 49, 50, 38, 23, 18, 24,
- 82, 39, 58, 19, 42, 40, 12, 120, 85, 47,
- 87, 72, 51, 31, 54, 33, 24, 73, 13, 14,
- 135, 75, 78, 84, 15, 74, 45, 46, 132, 133,
- 68, 55, 23, 18, 58, 86, 88, 69, 19, 91,
- 92, 93, 94, 95, 96, 97, 98, 99, 100, 70,
- 71, 24, -5, 1, 80, 89, 102, 2, 103, 3,
- 74, 107, 108, 104, 106, 4, 109, 5, 6, 111,
- 113, 7, 8, 9, 116, 127, 130, 137, 10, 11,
- 12, 142, 141, 143, 149, 151, 152, 153, 118, 154,
- 155, 105, 13, 14, 76, 126, 128, -5, 15, 0,
- 131, -4, 1, 2, 0, 41, 2, 0, 3, 0,
- 138, 140, 0, 0, 4, 0, 5, 6, 145, 0,
- 7, 8, 9, 147, 42, 0, 12, 10, 11, 12,
- 0, 0, 0, 0, 0, 0, 0, 0, 13, 14,
+ 23, 18, 134, 2, 39, 41, 19, 119, 53, 85,
+ 44, 87, 118, 48, 49, 50, 81, 23, 18, 24,
+ 128, -29, 58, 19, 42, 82, 12, 120, 114, 132,
+ 133, 115, 59, 60, 51, 139, 24, 61, 13, 14,
+ 135, 144, 78, 84, 15, 38, 146, 66, 67, 31,
+ 40, 33, 23, 18, 58, 86, 88, 75, 19, 91,
+ 92, 93, 94, 95, 96, 97, 98, 99, 100, 72,
+ 123, 24, -5, 1, 47, 73, 129, 2, 54, 3,
+ 55, 107, 108, 74, 69, 4, 68, 5, 6, 138,
+ 113, 7, 8, 9, 70, 143, 80, 145, 10, 11,
+ 12, 71, 147, 102, 149, 45, 46, 89, 103, 104,
+ 74, 106, 13, 14, 116, 126, 109, -5, 15, 140,
+ 131, -4, 1, 2, 111, 41, 2, 130, 3, 136,
+ 137, 127, 141, 142, 4, 148, 5, 6, 150, 153,
+ 7, 8, 9, 151, 42, 152, 12, 10, 11, 12,
+ 105, 154, 76, 0, 0, 0, 0, 0, 13, 14,
0, 13, 14, 2, 56, 3, 52, 15, 0, 0,
- 0, 4, 0, 5, 6, 59, 60, 0, 8, 9,
- 61, 123, 0, 0, 10, 11, 12, 129, 0, 0,
- 66, 67, 0, 0, 79, 0, 0, 136, 13, 14,
- 139, 0, 0, 121, 15, 0, 0, 144, 0, 146,
- 59, 60, 0, 0, 148, 61, 150, 62, 63, 64,
- 65, 28, 0, 0, 0, 66, 67, 29, 0, 0,
- 0, 30, 0, 0, 0, 31, 32, 33, 34, 59,
- 60, 0, 0, 35, 61, 90, 62, 63, 64, 65,
- 0, 59, 60, 83, 66, 67, 61, 0, 62, 63,
- 64, 65, 0, 59, 60, 83, 66, 67, 61, 90,
- 62, 63, 64, 65, 0, 59, 60, 0, 66, 67,
- 61, 0, 62, 63, 64, 65, 0, -36, -36, 0,
- 66, 67, -36, 0, 0, 0, -36, -36, 0, 59,
- 60, 0, -36, -36, 61, 0, 0, 0, 64, 65,
- 0, 0, 0, 0, 66, 67
+ 0, 4, 0, 5, 6, 0, 0, 0, 8, 9,
+ 0, 0, 0, 0, 10, 11, 12, 0, 0, 79,
+ 0, 0, -36, -36, 0, 0, 0, -36, 13, 14,
+ 0, -36, -36, 121, 15, 59, 60, -36, -36, 0,
+ 61, 0, 62, 63, 64, 65, 28, 0, 0, 0,
+ 66, 67, 29, 0, 0, 0, 30, 0, 0, 0,
+ 31, 32, 33, 34, 59, 60, 0, 0, 35, 61,
+ 90, 62, 63, 64, 65, 0, 59, 60, 83, 66,
+ 67, 61, 0, 62, 63, 64, 65, 0, 59, 60,
+ 83, 66, 67, 61, 90, 62, 63, 64, 65, 0,
+ 59, 60, 0, 66, 67, 61, 0, 62, 63, 64,
+ 65, 0, 59, 60, 0, 66, 67, 61, 0, 0,
+ 0, 64, 65, 0, 0, 0, 0, 66, 67
};
static const yytype_int16 yycheck[] =
{
- 0, 0, 7, 5, 46, 7, 0, 10, 17, 47,
- 10, 30, 50, 13, 14, 15, 7, 17, 17, 0,
- 39, 8, 22, 17, 26, 7, 28, 30, 54, 7,
- 56, 8, 0, 22, 46, 24, 17, 14, 40, 41,
- 45, 30, 42, 52, 46, 22, 31, 32, 11, 12,
- 46, 39, 52, 52, 54, 55, 56, 8, 52, 59,
+ 0, 0, 7, 5, 8, 7, 0, 10, 17, 54,
+ 10, 56, 109, 13, 14, 15, 30, 17, 17, 0,
+ 117, 46, 22, 17, 26, 39, 28, 30, 47, 11,
+ 12, 50, 33, 34, 0, 132, 17, 38, 40, 41,
+ 45, 138, 42, 52, 46, 7, 143, 48, 49, 22,
+ 7, 24, 52, 52, 54, 55, 56, 30, 52, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 8,
- 22, 52, 0, 1, 7, 29, 8, 5, 8, 7,
- 22, 81, 82, 8, 7, 13, 47, 15, 16, 47,
- 90, 19, 20, 21, 7, 50, 30, 12, 26, 27,
- 28, 7, 16, 27, 12, 12, 16, 12, 109, 27,
- 27, 77, 40, 41, 36, 115, 117, 45, 46, -1,
- 120, 0, 1, 5, -1, 7, 5, -1, 7, -1,
- 130, 132, -1, -1, 13, -1, 15, 16, 139, -1,
- 19, 20, 21, 144, 26, -1, 28, 26, 27, 28,
- -1, -1, -1, -1, -1, -1, -1, -1, 40, 41,
+ 112, 52, 0, 1, 7, 14, 118, 5, 46, 7,
+ 39, 81, 82, 22, 8, 13, 46, 15, 16, 131,
+ 90, 19, 20, 21, 8, 137, 7, 139, 26, 27,
+ 28, 22, 144, 8, 146, 31, 32, 29, 8, 8,
+ 22, 7, 40, 41, 7, 115, 47, 45, 46, 16,
+ 120, 0, 1, 5, 47, 7, 5, 30, 7, 12,
+ 130, 50, 7, 27, 13, 12, 15, 16, 12, 27,
+ 19, 20, 21, 16, 26, 12, 28, 26, 27, 28,
+ 77, 27, 36, -1, -1, -1, -1, -1, 40, 41,
-1, 40, 41, 5, 46, 7, 45, 46, -1, -1,
- -1, 13, -1, 15, 16, 33, 34, -1, 20, 21,
- 38, 112, -1, -1, 26, 27, 28, 118, -1, -1,
- 48, 49, -1, -1, 17, -1, -1, 128, 40, 41,
- 131, -1, -1, 45, 46, -1, -1, 138, -1, 140,
- 33, 34, -1, -1, 145, 38, 147, 40, 41, 42,
- 43, 8, -1, -1, -1, 48, 49, 14, -1, -1,
- -1, 18, -1, -1, -1, 22, 23, 24, 25, 33,
- 34, -1, -1, 30, 38, 39, 40, 41, 42, 43,
- -1, 33, 34, 47, 48, 49, 38, -1, 40, 41,
- 42, 43, -1, 33, 34, 47, 48, 49, 38, 39,
- 40, 41, 42, 43, -1, 33, 34, -1, 48, 49,
- 38, -1, 40, 41, 42, 43, -1, 33, 34, -1,
- 48, 49, 38, -1, -1, -1, 42, 43, -1, 33,
- 34, -1, 48, 49, 38, -1, -1, -1, 42, 43,
- -1, -1, -1, -1, 48, 49
+ -1, 13, -1, 15, 16, -1, -1, -1, 20, 21,
+ -1, -1, -1, -1, 26, 27, 28, -1, -1, 17,
+ -1, -1, 33, 34, -1, -1, -1, 38, 40, 41,
+ -1, 42, 43, 45, 46, 33, 34, 48, 49, -1,
+ 38, -1, 40, 41, 42, 43, 8, -1, -1, -1,
+ 48, 49, 14, -1, -1, -1, 18, -1, -1, -1,
+ 22, 23, 24, 25, 33, 34, -1, -1, 30, 38,
+ 39, 40, 41, 42, 43, -1, 33, 34, 47, 48,
+ 49, 38, -1, 40, 41, 42, 43, -1, 33, 34,
+ 47, 48, 49, 38, 39, 40, 41, 42, 43, -1,
+ 33, 34, -1, 48, 49, 38, -1, 40, 41, 42,
+ 43, -1, 33, 34, -1, 48, 49, 38, -1, -1,
+ -1, 42, 43, -1, -1, -1, -1, 48, 49
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -748,9 +744,9 @@ static const yytype_uint8 yystos[] =
63, 71, 8, 8, 8, 60, 7, 63, 63, 47,
61, 47, 62, 63, 47, 50, 7, 70, 62, 10,
30, 45, 55, 61, 63, 64, 63, 50, 62, 61,
- 30, 63, 11, 12, 7, 45, 61, 12, 63, 61,
- 62, 16, 7, 27, 61, 62, 61, 62, 61, 12,
- 61, 12, 16, 12, 27, 27
+ 30, 63, 11, 12, 7, 45, 12, 63, 61, 62,
+ 16, 7, 27, 61, 62, 61, 62, 61, 12, 61,
+ 12, 16, 12, 27, 27
};
#define yyerrok (yyerrstatus = 0)
@@ -1569,11 +1565,6 @@ yyreduce:
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 10:
-#line 102 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_printtop); ;}
- break;
-
case 11:
#line 103 "engines/director/lingo/lingo-gr.y"
{ yyerrok; ;}
@@ -1915,7 +1906,7 @@ yyreduce:
#line 313 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_procret);
- g_lingo->define(*(yyvsp[(2) - (7)].s), (yyvsp[(4) - (7)].code), (yyvsp[(7) - (7)].code), (yyvsp[(5) - (7)].narg));
+ g_lingo->define(*(yyvsp[(2) - (6)].s), (yyvsp[(4) - (6)].code), (yyvsp[(5) - (6)].narg));
g_lingo->_indef = false; ;}
break;
@@ -1956,7 +1947,7 @@ yyreduce:
/* Line 1267 of yacc.c. */
-#line 1960 "engines/director/lingo/lingo-gr.cpp"
+#line 1951 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index cd3fc7a..c87b17e 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -99,7 +99,7 @@ programline:
| func
| asgn { g_lingo->code1(g_lingo->c_xpop); }
| stmt
- | expr { g_lingo->code1(g_lingo->c_printtop); }
+ | expr
| error { yyerrok; }
| /* empty */
;
@@ -310,9 +310,9 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
// See also:
// on keyword
defn: tMACRO ID { g_lingo->_indef = true; }
- begin argdef stmtlist end {
+ begin argdef stmtlist {
g_lingo->code1(g_lingo->c_procret);
- g_lingo->define(*$2, $4, $7, $5);
+ g_lingo->define(*$2, $4, $5);
g_lingo->_indef = false; }
;
argdef: /* nothing */ { $$ = 0; }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index b270860..67c56fa 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -129,7 +129,7 @@ public:
public:
void execute(int pc);
Symbol *lookupVar(const char *name);
- void define(Common::String &s, int start, int end, int nargs);
+ void define(Common::String &s, int start, int nargs);
void codeArg(Common::String &s);
int codeId(Common::String &s);
int codeId_(Common::String &s);
Commit: 8a884ad08cd7e638f3be19cfb49a4642f88eb7bd
https://github.com/scummvm/scummvm/commit/8a884ad08cd7e638f3be19cfb49a4642f88eb7bd
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Change ReadStream to ReadStreamEndian
Changed paths:
engines/director/lingo/lingo-funcs.cpp
engines/director/resource.cpp
engines/director/resource.h
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 74897bd..39e50f5 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -190,14 +190,13 @@ void Lingo::func_mciwait(Common::String &s) {
}
void Lingo::func_goto(Common::String &frame, Common::String &movie) {
- warning("STUB: go to %s movie %s", frame.c_str(), movie.c_str());
if (!_vm->_movies->contains(movie))
error("Movie %s does not exist", movie.c_str());
_vm->_currentScore = _vm->_movies->getVal(movie);
_vm->_currentScore->loadArchive();
- if (frame.c_str() != "")
+ if (!frame.empty())
_vm->_currentScore->setStartToLabel(frame);
}
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 3ac9b4b..5a2033a 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -34,6 +34,7 @@ namespace Director {
Archive::Archive() {
_stream = 0;
+ _isBigEndian = true;
}
Archive::~Archive() {
@@ -81,7 +82,7 @@ bool Archive::hasResource(uint32 tag, const Common::String &resName) const {
return false;
}
-Common::SeekableReadStream *Archive::getResource(uint32 tag, uint16 id) {
+Common::SeekableSubReadStreamEndian *Archive::getResource(uint32 tag, uint16 id) {
if (!_types.contains(tag))
error("Archive does not contain '%s' %04x", tag2str(tag), id);
@@ -92,7 +93,7 @@ Common::SeekableReadStream *Archive::getResource(uint32 tag, uint16 id) {
const Resource &res = resMap[id];
- return new Common::SeekableSubReadStream(_stream, res.offset, res.offset + res.size);
+ return new Common::SeekableSubReadStreamEndian(_stream, res.offset, res.offset + res.size, _isBigEndian, DisposeAfterUse::NO);
}
uint32 Archive::getOffset(uint32 tag, uint16 id) const {
@@ -211,9 +212,10 @@ bool MacArchive::openStream(Common::SeekableReadStream *stream, uint32 startOffs
return false;
}
-Common::SeekableReadStream *MacArchive::getResource(uint32 tag, uint16 id) {
+Common::SeekableSubReadStreamEndian *MacArchive::getResource(uint32 tag, uint16 id) {
assert(_resFork);
- return _resFork->getResource(tag, id);
+ Common::SeekableReadStream *stream = _resFork->getResource(tag, id);
+ return new Common::SeekableSubReadStreamEndian(stream, 0, stream->size(), DisposeAfterUse::NO);
}
// RIFF Archive code
@@ -275,7 +277,7 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
return true;
}
-Common::SeekableReadStream *RIFFArchive::getResource(uint32 tag, uint16 id) {
+Common::SeekableSubReadStreamEndian *RIFFArchive::getResource(uint32 tag, uint16 id) {
if (!_types.contains(tag))
error("Archive does not contain '%s' %04x", tag2str(tag), id);
@@ -302,7 +304,7 @@ Common::SeekableReadStream *RIFFArchive::getResource(uint32 tag, uint16 id) {
size--;
}
- return new Common::SeekableSubReadStream(_stream, offset, offset + size);
+ return new Common::SeekableSubReadStreamEndian(_stream, offset, offset + size, true, DisposeAfterUse::NO);
}
// RIFX Archive code
diff --git a/engines/director/resource.h b/engines/director/resource.h
index 93b1bd9..fda8b79 100644
--- a/engines/director/resource.h
+++ b/engines/director/resource.h
@@ -29,6 +29,7 @@
#include "common/hashmap.h"
#include "common/file.h"
#include "common/str.h"
+#include "common/substream.h"
namespace Common {
class MacResManager;
@@ -51,25 +52,23 @@ public:
bool hasResource(uint32 tag, uint16 id) const;
bool hasResource(uint32 tag, const Common::String &resName) const;
- virtual Common::SeekableReadStream *getResource(uint32 tag, uint16 id);
+ virtual Common::SeekableSubReadStreamEndian *getResource(uint32 tag, uint16 id);
uint32 getOffset(uint32 tag, uint16 id) const;
uint16 findResourceID(uint32 tag, const Common::String &resName) const;
Common::String getName(uint32 tag, uint16 id) const;
Common::Array<uint32> getResourceTypeList() const;
Common::Array<uint16> getResourceIDList(uint32 type) const;
-
+ bool _isBigEndian;
static uint32 convertTagToUppercase(uint32 tag);
protected:
Common::SeekableReadStream *_stream;
-
struct Resource {
uint32 offset;
uint32 size;
Common::String name;
};
-
typedef Common::HashMap<uint16, Resource> ResourceMap;
typedef Common::HashMap<uint32, ResourceMap> TypeMap;
TypeMap _types;
@@ -83,7 +82,7 @@ public:
void close();
bool openFile(const Common::String &fileName);
bool openStream(Common::SeekableReadStream *stream, uint32 startOffset = 0);
- Common::SeekableReadStream *getResource(uint32 tag, uint16 id);
+ Common::SeekableSubReadStreamEndian *getResource(uint32 tag, uint16 id);
private:
Common::MacResManager *_resFork;
@@ -95,18 +94,15 @@ public:
~RIFFArchive() {}
bool openStream(Common::SeekableReadStream *stream, uint32 startOffset = 0);
- Common::SeekableReadStream *getResource(uint32 tag, uint16 id);
+ Common::SeekableSubReadStreamEndian *getResource(uint32 tag, uint16 id);
};
class RIFXArchive : public Archive {
public:
- RIFXArchive() : Archive(), _isBigEndian(true) {}
+ RIFXArchive() : Archive(){ _isBigEndian = true; }
~RIFXArchive() {}
bool openStream(Common::SeekableReadStream *stream, uint32 startOffset = 0);
-
-private:
- bool _isBigEndian;
};
} // End of namespace Director
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 6d5247f..a842287 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -67,7 +67,8 @@ void Score::loadArchive() {
if (clutList.size() == 0)
error("CLUT not found");
- Common::SeekableReadStream *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]);
+
+ Common::SeekableSubReadStreamEndian *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]);
loadPalette(*pal);
g_system->getPaletteManager()->setPalette(_vm->getPalette(), 0, _vm->getPaletteColorCount());
@@ -122,7 +123,7 @@ Score::~Score() {
delete _movieArchive;
}
-void Score::loadPalette(Common::SeekableReadStream &stream) {
+void Score::loadPalette(Common::SeekableSubReadStreamEndian &stream) {
uint16 steps = stream.size() / 6;
uint16 index = (steps * 3) - 1;
uint16 _paletteColorCount = steps;
@@ -142,8 +143,8 @@ void Score::loadPalette(Common::SeekableReadStream &stream) {
_vm->setPalette(_palette, _paletteColorCount);
}
-void Score::loadFrames(Common::SeekableReadStream &stream) {
- uint32 size = stream.readUint32BE();
+void Score::loadFrames(Common::SeekableSubReadStreamEndian &stream) {
+ uint32 size = stream.readUint32();
size -= 4;
uint16 channelSize;
uint16 channelOffset;
@@ -152,7 +153,7 @@ void Score::loadFrames(Common::SeekableReadStream &stream) {
_frames.push_back(initial);
while (size != 0) {
- uint16 frameSize = stream.readUint16BE();
+ uint16 frameSize = stream.readUint16();
size -= frameSize;
frameSize -= 2;
Frame *frame = new Frame(*_frames.back());
@@ -171,16 +172,16 @@ void Score::loadFrames(Common::SeekableReadStream &stream) {
_frames.remove_at(0);
}
-void Score::loadConfig(Common::SeekableReadStream &stream) {
- /*uint16 unk1 = */ stream.readUint16BE();
- /*ver1 = */ stream.readUint16BE();
+void Score::loadConfig(Common::SeekableSubReadStreamEndian &stream) {
+ /*uint16 unk1 = */ stream.readUint16();
+ /*ver1 = */ stream.readUint16();
_movieRect = Score::readRect(stream);
- _castArrayStart = stream.readUint16BE();
- _castArrayEnd = stream.readUint16BE();
+ _castArrayStart = stream.readUint16();
+ _castArrayEnd = stream.readUint16();
_currentFrameRate = stream.readByte();
stream.skip(9);
- _stageColor = stream.readUint16BE();
+ _stageColor = stream.readUint16();
}
void Score::readVersion(uint32 rid) {
@@ -190,7 +191,7 @@ void Score::readVersion(uint32 rid) {
debug("Version: %d.%d", _versionMajor, _versionMinor);
}
-void Score::loadCastData(Common::SeekableReadStream &stream) {
+void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream) {
for (uint16 id = _castArrayStart; id <= _castArrayEnd; id++) {
byte size = stream.readByte();
@@ -234,16 +235,16 @@ void Score::loadCastData(Common::SeekableReadStream &stream) {
}
}
-void Score::loadLabels(Common::SeekableReadStream &stream) {
- uint16 count = stream.readUint16BE() + 1;
+void Score::loadLabels(Common::SeekableSubReadStreamEndian &stream) {
+ uint16 count = stream.readUint16() + 1;
uint16 offset = count * 4 + 2;
- uint16 frame = stream.readUint16BE();
- uint16 stringPos = stream.readUint16BE() + offset;
+ uint16 frame = stream.readUint16();
+ uint16 stringPos = stream.readUint16() + offset;
for (uint16 i = 0; i < count; i++) {
- uint16 nextFrame = stream.readUint16BE();
- uint16 nextStringPos = stream.readUint16BE() + offset;
+ uint16 nextFrame = stream.readUint16();
+ uint16 nextStringPos = stream.readUint16() + offset;
uint16 streamPos = stream.pos();
stream.seek(stringPos);
@@ -265,18 +266,18 @@ void Score::loadLabels(Common::SeekableReadStream &stream) {
}
}
-void Score::loadActions(Common::SeekableReadStream &stream) {
- uint16 count = stream.readUint16BE() + 1;
+void Score::loadActions(Common::SeekableSubReadStreamEndian &stream) {
+ uint16 count = stream.readUint16() + 1;
uint16 offset = count * 4 + 2;
byte id = stream.readByte();
/*byte subId = */ stream.readByte(); //I couldn't find how it used in continuity (except print). Frame actionId = 1 byte.
- uint16 stringPos = stream.readUint16BE() + offset;
+ uint16 stringPos = stream.readUint16() + offset;
for (uint16 i = 0; i < count; i++) {
uint16 nextId = stream.readByte();
/*byte subId = */ stream.readByte();
- uint16 nextStringPos = stream.readUint16BE() + offset;
+ uint16 nextStringPos = stream.readUint16() + offset;
uint16 streamPos = stream.pos();
stream.seek(stringPos);
@@ -313,10 +314,10 @@ void Score::loadActions(Common::SeekableReadStream &stream) {
}
}
-void Score::loadScriptText(Common::SeekableReadStream &stream) {
- /*uint32 unk1 = */ stream.readUint32BE();
- uint32 strLen = stream.readUint32BE();
- /*uin32 dataLen = */ stream.readUint32BE();
+void Score::loadScriptText(Common::SeekableSubReadStreamEndian &stream) {
+ /*uint32 unk1 = */ stream.readUint32();
+ uint32 strLen = stream.readUint32();
+ /*uin32 dataLen = */ stream.readUint32();
Common::String script;
for (uint32 i = 0; i < strLen; i++) {
@@ -382,7 +383,7 @@ void Score::dumpScript(uint16 id, ScriptType type, Common::String script) {
out.close();
}
-void Score::loadCastInfo(Common::SeekableReadStream &stream, uint16 id) {
+void Score::loadCastInfo(Common::SeekableSubReadStreamEndian &stream, uint16 id) {
uint32 entryType = 0;
Common::Array<Common::String> castStrings = loadStrings(stream, entryType);
CastInfo *ci = new CastInfo();
@@ -425,7 +426,7 @@ Common::String Score::getString(Common::String str) {
return str;
}
-void Score::loadFileInfo(Common::SeekableReadStream &stream) {
+void Score::loadFileInfo(Common::SeekableSubReadStreamEndian &stream) {
Common::Array<Common::String> fileInfoStrings = loadStrings(stream, _flags);
_script = fileInfoStrings[0];
@@ -443,25 +444,25 @@ void Score::loadFileInfo(Common::SeekableReadStream &stream) {
_directory = fileInfoStrings[3];
}
-Common::Array<Common::String> Score::loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader) {
+Common::Array<Common::String> Score::loadStrings(Common::SeekableSubReadStreamEndian &stream, uint32 &entryType, bool hasHeader) {
Common::Array<Common::String> strings;
uint32 offset = 0;
if (hasHeader) {
- offset = stream.readUint32BE();
- /*uint32 unk1 = */ stream.readUint32BE();
- /*uint32 unk2 = */ stream.readUint32BE();
- entryType = stream.readUint32BE();
+ offset = stream.readUint32();
+ /*uint32 unk1 = */ stream.readUint32();
+ /*uint32 unk2 = */ stream.readUint32();
+ entryType = stream.readUint32();
stream.seek(offset);
}
- uint16 count = stream.readUint16BE();
+ uint16 count = stream.readUint16();
offset += (count + 1) * 4 + 2; //positions info + uint16 count
- uint32 startPos = stream.readUint32BE() + offset;
+ uint32 startPos = stream.readUint32() + offset;
for (uint16 i = 0; i < count; i++) {
Common::String entryString;
- uint32 nextPos = stream.readUint32BE() + offset;
+ uint32 nextPos = stream.readUint32() + offset;
uint32 streamPos = stream.pos();
stream.seek(startPos);
@@ -480,13 +481,13 @@ Common::Array<Common::String> Score::loadStrings(Common::SeekableReadStream &str
return strings;
}
-void Score::loadFontMap(Common::SeekableReadStream &stream) {
- uint16 count = stream.readUint16BE();
+void Score::loadFontMap(Common::SeekableSubReadStreamEndian &stream) {
+ uint16 count = stream.readUint16();
uint32 offset = (count * 2) + 2;
uint16 currentRawPosition = offset;
for (uint16 i = 0; i < count; i++) {
- uint16 id = stream.readUint16BE();
+ uint16 id = stream.readUint16();
uint32 positionInfo = stream.pos();
stream.seek(currentRawPosition);
@@ -504,29 +505,29 @@ void Score::loadFontMap(Common::SeekableReadStream &stream) {
}
}
-BitmapCast::BitmapCast(Common::SeekableReadStream &stream) {
+BitmapCast::BitmapCast(Common::SeekableSubReadStreamEndian &stream) {
/*byte flags = */ stream.readByte();
- uint16 someFlaggyThing = stream.readUint16BE();
+ uint16 someFlaggyThing = stream.readUint16();
initialRect = Score::readRect(stream);
boundingRect = Score::readRect(stream);
- regY = stream.readUint16BE();
- regX = stream.readUint16BE();
+ regY = stream.readUint16();
+ regX = stream.readUint16();
if (someFlaggyThing & 0x8000) {
- /*uint16 unk1 =*/ stream.readUint16BE();
- /*uint16 unk2 =*/ stream.readUint16BE();
+ /*uint16 unk1 =*/ stream.readUint16();
+ /*uint16 unk2 =*/ stream.readUint16();
}
}
-TextCast::TextCast(Common::SeekableReadStream &stream) {
+TextCast::TextCast(Common::SeekableSubReadStreamEndian &stream) {
/*byte flags =*/ stream.readByte();
borderSize = static_cast<SizeType>(stream.readByte());
gutterSize = static_cast<SizeType>(stream.readByte());
boxShadow = static_cast<SizeType>(stream.readByte());
textType = static_cast<TextType>(stream.readByte());
- textAlign = static_cast<TextAlignType>(stream.readUint16BE());
+ textAlign = static_cast<TextAlignType>(stream.readUint16());
stream.skip(6); //palinfo
- /*uint32 unk1 = */ stream.readUint32BE();
+ /*uint32 unk1 = */ stream.readUint32();
initialRect = Score::readRect(stream);
textShadow = static_cast<SizeType>(stream.readByte());
byte flags = stream.readByte();
@@ -537,10 +538,10 @@ TextCast::TextCast(Common::SeekableReadStream &stream) {
if (flags & 0x4)
textFlags.push_back(kTextFlagDoNotWrap);
- /*uint16 unk2 =*/ stream.readUint16BE();
+ /*uint16 unk2 =*/ stream.readUint16();
}
-ShapeCast::ShapeCast(Common::SeekableReadStream &stream) {
+ShapeCast::ShapeCast(Common::SeekableSubReadStreamEndian &stream) {
/*byte flags = */ stream.readByte();
/*unk1 = */ stream.readByte();
shapeType = static_cast<ShapeType>(stream.readByte());
@@ -553,12 +554,12 @@ ShapeCast::ShapeCast(Common::SeekableReadStream &stream) {
lineDirection = stream.readByte();
}
-Common::Rect Score::readRect(Common::SeekableReadStream &stream) {
+Common::Rect Score::readRect(Common::SeekableSubReadStreamEndian &stream) {
Common::Rect *rect = new Common::Rect();
- rect->top = stream.readUint16BE();
- rect->left = stream.readUint16BE();
- rect->bottom = stream.readUint16BE();
- rect->right = stream.readUint16BE();
+ rect->top = stream.readUint16();
+ rect->left = stream.readUint16();
+ rect->bottom = stream.readUint16();
+ rect->right = stream.readUint16();
return *rect;
}
@@ -727,7 +728,7 @@ Frame::~Frame() {
}
}
-void Frame::readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size) {
+void Frame::readChannel(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size) {
if (offset >= 32) {
if (size <= 16)
readSprite(stream, offset, size);
@@ -748,7 +749,7 @@ void Frame::readChannel(Common::SeekableReadStream &stream, uint16 offset, uint1
}
}
-void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset, uint16 size) {
+void Frame::readMainChannels(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size) {
uint16 finishPosition = offset + size;
while (offset < finishPosition) {
@@ -784,7 +785,7 @@ void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset,
offset++;
break;
case kSound1Position:
- _sound1 = stream.readUint16LE();
+ _sound1 = stream.readUint16();
offset+=2;
break;
case kSkipFrameFlagsPosition:
@@ -796,7 +797,7 @@ void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset,
offset++;
break;
case kSound2Position:
- _sound2 = stream.readUint16LE();
+ _sound2 = stream.readUint16();
offset += 2;
break;
case kSound2TypePosition:
@@ -804,7 +805,7 @@ void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset,
offset += 1;
break;
case kPaletePosition:
- if (stream.readUint16LE())
+ if (stream.readUint16())
readPaletteInfo(stream);
offset += 16;
default:
@@ -816,16 +817,16 @@ void Frame::readMainChannels(Common::SeekableReadStream &stream, uint16 offset,
}
}
-void Frame::readPaletteInfo(Common::SeekableReadStream &stream) {
+void Frame::readPaletteInfo(Common::SeekableSubReadStreamEndian &stream) {
_palette->firstColor = stream.readByte();
_palette->lastColor = stream.readByte();
_palette->flags = stream.readByte();
_palette->speed = stream.readByte();
- _palette->frameCount = stream.readUint16LE();
+ _palette->frameCount = stream.readUint16();
stream.skip(8); //unknown
}
-void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size) {
+void Frame::readSprite(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size) {
uint16 spritePosition = (offset - 32) / 16;
uint16 spriteStart = spritePosition * 16 + 32;
@@ -845,11 +846,11 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
fieldPosition++;
break;
case kSpritePositionUnk2:
- /*byte x2 = */ stream.readUint16BE();
+ /*byte x2 = */ stream.readUint16();
fieldPosition += 2;
break;
case kSpritePositionFlags:
- sprite._flags = stream.readUint16BE();
+ sprite._flags = stream.readUint16();
sprite._ink = static_cast<InkType>(sprite._flags & 0x3f);
if (sprite._flags & 0x40)
@@ -860,23 +861,23 @@ void Frame::readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16
fieldPosition += 2;
break;
case kSpritePositionCastId:
- sprite._castId = stream.readUint16BE();
+ sprite._castId = stream.readUint16();
fieldPosition += 2;
break;
case kSpritePositionY:
- sprite._startPoint.y = stream.readUint16BE();
+ sprite._startPoint.y = stream.readUint16();
fieldPosition += 2;
break;
case kSpritePositionX:
- sprite._startPoint.x = stream.readUint16BE();
+ sprite._startPoint.x = stream.readUint16();
fieldPosition += 2;
break;
case kSpritePositionWidth:
- sprite._width = stream.readUint16BE();
+ sprite._width = stream.readUint16();
fieldPosition += 2;
break;
case kSpritePositionHeight:
- sprite._height = stream.readUint16BE();
+ sprite._height = stream.readUint16();
fieldPosition += 2;
break;
default:
diff --git a/engines/director/score.h b/engines/director/score.h
index f276ff5..af8cd17 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -171,7 +171,7 @@ struct Cast {
};
struct BitmapCast : Cast {
- BitmapCast(Common::SeekableReadStream &stream);
+ BitmapCast(Common::SeekableSubReadStreamEndian &stream);
Common::Rect boundingRect;
uint16 regX;
@@ -187,7 +187,7 @@ enum ShapeType {
};
struct ShapeCast : Cast {
- ShapeCast(Common::SeekableReadStream &stream);
+ ShapeCast(Common::SeekableSubReadStreamEndian &stream);
ShapeType shapeType;
uint16 pattern;
@@ -226,7 +226,7 @@ enum SizeType {
};
struct TextCast : Cast {
- TextCast(Common::SeekableReadStream &stream);
+ TextCast(Common::SeekableSubReadStreamEndian &stream);
SizeType borderSize;
SizeType gutterSize;
@@ -245,7 +245,7 @@ enum ButtonType {
};
struct ButtonCast : TextCast {
- ButtonCast(Common::SeekableReadStream &stream) : TextCast(stream) {
+ ButtonCast(Common::SeekableSubReadStreamEndian &stream) : TextCast(stream) {
buttonType = static_cast<ButtonType>(stream.readUint16BE());
}
@@ -290,7 +290,7 @@ public:
Frame(const Frame &frame);
~Frame();
- void readChannel(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
+ void readChannel(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
void prepareFrame(Score *score);
uint16 getSpriteIDFromPos(Common::Point pos);
@@ -299,9 +299,9 @@ private:
void playSoundChannel();
void renderSprites(Graphics::ManagedSurface &surface, bool renderTrail);
void renderText(Graphics::ManagedSurface &surface, uint16 spriteID);
- void readPaletteInfo(Common::SeekableReadStream &stream);
- void readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
- void readMainChannels(Common::SeekableReadStream &stream, uint16 offset, uint16 size);
+ void readPaletteInfo(Common::SeekableSubReadStreamEndian &stream);
+ void readSprite(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
+ void readMainChannels(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
void drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
void drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
void drawGhostSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
@@ -332,9 +332,12 @@ public:
Score(DirectorEngine *vm);
~Score();
- static Common::Rect readRect(Common::SeekableReadStream &stream);
+ static Common::Rect readRect(Common::SeekableSubReadStreamEndian &stream);
void loadArchive();
void setStartToLabel(Common::String label);
+ void goToLoop();
+ void goToNext();
+ void goToPrevious();
void startLoop();
void processEvents();
Archive *getArchive() const { return _movieArchive; };
@@ -343,19 +346,19 @@ public:
private:
void update();
void readVersion(uint32 rid);
- void loadConfig(Common::SeekableReadStream &stream);
- void loadPalette(Common::SeekableReadStream &stream);
- void loadCastData(Common::SeekableReadStream &stream);
- void loadFrames(Common::SeekableReadStream &stream);
- void loadLabels(Common::SeekableReadStream &stream);
- void loadActions(Common::SeekableReadStream &stream);
- void loadCastInfo(Common::SeekableReadStream &stream, uint16 id);
- void loadScriptText(Common::SeekableReadStream &stream);
- void loadFileInfo(Common::SeekableReadStream &stream);
- void loadFontMap(Common::SeekableReadStream &stream);
+ void loadConfig(Common::SeekableSubReadStreamEndian &stream);
+ void loadPalette(Common::SeekableSubReadStreamEndian &stream);
+ void loadCastData(Common::SeekableSubReadStreamEndian &stream);
+ void loadFrames(Common::SeekableSubReadStreamEndian &stream);
+ void loadLabels(Common::SeekableSubReadStreamEndian &stream);
+ void loadActions(Common::SeekableSubReadStreamEndian &stream);
+ void loadCastInfo(Common::SeekableSubReadStreamEndian &stream, uint16 id);
+ void loadScriptText(Common::SeekableSubReadStreamEndian &stream);
+ void loadFileInfo(Common::SeekableSubReadStreamEndian &stream);
+ void loadFontMap(Common::SeekableSubReadStreamEndian &stream);
void dumpScript(uint16 id, ScriptType type, Common::String script);
Common::String getString(Common::String str);
- Common::Array<Common::String> loadStrings(Common::SeekableReadStream &stream, uint32 &entryType, bool hasHeader = true);
+ Common::Array<Common::String> loadStrings(Common::SeekableSubReadStreamEndian &stream, uint32 &entryType, bool hasHeader = true);
public:
Common::Array<Frame *> _frames;
Commit: e93960e200319b61bae57bfc4c1d75d710744fb2
https://github.com/scummvm/scummvm/commit/e93960e200319b61bae57bfc4c1d75d710744fb2
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add to Score jump labels commands
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index a842287..5b05ed6 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -406,6 +406,63 @@ void Score::loadCastInfo(Common::SeekableSubReadStreamEndian &stream, uint16 id)
_castsInfo[id] = ci;
}
+void Score::goToLoop() {
+ //This command has the playback head contonuously return to the first marker to to the left and then loop back.
+ //If no marker are to the left of the playback head, the playback head continues to the right.
+ Common::HashMap<uint16, Common::String>::iterator i;
+
+ for (i = _labels.begin(); i != _labels.end(); ++i) {
+ if (i->_value == _currentLabel) {
+ _currentFrame = i->_key;
+ return;
+ }
+ }
+}
+
+void Score::goToNext() {
+ Common::HashMap<uint16, Common::String>::iterator i;
+
+ for (i = _labels.begin(); i != _labels.end(); ++i) {
+ if (i->_value == _currentLabel) {
+ if (i != _labels.end()) {
+ //return to the first marker to to the right
+ ++i;
+ _currentFrame = i->_key;
+ return;
+ } else {
+ //if no markers are to the right of the playback head,
+ //the playback head goes to the first marker to the left
+ _currentFrame = i->_key;
+ return;
+ }
+ }
+ }
+ //If there are not markers to the left,
+ //the playback head goes to frame 1, (Director frame array start from 1, engine from 0)
+ _currentFrame = 0;
+}
+void Score::goToPrevious() {
+ //One label
+ if (_labels.begin() == _labels.end()) {
+ _currentFrame = _labels.begin()->_key;
+ return;
+ }
+
+ Common::HashMap<uint16, Common::String>::iterator previous = _labels.begin();
+ Common::HashMap<uint16, Common::String>::iterator i = previous++; //because iterator havent decrement operator
+
+ for (i = _labels.begin(); i != _labels.end(); ++i, ++previous) {
+ if (i->_value == _currentLabel) {
+ _currentFrame = previous->_key;
+ return;
+ } else {
+ _currentFrame = i->_key;
+ return;
+ }
+ }
+ _currentFrame = 0;
+}
+
Common::String Score::getString(Common::String str) {
if (str.size() == 0) {
return str;
@@ -613,6 +670,9 @@ void Score::update() {
//TODO Director 6 step: send prepareFrame event to all sprites and the script channel in upcoming frame
//_lingo->processEvent(kEventPrepareFrame, _currentFrame);
_currentFrame++;
+ if (_labels.contains(_currentFrame)) {
+ _currentLabel = _labels[_currentFrame];
+ }
_frames[_currentFrame]->prepareFrame(this);
//Stage is drawn between the prepareFrame and enterFrame events (Lingo in a Nutshell)
diff --git a/engines/director/score.h b/engines/director/score.h
index af8cd17..9aeb66e 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -383,6 +383,7 @@ private:
byte _currentFrameRate;
uint16 _castArrayStart;
uint16 _currentFrame;
+ Common::String _currentLabel;
uint32 _nextFrameTime;
uint32 _flags;
bool _stopPlay;
Commit: d440a73a41bb0d1dd6df22013a8df9b6b596600e
https://github.com/scummvm/scummvm/commit/d440a73a41bb0d1dd6df22013a8df9b6b596600e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix handler parameter assigning. Added more debug output.
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 6d8e51c..cb31f88 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -75,6 +75,29 @@ Common::Error DirectorEngine::run() {
_soundManager = new DirectorSound();
#if 0
+_lingo->addCode("--\n\
+macro check par1, par2\n\
+if par1 = 3 then\n\
+ put -3\n\
+else\n\
+ put 0\n\
+end if\n\
+if par2 = 2 then\n\
+ put 2\n\
+else\n\
+ put 0\n\
+end if\n\
+put par1\n\
+put par2\n\
+", kMovieScript, 5);
+
+_lingo->addCode("check(3, 2)\n\
+", kMovieScript, 2);
+
+_lingo->executeScript(kMovieScript, 2);
+
+return Common::kNoError;
+
_lingo->addCode("--\n\
macro SHIPX\n\
set x = 5\n\
@@ -107,7 +130,8 @@ else\n\
end if\n\
", kMovieScript, 1);
-_lingo->addCode("shipx\n\
+_lingo->addCode("check(2, 3)\n\
+shipx\n\
put x\n\
", kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 8d047e4..3ddc276 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -53,6 +53,12 @@ namespace Director {
void Lingo::execute(int pc) {
for(_pc = pc; (*_currentScript)[_pc] != STOP && !_returning;) {
+
+ for (int i = 0; i < _stack.size(); i++) {
+ debugN(5, "%d ", _stack[i].val);
+ }
+ debug(5, "");
+
_pc++;
(*((*_currentScript)[_pc - 1]))();
}
@@ -404,6 +410,7 @@ void Lingo::codeArg(Common::String &s) {
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString(s.c_str());
g_lingo->code1(g_lingo->c_assign);
+ g_lingo->code1(g_lingo->c_xpop);
}
int Lingo::codeId(Common::String &s) {
Commit: 840487d2ef1aa50748e526bd70dc2b7a3677d7eb
https://github.com/scummvm/scummvm/commit/840487d2ef1aa50748e526bd70dc2b7a3677d7eb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Parse macro definitions reliably
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.cpp
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 3968b56..d1262f1 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -420,14 +420,14 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 51
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 298
+#define YYLAST 255
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 51
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 21
/* YYNRULES -- Number of rules. */
-#define YYNRULES 76
+#define YYNRULES 75
/* YYNRULES -- Number of states. */
#define YYNSTATES 155
@@ -478,59 +478,59 @@ static const yytype_uint8 yytranslate[] =
YYRHS. */
static const yytype_uint16 yyprhs[] =
{
- 0, 0, 3, 7, 10, 12, 13, 15, 17, 19,
- 21, 23, 25, 26, 31, 36, 41, 43, 45, 53,
- 64, 73, 85, 98, 100, 104, 108, 111, 115, 117,
- 118, 119, 120, 123, 126, 128, 130, 132, 136, 140,
- 144, 148, 152, 156, 160, 164, 168, 171, 174, 178,
- 184, 187, 190, 193, 195, 197, 200, 203, 206, 209,
- 213, 216, 220, 223, 226, 228, 232, 235, 239, 240,
- 247, 248, 250, 254, 259, 260, 262
+ 0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
+ 20, 22, 23, 28, 33, 38, 40, 42, 50, 61,
+ 70, 82, 95, 97, 101, 105, 108, 112, 114, 115,
+ 116, 117, 120, 123, 125, 127, 129, 133, 137, 141,
+ 145, 149, 153, 157, 161, 165, 168, 171, 175, 181,
+ 184, 187, 190, 192, 194, 197, 200, 203, 206, 210,
+ 213, 217, 220, 223, 225, 229, 232, 236, 237, 245,
+ 246, 248, 252, 257, 258, 260
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 52, 0, -1, 53, 45, 52, -1, 53, 52, -1,
- 53, -1, -1, 68, -1, 64, -1, 54, -1, 55,
- -1, 63, -1, 1, -1, -1, 26, 63, 17, 7,
- -1, 28, 7, 39, 63, -1, 28, 7, 30, 63,
- -1, 63, -1, 64, -1, 59, 56, 29, 62, 61,
- 12, 16, -1, 59, 56, 29, 62, 61, 11, 62,
- 61, 12, 16, -1, 57, 46, 56, 47, 62, 61,
- 12, 27, -1, 58, 39, 63, 61, 30, 63, 61,
- 62, 61, 12, 27, -1, 58, 39, 63, 61, 10,
- 30, 63, 61, 62, 61, 12, 27, -1, 63, -1,
- 63, 39, 63, -1, 46, 56, 47, -1, 27, 32,
- -1, 27, 31, 7, -1, 16, -1, -1, -1, -1,
- 62, 45, -1, 62, 55, -1, 5, -1, 7, -1,
- 54, -1, 63, 40, 63, -1, 63, 41, 63, -1,
- 63, 42, 63, -1, 63, 43, 63, -1, 63, 48,
- 63, -1, 63, 49, 63, -1, 63, 38, 63, -1,
- 63, 33, 63, -1, 63, 34, 63, -1, 40, 63,
- -1, 41, 63, -1, 46, 63, 47, -1, 7, 60,
- 46, 71, 47, -1, 20, 8, -1, 21, 7, -1,
- 26, 63, -1, 65, -1, 13, -1, 15, 18, -1,
- 15, 23, -1, 15, 25, -1, 15, 66, -1, 15,
- 66, 67, -1, 15, 67, -1, 30, 14, 8, -1,
- 14, 8, -1, 30, 8, -1, 8, -1, 24, 22,
- 8, -1, 22, 8, -1, 30, 22, 8, -1, -1,
- 19, 7, 69, 60, 70, 62, -1, -1, 7, -1,
- 70, 50, 7, -1, 70, 50, 45, 7, -1, -1,
- 63, -1, 71, 50, 63, -1
+ 52, 0, -1, 53, 45, 52, -1, 53, -1, -1,
+ 68, -1, 64, -1, 54, -1, 55, -1, 63, -1,
+ 1, -1, -1, 26, 63, 17, 7, -1, 28, 7,
+ 39, 63, -1, 28, 7, 30, 63, -1, 63, -1,
+ 64, -1, 59, 56, 29, 62, 61, 12, 16, -1,
+ 59, 56, 29, 62, 61, 11, 62, 61, 12, 16,
+ -1, 57, 46, 56, 47, 62, 61, 12, 27, -1,
+ 58, 39, 63, 61, 30, 63, 61, 62, 61, 12,
+ 27, -1, 58, 39, 63, 61, 10, 30, 63, 61,
+ 62, 61, 12, 27, -1, 63, -1, 63, 39, 63,
+ -1, 46, 56, 47, -1, 27, 32, -1, 27, 31,
+ 7, -1, 16, -1, -1, -1, -1, 62, 45, -1,
+ 62, 55, -1, 5, -1, 7, -1, 54, -1, 63,
+ 40, 63, -1, 63, 41, 63, -1, 63, 42, 63,
+ -1, 63, 43, 63, -1, 63, 48, 63, -1, 63,
+ 49, 63, -1, 63, 38, 63, -1, 63, 33, 63,
+ -1, 63, 34, 63, -1, 40, 63, -1, 41, 63,
+ -1, 46, 63, 47, -1, 7, 60, 46, 71, 47,
+ -1, 20, 8, -1, 21, 7, -1, 26, 63, -1,
+ 65, -1, 13, -1, 15, 18, -1, 15, 23, -1,
+ 15, 25, -1, 15, 66, -1, 15, 66, 67, -1,
+ 15, 67, -1, 30, 14, 8, -1, 14, 8, -1,
+ 30, 8, -1, 8, -1, 24, 22, 8, -1, 22,
+ 8, -1, 30, 22, 8, -1, -1, 19, 7, 69,
+ 60, 70, 45, 62, -1, -1, 7, -1, 70, 50,
+ 7, -1, 70, 50, 45, 7, -1, -1, 63, -1,
+ 71, 50, 63, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 92, 92, 93, 94, 97, 98, 99, 100, 101,
- 102, 103, 104, 107, 113, 119, 127, 128, 129, 135,
- 147, 158, 174, 188, 189, 190, 192, 194, 200, 202,
- 204, 206, 207, 208, 211, 216, 219, 220, 221, 222,
- 223, 224, 225, 226, 227, 228, 229, 230, 231, 234,
- 240, 241, 242, 243, 244, 255, 256, 257, 258, 263,
- 269, 276, 277, 278, 279, 282, 283, 284, 312, 312,
- 318, 319, 320, 321, 324, 325, 326
+ 0, 92, 92, 93, 96, 97, 98, 99, 100, 101,
+ 102, 103, 106, 112, 118, 126, 127, 128, 134, 146,
+ 157, 173, 187, 188, 189, 191, 193, 199, 201, 203,
+ 205, 206, 207, 210, 215, 218, 219, 220, 221, 222,
+ 223, 224, 225, 226, 227, 228, 229, 230, 233, 239,
+ 240, 241, 242, 243, 254, 255, 256, 257, 262, 268,
+ 275, 276, 277, 278, 281, 282, 283, 311, 311, 317,
+ 318, 319, 320, 323, 324, 325
};
#endif
@@ -569,27 +569,27 @@ static const yytype_uint16 yytoknum[] =
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 51, 52, 52, 52, 53, 53, 53, 53, 53,
- 53, 53, 53, 54, 54, 54, 55, 55, 55, 55,
- 55, 55, 55, 56, 56, 56, 57, 58, 59, 60,
- 61, 62, 62, 62, 63, 63, 63, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 63, 63, 63, 64,
- 64, 64, 64, 64, 64, 65, 65, 65, 65, 65,
- 65, 66, 66, 66, 66, 67, 67, 67, 69, 68,
- 70, 70, 70, 70, 71, 71, 71
+ 0, 51, 52, 52, 53, 53, 53, 53, 53, 53,
+ 53, 53, 54, 54, 54, 55, 55, 55, 55, 55,
+ 55, 55, 56, 56, 56, 57, 58, 59, 60, 61,
+ 62, 62, 62, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 64, 64,
+ 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
+ 66, 66, 66, 66, 67, 67, 67, 69, 68, 70,
+ 70, 70, 70, 71, 71, 71
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
- 0, 2, 3, 2, 1, 0, 1, 1, 1, 1,
- 1, 1, 0, 4, 4, 4, 1, 1, 7, 10,
- 8, 11, 12, 1, 3, 3, 2, 3, 1, 0,
- 0, 0, 2, 2, 1, 1, 1, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 2, 2, 3, 5,
- 2, 2, 2, 1, 1, 2, 2, 2, 2, 3,
- 2, 3, 2, 2, 1, 3, 2, 3, 0, 6,
- 0, 1, 3, 4, 0, 1, 3
+ 0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
+ 1, 0, 4, 4, 4, 1, 1, 7, 10, 8,
+ 11, 12, 1, 3, 3, 2, 3, 1, 0, 0,
+ 0, 2, 2, 1, 1, 1, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 2, 2, 3, 5, 2,
+ 2, 2, 1, 1, 2, 2, 2, 2, 3, 2,
+ 3, 2, 2, 1, 3, 2, 3, 0, 7, 0,
+ 1, 3, 4, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -597,134 +597,126 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 34, 35, 54, 0, 28, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 8, 9,
- 0, 0, 0, 10, 7, 53, 6, 0, 64, 0,
- 55, 0, 56, 0, 57, 0, 58, 60, 68, 50,
- 51, 35, 0, 36, 52, 0, 26, 0, 46, 47,
- 0, 1, 0, 3, 0, 0, 0, 0, 23, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 74, 62,
- 66, 0, 63, 0, 0, 0, 59, 29, 0, 0,
- 27, 0, 0, 48, 2, 0, 30, 0, 0, 31,
- 0, 44, 45, 43, 37, 38, 39, 40, 41, 42,
- 75, 0, 65, 61, 67, 70, 13, 15, 14, 31,
- 0, 25, 30, 24, 49, 0, 71, 31, 30, 0,
- 0, 32, 33, 0, 16, 17, 76, 0, 69, 0,
- 0, 30, 31, 0, 72, 0, 0, 30, 31, 30,
- 18, 73, 20, 31, 30, 0, 30, 0, 0, 0,
- 0, 19, 0, 21, 22
+ 0, 10, 33, 34, 53, 0, 27, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 3, 35, 8,
+ 0, 0, 0, 9, 6, 52, 5, 0, 63, 0,
+ 54, 0, 55, 0, 56, 0, 57, 59, 67, 49,
+ 50, 34, 0, 35, 51, 0, 25, 0, 45, 46,
+ 0, 1, 0, 0, 0, 0, 0, 22, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 73, 61, 65,
+ 0, 62, 0, 0, 0, 58, 28, 0, 0, 26,
+ 0, 0, 47, 2, 0, 29, 0, 0, 30, 0,
+ 43, 44, 42, 36, 37, 38, 39, 40, 41, 74,
+ 0, 64, 60, 66, 69, 12, 14, 13, 30, 0,
+ 24, 29, 23, 48, 0, 70, 0, 29, 0, 0,
+ 31, 32, 0, 15, 16, 75, 30, 0, 0, 0,
+ 29, 30, 0, 68, 71, 0, 0, 29, 30, 29,
+ 17, 72, 19, 30, 29, 0, 29, 0, 0, 0,
+ 0, 18, 0, 20, 21
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 16, 17, 43, 122, 57, 20, 21, 22, 27,
- 110, 112, 124, 125, 25, 36, 37, 26, 77, 117,
- 101
+ -1, 16, 17, 43, 121, 56, 20, 21, 22, 27,
+ 109, 111, 123, 124, 25, 36, 37, 26, 76, 116,
+ 100
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -98
+#define YYPACT_NINF -106
static const yytype_int16 yypact[] =
{
- 72, -98, -98, -25, -98, 208, -98, 38, -4, 43,
- -2, 74, 67, -2, -2, -2, 34, 121, 159, -98,
- 32, 41, 118, 237, -98, -98, -98, 40, -98, 76,
- -98, 86, -98, 79, -98, 61, 27, -98, -98, -98,
- -98, -98, -2, -98, 172, 89, -98, -14, -1, -1,
- 213, -98, 72, -98, 118, -2, 118, 78, 225, -2,
- -2, -2, -2, -2, -2, -2, -2, -2, -2, -98,
- -98, 95, -98, 100, 101, 88, -98, -98, 172, 104,
- -98, -2, -2, -98, -98, 69, 237, 77, 201, -98,
- -2, 237, 237, 237, 249, 249, -1, -1, 237, 237,
- 237, -19, -98, -98, -98, 107, -98, 237, 237, -98,
- -3, -98, 158, 237, -98, -2, -98, 81, 158, 97,
- -2, -98, -98, 18, 237, -98, 237, -5, 158, 117,
- -2, 237, -98, 103, -98, 125, 106, 237, -98, 158,
- -98, -98, -98, -98, 158, 123, 158, 126, 127, 133,
- 112, -98, 124, -98, -98
+ 71, -106, -106, -39, -106, 165, -106, 22, 3, 26,
+ 98, 17, 30, 98, 98, 98, 44, 24, 1, -106,
+ 27, 31, 140, 194, -106, -106, -106, 28, -106, 67,
+ -106, 69, -106, 57, -106, 13, 6, -106, -106, -106,
+ -106, -106, 98, -106, 129, 75, -106, -21, 206, 206,
+ 170, -106, 71, 140, 98, 140, 54, 182, 98, 98,
+ 98, 98, 98, 98, 98, 98, 98, 98, -106, -106,
+ 77, -106, 80, 85, 72, -106, -106, 129, 88, -106,
+ 98, 98, -106, -106, 49, 194, 53, 158, -106, 98,
+ 194, 194, 194, 116, 116, 206, 206, 194, 194, 194,
+ -30, -106, -106, -106, 94, -106, 194, 194, -106, -7,
+ -106, 115, 194, -106, 98, -106, -26, 115, 74, 98,
+ -106, -106, 39, 194, -106, 194, -106, -5, 90, 98,
+ 194, -106, 91, 115, -106, 99, 81, 194, -106, 115,
+ -106, -106, -106, -106, 115, 97, 115, 101, 102, 103,
+ 83, -106, 96, -106, -106
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -98, -9, -98, 1, 6, -45, -98, -98, -98, 73,
- -42, -97, 0, 19, -98, -98, 116, -98, -98, -98,
- -98
+ -106, 73, -106, 4, 5, -8, -106, -106, -106, 45,
+ -105, -100, 0, 16, -106, -106, 104, -106, -106, -106,
+ -106
};
/* 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 -37
+#define YYTABLE_NINF -29
static const yytype_int16 yytable[] =
{
- 23, 18, 134, 2, 39, 41, 19, 119, 53, 85,
- 44, 87, 118, 48, 49, 50, 81, 23, 18, 24,
- 128, -29, 58, 19, 42, 82, 12, 120, 114, 132,
- 133, 115, 59, 60, 51, 139, 24, 61, 13, 14,
- 135, 144, 78, 84, 15, 38, 146, 66, 67, 31,
- 40, 33, 23, 18, 58, 86, 88, 75, 19, 91,
- 92, 93, 94, 95, 96, 97, 98, 99, 100, 72,
- 123, 24, -5, 1, 47, 73, 129, 2, 54, 3,
- 55, 107, 108, 74, 69, 4, 68, 5, 6, 138,
- 113, 7, 8, 9, 70, 143, 80, 145, 10, 11,
- 12, 71, 147, 102, 149, 45, 46, 89, 103, 104,
- 74, 106, 13, 14, 116, 126, 109, -5, 15, 140,
- 131, -4, 1, 2, 111, 41, 2, 130, 3, 136,
- 137, 127, 141, 142, 4, 148, 5, 6, 150, 153,
- 7, 8, 9, 151, 42, 152, 12, 10, 11, 12,
- 105, 154, 76, 0, 0, 0, 0, 0, 13, 14,
- 0, 13, 14, 2, 56, 3, 52, 15, 0, 0,
- 0, 4, 0, 5, 6, 0, 0, 0, 8, 9,
- 0, 0, 0, 0, 10, 11, 12, 0, 0, 79,
- 0, 0, -36, -36, 0, 0, 0, -36, 13, 14,
- 0, -36, -36, 121, 15, 59, 60, -36, -36, 0,
- 61, 0, 62, 63, 64, 65, 28, 0, 0, 0,
- 66, 67, 29, 0, 0, 0, 30, 0, 0, 0,
- 31, 32, 33, 34, 59, 60, 0, 0, 35, 61,
- 90, 62, 63, 64, 65, 0, 59, 60, 83, 66,
- 67, 61, 0, 62, 63, 64, 65, 0, 59, 60,
- 83, 66, 67, 61, 90, 62, 63, 64, 65, 0,
- 59, 60, 0, 66, 67, 61, 0, 62, 63, 64,
- 65, 0, 59, 60, 0, 66, 67, 61, 0, 0,
- 0, 64, 65, 0, 0, 0, 0, 66, 67
+ 23, -7, 134, 118, 18, 19, 122, -28, 117, 80,
+ 44, 39, 128, 48, 49, 50, 24, 113, 81, 126,
+ 114, 71, 57, 119, 127, 138, 133, 72, 31, 38,
+ 33, 139, 143, 40, 145, 73, 74, 47, 144, 147,
+ 135, 149, 77, 146, 51, 84, -7, 86, 45, 46,
+ 131, 132, 23, 57, 85, 87, 18, 19, 90, 91,
+ 92, 93, 94, 95, 96, 97, 98, 99, 24, 52,
+ 54, -4, 1, 53, 67, 68, 2, 69, 3, 70,
+ 106, 107, 79, 88, 4, 101, 5, 6, 102, 112,
+ 7, 8, 9, 103, 73, 105, 108, 10, 11, 12,
+ 110, 115, 136, 2, 129, 41, 141, 140, 142, 148,
+ 153, 13, 14, 150, 125, 152, -4, 15, 151, 130,
+ 2, 104, 3, 154, 42, 83, 12, 0, 4, 137,
+ 5, 6, 0, 0, 0, 8, 9, 0, 13, 14,
+ 75, 10, 11, 12, 15, 2, 78, 41, 0, 58,
+ 59, 0, 0, 0, 60, 13, 14, 0, 63, 64,
+ 120, 15, 58, 59, 65, 66, 42, 60, 12, 61,
+ 62, 63, 64, 28, 0, 0, 0, 65, 66, 29,
+ 13, 14, 0, 30, 0, 0, 55, 31, 32, 33,
+ 34, 58, 59, 0, 0, 35, 60, 89, 61, 62,
+ 63, 64, 0, 58, 59, 82, 65, 66, 60, 0,
+ 61, 62, 63, 64, 0, 58, 59, 82, 65, 66,
+ 60, 89, 61, 62, 63, 64, 0, 58, 59, 0,
+ 65, 66, 60, 0, 61, 62, 63, 64, 0, 58,
+ 59, 0, 65, 66, 60, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 65, 66
};
static const yytype_int16 yycheck[] =
{
- 0, 0, 7, 5, 8, 7, 0, 10, 17, 54,
- 10, 56, 109, 13, 14, 15, 30, 17, 17, 0,
- 117, 46, 22, 17, 26, 39, 28, 30, 47, 11,
- 12, 50, 33, 34, 0, 132, 17, 38, 40, 41,
- 45, 138, 42, 52, 46, 7, 143, 48, 49, 22,
- 7, 24, 52, 52, 54, 55, 56, 30, 52, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 8,
- 112, 52, 0, 1, 7, 14, 118, 5, 46, 7,
- 39, 81, 82, 22, 8, 13, 46, 15, 16, 131,
- 90, 19, 20, 21, 8, 137, 7, 139, 26, 27,
- 28, 22, 144, 8, 146, 31, 32, 29, 8, 8,
- 22, 7, 40, 41, 7, 115, 47, 45, 46, 16,
- 120, 0, 1, 5, 47, 7, 5, 30, 7, 12,
- 130, 50, 7, 27, 13, 12, 15, 16, 12, 27,
- 19, 20, 21, 16, 26, 12, 28, 26, 27, 28,
- 77, 27, 36, -1, -1, -1, -1, -1, 40, 41,
- -1, 40, 41, 5, 46, 7, 45, 46, -1, -1,
- -1, 13, -1, 15, 16, -1, -1, -1, 20, 21,
- -1, -1, -1, -1, 26, 27, 28, -1, -1, 17,
- -1, -1, 33, 34, -1, -1, -1, 38, 40, 41,
- -1, 42, 43, 45, 46, 33, 34, 48, 49, -1,
- 38, -1, 40, 41, 42, 43, 8, -1, -1, -1,
- 48, 49, 14, -1, -1, -1, 18, -1, -1, -1,
- 22, 23, 24, 25, 33, 34, -1, -1, 30, 38,
- 39, 40, 41, 42, 43, -1, 33, 34, 47, 48,
- 49, 38, -1, 40, 41, 42, 43, -1, 33, 34,
- 47, 48, 49, 38, 39, 40, 41, 42, 43, -1,
- 33, 34, -1, 48, 49, 38, -1, 40, 41, 42,
- 43, -1, 33, 34, -1, 48, 49, 38, -1, -1,
- -1, 42, 43, -1, -1, -1, -1, 48, 49
+ 0, 0, 7, 10, 0, 0, 111, 46, 108, 30,
+ 10, 8, 117, 13, 14, 15, 0, 47, 39, 45,
+ 50, 8, 22, 30, 50, 130, 126, 14, 22, 7,
+ 24, 131, 137, 7, 139, 22, 30, 7, 138, 144,
+ 45, 146, 42, 143, 0, 53, 45, 55, 31, 32,
+ 11, 12, 52, 53, 54, 55, 52, 52, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 52, 45,
+ 39, 0, 1, 46, 46, 8, 5, 8, 7, 22,
+ 80, 81, 7, 29, 13, 8, 15, 16, 8, 89,
+ 19, 20, 21, 8, 22, 7, 47, 26, 27, 28,
+ 47, 7, 12, 5, 30, 7, 7, 16, 27, 12,
+ 27, 40, 41, 12, 114, 12, 45, 46, 16, 119,
+ 5, 76, 7, 27, 26, 52, 28, -1, 13, 129,
+ 15, 16, -1, -1, -1, 20, 21, -1, 40, 41,
+ 36, 26, 27, 28, 46, 5, 17, 7, -1, 33,
+ 34, -1, -1, -1, 38, 40, 41, -1, 42, 43,
+ 45, 46, 33, 34, 48, 49, 26, 38, 28, 40,
+ 41, 42, 43, 8, -1, -1, -1, 48, 49, 14,
+ 40, 41, -1, 18, -1, -1, 46, 22, 23, 24,
+ 25, 33, 34, -1, -1, 30, 38, 39, 40, 41,
+ 42, 43, -1, 33, 34, 47, 48, 49, 38, -1,
+ 40, 41, 42, 43, -1, 33, 34, 47, 48, 49,
+ 38, 39, 40, 41, 42, 43, -1, 33, 34, -1,
+ 48, 49, 38, -1, 40, 41, 42, 43, -1, 33,
+ 34, -1, 48, 49, 38, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 48, 49
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -736,15 +728,15 @@ static const yytype_uint8 yystos[] =
57, 58, 59, 63, 64, 65, 68, 60, 8, 14,
18, 22, 23, 24, 25, 30, 66, 67, 7, 8,
7, 7, 26, 54, 63, 31, 32, 7, 63, 63,
- 63, 0, 45, 52, 46, 39, 46, 56, 63, 33,
- 34, 38, 40, 41, 42, 43, 48, 49, 46, 8,
- 8, 22, 8, 14, 22, 30, 67, 69, 63, 17,
- 7, 30, 39, 47, 52, 56, 63, 56, 63, 29,
- 39, 63, 63, 63, 63, 63, 63, 63, 63, 63,
- 63, 71, 8, 8, 8, 60, 7, 63, 63, 47,
- 61, 47, 62, 63, 47, 50, 7, 70, 62, 10,
- 30, 45, 55, 61, 63, 64, 63, 50, 62, 61,
- 30, 63, 11, 12, 7, 45, 12, 63, 61, 62,
+ 63, 0, 45, 46, 39, 46, 56, 63, 33, 34,
+ 38, 40, 41, 42, 43, 48, 49, 46, 8, 8,
+ 22, 8, 14, 22, 30, 67, 69, 63, 17, 7,
+ 30, 39, 47, 52, 56, 63, 56, 63, 29, 39,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 71, 8, 8, 8, 60, 7, 63, 63, 47, 61,
+ 47, 62, 63, 47, 50, 7, 70, 62, 10, 30,
+ 45, 55, 61, 63, 64, 63, 45, 50, 61, 30,
+ 63, 11, 12, 62, 7, 45, 12, 63, 61, 62,
16, 7, 27, 61, 62, 61, 62, 61, 12, 61,
12, 16, 12, 27, 27
};
@@ -1560,18 +1552,18 @@ yyreduce:
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
- case 8:
-#line 100 "engines/director/lingo/lingo-gr.y"
+ case 7:
+#line 99 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 11:
-#line 103 "engines/director/lingo/lingo-gr.y"
+ case 10:
+#line 102 "engines/director/lingo/lingo-gr.y"
{ yyerrok; ;}
break;
- case 13:
-#line 107 "engines/director/lingo/lingo-gr.y"
+ case 12:
+#line 106 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str());
@@ -1580,8 +1572,8 @@ yyreduce:
delete (yyvsp[(4) - (4)].s); ;}
break;
- case 14:
-#line 113 "engines/director/lingo/lingo-gr.y"
+ case 13:
+#line 112 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1590,8 +1582,8 @@ yyreduce:
delete (yyvsp[(2) - (4)].s); ;}
break;
- case 15:
-#line 119 "engines/director/lingo/lingo-gr.y"
+ case 14:
+#line 118 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1600,13 +1592,13 @@ yyreduce:
delete (yyvsp[(2) - (4)].s); ;}
break;
- case 16:
-#line 127 "engines/director/lingo/lingo-gr.y"
+ case 15:
+#line 126 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 18:
-#line 129 "engines/director/lingo/lingo-gr.y"
+ case 17:
+#line 128 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
@@ -1615,8 +1607,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; ;}
break;
- case 19:
-#line 135 "engines/director/lingo/lingo-gr.y"
+ case 18:
+#line 134 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1627,8 +1619,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
break;
- case 20:
-#line 147 "engines/director/lingo/lingo-gr.y"
+ case 19:
+#line 146 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1637,8 +1629,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
- case 21:
-#line 158 "engines/director/lingo/lingo-gr.y"
+ case 20:
+#line 157 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1653,8 +1645,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
break;
- case 22:
-#line 174 "engines/director/lingo/lingo-gr.y"
+ case 21:
+#line 173 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1669,23 +1661,23 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
break;
- case 23:
-#line 188 "engines/director/lingo/lingo-gr.y"
+ case 22:
+#line 187 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 24:
-#line 189 "engines/director/lingo/lingo-gr.y"
+ case 23:
+#line 188 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 26:
-#line 192 "engines/director/lingo/lingo-gr.y"
+ case 25:
+#line 191 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 27:
-#line 194 "engines/director/lingo/lingo-gr.y"
+ case 26:
+#line 193 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1693,28 +1685,28 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 28:
-#line 200 "engines/director/lingo/lingo-gr.y"
+ case 27:
+#line 199 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
- case 29:
-#line 202 "engines/director/lingo/lingo-gr.y"
+ case 28:
+#line 201 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 30:
-#line 204 "engines/director/lingo/lingo-gr.y"
+ case 29:
+#line 203 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 31:
-#line 206 "engines/director/lingo/lingo-gr.y"
+ case 30:
+#line 205 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 34:
-#line 211 "engines/director/lingo/lingo-gr.y"
+ case 33:
+#line 210 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1722,75 +1714,75 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 35:
-#line 216 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 215 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
+ case 36:
+#line 219 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_add); ;}
+ break;
+
case 37:
#line 220 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_add); ;}
+ { g_lingo->code1(g_lingo->c_sub); ;}
break;
case 38:
#line 221 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_sub); ;}
+ { g_lingo->code1(g_lingo->c_mul); ;}
break;
case 39:
#line 222 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_mul); ;}
+ { g_lingo->code1(g_lingo->c_div); ;}
break;
case 40:
#line 223 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_div); ;}
+ { g_lingo->code1(g_lingo->c_gt); ;}
break;
case 41:
#line 224 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gt); ;}
+ { g_lingo->code1(g_lingo->c_lt); ;}
break;
case 42:
#line 225 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_lt); ;}
+ { g_lingo->code1(g_lingo->c_neq); ;}
break;
case 43:
#line 226 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_neq); ;}
+ { g_lingo->code1(g_lingo->c_ge); ;}
break;
case 44:
#line 227 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_ge); ;}
+ { g_lingo->code1(g_lingo->c_le); ;}
break;
case 45:
#line 228 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_le); ;}
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 46:
#line 229 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 47:
#line 230 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
- break;
-
- case 48:
-#line 231 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 49:
-#line 234 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 233 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (5)].s)->c_str());
@@ -1799,43 +1791,43 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
+ case 49:
+#line 239 "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 50:
#line 240 "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); ;}
+ { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 51:
#line 241 "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); ;}
+ { g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 52:
-#line 242 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_printtop); ;}
+ case 53:
+#line 243 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_exit); ;}
break;
case 54:
-#line 244 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_exit); ;}
+#line 254 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 55:
#line 255 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoloop); ;}
+ { g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 56:
#line 256 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotonext); ;}
+ { g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 57:
#line 257 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoprevious); ;}
- break;
-
- case 58:
-#line 258 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1843,8 +1835,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 59:
-#line 263 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 262 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1853,8 +1845,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 60:
-#line 269 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 268 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1862,9 +1854,14 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
+ case 60:
+#line 275 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ break;
+
case 61:
#line 276 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 62:
@@ -1874,80 +1871,75 @@ yyreduce:
case 63:
#line 278 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 64:
-#line 279 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+#line 281 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 65:
#line 282 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 66:
#line 283 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 67:
-#line 284 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 311 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->_indef = true; ;}
break;
case 68:
#line 312 "engines/director/lingo/lingo-gr.y"
- { g_lingo->_indef = true; ;}
- break;
-
- case 69:
-#line 313 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_procret);
- g_lingo->define(*(yyvsp[(2) - (6)].s), (yyvsp[(4) - (6)].code), (yyvsp[(5) - (6)].narg));
+ g_lingo->define(*(yyvsp[(2) - (7)].s), (yyvsp[(4) - (7)].code), (yyvsp[(5) - (7)].narg));
g_lingo->_indef = false; ;}
break;
+ case 69:
+#line 317 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = 0; ;}
+ break;
+
case 70:
#line 318 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 0; ;}
+ { g_lingo->codeArg(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); (yyval.narg) = 1; ;}
break;
case 71:
#line 319 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); (yyval.narg) = 1; ;}
+ { g_lingo->codeArg(*(yyvsp[(3) - (3)].s)); delete (yyvsp[(3) - (3)].s); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 72:
#line 320 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg(*(yyvsp[(3) - (3)].s)); delete (yyvsp[(3) - (3)].s); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
+ { g_lingo->codeArg(*(yyvsp[(4) - (4)].s)); delete (yyvsp[(4) - (4)].s); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 73:
-#line 321 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg(*(yyvsp[(4) - (4)].s)); delete (yyvsp[(4) - (4)].s); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
+#line 323 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = 0; ;}
break;
case 74:
#line 324 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 0; ;}
+ { (yyval.narg) = 1; ;}
break;
case 75:
#line 325 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 1; ;}
- break;
-
- case 76:
-#line 326 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 1951 "engines/director/lingo/lingo-gr.cpp"
+#line 1943 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2161,6 +2153,6 @@ yyreturn:
}
-#line 329 "engines/director/lingo/lingo-gr.y"
+#line 328 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index c87b17e..94a2b78 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -90,7 +90,6 @@ using namespace Director;
%%
program: programline '\n' program
- | programline program
| programline
;
@@ -310,7 +309,7 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
// See also:
// on keyword
defn: tMACRO ID { g_lingo->_indef = true; }
- begin argdef stmtlist {
+ begin argdef '\n' stmtlist {
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$2, $4, $5);
g_lingo->_indef = false; }
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index b65fd81..0ecd689 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -122,9 +122,32 @@ void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
_currentScriptType = type;
_scripts[type][id] = _currentScript;
- parse(code.c_str());
+ // macros have conflicting grammar. Thus we ease life for the parser.
+ if (code.contains("\nmacro ")) {
+ const char *begin = strstr(code.c_str(), "\nmacro ") + 1;
+ char *end;
+ bool first = true;
- code1(STOP);
+ while ((end = strstr(begin, "\nmacro "))) {
+ if (first) {
+ begin = code.c_str();
+ first = false;
+ }
+ Common::String chunk(begin, end);
+
+ parse(chunk.c_str());
+
+ _currentScript->clear();
+
+ begin = end + 1;
+ }
+
+ parse(begin);
+ } else {
+ parse(code.c_str());
+
+ code1(STOP);
+ }
Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst));
}
Commit: 825a9fb29f39226a6be0f66ed0253ebafa8b143f
https://github.com/scummvm/scummvm/commit/825a9fb29f39226a6be0f66ed0253ebafa8b143f
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Load shared casts in engine
Changed paths:
engines/director/director.cpp
engines/director/director.h
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index cb31f88..2c8441d 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -56,6 +56,7 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
_mainArchive = 0;
_macBinary = 0;
_currentPalette = 0;
+
_movies = new Common::HashMap<Common::String, Score *>();
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "data");
@@ -370,4 +371,17 @@ void DirectorEngine::setPalette(byte *palette, uint16 count) {
_currentPaletteLength = count;
}
+Common::HashMap<int, Cast *> DirectorEngine::loadSharedCastsFrom(Common::String filename) {
+
+ //TODO d4 arch
+ RIFFArchive *shardcst = new RIFFArchive();
+ shardcst->openFile(filename);
+
+ Score *castScore = new Score(this);
+
+ Common::SeekableSubReadStreamEndian *castStream = shardcst->getResource(MKTAG('V','W','C','R'), 1024);
+
+ castScore->loadCastData(*castStream);
+ return castScore->_casts;
+}
} // End of namespace Director
diff --git a/engines/director/director.h b/engines/director/director.h
index 74dc651..8719064 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -44,7 +44,7 @@ class Archive;
struct DirectorGameDescription;
class Lingo;
class Score;
-
+class Cast;
class DirectorEngine : public ::Engine {
public:
@@ -66,9 +66,12 @@ public:
bool hasFeature(EngineFeature f) const;
const byte *getPalette() const { return _currentPalette; }
uint16 getPaletteColorCount() const { return _currentPaletteLength; }
+ Common::HashMap<int, Cast *> loadSharedCastsFrom(Common::String filename);
+
Common::HashMap<Common::String, Score *> *_movies;
Score *_currentScore;
+
protected:
virtual Common::Error run();
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 5b05ed6..285577d 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -67,7 +67,6 @@ void Score::loadArchive() {
if (clutList.size() == 0)
error("CLUT not found");
-
Common::SeekableSubReadStreamEndian *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]);
loadPalette(*pal);
@@ -194,7 +193,6 @@ void Score::readVersion(uint32 rid) {
void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream) {
for (uint16 id = _castArrayStart; id <= _castArrayEnd; id++) {
byte size = stream.readByte();
-
if (size == 0)
continue;
@@ -441,6 +439,7 @@ void Score::goToNext() {
//the playback head goes to frame 1, (Director frame array start from 1, engine from 0)
_currentFrame = 0;
}
+
void Score::goToPrevious() {
//One label
if (_labels.begin() == _labels.end()) {
diff --git a/engines/director/score.h b/engines/director/score.h
index 9aeb66e..592201e 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -341,14 +341,13 @@ public:
void startLoop();
void processEvents();
Archive *getArchive() const { return _movieArchive; };
-
+ void loadCastData(Common::SeekableSubReadStreamEndian &stream);
Common::String getMacName() const { return _macName; }
private:
void update();
void readVersion(uint32 rid);
void loadConfig(Common::SeekableSubReadStreamEndian &stream);
void loadPalette(Common::SeekableSubReadStreamEndian &stream);
- void loadCastData(Common::SeekableSubReadStreamEndian &stream);
void loadFrames(Common::SeekableSubReadStreamEndian &stream);
void loadLabels(Common::SeekableSubReadStreamEndian &stream);
void loadActions(Common::SeekableSubReadStreamEndian &stream);
Commit: e1e7051bf20effe8a9b35ab15829fd99dc945583
https://github.com/scummvm/scummvm/commit/e1e7051bf20effe8a9b35ab15829fd99dc945583
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Support goto frame jump
Changed paths:
engines/director/lingo/lingo-funcs.cpp
engines/director/score.h
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 39e50f5..eca6641 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -46,7 +46,7 @@
#include "engines/director/lingo/lingo.h"
#include "common/file.h"
#include "audio/decoders/wave.h"
-
+#include "common/util.h"
#include "director/lingo/lingo-gr.h"
namespace Director {
@@ -196,8 +196,16 @@ void Lingo::func_goto(Common::String &frame, Common::String &movie) {
_vm->_currentScore = _vm->_movies->getVal(movie);
_vm->_currentScore->loadArchive();
- if (!frame.empty())
- _vm->_currentScore->setStartToLabel(frame);
+ if (frame.empty())
+ return;
+
+ for (uint16 i = 0; i < frame.size(); i++) {
+ if (!Common::isDigit(frame[i])) {
+ _vm->_currentScore->setStartToLabel(frame);
+ return;
+ }
+ }
+ _vm->_currentScore->setCurrentFrame(strtol(frame.c_str(), 0, 10));
}
}
diff --git a/engines/director/score.h b/engines/director/score.h
index 592201e..06536d9 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -342,6 +342,7 @@ public:
void processEvents();
Archive *getArchive() const { return _movieArchive; };
void loadCastData(Common::SeekableSubReadStreamEndian &stream);
+ void setCurrentFrame(uint16 frameId) { _currentFrame = frameId; }
Common::String getMacName() const { return _macName; }
private:
void update();
Commit: 29e8752fcaa461dbb273a93b37a84ffb7dc93e7d
https://github.com/scummvm/scummvm/commit/29e8752fcaa461dbb273a93b37a84ffb7dc93e7d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Parse continuation arguments in macros
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 2c8441d..036a341 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -78,6 +78,7 @@ Common::Error DirectorEngine::run() {
#if 0
_lingo->addCode("--\n\
macro check par1, par2\n\
+, par3\n\
if par1 = 3 then\n\
put -3\n\
else\n\
@@ -90,9 +91,10 @@ else\n\
end if\n\
put par1\n\
put par2\n\
+put par3\n\
", kMovieScript, 5);
-_lingo->addCode("check(3, 2)\n\
+_lingo->addCode("check(1, 2, 3)\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index d1262f1..c68959d 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -420,7 +420,7 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 51
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 255
+#define YYLAST 246
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 51
@@ -516,7 +516,7 @@ static const yytype_int8 yyrhs[] =
30, 8, -1, 8, -1, 24, 22, 8, -1, 22,
8, -1, 30, 22, 8, -1, -1, 19, 7, 69,
60, 70, 45, 62, -1, -1, 7, -1, 70, 50,
- 7, -1, 70, 50, 45, 7, -1, -1, 63, -1,
+ 7, -1, 70, 45, 50, 7, -1, -1, 63, -1,
71, 50, 63, -1
};
@@ -610,7 +610,7 @@ static const yytype_uint8 yydefact[] =
0, 64, 60, 66, 69, 12, 14, 13, 30, 0,
24, 29, 23, 48, 0, 70, 0, 29, 0, 0,
31, 32, 0, 15, 16, 75, 30, 0, 0, 0,
- 29, 30, 0, 68, 71, 0, 0, 29, 30, 29,
+ 29, 30, 0, 0, 68, 71, 0, 29, 30, 29,
17, 72, 19, 30, 29, 0, 29, 0, 0, 0,
0, 18, 0, 20, 21
};
@@ -625,33 +625,33 @@ static const yytype_int8 yydefgoto[] =
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -106
+#define YYPACT_NINF -110
static const yytype_int16 yypact[] =
{
- 71, -106, -106, -39, -106, 165, -106, 22, 3, 26,
- 98, 17, 30, 98, 98, 98, 44, 24, 1, -106,
- 27, 31, 140, 194, -106, -106, -106, 28, -106, 67,
- -106, 69, -106, 57, -106, 13, 6, -106, -106, -106,
- -106, -106, 98, -106, 129, 75, -106, -21, 206, 206,
- 170, -106, 71, 140, 98, 140, 54, 182, 98, 98,
- 98, 98, 98, 98, 98, 98, 98, 98, -106, -106,
- 77, -106, 80, 85, 72, -106, -106, 129, 88, -106,
- 98, 98, -106, -106, 49, 194, 53, 158, -106, 98,
- 194, 194, 194, 116, 116, 206, 206, 194, 194, 194,
- -30, -106, -106, -106, 94, -106, 194, 194, -106, -7,
- -106, 115, 194, -106, 98, -106, -26, 115, 74, 98,
- -106, -106, 39, 194, -106, 194, -106, -5, 90, 98,
- 194, -106, 91, 115, -106, 99, 81, 194, -106, 115,
- -106, -106, -106, -106, 115, 97, 115, 101, 102, 103,
- 83, -106, 96, -106, -106
+ 71, -110, -110, -35, -110, 9, -110, 12, 18, 33,
+ 98, 17, 43, 98, 98, 98, 70, 32, 1, -110,
+ 36, 40, 140, 185, -110, -110, -110, 39, -110, 80,
+ -110, 85, -110, 72, -110, 61, 21, -110, -110, -110,
+ -110, -110, 98, -110, 129, 88, -110, -27, 197, 197,
+ 161, -110, 71, 140, 98, 140, 67, 173, 98, 98,
+ 98, 98, 98, 98, 98, 98, 98, 98, -110, -110,
+ 92, -110, 93, 94, 82, -110, -110, 129, 99, -110,
+ 98, 98, -110, -110, 60, 185, 63, 149, -110, 98,
+ 185, 185, 185, 116, 116, 197, 197, 185, 185, 185,
+ -3, -110, -110, -110, 101, -110, 185, 185, -110, 8,
+ -110, 115, 185, -110, 98, -110, -25, 115, 79, 98,
+ -110, -110, 62, 185, -110, 185, 65, 106, 109, 98,
+ 185, -110, 102, 118, 115, -110, 96, 185, -110, 115,
+ -110, -110, -110, -110, 115, 120, 115, 121, 111, 122,
+ 110, -110, 113, -110, -110
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -106, 73, -106, 4, 5, -8, -106, -106, -106, 45,
- -105, -100, 0, 16, -106, -106, 104, -106, -106, -106,
- -106
+ -110, 100, -110, 4, 5, -46, -110, -110, -110, 75,
+ -109, -102, 0, 16, -110, -110, 112, -110, -110, -110,
+ -110
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -661,62 +661,60 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -29
static const yytype_int16 yytable[] =
{
- 23, -7, 134, 118, 18, 19, 122, -28, 117, 80,
- 44, 39, 128, 48, 49, 50, 24, 113, 81, 126,
- 114, 71, 57, 119, 127, 138, 133, 72, 31, 38,
- 33, 139, 143, 40, 145, 73, 74, 47, 144, 147,
- 135, 149, 77, 146, 51, 84, -7, 86, 45, 46,
- 131, 132, 23, 57, 85, 87, 18, 19, 90, 91,
- 92, 93, 94, 95, 96, 97, 98, 99, 24, 52,
- 54, -4, 1, 53, 67, 68, 2, 69, 3, 70,
- 106, 107, 79, 88, 4, 101, 5, 6, 102, 112,
- 7, 8, 9, 103, 73, 105, 108, 10, 11, 12,
- 110, 115, 136, 2, 129, 41, 141, 140, 142, 148,
- 153, 13, 14, 150, 125, 152, -4, 15, 151, 130,
- 2, 104, 3, 154, 42, 83, 12, 0, 4, 137,
- 5, 6, 0, 0, 0, 8, 9, 0, 13, 14,
- 75, 10, 11, 12, 15, 2, 78, 41, 0, 58,
- 59, 0, 0, 0, 60, 13, 14, 0, 63, 64,
+ 23, -7, 122, 80, 18, 19, 117, 84, 128, 86,
+ 44, -28, 81, 48, 49, 50, 24, 28, 118, 38,
+ 126, 138, 57, 29, 134, 127, 39, 30, 143, 139,
+ 145, 31, 32, 33, 34, 147, 144, 149, 119, 35,
+ 40, 146, 77, 31, 113, 33, -7, 114, 45, 46,
+ 47, 74, 23, 57, 85, 87, 18, 19, 90, 91,
+ 92, 93, 94, 95, 96, 97, 98, 99, 24, 71,
+ 51, -4, 1, 131, 132, 72, 2, 52, 3, 54,
+ 106, 107, 53, 73, 4, 67, 5, 6, 68, 112,
+ 7, 8, 9, 69, 70, 79, 88, 10, 11, 12,
+ 101, 102, 103, 2, 73, 41, 105, 108, 115, 129,
+ 110, 13, 14, 135, 125, 133, -4, 15, 140, 130,
+ 2, 136, 3, 142, 42, 141, 12, 151, 4, 137,
+ 5, 6, 148, 150, 152, 8, 9, 153, 13, 14,
+ 154, 10, 11, 12, 15, 2, 78, 41, 75, 58,
+ 59, 104, 83, 0, 60, 13, 14, 0, 63, 64,
120, 15, 58, 59, 65, 66, 42, 60, 12, 61,
- 62, 63, 64, 28, 0, 0, 0, 65, 66, 29,
- 13, 14, 0, 30, 0, 0, 55, 31, 32, 33,
- 34, 58, 59, 0, 0, 35, 60, 89, 61, 62,
- 63, 64, 0, 58, 59, 82, 65, 66, 60, 0,
- 61, 62, 63, 64, 0, 58, 59, 82, 65, 66,
- 60, 89, 61, 62, 63, 64, 0, 58, 59, 0,
- 65, 66, 60, 0, 61, 62, 63, 64, 0, 58,
- 59, 0, 65, 66, 60, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 65, 66
+ 62, 63, 64, 0, 0, 0, 0, 65, 66, 0,
+ 13, 14, 58, 59, 0, 0, 55, 60, 89, 61,
+ 62, 63, 64, 0, 58, 59, 82, 65, 66, 60,
+ 0, 61, 62, 63, 64, 0, 58, 59, 82, 65,
+ 66, 60, 89, 61, 62, 63, 64, 0, 58, 59,
+ 0, 65, 66, 60, 0, 61, 62, 63, 64, 0,
+ 58, 59, 0, 65, 66, 60, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 65, 66
};
static const yytype_int16 yycheck[] =
{
- 0, 0, 7, 10, 0, 0, 111, 46, 108, 30,
- 10, 8, 117, 13, 14, 15, 0, 47, 39, 45,
- 50, 8, 22, 30, 50, 130, 126, 14, 22, 7,
- 24, 131, 137, 7, 139, 22, 30, 7, 138, 144,
- 45, 146, 42, 143, 0, 53, 45, 55, 31, 32,
- 11, 12, 52, 53, 54, 55, 52, 52, 58, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 52, 45,
- 39, 0, 1, 46, 46, 8, 5, 8, 7, 22,
- 80, 81, 7, 29, 13, 8, 15, 16, 8, 89,
- 19, 20, 21, 8, 22, 7, 47, 26, 27, 28,
- 47, 7, 12, 5, 30, 7, 7, 16, 27, 12,
- 27, 40, 41, 12, 114, 12, 45, 46, 16, 119,
- 5, 76, 7, 27, 26, 52, 28, -1, 13, 129,
- 15, 16, -1, -1, -1, 20, 21, -1, 40, 41,
- 36, 26, 27, 28, 46, 5, 17, 7, -1, 33,
- 34, -1, -1, -1, 38, 40, 41, -1, 42, 43,
+ 0, 0, 111, 30, 0, 0, 108, 53, 117, 55,
+ 10, 46, 39, 13, 14, 15, 0, 8, 10, 7,
+ 45, 130, 22, 14, 126, 50, 8, 18, 137, 131,
+ 139, 22, 23, 24, 25, 144, 138, 146, 30, 30,
+ 7, 143, 42, 22, 47, 24, 45, 50, 31, 32,
+ 7, 30, 52, 53, 54, 55, 52, 52, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 52, 8,
+ 0, 0, 1, 11, 12, 14, 5, 45, 7, 39,
+ 80, 81, 46, 22, 13, 46, 15, 16, 8, 89,
+ 19, 20, 21, 8, 22, 7, 29, 26, 27, 28,
+ 8, 8, 8, 5, 22, 7, 7, 47, 7, 30,
+ 47, 40, 41, 7, 114, 50, 45, 46, 16, 119,
+ 5, 12, 7, 27, 26, 7, 28, 16, 13, 129,
+ 15, 16, 12, 12, 12, 20, 21, 27, 40, 41,
+ 27, 26, 27, 28, 46, 5, 17, 7, 36, 33,
+ 34, 76, 52, -1, 38, 40, 41, -1, 42, 43,
45, 46, 33, 34, 48, 49, 26, 38, 28, 40,
- 41, 42, 43, 8, -1, -1, -1, 48, 49, 14,
- 40, 41, -1, 18, -1, -1, 46, 22, 23, 24,
- 25, 33, 34, -1, -1, 30, 38, 39, 40, 41,
- 42, 43, -1, 33, 34, 47, 48, 49, 38, -1,
- 40, 41, 42, 43, -1, 33, 34, 47, 48, 49,
- 38, 39, 40, 41, 42, 43, -1, 33, 34, -1,
- 48, 49, 38, -1, 40, 41, 42, 43, -1, 33,
- 34, -1, 48, 49, 38, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 48, 49
+ 41, 42, 43, -1, -1, -1, -1, 48, 49, -1,
+ 40, 41, 33, 34, -1, -1, 46, 38, 39, 40,
+ 41, 42, 43, -1, 33, 34, 47, 48, 49, 38,
+ -1, 40, 41, 42, 43, -1, 33, 34, 47, 48,
+ 49, 38, 39, 40, 41, 42, 43, -1, 33, 34,
+ -1, 48, 49, 38, -1, 40, 41, 42, 43, -1,
+ 33, 34, -1, 48, 49, 38, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 48, 49
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -736,7 +734,7 @@ static const yytype_uint8 yystos[] =
71, 8, 8, 8, 60, 7, 63, 63, 47, 61,
47, 62, 63, 47, 50, 7, 70, 62, 10, 30,
45, 55, 61, 63, 64, 63, 45, 50, 61, 30,
- 63, 11, 12, 62, 7, 45, 12, 63, 61, 62,
+ 63, 11, 12, 50, 62, 7, 12, 63, 61, 62,
16, 7, 27, 61, 62, 61, 62, 61, 12, 61,
12, 16, 12, 27, 27
};
@@ -1939,7 +1937,7 @@ yyreduce:
/* Line 1267 of yacc.c. */
-#line 1943 "engines/director/lingo/lingo-gr.cpp"
+#line 1941 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 94a2b78..6ed5400 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -317,7 +317,7 @@ defn: tMACRO ID { g_lingo->_indef = true; }
argdef: /* nothing */ { $$ = 0; }
| ID { g_lingo->codeArg(*$1); delete $1; $$ = 1; }
| argdef ',' ID { g_lingo->codeArg(*$3); delete $3; $$ = $1 + 1; }
- | argdef ',' '\n' ID { g_lingo->codeArg(*$4); delete $4; $$ = $1 + 1; }
+ | argdef '\n' ',' ID { g_lingo->codeArg(*$4); delete $4; $$ = $1 + 1; }
;
arglist: /* nothing */ { $$ = 0; }
Commit: 2523bed5db6de287b6f73ed4ef0715160bfe61a4
https://github.com/scummvm/scummvm/commit/2523bed5db6de287b6f73ed4ef0715160bfe61a4
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Split out the code gen functions into a separate file.
Changed paths:
A engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-code.cpp
engines/director/module.mk
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 3ddc276..065848d 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -51,37 +51,6 @@
namespace Director {
-void Lingo::execute(int pc) {
- for(_pc = pc; (*_currentScript)[_pc] != STOP && !_returning;) {
-
- for (int i = 0; i < _stack.size(); i++) {
- debugN(5, "%d ", _stack[i].val);
- }
- debug(5, "");
-
- _pc++;
- (*((*_currentScript)[_pc - 1]))();
- }
-}
-
-Symbol *Lingo::lookupVar(const char *name) {
- Symbol *sym;
-
- if (!_vars.contains(name)) { // Create variable if it was not defined
- sym = new Symbol;
- sym->name = (char *)calloc(strlen(name) + 1, 1);
- Common::strlcpy(sym->name, name, strlen(name) + 1);
- sym->type = VOID;
- sym->u.val = 0;
-
- _vars[name] = sym;
- } else {
- sym = g_lingo->_vars[name];
- }
-
- return sym;
-}
-
void Lingo::push(Datum d) {
_stack.push_back(d);
}
@@ -382,58 +351,6 @@ void Lingo::c_gotoprevious() {
warning("STUB: c_gotoprevious()");
}
-void Lingo::define(Common::String &name, int start, int nargs) {
- debug(3, "define(\"%s\", %d, %d, %d)", name.c_str(), start, _currentScript->size() - 1, nargs);
-
- Symbol *sym;
-
- if (!_handlers.contains(name)) { // Create variable if it was not defined
- sym = new Symbol;
-
- sym->name = (char *)calloc(name.size() + 1, 1);
- Common::strlcpy(sym->name, name.c_str(), name.size() + 1);
- sym->type = HANDLER;
-
- _handlers[name] = sym;
- } else {
- sym = g_lingo->_handlers[name];
-
- warning("Redefining handler '%s'", name.c_str());
- delete sym->u.defn;
- }
-
- sym->u.defn = new ScriptData(&(*_currentScript)[start], _currentScript->size() - start + 1);
- sym->nargs = nargs;
-}
-
-void Lingo::codeArg(Common::String &s) {
- g_lingo->code1(g_lingo->c_varpush);
- g_lingo->codeString(s.c_str());
- g_lingo->code1(g_lingo->c_assign);
- g_lingo->code1(g_lingo->c_xpop);
-}
-
-int Lingo::codeId(Common::String &s) {
- return g_lingo->codeId_(s);
-}
-
-int Lingo::codeId_(Common::String &name) {
- int ret;
-
- if (_handlers.contains(name)) { // This is a call
- ret = code1(c_call);
- codeString(name.c_str());
- code1((inst)0); // Zero arguments
- } else {
- ret = code1(c_varpush);
-
- codeString(name.c_str());
- code1(c_eval);
- }
-
- return ret;
-}
-
void Lingo::c_call() {
Common::String name((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
g_lingo->_pc += g_lingo->calcStringAlignment(name.c_str());
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
new file mode 100644
index 0000000..4b4d9d7
--- /dev/null
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -0,0 +1,137 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+// Heavily inspired by hoc
+// Copyright (C) AT&T 1995
+// All Rights Reserved
+//
+// Permission to use, copy, modify, and distribute this software and
+// its documentation for any purpose and without fee is hereby
+// granted, provided that the above copyright notice appear in all
+// copies and that both that the copyright notice and this
+// permission notice and warranty disclaimer appear in supporting
+// documentation, and that the name of AT&T or any of its entities
+// not be used in advertising or publicity pertaining to
+// distribution of the software without specific, written prior
+// permission.
+//
+// AT&T DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+// INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+// IN NO EVENT SHALL AT&T OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
+// SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+// IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+// ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+// THIS SOFTWARE.
+
+#include "engines/director/lingo/lingo.h"
+#include "common/file.h"
+#include "audio/decoders/wave.h"
+
+#include "director/lingo/lingo-gr.h"
+
+namespace Director {
+
+void Lingo::execute(int pc) {
+ for(_pc = pc; (*_currentScript)[_pc] != STOP && !_returning;) {
+
+ for (int i = 0; i < _stack.size(); i++) {
+ debugN(5, "%d ", _stack[i].val);
+ }
+ debug(5, "");
+
+ _pc++;
+ (*((*_currentScript)[_pc - 1]))();
+ }
+}
+
+Symbol *Lingo::lookupVar(const char *name) {
+ Symbol *sym;
+
+ if (!_vars.contains(name)) { // Create variable if it was not defined
+ sym = new Symbol;
+ sym->name = (char *)calloc(strlen(name) + 1, 1);
+ Common::strlcpy(sym->name, name, strlen(name) + 1);
+ sym->type = VOID;
+ sym->u.val = 0;
+
+ _vars[name] = sym;
+ } else {
+ sym = g_lingo->_vars[name];
+ }
+
+ return sym;
+}
+
+void Lingo::define(Common::String &name, int start, int nargs) {
+ debug(3, "define(\"%s\", %d, %d, %d)", name.c_str(), start, _currentScript->size() - 1, nargs);
+
+ Symbol *sym;
+
+ if (!_handlers.contains(name)) { // Create variable if it was not defined
+ sym = new Symbol;
+
+ sym->name = (char *)calloc(name.size() + 1, 1);
+ Common::strlcpy(sym->name, name.c_str(), name.size() + 1);
+ sym->type = HANDLER;
+
+ _handlers[name] = sym;
+ } else {
+ sym = g_lingo->_handlers[name];
+
+ warning("Redefining handler '%s'", name.c_str());
+ delete sym->u.defn;
+ }
+
+ sym->u.defn = new ScriptData(&(*_currentScript)[start], _currentScript->size() - start + 1);
+ sym->nargs = nargs;
+}
+
+void Lingo::codeArg(Common::String &s) {
+ g_lingo->code1(g_lingo->c_varpush);
+ g_lingo->codeString(s.c_str());
+ g_lingo->code1(g_lingo->c_assign);
+ g_lingo->code1(g_lingo->c_xpop);
+}
+
+int Lingo::codeId(Common::String &s) {
+ return g_lingo->codeId_(s);
+}
+
+int Lingo::codeId_(Common::String &name) {
+ int ret;
+
+ if (_handlers.contains(name)) { // This is a call
+ ret = code1(c_call);
+ codeString(name.c_str());
+ code1((inst)0); // Zero arguments
+ } else {
+ ret = code1(c_varpush);
+
+ codeString(name.c_str());
+ code1(c_eval);
+ }
+
+ return ret;
+}
+
+}
diff --git a/engines/director/module.mk b/engines/director/module.mk
index d903223..b39c75c 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -11,6 +11,7 @@ MODULE_OBJS = \
lingo/lingo-gr.o \
lingo/lingo.o \
lingo/lingo-code.o \
+ lingo/lingo-codegen.o \
lingo/lingo-funcs.o \
lingo/lingo-lex.o
Commit: 24a25820e80b8492650432ff9e5342ccb8e2850b
https://github.com/scummvm/scummvm/commit/24a25820e80b8492650432ff9e5342ccb8e2850b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix warning
Changed paths:
engines/director/director.h
diff --git a/engines/director/director.h b/engines/director/director.h
index 8719064..c2559b1 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -44,7 +44,7 @@ class Archive;
struct DirectorGameDescription;
class Lingo;
class Score;
-class Cast;
+struct Cast;
class DirectorEngine : public ::Engine {
public:
Commit: 3e0bf3a03c1b0e88620e483e2390e23015ff9afd
https://github.com/scummvm/scummvm/commit/3e0bf3a03c1b0e88620e483e2390e23015ff9afd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Parsing of macro calls without parens.
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 036a341..1130f22 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -95,6 +95,7 @@ put par3\n\
", kMovieScript, 5);
_lingo->addCode("check(1, 2, 3)\n\
+check 4, 5, 6\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 4b4d9d7..945da38 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -120,16 +120,10 @@ int Lingo::codeId(Common::String &s) {
int Lingo::codeId_(Common::String &name) {
int ret;
- if (_handlers.contains(name)) { // This is a call
- ret = code1(c_call);
- codeString(name.c_str());
- code1((inst)0); // Zero arguments
- } else {
- ret = code1(c_varpush);
+ ret = code1(c_varpush);
- codeString(name.c_str());
- code1(c_eval);
- }
+ codeString(name.c_str());
+ code1(c_eval);
return ret;
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index c68959d..996f7cc 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -418,18 +418,18 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 51
+#define YYFINAL 53
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 246
+#define YYLAST 264
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 51
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 21
+#define YYNNTS 22
/* YYNRULES -- Number of rules. */
-#define YYNRULES 75
+#define YYNRULES 77
/* YYNRULES -- Number of states. */
-#define YYNSTATES 155
+#define YYNSTATES 157
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -482,17 +482,17 @@ static const yytype_uint16 yyprhs[] =
20, 22, 23, 28, 33, 38, 40, 42, 50, 61,
70, 82, 95, 97, 101, 105, 108, 112, 114, 115,
116, 117, 120, 123, 125, 127, 129, 133, 137, 141,
- 145, 149, 153, 157, 161, 165, 168, 171, 175, 181,
- 184, 187, 190, 192, 194, 197, 200, 203, 206, 210,
- 213, 217, 220, 223, 225, 229, 232, 236, 237, 245,
- 246, 248, 252, 257, 258, 260
+ 145, 149, 153, 157, 161, 165, 168, 171, 175, 180,
+ 183, 186, 189, 191, 193, 197, 199, 202, 205, 208,
+ 211, 215, 218, 222, 225, 228, 230, 234, 237, 241,
+ 242, 250, 251, 253, 257, 262, 263, 265
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
52, 0, -1, 53, 45, 52, -1, 53, -1, -1,
- 68, -1, 64, -1, 54, -1, 55, -1, 63, -1,
+ 69, -1, 64, -1, 65, -1, 54, -1, 55, -1,
1, -1, -1, 26, 63, 17, 7, -1, 28, 7,
39, 63, -1, 28, 7, 30, 63, -1, 63, -1,
64, -1, 59, 56, 29, 62, 61, 12, 16, -1,
@@ -508,16 +508,16 @@ static const yytype_int8 yyrhs[] =
-1, 63, 43, 63, -1, 63, 48, 63, -1, 63,
49, 63, -1, 63, 38, 63, -1, 63, 33, 63,
-1, 63, 34, 63, -1, 40, 63, -1, 41, 63,
- -1, 46, 63, 47, -1, 7, 60, 46, 71, 47,
- -1, 20, 8, -1, 21, 7, -1, 26, 63, -1,
- 65, -1, 13, -1, 15, 18, -1, 15, 23, -1,
- 15, 25, -1, 15, 66, -1, 15, 66, 67, -1,
- 15, 67, -1, 30, 14, 8, -1, 14, 8, -1,
- 30, 8, -1, 8, -1, 24, 22, 8, -1, 22,
- 8, -1, 30, 22, 8, -1, -1, 19, 7, 69,
- 60, 70, 45, 62, -1, -1, 7, -1, 70, 50,
- 7, -1, 70, 45, 50, 7, -1, -1, 63, -1,
- 71, 50, 63, -1
+ -1, 46, 63, 47, -1, 7, 46, 72, 47, -1,
+ 20, 8, -1, 21, 7, -1, 26, 63, -1, 66,
+ -1, 13, -1, 7, 60, 72, -1, 7, -1, 15,
+ 18, -1, 15, 23, -1, 15, 25, -1, 15, 67,
+ -1, 15, 67, 68, -1, 15, 68, -1, 30, 14,
+ 8, -1, 14, 8, -1, 30, 8, -1, 8, -1,
+ 24, 22, 8, -1, 22, 8, -1, 30, 22, 8,
+ -1, -1, 19, 7, 70, 60, 71, 45, 62, -1,
+ -1, 7, -1, 71, 50, 7, -1, 71, 45, 50,
+ 7, -1, -1, 63, -1, 72, 50, 63, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -528,9 +528,9 @@ static const yytype_uint16 yyrline[] =
157, 173, 187, 188, 189, 191, 193, 199, 201, 203,
205, 206, 207, 210, 215, 218, 219, 220, 221, 222,
223, 224, 225, 226, 227, 228, 229, 230, 233, 239,
- 240, 241, 242, 243, 254, 255, 256, 257, 262, 268,
- 275, 276, 277, 278, 281, 282, 283, 311, 311, 317,
- 318, 319, 320, 323, 324, 325
+ 240, 241, 242, 243, 246, 252, 266, 267, 268, 269,
+ 274, 280, 287, 288, 289, 290, 293, 294, 295, 323,
+ 323, 329, 330, 331, 332, 335, 336, 337
};
#endif
@@ -547,8 +547,8 @@ static const char *const yytname[] =
"'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "','",
"$accept", "program", "programline", "asgn", "stmt", "cond",
"repeatwhile", "repeatwith", "if", "begin", "end", "stmtlist", "expr",
- "func", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "argdef",
- "arglist", 0
+ "func", "macro", "gotofunc", "gotoframe", "gotomovie", "defn", "@1",
+ "argdef", "arglist", 0
};
#endif
@@ -574,9 +574,9 @@ static const yytype_uint8 yyr1[] =
55, 55, 56, 56, 56, 57, 58, 59, 60, 61,
62, 62, 62, 63, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63, 63, 64, 64,
- 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
- 66, 66, 66, 66, 67, 67, 67, 69, 68, 70,
- 70, 70, 70, 71, 71, 71
+ 64, 64, 64, 64, 65, 65, 66, 66, 66, 66,
+ 66, 66, 67, 67, 67, 67, 68, 68, 68, 70,
+ 69, 71, 71, 71, 71, 72, 72, 72
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -586,10 +586,10 @@ static const yytype_uint8 yyr2[] =
1, 0, 4, 4, 4, 1, 1, 7, 10, 8,
11, 12, 1, 3, 3, 2, 3, 1, 0, 0,
0, 2, 2, 1, 1, 1, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 2, 2, 3, 5, 2,
- 2, 2, 1, 1, 2, 2, 2, 2, 3, 2,
- 3, 2, 2, 1, 3, 2, 3, 0, 7, 0,
- 1, 3, 4, 0, 1, 3
+ 3, 3, 3, 3, 3, 2, 2, 3, 4, 2,
+ 2, 2, 1, 1, 3, 1, 2, 2, 2, 2,
+ 3, 2, 3, 2, 2, 1, 3, 2, 3, 0,
+ 7, 0, 1, 3, 4, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -597,124 +597,128 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 10, 33, 34, 53, 0, 27, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 35, 8,
- 0, 0, 0, 9, 6, 52, 5, 0, 63, 0,
- 54, 0, 55, 0, 56, 0, 57, 59, 67, 49,
- 50, 34, 0, 35, 51, 0, 25, 0, 45, 46,
- 0, 1, 0, 0, 0, 0, 0, 22, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 73, 61, 65,
- 0, 62, 0, 0, 0, 58, 28, 0, 0, 26,
- 0, 0, 47, 2, 0, 29, 0, 0, 30, 0,
- 43, 44, 42, 36, 37, 38, 39, 40, 41, 74,
- 0, 64, 60, 66, 69, 12, 14, 13, 30, 0,
- 24, 29, 23, 48, 0, 70, 0, 29, 0, 0,
- 31, 32, 0, 15, 16, 75, 30, 0, 0, 0,
- 29, 30, 0, 0, 68, 71, 0, 29, 30, 29,
- 17, 72, 19, 30, 29, 0, 29, 0, 0, 0,
- 0, 18, 0, 20, 21
+ 0, 10, 33, 28, 53, 0, 27, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 3, 35, 9,
+ 0, 0, 0, 15, 6, 7, 52, 5, 75, 75,
+ 65, 0, 56, 0, 57, 0, 58, 0, 59, 61,
+ 69, 49, 50, 34, 0, 35, 51, 0, 25, 0,
+ 45, 46, 0, 1, 0, 0, 0, 0, 0, 22,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 76,
+ 0, 54, 63, 67, 0, 64, 0, 0, 0, 60,
+ 28, 0, 0, 26, 0, 0, 47, 2, 0, 29,
+ 0, 0, 30, 0, 43, 44, 42, 36, 37, 38,
+ 39, 40, 41, 48, 0, 66, 62, 68, 71, 12,
+ 14, 13, 30, 0, 24, 29, 23, 77, 72, 0,
+ 29, 0, 0, 34, 31, 32, 0, 16, 30, 0,
+ 0, 0, 29, 30, 0, 0, 70, 73, 0, 29,
+ 30, 29, 17, 74, 19, 30, 29, 0, 29, 0,
+ 0, 0, 0, 18, 0, 20, 21
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
- -1, 16, 17, 43, 121, 56, 20, 21, 22, 27,
- 109, 111, 123, 124, 25, 36, 37, 26, 76, 116,
- 100
+ -1, 16, 17, 45, 125, 58, 20, 21, 22, 29,
+ 113, 115, 23, 127, 25, 26, 38, 39, 27, 80,
+ 119, 70
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -110
+#define YYPACT_NINF -105
static const yytype_int16 yypact[] =
{
- 71, -110, -110, -35, -110, 9, -110, 12, 18, 33,
- 98, 17, 43, 98, 98, 98, 70, 32, 1, -110,
- 36, 40, 140, 185, -110, -110, -110, 39, -110, 80,
- -110, 85, -110, 72, -110, 61, 21, -110, -110, -110,
- -110, -110, 98, -110, 129, 88, -110, -27, 197, 197,
- 161, -110, 71, 140, 98, 140, 67, 173, 98, 98,
- 98, 98, 98, 98, 98, 98, 98, 98, -110, -110,
- 92, -110, 93, 94, 82, -110, -110, 129, 99, -110,
- 98, 98, -110, -110, 60, 185, 63, 149, -110, 98,
- 185, 185, 185, 116, 116, 197, 197, 185, 185, 185,
- -3, -110, -110, -110, 101, -110, 185, 185, -110, 8,
- -110, 115, 185, -110, 98, -110, -25, 115, 79, 98,
- -110, -110, 62, 185, -110, 185, 65, 106, 109, 98,
- 185, -110, 102, 118, 115, -110, 96, 185, -110, 115,
- -110, -110, -110, -110, 115, 120, 115, 121, 111, 122,
- 110, -110, 113, -110, -110
+ 65, -105, -105, 196, -105, 155, -105, -5, 28, 32,
+ 62, 9, 56, 62, 62, 62, 64, 23, 14, -105,
+ 25, 34, 109, 184, -105, -105, -105, -105, 62, 62,
+ -105, 68, -105, 69, -105, 57, -105, 1, 3, -105,
+ -105, -105, -105, -105, 62, -105, 119, 75, -105, -17,
+ 215, 215, 160, -105, 65, 109, 62, 109, 58, 172,
+ 62, 62, 62, 62, 62, 62, 62, 62, 62, 184,
+ -30, 39, -105, -105, 87, -105, 88, 89, 76, -105,
+ -105, 119, 92, -105, 62, 62, -105, -105, 53, 184,
+ 54, 148, -105, 62, 184, 184, 184, 213, 213, 215,
+ 215, 184, 184, -105, 62, -105, -105, -105, 97, -105,
+ 184, 184, -105, -9, -105, 102, 184, 184, -105, -21,
+ 102, 83, 62, 73, -105, -105, 37, -105, 70, 117,
+ 113, 62, 184, -105, 110, 120, 102, -105, 104, 184,
+ -105, 102, -105, -105, -105, -105, 102, 121, 102, 122,
+ 116, 126, 112, -105, 114, -105, -105
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -110, 100, -110, 4, 5, -46, -110, -110, -110, 75,
- -109, -102, 0, 16, -110, -110, 112, -110, -110, -110,
- -110
+ -105, 86, -105, 6, 7, -25, -105, -105, -105, 66,
+ -104, -102, -10, 8, -105, -105, -105, 106, -105, -105,
+ -105, 125
};
/* 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 -29
+#define YYTABLE_NINF -35
static const yytype_int16 yytable[] =
{
- 23, -7, 122, 80, 18, 19, 117, 84, 128, 86,
- 44, -28, 81, 48, 49, 50, 24, 28, 118, 38,
- 126, 138, 57, 29, 134, 127, 39, 30, 143, 139,
- 145, 31, 32, 33, 34, 147, 144, 149, 119, 35,
- 40, 146, 77, 31, 113, 33, -7, 114, 45, 46,
- 47, 74, 23, 57, 85, 87, 18, 19, 90, 91,
- 92, 93, 94, 95, 96, 97, 98, 99, 24, 71,
- 51, -4, 1, 131, 132, 72, 2, 52, 3, 54,
- 106, 107, 53, 73, 4, 67, 5, 6, 68, 112,
- 7, 8, 9, 69, 70, 79, 88, 10, 11, 12,
- 101, 102, 103, 2, 73, 41, 105, 108, 115, 129,
- 110, 13, 14, 135, 125, 133, -4, 15, 140, 130,
- 2, 136, 3, 142, 42, 141, 12, 151, 4, 137,
- 5, 6, 148, 150, 152, 8, 9, 153, 13, 14,
- 154, 10, 11, 12, 15, 2, 78, 41, 75, 58,
- 59, 104, 83, 0, 60, 13, 14, 0, 63, 64,
- 120, 15, 58, 59, 65, 66, 42, 60, 12, 61,
- 62, 63, 64, 0, 0, 0, 0, 65, 66, 0,
- 13, 14, 58, 59, 0, 0, 55, 60, 89, 61,
- 62, 63, 64, 0, 58, 59, 82, 65, 66, 60,
- 0, 61, 62, 63, 64, 0, 58, 59, 82, 65,
- 66, 60, 89, 61, 62, 63, 64, 0, 58, 59,
- 0, 65, 66, 60, 0, 61, 62, 63, 64, 0,
- 58, 59, 0, 65, 66, 60, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 65, 66
+ 46, 121, 40, 50, 51, 52, 18, 19, 24, 75,
+ 120, 126, 59, 84, -8, 76, 130, 103, 69, 69,
+ 104, 122, 85, 77, 128, 33, 136, 35, 140, 129,
+ 88, 141, 90, 78, 81, 145, 41, 147, 146, 42,
+ 47, 48, 149, 148, 151, 59, 89, 91, 133, 134,
+ 94, 95, 96, 97, 98, 99, 100, 101, 102, -8,
+ 18, 19, 24, 49, 53, -4, 1, 2, 54, 43,
+ 2, 55, 3, 56, 110, 111, 72, 73, 4, 74,
+ 5, 6, 83, 116, 7, 8, 9, 92, 44, 104,
+ 12, 10, 11, 12, 117, 105, 106, 107, 77, 109,
+ 112, 114, 13, 14, 118, 13, 14, 2, 15, 123,
+ -4, 15, 132, 131, 2, 4, 43, 5, 6, 28,
+ 135, 139, 8, 9, 137, 138, 142, 143, 10, 11,
+ 12, 144, 153, 150, 152, 44, 82, 12, 154, 155,
+ 87, 156, 13, 14, 79, 0, 108, 124, 15, 13,
+ 14, 0, 60, 61, 71, 57, 0, 62, 0, 63,
+ 64, 65, 66, 30, 0, 0, 0, 67, 68, 31,
+ 0, 0, 0, 32, 0, 0, 0, 33, 34, 35,
+ 36, 60, 61, 0, 0, 37, 62, 93, 63, 64,
+ 65, 66, 0, 60, 61, 86, 67, 68, 62, 0,
+ 63, 64, 65, 66, 0, 60, 61, 86, 67, 68,
+ 62, 93, 63, 64, 65, 66, 0, 60, 61, 0,
+ 67, 68, 62, 0, 63, 64, 65, 66, 0, -34,
+ -34, 0, 67, 68, -34, 0, 0, 0, -34, -34,
+ 0, 0, 28, 0, -34, -34, 60, 61, 60, 61,
+ 0, 62, 0, 62, 0, 65, 66, 0, 0, 0,
+ 0, 67, 68, 67, 68
};
static const yytype_int16 yycheck[] =
{
- 0, 0, 111, 30, 0, 0, 108, 53, 117, 55,
- 10, 46, 39, 13, 14, 15, 0, 8, 10, 7,
- 45, 130, 22, 14, 126, 50, 8, 18, 137, 131,
- 139, 22, 23, 24, 25, 144, 138, 146, 30, 30,
- 7, 143, 42, 22, 47, 24, 45, 50, 31, 32,
- 7, 30, 52, 53, 54, 55, 52, 52, 58, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 52, 8,
- 0, 0, 1, 11, 12, 14, 5, 45, 7, 39,
- 80, 81, 46, 22, 13, 46, 15, 16, 8, 89,
- 19, 20, 21, 8, 22, 7, 29, 26, 27, 28,
- 8, 8, 8, 5, 22, 7, 7, 47, 7, 30,
- 47, 40, 41, 7, 114, 50, 45, 46, 16, 119,
- 5, 12, 7, 27, 26, 7, 28, 16, 13, 129,
- 15, 16, 12, 12, 12, 20, 21, 27, 40, 41,
- 27, 26, 27, 28, 46, 5, 17, 7, 36, 33,
- 34, 76, 52, -1, 38, 40, 41, -1, 42, 43,
- 45, 46, 33, 34, 48, 49, 26, 38, 28, 40,
- 41, 42, 43, -1, -1, -1, -1, 48, 49, -1,
- 40, 41, 33, 34, -1, -1, 46, 38, 39, 40,
- 41, 42, 43, -1, 33, 34, 47, 48, 49, 38,
- -1, 40, 41, 42, 43, -1, 33, 34, 47, 48,
- 49, 38, 39, 40, 41, 42, 43, -1, 33, 34,
- -1, 48, 49, 38, -1, 40, 41, 42, 43, -1,
- 33, 34, -1, 48, 49, 38, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 48, 49
+ 10, 10, 7, 13, 14, 15, 0, 0, 0, 8,
+ 112, 115, 22, 30, 0, 14, 120, 47, 28, 29,
+ 50, 30, 39, 22, 45, 22, 128, 24, 132, 50,
+ 55, 133, 57, 30, 44, 139, 8, 141, 140, 7,
+ 31, 32, 146, 145, 148, 55, 56, 57, 11, 12,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 45,
+ 54, 54, 54, 7, 0, 0, 1, 5, 45, 7,
+ 5, 46, 7, 39, 84, 85, 8, 8, 13, 22,
+ 15, 16, 7, 93, 19, 20, 21, 29, 26, 50,
+ 28, 26, 27, 28, 104, 8, 8, 8, 22, 7,
+ 47, 47, 40, 41, 7, 40, 41, 5, 46, 7,
+ 45, 46, 122, 30, 5, 13, 7, 15, 16, 46,
+ 50, 131, 20, 21, 7, 12, 16, 7, 26, 27,
+ 28, 27, 16, 12, 12, 26, 17, 28, 12, 27,
+ 54, 27, 40, 41, 38, -1, 80, 45, 46, 40,
+ 41, -1, 33, 34, 29, 46, -1, 38, -1, 40,
+ 41, 42, 43, 8, -1, -1, -1, 48, 49, 14,
+ -1, -1, -1, 18, -1, -1, -1, 22, 23, 24,
+ 25, 33, 34, -1, -1, 30, 38, 39, 40, 41,
+ 42, 43, -1, 33, 34, 47, 48, 49, 38, -1,
+ 40, 41, 42, 43, -1, 33, 34, 47, 48, 49,
+ 38, 39, 40, 41, 42, 43, -1, 33, 34, -1,
+ 48, 49, 38, -1, 40, 41, 42, 43, -1, 33,
+ 34, -1, 48, 49, 38, -1, -1, -1, 42, 43,
+ -1, -1, 46, -1, 48, 49, 33, 34, 33, 34,
+ -1, 38, -1, 38, -1, 42, 43, -1, -1, -1,
+ -1, 48, 49, 48, 49
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -723,20 +727,20 @@ static const yytype_uint8 yystos[] =
{
0, 1, 5, 7, 13, 15, 16, 19, 20, 21,
26, 27, 28, 40, 41, 46, 52, 53, 54, 55,
- 57, 58, 59, 63, 64, 65, 68, 60, 8, 14,
- 18, 22, 23, 24, 25, 30, 66, 67, 7, 8,
- 7, 7, 26, 54, 63, 31, 32, 7, 63, 63,
- 63, 0, 45, 46, 39, 46, 56, 63, 33, 34,
- 38, 40, 41, 42, 43, 48, 49, 46, 8, 8,
- 22, 8, 14, 22, 30, 67, 69, 63, 17, 7,
- 30, 39, 47, 52, 56, 63, 56, 63, 29, 39,
- 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
- 71, 8, 8, 8, 60, 7, 63, 63, 47, 61,
- 47, 62, 63, 47, 50, 7, 70, 62, 10, 30,
- 45, 55, 61, 63, 64, 63, 45, 50, 61, 30,
- 63, 11, 12, 50, 62, 7, 12, 63, 61, 62,
- 16, 7, 27, 61, 62, 61, 62, 61, 12, 61,
- 12, 16, 12, 27, 27
+ 57, 58, 59, 63, 64, 65, 66, 69, 46, 60,
+ 8, 14, 18, 22, 23, 24, 25, 30, 67, 68,
+ 7, 8, 7, 7, 26, 54, 63, 31, 32, 7,
+ 63, 63, 63, 0, 45, 46, 39, 46, 56, 63,
+ 33, 34, 38, 40, 41, 42, 43, 48, 49, 63,
+ 72, 72, 8, 8, 22, 8, 14, 22, 30, 68,
+ 70, 63, 17, 7, 30, 39, 47, 52, 56, 63,
+ 56, 63, 29, 39, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 47, 50, 8, 8, 8, 60, 7,
+ 63, 63, 47, 61, 47, 62, 63, 63, 7, 71,
+ 62, 10, 30, 7, 45, 55, 61, 64, 45, 50,
+ 61, 30, 63, 11, 12, 50, 62, 7, 12, 63,
+ 61, 62, 16, 7, 27, 61, 62, 61, 62, 61,
+ 12, 61, 12, 16, 12, 27, 27
};
#define yyerrok (yyerrstatus = 0)
@@ -1550,8 +1554,8 @@ yyreduce:
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
- case 7:
-#line 99 "engines/director/lingo/lingo-gr.y"
+ case 8:
+#line 100 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
@@ -1783,9 +1787,9 @@ yyreduce:
#line 233 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
- g_lingo->codeString((yyvsp[(1) - (5)].s)->c_str());
+ g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
inst numpar = 0;
- WRITE_UINT32(&numpar, (yyvsp[(4) - (5)].narg));
+ WRITE_UINT32(&numpar, (yyvsp[(3) - (4)].narg));
g_lingo->code1(numpar); ;}
break;
@@ -1810,22 +1814,40 @@ yyreduce:
break;
case 54:
-#line 254 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoloop); ;}
+#line 246 "engines/director/lingo/lingo-gr.y"
+ {
+ g_lingo->code1(g_lingo->c_call);
+ g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
+ inst numpar = 0;
+ WRITE_UINT32(&numpar, (yyvsp[(3) - (3)].narg));
+ g_lingo->code1(numpar); ;}
break;
case 55:
-#line 255 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotonext); ;}
+#line 252 "engines/director/lingo/lingo-gr.y"
+ {
+ g_lingo->code1(g_lingo->c_call);
+ g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str());
+ g_lingo->code1(0); ;}
break;
case 56:
-#line 256 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoprevious); ;}
+#line 266 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 57:
-#line 257 "engines/director/lingo/lingo-gr.y"
+#line 267 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gotonext); ;}
+ break;
+
+ case 58:
+#line 268 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gotoprevious); ;}
+ break;
+
+ case 59:
+#line 269 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1833,8 +1855,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 58:
-#line 262 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 274 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1843,8 +1865,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 59:
-#line 268 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 280 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1852,92 +1874,92 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 60:
-#line 275 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 287 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 61:
-#line 276 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 288 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 62:
-#line 277 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 289 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 63:
-#line 278 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 290 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 64:
-#line 281 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 293 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 65:
-#line 282 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 294 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 66:
-#line 283 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 295 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 67:
-#line 311 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 323 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 68:
-#line 312 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 324 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*(yyvsp[(2) - (7)].s), (yyvsp[(4) - (7)].code), (yyvsp[(5) - (7)].narg));
g_lingo->_indef = false; ;}
break;
- case 69:
-#line 317 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 329 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 70:
-#line 318 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 330 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); (yyval.narg) = 1; ;}
break;
- case 71:
-#line 319 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 331 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(3) - (3)].s)); delete (yyvsp[(3) - (3)].s); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 72:
-#line 320 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 332 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(4) - (4)].s)); delete (yyvsp[(4) - (4)].s); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 73:
-#line 323 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 335 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 74:
-#line 324 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 336 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 75:
-#line 325 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 337 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 1941 "engines/director/lingo/lingo-gr.cpp"
+#line 1963 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2151,6 +2173,6 @@ yyreturn:
}
-#line 328 "engines/director/lingo/lingo-gr.y"
+#line 340 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 6ed5400..09523e3 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -96,9 +96,9 @@ program: programline '\n' program
programline:
| defn
| func
+ | macro
| asgn { g_lingo->code1(g_lingo->c_xpop); }
| stmt
- | expr
| error { yyerrok; }
| /* empty */
;
@@ -230,11 +230,11 @@ expr: INT {
| '(' expr ')' { $$ = $2; }
;
-func: ID begin '(' arglist ')' {
+func: ID '(' arglist ')' {
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString($1->c_str());
inst numpar = 0;
- WRITE_UINT32(&numpar, $4);
+ WRITE_UINT32(&numpar, $3);
g_lingo->code1(numpar); };
| tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_str()); delete $2; }
| tMCIWAIT ID { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
@@ -243,6 +243,18 @@ func: ID begin '(' arglist ')' {
| tEXIT { g_lingo->code1(g_lingo->c_exit); }
;
+macro: ID begin arglist {
+ g_lingo->code1(g_lingo->c_call);
+ g_lingo->codeString($1->c_str());
+ inst numpar = 0;
+ WRITE_UINT32(&numpar, $3);
+ g_lingo->code1(numpar); };
+ | ID {
+ g_lingo->code1(g_lingo->c_call);
+ g_lingo->codeString($1->c_str());
+ g_lingo->code1(0); };
+ ;
+
// go {to} {frame} whichFrame {of movie whichMovie}
// go {to} {frame "Open23" of} movie whichMovie
// go loop
Commit: ad9e955b1e1645aae2561a2b5263ae69d4d367a3
https://github.com/scummvm/scummvm/commit/ad9e955b1e1645aae2561a2b5263ae69d4d367a3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Add type to stack
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 1130f22..45f6a5a 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -100,8 +100,6 @@ check 4, 5, 6\n\
_lingo->executeScript(kMovieScript, 2);
-return Common::kNoError;
-
_lingo->addCode("--\n\
macro SHIPX\n\
set x = 5\n\
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 065848d..4407bb8 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -72,13 +72,36 @@ void Lingo::c_xpop() {
void Lingo::c_printtop(void) {
Datum d = g_lingo->pop();
- warning("%d", d.val);
+ switch (d.type) {
+ case VOID:
+ warning("Void");
+ break;
+ case INT:
+ warning("%d", d.u.i);
+ break;
+ case FLOAT:
+ warning("%f", d.u.f);
+ break;
+ case VAR:
+ if (!d.u.sym) {
+ warning("Inconsistent stack: var, val: %d", d.u.i);
+ } else {
+ if (d.u.sym->name)
+ warning("var: %s", d.u.sym->name);
+ else
+ warning("Nameless var. val: %d", d.u.sym->u.val);
+ }
+ break;
+ default:
+ warning("--unknown--");
+ }
}
void Lingo::c_constpush() {
Datum d;
inst i = (*g_lingo->_currentScript)[g_lingo->_pc++];
- d.val = READ_UINT32(&i);
+ d.u.i = READ_UINT32(&i);
+ d.type = INT;
g_lingo->push(d);
}
@@ -86,7 +109,8 @@ void Lingo::c_varpush() {
char *name = (char *)&(*g_lingo->_currentScript)[g_lingo->_pc];
Datum d;
- d.sym = g_lingo->lookupVar(name);
+ d.u.sym = g_lingo->lookupVar(name);
+ d.type = VAR;
g_lingo->_pc += g_lingo->calcStringAlignment(name);
@@ -98,13 +122,19 @@ void Lingo::c_assign() {
d1 = g_lingo->pop();
d2 = g_lingo->pop();
- if (d1.sym->type != INT && d1.sym->type != VOID) {
- warning("assignment to non-variable '%s'", d1.sym->name);
+ if (d1.type != VAR) {
+ warning("assignment to non-variable");
return;
}
- d1.sym->u.val = d2.val;
- d1.sym->type = INT;
+ if (d1.u.sym->type != INT && d1.u.sym->type != VOID) {
+ warning("assignment to non-variable '%s'", d1.u.sym->name);
+ return;
+ }
+
+ d1.u.sym->u.val = d2.u.i;
+ d1.u.sym->type = d2.type;
+
g_lingo->push(d2);
}
@@ -128,10 +158,11 @@ void Lingo::c_eval() {
Datum d;
d = g_lingo->pop();
- if (!g_lingo->verify(d.sym))
+ if (!g_lingo->verify(d.u.sym))
return;
- d.val = d.sym->u.val;
+ d.type = d.u.sym->type;
+ d.u.i = d.u.sym->u.val;
g_lingo->push(d);
}
@@ -140,7 +171,7 @@ void Lingo::c_add() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.val += d2.val;
+ d1.u.i += d2.u.i;
g_lingo->push(d1);
}
@@ -148,7 +179,7 @@ void Lingo::c_sub() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.val -= d2.val;
+ d1.u.i -= d2.u.i;
g_lingo->push(d1);
}
@@ -156,26 +187,26 @@ void Lingo::c_mul() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.val *= d2.val;
+ d1.u.i *= d2.u.i;
g_lingo->push(d1);
}
void Lingo::c_div() {
Datum d2 = g_lingo->pop();
- if (d2.val == 0)
+ if (d2.u.i == 0)
error("division by zero");
Datum d1 = g_lingo->pop();
- d1.val /= d2.val;
+ d1.u.i /= d2.u.i;
g_lingo->push(d1);
}
void Lingo::c_negate() {
Datum d = g_lingo->pop();
- d.val -= d.val;
+ d.u.i -= d.u.i;
g_lingo->push(d);
}
@@ -183,7 +214,7 @@ void Lingo::c_eq() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.val = (d1.val == d2.val) ? 1 : 0;
+ d1.u.i = (d1.u.i == d2.u.i) ? 1 : 0;
g_lingo->push(d1);
}
@@ -191,7 +222,7 @@ void Lingo::c_neq() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.val = (d1.val != d2.val) ? 1 : 0;
+ d1.u.i = (d1.u.i != d2.u.i) ? 1 : 0;
g_lingo->push(d1);
}
@@ -199,7 +230,7 @@ void Lingo::c_gt() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.val = (d1.val > d2.val) ? 1 : 0;
+ d1.u.i = (d1.u.i > d2.u.i) ? 1 : 0;
g_lingo->push(d1);
}
@@ -207,7 +238,7 @@ void Lingo::c_lt() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.val = (d1.val < d2.val) ? 1 : 0;
+ d1.u.i = (d1.u.i < d2.u.i) ? 1 : 0;
g_lingo->push(d1);
}
@@ -215,7 +246,7 @@ void Lingo::c_ge() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.val = (d1.val >= d2.val) ? 1 : 0;
+ d1.u.i = (d1.u.i >= d2.u.i) ? 1 : 0;
g_lingo->push(d1);
}
@@ -223,7 +254,7 @@ void Lingo::c_le() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.val = (d1.val <= d2.val) ? 1 : 0;
+ d1.u.i = (d1.u.i <= d2.u.i) ? 1 : 0;
g_lingo->push(d1);
}
@@ -237,7 +268,7 @@ void Lingo::c_repeatwhilecode(void) {
g_lingo->execute(savepc + 2); /* condition */
d = g_lingo->pop();
- while (d.val) {
+ while (d.u.i) {
g_lingo->execute(body); /* body */
if (g_lingo->_returning)
break;
@@ -264,7 +295,7 @@ void Lingo::c_repeatwithcode(void) {
g_lingo->execute(init); /* condition */
d = g_lingo->pop();
- counter->u.val = d.val;
+ counter->u.val = d.u.i;
counter->type = INT;
while (true) {
@@ -276,7 +307,7 @@ void Lingo::c_repeatwithcode(void) {
g_lingo->execute(finish); /* condition */
d = g_lingo->pop();
- if (counter->u.val == d.val + inc)
+ if (counter->u.val == d.u.i + inc)
break;
}
@@ -296,7 +327,7 @@ void Lingo::c_ifcode() {
d = g_lingo->pop();
- if (d.val) {
+ if (d.u.i) {
g_lingo->execute(then);
} else if (elsep) { /* else part? */
g_lingo->execute(elsep);
@@ -366,7 +397,8 @@ void Lingo::c_call() {
for (int i = nargs; i < sym->nargs; i++) {
Datum d;
- d.val = 0; // TODO, FIXME: Must be VOID
+ d.u.i = 0;
+ d.type = VOID;
g_lingo->push(d);
}
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 945da38..ca8374a 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -55,7 +55,7 @@ void Lingo::execute(int pc) {
for(_pc = pc; (*_currentScript)[_pc] != STOP && !_returning;) {
for (int i = 0; i < _stack.size(); i++) {
- debugN(5, "%d ", _stack[i].val);
+ debugN(5, "%d ", _stack[i].u.i);
}
debug(5, "");
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 996f7cc..ac54174 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -68,79 +68,81 @@
enum yytokentype {
UNARY = 258,
VOID = 259,
- INT = 260,
- FLOAT = 261,
- ID = 262,
- STRING = 263,
- HANDLER = 264,
- tDOWN = 265,
- tELSE = 266,
- tEND = 267,
- tEXIT = 268,
- tFRAME = 269,
- tGO = 270,
- tIF = 271,
- tINTO = 272,
- tLOOP = 273,
- tMACRO = 274,
- tMCI = 275,
- tMCIWAIT = 276,
- tMOVIE = 277,
- tNEXT = 278,
- tOF = 279,
- tPREVIOUS = 280,
- tPUT = 281,
- tREPEAT = 282,
- tSET = 283,
- tTHEN = 284,
- tTO = 285,
- tWITH = 286,
- tWHILE = 287,
- tGE = 288,
- tLE = 289,
- tGT = 290,
- tLT = 291,
- tEQ = 292,
- tNEQ = 293
+ VAR = 260,
+ INT = 261,
+ FLOAT = 262,
+ ID = 263,
+ STRING = 264,
+ HANDLER = 265,
+ tDOWN = 266,
+ tELSE = 267,
+ tEND = 268,
+ tEXIT = 269,
+ tFRAME = 270,
+ tGO = 271,
+ tIF = 272,
+ tINTO = 273,
+ tLOOP = 274,
+ tMACRO = 275,
+ tMCI = 276,
+ tMCIWAIT = 277,
+ tMOVIE = 278,
+ tNEXT = 279,
+ tOF = 280,
+ tPREVIOUS = 281,
+ tPUT = 282,
+ tREPEAT = 283,
+ tSET = 284,
+ tTHEN = 285,
+ tTO = 286,
+ tWITH = 287,
+ tWHILE = 288,
+ tGE = 289,
+ tLE = 290,
+ tGT = 291,
+ tLT = 292,
+ tEQ = 293,
+ tNEQ = 294
};
#endif
/* Tokens. */
#define UNARY 258
#define VOID 259
-#define INT 260
-#define FLOAT 261
-#define ID 262
-#define STRING 263
-#define HANDLER 264
-#define tDOWN 265
-#define tELSE 266
-#define tEND 267
-#define tEXIT 268
-#define tFRAME 269
-#define tGO 270
-#define tIF 271
-#define tINTO 272
-#define tLOOP 273
-#define tMACRO 274
-#define tMCI 275
-#define tMCIWAIT 276
-#define tMOVIE 277
-#define tNEXT 278
-#define tOF 279
-#define tPREVIOUS 280
-#define tPUT 281
-#define tREPEAT 282
-#define tSET 283
-#define tTHEN 284
-#define tTO 285
-#define tWITH 286
-#define tWHILE 287
-#define tGE 288
-#define tLE 289
-#define tGT 290
-#define tLT 291
-#define tEQ 292
-#define tNEQ 293
+#define VAR 260
+#define INT 261
+#define FLOAT 262
+#define ID 263
+#define STRING 264
+#define HANDLER 265
+#define tDOWN 266
+#define tELSE 267
+#define tEND 268
+#define tEXIT 269
+#define tFRAME 270
+#define tGO 271
+#define tIF 272
+#define tINTO 273
+#define tLOOP 274
+#define tMACRO 275
+#define tMCI 276
+#define tMCIWAIT 277
+#define tMOVIE 278
+#define tNEXT 279
+#define tOF 280
+#define tPREVIOUS 281
+#define tPUT 282
+#define tREPEAT 283
+#define tSET 284
+#define tTHEN 285
+#define tTO 286
+#define tWITH 287
+#define tWHILE 288
+#define tGE 289
+#define tLE 290
+#define tGT 291
+#define tLT 292
+#define tEQ 293
+#define tNEQ 294
@@ -192,7 +194,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 196 "engines/director/lingo/lingo-gr.cpp"
+#line 198 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -205,7 +207,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 209 "engines/director/lingo/lingo-gr.cpp"
+#line 211 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -423,7 +425,7 @@ union yyalloc
#define YYLAST 264
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 51
+#define YYNTOKENS 52
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 22
/* YYNRULES -- Number of rules. */
@@ -433,7 +435,7 @@ union yyalloc
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 293
+#define YYMAXUTOK 294
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -442,12 +444,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 45, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 46, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 44, 2, 2,
- 46, 47, 42, 40, 50, 41, 2, 43, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 45, 2, 2,
+ 47, 48, 43, 41, 51, 42, 2, 44, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 49, 39, 48, 2, 2, 2, 2, 2, 2, 2,
+ 50, 40, 49, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -470,7 +472,7 @@ static const yytype_uint8 yytranslate[] =
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38
+ 35, 36, 37, 38, 39
};
#if YYDEBUG
@@ -491,33 +493,33 @@ static const yytype_uint16 yyprhs[] =
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 52, 0, -1, 53, 45, 52, -1, 53, -1, -1,
- 69, -1, 64, -1, 65, -1, 54, -1, 55, -1,
- 1, -1, -1, 26, 63, 17, 7, -1, 28, 7,
- 39, 63, -1, 28, 7, 30, 63, -1, 63, -1,
- 64, -1, 59, 56, 29, 62, 61, 12, 16, -1,
- 59, 56, 29, 62, 61, 11, 62, 61, 12, 16,
- -1, 57, 46, 56, 47, 62, 61, 12, 27, -1,
- 58, 39, 63, 61, 30, 63, 61, 62, 61, 12,
- 27, -1, 58, 39, 63, 61, 10, 30, 63, 61,
- 62, 61, 12, 27, -1, 63, -1, 63, 39, 63,
- -1, 46, 56, 47, -1, 27, 32, -1, 27, 31,
- 7, -1, 16, -1, -1, -1, -1, 62, 45, -1,
- 62, 55, -1, 5, -1, 7, -1, 54, -1, 63,
- 40, 63, -1, 63, 41, 63, -1, 63, 42, 63,
- -1, 63, 43, 63, -1, 63, 48, 63, -1, 63,
- 49, 63, -1, 63, 38, 63, -1, 63, 33, 63,
- -1, 63, 34, 63, -1, 40, 63, -1, 41, 63,
- -1, 46, 63, 47, -1, 7, 46, 72, 47, -1,
- 20, 8, -1, 21, 7, -1, 26, 63, -1, 66,
- -1, 13, -1, 7, 60, 72, -1, 7, -1, 15,
- 18, -1, 15, 23, -1, 15, 25, -1, 15, 67,
- -1, 15, 67, 68, -1, 15, 68, -1, 30, 14,
- 8, -1, 14, 8, -1, 30, 8, -1, 8, -1,
- 24, 22, 8, -1, 22, 8, -1, 30, 22, 8,
- -1, -1, 19, 7, 70, 60, 71, 45, 62, -1,
- -1, 7, -1, 71, 50, 7, -1, 71, 45, 50,
- 7, -1, -1, 63, -1, 72, 50, 63, -1
+ 53, 0, -1, 54, 46, 53, -1, 54, -1, -1,
+ 70, -1, 65, -1, 66, -1, 55, -1, 56, -1,
+ 1, -1, -1, 27, 64, 18, 8, -1, 29, 8,
+ 40, 64, -1, 29, 8, 31, 64, -1, 64, -1,
+ 65, -1, 60, 57, 30, 63, 62, 13, 17, -1,
+ 60, 57, 30, 63, 62, 12, 63, 62, 13, 17,
+ -1, 58, 47, 57, 48, 63, 62, 13, 28, -1,
+ 59, 40, 64, 62, 31, 64, 62, 63, 62, 13,
+ 28, -1, 59, 40, 64, 62, 11, 31, 64, 62,
+ 63, 62, 13, 28, -1, 64, -1, 64, 40, 64,
+ -1, 47, 57, 48, -1, 28, 33, -1, 28, 32,
+ 8, -1, 17, -1, -1, -1, -1, 63, 46, -1,
+ 63, 56, -1, 6, -1, 8, -1, 55, -1, 64,
+ 41, 64, -1, 64, 42, 64, -1, 64, 43, 64,
+ -1, 64, 44, 64, -1, 64, 49, 64, -1, 64,
+ 50, 64, -1, 64, 39, 64, -1, 64, 34, 64,
+ -1, 64, 35, 64, -1, 41, 64, -1, 42, 64,
+ -1, 47, 64, 48, -1, 8, 47, 73, 48, -1,
+ 21, 9, -1, 22, 8, -1, 27, 64, -1, 67,
+ -1, 14, -1, 8, 61, 73, -1, 8, -1, 16,
+ 19, -1, 16, 24, -1, 16, 26, -1, 16, 68,
+ -1, 16, 68, 69, -1, 16, 69, -1, 31, 15,
+ 9, -1, 15, 9, -1, 31, 9, -1, 9, -1,
+ 25, 23, 9, -1, 23, 9, -1, 31, 23, 9,
+ -1, -1, 20, 8, 71, 61, 72, 46, 63, -1,
+ -1, 8, -1, 72, 51, 8, -1, 72, 46, 51,
+ 8, -1, -1, 64, -1, 73, 51, 64, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -539,13 +541,13 @@ static const yytype_uint16 yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "UNARY", "VOID", "INT", "FLOAT", "ID",
- "STRING", "HANDLER", "tDOWN", "tELSE", "tEND", "tEXIT", "tFRAME", "tGO",
- "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT",
- "tOF", "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH",
- "tWHILE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'",
- "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "','",
- "$accept", "program", "programline", "asgn", "stmt", "cond",
+ "$end", "error", "$undefined", "UNARY", "VOID", "VAR", "INT", "FLOAT",
+ "ID", "STRING", "HANDLER", "tDOWN", "tELSE", "tEND", "tEXIT", "tFRAME",
+ "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE",
+ "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO",
+ "tWITH", "tWHILE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='",
+ "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'",
+ "','", "$accept", "program", "programline", "asgn", "stmt", "cond",
"repeatwhile", "repeatwith", "if", "begin", "end", "stmtlist", "expr",
"func", "macro", "gotofunc", "gotoframe", "gotomovie", "defn", "@1",
"argdef", "arglist", 0
@@ -560,23 +562,23 @@ static const yytype_uint16 yytoknum[] =
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 287, 288, 289, 290, 291, 292, 293, 61,
- 43, 45, 42, 47, 37, 10, 40, 41, 62, 60,
- 44
+ 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
+ 61, 43, 45, 42, 47, 37, 10, 40, 41, 62,
+ 60, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 51, 52, 52, 53, 53, 53, 53, 53, 53,
- 53, 53, 54, 54, 54, 55, 55, 55, 55, 55,
- 55, 55, 56, 56, 56, 57, 58, 59, 60, 61,
- 62, 62, 62, 63, 63, 63, 63, 63, 63, 63,
- 63, 63, 63, 63, 63, 63, 63, 63, 64, 64,
- 64, 64, 64, 64, 65, 65, 66, 66, 66, 66,
- 66, 66, 67, 67, 67, 67, 68, 68, 68, 70,
- 69, 71, 71, 71, 71, 72, 72, 72
+ 0, 52, 53, 53, 54, 54, 54, 54, 54, 54,
+ 54, 54, 55, 55, 55, 56, 56, 56, 56, 56,
+ 56, 56, 57, 57, 57, 58, 59, 60, 61, 62,
+ 63, 63, 63, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
+ 65, 65, 65, 65, 66, 66, 67, 67, 67, 67,
+ 67, 67, 68, 68, 68, 68, 69, 69, 69, 71,
+ 70, 72, 72, 72, 72, 73, 73, 73
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -625,33 +627,33 @@ static const yytype_int8 yydefgoto[] =
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -105
+#define YYPACT_NINF -107
static const yytype_int16 yypact[] =
{
- 65, -105, -105, 196, -105, 155, -105, -5, 28, 32,
- 62, 9, 56, 62, 62, 62, 64, 23, 14, -105,
- 25, 34, 109, 184, -105, -105, -105, -105, 62, 62,
- -105, 68, -105, 69, -105, 57, -105, 1, 3, -105,
- -105, -105, -105, -105, 62, -105, 119, 75, -105, -17,
- 215, 215, 160, -105, 65, 109, 62, 109, 58, 172,
- 62, 62, 62, 62, 62, 62, 62, 62, 62, 184,
- -30, 39, -105, -105, 87, -105, 88, 89, 76, -105,
- -105, 119, 92, -105, 62, 62, -105, -105, 53, 184,
- 54, 148, -105, 62, 184, 184, 184, 213, 213, 215,
- 215, 184, 184, -105, 62, -105, -105, -105, 97, -105,
- 184, 184, -105, -9, -105, 102, 184, 184, -105, -21,
- 102, 83, 62, 73, -105, -105, 37, -105, 70, 117,
- 113, 62, 184, -105, 110, 120, 102, -105, 104, 184,
- -105, 102, -105, -105, -105, -105, 102, 121, 102, 122,
- 116, 126, 112, -105, 114, -105, -105
+ 64, -107, -107, 195, -107, 154, -107, -7, 22, 9,
+ 61, 5, 41, 61, 61, 61, 59, 17, 2, -107,
+ 19, 28, 108, 183, -107, -107, -107, -107, 61, 61,
+ -107, 62, -107, 67, -107, 50, -107, 13, -2, -107,
+ -107, -107, -107, -107, 61, -107, 118, 69, -107, -16,
+ 214, 214, 159, -107, 64, 108, 61, 108, 49, 171,
+ 61, 61, 61, 61, 61, 61, 61, 61, 61, 183,
+ -35, 31, -107, -107, 78, -107, 80, 88, 75, -107,
+ -107, 118, 91, -107, 61, 61, -107, -107, 52, 183,
+ 53, 147, -107, 61, 183, 183, 183, 212, 212, 214,
+ 214, 183, 183, -107, 61, -107, -107, -107, 96, -107,
+ 183, 183, -107, -1, -107, 101, 183, 183, -107, -26,
+ 101, 82, 61, 72, -107, -107, 83, -107, 73, 112,
+ 113, 61, 183, -107, 110, 117, 101, -107, 103, 183,
+ -107, 101, -107, -107, -107, -107, 101, 119, 101, 120,
+ 121, 126, 106, -107, 116, -107, -107
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -105, 86, -105, 6, 7, -25, -105, -105, -105, 66,
- -104, -102, -10, 8, -105, -105, -105, 106, -105, -105,
- -105, 125
+ -107, 86, -107, 6, 7, -14, -107, -107, -107, 65,
+ -106, -101, -10, 8, -107, -107, -107, 127, -107, -107,
+ -107, 122
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -661,23 +663,23 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -35
static const yytype_int16 yytable[] =
{
- 46, 121, 40, 50, 51, 52, 18, 19, 24, 75,
- 120, 126, 59, 84, -8, 76, 130, 103, 69, 69,
- 104, 122, 85, 77, 128, 33, 136, 35, 140, 129,
- 88, 141, 90, 78, 81, 145, 41, 147, 146, 42,
- 47, 48, 149, 148, 151, 59, 89, 91, 133, 134,
- 94, 95, 96, 97, 98, 99, 100, 101, 102, -8,
- 18, 19, 24, 49, 53, -4, 1, 2, 54, 43,
- 2, 55, 3, 56, 110, 111, 72, 73, 4, 74,
- 5, 6, 83, 116, 7, 8, 9, 92, 44, 104,
- 12, 10, 11, 12, 117, 105, 106, 107, 77, 109,
+ 46, 40, -8, 50, 51, 52, 18, 19, 24, 126,
+ 121, 120, 59, 103, 130, 84, 104, 42, 69, 69,
+ 128, 33, 75, 35, 85, 129, 140, 136, 76, 78,
+ 122, 41, 141, 145, 81, 147, 77, 47, 48, 146,
+ 149, 88, 151, 90, 148, 59, 89, 91, -8, 49,
+ 94, 95, 96, 97, 98, 99, 100, 101, 102, 53,
+ 18, 19, 24, 54, -4, 1, 55, 2, 56, 43,
+ 2, 72, 3, 74, 110, 111, 73, 83, 4, 92,
+ 5, 6, 104, 116, 7, 8, 9, 105, 44, 106,
+ 12, 10, 11, 12, 117, 133, 134, 107, 77, 109,
112, 114, 13, 14, 118, 13, 14, 2, 15, 123,
-4, 15, 132, 131, 2, 4, 43, 5, 6, 28,
- 135, 139, 8, 9, 137, 138, 142, 143, 10, 11,
- 12, 144, 153, 150, 152, 44, 82, 12, 154, 155,
- 87, 156, 13, 14, 79, 0, 108, 124, 15, 13,
- 14, 0, 60, 61, 71, 57, 0, 62, 0, 63,
- 64, 65, 66, 30, 0, 0, 0, 67, 68, 31,
+ 137, 139, 8, 9, 135, 143, 138, 142, 10, 11,
+ 12, 144, 150, 152, 155, 44, 82, 12, 153, 154,
+ 87, 0, 13, 14, 156, 108, 0, 124, 15, 13,
+ 14, 71, 60, 61, 0, 57, 0, 62, 0, 63,
+ 64, 65, 66, 30, 0, 79, 0, 67, 68, 31,
0, 0, 0, 32, 0, 0, 0, 33, 34, 35,
36, 60, 61, 0, 0, 37, 62, 93, 63, 64,
65, 66, 0, 60, 61, 86, 67, 68, 62, 0,
@@ -692,55 +694,55 @@ static const yytype_int16 yytable[] =
static const yytype_int16 yycheck[] =
{
- 10, 10, 7, 13, 14, 15, 0, 0, 0, 8,
- 112, 115, 22, 30, 0, 14, 120, 47, 28, 29,
- 50, 30, 39, 22, 45, 22, 128, 24, 132, 50,
- 55, 133, 57, 30, 44, 139, 8, 141, 140, 7,
- 31, 32, 146, 145, 148, 55, 56, 57, 11, 12,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 45,
- 54, 54, 54, 7, 0, 0, 1, 5, 45, 7,
- 5, 46, 7, 39, 84, 85, 8, 8, 13, 22,
- 15, 16, 7, 93, 19, 20, 21, 29, 26, 50,
- 28, 26, 27, 28, 104, 8, 8, 8, 22, 7,
- 47, 47, 40, 41, 7, 40, 41, 5, 46, 7,
- 45, 46, 122, 30, 5, 13, 7, 15, 16, 46,
- 50, 131, 20, 21, 7, 12, 16, 7, 26, 27,
- 28, 27, 16, 12, 12, 26, 17, 28, 12, 27,
- 54, 27, 40, 41, 38, -1, 80, 45, 46, 40,
- 41, -1, 33, 34, 29, 46, -1, 38, -1, 40,
- 41, 42, 43, 8, -1, -1, -1, 48, 49, 14,
- -1, -1, -1, 18, -1, -1, -1, 22, 23, 24,
- 25, 33, 34, -1, -1, 30, 38, 39, 40, 41,
- 42, 43, -1, 33, 34, 47, 48, 49, 38, -1,
- 40, 41, 42, 43, -1, 33, 34, 47, 48, 49,
- 38, 39, 40, 41, 42, 43, -1, 33, 34, -1,
- 48, 49, 38, -1, 40, 41, 42, 43, -1, 33,
- 34, -1, 48, 49, 38, -1, -1, -1, 42, 43,
- -1, -1, 46, -1, 48, 49, 33, 34, 33, 34,
- -1, 38, -1, 38, -1, 42, 43, -1, -1, -1,
- -1, 48, 49, 48, 49
+ 10, 8, 0, 13, 14, 15, 0, 0, 0, 115,
+ 11, 112, 22, 48, 120, 31, 51, 8, 28, 29,
+ 46, 23, 9, 25, 40, 51, 132, 128, 15, 31,
+ 31, 9, 133, 139, 44, 141, 23, 32, 33, 140,
+ 146, 55, 148, 57, 145, 55, 56, 57, 46, 8,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 0,
+ 54, 54, 54, 46, 0, 1, 47, 6, 40, 8,
+ 6, 9, 8, 23, 84, 85, 9, 8, 14, 30,
+ 16, 17, 51, 93, 20, 21, 22, 9, 27, 9,
+ 29, 27, 28, 29, 104, 12, 13, 9, 23, 8,
+ 48, 48, 41, 42, 8, 41, 42, 6, 47, 8,
+ 46, 47, 122, 31, 6, 14, 8, 16, 17, 47,
+ 8, 131, 21, 22, 51, 8, 13, 17, 27, 28,
+ 29, 28, 13, 13, 28, 27, 18, 29, 17, 13,
+ 54, -1, 41, 42, 28, 80, -1, 46, 47, 41,
+ 42, 29, 34, 35, -1, 47, -1, 39, -1, 41,
+ 42, 43, 44, 9, -1, 38, -1, 49, 50, 15,
+ -1, -1, -1, 19, -1, -1, -1, 23, 24, 25,
+ 26, 34, 35, -1, -1, 31, 39, 40, 41, 42,
+ 43, 44, -1, 34, 35, 48, 49, 50, 39, -1,
+ 41, 42, 43, 44, -1, 34, 35, 48, 49, 50,
+ 39, 40, 41, 42, 43, 44, -1, 34, 35, -1,
+ 49, 50, 39, -1, 41, 42, 43, 44, -1, 34,
+ 35, -1, 49, 50, 39, -1, -1, -1, 43, 44,
+ -1, -1, 47, -1, 49, 50, 34, 35, 34, 35,
+ -1, 39, -1, 39, -1, 43, 44, -1, -1, -1,
+ -1, 49, 50, 49, 50
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 5, 7, 13, 15, 16, 19, 20, 21,
- 26, 27, 28, 40, 41, 46, 52, 53, 54, 55,
- 57, 58, 59, 63, 64, 65, 66, 69, 46, 60,
- 8, 14, 18, 22, 23, 24, 25, 30, 67, 68,
- 7, 8, 7, 7, 26, 54, 63, 31, 32, 7,
- 63, 63, 63, 0, 45, 46, 39, 46, 56, 63,
- 33, 34, 38, 40, 41, 42, 43, 48, 49, 63,
- 72, 72, 8, 8, 22, 8, 14, 22, 30, 68,
- 70, 63, 17, 7, 30, 39, 47, 52, 56, 63,
- 56, 63, 29, 39, 63, 63, 63, 63, 63, 63,
- 63, 63, 63, 47, 50, 8, 8, 8, 60, 7,
- 63, 63, 47, 61, 47, 62, 63, 63, 7, 71,
- 62, 10, 30, 7, 45, 55, 61, 64, 45, 50,
- 61, 30, 63, 11, 12, 50, 62, 7, 12, 63,
- 61, 62, 16, 7, 27, 61, 62, 61, 62, 61,
- 12, 61, 12, 16, 12, 27, 27
+ 0, 1, 6, 8, 14, 16, 17, 20, 21, 22,
+ 27, 28, 29, 41, 42, 47, 53, 54, 55, 56,
+ 58, 59, 60, 64, 65, 66, 67, 70, 47, 61,
+ 9, 15, 19, 23, 24, 25, 26, 31, 68, 69,
+ 8, 9, 8, 8, 27, 55, 64, 32, 33, 8,
+ 64, 64, 64, 0, 46, 47, 40, 47, 57, 64,
+ 34, 35, 39, 41, 42, 43, 44, 49, 50, 64,
+ 73, 73, 9, 9, 23, 9, 15, 23, 31, 69,
+ 71, 64, 18, 8, 31, 40, 48, 53, 57, 64,
+ 57, 64, 30, 40, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 48, 51, 9, 9, 9, 61, 8,
+ 64, 64, 48, 62, 48, 63, 64, 64, 8, 72,
+ 63, 11, 31, 8, 46, 56, 62, 65, 46, 51,
+ 62, 31, 64, 12, 13, 51, 63, 8, 13, 64,
+ 62, 63, 17, 8, 28, 62, 63, 62, 63, 62,
+ 13, 62, 13, 17, 13, 28, 28
};
#define yyerrok (yyerrstatus = 0)
@@ -1959,7 +1961,7 @@ yyreduce:
/* Line 1267 of yacc.c. */
-#line 1963 "engines/director/lingo/lingo-gr.cpp"
+#line 1965 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 2bf7d7a..bdef89f 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -41,79 +41,81 @@
enum yytokentype {
UNARY = 258,
VOID = 259,
- INT = 260,
- FLOAT = 261,
- ID = 262,
- STRING = 263,
- HANDLER = 264,
- tDOWN = 265,
- tELSE = 266,
- tEND = 267,
- tEXIT = 268,
- tFRAME = 269,
- tGO = 270,
- tIF = 271,
- tINTO = 272,
- tLOOP = 273,
- tMACRO = 274,
- tMCI = 275,
- tMCIWAIT = 276,
- tMOVIE = 277,
- tNEXT = 278,
- tOF = 279,
- tPREVIOUS = 280,
- tPUT = 281,
- tREPEAT = 282,
- tSET = 283,
- tTHEN = 284,
- tTO = 285,
- tWITH = 286,
- tWHILE = 287,
- tGE = 288,
- tLE = 289,
- tGT = 290,
- tLT = 291,
- tEQ = 292,
- tNEQ = 293
+ VAR = 260,
+ INT = 261,
+ FLOAT = 262,
+ ID = 263,
+ STRING = 264,
+ HANDLER = 265,
+ tDOWN = 266,
+ tELSE = 267,
+ tEND = 268,
+ tEXIT = 269,
+ tFRAME = 270,
+ tGO = 271,
+ tIF = 272,
+ tINTO = 273,
+ tLOOP = 274,
+ tMACRO = 275,
+ tMCI = 276,
+ tMCIWAIT = 277,
+ tMOVIE = 278,
+ tNEXT = 279,
+ tOF = 280,
+ tPREVIOUS = 281,
+ tPUT = 282,
+ tREPEAT = 283,
+ tSET = 284,
+ tTHEN = 285,
+ tTO = 286,
+ tWITH = 287,
+ tWHILE = 288,
+ tGE = 289,
+ tLE = 290,
+ tGT = 291,
+ tLT = 292,
+ tEQ = 293,
+ tNEQ = 294
};
#endif
/* Tokens. */
#define UNARY 258
#define VOID 259
-#define INT 260
-#define FLOAT 261
-#define ID 262
-#define STRING 263
-#define HANDLER 264
-#define tDOWN 265
-#define tELSE 266
-#define tEND 267
-#define tEXIT 268
-#define tFRAME 269
-#define tGO 270
-#define tIF 271
-#define tINTO 272
-#define tLOOP 273
-#define tMACRO 274
-#define tMCI 275
-#define tMCIWAIT 276
-#define tMOVIE 277
-#define tNEXT 278
-#define tOF 279
-#define tPREVIOUS 280
-#define tPUT 281
-#define tREPEAT 282
-#define tSET 283
-#define tTHEN 284
-#define tTO 285
-#define tWITH 286
-#define tWHILE 287
-#define tGE 288
-#define tLE 289
-#define tGT 290
-#define tLT 291
-#define tEQ 292
-#define tNEQ 293
+#define VAR 260
+#define INT 261
+#define FLOAT 262
+#define ID 263
+#define STRING 264
+#define HANDLER 265
+#define tDOWN 266
+#define tELSE 267
+#define tEND 268
+#define tEXIT 269
+#define tFRAME 270
+#define tGO 271
+#define tIF 272
+#define tINTO 273
+#define tLOOP 274
+#define tMACRO 275
+#define tMCI 276
+#define tMCIWAIT 277
+#define tMOVIE 278
+#define tNEXT 279
+#define tOF 280
+#define tPREVIOUS 281
+#define tPUT 282
+#define tREPEAT 283
+#define tSET 284
+#define tTHEN 285
+#define tTO 286
+#define tWITH 287
+#define tWHILE 288
+#define tGE 289
+#define tLE 290
+#define tGT 291
+#define tLT 292
+#define tEQ 293
+#define tNEQ 294
@@ -129,7 +131,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 133 "engines/director/lingo/lingo-gr.hpp"
+#line 135 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 09523e3..e77293d 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -70,7 +70,7 @@ using namespace Director;
int narg; /* number of arguments */
}
-%token UNARY VOID
+%token UNARY VOID VAR
%token<i> INT
%token<f> FLOAT
%token<s> ID STRING HANDLER
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 67c56fa..cfa25d7 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -30,6 +30,7 @@
#include "common/str.h"
#include "engines/director/director.h"
#include "engines/director/score.h"
+#include "director/lingo/lingo-gr.h"
namespace Director {
@@ -77,7 +78,7 @@ typedef Common::Array<inst> ScriptData;
typedef struct Symbol { /* symbol table entry */
char *name;
- long type;
+ int type;
union {
int val; /* VAR */
float fval; /* FLOAT */
@@ -89,11 +90,16 @@ typedef struct Symbol { /* symbol table entry */
Symbol();
} Symbol;
-typedef union Datum { /* interpreter stack type */
- int val;
- Symbol *sym;
+typedef struct Datum { /* interpreter stack type */
+ int type;
- Datum() { val = 0; sym = NULL; }
+ union {
+ int i;
+ float f;
+ Symbol *sym;
+ } u;
+
+ Datum() { u.sym = NULL; type = VOID; }
} Datum;
typedef struct CFrame { /* proc/func call stack frame */
Commit: 9d46e4587bf16e7653ae7144ebc51d32b8905c66
https://github.com/scummvm/scummvm/commit/9d46e4587bf16e7653ae7144ebc51d32b8905c66
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Ignore trailing spaces in scripts
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 45f6a5a..edb36e7 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -77,16 +77,16 @@ Common::Error DirectorEngine::run() {
#if 0
_lingo->addCode("--\n\
-macro check par1, par2\n\
+macro check par1, par2 \n\
, par3\n\
if par1 = 3 then\n\
put -3\n\
else\n\
put 0\n\
-end if\n\
-if par2 = 2 then\n\
- put 2\n\
-else\n\
+end if \n\
+if par2 = 2 then \n\
+ put 2 \n\
+else \n\
put 0\n\
end if\n\
put par1\n\
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index c7c7a7a..535daac 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -373,21 +373,21 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[114] =
+static yyconst flex_int16_t yy_accept[116] =
{ 0,
- 0, 0, 38, 36, 3, 34, 34, 36, 36, 33,
- 33, 32, 33, 33, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 2,
- 2, 3, 34, 27, 0, 35, 1, 31, 32, 29,
- 28, 30, 30, 30, 30, 30, 30, 10, 5, 30,
- 30, 30, 30, 30, 30, 18, 30, 30, 30, 30,
- 30, 24, 30, 30, 1, 31, 30, 30, 7, 30,
- 30, 30, 30, 30, 14, 30, 30, 30, 20, 30,
- 22, 30, 30, 30, 4, 6, 8, 30, 11, 12,
- 30, 30, 30, 17, 30, 30, 23, 30, 25, 9,
-
- 13, 30, 16, 30, 30, 26, 30, 30, 21, 15,
- 30, 19, 0
+ 0, 0, 38, 36, 3, 34, 34, 36, 36, 36,
+ 33, 33, 32, 33, 33, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+ 2, 2, 3, 34, 0, 27, 0, 35, 1, 31,
+ 32, 29, 28, 30, 30, 30, 30, 30, 30, 10,
+ 5, 30, 30, 30, 30, 30, 30, 18, 30, 30,
+ 30, 30, 30, 24, 30, 30, 1, 31, 30, 30,
+ 7, 30, 30, 30, 30, 30, 14, 30, 30, 30,
+ 20, 30, 22, 30, 30, 30, 4, 6, 8, 30,
+ 11, 12, 30, 30, 30, 17, 30, 30, 23, 30,
+
+ 25, 9, 13, 30, 16, 30, 30, 26, 30, 30,
+ 21, 15, 30, 19, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -432,108 +432,114 @@ static yyconst flex_int32_t yy_meta[56] =
4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[117] =
+static yyconst flex_int16_t yy_base[119] =
{ 0,
- 0, 54, 210, 227, 207, 54, 57, 195, 198, 227,
- 194, 52, 188, 187, 0, 37, 41, 37, 41, 49,
- 43, 56, 55, 57, 49, 60, 61, 80, 82, 197,
- 227, 184, 105, 227, 109, 227, 0, 80, 100, 227,
- 227, 0, 72, 82, 95, 91, 100, 0, 0, 86,
- 91, 102, 97, 88, 88, 0, 109, 98, 102, 100,
- 116, 0, 119, 113, 0, 71, 119, 127, 0, 116,
- 127, 126, 126, 127, 123, 135, 128, 127, 0, 142,
- 0, 137, 144, 147, 0, 0, 0, 151, 0, 0,
- 144, 160, 163, 0, 161, 170, 0, 168, 0, 0,
-
- 0, 169, 0, 166, 163, 0, 164, 165, 0, 0,
- 168, 0, 227, 218, 68, 222
+ 0, 54, 232, 255, 58, 54, 61, 64, 217, 222,
+ 255, 219, 60, 214, 185, 0, 45, 49, 45, 49,
+ 57, 51, 64, 63, 65, 57, 68, 69, 88, 90,
+ 114, 118, 122, 125, 134, 255, 138, 255, 0, 88,
+ 130, 255, 255, 0, 80, 101, 124, 120, 129, 0,
+ 0, 115, 120, 131, 126, 117, 117, 0, 134, 123,
+ 127, 125, 138, 0, 135, 128, 0, 79, 134, 142,
+ 0, 133, 146, 155, 155, 156, 152, 164, 157, 156,
+ 0, 171, 0, 166, 169, 172, 0, 0, 0, 176,
+ 0, 0, 169, 182, 180, 0, 177, 186, 0, 185,
+
+ 0, 0, 0, 188, 0, 190, 190, 0, 192, 193,
+ 0, 0, 196, 0, 255, 246, 76, 250
} ;
-static yyconst flex_int16_t yy_def[117] =
+static yyconst flex_int16_t yy_def[119] =
{ 0,
- 113, 1, 113, 113, 113, 113, 113, 113, 114, 113,
- 113, 113, 113, 113, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 113,
- 113, 113, 113, 113, 114, 113, 116, 113, 113, 113,
- 113, 115, 115, 115, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 116, 113, 115, 115, 115, 115,
+ 115, 1, 115, 115, 115, 115, 115, 115, 115, 116,
+ 115, 115, 115, 115, 115, 117, 117, 117, 117, 117,
+ 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
+ 115, 115, 115, 115, 115, 115, 116, 115, 118, 115,
+ 115, 115, 115, 117, 117, 117, 117, 117, 117, 117,
+ 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
+ 117, 117, 117, 117, 117, 117, 118, 115, 117, 117,
+ 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
+ 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
+ 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
+
+ 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
+ 117, 117, 117, 117, 0, 115, 115, 115
+ } ;
+
+static yyconst flex_int16_t yy_nxt[311] =
+ { 0,
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
+ 13, 14, 11, 15, 16, 16, 16, 17, 18, 19,
+ 20, 16, 21, 22, 23, 24, 25, 26, 27, 28,
+ 29, 16, 16, 30, 16, 16, 16, 17, 18, 19,
+ 20, 16, 21, 22, 23, 24, 25, 26, 27, 28,
+ 29, 16, 16, 30, 16, 31, 34, 34, 32, 33,
+ 34, 34, 35, 34, 34, 35, 34, 34, 35, 40,
+ 41, 45, 46, 49, 47, 50, 51, 53, 54, 44,
+ 55, 57, 52, 48, 58, 59, 61, 62, 60, 68,
+ 56, 45, 46, 49, 47, 50, 51, 53, 68, 54,
+
+ 55, 57, 52, 48, 58, 59, 61, 62, 60, 63,
+ 56, 65, 66, 69, 64, 33, 34, 34, 35, 35,
+ 34, 34, 35, 33, 34, 34, 35, 34, 34, 63,
+ 70, 65, 66, 69, 64, 35, 34, 34, 35, 40,
+ 41, 71, 72, 73, 38, 74, 75, 76, 77, 78,
+ 70, 79, 80, 81, 82, 83, 84, 85, 86, 87,
+ 88, 71, 72, 89, 73, 74, 75, 76, 77, 78,
+ 90, 79, 80, 81, 82, 83, 84, 85, 86, 87,
+ 88, 91, 92, 89, 93, 94, 95, 96, 97, 98,
+ 90, 99, 100, 101, 102, 103, 104, 43, 105, 106,
+
+ 107, 91, 92, 108, 93, 94, 95, 96, 97, 98,
+ 109, 99, 100, 101, 102, 103, 110, 104, 105, 106,
+ 111, 107, 112, 108, 113, 114, 42, 39, 38, 36,
+ 109, 115, 115, 115, 115, 115, 110, 115, 115, 115,
+ 111, 115, 112, 115, 113, 114, 37, 115, 37, 37,
+ 67, 115, 115, 67, 3, 115, 115, 115, 115, 115,
115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
-
115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
- 115, 115, 0, 113, 113, 113
- } ;
-static yyconst flex_int16_t yy_nxt[283] =
- { 0,
- 4, 5, 6, 7, 4, 8, 9, 10, 11, 4,
- 12, 13, 10, 14, 15, 15, 15, 16, 17, 18,
- 19, 15, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 15, 15, 29, 15, 15, 15, 16, 17, 18,
- 19, 15, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 15, 15, 29, 15, 30, 33, 33, 31, 33,
- 33, 38, 39, 43, 44, 47, 45, 48, 49, 51,
- 52, 42, 53, 55, 50, 46, 56, 57, 59, 60,
- 58, 66, 54, 43, 44, 47, 45, 48, 49, 51,
- 66, 52, 53, 55, 50, 46, 56, 57, 59, 60,
-
- 58, 61, 54, 63, 64, 67, 62, 33, 33, 38,
- 39, 68, 69, 70, 71, 36, 72, 73, 74, 75,
- 76, 61, 77, 63, 64, 67, 62, 78, 79, 80,
- 81, 68, 69, 70, 82, 71, 72, 73, 74, 75,
- 76, 83, 77, 84, 85, 86, 87, 78, 79, 80,
- 81, 88, 89, 90, 82, 91, 92, 93, 94, 95,
- 96, 83, 97, 84, 85, 86, 87, 98, 99, 100,
- 101, 88, 89, 90, 102, 91, 92, 93, 94, 95,
- 96, 103, 97, 104, 105, 32, 106, 98, 99, 100,
- 101, 107, 108, 109, 110, 102, 111, 112, 32, 41,
-
- 40, 103, 37, 104, 36, 105, 106, 34, 32, 113,
- 113, 107, 108, 109, 110, 113, 111, 112, 35, 113,
- 35, 35, 65, 113, 113, 65, 3, 113, 113, 113,
- 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
- 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
- 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
- 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
- 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
- 113, 113
+ 115, 115, 115, 115, 115, 115, 115, 115, 115, 115
} ;
-static yyconst flex_int16_t yy_chk[283] =
+static yyconst flex_int16_t yy_chk[311] =
{ 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, 2, 6, 6, 2, 7,
- 7, 12, 12, 16, 17, 18, 17, 19, 20, 21,
- 22, 115, 22, 23, 20, 17, 24, 25, 26, 27,
- 25, 66, 22, 16, 17, 18, 17, 19, 20, 21,
- 38, 22, 22, 23, 20, 17, 24, 25, 26, 27,
-
- 25, 28, 22, 29, 29, 43, 28, 33, 33, 39,
- 39, 44, 45, 46, 47, 35, 50, 51, 52, 53,
- 54, 28, 55, 29, 29, 43, 28, 57, 58, 59,
- 60, 44, 45, 46, 61, 47, 50, 51, 52, 53,
- 54, 63, 55, 64, 67, 68, 70, 57, 58, 59,
- 60, 71, 72, 73, 61, 74, 75, 76, 77, 78,
- 80, 63, 82, 64, 67, 68, 70, 83, 84, 88,
- 91, 71, 72, 73, 92, 74, 75, 76, 77, 78,
- 80, 93, 82, 95, 96, 32, 98, 83, 84, 88,
- 91, 102, 104, 105, 107, 92, 108, 111, 30, 14,
-
- 13, 93, 11, 95, 9, 96, 98, 8, 5, 3,
- 0, 102, 104, 105, 107, 0, 108, 111, 114, 0,
- 114, 114, 116, 0, 0, 116, 113, 113, 113, 113,
- 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
- 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
- 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
- 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
- 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
- 113, 113
+ 1, 1, 1, 1, 1, 2, 6, 6, 2, 5,
+ 5, 5, 5, 7, 7, 8, 8, 8, 8, 13,
+ 13, 17, 18, 19, 18, 20, 21, 22, 23, 117,
+ 23, 24, 21, 18, 25, 26, 27, 28, 26, 68,
+ 23, 17, 18, 19, 18, 20, 21, 22, 40, 23,
+
+ 23, 24, 21, 18, 25, 26, 27, 28, 26, 29,
+ 23, 30, 30, 45, 29, 31, 31, 31, 31, 32,
+ 32, 32, 32, 33, 33, 33, 33, 34, 34, 29,
+ 46, 30, 30, 45, 29, 35, 35, 35, 35, 41,
+ 41, 47, 48, 49, 37, 52, 53, 54, 55, 56,
+ 46, 57, 59, 60, 61, 62, 63, 65, 66, 69,
+ 70, 47, 48, 72, 49, 52, 53, 54, 55, 56,
+ 73, 57, 59, 60, 61, 62, 63, 65, 66, 69,
+ 70, 74, 75, 72, 76, 77, 78, 79, 80, 82,
+ 73, 84, 85, 86, 90, 93, 94, 15, 95, 97,
+
+ 98, 74, 75, 100, 76, 77, 78, 79, 80, 82,
+ 104, 84, 85, 86, 90, 93, 106, 94, 95, 97,
+ 107, 98, 109, 100, 110, 113, 14, 12, 10, 9,
+ 104, 3, 0, 0, 0, 0, 106, 0, 0, 0,
+ 107, 0, 109, 0, 110, 113, 116, 0, 116, 116,
+ 118, 0, 0, 118, 115, 115, 115, 115, 115, 115,
+ 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
+ 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
+ 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
+ 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
+
+ 115, 115, 115, 115, 115, 115, 115, 115, 115, 115
} ;
static yy_state_type yy_last_accepting_state;
@@ -583,7 +589,7 @@ char *yytext;
int yyparse();
-#line 587 "engines/director/lingo/lingo-lex.cpp"
+#line 593 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -771,7 +777,7 @@ YY_DECL
#line 45 "engines/director/lingo/lingo-lex.l"
-#line 775 "engines/director/lingo/lingo-lex.cpp"
+#line 781 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -825,13 +831,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 >= 114 )
+ if ( yy_current_state >= 116 )
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] != 227 );
+ while ( yy_base[yy_current_state] != 255 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -1041,7 +1047,7 @@ YY_RULE_SETUP
#line 87 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1045 "engines/director/lingo/lingo-lex.cpp"
+#line 1051 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1334,7 +1340,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 >= 114 )
+ if ( yy_current_state >= 116 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1362,11 +1368,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 >= 114 )
+ if ( yy_current_state >= 116 )
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 == 113);
+ yy_is_jam = (yy_current_state == 115);
return yy_is_jam ? 0 : yy_current_state;
}
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 3634df8..3d92963 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -39,7 +39,7 @@ constfloat [[:digit:]]+\.[[:digit:]]*
constinteger [[:digit:]]+
conststring \"[^\"\n]*\"
operator [-+*/%=^:,()><]
-newline [\n\r]+
+newline [ \t]*[\n\r]+
whitespace [\t ]
%%
Commit: 16cca8054a9ebdb2f3e210b347e0f3d8d42e38d1
https://github.com/scummvm/scummvm/commit/16cca8054a9ebdb2f3e210b347e0f3d8d42e38d1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Move macro grammar to more logical spot in the file
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index ac54174..f0f697f 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -485,16 +485,16 @@ static const yytype_uint16 yyprhs[] =
70, 82, 95, 97, 101, 105, 108, 112, 114, 115,
116, 117, 120, 123, 125, 127, 129, 133, 137, 141,
145, 149, 153, 157, 161, 165, 168, 171, 175, 180,
- 183, 186, 189, 191, 193, 197, 199, 202, 205, 208,
- 211, 215, 218, 222, 225, 228, 230, 234, 237, 241,
- 242, 250, 251, 253, 257, 262, 263, 265
+ 183, 186, 189, 191, 193, 196, 199, 202, 205, 209,
+ 212, 216, 219, 222, 224, 228, 231, 235, 236, 244,
+ 245, 247, 251, 256, 260, 262, 263, 265
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
53, 0, -1, 54, 46, 53, -1, 54, -1, -1,
- 70, -1, 65, -1, 66, -1, 55, -1, 56, -1,
+ 69, -1, 65, -1, 72, -1, 55, -1, 56, -1,
1, -1, -1, 27, 64, 18, 8, -1, 29, 8,
40, 64, -1, 29, 8, 31, 64, -1, 64, -1,
65, -1, 60, 57, 30, 63, 62, 13, 17, -1,
@@ -511,14 +511,14 @@ static const yytype_int8 yyrhs[] =
50, 64, -1, 64, 39, 64, -1, 64, 34, 64,
-1, 64, 35, 64, -1, 41, 64, -1, 42, 64,
-1, 47, 64, 48, -1, 8, 47, 73, 48, -1,
- 21, 9, -1, 22, 8, -1, 27, 64, -1, 67,
- -1, 14, -1, 8, 61, 73, -1, 8, -1, 16,
- 19, -1, 16, 24, -1, 16, 26, -1, 16, 68,
- -1, 16, 68, 69, -1, 16, 69, -1, 31, 15,
- 9, -1, 15, 9, -1, 31, 9, -1, 9, -1,
- 25, 23, 9, -1, 23, 9, -1, 31, 23, 9,
- -1, -1, 20, 8, 71, 61, 72, 46, 63, -1,
- -1, 8, -1, 72, 51, 8, -1, 72, 46, 51,
+ 21, 9, -1, 22, 8, -1, 27, 64, -1, 66,
+ -1, 14, -1, 16, 19, -1, 16, 24, -1, 16,
+ 26, -1, 16, 67, -1, 16, 67, 68, -1, 16,
+ 68, -1, 31, 15, 9, -1, 15, 9, -1, 31,
+ 9, -1, 9, -1, 25, 23, 9, -1, 23, 9,
+ -1, 31, 23, 9, -1, -1, 20, 8, 70, 61,
+ 71, 46, 63, -1, -1, 8, -1, 71, 51, 8,
+ -1, 71, 46, 51, 8, -1, 8, 61, 73, -1,
8, -1, -1, 64, -1, 73, 51, 64, -1
};
@@ -530,9 +530,9 @@ static const yytype_uint16 yyrline[] =
157, 173, 187, 188, 189, 191, 193, 199, 201, 203,
205, 206, 207, 210, 215, 218, 219, 220, 221, 222,
223, 224, 225, 226, 227, 228, 229, 230, 233, 239,
- 240, 241, 242, 243, 246, 252, 266, 267, 268, 269,
- 274, 280, 287, 288, 289, 290, 293, 294, 295, 323,
- 323, 329, 330, 331, 332, 335, 336, 337
+ 240, 241, 242, 243, 254, 255, 256, 257, 262, 268,
+ 275, 276, 277, 278, 281, 282, 283, 311, 311, 317,
+ 318, 319, 320, 323, 329, 335, 336, 337
};
#endif
@@ -549,8 +549,8 @@ static const char *const yytname[] =
"'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'",
"','", "$accept", "program", "programline", "asgn", "stmt", "cond",
"repeatwhile", "repeatwith", "if", "begin", "end", "stmtlist", "expr",
- "func", "macro", "gotofunc", "gotoframe", "gotomovie", "defn", "@1",
- "argdef", "arglist", 0
+ "func", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "argdef",
+ "macro", "arglist", 0
};
#endif
@@ -576,9 +576,9 @@ static const yytype_uint8 yyr1[] =
56, 56, 57, 57, 57, 58, 59, 60, 61, 62,
63, 63, 63, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
- 65, 65, 65, 65, 66, 66, 67, 67, 67, 67,
- 67, 67, 68, 68, 68, 68, 69, 69, 69, 71,
- 70, 72, 72, 72, 72, 73, 73, 73
+ 65, 65, 65, 65, 66, 66, 66, 66, 66, 66,
+ 67, 67, 67, 67, 68, 68, 68, 70, 69, 71,
+ 71, 71, 71, 72, 72, 73, 73, 73
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -589,9 +589,9 @@ static const yytype_uint8 yyr2[] =
11, 12, 1, 3, 3, 2, 3, 1, 0, 0,
0, 2, 2, 1, 1, 1, 3, 3, 3, 3,
3, 3, 3, 3, 3, 2, 2, 3, 4, 2,
- 2, 2, 1, 1, 3, 1, 2, 2, 2, 2,
- 3, 2, 3, 2, 2, 1, 3, 2, 3, 0,
- 7, 0, 1, 3, 4, 0, 1, 3
+ 2, 2, 1, 1, 2, 2, 2, 2, 3, 2,
+ 3, 2, 2, 1, 3, 2, 3, 0, 7, 0,
+ 1, 3, 4, 3, 1, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -601,19 +601,19 @@ static const yytype_uint8 yydefact[] =
{
0, 10, 33, 28, 53, 0, 27, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 3, 35, 9,
- 0, 0, 0, 15, 6, 7, 52, 5, 75, 75,
- 65, 0, 56, 0, 57, 0, 58, 0, 59, 61,
- 69, 49, 50, 34, 0, 35, 51, 0, 25, 0,
+ 0, 0, 0, 15, 6, 52, 5, 7, 75, 75,
+ 63, 0, 54, 0, 55, 0, 56, 0, 57, 59,
+ 67, 49, 50, 34, 0, 35, 51, 0, 25, 0,
45, 46, 0, 1, 0, 0, 0, 0, 0, 22,
0, 0, 0, 0, 0, 0, 0, 0, 0, 76,
- 0, 54, 63, 67, 0, 64, 0, 0, 0, 60,
+ 0, 73, 61, 65, 0, 62, 0, 0, 0, 58,
28, 0, 0, 26, 0, 0, 47, 2, 0, 29,
0, 0, 30, 0, 43, 44, 42, 36, 37, 38,
- 39, 40, 41, 48, 0, 66, 62, 68, 71, 12,
- 14, 13, 30, 0, 24, 29, 23, 77, 72, 0,
+ 39, 40, 41, 48, 0, 64, 60, 66, 69, 12,
+ 14, 13, 30, 0, 24, 29, 23, 77, 70, 0,
29, 0, 0, 34, 31, 32, 0, 16, 30, 0,
- 0, 0, 29, 30, 0, 0, 70, 73, 0, 29,
- 30, 29, 17, 74, 19, 30, 29, 0, 29, 0,
+ 0, 0, 29, 30, 0, 0, 68, 71, 0, 29,
+ 30, 29, 17, 72, 19, 30, 29, 0, 29, 0,
0, 0, 0, 18, 0, 20, 21
};
@@ -621,8 +621,8 @@ static const yytype_uint8 yydefact[] =
static const yytype_int8 yydefgoto[] =
{
-1, 16, 17, 45, 125, 58, 20, 21, 22, 29,
- 113, 115, 23, 127, 25, 26, 38, 39, 27, 80,
- 119, 70
+ 113, 115, 23, 127, 25, 38, 39, 26, 80, 119,
+ 27, 70
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
@@ -652,7 +652,7 @@ static const yytype_int16 yypact[] =
static const yytype_int8 yypgoto[] =
{
-107, 86, -107, 6, 7, -14, -107, -107, -107, 65,
- -106, -101, -10, 8, -107, -107, -107, 127, -107, -107,
+ -106, -101, -10, 8, -107, -107, 127, -107, -107, -107,
-107, 122
};
@@ -729,16 +729,16 @@ static const yytype_uint8 yystos[] =
{
0, 1, 6, 8, 14, 16, 17, 20, 21, 22,
27, 28, 29, 41, 42, 47, 53, 54, 55, 56,
- 58, 59, 60, 64, 65, 66, 67, 70, 47, 61,
- 9, 15, 19, 23, 24, 25, 26, 31, 68, 69,
+ 58, 59, 60, 64, 65, 66, 69, 72, 47, 61,
+ 9, 15, 19, 23, 24, 25, 26, 31, 67, 68,
8, 9, 8, 8, 27, 55, 64, 32, 33, 8,
64, 64, 64, 0, 46, 47, 40, 47, 57, 64,
34, 35, 39, 41, 42, 43, 44, 49, 50, 64,
- 73, 73, 9, 9, 23, 9, 15, 23, 31, 69,
- 71, 64, 18, 8, 31, 40, 48, 53, 57, 64,
+ 73, 73, 9, 9, 23, 9, 15, 23, 31, 68,
+ 70, 64, 18, 8, 31, 40, 48, 53, 57, 64,
57, 64, 30, 40, 64, 64, 64, 64, 64, 64,
64, 64, 64, 48, 51, 9, 9, 9, 61, 8,
- 64, 64, 48, 62, 48, 63, 64, 64, 8, 72,
+ 64, 64, 48, 62, 48, 63, 64, 64, 8, 71,
63, 11, 31, 8, 46, 56, 62, 65, 46, 51,
62, 31, 64, 12, 13, 51, 63, 8, 13, 64,
62, 63, 17, 8, 28, 62, 63, 62, 63, 62,
@@ -1816,40 +1816,22 @@ yyreduce:
break;
case 54:
-#line 246 "engines/director/lingo/lingo-gr.y"
- {
- g_lingo->code1(g_lingo->c_call);
- g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
- inst numpar = 0;
- WRITE_UINT32(&numpar, (yyvsp[(3) - (3)].narg));
- g_lingo->code1(numpar); ;}
- break;
-
- case 55:
-#line 252 "engines/director/lingo/lingo-gr.y"
- {
- g_lingo->code1(g_lingo->c_call);
- g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str());
- g_lingo->code1(0); ;}
- break;
-
- case 56:
-#line 266 "engines/director/lingo/lingo-gr.y"
+#line 254 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 57:
-#line 267 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 255 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 58:
-#line 268 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 256 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 59:
-#line 269 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 257 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1857,8 +1839,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 60:
-#line 274 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 262 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1867,8 +1849,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 61:
-#line 280 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 268 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1876,74 +1858,92 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 62:
-#line 287 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 275 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 63:
-#line 288 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 276 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 64:
-#line 289 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 277 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 65:
-#line 290 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 278 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 66:
-#line 293 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 281 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 67:
-#line 294 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 282 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 68:
-#line 295 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 283 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 69:
-#line 323 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 311 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 70:
-#line 324 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 312 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*(yyvsp[(2) - (7)].s), (yyvsp[(4) - (7)].code), (yyvsp[(5) - (7)].narg));
g_lingo->_indef = false; ;}
break;
- case 71:
-#line 329 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 317 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 72:
-#line 330 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 318 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); (yyval.narg) = 1; ;}
break;
- case 73:
-#line 331 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 319 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(3) - (3)].s)); delete (yyvsp[(3) - (3)].s); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 74:
-#line 332 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 320 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg(*(yyvsp[(4) - (4)].s)); delete (yyvsp[(4) - (4)].s); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
+ case 73:
+#line 323 "engines/director/lingo/lingo-gr.y"
+ {
+ g_lingo->code1(g_lingo->c_call);
+ g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
+ inst numpar = 0;
+ WRITE_UINT32(&numpar, (yyvsp[(3) - (3)].narg));
+ g_lingo->code1(numpar); ;}
+ break;
+
+ case 74:
+#line 329 "engines/director/lingo/lingo-gr.y"
+ {
+ g_lingo->code1(g_lingo->c_call);
+ g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str());
+ g_lingo->code1(0); ;}
+ break;
+
case 75:
#line 335 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index e77293d..7667481 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -243,18 +243,6 @@ func: ID '(' arglist ')' {
| tEXIT { g_lingo->code1(g_lingo->c_exit); }
;
-macro: ID begin arglist {
- g_lingo->code1(g_lingo->c_call);
- g_lingo->codeString($1->c_str());
- inst numpar = 0;
- WRITE_UINT32(&numpar, $3);
- g_lingo->code1(numpar); };
- | ID {
- g_lingo->code1(g_lingo->c_call);
- g_lingo->codeString($1->c_str());
- g_lingo->code1(0); };
- ;
-
// go {to} {frame} whichFrame {of movie whichMovie}
// go {to} {frame "Open23" of} movie whichMovie
// go loop
@@ -332,6 +320,18 @@ argdef: /* nothing */ { $$ = 0; }
| argdef '\n' ',' ID { g_lingo->codeArg(*$4); delete $4; $$ = $1 + 1; }
;
+macro: ID begin arglist {
+ g_lingo->code1(g_lingo->c_call);
+ g_lingo->codeString($1->c_str());
+ inst numpar = 0;
+ WRITE_UINT32(&numpar, $3);
+ g_lingo->code1(numpar); };
+ | ID {
+ g_lingo->code1(g_lingo->c_call);
+ g_lingo->codeString($1->c_str());
+ g_lingo->code1(0); };
+ ;
+
arglist: /* nothing */ { $$ = 0; }
| expr { $$ = 1; }
| arglist ',' expr { $$ = $1 + 1; }
Commit: 9319eee100b6c813c2bbe50da79f741e06649018
https://github.com/scummvm/scummvm/commit/9319eee100b6c813c2bbe50da79f741e06649018
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Loading shared DIB, STXT
Changed paths:
engines/director/director.cpp
engines/director/director.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index edb36e7..3fbc0b6 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -372,7 +372,7 @@ void DirectorEngine::setPalette(byte *palette, uint16 count) {
_currentPaletteLength = count;
}
-Common::HashMap<int, Cast *> DirectorEngine::loadSharedCastsFrom(Common::String filename) {
+void DirectorEngine::loadSharedCastsFrom(Common::String filename) {
//TODO d4 arch
RIFFArchive *shardcst = new RIFFArchive();
@@ -383,6 +383,24 @@ Common::HashMap<int, Cast *> DirectorEngine::loadSharedCastsFrom(Common::String
Common::SeekableSubReadStreamEndian *castStream = shardcst->getResource(MKTAG('V','W','C','R'), 1024);
castScore->loadCastData(*castStream);
- return castScore->_casts;
+ _sharedCasts = castScore->_casts;
+ Common::Array<uint16> dib = shardcst->getResourceIDList(MKTAG('D','I','B',' '));
+
+ if (dib.size() != 0) {
+ Common::Array<uint16>::iterator iterator;
+ for (iterator = dib.begin(); iterator != dib.end(); ++iterator) {
+ _sharedDIB[*iterator] = shardcst->getResource(MKTAG('D','I','B',' '), *iterator);
+ }
+ }
+
+ Common::Array<uint16> stxt = shardcst->getResourceIDList(MKTAG('D','I','B',' '));
+
+ if (stxt.size() != 0) {
+ Common::Array<uint16>::iterator iterator;
+ for (iterator = stxt.begin(); iterator != stxt.end(); ++iterator) {
+ _sharedSTXT[*iterator] = shardcst->getResource(MKTAG('S','T','X','T'), *iterator);
+ }
+ }
}
+
} // End of namespace Director
diff --git a/engines/director/director.h b/engines/director/director.h
index c2559b1..566bb2e 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -66,7 +66,7 @@ public:
bool hasFeature(EngineFeature f) const;
const byte *getPalette() const { return _currentPalette; }
uint16 getPaletteColorCount() const { return _currentPaletteLength; }
- Common::HashMap<int, Cast *> loadSharedCastsFrom(Common::String filename);
+ void loadSharedCastsFrom(Common::String filename);
Common::HashMap<Common::String, Score *> *_movies;
Score *_currentScore;
@@ -88,7 +88,9 @@ private:
void loadMac();
Common::String readPascalString(Common::SeekableReadStream &stream);
-
+ Common::HashMap<int, Cast *> _sharedCasts;
+ Common::HashMap<int, Common::SeekableReadStream *> _sharedDIB;
+ Common::HashMap<int, Common::SeekableReadStream *> _sharedSTXT;
Archive *_mainArchive;
Common::MacResManager *_macBinary;
DirectorSound *_soundManager;
Commit: aac6c9695a5007b5027df8686b257d9a923a2099
https://github.com/scummvm/scummvm/commit/aac6c9695a5007b5027df8686b257d9a923a2099
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Execute goto scripts
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 4407bb8..7555af8 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -371,15 +371,15 @@ void Lingo::c_goto() {
}
void Lingo::c_gotoloop() {
- warning("STUB: c_gotoloop()");
+ g_lingo->func_gotoLoop();
}
void Lingo::c_gotonext() {
- warning("STUB: c_gotonext()");
+ g_lingo->func_gotoNext();
}
void Lingo::c_gotoprevious() {
- warning("STUB: c_gotoprevious()");
+ g_lingo->func_gotoPrev();
}
void Lingo::c_call() {
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index eca6641..eae253d 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -208,4 +208,16 @@ void Lingo::func_goto(Common::String &frame, Common::String &movie) {
_vm->_currentScore->setCurrentFrame(strtol(frame.c_str(), 0, 10));
}
+void Lingo::func_gotoLoop() {
+ _vm->_currentScore->goToLoop();
+}
+
+void Lingo::func_gotoNext() {
+ _vm->_currentScore->goToNext();
+}
+
+void Lingo::func_gotoPrev() {
+ _vm->_currentScore->goToPrevious();
+}
+
}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index cfa25d7..bb613ab 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -175,6 +175,9 @@ public:
void func_mci(Common::String &s);
void func_mciwait(Common::String &s);
void func_goto(Common::String &frame, Common::String &movie);
+ void func_gotoLoop();
+ void func_gotoNext();
+ void func_gotoPrev();
public:
ScriptData *_currentScript;
Commit: 0b9e3607a01f4c3b2820b2017240adf073669820
https://github.com/scummvm/scummvm/commit/0b9e3607a01f4c3b2820b2017240adf073669820
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Using shared casts for rendering
Changed paths:
engines/director/director.h
engines/director/score.cpp
diff --git a/engines/director/director.h b/engines/director/director.h
index 566bb2e..0e76cd9 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -67,6 +67,9 @@ public:
const byte *getPalette() const { return _currentPalette; }
uint16 getPaletteColorCount() const { return _currentPaletteLength; }
void loadSharedCastsFrom(Common::String filename);
+ Common::HashMap<int, Common::SeekableReadStream *> getSharedDIB() const { return _sharedDIB; }
+ Common::HashMap<int, Common::SeekableReadStream *> getSharedSTXT() const { return _sharedSTXT; }
+ Common::HashMap<int, Cast *> getSharedCasts() const { return _sharedCasts; }
Common::HashMap<Common::String, Score *> *_movies;
Score *_currentScore;
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 285577d..0a4aed4 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1118,7 +1118,18 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
if ((_sprites[i]->_trails == 0 && renderTrail) || (_sprites[i]->_trails == 1 && !renderTrail))
continue;
- Cast *cast = _vm->_currentScore->_casts[_sprites[i]->_castId];
+ Cast *cast;
+ if (!_vm->_currentScore->_casts.contains(_sprites[i]->_castId)) {
+ if (!_vm->getSharedCasts().contains(_sprites[i]->_castId)) {
+ warning("Cast id %d not found", _sprites[i]->_castId);
+ continue;
+ } else {
+ cast = _vm->getSharedCasts().getVal(_sprites[i]->_castId);
+ }
+ } else {
+ cast = _vm->_currentScore->_casts[_sprites[i]->_castId];
+ }
+
if (cast->type == kCastText) {
renderText(surface, i);
continue;
@@ -1128,11 +1139,16 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
uint32 imgId = 1024 + _sprites[i]->_castId;
if (!_vm->_currentScore->getArchive()->hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
- continue;
+ if (!_vm->getSharedDIB().contains(imgId)) {
+ warning("DIB id %d not found", imgId);
+ continue;
+ } else {
+ img.loadStream(*_vm->getSharedDIB().getVal(imgId));
+ }
+ } else {
+ img.loadStream(*_vm->_currentScore->getArchive()->getResource(MKTAG('D', 'I', 'B', ' '), imgId));
}
- img.loadStream(*_vm->_currentScore->getArchive()->getResource(MKTAG('D', 'I', 'B', ' '), imgId));
-
uint32 regX = static_cast<BitmapCast *>(_sprites[i]->_cast)->regX;
uint32 regY = static_cast<BitmapCast *>(_sprites[i]->_cast)->regY;
uint32 rectLeft = static_cast<BitmapCast *>(_sprites[i]->_cast)->initialRect.left;
Commit: 30ced4a4e226648cb53a9fcbd3eb3a9f4c461537
https://github.com/scummvm/scummvm/commit/30ced4a4e226648cb53a9fcbd3eb3a9f4c461537
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix warning
Changed paths:
engines/director/lingo/lingo.cpp
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 0ecd689..37bf53a 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -125,7 +125,7 @@ void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
// macros have conflicting grammar. Thus we ease life for the parser.
if (code.contains("\nmacro ")) {
const char *begin = strstr(code.c_str(), "\nmacro ") + 1;
- char *end;
+ const char *end;
bool first = true;
while ((end = strstr(begin, "\nmacro "))) {
Commit: 839ac90f615e1cda46db0ec7ed864e67c8b9631b
https://github.com/scummvm/scummvm/commit/839ac90f615e1cda46db0ec7ed864e67c8b9631b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fixed argument order in macros, simplified grammar.
Changed paths:
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index ca8374a..e2757bb 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -106,15 +106,36 @@ void Lingo::define(Common::String &name, int start, int nargs) {
sym->nargs = nargs;
}
-void Lingo::codeArg(Common::String &s) {
- g_lingo->code1(g_lingo->c_varpush);
- g_lingo->codeString(s.c_str());
- g_lingo->code1(g_lingo->c_assign);
- g_lingo->code1(g_lingo->c_xpop);
+void Lingo::codeArg(Common::String *s) {
+ _argstack.push_back(s);
+}
+
+void Lingo::codeArgStore() {
+ while (true) {
+ if (_argstack.empty()) {
+ warning("Arg stack underflow");
+ break;
+ }
+
+ Common::String *arg = _argstack.back();
+ _argstack.pop_back();
+
+ if (arg->equals("<args>")) {
+ delete arg;
+ break;
+ }
+
+ code1(c_varpush);
+ codeString(arg->c_str());
+ code1(c_assign);
+ code1(c_xpop);
+
+ delete arg;
+ }
}
int Lingo::codeId(Common::String &s) {
- return g_lingo->codeId_(s);
+ return codeId_(s);
}
int Lingo::codeId_(Common::String &name) {
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index f0f697f..e792531 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -422,16 +422,16 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 53
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 264
+#define YYLAST 257
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 52
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 22
+#define YYNNTS 24
/* YYNRULES -- Number of rules. */
#define YYNRULES 77
/* YYNRULES -- Number of states. */
-#define YYNSTATES 157
+#define YYNSTATES 158
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -481,58 +481,58 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
- 20, 22, 23, 28, 33, 38, 40, 42, 50, 61,
- 70, 82, 95, 97, 101, 105, 108, 112, 114, 115,
- 116, 117, 120, 123, 125, 127, 129, 133, 137, 141,
- 145, 149, 153, 157, 161, 165, 168, 171, 175, 180,
- 183, 186, 189, 191, 193, 196, 199, 202, 205, 209,
- 212, 216, 219, 222, 224, 228, 231, 235, 236, 244,
- 245, 247, 251, 256, 260, 262, 263, 265
+ 20, 22, 27, 32, 37, 39, 41, 49, 60, 69,
+ 81, 94, 96, 100, 104, 107, 111, 113, 114, 115,
+ 116, 119, 122, 124, 126, 128, 132, 136, 140, 144,
+ 148, 152, 156, 160, 164, 167, 170, 174, 179, 182,
+ 185, 188, 190, 192, 195, 198, 201, 204, 208, 211,
+ 215, 218, 221, 223, 227, 230, 234, 235, 244, 245,
+ 247, 251, 256, 257, 258, 262, 263, 265
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
53, 0, -1, 54, 46, 53, -1, 54, -1, -1,
- 69, -1, 65, -1, 72, -1, 55, -1, 56, -1,
- 1, -1, -1, 27, 64, 18, 8, -1, 29, 8,
- 40, 64, -1, 29, 8, 31, 64, -1, 64, -1,
- 65, -1, 60, 57, 30, 63, 62, 13, 17, -1,
- 60, 57, 30, 63, 62, 12, 63, 62, 13, 17,
- -1, 58, 47, 57, 48, 63, 62, 13, 28, -1,
- 59, 40, 64, 62, 31, 64, 62, 63, 62, 13,
- 28, -1, 59, 40, 64, 62, 11, 31, 64, 62,
- 63, 62, 13, 28, -1, 64, -1, 64, 40, 64,
- -1, 47, 57, 48, -1, 28, 33, -1, 28, 32,
- 8, -1, 17, -1, -1, -1, -1, 63, 46, -1,
- 63, 56, -1, 6, -1, 8, -1, 55, -1, 64,
- 41, 64, -1, 64, 42, 64, -1, 64, 43, 64,
- -1, 64, 44, 64, -1, 64, 49, 64, -1, 64,
- 50, 64, -1, 64, 39, 64, -1, 64, 34, 64,
- -1, 64, 35, 64, -1, 41, 64, -1, 42, 64,
- -1, 47, 64, 48, -1, 8, 47, 73, 48, -1,
- 21, 9, -1, 22, 8, -1, 27, 64, -1, 66,
- -1, 14, -1, 16, 19, -1, 16, 24, -1, 16,
- 26, -1, 16, 67, -1, 16, 67, 68, -1, 16,
- 68, -1, 31, 15, 9, -1, 15, 9, -1, 31,
- 9, -1, 9, -1, 25, 23, 9, -1, 23, 9,
- -1, 31, 23, 9, -1, -1, 20, 8, 70, 61,
- 71, 46, 63, -1, -1, 8, -1, 71, 51, 8,
- -1, 71, 46, 51, 8, -1, 8, 61, 73, -1,
- 8, -1, -1, 64, -1, 73, 51, 64, -1
+ 69, -1, 65, -1, 74, -1, 55, -1, 56, -1,
+ 1, -1, 27, 64, 18, 8, -1, 29, 8, 40,
+ 64, -1, 29, 8, 31, 64, -1, 64, -1, 65,
+ -1, 60, 57, 30, 63, 62, 13, 17, -1, 60,
+ 57, 30, 63, 62, 12, 63, 62, 13, 17, -1,
+ 58, 47, 57, 48, 63, 62, 13, 28, -1, 59,
+ 40, 64, 62, 31, 64, 62, 63, 62, 13, 28,
+ -1, 59, 40, 64, 62, 11, 31, 64, 62, 63,
+ 62, 13, 28, -1, 64, -1, 64, 40, 64, -1,
+ 47, 57, 48, -1, 28, 33, -1, 28, 32, 8,
+ -1, 17, -1, -1, -1, -1, 63, 46, -1, 63,
+ 56, -1, 6, -1, 8, -1, 55, -1, 64, 41,
+ 64, -1, 64, 42, 64, -1, 64, 43, 64, -1,
+ 64, 44, 64, -1, 64, 49, 64, -1, 64, 50,
+ 64, -1, 64, 39, 64, -1, 64, 34, 64, -1,
+ 64, 35, 64, -1, 41, 64, -1, 42, 64, -1,
+ 47, 64, 48, -1, 8, 47, 75, 48, -1, 21,
+ 9, -1, 22, 8, -1, 27, 64, -1, 66, -1,
+ 14, -1, 16, 19, -1, 16, 24, -1, 16, 26,
+ -1, 16, 67, -1, 16, 67, 68, -1, 16, 68,
+ -1, 31, 15, 9, -1, 15, 9, -1, 31, 9,
+ -1, 9, -1, 25, 23, 9, -1, 23, 9, -1,
+ 31, 23, 9, -1, -1, 20, 8, 70, 72, 71,
+ 46, 73, 63, -1, -1, 8, -1, 71, 51, 8,
+ -1, 71, 46, 51, 8, -1, -1, -1, 8, 61,
+ 75, -1, -1, 64, -1, 75, 51, 64, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 92, 92, 93, 96, 97, 98, 99, 100, 101,
- 102, 103, 106, 112, 118, 126, 127, 128, 134, 146,
- 157, 173, 187, 188, 189, 191, 193, 199, 201, 203,
- 205, 206, 207, 210, 215, 218, 219, 220, 221, 222,
- 223, 224, 225, 226, 227, 228, 229, 230, 233, 239,
- 240, 241, 242, 243, 254, 255, 256, 257, 262, 268,
- 275, 276, 277, 278, 281, 282, 283, 311, 311, 317,
- 318, 319, 320, 323, 329, 335, 336, 337
+ 102, 105, 111, 117, 125, 126, 127, 133, 145, 156,
+ 172, 186, 187, 188, 190, 192, 198, 200, 202, 204,
+ 205, 206, 209, 214, 217, 218, 219, 220, 221, 222,
+ 223, 224, 225, 226, 227, 228, 229, 232, 238, 239,
+ 240, 241, 242, 253, 254, 255, 256, 261, 267, 274,
+ 275, 276, 277, 280, 281, 282, 310, 310, 316, 317,
+ 318, 319, 321, 323, 326, 334, 335, 336
};
#endif
@@ -550,7 +550,7 @@ static const char *const yytname[] =
"','", "$accept", "program", "programline", "asgn", "stmt", "cond",
"repeatwhile", "repeatwith", "if", "begin", "end", "stmtlist", "expr",
"func", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "argdef",
- "macro", "arglist", 0
+ "argbegin", "argstore", "macro", "arglist", 0
};
#endif
@@ -572,26 +572,26 @@ static const yytype_uint16 yytoknum[] =
static const yytype_uint8 yyr1[] =
{
0, 52, 53, 53, 54, 54, 54, 54, 54, 54,
- 54, 54, 55, 55, 55, 56, 56, 56, 56, 56,
- 56, 56, 57, 57, 57, 58, 59, 60, 61, 62,
- 63, 63, 63, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 64, 65, 65,
- 65, 65, 65, 65, 66, 66, 66, 66, 66, 66,
- 67, 67, 67, 67, 68, 68, 68, 70, 69, 71,
- 71, 71, 71, 72, 72, 73, 73, 73
+ 54, 55, 55, 55, 56, 56, 56, 56, 56, 56,
+ 56, 57, 57, 57, 58, 59, 60, 61, 62, 63,
+ 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 65, 65, 65,
+ 65, 65, 65, 66, 66, 66, 66, 66, 66, 67,
+ 67, 67, 67, 68, 68, 68, 70, 69, 71, 71,
+ 71, 71, 72, 73, 74, 75, 75, 75
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 1, 0, 4, 4, 4, 1, 1, 7, 10, 8,
- 11, 12, 1, 3, 3, 2, 3, 1, 0, 0,
- 0, 2, 2, 1, 1, 1, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 2, 2, 3, 4, 2,
- 2, 2, 1, 1, 2, 2, 2, 2, 3, 2,
- 3, 2, 2, 1, 3, 2, 3, 0, 7, 0,
- 1, 3, 4, 3, 1, 0, 1, 3
+ 1, 4, 4, 4, 1, 1, 7, 10, 8, 11,
+ 12, 1, 3, 3, 2, 3, 1, 0, 0, 0,
+ 2, 2, 1, 1, 1, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 2, 2, 3, 4, 2, 2,
+ 2, 1, 1, 2, 2, 2, 2, 3, 2, 3,
+ 2, 2, 1, 3, 2, 3, 0, 8, 0, 1,
+ 3, 4, 0, 0, 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -599,30 +599,30 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 10, 33, 28, 53, 0, 27, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 35, 9,
- 0, 0, 0, 15, 6, 52, 5, 7, 75, 75,
- 63, 0, 54, 0, 55, 0, 56, 0, 57, 59,
- 67, 49, 50, 34, 0, 35, 51, 0, 25, 0,
- 45, 46, 0, 1, 0, 0, 0, 0, 0, 22,
+ 0, 10, 32, 27, 52, 0, 26, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 3, 34, 9,
+ 0, 0, 0, 14, 6, 51, 5, 7, 75, 75,
+ 62, 0, 53, 0, 54, 0, 55, 0, 56, 58,
+ 66, 48, 49, 33, 0, 34, 50, 0, 24, 0,
+ 44, 45, 0, 1, 0, 0, 0, 0, 0, 21,
0, 0, 0, 0, 0, 0, 0, 0, 0, 76,
- 0, 73, 61, 65, 0, 62, 0, 0, 0, 58,
- 28, 0, 0, 26, 0, 0, 47, 2, 0, 29,
- 0, 0, 30, 0, 43, 44, 42, 36, 37, 38,
- 39, 40, 41, 48, 0, 64, 60, 66, 69, 12,
- 14, 13, 30, 0, 24, 29, 23, 77, 70, 0,
- 29, 0, 0, 34, 31, 32, 0, 16, 30, 0,
- 0, 0, 29, 30, 0, 0, 68, 71, 0, 29,
- 30, 29, 17, 72, 19, 30, 29, 0, 29, 0,
- 0, 0, 0, 18, 0, 20, 21
+ 0, 74, 60, 64, 0, 61, 0, 0, 0, 57,
+ 72, 0, 0, 25, 0, 0, 46, 2, 0, 28,
+ 0, 0, 29, 0, 42, 43, 41, 35, 36, 37,
+ 38, 39, 40, 47, 0, 63, 59, 65, 68, 11,
+ 13, 12, 29, 0, 23, 28, 22, 77, 69, 0,
+ 28, 0, 0, 33, 30, 31, 0, 15, 73, 0,
+ 0, 0, 28, 29, 0, 0, 29, 70, 0, 28,
+ 29, 28, 16, 71, 67, 18, 29, 28, 0, 28,
+ 0, 0, 0, 0, 17, 0, 19, 20
};
/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int8 yydefgoto[] =
+static const yytype_int16 yydefgoto[] =
{
-1, 16, 17, 45, 125, 58, 20, 21, 22, 29,
113, 115, 23, 127, 25, 38, 39, 26, 80, 119,
- 27, 70
+ 108, 136, 27, 70
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
@@ -630,97 +630,95 @@ static const yytype_int8 yydefgoto[] =
#define YYPACT_NINF -107
static const yytype_int16 yypact[] =
{
- 64, -107, -107, 195, -107, 154, -107, -7, 22, 9,
- 61, 5, 41, 61, 61, 61, 59, 17, 2, -107,
- 19, 28, 108, 183, -107, -107, -107, -107, 61, 61,
- -107, 62, -107, 67, -107, 50, -107, 13, -2, -107,
- -107, -107, -107, -107, 61, -107, 118, 69, -107, -16,
- 214, 214, 159, -107, 64, 108, 61, 108, 49, 171,
- 61, 61, 61, 61, 61, 61, 61, 61, 61, 183,
- -35, 31, -107, -107, 78, -107, 80, 88, 75, -107,
- -107, 118, 91, -107, 61, 61, -107, -107, 52, 183,
- 53, 147, -107, 61, 183, 183, 183, 212, 212, 214,
- 214, 183, 183, -107, 61, -107, -107, -107, 96, -107,
- 183, 183, -107, -1, -107, 101, 183, 183, -107, -26,
- 101, 82, 61, 72, -107, -107, 83, -107, 73, 112,
- 113, 61, 183, -107, 110, 117, 101, -107, 103, 183,
- -107, 101, -107, -107, -107, -107, 101, 119, 101, 120,
- 121, 126, 106, -107, 116, -107, -107
+ 64, -107, -107, 188, -107, 13, -107, -7, 4, 17,
+ 61, 44, 32, 61, 61, 61, 42, 3, 2, -107,
+ 12, 23, 108, 176, -107, -107, -107, -107, 61, 61,
+ -107, 57, -107, 59, -107, 48, -107, 104, -8, -107,
+ -107, -107, -107, -107, 61, -107, 128, 65, -107, -20,
+ 207, 207, 152, -107, 64, 108, 61, 108, 49, 164,
+ 61, 61, 61, 61, 61, 61, 61, 61, 61, 176,
+ -24, 31, -107, -107, 78, -107, 80, 88, 75, -107,
+ -107, 128, 91, -107, 61, 61, -107, -107, 52, 176,
+ 53, 140, -107, 61, 176, 176, 176, 205, 205, 207,
+ 207, 176, 176, -107, 61, -107, -107, -107, 96, -107,
+ 176, 176, -107, -1, -107, 101, 176, 176, -107, -30,
+ 101, 89, 61, 77, -107, -107, 83, -107, 74, 118,
+ 120, 61, 176, -107, 114, 126, -107, -107, 110, 176,
+ -107, 101, -107, -107, 101, -107, -107, 101, 123, 101,
+ 127, 122, 131, 113, -107, 117, -107, -107
};
/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int8 yypgoto[] =
+static const yytype_int16 yypgoto[] =
{
- -107, 86, -107, 6, 7, -14, -107, -107, -107, 65,
- -106, -101, -10, 8, -107, -107, 127, -107, -107, -107,
- -107, 122
+ -107, 97, -107, 6, 7, -26, -107, -107, -107, -107,
+ -106, 20, -10, 8, -107, -107, 116, -107, -107, -107,
+ -107, -107, -107, 129
};
/* 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 -35
+#define YYTABLE_NINF -34
static const yytype_int16 yytable[] =
{
46, 40, -8, 50, 51, 52, 18, 19, 24, 126,
- 121, 120, 59, 103, 130, 84, 104, 42, 69, 69,
- 128, 33, 75, 35, 85, 129, 140, 136, 76, 78,
- 122, 41, 141, 145, 81, 147, 77, 47, 48, 146,
- 149, 88, 151, 90, 148, 59, 89, 91, -8, 49,
- 94, 95, 96, 97, 98, 99, 100, 101, 102, 53,
- 18, 19, 24, 54, -4, 1, 55, 2, 56, 43,
- 2, 72, 3, 74, 110, 111, 73, 83, 4, 92,
+ 121, 84, 59, 41, 130, 33, 128, 35, 69, 69,
+ 85, 129, 30, 78, 103, 42, 140, 104, 31, 88,
+ 122, 90, 32, 146, 81, 148, 33, 34, 35, 36,
+ 49, 150, 53, 152, 37, 59, 89, 91, -8, 54,
+ 94, 95, 96, 97, 98, 99, 100, 101, 102, 55,
+ 18, 19, 24, 56, -4, 1, 72, 2, 73, 43,
+ 2, 74, 3, 83, 110, 111, 47, 48, 4, 92,
5, 6, 104, 116, 7, 8, 9, 105, 44, 106,
12, 10, 11, 12, 117, 133, 134, 107, 77, 109,
112, 114, 13, 14, 118, 13, 14, 2, 15, 123,
- -4, 15, 132, 131, 2, 4, 43, 5, 6, 28,
- 137, 139, 8, 9, 135, 143, 138, 142, 10, 11,
- 12, 144, 150, 152, 155, 44, 82, 12, 153, 154,
- 87, 0, 13, 14, 156, 108, 0, 124, 15, 13,
- 14, 71, 60, 61, 0, 57, 0, 62, 0, 63,
- 64, 65, 66, 30, 0, 79, 0, 67, 68, 31,
- 0, 0, 0, 32, 0, 0, 0, 33, 34, 35,
- 36, 60, 61, 0, 0, 37, 62, 93, 63, 64,
- 65, 66, 0, 60, 61, 86, 67, 68, 62, 0,
- 63, 64, 65, 66, 0, 60, 61, 86, 67, 68,
- 62, 93, 63, 64, 65, 66, 0, 60, 61, 0,
- 67, 68, 62, 0, 63, 64, 65, 66, 0, -34,
- -34, 0, 67, 68, -34, 0, 0, 0, -34, -34,
- 0, 0, 28, 0, -34, -34, 60, 61, 60, 61,
- 0, 62, 0, 62, 0, 65, 66, 0, 0, 0,
- 0, 67, 68, 67, 68
+ -4, 15, 132, 75, 2, 4, 43, 5, 6, 76,
+ 131, 139, 8, 9, 28, 135, 137, 77, 10, 11,
+ 12, 142, 120, 138, 143, 44, 151, 12, 145, 154,
+ 153, 156, 13, 14, 155, 157, 82, 124, 15, 13,
+ 14, 87, 0, 141, 79, 57, 144, 0, 71, 0,
+ 147, 0, 60, 61, 0, 0, 149, 62, 0, 63,
+ 64, 65, 66, 0, 60, 61, 0, 67, 68, 62,
+ 93, 63, 64, 65, 66, 0, 60, 61, 86, 67,
+ 68, 62, 0, 63, 64, 65, 66, 0, 60, 61,
+ 86, 67, 68, 62, 93, 63, 64, 65, 66, 0,
+ 60, 61, 0, 67, 68, 62, 0, 63, 64, 65,
+ 66, 0, -33, -33, 0, 67, 68, -33, 0, 0,
+ 0, -33, -33, 0, 0, 28, 0, -33, -33, 60,
+ 61, 60, 61, 0, 62, 0, 62, 0, 65, 66,
+ 0, 0, 0, 0, 67, 68, 67, 68
};
static const yytype_int16 yycheck[] =
{
10, 8, 0, 13, 14, 15, 0, 0, 0, 115,
- 11, 112, 22, 48, 120, 31, 51, 8, 28, 29,
- 46, 23, 9, 25, 40, 51, 132, 128, 15, 31,
- 31, 9, 133, 139, 44, 141, 23, 32, 33, 140,
- 146, 55, 148, 57, 145, 55, 56, 57, 46, 8,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 0,
- 54, 54, 54, 46, 0, 1, 47, 6, 40, 8,
- 6, 9, 8, 23, 84, 85, 9, 8, 14, 30,
+ 11, 31, 22, 9, 120, 23, 46, 25, 28, 29,
+ 40, 51, 9, 31, 48, 8, 132, 51, 15, 55,
+ 31, 57, 19, 139, 44, 141, 23, 24, 25, 26,
+ 8, 147, 0, 149, 31, 55, 56, 57, 46, 46,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 47,
+ 54, 54, 54, 40, 0, 1, 9, 6, 9, 8,
+ 6, 23, 8, 8, 84, 85, 32, 33, 14, 30,
16, 17, 51, 93, 20, 21, 22, 9, 27, 9,
29, 27, 28, 29, 104, 12, 13, 9, 23, 8,
48, 48, 41, 42, 8, 41, 42, 6, 47, 8,
- 46, 47, 122, 31, 6, 14, 8, 16, 17, 47,
- 8, 131, 21, 22, 51, 8, 13, 17, 27, 28,
- 29, 28, 13, 13, 28, 27, 18, 29, 17, 13,
- 54, -1, 41, 42, 28, 80, -1, 46, 47, 41,
- 42, 29, 34, 35, -1, 47, -1, 39, -1, 41,
- 42, 43, 44, 9, -1, 38, -1, 49, 50, 15,
- -1, -1, -1, 19, -1, -1, -1, 23, 24, 25,
- 26, 34, 35, -1, -1, 31, 39, 40, 41, 42,
- 43, 44, -1, 34, 35, 48, 49, 50, 39, -1,
- 41, 42, 43, 44, -1, 34, 35, 48, 49, 50,
- 39, 40, 41, 42, 43, 44, -1, 34, 35, -1,
- 49, 50, 39, -1, 41, 42, 43, 44, -1, 34,
- 35, -1, 49, 50, 39, -1, -1, -1, 43, 44,
- -1, -1, 47, -1, 49, 50, 34, 35, 34, 35,
- -1, 39, -1, 39, -1, 43, 44, -1, -1, -1,
- -1, 49, 50, 49, 50
+ 46, 47, 122, 9, 6, 14, 8, 16, 17, 15,
+ 31, 131, 21, 22, 47, 51, 8, 23, 27, 28,
+ 29, 17, 112, 13, 8, 27, 13, 29, 28, 17,
+ 13, 28, 41, 42, 13, 28, 18, 46, 47, 41,
+ 42, 54, -1, 133, 38, 47, 136, -1, 29, -1,
+ 140, -1, 34, 35, -1, -1, 146, 39, -1, 41,
+ 42, 43, 44, -1, 34, 35, -1, 49, 50, 39,
+ 40, 41, 42, 43, 44, -1, 34, 35, 48, 49,
+ 50, 39, -1, 41, 42, 43, 44, -1, 34, 35,
+ 48, 49, 50, 39, 40, 41, 42, 43, 44, -1,
+ 34, 35, -1, 49, 50, 39, -1, 41, 42, 43,
+ 44, -1, 34, 35, -1, 49, 50, 39, -1, -1,
+ -1, 43, 44, -1, -1, 47, -1, 49, 50, 34,
+ 35, 34, 35, -1, 39, -1, 39, -1, 43, 44,
+ -1, -1, -1, -1, 49, 50, 49, 50
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -729,20 +727,20 @@ static const yytype_uint8 yystos[] =
{
0, 1, 6, 8, 14, 16, 17, 20, 21, 22,
27, 28, 29, 41, 42, 47, 53, 54, 55, 56,
- 58, 59, 60, 64, 65, 66, 69, 72, 47, 61,
+ 58, 59, 60, 64, 65, 66, 69, 74, 47, 61,
9, 15, 19, 23, 24, 25, 26, 31, 67, 68,
8, 9, 8, 8, 27, 55, 64, 32, 33, 8,
64, 64, 64, 0, 46, 47, 40, 47, 57, 64,
34, 35, 39, 41, 42, 43, 44, 49, 50, 64,
- 73, 73, 9, 9, 23, 9, 15, 23, 31, 68,
+ 75, 75, 9, 9, 23, 9, 15, 23, 31, 68,
70, 64, 18, 8, 31, 40, 48, 53, 57, 64,
57, 64, 30, 40, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 48, 51, 9, 9, 9, 61, 8,
+ 64, 64, 64, 48, 51, 9, 9, 9, 72, 8,
64, 64, 48, 62, 48, 63, 64, 64, 8, 71,
63, 11, 31, 8, 46, 56, 62, 65, 46, 51,
- 62, 31, 64, 12, 13, 51, 63, 8, 13, 64,
- 62, 63, 17, 8, 28, 62, 63, 62, 63, 62,
- 13, 62, 13, 17, 13, 28, 28
+ 62, 31, 64, 12, 13, 51, 73, 8, 13, 64,
+ 62, 63, 17, 8, 63, 28, 62, 63, 62, 63,
+ 62, 13, 62, 13, 17, 13, 28, 28
};
#define yyerrok (yyerrstatus = 0)
@@ -1566,8 +1564,8 @@ yyreduce:
{ yyerrok; ;}
break;
- case 12:
-#line 106 "engines/director/lingo/lingo-gr.y"
+ case 11:
+#line 105 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str());
@@ -1576,8 +1574,8 @@ yyreduce:
delete (yyvsp[(4) - (4)].s); ;}
break;
- case 13:
-#line 112 "engines/director/lingo/lingo-gr.y"
+ case 12:
+#line 111 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1586,8 +1584,8 @@ yyreduce:
delete (yyvsp[(2) - (4)].s); ;}
break;
- case 14:
-#line 118 "engines/director/lingo/lingo-gr.y"
+ case 13:
+#line 117 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1596,13 +1594,13 @@ yyreduce:
delete (yyvsp[(2) - (4)].s); ;}
break;
- case 15:
-#line 126 "engines/director/lingo/lingo-gr.y"
+ case 14:
+#line 125 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 17:
-#line 128 "engines/director/lingo/lingo-gr.y"
+ case 16:
+#line 127 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
@@ -1611,8 +1609,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; ;}
break;
- case 18:
-#line 134 "engines/director/lingo/lingo-gr.y"
+ case 17:
+#line 133 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1623,8 +1621,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
break;
- case 19:
-#line 146 "engines/director/lingo/lingo-gr.y"
+ case 18:
+#line 145 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1633,8 +1631,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
- case 20:
-#line 157 "engines/director/lingo/lingo-gr.y"
+ case 19:
+#line 156 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1649,8 +1647,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
break;
- case 21:
-#line 173 "engines/director/lingo/lingo-gr.y"
+ case 20:
+#line 172 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1665,23 +1663,23 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
break;
- case 22:
-#line 187 "engines/director/lingo/lingo-gr.y"
+ case 21:
+#line 186 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 23:
-#line 188 "engines/director/lingo/lingo-gr.y"
+ case 22:
+#line 187 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 25:
-#line 191 "engines/director/lingo/lingo-gr.y"
+ case 24:
+#line 190 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 26:
-#line 193 "engines/director/lingo/lingo-gr.y"
+ case 25:
+#line 192 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1689,28 +1687,28 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 27:
-#line 199 "engines/director/lingo/lingo-gr.y"
+ case 26:
+#line 198 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
- case 28:
-#line 201 "engines/director/lingo/lingo-gr.y"
+ case 27:
+#line 200 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 29:
-#line 203 "engines/director/lingo/lingo-gr.y"
+ case 28:
+#line 202 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 30:
-#line 205 "engines/director/lingo/lingo-gr.y"
+ case 29:
+#line 204 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 33:
-#line 210 "engines/director/lingo/lingo-gr.y"
+ case 32:
+#line 209 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1718,75 +1716,75 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 34:
-#line 215 "engines/director/lingo/lingo-gr.y"
+ case 33:
+#line 214 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
+ case 35:
+#line 218 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_add); ;}
+ break;
+
case 36:
#line 219 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_add); ;}
+ { g_lingo->code1(g_lingo->c_sub); ;}
break;
case 37:
#line 220 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_sub); ;}
+ { g_lingo->code1(g_lingo->c_mul); ;}
break;
case 38:
#line 221 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_mul); ;}
+ { g_lingo->code1(g_lingo->c_div); ;}
break;
case 39:
#line 222 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_div); ;}
+ { g_lingo->code1(g_lingo->c_gt); ;}
break;
case 40:
#line 223 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gt); ;}
+ { g_lingo->code1(g_lingo->c_lt); ;}
break;
case 41:
#line 224 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_lt); ;}
+ { g_lingo->code1(g_lingo->c_neq); ;}
break;
case 42:
#line 225 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_neq); ;}
+ { g_lingo->code1(g_lingo->c_ge); ;}
break;
case 43:
#line 226 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_ge); ;}
+ { g_lingo->code1(g_lingo->c_le); ;}
break;
case 44:
#line 227 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_le); ;}
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 45:
#line 228 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 46:
#line 229 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
- break;
-
- case 47:
-#line 230 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 48:
-#line 233 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 232 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1795,43 +1793,43 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
+ case 48:
+#line 238 "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 49:
#line 239 "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); ;}
+ { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 50:
#line 240 "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); ;}
+ { g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 51:
-#line 241 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_printtop); ;}
+ case 52:
+#line 242 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_exit); ;}
break;
case 53:
-#line 243 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_exit); ;}
+#line 253 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 54:
#line 254 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoloop); ;}
+ { g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 55:
#line 255 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotonext); ;}
+ { g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 56:
#line 256 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoprevious); ;}
- break;
-
- case 57:
-#line 257 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1839,8 +1837,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 58:
-#line 262 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 261 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1849,8 +1847,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 59:
-#line 268 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 267 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1858,9 +1856,14 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
+ case 59:
+#line 274 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ break;
+
case 60:
#line 275 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 61:
@@ -1870,64 +1873,69 @@ yyreduce:
case 62:
#line 277 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 63:
-#line 278 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+#line 280 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 64:
#line 281 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 65:
#line 282 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 66:
-#line 283 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 310 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->_indef = true; ;}
break;
case 67:
#line 311 "engines/director/lingo/lingo-gr.y"
- { g_lingo->_indef = true; ;}
- break;
-
- case 68:
-#line 312 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_procret);
- g_lingo->define(*(yyvsp[(2) - (7)].s), (yyvsp[(4) - (7)].code), (yyvsp[(5) - (7)].narg));
+ g_lingo->define(*(yyvsp[(2) - (8)].s), (yyvsp[(4) - (8)].code), (yyvsp[(5) - (8)].narg));
g_lingo->_indef = false; ;}
break;
+ case 68:
+#line 316 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = 0; ;}
+ break;
+
case 69:
#line 317 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 0; ;}
+ { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 70:
#line 318 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg(*(yyvsp[(1) - (1)].s)); delete (yyvsp[(1) - (1)].s); (yyval.narg) = 1; ;}
+ { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 71:
#line 319 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg(*(yyvsp[(3) - (3)].s)); delete (yyvsp[(3) - (3)].s); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
+ { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 72:
-#line 320 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg(*(yyvsp[(4) - (4)].s)); delete (yyvsp[(4) - (4)].s); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
+#line 321 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArg(new Common::String("<args>")); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 73:
#line 323 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArgStore(); ;}
+ break;
+
+ case 74:
+#line 326 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -1936,26 +1944,18 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 74:
-#line 329 "engines/director/lingo/lingo-gr.y"
- {
- g_lingo->code1(g_lingo->c_call);
- g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str());
- g_lingo->code1(0); ;}
- break;
-
case 75:
-#line 335 "engines/director/lingo/lingo-gr.y"
+#line 334 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 76:
-#line 336 "engines/director/lingo/lingo-gr.y"
+#line 335 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
case 77:
-#line 337 "engines/director/lingo/lingo-gr.y"
+#line 336 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
@@ -2175,6 +2175,6 @@ yyreturn:
}
-#line 340 "engines/director/lingo/lingo-gr.y"
+#line 339 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 7667481..0ffa2d4 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -78,7 +78,7 @@ using namespace Director;
%token tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO tWITH tWHILE
%token tGE tLE tGT tLT tEQ tNEQ
-%type<code> asgn begin cond end expr if repeatwhile repeatwith stmtlist
+%type<code> argbegin asgn begin cond end expr if repeatwhile repeatwith stmtlist
%type<s> gotoframe gotomovie
%type<narg> argdef arglist
@@ -100,7 +100,6 @@ programline:
| asgn { g_lingo->code1(g_lingo->c_xpop); }
| stmt
| error { yyerrok; }
- | /* empty */
;
asgn: tPUT expr tINTO ID {
@@ -309,15 +308,19 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
// See also:
// on keyword
defn: tMACRO ID { g_lingo->_indef = true; }
- begin argdef '\n' stmtlist {
+ argbegin argdef '\n' argstore stmtlist {
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$2, $4, $5);
g_lingo->_indef = false; }
;
argdef: /* nothing */ { $$ = 0; }
- | ID { g_lingo->codeArg(*$1); delete $1; $$ = 1; }
- | argdef ',' ID { g_lingo->codeArg(*$3); delete $3; $$ = $1 + 1; }
- | argdef '\n' ',' ID { g_lingo->codeArg(*$4); delete $4; $$ = $1 + 1; }
+ | ID { g_lingo->codeArg($1); $$ = 1; }
+ | argdef ',' ID { g_lingo->codeArg($3); $$ = $1 + 1; }
+ | argdef '\n' ',' ID { g_lingo->codeArg($4); $$ = $1 + 1; }
+ ;
+argbegin: /* nothing */ { g_lingo->codeArg(new Common::String("<args>")); $$ = g_lingo->_currentScript->size(); }
+ ;
+argstore: /* nothing */ { g_lingo->codeArgStore(); }
;
macro: ID begin arglist {
@@ -326,10 +329,6 @@ macro: ID begin arglist {
inst numpar = 0;
WRITE_UINT32(&numpar, $3);
g_lingo->code1(numpar); };
- | ID {
- g_lingo->code1(g_lingo->c_call);
- g_lingo->codeString($1->c_str());
- g_lingo->code1(0); };
;
arglist: /* nothing */ { $$ = 0; }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index bb613ab..e40aa63 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -136,7 +136,8 @@ public:
void execute(int pc);
Symbol *lookupVar(const char *name);
void define(Common::String &s, int start, int nargs);
- void codeArg(Common::String &s);
+ void codeArg(Common::String *s);
+ void codeArgStore();
int codeId(Common::String &s);
int codeId_(Common::String &s);
@@ -186,6 +187,7 @@ public:
bool _indef;
Common::Array<CFrame *> _callstack;
+ Common::Array<Common::String *> _argstack;
private:
int parse(const char *code);
Commit: 9fff6529a3a3955a1a7201398ecf3f1a90871399
https://github.com/scummvm/scummvm/commit/9fff6529a3a3955a1a7201398ecf3f1a90871399
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: SImplified arg processing at macro definition.
Changed paths:
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index e2757bb..581b1c1 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -120,11 +120,6 @@ void Lingo::codeArgStore() {
Common::String *arg = _argstack.back();
_argstack.pop_back();
- if (arg->equals("<args>")) {
- delete arg;
- break;
- }
-
code1(c_varpush);
codeString(arg->c_str());
code1(c_assign);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index e792531..2376625 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -427,9 +427,9 @@ union yyalloc
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 52
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 24
+#define YYNNTS 23
/* YYNRULES -- Number of rules. */
-#define YYNRULES 77
+#define YYNRULES 76
/* YYNRULES -- Number of states. */
#define YYNSTATES 158
@@ -487,14 +487,14 @@ static const yytype_uint16 yyprhs[] =
148, 152, 156, 160, 164, 167, 170, 174, 179, 182,
185, 188, 190, 192, 195, 198, 201, 204, 208, 211,
215, 218, 221, 223, 227, 230, 234, 235, 244, 245,
- 247, 251, 256, 257, 258, 262, 263, 265
+ 247, 251, 256, 257, 261, 262, 264
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
53, 0, -1, 54, 46, 53, -1, 54, -1, -1,
- 69, -1, 65, -1, 74, -1, 55, -1, 56, -1,
+ 69, -1, 65, -1, 73, -1, 55, -1, 56, -1,
1, -1, 27, 64, 18, 8, -1, 29, 8, 40,
64, -1, 29, 8, 31, 64, -1, 64, -1, 65,
-1, 60, 57, 30, 63, 62, 13, 17, -1, 60,
@@ -510,16 +510,16 @@ static const yytype_int8 yyrhs[] =
64, 44, 64, -1, 64, 49, 64, -1, 64, 50,
64, -1, 64, 39, 64, -1, 64, 34, 64, -1,
64, 35, 64, -1, 41, 64, -1, 42, 64, -1,
- 47, 64, 48, -1, 8, 47, 75, 48, -1, 21,
+ 47, 64, 48, -1, 8, 47, 74, 48, -1, 21,
9, -1, 22, 8, -1, 27, 64, -1, 66, -1,
14, -1, 16, 19, -1, 16, 24, -1, 16, 26,
-1, 16, 67, -1, 16, 67, 68, -1, 16, 68,
-1, 31, 15, 9, -1, 15, 9, -1, 31, 9,
-1, 9, -1, 25, 23, 9, -1, 23, 9, -1,
- 31, 23, 9, -1, -1, 20, 8, 70, 72, 71,
- 46, 73, 63, -1, -1, 8, -1, 71, 51, 8,
- -1, 71, 46, 51, 8, -1, -1, -1, 8, 61,
- 75, -1, -1, 64, -1, 75, 51, 64, -1
+ 31, 23, 9, -1, -1, 20, 8, 70, 61, 71,
+ 46, 72, 63, -1, -1, 8, -1, 71, 51, 8,
+ -1, 71, 46, 51, 8, -1, -1, 8, 61, 74,
+ -1, -1, 64, -1, 74, 51, 64, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -532,7 +532,7 @@ static const yytype_uint16 yyrline[] =
223, 224, 225, 226, 227, 228, 229, 232, 238, 239,
240, 241, 242, 253, 254, 255, 256, 261, 267, 274,
275, 276, 277, 280, 281, 282, 310, 310, 316, 317,
- 318, 319, 321, 323, 326, 334, 335, 336
+ 318, 319, 321, 324, 332, 333, 334
};
#endif
@@ -550,7 +550,7 @@ static const char *const yytname[] =
"','", "$accept", "program", "programline", "asgn", "stmt", "cond",
"repeatwhile", "repeatwith", "if", "begin", "end", "stmtlist", "expr",
"func", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "argdef",
- "argbegin", "argstore", "macro", "arglist", 0
+ "argstore", "macro", "arglist", 0
};
#endif
@@ -578,7 +578,7 @@ static const yytype_uint8 yyr1[] =
64, 64, 64, 64, 64, 64, 64, 65, 65, 65,
65, 65, 65, 66, 66, 66, 66, 66, 66, 67,
67, 67, 67, 68, 68, 68, 70, 69, 71, 71,
- 71, 71, 72, 73, 74, 75, 75, 75
+ 71, 71, 72, 73, 74, 74, 74
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -591,7 +591,7 @@ static const yytype_uint8 yyr2[] =
3, 3, 3, 3, 2, 2, 3, 4, 2, 2,
2, 1, 1, 2, 2, 2, 2, 3, 2, 3,
2, 2, 1, 3, 2, 3, 0, 8, 0, 1,
- 3, 4, 0, 0, 3, 0, 1, 3
+ 3, 4, 0, 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -601,17 +601,17 @@ static const yytype_uint8 yydefact[] =
{
0, 10, 32, 27, 52, 0, 26, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 3, 34, 9,
- 0, 0, 0, 14, 6, 51, 5, 7, 75, 75,
+ 0, 0, 0, 14, 6, 51, 5, 7, 74, 74,
62, 0, 53, 0, 54, 0, 55, 0, 56, 58,
66, 48, 49, 33, 0, 34, 50, 0, 24, 0,
44, 45, 0, 1, 0, 0, 0, 0, 0, 21,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 76,
- 0, 74, 60, 64, 0, 61, 0, 0, 0, 57,
- 72, 0, 0, 25, 0, 0, 46, 2, 0, 28,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
+ 0, 73, 60, 64, 0, 61, 0, 0, 0, 57,
+ 27, 0, 0, 25, 0, 0, 46, 2, 0, 28,
0, 0, 29, 0, 42, 43, 41, 35, 36, 37,
38, 39, 40, 47, 0, 63, 59, 65, 68, 11,
- 13, 12, 29, 0, 23, 28, 22, 77, 69, 0,
- 28, 0, 0, 33, 30, 31, 0, 15, 73, 0,
+ 13, 12, 29, 0, 23, 28, 22, 76, 69, 0,
+ 28, 0, 0, 33, 30, 31, 0, 15, 72, 0,
0, 0, 28, 29, 0, 0, 29, 70, 0, 28,
29, 28, 16, 71, 67, 18, 29, 28, 0, 28,
0, 0, 0, 0, 17, 0, 19, 20
@@ -622,7 +622,7 @@ static const yytype_int16 yydefgoto[] =
{
-1, 16, 17, 45, 125, 58, 20, 21, 22, 29,
113, 115, 23, 127, 25, 38, 39, 26, 80, 119,
- 108, 136, 27, 70
+ 136, 27, 70
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
@@ -651,9 +651,9 @@ static const yytype_int16 yypact[] =
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -107, 97, -107, 6, 7, -26, -107, -107, -107, -107,
+ -107, 97, -107, 6, 7, -26, -107, -107, -107, 72,
-106, 20, -10, 8, -107, -107, 116, -107, -107, -107,
- -107, -107, -107, 129
+ -107, -107, 129
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -678,7 +678,7 @@ static const yytype_int16 yytable[] =
131, 139, 8, 9, 28, 135, 137, 77, 10, 11,
12, 142, 120, 138, 143, 44, 151, 12, 145, 154,
153, 156, 13, 14, 155, 157, 82, 124, 15, 13,
- 14, 87, 0, 141, 79, 57, 144, 0, 71, 0,
+ 14, 87, 108, 141, 79, 57, 144, 0, 71, 0,
147, 0, 60, 61, 0, 0, 149, 62, 0, 63,
64, 65, 66, 0, 60, 61, 0, 67, 68, 62,
93, 63, 64, 65, 66, 0, 60, 61, 86, 67,
@@ -708,7 +708,7 @@ static const yytype_int16 yycheck[] =
31, 131, 21, 22, 47, 51, 8, 23, 27, 28,
29, 17, 112, 13, 8, 27, 13, 29, 28, 17,
13, 28, 41, 42, 13, 28, 18, 46, 47, 41,
- 42, 54, -1, 133, 38, 47, 136, -1, 29, -1,
+ 42, 54, 80, 133, 38, 47, 136, -1, 29, -1,
140, -1, 34, 35, -1, -1, 146, 39, -1, 41,
42, 43, 44, -1, 34, 35, -1, 49, 50, 39,
40, 41, 42, 43, 44, -1, 34, 35, 48, 49,
@@ -727,18 +727,18 @@ static const yytype_uint8 yystos[] =
{
0, 1, 6, 8, 14, 16, 17, 20, 21, 22,
27, 28, 29, 41, 42, 47, 53, 54, 55, 56,
- 58, 59, 60, 64, 65, 66, 69, 74, 47, 61,
+ 58, 59, 60, 64, 65, 66, 69, 73, 47, 61,
9, 15, 19, 23, 24, 25, 26, 31, 67, 68,
8, 9, 8, 8, 27, 55, 64, 32, 33, 8,
64, 64, 64, 0, 46, 47, 40, 47, 57, 64,
34, 35, 39, 41, 42, 43, 44, 49, 50, 64,
- 75, 75, 9, 9, 23, 9, 15, 23, 31, 68,
+ 74, 74, 9, 9, 23, 9, 15, 23, 31, 68,
70, 64, 18, 8, 31, 40, 48, 53, 57, 64,
57, 64, 30, 40, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 48, 51, 9, 9, 9, 72, 8,
+ 64, 64, 64, 48, 51, 9, 9, 9, 61, 8,
64, 64, 48, 62, 48, 63, 64, 64, 8, 71,
63, 11, 31, 8, 46, 56, 62, 65, 46, 51,
- 62, 31, 64, 12, 13, 51, 73, 8, 13, 64,
+ 62, 31, 64, 12, 13, 51, 72, 8, 13, 64,
62, 63, 17, 8, 63, 28, 62, 63, 62, 63,
62, 13, 62, 13, 17, 13, 28, 28
};
@@ -1926,16 +1926,11 @@ yyreduce:
case 72:
#line 321 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg(new Common::String("<args>")); (yyval.code) = g_lingo->_currentScript->size(); ;}
- break;
-
- case 73:
-#line 323 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 74:
-#line 326 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 324 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -1944,24 +1939,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 75:
-#line 334 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 332 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 76:
-#line 335 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 333 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 77:
-#line 336 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 334 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 1965 "engines/director/lingo/lingo-gr.cpp"
+#line 1960 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2175,6 +2170,6 @@ yyreturn:
}
-#line 339 "engines/director/lingo/lingo-gr.y"
+#line 337 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 0ffa2d4..3c716a5 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -78,7 +78,7 @@ using namespace Director;
%token tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO tWITH tWHILE
%token tGE tLE tGT tLT tEQ tNEQ
-%type<code> argbegin asgn begin cond end expr if repeatwhile repeatwith stmtlist
+%type<code> asgn begin cond end expr if repeatwhile repeatwith stmtlist
%type<s> gotoframe gotomovie
%type<narg> argdef arglist
@@ -308,7 +308,7 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
// See also:
// on keyword
defn: tMACRO ID { g_lingo->_indef = true; }
- argbegin argdef '\n' argstore stmtlist {
+ begin argdef '\n' argstore stmtlist {
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$2, $4, $5);
g_lingo->_indef = false; }
@@ -318,8 +318,6 @@ argdef: /* nothing */ { $$ = 0; }
| argdef ',' ID { g_lingo->codeArg($3); $$ = $1 + 1; }
| argdef '\n' ',' ID { g_lingo->codeArg($4); $$ = $1 + 1; }
;
-argbegin: /* nothing */ { g_lingo->codeArg(new Common::String("<args>")); $$ = g_lingo->_currentScript->size(); }
- ;
argstore: /* nothing */ { g_lingo->codeArgStore(); }
;
Commit: 19ae959bdd97e785f913caa101aef03b0d035bf8
https://github.com/scummvm/scummvm/commit/19ae959bdd97e785f913caa101aef03b0d035bf8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Actually let VOID vars to pass.
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 3fbc0b6..af0f87b 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -96,6 +96,7 @@ put par3\n\
_lingo->addCode("check(1, 2, 3)\n\
check 4, 5, 6\n\
+check 7, 8\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 7555af8..92cb994 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -145,12 +145,9 @@ bool Lingo::verify(Symbol *s) {
return false;
}
- if (s->type == VOID) {
+ if (s->type == VOID)
warning("Variable used before assigning a value '%s'", s->name);
- return false;
- }
-
return true;
}
Commit: 038a3ca29392b61f7286302c70f948fde161c126
https://github.com/scummvm/scummvm/commit/038a3ca29392b61f7286302c70f948fde161c126
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Change Labels HashMap to SortedArray
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 0a4aed4..b334caf 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -234,6 +234,7 @@ void Score::loadCastData(Common::SeekableSubReadStreamEndian &stream) {
}
void Score::loadLabels(Common::SeekableSubReadStreamEndian &stream) {
+ _labels = new Common::SortedArray<Label *>(compareLabels);
uint16 count = stream.readUint16() + 1;
uint16 offset = count * 4 + 2;
@@ -246,24 +247,28 @@ void Score::loadLabels(Common::SeekableSubReadStreamEndian &stream) {
uint16 streamPos = stream.pos();
stream.seek(stringPos);
-
+ Common::String label;
for (uint16 j = stringPos; j < nextStringPos; j++) {
- _labels[frame] += stream.readByte();
+ label += stream.readByte();
}
-
+ _labels->insert(new Label(label, frame));
stream.seek(streamPos);
frame = nextFrame;
stringPos = nextStringPos;
}
- Common::HashMap<uint16, Common::String>::iterator j;
+ Common::SortedArray<Label *>::iterator j;
- for (j = _labels.begin(); j != _labels.end(); ++j) {
- debug("Frame %d, Label %s", j->_key, j->_value.c_str());
+ for (j = _labels->begin(); j != _labels->end(); ++j) {
+ debug("Frame %d, Label %s", (*j)->number, (*j)->name.c_str());
}
}
+int Score::compareLabels(const void *a, const void *b) {
+ return ((Label *)a)->number - ((Label *)b)->number;
+}
+
void Score::loadActions(Common::SeekableSubReadStreamEndian &stream) {
uint16 count = stream.readUint16() + 1;
uint16 offset = count * 4 + 2;
@@ -339,15 +344,14 @@ void Score::loadScriptText(Common::SeekableSubReadStreamEndian &stream) {
}
void Score::setStartToLabel(Common::String label) {
- Common::HashMap<uint16, Common::String>::iterator i;
+ Common::SortedArray<Label *>::iterator i;
- for (i = _labels.begin(); i != _labels.end(); ++i) {
- if (i->_value == label) {
- _currentFrame = i->_key;
+ for (i = _labels->begin(); i != _labels->end(); ++i) {
+ if ((*i)->name == label) {
+ _currentFrame = (*i)->number;
return;
}
}
-
warning("Label %s not found", label.c_str());
}
@@ -407,30 +411,30 @@ void Score::loadCastInfo(Common::SeekableSubReadStreamEndian &stream, uint16 id)
void Score::goToLoop() {
//This command has the playback head contonuously return to the first marker to to the left and then loop back.
//If no marker are to the left of the playback head, the playback head continues to the right.
- Common::HashMap<uint16, Common::String>::iterator i;
+ Common::SortedArray<Label *>::iterator i;
- for (i = _labels.begin(); i != _labels.end(); ++i) {
- if (i->_value == _currentLabel) {
- _currentFrame = i->_key;
+ for (i = _labels->begin(); i != _labels->end(); ++i) {
+ if ((*i)->name == _currentLabel) {
+ _currentFrame = (*i)->number;
return;
}
}
}
void Score::goToNext() {
- Common::HashMap<uint16, Common::String>::iterator i;
+ Common::SortedArray<Label *>::iterator i;
- for (i = _labels.begin(); i != _labels.end(); ++i) {
- if (i->_value == _currentLabel) {
- if (i != _labels.end()) {
+ for (i = _labels->begin(); i != _labels->end(); ++i) {
+ if ((*i)->name == _currentLabel) {
+ if (i != _labels->end()) {
//return to the first marker to to the right
++i;
- _currentFrame = i->_key;
+ _currentFrame = (*i)->number;
return;
} else {
//if no markers are to the right of the playback head,
//the playback head goes to the first marker to the left
- _currentFrame = i->_key;
+ _currentFrame = (*i)->number;
return;
}
}
@@ -442,20 +446,20 @@ void Score::goToNext() {
void Score::goToPrevious() {
//One label
- if (_labels.begin() == _labels.end()) {
- _currentFrame = _labels.begin()->_key;
+ if (_labels->begin() == _labels->end()) {
+ _currentFrame = (*_labels->begin())->number;
return;
}
- Common::HashMap<uint16, Common::String>::iterator previous = _labels.begin();
- Common::HashMap<uint16, Common::String>::iterator i = previous++; //because iterator havent decrement operator
+ Common::SortedArray<Label *>::iterator previous = _labels->begin();
+ Common::SortedArray<Label *>::iterator i = previous++;
- for (i = _labels.begin(); i != _labels.end(); ++i, ++previous) {
- if (i->_value == _currentLabel) {
- _currentFrame = previous->_key;
+ for (i = _labels->begin(); i != _labels->end(); ++i, ++previous) {
+ if ((*i)->name == _currentLabel) {
+ _currentFrame = (*previous)->number;
return;
} else {
- _currentFrame = i->_key;
+ _currentFrame = (*i)->number;
return;
}
}
@@ -669,9 +673,14 @@ void Score::update() {
//TODO Director 6 step: send prepareFrame event to all sprites and the script channel in upcoming frame
//_lingo->processEvent(kEventPrepareFrame, _currentFrame);
_currentFrame++;
- if (_labels.contains(_currentFrame)) {
- _currentLabel = _labels[_currentFrame];
+
+ Common::SortedArray<Label *>::iterator i;
+ for (i = _labels->begin(); i != _labels->end(); ++i) {
+ if ((*i)->number = _currentFrame) {
+ _currentLabel = (*i)->name;
+ }
}
+
_frames[_currentFrame]->prepareFrame(this);
//Stage is drawn between the prepareFrame and enterFrame events (Lingo in a Nutshell)
diff --git a/engines/director/score.h b/engines/director/score.h
index 06536d9..0327425 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -327,12 +327,19 @@ public:
DirectorEngine *_vm;
};
+struct Label {
+ Common::String name;
+ uint16 number;
+ Label(Common::String _name, uint16 _number) { name = _name; number = _number; }
+};
+
class Score {
public:
Score(DirectorEngine *vm);
~Score();
static Common::Rect readRect(Common::SeekableSubReadStreamEndian &stream);
+ static int compareLabels(const void *a, const void *b);
void loadArchive();
void setStartToLabel(Common::String label);
void goToLoop();
@@ -364,7 +371,7 @@ public:
Common::Array<Frame *> _frames;
Common::HashMap<int, Cast *> _casts;
Common::HashMap<uint16, CastInfo *> _castsInfo;
- Common::HashMap<uint16, Common::String> _labels;
+ Common::SortedArray<Label *> *_labels;
Common::HashMap<uint16, Common::String> _actions;
Common::HashMap<uint16, Common::String> _fontMap;
Graphics::ManagedSurface *_surface;
Commit: 4b871b62e5fea82517301c7377118244420723d7
https://github.com/scummvm/scummvm/commit/4b871b62e5fea82517301c7377118244420723d7
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Renew shared resources when loading new folder
Changed paths:
engines/director/director.cpp
engines/director/director.h
engines/director/score.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index af0f87b..0c63525 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -56,6 +56,8 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
_mainArchive = 0;
_macBinary = 0;
_currentPalette = 0;
+ //FIXME
+ _sharedMMM = "SHARDCST.MMM";
_movies = new Common::HashMap<Common::String, Score *>();
const Common::FSNode gameDataDir(ConfMan.get("path"));
@@ -210,6 +212,11 @@ Common::HashMap<Common::String, Score *> DirectorEngine::loadMMMNames(Common::St
if (!movies.empty()) {
for (Common::FSList::const_iterator i = movies.begin(); i != movies.end(); ++i) {
+ if (i->getName() == _sharedMMM) {
+ loadSharedCastsFrom(i->getPath());
+ continue;
+ }
+
RIFFArchive *arc = new RIFFArchive();
arc->openFile(i->getPath());
Score *sc = new Score(this);
@@ -402,6 +409,15 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) {
_sharedSTXT[*iterator] = shardcst->getResource(MKTAG('S','T','X','T'), *iterator);
}
}
+
+ Common::Array<uint16> sound = shardcst->getResourceIDList(MKTAG('S','N','D',' '));
+
+ if (stxt.size() != 0) {
+ Common::Array<uint16>::iterator iterator;
+ for (iterator = sound.begin(); iterator != sound.end(); ++iterator) {
+ _sharedSTXT[*iterator] = shardcst->getResource(MKTAG('S','N','D',' '), *iterator);
+ }
+ }
}
} // End of namespace Director
diff --git a/engines/director/director.h b/engines/director/director.h
index 0e76cd9..82c43fd 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -91,9 +91,13 @@ private:
void loadMac();
Common::String readPascalString(Common::SeekableReadStream &stream);
+
+ Common::String _sharedMMM;
Common::HashMap<int, Cast *> _sharedCasts;
Common::HashMap<int, Common::SeekableReadStream *> _sharedDIB;
Common::HashMap<int, Common::SeekableReadStream *> _sharedSTXT;
+ Common::HashMap<int, Common::SeekableReadStream *> _sharedSound;
+
Archive *_mainArchive;
Common::MacResManager *_macBinary;
DirectorSound *_soundManager;
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index b334caf..7b26a95 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -676,7 +676,7 @@ void Score::update() {
Common::SortedArray<Label *>::iterator i;
for (i = _labels->begin(); i != _labels->end(); ++i) {
- if ((*i)->number = _currentFrame) {
+ if ((*i)->number == _currentFrame) {
_currentLabel = (*i)->name;
}
}
Commit: 7013f6bb40d9be0b3620ab331be4d4d1b60ac477
https://github.com/scummvm/scummvm/commit/7013f6bb40d9be0b3620ab331be4d4d1b60ac477
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implemented 'global' keyword. Start of local/global var implementation
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 92cb994..349b51f 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -424,4 +424,24 @@ void Lingo::c_procret() {
g_lingo->_returning = true;
}
+void Lingo::c_global() {
+ Common::String name((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
+
+ Symbol *s = g_lingo->lookupVar(name.c_str(), false);
+ if (s) {
+ if (s->global) {
+ warning("Redefinition of global variable %s", name.c_str());
+ } else {
+ warning("Local variable %s declared as global", name.c_str());
+ }
+
+ return;
+ }
+
+ s = g_lingo->lookupVar(name.c_str(), true, false);
+ s->global = true;
+
+ g_lingo->_pc += g_lingo->calcStringAlignment(name.c_str());
+}
+
}
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 581b1c1..8473f2e 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -64,10 +64,13 @@ void Lingo::execute(int pc) {
}
}
-Symbol *Lingo::lookupVar(const char *name) {
+Symbol *Lingo::lookupVar(const char *name, bool create, bool putInLocalList) {
Symbol *sym;
if (!_vars.contains(name)) { // Create variable if it was not defined
+ if (!create)
+ return NULL;
+
sym = new Symbol;
sym->name = (char *)calloc(strlen(name) + 1, 1);
Common::strlcpy(sym->name, name, strlen(name) + 1);
@@ -79,6 +82,9 @@ Symbol *Lingo::lookupVar(const char *name) {
sym = g_lingo->_vars[name];
}
+ if (putInLocalList)
+ _localvars[name] = true;
+
return sym;
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 2376625..80229c7 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -79,30 +79,31 @@
tEND = 268,
tEXIT = 269,
tFRAME = 270,
- tGO = 271,
- tIF = 272,
- tINTO = 273,
- tLOOP = 274,
- tMACRO = 275,
- tMCI = 276,
- tMCIWAIT = 277,
- tMOVIE = 278,
- tNEXT = 279,
- tOF = 280,
- tPREVIOUS = 281,
- tPUT = 282,
- tREPEAT = 283,
- tSET = 284,
- tTHEN = 285,
- tTO = 286,
- tWITH = 287,
- tWHILE = 288,
- tGE = 289,
- tLE = 290,
- tGT = 291,
- tLT = 292,
- tEQ = 293,
- tNEQ = 294
+ tGLOBAL = 271,
+ tGO = 272,
+ tIF = 273,
+ tINTO = 274,
+ tLOOP = 275,
+ tMACRO = 276,
+ tMCI = 277,
+ tMCIWAIT = 278,
+ tMOVIE = 279,
+ tNEXT = 280,
+ tOF = 281,
+ tPREVIOUS = 282,
+ tPUT = 283,
+ tREPEAT = 284,
+ tSET = 285,
+ tTHEN = 286,
+ tTO = 287,
+ tWITH = 288,
+ tWHILE = 289,
+ tGE = 290,
+ tLE = 291,
+ tGT = 292,
+ tLT = 293,
+ tEQ = 294,
+ tNEQ = 295
};
#endif
/* Tokens. */
@@ -119,30 +120,31 @@
#define tEND 268
#define tEXIT 269
#define tFRAME 270
-#define tGO 271
-#define tIF 272
-#define tINTO 273
-#define tLOOP 274
-#define tMACRO 275
-#define tMCI 276
-#define tMCIWAIT 277
-#define tMOVIE 278
-#define tNEXT 279
-#define tOF 280
-#define tPREVIOUS 281
-#define tPUT 282
-#define tREPEAT 283
-#define tSET 284
-#define tTHEN 285
-#define tTO 286
-#define tWITH 287
-#define tWHILE 288
-#define tGE 289
-#define tLE 290
-#define tGT 291
-#define tLT 292
-#define tEQ 293
-#define tNEQ 294
+#define tGLOBAL 271
+#define tGO 272
+#define tIF 273
+#define tINTO 274
+#define tLOOP 275
+#define tMACRO 276
+#define tMCI 277
+#define tMCIWAIT 278
+#define tMOVIE 279
+#define tNEXT 280
+#define tOF 281
+#define tPREVIOUS 282
+#define tPUT 283
+#define tREPEAT 284
+#define tSET 285
+#define tTHEN 286
+#define tTO 287
+#define tWITH 288
+#define tWHILE 289
+#define tGE 290
+#define tLE 291
+#define tGT 292
+#define tLT 293
+#define tEQ 294
+#define tNEQ 295
@@ -194,7 +196,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 198 "engines/director/lingo/lingo-gr.cpp"
+#line 200 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -207,7 +209,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 211 "engines/director/lingo/lingo-gr.cpp"
+#line 213 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -420,22 +422,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 53
+#define YYFINAL 55
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 257
+#define YYLAST 264
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 52
+#define YYNTOKENS 53
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 23
/* YYNRULES -- Number of rules. */
-#define YYNRULES 76
+#define YYNRULES 77
/* YYNRULES -- Number of states. */
-#define YYNSTATES 158
+#define YYNSTATES 160
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 294
+#define YYMAXUTOK 295
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -444,12 +446,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 46, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 47, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 45, 2, 2,
- 47, 48, 43, 41, 51, 42, 2, 44, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 46, 2, 2,
+ 48, 49, 44, 42, 52, 43, 2, 45, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 50, 40, 49, 2, 2, 2, 2, 2, 2, 2,
+ 51, 41, 50, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -472,7 +474,7 @@ static const yytype_uint8 yytranslate[] =
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39
+ 35, 36, 37, 38, 39, 40
};
#if YYDEBUG
@@ -485,41 +487,42 @@ static const yytype_uint16 yyprhs[] =
81, 94, 96, 100, 104, 107, 111, 113, 114, 115,
116, 119, 122, 124, 126, 128, 132, 136, 140, 144,
148, 152, 156, 160, 164, 167, 170, 174, 179, 182,
- 185, 188, 190, 192, 195, 198, 201, 204, 208, 211,
- 215, 218, 221, 223, 227, 230, 234, 235, 244, 245,
- 247, 251, 256, 257, 261, 262, 264
+ 185, 188, 190, 192, 195, 198, 201, 204, 207, 211,
+ 214, 218, 221, 224, 226, 230, 233, 237, 238, 247,
+ 248, 250, 254, 259, 260, 264, 265, 267
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 53, 0, -1, 54, 46, 53, -1, 54, -1, -1,
- 69, -1, 65, -1, 73, -1, 55, -1, 56, -1,
- 1, -1, 27, 64, 18, 8, -1, 29, 8, 40,
- 64, -1, 29, 8, 31, 64, -1, 64, -1, 65,
- -1, 60, 57, 30, 63, 62, 13, 17, -1, 60,
- 57, 30, 63, 62, 12, 63, 62, 13, 17, -1,
- 58, 47, 57, 48, 63, 62, 13, 28, -1, 59,
- 40, 64, 62, 31, 64, 62, 63, 62, 13, 28,
- -1, 59, 40, 64, 62, 11, 31, 64, 62, 63,
- 62, 13, 28, -1, 64, -1, 64, 40, 64, -1,
- 47, 57, 48, -1, 28, 33, -1, 28, 32, 8,
- -1, 17, -1, -1, -1, -1, 63, 46, -1, 63,
- 56, -1, 6, -1, 8, -1, 55, -1, 64, 41,
- 64, -1, 64, 42, 64, -1, 64, 43, 64, -1,
- 64, 44, 64, -1, 64, 49, 64, -1, 64, 50,
- 64, -1, 64, 39, 64, -1, 64, 34, 64, -1,
- 64, 35, 64, -1, 41, 64, -1, 42, 64, -1,
- 47, 64, 48, -1, 8, 47, 74, 48, -1, 21,
- 9, -1, 22, 8, -1, 27, 64, -1, 66, -1,
- 14, -1, 16, 19, -1, 16, 24, -1, 16, 26,
- -1, 16, 67, -1, 16, 67, 68, -1, 16, 68,
- -1, 31, 15, 9, -1, 15, 9, -1, 31, 9,
- -1, 9, -1, 25, 23, 9, -1, 23, 9, -1,
- 31, 23, 9, -1, -1, 20, 8, 70, 61, 71,
- 46, 72, 63, -1, -1, 8, -1, 71, 51, 8,
- -1, 71, 46, 51, 8, -1, -1, 8, 61, 74,
- -1, -1, 64, -1, 74, 51, 64, -1
+ 54, 0, -1, 55, 47, 54, -1, 55, -1, -1,
+ 70, -1, 66, -1, 74, -1, 56, -1, 57, -1,
+ 1, -1, 28, 65, 19, 8, -1, 30, 8, 41,
+ 65, -1, 30, 8, 32, 65, -1, 65, -1, 66,
+ -1, 61, 58, 31, 64, 63, 13, 18, -1, 61,
+ 58, 31, 64, 63, 12, 64, 63, 13, 18, -1,
+ 59, 48, 58, 49, 64, 63, 13, 29, -1, 60,
+ 41, 65, 63, 32, 65, 63, 64, 63, 13, 29,
+ -1, 60, 41, 65, 63, 11, 32, 65, 63, 64,
+ 63, 13, 29, -1, 65, -1, 65, 41, 65, -1,
+ 48, 58, 49, -1, 29, 34, -1, 29, 33, 8,
+ -1, 18, -1, -1, -1, -1, 64, 47, -1, 64,
+ 57, -1, 6, -1, 8, -1, 56, -1, 65, 42,
+ 65, -1, 65, 43, 65, -1, 65, 44, 65, -1,
+ 65, 45, 65, -1, 65, 50, 65, -1, 65, 51,
+ 65, -1, 65, 40, 65, -1, 65, 35, 65, -1,
+ 65, 36, 65, -1, 42, 65, -1, 43, 65, -1,
+ 48, 65, 49, -1, 8, 48, 75, 49, -1, 22,
+ 9, -1, 23, 8, -1, 28, 65, -1, 67, -1,
+ 14, -1, 16, 8, -1, 17, 20, -1, 17, 25,
+ -1, 17, 27, -1, 17, 68, -1, 17, 68, 69,
+ -1, 17, 69, -1, 32, 15, 9, -1, 15, 9,
+ -1, 32, 9, -1, 9, -1, 26, 24, 9, -1,
+ 24, 9, -1, 32, 24, 9, -1, -1, 21, 8,
+ 71, 62, 72, 47, 73, 64, -1, -1, 8, -1,
+ 72, 52, 8, -1, 72, 47, 52, 8, -1, -1,
+ 8, 62, 75, -1, -1, 65, -1, 75, 52, 65,
+ -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -530,9 +533,9 @@ static const yytype_uint16 yyrline[] =
172, 186, 187, 188, 190, 192, 198, 200, 202, 204,
205, 206, 209, 214, 217, 218, 219, 220, 221, 222,
223, 224, 225, 226, 227, 228, 229, 232, 238, 239,
- 240, 241, 242, 253, 254, 255, 256, 261, 267, 274,
- 275, 276, 277, 280, 281, 282, 310, 310, 316, 317,
- 318, 319, 321, 324, 332, 333, 334
+ 240, 241, 242, 243, 254, 255, 256, 257, 262, 268,
+ 275, 276, 277, 278, 281, 282, 283, 311, 311, 317,
+ 318, 319, 320, 322, 325, 333, 334, 335
};
#endif
@@ -543,14 +546,14 @@ static const char *const yytname[] =
{
"$end", "error", "$undefined", "UNARY", "VOID", "VAR", "INT", "FLOAT",
"ID", "STRING", "HANDLER", "tDOWN", "tELSE", "tEND", "tEXIT", "tFRAME",
- "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE",
- "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO",
- "tWITH", "tWHILE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='",
- "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'",
- "','", "$accept", "program", "programline", "asgn", "stmt", "cond",
- "repeatwhile", "repeatwith", "if", "begin", "end", "stmtlist", "expr",
- "func", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "argdef",
- "argstore", "macro", "arglist", 0
+ "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT",
+ "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT", "tSET",
+ "tTHEN", "tTO", "tWITH", "tWHILE", "tGE", "tLE", "tGT", "tLT", "tEQ",
+ "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'",
+ "'>'", "'<'", "','", "$accept", "program", "programline", "asgn", "stmt",
+ "cond", "repeatwhile", "repeatwith", "if", "begin", "end", "stmtlist",
+ "expr", "func", "gotofunc", "gotoframe", "gotomovie", "defn", "@1",
+ "argdef", "argstore", "macro", "arglist", 0
};
#endif
@@ -563,22 +566,22 @@ static const yytype_uint16 yytoknum[] =
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 61, 43, 45, 42, 47, 37, 10, 40, 41, 62,
- 60, 44
+ 295, 61, 43, 45, 42, 47, 37, 10, 40, 41,
+ 62, 60, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 52, 53, 53, 54, 54, 54, 54, 54, 54,
- 54, 55, 55, 55, 56, 56, 56, 56, 56, 56,
- 56, 57, 57, 57, 58, 59, 60, 61, 62, 63,
- 63, 63, 64, 64, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 64, 64, 64, 64, 65, 65, 65,
- 65, 65, 65, 66, 66, 66, 66, 66, 66, 67,
- 67, 67, 67, 68, 68, 68, 70, 69, 71, 71,
- 71, 71, 72, 73, 74, 74, 74
+ 0, 53, 54, 54, 55, 55, 55, 55, 55, 55,
+ 55, 56, 56, 56, 57, 57, 57, 57, 57, 57,
+ 57, 58, 58, 58, 59, 60, 61, 62, 63, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 66, 66, 66,
+ 66, 66, 66, 66, 67, 67, 67, 67, 67, 67,
+ 68, 68, 68, 68, 69, 69, 69, 71, 70, 72,
+ 72, 72, 72, 73, 74, 75, 75, 75
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -589,9 +592,9 @@ static const yytype_uint8 yyr2[] =
12, 1, 3, 3, 2, 3, 1, 0, 0, 0,
2, 2, 1, 1, 1, 3, 3, 3, 3, 3,
3, 3, 3, 3, 2, 2, 3, 4, 2, 2,
- 2, 1, 1, 2, 2, 2, 2, 3, 2, 3,
- 2, 2, 1, 3, 2, 3, 0, 8, 0, 1,
- 3, 4, 0, 3, 0, 1, 3
+ 2, 1, 1, 2, 2, 2, 2, 2, 3, 2,
+ 3, 2, 2, 1, 3, 2, 3, 0, 8, 0,
+ 1, 3, 4, 0, 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -599,61 +602,61 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 10, 32, 27, 52, 0, 26, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 34, 9,
- 0, 0, 0, 14, 6, 51, 5, 7, 74, 74,
- 62, 0, 53, 0, 54, 0, 55, 0, 56, 58,
- 66, 48, 49, 33, 0, 34, 50, 0, 24, 0,
- 44, 45, 0, 1, 0, 0, 0, 0, 0, 21,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 75,
- 0, 73, 60, 64, 0, 61, 0, 0, 0, 57,
- 27, 0, 0, 25, 0, 0, 46, 2, 0, 28,
- 0, 0, 29, 0, 42, 43, 41, 35, 36, 37,
- 38, 39, 40, 47, 0, 63, 59, 65, 68, 11,
- 13, 12, 29, 0, 23, 28, 22, 76, 69, 0,
- 28, 0, 0, 33, 30, 31, 0, 15, 72, 0,
- 0, 0, 28, 29, 0, 0, 29, 70, 0, 28,
- 29, 28, 16, 71, 67, 18, 29, 28, 0, 28,
- 0, 0, 0, 0, 17, 0, 19, 20
+ 0, 10, 32, 27, 52, 0, 0, 26, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 34,
+ 9, 0, 0, 0, 14, 6, 51, 5, 7, 75,
+ 75, 53, 63, 0, 54, 0, 55, 0, 56, 0,
+ 57, 59, 67, 48, 49, 33, 0, 34, 50, 0,
+ 24, 0, 44, 45, 0, 1, 0, 0, 0, 0,
+ 0, 21, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 76, 0, 74, 61, 65, 0, 62, 0, 0,
+ 0, 58, 27, 0, 0, 25, 0, 0, 46, 2,
+ 0, 28, 0, 0, 29, 0, 42, 43, 41, 35,
+ 36, 37, 38, 39, 40, 47, 0, 64, 60, 66,
+ 69, 11, 13, 12, 29, 0, 23, 28, 22, 77,
+ 70, 0, 28, 0, 0, 33, 30, 31, 0, 15,
+ 73, 0, 0, 0, 28, 29, 0, 0, 29, 71,
+ 0, 28, 29, 28, 16, 72, 68, 18, 29, 28,
+ 0, 28, 0, 0, 0, 0, 17, 0, 19, 20
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 16, 17, 45, 125, 58, 20, 21, 22, 29,
- 113, 115, 23, 127, 25, 38, 39, 26, 80, 119,
- 136, 27, 70
+ -1, 17, 18, 47, 127, 60, 21, 22, 23, 30,
+ 115, 117, 24, 129, 26, 40, 41, 27, 82, 121,
+ 138, 28, 72
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -107
+#define YYPACT_NINF -108
static const yytype_int16 yypact[] =
{
- 64, -107, -107, 188, -107, 13, -107, -7, 4, 17,
- 61, 44, 32, 61, 61, 61, 42, 3, 2, -107,
- 12, 23, 108, 176, -107, -107, -107, -107, 61, 61,
- -107, 57, -107, 59, -107, 48, -107, 104, -8, -107,
- -107, -107, -107, -107, 61, -107, 128, 65, -107, -20,
- 207, 207, 152, -107, 64, 108, 61, 108, 49, 164,
- 61, 61, 61, 61, 61, 61, 61, 61, 61, 176,
- -24, 31, -107, -107, 78, -107, 80, 88, 75, -107,
- -107, 128, 91, -107, 61, 61, -107, -107, 52, 176,
- 53, 140, -107, 61, 176, 176, 176, 205, 205, 207,
- 207, 176, 176, -107, 61, -107, -107, -107, 96, -107,
- 176, 176, -107, -1, -107, 101, 176, 176, -107, -30,
- 101, 89, 61, 77, -107, -107, 83, -107, 74, 118,
- 120, 61, 176, -107, 114, 126, -107, -107, 110, 176,
- -107, 101, -107, -107, 101, -107, -107, 101, 123, 101,
- 127, 122, 131, 113, -107, 117, -107, -107
+ 82, -108, -108, 196, -108, 1, 5, -108, 13, 4,
+ 25, 37, 27, 42, 37, 37, 37, 74, 31, 2,
+ -108, 38, 46, 111, 184, -108, -108, -108, -108, 37,
+ 37, -108, -108, 84, -108, 93, -108, 67, -108, 57,
+ 45, -108, -108, -108, -108, -108, 37, -108, 136, 98,
+ -108, -15, -12, -12, 160, -108, 82, 111, 37, 111,
+ 77, 172, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 184, 40, 62, -108, -108, 100, -108, 106, 107,
+ 94, -108, -108, 136, 112, -108, 37, 37, -108, -108,
+ 72, 184, 78, 148, -108, 37, 184, 184, 184, 213,
+ 213, -12, -12, 184, 184, -108, 37, -108, -108, -108,
+ 115, -108, 184, 184, -108, -10, -108, 120, 184, 184,
+ -108, -36, 120, 99, 37, 85, -108, -108, 28, -108,
+ 80, 127, 131, 37, 184, -108, 122, 137, -108, -108,
+ 117, 184, -108, 120, -108, -108, 120, -108, -108, 120,
+ 134, 120, 138, 139, 143, 123, -108, 129, -108, -108
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -107, 97, -107, 6, 7, -26, -107, -107, -107, 72,
- -106, 20, -10, 8, -107, -107, 116, -107, -107, -107,
- -107, -107, 129
+ -108, 104, -108, 6, 7, 11, -108, -108, -108, 79,
+ -107, -41, -11, 8, -108, -108, 124, -108, -108, -108,
+ -108, -108, 135
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -663,84 +666,86 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -34
static const yytype_int16 yytable[] =
{
- 46, 40, -8, 50, 51, 52, 18, 19, 24, 126,
- 121, 84, 59, 41, 130, 33, 128, 35, 69, 69,
- 85, 129, 30, 78, 103, 42, 140, 104, 31, 88,
- 122, 90, 32, 146, 81, 148, 33, 34, 35, 36,
- 49, 150, 53, 152, 37, 59, 89, 91, -8, 54,
- 94, 95, 96, 97, 98, 99, 100, 101, 102, 55,
- 18, 19, 24, 56, -4, 1, 72, 2, 73, 43,
- 2, 74, 3, 83, 110, 111, 47, 48, 4, 92,
- 5, 6, 104, 116, 7, 8, 9, 105, 44, 106,
- 12, 10, 11, 12, 117, 133, 134, 107, 77, 109,
- 112, 114, 13, 14, 118, 13, 14, 2, 15, 123,
- -4, 15, 132, 75, 2, 4, 43, 5, 6, 76,
- 131, 139, 8, 9, 28, 135, 137, 77, 10, 11,
- 12, 142, 120, 138, 143, 44, 151, 12, 145, 154,
- 153, 156, 13, 14, 155, 157, 82, 124, 15, 13,
- 14, 87, 108, 141, 79, 57, 144, 0, 71, 0,
- 147, 0, 60, 61, 0, 0, 149, 62, 0, 63,
- 64, 65, 66, 0, 60, 61, 0, 67, 68, 62,
- 93, 63, 64, 65, 66, 0, 60, 61, 86, 67,
- 68, 62, 0, 63, 64, 65, 66, 0, 60, 61,
- 86, 67, 68, 62, 93, 63, 64, 65, 66, 0,
- 60, 61, 0, 67, 68, 62, 0, 63, 64, 65,
- 66, 0, -33, -33, 0, 67, 68, -33, 0, 0,
- 0, -33, -33, 0, 0, 28, 0, -33, -33, 60,
- 61, 60, 61, 0, 62, 0, 62, 0, 65, 66,
- 0, 0, 0, 0, 67, 68, 67, 68
+ 48, 123, -8, 52, 53, 54, 19, 20, 25, 31,
+ 128, 130, 61, 43, 32, 132, 131, 86, 71, 71,
+ 33, 42, 124, 62, 63, 34, 87, 142, 64, 35,
+ 36, 37, 38, 44, 148, 83, 150, 39, 69, 70,
+ 135, 136, 152, 2, 154, 45, 61, 91, 93, -8,
+ 51, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ 49, 50, 19, 20, 25, 46, 77, 13, 90, 35,
+ 92, 37, 78, 122, 55, 112, 113, 80, 56, 14,
+ 15, 79, -4, 1, 118, 16, 57, 58, 2, 105,
+ 3, 76, 106, 74, 143, 119, 4, 146, 5, 6,
+ 7, 149, 75, 8, 9, 10, 85, 151, 94, 107,
+ 11, 12, 13, 134, 106, 108, 109, 2, 79, 45,
+ 111, 114, 141, 120, 14, 15, 2, 116, 125, -4,
+ 16, 133, 137, 29, 4, 139, 5, 6, 7, 46,
+ 144, 13, 9, 10, 140, 145, 147, 153, 11, 12,
+ 13, 155, 158, 14, 15, 84, 157, 156, 159, 59,
+ 89, 110, 14, 15, 81, 73, 0, 126, 16, 0,
+ 0, 62, 63, 0, 0, 0, 64, 0, 65, 66,
+ 67, 68, 0, 62, 63, 0, 69, 70, 64, 95,
+ 65, 66, 67, 68, 0, 62, 63, 88, 69, 70,
+ 64, 0, 65, 66, 67, 68, 0, 62, 63, 88,
+ 69, 70, 64, 95, 65, 66, 67, 68, 0, 62,
+ 63, 0, 69, 70, 64, 0, 65, 66, 67, 68,
+ 0, -33, -33, 0, 69, 70, -33, 0, 0, 0,
+ -33, -33, 0, 0, 29, 0, -33, -33, 62, 63,
+ 0, 0, 0, 64, 0, 0, 0, 67, 68, 0,
+ 0, 0, 0, 69, 70
};
static const yytype_int16 yycheck[] =
{
- 10, 8, 0, 13, 14, 15, 0, 0, 0, 115,
- 11, 31, 22, 9, 120, 23, 46, 25, 28, 29,
- 40, 51, 9, 31, 48, 8, 132, 51, 15, 55,
- 31, 57, 19, 139, 44, 141, 23, 24, 25, 26,
- 8, 147, 0, 149, 31, 55, 56, 57, 46, 46,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 47,
- 54, 54, 54, 40, 0, 1, 9, 6, 9, 8,
- 6, 23, 8, 8, 84, 85, 32, 33, 14, 30,
- 16, 17, 51, 93, 20, 21, 22, 9, 27, 9,
- 29, 27, 28, 29, 104, 12, 13, 9, 23, 8,
- 48, 48, 41, 42, 8, 41, 42, 6, 47, 8,
- 46, 47, 122, 9, 6, 14, 8, 16, 17, 15,
- 31, 131, 21, 22, 47, 51, 8, 23, 27, 28,
- 29, 17, 112, 13, 8, 27, 13, 29, 28, 17,
- 13, 28, 41, 42, 13, 28, 18, 46, 47, 41,
- 42, 54, 80, 133, 38, 47, 136, -1, 29, -1,
- 140, -1, 34, 35, -1, -1, 146, 39, -1, 41,
- 42, 43, 44, -1, 34, 35, -1, 49, 50, 39,
- 40, 41, 42, 43, 44, -1, 34, 35, 48, 49,
- 50, 39, -1, 41, 42, 43, 44, -1, 34, 35,
- 48, 49, 50, 39, 40, 41, 42, 43, 44, -1,
- 34, 35, -1, 49, 50, 39, -1, 41, 42, 43,
- 44, -1, 34, 35, -1, 49, 50, 39, -1, -1,
- -1, 43, 44, -1, -1, 47, -1, 49, 50, 34,
- 35, 34, 35, -1, 39, -1, 39, -1, 43, 44,
- -1, -1, -1, -1, 49, 50, 49, 50
+ 11, 11, 0, 14, 15, 16, 0, 0, 0, 8,
+ 117, 47, 23, 9, 9, 122, 52, 32, 29, 30,
+ 15, 8, 32, 35, 36, 20, 41, 134, 40, 24,
+ 25, 26, 27, 8, 141, 46, 143, 32, 50, 51,
+ 12, 13, 149, 6, 151, 8, 57, 58, 59, 47,
+ 8, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+ 33, 34, 56, 56, 56, 28, 9, 30, 57, 24,
+ 59, 26, 15, 114, 0, 86, 87, 32, 47, 42,
+ 43, 24, 0, 1, 95, 48, 48, 41, 6, 49,
+ 8, 24, 52, 9, 135, 106, 14, 138, 16, 17,
+ 18, 142, 9, 21, 22, 23, 8, 148, 31, 9,
+ 28, 29, 30, 124, 52, 9, 9, 6, 24, 8,
+ 8, 49, 133, 8, 42, 43, 6, 49, 8, 47,
+ 48, 32, 52, 48, 14, 8, 16, 17, 18, 28,
+ 18, 30, 22, 23, 13, 8, 29, 13, 28, 29,
+ 30, 13, 29, 42, 43, 19, 13, 18, 29, 48,
+ 56, 82, 42, 43, 40, 30, -1, 47, 48, -1,
+ -1, 35, 36, -1, -1, -1, 40, -1, 42, 43,
+ 44, 45, -1, 35, 36, -1, 50, 51, 40, 41,
+ 42, 43, 44, 45, -1, 35, 36, 49, 50, 51,
+ 40, -1, 42, 43, 44, 45, -1, 35, 36, 49,
+ 50, 51, 40, 41, 42, 43, 44, 45, -1, 35,
+ 36, -1, 50, 51, 40, -1, 42, 43, 44, 45,
+ -1, 35, 36, -1, 50, 51, 40, -1, -1, -1,
+ 44, 45, -1, -1, 48, -1, 50, 51, 35, 36,
+ -1, -1, -1, 40, -1, -1, -1, 44, 45, -1,
+ -1, -1, -1, 50, 51
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 6, 8, 14, 16, 17, 20, 21, 22,
- 27, 28, 29, 41, 42, 47, 53, 54, 55, 56,
- 58, 59, 60, 64, 65, 66, 69, 73, 47, 61,
- 9, 15, 19, 23, 24, 25, 26, 31, 67, 68,
- 8, 9, 8, 8, 27, 55, 64, 32, 33, 8,
- 64, 64, 64, 0, 46, 47, 40, 47, 57, 64,
- 34, 35, 39, 41, 42, 43, 44, 49, 50, 64,
- 74, 74, 9, 9, 23, 9, 15, 23, 31, 68,
- 70, 64, 18, 8, 31, 40, 48, 53, 57, 64,
- 57, 64, 30, 40, 64, 64, 64, 64, 64, 64,
- 64, 64, 64, 48, 51, 9, 9, 9, 61, 8,
- 64, 64, 48, 62, 48, 63, 64, 64, 8, 71,
- 63, 11, 31, 8, 46, 56, 62, 65, 46, 51,
- 62, 31, 64, 12, 13, 51, 72, 8, 13, 64,
- 62, 63, 17, 8, 63, 28, 62, 63, 62, 63,
- 62, 13, 62, 13, 17, 13, 28, 28
+ 0, 1, 6, 8, 14, 16, 17, 18, 21, 22,
+ 23, 28, 29, 30, 42, 43, 48, 54, 55, 56,
+ 57, 59, 60, 61, 65, 66, 67, 70, 74, 48,
+ 62, 8, 9, 15, 20, 24, 25, 26, 27, 32,
+ 68, 69, 8, 9, 8, 8, 28, 56, 65, 33,
+ 34, 8, 65, 65, 65, 0, 47, 48, 41, 48,
+ 58, 65, 35, 36, 40, 42, 43, 44, 45, 50,
+ 51, 65, 75, 75, 9, 9, 24, 9, 15, 24,
+ 32, 69, 71, 65, 19, 8, 32, 41, 49, 54,
+ 58, 65, 58, 65, 31, 41, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 49, 52, 9, 9, 9,
+ 62, 8, 65, 65, 49, 63, 49, 64, 65, 65,
+ 8, 72, 64, 11, 32, 8, 47, 57, 63, 66,
+ 47, 52, 63, 32, 65, 12, 13, 52, 73, 8,
+ 13, 65, 63, 64, 18, 8, 64, 29, 63, 64,
+ 63, 64, 63, 13, 63, 13, 18, 13, 29, 29
};
#define yyerrok (yyerrstatus = 0)
@@ -1814,22 +1819,27 @@ yyreduce:
break;
case 53:
-#line 253 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoloop); ;}
+#line 243 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 54:
#line 254 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotonext); ;}
+ { g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 55:
#line 255 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoprevious); ;}
+ { g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 56:
#line 256 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gotoprevious); ;}
+ break;
+
+ case 57:
+#line 257 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1837,8 +1847,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 57:
-#line 261 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 262 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1847,8 +1857,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 58:
-#line 267 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 268 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1856,14 +1866,9 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 59:
-#line 274 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
- break;
-
case 60:
#line 275 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 61:
@@ -1873,64 +1878,69 @@ yyreduce:
case 62:
#line 277 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 63:
-#line 280 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 278 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 64:
#line 281 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 65:
#line 282 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 66:
-#line 310 "engines/director/lingo/lingo-gr.y"
- { g_lingo->_indef = true; ;}
+#line 283 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 67:
#line 311 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->_indef = true; ;}
+ break;
+
+ case 68:
+#line 312 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*(yyvsp[(2) - (8)].s), (yyvsp[(4) - (8)].code), (yyvsp[(5) - (8)].narg));
g_lingo->_indef = false; ;}
break;
- case 68:
-#line 316 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 0; ;}
- break;
-
case 69:
#line 317 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
+ { (yyval.narg) = 0; ;}
break;
case 70:
#line 318 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
+ { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 71:
#line 319 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
+ { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 72:
-#line 321 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArgStore(); ;}
+#line 320 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 73:
-#line 324 "engines/director/lingo/lingo-gr.y"
+#line 322 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArgStore(); ;}
+ break;
+
+ case 74:
+#line 325 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -1939,24 +1949,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 74:
-#line 332 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 0; ;}
- break;
-
case 75:
#line 333 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 1; ;}
+ { (yyval.narg) = 0; ;}
break;
case 76:
#line 334 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = 1; ;}
+ break;
+
+ case 77:
+#line 335 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 1960 "engines/director/lingo/lingo-gr.cpp"
+#line 1970 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2170,6 +2180,6 @@ yyreturn:
}
-#line 337 "engines/director/lingo/lingo-gr.y"
+#line 338 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index bdef89f..efc1e80 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -52,30 +52,31 @@
tEND = 268,
tEXIT = 269,
tFRAME = 270,
- tGO = 271,
- tIF = 272,
- tINTO = 273,
- tLOOP = 274,
- tMACRO = 275,
- tMCI = 276,
- tMCIWAIT = 277,
- tMOVIE = 278,
- tNEXT = 279,
- tOF = 280,
- tPREVIOUS = 281,
- tPUT = 282,
- tREPEAT = 283,
- tSET = 284,
- tTHEN = 285,
- tTO = 286,
- tWITH = 287,
- tWHILE = 288,
- tGE = 289,
- tLE = 290,
- tGT = 291,
- tLT = 292,
- tEQ = 293,
- tNEQ = 294
+ tGLOBAL = 271,
+ tGO = 272,
+ tIF = 273,
+ tINTO = 274,
+ tLOOP = 275,
+ tMACRO = 276,
+ tMCI = 277,
+ tMCIWAIT = 278,
+ tMOVIE = 279,
+ tNEXT = 280,
+ tOF = 281,
+ tPREVIOUS = 282,
+ tPUT = 283,
+ tREPEAT = 284,
+ tSET = 285,
+ tTHEN = 286,
+ tTO = 287,
+ tWITH = 288,
+ tWHILE = 289,
+ tGE = 290,
+ tLE = 291,
+ tGT = 292,
+ tLT = 293,
+ tEQ = 294,
+ tNEQ = 295
};
#endif
/* Tokens. */
@@ -92,30 +93,31 @@
#define tEND 268
#define tEXIT 269
#define tFRAME 270
-#define tGO 271
-#define tIF 272
-#define tINTO 273
-#define tLOOP 274
-#define tMACRO 275
-#define tMCI 276
-#define tMCIWAIT 277
-#define tMOVIE 278
-#define tNEXT 279
-#define tOF 280
-#define tPREVIOUS 281
-#define tPUT 282
-#define tREPEAT 283
-#define tSET 284
-#define tTHEN 285
-#define tTO 286
-#define tWITH 287
-#define tWHILE 288
-#define tGE 289
-#define tLE 290
-#define tGT 291
-#define tLT 292
-#define tEQ 293
-#define tNEQ 294
+#define tGLOBAL 271
+#define tGO 272
+#define tIF 273
+#define tINTO 274
+#define tLOOP 275
+#define tMACRO 276
+#define tMCI 277
+#define tMCIWAIT 278
+#define tMOVIE 279
+#define tNEXT 280
+#define tOF 281
+#define tPREVIOUS 282
+#define tPUT 283
+#define tREPEAT 284
+#define tSET 285
+#define tTHEN 286
+#define tTO 287
+#define tWITH 288
+#define tWHILE 289
+#define tGE 290
+#define tLE 291
+#define tGT 292
+#define tLT 293
+#define tEQ 294
+#define tNEQ 295
@@ -131,7 +133,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 135 "engines/director/lingo/lingo-gr.hpp"
+#line 137 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 3c716a5..2084c70 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -74,7 +74,7 @@ using namespace Director;
%token<i> INT
%token<f> FLOAT
%token<s> ID STRING HANDLER
-%token tDOWN tELSE tEND tEXIT tFRAME tGO tIF tINTO tLOOP tMACRO tMCI tMCIWAIT
+%token tDOWN tELSE tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO tMCI tMCIWAIT
%token tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO tWITH tWHILE
%token tGE tLE tGT tLT tEQ tNEQ
@@ -240,6 +240,7 @@ func: ID '(' arglist ')' {
| tPUT expr { g_lingo->code1(g_lingo->c_printtop); }
| gotofunc
| tEXIT { g_lingo->code1(g_lingo->c_exit); }
+ | tGLOBAL ID { g_lingo->code1(g_lingo->c_global); g_lingo->codeString($2->c_str()); delete $2; }
;
// go {to} {frame} whichFrame {of movie whichMovie}
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 535daac..48f7152 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 37
-#define YY_END_OF_BUFFER 38
+#define YY_NUM_RULES 38
+#define YY_END_OF_BUFFER 39
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,21 +373,21 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[116] =
+static yyconst flex_int16_t yy_accept[121] =
{ 0,
- 0, 0, 38, 36, 3, 34, 34, 36, 36, 36,
- 33, 33, 32, 33, 33, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
- 2, 2, 3, 34, 0, 27, 0, 35, 1, 31,
- 32, 29, 28, 30, 30, 30, 30, 30, 30, 10,
- 5, 30, 30, 30, 30, 30, 30, 18, 30, 30,
- 30, 30, 30, 24, 30, 30, 1, 31, 30, 30,
- 7, 30, 30, 30, 30, 30, 14, 30, 30, 30,
- 20, 30, 22, 30, 30, 30, 4, 6, 8, 30,
- 11, 12, 30, 30, 30, 17, 30, 30, 23, 30,
-
- 25, 9, 13, 30, 16, 30, 30, 26, 30, 30,
- 21, 15, 30, 19, 0
+ 0, 0, 39, 37, 3, 35, 35, 37, 37, 37,
+ 34, 34, 33, 34, 34, 31, 31, 31, 31, 31,
+ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
+ 2, 2, 3, 35, 0, 28, 0, 36, 1, 32,
+ 33, 30, 29, 31, 31, 31, 31, 31, 31, 31,
+ 11, 5, 31, 31, 31, 31, 31, 31, 19, 31,
+ 31, 31, 31, 31, 25, 31, 31, 1, 32, 31,
+ 31, 7, 31, 31, 31, 31, 31, 31, 15, 31,
+ 31, 31, 21, 31, 23, 31, 31, 31, 4, 6,
+ 8, 31, 31, 12, 13, 31, 31, 31, 18, 31,
+
+ 31, 24, 31, 26, 9, 31, 14, 31, 17, 31,
+ 31, 27, 10, 31, 31, 22, 16, 31, 20, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -399,13 +399,13 @@ static yyconst flex_int32_t yy_ec[256] =
8, 8, 8, 8, 9, 10, 8, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 8, 1, 12,
13, 14, 1, 1, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 16, 16, 24, 25, 26, 27, 28,
- 16, 29, 30, 31, 32, 33, 34, 35, 16, 16,
- 1, 1, 1, 8, 16, 1, 36, 16, 37, 38,
+ 21, 22, 23, 24, 24, 25, 26, 27, 28, 29,
+ 24, 30, 31, 32, 33, 34, 35, 36, 24, 24,
+ 1, 1, 1, 8, 24, 1, 37, 38, 39, 40,
- 39, 40, 41, 42, 43, 16, 16, 44, 45, 46,
- 47, 48, 16, 49, 50, 51, 52, 53, 54, 55,
- 16, 16, 1, 1, 1, 1, 1, 1, 1, 1,
+ 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,
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,
@@ -422,124 +422,130 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[56] =
+static yyconst flex_int32_t yy_meta[58] =
{ 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, 4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[119] =
+static yyconst flex_int16_t yy_base[124] =
{ 0,
- 0, 54, 232, 255, 58, 54, 61, 64, 217, 222,
- 255, 219, 60, 214, 185, 0, 45, 49, 45, 49,
- 57, 51, 64, 63, 65, 57, 68, 69, 88, 90,
- 114, 118, 122, 125, 134, 255, 138, 255, 0, 88,
- 130, 255, 255, 0, 80, 101, 124, 120, 129, 0,
- 0, 115, 120, 131, 126, 117, 117, 0, 134, 123,
- 127, 125, 138, 0, 135, 128, 0, 79, 134, 142,
- 0, 133, 146, 155, 155, 156, 152, 164, 157, 156,
- 0, 171, 0, 166, 169, 172, 0, 0, 0, 176,
- 0, 0, 169, 182, 180, 0, 177, 186, 0, 185,
-
- 0, 0, 0, 188, 0, 190, 190, 0, 192, 193,
- 0, 0, 196, 0, 255, 246, 76, 250
+ 0, 56, 244, 270, 60, 56, 63, 66, 230, 235,
+ 270, 232, 62, 155, 145, 0, 46, 50, 46, 53,
+ 62, 51, 75, 64, 64, 78, 68, 72, 93, 94,
+ 123, 131, 141, 90, 145, 270, 116, 270, 0, 111,
+ 108, 270, 270, 0, 45, 89, 112, 108, 125, 123,
+ 0, 0, 122, 127, 139, 134, 125, 124, 0, 142,
+ 131, 135, 133, 147, 0, 144, 137, 0, 77, 143,
+ 152, 0, 141, 148, 161, 154, 158, 162, 161, 174,
+ 168, 167, 0, 179, 0, 175, 179, 183, 0, 0,
+ 0, 187, 192, 0, 0, 181, 195, 192, 0, 189,
+
+ 199, 0, 196, 0, 0, 193, 0, 193, 0, 196,
+ 194, 0, 0, 199, 202, 0, 0, 209, 0, 270,
+ 261, 81, 265
} ;
-static yyconst flex_int16_t yy_def[119] =
+static yyconst flex_int16_t yy_def[124] =
{ 0,
- 115, 1, 115, 115, 115, 115, 115, 115, 115, 116,
- 115, 115, 115, 115, 115, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
- 115, 115, 115, 115, 115, 115, 116, 115, 118, 115,
- 115, 115, 115, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 117, 118, 115, 117, 117,
- 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
-
- 117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 0, 115, 115, 115
+ 120, 1, 120, 120, 120, 120, 120, 120, 120, 121,
+ 120, 120, 120, 120, 120, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 120, 120, 120, 120, 120, 120, 121, 120, 123, 120,
+ 120, 120, 120, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 123, 120, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122, 122, 0,
+ 120, 120, 120
} ;
-static yyconst flex_int16_t yy_nxt[311] =
+static yyconst flex_int16_t yy_nxt[328] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
13, 14, 11, 15, 16, 16, 16, 17, 18, 19,
- 20, 16, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 16, 16, 30, 16, 16, 16, 17, 18, 19,
- 20, 16, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 16, 16, 30, 16, 31, 34, 34, 32, 33,
- 34, 34, 35, 34, 34, 35, 34, 34, 35, 40,
- 41, 45, 46, 49, 47, 50, 51, 53, 54, 44,
- 55, 57, 52, 48, 58, 59, 61, 62, 60, 68,
- 56, 45, 46, 49, 47, 50, 51, 53, 68, 54,
-
- 55, 57, 52, 48, 58, 59, 61, 62, 60, 63,
- 56, 65, 66, 69, 64, 33, 34, 34, 35, 35,
- 34, 34, 35, 33, 34, 34, 35, 34, 34, 63,
- 70, 65, 66, 69, 64, 35, 34, 34, 35, 40,
- 41, 71, 72, 73, 38, 74, 75, 76, 77, 78,
- 70, 79, 80, 81, 82, 83, 84, 85, 86, 87,
- 88, 71, 72, 89, 73, 74, 75, 76, 77, 78,
- 90, 79, 80, 81, 82, 83, 84, 85, 86, 87,
- 88, 91, 92, 89, 93, 94, 95, 96, 97, 98,
- 90, 99, 100, 101, 102, 103, 104, 43, 105, 106,
-
- 107, 91, 92, 108, 93, 94, 95, 96, 97, 98,
- 109, 99, 100, 101, 102, 103, 110, 104, 105, 106,
- 111, 107, 112, 108, 113, 114, 42, 39, 38, 36,
- 109, 115, 115, 115, 115, 115, 110, 115, 115, 115,
- 111, 115, 112, 115, 113, 114, 37, 115, 37, 37,
- 67, 115, 115, 67, 3, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
-
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115
+ 20, 16, 21, 16, 22, 23, 24, 25, 26, 27,
+ 28, 29, 16, 16, 30, 16, 16, 16, 16, 17,
+ 18, 19, 20, 16, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 16, 16, 30, 16, 31, 34, 34,
+ 32, 33, 34, 34, 35, 34, 34, 35, 34, 34,
+ 35, 40, 41, 45, 46, 49, 47, 50, 54, 70,
+ 51, 52, 58, 59, 44, 48, 62, 69, 53, 55,
+ 63, 56, 34, 34, 45, 46, 49, 47, 50, 54,
+
+ 70, 51, 57, 52, 58, 59, 48, 60, 62, 53,
+ 61, 55, 63, 56, 64, 66, 67, 40, 41, 71,
+ 65, 69, 38, 57, 33, 34, 34, 35, 60, 72,
+ 73, 61, 35, 34, 34, 35, 64, 66, 67, 74,
+ 71, 65, 33, 34, 34, 35, 35, 34, 34, 35,
+ 75, 72, 73, 76, 77, 78, 79, 43, 80, 81,
+ 82, 74, 83, 84, 85, 86, 87, 42, 88, 89,
+ 90, 75, 91, 92, 76, 77, 93, 78, 79, 80,
+ 81, 94, 82, 83, 84, 85, 95, 86, 87, 88,
+ 89, 96, 90, 91, 92, 97, 98, 101, 93, 99,
+
+ 100, 102, 94, 103, 104, 105, 106, 95, 107, 108,
+ 109, 110, 96, 111, 112, 114, 97, 113, 98, 101,
+ 99, 100, 102, 115, 103, 116, 104, 105, 106, 107,
+ 117, 108, 109, 110, 118, 111, 112, 114, 113, 119,
+ 39, 38, 36, 120, 115, 120, 116, 120, 120, 120,
+ 120, 117, 120, 120, 120, 118, 120, 120, 120, 120,
+ 119, 37, 120, 37, 37, 68, 120, 120, 68, 3,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120
} ;
-static yyconst flex_int16_t yy_chk[311] =
+static yyconst flex_int16_t yy_chk[328] =
{ 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, 2, 6, 6, 2, 5,
- 5, 5, 5, 7, 7, 8, 8, 8, 8, 13,
- 13, 17, 18, 19, 18, 20, 21, 22, 23, 117,
- 23, 24, 21, 18, 25, 26, 27, 28, 26, 68,
- 23, 17, 18, 19, 18, 20, 21, 22, 40, 23,
-
- 23, 24, 21, 18, 25, 26, 27, 28, 26, 29,
- 23, 30, 30, 45, 29, 31, 31, 31, 31, 32,
- 32, 32, 32, 33, 33, 33, 33, 34, 34, 29,
- 46, 30, 30, 45, 29, 35, 35, 35, 35, 41,
- 41, 47, 48, 49, 37, 52, 53, 54, 55, 56,
- 46, 57, 59, 60, 61, 62, 63, 65, 66, 69,
- 70, 47, 48, 72, 49, 52, 53, 54, 55, 56,
- 73, 57, 59, 60, 61, 62, 63, 65, 66, 69,
- 70, 74, 75, 72, 76, 77, 78, 79, 80, 82,
- 73, 84, 85, 86, 90, 93, 94, 15, 95, 97,
-
- 98, 74, 75, 100, 76, 77, 78, 79, 80, 82,
- 104, 84, 85, 86, 90, 93, 106, 94, 95, 97,
- 107, 98, 109, 100, 110, 113, 14, 12, 10, 9,
- 104, 3, 0, 0, 0, 0, 106, 0, 0, 0,
- 107, 0, 109, 0, 110, 113, 116, 0, 116, 116,
- 118, 0, 0, 118, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115,
-
- 115, 115, 115, 115, 115, 115, 115, 115, 115, 115
+ 1, 1, 1, 1, 1, 1, 1, 2, 6, 6,
+ 2, 5, 5, 5, 5, 7, 7, 8, 8, 8,
+ 8, 13, 13, 17, 18, 19, 18, 20, 22, 45,
+ 20, 21, 24, 25, 122, 18, 27, 69, 21, 23,
+ 28, 23, 34, 34, 17, 18, 19, 18, 20, 22,
+
+ 45, 20, 23, 21, 24, 25, 18, 26, 27, 21,
+ 26, 23, 28, 23, 29, 30, 30, 41, 41, 46,
+ 29, 40, 37, 23, 31, 31, 31, 31, 26, 47,
+ 48, 26, 32, 32, 32, 32, 29, 30, 30, 49,
+ 46, 29, 33, 33, 33, 33, 35, 35, 35, 35,
+ 50, 47, 48, 53, 54, 55, 56, 15, 57, 58,
+ 60, 49, 61, 62, 63, 64, 66, 14, 67, 70,
+ 71, 50, 73, 74, 53, 54, 75, 55, 56, 57,
+ 58, 76, 60, 61, 62, 63, 77, 64, 66, 67,
+ 70, 78, 71, 73, 74, 79, 80, 84, 75, 81,
+
+ 82, 86, 76, 87, 88, 92, 93, 77, 96, 97,
+ 98, 100, 78, 101, 103, 108, 79, 106, 80, 84,
+ 81, 82, 86, 110, 87, 111, 88, 92, 93, 96,
+ 114, 97, 98, 100, 115, 101, 103, 108, 106, 118,
+ 12, 10, 9, 3, 110, 0, 111, 0, 0, 0,
+ 0, 114, 0, 0, 0, 115, 0, 0, 0, 0,
+ 118, 121, 0, 121, 121, 123, 0, 0, 123, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
+ 120, 120, 120, 120, 120, 120, 120
} ;
static yy_state_type yy_last_accepting_state;
@@ -589,7 +595,7 @@ char *yytext;
int yyparse();
-#line 593 "engines/director/lingo/lingo-lex.cpp"
+#line 599 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -777,7 +783,7 @@ YY_DECL
#line 45 "engines/director/lingo/lingo-lex.l"
-#line 781 "engines/director/lingo/lingo-lex.cpp"
+#line 787 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -831,13 +837,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 >= 116 )
+ if ( yy_current_state >= 121 )
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] != 255 );
+ while ( yy_base[yy_current_state] != 270 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -909,145 +915,150 @@ YY_RULE_SETUP
case 10:
YY_RULE_SETUP
#line 57 "engines/director/lingo/lingo-lex.l"
-{ return tGO; }
+{ return tGLOBAL; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 58 "engines/director/lingo/lingo-lex.l"
-{ return tINTO; }
+{ return tGO; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 59 "engines/director/lingo/lingo-lex.l"
-{ return tLOOP; }
+{ return tINTO; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 60 "engines/director/lingo/lingo-lex.l"
-{ return tMACRO; }
+{ return tLOOP; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 61 "engines/director/lingo/lingo-lex.l"
-{ return tMCI; }
+{ return tMACRO; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 62 "engines/director/lingo/lingo-lex.l"
-{ return tMCIWAIT; }
+{ return tMCI; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 63 "engines/director/lingo/lingo-lex.l"
-{ return tMOVIE; }
+{ return tMCIWAIT; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 64 "engines/director/lingo/lingo-lex.l"
-{ return tNEXT; }
+{ return tMOVIE; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 65 "engines/director/lingo/lingo-lex.l"
-{ return tOF; }
+{ return tNEXT; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 66 "engines/director/lingo/lingo-lex.l"
-{ return tPREVIOUS; }
+{ return tOF; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 67 "engines/director/lingo/lingo-lex.l"
-{ return tPUT; }
+{ return tPREVIOUS; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 68 "engines/director/lingo/lingo-lex.l"
-{ return tREPEAT; }
+{ return tPUT; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 69 "engines/director/lingo/lingo-lex.l"
-{ return tSET; }
+{ return tREPEAT; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 70 "engines/director/lingo/lingo-lex.l"
-{ return tTHEN; }
+{ return tSET; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 71 "engines/director/lingo/lingo-lex.l"
-{ return tTO; }
+{ return tTHEN; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 72 "engines/director/lingo/lingo-lex.l"
-{ return tWITH; }
+{ return tTO; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 73 "engines/director/lingo/lingo-lex.l"
-{ return tWHILE; }
+{ return tWITH; }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 75 "engines/director/lingo/lingo-lex.l"
-{ return tNEQ; }
+#line 74 "engines/director/lingo/lingo-lex.l"
+{ return tWHILE; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 76 "engines/director/lingo/lingo-lex.l"
-{ return tGE; }
+{ return tNEQ; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 77 "engines/director/lingo/lingo-lex.l"
-{ return tLE; }
+{ return tGE; }
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 79 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return ID; }
+#line 78 "engines/director/lingo/lingo-lex.l"
+{ return tLE; }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 80 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+{ yylval.s = new Common::String(yytext); return ID; }
YY_BREAK
case 32:
YY_RULE_SETUP
#line 81 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 33:
YY_RULE_SETUP
#line 82 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 34:
-/* rule 34 can match eol */
YY_RULE_SETUP
#line 83 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ return *yytext; }
YY_BREAK
case 35:
+/* rule 35 can match eol */
YY_RULE_SETUP
#line 84 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return '\n'; }
YY_BREAK
case 36:
YY_RULE_SETUP
#line 85 "engines/director/lingo/lingo-lex.l"
-
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 87 "engines/director/lingo/lingo-lex.l"
+#line 86 "engines/director/lingo/lingo-lex.l"
+
+ YY_BREAK
+case 38:
+YY_RULE_SETUP
+#line 88 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1051 "engines/director/lingo/lingo-lex.cpp"
+#line 1062 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1340,7 +1351,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 >= 116 )
+ if ( yy_current_state >= 121 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1368,11 +1379,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 >= 116 )
+ if ( yy_current_state >= 121 )
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 == 115);
+ yy_is_jam = (yy_current_state == 120);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2047,7 +2058,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 87 "engines/director/lingo/lingo-lex.l"
+#line 88 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 3d92963..2e42471 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -54,6 +54,7 @@ whitespace [\t ]
(?i:end) { return tEND; }
(?i:exit) { return tEXIT; }
(?i:frame) { return tFRAME; }
+(?i:global) { return tGLOBAL; }
(?i:go) { return tGO; }
(?i:into) { return tINTO; }
(?i:loop) { return tLOOP; }
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 37bf53a..cbf0d9b 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -72,6 +72,7 @@ Symbol::Symbol() {
type = VOID;
u.str = NULL;
nargs = 0;
+ global = false;
}
Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index e40aa63..137b8f7 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -77,8 +77,8 @@ typedef void (*inst)(void);
typedef Common::Array<inst> ScriptData;
typedef struct Symbol { /* symbol table entry */
- char *name;
- int type;
+ char *name;
+ int type;
union {
int val; /* VAR */
float fval; /* FLOAT */
@@ -86,6 +86,7 @@ typedef struct Symbol { /* symbol table entry */
char *str; /* STRING */
} u;
int nargs;
+ bool global;
Symbol();
} Symbol;
@@ -134,7 +135,7 @@ public:
public:
void execute(int pc);
- Symbol *lookupVar(const char *name);
+ Symbol *lookupVar(const char *name, bool create = true, bool putInLocalList = true);
void define(Common::String &s, int start, int nargs);
void codeArg(Common::String *s);
void codeArgStore();
@@ -172,6 +173,7 @@ public:
static void c_gotoloop();
static void c_gotonext();
static void c_gotoprevious();
+ static void c_global();
void func_mci(Common::String &s);
void func_mciwait(Common::String &s);
@@ -200,6 +202,7 @@ private:
ScriptHash _scripts[kMaxScriptType + 1];
SymbolHash _vars;
+ Common::HashMap<Common::String, bool, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _localvars;
SymbolHash _handlers;
int _pc;
Commit: 7164b1531c63c825c7a2a5675bfabc1cf7887b5c
https://github.com/scummvm/scummvm/commit/7164b1531c63c825c7a2a5675bfabc1cf7887b5c
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix code style violation
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-funcs.cpp
engines/director/lingo/lingo.h
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 349b51f..31aeac6 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -368,15 +368,15 @@ void Lingo::c_goto() {
}
void Lingo::c_gotoloop() {
- g_lingo->func_gotoLoop();
+ g_lingo->func_gotoloop();
}
void Lingo::c_gotonext() {
- g_lingo->func_gotoNext();
+ g_lingo->func_gotonext();
}
void Lingo::c_gotoprevious() {
- g_lingo->func_gotoPrev();
+ g_lingo->func_gotoprevious();
}
void Lingo::c_call() {
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index eae253d..fbb65ea 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -208,16 +208,16 @@ void Lingo::func_goto(Common::String &frame, Common::String &movie) {
_vm->_currentScore->setCurrentFrame(strtol(frame.c_str(), 0, 10));
}
-void Lingo::func_gotoLoop() {
- _vm->_currentScore->goToLoop();
+void Lingo::func_gotoloop() {
+ _vm->_currentScore->gotoloop();
}
-void Lingo::func_gotoNext() {
- _vm->_currentScore->goToNext();
+void Lingo::func_gotonext() {
+ _vm->_currentScore->gotonext();
}
-void Lingo::func_gotoPrev() {
- _vm->_currentScore->goToPrevious();
+void Lingo::func_gotoprevious() {
+ _vm->_currentScore->gotoprevious();
}
}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 137b8f7..93a2e23 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -178,9 +178,9 @@ public:
void func_mci(Common::String &s);
void func_mciwait(Common::String &s);
void func_goto(Common::String &frame, Common::String &movie);
- void func_gotoLoop();
- void func_gotoNext();
- void func_gotoPrev();
+ void func_gotoloop();
+ void func_gotonext();
+ void func_gotoprevious();
public:
ScriptData *_currentScript;
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 7b26a95..ff324c5 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -408,7 +408,7 @@ void Score::loadCastInfo(Common::SeekableSubReadStreamEndian &stream, uint16 id)
_castsInfo[id] = ci;
}
-void Score::goToLoop() {
+void Score::gotoloop() {
//This command has the playback head contonuously return to the first marker to to the left and then loop back.
//If no marker are to the left of the playback head, the playback head continues to the right.
Common::SortedArray<Label *>::iterator i;
@@ -421,7 +421,7 @@ void Score::goToLoop() {
}
}
-void Score::goToNext() {
+void Score::gotonext() {
Common::SortedArray<Label *>::iterator i;
for (i = _labels->begin(); i != _labels->end(); ++i) {
@@ -444,7 +444,7 @@ void Score::goToNext() {
_currentFrame = 0;
}
-void Score::goToPrevious() {
+void Score::gotoprevious() {
//One label
if (_labels->begin() == _labels->end()) {
_currentFrame = (*_labels->begin())->number;
diff --git a/engines/director/score.h b/engines/director/score.h
index 0327425..6c6b661 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -330,7 +330,7 @@ public:
struct Label {
Common::String name;
uint16 number;
- Label(Common::String _name, uint16 _number) { name = _name; number = _number; }
+ Label(Common::String name1, uint16 number1) { name = name1; number = number1; }
};
class Score {
@@ -342,9 +342,9 @@ public:
static int compareLabels(const void *a, const void *b);
void loadArchive();
void setStartToLabel(Common::String label);
- void goToLoop();
- void goToNext();
- void goToPrevious();
+ void gotoloop();
+ void gotonext();
+ void gotoprevious();
void startLoop();
void processEvents();
Archive *getArchive() const { return _movieArchive; };
Commit: aaf8448cbc0a282a1c28f0ef4d7c738c8b87ab3b
https://github.com/scummvm/scummvm/commit/aaf8448cbc0a282a1c28f0ef4d7c738c8b87ab3b
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add loading shared casts for Director version > 3
Changed paths:
engines/director/director.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 0c63525..10db492 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -381,17 +381,22 @@ void DirectorEngine::setPalette(byte *palette, uint16 count) {
}
void DirectorEngine::loadSharedCastsFrom(Common::String filename) {
+ Archive *shardcst;
+
+ if (getVersion() < 4) {
+ shardcst = new RIFFArchive();
+ } else {
+ shardcst = new RIFXArchive();
+ }
- //TODO d4 arch
- RIFFArchive *shardcst = new RIFFArchive();
shardcst->openFile(filename);
Score *castScore = new Score(this);
-
Common::SeekableSubReadStreamEndian *castStream = shardcst->getResource(MKTAG('V','W','C','R'), 1024);
castScore->loadCastData(*castStream);
_sharedCasts = castScore->_casts;
+
Common::Array<uint16> dib = shardcst->getResourceIDList(MKTAG('D','I','B',' '));
if (dib.size() != 0) {
Commit: b208b8e5fffc6a13277987d98400488c4d59d9c1
https://github.com/scummvm/scummvm/commit/b208b8e5fffc6a13277987d98400488c4d59d9c1
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix memory corruption
Changed paths:
engines/director/director.cpp
engines/director/director.h
engines/director/score.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 10db492..9a22e67 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -395,14 +395,14 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) {
Common::SeekableSubReadStreamEndian *castStream = shardcst->getResource(MKTAG('V','W','C','R'), 1024);
castScore->loadCastData(*castStream);
- _sharedCasts = castScore->_casts;
+ *_sharedCasts = castScore->_casts;
Common::Array<uint16> dib = shardcst->getResourceIDList(MKTAG('D','I','B',' '));
if (dib.size() != 0) {
Common::Array<uint16>::iterator iterator;
for (iterator = dib.begin(); iterator != dib.end(); ++iterator) {
- _sharedDIB[*iterator] = shardcst->getResource(MKTAG('D','I','B',' '), *iterator);
+ _sharedDIB->setVal(*iterator, shardcst->getResource(MKTAG('D','I','B',' '), *iterator));
}
}
@@ -411,7 +411,7 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) {
if (stxt.size() != 0) {
Common::Array<uint16>::iterator iterator;
for (iterator = stxt.begin(); iterator != stxt.end(); ++iterator) {
- _sharedSTXT[*iterator] = shardcst->getResource(MKTAG('S','T','X','T'), *iterator);
+ _sharedSTXT->setVal(*iterator, shardcst->getResource(MKTAG('S','T','X','T'), *iterator));
}
}
@@ -420,7 +420,7 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) {
if (stxt.size() != 0) {
Common::Array<uint16>::iterator iterator;
for (iterator = sound.begin(); iterator != sound.end(); ++iterator) {
- _sharedSTXT[*iterator] = shardcst->getResource(MKTAG('S','N','D',' '), *iterator);
+ _sharedSound->setVal(*iterator, shardcst->getResource(MKTAG('S','N','D',' '), *iterator));
}
}
}
diff --git a/engines/director/director.h b/engines/director/director.h
index 82c43fd..a3e0ad0 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -24,6 +24,7 @@
#define DIRECTOR_DIRECTOR_H
#include "common/scummsys.h"
+#include "common/substream.h"
#include "common/str.h"
#include "common/hashmap.h"
@@ -67,9 +68,9 @@ public:
const byte *getPalette() const { return _currentPalette; }
uint16 getPaletteColorCount() const { return _currentPaletteLength; }
void loadSharedCastsFrom(Common::String filename);
- Common::HashMap<int, Common::SeekableReadStream *> getSharedDIB() const { return _sharedDIB; }
- Common::HashMap<int, Common::SeekableReadStream *> getSharedSTXT() const { return _sharedSTXT; }
- Common::HashMap<int, Cast *> getSharedCasts() const { return _sharedCasts; }
+ Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *getSharedDIB() const { return _sharedDIB; }
+ Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *getSharedSTXT() const { return _sharedSTXT; }
+ Common::HashMap<int, Cast *> *getSharedCasts() const { return _sharedCasts; }
Common::HashMap<Common::String, Score *> *_movies;
Score *_currentScore;
@@ -93,10 +94,10 @@ private:
Common::String readPascalString(Common::SeekableReadStream &stream);
Common::String _sharedMMM;
- Common::HashMap<int, Cast *> _sharedCasts;
- Common::HashMap<int, Common::SeekableReadStream *> _sharedDIB;
- Common::HashMap<int, Common::SeekableReadStream *> _sharedSTXT;
- Common::HashMap<int, Common::SeekableReadStream *> _sharedSound;
+ Common::HashMap<int, Cast *> *_sharedCasts;
+ Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *_sharedDIB;
+ Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *_sharedSTXT;
+ Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *_sharedSound;
Archive *_mainArchive;
Common::MacResManager *_macBinary;
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index ff324c5..59b37ec 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1129,11 +1129,11 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
Cast *cast;
if (!_vm->_currentScore->_casts.contains(_sprites[i]->_castId)) {
- if (!_vm->getSharedCasts().contains(_sprites[i]->_castId)) {
+ if (!_vm->getSharedCasts()->contains(_sprites[i]->_castId)) {
warning("Cast id %d not found", _sprites[i]->_castId);
continue;
} else {
- cast = _vm->getSharedCasts().getVal(_sprites[i]->_castId);
+ cast = _vm->getSharedCasts()->getVal(_sprites[i]->_castId);
}
} else {
cast = _vm->_currentScore->_casts[_sprites[i]->_castId];
@@ -1148,11 +1148,11 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
uint32 imgId = 1024 + _sprites[i]->_castId;
if (!_vm->_currentScore->getArchive()->hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
- if (!_vm->getSharedDIB().contains(imgId)) {
+ if (!_vm->getSharedDIB()->contains(imgId)) {
warning("DIB id %d not found", imgId);
continue;
} else {
- img.loadStream(*_vm->getSharedDIB().getVal(imgId));
+ img.loadStream(*_vm->getSharedDIB()->getVal(imgId));
}
} else {
img.loadStream(*_vm->_currentScore->getArchive()->getResource(MKTAG('D', 'I', 'B', ' '), imgId));
Commit: 30db02c87ebe64a0cad3dd5d5d4454f73df55466
https://github.com/scummvm/scummvm/commit/30db02c87ebe64a0cad3dd5d5d4454f73df55466
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Handle some differences beetwen D1-3 and D4-6
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 59b37ec..2778cece 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -74,10 +74,14 @@ void Score::loadArchive() {
assert(_movieArchive->hasResource(MKTAG('V','W','S','C'), 1024));
assert(_movieArchive->hasResource(MKTAG('V','W','C','F'), 1024));
- assert(_movieArchive->hasResource(MKTAG('V','W','C','R'), 1024));
+
loadFrames(*_movieArchive->getResource(MKTAG('V','W','S','C'), 1024));
loadConfig(*_movieArchive->getResource(MKTAG('V','W','C','F'), 1024));
- loadCastData(*_movieArchive->getResource(MKTAG('V','W','C','R'), 1024));
+
+ if (_vm->getVersion() < 4) {
+ assert(_movieArchive->hasResource(MKTAG('V','W','C','R'), 1024));
+ loadCastData(*_movieArchive->getResource(MKTAG('V','W','C','R'), 1024));
+ }
if (_movieArchive->hasResource(MKTAG('V','W','A','C'), 1024)) {
loadActions(*_movieArchive->getResource(MKTAG('V','W','A','C'), 1024));
@@ -145,6 +149,12 @@ void Score::loadPalette(Common::SeekableSubReadStreamEndian &stream) {
void Score::loadFrames(Common::SeekableSubReadStreamEndian &stream) {
uint32 size = stream.readUint32();
size -= 4;
+
+ if (_vm->getVersion() > 3) {
+ stream.skip(16);
+ //Unknown, some bytes - constant (refer to contuinity).
+ }
+
uint16 channelSize;
uint16 channelOffset;
@@ -158,10 +168,17 @@ void Score::loadFrames(Common::SeekableSubReadStreamEndian &stream) {
Frame *frame = new Frame(*_frames.back());
while (frameSize != 0) {
- channelSize = stream.readByte() * 2;
- channelOffset = stream.readByte() * 2;
+ if (_vm->getVersion() < 4) {
+ channelSize = stream.readByte() * 2;
+ channelOffset = stream.readByte() * 2;
+ frameSize -= channelSize + 2;
+ } else {
+ channelSize = stream.readByte();
+ channelOffset = stream.readByte();
+ frameSize -= channelSize + 4;
+ }
frame->readChannel(stream, channelOffset, channelSize);
- frameSize -= channelSize + 2;
+
}
_frames.push_back(frame);
Commit: 256727964c4c06beb70c422ec70f610e56283123
https://github.com/scummvm/scummvm/commit/256727964c4c06beb70c422ec70f610e56283123
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Render bitmaps
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 2778cece..3863ef7 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -36,6 +36,7 @@
#include "common/events.h"
#include "engines/util.h"
#include "graphics/managed_surface.h"
+#include "image/bmp.h"
namespace Director {
@@ -1161,19 +1162,7 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
continue;
}
- DIBDecoder img;
- uint32 imgId = 1024 + _sprites[i]->_castId;
-
- if (!_vm->_currentScore->getArchive()->hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
- if (!_vm->getSharedDIB()->contains(imgId)) {
- warning("DIB id %d not found", imgId);
- continue;
- } else {
- img.loadStream(*_vm->getSharedDIB()->getVal(imgId));
- }
- } else {
- img.loadStream(*_vm->_currentScore->getArchive()->getResource(MKTAG('D', 'I', 'B', ' '), imgId));
- }
+ Image::ImageDecoder *img = getImageFrom(_sprites[i]->_castId);
uint32 regX = static_cast<BitmapCast *>(_sprites[i]->_cast)->regX;
uint32 regY = static_cast<BitmapCast *>(_sprites[i]->_cast)->regY;
@@ -1190,29 +1179,58 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
switch (_sprites[i]->_ink) {
case kInkTypeCopy:
- surface.blitFrom(*img.getSurface(), Common::Point(x, y));
+ surface.blitFrom(*img->getSurface(), Common::Point(x, y));
break;
case kInkTypeBackgndTrans:
- drawBackgndTransSprite(surface, *img.getSurface(), drawRect);
+ drawBackgndTransSprite(surface, *img->getSurface(), drawRect);
break;
case kInkTypeMatte:
- drawMatteSprite(surface, *img.getSurface(), drawRect);
+ drawMatteSprite(surface, *img->getSurface(), drawRect);
break;
case kInkTypeGhost:
- drawGhostSprite(surface, *img.getSurface(), drawRect);
+ drawGhostSprite(surface, *img->getSurface(), drawRect);
break;
case kInkTypeReverse:
- drawReverseSprite(surface, *img.getSurface(), drawRect);
+ drawReverseSprite(surface, *img->getSurface(), drawRect);
break;
default:
warning("Unhandled ink type %d", _sprites[i]->_ink);
- surface.blitFrom(*img.getSurface(), Common::Point(x, y));
+ surface.blitFrom(*img->getSurface(), Common::Point(x, y));
break;
}
}
}
}
+Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
+ uint16 imgId = spriteId + 1024;
+ Image::ImageDecoder *img;
+
+ if (!_vm->_currentScore->getArchive()->hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
+ img = new DIBDecoder();
+ img->loadStream(*_vm->_currentScore->getArchive()->getResource(MKTAG('D', 'I', 'B', ' '), imgId));
+ return img;
+ }
+
+ if (_vm->getSharedDIB()->contains(imgId)) {
+ img = new DIBDecoder();
+ img->loadStream(*_vm->getSharedDIB()->getVal(imgId));
+ return img;
+ }
+
+ if (!_vm->_currentScore->getArchive()->hasResource(MKTAG('B', 'I', 'T', 'D'), imgId)) {
+ img = new Image::BitmapDecoder();
+ img->loadStream(*_vm->_currentScore->getArchive()->getResource(MKTAG('B', 'I', 'T', 'D'), imgId));
+ return img;
+ }
+
+ //TODO Shared bitmaps
+
+ warning("Image %d not found", spriteId);
+ return img;
+}
+
+
void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID) {
warning("STUB: renderText()");
}
diff --git a/engines/director/score.h b/engines/director/score.h
index 6c6b661..9f13df7 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -29,6 +29,7 @@
#include "director/resource.h"
#include "graphics/managed_surface.h"
#include "common/str.h"
+#include "image/image_decoder.h"
namespace Director {
@@ -302,6 +303,7 @@ private:
void readPaletteInfo(Common::SeekableSubReadStreamEndian &stream);
void readSprite(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
void readMainChannels(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
+ Image::ImageDecoder *getImageFrom(uint16 spriteID);
void drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
void drawMatteSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
void drawGhostSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect);
Commit: bba7efff11ee5f42731495a43128dbaa909e22b1
https://github.com/scummvm/scummvm/commit/bba7efff11ee5f42731495a43128dbaa909e22b1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: C++-ify structs
Changed paths:
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 93a2e23..becd410 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -76,7 +76,7 @@ typedef void (*inst)(void);
typedef Common::Array<inst> ScriptData;
-typedef struct Symbol { /* symbol table entry */
+struct Symbol { /* symbol table entry */
char *name;
int type;
union {
@@ -89,9 +89,9 @@ typedef struct Symbol { /* symbol table entry */
bool global;
Symbol();
-} Symbol;
+};
-typedef struct Datum { /* interpreter stack type */
+struct Datum { /* interpreter stack type */
int type;
union {
@@ -101,13 +101,13 @@ typedef struct Datum { /* interpreter stack type */
} u;
Datum() { u.sym = NULL; type = VOID; }
-} Datum;
+};
-typedef struct CFrame { /* proc/func call stack frame */
+struct CFrame { /* proc/func call stack frame */
Symbol *sp; /* symbol table entry */
int retpc; /* where to resume after return */
ScriptData *retscript; /* which script to resume after return */
-} CFrame;
+};
typedef Common::HashMap<int32, ScriptData *> ScriptHash;
typedef Common::Array<Datum> StackData;
Commit: 0f65b9abb3d671f1ffd9cd1089fca055ce24d4db
https://github.com/scummvm/scummvm/commit/0f65b9abb3d671f1ffd9cd1089fca055ce24d4db
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Stub for context creation
Changed paths:
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 8473f2e..b5bc801 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -64,6 +64,16 @@ void Lingo::execute(int pc) {
}
}
+void Lingo::pushContext() {
+ Context *con = new Context;
+
+ _contexts.push_back(con);
+}
+
+void Lingo::popContext() {
+ _contexts.pop_back();
+}
+
Symbol *Lingo::lookupVar(const char *name, bool create, bool putInLocalList) {
Symbol *sym;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index becd410..bec14f2 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -113,6 +113,11 @@ typedef Common::HashMap<int32, ScriptData *> ScriptHash;
typedef Common::Array<Datum> StackData;
typedef Common::HashMap<Common::String, Symbol *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> SymbolHash;
+struct Context { /* execution context */
+ Symbol *handler;
+ SymbolHash *localvars;
+};
+
class Lingo {
public:
Lingo(DirectorEngine *vm);
@@ -135,6 +140,8 @@ public:
public:
void execute(int pc);
+ void pushContext();
+ void popContext();
Symbol *lookupVar(const char *name, bool create = true, bool putInLocalList = true);
void define(Common::String &s, int start, int nargs);
void codeArg(Common::String *s);
@@ -205,6 +212,8 @@ private:
Common::HashMap<Common::String, bool, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _localvars;
SymbolHash _handlers;
+ Common::Array<Context *> _contexts;
+
int _pc;
StackData _stack;
Commit: a279faf251f1703355b5d7dbaf2b935a25e21047
https://github.com/scummvm/scummvm/commit/a279faf251f1703355b5d7dbaf2b935a25e21047
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix warning
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 3863ef7..c51c6cc 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1204,7 +1204,7 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
uint16 imgId = spriteId + 1024;
- Image::ImageDecoder *img;
+ Image::ImageDecoder *img = NULL;
if (!_vm->_currentScore->getArchive()->hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
img = new DIBDecoder();
Commit: 0b6d950729296c177ad502328fd5b5e3b0bb04c9
https://github.com/scummvm/scummvm/commit/0b6d950729296c177ad502328fd5b5e3b0bb04c9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Store and restore local variables in scope.
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 31aeac6..9bc6b48 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -404,6 +404,13 @@ void Lingo::c_call() {
fp->sp = sym;
fp->retpc = g_lingo->_pc;
fp->retscript = g_lingo->_currentScript;
+ fp->localvars = g_lingo->_localvars;
+
+ // Clean up current scope local variables
+ for (SymbolHash::const_iterator h = g_lingo->_localvars->begin(); h != g_lingo->_localvars->end(); ++h)
+ g_lingo->_vars.erase(h->_key);
+
+ g_lingo->_localvars = new SymbolHash;
g_lingo->_callstack.push_back(fp);
@@ -419,6 +426,18 @@ void Lingo::c_procret() {
g_lingo->_currentScript = fp->retscript;
g_lingo->_pc = fp->retpc;
+ // Clean up current scope local variables and clean up memory
+ for (SymbolHash::const_iterator h = g_lingo->_localvars->begin(); h != g_lingo->_localvars->end(); ++h) {
+ g_lingo->_vars.erase(h->_key);
+ delete h->_value;
+ }
+ delete g_lingo->_localvars;
+
+ // Restore local variables
+ g_lingo->_localvars = fp->localvars;
+ for (SymbolHash::const_iterator h = g_lingo->_localvars->begin(); h != g_lingo->_localvars->end(); ++h)
+ g_lingo->_vars[h->_key] = h->_value;
+
delete fp;
g_lingo->_returning = true;
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index b5bc801..ae62428 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -64,16 +64,6 @@ void Lingo::execute(int pc) {
}
}
-void Lingo::pushContext() {
- Context *con = new Context;
-
- _contexts.push_back(con);
-}
-
-void Lingo::popContext() {
- _contexts.pop_back();
-}
-
Symbol *Lingo::lookupVar(const char *name, bool create, bool putInLocalList) {
Symbol *sym;
@@ -93,7 +83,7 @@ Symbol *Lingo::lookupVar(const char *name, bool create, bool putInLocalList) {
}
if (putInLocalList)
- _localvars[name] = true;
+ (*_localvars)[name] = sym;
return sym;
}
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index cbf0d9b..accd9a1 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -163,7 +163,11 @@ void Lingo::executeScript(ScriptType type, uint16 id) {
_pc = 0;
_returning = false;
+ _localvars = new SymbolHash;
+
execute(_pc);
+
+ delete _localvars;
}
void Lingo::processEvent(LEvent event, int entityId) {
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index bec14f2..e30d8a4 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -103,18 +103,14 @@ struct Datum { /* interpreter stack type */
Datum() { u.sym = NULL; type = VOID; }
};
-struct CFrame { /* proc/func call stack frame */
- Symbol *sp; /* symbol table entry */
- int retpc; /* where to resume after return */
- ScriptData *retscript; /* which script to resume after return */
-};
-
typedef Common::HashMap<int32, ScriptData *> ScriptHash;
typedef Common::Array<Datum> StackData;
typedef Common::HashMap<Common::String, Symbol *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> SymbolHash;
-struct Context { /* execution context */
- Symbol *handler;
+struct CFrame { /* proc/func call stack frame */
+ Symbol *sp; /* symbol table entry */
+ int retpc; /* where to resume after return */
+ ScriptData *retscript; /* which script to resume after return */
SymbolHash *localvars;
};
@@ -209,11 +205,9 @@ private:
ScriptHash _scripts[kMaxScriptType + 1];
SymbolHash _vars;
- Common::HashMap<Common::String, bool, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _localvars;
+ SymbolHash *_localvars;
SymbolHash _handlers;
- Common::Array<Context *> _contexts;
-
int _pc;
StackData _stack;
Commit: c53e4b579a0217e01208b7e06ead853f4319df7c
https://github.com/scummvm/scummvm/commit/c53e4b579a0217e01208b7e06ead853f4319df7c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Make global/local vars work
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 9a22e67..7463a9e 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -105,6 +105,7 @@ _lingo->executeScript(kMovieScript, 2);
_lingo->addCode("--\n\
macro SHIPX\n\
+global x\n\
set x = 5\n\
if x = 1 then\n\
go \"Zoom\"\n\
@@ -117,12 +118,13 @@ put 100\n\
\n\
--\n\
macro ZIPX\n\
-set x = 5\n\
+set x = 7\n\
if x = 1 then\n\
go \"ZIP\"\n\
exit\n\
end if\n\
if x >1 then\n\
+put x\n\
exit\n\
end if\n\
\n\
@@ -136,8 +138,11 @@ end if\n\
", kMovieScript, 1);
_lingo->addCode("check(2, 3)\n\
+global x\n\
shipx\n\
put x\n\
+zipx\n\
+put x\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 9bc6b48..1a297e5 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -406,10 +406,7 @@ void Lingo::c_call() {
fp->retscript = g_lingo->_currentScript;
fp->localvars = g_lingo->_localvars;
- // Clean up current scope local variables
- for (SymbolHash::const_iterator h = g_lingo->_localvars->begin(); h != g_lingo->_localvars->end(); ++h)
- g_lingo->_vars.erase(h->_key);
-
+ // Create new set of local variables
g_lingo->_localvars = new SymbolHash;
g_lingo->_callstack.push_back(fp);
@@ -426,17 +423,10 @@ void Lingo::c_procret() {
g_lingo->_currentScript = fp->retscript;
g_lingo->_pc = fp->retpc;
- // Clean up current scope local variables and clean up memory
- for (SymbolHash::const_iterator h = g_lingo->_localvars->begin(); h != g_lingo->_localvars->end(); ++h) {
- g_lingo->_vars.erase(h->_key);
- delete h->_value;
- }
- delete g_lingo->_localvars;
+ g_lingo->cleanLocalVars();
// Restore local variables
g_lingo->_localvars = fp->localvars;
- for (SymbolHash::const_iterator h = g_lingo->_localvars->begin(); h != g_lingo->_localvars->end(); ++h)
- g_lingo->_vars[h->_key] = h->_value;
delete fp;
@@ -447,17 +437,11 @@ void Lingo::c_global() {
Common::String name((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
Symbol *s = g_lingo->lookupVar(name.c_str(), false);
- if (s) {
- if (s->global) {
- warning("Redefinition of global variable %s", name.c_str());
- } else {
- warning("Local variable %s declared as global", name.c_str());
- }
-
- return;
+ if (s && !s->global) {
+ warning("Local variable %s declared as global", name.c_str());
}
- s = g_lingo->lookupVar(name.c_str(), true, false);
+ s = g_lingo->lookupVar(name.c_str(), true, true);
s->global = true;
g_lingo->_pc += g_lingo->calcStringAlignment(name.c_str());
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index ae62428..89d30be 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -64,10 +64,10 @@ void Lingo::execute(int pc) {
}
}
-Symbol *Lingo::lookupVar(const char *name, bool create, bool putInLocalList) {
+Symbol *Lingo::lookupVar(const char *name, bool create, bool putInGlobalList) {
Symbol *sym;
- if (!_vars.contains(name)) { // Create variable if it was not defined
+ if (!_localvars->contains(name)) { // Create variable if it was not defined
if (!create)
return NULL;
@@ -77,17 +77,31 @@ Symbol *Lingo::lookupVar(const char *name, bool create, bool putInLocalList) {
sym->type = VOID;
sym->u.val = 0;
- _vars[name] = sym;
+ (*_localvars)[name] = sym;
+
+ if (putInGlobalList) {
+ sym->global = true;
+ _globalvars[name] = sym;
+ }
} else {
- sym = g_lingo->_vars[name];
- }
+ sym = (*_localvars)[name];
- if (putInLocalList)
- (*_localvars)[name] = sym;
+ if (sym->global)
+ sym = _globalvars[name];
+ }
return sym;
}
+void Lingo::cleanLocalVars() {
+ // Clean up current scope local variables and clean up memory
+ for (SymbolHash::const_iterator h = _localvars->begin(); h != _localvars->end(); ++h) {
+ if (!h->_value->global)
+ delete h->_value;
+ }
+ delete g_lingo->_localvars;
+}
+
void Lingo::define(Common::String &name, int start, int nargs) {
debug(3, "define(\"%s\", %d, %d, %d)", name.c_str(), start, _currentScript->size() - 1, nargs);
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index accd9a1..e584ac0 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -167,7 +167,7 @@ void Lingo::executeScript(ScriptType type, uint16 id) {
execute(_pc);
- delete _localvars;
+ cleanLocalVars();
}
void Lingo::processEvent(LEvent event, int entityId) {
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index e30d8a4..f9c58f0 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -138,7 +138,8 @@ public:
void execute(int pc);
void pushContext();
void popContext();
- Symbol *lookupVar(const char *name, bool create = true, bool putInLocalList = true);
+ Symbol *lookupVar(const char *name, bool create = true, bool putInGlobalList = false);
+ void cleanLocalVars();
void define(Common::String &s, int start, int nargs);
void codeArg(Common::String *s);
void codeArgStore();
@@ -204,7 +205,7 @@ private:
ScriptHash _scripts[kMaxScriptType + 1];
- SymbolHash _vars;
+ SymbolHash _globalvars;
SymbolHash *_localvars;
SymbolHash _handlers;
Commit: d70a76f1d6e5fdb5e7dd0a3c45f7c6acf4f8a94f
https://github.com/scummvm/scummvm/commit/d70a76f1d6e5fdb5e7dd0a3c45f7c6acf4f8a94f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Make 'global' accept list of variables
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 7463a9e..2081ebd 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -105,13 +105,14 @@ _lingo->executeScript(kMovieScript, 2);
_lingo->addCode("--\n\
macro SHIPX\n\
-global x\n\
+global x, y\n\
set x = 5\n\
if x = 1 then\n\
go \"Zoom\"\n\
exit\n\
end if\n\
if x >1 then\n\
+set y = 10\n\
exit\n\
end if\n\
put 100\n\
@@ -138,11 +139,13 @@ end if\n\
", kMovieScript, 1);
_lingo->addCode("check(2, 3)\n\
-global x\n\
+global x, y\n\
+set y = 8\n\
shipx\n\
put x\n\
zipx\n\
put x\n\
+put y\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 80229c7..13630f5 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -422,18 +422,18 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 55
+#define YYFINAL 56
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 264
+#define YYLAST 260
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 53
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 23
+#define YYNNTS 24
/* YYNRULES -- Number of rules. */
-#define YYNRULES 77
+#define YYNRULES 79
/* YYNRULES -- Number of states. */
-#define YYNSTATES 160
+#define YYNSTATES 163
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -487,16 +487,16 @@ static const yytype_uint16 yyprhs[] =
81, 94, 96, 100, 104, 107, 111, 113, 114, 115,
116, 119, 122, 124, 126, 128, 132, 136, 140, 144,
148, 152, 156, 160, 164, 167, 170, 174, 179, 182,
- 185, 188, 190, 192, 195, 198, 201, 204, 207, 211,
- 214, 218, 221, 224, 226, 230, 233, 237, 238, 247,
- 248, 250, 254, 259, 260, 264, 265, 267
+ 185, 188, 190, 192, 195, 197, 201, 204, 207, 210,
+ 213, 217, 220, 224, 227, 230, 232, 236, 239, 243,
+ 244, 253, 254, 256, 260, 265, 266, 270, 271, 273
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
54, 0, -1, 55, 47, 54, -1, 55, -1, -1,
- 70, -1, 66, -1, 74, -1, 56, -1, 57, -1,
+ 71, -1, 66, -1, 75, -1, 56, -1, 57, -1,
1, -1, 28, 65, 19, 8, -1, 30, 8, 41,
65, -1, 30, 8, 32, 65, -1, 65, -1, 66,
-1, 61, 58, 31, 64, 63, 13, 18, -1, 61,
@@ -512,17 +512,17 @@ static const yytype_int8 yyrhs[] =
65, 45, 65, -1, 65, 50, 65, -1, 65, 51,
65, -1, 65, 40, 65, -1, 65, 35, 65, -1,
65, 36, 65, -1, 42, 65, -1, 43, 65, -1,
- 48, 65, 49, -1, 8, 48, 75, 49, -1, 22,
- 9, -1, 23, 8, -1, 28, 65, -1, 67, -1,
- 14, -1, 16, 8, -1, 17, 20, -1, 17, 25,
- -1, 17, 27, -1, 17, 68, -1, 17, 68, 69,
- -1, 17, 69, -1, 32, 15, 9, -1, 15, 9,
- -1, 32, 9, -1, 9, -1, 26, 24, 9, -1,
- 24, 9, -1, 32, 24, 9, -1, -1, 21, 8,
- 71, 62, 72, 47, 73, 64, -1, -1, 8, -1,
- 72, 52, 8, -1, 72, 47, 52, 8, -1, -1,
- 8, 62, 75, -1, -1, 65, -1, 75, 52, 65,
- -1
+ 48, 65, 49, -1, 8, 48, 76, 49, -1, 22,
+ 9, -1, 23, 8, -1, 28, 65, -1, 68, -1,
+ 14, -1, 16, 67, -1, 8, -1, 67, 52, 8,
+ -1, 17, 20, -1, 17, 25, -1, 17, 27, -1,
+ 17, 69, -1, 17, 69, 70, -1, 17, 70, -1,
+ 32, 15, 9, -1, 15, 9, -1, 32, 9, -1,
+ 9, -1, 26, 24, 9, -1, 24, 9, -1, 32,
+ 24, 9, -1, -1, 21, 8, 72, 62, 73, 47,
+ 74, 64, -1, -1, 8, -1, 73, 52, 8, -1,
+ 73, 47, 52, 8, -1, -1, 8, 62, 76, -1,
+ -1, 65, -1, 76, 52, 65, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -533,9 +533,9 @@ static const yytype_uint16 yyrline[] =
172, 186, 187, 188, 190, 192, 198, 200, 202, 204,
205, 206, 209, 214, 217, 218, 219, 220, 221, 222,
223, 224, 225, 226, 227, 228, 229, 232, 238, 239,
- 240, 241, 242, 243, 254, 255, 256, 257, 262, 268,
- 275, 276, 277, 278, 281, 282, 283, 311, 311, 317,
- 318, 319, 320, 322, 325, 333, 334, 335
+ 240, 241, 242, 243, 246, 247, 258, 259, 260, 261,
+ 266, 272, 279, 280, 281, 282, 285, 286, 287, 315,
+ 315, 321, 322, 323, 324, 326, 329, 337, 338, 339
};
#endif
@@ -552,8 +552,8 @@ static const char *const yytname[] =
"tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'",
"'>'", "'<'", "','", "$accept", "program", "programline", "asgn", "stmt",
"cond", "repeatwhile", "repeatwith", "if", "begin", "end", "stmtlist",
- "expr", "func", "gotofunc", "gotoframe", "gotomovie", "defn", "@1",
- "argdef", "argstore", "macro", "arglist", 0
+ "expr", "func", "globallist", "gotofunc", "gotoframe", "gotomovie",
+ "defn", "@1", "argdef", "argstore", "macro", "arglist", 0
};
#endif
@@ -579,9 +579,9 @@ static const yytype_uint8 yyr1[] =
57, 58, 58, 58, 59, 60, 61, 62, 63, 64,
64, 64, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 65, 65, 65, 65, 65, 66, 66, 66,
- 66, 66, 66, 66, 67, 67, 67, 67, 67, 67,
- 68, 68, 68, 68, 69, 69, 69, 71, 70, 72,
- 72, 72, 72, 73, 74, 75, 75, 75
+ 66, 66, 66, 66, 67, 67, 68, 68, 68, 68,
+ 68, 68, 69, 69, 69, 69, 70, 70, 70, 72,
+ 71, 73, 73, 73, 73, 74, 75, 76, 76, 76
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -592,9 +592,9 @@ static const yytype_uint8 yyr2[] =
12, 1, 3, 3, 2, 3, 1, 0, 0, 0,
2, 2, 1, 1, 1, 3, 3, 3, 3, 3,
3, 3, 3, 3, 2, 2, 3, 4, 2, 2,
- 2, 1, 1, 2, 2, 2, 2, 2, 3, 2,
- 3, 2, 2, 1, 3, 2, 3, 0, 8, 0,
- 1, 3, 4, 0, 3, 0, 1, 3
+ 2, 1, 1, 2, 1, 3, 2, 2, 2, 2,
+ 3, 2, 3, 2, 2, 1, 3, 2, 3, 0,
+ 8, 0, 1, 3, 4, 0, 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -604,59 +604,61 @@ static const yytype_uint8 yydefact[] =
{
0, 10, 32, 27, 52, 0, 0, 26, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 3, 34,
- 9, 0, 0, 0, 14, 6, 51, 5, 7, 75,
- 75, 53, 63, 0, 54, 0, 55, 0, 56, 0,
- 57, 59, 67, 48, 49, 33, 0, 34, 50, 0,
- 24, 0, 44, 45, 0, 1, 0, 0, 0, 0,
- 0, 21, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 76, 0, 74, 61, 65, 0, 62, 0, 0,
- 0, 58, 27, 0, 0, 25, 0, 0, 46, 2,
- 0, 28, 0, 0, 29, 0, 42, 43, 41, 35,
- 36, 37, 38, 39, 40, 47, 0, 64, 60, 66,
- 69, 11, 13, 12, 29, 0, 23, 28, 22, 77,
- 70, 0, 28, 0, 0, 33, 30, 31, 0, 15,
- 73, 0, 0, 0, 28, 29, 0, 0, 29, 71,
- 0, 28, 29, 28, 16, 72, 68, 18, 29, 28,
- 0, 28, 0, 0, 0, 0, 17, 0, 19, 20
+ 9, 0, 0, 0, 14, 6, 51, 5, 7, 77,
+ 77, 54, 53, 65, 0, 56, 0, 57, 0, 58,
+ 0, 59, 61, 69, 48, 49, 33, 0, 34, 50,
+ 0, 24, 0, 44, 45, 0, 1, 0, 0, 0,
+ 0, 0, 21, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 78, 0, 76, 0, 63, 67, 0, 64,
+ 0, 0, 0, 60, 27, 0, 0, 25, 0, 0,
+ 46, 2, 0, 28, 0, 0, 29, 0, 42, 43,
+ 41, 35, 36, 37, 38, 39, 40, 47, 0, 55,
+ 66, 62, 68, 71, 11, 13, 12, 29, 0, 23,
+ 28, 22, 79, 72, 0, 28, 0, 0, 33, 30,
+ 31, 0, 15, 75, 0, 0, 0, 28, 29, 0,
+ 0, 29, 73, 0, 28, 29, 28, 16, 74, 70,
+ 18, 29, 28, 0, 28, 0, 0, 0, 0, 17,
+ 0, 19, 20
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 17, 18, 47, 127, 60, 21, 22, 23, 30,
- 115, 117, 24, 129, 26, 40, 41, 27, 82, 121,
- 138, 28, 72
+ -1, 17, 18, 48, 130, 61, 21, 22, 23, 30,
+ 118, 120, 24, 132, 32, 26, 41, 42, 27, 84,
+ 124, 141, 28, 73
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -108
+#define YYPACT_NINF -117
static const yytype_int16 yypact[] =
{
- 82, -108, -108, 196, -108, 1, 5, -108, 13, 4,
- 25, 37, 27, 42, 37, 37, 37, 74, 31, 2,
- -108, 38, 46, 111, 184, -108, -108, -108, -108, 37,
- 37, -108, -108, 84, -108, 93, -108, 67, -108, 57,
- 45, -108, -108, -108, -108, -108, 37, -108, 136, 98,
- -108, -15, -12, -12, 160, -108, 82, 111, 37, 111,
- 77, 172, 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 184, 40, 62, -108, -108, 100, -108, 106, 107,
- 94, -108, -108, 136, 112, -108, 37, 37, -108, -108,
- 72, 184, 78, 148, -108, 37, 184, 184, 184, 213,
- 213, -12, -12, 184, 184, -108, 37, -108, -108, -108,
- 115, -108, 184, 184, -108, -10, -108, 120, 184, 184,
- -108, -36, 120, 99, 37, 85, -108, -108, 28, -108,
- 80, 127, 131, 37, 184, -108, 122, 137, -108, -108,
- 117, 184, -108, 120, -108, -108, 120, -108, -108, 120,
- 134, 120, 138, 139, 143, 123, -108, 129, -108, -108
+ 66, -117, -117, 192, -117, 26, 151, -117, 29, 32,
+ 36, 3, -13, 42, 3, 3, 3, 62, 28, 14,
+ -117, 25, 38, 63, 180, -117, -117, -117, -117, 3,
+ 3, -117, 33, -117, 72, -117, 81, -117, 68, -117,
+ 15, 44, -117, -117, -117, -117, -117, 3, -117, 119,
+ 92, -117, -15, -8, -8, 156, -117, 66, 63, 3,
+ 63, 70, 168, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 180, -36, 50, 95, -117, -117, 98, -117,
+ 106, 108, 80, -117, -117, 119, 111, -117, 3, 3,
+ -117, -117, 74, 180, 79, 144, -117, 3, 180, 180,
+ 180, 209, 209, -8, -8, 180, 180, -117, 3, -117,
+ -117, -117, -117, 122, -117, 180, 180, -117, -9, -117,
+ 104, 180, 180, -117, -37, 104, 99, 3, 87, -117,
+ -117, 86, -117, 84, 129, 126, 3, 180, -117, 124,
+ 132, -117, -117, 114, 180, -117, 104, -117, -117, 104,
+ -117, -117, 104, 131, 104, 136, 127, 140, 128, -117,
+ 138, -117, -117
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -108, 104, -108, 6, 7, 11, -108, -108, -108, 79,
- -107, -41, -11, 8, -108, -108, 124, -108, -108, -108,
- -108, -108, 135
+ -117, 115, -117, 6, 7, -20, -117, -117, -117, 89,
+ 4, -116, -11, 8, -117, -117, -117, 133, -117, -117,
+ -117, -117, -117, 135
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -666,64 +668,64 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -34
static const yytype_int16 yytable[] =
{
- 48, 123, -8, 52, 53, 54, 19, 20, 25, 31,
- 128, 130, 61, 43, 32, 132, 131, 86, 71, 71,
- 33, 42, 124, 62, 63, 34, 87, 142, 64, 35,
- 36, 37, 38, 44, 148, 83, 150, 39, 69, 70,
- 135, 136, 152, 2, 154, 45, 61, 91, 93, -8,
- 51, 96, 97, 98, 99, 100, 101, 102, 103, 104,
- 49, 50, 19, 20, 25, 46, 77, 13, 90, 35,
- 92, 37, 78, 122, 55, 112, 113, 80, 56, 14,
- 15, 79, -4, 1, 118, 16, 57, 58, 2, 105,
- 3, 76, 106, 74, 143, 119, 4, 146, 5, 6,
- 7, 149, 75, 8, 9, 10, 85, 151, 94, 107,
- 11, 12, 13, 134, 106, 108, 109, 2, 79, 45,
- 111, 114, 141, 120, 14, 15, 2, 116, 125, -4,
- 16, 133, 137, 29, 4, 139, 5, 6, 7, 46,
- 144, 13, 9, 10, 140, 145, 147, 153, 11, 12,
- 13, 155, 158, 14, 15, 84, 157, 156, 159, 59,
- 89, 110, 14, 15, 81, 73, 0, 126, 16, 0,
- 0, 62, 63, 0, 0, 0, 64, 0, 65, 66,
- 67, 68, 0, 62, 63, 0, 69, 70, 64, 95,
- 65, 66, 67, 68, 0, 62, 63, 88, 69, 70,
- 64, 0, 65, 66, 67, 68, 0, 62, 63, 88,
- 69, 70, 64, 95, 65, 66, 67, 68, 0, 62,
- 63, 0, 69, 70, 64, 0, 65, 66, 67, 68,
- 0, -33, -33, 0, 69, 70, -33, 0, 0, 0,
- -33, -33, 0, 0, 29, 0, -33, -33, 62, 63,
- 0, 0, 0, 64, 0, 0, 0, 67, 68, 0,
- 0, 0, 0, 69, 70
+ 49, 125, 126, 53, 54, 55, 19, 20, 25, 2,
+ 133, 46, 62, 107, -8, 134, 108, 88, 72, 72,
+ 50, 51, 146, 127, 79, 149, 89, 63, 64, 152,
+ 80, 47, 65, 13, 31, 154, 85, 43, 92, 81,
+ 94, 44, 70, 71, 45, 14, 15, 62, 93, 95,
+ 52, 16, 98, 99, 100, 101, 102, 103, 104, 105,
+ 106, -8, 56, 19, 20, 25, -4, 1, 36, 2,
+ 38, 46, 2, 58, 3, 57, 82, 115, 116, 59,
+ 4, 76, 5, 6, 7, 75, 121, 8, 9, 10,
+ 77, 47, 78, 13, 11, 12, 13, 122, 138, 139,
+ 87, 96, 108, 109, 81, 14, 15, 110, 14, 15,
+ 2, 60, 128, -4, 16, 111, 137, 112, 4, 114,
+ 5, 6, 7, 117, 131, 144, 9, 10, 119, 135,
+ 123, 136, 11, 12, 13, 29, 140, 142, 86, 143,
+ 148, 145, 147, 150, 156, 159, 14, 15, 151, 158,
+ 153, 129, 16, 160, 63, 64, 155, 161, 157, 65,
+ 33, 66, 67, 68, 69, 74, 34, 162, 0, 70,
+ 71, 35, 91, 113, 83, 36, 37, 38, 39, 63,
+ 64, 0, 0, 40, 65, 97, 66, 67, 68, 69,
+ 0, 63, 64, 90, 70, 71, 65, 0, 66, 67,
+ 68, 69, 0, 63, 64, 90, 70, 71, 65, 97,
+ 66, 67, 68, 69, 0, 63, 64, 0, 70, 71,
+ 65, 0, 66, 67, 68, 69, 0, -33, -33, 0,
+ 70, 71, -33, 0, 0, 0, -33, -33, 0, 0,
+ 29, 0, -33, -33, 63, 64, 0, 0, 0, 65,
+ 0, 0, 0, 68, 69, 0, 0, 0, 0, 70,
+ 71
};
static const yytype_int16 yycheck[] =
{
- 11, 11, 0, 14, 15, 16, 0, 0, 0, 8,
- 117, 47, 23, 9, 9, 122, 52, 32, 29, 30,
- 15, 8, 32, 35, 36, 20, 41, 134, 40, 24,
- 25, 26, 27, 8, 141, 46, 143, 32, 50, 51,
- 12, 13, 149, 6, 151, 8, 57, 58, 59, 47,
- 8, 62, 63, 64, 65, 66, 67, 68, 69, 70,
- 33, 34, 56, 56, 56, 28, 9, 30, 57, 24,
- 59, 26, 15, 114, 0, 86, 87, 32, 47, 42,
- 43, 24, 0, 1, 95, 48, 48, 41, 6, 49,
- 8, 24, 52, 9, 135, 106, 14, 138, 16, 17,
- 18, 142, 9, 21, 22, 23, 8, 148, 31, 9,
- 28, 29, 30, 124, 52, 9, 9, 6, 24, 8,
- 8, 49, 133, 8, 42, 43, 6, 49, 8, 47,
- 48, 32, 52, 48, 14, 8, 16, 17, 18, 28,
- 18, 30, 22, 23, 13, 8, 29, 13, 28, 29,
- 30, 13, 29, 42, 43, 19, 13, 18, 29, 48,
- 56, 82, 42, 43, 40, 30, -1, 47, 48, -1,
- -1, 35, 36, -1, -1, -1, 40, -1, 42, 43,
- 44, 45, -1, 35, 36, -1, 50, 51, 40, 41,
- 42, 43, 44, 45, -1, 35, 36, 49, 50, 51,
- 40, -1, 42, 43, 44, 45, -1, 35, 36, 49,
- 50, 51, 40, 41, 42, 43, 44, 45, -1, 35,
- 36, -1, 50, 51, 40, -1, 42, 43, 44, 45,
- -1, 35, 36, -1, 50, 51, 40, -1, -1, -1,
- 44, 45, -1, -1, 48, -1, 50, 51, 35, 36,
- -1, -1, -1, 40, -1, -1, -1, 44, 45, -1,
- -1, -1, -1, 50, 51
+ 11, 117, 11, 14, 15, 16, 0, 0, 0, 6,
+ 47, 8, 23, 49, 0, 52, 52, 32, 29, 30,
+ 33, 34, 138, 32, 9, 141, 41, 35, 36, 145,
+ 15, 28, 40, 30, 8, 151, 47, 8, 58, 24,
+ 60, 9, 50, 51, 8, 42, 43, 58, 59, 60,
+ 8, 48, 63, 64, 65, 66, 67, 68, 69, 70,
+ 71, 47, 0, 57, 57, 57, 0, 1, 24, 6,
+ 26, 8, 6, 48, 8, 47, 32, 88, 89, 41,
+ 14, 9, 16, 17, 18, 52, 97, 21, 22, 23,
+ 9, 28, 24, 30, 28, 29, 30, 108, 12, 13,
+ 8, 31, 52, 8, 24, 42, 43, 9, 42, 43,
+ 6, 48, 8, 47, 48, 9, 127, 9, 14, 8,
+ 16, 17, 18, 49, 120, 136, 22, 23, 49, 125,
+ 8, 32, 28, 29, 30, 48, 52, 8, 19, 13,
+ 8, 137, 18, 29, 13, 18, 42, 43, 144, 13,
+ 146, 47, 48, 13, 35, 36, 152, 29, 154, 40,
+ 9, 42, 43, 44, 45, 30, 15, 29, -1, 50,
+ 51, 20, 57, 84, 41, 24, 25, 26, 27, 35,
+ 36, -1, -1, 32, 40, 41, 42, 43, 44, 45,
+ -1, 35, 36, 49, 50, 51, 40, -1, 42, 43,
+ 44, 45, -1, 35, 36, 49, 50, 51, 40, 41,
+ 42, 43, 44, 45, -1, 35, 36, -1, 50, 51,
+ 40, -1, 42, 43, 44, 45, -1, 35, 36, -1,
+ 50, 51, 40, -1, -1, -1, 44, 45, -1, -1,
+ 48, -1, 50, 51, 35, 36, -1, -1, -1, 40,
+ -1, -1, -1, 44, 45, -1, -1, -1, -1, 50,
+ 51
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -732,20 +734,21 @@ static const yytype_uint8 yystos[] =
{
0, 1, 6, 8, 14, 16, 17, 18, 21, 22,
23, 28, 29, 30, 42, 43, 48, 54, 55, 56,
- 57, 59, 60, 61, 65, 66, 67, 70, 74, 48,
- 62, 8, 9, 15, 20, 24, 25, 26, 27, 32,
- 68, 69, 8, 9, 8, 8, 28, 56, 65, 33,
- 34, 8, 65, 65, 65, 0, 47, 48, 41, 48,
- 58, 65, 35, 36, 40, 42, 43, 44, 45, 50,
- 51, 65, 75, 75, 9, 9, 24, 9, 15, 24,
- 32, 69, 71, 65, 19, 8, 32, 41, 49, 54,
- 58, 65, 58, 65, 31, 41, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 49, 52, 9, 9, 9,
- 62, 8, 65, 65, 49, 63, 49, 64, 65, 65,
- 8, 72, 64, 11, 32, 8, 47, 57, 63, 66,
- 47, 52, 63, 32, 65, 12, 13, 52, 73, 8,
- 13, 65, 63, 64, 18, 8, 64, 29, 63, 64,
- 63, 64, 63, 13, 63, 13, 18, 13, 29, 29
+ 57, 59, 60, 61, 65, 66, 68, 71, 75, 48,
+ 62, 8, 67, 9, 15, 20, 24, 25, 26, 27,
+ 32, 69, 70, 8, 9, 8, 8, 28, 56, 65,
+ 33, 34, 8, 65, 65, 65, 0, 47, 48, 41,
+ 48, 58, 65, 35, 36, 40, 42, 43, 44, 45,
+ 50, 51, 65, 76, 76, 52, 9, 9, 24, 9,
+ 15, 24, 32, 70, 72, 65, 19, 8, 32, 41,
+ 49, 54, 58, 65, 58, 65, 31, 41, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 49, 52, 8,
+ 9, 9, 9, 62, 8, 65, 65, 49, 63, 49,
+ 64, 65, 65, 8, 73, 64, 11, 32, 8, 47,
+ 57, 63, 66, 47, 52, 63, 32, 65, 12, 13,
+ 52, 74, 8, 13, 65, 63, 64, 18, 8, 64,
+ 29, 63, 64, 63, 64, 63, 13, 63, 13, 18,
+ 13, 29, 29
};
#define yyerrok (yyerrstatus = 0)
@@ -1818,28 +1821,33 @@ yyreduce:
{ g_lingo->code1(g_lingo->c_exit); ;}
break;
- case 53:
-#line 243 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
+ case 54:
+#line 246 "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 54:
-#line 254 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 247 "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 56:
+#line 258 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 55:
-#line 255 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 259 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 56:
-#line 256 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 260 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 57:
-#line 257 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 261 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1847,8 +1855,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 58:
-#line 262 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 266 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1857,8 +1865,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 59:
-#line 268 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 272 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1866,81 +1874,81 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 60:
-#line 275 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 279 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 61:
-#line 276 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 280 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 62:
-#line 277 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 281 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 63:
-#line 278 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 282 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 64:
-#line 281 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 285 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 65:
-#line 282 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 286 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 66:
-#line 283 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 287 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 67:
-#line 311 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 315 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 68:
-#line 312 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 316 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*(yyvsp[(2) - (8)].s), (yyvsp[(4) - (8)].code), (yyvsp[(5) - (8)].narg));
g_lingo->_indef = false; ;}
break;
- case 69:
-#line 317 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 321 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 70:
-#line 318 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 322 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 71:
-#line 319 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 323 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 72:
-#line 320 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 324 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 73:
-#line 322 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 326 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 74:
-#line 325 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 329 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -1949,24 +1957,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 75:
-#line 333 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 337 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 76:
-#line 334 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 338 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 77:
-#line 335 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 339 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 1970 "engines/director/lingo/lingo-gr.cpp"
+#line 1978 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2180,6 +2188,6 @@ yyreturn:
}
-#line 338 "engines/director/lingo/lingo-gr.y"
+#line 342 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 2084c70..73dc4f0 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -240,7 +240,11 @@ func: ID '(' arglist ')' {
| tPUT expr { g_lingo->code1(g_lingo->c_printtop); }
| gotofunc
| tEXIT { g_lingo->code1(g_lingo->c_exit); }
- | tGLOBAL ID { g_lingo->code1(g_lingo->c_global); g_lingo->codeString($2->c_str()); delete $2; }
+ | tGLOBAL globallist
+ ;
+
+globallist: ID { g_lingo->code1(g_lingo->c_global); g_lingo->codeString($1->c_str()); delete $1; }
+ | globallist ',' ID { g_lingo->code1(g_lingo->c_global); g_lingo->codeString($3->c_str()); delete $3; }
;
// go {to} {frame} whichFrame {of movie whichMovie}
Commit: 0f58203c021512396d8e3a32ada41f49eb0e1880
https://github.com/scummvm/scummvm/commit/0f58203c021512396d8e3a32ada41f49eb0e1880
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix rendering resource, loading shared BMP
Changed paths:
engines/director/director.cpp
engines/director/director.h
engines/director/score.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 2081ebd..c7ae940 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -58,6 +58,11 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
_currentPalette = 0;
//FIXME
_sharedMMM = "SHARDCST.MMM";
+ _sharedCasts = new Common::HashMap<int, Cast *>();
+ _sharedDIB = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>();
+ _sharedBMP = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>();
+ _sharedSTXT = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>();
+ _sharedSound = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>();
_movies = new Common::HashMap<Common::String, Score *>();
const Common::FSNode gameDataDir(ConfMan.get("path"));
@@ -423,6 +428,15 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) {
}
}
+ Common::Array<uint16> bmp = shardcst->getResourceIDList(MKTAG('B','I','T','D'));
+
+ if (bmp.size() != 0) {
+ Common::Array<uint16>::iterator iterator;
+ for (iterator = bmp.begin(); iterator != bmp.end(); ++iterator) {
+ _sharedBMP->setVal(*iterator, shardcst->getResource(MKTAG('B','I','T','D'), *iterator));
+ }
+ }
+
Common::Array<uint16> sound = shardcst->getResourceIDList(MKTAG('S','N','D',' '));
if (stxt.size() != 0) {
diff --git a/engines/director/director.h b/engines/director/director.h
index a3e0ad0..2d0b734 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -69,6 +69,7 @@ public:
uint16 getPaletteColorCount() const { return _currentPaletteLength; }
void loadSharedCastsFrom(Common::String filename);
Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *getSharedDIB() const { return _sharedDIB; }
+ Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *getSharedBMP() const { return _sharedBMP; }
Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *getSharedSTXT() const { return _sharedSTXT; }
Common::HashMap<int, Cast *> *getSharedCasts() const { return _sharedCasts; }
@@ -98,6 +99,7 @@ private:
Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *_sharedDIB;
Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *_sharedSTXT;
Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *_sharedSound;
+ Common::HashMap<int, Common::SeekableSubReadStreamEndian *> *_sharedBMP;
Archive *_mainArchive;
Common::MacResManager *_macBinary;
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index c51c6cc..6b9cdb2 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1164,6 +1164,10 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
Image::ImageDecoder *img = getImageFrom(_sprites[i]->_castId);
+ if (!img) {
+ continue;
+ }
+
uint32 regX = static_cast<BitmapCast *>(_sprites[i]->_cast)->regX;
uint32 regY = static_cast<BitmapCast *>(_sprites[i]->_cast)->regY;
uint32 rectLeft = static_cast<BitmapCast *>(_sprites[i]->_cast)->initialRect.left;
@@ -1224,7 +1228,11 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
return img;
}
- //TODO Shared bitmaps
+ if (_vm->getSharedBMP()->contains(imgId)) {
+ img = new Image::BitmapDecoder();
+ img->loadStream(*_vm->getSharedBMP()->getVal(imgId));
+ return img;
+ }
warning("Image %d not found", spriteId);
return img;
Commit: b460a7c03601952e4e60c565893bdaf90ae92f33
https://github.com/scummvm/scummvm/commit/b460a7c03601952e4e60c565893bdaf90ae92f33
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Calculate values for text rendering
Changed paths:
engines/director/director.cpp
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index c7ae940..a6422df 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -201,7 +201,6 @@ end repeat\n\
//FIXME
_mainArchive = new RIFFArchive();
_mainArchive->openFile("bookshelf_example.mmm");
-
_currentScore = new Score(this);
debug(0, "Score name %s", _currentScore->getMacName().c_str());
@@ -415,15 +414,17 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) {
if (dib.size() != 0) {
Common::Array<uint16>::iterator iterator;
for (iterator = dib.begin(); iterator != dib.end(); ++iterator) {
+ debug(3, "Shared DIB %d", *iterator);
_sharedDIB->setVal(*iterator, shardcst->getResource(MKTAG('D','I','B',' '), *iterator));
}
}
- Common::Array<uint16> stxt = shardcst->getResourceIDList(MKTAG('D','I','B',' '));
+ Common::Array<uint16> stxt = shardcst->getResourceIDList(MKTAG('S','T','X','T'));
if (stxt.size() != 0) {
Common::Array<uint16>::iterator iterator;
for (iterator = stxt.begin(); iterator != stxt.end(); ++iterator) {
+ debug(3, "Shared STXT %d", *iterator);
_sharedSTXT->setVal(*iterator, shardcst->getResource(MKTAG('S','T','X','T'), *iterator));
}
}
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 6b9cdb2..c799eef 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1240,7 +1240,35 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID) {
- warning("STUB: renderText()");
+ Cast *textCast = _vm->_currentScore->_casts[_sprites[spriteID]->_castId];
+ Common::SeekableSubReadStreamEndian *textStream;
+
+ if (_vm->_currentScore->_movieArchive->hasResource(MKTAG('S','T','X','T'), spriteID + 1024)) {
+ textStream = _vm->_currentScore->_movieArchive->getResource(MKTAG('S','T','X','T'), spriteID + 1024);
+ } else {
+ textStream = _vm->getSharedSTXT()->getVal(spriteID + 1024);
+ }
+ /*uint32 unk1 = */ textStream->readUint32();
+ uint32 strLen = textStream->readUint32();
+ /*uin32 dataLen = */ textStream->readUint32();
+ Common::String text;
+
+ for (uint32 i = 0; i < strLen; i++) {
+ byte ch = textStream->readByte();
+ if (ch == 0x0d) {
+ ch = '\n';
+ }
+ text += ch;
+ }
+
+ uint32 rectLeft = static_cast<TextCast *>(_sprites[spriteID]->_cast)->initialRect.left;
+ uint32 rectTop = static_cast<TextCast *>(_sprites[spriteID]->_cast)->initialRect.top;
+
+ int x = _sprites[spriteID]->_startPoint.x + rectLeft;
+ int y = _sprites[spriteID]->_startPoint.y + rectTop;
+ int height = _sprites[spriteID]->_height;
+ int width = _sprites[spriteID]->_width;
+ //TODO render text
}
void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
diff --git a/engines/director/score.h b/engines/director/score.h
index 9f13df7..b616e11 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -30,6 +30,7 @@
#include "graphics/managed_surface.h"
#include "common/str.h"
#include "image/image_decoder.h"
+#include "graphics/font.h"
namespace Director {
@@ -290,7 +291,6 @@ public:
Frame(DirectorEngine *vm);
Frame(const Frame &frame);
~Frame();
-
void readChannel(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
void prepareFrame(Score *score);
uint16 getSpriteIDFromPos(Common::Point pos);
@@ -378,6 +378,7 @@ public:
Common::HashMap<uint16, Common::String> _fontMap;
Graphics::ManagedSurface *_surface;
Graphics::ManagedSurface *_trailSurface;
+ Graphics::Font *_font;
Archive *_movieArchive;
Common::Rect _movieRect;
Commit: 2ad3d3a236d579565d74f67863fc8a78c0882b64
https://github.com/scummvm/scummvm/commit/2ad3d3a236d579565d74f67863fc8a78c0882b64
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Simple text rendering
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index c799eef..82b7ebf 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -37,6 +37,7 @@
#include "engines/util.h"
#include "graphics/managed_surface.h"
#include "image/bmp.h"
+#include "graphics/fontman.h"
namespace Director {
@@ -1268,7 +1269,9 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID) {
int y = _sprites[spriteID]->_startPoint.y + rectTop;
int height = _sprites[spriteID]->_height;
int width = _sprites[spriteID]->_width;
- //TODO render text
+
+ //FIXME
+ FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont)->drawString(&surface, text, x, y, width, 0);
}
void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
Commit: 061f868d7917f3104c294041ab51ac08f1fd0e38
https://github.com/scummvm/scummvm/commit/061f868d7917f3104c294041ab51ac08f1fd0e38
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Free memory, fix render text ID
Changed paths:
engines/director/director.cpp
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index a6422df..8616317 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -52,28 +52,37 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
// Setup mixer
syncSoundSettings();
-
- _mainArchive = 0;
- _macBinary = 0;
- _currentPalette = 0;
- //FIXME
- _sharedMMM = "SHARDCST.MMM";
_sharedCasts = new Common::HashMap<int, Cast *>();
_sharedDIB = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>();
_sharedBMP = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>();
_sharedSTXT = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>();
_sharedSound = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>();
+ _mainArchive = 0;
+ _macBinary = 0;
+ //FIXME
+ _sharedMMM = "SHARDCST.MMM";
_movies = new Common::HashMap<Common::String, Score *>();
+
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "data");
SearchMan.addSubDirectoryMatching(gameDataDir, "install");
}
DirectorEngine::~DirectorEngine() {
+ delete[] _sharedCasts;
+ delete[] _sharedSound;
+ delete[] _sharedBMP;
+ delete[] _sharedSTXT;
+ delete[] _sharedDIB;
+ delete[] _movies;
+
delete _mainArchive;
delete _macBinary;
- delete[] _currentPalette;
+ delete _soundManager;
+ delete _lingo;
+ delete _currentScore;
+ delete _currentPalette;
}
Common::Error DirectorEngine::run() {
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 82b7ebf..fc24de7 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -125,7 +125,19 @@ Score::~Score() {
delete _trailSurface;
_movieArchive->close();
+
+ delete _surface;
+ delete _trailSurface;
+
+ delete _font;
delete _movieArchive;
+
+ delete[] _labels;
+ delete[] &_frames;
+ delete[] &_casts;
+ delete[] &_castsInfo;
+ delete[] &_actions;
+ delete[] &_fontMap;
}
void Score::loadPalette(Common::SeekableSubReadStreamEndian &stream) {
@@ -810,9 +822,9 @@ Frame::Frame(const Frame &frame) {
}
Frame::~Frame() {
- for (uint16 i = 0; i < _sprites.size(); i++) {
- delete _sprites[i];
- }
+ delete[] &_sprites;
+ delete[] &_drawRects;
+ delete _palette;
}
void Frame::readChannel(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size) {
@@ -1166,6 +1178,7 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
Image::ImageDecoder *img = getImageFrom(_sprites[i]->_castId);
if (!img) {
+ warning("Image with id %d not found", _sprites[i]->_castId);
continue;
}
@@ -1241,11 +1254,12 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID) {
- Cast *textCast = _vm->_currentScore->_casts[_sprites[spriteID]->_castId];
+ uint16 castID = _sprites[spriteID]->_castId;
+ Cast *textCast = _vm->_currentScore->_casts[castID];
Common::SeekableSubReadStreamEndian *textStream;
- if (_vm->_currentScore->_movieArchive->hasResource(MKTAG('S','T','X','T'), spriteID + 1024)) {
- textStream = _vm->_currentScore->_movieArchive->getResource(MKTAG('S','T','X','T'), spriteID + 1024);
+ if (_vm->_currentScore->_movieArchive->hasResource(MKTAG('S','T','X','T'), castID + 1024)) {
+ textStream = _vm->_currentScore->_movieArchive->getResource(MKTAG('S','T','X','T'), castID + 1024);
} else {
textStream = _vm->getSharedSTXT()->getVal(spriteID + 1024);
}
@@ -1410,4 +1424,9 @@ Sprite::Sprite(const Sprite &sprite) {
_startPoint.y = sprite._startPoint.y;
}
+Sprite::~Sprite() {
+ delete _cast;
+ delete &_startPoint;
+}
+
} //End of namespace Director
diff --git a/engines/director/score.h b/engines/director/score.h
index b616e11..459d2e9 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -274,7 +274,7 @@ class Sprite {
public:
Sprite();
Sprite(const Sprite &sprite);
-
+ ~Sprite();
bool _enabled;
byte _castId;
InkType _ink;
@@ -299,7 +299,7 @@ private:
void playTransition(Score *score);
void playSoundChannel();
void renderSprites(Graphics::ManagedSurface &surface, bool renderTrail);
- void renderText(Graphics::ManagedSurface &surface, uint16 spriteID);
+ void renderText(Graphics::ManagedSurface &surface, uint16 castId);
void readPaletteInfo(Common::SeekableSubReadStreamEndian &stream);
void readSprite(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
void readMainChannels(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
Commit: 8cc88b6fcad2195883f058a2cd0cb3f7c2414acd
https://github.com/scummvm/scummvm/commit/8cc88b6fcad2195883f058a2cd0cb3f7c2414acd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Initial code for built-in functions
Changed paths:
A engines/director/lingo/lingo-builtins.cpp
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
engines/director/module.mk
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
new file mode 100644
index 0000000..2286bb7
--- /dev/null
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "engines/director/lingo/lingo.h"
+
+namespace Director {
+
+static struct BuiltinProto {
+ const char *name;
+ void (*func)(void);
+ int nparams;
+} builtins[] = {
+ { "random", Lingo::b_random, 1},
+ { 0, 0, 0 }
+};
+
+void Lingo::initBuiltIns() {
+ for (BuiltinProto *blt = builtins; blt->name; blt++) {
+ _builtins[blt->name] = new Builtin(blt->func, blt->nparams);
+ }
+}
+
+void Lingo::b_random() {
+ Datum max = g_lingo->pop();
+ Datum res;
+
+ res.u.i = 5;
+ res.type = INT;
+
+ warning("b_random");
+ g_lingo->push(res);
+}
+
+}
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 89d30be..6e388dd 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -126,6 +126,23 @@ void Lingo::define(Common::String &name, int start, int nargs) {
sym->nargs = nargs;
}
+int Lingo::codeString(const char *str) {
+ int numInsts = calcStringAlignment(str);
+
+ // Where we copy the string over
+ int pos = _currentScript->size();
+
+ // Allocate needed space in script
+ for (int i = 0; i < numInsts; i++)
+ _currentScript->push_back(0);
+
+ byte *dst = (byte *)&_currentScript->front() + pos * sizeof(inst);
+
+ memcpy(dst, str, strlen(str) + 1);
+
+ return _currentScript->size();
+}
+
void Lingo::codeArg(Common::String *s) {
_argstack.push_back(s);
}
@@ -164,4 +181,24 @@ int Lingo::codeId_(Common::String &name) {
return ret;
}
+int Lingo::codeFunc(Common::String *name, int nargs) {
+ int ret;
+
+ if (!g_lingo->_builtins.contains(*name)) {
+ ret = g_lingo->code1(g_lingo->c_call);
+ g_lingo->codeString(name->c_str());
+
+ inst numpar = 0;
+ WRITE_UINT32(&numpar, nargs);
+ g_lingo->code1(numpar);
+ } else {
+ if (nargs != g_lingo->_builtins[*name]->nargs)
+ error("Built-in function %s expects %d arguments but got %d", name->c_str(), g_lingo->_builtins[*name]->nargs, nargs);
+
+ ret = g_lingo->code1(g_lingo->_builtins[*name]->func);
+ }
+
+ return ret;
+}
+
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 13630f5..01329d4 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -532,10 +532,10 @@ static const yytype_uint16 yyrline[] =
102, 105, 111, 117, 125, 126, 127, 133, 145, 156,
172, 186, 187, 188, 190, 192, 198, 200, 202, 204,
205, 206, 209, 214, 217, 218, 219, 220, 221, 222,
- 223, 224, 225, 226, 227, 228, 229, 232, 238, 239,
- 240, 241, 242, 243, 246, 247, 258, 259, 260, 261,
- 266, 272, 279, 280, 281, 282, 285, 286, 287, 315,
- 315, 321, 322, 323, 324, 326, 329, 337, 338, 339
+ 223, 224, 225, 226, 227, 228, 229, 232, 235, 236,
+ 237, 238, 239, 240, 243, 244, 255, 256, 257, 258,
+ 263, 269, 276, 277, 278, 279, 282, 283, 284, 312,
+ 312, 318, 319, 320, 321, 323, 326, 334, 335, 336
};
#endif
@@ -1794,60 +1794,57 @@ yyreduce:
case 47:
#line 232 "engines/director/lingo/lingo-gr.y"
{
- g_lingo->code1(g_lingo->c_call);
- g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
- inst numpar = 0;
- WRITE_UINT32(&numpar, (yyvsp[(3) - (4)].narg));
- g_lingo->code1(numpar); ;}
+ g_lingo->codeFunc((yyvsp[(1) - (4)].s), (yyvsp[(3) - (4)].narg));
+ delete (yyvsp[(1) - (4)].s); ;}
break;
case 48:
-#line 238 "engines/director/lingo/lingo-gr.y"
+#line 235 "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 49:
-#line 239 "engines/director/lingo/lingo-gr.y"
+#line 236 "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 50:
-#line 240 "engines/director/lingo/lingo-gr.y"
+#line 237 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 52:
-#line 242 "engines/director/lingo/lingo-gr.y"
+#line 239 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_exit); ;}
break;
case 54:
-#line 246 "engines/director/lingo/lingo-gr.y"
+#line 243 "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 55:
-#line 247 "engines/director/lingo/lingo-gr.y"
+#line 244 "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 56:
-#line 258 "engines/director/lingo/lingo-gr.y"
+#line 255 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 57:
-#line 259 "engines/director/lingo/lingo-gr.y"
+#line 256 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 58:
-#line 260 "engines/director/lingo/lingo-gr.y"
+#line 257 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 59:
-#line 261 "engines/director/lingo/lingo-gr.y"
+#line 258 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1856,7 +1853,7 @@ yyreduce:
break;
case 60:
-#line 266 "engines/director/lingo/lingo-gr.y"
+#line 263 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1866,7 +1863,7 @@ yyreduce:
break;
case 61:
-#line 272 "engines/director/lingo/lingo-gr.y"
+#line 269 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1875,47 +1872,47 @@ yyreduce:
break;
case 62:
-#line 279 "engines/director/lingo/lingo-gr.y"
+#line 276 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 63:
-#line 280 "engines/director/lingo/lingo-gr.y"
+#line 277 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 64:
-#line 281 "engines/director/lingo/lingo-gr.y"
+#line 278 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 65:
-#line 282 "engines/director/lingo/lingo-gr.y"
+#line 279 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 66:
-#line 285 "engines/director/lingo/lingo-gr.y"
+#line 282 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 67:
-#line 286 "engines/director/lingo/lingo-gr.y"
+#line 283 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 68:
-#line 287 "engines/director/lingo/lingo-gr.y"
+#line 284 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 69:
-#line 315 "engines/director/lingo/lingo-gr.y"
+#line 312 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 70:
-#line 316 "engines/director/lingo/lingo-gr.y"
+#line 313 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*(yyvsp[(2) - (8)].s), (yyvsp[(4) - (8)].code), (yyvsp[(5) - (8)].narg));
@@ -1923,32 +1920,32 @@ yyreduce:
break;
case 71:
-#line 321 "engines/director/lingo/lingo-gr.y"
+#line 318 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 72:
-#line 322 "engines/director/lingo/lingo-gr.y"
+#line 319 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 73:
-#line 323 "engines/director/lingo/lingo-gr.y"
+#line 320 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 74:
-#line 324 "engines/director/lingo/lingo-gr.y"
+#line 321 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 75:
-#line 326 "engines/director/lingo/lingo-gr.y"
+#line 323 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
case 76:
-#line 329 "engines/director/lingo/lingo-gr.y"
+#line 326 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -1958,23 +1955,23 @@ yyreduce:
break;
case 77:
-#line 337 "engines/director/lingo/lingo-gr.y"
+#line 334 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 78:
-#line 338 "engines/director/lingo/lingo-gr.y"
+#line 335 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
case 79:
-#line 339 "engines/director/lingo/lingo-gr.y"
+#line 336 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 1978 "engines/director/lingo/lingo-gr.cpp"
+#line 1975 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2188,6 +2185,6 @@ yyreturn:
}
-#line 342 "engines/director/lingo/lingo-gr.y"
+#line 339 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 73dc4f0..aac0f03 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -230,11 +230,8 @@ expr: INT {
;
func: ID '(' arglist ')' {
- g_lingo->code1(g_lingo->c_call);
- g_lingo->codeString($1->c_str());
- inst numpar = 0;
- WRITE_UINT32(&numpar, $3);
- g_lingo->code1(numpar); };
+ g_lingo->codeFunc($1, $3);
+ delete $1; }
| tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_str()); delete $2; }
| tMCIWAIT ID { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
| tPUT expr { g_lingo->code1(g_lingo->c_printtop); }
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index e584ac0..d8c3bdf 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -81,6 +81,8 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
for (const EventHandlerType *t = &eventHanlerDescs[0]; t->handler != kEventNone; ++t)
_eventHandlerTypes[t->handler] = t->name;
+ initBuiltIns();
+
_currentScript = 0;
_currentScriptType = kMovieScript;
_pc = 0;
@@ -93,23 +95,6 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
Lingo::~Lingo() {
}
-int Lingo::codeString(const char *str) {
- int numInsts = calcStringAlignment(str);
-
- // Where we copy the string over
- int pos = _currentScript->size();
-
- // Allocate needed space in script
- for (int i = 0; i < numInsts; i++)
- _currentScript->push_back(0);
-
- byte *dst = (byte *)&_currentScript->front() + pos * sizeof(inst);
-
- memcpy(dst, str, strlen(str) + 1);
-
- return _currentScript->size();
-}
-
void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
code += '\n';
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index f9c58f0..d1969c2 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -103,9 +103,17 @@ struct Datum { /* interpreter stack type */
Datum() { u.sym = NULL; type = VOID; }
};
+struct Builtin {
+ void (*func)(void);
+ int nargs;
+
+ Builtin(void (*func1)(void), int nargs1) : func(func1), nargs(nargs1) {}
+};
+
typedef Common::HashMap<int32, ScriptData *> ScriptHash;
typedef Common::Array<Datum> StackData;
typedef Common::HashMap<Common::String, Symbol *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> SymbolHash;
+typedef Common::HashMap<Common::String, Builtin *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> BuiltinHash;
struct CFrame { /* proc/func call stack frame */
Symbol *sp; /* symbol table entry */
@@ -124,6 +132,16 @@ public:
void processEvent(LEvent event, int entityId);
+ void initBuiltIns();
+
+public:
+ void execute(int pc);
+ void pushContext();
+ void popContext();
+ Symbol *lookupVar(const char *name, bool create = true, bool putInGlobalList = false);
+ void cleanLocalVars();
+ void define(Common::String &s, int start, int nargs);
+
int code1(inst code) { _currentScript->push_back(code); return _currentScript->size() - 1; }
int code2(inst code_1, inst code_2) { int o = code1(code_1); code1(code_2); return o; }
int code3(inst code_1, inst code_2, inst code_3) { int o = code1(code_1); code1(code_2); code1(code_3); return o; }
@@ -134,13 +152,7 @@ public:
int l = strlen(s); return (l + 1 + instLen - 1) / instLen;
}
-public:
- void execute(int pc);
- void pushContext();
- void popContext();
- Symbol *lookupVar(const char *name, bool create = true, bool putInGlobalList = false);
- void cleanLocalVars();
- void define(Common::String &s, int start, int nargs);
+ int codeFunc(Common::String *name, int nargs);
void codeArg(Common::String *s);
void codeArgStore();
int codeId(Common::String &s);
@@ -179,6 +191,8 @@ public:
static void c_gotoprevious();
static void c_global();
+ static void b_random();
+
void func_mci(Common::String &s);
void func_mciwait(Common::String &s);
void func_goto(Common::String &frame, Common::String &movie);
@@ -194,6 +208,7 @@ public:
Common::Array<CFrame *> _callstack;
Common::Array<Common::String *> _argstack;
+ BuiltinHash _builtins;
private:
int parse(const char *code);
diff --git a/engines/director/module.mk b/engines/director/module.mk
index b39c75c..273a133 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -10,6 +10,7 @@ MODULE_OBJS = \
sound.o \
lingo/lingo-gr.o \
lingo/lingo.o \
+ lingo/lingo-builtins.o \
lingo/lingo-code.o \
lingo/lingo-codegen.o \
lingo/lingo-funcs.o \
Commit: 610075cc153411e945cda54b43974e7c7a5becfe
https://github.com/scummvm/scummvm/commit/610075cc153411e945cda54b43974e7c7a5becfe
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Make built-in functions work (sometimes)
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 8616317..d1b88ba 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -92,35 +92,10 @@ Common::Error DirectorEngine::run() {
_soundManager = new DirectorSound();
#if 0
-_lingo->addCode("--\n\
-macro check par1, par2 \n\
-, par3\n\
-if par1 = 3 then\n\
- put -3\n\
-else\n\
- put 0\n\
-end if \n\
-if par2 = 2 then \n\
- put 2 \n\
-else \n\
- put 0\n\
-end if\n\
-put par1\n\
-put par2\n\
-put par3\n\
-", kMovieScript, 5);
-
-_lingo->addCode("check(1, 2, 3)\n\
-check 4, 5, 6\n\
-check 7, 8\n\
-", kMovieScript, 2);
-
-_lingo->executeScript(kMovieScript, 2);
-
_lingo->addCode("--\n\
macro SHIPX\n\
global x, y\n\
-set x = 5\n\
+set x = Random(5)\n\
if x = 1 then\n\
go \"Zoom\"\n\
exit\n\
@@ -133,7 +108,7 @@ put 100\n\
\n\
--\n\
macro ZIPX\n\
-set x = 7\n\
+set x = Random(5)\n\
if x = 1 then\n\
go \"ZIP\"\n\
exit\n\
@@ -144,12 +119,21 @@ exit\n\
end if\n\
\n\
--\n\
-macro check par1, par2\n\
+mmacro check par1, par2 \n\
+, par3\n\
if par1 = 3 then\n\
- put 8\n\
+ put -3\n\
else\n\
- put 9\n\
+ put 0\n\
+end if \n\
+if par2 = 2 then \n\
+ put 2 \n\
+else \n\
+ put 0\n\
end if\n\
+put par1\n\
+put par2\n\
+put par3\n\
", kMovieScript, 1);
_lingo->addCode("check(2, 3)\n\
@@ -160,6 +144,9 @@ put x\n\
zipx\n\
put x\n\
put y\n\
+check(1, 2, 3)\n\
+check 4, 5, 6\n\
+check 7, 8\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 01329d4..77d99e3 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -433,7 +433,7 @@ union yyalloc
/* YYNRULES -- Number of rules. */
#define YYNRULES 79
/* YYNRULES -- Number of states. */
-#define YYNSTATES 163
+#define YYNSTATES 162
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -485,8 +485,8 @@ static const yytype_uint16 yyprhs[] =
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
20, 22, 27, 32, 37, 39, 41, 49, 60, 69,
81, 94, 96, 100, 104, 107, 111, 113, 114, 115,
- 116, 119, 122, 124, 126, 128, 132, 136, 140, 144,
- 148, 152, 156, 160, 164, 167, 170, 174, 179, 182,
+ 116, 119, 122, 124, 129, 131, 133, 137, 141, 145,
+ 149, 153, 157, 161, 165, 169, 172, 175, 179, 182,
185, 188, 190, 192, 195, 197, 201, 204, 207, 210,
213, 217, 220, 224, 227, 230, 232, 236, 239, 243,
244, 253, 254, 256, 260, 265, 266, 270, 271, 273
@@ -507,12 +507,12 @@ static const yytype_int8 yyrhs[] =
63, 13, 29, -1, 65, -1, 65, 41, 65, -1,
48, 58, 49, -1, 29, 34, -1, 29, 33, 8,
-1, 18, -1, -1, -1, -1, 64, 47, -1, 64,
- 57, -1, 6, -1, 8, -1, 56, -1, 65, 42,
- 65, -1, 65, 43, 65, -1, 65, 44, 65, -1,
- 65, 45, 65, -1, 65, 50, 65, -1, 65, 51,
- 65, -1, 65, 40, 65, -1, 65, 35, 65, -1,
- 65, 36, 65, -1, 42, 65, -1, 43, 65, -1,
- 48, 65, 49, -1, 8, 48, 76, 49, -1, 22,
+ 57, -1, 6, -1, 8, 48, 76, 49, -1, 8,
+ -1, 56, -1, 65, 42, 65, -1, 65, 43, 65,
+ -1, 65, 44, 65, -1, 65, 45, 65, -1, 65,
+ 50, 65, -1, 65, 51, 65, -1, 65, 40, 65,
+ -1, 65, 35, 65, -1, 65, 36, 65, -1, 42,
+ 65, -1, 43, 65, -1, 48, 65, 49, -1, 22,
9, -1, 23, 8, -1, 28, 65, -1, 68, -1,
14, -1, 16, 67, -1, 8, -1, 67, 52, 8,
-1, 17, 20, -1, 17, 25, -1, 17, 27, -1,
@@ -531,8 +531,8 @@ static const yytype_uint16 yyrline[] =
0, 92, 92, 93, 96, 97, 98, 99, 100, 101,
102, 105, 111, 117, 125, 126, 127, 133, 145, 156,
172, 186, 187, 188, 190, 192, 198, 200, 202, 204,
- 205, 206, 209, 214, 217, 218, 219, 220, 221, 222,
- 223, 224, 225, 226, 227, 228, 229, 232, 235, 236,
+ 205, 206, 209, 214, 217, 220, 221, 222, 223, 224,
+ 225, 226, 227, 228, 229, 230, 231, 232, 235, 236,
237, 238, 239, 240, 243, 244, 255, 256, 257, 258,
263, 269, 276, 277, 278, 279, 282, 283, 284, 312,
312, 318, 319, 320, 321, 323, 326, 334, 335, 336
@@ -578,7 +578,7 @@ static const yytype_uint8 yyr1[] =
55, 56, 56, 56, 57, 57, 57, 57, 57, 57,
57, 58, 58, 58, 59, 60, 61, 62, 63, 64,
64, 64, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 66, 66, 66,
+ 65, 65, 65, 65, 65, 65, 65, 65, 66, 66,
66, 66, 66, 66, 67, 67, 68, 68, 68, 68,
68, 68, 69, 69, 69, 69, 70, 70, 70, 72,
71, 73, 73, 73, 73, 74, 75, 76, 76, 76
@@ -590,8 +590,8 @@ static const yytype_uint8 yyr2[] =
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
1, 4, 4, 4, 1, 1, 7, 10, 8, 11,
12, 1, 3, 3, 2, 3, 1, 0, 0, 0,
- 2, 2, 1, 1, 1, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 2, 2, 3, 4, 2, 2,
+ 2, 2, 1, 4, 1, 1, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 2, 2, 3, 2, 2,
2, 1, 1, 2, 1, 3, 2, 2, 2, 2,
3, 2, 3, 2, 2, 1, 3, 2, 3, 0,
8, 0, 1, 3, 4, 0, 3, 0, 1, 3
@@ -603,30 +603,30 @@ static const yytype_uint8 yyr2[] =
static const yytype_uint8 yydefact[] =
{
0, 10, 32, 27, 52, 0, 0, 26, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 3, 34,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 35,
9, 0, 0, 0, 14, 6, 51, 5, 7, 77,
77, 54, 53, 65, 0, 56, 0, 57, 0, 58,
- 0, 59, 61, 69, 48, 49, 33, 0, 34, 50,
- 0, 24, 0, 44, 45, 0, 1, 0, 0, 0,
+ 0, 59, 61, 69, 48, 49, 34, 0, 35, 50,
+ 0, 24, 0, 45, 46, 0, 1, 0, 0, 0,
0, 0, 21, 0, 0, 0, 0, 0, 0, 0,
0, 0, 78, 0, 76, 0, 63, 67, 0, 64,
0, 0, 0, 60, 27, 0, 0, 25, 0, 0,
- 46, 2, 0, 28, 0, 0, 29, 0, 42, 43,
- 41, 35, 36, 37, 38, 39, 40, 47, 0, 55,
+ 47, 2, 0, 28, 0, 0, 29, 0, 43, 44,
+ 42, 36, 37, 38, 39, 40, 41, 33, 0, 55,
66, 62, 68, 71, 11, 13, 12, 29, 0, 23,
- 28, 22, 79, 72, 0, 28, 0, 0, 33, 30,
- 31, 0, 15, 75, 0, 0, 0, 28, 29, 0,
- 0, 29, 73, 0, 28, 29, 28, 16, 74, 70,
- 18, 29, 28, 0, 28, 0, 0, 0, 0, 17,
- 0, 19, 20
+ 28, 22, 79, 72, 0, 28, 0, 0, 30, 31,
+ 0, 15, 75, 0, 0, 0, 28, 29, 0, 0,
+ 29, 73, 0, 28, 29, 28, 16, 74, 70, 18,
+ 29, 28, 0, 28, 0, 0, 0, 0, 17, 0,
+ 19, 20
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 17, 18, 48, 130, 61, 21, 22, 23, 30,
- 118, 120, 24, 132, 32, 26, 41, 42, 27, 84,
- 124, 141, 28, 73
+ -1, 17, 18, 48, 129, 61, 21, 22, 23, 30,
+ 118, 120, 24, 131, 32, 26, 41, 42, 27, 84,
+ 124, 140, 28, 73
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
@@ -634,65 +634,65 @@ static const yytype_int16 yydefgoto[] =
#define YYPACT_NINF -117
static const yytype_int16 yypact[] =
{
- 66, -117, -117, 192, -117, 26, 151, -117, 29, 32,
- 36, 3, -13, 42, 3, 3, 3, 62, 28, 14,
- -117, 25, 38, 63, 180, -117, -117, -117, -117, 3,
+ 66, -117, -117, 192, -117, 19, 151, -117, 24, 29,
+ 42, 3, 9, 54, 3, 3, 3, 16, 26, 14,
+ -117, 27, 38, 63, 180, -117, -117, -117, -117, 3,
3, -117, 33, -117, 72, -117, 81, -117, 68, -117,
- 15, 44, -117, -117, -117, -117, -117, 3, -117, 119,
- 92, -117, -15, -8, -8, 156, -117, 66, 63, 3,
- 63, 70, 168, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 180, -36, 50, 95, -117, -117, 98, -117,
- 106, 108, 80, -117, -117, 119, 111, -117, 3, 3,
- -117, -117, 74, 180, 79, 144, -117, 3, 180, 180,
- 180, 209, 209, -8, -8, 180, 180, -117, 3, -117,
- -117, -117, -117, 122, -117, 180, 180, -117, -9, -117,
- 104, 180, 180, -117, -37, 104, 99, 3, 87, -117,
- -117, 86, -117, 84, 129, 126, 3, 180, -117, 124,
- 132, -117, -117, 114, 180, -117, 104, -117, -117, 104,
- -117, -117, 104, 131, 104, 136, 127, 140, 128, -117,
- 138, -117, -117
+ 20, 44, -117, -117, -117, -117, 52, 3, -117, 119,
+ 93, -117, -19, -10, -10, 156, -117, 66, 63, 3,
+ 63, 71, 168, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 180, -32, 51, 96, -117, -117, 98, -117,
+ 106, 108, 95, -117, -117, 119, 115, -117, 3, 3,
+ -117, -117, 79, 180, 80, 144, -117, 3, 180, 180,
+ 180, 209, 209, -10, -10, 180, 180, -117, 3, -117,
+ -117, -117, -117, 123, -117, 180, 180, -117, -9, -117,
+ 104, 180, 180, -117, -37, 104, 103, 3, -117, -117,
+ 86, -117, 84, 129, 126, 3, 180, -117, 122, 134,
+ -117, -117, 114, 180, -117, 104, -117, -117, 104, -117,
+ -117, 104, 131, 104, 132, 135, 136, 128, -117, 138,
+ -117, -117
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -117, 115, -117, 6, 7, -20, -117, -117, -117, 89,
- 4, -116, -11, 8, -117, -117, -117, 133, -117, -117,
- -117, -117, -117, 135
+ -117, 111, -117, 6, 7, -21, -117, -117, -117, 88,
+ 5, -116, -11, 8, -117, -117, -117, 124, -117, -117,
+ -117, -117, -117, 143
};
/* 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 -34
+#define YYTABLE_NINF -35
static const yytype_int16 yytable[] =
{
49, 125, 126, 53, 54, 55, 19, 20, 25, 2,
- 133, 46, 62, 107, -8, 134, 108, 88, 72, 72,
- 50, 51, 146, 127, 79, 149, 89, 63, 64, 152,
- 80, 47, 65, 13, 31, 154, 85, 43, 92, 81,
- 94, 44, 70, 71, 45, 14, 15, 62, 93, 95,
- 52, 16, 98, 99, 100, 101, 102, 103, 104, 105,
- 106, -8, 56, 19, 20, 25, -4, 1, 36, 2,
- 38, 46, 2, 58, 3, 57, 82, 115, 116, 59,
+ 132, 46, 62, 88, -8, 133, 56, 107, 72, 72,
+ 108, 145, 89, 127, 148, 63, 64, 31, 151, 79,
+ 65, 47, 43, 13, 153, 80, 85, 92, 44, 94,
+ 70, 71, 50, 51, 81, 14, 15, 62, 93, 95,
+ 45, 16, 98, 99, 100, 101, 102, 103, 104, 105,
+ 106, -8, 52, 19, 20, 25, -4, 1, 36, 2,
+ 38, 46, 2, 57, 3, 58, 82, 115, 116, 59,
4, 76, 5, 6, 7, 75, 121, 8, 9, 10,
- 77, 47, 78, 13, 11, 12, 13, 122, 138, 139,
- 87, 96, 108, 109, 81, 14, 15, 110, 14, 15,
- 2, 60, 128, -4, 16, 111, 137, 112, 4, 114,
- 5, 6, 7, 117, 131, 144, 9, 10, 119, 135,
- 123, 136, 11, 12, 13, 29, 140, 142, 86, 143,
- 148, 145, 147, 150, 156, 159, 14, 15, 151, 158,
- 153, 129, 16, 160, 63, 64, 155, 161, 157, 65,
- 33, 66, 67, 68, 69, 74, 34, 162, 0, 70,
- 71, 35, 91, 113, 83, 36, 37, 38, 39, 63,
+ 77, 47, 78, 13, 11, 12, 13, 122, 137, 138,
+ 29, 87, 96, 108, 109, 14, 15, 110, 14, 15,
+ 2, 60, 46, -4, 16, 111, 136, 112, 4, 81,
+ 5, 6, 7, 114, 143, 130, 9, 10, 117, 119,
+ 134, 123, 11, 12, 13, 135, 139, 141, 86, 142,
+ 146, 144, 147, 149, 155, 157, 14, 15, 150, 159,
+ 152, 128, 16, 158, 63, 64, 154, 160, 156, 65,
+ 33, 66, 67, 68, 69, 83, 34, 161, 91, 70,
+ 71, 35, 113, 74, 0, 36, 37, 38, 39, 63,
64, 0, 0, 40, 65, 97, 66, 67, 68, 69,
0, 63, 64, 90, 70, 71, 65, 0, 66, 67,
68, 69, 0, 63, 64, 90, 70, 71, 65, 97,
66, 67, 68, 69, 0, 63, 64, 0, 70, 71,
- 65, 0, 66, 67, 68, 69, 0, -33, -33, 0,
- 70, 71, -33, 0, 0, 0, -33, -33, 0, 0,
- 29, 0, -33, -33, 63, 64, 0, 0, 0, 65,
+ 65, 0, 66, 67, 68, 69, 0, -34, -34, 0,
+ 70, 71, -34, 0, 0, 0, -34, -34, 0, 0,
+ 29, 0, -34, -34, 63, 64, 0, 0, 0, 65,
0, 0, 0, 68, 69, 0, 0, 0, 0, 70,
71
};
@@ -700,23 +700,23 @@ static const yytype_int16 yytable[] =
static const yytype_int16 yycheck[] =
{
11, 117, 11, 14, 15, 16, 0, 0, 0, 6,
- 47, 8, 23, 49, 0, 52, 52, 32, 29, 30,
- 33, 34, 138, 32, 9, 141, 41, 35, 36, 145,
- 15, 28, 40, 30, 8, 151, 47, 8, 58, 24,
- 60, 9, 50, 51, 8, 42, 43, 58, 59, 60,
+ 47, 8, 23, 32, 0, 52, 0, 49, 29, 30,
+ 52, 137, 41, 32, 140, 35, 36, 8, 144, 9,
+ 40, 28, 8, 30, 150, 15, 47, 58, 9, 60,
+ 50, 51, 33, 34, 24, 42, 43, 58, 59, 60,
8, 48, 63, 64, 65, 66, 67, 68, 69, 70,
- 71, 47, 0, 57, 57, 57, 0, 1, 24, 6,
- 26, 8, 6, 48, 8, 47, 32, 88, 89, 41,
+ 71, 47, 8, 57, 57, 57, 0, 1, 24, 6,
+ 26, 8, 6, 47, 8, 48, 32, 88, 89, 41,
14, 9, 16, 17, 18, 52, 97, 21, 22, 23,
9, 28, 24, 30, 28, 29, 30, 108, 12, 13,
- 8, 31, 52, 8, 24, 42, 43, 9, 42, 43,
- 6, 48, 8, 47, 48, 9, 127, 9, 14, 8,
- 16, 17, 18, 49, 120, 136, 22, 23, 49, 125,
- 8, 32, 28, 29, 30, 48, 52, 8, 19, 13,
- 8, 137, 18, 29, 13, 18, 42, 43, 144, 13,
- 146, 47, 48, 13, 35, 36, 152, 29, 154, 40,
- 9, 42, 43, 44, 45, 30, 15, 29, -1, 50,
- 51, 20, 57, 84, 41, 24, 25, 26, 27, 35,
+ 48, 8, 31, 52, 8, 42, 43, 9, 42, 43,
+ 6, 48, 8, 47, 48, 9, 127, 9, 14, 24,
+ 16, 17, 18, 8, 135, 120, 22, 23, 49, 49,
+ 125, 8, 28, 29, 30, 32, 52, 8, 19, 13,
+ 18, 136, 8, 29, 13, 13, 42, 43, 143, 13,
+ 145, 47, 48, 18, 35, 36, 151, 29, 153, 40,
+ 9, 42, 43, 44, 45, 41, 15, 29, 57, 50,
+ 51, 20, 84, 30, -1, 24, 25, 26, 27, 35,
36, -1, -1, 32, 40, 41, 42, 43, 44, 45,
-1, 35, 36, 49, 50, 51, 40, -1, 42, 43,
44, 45, -1, 35, 36, 49, 50, 51, 40, 41,
@@ -744,11 +744,11 @@ static const yytype_uint8 yystos[] =
49, 54, 58, 65, 58, 65, 31, 41, 65, 65,
65, 65, 65, 65, 65, 65, 65, 49, 52, 8,
9, 9, 9, 62, 8, 65, 65, 49, 63, 49,
- 64, 65, 65, 8, 73, 64, 11, 32, 8, 47,
- 57, 63, 66, 47, 52, 63, 32, 65, 12, 13,
- 52, 74, 8, 13, 65, 63, 64, 18, 8, 64,
- 29, 63, 64, 63, 64, 63, 13, 63, 13, 18,
- 13, 29, 29
+ 64, 65, 65, 8, 73, 64, 11, 32, 47, 57,
+ 63, 66, 47, 52, 63, 32, 65, 12, 13, 52,
+ 74, 8, 13, 65, 63, 64, 18, 8, 64, 29,
+ 63, 64, 63, 64, 63, 13, 63, 13, 18, 13,
+ 29, 29
};
#define yyerrok (yyerrstatus = 0)
@@ -1727,75 +1727,75 @@ yyreduce:
case 33:
#line 214 "engines/director/lingo/lingo-gr.y"
{
- (yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
- delete (yyvsp[(1) - (1)].s); ;}
+ (yyval.code) = g_lingo->codeFunc((yyvsp[(1) - (4)].s), (yyvsp[(3) - (4)].narg));
+ delete (yyvsp[(1) - (4)].s); ;}
break;
- case 35:
-#line 218 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_add); ;}
+ case 34:
+#line 217 "engines/director/lingo/lingo-gr.y"
+ {
+ (yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
+ delete (yyvsp[(1) - (1)].s); ;}
break;
case 36:
-#line 219 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_sub); ;}
+#line 221 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_add); ;}
break;
case 37:
-#line 220 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_mul); ;}
+#line 222 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_sub); ;}
break;
case 38:
-#line 221 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_div); ;}
+#line 223 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_mul); ;}
break;
case 39:
-#line 222 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gt); ;}
+#line 224 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_div); ;}
break;
case 40:
-#line 223 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_lt); ;}
+#line 225 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gt); ;}
break;
case 41:
-#line 224 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_neq); ;}
+#line 226 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_lt); ;}
break;
case 42:
-#line 225 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_ge); ;}
+#line 227 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_neq); ;}
break;
case 43:
-#line 226 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_le); ;}
+#line 228 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_ge); ;}
break;
case 44:
-#line 227 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+#line 229 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_le); ;}
break;
case 45:
-#line 228 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
+#line 230 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 46:
-#line 229 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+#line 231 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 47:
#line 232 "engines/director/lingo/lingo-gr.y"
- {
- g_lingo->codeFunc((yyvsp[(1) - (4)].s), (yyvsp[(3) - (4)].narg));
- delete (yyvsp[(1) - (4)].s); ;}
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 48:
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index aac0f03..eceaba0 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -211,6 +211,9 @@ expr: INT {
inst i = 0;
WRITE_UINT32(&i, $1);
g_lingo->code1(i); };
+ | ID '(' arglist ')' {
+ $$ = g_lingo->codeFunc($1, $3);
+ delete $1; }
| ID {
$$ = g_lingo->codeId(*$1);
delete $1; }
@@ -229,10 +232,7 @@ expr: INT {
| '(' expr ')' { $$ = $2; }
;
-func: ID '(' arglist ')' {
- g_lingo->codeFunc($1, $3);
- delete $1; }
- | tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_str()); delete $2; }
+func: tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_str()); delete $2; }
| tMCIWAIT ID { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
| tPUT expr { g_lingo->code1(g_lingo->c_printtop); }
| gotofunc
Commit: 953c57944ec98f14b494359e65b78001f956a011
https://github.com/scummvm/scummvm/commit/953c57944ec98f14b494359e65b78001f956a011
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Make built-in functions work (always)
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index d1b88ba..9f2ffce 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -119,7 +119,7 @@ exit\n\
end if\n\
\n\
--\n\
-mmacro check par1, par2 \n\
+macro check par1, par2 \n\
, par3\n\
if par1 = 3 then\n\
put -3\n\
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 77d99e3..7995952 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -535,7 +535,7 @@ static const yytype_uint16 yyrline[] =
225, 226, 227, 228, 229, 230, 231, 232, 235, 236,
237, 238, 239, 240, 243, 244, 255, 256, 257, 258,
263, 269, 276, 277, 278, 279, 282, 283, 284, 312,
- 312, 318, 319, 320, 321, 323, 326, 334, 335, 336
+ 312, 319, 320, 321, 322, 324, 327, 335, 336, 337
};
#endif
@@ -1914,38 +1914,39 @@ yyreduce:
case 70:
#line 313 "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);
g_lingo->define(*(yyvsp[(2) - (8)].s), (yyvsp[(4) - (8)].code), (yyvsp[(5) - (8)].narg));
g_lingo->_indef = false; ;}
break;
case 71:
-#line 318 "engines/director/lingo/lingo-gr.y"
+#line 319 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 72:
-#line 319 "engines/director/lingo/lingo-gr.y"
+#line 320 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 73:
-#line 320 "engines/director/lingo/lingo-gr.y"
+#line 321 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 74:
-#line 321 "engines/director/lingo/lingo-gr.y"
+#line 322 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 75:
-#line 323 "engines/director/lingo/lingo-gr.y"
+#line 324 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
case 76:
-#line 326 "engines/director/lingo/lingo-gr.y"
+#line 327 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -1955,23 +1956,23 @@ yyreduce:
break;
case 77:
-#line 334 "engines/director/lingo/lingo-gr.y"
+#line 335 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 78:
-#line 335 "engines/director/lingo/lingo-gr.y"
+#line 336 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
case 79:
-#line 336 "engines/director/lingo/lingo-gr.y"
+#line 337 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 1975 "engines/director/lingo/lingo-gr.cpp"
+#line 1976 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2185,6 +2186,6 @@ yyreturn:
}
-#line 339 "engines/director/lingo/lingo-gr.y"
+#line 340 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index eceaba0..aca2a19 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -311,6 +311,7 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
// on keyword
defn: tMACRO ID { g_lingo->_indef = true; }
begin argdef '\n' argstore stmtlist {
+ g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$2, $4, $5);
g_lingo->_indef = false; }
Commit: 50163b3c44b29e70110447b30c13e125653edea6
https://github.com/scummvm/scummvm/commit/50163b3c44b29e70110447b30c13e125653edea6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implement one-line version of 'if' statement
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 9f2ffce..c0c5a8b 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -147,6 +147,7 @@ put y\n\
check(1, 2, 3)\n\
check 4, 5, 6\n\
check 7, 8\n\
+if random(4) > 2 then put 1000\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 7995952..3ed07c5 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -422,18 +422,18 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 56
+#define YYFINAL 57
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 260
+#define YYLAST 326
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 53
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 24
+#define YYNNTS 25
/* YYNRULES -- Number of rules. */
-#define YYNRULES 79
+#define YYNRULES 81
/* YYNRULES -- Number of states. */
-#define YYNSTATES 162
+#define YYNSTATES 169
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -483,59 +483,62 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
- 20, 22, 27, 32, 37, 39, 41, 49, 60, 69,
- 81, 94, 96, 100, 104, 107, 111, 113, 114, 115,
- 116, 119, 122, 124, 129, 131, 133, 137, 141, 145,
- 149, 153, 157, 161, 165, 169, 172, 175, 179, 182,
- 185, 188, 190, 192, 195, 197, 201, 204, 207, 210,
- 213, 217, 220, 224, 227, 230, 232, 236, 239, 243,
- 244, 253, 254, 256, 260, 265, 266, 270, 271, 273
+ 20, 22, 24, 29, 34, 39, 41, 43, 51, 62,
+ 71, 83, 96, 103, 105, 109, 113, 116, 120, 122,
+ 123, 124, 125, 128, 131, 133, 138, 140, 142, 146,
+ 150, 154, 158, 162, 166, 170, 174, 178, 181, 184,
+ 188, 191, 194, 197, 199, 201, 204, 206, 210, 213,
+ 216, 219, 222, 226, 229, 233, 236, 239, 241, 245,
+ 248, 252, 253, 262, 263, 265, 269, 274, 275, 279,
+ 280, 282
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
54, 0, -1, 55, 47, 54, -1, 55, -1, -1,
- 71, -1, 66, -1, 75, -1, 56, -1, 57, -1,
- 1, -1, 28, 65, 19, 8, -1, 30, 8, 41,
- 65, -1, 30, 8, 32, 65, -1, 65, -1, 66,
- -1, 61, 58, 31, 64, 63, 13, 18, -1, 61,
- 58, 31, 64, 63, 12, 64, 63, 13, 18, -1,
- 59, 48, 58, 49, 64, 63, 13, 29, -1, 60,
- 41, 65, 63, 32, 65, 63, 64, 63, 13, 29,
- -1, 60, 41, 65, 63, 11, 32, 65, 63, 64,
- 63, 13, 29, -1, 65, -1, 65, 41, 65, -1,
- 48, 58, 49, -1, 29, 34, -1, 29, 33, 8,
- -1, 18, -1, -1, -1, -1, 64, 47, -1, 64,
- 57, -1, 6, -1, 8, 48, 76, 49, -1, 8,
- -1, 56, -1, 65, 42, 65, -1, 65, 43, 65,
- -1, 65, 44, 65, -1, 65, 45, 65, -1, 65,
- 50, 65, -1, 65, 51, 65, -1, 65, 40, 65,
- -1, 65, 35, 65, -1, 65, 36, 65, -1, 42,
- 65, -1, 43, 65, -1, 48, 65, 49, -1, 22,
- 9, -1, 23, 8, -1, 28, 65, -1, 68, -1,
- 14, -1, 16, 67, -1, 8, -1, 67, 52, 8,
- -1, 17, 20, -1, 17, 25, -1, 17, 27, -1,
- 17, 69, -1, 17, 69, 70, -1, 17, 70, -1,
- 32, 15, 9, -1, 15, 9, -1, 32, 9, -1,
- 9, -1, 26, 24, 9, -1, 24, 9, -1, 32,
- 24, 9, -1, -1, 21, 8, 72, 62, 73, 47,
- 74, 64, -1, -1, 8, -1, 73, 52, 8, -1,
- 73, 47, 52, 8, -1, -1, 8, 62, 76, -1,
- -1, 65, -1, 76, 52, 65, -1
+ 72, -1, 67, -1, 76, -1, 56, -1, 58, -1,
+ 57, -1, 1, -1, 28, 66, 19, 8, -1, 30,
+ 8, 41, 66, -1, 30, 8, 32, 66, -1, 66,
+ -1, 67, -1, 62, 59, 31, 65, 64, 13, 18,
+ -1, 62, 59, 31, 65, 64, 12, 65, 64, 13,
+ 18, -1, 60, 48, 59, 49, 65, 64, 13, 29,
+ -1, 61, 41, 66, 64, 32, 66, 64, 65, 64,
+ 13, 29, -1, 61, 41, 66, 64, 11, 32, 66,
+ 64, 65, 64, 13, 29, -1, 62, 59, 31, 63,
+ 57, 64, -1, 66, -1, 66, 41, 66, -1, 48,
+ 59, 49, -1, 29, 34, -1, 29, 33, 8, -1,
+ 18, -1, -1, -1, -1, 65, 47, -1, 65, 57,
+ -1, 6, -1, 8, 48, 77, 49, -1, 8, -1,
+ 56, -1, 66, 42, 66, -1, 66, 43, 66, -1,
+ 66, 44, 66, -1, 66, 45, 66, -1, 66, 50,
+ 66, -1, 66, 51, 66, -1, 66, 40, 66, -1,
+ 66, 35, 66, -1, 66, 36, 66, -1, 42, 66,
+ -1, 43, 66, -1, 48, 66, 49, -1, 22, 9,
+ -1, 23, 8, -1, 28, 66, -1, 69, -1, 14,
+ -1, 16, 68, -1, 8, -1, 68, 52, 8, -1,
+ 17, 20, -1, 17, 25, -1, 17, 27, -1, 17,
+ 70, -1, 17, 70, 71, -1, 17, 71, -1, 32,
+ 15, 9, -1, 15, 9, -1, 32, 9, -1, 9,
+ -1, 26, 24, 9, -1, 24, 9, -1, 32, 24,
+ 9, -1, -1, 21, 8, 73, 63, 74, 47, 75,
+ 65, -1, -1, 8, -1, 74, 52, 8, -1, 74,
+ 47, 52, 8, -1, -1, 8, 63, 77, -1, -1,
+ 66, -1, 77, 52, 66, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 92, 92, 93, 96, 97, 98, 99, 100, 101,
- 102, 105, 111, 117, 125, 126, 127, 133, 145, 156,
- 172, 186, 187, 188, 190, 192, 198, 200, 202, 204,
- 205, 206, 209, 214, 217, 220, 221, 222, 223, 224,
- 225, 226, 227, 228, 229, 230, 231, 232, 235, 236,
- 237, 238, 239, 240, 243, 244, 255, 256, 257, 258,
- 263, 269, 276, 277, 278, 279, 282, 283, 284, 312,
- 312, 319, 320, 321, 322, 324, 327, 335, 336, 337
+ 102, 103, 106, 112, 118, 126, 127, 128, 134, 146,
+ 157, 173, 187, 195, 196, 197, 199, 201, 207, 209,
+ 211, 213, 214, 215, 218, 223, 226, 229, 230, 231,
+ 232, 233, 234, 235, 236, 237, 238, 239, 240, 241,
+ 244, 245, 246, 247, 248, 249, 252, 253, 264, 265,
+ 266, 267, 272, 278, 285, 286, 287, 288, 291, 292,
+ 293, 321, 321, 328, 329, 330, 331, 333, 336, 344,
+ 345, 346
};
#endif
@@ -551,9 +554,9 @@ static const char *const yytname[] =
"tTHEN", "tTO", "tWITH", "tWHILE", "tGE", "tLE", "tGT", "tLT", "tEQ",
"tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'",
"'>'", "'<'", "','", "$accept", "program", "programline", "asgn", "stmt",
- "cond", "repeatwhile", "repeatwith", "if", "begin", "end", "stmtlist",
- "expr", "func", "globallist", "gotofunc", "gotoframe", "gotomovie",
- "defn", "@1", "argdef", "argstore", "macro", "arglist", 0
+ "stmtoneliner", "cond", "repeatwhile", "repeatwith", "if", "begin",
+ "end", "stmtlist", "expr", "func", "globallist", "gotofunc", "gotoframe",
+ "gotomovie", "defn", "@1", "argdef", "argstore", "macro", "arglist", 0
};
#endif
@@ -575,26 +578,28 @@ static const yytype_uint16 yytoknum[] =
static const yytype_uint8 yyr1[] =
{
0, 53, 54, 54, 55, 55, 55, 55, 55, 55,
- 55, 56, 56, 56, 57, 57, 57, 57, 57, 57,
- 57, 58, 58, 58, 59, 60, 61, 62, 63, 64,
- 64, 64, 65, 65, 65, 65, 65, 65, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 65, 66, 66,
- 66, 66, 66, 66, 67, 67, 68, 68, 68, 68,
- 68, 68, 69, 69, 69, 69, 70, 70, 70, 72,
- 71, 73, 73, 73, 73, 74, 75, 76, 76, 76
+ 55, 55, 56, 56, 56, 57, 57, 57, 57, 57,
+ 57, 57, 58, 59, 59, 59, 60, 61, 62, 63,
+ 64, 65, 65, 65, 66, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
+ 67, 67, 67, 67, 67, 67, 68, 68, 69, 69,
+ 69, 69, 69, 69, 70, 70, 70, 70, 71, 71,
+ 71, 73, 72, 74, 74, 74, 74, 75, 76, 77,
+ 77, 77
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 1, 4, 4, 4, 1, 1, 7, 10, 8, 11,
- 12, 1, 3, 3, 2, 3, 1, 0, 0, 0,
- 2, 2, 1, 4, 1, 1, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 2, 2, 3, 2, 2,
- 2, 1, 1, 2, 1, 3, 2, 2, 2, 2,
- 3, 2, 3, 2, 2, 1, 3, 2, 3, 0,
- 8, 0, 1, 3, 4, 0, 3, 0, 1, 3
+ 1, 1, 4, 4, 4, 1, 1, 7, 10, 8,
+ 11, 12, 6, 1, 3, 3, 2, 3, 1, 0,
+ 0, 0, 2, 2, 1, 4, 1, 1, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 2, 2, 3,
+ 2, 2, 2, 1, 1, 2, 1, 3, 2, 2,
+ 2, 2, 3, 2, 3, 2, 2, 1, 3, 2,
+ 3, 0, 8, 0, 1, 3, 4, 0, 3, 0,
+ 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -602,130 +607,142 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 10, 32, 27, 52, 0, 0, 26, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 3, 35,
- 9, 0, 0, 0, 14, 6, 51, 5, 7, 77,
- 77, 54, 53, 65, 0, 56, 0, 57, 0, 58,
- 0, 59, 61, 69, 48, 49, 34, 0, 35, 50,
- 0, 24, 0, 45, 46, 0, 1, 0, 0, 0,
- 0, 0, 21, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 78, 0, 76, 0, 63, 67, 0, 64,
- 0, 0, 0, 60, 27, 0, 0, 25, 0, 0,
- 47, 2, 0, 28, 0, 0, 29, 0, 43, 44,
- 42, 36, 37, 38, 39, 40, 41, 33, 0, 55,
- 66, 62, 68, 71, 11, 13, 12, 29, 0, 23,
- 28, 22, 79, 72, 0, 28, 0, 0, 30, 31,
- 0, 15, 75, 0, 0, 0, 28, 29, 0, 0,
- 29, 73, 0, 28, 29, 28, 16, 74, 70, 18,
- 29, 28, 0, 28, 0, 0, 0, 0, 17, 0,
- 19, 20
+ 0, 11, 34, 29, 54, 0, 0, 28, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 37,
+ 10, 9, 0, 0, 0, 15, 6, 53, 5, 7,
+ 79, 79, 56, 55, 67, 0, 58, 0, 59, 0,
+ 60, 0, 61, 63, 71, 50, 51, 36, 0, 37,
+ 52, 0, 26, 0, 47, 48, 0, 1, 0, 0,
+ 0, 0, 0, 23, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 80, 0, 78, 0, 65, 69, 0,
+ 66, 0, 0, 0, 62, 29, 0, 0, 27, 0,
+ 0, 49, 2, 0, 30, 0, 0, 29, 0, 45,
+ 46, 44, 38, 39, 40, 41, 42, 43, 35, 0,
+ 57, 68, 64, 70, 73, 12, 14, 13, 31, 0,
+ 25, 0, 30, 24, 81, 74, 0, 30, 0, 0,
+ 30, 0, 16, 32, 33, 0, 77, 0, 0, 0,
+ 30, 22, 0, 31, 0, 0, 31, 75, 0, 30,
+ 31, 31, 30, 17, 76, 72, 19, 31, 30, 0,
+ 30, 0, 0, 0, 0, 18, 0, 20, 21
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 17, 18, 48, 129, 61, 21, 22, 23, 30,
- 118, 120, 24, 131, 32, 26, 41, 42, 27, 84,
- 124, 140, 28, 73
+ -1, 17, 18, 49, 134, 21, 62, 22, 23, 131,
+ 31, 119, 122, 25, 132, 33, 27, 42, 43, 28,
+ 85, 126, 146, 29, 74
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -117
+#define YYPACT_NINF -118
static const yytype_int16 yypact[] =
{
- 66, -117, -117, 192, -117, 19, 151, -117, 24, 29,
- 42, 3, 9, 54, 3, 3, 3, 16, 26, 14,
- -117, 27, 38, 63, 180, -117, -117, -117, -117, 3,
- 3, -117, 33, -117, 72, -117, 81, -117, 68, -117,
- 20, 44, -117, -117, -117, -117, 52, 3, -117, 119,
- 93, -117, -19, -10, -10, 156, -117, 66, 63, 3,
- 63, 71, 168, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 180, -32, 51, 96, -117, -117, 98, -117,
- 106, 108, 95, -117, -117, 119, 115, -117, 3, 3,
- -117, -117, 79, 180, 80, 144, -117, 3, 180, 180,
- 180, 209, 209, -10, -10, 180, 180, -117, 3, -117,
- -117, -117, -117, 123, -117, 180, 180, -117, -9, -117,
- 104, 180, 180, -117, -37, 104, 103, 3, -117, -117,
- 86, -117, 84, 129, 126, 3, 180, -117, 122, 134,
- -117, -117, 114, 180, -117, 104, -117, -117, 104, -117,
- -117, 104, 131, 104, 132, 135, 136, 128, -117, 138,
- -117, -117
+ 83, -118, -118, 258, -118, 17, 217, -118, 27, 5,
+ 30, 60, 37, 33, 60, 60, 60, 47, 16, 15,
+ -118, -118, 24, 32, 109, 246, -118, -118, -118, -118,
+ 60, 60, -118, 25, -118, 67, -118, 72, -118, 58,
+ -118, 21, 20, -118, -118, -118, -118, 38, 60, -118,
+ 180, 77, -118, -10, -8, -8, 222, -118, 83, 109,
+ 60, 109, 63, 234, 60, 60, 60, 60, 60, 60,
+ 60, 60, 60, 246, -31, 40, 85, -118, -118, 86,
+ -118, 87, 98, 90, -118, -118, 180, 101, -118, 60,
+ 60, -118, -118, 70, 246, 73, 210, 4, 60, 246,
+ 246, 246, 275, 275, -8, -8, 246, 246, -118, 60,
+ -118, -118, -118, -118, 102, -118, 246, 246, -118, -9,
+ -118, 164, 126, 246, 246, -118, -13, 126, 84, 60,
+ -118, 109, -118, -118, -118, 62, 69, 115, 111, 60,
+ 246, -118, 104, -118, 118, 121, -118, -118, 112, 246,
+ -118, -118, 126, -118, -118, 126, -118, -118, 126, 120,
+ 126, 125, 127, 133, 124, -118, 129, -118, -118
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -117, 111, -117, 6, 7, -21, -117, -117, -117, 88,
- 5, -116, -11, 8, -117, -117, -117, 124, -117, -117,
- -117, -117, -117, 143
+ -118, 89, -118, 7, 6, -118, -51, -118, -118, 9,
+ -73, 61, -117, -11, 11, -118, -118, -118, 108, -118,
+ -118, -118, -118, -118, 128
};
/* 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 -35
+#define YYTABLE_NINF -37
static const yytype_int16 yytable[] =
{
- 49, 125, 126, 53, 54, 55, 19, 20, 25, 2,
- 132, 46, 62, 88, -8, 133, 56, 107, 72, 72,
- 108, 145, 89, 127, 148, 63, 64, 31, 151, 79,
- 65, 47, 43, 13, 153, 80, 85, 92, 44, 94,
- 70, 71, 50, 51, 81, 14, 15, 62, 93, 95,
- 45, 16, 98, 99, 100, 101, 102, 103, 104, 105,
- 106, -8, 52, 19, 20, 25, -4, 1, 36, 2,
- 38, 46, 2, 57, 3, 58, 82, 115, 116, 59,
- 4, 76, 5, 6, 7, 75, 121, 8, 9, 10,
- 77, 47, 78, 13, 11, 12, 13, 122, 137, 138,
- 29, 87, 96, 108, 109, 14, 15, 110, 14, 15,
- 2, 60, 46, -4, 16, 111, 136, 112, 4, 81,
- 5, 6, 7, 114, 143, 130, 9, 10, 117, 119,
- 134, 123, 11, 12, 13, 135, 139, 141, 86, 142,
- 146, 144, 147, 149, 155, 157, 14, 15, 150, 159,
- 152, 128, 16, 158, 63, 64, 154, 160, 156, 65,
- 33, 66, 67, 68, 69, 83, 34, 161, 91, 70,
- 71, 35, 113, 74, 0, 36, 37, 38, 39, 63,
- 64, 0, 0, 40, 65, 97, 66, 67, 68, 69,
- 0, 63, 64, 90, 70, 71, 65, 0, 66, 67,
- 68, 69, 0, 63, 64, 90, 70, 71, 65, 97,
- 66, 67, 68, 69, 0, 63, 64, 0, 70, 71,
- 65, 0, 66, 67, 68, 69, 0, -34, -34, 0,
- 70, 71, -34, 0, 0, 0, -34, -34, 0, 0,
- 29, 0, -34, -34, 63, 64, 0, 0, 0, 65,
- 0, 0, 0, 68, 69, 0, 0, 0, 0, 70,
- 71
+ 50, 127, 128, 54, 55, 56, 20, 19, 93, 24,
+ 95, 26, 114, 63, 45, -8, -31, -31, 108, 73,
+ 73, 109, 89, 129, 121, 32, 152, 64, 65, 155,
+ 80, 90, 66, 158, 136, 44, 81, 86, 46, 137,
+ 160, 53, 71, 72, 37, 82, 39, 57, 63, 94,
+ 96, -31, 83, 99, 100, 101, 102, 103, 104, 105,
+ 106, 107, -8, 58, 20, 19, 2, 24, 47, 26,
+ 51, 52, 59, 60, 143, 144, 77, 76, 116, 117,
+ 142, 78, 79, -4, 1, 88, 30, 123, 48, 2,
+ 13, 3, 109, 110, 97, 111, 112, 4, 124, 5,
+ 6, 7, 14, 15, 8, 9, 10, 113, 16, 115,
+ 125, 11, 12, 13, 82, 2, 139, 47, 140, 118,
+ 63, 145, 120, 147, 148, 14, 15, 130, 149, 154,
+ -4, 16, 2, 162, 47, 151, 153, 48, 164, 13,
+ 4, 156, 5, 6, 7, 165, 166, 92, 9, 10,
+ 84, 14, 15, 167, 11, 12, 13, 61, 168, 75,
+ 0, 0, 0, 0, 0, 0, 0, 0, 14, 15,
+ 2, 0, 47, 133, 16, 0, 0, 0, 4, 0,
+ 5, 6, 7, 135, 0, 0, 9, 10, 138, 0,
+ 0, 141, 11, 12, 13, 0, 0, 0, 0, 87,
+ 0, 150, 0, 0, 0, 0, 14, 15, 0, 0,
+ 157, 0, 16, 159, 0, 64, 65, 0, 0, 161,
+ 66, 163, 67, 68, 69, 70, 34, 0, 0, 0,
+ 71, 72, 35, 0, 0, 0, 0, 36, 0, 0,
+ 0, 37, 38, 39, 40, 64, 65, 0, 0, 41,
+ 66, 98, 67, 68, 69, 70, 0, 64, 65, 91,
+ 71, 72, 66, 0, 67, 68, 69, 70, 0, 64,
+ 65, 91, 71, 72, 66, 98, 67, 68, 69, 70,
+ 0, 64, 65, 0, 71, 72, 66, 0, 67, 68,
+ 69, 70, 0, -36, -36, 0, 71, 72, -36, 0,
+ 0, 0, -36, -36, 0, 0, 30, 0, -36, -36,
+ 64, 65, 0, 0, 0, 66, 0, 0, 0, 69,
+ 70, 0, 0, 0, 0, 71, 72
};
static const yytype_int16 yycheck[] =
{
- 11, 117, 11, 14, 15, 16, 0, 0, 0, 6,
- 47, 8, 23, 32, 0, 52, 0, 49, 29, 30,
- 52, 137, 41, 32, 140, 35, 36, 8, 144, 9,
- 40, 28, 8, 30, 150, 15, 47, 58, 9, 60,
- 50, 51, 33, 34, 24, 42, 43, 58, 59, 60,
- 8, 48, 63, 64, 65, 66, 67, 68, 69, 70,
- 71, 47, 8, 57, 57, 57, 0, 1, 24, 6,
- 26, 8, 6, 47, 8, 48, 32, 88, 89, 41,
- 14, 9, 16, 17, 18, 52, 97, 21, 22, 23,
- 9, 28, 24, 30, 28, 29, 30, 108, 12, 13,
- 48, 8, 31, 52, 8, 42, 43, 9, 42, 43,
- 6, 48, 8, 47, 48, 9, 127, 9, 14, 24,
- 16, 17, 18, 8, 135, 120, 22, 23, 49, 49,
- 125, 8, 28, 29, 30, 32, 52, 8, 19, 13,
- 18, 136, 8, 29, 13, 13, 42, 43, 143, 13,
- 145, 47, 48, 18, 35, 36, 151, 29, 153, 40,
- 9, 42, 43, 44, 45, 41, 15, 29, 57, 50,
- 51, 20, 84, 30, -1, 24, 25, 26, 27, 35,
- 36, -1, -1, 32, 40, 41, 42, 43, 44, 45,
- -1, 35, 36, 49, 50, 51, 40, -1, 42, 43,
- 44, 45, -1, 35, 36, 49, 50, 51, 40, 41,
- 42, 43, 44, 45, -1, 35, 36, -1, 50, 51,
- 40, -1, 42, 43, 44, 45, -1, 35, 36, -1,
- 50, 51, 40, -1, -1, -1, 44, 45, -1, -1,
- 48, -1, 50, 51, 35, 36, -1, -1, -1, 40,
- -1, -1, -1, 44, 45, -1, -1, -1, -1, 50,
- 51
+ 11, 118, 11, 14, 15, 16, 0, 0, 59, 0,
+ 61, 0, 85, 24, 9, 0, 12, 13, 49, 30,
+ 31, 52, 32, 32, 97, 8, 143, 35, 36, 146,
+ 9, 41, 40, 150, 47, 8, 15, 48, 8, 52,
+ 157, 8, 50, 51, 24, 24, 26, 0, 59, 60,
+ 61, 47, 32, 64, 65, 66, 67, 68, 69, 70,
+ 71, 72, 47, 47, 58, 58, 6, 58, 8, 58,
+ 33, 34, 48, 41, 12, 13, 9, 52, 89, 90,
+ 131, 9, 24, 0, 1, 8, 48, 98, 28, 6,
+ 30, 8, 52, 8, 31, 9, 9, 14, 109, 16,
+ 17, 18, 42, 43, 21, 22, 23, 9, 48, 8,
+ 8, 28, 29, 30, 24, 6, 32, 8, 129, 49,
+ 131, 52, 49, 8, 13, 42, 43, 121, 139, 8,
+ 47, 48, 6, 13, 8, 31, 18, 28, 13, 30,
+ 14, 29, 16, 17, 18, 18, 13, 58, 22, 23,
+ 42, 42, 43, 29, 28, 29, 30, 48, 29, 31,
+ -1, -1, -1, -1, -1, -1, -1, -1, 42, 43,
+ 6, -1, 8, 47, 48, -1, -1, -1, 14, -1,
+ 16, 17, 18, 122, -1, -1, 22, 23, 127, -1,
+ -1, 130, 28, 29, 30, -1, -1, -1, -1, 19,
+ -1, 140, -1, -1, -1, -1, 42, 43, -1, -1,
+ 149, -1, 48, 152, -1, 35, 36, -1, -1, 158,
+ 40, 160, 42, 43, 44, 45, 9, -1, -1, -1,
+ 50, 51, 15, -1, -1, -1, -1, 20, -1, -1,
+ -1, 24, 25, 26, 27, 35, 36, -1, -1, 32,
+ 40, 41, 42, 43, 44, 45, -1, 35, 36, 49,
+ 50, 51, 40, -1, 42, 43, 44, 45, -1, 35,
+ 36, 49, 50, 51, 40, 41, 42, 43, 44, 45,
+ -1, 35, 36, -1, 50, 51, 40, -1, 42, 43,
+ 44, 45, -1, 35, 36, -1, 50, 51, 40, -1,
+ -1, -1, 44, 45, -1, -1, 48, -1, 50, 51,
+ 35, 36, -1, -1, -1, 40, -1, -1, -1, 44,
+ 45, -1, -1, -1, -1, 50, 51
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -734,21 +751,21 @@ static const yytype_uint8 yystos[] =
{
0, 1, 6, 8, 14, 16, 17, 18, 21, 22,
23, 28, 29, 30, 42, 43, 48, 54, 55, 56,
- 57, 59, 60, 61, 65, 66, 68, 71, 75, 48,
- 62, 8, 67, 9, 15, 20, 24, 25, 26, 27,
- 32, 69, 70, 8, 9, 8, 8, 28, 56, 65,
- 33, 34, 8, 65, 65, 65, 0, 47, 48, 41,
- 48, 58, 65, 35, 36, 40, 42, 43, 44, 45,
- 50, 51, 65, 76, 76, 52, 9, 9, 24, 9,
- 15, 24, 32, 70, 72, 65, 19, 8, 32, 41,
- 49, 54, 58, 65, 58, 65, 31, 41, 65, 65,
- 65, 65, 65, 65, 65, 65, 65, 49, 52, 8,
- 9, 9, 9, 62, 8, 65, 65, 49, 63, 49,
- 64, 65, 65, 8, 73, 64, 11, 32, 47, 57,
- 63, 66, 47, 52, 63, 32, 65, 12, 13, 52,
- 74, 8, 13, 65, 63, 64, 18, 8, 64, 29,
- 63, 64, 63, 64, 63, 13, 63, 13, 18, 13,
- 29, 29
+ 57, 58, 60, 61, 62, 66, 67, 69, 72, 76,
+ 48, 63, 8, 68, 9, 15, 20, 24, 25, 26,
+ 27, 32, 70, 71, 8, 9, 8, 8, 28, 56,
+ 66, 33, 34, 8, 66, 66, 66, 0, 47, 48,
+ 41, 48, 59, 66, 35, 36, 40, 42, 43, 44,
+ 45, 50, 51, 66, 77, 77, 52, 9, 9, 24,
+ 9, 15, 24, 32, 71, 73, 66, 19, 8, 32,
+ 41, 49, 54, 59, 66, 59, 66, 31, 41, 66,
+ 66, 66, 66, 66, 66, 66, 66, 66, 49, 52,
+ 8, 9, 9, 9, 63, 8, 66, 66, 49, 64,
+ 49, 63, 65, 66, 66, 8, 74, 65, 11, 32,
+ 57, 62, 67, 47, 57, 64, 47, 52, 64, 32,
+ 66, 64, 59, 12, 13, 52, 75, 8, 13, 66,
+ 64, 31, 65, 18, 8, 65, 29, 64, 65, 64,
+ 65, 64, 13, 64, 13, 18, 13, 29, 29
};
#define yyerrok (yyerrstatus = 0)
@@ -1567,13 +1584,13 @@ yyreduce:
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 10:
-#line 102 "engines/director/lingo/lingo-gr.y"
+ case 11:
+#line 103 "engines/director/lingo/lingo-gr.y"
{ yyerrok; ;}
break;
- case 11:
-#line 105 "engines/director/lingo/lingo-gr.y"
+ case 12:
+#line 106 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str());
@@ -1582,8 +1599,8 @@ yyreduce:
delete (yyvsp[(4) - (4)].s); ;}
break;
- case 12:
-#line 111 "engines/director/lingo/lingo-gr.y"
+ case 13:
+#line 112 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1592,8 +1609,8 @@ yyreduce:
delete (yyvsp[(2) - (4)].s); ;}
break;
- case 13:
-#line 117 "engines/director/lingo/lingo-gr.y"
+ case 14:
+#line 118 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1602,13 +1619,13 @@ yyreduce:
delete (yyvsp[(2) - (4)].s); ;}
break;
- case 14:
-#line 125 "engines/director/lingo/lingo-gr.y"
+ case 15:
+#line 126 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 16:
-#line 127 "engines/director/lingo/lingo-gr.y"
+ case 17:
+#line 128 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
@@ -1617,8 +1634,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; ;}
break;
- case 17:
-#line 133 "engines/director/lingo/lingo-gr.y"
+ case 18:
+#line 134 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1629,8 +1646,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
break;
- case 18:
-#line 145 "engines/director/lingo/lingo-gr.y"
+ case 19:
+#line 146 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1639,8 +1656,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
- case 19:
-#line 156 "engines/director/lingo/lingo-gr.y"
+ case 20:
+#line 157 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1655,8 +1672,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
break;
- case 20:
-#line 172 "engines/director/lingo/lingo-gr.y"
+ case 21:
+#line 173 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1671,23 +1688,33 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
break;
- case 21:
-#line 186 "engines/director/lingo/lingo-gr.y"
+ case 22:
+#line 187 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
+ WRITE_UINT32(&end, (yyvsp[(6) - (6)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 3] = end; ;}
+ break;
+
+ case 23:
+#line 195 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 22:
-#line 187 "engines/director/lingo/lingo-gr.y"
+ case 24:
+#line 196 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 24:
-#line 190 "engines/director/lingo/lingo-gr.y"
+ case 26:
+#line 199 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 25:
-#line 192 "engines/director/lingo/lingo-gr.y"
+ case 27:
+#line 201 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1695,28 +1722,28 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 26:
-#line 198 "engines/director/lingo/lingo-gr.y"
+ case 28:
+#line 207 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
- case 27:
-#line 200 "engines/director/lingo/lingo-gr.y"
+ case 29:
+#line 209 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 28:
-#line 202 "engines/director/lingo/lingo-gr.y"
+ case 30:
+#line 211 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 29:
-#line 204 "engines/director/lingo/lingo-gr.y"
+ case 31:
+#line 213 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 32:
-#line 209 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 218 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1724,127 +1751,127 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 33:
-#line 214 "engines/director/lingo/lingo-gr.y"
+ case 35:
+#line 223 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeFunc((yyvsp[(1) - (4)].s), (yyvsp[(3) - (4)].narg));
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 34:
-#line 217 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 226 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 36:
-#line 221 "engines/director/lingo/lingo-gr.y"
+ case 38:
+#line 230 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 37:
-#line 222 "engines/director/lingo/lingo-gr.y"
+ case 39:
+#line 231 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 38:
-#line 223 "engines/director/lingo/lingo-gr.y"
+ case 40:
+#line 232 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 39:
-#line 224 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 233 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 40:
-#line 225 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 234 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 41:
-#line 226 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 235 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 42:
-#line 227 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 236 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 43:
-#line 228 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 237 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 44:
-#line 229 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 238 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 45:
-#line 230 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 239 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 46:
-#line 231 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 240 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 47:
-#line 232 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 241 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 48:
-#line 235 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 244 "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 49:
-#line 236 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 245 "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 50:
-#line 237 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 246 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 52:
-#line 239 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 248 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_exit); ;}
break;
- case 54:
-#line 243 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 252 "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 55:
-#line 244 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 253 "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 56:
-#line 255 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 264 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 57:
-#line 256 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 265 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 58:
-#line 257 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 266 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 59:
-#line 258 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 267 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1852,8 +1879,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 60:
-#line 263 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 272 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1862,8 +1889,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 61:
-#line 269 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 278 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1871,48 +1898,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 62:
-#line 276 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 285 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 63:
-#line 277 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 286 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 64:
-#line 278 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 287 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 65:
-#line 279 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 288 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 66:
-#line 282 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 291 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 67:
-#line 283 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 292 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 68:
-#line 284 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 293 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 69:
-#line 312 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 321 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 70:
-#line 313 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 322 "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);
@@ -1920,33 +1947,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 71:
-#line 319 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 328 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 72:
-#line 320 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 329 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 73:
-#line 321 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 330 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 74:
-#line 322 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 331 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 75:
-#line 324 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 333 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 76:
-#line 327 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 336 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -1955,24 +1982,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 77:
-#line 335 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 344 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 78:
-#line 336 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 345 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 79:
-#line 337 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 346 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 1976 "engines/director/lingo/lingo-gr.cpp"
+#line 2003 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2186,6 +2213,6 @@ yyreturn:
}
-#line 340 "engines/director/lingo/lingo-gr.y"
+#line 349 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index aca2a19..86d5872 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -98,6 +98,7 @@ programline:
| func
| macro
| asgn { g_lingo->code1(g_lingo->c_xpop); }
+ | stmtoneliner
| stmt
| error { yyerrok; }
;
@@ -183,6 +184,14 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
(*g_lingo->_currentScript)[$1 + 5] = end; } /* end, if cond fails */
;
+stmtoneliner: if cond tTHEN begin stmt end {
+ inst then = 0, end = 0;
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&end, $6);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ ;
+
cond: expr { g_lingo->code1(STOP); }
| expr '=' expr { g_lingo->code2(g_lingo->c_eq, STOP); }
| '(' cond ')'
Commit: 2d08b875241739bb6b003e294af4bcb19ca21743
https://github.com/scummvm/scummvm/commit/2d08b875241739bb6b003e294af4bcb19ca21743
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Added random source
Changed paths:
engines/director/director.cpp
engines/director/director.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index c0c5a8b..45c27e7 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -46,7 +46,8 @@
namespace Director {
-DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
+DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc),
+ _rnd("director") {
if (!_mixer->isReady())
error("Sound initialization failed");
diff --git a/engines/director/director.h b/engines/director/director.h
index 2d0b734..bb08099 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -24,6 +24,7 @@
#define DIRECTOR_DIRECTOR_H
#include "common/scummsys.h"
+#include "common/random.h"
#include "common/substream.h"
#include "common/str.h"
@@ -76,6 +77,7 @@ public:
Common::HashMap<Common::String, Score *> *_movies;
Score *_currentScore;
+ Common::RandomSource _rnd;
protected:
virtual Common::Error run();
Commit: 8a7411fb9751cbfe1c7b3e0c7ee6ccf57a4efdc1
https://github.com/scummvm/scummvm/commit/8a7411fb9751cbfe1c7b3e0c7ee6ccf57a4efdc1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Complete Rand() function implementation
Changed paths:
engines/director/lingo/lingo-builtins.cpp
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 2286bb7..311e774 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -43,10 +43,12 @@ void Lingo::b_random() {
Datum max = g_lingo->pop();
Datum res;
- res.u.i = 5;
+ if (max.type != INT)
+ warning("Non-int type for rand: %d", max.type);
+
+ res.u.i = g_lingo->_vm->_rnd.getRandomNumber(max.u.i);
res.type = INT;
- warning("b_random");
g_lingo->push(res);
}
Commit: 56d51f9c1d3cd2003d06d59aa88ef63973ada4f9
https://github.com/scummvm/scummvm/commit/56d51f9c1d3cd2003d06d59aa88ef63973ada4f9
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Loading Classic Mac fonts
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index fc24de7..25154cc 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -24,7 +24,9 @@
#include "common/stream.h"
#include "common/debug.h"
#include "common/file.h"
+#include "common/archive.h"
#include "common/config-manager.h"
+#include "common/unzip.h"
#include "common/system.h"
#include "director/dib.h"
@@ -38,10 +40,12 @@
#include "graphics/managed_surface.h"
#include "image/bmp.h"
#include "graphics/fontman.h"
+#include "graphics/fonts/bdf.h"
namespace Director {
Score::Score(DirectorEngine *vm) {
+ loadMacFonts();
_vm = vm;
_surface = new Graphics::ManagedSurface;
_trailSurface = new Graphics::ManagedSurface;
@@ -591,11 +595,53 @@ void Score::loadFontMap(Common::SeekableSubReadStreamEndian &stream) {
}
_fontMap[id] = font;
+ debug(3, "ID %d Font %s", id, font.c_str());
currentRawPosition = stream.pos();
stream.seek(positionInfo);
}
}
+void Score::loadMacFonts() {
+ //Copy from Wage
+ Common::Archive *dat;
+
+ dat = Common::makeZipArchive("classicmacfonts.dat");
+
+ if (!dat) {
+ warning("Could not find classicmacfonts.dat. Falling back to built-in fonts");
+ return;
+ }
+
+ Common::ArchiveMemberList list;
+ dat->listMembers(list);
+
+ for (Common::ArchiveMemberList::iterator it = list.begin(); it != list.end(); ++it) {
+ Common::SeekableReadStream *stream = dat->createReadStreamForMember((*it)->getName());
+
+ Graphics::BdfFont *font = Graphics::BdfFont::loadFont(*stream);
+
+ delete stream;
+
+ Common::String fontName = (*it)->getName();
+
+ // Trim the .bdf extension
+ for (int i = fontName.size() - 1; i >= 0; --i) {
+ if (fontName[i] == '.') {
+ while ((uint)i < fontName.size()) {
+ fontName.deleteLastChar();
+ }
+ break;
+ }
+ }
+
+ FontMan.assignFontToName(fontName, font);
+
+ debug(" %s", fontName.c_str());
+ }
+
+ delete dat;
+}
+
BitmapCast::BitmapCast(Common::SeekableSubReadStreamEndian &stream) {
/*byte flags = */ stream.readByte();
uint16 someFlaggyThing = stream.readUint16();
diff --git a/engines/director/score.h b/engines/director/score.h
index 459d2e9..f3efd56 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -357,6 +357,7 @@ private:
void update();
void readVersion(uint32 rid);
void loadConfig(Common::SeekableSubReadStreamEndian &stream);
+ void loadMacFonts();
void loadPalette(Common::SeekableSubReadStreamEndian &stream);
void loadFrames(Common::SeekableSubReadStreamEndian &stream);
void loadLabels(Common::SeekableSubReadStreamEndian &stream);
Commit: 1b0e5467456bfe452217c09af7494861480c4523
https://github.com/scummvm/scummvm/commit/1b0e5467456bfe452217c09af7494861480c4523
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Assignment some TextCast unknows
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 25154cc..e5857f2 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -664,7 +664,9 @@ TextCast::TextCast(Common::SeekableSubReadStreamEndian &stream) {
textType = static_cast<TextType>(stream.readByte());
textAlign = static_cast<TextAlignType>(stream.readUint16());
stream.skip(6); //palinfo
- /*uint32 unk1 = */ stream.readUint32();
+ //for now, just supposition
+ fontId = stream.readUint32();
+
initialRect = Score::readRect(stream);
textShadow = static_cast<SizeType>(stream.readByte());
byte flags = stream.readByte();
@@ -674,8 +676,8 @@ TextCast::TextCast(Common::SeekableSubReadStreamEndian &stream) {
textFlags.push_back(kTextFlagAutoTab);
if (flags & 0x4)
textFlags.push_back(kTextFlagDoNotWrap);
-
- /*uint16 unk2 =*/ stream.readUint16();
+ //again supposition
+ fontSize = stream.readUint16();
}
ShapeCast::ShapeCast(Common::SeekableSubReadStreamEndian &stream) {
diff --git a/engines/director/score.h b/engines/director/score.h
index f3efd56..b6eb968 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -234,6 +234,8 @@ struct TextCast : Cast {
SizeType gutterSize;
SizeType boxShadow;
+ uint32 fontId;
+ uint16 fontSize;
TextType textType;
TextAlignType textAlign;
SizeType textShadow;
Commit: 32fb9a33442af5786a207f1b9b053f0ef5cda8ae
https://github.com/scummvm/scummvm/commit/32fb9a33442af5786a207f1b9b053f0ef5cda8ae
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Draw string with mac fonts
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index e5857f2..ea0616a 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1303,7 +1303,8 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID) {
uint16 castID = _sprites[spriteID]->_castId;
- Cast *textCast = _vm->_currentScore->_casts[castID];
+
+ TextCast *textCast = static_cast<TextCast *>(_vm->_currentScore->_casts[castID]);
Common::SeekableSubReadStreamEndian *textStream;
if (_vm->_currentScore->_movieArchive->hasResource(MKTAG('S','T','X','T'), castID + 1024)) {
@@ -1332,8 +1333,13 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID) {
int height = _sprites[spriteID]->_height;
int width = _sprites[spriteID]->_width;
- //FIXME
- FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont)->drawString(&surface, text, x, y, width, 0);
+ const Graphics::Font *font = FontMan.getFontByName(_vm->_currentScore->_fontMap[textCast->fontId]);
+
+ if (!font) {
+ error("Cannot load font %s", _vm->_currentScore->_fontMap[textCast->fontId].c_str());
+ }
+
+ font->drawString(&surface, text, x, y, width, 0);
}
void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
Commit: ca40ccd9d123d18d9ba5e7b9a504a9fb6ee10355
https://github.com/scummvm/scummvm/commit/ca40ccd9d123d18d9ba5e7b9a504a9fb6ee10355
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Added float constants and automatic type conversion
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 45c27e7..71cd3b6 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -149,6 +149,12 @@ check(1, 2, 3)\n\
check 4, 5, 6\n\
check 7, 8\n\
if random(4) > 2 then put 1000\n\
+set z = 5.5\n\
+set z1 = 2\n\
+set z2 = z / z1\n\
+put z\n\
+put z1\n\
+put z2\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 1a297e5..163dd1a 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -105,6 +105,17 @@ void Lingo::c_constpush() {
g_lingo->push(d);
}
+void Lingo::c_fconstpush() {
+ Datum d;
+ inst i = (*g_lingo->_currentScript)[g_lingo->_pc];
+ d.u.f = *((float *)&i);
+ d.type = FLOAT;
+
+ g_lingo->_pc += g_lingo->calcCodeAlignment(sizeof(float));
+
+ g_lingo->push(d);
+}
+
void Lingo::c_varpush() {
char *name = (char *)&(*g_lingo->_currentScript)[g_lingo->_pc];
Datum d;
@@ -139,7 +150,7 @@ void Lingo::c_assign() {
}
bool Lingo::verify(Symbol *s) {
- if (s->type != INT && s->type != VOID) {
+ if (s->type != INT && s->type != VOID && s->type != FLOAT) {
warning("attempt to evaluate non-variable '%s'", s->name);
return false;
@@ -168,7 +179,11 @@ void Lingo::c_add() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.u.i += d2.u.i;
+ if (g_lingo->alignTypes(d1, d2) == FLOAT) {
+ d1.u.f += d2.u.f;
+ } else {
+ d1.u.i += d2.u.i;
+ }
g_lingo->push(d1);
}
@@ -176,7 +191,11 @@ void Lingo::c_sub() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.u.i -= d2.u.i;
+ if (g_lingo->alignTypes(d1, d2) == FLOAT) {
+ d1.u.f -= d2.u.f;
+ } else {
+ d1.u.i -= d2.u.i;
+ }
g_lingo->push(d1);
}
@@ -184,26 +203,39 @@ void Lingo::c_mul() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.u.i *= d2.u.i;
+ if (g_lingo->alignTypes(d1, d2) == FLOAT) {
+ d1.u.f *= d2.u.f;
+ } else {
+ d1.u.i *= d2.u.i;
+ }
g_lingo->push(d1);
}
void Lingo::c_div() {
Datum d2 = g_lingo->pop();
- if (d2.u.i == 0)
+ if ((d2.type == INT && d2.u.i == 0) ||
+ (d2.type == FLOAT && d2.u.f == 0.0))
error("division by zero");
Datum d1 = g_lingo->pop();
- d1.u.i /= d2.u.i;
+ if (g_lingo->alignTypes(d1, d2) == FLOAT) {
+ d1.u.f /= d2.u.f;
+ } else {
+ d1.u.i /= d2.u.i;
+ }
g_lingo->push(d1);
}
void Lingo::c_negate() {
Datum d = g_lingo->pop();
- d.u.i -= d.u.i;
+ if (d.type == INT)
+ d.u.i = -d.u.i;
+ else if (d.type == FLOAT)
+ d.u.f = -d.u.f;
+
g_lingo->push(d);
}
@@ -211,7 +243,12 @@ void Lingo::c_eq() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.u.i = (d1.u.i == d2.u.i) ? 1 : 0;
+ if (g_lingo->alignTypes(d1, d2) == FLOAT) {
+ d1.u.i = (d1.u.f == d2.u.f) ? 1 : 0;
+ d1.type = INT;
+ } else {
+ d1.u.i = (d1.u.i == d2.u.i) ? 1 : 0;
+ }
g_lingo->push(d1);
}
@@ -219,7 +256,12 @@ void Lingo::c_neq() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.u.i = (d1.u.i != d2.u.i) ? 1 : 0;
+ if (g_lingo->alignTypes(d1, d2) == FLOAT) {
+ d1.u.i = (d1.u.f != d2.u.f) ? 1 : 0;
+ d1.type = INT;
+ } else {
+ d1.u.i = (d1.u.i != d2.u.i) ? 1 : 0;
+ }
g_lingo->push(d1);
}
@@ -227,7 +269,12 @@ void Lingo::c_gt() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.u.i = (d1.u.i > d2.u.i) ? 1 : 0;
+ if (g_lingo->alignTypes(d1, d2) == FLOAT) {
+ d1.u.i = (d1.u.f > d2.u.f) ? 1 : 0;
+ d1.type = INT;
+ } else {
+ d1.u.i = (d1.u.i > d2.u.i) ? 1 : 0;
+ }
g_lingo->push(d1);
}
@@ -235,7 +282,12 @@ void Lingo::c_lt() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.u.i = (d1.u.i < d2.u.i) ? 1 : 0;
+ if (g_lingo->alignTypes(d1, d2) == FLOAT) {
+ d1.u.i = (d1.u.f < d2.u.f) ? 1 : 0;
+ d1.type = INT;
+ } else {
+ d1.u.i = (d1.u.i < d2.u.i) ? 1 : 0;
+ }
g_lingo->push(d1);
}
@@ -243,7 +295,12 @@ void Lingo::c_ge() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.u.i = (d1.u.i >= d2.u.i) ? 1 : 0;
+ if (g_lingo->alignTypes(d1, d2) == FLOAT) {
+ d1.u.i = (d1.u.f >= d2.u.f) ? 1 : 0;
+ d1.type = INT;
+ } else {
+ d1.u.i = (d1.u.i >= d2.u.i) ? 1 : 0;
+ }
g_lingo->push(d1);
}
@@ -251,7 +308,12 @@ void Lingo::c_le() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- d1.u.i = (d1.u.i <= d2.u.i) ? 1 : 0;
+ if (g_lingo->alignTypes(d1, d2) == FLOAT) {
+ d1.u.i = (d1.u.f <= d2.u.f) ? 1 : 0;
+ d1.type = INT;
+ } else {
+ d1.u.i = (d1.u.i <= d2.u.i) ? 1 : 0;
+ }
g_lingo->push(d1);
}
@@ -264,6 +326,7 @@ void Lingo::c_repeatwhilecode(void) {
g_lingo->execute(savepc + 2); /* condition */
d = g_lingo->pop();
+ d.toInt();
while (d.u.i) {
g_lingo->execute(body); /* body */
@@ -272,6 +335,7 @@ void Lingo::c_repeatwhilecode(void) {
g_lingo->execute(savepc + 2); /* condition */
d = g_lingo->pop();
+ d.toInt();
}
if (!g_lingo->_returning)
@@ -292,6 +356,7 @@ void Lingo::c_repeatwithcode(void) {
g_lingo->execute(init); /* condition */
d = g_lingo->pop();
+ d.toInt();
counter->u.val = d.u.i;
counter->type = INT;
@@ -303,6 +368,7 @@ void Lingo::c_repeatwithcode(void) {
counter->u.val += inc;
g_lingo->execute(finish); /* condition */
d = g_lingo->pop();
+ d.toInt();
if (counter->u.val == d.u.i + inc)
break;
@@ -324,7 +390,7 @@ void Lingo::c_ifcode() {
d = g_lingo->pop();
- if (d.u.i) {
+ if (d.toInt()) {
g_lingo->execute(then);
} else if (elsep) { /* else part? */
g_lingo->execute(elsep);
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 6e388dd..bafc225 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -143,6 +143,23 @@ int Lingo::codeString(const char *str) {
return _currentScript->size();
}
+int Lingo::codeFloat(float f) {
+ int numInsts = calcCodeAlignment(sizeof(float));
+
+ // Where we copy the string over
+ int pos = _currentScript->size();
+
+ // Allocate needed space in script
+ for (int i = 0; i < numInsts; i++)
+ _currentScript->push_back(0);
+
+ float *dst = (float *)((byte *)&_currentScript->front() + pos * sizeof(inst));
+
+ *dst = f;
+
+ return _currentScript->size();
+}
+
void Lingo::codeArg(Common::String *s) {
_argstack.push_back(s);
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 3ed07c5..4e4262b 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -422,7 +422,7 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 57
+#define YYFINAL 58
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 326
@@ -431,9 +431,9 @@ union yyalloc
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 25
/* YYNRULES -- Number of rules. */
-#define YYNRULES 81
+#define YYNRULES 82
/* YYNRULES -- Number of states. */
-#define YYNSTATES 169
+#define YYNSTATES 170
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -485,12 +485,12 @@ static const yytype_uint16 yyprhs[] =
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
20, 22, 24, 29, 34, 39, 41, 43, 51, 62,
71, 83, 96, 103, 105, 109, 113, 116, 120, 122,
- 123, 124, 125, 128, 131, 133, 138, 140, 142, 146,
- 150, 154, 158, 162, 166, 170, 174, 178, 181, 184,
- 188, 191, 194, 197, 199, 201, 204, 206, 210, 213,
- 216, 219, 222, 226, 229, 233, 236, 239, 241, 245,
- 248, 252, 253, 262, 263, 265, 269, 274, 275, 279,
- 280, 282
+ 123, 124, 125, 128, 131, 133, 135, 140, 142, 144,
+ 148, 152, 156, 160, 164, 168, 172, 176, 180, 183,
+ 186, 190, 193, 196, 199, 201, 203, 206, 208, 212,
+ 215, 218, 221, 224, 228, 231, 235, 238, 241, 243,
+ 247, 250, 254, 255, 264, 265, 267, 271, 276, 277,
+ 281, 282, 284
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -509,22 +509,22 @@ static const yytype_int8 yyrhs[] =
57, 64, -1, 66, -1, 66, 41, 66, -1, 48,
59, 49, -1, 29, 34, -1, 29, 33, 8, -1,
18, -1, -1, -1, -1, 65, 47, -1, 65, 57,
- -1, 6, -1, 8, 48, 77, 49, -1, 8, -1,
- 56, -1, 66, 42, 66, -1, 66, 43, 66, -1,
- 66, 44, 66, -1, 66, 45, 66, -1, 66, 50,
- 66, -1, 66, 51, 66, -1, 66, 40, 66, -1,
- 66, 35, 66, -1, 66, 36, 66, -1, 42, 66,
- -1, 43, 66, -1, 48, 66, 49, -1, 22, 9,
- -1, 23, 8, -1, 28, 66, -1, 69, -1, 14,
- -1, 16, 68, -1, 8, -1, 68, 52, 8, -1,
- 17, 20, -1, 17, 25, -1, 17, 27, -1, 17,
- 70, -1, 17, 70, 71, -1, 17, 71, -1, 32,
- 15, 9, -1, 15, 9, -1, 32, 9, -1, 9,
- -1, 26, 24, 9, -1, 24, 9, -1, 32, 24,
- 9, -1, -1, 21, 8, 73, 63, 74, 47, 75,
- 65, -1, -1, 8, -1, 74, 52, 8, -1, 74,
- 47, 52, 8, -1, -1, 8, 63, 77, -1, -1,
- 66, -1, 77, 52, 66, -1
+ -1, 6, -1, 7, -1, 8, 48, 77, 49, -1,
+ 8, -1, 56, -1, 66, 42, 66, -1, 66, 43,
+ 66, -1, 66, 44, 66, -1, 66, 45, 66, -1,
+ 66, 50, 66, -1, 66, 51, 66, -1, 66, 40,
+ 66, -1, 66, 35, 66, -1, 66, 36, 66, -1,
+ 42, 66, -1, 43, 66, -1, 48, 66, 49, -1,
+ 22, 9, -1, 23, 8, -1, 28, 66, -1, 69,
+ -1, 14, -1, 16, 68, -1, 8, -1, 68, 52,
+ 8, -1, 17, 20, -1, 17, 25, -1, 17, 27,
+ -1, 17, 70, -1, 17, 70, 71, -1, 17, 71,
+ -1, 32, 15, 9, -1, 15, 9, -1, 32, 9,
+ -1, 9, -1, 26, 24, 9, -1, 24, 9, -1,
+ 32, 24, 9, -1, -1, 21, 8, 73, 63, 74,
+ 47, 75, 65, -1, -1, 8, -1, 74, 52, 8,
+ -1, 74, 47, 52, 8, -1, -1, 8, 63, 77,
+ -1, -1, 66, -1, 77, 52, 66, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -533,12 +533,12 @@ static const yytype_uint16 yyrline[] =
0, 92, 92, 93, 96, 97, 98, 99, 100, 101,
102, 103, 106, 112, 118, 126, 127, 128, 134, 146,
157, 173, 187, 195, 196, 197, 199, 201, 207, 209,
- 211, 213, 214, 215, 218, 223, 226, 229, 230, 231,
- 232, 233, 234, 235, 236, 237, 238, 239, 240, 241,
- 244, 245, 246, 247, 248, 249, 252, 253, 264, 265,
- 266, 267, 272, 278, 285, 286, 287, 288, 291, 292,
- 293, 321, 321, 328, 329, 330, 331, 333, 336, 344,
- 345, 346
+ 211, 213, 214, 215, 218, 223, 226, 229, 232, 233,
+ 234, 235, 236, 237, 238, 239, 240, 241, 242, 243,
+ 244, 247, 248, 249, 250, 251, 252, 255, 256, 267,
+ 268, 269, 270, 275, 281, 288, 289, 290, 291, 294,
+ 295, 296, 324, 324, 331, 332, 333, 334, 336, 339,
+ 347, 348, 349
};
#endif
@@ -582,10 +582,10 @@ static const yytype_uint8 yyr1[] =
57, 57, 58, 59, 59, 59, 60, 61, 62, 63,
64, 65, 65, 65, 66, 66, 66, 66, 66, 66,
66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
- 67, 67, 67, 67, 67, 67, 68, 68, 69, 69,
- 69, 69, 69, 69, 70, 70, 70, 70, 71, 71,
- 71, 73, 72, 74, 74, 74, 74, 75, 76, 77,
- 77, 77
+ 66, 67, 67, 67, 67, 67, 67, 68, 68, 69,
+ 69, 69, 69, 69, 69, 70, 70, 70, 70, 71,
+ 71, 71, 73, 72, 74, 74, 74, 74, 75, 76,
+ 77, 77, 77
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -594,12 +594,12 @@ static const yytype_uint8 yyr2[] =
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
1, 1, 4, 4, 4, 1, 1, 7, 10, 8,
11, 12, 6, 1, 3, 3, 2, 3, 1, 0,
- 0, 0, 2, 2, 1, 4, 1, 1, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 2, 2, 3,
- 2, 2, 2, 1, 1, 2, 1, 3, 2, 2,
- 2, 2, 3, 2, 3, 2, 2, 1, 3, 2,
- 3, 0, 8, 0, 1, 3, 4, 0, 3, 0,
- 1, 3
+ 0, 0, 2, 2, 1, 1, 4, 1, 1, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 2, 2,
+ 3, 2, 2, 2, 1, 1, 2, 1, 3, 2,
+ 2, 2, 2, 3, 2, 3, 2, 2, 1, 3,
+ 2, 3, 0, 8, 0, 1, 3, 4, 0, 3,
+ 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -607,132 +607,132 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 34, 29, 54, 0, 0, 28, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 3, 37,
- 10, 9, 0, 0, 0, 15, 6, 53, 5, 7,
- 79, 79, 56, 55, 67, 0, 58, 0, 59, 0,
- 60, 0, 61, 63, 71, 50, 51, 36, 0, 37,
- 52, 0, 26, 0, 47, 48, 0, 1, 0, 0,
- 0, 0, 0, 23, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 80, 0, 78, 0, 65, 69, 0,
- 66, 0, 0, 0, 62, 29, 0, 0, 27, 0,
- 0, 49, 2, 0, 30, 0, 0, 29, 0, 45,
- 46, 44, 38, 39, 40, 41, 42, 43, 35, 0,
- 57, 68, 64, 70, 73, 12, 14, 13, 31, 0,
- 25, 0, 30, 24, 81, 74, 0, 30, 0, 0,
- 30, 0, 16, 32, 33, 0, 77, 0, 0, 0,
- 30, 22, 0, 31, 0, 0, 31, 75, 0, 30,
- 31, 31, 30, 17, 76, 72, 19, 31, 30, 0,
- 30, 0, 0, 0, 0, 18, 0, 20, 21
+ 0, 11, 34, 35, 29, 55, 0, 0, 28, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
+ 38, 10, 9, 0, 0, 0, 15, 6, 54, 5,
+ 7, 80, 80, 57, 56, 68, 0, 59, 0, 60,
+ 0, 61, 0, 62, 64, 72, 51, 52, 37, 0,
+ 38, 53, 0, 26, 0, 48, 49, 0, 1, 0,
+ 0, 0, 0, 0, 23, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 81, 0, 79, 0, 66, 70,
+ 0, 67, 0, 0, 0, 63, 29, 0, 0, 27,
+ 0, 0, 50, 2, 0, 30, 0, 0, 29, 0,
+ 46, 47, 45, 39, 40, 41, 42, 43, 44, 36,
+ 0, 58, 69, 65, 71, 74, 12, 14, 13, 31,
+ 0, 25, 0, 30, 24, 82, 75, 0, 30, 0,
+ 0, 30, 0, 16, 32, 33, 0, 78, 0, 0,
+ 0, 30, 22, 0, 31, 0, 0, 31, 76, 0,
+ 30, 31, 31, 30, 17, 77, 73, 19, 31, 30,
+ 0, 30, 0, 0, 0, 0, 18, 0, 20, 21
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 17, 18, 49, 134, 21, 62, 22, 23, 131,
- 31, 119, 122, 25, 132, 33, 27, 42, 43, 28,
- 85, 126, 146, 29, 74
+ -1, 18, 19, 50, 135, 22, 63, 23, 24, 132,
+ 32, 120, 123, 26, 133, 34, 28, 43, 44, 29,
+ 86, 127, 147, 30, 75
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -118
+#define YYPACT_NINF -119
static const yytype_int16 yypact[] =
{
- 83, -118, -118, 258, -118, 17, 217, -118, 27, 5,
- 30, 60, 37, 33, 60, 60, 60, 47, 16, 15,
- -118, -118, 24, 32, 109, 246, -118, -118, -118, -118,
- 60, 60, -118, 25, -118, 67, -118, 72, -118, 58,
- -118, 21, 20, -118, -118, -118, -118, 38, 60, -118,
- 180, 77, -118, -10, -8, -8, 222, -118, 83, 109,
- 60, 109, 63, 234, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 246, -31, 40, 85, -118, -118, 86,
- -118, 87, 98, 90, -118, -118, 180, 101, -118, 60,
- 60, -118, -118, 70, 246, 73, 210, 4, 60, 246,
- 246, 246, 275, 275, -8, -8, 246, 246, -118, 60,
- -118, -118, -118, -118, 102, -118, 246, 246, -118, -9,
- -118, 164, 126, 246, 246, -118, -13, 126, 84, 60,
- -118, 109, -118, -118, -118, 62, 69, 115, 111, 60,
- 246, -118, 104, -118, 118, 121, -118, -118, 112, 246,
- -118, -118, 126, -118, -118, 126, -118, -118, 126, 120,
- 126, 125, 127, 133, 124, -118, 129, -118, -118
+ 83, -119, -119, -119, 258, -119, 17, 217, -119, 27,
+ 5, 33, 66, 30, 39, 66, 66, 66, 38, 22,
+ 15, -119, -119, 19, 36, 109, 246, -119, -119, -119,
+ -119, 66, 66, -119, 29, -119, 62, -119, 73, -119,
+ 61, -119, 21, 20, -119, -119, -119, -119, 40, 66,
+ -119, 180, 78, -119, -10, -8, -8, 222, -119, 83,
+ 109, 66, 109, 64, 234, 66, 66, 66, 66, 66,
+ 66, 66, 66, 66, 246, -31, 41, 84, -119, -119,
+ 93, -119, 94, 98, 86, -119, -119, 180, 111, -119,
+ 66, 66, -119, -119, 72, 246, 74, 210, 4, 66,
+ 246, 246, 246, 275, 275, -8, -8, 246, 246, -119,
+ 66, -119, -119, -119, -119, 114, -119, 246, 246, -119,
+ -9, -119, 164, 126, 246, 246, -119, -13, 126, 92,
+ 66, -119, 109, -119, -119, -119, 63, 75, 127, 123,
+ 66, 246, -119, 107, -119, 128, 133, -119, -119, 116,
+ 246, -119, -119, 126, -119, -119, 126, -119, -119, 126,
+ 134, 126, 137, 135, 145, 130, -119, 131, -119, -119
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -118, 89, -118, 7, 6, -118, -51, -118, -118, 9,
- -73, 61, -117, -11, 11, -118, -118, -118, 108, -118,
- -118, -118, -118, -118, 128
+ -119, 102, -119, 6, 7, -119, -52, -119, -119, 9,
+ -74, 60, -118, -12, 11, -119, -119, -119, 119, -119,
+ -119, -119, -119, -119, 132
};
/* 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 -37
+#define YYTABLE_NINF -38
static const yytype_int16 yytable[] =
{
- 50, 127, 128, 54, 55, 56, 20, 19, 93, 24,
- 95, 26, 114, 63, 45, -8, -31, -31, 108, 73,
- 73, 109, 89, 129, 121, 32, 152, 64, 65, 155,
- 80, 90, 66, 158, 136, 44, 81, 86, 46, 137,
- 160, 53, 71, 72, 37, 82, 39, 57, 63, 94,
- 96, -31, 83, 99, 100, 101, 102, 103, 104, 105,
- 106, 107, -8, 58, 20, 19, 2, 24, 47, 26,
- 51, 52, 59, 60, 143, 144, 77, 76, 116, 117,
- 142, 78, 79, -4, 1, 88, 30, 123, 48, 2,
- 13, 3, 109, 110, 97, 111, 112, 4, 124, 5,
- 6, 7, 14, 15, 8, 9, 10, 113, 16, 115,
- 125, 11, 12, 13, 82, 2, 139, 47, 140, 118,
- 63, 145, 120, 147, 148, 14, 15, 130, 149, 154,
- -4, 16, 2, 162, 47, 151, 153, 48, 164, 13,
- 4, 156, 5, 6, 7, 165, 166, 92, 9, 10,
- 84, 14, 15, 167, 11, 12, 13, 61, 168, 75,
- 0, 0, 0, 0, 0, 0, 0, 0, 14, 15,
- 2, 0, 47, 133, 16, 0, 0, 0, 4, 0,
- 5, 6, 7, 135, 0, 0, 9, 10, 138, 0,
- 0, 141, 11, 12, 13, 0, 0, 0, 0, 87,
- 0, 150, 0, 0, 0, 0, 14, 15, 0, 0,
- 157, 0, 16, 159, 0, 64, 65, 0, 0, 161,
- 66, 163, 67, 68, 69, 70, 34, 0, 0, 0,
- 71, 72, 35, 0, 0, 0, 0, 36, 0, 0,
- 0, 37, 38, 39, 40, 64, 65, 0, 0, 41,
- 66, 98, 67, 68, 69, 70, 0, 64, 65, 91,
- 71, 72, 66, 0, 67, 68, 69, 70, 0, 64,
- 65, 91, 71, 72, 66, 98, 67, 68, 69, 70,
- 0, 64, 65, 0, 71, 72, 66, 0, 67, 68,
- 69, 70, 0, -36, -36, 0, 71, 72, -36, 0,
- 0, 0, -36, -36, 0, 0, 30, 0, -36, -36,
- 64, 65, 0, 0, 0, 66, 0, 0, 0, 69,
- 70, 0, 0, 0, 0, 71, 72
+ 51, 128, 129, 55, 56, 57, 20, 21, 94, 25,
+ 96, 27, 115, 64, 46, -8, -31, -31, 109, 74,
+ 74, 110, 90, 130, 122, 33, 153, 65, 66, 156,
+ 81, 91, 67, 159, 137, 45, 82, 87, 58, 138,
+ 161, 47, 72, 73, 38, 83, 40, 54, 64, 95,
+ 97, -31, 84, 100, 101, 102, 103, 104, 105, 106,
+ 107, 108, -8, 52, 53, 20, 21, 60, 25, 59,
+ 27, 78, 2, 3, 48, 144, 145, 61, 117, 118,
+ 143, 77, 79, -4, 1, 80, 89, 124, 31, 2,
+ 3, 4, 111, 110, 49, 98, 14, 5, 125, 6,
+ 7, 8, 112, 113, 9, 10, 11, 114, 15, 16,
+ 83, 12, 13, 14, 17, 2, 3, 48, 141, 116,
+ 64, 119, 126, 121, 140, 15, 16, 146, 150, 131,
+ -4, 17, 2, 3, 48, 148, 149, 49, 152, 14,
+ 5, 155, 6, 7, 8, 157, 154, 163, 10, 11,
+ 165, 15, 16, 166, 12, 13, 14, 62, 167, 168,
+ 169, 93, 85, 0, 76, 0, 0, 0, 15, 16,
+ 2, 3, 48, 134, 17, 0, 0, 0, 5, 0,
+ 6, 7, 8, 136, 0, 0, 10, 11, 139, 0,
+ 0, 142, 12, 13, 14, 0, 0, 0, 0, 88,
+ 0, 151, 0, 0, 0, 0, 15, 16, 0, 0,
+ 158, 0, 17, 160, 0, 65, 66, 0, 0, 162,
+ 67, 164, 68, 69, 70, 71, 35, 0, 0, 0,
+ 72, 73, 36, 0, 0, 0, 0, 37, 0, 0,
+ 0, 38, 39, 40, 41, 65, 66, 0, 0, 42,
+ 67, 99, 68, 69, 70, 71, 0, 65, 66, 92,
+ 72, 73, 67, 0, 68, 69, 70, 71, 0, 65,
+ 66, 92, 72, 73, 67, 99, 68, 69, 70, 71,
+ 0, 65, 66, 0, 72, 73, 67, 0, 68, 69,
+ 70, 71, 0, -37, -37, 0, 72, 73, -37, 0,
+ 0, 0, -37, -37, 0, 0, 31, 0, -37, -37,
+ 65, 66, 0, 0, 0, 67, 0, 0, 0, 70,
+ 71, 0, 0, 0, 0, 72, 73
};
static const yytype_int16 yycheck[] =
{
- 11, 118, 11, 14, 15, 16, 0, 0, 59, 0,
- 61, 0, 85, 24, 9, 0, 12, 13, 49, 30,
- 31, 52, 32, 32, 97, 8, 143, 35, 36, 146,
- 9, 41, 40, 150, 47, 8, 15, 48, 8, 52,
- 157, 8, 50, 51, 24, 24, 26, 0, 59, 60,
- 61, 47, 32, 64, 65, 66, 67, 68, 69, 70,
- 71, 72, 47, 47, 58, 58, 6, 58, 8, 58,
- 33, 34, 48, 41, 12, 13, 9, 52, 89, 90,
- 131, 9, 24, 0, 1, 8, 48, 98, 28, 6,
- 30, 8, 52, 8, 31, 9, 9, 14, 109, 16,
- 17, 18, 42, 43, 21, 22, 23, 9, 48, 8,
- 8, 28, 29, 30, 24, 6, 32, 8, 129, 49,
- 131, 52, 49, 8, 13, 42, 43, 121, 139, 8,
- 47, 48, 6, 13, 8, 31, 18, 28, 13, 30,
- 14, 29, 16, 17, 18, 18, 13, 58, 22, 23,
- 42, 42, 43, 29, 28, 29, 30, 48, 29, 31,
- -1, -1, -1, -1, -1, -1, -1, -1, 42, 43,
- 6, -1, 8, 47, 48, -1, -1, -1, 14, -1,
- 16, 17, 18, 122, -1, -1, 22, 23, 127, -1,
- -1, 130, 28, 29, 30, -1, -1, -1, -1, 19,
- -1, 140, -1, -1, -1, -1, 42, 43, -1, -1,
- 149, -1, 48, 152, -1, 35, 36, -1, -1, 158,
- 40, 160, 42, 43, 44, 45, 9, -1, -1, -1,
+ 12, 119, 11, 15, 16, 17, 0, 0, 60, 0,
+ 62, 0, 86, 25, 9, 0, 12, 13, 49, 31,
+ 32, 52, 32, 32, 98, 8, 144, 35, 36, 147,
+ 9, 41, 40, 151, 47, 8, 15, 49, 0, 52,
+ 158, 8, 50, 51, 24, 24, 26, 8, 60, 61,
+ 62, 47, 32, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 47, 33, 34, 59, 59, 48, 59, 47,
+ 59, 9, 6, 7, 8, 12, 13, 41, 90, 91,
+ 132, 52, 9, 0, 1, 24, 8, 99, 48, 6,
+ 7, 8, 8, 52, 28, 31, 30, 14, 110, 16,
+ 17, 18, 9, 9, 21, 22, 23, 9, 42, 43,
+ 24, 28, 29, 30, 48, 6, 7, 8, 130, 8,
+ 132, 49, 8, 49, 32, 42, 43, 52, 140, 122,
+ 47, 48, 6, 7, 8, 8, 13, 28, 31, 30,
+ 14, 8, 16, 17, 18, 29, 18, 13, 22, 23,
+ 13, 42, 43, 18, 28, 29, 30, 48, 13, 29,
+ 29, 59, 43, -1, 32, -1, -1, -1, 42, 43,
+ 6, 7, 8, 47, 48, -1, -1, -1, 14, -1,
+ 16, 17, 18, 123, -1, -1, 22, 23, 128, -1,
+ -1, 131, 28, 29, 30, -1, -1, -1, -1, 19,
+ -1, 141, -1, -1, -1, -1, 42, 43, -1, -1,
+ 150, -1, 48, 153, -1, 35, 36, -1, -1, 159,
+ 40, 161, 42, 43, 44, 45, 9, -1, -1, -1,
50, 51, 15, -1, -1, -1, -1, 20, -1, -1,
-1, 24, 25, 26, 27, 35, 36, -1, -1, 32,
40, 41, 42, 43, 44, 45, -1, 35, 36, 49,
@@ -749,23 +749,23 @@ static const yytype_int16 yycheck[] =
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 6, 8, 14, 16, 17, 18, 21, 22,
- 23, 28, 29, 30, 42, 43, 48, 54, 55, 56,
- 57, 58, 60, 61, 62, 66, 67, 69, 72, 76,
- 48, 63, 8, 68, 9, 15, 20, 24, 25, 26,
- 27, 32, 70, 71, 8, 9, 8, 8, 28, 56,
- 66, 33, 34, 8, 66, 66, 66, 0, 47, 48,
- 41, 48, 59, 66, 35, 36, 40, 42, 43, 44,
- 45, 50, 51, 66, 77, 77, 52, 9, 9, 24,
- 9, 15, 24, 32, 71, 73, 66, 19, 8, 32,
- 41, 49, 54, 59, 66, 59, 66, 31, 41, 66,
- 66, 66, 66, 66, 66, 66, 66, 66, 49, 52,
- 8, 9, 9, 9, 63, 8, 66, 66, 49, 64,
- 49, 63, 65, 66, 66, 8, 74, 65, 11, 32,
- 57, 62, 67, 47, 57, 64, 47, 52, 64, 32,
- 66, 64, 59, 12, 13, 52, 75, 8, 13, 66,
- 64, 31, 65, 18, 8, 65, 29, 64, 65, 64,
- 65, 64, 13, 64, 13, 18, 13, 29, 29
+ 0, 1, 6, 7, 8, 14, 16, 17, 18, 21,
+ 22, 23, 28, 29, 30, 42, 43, 48, 54, 55,
+ 56, 57, 58, 60, 61, 62, 66, 67, 69, 72,
+ 76, 48, 63, 8, 68, 9, 15, 20, 24, 25,
+ 26, 27, 32, 70, 71, 8, 9, 8, 8, 28,
+ 56, 66, 33, 34, 8, 66, 66, 66, 0, 47,
+ 48, 41, 48, 59, 66, 35, 36, 40, 42, 43,
+ 44, 45, 50, 51, 66, 77, 77, 52, 9, 9,
+ 24, 9, 15, 24, 32, 71, 73, 66, 19, 8,
+ 32, 41, 49, 54, 59, 66, 59, 66, 31, 41,
+ 66, 66, 66, 66, 66, 66, 66, 66, 66, 49,
+ 52, 8, 9, 9, 9, 63, 8, 66, 66, 49,
+ 64, 49, 63, 65, 66, 66, 8, 74, 65, 11,
+ 32, 57, 62, 67, 47, 57, 64, 47, 52, 64,
+ 32, 66, 64, 59, 12, 13, 52, 75, 8, 13,
+ 66, 64, 31, 65, 18, 8, 65, 29, 64, 65,
+ 64, 65, 64, 13, 64, 13, 18, 13, 29, 29
};
#define yyerrok (yyerrstatus = 0)
@@ -1754,124 +1754,131 @@ yyreduce:
case 35:
#line 223 "engines/director/lingo/lingo-gr.y"
{
- (yyval.code) = g_lingo->codeFunc((yyvsp[(1) - (4)].s), (yyvsp[(3) - (4)].narg));
- delete (yyvsp[(1) - (4)].s); ;}
+ (yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
+ g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
case 36:
#line 226 "engines/director/lingo/lingo-gr.y"
{
+ (yyval.code) = g_lingo->codeFunc((yyvsp[(1) - (4)].s), (yyvsp[(3) - (4)].narg));
+ delete (yyvsp[(1) - (4)].s); ;}
+ break;
+
+ case 37:
+#line 229 "engines/director/lingo/lingo-gr.y"
+ {
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 38:
-#line 230 "engines/director/lingo/lingo-gr.y"
+ case 39:
+#line 233 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 39:
-#line 231 "engines/director/lingo/lingo-gr.y"
+ case 40:
+#line 234 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 40:
-#line 232 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 235 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 41:
-#line 233 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 236 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 42:
-#line 234 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 237 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 43:
-#line 235 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 238 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 44:
-#line 236 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 239 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 45:
-#line 237 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 240 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 46:
-#line 238 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 241 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 47:
-#line 239 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 242 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 48:
-#line 240 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 243 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 49:
-#line 241 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 244 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 50:
-#line 244 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 247 "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 51:
-#line 245 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 248 "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 52:
-#line 246 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 249 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 54:
-#line 248 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 251 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_exit); ;}
break;
- case 56:
-#line 252 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 255 "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 57:
-#line 253 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 256 "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 58:
-#line 264 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 267 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 59:
-#line 265 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 268 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 60:
-#line 266 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 269 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 61:
-#line 267 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 270 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1879,8 +1886,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 62:
-#line 272 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 275 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1889,8 +1896,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 63:
-#line 278 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 281 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1898,48 +1905,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 64:
-#line 285 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
- break;
-
case 65:
-#line 286 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+#line 288 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 66:
-#line 287 "engines/director/lingo/lingo-gr.y"
+#line 289 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 67:
-#line 288 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+#line 290 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 68:
#line 291 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 69:
-#line 292 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+#line 294 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 70:
-#line 293 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 295 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 71:
-#line 321 "engines/director/lingo/lingo-gr.y"
- { g_lingo->_indef = true; ;}
+#line 296 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 72:
-#line 322 "engines/director/lingo/lingo-gr.y"
+#line 324 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->_indef = true; ;}
+ break;
+
+ case 73:
+#line 325 "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);
@@ -1947,33 +1954,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 73:
-#line 328 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 331 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 74:
-#line 329 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 332 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 75:
-#line 330 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 333 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 76:
-#line 331 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 334 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 77:
-#line 333 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 336 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 78:
-#line 336 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 339 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -1982,24 +1989,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 79:
-#line 344 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 347 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 80:
-#line 345 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 348 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 81:
-#line 346 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 349 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2003 "engines/director/lingo/lingo-gr.cpp"
+#line 2010 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2213,6 +2220,6 @@ yyreturn:
}
-#line 349 "engines/director/lingo/lingo-gr.y"
+#line 352 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 86d5872..1c57e3f 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -219,7 +219,10 @@ expr: INT {
$$ = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
WRITE_UINT32(&i, $1);
- g_lingo->code1(i); };
+ g_lingo->code1(i); }
+ | FLOAT {
+ $$ = g_lingo->code1(g_lingo->c_fconstpush);
+ g_lingo->codeFloat($1); }
| ID '(' arglist ')' {
$$ = g_lingo->codeFunc($1, $3);
delete $1; }
@@ -338,7 +341,7 @@ macro: ID begin arglist {
g_lingo->codeString($1->c_str());
inst numpar = 0;
WRITE_UINT32(&numpar, $3);
- g_lingo->code1(numpar); };
+ g_lingo->code1(numpar); }
;
arglist: /* nothing */ { $$ = 0; }
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index d8c3bdf..9d23b62 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -162,4 +162,48 @@ void Lingo::processEvent(LEvent event, int entityId) {
debug(2, "processEvent(%s) for %d", _eventHandlerTypes[event], entityId);
}
+int Lingo::alignTypes(Datum &d1, Datum &d2) {
+ int opType = INT;
+
+ if (d1.type == FLOAT || d2.type == FLOAT) {
+ opType = FLOAT;
+ d1.toFloat();
+ d2.toFloat();
+ }
+
+ return opType;
+}
+
+int Datum::toInt() {
+ switch (type) {
+ case INT:
+ // no-op
+ break;
+ case FLOAT:
+ u.i = (int)u.f;
+ type = FLOAT;
+ break;
+ default:
+ warning("Incorrect operation toInt() for type: %d", type);
+ }
+
+ return u.i;
+}
+
+float Datum::toFloat() {
+ switch (type) {
+ case INT:
+ u.f = (float)u.i;
+ type = FLOAT;
+ break;
+ case FLOAT:
+ // no-op
+ break;
+ default:
+ warning("Incorrect operation toFloat() for type: %d", type);
+ }
+
+ return u.f;
+}
+
} // End of namespace Director
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index d1969c2..c6c903d 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -101,6 +101,9 @@ struct Datum { /* interpreter stack type */
} u;
Datum() { u.sym = NULL; type = VOID; }
+
+ float toFloat();
+ int toInt();
};
struct Builtin {
@@ -142,14 +145,19 @@ public:
void cleanLocalVars();
void define(Common::String &s, int start, int nargs);
+ int alignTypes(Datum &d1, Datum &d2);
+
int code1(inst code) { _currentScript->push_back(code); return _currentScript->size() - 1; }
int code2(inst code_1, inst code_2) { int o = code1(code_1); code1(code_2); return o; }
int code3(inst code_1, inst code_2, inst code_3) { int o = code1(code_1); code1(code_2); code1(code_3); return o; }
int codeString(const char *s);
int calcStringAlignment(const char *s) {
+ return calcCodeAlignment(strlen(s) + 1);
+ }
+ int calcCodeAlignment(int l) {
int instLen = sizeof(inst);
- int l = strlen(s); return (l + 1 + instLen - 1) / instLen;
+ return (l + instLen - 1) / instLen;
}
int codeFunc(Common::String *name, int nargs);
@@ -157,6 +165,7 @@ public:
void codeArgStore();
int codeId(Common::String &s);
int codeId_(Common::String &s);
+ int codeFloat(float f);
static void c_xpop();
static void c_printtop();
@@ -166,6 +175,7 @@ public:
static void c_div();
static void c_negate();
static void c_constpush();
+ static void c_fconstpush();
static void c_varpush();
static void c_assign();
bool verify(Symbol *s);
Commit: 95c14371e7deedd171619e58411437d3df80f693
https://github.com/scummvm/scummvm/commit/95c14371e7deedd171619e58411437d3df80f693
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Differentiate built-in function from IDs
Changed paths:
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index bafc225..b620677 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -198,24 +198,4 @@ int Lingo::codeId_(Common::String &name) {
return ret;
}
-int Lingo::codeFunc(Common::String *name, int nargs) {
- int ret;
-
- if (!g_lingo->_builtins.contains(*name)) {
- ret = g_lingo->code1(g_lingo->c_call);
- g_lingo->codeString(name->c_str());
-
- inst numpar = 0;
- WRITE_UINT32(&numpar, nargs);
- g_lingo->code1(numpar);
- } else {
- if (nargs != g_lingo->_builtins[*name]->nargs)
- error("Built-in function %s expects %d arguments but got %d", name->c_str(), g_lingo->_builtins[*name]->nargs, nargs);
-
- ret = g_lingo->code1(g_lingo->_builtins[*name]->func);
- }
-
- return ret;
-}
-
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 4e4262b..4c4efdb 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -71,39 +71,40 @@
VAR = 260,
INT = 261,
FLOAT = 262,
- ID = 263,
- STRING = 264,
- HANDLER = 265,
- tDOWN = 266,
- tELSE = 267,
- tEND = 268,
- tEXIT = 269,
- tFRAME = 270,
- tGLOBAL = 271,
- tGO = 272,
- tIF = 273,
- tINTO = 274,
- tLOOP = 275,
- tMACRO = 276,
- tMCI = 277,
- tMCIWAIT = 278,
- tMOVIE = 279,
- tNEXT = 280,
- tOF = 281,
- tPREVIOUS = 282,
- tPUT = 283,
- tREPEAT = 284,
- tSET = 285,
- tTHEN = 286,
- tTO = 287,
- tWITH = 288,
- tWHILE = 289,
- tGE = 290,
- tLE = 291,
- tGT = 292,
- tLT = 293,
- tEQ = 294,
- tNEQ = 295
+ BLTIN = 263,
+ ID = 264,
+ STRING = 265,
+ HANDLER = 266,
+ tDOWN = 267,
+ tELSE = 268,
+ tEND = 269,
+ tEXIT = 270,
+ tFRAME = 271,
+ tGLOBAL = 272,
+ tGO = 273,
+ tIF = 274,
+ tINTO = 275,
+ tLOOP = 276,
+ tMACRO = 277,
+ tMCI = 278,
+ tMCIWAIT = 279,
+ tMOVIE = 280,
+ tNEXT = 281,
+ tOF = 282,
+ tPREVIOUS = 283,
+ tPUT = 284,
+ tREPEAT = 285,
+ tSET = 286,
+ tTHEN = 287,
+ tTO = 288,
+ tWITH = 289,
+ tWHILE = 290,
+ tGE = 291,
+ tLE = 292,
+ tGT = 293,
+ tLT = 294,
+ tEQ = 295,
+ tNEQ = 296
};
#endif
/* Tokens. */
@@ -112,39 +113,40 @@
#define VAR 260
#define INT 261
#define FLOAT 262
-#define ID 263
-#define STRING 264
-#define HANDLER 265
-#define tDOWN 266
-#define tELSE 267
-#define tEND 268
-#define tEXIT 269
-#define tFRAME 270
-#define tGLOBAL 271
-#define tGO 272
-#define tIF 273
-#define tINTO 274
-#define tLOOP 275
-#define tMACRO 276
-#define tMCI 277
-#define tMCIWAIT 278
-#define tMOVIE 279
-#define tNEXT 280
-#define tOF 281
-#define tPREVIOUS 282
-#define tPUT 283
-#define tREPEAT 284
-#define tSET 285
-#define tTHEN 286
-#define tTO 287
-#define tWITH 288
-#define tWHILE 289
-#define tGE 290
-#define tLE 291
-#define tGT 292
-#define tLT 293
-#define tEQ 294
-#define tNEQ 295
+#define BLTIN 263
+#define ID 264
+#define STRING 265
+#define HANDLER 266
+#define tDOWN 267
+#define tELSE 268
+#define tEND 269
+#define tEXIT 270
+#define tFRAME 271
+#define tGLOBAL 272
+#define tGO 273
+#define tIF 274
+#define tINTO 275
+#define tLOOP 276
+#define tMACRO 277
+#define tMCI 278
+#define tMCIWAIT 279
+#define tMOVIE 280
+#define tNEXT 281
+#define tOF 282
+#define tPREVIOUS 283
+#define tPUT 284
+#define tREPEAT 285
+#define tSET 286
+#define tTHEN 287
+#define tTO 288
+#define tWITH 289
+#define tWHILE 290
+#define tGE 291
+#define tLE 292
+#define tGT 293
+#define tLT 294
+#define tEQ 295
+#define tNEQ 296
@@ -196,7 +198,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 200 "engines/director/lingo/lingo-gr.cpp"
+#line 202 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -209,7 +211,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 213 "engines/director/lingo/lingo-gr.cpp"
+#line 215 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -422,22 +424,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 58
+#define YYFINAL 60
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 326
+#define YYLAST 340
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 53
+#define YYNTOKENS 54
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 25
/* YYNRULES -- Number of rules. */
-#define YYNRULES 82
+#define YYNRULES 83
/* YYNRULES -- Number of states. */
-#define YYNSTATES 170
+#define YYNSTATES 174
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 295
+#define YYMAXUTOK 296
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -446,12 +448,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 47, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 48, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 46, 2, 2,
- 48, 49, 44, 42, 52, 43, 2, 45, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 47, 2, 2,
+ 49, 50, 45, 43, 53, 44, 2, 46, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 51, 41, 50, 2, 2, 2, 2, 2, 2, 2,
+ 52, 42, 51, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -474,7 +476,7 @@ static const yytype_uint8 yytranslate[] =
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40
+ 35, 36, 37, 38, 39, 40, 41
};
#if YYDEBUG
@@ -485,46 +487,47 @@ static const yytype_uint16 yyprhs[] =
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
20, 22, 24, 29, 34, 39, 41, 43, 51, 62,
71, 83, 96, 103, 105, 109, 113, 116, 120, 122,
- 123, 124, 125, 128, 131, 133, 135, 140, 142, 144,
- 148, 152, 156, 160, 164, 168, 172, 176, 180, 183,
- 186, 190, 193, 196, 199, 201, 203, 206, 208, 212,
- 215, 218, 221, 224, 228, 231, 235, 238, 241, 243,
- 247, 250, 254, 255, 264, 265, 267, 271, 276, 277,
- 281, 282, 284
+ 123, 124, 125, 128, 131, 133, 135, 140, 145, 147,
+ 149, 153, 157, 161, 165, 169, 173, 177, 181, 185,
+ 188, 191, 195, 198, 201, 204, 206, 208, 211, 213,
+ 217, 220, 223, 226, 229, 233, 236, 240, 243, 246,
+ 248, 252, 255, 259, 260, 269, 270, 272, 276, 281,
+ 282, 286, 287, 289
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 54, 0, -1, 55, 47, 54, -1, 55, -1, -1,
- 72, -1, 67, -1, 76, -1, 56, -1, 58, -1,
- 57, -1, 1, -1, 28, 66, 19, 8, -1, 30,
- 8, 41, 66, -1, 30, 8, 32, 66, -1, 66,
- -1, 67, -1, 62, 59, 31, 65, 64, 13, 18,
- -1, 62, 59, 31, 65, 64, 12, 65, 64, 13,
- 18, -1, 60, 48, 59, 49, 65, 64, 13, 29,
- -1, 61, 41, 66, 64, 32, 66, 64, 65, 64,
- 13, 29, -1, 61, 41, 66, 64, 11, 32, 66,
- 64, 65, 64, 13, 29, -1, 62, 59, 31, 63,
- 57, 64, -1, 66, -1, 66, 41, 66, -1, 48,
- 59, 49, -1, 29, 34, -1, 29, 33, 8, -1,
- 18, -1, -1, -1, -1, 65, 47, -1, 65, 57,
- -1, 6, -1, 7, -1, 8, 48, 77, 49, -1,
- 8, -1, 56, -1, 66, 42, 66, -1, 66, 43,
- 66, -1, 66, 44, 66, -1, 66, 45, 66, -1,
- 66, 50, 66, -1, 66, 51, 66, -1, 66, 40,
- 66, -1, 66, 35, 66, -1, 66, 36, 66, -1,
- 42, 66, -1, 43, 66, -1, 48, 66, 49, -1,
- 22, 9, -1, 23, 8, -1, 28, 66, -1, 69,
- -1, 14, -1, 16, 68, -1, 8, -1, 68, 52,
- 8, -1, 17, 20, -1, 17, 25, -1, 17, 27,
- -1, 17, 70, -1, 17, 70, 71, -1, 17, 71,
- -1, 32, 15, 9, -1, 15, 9, -1, 32, 9,
- -1, 9, -1, 26, 24, 9, -1, 24, 9, -1,
- 32, 24, 9, -1, -1, 21, 8, 73, 63, 74,
- 47, 75, 65, -1, -1, 8, -1, 74, 52, 8,
- -1, 74, 47, 52, 8, -1, -1, 8, 63, 77,
- -1, -1, 66, -1, 77, 52, 66, -1
+ 55, 0, -1, 56, 48, 55, -1, 56, -1, -1,
+ 73, -1, 68, -1, 77, -1, 57, -1, 59, -1,
+ 58, -1, 1, -1, 29, 67, 20, 9, -1, 31,
+ 9, 42, 67, -1, 31, 9, 33, 67, -1, 67,
+ -1, 68, -1, 63, 60, 32, 66, 65, 14, 19,
+ -1, 63, 60, 32, 66, 65, 13, 66, 65, 14,
+ 19, -1, 61, 49, 60, 50, 66, 65, 14, 30,
+ -1, 62, 42, 67, 65, 33, 67, 65, 66, 65,
+ 14, 30, -1, 62, 42, 67, 65, 12, 33, 67,
+ 65, 66, 65, 14, 30, -1, 63, 60, 32, 64,
+ 58, 65, -1, 67, -1, 67, 42, 67, -1, 49,
+ 60, 50, -1, 30, 35, -1, 30, 34, 9, -1,
+ 19, -1, -1, -1, -1, 66, 48, -1, 66, 58,
+ -1, 6, -1, 7, -1, 8, 49, 78, 50, -1,
+ 9, 49, 78, 50, -1, 9, -1, 57, -1, 67,
+ 43, 67, -1, 67, 44, 67, -1, 67, 45, 67,
+ -1, 67, 46, 67, -1, 67, 51, 67, -1, 67,
+ 52, 67, -1, 67, 41, 67, -1, 67, 36, 67,
+ -1, 67, 37, 67, -1, 43, 67, -1, 44, 67,
+ -1, 49, 67, 50, -1, 23, 10, -1, 24, 9,
+ -1, 29, 67, -1, 70, -1, 15, -1, 17, 69,
+ -1, 9, -1, 69, 53, 9, -1, 18, 21, -1,
+ 18, 26, -1, 18, 28, -1, 18, 71, -1, 18,
+ 71, 72, -1, 18, 72, -1, 33, 16, 10, -1,
+ 16, 10, -1, 33, 10, -1, 10, -1, 27, 25,
+ 10, -1, 25, 10, -1, 33, 25, 10, -1, -1,
+ 22, 9, 74, 64, 75, 48, 76, 66, -1, -1,
+ 9, -1, 75, 53, 9, -1, 75, 48, 53, 9,
+ -1, -1, 9, 64, 78, -1, -1, 67, -1, 78,
+ 53, 67, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -533,12 +536,12 @@ static const yytype_uint16 yyrline[] =
0, 92, 92, 93, 96, 97, 98, 99, 100, 101,
102, 103, 106, 112, 118, 126, 127, 128, 134, 146,
157, 173, 187, 195, 196, 197, 199, 201, 207, 209,
- 211, 213, 214, 215, 218, 223, 226, 229, 232, 233,
- 234, 235, 236, 237, 238, 239, 240, 241, 242, 243,
- 244, 247, 248, 249, 250, 251, 252, 255, 256, 267,
- 268, 269, 270, 275, 281, 288, 289, 290, 291, 294,
- 295, 296, 324, 324, 331, 332, 333, 334, 336, 339,
- 347, 348, 349
+ 211, 213, 214, 215, 218, 223, 226, 232, 240, 243,
+ 244, 245, 246, 247, 248, 249, 250, 251, 252, 253,
+ 254, 255, 258, 259, 260, 261, 262, 263, 266, 267,
+ 278, 279, 280, 281, 286, 292, 299, 300, 301, 302,
+ 305, 306, 307, 335, 335, 342, 343, 344, 345, 347,
+ 350, 358, 359, 360
};
#endif
@@ -548,15 +551,16 @@ static const yytype_uint16 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "UNARY", "VOID", "VAR", "INT", "FLOAT",
- "ID", "STRING", "HANDLER", "tDOWN", "tELSE", "tEND", "tEXIT", "tFRAME",
- "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT",
- "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT", "tSET",
- "tTHEN", "tTO", "tWITH", "tWHILE", "tGE", "tLE", "tGT", "tLT", "tEQ",
- "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'",
- "'>'", "'<'", "','", "$accept", "program", "programline", "asgn", "stmt",
- "stmtoneliner", "cond", "repeatwhile", "repeatwith", "if", "begin",
- "end", "stmtlist", "expr", "func", "globallist", "gotofunc", "gotoframe",
- "gotomovie", "defn", "@1", "argdef", "argstore", "macro", "arglist", 0
+ "BLTIN", "ID", "STRING", "HANDLER", "tDOWN", "tELSE", "tEND", "tEXIT",
+ "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI",
+ "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT",
+ "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tGE", "tLE", "tGT", "tLT",
+ "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('",
+ "')'", "'>'", "'<'", "','", "$accept", "program", "programline", "asgn",
+ "stmt", "stmtoneliner", "cond", "repeatwhile", "repeatwith", "if",
+ "begin", "end", "stmtlist", "expr", "func", "globallist", "gotofunc",
+ "gotoframe", "gotomovie", "defn", "@1", "argdef", "argstore", "macro",
+ "arglist", 0
};
#endif
@@ -569,23 +573,23 @@ static const yytype_uint16 yytoknum[] =
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 61, 43, 45, 42, 47, 37, 10, 40, 41,
- 62, 60, 44
+ 295, 296, 61, 43, 45, 42, 47, 37, 10, 40,
+ 41, 62, 60, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 53, 54, 54, 55, 55, 55, 55, 55, 55,
- 55, 55, 56, 56, 56, 57, 57, 57, 57, 57,
- 57, 57, 58, 59, 59, 59, 60, 61, 62, 63,
- 64, 65, 65, 65, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 67, 67, 67, 67, 67, 67, 68, 68, 69,
- 69, 69, 69, 69, 69, 70, 70, 70, 70, 71,
- 71, 71, 73, 72, 74, 74, 74, 74, 75, 76,
- 77, 77, 77
+ 0, 54, 55, 55, 56, 56, 56, 56, 56, 56,
+ 56, 56, 57, 57, 57, 58, 58, 58, 58, 58,
+ 58, 58, 59, 60, 60, 60, 61, 62, 63, 64,
+ 65, 66, 66, 66, 67, 67, 67, 67, 67, 67,
+ 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
+ 67, 67, 68, 68, 68, 68, 68, 68, 69, 69,
+ 70, 70, 70, 70, 70, 70, 71, 71, 71, 71,
+ 72, 72, 72, 74, 73, 75, 75, 75, 75, 76,
+ 77, 78, 78, 78
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -594,12 +598,12 @@ static const yytype_uint8 yyr2[] =
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
1, 1, 4, 4, 4, 1, 1, 7, 10, 8,
11, 12, 6, 1, 3, 3, 2, 3, 1, 0,
- 0, 0, 2, 2, 1, 1, 4, 1, 1, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 2, 2,
- 3, 2, 2, 2, 1, 1, 2, 1, 3, 2,
- 2, 2, 2, 3, 2, 3, 2, 2, 1, 3,
- 2, 3, 0, 8, 0, 1, 3, 4, 0, 3,
- 0, 1, 3
+ 0, 0, 2, 2, 1, 1, 4, 4, 1, 1,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
+ 2, 3, 2, 2, 2, 1, 1, 2, 1, 3,
+ 2, 2, 2, 2, 3, 2, 3, 2, 2, 1,
+ 3, 2, 3, 0, 8, 0, 1, 3, 4, 0,
+ 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -607,165 +611,172 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 34, 35, 29, 55, 0, 0, 28, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
- 38, 10, 9, 0, 0, 0, 15, 6, 54, 5,
- 7, 80, 80, 57, 56, 68, 0, 59, 0, 60,
- 0, 61, 0, 62, 64, 72, 51, 52, 37, 0,
- 38, 53, 0, 26, 0, 48, 49, 0, 1, 0,
- 0, 0, 0, 0, 23, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 81, 0, 79, 0, 66, 70,
- 0, 67, 0, 0, 0, 63, 29, 0, 0, 27,
- 0, 0, 50, 2, 0, 30, 0, 0, 29, 0,
- 46, 47, 45, 39, 40, 41, 42, 43, 44, 36,
- 0, 58, 69, 65, 71, 74, 12, 14, 13, 31,
- 0, 25, 0, 30, 24, 82, 75, 0, 30, 0,
- 0, 30, 0, 16, 32, 33, 0, 78, 0, 0,
- 0, 30, 22, 0, 31, 0, 0, 31, 76, 0,
- 30, 31, 31, 30, 17, 77, 73, 19, 31, 30,
- 0, 30, 0, 0, 0, 0, 18, 0, 20, 21
+ 0, 11, 34, 35, 0, 29, 56, 0, 0, 28,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 3, 39, 10, 9, 0, 0, 0, 15, 6, 55,
+ 5, 7, 81, 81, 81, 58, 57, 69, 0, 60,
+ 0, 61, 0, 62, 0, 63, 65, 73, 52, 53,
+ 38, 0, 39, 54, 0, 26, 0, 49, 50, 0,
+ 1, 0, 0, 0, 0, 0, 23, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 82, 0, 0, 80,
+ 0, 67, 71, 0, 68, 0, 0, 0, 64, 29,
+ 0, 0, 27, 0, 0, 51, 2, 0, 30, 0,
+ 0, 29, 0, 47, 48, 46, 40, 41, 42, 43,
+ 44, 45, 36, 0, 37, 59, 70, 66, 72, 75,
+ 12, 14, 13, 31, 0, 25, 0, 30, 24, 83,
+ 76, 0, 30, 0, 0, 30, 0, 16, 32, 33,
+ 0, 79, 0, 0, 0, 30, 22, 0, 31, 0,
+ 0, 31, 77, 0, 30, 31, 31, 30, 17, 78,
+ 74, 19, 31, 30, 0, 30, 0, 0, 0, 0,
+ 18, 0, 20, 21
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 18, 19, 50, 135, 22, 63, 23, 24, 132,
- 32, 120, 123, 26, 133, 34, 28, 43, 44, 29,
- 86, 127, 147, 30, 75
+ -1, 19, 20, 52, 139, 23, 65, 24, 25, 136,
+ 34, 124, 127, 27, 137, 36, 29, 45, 46, 30,
+ 89, 131, 151, 31, 77
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -119
+#define YYPACT_NINF -123
static const yytype_int16 yypact[] =
{
- 83, -119, -119, -119, 258, -119, 17, 217, -119, 27,
- 5, 33, 66, 30, 39, 66, 66, 66, 38, 22,
- 15, -119, -119, 19, 36, 109, 246, -119, -119, -119,
- -119, 66, 66, -119, 29, -119, 62, -119, 73, -119,
- 61, -119, 21, 20, -119, -119, -119, -119, 40, 66,
- -119, 180, 78, -119, -10, -8, -8, 222, -119, 83,
- 109, 66, 109, 64, 234, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 246, -31, 41, 84, -119, -119,
- 93, -119, 94, 98, 86, -119, -119, 180, 111, -119,
- 66, 66, -119, -119, 72, 246, 74, 210, 4, 66,
- 246, 246, 246, 275, 275, -8, -8, 246, 246, -119,
- 66, -119, -119, -119, -119, 114, -119, 246, 246, -119,
- -9, -119, 164, 126, 246, 246, -119, -13, 126, 92,
- 66, -119, 109, -119, -119, -119, 63, 75, 127, 123,
- 66, 246, -119, 107, -119, 128, 133, -119, -119, 116,
- 246, -119, -119, 126, -119, -119, 126, -119, -119, 126,
- 134, 126, 137, 135, 145, 130, -119, 131, -119, -119
+ 86, -123, -123, -123, -24, 288, -123, 22, 247, -123,
+ 26, 27, 32, 157, -17, 35, 157, 157, 157, 48,
+ 4, 16, -123, -123, 30, 42, 201, 276, -123, -123,
+ -123, -123, 157, 157, 157, -123, 12, -123, 73, -123,
+ 75, -123, 63, -123, 14, 20, -123, -123, -123, -123,
+ 47, 157, -123, 215, 81, -123, -19, -9, -9, 252,
+ -123, 86, 201, 157, 201, 59, 264, 157, 157, 157,
+ 157, 157, 157, 157, 157, 157, 276, 19, 23, 46,
+ 102, -123, -123, 104, -123, 108, 109, 95, -123, -123,
+ 215, 113, -123, 157, 157, -123, -123, 74, 276, 76,
+ 240, -2, 157, 276, 276, 276, 61, 61, -9, -9,
+ 276, 276, -123, 157, -123, -123, -123, -123, -123, 116,
+ -123, 276, 276, -123, 3, -123, 174, 130, 276, 276,
+ -123, 18, 130, 94, 157, -123, 201, -123, -123, -123,
+ 64, 79, 124, 126, 157, 276, -123, 110, -123, 122,
+ 134, -123, -123, 114, 276, -123, -123, 130, -123, -123,
+ 130, -123, -123, 130, 132, 130, 136, 133, 137, 125,
+ -123, 127, -123, -123
};
/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int16 yypgoto[] =
+static const yytype_int8 yypgoto[] =
{
- -119, 102, -119, 6, 7, -119, -52, -119, -119, 9,
- -74, 60, -118, -12, 11, -119, -119, -119, 119, -119,
- -119, -119, -119, -119, 132
+ -123, 97, -123, 6, 2, -123, -54, -123, -123, 7,
+ -67, 84, -122, -13, 9, -123, -123, -123, 111, -123,
+ -123, -123, -123, -123, 41
};
/* 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 -38
+#define YYTABLE_NINF -39
static const yytype_int16 yytable[] =
{
- 51, 128, 129, 55, 56, 57, 20, 21, 94, 25,
- 96, 27, 115, 64, 46, -8, -31, -31, 109, 74,
- 74, 110, 90, 130, 122, 33, 153, 65, 66, 156,
- 81, 91, 67, 159, 137, 45, 82, 87, 58, 138,
- 161, 47, 72, 73, 38, 83, 40, 54, 64, 95,
- 97, -31, 84, 100, 101, 102, 103, 104, 105, 106,
- 107, 108, -8, 52, 53, 20, 21, 60, 25, 59,
- 27, 78, 2, 3, 48, 144, 145, 61, 117, 118,
- 143, 77, 79, -4, 1, 80, 89, 124, 31, 2,
- 3, 4, 111, 110, 49, 98, 14, 5, 125, 6,
- 7, 8, 112, 113, 9, 10, 11, 114, 15, 16,
- 83, 12, 13, 14, 17, 2, 3, 48, 141, 116,
- 64, 119, 126, 121, 140, 15, 16, 146, 150, 131,
- -4, 17, 2, 3, 48, 148, 149, 49, 152, 14,
- 5, 155, 6, 7, 8, 157, 154, 163, 10, 11,
- 165, 15, 16, 166, 12, 13, 14, 62, 167, 168,
- 169, 93, 85, 0, 76, 0, 0, 0, 15, 16,
- 2, 3, 48, 134, 17, 0, 0, 0, 5, 0,
- 6, 7, 8, 136, 0, 0, 10, 11, 139, 0,
- 0, 142, 12, 13, 14, 0, 0, 0, 0, 88,
- 0, 151, 0, 0, 0, 0, 15, 16, 0, 0,
- 158, 0, 17, 160, 0, 65, 66, 0, 0, 162,
- 67, 164, 68, 69, 70, 71, 35, 0, 0, 0,
- 72, 73, 36, 0, 0, 0, 0, 37, 0, 0,
- 0, 38, 39, 40, 41, 65, 66, 0, 0, 42,
- 67, 99, 68, 69, 70, 71, 0, 65, 66, 92,
- 72, 73, 67, 0, 68, 69, 70, 71, 0, 65,
- 66, 92, 72, 73, 67, 99, 68, 69, 70, 71,
- 0, 65, 66, 0, 72, 73, 67, 0, 68, 69,
- 70, 71, 0, -37, -37, 0, 72, 73, -37, 0,
- 0, 0, -37, -37, 0, 0, 31, 0, -37, -37,
- 65, 66, 0, 0, 0, 67, 0, 0, 0, 70,
- 71, 0, 0, 0, 0, 72, 73
+ 53, 132, 22, 57, 58, 59, 21, 26, 97, 28,
+ 99, -31, -31, 66, 93, 133, -8, 54, 55, 76,
+ 76, 76, 119, 94, 84, 32, 157, 67, 68, 160,
+ 85, 35, 69, 163, 126, 47, 134, 48, 90, 86,
+ 165, 49, 74, 75, 56, 40, -31, 42, 60, 66,
+ 98, 100, 61, 87, 103, 104, 105, 106, 107, 108,
+ 109, 110, 111, 22, -8, 80, 141, 21, 26, 112,
+ 28, 142, 113, 114, 78, 79, 113, 148, 149, 62,
+ 121, 122, 147, 81, 63, 82, -4, 1, 83, 128,
+ 92, 101, 2, 3, 4, 5, 33, 67, 68, 113,
+ 129, 6, 69, 7, 8, 9, 72, 73, 10, 11,
+ 12, 115, 74, 75, 116, 13, 14, 15, 117, 118,
+ 86, 145, 120, 66, 123, 130, 125, 144, 135, 16,
+ 17, 154, 150, 152, -4, 18, 2, 3, 4, 50,
+ 153, 158, 156, 159, 161, 6, 167, 7, 8, 9,
+ 169, 171, 170, 11, 12, 172, 88, 173, 96, 13,
+ 14, 15, 0, 2, 3, 4, 50, 0, 0, 0,
+ 0, 0, 0, 16, 17, 0, 0, 0, 138, 18,
+ 2, 3, 4, 50, 0, 0, 51, 0, 15, 6,
+ 0, 7, 8, 9, 0, 0, 0, 11, 12, 0,
+ 16, 17, 0, 13, 14, 15, 18, 2, 3, 4,
+ 50, 140, 0, 0, 0, 0, 143, 16, 17, 146,
+ 0, 0, 0, 18, 0, 0, 0, 0, 0, 155,
+ 51, 0, 15, 0, 0, 91, 0, 0, 162, 0,
+ 0, 164, 0, 0, 16, 17, 0, 166, 0, 168,
+ 64, 67, 68, 0, 0, 0, 69, 37, 70, 71,
+ 72, 73, 0, 38, 0, 0, 74, 75, 39, 0,
+ 0, 0, 40, 41, 42, 43, 67, 68, 0, 0,
+ 44, 69, 102, 70, 71, 72, 73, 0, 67, 68,
+ 95, 74, 75, 69, 0, 70, 71, 72, 73, 0,
+ 67, 68, 95, 74, 75, 69, 102, 70, 71, 72,
+ 73, 0, 67, 68, 0, 74, 75, 69, 0, 70,
+ 71, 72, 73, 0, -38, -38, 0, 74, 75, -38,
+ 0, 0, 0, -38, -38, 0, 0, 33, 0, -38,
+ -38
};
static const yytype_int16 yycheck[] =
{
- 12, 119, 11, 15, 16, 17, 0, 0, 60, 0,
- 62, 0, 86, 25, 9, 0, 12, 13, 49, 31,
- 32, 52, 32, 32, 98, 8, 144, 35, 36, 147,
- 9, 41, 40, 151, 47, 8, 15, 49, 0, 52,
- 158, 8, 50, 51, 24, 24, 26, 8, 60, 61,
- 62, 47, 32, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 47, 33, 34, 59, 59, 48, 59, 47,
- 59, 9, 6, 7, 8, 12, 13, 41, 90, 91,
- 132, 52, 9, 0, 1, 24, 8, 99, 48, 6,
- 7, 8, 8, 52, 28, 31, 30, 14, 110, 16,
- 17, 18, 9, 9, 21, 22, 23, 9, 42, 43,
- 24, 28, 29, 30, 48, 6, 7, 8, 130, 8,
- 132, 49, 8, 49, 32, 42, 43, 52, 140, 122,
- 47, 48, 6, 7, 8, 8, 13, 28, 31, 30,
- 14, 8, 16, 17, 18, 29, 18, 13, 22, 23,
- 13, 42, 43, 18, 28, 29, 30, 48, 13, 29,
- 29, 59, 43, -1, 32, -1, -1, -1, 42, 43,
- 6, 7, 8, 47, 48, -1, -1, -1, 14, -1,
- 16, 17, 18, 123, -1, -1, 22, 23, 128, -1,
- -1, 131, 28, 29, 30, -1, -1, -1, -1, 19,
- -1, 141, -1, -1, -1, -1, 42, 43, -1, -1,
- 150, -1, 48, 153, -1, 35, 36, -1, -1, 159,
- 40, 161, 42, 43, 44, 45, 9, -1, -1, -1,
- 50, 51, 15, -1, -1, -1, -1, 20, -1, -1,
- -1, 24, 25, 26, 27, 35, 36, -1, -1, 32,
- 40, 41, 42, 43, 44, 45, -1, 35, 36, 49,
- 50, 51, 40, -1, 42, 43, 44, 45, -1, 35,
- 36, 49, 50, 51, 40, 41, 42, 43, 44, 45,
- -1, 35, 36, -1, 50, 51, 40, -1, 42, 43,
- 44, 45, -1, 35, 36, -1, 50, 51, 40, -1,
- -1, -1, 44, 45, -1, -1, 48, -1, 50, 51,
- 35, 36, -1, -1, -1, 40, -1, -1, -1, 44,
- 45, -1, -1, -1, -1, 50, 51
+ 13, 123, 0, 16, 17, 18, 0, 0, 62, 0,
+ 64, 13, 14, 26, 33, 12, 0, 34, 35, 32,
+ 33, 34, 89, 42, 10, 49, 148, 36, 37, 151,
+ 16, 9, 41, 155, 101, 9, 33, 10, 51, 25,
+ 162, 9, 51, 52, 9, 25, 48, 27, 0, 62,
+ 63, 64, 48, 33, 67, 68, 69, 70, 71, 72,
+ 73, 74, 75, 61, 48, 53, 48, 61, 61, 50,
+ 61, 53, 53, 50, 33, 34, 53, 13, 14, 49,
+ 93, 94, 136, 10, 42, 10, 0, 1, 25, 102,
+ 9, 32, 6, 7, 8, 9, 49, 36, 37, 53,
+ 113, 15, 41, 17, 18, 19, 45, 46, 22, 23,
+ 24, 9, 51, 52, 10, 29, 30, 31, 10, 10,
+ 25, 134, 9, 136, 50, 9, 50, 33, 126, 43,
+ 44, 144, 53, 9, 48, 49, 6, 7, 8, 9,
+ 14, 19, 32, 9, 30, 15, 14, 17, 18, 19,
+ 14, 14, 19, 23, 24, 30, 45, 30, 61, 29,
+ 30, 31, -1, 6, 7, 8, 9, -1, -1, -1,
+ -1, -1, -1, 43, 44, -1, -1, -1, 48, 49,
+ 6, 7, 8, 9, -1, -1, 29, -1, 31, 15,
+ -1, 17, 18, 19, -1, -1, -1, 23, 24, -1,
+ 43, 44, -1, 29, 30, 31, 49, 6, 7, 8,
+ 9, 127, -1, -1, -1, -1, 132, 43, 44, 135,
+ -1, -1, -1, 49, -1, -1, -1, -1, -1, 145,
+ 29, -1, 31, -1, -1, 20, -1, -1, 154, -1,
+ -1, 157, -1, -1, 43, 44, -1, 163, -1, 165,
+ 49, 36, 37, -1, -1, -1, 41, 10, 43, 44,
+ 45, 46, -1, 16, -1, -1, 51, 52, 21, -1,
+ -1, -1, 25, 26, 27, 28, 36, 37, -1, -1,
+ 33, 41, 42, 43, 44, 45, 46, -1, 36, 37,
+ 50, 51, 52, 41, -1, 43, 44, 45, 46, -1,
+ 36, 37, 50, 51, 52, 41, 42, 43, 44, 45,
+ 46, -1, 36, 37, -1, 51, 52, 41, -1, 43,
+ 44, 45, 46, -1, 36, 37, -1, 51, 52, 41,
+ -1, -1, -1, 45, 46, -1, -1, 49, -1, 51,
+ 52
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 6, 7, 8, 14, 16, 17, 18, 21,
- 22, 23, 28, 29, 30, 42, 43, 48, 54, 55,
- 56, 57, 58, 60, 61, 62, 66, 67, 69, 72,
- 76, 48, 63, 8, 68, 9, 15, 20, 24, 25,
- 26, 27, 32, 70, 71, 8, 9, 8, 8, 28,
- 56, 66, 33, 34, 8, 66, 66, 66, 0, 47,
- 48, 41, 48, 59, 66, 35, 36, 40, 42, 43,
- 44, 45, 50, 51, 66, 77, 77, 52, 9, 9,
- 24, 9, 15, 24, 32, 71, 73, 66, 19, 8,
- 32, 41, 49, 54, 59, 66, 59, 66, 31, 41,
- 66, 66, 66, 66, 66, 66, 66, 66, 66, 49,
- 52, 8, 9, 9, 9, 63, 8, 66, 66, 49,
- 64, 49, 63, 65, 66, 66, 8, 74, 65, 11,
- 32, 57, 62, 67, 47, 57, 64, 47, 52, 64,
- 32, 66, 64, 59, 12, 13, 52, 75, 8, 13,
- 66, 64, 31, 65, 18, 8, 65, 29, 64, 65,
- 64, 65, 64, 13, 64, 13, 18, 13, 29, 29
+ 0, 1, 6, 7, 8, 9, 15, 17, 18, 19,
+ 22, 23, 24, 29, 30, 31, 43, 44, 49, 55,
+ 56, 57, 58, 59, 61, 62, 63, 67, 68, 70,
+ 73, 77, 49, 49, 64, 9, 69, 10, 16, 21,
+ 25, 26, 27, 28, 33, 71, 72, 9, 10, 9,
+ 9, 29, 57, 67, 34, 35, 9, 67, 67, 67,
+ 0, 48, 49, 42, 49, 60, 67, 36, 37, 41,
+ 43, 44, 45, 46, 51, 52, 67, 78, 78, 78,
+ 53, 10, 10, 25, 10, 16, 25, 33, 72, 74,
+ 67, 20, 9, 33, 42, 50, 55, 60, 67, 60,
+ 67, 32, 42, 67, 67, 67, 67, 67, 67, 67,
+ 67, 67, 50, 53, 50, 9, 10, 10, 10, 64,
+ 9, 67, 67, 50, 65, 50, 64, 66, 67, 67,
+ 9, 75, 66, 12, 33, 58, 63, 68, 48, 58,
+ 65, 48, 53, 65, 33, 67, 65, 60, 13, 14,
+ 53, 76, 9, 14, 67, 65, 32, 66, 19, 9,
+ 66, 30, 65, 66, 65, 66, 65, 14, 65, 14,
+ 19, 14, 30, 30
};
#define yyerrok (yyerrstatus = 0)
@@ -1761,124 +1772,139 @@ yyreduce:
case 36:
#line 226 "engines/director/lingo/lingo-gr.y"
{
- (yyval.code) = g_lingo->codeFunc((yyvsp[(1) - (4)].s), (yyvsp[(3) - (4)].narg));
- delete (yyvsp[(1) - (4)].s); ;}
+ 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 37:
-#line 229 "engines/director/lingo/lingo-gr.y"
+#line 232 "engines/director/lingo/lingo-gr.y"
+ {
+ (yyval.code) = g_lingo->code1(g_lingo->c_call);
+ g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
+
+ inst numpar = 0;
+ WRITE_UINT32(&numpar, (yyvsp[(3) - (4)].narg));
+ g_lingo->code1(numpar);
+ delete (yyvsp[(1) - (4)].s); ;}
+ break;
+
+ case 38:
+#line 240 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 39:
-#line 233 "engines/director/lingo/lingo-gr.y"
+ case 40:
+#line 244 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 40:
-#line 234 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 245 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 41:
-#line 235 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 246 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 42:
-#line 236 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 247 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 43:
-#line 237 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 248 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 44:
-#line 238 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 249 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 45:
-#line 239 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 250 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 46:
-#line 240 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 251 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 47:
-#line 241 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 252 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 48:
-#line 242 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 253 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 49:
-#line 243 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 254 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 50:
-#line 244 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 255 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 51:
-#line 247 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 258 "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 52:
-#line 248 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 259 "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 53:
-#line 249 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 260 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 55:
-#line 251 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 262 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_exit); ;}
break;
- case 57:
-#line 255 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 266 "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 58:
-#line 256 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 267 "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 59:
-#line 267 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 278 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 60:
-#line 268 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 279 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 61:
-#line 269 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 280 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 62:
-#line 270 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 281 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1886,8 +1912,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 63:
-#line 275 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 286 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1896,8 +1922,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 64:
-#line 281 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 292 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1905,48 +1931,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 65:
-#line 288 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 299 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 66:
-#line 289 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 300 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 67:
-#line 290 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 301 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 68:
-#line 291 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 302 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 69:
-#line 294 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 305 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 70:
-#line 295 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 306 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 71:
-#line 296 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 307 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 72:
-#line 324 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 335 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 73:
-#line 325 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 336 "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);
@@ -1954,33 +1980,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 74:
-#line 331 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 342 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 75:
-#line 332 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 343 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 76:
-#line 333 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 344 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 77:
-#line 334 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 345 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 78:
-#line 336 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 347 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 79:
-#line 339 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 350 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -1989,24 +2015,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 80:
-#line 347 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 358 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 81:
-#line 348 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 359 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 82:
-#line 349 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 360 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2010 "engines/director/lingo/lingo-gr.cpp"
+#line 2036 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2220,6 +2246,6 @@ yyreturn:
}
-#line 352 "engines/director/lingo/lingo-gr.y"
+#line 363 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index efc1e80..e21948c 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -44,39 +44,40 @@
VAR = 260,
INT = 261,
FLOAT = 262,
- ID = 263,
- STRING = 264,
- HANDLER = 265,
- tDOWN = 266,
- tELSE = 267,
- tEND = 268,
- tEXIT = 269,
- tFRAME = 270,
- tGLOBAL = 271,
- tGO = 272,
- tIF = 273,
- tINTO = 274,
- tLOOP = 275,
- tMACRO = 276,
- tMCI = 277,
- tMCIWAIT = 278,
- tMOVIE = 279,
- tNEXT = 280,
- tOF = 281,
- tPREVIOUS = 282,
- tPUT = 283,
- tREPEAT = 284,
- tSET = 285,
- tTHEN = 286,
- tTO = 287,
- tWITH = 288,
- tWHILE = 289,
- tGE = 290,
- tLE = 291,
- tGT = 292,
- tLT = 293,
- tEQ = 294,
- tNEQ = 295
+ BLTIN = 263,
+ ID = 264,
+ STRING = 265,
+ HANDLER = 266,
+ tDOWN = 267,
+ tELSE = 268,
+ tEND = 269,
+ tEXIT = 270,
+ tFRAME = 271,
+ tGLOBAL = 272,
+ tGO = 273,
+ tIF = 274,
+ tINTO = 275,
+ tLOOP = 276,
+ tMACRO = 277,
+ tMCI = 278,
+ tMCIWAIT = 279,
+ tMOVIE = 280,
+ tNEXT = 281,
+ tOF = 282,
+ tPREVIOUS = 283,
+ tPUT = 284,
+ tREPEAT = 285,
+ tSET = 286,
+ tTHEN = 287,
+ tTO = 288,
+ tWITH = 289,
+ tWHILE = 290,
+ tGE = 291,
+ tLE = 292,
+ tGT = 293,
+ tLT = 294,
+ tEQ = 295,
+ tNEQ = 296
};
#endif
/* Tokens. */
@@ -85,39 +86,40 @@
#define VAR 260
#define INT 261
#define FLOAT 262
-#define ID 263
-#define STRING 264
-#define HANDLER 265
-#define tDOWN 266
-#define tELSE 267
-#define tEND 268
-#define tEXIT 269
-#define tFRAME 270
-#define tGLOBAL 271
-#define tGO 272
-#define tIF 273
-#define tINTO 274
-#define tLOOP 275
-#define tMACRO 276
-#define tMCI 277
-#define tMCIWAIT 278
-#define tMOVIE 279
-#define tNEXT 280
-#define tOF 281
-#define tPREVIOUS 282
-#define tPUT 283
-#define tREPEAT 284
-#define tSET 285
-#define tTHEN 286
-#define tTO 287
-#define tWITH 288
-#define tWHILE 289
-#define tGE 290
-#define tLE 291
-#define tGT 292
-#define tLT 293
-#define tEQ 294
-#define tNEQ 295
+#define BLTIN 263
+#define ID 264
+#define STRING 265
+#define HANDLER 266
+#define tDOWN 267
+#define tELSE 268
+#define tEND 269
+#define tEXIT 270
+#define tFRAME 271
+#define tGLOBAL 272
+#define tGO 273
+#define tIF 274
+#define tINTO 275
+#define tLOOP 276
+#define tMACRO 277
+#define tMCI 278
+#define tMCIWAIT 279
+#define tMOVIE 280
+#define tNEXT 281
+#define tOF 282
+#define tPREVIOUS 283
+#define tPUT 284
+#define tREPEAT 285
+#define tSET 286
+#define tTHEN 287
+#define tTO 288
+#define tWITH 289
+#define tWHILE 290
+#define tGE 291
+#define tLE 292
+#define tGT 293
+#define tLT 294
+#define tEQ 295
+#define tNEQ 296
@@ -133,7 +135,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 137 "engines/director/lingo/lingo-gr.hpp"
+#line 139 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 1c57e3f..df083b5 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -73,7 +73,7 @@ using namespace Director;
%token UNARY VOID VAR
%token<i> INT
%token<f> FLOAT
-%token<s> ID STRING HANDLER
+%token<s> BLTIN ID STRING HANDLER
%token tDOWN tELSE tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO tMCI tMCIWAIT
%token tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO tWITH tWHILE
%token tGE tLE tGT tLT tEQ tNEQ
@@ -223,9 +223,20 @@ expr: INT {
| FLOAT {
$$ = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat($1); }
+ | 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; }
| ID '(' arglist ')' {
- $$ = g_lingo->codeFunc($1, $3);
- delete $1; }
+ $$ = g_lingo->code1(g_lingo->c_call);
+ g_lingo->codeString($1->c_str());
+
+ inst numpar = 0;
+ WRITE_UINT32(&numpar, $3);
+ g_lingo->code1(numpar);
+ delete $1; }
| ID {
$$ = g_lingo->codeId(*$1);
delete $1; }
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 48f7152..bd84f79 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -1020,45 +1020,52 @@ YY_RULE_SETUP
case 31:
YY_RULE_SETUP
#line 80 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(yytext); return ID; }
+{
+ yylval.s = new Common::String(yytext);
+
+ if (Director::g_lingo->_builtins.contains(yytext))
+ return BLTIN;
+
+ return ID;
+ }
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 81 "engines/director/lingo/lingo-lex.l"
+#line 88 "engines/director/lingo/lingo-lex.l"
{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 82 "engines/director/lingo/lingo-lex.l"
+#line 89 "engines/director/lingo/lingo-lex.l"
{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 83 "engines/director/lingo/lingo-lex.l"
+#line 90 "engines/director/lingo/lingo-lex.l"
{ return *yytext; }
YY_BREAK
case 35:
/* rule 35 can match eol */
YY_RULE_SETUP
-#line 84 "engines/director/lingo/lingo-lex.l"
+#line 91 "engines/director/lingo/lingo-lex.l"
{ return '\n'; }
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 85 "engines/director/lingo/lingo-lex.l"
+#line 92 "engines/director/lingo/lingo-lex.l"
{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 86 "engines/director/lingo/lingo-lex.l"
+#line 93 "engines/director/lingo/lingo-lex.l"
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 88 "engines/director/lingo/lingo-lex.l"
+#line 95 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1062 "engines/director/lingo/lingo-lex.cpp"
+#line 1069 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -2058,7 +2065,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 88 "engines/director/lingo/lingo-lex.l"
+#line 95 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 2e42471..6144bba 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -77,7 +77,14 @@ whitespace [\t ]
[>][=] { return tGE; }
[<][=] { return tLE; }
-{identifier} { yylval.s = new Common::String(yytext); return ID; }
+{identifier} {
+ yylval.s = new Common::String(yytext);
+
+ if (Director::g_lingo->_builtins.contains(yytext))
+ return BLTIN;
+
+ return ID;
+ }
{constfloat} { yylval.f = atof(yytext); return FLOAT; }
{constinteger} { yylval.i = strtol(yytext, NULL, 10); return INT; }
{operator} { return *yytext; }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index c6c903d..bd53ff2 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -160,7 +160,6 @@ public:
return (l + instLen - 1) / instLen;
}
- int codeFunc(Common::String *name, int nargs);
void codeArg(Common::String *s);
void codeArgStore();
int codeId(Common::String &s);
Commit: 4b9b1f3c2dfdba8e6705195832c69b2952d47f9c
https://github.com/scummvm/scummvm/commit/4b9b1f3c2dfdba8e6705195832c69b2952d47f9c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix crash on deinitialization
Changed paths:
engines/director/director.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 71cd3b6..db218e4 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -53,17 +53,17 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
// Setup mixer
syncSoundSettings();
- _sharedCasts = new Common::HashMap<int, Cast *>();
- _sharedDIB = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>();
- _sharedBMP = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>();
- _sharedSTXT = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>();
- _sharedSound = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>();
+ _sharedCasts = new Common::HashMap<int, Cast *>;
+ _sharedDIB = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>;
+ _sharedBMP = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>;
+ _sharedSTXT = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>;
+ _sharedSound = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>;
_mainArchive = 0;
_macBinary = 0;
//FIXME
_sharedMMM = "SHARDCST.MMM";
- _movies = new Common::HashMap<Common::String, Score *>();
+ _movies = new Common::HashMap<Common::String, Score *>;
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "data");
@@ -71,12 +71,12 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
}
DirectorEngine::~DirectorEngine() {
- delete[] _sharedCasts;
- delete[] _sharedSound;
- delete[] _sharedBMP;
- delete[] _sharedSTXT;
- delete[] _sharedDIB;
- delete[] _movies;
+ delete _sharedCasts;
+ delete _sharedSound;
+ delete _sharedBMP;
+ delete _sharedSTXT;
+ delete _sharedDIB;
+ delete _movies;
delete _mainArchive;
delete _macBinary;
Commit: 36d7addda93a23f1a31ba4c308c77d6d6fa98e8f
https://github.com/scummvm/scummvm/commit/36d7addda93a23f1a31ba4c308c77d6d6fa98e8f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix another crash on exit
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index ea0616a..cfce7a4 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -54,6 +54,7 @@ Score::Score(DirectorEngine *vm) {
_soundManager = _vm->getSoundManager();
_lingo->processEvent(kEventPrepareMovie, 0);
_movieScriptCount = 0;
+ _labels = NULL;
if (_movieArchive->hasResource(MKTAG('M','C','N','M'), 0)) {
_macName = _movieArchive->getName(MKTAG('M','C','N','M'), 0).c_str();
@@ -122,13 +123,17 @@ void Score::loadArchive() {
}
Score::~Score() {
- _surface->free();
- _trailSurface->free();
+ if (_surface)
+ _surface->free();
+
+ if (_trailSurface)
+ _trailSurface->free();
delete _surface;
delete _trailSurface;
- _movieArchive->close();
+ if (_movieArchive)
+ _movieArchive->close();
delete _surface;
delete _trailSurface;
@@ -136,12 +141,7 @@ Score::~Score() {
delete _font;
delete _movieArchive;
- delete[] _labels;
- delete[] &_frames;
- delete[] &_casts;
- delete[] &_castsInfo;
- delete[] &_actions;
- delete[] &_fontMap;
+ delete _labels;
}
void Score::loadPalette(Common::SeekableSubReadStreamEndian &stream) {
Commit: 196044aeae5c93e34e141c9758e5477e545a5f89
https://github.com/scummvm/scummvm/commit/196044aeae5c93e34e141c9758e5477e545a5f89
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implement 'exit' command
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 163dd1a..36f284e 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -403,10 +403,6 @@ void Lingo::c_ifcode() {
//************************
// Built-in functions
//************************
-void Lingo::c_exit() {
- warning("STUB: c_exit()");
-}
-
void Lingo::c_mci() {
Common::String s((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 4c4efdb..b00d22c 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -538,10 +538,10 @@ static const yytype_uint16 yyrline[] =
157, 173, 187, 195, 196, 197, 199, 201, 207, 209,
211, 213, 214, 215, 218, 223, 226, 232, 240, 243,
244, 245, 246, 247, 248, 249, 250, 251, 252, 253,
- 254, 255, 258, 259, 260, 261, 262, 263, 266, 267,
- 278, 279, 280, 281, 286, 292, 299, 300, 301, 302,
- 305, 306, 307, 335, 335, 342, 343, 344, 345, 347,
- 350, 358, 359, 360
+ 254, 255, 258, 259, 260, 261, 262, 264, 267, 268,
+ 279, 280, 281, 282, 287, 293, 300, 301, 302, 303,
+ 306, 307, 308, 336, 336, 343, 344, 345, 346, 348,
+ 351, 359, 360, 361
};
#endif
@@ -1875,36 +1875,37 @@ yyreduce:
case 56:
#line 262 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_exit); ;}
+ { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
+ g_lingo->code1(g_lingo->c_procret); ;}
break;
case 58:
-#line 266 "engines/director/lingo/lingo-gr.y"
+#line 267 "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 59:
-#line 267 "engines/director/lingo/lingo-gr.y"
+#line 268 "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 60:
-#line 278 "engines/director/lingo/lingo-gr.y"
+#line 279 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 61:
-#line 279 "engines/director/lingo/lingo-gr.y"
+#line 280 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 62:
-#line 280 "engines/director/lingo/lingo-gr.y"
+#line 281 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 63:
-#line 281 "engines/director/lingo/lingo-gr.y"
+#line 282 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1913,7 +1914,7 @@ yyreduce:
break;
case 64:
-#line 286 "engines/director/lingo/lingo-gr.y"
+#line 287 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1923,7 +1924,7 @@ yyreduce:
break;
case 65:
-#line 292 "engines/director/lingo/lingo-gr.y"
+#line 293 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1932,47 +1933,47 @@ yyreduce:
break;
case 66:
-#line 299 "engines/director/lingo/lingo-gr.y"
+#line 300 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 67:
-#line 300 "engines/director/lingo/lingo-gr.y"
+#line 301 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 68:
-#line 301 "engines/director/lingo/lingo-gr.y"
+#line 302 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 69:
-#line 302 "engines/director/lingo/lingo-gr.y"
+#line 303 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 70:
-#line 305 "engines/director/lingo/lingo-gr.y"
+#line 306 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 71:
-#line 306 "engines/director/lingo/lingo-gr.y"
+#line 307 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 72:
-#line 307 "engines/director/lingo/lingo-gr.y"
+#line 308 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 73:
-#line 335 "engines/director/lingo/lingo-gr.y"
+#line 336 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 74:
-#line 336 "engines/director/lingo/lingo-gr.y"
+#line 337 "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);
@@ -1981,32 +1982,32 @@ yyreduce:
break;
case 75:
-#line 342 "engines/director/lingo/lingo-gr.y"
+#line 343 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 76:
-#line 343 "engines/director/lingo/lingo-gr.y"
+#line 344 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 77:
-#line 344 "engines/director/lingo/lingo-gr.y"
+#line 345 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 78:
-#line 345 "engines/director/lingo/lingo-gr.y"
+#line 346 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 79:
-#line 347 "engines/director/lingo/lingo-gr.y"
+#line 348 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
case 80:
-#line 350 "engines/director/lingo/lingo-gr.y"
+#line 351 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2016,23 +2017,23 @@ yyreduce:
break;
case 81:
-#line 358 "engines/director/lingo/lingo-gr.y"
+#line 359 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 82:
-#line 359 "engines/director/lingo/lingo-gr.y"
+#line 360 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
case 83:
-#line 360 "engines/director/lingo/lingo-gr.y"
+#line 361 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2036 "engines/director/lingo/lingo-gr.cpp"
+#line 2037 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2246,6 +2247,6 @@ yyreturn:
}
-#line 363 "engines/director/lingo/lingo-gr.y"
+#line 364 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index df083b5..df0f494 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -259,7 +259,8 @@ func: tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_
| tMCIWAIT ID { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
| tPUT expr { g_lingo->code1(g_lingo->c_printtop); }
| gotofunc
- | tEXIT { g_lingo->code1(g_lingo->c_exit); }
+ | tEXIT { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
+ g_lingo->code1(g_lingo->c_procret); }
| tGLOBAL globallist
;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index bd53ff2..11f84b2 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -191,7 +191,6 @@ public:
static void c_call();
static void c_procret();
- static void c_exit();
static void c_mci();
static void c_mciwait();
static void c_goto();
Commit: e08f8bbe43079fef358985d1e6be637844e36e86
https://github.com/scummvm/scummvm/commit/e08f8bbe43079fef358985d1e6be637844e36e86
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix toInt()
Changed paths:
engines/director/lingo/lingo.cpp
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 9d23b62..b1befd9 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -181,7 +181,7 @@ int Datum::toInt() {
break;
case FLOAT:
u.i = (int)u.f;
- type = FLOAT;
+ type = INT;
break;
default:
warning("Incorrect operation toInt() for type: %d", type);
Commit: 7327f0b86e53a2140ad8fd8d563871a8d54cb4ed
https://github.com/scummvm/scummvm/commit/7327f0b86e53a2140ad8fd8d563871a8d54cb4ed
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implement more built-in math functions
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-builtins.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index db218e4..fa16502 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -155,6 +155,8 @@ set z2 = z / z1\n\
put z\n\
put z1\n\
put z2\n\
+put integer(z2)\n\
+put cos(z2)\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 311e774..4bca9fd 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -29,6 +29,12 @@ static struct BuiltinProto {
void (*func)(void);
int nparams;
} builtins[] = {
+ { "abs", Lingo::b_abs, 1},
+ { "atan", Lingo::b_atan, 1},
+ { "cos", Lingo::b_cos, 1},
+ { "exp", Lingo::b_exp, 1},
+ { "integer",Lingo::b_integer, 1},
+ { "log", Lingo::b_log, 1},
{ "random", Lingo::b_random, 1},
{ 0, 0, 0 }
};
@@ -39,12 +45,57 @@ void Lingo::initBuiltIns() {
}
}
+void Lingo::b_abs() {
+ Datum d = g_lingo->pop();
+
+ if (d.type == INT)
+ d.u.i = ABS(d.u.i);
+ else if (d.type == FLOAT)
+ d.u.f = ABS(d.u.f);
+
+ g_lingo->push(d);
+}
+
+void Lingo::b_atan() {
+ Datum d = g_lingo->pop();
+ d.toFloat();
+ d.u.f = atanf(d.u.f);
+ g_lingo->push(d);
+}
+
+void Lingo::b_cos() {
+ Datum d = g_lingo->pop();
+ d.toFloat();
+ d.u.f = cos(d.u.f);
+ g_lingo->push(d);
+}
+
+void Lingo::b_exp() {
+ Datum d = g_lingo->pop();
+ d.toInt(); // Lingo uses int, so we're enforcing it
+ d.toFloat();
+ d.u.f = expf(d.u.f);
+ g_lingo->push(d);
+}
+
+void Lingo::b_integer() {
+ Datum d = g_lingo->pop();
+ d.toInt();
+ g_lingo->push(d);
+}
+
+void Lingo::b_log() {
+ Datum d = g_lingo->pop();
+ d.toFloat();
+ d.u.f = logf(d.u.f);
+ g_lingo->push(d);
+}
+
void Lingo::b_random() {
Datum max = g_lingo->pop();
Datum res;
- if (max.type != INT)
- warning("Non-int type for rand: %d", max.type);
+ max.toInt();
res.u.i = g_lingo->_vm->_rnd.getRandomNumber(max.u.i);
res.type = INT;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 11f84b2..8028425 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -199,6 +199,12 @@ public:
static void c_gotoprevious();
static void c_global();
+ static void b_abs();
+ static void b_atan();
+ static void b_cos();
+ static void b_exp();
+ static void b_integer();
+ static void b_log();
static void b_random();
void func_mci(Common::String &s);
Commit: 48b9ae7d698c5f7a80d3687a67598b7935d4ad87
https://github.com/scummvm/scummvm/commit/48b9ae7d698c5f7a80d3687a67598b7935d4ad87
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implemented rest of math functions
Changed paths:
engines/director/lingo/lingo-builtins.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 4bca9fd..0fe742a 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -33,9 +33,15 @@ static struct BuiltinProto {
{ "atan", Lingo::b_atan, 1},
{ "cos", Lingo::b_cos, 1},
{ "exp", Lingo::b_exp, 1},
+ { "float", Lingo::b_float, 1},
{ "integer",Lingo::b_integer, 1},
{ "log", Lingo::b_log, 1},
+ { "pi", Lingo::b_pi, 0},
+ { "power", Lingo::b_power, 2},
{ "random", Lingo::b_random, 1},
+ { "sin", Lingo::b_sin, 1},
+ { "sqrt", Lingo::b_sqrt, 1},
+ { "tan", Lingo::b_tan, 1},
{ 0, 0, 0 }
};
@@ -78,6 +84,12 @@ void Lingo::b_exp() {
g_lingo->push(d);
}
+void Lingo::b_float() {
+ Datum d = g_lingo->pop();
+ d.toFloat();
+ g_lingo->push(d);
+}
+
void Lingo::b_integer() {
Datum d = g_lingo->pop();
d.toInt();
@@ -91,6 +103,22 @@ void Lingo::b_log() {
g_lingo->push(d);
}
+void Lingo::b_pi() {
+ Datum d;
+ d.toFloat();
+ d.u.f = 3.14159265358;
+ g_lingo->push(d);
+}
+
+void Lingo::b_power() {
+ Datum d1 = g_lingo->pop();
+ Datum d2 = g_lingo->pop();
+ d1.toFloat();
+ d2.toFloat();
+ d1.u.f = powf(d2.u.f, d1.u.f);
+ g_lingo->push(d1);
+}
+
void Lingo::b_random() {
Datum max = g_lingo->pop();
Datum res;
@@ -103,4 +131,25 @@ void Lingo::b_random() {
g_lingo->push(res);
}
+void Lingo::b_sin() {
+ Datum d = g_lingo->pop();
+ d.toFloat();
+ d.u.f = sin(d.u.f);
+ g_lingo->push(d);
+}
+
+void Lingo::b_sqrt() {
+ Datum d = g_lingo->pop();
+ d.toFloat();
+ d.u.f = sqrt(d.u.f);
+ g_lingo->push(d);
+}
+
+void Lingo::b_tan() {
+ Datum d = g_lingo->pop();
+ d.toFloat();
+ d.u.f = tan(d.u.f);
+ g_lingo->push(d);
+}
+
}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 8028425..0f66706 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -203,9 +203,15 @@ public:
static void b_atan();
static void b_cos();
static void b_exp();
+ static void b_float();
static void b_integer();
static void b_log();
+ static void b_pi();
+ static void b_power();
static void b_random();
+ static void b_sin();
+ static void b_sqrt();
+ static void b_tan();
void func_mci(Common::String &s);
void func_mciwait(Common::String &s);
Commit: 3cf8510c418ae6fd9683691c8da01aba062c3367
https://github.com/scummvm/scummvm/commit/3cf8510c418ae6fd9683691c8da01aba062c3367
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Process D3-style cast references
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 36f284e..918dea1 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -121,7 +121,16 @@ void Lingo::c_varpush() {
Datum d;
d.u.sym = g_lingo->lookupVar(name);
- d.type = VAR;
+ if (d.u.sym->type == CASTREF) {
+ d.type = INT;
+ int val = d.u.sym->u.val;
+
+ delete d.u.sym;
+
+ d.u.i = val;
+ } else {
+ d.type = VAR;
+ }
g_lingo->_pc += g_lingo->calcStringAlignment(name);
@@ -166,6 +175,11 @@ void Lingo::c_eval() {
Datum d;
d = g_lingo->pop();
+ if (d.type != VAR) { // It could be cast ref
+ g_lingo->push(d);
+ return;
+ }
+
if (!g_lingo->verify(d.u.sym))
return;
@@ -354,6 +368,10 @@ void Lingo::c_repeatwithcode(void) {
Common::String countername((char *)&(*g_lingo->_currentScript)[savepc + 5]);
Symbol *counter = g_lingo->lookupVar(countername.c_str());
+ if (counter->type == CASTREF) {
+ error("Cast ref used as index: %s", countername.c_str());
+ }
+
g_lingo->execute(init); /* condition */
d = g_lingo->pop();
d.toInt();
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index b620677..ad78031 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -67,6 +67,27 @@ void Lingo::execute(int pc) {
Symbol *Lingo::lookupVar(const char *name, bool create, bool putInGlobalList) {
Symbol *sym;
+ // Looking for the cast member constants
+ if (_vm->getVersion() < 4) { // TODO: There could be a flag 'Allow Outdated Lingo' in Movie Info in D4
+ if (strlen(name) == 3) {
+ if (name[0] >= 'A' && name[0] <= 'H' &&
+ name[1] >= '1' && name[1] <= '8' &&
+ name[2] >= '1' && name[2] <= '8') {
+
+ if (!create)
+ error("Cast reference used in wrong context: %s", name);
+
+ int val = (name[0] - 'A') * 64 + (name[1] - '1') * 8 + (name[2] - '1') + 1;
+ sym = new Symbol;
+
+ sym->type = CASTREF;
+ sym->u.val = val;
+
+ return sym;
+ }
+ }
+ }
+
if (!_localvars->contains(name)) { // Create variable if it was not defined
if (!create)
return NULL;
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index b00d22c..f079879 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -66,87 +66,89 @@
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
- UNARY = 258,
- VOID = 259,
- VAR = 260,
- INT = 261,
- FLOAT = 262,
- BLTIN = 263,
- ID = 264,
- STRING = 265,
- HANDLER = 266,
- tDOWN = 267,
- tELSE = 268,
- tEND = 269,
- tEXIT = 270,
- tFRAME = 271,
- tGLOBAL = 272,
- tGO = 273,
- tIF = 274,
- tINTO = 275,
- tLOOP = 276,
- tMACRO = 277,
- tMCI = 278,
- tMCIWAIT = 279,
- tMOVIE = 280,
- tNEXT = 281,
- tOF = 282,
- tPREVIOUS = 283,
- tPUT = 284,
- tREPEAT = 285,
- tSET = 286,
- tTHEN = 287,
- tTO = 288,
- tWITH = 289,
- tWHILE = 290,
- tGE = 291,
- tLE = 292,
- tGT = 293,
- tLT = 294,
- tEQ = 295,
- tNEQ = 296
+ CASTREF = 258,
+ UNARY = 259,
+ VOID = 260,
+ VAR = 261,
+ INT = 262,
+ FLOAT = 263,
+ BLTIN = 264,
+ ID = 265,
+ STRING = 266,
+ HANDLER = 267,
+ tDOWN = 268,
+ tELSE = 269,
+ tEND = 270,
+ tEXIT = 271,
+ tFRAME = 272,
+ tGLOBAL = 273,
+ tGO = 274,
+ tIF = 275,
+ tINTO = 276,
+ tLOOP = 277,
+ tMACRO = 278,
+ tMCI = 279,
+ tMCIWAIT = 280,
+ tMOVIE = 281,
+ tNEXT = 282,
+ tOF = 283,
+ tPREVIOUS = 284,
+ tPUT = 285,
+ tREPEAT = 286,
+ tSET = 287,
+ tTHEN = 288,
+ tTO = 289,
+ tWITH = 290,
+ tWHILE = 291,
+ tGE = 292,
+ tLE = 293,
+ tGT = 294,
+ tLT = 295,
+ tEQ = 296,
+ tNEQ = 297
};
#endif
/* Tokens. */
-#define UNARY 258
-#define VOID 259
-#define VAR 260
-#define INT 261
-#define FLOAT 262
-#define BLTIN 263
-#define ID 264
-#define STRING 265
-#define HANDLER 266
-#define tDOWN 267
-#define tELSE 268
-#define tEND 269
-#define tEXIT 270
-#define tFRAME 271
-#define tGLOBAL 272
-#define tGO 273
-#define tIF 274
-#define tINTO 275
-#define tLOOP 276
-#define tMACRO 277
-#define tMCI 278
-#define tMCIWAIT 279
-#define tMOVIE 280
-#define tNEXT 281
-#define tOF 282
-#define tPREVIOUS 283
-#define tPUT 284
-#define tREPEAT 285
-#define tSET 286
-#define tTHEN 287
-#define tTO 288
-#define tWITH 289
-#define tWHILE 290
-#define tGE 291
-#define tLE 292
-#define tGT 293
-#define tLT 294
-#define tEQ 295
-#define tNEQ 296
+#define CASTREF 258
+#define UNARY 259
+#define VOID 260
+#define VAR 261
+#define INT 262
+#define FLOAT 263
+#define BLTIN 264
+#define ID 265
+#define STRING 266
+#define HANDLER 267
+#define tDOWN 268
+#define tELSE 269
+#define tEND 270
+#define tEXIT 271
+#define tFRAME 272
+#define tGLOBAL 273
+#define tGO 274
+#define tIF 275
+#define tINTO 276
+#define tLOOP 277
+#define tMACRO 278
+#define tMCI 279
+#define tMCIWAIT 280
+#define tMOVIE 281
+#define tNEXT 282
+#define tOF 283
+#define tPREVIOUS 284
+#define tPUT 285
+#define tREPEAT 286
+#define tSET 287
+#define tTHEN 288
+#define tTO 289
+#define tWITH 290
+#define tWHILE 291
+#define tGE 292
+#define tLE 293
+#define tGT 294
+#define tLT 295
+#define tEQ 296
+#define tNEQ 297
@@ -198,7 +200,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 202 "engines/director/lingo/lingo-gr.cpp"
+#line 204 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -211,7 +213,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 215 "engines/director/lingo/lingo-gr.cpp"
+#line 217 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -429,7 +431,7 @@ union yyalloc
#define YYLAST 340
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 54
+#define YYNTOKENS 55
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 25
/* YYNRULES -- Number of rules. */
@@ -439,7 +441,7 @@ union yyalloc
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 296
+#define YYMAXUTOK 297
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -448,12 +450,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 48, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 49, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 47, 2, 2,
- 49, 50, 45, 43, 53, 44, 2, 46, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 48, 2, 2,
+ 50, 51, 46, 44, 54, 45, 2, 47, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 52, 42, 51, 2, 2, 2, 2, 2, 2, 2,
+ 53, 43, 52, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -476,7 +478,7 @@ static const yytype_uint8 yytranslate[] =
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41
+ 35, 36, 37, 38, 39, 40, 41, 42
};
#if YYDEBUG
@@ -498,36 +500,36 @@ static const yytype_uint16 yyprhs[] =
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 55, 0, -1, 56, 48, 55, -1, 56, -1, -1,
- 73, -1, 68, -1, 77, -1, 57, -1, 59, -1,
- 58, -1, 1, -1, 29, 67, 20, 9, -1, 31,
- 9, 42, 67, -1, 31, 9, 33, 67, -1, 67,
- -1, 68, -1, 63, 60, 32, 66, 65, 14, 19,
- -1, 63, 60, 32, 66, 65, 13, 66, 65, 14,
- 19, -1, 61, 49, 60, 50, 66, 65, 14, 30,
- -1, 62, 42, 67, 65, 33, 67, 65, 66, 65,
- 14, 30, -1, 62, 42, 67, 65, 12, 33, 67,
- 65, 66, 65, 14, 30, -1, 63, 60, 32, 64,
- 58, 65, -1, 67, -1, 67, 42, 67, -1, 49,
- 60, 50, -1, 30, 35, -1, 30, 34, 9, -1,
- 19, -1, -1, -1, -1, 66, 48, -1, 66, 58,
- -1, 6, -1, 7, -1, 8, 49, 78, 50, -1,
- 9, 49, 78, 50, -1, 9, -1, 57, -1, 67,
- 43, 67, -1, 67, 44, 67, -1, 67, 45, 67,
- -1, 67, 46, 67, -1, 67, 51, 67, -1, 67,
- 52, 67, -1, 67, 41, 67, -1, 67, 36, 67,
- -1, 67, 37, 67, -1, 43, 67, -1, 44, 67,
- -1, 49, 67, 50, -1, 23, 10, -1, 24, 9,
- -1, 29, 67, -1, 70, -1, 15, -1, 17, 69,
- -1, 9, -1, 69, 53, 9, -1, 18, 21, -1,
- 18, 26, -1, 18, 28, -1, 18, 71, -1, 18,
- 71, 72, -1, 18, 72, -1, 33, 16, 10, -1,
- 16, 10, -1, 33, 10, -1, 10, -1, 27, 25,
- 10, -1, 25, 10, -1, 33, 25, 10, -1, -1,
- 22, 9, 74, 64, 75, 48, 76, 66, -1, -1,
- 9, -1, 75, 53, 9, -1, 75, 48, 53, 9,
- -1, -1, 9, 64, 78, -1, -1, 67, -1, 78,
- 53, 67, -1
+ 56, 0, -1, 57, 49, 56, -1, 57, -1, -1,
+ 74, -1, 69, -1, 78, -1, 58, -1, 60, -1,
+ 59, -1, 1, -1, 30, 68, 21, 10, -1, 32,
+ 10, 43, 68, -1, 32, 10, 34, 68, -1, 68,
+ -1, 69, -1, 64, 61, 33, 67, 66, 15, 20,
+ -1, 64, 61, 33, 67, 66, 14, 67, 66, 15,
+ 20, -1, 62, 50, 61, 51, 67, 66, 15, 31,
+ -1, 63, 43, 68, 66, 34, 68, 66, 67, 66,
+ 15, 31, -1, 63, 43, 68, 66, 13, 34, 68,
+ 66, 67, 66, 15, 31, -1, 64, 61, 33, 65,
+ 59, 66, -1, 68, -1, 68, 43, 68, -1, 50,
+ 61, 51, -1, 31, 36, -1, 31, 35, 10, -1,
+ 20, -1, -1, -1, -1, 67, 49, -1, 67, 59,
+ -1, 7, -1, 8, -1, 9, 50, 79, 51, -1,
+ 10, 50, 79, 51, -1, 10, -1, 58, -1, 68,
+ 44, 68, -1, 68, 45, 68, -1, 68, 46, 68,
+ -1, 68, 47, 68, -1, 68, 52, 68, -1, 68,
+ 53, 68, -1, 68, 42, 68, -1, 68, 37, 68,
+ -1, 68, 38, 68, -1, 44, 68, -1, 45, 68,
+ -1, 50, 68, 51, -1, 24, 11, -1, 25, 10,
+ -1, 30, 68, -1, 71, -1, 16, -1, 18, 70,
+ -1, 10, -1, 70, 54, 10, -1, 19, 22, -1,
+ 19, 27, -1, 19, 29, -1, 19, 72, -1, 19,
+ 72, 73, -1, 19, 73, -1, 34, 17, 11, -1,
+ 17, 11, -1, 34, 11, -1, 11, -1, 28, 26,
+ 11, -1, 26, 11, -1, 34, 26, 11, -1, -1,
+ 23, 10, 75, 65, 76, 49, 77, 67, -1, -1,
+ 10, -1, 76, 54, 10, -1, 76, 49, 54, 10,
+ -1, -1, 10, 65, 79, -1, -1, 68, -1, 79,
+ 54, 68, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -550,17 +552,17 @@ static const yytype_uint16 yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "UNARY", "VOID", "VAR", "INT", "FLOAT",
- "BLTIN", "ID", "STRING", "HANDLER", "tDOWN", "tELSE", "tEND", "tEXIT",
- "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI",
- "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT",
- "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tGE", "tLE", "tGT", "tLT",
- "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('",
- "')'", "'>'", "'<'", "','", "$accept", "program", "programline", "asgn",
- "stmt", "stmtoneliner", "cond", "repeatwhile", "repeatwith", "if",
- "begin", "end", "stmtlist", "expr", "func", "globallist", "gotofunc",
- "gotoframe", "gotomovie", "defn", "@1", "argdef", "argstore", "macro",
- "arglist", 0
+ "$end", "error", "$undefined", "CASTREF", "UNARY", "VOID", "VAR", "INT",
+ "FLOAT", "BLTIN", "ID", "STRING", "HANDLER", "tDOWN", "tELSE", "tEND",
+ "tEXIT", "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO",
+ "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT",
+ "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tGE", "tLE",
+ "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'",
+ "'\\n'", "'('", "')'", "'>'", "'<'", "','", "$accept", "program",
+ "programline", "asgn", "stmt", "stmtoneliner", "cond", "repeatwhile",
+ "repeatwith", "if", "begin", "end", "stmtlist", "expr", "func",
+ "globallist", "gotofunc", "gotoframe", "gotomovie", "defn", "@1",
+ "argdef", "argstore", "macro", "arglist", 0
};
#endif
@@ -573,23 +575,23 @@ static const yytype_uint16 yytoknum[] =
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 61, 43, 45, 42, 47, 37, 10, 40,
- 41, 62, 60, 44
+ 295, 296, 297, 61, 43, 45, 42, 47, 37, 10,
+ 40, 41, 62, 60, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 54, 55, 55, 56, 56, 56, 56, 56, 56,
- 56, 56, 57, 57, 57, 58, 58, 58, 58, 58,
- 58, 58, 59, 60, 60, 60, 61, 62, 63, 64,
- 65, 66, 66, 66, 67, 67, 67, 67, 67, 67,
- 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
- 67, 67, 68, 68, 68, 68, 68, 68, 69, 69,
- 70, 70, 70, 70, 70, 70, 71, 71, 71, 71,
- 72, 72, 72, 74, 73, 75, 75, 75, 75, 76,
- 77, 78, 78, 78
+ 0, 55, 56, 56, 57, 57, 57, 57, 57, 57,
+ 57, 57, 58, 58, 58, 59, 59, 59, 59, 59,
+ 59, 59, 60, 61, 61, 61, 62, 63, 64, 65,
+ 66, 67, 67, 67, 68, 68, 68, 68, 68, 68,
+ 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
+ 68, 68, 69, 69, 69, 69, 69, 69, 70, 70,
+ 71, 71, 71, 71, 71, 71, 72, 72, 72, 72,
+ 73, 73, 73, 75, 74, 76, 76, 76, 76, 77,
+ 78, 79, 79, 79
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -644,32 +646,32 @@ static const yytype_int16 yydefgoto[] =
#define YYPACT_NINF -123
static const yytype_int16 yypact[] =
{
- 86, -123, -123, -123, -24, 288, -123, 22, 247, -123,
- 26, 27, 32, 157, -17, 35, 157, 157, 157, 48,
- 4, 16, -123, -123, 30, 42, 201, 276, -123, -123,
- -123, -123, 157, 157, 157, -123, 12, -123, 73, -123,
- 75, -123, 63, -123, 14, 20, -123, -123, -123, -123,
- 47, 157, -123, 215, 81, -123, -19, -9, -9, 252,
- -123, 86, 201, 157, 201, 59, 264, 157, 157, 157,
- 157, 157, 157, 157, 157, 157, 276, 19, 23, 46,
- 102, -123, -123, 104, -123, 108, 109, 95, -123, -123,
- 215, 113, -123, 157, 157, -123, -123, 74, 276, 76,
- 240, -2, 157, 276, 276, 276, 61, 61, -9, -9,
- 276, 276, -123, 157, -123, -123, -123, -123, -123, 116,
- -123, 276, 276, -123, 3, -123, 174, 130, 276, 276,
- -123, 18, 130, 94, 157, -123, 201, -123, -123, -123,
- 64, 79, 124, 126, 157, 276, -123, 110, -123, 122,
- 134, -123, -123, 114, 276, -123, -123, 130, -123, -123,
- 130, -123, -123, 130, 132, 130, 136, 133, 137, 125,
- -123, 127, -123, -123
+ 85, -123, -123, -123, -33, 287, -123, 42, 246, -123,
+ 59, 65, 69, 156, -12, 73, 156, 156, 156, 90,
+ 47, 15, -123, -123, 34, 48, 200, 275, -123, -123,
+ -123, -123, 156, 156, 156, -123, 43, -123, 87, -123,
+ 88, -123, 76, -123, 5, 13, -123, -123, -123, -123,
+ 56, 156, -123, 214, 97, -123, -9, 35, 35, 251,
+ -123, 85, 200, 156, 200, 78, 263, 156, 156, 156,
+ 156, 156, 156, 156, 156, 156, 275, 20, 24, 58,
+ 103, -123, -123, 107, -123, 108, 109, 96, -123, -123,
+ 214, 104, -123, 156, 156, -123, -123, 74, 275, 75,
+ 239, -3, 156, 275, 275, 275, -10, -10, 35, 35,
+ 275, 275, -123, 156, -123, -123, -123, -123, -123, 114,
+ -123, 275, 275, -123, 1, -123, 173, 129, 275, 275,
+ -123, -1, 129, 93, 156, -123, 200, -123, -123, -123,
+ 30, 79, 122, 125, 156, 275, -123, 110, -123, 121,
+ 132, -123, -123, 113, 275, -123, -123, 129, -123, -123,
+ 129, -123, -123, 129, 131, 129, 135, 136, 137, 120,
+ -123, 124, -123, -123
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -123, 97, -123, 6, 2, -123, -54, -123, -123, 7,
- -67, 84, -122, -13, 9, -123, -123, -123, 111, -123,
- -123, -123, -123, -123, 41
+ -123, 101, -123, 6, 2, -123, -54, -123, -123, 7,
+ -71, 84, -122, -13, 9, -123, -123, -123, 112, -123,
+ -123, -123, -123, -123, 32
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -680,22 +682,22 @@ static const yytype_int8 yypgoto[] =
static const yytype_int16 yytable[] =
{
53, 132, 22, 57, 58, 59, 21, 26, 97, 28,
- 99, -31, -31, 66, 93, 133, -8, 54, 55, 76,
- 76, 76, 119, 94, 84, 32, 157, 67, 68, 160,
- 85, 35, 69, 163, 126, 47, 134, 48, 90, 86,
- 165, 49, 74, 75, 56, 40, -31, 42, 60, 66,
- 98, 100, 61, 87, 103, 104, 105, 106, 107, 108,
- 109, 110, 111, 22, -8, 80, 141, 21, 26, 112,
- 28, 142, 113, 114, 78, 79, 113, 148, 149, 62,
- 121, 122, 147, 81, 63, 82, -4, 1, 83, 128,
- 92, 101, 2, 3, 4, 5, 33, 67, 68, 113,
- 129, 6, 69, 7, 8, 9, 72, 73, 10, 11,
- 12, 115, 74, 75, 116, 13, 14, 15, 117, 118,
- 86, 145, 120, 66, 123, 130, 125, 144, 135, 16,
- 17, 154, 150, 152, -4, 18, 2, 3, 4, 50,
- 153, 158, 156, 159, 161, 6, 167, 7, 8, 9,
- 169, 171, 170, 11, 12, 172, 88, 173, 96, 13,
- 14, 15, 0, 2, 3, 4, 50, 0, 0, 0,
+ 99, -31, -31, 66, 133, -8, 84, 32, 119, 76,
+ 76, 76, 85, 54, 55, 93, 157, 67, 68, 160,
+ 126, 86, 69, 163, 94, 134, 72, 73, 90, 40,
+ 165, 42, 74, 75, 148, 149, -31, 87, 141, 66,
+ 98, 100, 35, 142, 103, 104, 105, 106, 107, 108,
+ 109, 110, 111, 22, -8, 78, 79, 21, 26, 47,
+ 28, 112, 67, 68, 113, 114, 48, 69, 113, 49,
+ 121, 122, 147, 56, 62, -4, 1, 74, 75, 128,
+ 60, 63, 2, 3, 4, 5, 61, 80, 81, 82,
+ 129, 6, 83, 7, 8, 9, 33, 92, 10, 11,
+ 12, 101, 113, 115, 120, 13, 14, 15, 116, 117,
+ 118, 145, 86, 66, 130, 123, 125, 144, 135, 16,
+ 17, 154, 152, 150, -4, 18, 2, 3, 4, 50,
+ 153, 158, 159, 156, 161, 6, 167, 7, 8, 9,
+ 169, 172, 171, 11, 12, 173, 170, 88, 0, 13,
+ 14, 15, 96, 2, 3, 4, 50, 0, 0, 0,
0, 0, 0, 16, 17, 0, 0, 0, 138, 18,
2, 3, 4, 50, 0, 0, 51, 0, 15, 6,
0, 7, 8, 9, 0, 0, 0, 11, 12, 0,
@@ -719,64 +721,64 @@ static const yytype_int16 yytable[] =
static const yytype_int16 yycheck[] =
{
13, 123, 0, 16, 17, 18, 0, 0, 62, 0,
- 64, 13, 14, 26, 33, 12, 0, 34, 35, 32,
- 33, 34, 89, 42, 10, 49, 148, 36, 37, 151,
- 16, 9, 41, 155, 101, 9, 33, 10, 51, 25,
- 162, 9, 51, 52, 9, 25, 48, 27, 0, 62,
- 63, 64, 48, 33, 67, 68, 69, 70, 71, 72,
- 73, 74, 75, 61, 48, 53, 48, 61, 61, 50,
- 61, 53, 53, 50, 33, 34, 53, 13, 14, 49,
- 93, 94, 136, 10, 42, 10, 0, 1, 25, 102,
- 9, 32, 6, 7, 8, 9, 49, 36, 37, 53,
- 113, 15, 41, 17, 18, 19, 45, 46, 22, 23,
- 24, 9, 51, 52, 10, 29, 30, 31, 10, 10,
- 25, 134, 9, 136, 50, 9, 50, 33, 126, 43,
- 44, 144, 53, 9, 48, 49, 6, 7, 8, 9,
- 14, 19, 32, 9, 30, 15, 14, 17, 18, 19,
- 14, 14, 19, 23, 24, 30, 45, 30, 61, 29,
- 30, 31, -1, 6, 7, 8, 9, -1, -1, -1,
- -1, -1, -1, 43, 44, -1, -1, -1, 48, 49,
- 6, 7, 8, 9, -1, -1, 29, -1, 31, 15,
- -1, 17, 18, 19, -1, -1, -1, 23, 24, -1,
- 43, 44, -1, 29, 30, 31, 49, 6, 7, 8,
- 9, 127, -1, -1, -1, -1, 132, 43, 44, 135,
- -1, -1, -1, 49, -1, -1, -1, -1, -1, 145,
- 29, -1, 31, -1, -1, 20, -1, -1, 154, -1,
- -1, 157, -1, -1, 43, 44, -1, 163, -1, 165,
- 49, 36, 37, -1, -1, -1, 41, 10, 43, 44,
- 45, 46, -1, 16, -1, -1, 51, 52, 21, -1,
- -1, -1, 25, 26, 27, 28, 36, 37, -1, -1,
- 33, 41, 42, 43, 44, 45, 46, -1, 36, 37,
- 50, 51, 52, 41, -1, 43, 44, 45, 46, -1,
- 36, 37, 50, 51, 52, 41, 42, 43, 44, 45,
- 46, -1, 36, 37, -1, 51, 52, 41, -1, 43,
- 44, 45, 46, -1, 36, 37, -1, 51, 52, 41,
- -1, -1, -1, 45, 46, -1, -1, 49, -1, 51,
- 52
+ 64, 14, 15, 26, 13, 0, 11, 50, 89, 32,
+ 33, 34, 17, 35, 36, 34, 148, 37, 38, 151,
+ 101, 26, 42, 155, 43, 34, 46, 47, 51, 26,
+ 162, 28, 52, 53, 14, 15, 49, 34, 49, 62,
+ 63, 64, 10, 54, 67, 68, 69, 70, 71, 72,
+ 73, 74, 75, 61, 49, 33, 34, 61, 61, 10,
+ 61, 51, 37, 38, 54, 51, 11, 42, 54, 10,
+ 93, 94, 136, 10, 50, 0, 1, 52, 53, 102,
+ 0, 43, 7, 8, 9, 10, 49, 54, 11, 11,
+ 113, 16, 26, 18, 19, 20, 50, 10, 23, 24,
+ 25, 33, 54, 10, 10, 30, 31, 32, 11, 11,
+ 11, 134, 26, 136, 10, 51, 51, 34, 126, 44,
+ 45, 144, 10, 54, 49, 50, 7, 8, 9, 10,
+ 15, 20, 10, 33, 31, 16, 15, 18, 19, 20,
+ 15, 31, 15, 24, 25, 31, 20, 45, -1, 30,
+ 31, 32, 61, 7, 8, 9, 10, -1, -1, -1,
+ -1, -1, -1, 44, 45, -1, -1, -1, 49, 50,
+ 7, 8, 9, 10, -1, -1, 30, -1, 32, 16,
+ -1, 18, 19, 20, -1, -1, -1, 24, 25, -1,
+ 44, 45, -1, 30, 31, 32, 50, 7, 8, 9,
+ 10, 127, -1, -1, -1, -1, 132, 44, 45, 135,
+ -1, -1, -1, 50, -1, -1, -1, -1, -1, 145,
+ 30, -1, 32, -1, -1, 21, -1, -1, 154, -1,
+ -1, 157, -1, -1, 44, 45, -1, 163, -1, 165,
+ 50, 37, 38, -1, -1, -1, 42, 11, 44, 45,
+ 46, 47, -1, 17, -1, -1, 52, 53, 22, -1,
+ -1, -1, 26, 27, 28, 29, 37, 38, -1, -1,
+ 34, 42, 43, 44, 45, 46, 47, -1, 37, 38,
+ 51, 52, 53, 42, -1, 44, 45, 46, 47, -1,
+ 37, 38, 51, 52, 53, 42, 43, 44, 45, 46,
+ 47, -1, 37, 38, -1, 52, 53, 42, -1, 44,
+ 45, 46, 47, -1, 37, 38, -1, 52, 53, 42,
+ -1, -1, -1, 46, 47, -1, -1, 50, -1, 52,
+ 53
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 6, 7, 8, 9, 15, 17, 18, 19,
- 22, 23, 24, 29, 30, 31, 43, 44, 49, 55,
- 56, 57, 58, 59, 61, 62, 63, 67, 68, 70,
- 73, 77, 49, 49, 64, 9, 69, 10, 16, 21,
- 25, 26, 27, 28, 33, 71, 72, 9, 10, 9,
- 9, 29, 57, 67, 34, 35, 9, 67, 67, 67,
- 0, 48, 49, 42, 49, 60, 67, 36, 37, 41,
- 43, 44, 45, 46, 51, 52, 67, 78, 78, 78,
- 53, 10, 10, 25, 10, 16, 25, 33, 72, 74,
- 67, 20, 9, 33, 42, 50, 55, 60, 67, 60,
- 67, 32, 42, 67, 67, 67, 67, 67, 67, 67,
- 67, 67, 50, 53, 50, 9, 10, 10, 10, 64,
- 9, 67, 67, 50, 65, 50, 64, 66, 67, 67,
- 9, 75, 66, 12, 33, 58, 63, 68, 48, 58,
- 65, 48, 53, 65, 33, 67, 65, 60, 13, 14,
- 53, 76, 9, 14, 67, 65, 32, 66, 19, 9,
- 66, 30, 65, 66, 65, 66, 65, 14, 65, 14,
- 19, 14, 30, 30
+ 0, 1, 7, 8, 9, 10, 16, 18, 19, 20,
+ 23, 24, 25, 30, 31, 32, 44, 45, 50, 56,
+ 57, 58, 59, 60, 62, 63, 64, 68, 69, 71,
+ 74, 78, 50, 50, 65, 10, 70, 11, 17, 22,
+ 26, 27, 28, 29, 34, 72, 73, 10, 11, 10,
+ 10, 30, 58, 68, 35, 36, 10, 68, 68, 68,
+ 0, 49, 50, 43, 50, 61, 68, 37, 38, 42,
+ 44, 45, 46, 47, 52, 53, 68, 79, 79, 79,
+ 54, 11, 11, 26, 11, 17, 26, 34, 73, 75,
+ 68, 21, 10, 34, 43, 51, 56, 61, 68, 61,
+ 68, 33, 43, 68, 68, 68, 68, 68, 68, 68,
+ 68, 68, 51, 54, 51, 10, 11, 11, 11, 65,
+ 10, 68, 68, 51, 66, 51, 65, 67, 68, 68,
+ 10, 76, 67, 13, 34, 59, 64, 69, 49, 59,
+ 66, 49, 54, 66, 34, 68, 66, 61, 14, 15,
+ 54, 77, 10, 15, 68, 66, 33, 67, 20, 10,
+ 67, 31, 66, 67, 66, 67, 66, 15, 66, 15,
+ 20, 15, 31, 31
};
#define yyerrok (yyerrstatus = 0)
@@ -2033,7 +2035,7 @@ yyreduce:
/* Line 1267 of yacc.c. */
-#line 2037 "engines/director/lingo/lingo-gr.cpp"
+#line 2039 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index e21948c..2aff182 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -39,87 +39,89 @@
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
- UNARY = 258,
- VOID = 259,
- VAR = 260,
- INT = 261,
- FLOAT = 262,
- BLTIN = 263,
- ID = 264,
- STRING = 265,
- HANDLER = 266,
- tDOWN = 267,
- tELSE = 268,
- tEND = 269,
- tEXIT = 270,
- tFRAME = 271,
- tGLOBAL = 272,
- tGO = 273,
- tIF = 274,
- tINTO = 275,
- tLOOP = 276,
- tMACRO = 277,
- tMCI = 278,
- tMCIWAIT = 279,
- tMOVIE = 280,
- tNEXT = 281,
- tOF = 282,
- tPREVIOUS = 283,
- tPUT = 284,
- tREPEAT = 285,
- tSET = 286,
- tTHEN = 287,
- tTO = 288,
- tWITH = 289,
- tWHILE = 290,
- tGE = 291,
- tLE = 292,
- tGT = 293,
- tLT = 294,
- tEQ = 295,
- tNEQ = 296
+ CASTREF = 258,
+ UNARY = 259,
+ VOID = 260,
+ VAR = 261,
+ INT = 262,
+ FLOAT = 263,
+ BLTIN = 264,
+ ID = 265,
+ STRING = 266,
+ HANDLER = 267,
+ tDOWN = 268,
+ tELSE = 269,
+ tEND = 270,
+ tEXIT = 271,
+ tFRAME = 272,
+ tGLOBAL = 273,
+ tGO = 274,
+ tIF = 275,
+ tINTO = 276,
+ tLOOP = 277,
+ tMACRO = 278,
+ tMCI = 279,
+ tMCIWAIT = 280,
+ tMOVIE = 281,
+ tNEXT = 282,
+ tOF = 283,
+ tPREVIOUS = 284,
+ tPUT = 285,
+ tREPEAT = 286,
+ tSET = 287,
+ tTHEN = 288,
+ tTO = 289,
+ tWITH = 290,
+ tWHILE = 291,
+ tGE = 292,
+ tLE = 293,
+ tGT = 294,
+ tLT = 295,
+ tEQ = 296,
+ tNEQ = 297
};
#endif
/* Tokens. */
-#define UNARY 258
-#define VOID 259
-#define VAR 260
-#define INT 261
-#define FLOAT 262
-#define BLTIN 263
-#define ID 264
-#define STRING 265
-#define HANDLER 266
-#define tDOWN 267
-#define tELSE 268
-#define tEND 269
-#define tEXIT 270
-#define tFRAME 271
-#define tGLOBAL 272
-#define tGO 273
-#define tIF 274
-#define tINTO 275
-#define tLOOP 276
-#define tMACRO 277
-#define tMCI 278
-#define tMCIWAIT 279
-#define tMOVIE 280
-#define tNEXT 281
-#define tOF 282
-#define tPREVIOUS 283
-#define tPUT 284
-#define tREPEAT 285
-#define tSET 286
-#define tTHEN 287
-#define tTO 288
-#define tWITH 289
-#define tWHILE 290
-#define tGE 291
-#define tLE 292
-#define tGT 293
-#define tLT 294
-#define tEQ 295
-#define tNEQ 296
+#define CASTREF 258
+#define UNARY 259
+#define VOID 260
+#define VAR 261
+#define INT 262
+#define FLOAT 263
+#define BLTIN 264
+#define ID 265
+#define STRING 266
+#define HANDLER 267
+#define tDOWN 268
+#define tELSE 269
+#define tEND 270
+#define tEXIT 271
+#define tFRAME 272
+#define tGLOBAL 273
+#define tGO 274
+#define tIF 275
+#define tINTO 276
+#define tLOOP 277
+#define tMACRO 278
+#define tMCI 279
+#define tMCIWAIT 280
+#define tMOVIE 281
+#define tNEXT 282
+#define tOF 283
+#define tPREVIOUS 284
+#define tPUT 285
+#define tREPEAT 286
+#define tSET 287
+#define tTHEN 288
+#define tTO 289
+#define tWITH 290
+#define tWHILE 291
+#define tGE 292
+#define tLE 293
+#define tGT 294
+#define tLT 295
+#define tEQ 296
+#define tNEQ 297
@@ -135,7 +137,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 139 "engines/director/lingo/lingo-gr.hpp"
+#line 141 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index df0f494..191bccf 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -70,7 +70,7 @@ using namespace Director;
int narg; /* number of arguments */
}
-%token UNARY VOID VAR
+%token CASTREF UNARY VOID VAR
%token<i> INT
%token<f> FLOAT
%token<s> BLTIN ID STRING HANDLER
Commit: 260c44beed4c67f3576503e6a22daad955ec2af5
https://github.com/scummvm/scummvm/commit/260c44beed4c67f3576503e6a22daad955ec2af5
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Handle text gutter/border box
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index cfce7a4..655cf91 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1340,6 +1340,45 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID) {
}
font->drawString(&surface, text, x, y, width, 0);
+
+ if (textCast->borderSize != kSizeNone) {
+ uint16 size = textCast->borderSize;
+
+ //Indent from borders, measured in d4
+ x -= 1;
+ y -= 4;
+
+ height += 4;
+ width += 1;
+
+ while (size) {
+ surface.frameRect(Common::Rect(x, y, x + height, y + width), 0);
+ x--;
+ y--;
+ height += 2;
+ width += 2;
+ size--;
+ }
+ }
+
+ if (textCast->gutterSize != kSizeNone) {
+ x -= 1;
+ y -= 4;
+
+ height += 4;
+ width += 1;
+ uint16 size = textCast->gutterSize;
+
+ surface.frameRect(Common::Rect(x, y, x + height, y + width), 0);
+
+ while (size) {
+ surface.drawLine(x + width, y, x + width, y + height, 0);
+ surface.drawLine(x, y + height, x + width, y + height, 0);
+ x++;
+ y++;
+ size--;
+ }
+ }
}
void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) {
Commit: b62089ed9554fd04c42fc3cc1fe69e58cc58828e
https://github.com/scummvm/scummvm/commit/b62089ed9554fd04c42fc3cc1fe69e58cc58828e
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix image resource checking
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 655cf91..22f5381 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1272,7 +1272,7 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
uint16 imgId = spriteId + 1024;
Image::ImageDecoder *img = NULL;
- if (!_vm->_currentScore->getArchive()->hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
+ if (_vm->_currentScore->getArchive()->hasResource(MKTAG('D', 'I', 'B', ' '), imgId)) {
img = new DIBDecoder();
img->loadStream(*_vm->_currentScore->getArchive()->getResource(MKTAG('D', 'I', 'B', ' '), imgId));
return img;
@@ -1284,7 +1284,7 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
return img;
}
- if (!_vm->_currentScore->getArchive()->hasResource(MKTAG('B', 'I', 'T', 'D'), imgId)) {
+ if (_vm->_currentScore->getArchive()->hasResource(MKTAG('B', 'I', 'T', 'D'), imgId)) {
img = new Image::BitmapDecoder();
img->loadStream(*_vm->_currentScore->getArchive()->getResource(MKTAG('B', 'I', 'T', 'D'), imgId));
return img;
Commit: f4325f30effa36d14bfa97312c25a58ac1ebe4cd
https://github.com/scummvm/scummvm/commit/f4325f30effa36d14bfa97312c25a58ac1ebe4cd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Started 'else if' implementation
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index fa16502..afc65b2 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -94,6 +94,20 @@ Common::Error DirectorEngine::run() {
#if 0
_lingo->addCode("--\n\
+ if y = 5 then\n\
+ set x = 5\n\
+ else if y = 6 then\n\
+ set x = 6\n\
+ else\n\
+ set x = 7\n\
+ endif\n\
+", kMovieScript, 2);
+
+_lingo->executeScript(kMovieScript, 2);
+
+return Common::kNoError;
+
+ _lingo->addCode("--\n\
macro SHIPX\n\
global x, y\n\
set x = Random(5)\n\
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index f079879..61b989a 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -426,18 +426,18 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 60
+#define YYFINAL 61
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 340
+#define YYLAST 339
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 55
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 25
+#define YYNNTS 28
/* YYNRULES -- Number of rules. */
-#define YYNRULES 83
+#define YYNRULES 88
/* YYNRULES -- Number of states. */
-#define YYNSTATES 174
+#define YYNSTATES 189
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -487,63 +487,65 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
- 20, 22, 24, 29, 34, 39, 41, 43, 51, 62,
- 71, 83, 96, 103, 105, 109, 113, 116, 120, 122,
- 123, 124, 125, 128, 131, 133, 135, 140, 145, 147,
- 149, 153, 157, 161, 165, 169, 173, 177, 181, 185,
- 188, 191, 195, 198, 201, 204, 206, 208, 211, 213,
- 217, 220, 223, 226, 229, 233, 236, 240, 243, 246,
- 248, 252, 255, 259, 260, 269, 270, 272, 276, 281,
- 282, 286, 287, 289
+ 20, 22, 24, 29, 34, 39, 41, 43, 45, 54,
+ 66, 79, 86, 94, 105, 116, 118, 122, 129, 131,
+ 135, 139, 142, 146, 148, 149, 150, 151, 154, 157,
+ 159, 161, 166, 171, 173, 175, 179, 183, 187, 191,
+ 195, 199, 203, 207, 211, 214, 217, 221, 224, 227,
+ 230, 232, 234, 237, 239, 243, 246, 249, 252, 255,
+ 259, 262, 266, 269, 272, 274, 278, 281, 285, 286,
+ 295, 296, 298, 302, 307, 308, 312, 313, 315
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
56, 0, -1, 57, 49, 56, -1, 57, -1, -1,
- 74, -1, 69, -1, 78, -1, 58, -1, 60, -1,
- 59, -1, 1, -1, 30, 68, 21, 10, -1, 32,
- 10, 43, 68, -1, 32, 10, 34, 68, -1, 68,
- -1, 69, -1, 64, 61, 33, 67, 66, 15, 20,
- -1, 64, 61, 33, 67, 66, 14, 67, 66, 15,
- 20, -1, 62, 50, 61, 51, 67, 66, 15, 31,
- -1, 63, 43, 68, 66, 34, 68, 66, 67, 66,
- 15, 31, -1, 63, 43, 68, 66, 13, 34, 68,
- 66, 67, 66, 15, 31, -1, 64, 61, 33, 65,
- 59, 66, -1, 68, -1, 68, 43, 68, -1, 50,
- 61, 51, -1, 31, 36, -1, 31, 35, 10, -1,
- 20, -1, -1, -1, -1, 67, 49, -1, 67, 59,
- -1, 7, -1, 8, -1, 9, 50, 79, 51, -1,
- 10, 50, 79, 51, -1, 10, -1, 58, -1, 68,
- 44, 68, -1, 68, 45, 68, -1, 68, 46, 68,
- -1, 68, 47, 68, -1, 68, 52, 68, -1, 68,
- 53, 68, -1, 68, 42, 68, -1, 68, 37, 68,
- -1, 68, 38, 68, -1, 44, 68, -1, 45, 68,
- -1, 50, 68, 51, -1, 24, 11, -1, 25, 10,
- -1, 30, 68, -1, 71, -1, 16, -1, 18, 70,
- -1, 10, -1, 70, 54, 10, -1, 19, 22, -1,
- 19, 27, -1, 19, 29, -1, 19, 72, -1, 19,
- 72, 73, -1, 19, 73, -1, 34, 17, 11, -1,
- 17, 11, -1, 34, 11, -1, 11, -1, 28, 26,
- 11, -1, 26, 11, -1, 34, 26, 11, -1, -1,
- 23, 10, 75, 65, 76, 49, 77, 67, -1, -1,
- 10, -1, 76, 54, 10, -1, 76, 49, 54, 10,
- -1, -1, 10, 65, 79, -1, -1, 68, -1, 79,
- 54, 68, -1
+ 77, -1, 72, -1, 81, -1, 58, -1, 60, -1,
+ 59, -1, 1, -1, 30, 71, 21, 10, -1, 32,
+ 10, 43, 71, -1, 32, 10, 34, 71, -1, 71,
+ -1, 72, -1, 61, -1, 65, 50, 64, 51, 70,
+ 69, 15, 31, -1, 66, 43, 71, 69, 34, 71,
+ 69, 70, 69, 15, 31, -1, 66, 43, 71, 69,
+ 13, 34, 71, 69, 70, 69, 15, 31, -1, 67,
+ 64, 33, 68, 59, 69, -1, 67, 64, 33, 70,
+ 69, 15, 20, -1, 67, 64, 33, 70, 69, 14,
+ 70, 69, 15, 20, -1, 67, 64, 33, 70, 69,
+ 68, 62, 69, 15, 20, -1, 63, -1, 63, 49,
+ 62, -1, 14, 67, 64, 33, 70, 69, -1, 71,
+ -1, 71, 43, 71, -1, 50, 64, 51, -1, 31,
+ 36, -1, 31, 35, 10, -1, 20, -1, -1, -1,
+ -1, 70, 49, -1, 70, 59, -1, 7, -1, 8,
+ -1, 9, 50, 82, 51, -1, 10, 50, 82, 51,
+ -1, 10, -1, 58, -1, 71, 44, 71, -1, 71,
+ 45, 71, -1, 71, 46, 71, -1, 71, 47, 71,
+ -1, 71, 52, 71, -1, 71, 53, 71, -1, 71,
+ 42, 71, -1, 71, 37, 71, -1, 71, 38, 71,
+ -1, 44, 71, -1, 45, 71, -1, 50, 71, 51,
+ -1, 24, 11, -1, 25, 10, -1, 30, 71, -1,
+ 74, -1, 16, -1, 18, 73, -1, 10, -1, 73,
+ 54, 10, -1, 19, 22, -1, 19, 27, -1, 19,
+ 29, -1, 19, 75, -1, 19, 75, 76, -1, 19,
+ 76, -1, 34, 17, 11, -1, 17, 11, -1, 34,
+ 11, -1, 11, -1, 28, 26, 11, -1, 26, 11,
+ -1, 34, 26, 11, -1, -1, 23, 10, 78, 68,
+ 79, 49, 80, 70, -1, -1, 10, -1, 79, 54,
+ 10, -1, 79, 49, 54, 10, -1, -1, 10, 68,
+ 82, -1, -1, 71, -1, 82, 54, 71, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 92, 92, 93, 96, 97, 98, 99, 100, 101,
- 102, 103, 106, 112, 118, 126, 127, 128, 134, 146,
- 157, 173, 187, 195, 196, 197, 199, 201, 207, 209,
- 211, 213, 214, 215, 218, 223, 226, 232, 240, 243,
- 244, 245, 246, 247, 248, 249, 250, 251, 252, 253,
- 254, 255, 258, 259, 260, 261, 262, 264, 267, 268,
- 279, 280, 281, 282, 287, 293, 300, 301, 302, 303,
- 306, 307, 308, 336, 336, 343, 344, 345, 346, 348,
- 351, 359, 360, 361
+ 102, 103, 106, 112, 118, 126, 127, 128, 133, 144,
+ 160, 174, 182, 188, 196, 206, 207, 210, 220, 221,
+ 222, 224, 226, 232, 234, 236, 238, 239, 240, 243,
+ 248, 251, 257, 265, 268, 269, 270, 271, 272, 273,
+ 274, 275, 276, 277, 278, 279, 280, 283, 284, 285,
+ 286, 287, 289, 292, 293, 304, 305, 306, 307, 312,
+ 318, 325, 326, 327, 328, 331, 332, 333, 361, 361,
+ 368, 369, 370, 371, 373, 376, 384, 385, 386
};
#endif
@@ -559,10 +561,10 @@ static const char *const yytname[] =
"tREPEAT", "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tGE", "tLE",
"tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'",
"'\\n'", "'('", "')'", "'>'", "'<'", "','", "$accept", "program",
- "programline", "asgn", "stmt", "stmtoneliner", "cond", "repeatwhile",
- "repeatwith", "if", "begin", "end", "stmtlist", "expr", "func",
- "globallist", "gotofunc", "gotoframe", "gotomovie", "defn", "@1",
- "argdef", "argstore", "macro", "arglist", 0
+ "programline", "asgn", "stmt", "stmtoneliner", "ifstmt", "elseif",
+ "elseif1", "cond", "repeatwhile", "repeatwith", "if", "begin", "end",
+ "stmtlist", "expr", "func", "globallist", "gotofunc", "gotoframe",
+ "gotomovie", "defn", "@1", "argdef", "argstore", "macro", "arglist", 0
};
#endif
@@ -585,27 +587,27 @@ static const yytype_uint8 yyr1[] =
{
0, 55, 56, 56, 57, 57, 57, 57, 57, 57,
57, 57, 58, 58, 58, 59, 59, 59, 59, 59,
- 59, 59, 60, 61, 61, 61, 62, 63, 64, 65,
- 66, 67, 67, 67, 68, 68, 68, 68, 68, 68,
- 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 69, 69, 69, 69, 69, 69, 70, 70,
- 71, 71, 71, 71, 71, 71, 72, 72, 72, 72,
- 73, 73, 73, 75, 74, 76, 76, 76, 76, 77,
- 78, 79, 79, 79
+ 59, 60, 61, 61, 61, 62, 62, 63, 64, 64,
+ 64, 65, 66, 67, 68, 69, 70, 70, 70, 71,
+ 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 71, 71, 71, 71, 72, 72, 72,
+ 72, 72, 72, 73, 73, 74, 74, 74, 74, 74,
+ 74, 75, 75, 75, 75, 76, 76, 76, 78, 77,
+ 79, 79, 79, 79, 80, 81, 82, 82, 82
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 1, 1, 4, 4, 4, 1, 1, 7, 10, 8,
- 11, 12, 6, 1, 3, 3, 2, 3, 1, 0,
- 0, 0, 2, 2, 1, 1, 4, 4, 1, 1,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 2,
- 2, 3, 2, 2, 2, 1, 1, 2, 1, 3,
- 2, 2, 2, 2, 3, 2, 3, 2, 2, 1,
- 3, 2, 3, 0, 8, 0, 1, 3, 4, 0,
- 3, 0, 1, 3
+ 1, 1, 4, 4, 4, 1, 1, 1, 8, 11,
+ 12, 6, 7, 10, 10, 1, 3, 6, 1, 3,
+ 3, 2, 3, 1, 0, 0, 0, 2, 2, 1,
+ 1, 4, 4, 1, 1, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 2, 2, 3, 2, 2, 2,
+ 1, 1, 2, 1, 3, 2, 2, 2, 2, 3,
+ 2, 3, 2, 2, 1, 3, 2, 3, 0, 8,
+ 0, 1, 3, 4, 0, 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -613,148 +615,148 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 34, 35, 0, 29, 56, 0, 0, 28,
+ 0, 11, 39, 40, 0, 34, 61, 0, 0, 33,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 3, 39, 10, 9, 0, 0, 0, 15, 6, 55,
- 5, 7, 81, 81, 81, 58, 57, 69, 0, 60,
- 0, 61, 0, 62, 0, 63, 65, 73, 52, 53,
- 38, 0, 39, 54, 0, 26, 0, 49, 50, 0,
- 1, 0, 0, 0, 0, 0, 23, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 82, 0, 0, 80,
- 0, 67, 71, 0, 68, 0, 0, 0, 64, 29,
- 0, 0, 27, 0, 0, 51, 2, 0, 30, 0,
- 0, 29, 0, 47, 48, 46, 40, 41, 42, 43,
- 44, 45, 36, 0, 37, 59, 70, 66, 72, 75,
- 12, 14, 13, 31, 0, 25, 0, 30, 24, 83,
- 76, 0, 30, 0, 0, 30, 0, 16, 32, 33,
- 0, 79, 0, 0, 0, 30, 22, 0, 31, 0,
- 0, 31, 77, 0, 30, 31, 31, 30, 17, 78,
- 74, 19, 31, 30, 0, 30, 0, 0, 0, 0,
- 18, 0, 20, 21
+ 3, 44, 10, 9, 17, 0, 0, 0, 15, 6,
+ 60, 5, 7, 86, 86, 86, 63, 62, 74, 0,
+ 65, 0, 66, 0, 67, 0, 68, 70, 78, 57,
+ 58, 43, 0, 44, 59, 0, 31, 0, 54, 55,
+ 0, 1, 0, 0, 0, 0, 0, 28, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 87, 0, 0,
+ 85, 0, 72, 76, 0, 73, 0, 0, 0, 69,
+ 34, 0, 0, 32, 0, 0, 56, 2, 0, 35,
+ 0, 0, 34, 0, 52, 53, 51, 45, 46, 47,
+ 48, 49, 50, 41, 0, 42, 64, 75, 71, 77,
+ 80, 12, 14, 13, 36, 0, 30, 0, 35, 29,
+ 88, 81, 0, 35, 0, 0, 35, 0, 16, 37,
+ 38, 0, 84, 0, 0, 0, 35, 21, 0, 36,
+ 0, 0, 0, 36, 82, 0, 35, 36, 36, 35,
+ 22, 0, 35, 25, 83, 79, 18, 36, 35, 0,
+ 0, 0, 0, 35, 0, 0, 0, 0, 26, 0,
+ 0, 23, 36, 24, 0, 19, 35, 20, 27
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 19, 20, 52, 139, 23, 65, 24, 25, 136,
- 34, 124, 127, 27, 137, 36, 29, 45, 46, 30,
- 89, 131, 151, 31, 77
+ -1, 19, 20, 53, 140, 23, 24, 162, 163, 66,
+ 25, 26, 137, 35, 125, 128, 28, 138, 37, 30,
+ 46, 47, 31, 90, 132, 153, 32, 78
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -123
+#define YYPACT_NINF -87
static const yytype_int16 yypact[] =
{
- 85, -123, -123, -123, -33, 287, -123, 42, 246, -123,
- 59, 65, 69, 156, -12, 73, 156, 156, 156, 90,
- 47, 15, -123, -123, 34, 48, 200, 275, -123, -123,
- -123, -123, 156, 156, 156, -123, 43, -123, 87, -123,
- 88, -123, 76, -123, 5, 13, -123, -123, -123, -123,
- 56, 156, -123, 214, 97, -123, -9, 35, 35, 251,
- -123, 85, 200, 156, 200, 78, 263, 156, 156, 156,
- 156, 156, 156, 156, 156, 156, 275, 20, 24, 58,
- 103, -123, -123, 107, -123, 108, 109, 96, -123, -123,
- 214, 104, -123, 156, 156, -123, -123, 74, 275, 75,
- 239, -3, 156, 275, 275, 275, -10, -10, 35, 35,
- 275, 275, -123, 156, -123, -123, -123, -123, -123, 114,
- -123, 275, 275, -123, 1, -123, 173, 129, 275, 275,
- -123, -1, 129, 93, 156, -123, 200, -123, -123, -123,
- 30, 79, 122, 125, 156, 275, -123, 110, -123, 121,
- 132, -123, -123, 113, 275, -123, -123, 129, -123, -123,
- 129, -123, -123, 129, 131, 129, 135, 136, 137, 120,
- -123, 124, -123, -123
+ 126, -87, -87, -87, -43, 286, -87, -1, 88, -87,
+ 16, 13, 51, 197, 17, 64, 197, 197, 197, 80,
+ 33, 2, -87, -87, -87, 36, 45, 241, 274, -87,
+ -87, -87, -87, 197, 197, 197, -87, 38, -87, 82,
+ -87, 83, -87, 69, -87, 20, -7, -87, -87, -87,
+ -87, 46, 197, -87, -3, 90, -87, -11, 130, 130,
+ 250, -87, 126, 241, 197, 241, 70, 262, 197, 197,
+ 197, 197, 197, 197, 197, 197, 197, 274, -18, -6,
+ 48, 96, -87, -87, 100, -87, 108, 109, 95, -87,
+ -87, -3, 113, -87, 197, 197, -87, -87, 73, 274,
+ 74, 223, -9, 197, 274, 274, 274, 101, 101, 130,
+ 130, 274, 274, -87, 197, -87, -87, -87, -87, -87,
+ 118, -87, 274, 274, -87, 4, -87, 214, 170, 274,
+ 274, -87, -29, 170, 107, 197, -87, 241, -87, -87,
+ -87, 42, 75, 142, 140, 197, 274, -87, 127, -87,
+ 139, 148, 153, -87, -87, 133, 274, -87, -87, 170,
+ -87, 146, -87, 120, -87, 170, -87, -87, 170, 158,
+ 241, 159, 148, 170, 166, 164, 152, 167, -87, 176,
+ 161, -87, -87, -87, 162, -87, 170, -87, -87
};
/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int8 yypgoto[] =
+static const yytype_int16 yypgoto[] =
{
- -123, 101, -123, 6, 2, -123, -54, -123, -123, 7,
- -71, 84, -122, -13, 9, -123, -123, -123, 112, -123,
- -123, -123, -123, -123, 32
+ -87, 134, -87, 14, 10, -87, -87, 25, -87, -62,
+ -87, -87, 0, -86, -55, -70, -5, 15, -87, -87,
+ -87, 157, -87, -87, -87, -87, -87, 50
};
/* 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 -39
+#define YYTABLE_NINF -44
static const yytype_int16 yytable[] =
{
- 53, 132, 22, 57, 58, 59, 21, 26, 97, 28,
- 99, -31, -31, 66, 133, -8, 84, 32, 119, 76,
- 76, 76, 85, 54, 55, 93, 157, 67, 68, 160,
- 126, 86, 69, 163, 94, 134, 72, 73, 90, 40,
- 165, 42, 74, 75, 148, 149, -31, 87, 141, 66,
- 98, 100, 35, 142, 103, 104, 105, 106, 107, 108,
- 109, 110, 111, 22, -8, 78, 79, 21, 26, 47,
- 28, 112, 67, 68, 113, 114, 48, 69, 113, 49,
- 121, 122, 147, 56, 62, -4, 1, 74, 75, 128,
- 60, 63, 2, 3, 4, 5, 61, 80, 81, 82,
- 129, 6, 83, 7, 8, 9, 33, 92, 10, 11,
- 12, 101, 113, 115, 120, 13, 14, 15, 116, 117,
- 118, 145, 86, 66, 130, 123, 125, 144, 135, 16,
- 17, 154, 152, 150, -4, 18, 2, 3, 4, 50,
- 153, 158, 159, 156, 161, 6, 167, 7, 8, 9,
- 169, 172, 171, 11, 12, 173, 170, 88, 0, 13,
- 14, 15, 96, 2, 3, 4, 50, 0, 0, 0,
- 0, 0, 0, 16, 17, 0, 0, 0, 138, 18,
- 2, 3, 4, 50, 0, 0, 51, 0, 15, 6,
- 0, 7, 8, 9, 0, 0, 0, 11, 12, 0,
- 16, 17, 0, 13, 14, 15, 18, 2, 3, 4,
- 50, 140, 0, 0, 0, 0, 143, 16, 17, 146,
- 0, 0, 0, 18, 0, 0, 0, 0, 0, 155,
- 51, 0, 15, 0, 0, 91, 0, 0, 162, 0,
- 0, 164, 0, 0, 16, 17, 0, 166, 0, 168,
- 64, 67, 68, 0, 0, 0, 69, 37, 70, 71,
- 72, 73, 0, 38, 0, 0, 74, 75, 39, 0,
- 0, 0, 40, 41, 42, 43, 67, 68, 0, 0,
- 44, 69, 102, 70, 71, 72, 73, 0, 67, 68,
- 95, 74, 75, 69, 0, 70, 71, 72, 73, 0,
- 67, 68, 95, 74, 75, 69, 102, 70, 71, 72,
- 73, 0, 67, 68, 0, 74, 75, 69, 0, 70,
- 71, 72, 73, 0, -38, -38, 0, 74, 75, -38,
- 0, 0, 0, -38, -38, 0, 0, 33, 0, -38,
- -38
+ 27, 98, -8, 100, 120, -36, -36, 33, 54, 36,
+ 22, 58, 59, 60, 21, 29, 127, 134, 92, 41,
+ 142, 43, 67, 94, 49, 143, 48, 88, 77, 77,
+ 77, 85, 95, 113, 68, 69, 114, 86, 135, 70,
+ -36, 71, 72, 73, 74, 115, 87, 91, 114, 75,
+ 76, -8, 55, 56, 133, 151, 149, 150, 67, 99,
+ 101, 50, 27, 104, 105, 106, 107, 108, 109, 110,
+ 111, 112, 22, 141, 57, 148, 21, 29, 144, 159,
+ 61, 147, 62, 165, 79, 80, 63, 168, 64, 122,
+ 123, 157, 81, 82, 83, 84, 34, 173, 129, 38,
+ 93, 167, 114, 102, 169, 39, 116, 171, 176, 130,
+ 40, 117, 186, 174, 41, 42, 43, 44, 179, 118,
+ 119, 87, 45, 121, 124, 126, -4, 1, 131, 152,
+ 146, 188, 67, 2, 3, 4, 5, 136, 68, 69,
+ 156, 145, 6, 70, 7, 8, 9, 73, 74, 10,
+ 11, 12, 154, 75, 76, 155, 13, 14, 15, 160,
+ 158, 170, 161, 164, 166, 67, 9, 68, 69, 172,
+ 16, 17, 70, 175, 177, -4, 18, 2, 3, 4,
+ 51, 180, 75, 76, 181, 182, 6, 183, 7, 8,
+ 9, 184, 185, 187, 11, 12, 97, 178, 0, 0,
+ 13, 14, 15, 89, 2, 3, 4, 51, 0, 0,
+ 0, 0, 0, 0, 16, 17, 0, 0, 0, 139,
+ 18, 2, 3, 4, 51, 0, 0, 52, 0, 15,
+ 6, 0, 7, 8, 9, 0, 0, 0, 11, 12,
+ 0, 16, 17, 0, 13, 14, 15, 18, 2, 3,
+ 4, 51, 0, 0, 0, 0, 0, 0, 16, 17,
+ 68, 69, 0, 0, 18, 70, 103, 71, 72, 73,
+ 74, 52, 0, 15, 96, 75, 76, 0, 0, 0,
+ 0, 0, 0, 0, 0, 16, 17, 68, 69, 0,
+ 0, 65, 70, 0, 71, 72, 73, 74, 0, 68,
+ 69, 96, 75, 76, 70, 103, 71, 72, 73, 74,
+ 0, 68, 69, 0, 75, 76, 70, 0, 71, 72,
+ 73, 74, 0, -43, -43, 0, 75, 76, -43, 0,
+ 0, 0, -43, -43, 0, 0, 34, 0, -43, -43
};
static const yytype_int16 yycheck[] =
{
- 13, 123, 0, 16, 17, 18, 0, 0, 62, 0,
- 64, 14, 15, 26, 13, 0, 11, 50, 89, 32,
- 33, 34, 17, 35, 36, 34, 148, 37, 38, 151,
- 101, 26, 42, 155, 43, 34, 46, 47, 51, 26,
- 162, 28, 52, 53, 14, 15, 49, 34, 49, 62,
- 63, 64, 10, 54, 67, 68, 69, 70, 71, 72,
- 73, 74, 75, 61, 49, 33, 34, 61, 61, 10,
- 61, 51, 37, 38, 54, 51, 11, 42, 54, 10,
- 93, 94, 136, 10, 50, 0, 1, 52, 53, 102,
- 0, 43, 7, 8, 9, 10, 49, 54, 11, 11,
- 113, 16, 26, 18, 19, 20, 50, 10, 23, 24,
- 25, 33, 54, 10, 10, 30, 31, 32, 11, 11,
- 11, 134, 26, 136, 10, 51, 51, 34, 126, 44,
- 45, 144, 10, 54, 49, 50, 7, 8, 9, 10,
- 15, 20, 10, 33, 31, 16, 15, 18, 19, 20,
- 15, 31, 15, 24, 25, 31, 20, 45, -1, 30,
- 31, 32, 61, 7, 8, 9, 10, -1, -1, -1,
- -1, -1, -1, 44, 45, -1, -1, -1, 49, 50,
- 7, 8, 9, 10, -1, -1, 30, -1, 32, 16,
- -1, 18, 19, 20, -1, -1, -1, 24, 25, -1,
- 44, 45, -1, 30, 31, 32, 50, 7, 8, 9,
- 10, 127, -1, -1, -1, -1, 132, 44, 45, 135,
- -1, -1, -1, 50, -1, -1, -1, -1, -1, 145,
- 30, -1, 32, -1, -1, 21, -1, -1, 154, -1,
- -1, 157, -1, -1, 44, 45, -1, 163, -1, 165,
- 50, 37, 38, -1, -1, -1, 42, 11, 44, 45,
- 46, 47, -1, 17, -1, -1, 52, 53, 22, -1,
- -1, -1, 26, 27, 28, 29, 37, 38, -1, -1,
- 34, 42, 43, 44, 45, 46, 47, -1, 37, 38,
- 51, 52, 53, 42, -1, 44, 45, 46, 47, -1,
- 37, 38, 51, 52, 53, 42, 43, 44, 45, 46,
- 47, -1, 37, 38, -1, 52, 53, 42, -1, 44,
- 45, 46, 47, -1, 37, 38, -1, 52, 53, 42,
- -1, -1, -1, 46, 47, -1, -1, 50, -1, 52,
- 53
+ 0, 63, 0, 65, 90, 14, 15, 50, 13, 10,
+ 0, 16, 17, 18, 0, 0, 102, 13, 21, 26,
+ 49, 28, 27, 34, 11, 54, 10, 34, 33, 34,
+ 35, 11, 43, 51, 37, 38, 54, 17, 34, 42,
+ 49, 44, 45, 46, 47, 51, 26, 52, 54, 52,
+ 53, 49, 35, 36, 124, 141, 14, 15, 63, 64,
+ 65, 10, 62, 68, 69, 70, 71, 72, 73, 74,
+ 75, 76, 62, 128, 10, 137, 62, 62, 133, 149,
+ 0, 136, 49, 153, 34, 35, 50, 157, 43, 94,
+ 95, 146, 54, 11, 11, 26, 50, 167, 103, 11,
+ 10, 156, 54, 33, 159, 17, 10, 162, 170, 114,
+ 22, 11, 182, 168, 26, 27, 28, 29, 173, 11,
+ 11, 26, 34, 10, 51, 51, 0, 1, 10, 54,
+ 135, 186, 137, 7, 8, 9, 10, 127, 37, 38,
+ 145, 34, 16, 42, 18, 19, 20, 46, 47, 23,
+ 24, 25, 10, 52, 53, 15, 30, 31, 32, 20,
+ 33, 161, 14, 10, 31, 170, 20, 37, 38, 49,
+ 44, 45, 42, 15, 15, 49, 50, 7, 8, 9,
+ 10, 15, 52, 53, 20, 33, 16, 20, 18, 19,
+ 20, 15, 31, 31, 24, 25, 62, 172, -1, -1,
+ 30, 31, 32, 46, 7, 8, 9, 10, -1, -1,
+ -1, -1, -1, -1, 44, 45, -1, -1, -1, 49,
+ 50, 7, 8, 9, 10, -1, -1, 30, -1, 32,
+ 16, -1, 18, 19, 20, -1, -1, -1, 24, 25,
+ -1, 44, 45, -1, 30, 31, 32, 50, 7, 8,
+ 9, 10, -1, -1, -1, -1, -1, -1, 44, 45,
+ 37, 38, -1, -1, 50, 42, 43, 44, 45, 46,
+ 47, 30, -1, 32, 51, 52, 53, -1, -1, -1,
+ -1, -1, -1, -1, -1, 44, 45, 37, 38, -1,
+ -1, 50, 42, -1, 44, 45, 46, 47, -1, 37,
+ 38, 51, 52, 53, 42, 43, 44, 45, 46, 47,
+ -1, 37, 38, -1, 52, 53, 42, -1, 44, 45,
+ 46, 47, -1, 37, 38, -1, 52, 53, 42, -1,
+ -1, -1, 46, 47, -1, -1, 50, -1, 52, 53
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -763,22 +765,23 @@ static const yytype_uint8 yystos[] =
{
0, 1, 7, 8, 9, 10, 16, 18, 19, 20,
23, 24, 25, 30, 31, 32, 44, 45, 50, 56,
- 57, 58, 59, 60, 62, 63, 64, 68, 69, 71,
- 74, 78, 50, 50, 65, 10, 70, 11, 17, 22,
- 26, 27, 28, 29, 34, 72, 73, 10, 11, 10,
- 10, 30, 58, 68, 35, 36, 10, 68, 68, 68,
- 0, 49, 50, 43, 50, 61, 68, 37, 38, 42,
- 44, 45, 46, 47, 52, 53, 68, 79, 79, 79,
- 54, 11, 11, 26, 11, 17, 26, 34, 73, 75,
- 68, 21, 10, 34, 43, 51, 56, 61, 68, 61,
- 68, 33, 43, 68, 68, 68, 68, 68, 68, 68,
- 68, 68, 51, 54, 51, 10, 11, 11, 11, 65,
- 10, 68, 68, 51, 66, 51, 65, 67, 68, 68,
- 10, 76, 67, 13, 34, 59, 64, 69, 49, 59,
- 66, 49, 54, 66, 34, 68, 66, 61, 14, 15,
- 54, 77, 10, 15, 68, 66, 33, 67, 20, 10,
- 67, 31, 66, 67, 66, 67, 66, 15, 66, 15,
- 20, 15, 31, 31
+ 57, 58, 59, 60, 61, 65, 66, 67, 71, 72,
+ 74, 77, 81, 50, 50, 68, 10, 73, 11, 17,
+ 22, 26, 27, 28, 29, 34, 75, 76, 10, 11,
+ 10, 10, 30, 58, 71, 35, 36, 10, 71, 71,
+ 71, 0, 49, 50, 43, 50, 64, 71, 37, 38,
+ 42, 44, 45, 46, 47, 52, 53, 71, 82, 82,
+ 82, 54, 11, 11, 26, 11, 17, 26, 34, 76,
+ 78, 71, 21, 10, 34, 43, 51, 56, 64, 71,
+ 64, 71, 33, 43, 71, 71, 71, 71, 71, 71,
+ 71, 71, 71, 51, 54, 51, 10, 11, 11, 11,
+ 68, 10, 71, 71, 51, 69, 51, 68, 70, 71,
+ 71, 10, 79, 70, 13, 34, 59, 67, 72, 49,
+ 59, 69, 49, 54, 69, 34, 71, 69, 64, 14,
+ 15, 68, 54, 80, 10, 15, 71, 69, 33, 70,
+ 20, 14, 62, 63, 10, 70, 31, 69, 70, 69,
+ 67, 69, 49, 70, 69, 15, 64, 15, 62, 69,
+ 15, 20, 33, 20, 15, 31, 70, 31, 69
};
#define yyerrok (yyerrstatus = 0)
@@ -1637,30 +1640,8 @@ yyreduce:
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 17:
-#line 128 "engines/director/lingo/lingo-gr.y"
- {
- inst then = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
- WRITE_UINT32(&end, (yyvsp[(5) - (7)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; ;}
- break;
-
case 18:
-#line 134 "engines/director/lingo/lingo-gr.y"
- {
- inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
- WRITE_UINT32(&else1, (yyvsp[(7) - (10)].code));
- WRITE_UINT32(&end, (yyvsp[(8) - (10)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
- break;
-
- case 19:
-#line 146 "engines/director/lingo/lingo-gr.y"
+#line 133 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1669,8 +1650,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
- case 20:
-#line 157 "engines/director/lingo/lingo-gr.y"
+ case 19:
+#line 144 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1685,8 +1666,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
break;
- case 21:
-#line 173 "engines/director/lingo/lingo-gr.y"
+ case 20:
+#line 160 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1701,8 +1682,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
break;
- case 22:
-#line 187 "engines/director/lingo/lingo-gr.y"
+ case 21:
+#line 174 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1711,23 +1692,69 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 3] = end; ;}
break;
+ case 22:
+#line 182 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
+ WRITE_UINT32(&end, (yyvsp[(5) - (7)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; ;}
+ break;
+
case 23:
-#line 195 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(STOP); ;}
+#line 188 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
+ WRITE_UINT32(&else1, (yyvsp[(7) - (10)].code));
+ WRITE_UINT32(&end, (yyvsp[(8) - (10)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
break;
case 24:
#line 196 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
+ WRITE_UINT32(&else1, (yyvsp[(6) - (10)].code));
+ WRITE_UINT32(&end, (yyvsp[(8) - (10)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
+ break;
+
+ case 27:
+#line 210 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(5) - (6)].code));
+ WRITE_UINT32(&else1, (yyvsp[(6) - (6)].code));
+ WRITE_UINT32(&end, 0);
+ (*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 3] = end; ;}
+ break;
+
+ case 28:
+#line 220 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(STOP); ;}
+ break;
+
+ case 29:
+#line 221 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 26:
-#line 199 "engines/director/lingo/lingo-gr.y"
+ case 31:
+#line 224 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 27:
-#line 201 "engines/director/lingo/lingo-gr.y"
+ case 32:
+#line 226 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1735,28 +1762,28 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 28:
-#line 207 "engines/director/lingo/lingo-gr.y"
+ case 33:
+#line 232 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
- case 29:
-#line 209 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 234 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 30:
-#line 211 "engines/director/lingo/lingo-gr.y"
+ case 35:
+#line 236 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 31:
-#line 213 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 238 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 34:
-#line 218 "engines/director/lingo/lingo-gr.y"
+ case 39:
+#line 243 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1764,15 +1791,15 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 35:
-#line 223 "engines/director/lingo/lingo-gr.y"
+ case 40:
+#line 248 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
- case 36:
-#line 226 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 251 "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));
@@ -1781,8 +1808,8 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 37:
-#line 232 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 257 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1793,121 +1820,121 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 38:
-#line 240 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 265 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 40:
-#line 244 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 269 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 41:
-#line 245 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 270 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 42:
-#line 246 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 271 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 43:
-#line 247 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 272 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 44:
-#line 248 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 273 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 45:
-#line 249 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 274 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 46:
-#line 250 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 275 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 47:
-#line 251 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 276 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 48:
-#line 252 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 277 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 49:
-#line 253 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 278 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 50:
-#line 254 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 279 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 51:
-#line 255 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 280 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 52:
-#line 258 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 283 "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 53:
-#line 259 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 284 "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 54:
-#line 260 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 285 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 56:
-#line 262 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 287 "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 58:
-#line 267 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 292 "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 59:
-#line 268 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 293 "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 60:
-#line 279 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 304 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 61:
-#line 280 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 305 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 62:
-#line 281 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 306 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 63:
-#line 282 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 307 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1915,8 +1942,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 64:
-#line 287 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 312 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1925,8 +1952,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 65:
-#line 293 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 318 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1934,48 +1961,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 66:
-#line 300 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 325 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 67:
-#line 301 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 326 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 68:
-#line 302 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 327 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 69:
-#line 303 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 328 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 70:
-#line 306 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 331 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 71:
-#line 307 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 332 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 72:
-#line 308 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 333 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 73:
-#line 336 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 361 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 74:
-#line 337 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 362 "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);
@@ -1983,33 +2010,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 75:
-#line 343 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 368 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 76:
-#line 344 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 369 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 77:
-#line 345 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 370 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 78:
-#line 346 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 371 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 79:
-#line 348 "engines/director/lingo/lingo-gr.y"
+ case 84:
+#line 373 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 80:
-#line 351 "engines/director/lingo/lingo-gr.y"
+ case 85:
+#line 376 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2018,24 +2045,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 81:
-#line 359 "engines/director/lingo/lingo-gr.y"
+ case 86:
+#line 384 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 82:
-#line 360 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 385 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 83:
-#line 361 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 386 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2039 "engines/director/lingo/lingo-gr.cpp"
+#line 2066 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2249,6 +2276,6 @@ yyreturn:
}
-#line 364 "engines/director/lingo/lingo-gr.y"
+#line 389 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 191bccf..de153b9 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -125,20 +125,7 @@ asgn: tPUT expr tINTO ID {
stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
| func
- | if cond tTHEN stmtlist end tEND tIF {
- inst then = 0, end = 0;
- WRITE_UINT32(&then, $4);
- WRITE_UINT32(&end, $5);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
- | if cond tTHEN stmtlist end tELSE stmtlist end tEND tIF {
- inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, $4);
- WRITE_UINT32(&else1, $7);
- WRITE_UINT32(&end, $8);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ | ifstmt
// repeat while (expression = TRUE)
// statements
// end repeat
@@ -192,6 +179,44 @@ stmtoneliner: if cond tTHEN begin stmt end {
(*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
;
+ifstmt: if cond tTHEN stmtlist end tEND tIF {
+ inst then = 0, end = 0;
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&end, $5);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ | if cond tTHEN stmtlist end tELSE stmtlist end tEND tIF {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&else1, $7);
+ WRITE_UINT32(&end, $8);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ | if cond tTHEN stmtlist end begin elseif end tEND tIF {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&else1, $6);
+ WRITE_UINT32(&end, $8);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ ;
+
+elseif: elseif1
+ | elseif1 '\n' elseif
+ ;
+
+elseif1: tELSE if cond tTHEN stmtlist end {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, $5);
+ WRITE_UINT32(&else1, $6);
+ WRITE_UINT32(&end, 0);
+ (*g_lingo->_currentScript)[$2 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$2 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$2 + 3] = end; } /* end, if cond fails */
+ ;
+
cond: expr { g_lingo->code1(STOP); }
| expr '=' expr { g_lingo->code2(g_lingo->c_eq, STOP); }
| '(' cond ')'
Commit: 350f81635f0186a9c93d8750d1d043f8c1cfda00
https://github.com/scummvm/scummvm/commit/350f81635f0186a9c93d8750d1d043f8c1cfda00
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Render checkbox and button rectangles
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 22f5381..9e17498 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1268,6 +1268,31 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
}
}
+void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId) {
+ renderText(surface, spriteId);
+
+ uint16 castID = _sprites[spriteId]->_castId;
+ ButtonCast *button = static_cast<ButtonCast *>(_vm->_currentScore->_casts[castID]);
+
+ uint32 rectLeft = button->initialRect.left;
+ uint32 rectTop = button->initialRect.top;
+
+ int x = _sprites[spriteId]->_startPoint.x + rectLeft;
+ int y = _sprites[spriteId]->_startPoint.y + rectTop;
+ int height = _sprites[spriteId]->_height;
+ int width = _sprites[spriteId]->_width;
+
+ switch (button->buttonType) {
+ case kTypeCheckBox:
+ //Magic numbers: checkbox square need to move left about 5px from text and 12px side size (d4)
+ surface.frameRect(Common::Rect(x - 17, y, x + 12, y + 12), 0);
+ break;
+ case kTypeButton:
+ surface.frameRect(Common::Rect(x, y, x + width, y + height), 0);
+ break;
+ }
+}
+
Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) {
uint16 imgId = spriteId + 1024;
Image::ImageDecoder *img = NULL;
diff --git a/engines/director/score.h b/engines/director/score.h
index b6eb968..8a3400b 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -301,7 +301,8 @@ private:
void playTransition(Score *score);
void playSoundChannel();
void renderSprites(Graphics::ManagedSurface &surface, bool renderTrail);
- void renderText(Graphics::ManagedSurface &surface, uint16 castId);
+ void renderText(Graphics::ManagedSurface &surface, uint16 spriteId);
+ void renderButton(Graphics::ManagedSurface &surface, uint16 spriteId);
void readPaletteInfo(Common::SeekableSubReadStreamEndian &stream);
void readSprite(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
void readMainChannels(Common::SeekableSubReadStreamEndian &stream, uint16 offset, uint16 size);
Commit: eb724af3ea1eb7eeb3948c6ca9fd299ca0cfec76
https://github.com/scummvm/scummvm/commit/eb724af3ea1eb7eeb3948c6ca9fd299ca0cfec76
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Parse basic 'else if' clause
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index afc65b2..4398f2b 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -94,16 +94,16 @@ Common::Error DirectorEngine::run() {
#if 0
_lingo->addCode("--\n\
- if y = 5 then\n\
- set x = 5\n\
- else if y = 6 then\n\
- set x = 6\n\
- else\n\
- set x = 7\n\
- endif\n\
+ if 5 then\n\
+ exit\n\
+ else if 6 then\n\
+ exit\n\
+ else if 7 then\n\
+ exit\n\
+ end if\n\
", kMovieScript, 2);
-_lingo->executeScript(kMovieScript, 2);
+//_lingo->executeScript(kMovieScript, 2);
return Common::kNoError;
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 61b989a..5d3bcd6 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -78,34 +78,35 @@
HANDLER = 267,
tDOWN = 268,
tELSE = 269,
- tEND = 270,
- tEXIT = 271,
- tFRAME = 272,
- tGLOBAL = 273,
- tGO = 274,
- tIF = 275,
- tINTO = 276,
- tLOOP = 277,
- tMACRO = 278,
- tMCI = 279,
- tMCIWAIT = 280,
- tMOVIE = 281,
- tNEXT = 282,
- tOF = 283,
- tPREVIOUS = 284,
- tPUT = 285,
- tREPEAT = 286,
- tSET = 287,
- tTHEN = 288,
- tTO = 289,
- tWITH = 290,
- tWHILE = 291,
- tGE = 292,
- tLE = 293,
- tGT = 294,
- tLT = 295,
- tEQ = 296,
- tNEQ = 297
+ tELSIF = 270,
+ tEND = 271,
+ tEXIT = 272,
+ tFRAME = 273,
+ tGLOBAL = 274,
+ tGO = 275,
+ tIF = 276,
+ tINTO = 277,
+ tLOOP = 278,
+ tMACRO = 279,
+ tMCI = 280,
+ tMCIWAIT = 281,
+ tMOVIE = 282,
+ tNEXT = 283,
+ tOF = 284,
+ tPREVIOUS = 285,
+ tPUT = 286,
+ tREPEAT = 287,
+ tSET = 288,
+ tTHEN = 289,
+ tTO = 290,
+ tWITH = 291,
+ tWHILE = 292,
+ tGE = 293,
+ tLE = 294,
+ tGT = 295,
+ tLT = 296,
+ tEQ = 297,
+ tNEQ = 298
};
#endif
/* Tokens. */
@@ -121,34 +122,35 @@
#define HANDLER 267
#define tDOWN 268
#define tELSE 269
-#define tEND 270
-#define tEXIT 271
-#define tFRAME 272
-#define tGLOBAL 273
-#define tGO 274
-#define tIF 275
-#define tINTO 276
-#define tLOOP 277
-#define tMACRO 278
-#define tMCI 279
-#define tMCIWAIT 280
-#define tMOVIE 281
-#define tNEXT 282
-#define tOF 283
-#define tPREVIOUS 284
-#define tPUT 285
-#define tREPEAT 286
-#define tSET 287
-#define tTHEN 288
-#define tTO 289
-#define tWITH 290
-#define tWHILE 291
-#define tGE 292
-#define tLE 293
-#define tGT 294
-#define tLT 295
-#define tEQ 296
-#define tNEQ 297
+#define tELSIF 270
+#define tEND 271
+#define tEXIT 272
+#define tFRAME 273
+#define tGLOBAL 274
+#define tGO 275
+#define tIF 276
+#define tINTO 277
+#define tLOOP 278
+#define tMACRO 279
+#define tMCI 280
+#define tMCIWAIT 281
+#define tMOVIE 282
+#define tNEXT 283
+#define tOF 284
+#define tPREVIOUS 285
+#define tPUT 286
+#define tREPEAT 287
+#define tSET 288
+#define tTHEN 289
+#define tTO 290
+#define tWITH 291
+#define tWHILE 292
+#define tGE 293
+#define tLE 294
+#define tGT 295
+#define tLT 296
+#define tEQ 297
+#define tNEQ 298
@@ -200,7 +202,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 204 "engines/director/lingo/lingo-gr.cpp"
+#line 206 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -213,7 +215,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 217 "engines/director/lingo/lingo-gr.cpp"
+#line 219 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -428,20 +430,20 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 61
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 339
+#define YYLAST 327
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 55
+#define YYNTOKENS 56
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 28
+#define YYNNTS 29
/* YYNRULES -- Number of rules. */
-#define YYNRULES 88
+#define YYNRULES 89
/* YYNRULES -- Number of states. */
-#define YYNSTATES 189
+#define YYNSTATES 187
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 297
+#define YYMAXUTOK 298
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -450,12 +452,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 49, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 50, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 48, 2, 2,
- 50, 51, 46, 44, 54, 45, 2, 47, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 49, 2, 2,
+ 51, 52, 47, 45, 55, 46, 2, 48, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 53, 43, 52, 2, 2, 2, 2, 2, 2, 2,
+ 54, 44, 53, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -478,7 +480,7 @@ static const yytype_uint8 yytranslate[] =
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42
+ 35, 36, 37, 38, 39, 40, 41, 42, 43
};
#if YYDEBUG
@@ -488,50 +490,50 @@ static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
20, 22, 24, 29, 34, 39, 41, 43, 45, 54,
- 66, 79, 86, 94, 105, 116, 118, 122, 129, 131,
- 135, 139, 142, 146, 148, 149, 150, 151, 154, 157,
- 159, 161, 166, 171, 173, 175, 179, 183, 187, 191,
- 195, 199, 203, 207, 211, 214, 217, 221, 224, 227,
- 230, 232, 234, 237, 239, 243, 246, 249, 252, 255,
- 259, 262, 266, 269, 272, 274, 278, 281, 285, 286,
- 295, 296, 298, 302, 307, 308, 312, 313, 315
+ 66, 79, 86, 94, 105, 116, 119, 121, 126, 128,
+ 132, 136, 139, 143, 145, 147, 148, 149, 150, 153,
+ 156, 158, 160, 165, 170, 172, 174, 178, 182, 186,
+ 190, 194, 198, 202, 206, 210, 213, 216, 220, 223,
+ 226, 229, 231, 233, 236, 238, 242, 245, 248, 251,
+ 254, 258, 261, 265, 268, 271, 273, 277, 280, 284,
+ 285, 294, 295, 297, 301, 306, 307, 311, 312, 314
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 56, 0, -1, 57, 49, 56, -1, 57, -1, -1,
- 77, -1, 72, -1, 81, -1, 58, -1, 60, -1,
- 59, -1, 1, -1, 30, 71, 21, 10, -1, 32,
- 10, 43, 71, -1, 32, 10, 34, 71, -1, 71,
- -1, 72, -1, 61, -1, 65, 50, 64, 51, 70,
- 69, 15, 31, -1, 66, 43, 71, 69, 34, 71,
- 69, 70, 69, 15, 31, -1, 66, 43, 71, 69,
- 13, 34, 71, 69, 70, 69, 15, 31, -1, 67,
- 64, 33, 68, 59, 69, -1, 67, 64, 33, 70,
- 69, 15, 20, -1, 67, 64, 33, 70, 69, 14,
- 70, 69, 15, 20, -1, 67, 64, 33, 70, 69,
- 68, 62, 69, 15, 20, -1, 63, -1, 63, 49,
- 62, -1, 14, 67, 64, 33, 70, 69, -1, 71,
- -1, 71, 43, 71, -1, 50, 64, 51, -1, 31,
- 36, -1, 31, 35, 10, -1, 20, -1, -1, -1,
- -1, 70, 49, -1, 70, 59, -1, 7, -1, 8,
- -1, 9, 50, 82, 51, -1, 10, 50, 82, 51,
- -1, 10, -1, 58, -1, 71, 44, 71, -1, 71,
- 45, 71, -1, 71, 46, 71, -1, 71, 47, 71,
- -1, 71, 52, 71, -1, 71, 53, 71, -1, 71,
- 42, 71, -1, 71, 37, 71, -1, 71, 38, 71,
- -1, 44, 71, -1, 45, 71, -1, 50, 71, 51,
- -1, 24, 11, -1, 25, 10, -1, 30, 71, -1,
- 74, -1, 16, -1, 18, 73, -1, 10, -1, 73,
- 54, 10, -1, 19, 22, -1, 19, 27, -1, 19,
- 29, -1, 19, 75, -1, 19, 75, 76, -1, 19,
- 76, -1, 34, 17, 11, -1, 17, 11, -1, 34,
- 11, -1, 11, -1, 28, 26, 11, -1, 26, 11,
- -1, 34, 26, 11, -1, -1, 23, 10, 78, 68,
- 79, 49, 80, 70, -1, -1, 10, -1, 79, 54,
- 10, -1, 79, 49, 54, 10, -1, -1, 10, 68,
- 82, -1, -1, 71, -1, 82, 54, 71, -1
+ 57, 0, -1, 58, 50, 57, -1, 58, -1, -1,
+ 79, -1, 74, -1, 83, -1, 59, -1, 61, -1,
+ 60, -1, 1, -1, 31, 73, 22, 10, -1, 33,
+ 10, 44, 73, -1, 33, 10, 35, 73, -1, 73,
+ -1, 74, -1, 62, -1, 66, 51, 65, 52, 72,
+ 71, 16, 32, -1, 67, 44, 73, 71, 35, 73,
+ 71, 72, 71, 16, 32, -1, 67, 44, 73, 71,
+ 13, 35, 73, 71, 72, 71, 16, 32, -1, 68,
+ 65, 34, 70, 60, 71, -1, 68, 65, 34, 72,
+ 71, 16, 21, -1, 68, 65, 34, 72, 71, 14,
+ 72, 71, 16, 21, -1, 68, 65, 34, 72, 71,
+ 70, 63, 71, 16, 21, -1, 64, 63, -1, 64,
+ -1, 69, 65, 34, 72, -1, 73, -1, 73, 44,
+ 73, -1, 51, 65, 52, -1, 32, 37, -1, 32,
+ 36, 10, -1, 21, -1, 15, -1, -1, -1, -1,
+ 72, 50, -1, 72, 60, -1, 7, -1, 8, -1,
+ 9, 51, 84, 52, -1, 10, 51, 84, 52, -1,
+ 10, -1, 59, -1, 73, 45, 73, -1, 73, 46,
+ 73, -1, 73, 47, 73, -1, 73, 48, 73, -1,
+ 73, 53, 73, -1, 73, 54, 73, -1, 73, 43,
+ 73, -1, 73, 38, 73, -1, 73, 39, 73, -1,
+ 45, 73, -1, 46, 73, -1, 51, 73, 52, -1,
+ 25, 11, -1, 26, 10, -1, 31, 73, -1, 76,
+ -1, 17, -1, 19, 75, -1, 10, -1, 75, 55,
+ 10, -1, 20, 23, -1, 20, 28, -1, 20, 30,
+ -1, 20, 77, -1, 20, 77, 78, -1, 20, 78,
+ -1, 35, 18, 11, -1, 18, 11, -1, 35, 11,
+ -1, 11, -1, 29, 27, 11, -1, 27, 11, -1,
+ 35, 27, 11, -1, -1, 24, 10, 80, 70, 81,
+ 50, 82, 72, -1, -1, 10, -1, 81, 55, 10,
+ -1, 81, 50, 55, 10, -1, -1, 10, 70, 84,
+ -1, -1, 73, -1, 84, 55, 73, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -540,12 +542,12 @@ static const yytype_uint16 yyrline[] =
0, 92, 92, 93, 96, 97, 98, 99, 100, 101,
102, 103, 106, 112, 118, 126, 127, 128, 133, 144,
160, 174, 182, 188, 196, 206, 207, 210, 220, 221,
- 222, 224, 226, 232, 234, 236, 238, 239, 240, 243,
- 248, 251, 257, 265, 268, 269, 270, 271, 272, 273,
- 274, 275, 276, 277, 278, 279, 280, 283, 284, 285,
- 286, 287, 289, 292, 293, 304, 305, 306, 307, 312,
- 318, 325, 326, 327, 328, 331, 332, 333, 361, 361,
- 368, 369, 370, 371, 373, 376, 384, 385, 386
+ 222, 224, 226, 232, 234, 236, 238, 240, 241, 242,
+ 245, 250, 253, 259, 267, 270, 271, 272, 273, 274,
+ 275, 276, 277, 278, 279, 280, 281, 282, 285, 286,
+ 287, 288, 289, 291, 294, 295, 306, 307, 308, 309,
+ 314, 320, 327, 328, 329, 330, 333, 334, 335, 363,
+ 363, 370, 371, 372, 373, 375, 378, 386, 387, 388
};
#endif
@@ -555,16 +557,17 @@ static const yytype_uint16 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "CASTREF", "UNARY", "VOID", "VAR", "INT",
- "FLOAT", "BLTIN", "ID", "STRING", "HANDLER", "tDOWN", "tELSE", "tEND",
- "tEXIT", "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO",
- "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT",
- "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tGE", "tLE",
- "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'", "'%'",
- "'\\n'", "'('", "')'", "'>'", "'<'", "','", "$accept", "program",
- "programline", "asgn", "stmt", "stmtoneliner", "ifstmt", "elseif",
- "elseif1", "cond", "repeatwhile", "repeatwith", "if", "begin", "end",
- "stmtlist", "expr", "func", "globallist", "gotofunc", "gotoframe",
- "gotomovie", "defn", "@1", "argdef", "argstore", "macro", "arglist", 0
+ "FLOAT", "BLTIN", "ID", "STRING", "HANDLER", "tDOWN", "tELSE", "tELSIF",
+ "tEND", "tEXIT", "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP",
+ "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS",
+ "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tGE",
+ "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'",
+ "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "','", "$accept", "program",
+ "programline", "asgn", "stmt", "stmtoneliner", "ifstmt", "elseifstmt",
+ "elseifstmt1", "cond", "repeatwhile", "repeatwith", "if", "elseif",
+ "begin", "end", "stmtlist", "expr", "func", "globallist", "gotofunc",
+ "gotoframe", "gotomovie", "defn", "@1", "argdef", "argstore", "macro",
+ "arglist", 0
};
#endif
@@ -577,23 +580,23 @@ static const yytype_uint16 yytoknum[] =
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, 61, 43, 45, 42, 47, 37, 10,
- 40, 41, 62, 60, 44
+ 295, 296, 297, 298, 61, 43, 45, 42, 47, 37,
+ 10, 40, 41, 62, 60, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 55, 56, 56, 57, 57, 57, 57, 57, 57,
- 57, 57, 58, 58, 58, 59, 59, 59, 59, 59,
- 59, 60, 61, 61, 61, 62, 62, 63, 64, 64,
- 64, 65, 66, 67, 68, 69, 70, 70, 70, 71,
- 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
- 71, 71, 71, 71, 71, 71, 71, 72, 72, 72,
- 72, 72, 72, 73, 73, 74, 74, 74, 74, 74,
- 74, 75, 75, 75, 75, 76, 76, 76, 78, 77,
- 79, 79, 79, 79, 80, 81, 82, 82, 82
+ 0, 56, 57, 57, 58, 58, 58, 58, 58, 58,
+ 58, 58, 59, 59, 59, 60, 60, 60, 60, 60,
+ 60, 61, 62, 62, 62, 63, 63, 64, 65, 65,
+ 65, 66, 67, 68, 69, 70, 71, 72, 72, 72,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 73, 73, 73, 73, 73, 73, 73, 73, 74, 74,
+ 74, 74, 74, 74, 75, 75, 76, 76, 76, 76,
+ 76, 76, 77, 77, 77, 77, 78, 78, 78, 80,
+ 79, 81, 81, 81, 81, 82, 83, 84, 84, 84
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -601,13 +604,13 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
1, 1, 4, 4, 4, 1, 1, 1, 8, 11,
- 12, 6, 7, 10, 10, 1, 3, 6, 1, 3,
- 3, 2, 3, 1, 0, 0, 0, 2, 2, 1,
- 1, 4, 4, 1, 1, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 2, 2, 3, 2, 2, 2,
- 1, 1, 2, 1, 3, 2, 2, 2, 2, 3,
- 2, 3, 2, 2, 1, 3, 2, 3, 0, 8,
- 0, 1, 3, 4, 0, 3, 0, 1, 3
+ 12, 6, 7, 10, 10, 2, 1, 4, 1, 3,
+ 3, 2, 3, 1, 1, 0, 0, 0, 2, 2,
+ 1, 1, 4, 4, 1, 1, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 2, 2, 3, 2, 2,
+ 2, 1, 1, 2, 1, 3, 2, 2, 2, 2,
+ 3, 2, 3, 2, 2, 1, 3, 2, 3, 0,
+ 8, 0, 1, 3, 4, 0, 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -615,173 +618,171 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 39, 40, 0, 34, 61, 0, 0, 33,
+ 0, 11, 40, 41, 0, 35, 62, 0, 0, 33,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 3, 44, 10, 9, 17, 0, 0, 0, 15, 6,
- 60, 5, 7, 86, 86, 86, 63, 62, 74, 0,
- 65, 0, 66, 0, 67, 0, 68, 70, 78, 57,
- 58, 43, 0, 44, 59, 0, 31, 0, 54, 55,
+ 3, 45, 10, 9, 17, 0, 0, 0, 15, 6,
+ 61, 5, 7, 87, 87, 87, 64, 63, 75, 0,
+ 66, 0, 67, 0, 68, 0, 69, 71, 79, 58,
+ 59, 44, 0, 45, 60, 0, 31, 0, 55, 56,
0, 1, 0, 0, 0, 0, 0, 28, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 87, 0, 0,
- 85, 0, 72, 76, 0, 73, 0, 0, 0, 69,
- 34, 0, 0, 32, 0, 0, 56, 2, 0, 35,
- 0, 0, 34, 0, 52, 53, 51, 45, 46, 47,
- 48, 49, 50, 41, 0, 42, 64, 75, 71, 77,
- 80, 12, 14, 13, 36, 0, 30, 0, 35, 29,
- 88, 81, 0, 35, 0, 0, 35, 0, 16, 37,
- 38, 0, 84, 0, 0, 0, 35, 21, 0, 36,
- 0, 0, 0, 36, 82, 0, 35, 36, 36, 35,
- 22, 0, 35, 25, 83, 79, 18, 36, 35, 0,
- 0, 0, 0, 35, 0, 0, 0, 0, 26, 0,
- 0, 23, 36, 24, 0, 19, 35, 20, 27
+ 0, 0, 0, 0, 0, 0, 0, 88, 0, 0,
+ 86, 0, 73, 77, 0, 74, 0, 0, 0, 70,
+ 35, 0, 0, 32, 0, 0, 57, 2, 0, 36,
+ 0, 0, 35, 0, 53, 54, 52, 46, 47, 48,
+ 49, 50, 51, 42, 0, 43, 65, 76, 72, 78,
+ 81, 12, 14, 13, 37, 0, 30, 0, 36, 29,
+ 89, 82, 0, 36, 0, 0, 36, 0, 16, 38,
+ 39, 35, 85, 0, 0, 0, 36, 21, 0, 37,
+ 0, 0, 0, 37, 83, 0, 36, 37, 37, 36,
+ 22, 34, 36, 26, 0, 84, 80, 18, 37, 36,
+ 0, 0, 25, 0, 36, 0, 0, 0, 37, 0,
+ 0, 23, 24, 27, 0, 19, 20
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
-1, 19, 20, 53, 140, 23, 24, 162, 163, 66,
- 25, 26, 137, 35, 125, 128, 28, 138, 37, 30,
- 46, 47, 31, 90, 132, 153, 32, 78
+ 25, 26, 137, 164, 35, 125, 128, 28, 138, 37,
+ 30, 46, 47, 31, 90, 132, 153, 32, 78
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -87
+#define YYPACT_NINF -84
static const yytype_int16 yypact[] =
{
- 126, -87, -87, -87, -43, 286, -87, -1, 88, -87,
- 16, 13, 51, 197, 17, 64, 197, 197, 197, 80,
- 33, 2, -87, -87, -87, 36, 45, 241, 274, -87,
- -87, -87, -87, 197, 197, 197, -87, 38, -87, 82,
- -87, 83, -87, 69, -87, 20, -7, -87, -87, -87,
- -87, 46, 197, -87, -3, 90, -87, -11, 130, 130,
- 250, -87, 126, 241, 197, 241, 70, 262, 197, 197,
- 197, 197, 197, 197, 197, 197, 197, 274, -18, -6,
- 48, 96, -87, -87, 100, -87, 108, 109, 95, -87,
- -87, -3, 113, -87, 197, 197, -87, -87, 73, 274,
- 74, 223, -9, 197, 274, 274, 274, 101, 101, 130,
- 130, 274, 274, -87, 197, -87, -87, -87, -87, -87,
- 118, -87, 274, 274, -87, 4, -87, 214, 170, 274,
- 274, -87, -29, 170, 107, 197, -87, 241, -87, -87,
- -87, 42, 75, 142, 140, 197, 274, -87, 127, -87,
- 139, 148, 153, -87, -87, 133, 274, -87, -87, 170,
- -87, 146, -87, 120, -87, 170, -87, -87, 170, 158,
- 241, 159, 148, 170, 166, 164, 152, 167, -87, 176,
- 161, -87, -87, -87, 162, -87, 170, -87, -87
+ 133, -84, -84, -84, -26, 273, -84, 22, 8, -84,
+ 43, 35, 79, 129, 47, 84, 129, 129, 129, 97,
+ 48, 15, -84, -84, -84, 49, 61, 161, 261, -84,
+ -84, -84, -84, 129, 129, 129, -84, 51, -84, 104,
+ -84, 105, -84, 90, -84, 6, 13, -84, -84, -84,
+ -84, 69, 129, -84, 65, 111, -84, -17, -9, -9,
+ 237, -84, 133, 161, 129, 161, 89, 249, 129, 129,
+ 129, 129, 129, 129, 129, 129, 129, 261, 23, 36,
+ 70, 116, -84, -84, 117, -84, 119, 120, 100, -84,
+ -84, 65, 125, -84, 129, 129, -84, -84, 92, 261,
+ 93, 219, -3, 129, 261, 261, 261, 198, 198, -9,
+ -9, 261, 261, -84, 129, -84, -84, -84, -84, -84,
+ 136, -84, 261, 261, -84, -12, -84, 223, 178, 261,
+ 261, -84, -1, 178, 112, 129, -84, 161, -84, -84,
+ -84, 63, 94, 138, 139, 129, 261, -84, 122, -84,
+ 140, 148, 157, -84, -84, 141, 261, -84, -84, 178,
+ -84, -84, -84, 148, 161, -84, 178, -84, -84, 178,
+ 156, 160, -84, 143, 178, 165, 168, 169, -84, 166,
+ 159, -84, -84, 178, 164, -84, -84
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -87, 134, -87, 14, 10, -87, -87, 25, -87, -62,
- -87, -87, 0, -86, -55, -70, -5, 15, -87, -87,
- -87, 157, -87, -87, -87, -87, -87, 50
+ -84, 131, -84, 7, 2, -84, -84, 37, -84, -57,
+ -84, -84, 9, -84, -74, -60, -83, -13, 10, -84,
+ -84, -84, 155, -84, -84, -84, -84, -84, 58
};
/* 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 -44
+#define YYTABLE_NINF -45
static const yytype_int16 yytable[] =
{
- 27, 98, -8, 100, 120, -36, -36, 33, 54, 36,
- 22, 58, 59, 60, 21, 29, 127, 134, 92, 41,
- 142, 43, 67, 94, 49, 143, 48, 88, 77, 77,
- 77, 85, 95, 113, 68, 69, 114, 86, 135, 70,
- -36, 71, 72, 73, 74, 115, 87, 91, 114, 75,
- 76, -8, 55, 56, 133, 151, 149, 150, 67, 99,
- 101, 50, 27, 104, 105, 106, 107, 108, 109, 110,
- 111, 112, 22, 141, 57, 148, 21, 29, 144, 159,
- 61, 147, 62, 165, 79, 80, 63, 168, 64, 122,
- 123, 157, 81, 82, 83, 84, 34, 173, 129, 38,
- 93, 167, 114, 102, 169, 39, 116, 171, 176, 130,
- 40, 117, 186, 174, 41, 42, 43, 44, 179, 118,
- 119, 87, 45, 121, 124, 126, -4, 1, 131, 152,
- 146, 188, 67, 2, 3, 4, 5, 136, 68, 69,
- 156, 145, 6, 70, 7, 8, 9, 73, 74, 10,
- 11, 12, 154, 75, 76, 155, 13, 14, 15, 160,
- 158, 170, 161, 164, 166, 67, 9, 68, 69, 172,
- 16, 17, 70, 175, 177, -4, 18, 2, 3, 4,
- 51, 180, 75, 76, 181, 182, 6, 183, 7, 8,
- 9, 184, 185, 187, 11, 12, 97, 178, 0, 0,
- 13, 14, 15, 89, 2, 3, 4, 51, 0, 0,
- 0, 0, 0, 0, 16, 17, 0, 0, 0, 139,
- 18, 2, 3, 4, 51, 0, 0, 52, 0, 15,
- 6, 0, 7, 8, 9, 0, 0, 0, 11, 12,
- 0, 16, 17, 0, 13, 14, 15, 18, 2, 3,
- 4, 51, 0, 0, 0, 0, 0, 0, 16, 17,
- 68, 69, 0, 0, 18, 70, 103, 71, 72, 73,
- 74, 52, 0, 15, 96, 75, 76, 0, 0, 0,
- 0, 0, 0, 0, 0, 16, 17, 68, 69, 0,
- 0, 65, 70, 0, 71, 72, 73, 74, 0, 68,
- 69, 96, 75, 76, 70, 103, 71, 72, 73, 74,
- 0, 68, 69, 0, 75, 76, 70, 0, 71, 72,
- 73, 74, 0, -43, -43, 0, 75, 76, -43, 0,
- 0, 0, -43, -43, 0, 0, 34, 0, -43, -43
+ 54, 134, 22, 58, 59, 60, 98, 21, 100, 27,
+ 29, -37, -37, -37, 67, -8, 120, 85, 94, 38,
+ 77, 77, 77, 135, 86, 33, 39, 95, 127, 68,
+ 69, 40, 36, 87, 70, 41, 42, 43, 44, 91,
+ 41, 133, 43, 45, 75, 76, 49, -37, 88, 142,
+ 67, 99, 101, 48, 143, 104, 105, 106, 107, 108,
+ 109, 110, 111, 112, 22, -8, 159, 151, 141, 21,
+ 166, 27, 29, 144, 169, 113, 147, 149, 114, 150,
+ 148, 122, 123, 55, 56, 174, 157, 92, 115, 50,
+ 129, 114, 79, 80, 57, 183, 168, 61, 62, 170,
+ 63, 130, 171, 68, 69, 64, 81, 173, 70, 175,
+ 71, 72, 73, 74, 179, 82, 83, 84, 75, 76,
+ 34, 93, 146, 102, 67, 114, 116, 87, 117, 136,
+ 118, 119, 156, -4, 1, 121, 2, 3, 4, 51,
+ 2, 3, 4, 5, 124, 126, 131, 145, 154, 152,
+ 6, 67, 7, 8, 9, 155, 158, 10, 11, 12,
+ 52, 160, 15, 161, 13, 14, 15, 165, 2, 3,
+ 4, 51, 176, 167, 16, 17, 177, 178, 16, 17,
+ 18, 180, 184, -4, 18, 2, 3, 4, 51, 181,
+ 182, 185, 52, 97, 15, 6, 186, 7, 8, 9,
+ 172, 89, 0, 11, 12, 0, 16, 17, 0, 13,
+ 14, 15, 65, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 17, 0, 0, 0, 139, 18,
+ 2, 3, 4, 51, 0, 0, 68, 69, 0, 0,
+ 6, 70, 7, 8, 9, 73, 74, 0, 11, 12,
+ 0, 75, 76, 0, 13, 14, 15, 68, 69, 0,
+ 0, 0, 70, 103, 71, 72, 73, 74, 16, 17,
+ 0, 96, 75, 76, 18, 68, 69, 0, 0, 0,
+ 70, 0, 71, 72, 73, 74, 0, 68, 69, 96,
+ 75, 76, 70, 103, 71, 72, 73, 74, 0, 68,
+ 69, 0, 75, 76, 70, 0, 71, 72, 73, 74,
+ 0, -44, -44, 0, 75, 76, -44, 0, 0, 0,
+ -44, -44, 0, 0, 34, 0, -44, -44
};
static const yytype_int16 yycheck[] =
{
- 0, 63, 0, 65, 90, 14, 15, 50, 13, 10,
- 0, 16, 17, 18, 0, 0, 102, 13, 21, 26,
- 49, 28, 27, 34, 11, 54, 10, 34, 33, 34,
- 35, 11, 43, 51, 37, 38, 54, 17, 34, 42,
- 49, 44, 45, 46, 47, 51, 26, 52, 54, 52,
- 53, 49, 35, 36, 124, 141, 14, 15, 63, 64,
- 65, 10, 62, 68, 69, 70, 71, 72, 73, 74,
- 75, 76, 62, 128, 10, 137, 62, 62, 133, 149,
- 0, 136, 49, 153, 34, 35, 50, 157, 43, 94,
- 95, 146, 54, 11, 11, 26, 50, 167, 103, 11,
- 10, 156, 54, 33, 159, 17, 10, 162, 170, 114,
- 22, 11, 182, 168, 26, 27, 28, 29, 173, 11,
- 11, 26, 34, 10, 51, 51, 0, 1, 10, 54,
- 135, 186, 137, 7, 8, 9, 10, 127, 37, 38,
- 145, 34, 16, 42, 18, 19, 20, 46, 47, 23,
- 24, 25, 10, 52, 53, 15, 30, 31, 32, 20,
- 33, 161, 14, 10, 31, 170, 20, 37, 38, 49,
- 44, 45, 42, 15, 15, 49, 50, 7, 8, 9,
- 10, 15, 52, 53, 20, 33, 16, 20, 18, 19,
- 20, 15, 31, 31, 24, 25, 62, 172, -1, -1,
- 30, 31, 32, 46, 7, 8, 9, 10, -1, -1,
- -1, -1, -1, -1, 44, 45, -1, -1, -1, 49,
- 50, 7, 8, 9, 10, -1, -1, 30, -1, 32,
- 16, -1, 18, 19, 20, -1, -1, -1, 24, 25,
- -1, 44, 45, -1, 30, 31, 32, 50, 7, 8,
- 9, 10, -1, -1, -1, -1, -1, -1, 44, 45,
- 37, 38, -1, -1, 50, 42, 43, 44, 45, 46,
- 47, 30, -1, 32, 51, 52, 53, -1, -1, -1,
- -1, -1, -1, -1, -1, 44, 45, 37, 38, -1,
- -1, 50, 42, -1, 44, 45, 46, 47, -1, 37,
- 38, 51, 52, 53, 42, 43, 44, 45, 46, 47,
- -1, 37, 38, -1, 52, 53, 42, -1, 44, 45,
- 46, 47, -1, 37, 38, -1, 52, 53, 42, -1,
- -1, -1, 46, 47, -1, -1, 50, -1, 52, 53
+ 13, 13, 0, 16, 17, 18, 63, 0, 65, 0,
+ 0, 14, 15, 16, 27, 0, 90, 11, 35, 11,
+ 33, 34, 35, 35, 18, 51, 18, 44, 102, 38,
+ 39, 23, 10, 27, 43, 27, 28, 29, 30, 52,
+ 27, 124, 29, 35, 53, 54, 11, 50, 35, 50,
+ 63, 64, 65, 10, 55, 68, 69, 70, 71, 72,
+ 73, 74, 75, 76, 62, 50, 149, 141, 128, 62,
+ 153, 62, 62, 133, 157, 52, 136, 14, 55, 16,
+ 137, 94, 95, 36, 37, 168, 146, 22, 52, 10,
+ 103, 55, 34, 35, 10, 178, 156, 0, 50, 159,
+ 51, 114, 162, 38, 39, 44, 55, 164, 43, 169,
+ 45, 46, 47, 48, 174, 11, 11, 27, 53, 54,
+ 51, 10, 135, 34, 137, 55, 10, 27, 11, 127,
+ 11, 11, 145, 0, 1, 10, 7, 8, 9, 10,
+ 7, 8, 9, 10, 52, 52, 10, 35, 10, 55,
+ 17, 164, 19, 20, 21, 16, 34, 24, 25, 26,
+ 31, 21, 33, 15, 31, 32, 33, 10, 7, 8,
+ 9, 10, 16, 32, 45, 46, 16, 34, 45, 46,
+ 51, 16, 16, 50, 51, 7, 8, 9, 10, 21,
+ 21, 32, 31, 62, 33, 17, 32, 19, 20, 21,
+ 163, 46, -1, 25, 26, -1, 45, 46, -1, 31,
+ 32, 33, 51, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 45, 46, -1, -1, -1, 50, 51,
+ 7, 8, 9, 10, -1, -1, 38, 39, -1, -1,
+ 17, 43, 19, 20, 21, 47, 48, -1, 25, 26,
+ -1, 53, 54, -1, 31, 32, 33, 38, 39, -1,
+ -1, -1, 43, 44, 45, 46, 47, 48, 45, 46,
+ -1, 52, 53, 54, 51, 38, 39, -1, -1, -1,
+ 43, -1, 45, 46, 47, 48, -1, 38, 39, 52,
+ 53, 54, 43, 44, 45, 46, 47, 48, -1, 38,
+ 39, -1, 53, 54, 43, -1, 45, 46, 47, 48,
+ -1, 38, 39, -1, 53, 54, 43, -1, -1, -1,
+ 47, 48, -1, -1, 51, -1, 53, 54
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 7, 8, 9, 10, 16, 18, 19, 20,
- 23, 24, 25, 30, 31, 32, 44, 45, 50, 56,
- 57, 58, 59, 60, 61, 65, 66, 67, 71, 72,
- 74, 77, 81, 50, 50, 68, 10, 73, 11, 17,
- 22, 26, 27, 28, 29, 34, 75, 76, 10, 11,
- 10, 10, 30, 58, 71, 35, 36, 10, 71, 71,
- 71, 0, 49, 50, 43, 50, 64, 71, 37, 38,
- 42, 44, 45, 46, 47, 52, 53, 71, 82, 82,
- 82, 54, 11, 11, 26, 11, 17, 26, 34, 76,
- 78, 71, 21, 10, 34, 43, 51, 56, 64, 71,
- 64, 71, 33, 43, 71, 71, 71, 71, 71, 71,
- 71, 71, 71, 51, 54, 51, 10, 11, 11, 11,
- 68, 10, 71, 71, 51, 69, 51, 68, 70, 71,
- 71, 10, 79, 70, 13, 34, 59, 67, 72, 49,
- 59, 69, 49, 54, 69, 34, 71, 69, 64, 14,
- 15, 68, 54, 80, 10, 15, 71, 69, 33, 70,
- 20, 14, 62, 63, 10, 70, 31, 69, 70, 69,
- 67, 69, 49, 70, 69, 15, 64, 15, 62, 69,
- 15, 20, 33, 20, 15, 31, 70, 31, 69
+ 0, 1, 7, 8, 9, 10, 17, 19, 20, 21,
+ 24, 25, 26, 31, 32, 33, 45, 46, 51, 57,
+ 58, 59, 60, 61, 62, 66, 67, 68, 73, 74,
+ 76, 79, 83, 51, 51, 70, 10, 75, 11, 18,
+ 23, 27, 28, 29, 30, 35, 77, 78, 10, 11,
+ 10, 10, 31, 59, 73, 36, 37, 10, 73, 73,
+ 73, 0, 50, 51, 44, 51, 65, 73, 38, 39,
+ 43, 45, 46, 47, 48, 53, 54, 73, 84, 84,
+ 84, 55, 11, 11, 27, 11, 18, 27, 35, 78,
+ 80, 73, 22, 10, 35, 44, 52, 57, 65, 73,
+ 65, 73, 34, 44, 73, 73, 73, 73, 73, 73,
+ 73, 73, 73, 52, 55, 52, 10, 11, 11, 11,
+ 70, 10, 73, 73, 52, 71, 52, 70, 72, 73,
+ 73, 10, 81, 72, 13, 35, 60, 68, 74, 50,
+ 60, 71, 50, 55, 71, 35, 73, 71, 65, 14,
+ 16, 70, 55, 82, 10, 16, 73, 71, 34, 72,
+ 21, 15, 63, 64, 69, 10, 72, 32, 71, 72,
+ 71, 71, 63, 65, 72, 71, 16, 16, 34, 71,
+ 16, 21, 21, 72, 16, 32, 32
};
#define yyerrok (yyerrstatus = 0)
@@ -1730,12 +1731,12 @@ yyreduce:
#line 210 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(5) - (6)].code));
- WRITE_UINT32(&else1, (yyvsp[(6) - (6)].code));
+ WRITE_UINT32(&then, (yyvsp[(4) - (4)].code));
+ WRITE_UINT32(&else1, 0);
WRITE_UINT32(&end, 0);
- (*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 3] = end; ;}
+ (*g_lingo->_currentScript)[(yyvsp[(2) - (4)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(2) - (4)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(2) - (4)].code) + 3] = end; ;}
break;
case 28:
@@ -1769,21 +1770,26 @@ yyreduce:
case 34:
#line 234 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->_currentScript->size(); ;}
+ { (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
case 35:
#line 236 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
+ { (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 36:
#line 238 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
+ break;
+
+ case 37:
+#line 240 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 39:
-#line 243 "engines/director/lingo/lingo-gr.y"
+ case 40:
+#line 245 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1791,15 +1797,15 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 40:
-#line 248 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 250 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
- case 41:
-#line 251 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 253 "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));
@@ -1808,8 +1814,8 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 42:
-#line 257 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 259 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1820,121 +1826,121 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 43:
-#line 265 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 267 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 45:
-#line 269 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 271 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 46:
-#line 270 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 272 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 47:
-#line 271 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 273 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 48:
-#line 272 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 274 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 49:
-#line 273 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 275 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 50:
-#line 274 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 276 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 51:
-#line 275 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 277 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 52:
-#line 276 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 278 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 53:
-#line 277 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 279 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 54:
-#line 278 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 280 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 55:
-#line 279 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 281 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 56:
-#line 280 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 282 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 57:
-#line 283 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 285 "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 58:
-#line 284 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 286 "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 59:
-#line 285 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 287 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 61:
-#line 287 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 289 "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 63:
-#line 292 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 294 "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 64:
-#line 293 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 295 "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 65:
-#line 304 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 306 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 66:
-#line 305 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 307 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 67:
-#line 306 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 308 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 68:
-#line 307 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 309 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1942,8 +1948,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 69:
-#line 312 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 314 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1952,8 +1958,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 70:
-#line 318 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 320 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1961,48 +1967,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 71:
-#line 325 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 327 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 72:
-#line 326 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 328 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 73:
-#line 327 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 329 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 74:
-#line 328 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 330 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 75:
-#line 331 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 333 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 76:
-#line 332 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 334 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 77:
-#line 333 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 335 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 78:
-#line 361 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 363 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 79:
-#line 362 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 364 "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);
@@ -2010,33 +2016,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 80:
-#line 368 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 370 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 81:
-#line 369 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 371 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 82:
-#line 370 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 372 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 83:
-#line 371 "engines/director/lingo/lingo-gr.y"
+ case 84:
+#line 373 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 84:
-#line 373 "engines/director/lingo/lingo-gr.y"
+ case 85:
+#line 375 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 85:
-#line 376 "engines/director/lingo/lingo-gr.y"
+ case 86:
+#line 378 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2045,24 +2051,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 86:
-#line 384 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 386 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 87:
-#line 385 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 387 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 88:
-#line 386 "engines/director/lingo/lingo-gr.y"
+ case 89:
+#line 388 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2066 "engines/director/lingo/lingo-gr.cpp"
+#line 2072 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2276,6 +2282,6 @@ yyreturn:
}
-#line 389 "engines/director/lingo/lingo-gr.y"
+#line 391 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 2aff182..4216ad6 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -51,34 +51,35 @@
HANDLER = 267,
tDOWN = 268,
tELSE = 269,
- tEND = 270,
- tEXIT = 271,
- tFRAME = 272,
- tGLOBAL = 273,
- tGO = 274,
- tIF = 275,
- tINTO = 276,
- tLOOP = 277,
- tMACRO = 278,
- tMCI = 279,
- tMCIWAIT = 280,
- tMOVIE = 281,
- tNEXT = 282,
- tOF = 283,
- tPREVIOUS = 284,
- tPUT = 285,
- tREPEAT = 286,
- tSET = 287,
- tTHEN = 288,
- tTO = 289,
- tWITH = 290,
- tWHILE = 291,
- tGE = 292,
- tLE = 293,
- tGT = 294,
- tLT = 295,
- tEQ = 296,
- tNEQ = 297
+ tELSIF = 270,
+ tEND = 271,
+ tEXIT = 272,
+ tFRAME = 273,
+ tGLOBAL = 274,
+ tGO = 275,
+ tIF = 276,
+ tINTO = 277,
+ tLOOP = 278,
+ tMACRO = 279,
+ tMCI = 280,
+ tMCIWAIT = 281,
+ tMOVIE = 282,
+ tNEXT = 283,
+ tOF = 284,
+ tPREVIOUS = 285,
+ tPUT = 286,
+ tREPEAT = 287,
+ tSET = 288,
+ tTHEN = 289,
+ tTO = 290,
+ tWITH = 291,
+ tWHILE = 292,
+ tGE = 293,
+ tLE = 294,
+ tGT = 295,
+ tLT = 296,
+ tEQ = 297,
+ tNEQ = 298
};
#endif
/* Tokens. */
@@ -94,34 +95,35 @@
#define HANDLER 267
#define tDOWN 268
#define tELSE 269
-#define tEND 270
-#define tEXIT 271
-#define tFRAME 272
-#define tGLOBAL 273
-#define tGO 274
-#define tIF 275
-#define tINTO 276
-#define tLOOP 277
-#define tMACRO 278
-#define tMCI 279
-#define tMCIWAIT 280
-#define tMOVIE 281
-#define tNEXT 282
-#define tOF 283
-#define tPREVIOUS 284
-#define tPUT 285
-#define tREPEAT 286
-#define tSET 287
-#define tTHEN 288
-#define tTO 289
-#define tWITH 290
-#define tWHILE 291
-#define tGE 292
-#define tLE 293
-#define tGT 294
-#define tLT 295
-#define tEQ 296
-#define tNEQ 297
+#define tELSIF 270
+#define tEND 271
+#define tEXIT 272
+#define tFRAME 273
+#define tGLOBAL 274
+#define tGO 275
+#define tIF 276
+#define tINTO 277
+#define tLOOP 278
+#define tMACRO 279
+#define tMCI 280
+#define tMCIWAIT 281
+#define tMOVIE 282
+#define tNEXT 283
+#define tOF 284
+#define tPREVIOUS 285
+#define tPUT 286
+#define tREPEAT 287
+#define tSET 288
+#define tTHEN 289
+#define tTO 290
+#define tWITH 291
+#define tWHILE 292
+#define tGE 293
+#define tLE 294
+#define tGT 295
+#define tLT 296
+#define tEQ 297
+#define tNEQ 298
@@ -137,7 +139,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 141 "engines/director/lingo/lingo-gr.hpp"
+#line 143 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index de153b9..35d589b 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -74,11 +74,11 @@ using namespace Director;
%token<i> INT
%token<f> FLOAT
%token<s> BLTIN ID STRING HANDLER
-%token tDOWN tELSE tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO tMCI tMCIWAIT
+%token tDOWN tELSE tELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO tMCI tMCIWAIT
%token tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO tWITH tWHILE
%token tGE tLE tGT tLT tEQ tNEQ
-%type<code> asgn begin cond end expr if repeatwhile repeatwith stmtlist
+%type<code> asgn begin cond elseif end expr if repeatwhile repeatwith stmtlist
%type<s> gotoframe gotomovie
%type<narg> argdef arglist
@@ -193,7 +193,7 @@ ifstmt: if cond tTHEN stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
- | if cond tTHEN stmtlist end begin elseif end tEND tIF {
+ | if cond tTHEN stmtlist end begin elseifstmt end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $4);
WRITE_UINT32(&else1, $6);
@@ -203,14 +203,14 @@ ifstmt: if cond tTHEN stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
;
-elseif: elseif1
- | elseif1 '\n' elseif
+elseifstmt: elseifstmt1 elseifstmt
+ | elseifstmt1
;
-elseif1: tELSE if cond tTHEN stmtlist end {
+elseifstmt1: elseif cond tTHEN stmtlist {
inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, $5);
- WRITE_UINT32(&else1, $6);
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&else1, 0);
WRITE_UINT32(&end, 0);
(*g_lingo->_currentScript)[$2 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$2 + 2] = else1; /* elsepart */
@@ -229,7 +229,9 @@ repeatwith: tREPEAT tWITH ID {
g_lingo->codeString($3->c_str());
delete $3; }
;
-if: tIF { $$ = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); }
+if: tIF { $$ = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); }
+ ;
+elseif: tELSIF { $$ = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); }
;
begin: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
;
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index bd84f79..bbe4275 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 38
-#define YY_END_OF_BUFFER 39
+#define YY_NUM_RULES 39
+#define YY_END_OF_BUFFER 40
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,21 +373,22 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[121] =
+static yyconst flex_int16_t yy_accept[124] =
{ 0,
- 0, 0, 39, 37, 3, 35, 35, 37, 37, 37,
- 34, 34, 33, 34, 34, 31, 31, 31, 31, 31,
- 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
- 2, 2, 3, 35, 0, 28, 0, 36, 1, 32,
- 33, 30, 29, 31, 31, 31, 31, 31, 31, 31,
- 11, 5, 31, 31, 31, 31, 31, 31, 19, 31,
- 31, 31, 31, 31, 25, 31, 31, 1, 32, 31,
- 31, 7, 31, 31, 31, 31, 31, 31, 15, 31,
- 31, 31, 21, 31, 23, 31, 31, 31, 4, 6,
- 8, 31, 31, 12, 13, 31, 31, 31, 18, 31,
-
- 31, 24, 31, 26, 9, 31, 14, 31, 17, 31,
- 31, 27, 10, 31, 31, 22, 16, 31, 20, 0
+ 0, 0, 40, 38, 3, 36, 36, 38, 38, 38,
+ 35, 35, 34, 35, 35, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 2, 2, 3, 36, 0, 29, 0, 37, 1, 33,
+ 34, 31, 30, 32, 32, 32, 32, 32, 32, 32,
+ 12, 5, 32, 32, 32, 32, 32, 32, 20, 32,
+ 32, 32, 32, 32, 26, 32, 32, 1, 33, 32,
+ 32, 8, 32, 32, 32, 32, 32, 32, 16, 32,
+ 32, 32, 22, 32, 24, 32, 32, 32, 4, 7,
+ 9, 32, 32, 13, 14, 32, 32, 32, 19, 32,
+
+ 32, 25, 32, 27, 0, 10, 32, 15, 32, 18,
+ 32, 32, 28, 0, 11, 32, 32, 23, 6, 17,
+ 32, 21, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -432,43 +433,43 @@ static yyconst flex_int32_t yy_meta[58] =
4, 4, 4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[124] =
+static yyconst flex_int16_t yy_base[127] =
{ 0,
- 0, 56, 244, 270, 60, 56, 63, 66, 230, 235,
- 270, 232, 62, 155, 145, 0, 46, 50, 46, 53,
+ 0, 56, 250, 287, 60, 56, 63, 66, 236, 241,
+ 287, 236, 62, 228, 203, 0, 46, 50, 46, 53,
62, 51, 75, 64, 64, 78, 68, 72, 93, 94,
- 123, 131, 141, 90, 145, 270, 116, 270, 0, 111,
- 108, 270, 270, 0, 45, 89, 112, 108, 125, 123,
+ 123, 131, 141, 90, 145, 287, 161, 287, 0, 147,
+ 108, 287, 287, 0, 45, 89, 112, 108, 125, 123,
0, 0, 122, 127, 139, 134, 125, 124, 0, 142,
- 131, 135, 133, 147, 0, 144, 137, 0, 77, 143,
+ 131, 135, 133, 147, 0, 144, 137, 0, 112, 143,
152, 0, 141, 148, 161, 154, 158, 162, 161, 174,
- 168, 167, 0, 179, 0, 175, 179, 183, 0, 0,
+ 168, 167, 0, 179, 0, 175, 179, 183, 0, 83,
0, 187, 192, 0, 0, 181, 195, 192, 0, 189,
- 199, 0, 196, 0, 0, 193, 0, 193, 0, 196,
- 194, 0, 0, 199, 202, 0, 0, 209, 0, 270,
- 261, 81, 265
+ 199, 0, 196, 0, 233, 0, 193, 0, 201, 0,
+ 198, 199, 0, 220, 0, 210, 210, 0, 287, 0,
+ 213, 0, 287, 278, 118, 282
} ;
-static yyconst flex_int16_t yy_def[124] =
+static yyconst flex_int16_t yy_def[127] =
{ 0,
- 120, 1, 120, 120, 120, 120, 120, 120, 120, 121,
- 120, 120, 120, 120, 120, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 120, 120, 120, 120, 120, 120, 121, 120, 123, 120,
- 120, 120, 120, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 123, 120, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
-
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
- 122, 122, 122, 122, 122, 122, 122, 122, 122, 0,
- 120, 120, 120
+ 123, 1, 123, 123, 123, 123, 123, 123, 123, 124,
+ 123, 123, 123, 123, 123, 125, 125, 125, 125, 125,
+ 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
+ 123, 123, 123, 123, 123, 123, 124, 123, 126, 123,
+ 123, 123, 123, 125, 125, 125, 125, 125, 125, 125,
+ 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
+ 125, 125, 125, 125, 125, 125, 125, 126, 123, 125,
+ 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
+ 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
+ 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
+
+ 125, 125, 125, 125, 123, 125, 125, 125, 125, 125,
+ 125, 125, 125, 123, 125, 125, 125, 125, 123, 125,
+ 125, 125, 0, 123, 123, 123
} ;
-static yyconst flex_int16_t yy_nxt[328] =
+static yyconst flex_int16_t yy_nxt[345] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
13, 14, 11, 15, 16, 16, 16, 17, 18, 19,
@@ -478,37 +479,39 @@ static yyconst flex_int16_t yy_nxt[328] =
27, 28, 29, 16, 16, 30, 16, 31, 34, 34,
32, 33, 34, 34, 35, 34, 34, 35, 34, 34,
35, 40, 41, 45, 46, 49, 47, 50, 54, 70,
- 51, 52, 58, 59, 44, 48, 62, 69, 53, 55,
+ 51, 52, 58, 59, 105, 48, 62, 105, 53, 55,
63, 56, 34, 34, 45, 46, 49, 47, 50, 54,
70, 51, 57, 52, 58, 59, 48, 60, 62, 53,
61, 55, 63, 56, 64, 66, 67, 40, 41, 71,
- 65, 69, 38, 57, 33, 34, 34, 35, 60, 72,
+ 65, 44, 69, 57, 33, 34, 34, 35, 60, 72,
73, 61, 35, 34, 34, 35, 64, 66, 67, 74,
71, 65, 33, 34, 34, 35, 35, 34, 34, 35,
- 75, 72, 73, 76, 77, 78, 79, 43, 80, 81,
- 82, 74, 83, 84, 85, 86, 87, 42, 88, 89,
+ 75, 72, 73, 76, 77, 78, 79, 69, 80, 81,
+ 82, 74, 83, 84, 85, 86, 87, 38, 88, 89,
90, 75, 91, 92, 76, 77, 93, 78, 79, 80,
81, 94, 82, 83, 84, 85, 95, 86, 87, 88,
89, 96, 90, 91, 92, 97, 98, 101, 93, 99,
- 100, 102, 94, 103, 104, 105, 106, 95, 107, 108,
- 109, 110, 96, 111, 112, 114, 97, 113, 98, 101,
- 99, 100, 102, 115, 103, 116, 104, 105, 106, 107,
- 117, 108, 109, 110, 118, 111, 112, 114, 113, 119,
- 39, 38, 36, 120, 115, 120, 116, 120, 120, 120,
- 120, 117, 120, 120, 120, 118, 120, 120, 120, 120,
- 119, 37, 120, 37, 37, 68, 120, 120, 68, 3,
- 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
- 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
- 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-
- 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
- 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
- 120, 120, 120, 120, 120, 120, 120
+ 100, 102, 94, 103, 104, 106, 107, 95, 108, 109,
+ 110, 111, 96, 112, 113, 43, 97, 115, 98, 101,
+ 99, 100, 102, 116, 103, 117, 104, 106, 107, 108,
+ 118, 109, 110, 111, 105, 112, 113, 105, 115, 119,
+ 42, 120, 121, 122, 39, 116, 117, 38, 36, 123,
+ 123, 118, 123, 123, 123, 114, 123, 123, 123, 123,
+ 123, 119, 120, 121, 122, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 114, 37, 123,
+ 37, 37, 68, 123, 123, 68, 3, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123
} ;
-static yyconst flex_int16_t yy_chk[328] =
+static yyconst flex_int16_t yy_chk[345] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -518,34 +521,36 @@ static yyconst flex_int16_t yy_chk[328] =
1, 1, 1, 1, 1, 1, 1, 2, 6, 6,
2, 5, 5, 5, 5, 7, 7, 8, 8, 8,
8, 13, 13, 17, 18, 19, 18, 20, 22, 45,
- 20, 21, 24, 25, 122, 18, 27, 69, 21, 23,
+ 20, 21, 24, 25, 90, 18, 27, 90, 21, 23,
28, 23, 34, 34, 17, 18, 19, 18, 20, 22,
45, 20, 23, 21, 24, 25, 18, 26, 27, 21,
26, 23, 28, 23, 29, 30, 30, 41, 41, 46,
- 29, 40, 37, 23, 31, 31, 31, 31, 26, 47,
+ 29, 125, 69, 23, 31, 31, 31, 31, 26, 47,
48, 26, 32, 32, 32, 32, 29, 30, 30, 49,
46, 29, 33, 33, 33, 33, 35, 35, 35, 35,
- 50, 47, 48, 53, 54, 55, 56, 15, 57, 58,
- 60, 49, 61, 62, 63, 64, 66, 14, 67, 70,
+ 50, 47, 48, 53, 54, 55, 56, 40, 57, 58,
+ 60, 49, 61, 62, 63, 64, 66, 37, 67, 70,
71, 50, 73, 74, 53, 54, 75, 55, 56, 57,
58, 76, 60, 61, 62, 63, 77, 64, 66, 67,
70, 78, 71, 73, 74, 79, 80, 84, 75, 81,
82, 86, 76, 87, 88, 92, 93, 77, 96, 97,
- 98, 100, 78, 101, 103, 108, 79, 106, 80, 84,
- 81, 82, 86, 110, 87, 111, 88, 92, 93, 96,
- 114, 97, 98, 100, 115, 101, 103, 108, 106, 118,
- 12, 10, 9, 3, 110, 0, 111, 0, 0, 0,
- 0, 114, 0, 0, 0, 115, 0, 0, 0, 0,
- 118, 121, 0, 121, 121, 123, 0, 0, 123, 120,
- 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
- 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
- 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
-
- 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
- 120, 120, 120, 120, 120, 120, 120, 120, 120, 120,
- 120, 120, 120, 120, 120, 120, 120
+ 98, 100, 78, 101, 103, 15, 79, 107, 80, 84,
+ 81, 82, 86, 109, 87, 111, 88, 92, 93, 96,
+ 112, 97, 98, 100, 105, 101, 103, 105, 107, 114,
+ 14, 116, 117, 121, 12, 109, 111, 10, 9, 3,
+ 0, 112, 0, 0, 0, 105, 0, 0, 0, 0,
+ 0, 114, 116, 117, 121, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 105, 124, 0,
+ 124, 124, 126, 0, 0, 126, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123
} ;
static yy_state_type yy_last_accepting_state;
@@ -595,7 +600,7 @@ char *yytext;
int yyparse();
-#line 599 "engines/director/lingo/lingo-lex.cpp"
+#line 604 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -783,7 +788,7 @@ YY_DECL
#line 45 "engines/director/lingo/lingo-lex.l"
-#line 787 "engines/director/lingo/lingo-lex.cpp"
+#line 792 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -837,13 +842,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 >= 121 )
+ if ( yy_current_state >= 124 )
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] != 270 );
+ while ( yy_base[yy_current_state] != 287 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -895,131 +900,136 @@ YY_RULE_SETUP
case 6:
YY_RULE_SETUP
#line 53 "engines/director/lingo/lingo-lex.l"
-{ return tELSE; }
+{ return tELSIF; }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 54 "engines/director/lingo/lingo-lex.l"
-{ return tEND; }
+{ return tELSE; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 55 "engines/director/lingo/lingo-lex.l"
-{ return tEXIT; }
+{ return tEND; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 56 "engines/director/lingo/lingo-lex.l"
-{ return tFRAME; }
+{ return tEXIT; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 57 "engines/director/lingo/lingo-lex.l"
-{ return tGLOBAL; }
+{ return tFRAME; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 58 "engines/director/lingo/lingo-lex.l"
-{ return tGO; }
+{ return tGLOBAL; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 59 "engines/director/lingo/lingo-lex.l"
-{ return tINTO; }
+{ return tGO; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 60 "engines/director/lingo/lingo-lex.l"
-{ return tLOOP; }
+{ return tINTO; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 61 "engines/director/lingo/lingo-lex.l"
-{ return tMACRO; }
+{ return tLOOP; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 62 "engines/director/lingo/lingo-lex.l"
-{ return tMCI; }
+{ return tMACRO; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 63 "engines/director/lingo/lingo-lex.l"
-{ return tMCIWAIT; }
+{ return tMCI; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 64 "engines/director/lingo/lingo-lex.l"
-{ return tMOVIE; }
+{ return tMCIWAIT; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 65 "engines/director/lingo/lingo-lex.l"
-{ return tNEXT; }
+{ return tMOVIE; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 66 "engines/director/lingo/lingo-lex.l"
-{ return tOF; }
+{ return tNEXT; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 67 "engines/director/lingo/lingo-lex.l"
-{ return tPREVIOUS; }
+{ return tOF; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 68 "engines/director/lingo/lingo-lex.l"
-{ return tPUT; }
+{ return tPREVIOUS; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 69 "engines/director/lingo/lingo-lex.l"
-{ return tREPEAT; }
+{ return tPUT; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 70 "engines/director/lingo/lingo-lex.l"
-{ return tSET; }
+{ return tREPEAT; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 71 "engines/director/lingo/lingo-lex.l"
-{ return tTHEN; }
+{ return tSET; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 72 "engines/director/lingo/lingo-lex.l"
-{ return tTO; }
+{ return tTHEN; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 73 "engines/director/lingo/lingo-lex.l"
-{ return tWITH; }
+{ return tTO; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 74 "engines/director/lingo/lingo-lex.l"
-{ return tWHILE; }
+{ return tWITH; }
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 76 "engines/director/lingo/lingo-lex.l"
-{ return tNEQ; }
+#line 75 "engines/director/lingo/lingo-lex.l"
+{ return tWHILE; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 77 "engines/director/lingo/lingo-lex.l"
-{ return tGE; }
+{ return tNEQ; }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 78 "engines/director/lingo/lingo-lex.l"
-{ return tLE; }
+{ return tGE; }
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 80 "engines/director/lingo/lingo-lex.l"
+#line 79 "engines/director/lingo/lingo-lex.l"
+{ return tLE; }
+ YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 81 "engines/director/lingo/lingo-lex.l"
{
yylval.s = new Common::String(yytext);
@@ -1029,43 +1039,43 @@ YY_RULE_SETUP
return ID;
}
YY_BREAK
-case 32:
-YY_RULE_SETUP
-#line 88 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
- YY_BREAK
case 33:
YY_RULE_SETUP
#line 89 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 34:
YY_RULE_SETUP
#line 90 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 35:
-/* rule 35 can match eol */
YY_RULE_SETUP
#line 91 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ return *yytext; }
YY_BREAK
case 36:
+/* rule 36 can match eol */
YY_RULE_SETUP
#line 92 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return '\n'; }
YY_BREAK
case 37:
YY_RULE_SETUP
#line 93 "engines/director/lingo/lingo-lex.l"
-
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 95 "engines/director/lingo/lingo-lex.l"
+#line 94 "engines/director/lingo/lingo-lex.l"
+
+ YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 96 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1069 "engines/director/lingo/lingo-lex.cpp"
+#line 1079 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1358,7 +1368,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 >= 121 )
+ if ( yy_current_state >= 124 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1386,11 +1396,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 >= 121 )
+ if ( yy_current_state >= 124 )
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 == 120);
+ yy_is_jam = (yy_current_state == 123);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2065,7 +2075,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 95 "engines/director/lingo/lingo-lex.l"
+#line 96 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 6144bba..2580f4f 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -50,6 +50,7 @@ whitespace [\t ]
(?i:down) { return tDOWN; }
(?i:if) { return tIF; }
+(?i:else[\t ]+if) { return tELSIF; }
(?i:else) { return tELSE; }
(?i:end) { return tEND; }
(?i:exit) { return tEXIT; }
Commit: 05f89c2a1b8f0ce5c068725059d50a0a60a3709c
https://github.com/scummvm/scummvm/commit/05f89c2a1b8f0ce5c068725059d50a0a60a3709c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Parsing one-liner 'else if'
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 4398f2b..e85c01e 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -98,8 +98,7 @@ Common::Error DirectorEngine::run() {
exit\n\
else if 6 then\n\
exit\n\
- else if 7 then\n\
- exit\n\
+ else if 7 then exit\n\
end if\n\
", kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 5d3bcd6..d45fabd 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -430,16 +430,16 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 61
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 327
+#define YYLAST 354
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 56
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 29
/* YYNRULES -- Number of rules. */
-#define YYNRULES 89
+#define YYNRULES 90
/* YYNRULES -- Number of states. */
-#define YYNSTATES 187
+#define YYNSTATES 190
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -490,13 +490,14 @@ static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
20, 22, 24, 29, 34, 39, 41, 43, 45, 54,
- 66, 79, 86, 94, 105, 116, 119, 121, 126, 128,
- 132, 136, 139, 143, 145, 147, 148, 149, 150, 153,
- 156, 158, 160, 165, 170, 172, 174, 178, 182, 186,
- 190, 194, 198, 202, 206, 210, 213, 216, 220, 223,
- 226, 229, 231, 233, 236, 238, 242, 245, 248, 251,
- 254, 258, 261, 265, 268, 271, 273, 277, 280, 284,
- 285, 294, 295, 297, 301, 306, 307, 311, 312, 314
+ 66, 79, 86, 94, 105, 116, 119, 121, 128, 133,
+ 135, 139, 143, 146, 150, 152, 154, 155, 156, 157,
+ 160, 163, 165, 167, 172, 177, 179, 181, 185, 189,
+ 193, 197, 201, 205, 209, 213, 217, 220, 223, 227,
+ 230, 233, 236, 238, 240, 243, 245, 249, 252, 255,
+ 258, 261, 265, 268, 272, 275, 278, 280, 284, 287,
+ 291, 292, 301, 302, 304, 308, 313, 314, 318, 319,
+ 321
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -514,26 +515,27 @@ static const yytype_int8 yyrhs[] =
71, 16, 21, -1, 68, 65, 34, 72, 71, 14,
72, 71, 16, 21, -1, 68, 65, 34, 72, 71,
70, 63, 71, 16, 21, -1, 64, 63, -1, 64,
- -1, 69, 65, 34, 72, -1, 73, -1, 73, 44,
- 73, -1, 51, 65, 52, -1, 32, 37, -1, 32,
- 36, 10, -1, 21, -1, 15, -1, -1, -1, -1,
- 72, 50, -1, 72, 60, -1, 7, -1, 8, -1,
- 9, 51, 84, 52, -1, 10, 51, 84, 52, -1,
- 10, -1, 59, -1, 73, 45, 73, -1, 73, 46,
- 73, -1, 73, 47, 73, -1, 73, 48, 73, -1,
- 73, 53, 73, -1, 73, 54, 73, -1, 73, 43,
- 73, -1, 73, 38, 73, -1, 73, 39, 73, -1,
- 45, 73, -1, 46, 73, -1, 51, 73, 52, -1,
- 25, 11, -1, 26, 10, -1, 31, 73, -1, 76,
- -1, 17, -1, 19, 75, -1, 10, -1, 75, 55,
- 10, -1, 20, 23, -1, 20, 28, -1, 20, 30,
- -1, 20, 77, -1, 20, 77, 78, -1, 20, 78,
- -1, 35, 18, 11, -1, 18, 11, -1, 35, 11,
- -1, 11, -1, 29, 27, 11, -1, 27, 11, -1,
- 35, 27, 11, -1, -1, 24, 10, 80, 70, 81,
- 50, 82, 72, -1, -1, 10, -1, 81, 55, 10,
- -1, 81, 50, 55, 10, -1, -1, 10, 70, 84,
- -1, -1, 73, -1, 84, 55, 73, -1
+ -1, 69, 65, 34, 70, 60, 50, -1, 69, 65,
+ 34, 72, -1, 73, -1, 73, 44, 73, -1, 51,
+ 65, 52, -1, 32, 37, -1, 32, 36, 10, -1,
+ 21, -1, 15, -1, -1, -1, -1, 72, 50, -1,
+ 72, 60, -1, 7, -1, 8, -1, 9, 51, 84,
+ 52, -1, 10, 51, 84, 52, -1, 10, -1, 59,
+ -1, 73, 45, 73, -1, 73, 46, 73, -1, 73,
+ 47, 73, -1, 73, 48, 73, -1, 73, 53, 73,
+ -1, 73, 54, 73, -1, 73, 43, 73, -1, 73,
+ 38, 73, -1, 73, 39, 73, -1, 45, 73, -1,
+ 46, 73, -1, 51, 73, 52, -1, 25, 11, -1,
+ 26, 10, -1, 31, 73, -1, 76, -1, 17, -1,
+ 19, 75, -1, 10, -1, 75, 55, 10, -1, 20,
+ 23, -1, 20, 28, -1, 20, 30, -1, 20, 77,
+ -1, 20, 77, 78, -1, 20, 78, -1, 35, 18,
+ 11, -1, 18, 11, -1, 35, 11, -1, 11, -1,
+ 29, 27, 11, -1, 27, 11, -1, 35, 27, 11,
+ -1, -1, 24, 10, 80, 70, 81, 50, 82, 72,
+ -1, -1, 10, -1, 81, 55, 10, -1, 81, 50,
+ 55, 10, -1, -1, 10, 70, 84, -1, -1, 73,
+ -1, 84, 55, 73, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -541,13 +543,14 @@ static const yytype_uint16 yyrline[] =
{
0, 92, 92, 93, 96, 97, 98, 99, 100, 101,
102, 103, 106, 112, 118, 126, 127, 128, 133, 144,
- 160, 174, 182, 188, 196, 206, 207, 210, 220, 221,
- 222, 224, 226, 232, 234, 236, 238, 240, 241, 242,
- 245, 250, 253, 259, 267, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 279, 280, 281, 282, 285, 286,
- 287, 288, 289, 291, 294, 295, 306, 307, 308, 309,
- 314, 320, 327, 328, 329, 330, 333, 334, 335, 363,
- 363, 370, 371, 372, 373, 375, 378, 386, 387, 388
+ 160, 174, 182, 188, 196, 206, 207, 210, 218, 229,
+ 230, 231, 233, 235, 241, 243, 245, 247, 249, 250,
+ 251, 254, 259, 262, 268, 276, 279, 280, 281, 282,
+ 283, 284, 285, 286, 287, 288, 289, 290, 291, 294,
+ 295, 296, 297, 298, 300, 303, 304, 315, 316, 317,
+ 318, 323, 329, 336, 337, 338, 339, 342, 343, 344,
+ 372, 372, 379, 380, 381, 382, 384, 387, 395, 396,
+ 397
};
#endif
@@ -590,13 +593,14 @@ static const yytype_uint8 yyr1[] =
{
0, 56, 57, 57, 58, 58, 58, 58, 58, 58,
58, 58, 59, 59, 59, 60, 60, 60, 60, 60,
- 60, 61, 62, 62, 62, 63, 63, 64, 65, 65,
- 65, 66, 67, 68, 69, 70, 71, 72, 72, 72,
- 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 73, 74, 74,
- 74, 74, 74, 74, 75, 75, 76, 76, 76, 76,
- 76, 76, 77, 77, 77, 77, 78, 78, 78, 80,
- 79, 81, 81, 81, 81, 82, 83, 84, 84, 84
+ 60, 61, 62, 62, 62, 63, 63, 64, 64, 65,
+ 65, 65, 66, 67, 68, 69, 70, 71, 72, 72,
+ 72, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 74,
+ 74, 74, 74, 74, 74, 75, 75, 76, 76, 76,
+ 76, 76, 76, 77, 77, 77, 77, 78, 78, 78,
+ 80, 79, 81, 81, 81, 81, 82, 83, 84, 84,
+ 84
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -604,13 +608,14 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
1, 1, 4, 4, 4, 1, 1, 1, 8, 11,
- 12, 6, 7, 10, 10, 2, 1, 4, 1, 3,
- 3, 2, 3, 1, 1, 0, 0, 0, 2, 2,
- 1, 1, 4, 4, 1, 1, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 2, 2, 3, 2, 2,
- 2, 1, 1, 2, 1, 3, 2, 2, 2, 2,
- 3, 2, 3, 2, 2, 1, 3, 2, 3, 0,
- 8, 0, 1, 3, 4, 0, 3, 0, 1, 3
+ 12, 6, 7, 10, 10, 2, 1, 6, 4, 1,
+ 3, 3, 2, 3, 1, 1, 0, 0, 0, 2,
+ 2, 1, 1, 4, 4, 1, 1, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 2, 2, 3, 2,
+ 2, 2, 1, 1, 2, 1, 3, 2, 2, 2,
+ 2, 3, 2, 3, 2, 2, 1, 3, 2, 3,
+ 0, 8, 0, 1, 3, 4, 0, 3, 0, 1,
+ 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -618,25 +623,25 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 40, 41, 0, 35, 62, 0, 0, 33,
+ 0, 11, 41, 42, 0, 36, 63, 0, 0, 34,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 3, 45, 10, 9, 17, 0, 0, 0, 15, 6,
- 61, 5, 7, 87, 87, 87, 64, 63, 75, 0,
- 66, 0, 67, 0, 68, 0, 69, 71, 79, 58,
- 59, 44, 0, 45, 60, 0, 31, 0, 55, 56,
- 0, 1, 0, 0, 0, 0, 0, 28, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 88, 0, 0,
- 86, 0, 73, 77, 0, 74, 0, 0, 0, 70,
- 35, 0, 0, 32, 0, 0, 57, 2, 0, 36,
- 0, 0, 35, 0, 53, 54, 52, 46, 47, 48,
- 49, 50, 51, 42, 0, 43, 65, 76, 72, 78,
- 81, 12, 14, 13, 37, 0, 30, 0, 36, 29,
- 89, 82, 0, 36, 0, 0, 36, 0, 16, 38,
- 39, 35, 85, 0, 0, 0, 36, 21, 0, 37,
- 0, 0, 0, 37, 83, 0, 36, 37, 37, 36,
- 22, 34, 36, 26, 0, 84, 80, 18, 37, 36,
- 0, 0, 25, 0, 36, 0, 0, 0, 37, 0,
- 0, 23, 24, 27, 0, 19, 20
+ 3, 46, 10, 9, 17, 0, 0, 0, 15, 6,
+ 62, 5, 7, 88, 88, 88, 65, 64, 76, 0,
+ 67, 0, 68, 0, 69, 0, 70, 72, 80, 59,
+ 60, 45, 0, 46, 61, 0, 32, 0, 56, 57,
+ 0, 1, 0, 0, 0, 0, 0, 29, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 89, 0, 0,
+ 87, 0, 74, 78, 0, 75, 0, 0, 0, 71,
+ 36, 0, 0, 33, 0, 0, 58, 2, 0, 37,
+ 0, 0, 36, 0, 54, 55, 53, 47, 48, 49,
+ 50, 51, 52, 43, 0, 44, 66, 77, 73, 79,
+ 82, 12, 14, 13, 38, 0, 31, 0, 37, 30,
+ 90, 83, 0, 37, 0, 0, 37, 0, 16, 39,
+ 40, 36, 86, 0, 0, 0, 37, 21, 0, 38,
+ 0, 0, 0, 38, 84, 0, 37, 38, 38, 37,
+ 22, 35, 37, 26, 0, 85, 81, 18, 38, 37,
+ 0, 0, 25, 0, 37, 0, 0, 0, 36, 0,
+ 0, 23, 24, 0, 28, 0, 19, 0, 20, 27
};
/* YYDEFGOTO[NTERM-NUM]. */
@@ -649,115 +654,121 @@ static const yytype_int16 yydefgoto[] =
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -84
+#define YYPACT_NINF -123
static const yytype_int16 yypact[] =
{
- 133, -84, -84, -84, -26, 273, -84, 22, 8, -84,
- 43, 35, 79, 129, 47, 84, 129, 129, 129, 97,
- 48, 15, -84, -84, -84, 49, 61, 161, 261, -84,
- -84, -84, -84, 129, 129, 129, -84, 51, -84, 104,
- -84, 105, -84, 90, -84, 6, 13, -84, -84, -84,
- -84, 69, 129, -84, 65, 111, -84, -17, -9, -9,
- 237, -84, 133, 161, 129, 161, 89, 249, 129, 129,
- 129, 129, 129, 129, 129, 129, 129, 261, 23, 36,
- 70, 116, -84, -84, 117, -84, 119, 120, 100, -84,
- -84, 65, 125, -84, 129, 129, -84, -84, 92, 261,
- 93, 219, -3, 129, 261, 261, 261, 198, 198, -9,
- -9, 261, 261, -84, 129, -84, -84, -84, -84, -84,
- 136, -84, 261, 261, -84, -12, -84, 223, 178, 261,
- 261, -84, -1, 178, 112, 129, -84, 161, -84, -84,
- -84, 63, 94, 138, 139, 129, 261, -84, 122, -84,
- 140, 148, 157, -84, -84, 141, 261, -84, -84, 178,
- -84, -84, -84, 148, 161, -84, 178, -84, -84, 178,
- 156, 160, -84, 143, 178, 165, 168, 169, -84, 166,
- 159, -84, -84, 178, 164, -84, -84
+ 136, -123, -123, -123, -42, 283, -123, 24, 193, -123,
+ 35, 27, 44, 75, 13, 51, 75, 75, 75, 74,
+ 37, 7, -123, -123, -123, 46, 55, 164, 271, -123,
+ -123, -123, -123, 75, 75, 75, -123, 40, -123, 89,
+ -123, 92, -123, 78, -123, 21, 59, -123, -123, -123,
+ -123, 60, 75, -123, 222, 100, -123, -11, -2, -2,
+ 247, -123, 136, 164, 75, 164, 79, 259, 75, 75,
+ 75, 75, 75, 75, 75, 75, 75, 271, -29, 41,
+ 57, 105, -123, -123, 106, -123, 107, 111, 96, -123,
+ -123, 222, 114, -123, 75, 75, -123, -123, 64, 271,
+ 73, 235, 3, 75, 271, 271, 271, 300, 300, -2,
+ -2, 271, 271, -123, 75, -123, -123, -123, -123, -123,
+ 118, -123, 271, 271, -123, 8, -123, 226, 181, 271,
+ 271, -123, -30, 181, 94, 75, -123, 164, -123, -123,
+ -123, 28, 76, 123, 119, 75, 271, -123, 104, -123,
+ 113, 124, 131, -123, -123, 110, 271, -123, -123, 181,
+ -123, -123, -123, 124, 164, -123, 181, -123, -123, 181,
+ 132, 133, -123, 116, 181, 135, 126, 137, -10, 138,
+ 120, -123, -123, 226, 181, 134, -123, 115, -123, -123
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -84, 131, -84, 7, 2, -84, -84, 37, -84, -57,
- -84, -84, 9, -84, -74, -60, -83, -13, 10, -84,
- -84, -84, 155, -84, -84, -84, -84, -84, 58
+ -123, 101, -123, 10, 0, -123, -123, 1, -123, -62,
+ -123, -123, 14, -123, -86, -55, -122, -5, 15, -123,
+ -123, -123, 129, -123, -123, -123, -123, -123, 45
};
/* 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 -45
+#define YYTABLE_NINF -46
static const yytype_int16 yytable[] =
{
- 54, 134, 22, 58, 59, 60, 98, 21, 100, 27,
- 29, -37, -37, -37, 67, -8, 120, 85, 94, 38,
- 77, 77, 77, 135, 86, 33, 39, 95, 127, 68,
- 69, 40, 36, 87, 70, 41, 42, 43, 44, 91,
- 41, 133, 43, 45, 75, 76, 49, -37, 88, 142,
- 67, 99, 101, 48, 143, 104, 105, 106, 107, 108,
- 109, 110, 111, 112, 22, -8, 159, 151, 141, 21,
- 166, 27, 29, 144, 169, 113, 147, 149, 114, 150,
- 148, 122, 123, 55, 56, 174, 157, 92, 115, 50,
- 129, 114, 79, 80, 57, 183, 168, 61, 62, 170,
- 63, 130, 171, 68, 69, 64, 81, 173, 70, 175,
- 71, 72, 73, 74, 179, 82, 83, 84, 75, 76,
- 34, 93, 146, 102, 67, 114, 116, 87, 117, 136,
- 118, 119, 156, -4, 1, 121, 2, 3, 4, 51,
- 2, 3, 4, 5, 124, 126, 131, 145, 154, 152,
- 6, 67, 7, 8, 9, 155, 158, 10, 11, 12,
- 52, 160, 15, 161, 13, 14, 15, 165, 2, 3,
- 4, 51, 176, 167, 16, 17, 177, 178, 16, 17,
- 18, 180, 184, -4, 18, 2, 3, 4, 51, 181,
- 182, 185, 52, 97, 15, 6, 186, 7, 8, 9,
- 172, 89, 0, 11, 12, 0, 16, 17, 0, 13,
- 14, 15, 65, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 16, 17, 0, 0, 0, 139, 18,
- 2, 3, 4, 51, 0, 0, 68, 69, 0, 0,
- 6, 70, 7, 8, 9, 73, 74, 0, 11, 12,
- 0, 75, 76, 0, 13, 14, 15, 68, 69, 0,
- 0, 0, 70, 103, 71, 72, 73, 74, 16, 17,
- 0, 96, 75, 76, 18, 68, 69, 0, 0, 0,
+ 22, 98, 133, 100, 120, -38, -38, -8, 54, 33,
+ 21, 58, 59, 60, 27, 29, 127, -38, -38, -38,
+ 142, 134, 67, 113, 94, 143, 114, 159, 77, 77,
+ 77, 166, 85, 95, 36, 169, 68, 69, 49, 86,
+ -38, 70, 149, 135, 150, 48, 174, 91, 87, 55,
+ 56, 75, 76, -38, 50, 151, 184, -8, 67, 99,
+ 101, 57, 22, 104, 105, 106, 107, 108, 109, 110,
+ 111, 112, 21, 141, 61, 148, 27, 29, 144, 79,
+ 80, 147, 2, 3, 4, 51, 41, 62, 43, 122,
+ 123, 157, 183, 115, 88, 81, 114, 63, 129, 64,
+ 82, 168, 173, 83, 170, 84, 52, 171, 15, 130,
+ 93, 34, 114, 102, 175, 116, 124, 117, 118, 179,
+ 16, 17, 119, 87, 121, 126, 18, 136, 131, 145,
+ 146, 152, 67, 154, 160, 155, -4, 1, 158, 161,
+ 156, 165, 167, 2, 3, 4, 5, 181, 176, 177,
+ 178, 180, 186, 6, 185, 7, 8, 9, 182, 67,
+ 10, 11, 12, 97, 172, 189, 188, 13, 14, 15,
+ 0, 2, 3, 4, 51, 89, 0, 0, 0, 0,
+ 0, 16, 17, 187, 0, 0, -4, 18, 2, 3,
+ 4, 51, 0, 0, 0, 52, 0, 15, 6, 0,
+ 7, 8, 9, 0, 38, 0, 11, 12, 0, 16,
+ 17, 39, 13, 14, 15, 65, 40, 0, 0, 0,
+ 41, 42, 43, 44, 0, 0, 16, 17, 45, 0,
+ 0, 139, 18, 2, 3, 4, 51, 0, 0, 0,
+ 0, 0, 0, 6, 92, 7, 8, 9, 0, 0,
+ 0, 11, 12, 0, 0, 0, 0, 13, 14, 15,
+ 68, 69, 0, 0, 0, 70, 0, 71, 72, 73,
+ 74, 16, 17, 68, 69, 75, 76, 18, 70, 103,
+ 71, 72, 73, 74, 0, 68, 69, 96, 75, 76,
70, 0, 71, 72, 73, 74, 0, 68, 69, 96,
75, 76, 70, 103, 71, 72, 73, 74, 0, 68,
69, 0, 75, 76, 70, 0, 71, 72, 73, 74,
- 0, -44, -44, 0, 75, 76, -44, 0, 0, 0,
- -44, -44, 0, 0, 34, 0, -44, -44
+ 0, -45, -45, 0, 75, 76, -45, 0, 0, 0,
+ -45, -45, 0, 0, 34, 0, -45, -45, 68, 69,
+ 0, 0, 0, 70, 0, 0, 0, 73, 74, 0,
+ 0, 0, 0, 75, 76
};
static const yytype_int16 yycheck[] =
{
- 13, 13, 0, 16, 17, 18, 63, 0, 65, 0,
- 0, 14, 15, 16, 27, 0, 90, 11, 35, 11,
- 33, 34, 35, 35, 18, 51, 18, 44, 102, 38,
- 39, 23, 10, 27, 43, 27, 28, 29, 30, 52,
- 27, 124, 29, 35, 53, 54, 11, 50, 35, 50,
- 63, 64, 65, 10, 55, 68, 69, 70, 71, 72,
- 73, 74, 75, 76, 62, 50, 149, 141, 128, 62,
- 153, 62, 62, 133, 157, 52, 136, 14, 55, 16,
- 137, 94, 95, 36, 37, 168, 146, 22, 52, 10,
- 103, 55, 34, 35, 10, 178, 156, 0, 50, 159,
- 51, 114, 162, 38, 39, 44, 55, 164, 43, 169,
- 45, 46, 47, 48, 174, 11, 11, 27, 53, 54,
- 51, 10, 135, 34, 137, 55, 10, 27, 11, 127,
- 11, 11, 145, 0, 1, 10, 7, 8, 9, 10,
- 7, 8, 9, 10, 52, 52, 10, 35, 10, 55,
- 17, 164, 19, 20, 21, 16, 34, 24, 25, 26,
- 31, 21, 33, 15, 31, 32, 33, 10, 7, 8,
- 9, 10, 16, 32, 45, 46, 16, 34, 45, 46,
- 51, 16, 16, 50, 51, 7, 8, 9, 10, 21,
- 21, 32, 31, 62, 33, 17, 32, 19, 20, 21,
- 163, 46, -1, 25, 26, -1, 45, 46, -1, 31,
- 32, 33, 51, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 45, 46, -1, -1, -1, 50, 51,
- 7, 8, 9, 10, -1, -1, 38, 39, -1, -1,
- 17, 43, 19, 20, 21, 47, 48, -1, 25, 26,
- -1, 53, 54, -1, 31, 32, 33, 38, 39, -1,
- -1, -1, 43, 44, 45, 46, 47, 48, 45, 46,
- -1, 52, 53, 54, 51, 38, 39, -1, -1, -1,
+ 0, 63, 124, 65, 90, 15, 16, 0, 13, 51,
+ 0, 16, 17, 18, 0, 0, 102, 14, 15, 16,
+ 50, 13, 27, 52, 35, 55, 55, 149, 33, 34,
+ 35, 153, 11, 44, 10, 157, 38, 39, 11, 18,
+ 50, 43, 14, 35, 16, 10, 168, 52, 27, 36,
+ 37, 53, 54, 50, 10, 141, 178, 50, 63, 64,
+ 65, 10, 62, 68, 69, 70, 71, 72, 73, 74,
+ 75, 76, 62, 128, 0, 137, 62, 62, 133, 34,
+ 35, 136, 7, 8, 9, 10, 27, 50, 29, 94,
+ 95, 146, 178, 52, 35, 55, 55, 51, 103, 44,
+ 11, 156, 164, 11, 159, 27, 31, 162, 33, 114,
+ 10, 51, 55, 34, 169, 10, 52, 11, 11, 174,
+ 45, 46, 11, 27, 10, 52, 51, 127, 10, 35,
+ 135, 55, 137, 10, 21, 16, 0, 1, 34, 15,
+ 145, 10, 32, 7, 8, 9, 10, 21, 16, 16,
+ 34, 16, 32, 17, 16, 19, 20, 21, 21, 164,
+ 24, 25, 26, 62, 163, 50, 32, 31, 32, 33,
+ -1, 7, 8, 9, 10, 46, -1, -1, -1, -1,
+ -1, 45, 46, 183, -1, -1, 50, 51, 7, 8,
+ 9, 10, -1, -1, -1, 31, -1, 33, 17, -1,
+ 19, 20, 21, -1, 11, -1, 25, 26, -1, 45,
+ 46, 18, 31, 32, 33, 51, 23, -1, -1, -1,
+ 27, 28, 29, 30, -1, -1, 45, 46, 35, -1,
+ -1, 50, 51, 7, 8, 9, 10, -1, -1, -1,
+ -1, -1, -1, 17, 22, 19, 20, 21, -1, -1,
+ -1, 25, 26, -1, -1, -1, -1, 31, 32, 33,
+ 38, 39, -1, -1, -1, 43, -1, 45, 46, 47,
+ 48, 45, 46, 38, 39, 53, 54, 51, 43, 44,
+ 45, 46, 47, 48, -1, 38, 39, 52, 53, 54,
43, -1, 45, 46, 47, 48, -1, 38, 39, 52,
53, 54, 43, 44, 45, 46, 47, 48, -1, 38,
39, -1, 53, 54, 43, -1, 45, 46, 47, 48,
-1, 38, 39, -1, 53, 54, 43, -1, -1, -1,
- 47, 48, -1, -1, 51, -1, 53, 54
+ 47, 48, -1, -1, 51, -1, 53, 54, 38, 39,
+ -1, -1, -1, 43, -1, -1, -1, 47, 48, -1,
+ -1, -1, -1, 53, 54
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -782,7 +793,7 @@ static const yytype_uint8 yystos[] =
16, 70, 55, 82, 10, 16, 73, 71, 34, 72,
21, 15, 63, 64, 69, 10, 72, 32, 71, 72,
71, 71, 63, 65, 72, 71, 16, 16, 34, 71,
- 16, 21, 21, 72, 16, 32, 32
+ 16, 21, 21, 70, 72, 16, 32, 60, 32, 50
};
#define yyerrok (yyerrstatus = 0)
@@ -1731,6 +1742,18 @@ yyreduce:
#line 210 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
+ WRITE_UINT32(&else1, 0);
+ WRITE_UINT32(&end, 0);
+ (*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 3] = end; ;}
+ break;
+
+ case 28:
+#line 218 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (4)].code));
WRITE_UINT32(&else1, 0);
WRITE_UINT32(&end, 0);
@@ -1739,23 +1762,23 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(2) - (4)].code) + 3] = end; ;}
break;
- case 28:
-#line 220 "engines/director/lingo/lingo-gr.y"
+ case 29:
+#line 229 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 29:
-#line 221 "engines/director/lingo/lingo-gr.y"
+ case 30:
+#line 230 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 31:
-#line 224 "engines/director/lingo/lingo-gr.y"
+ case 32:
+#line 233 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 32:
-#line 226 "engines/director/lingo/lingo-gr.y"
+ case 33:
+#line 235 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1763,33 +1786,33 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 33:
-#line 232 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 241 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
- case 34:
-#line 234 "engines/director/lingo/lingo-gr.y"
+ case 35:
+#line 243 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
- case 35:
-#line 236 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 245 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 36:
-#line 238 "engines/director/lingo/lingo-gr.y"
+ case 37:
+#line 247 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 37:
-#line 240 "engines/director/lingo/lingo-gr.y"
+ case 38:
+#line 249 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 40:
-#line 245 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 254 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1797,15 +1820,15 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 41:
-#line 250 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 259 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
- case 42:
-#line 253 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 262 "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));
@@ -1814,8 +1837,8 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 43:
-#line 259 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 268 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1826,121 +1849,121 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 44:
-#line 267 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 276 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 46:
-#line 271 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 280 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 47:
-#line 272 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 281 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 48:
-#line 273 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 282 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 49:
-#line 274 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 283 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 50:
-#line 275 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 284 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 51:
-#line 276 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 285 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 52:
-#line 277 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 286 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 53:
-#line 278 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 287 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 54:
-#line 279 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 288 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 55:
-#line 280 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 289 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 56:
-#line 281 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 290 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 57:
-#line 282 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 291 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 58:
-#line 285 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 294 "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 59:
-#line 286 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 295 "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 60:
-#line 287 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 296 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 62:
-#line 289 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 298 "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 64:
-#line 294 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 303 "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 65:
-#line 295 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 304 "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 66:
-#line 306 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 315 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 67:
-#line 307 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 316 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 68:
-#line 308 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 317 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 69:
-#line 309 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 318 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1948,8 +1971,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 70:
-#line 314 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 323 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1958,8 +1981,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 71:
-#line 320 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 329 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1967,48 +1990,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 72:
-#line 327 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 336 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 73:
-#line 328 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 337 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 74:
-#line 329 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 338 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 75:
-#line 330 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 339 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 76:
-#line 333 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 342 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 77:
-#line 334 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 343 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 78:
-#line 335 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 344 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 79:
-#line 363 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 372 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 80:
-#line 364 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 373 "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);
@@ -2016,33 +2039,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 81:
-#line 370 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 379 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 82:
-#line 371 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 380 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 83:
-#line 372 "engines/director/lingo/lingo-gr.y"
+ case 84:
+#line 381 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 84:
-#line 373 "engines/director/lingo/lingo-gr.y"
+ case 85:
+#line 382 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 85:
-#line 375 "engines/director/lingo/lingo-gr.y"
+ case 86:
+#line 384 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 86:
-#line 378 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 387 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2051,24 +2074,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 87:
-#line 386 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 395 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 88:
-#line 387 "engines/director/lingo/lingo-gr.y"
+ case 89:
+#line 396 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 89:
-#line 388 "engines/director/lingo/lingo-gr.y"
+ case 90:
+#line 397 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2072 "engines/director/lingo/lingo-gr.cpp"
+#line 2095 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2282,6 +2305,6 @@ yyreturn:
}
-#line 391 "engines/director/lingo/lingo-gr.y"
+#line 400 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 35d589b..c0ec629 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -207,7 +207,7 @@ elseifstmt: elseifstmt1 elseifstmt
| elseifstmt1
;
-elseifstmt1: elseif cond tTHEN stmtlist {
+elseifstmt1: elseif cond tTHEN begin stmt '\n' {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $4);
WRITE_UINT32(&else1, 0);
@@ -215,6 +215,15 @@ elseifstmt1: elseif cond tTHEN stmtlist {
(*g_lingo->_currentScript)[$2 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$2 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$2 + 3] = end; } /* end, if cond fails */
+ | elseif cond tTHEN stmtlist {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&else1, 0);
+ WRITE_UINT32(&end, 0);
+ (*g_lingo->_currentScript)[$2 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$2 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$2 + 3] = end; } /* end, if cond fails */
+
;
cond: expr { g_lingo->code1(STOP); }
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index bbe4275..d4a3bb9 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -2086,7 +2086,7 @@ namespace Director {
int Lingo::parse(const char *code) {
YY_BUFFER_STATE bp;
- yydebug = 0;
+ yydebug = 1;
yy_delete_buffer(YY_CURRENT_BUFFER);
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 2580f4f..8249b0b 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -102,7 +102,7 @@ namespace Director {
int Lingo::parse(const char *code) {
YY_BUFFER_STATE bp;
- yydebug = 0;
+ yydebug = 1;
yy_delete_buffer(YY_CURRENT_BUFFER);
Commit: 97e80a0c7a376817b4304c57a355ebfe30e4ee12
https://github.com/scummvm/scummvm/commit/97e80a0c7a376817b4304c57a355ebfe30e4ee12
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Added support for two line if/else
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index e85c01e..e145a4d 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -97,9 +97,12 @@ Common::Error DirectorEngine::run() {
if 5 then\n\
exit\n\
else if 6 then\n\
+ put x\n\
exit\n\
else if 7 then exit\n\
end if\n\
+ if 5 then exit\n\
+ else exit\n\
", kMovieScript, 2);
//_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index d45fabd..0bade4c 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -430,16 +430,16 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 61
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 354
+#define YYLAST 344
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 56
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 29
/* YYNRULES -- Number of rules. */
-#define YYNRULES 90
+#define YYNRULES 91
/* YYNRULES -- Number of states. */
-#define YYNSTATES 190
+#define YYNSTATES 196
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -490,14 +490,14 @@ static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
20, 22, 24, 29, 34, 39, 41, 43, 45, 54,
- 66, 79, 86, 94, 105, 116, 119, 121, 128, 133,
- 135, 139, 143, 146, 150, 152, 154, 155, 156, 157,
- 160, 163, 165, 167, 172, 177, 179, 181, 185, 189,
- 193, 197, 201, 205, 209, 213, 217, 220, 223, 227,
- 230, 233, 236, 238, 240, 243, 245, 249, 252, 255,
- 258, 261, 265, 268, 272, 275, 278, 280, 284, 287,
- 291, 292, 301, 302, 304, 308, 313, 314, 318, 319,
- 321
+ 66, 79, 86, 99, 107, 118, 129, 132, 134, 141,
+ 146, 148, 152, 156, 159, 163, 165, 167, 168, 169,
+ 170, 173, 176, 178, 180, 185, 190, 192, 194, 198,
+ 202, 206, 210, 214, 218, 222, 226, 230, 233, 236,
+ 240, 243, 246, 249, 251, 253, 256, 258, 262, 265,
+ 268, 271, 274, 278, 281, 285, 288, 291, 293, 297,
+ 300, 304, 305, 314, 315, 317, 321, 326, 327, 331,
+ 332, 334
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -511,31 +511,32 @@ static const yytype_int8 yyrhs[] =
71, 16, 32, -1, 67, 44, 73, 71, 35, 73,
71, 72, 71, 16, 32, -1, 67, 44, 73, 71,
13, 35, 73, 71, 72, 71, 16, 32, -1, 68,
- 65, 34, 70, 60, 71, -1, 68, 65, 34, 72,
- 71, 16, 21, -1, 68, 65, 34, 72, 71, 14,
- 72, 71, 16, 21, -1, 68, 65, 34, 72, 71,
- 70, 63, 71, 16, 21, -1, 64, 63, -1, 64,
- -1, 69, 65, 34, 70, 60, 50, -1, 69, 65,
- 34, 72, -1, 73, -1, 73, 44, 73, -1, 51,
- 65, 52, -1, 32, 37, -1, 32, 36, 10, -1,
- 21, -1, 15, -1, -1, -1, -1, 72, 50, -1,
- 72, 60, -1, 7, -1, 8, -1, 9, 51, 84,
- 52, -1, 10, 51, 84, 52, -1, 10, -1, 59,
- -1, 73, 45, 73, -1, 73, 46, 73, -1, 73,
- 47, 73, -1, 73, 48, 73, -1, 73, 53, 73,
- -1, 73, 54, 73, -1, 73, 43, 73, -1, 73,
- 38, 73, -1, 73, 39, 73, -1, 45, 73, -1,
- 46, 73, -1, 51, 73, 52, -1, 25, 11, -1,
- 26, 10, -1, 31, 73, -1, 76, -1, 17, -1,
- 19, 75, -1, 10, -1, 75, 55, 10, -1, 20,
- 23, -1, 20, 28, -1, 20, 30, -1, 20, 77,
- -1, 20, 77, 78, -1, 20, 78, -1, 35, 18,
- 11, -1, 18, 11, -1, 35, 11, -1, 11, -1,
- 29, 27, 11, -1, 27, 11, -1, 35, 27, 11,
- -1, -1, 24, 10, 80, 70, 81, 50, 82, 72,
- -1, -1, 10, -1, 81, 55, 10, -1, 81, 50,
- 55, 10, -1, -1, 10, 70, 84, -1, -1, 73,
- -1, 84, 55, 73, -1
+ 65, 34, 70, 60, 71, -1, 68, 65, 34, 70,
+ 60, 71, 50, 14, 70, 60, 71, 50, -1, 68,
+ 65, 34, 72, 71, 16, 21, -1, 68, 65, 34,
+ 72, 71, 14, 72, 71, 16, 21, -1, 68, 65,
+ 34, 72, 71, 70, 63, 71, 16, 21, -1, 64,
+ 63, -1, 64, -1, 69, 65, 34, 70, 60, 50,
+ -1, 69, 65, 34, 72, -1, 73, -1, 73, 44,
+ 73, -1, 51, 65, 52, -1, 32, 37, -1, 32,
+ 36, 10, -1, 21, -1, 15, -1, -1, -1, -1,
+ 72, 50, -1, 72, 60, -1, 7, -1, 8, -1,
+ 9, 51, 84, 52, -1, 10, 51, 84, 52, -1,
+ 10, -1, 59, -1, 73, 45, 73, -1, 73, 46,
+ 73, -1, 73, 47, 73, -1, 73, 48, 73, -1,
+ 73, 53, 73, -1, 73, 54, 73, -1, 73, 43,
+ 73, -1, 73, 38, 73, -1, 73, 39, 73, -1,
+ 45, 73, -1, 46, 73, -1, 51, 73, 52, -1,
+ 25, 11, -1, 26, 10, -1, 31, 73, -1, 76,
+ -1, 17, -1, 19, 75, -1, 10, -1, 75, 55,
+ 10, -1, 20, 23, -1, 20, 28, -1, 20, 30,
+ -1, 20, 77, -1, 20, 77, 78, -1, 20, 78,
+ -1, 35, 18, 11, -1, 18, 11, -1, 35, 11,
+ -1, 11, -1, 29, 27, 11, -1, 27, 11, -1,
+ 35, 27, 11, -1, -1, 24, 10, 80, 70, 81,
+ 50, 82, 72, -1, -1, 10, -1, 81, 55, 10,
+ -1, 81, 50, 55, 10, -1, -1, 10, 70, 84,
+ -1, -1, 73, -1, 84, 55, 73, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -543,14 +544,14 @@ static const yytype_uint16 yyrline[] =
{
0, 92, 92, 93, 96, 97, 98, 99, 100, 101,
102, 103, 106, 112, 118, 126, 127, 128, 133, 144,
- 160, 174, 182, 188, 196, 206, 207, 210, 218, 229,
- 230, 231, 233, 235, 241, 243, 245, 247, 249, 250,
- 251, 254, 259, 262, 268, 276, 279, 280, 281, 282,
- 283, 284, 285, 286, 287, 288, 289, 290, 291, 294,
- 295, 296, 297, 298, 300, 303, 304, 315, 316, 317,
- 318, 323, 329, 336, 337, 338, 339, 342, 343, 344,
- 372, 372, 379, 380, 381, 382, 384, 387, 395, 396,
- 397
+ 160, 174, 180, 190, 196, 204, 214, 215, 218, 226,
+ 237, 238, 239, 241, 243, 249, 251, 253, 255, 257,
+ 258, 259, 262, 267, 270, 276, 284, 287, 288, 289,
+ 290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
+ 302, 303, 304, 305, 306, 308, 311, 312, 323, 324,
+ 325, 326, 331, 337, 344, 345, 346, 347, 350, 351,
+ 352, 380, 380, 387, 388, 389, 390, 392, 395, 403,
+ 404, 405
};
#endif
@@ -593,14 +594,14 @@ static const yytype_uint8 yyr1[] =
{
0, 56, 57, 57, 58, 58, 58, 58, 58, 58,
58, 58, 59, 59, 59, 60, 60, 60, 60, 60,
- 60, 61, 62, 62, 62, 63, 63, 64, 64, 65,
- 65, 65, 66, 67, 68, 69, 70, 71, 72, 72,
- 72, 73, 73, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 73, 73, 74,
- 74, 74, 74, 74, 74, 75, 75, 76, 76, 76,
- 76, 76, 76, 77, 77, 77, 77, 78, 78, 78,
- 80, 79, 81, 81, 81, 81, 82, 83, 84, 84,
- 84
+ 60, 61, 61, 62, 62, 62, 63, 63, 64, 64,
+ 65, 65, 65, 66, 67, 68, 69, 70, 71, 72,
+ 72, 72, 73, 73, 73, 73, 73, 73, 73, 73,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 74, 74, 74, 74, 74, 74, 75, 75, 76, 76,
+ 76, 76, 76, 76, 77, 77, 77, 77, 78, 78,
+ 78, 80, 79, 81, 81, 81, 81, 82, 83, 84,
+ 84, 84
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -608,14 +609,14 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
1, 1, 4, 4, 4, 1, 1, 1, 8, 11,
- 12, 6, 7, 10, 10, 2, 1, 6, 4, 1,
- 3, 3, 2, 3, 1, 1, 0, 0, 0, 2,
- 2, 1, 1, 4, 4, 1, 1, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 2, 2, 3, 2,
- 2, 2, 1, 1, 2, 1, 3, 2, 2, 2,
- 2, 3, 2, 3, 2, 2, 1, 3, 2, 3,
- 0, 8, 0, 1, 3, 4, 0, 3, 0, 1,
- 3
+ 12, 6, 12, 7, 10, 10, 2, 1, 6, 4,
+ 1, 3, 3, 2, 3, 1, 1, 0, 0, 0,
+ 2, 2, 1, 1, 4, 4, 1, 1, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 2, 2, 3,
+ 2, 2, 2, 1, 1, 2, 1, 3, 2, 2,
+ 2, 2, 3, 2, 3, 2, 2, 1, 3, 2,
+ 3, 0, 8, 0, 1, 3, 4, 0, 3, 0,
+ 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -623,151 +624,151 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 41, 42, 0, 36, 63, 0, 0, 34,
+ 0, 11, 42, 43, 0, 37, 64, 0, 0, 35,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 3, 46, 10, 9, 17, 0, 0, 0, 15, 6,
- 62, 5, 7, 88, 88, 88, 65, 64, 76, 0,
- 67, 0, 68, 0, 69, 0, 70, 72, 80, 59,
- 60, 45, 0, 46, 61, 0, 32, 0, 56, 57,
- 0, 1, 0, 0, 0, 0, 0, 29, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 89, 0, 0,
- 87, 0, 74, 78, 0, 75, 0, 0, 0, 71,
- 36, 0, 0, 33, 0, 0, 58, 2, 0, 37,
- 0, 0, 36, 0, 54, 55, 53, 47, 48, 49,
- 50, 51, 52, 43, 0, 44, 66, 77, 73, 79,
- 82, 12, 14, 13, 38, 0, 31, 0, 37, 30,
- 90, 83, 0, 37, 0, 0, 37, 0, 16, 39,
- 40, 36, 86, 0, 0, 0, 37, 21, 0, 38,
- 0, 0, 0, 38, 84, 0, 37, 38, 38, 37,
- 22, 35, 37, 26, 0, 85, 81, 18, 38, 37,
- 0, 0, 25, 0, 37, 0, 0, 0, 36, 0,
- 0, 23, 24, 0, 28, 0, 19, 0, 20, 27
+ 3, 47, 10, 9, 17, 0, 0, 0, 15, 6,
+ 63, 5, 7, 89, 89, 89, 66, 65, 77, 0,
+ 68, 0, 69, 0, 70, 0, 71, 73, 81, 60,
+ 61, 46, 0, 47, 62, 0, 33, 0, 57, 58,
+ 0, 1, 0, 0, 0, 0, 0, 30, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 90, 0, 0,
+ 88, 0, 75, 79, 0, 76, 0, 0, 0, 72,
+ 37, 0, 0, 34, 0, 0, 59, 2, 0, 38,
+ 0, 0, 37, 0, 55, 56, 54, 48, 49, 50,
+ 51, 52, 53, 44, 0, 45, 67, 78, 74, 80,
+ 83, 12, 14, 13, 39, 0, 32, 0, 38, 31,
+ 91, 84, 0, 38, 0, 0, 38, 0, 16, 40,
+ 41, 37, 87, 0, 0, 0, 38, 21, 0, 39,
+ 0, 0, 0, 39, 85, 0, 38, 39, 0, 39,
+ 38, 23, 36, 38, 27, 0, 86, 82, 18, 39,
+ 38, 37, 0, 0, 26, 0, 38, 0, 0, 0,
+ 0, 37, 0, 0, 38, 24, 25, 0, 29, 0,
+ 19, 0, 0, 20, 22, 28
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 19, 20, 53, 140, 23, 24, 162, 163, 66,
- 25, 26, 137, 164, 35, 125, 128, 28, 138, 37,
+ -1, 19, 20, 53, 140, 23, 24, 163, 164, 66,
+ 25, 26, 137, 165, 35, 125, 128, 28, 138, 37,
30, 46, 47, 31, 90, 132, 153, 32, 78
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -123
+#define YYPACT_NINF -89
static const yytype_int16 yypact[] =
{
- 136, -123, -123, -123, -42, 283, -123, 24, 193, -123,
- 35, 27, 44, 75, 13, 51, 75, 75, 75, 74,
- 37, 7, -123, -123, -123, 46, 55, 164, 271, -123,
- -123, -123, -123, 75, 75, 75, -123, 40, -123, 89,
- -123, 92, -123, 78, -123, 21, 59, -123, -123, -123,
- -123, 60, 75, -123, 222, 100, -123, -11, -2, -2,
- 247, -123, 136, 164, 75, 164, 79, 259, 75, 75,
- 75, 75, 75, 75, 75, 75, 75, 271, -29, 41,
- 57, 105, -123, -123, 106, -123, 107, 111, 96, -123,
- -123, 222, 114, -123, 75, 75, -123, -123, 64, 271,
- 73, 235, 3, 75, 271, 271, 271, 300, 300, -2,
- -2, 271, 271, -123, 75, -123, -123, -123, -123, -123,
- 118, -123, 271, 271, -123, 8, -123, 226, 181, 271,
- 271, -123, -30, 181, 94, 75, -123, 164, -123, -123,
- -123, 28, 76, 123, 119, 75, 271, -123, 104, -123,
- 113, 124, 131, -123, -123, 110, 271, -123, -123, 181,
- -123, -123, -123, 124, 164, -123, 181, -123, -123, 181,
- 132, 133, -123, 116, 181, 135, 126, 137, -10, 138,
- 120, -123, -123, 226, 181, 134, -123, 115, -123, -123
+ 138, -89, -89, -89, -30, 72, -89, -1, 8, -89,
+ 17, 23, 34, 166, 19, 40, 166, 166, 166, 57,
+ 11, 4, -89, -89, -89, 37, 48, 211, 290, -89,
+ -89, -89, -89, 166, 166, 166, -89, 42, -89, 84,
+ -89, 88, -89, 73, -89, 21, 52, -89, -89, -89,
+ -89, 54, 166, -89, 242, 97, -89, -11, 63, 63,
+ 266, -89, 138, 211, 166, 211, 78, 278, 166, 166,
+ 166, 166, 166, 166, 166, 166, 166, 290, -6, 30,
+ 58, 112, -89, -89, 113, -89, 118, 120, 106, -89,
+ -89, 242, 125, -89, 166, 166, -89, -89, 85, 290,
+ 89, 254, -9, 166, 290, 290, 290, 229, 229, 63,
+ 63, 290, 290, -89, 166, -89, -89, -89, -89, -89,
+ 126, -89, 290, 290, -89, 7, -89, 228, 183, 290,
+ 290, -89, -10, 183, 108, 166, -89, 211, -89, -89,
+ -89, 9, 94, 134, 135, 166, 290, 100, 119, -89,
+ 131, 139, 146, -89, -89, 129, 290, -89, 151, -89,
+ 183, -89, -89, -89, 139, 211, -89, 183, -89, -89,
+ 183, -89, 150, 152, -89, 133, 183, 156, 228, 158,
+ 159, 2, 161, 149, -89, -89, -89, 228, 183, 153,
+ -89, 132, 136, -89, -89, -89
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -123, 101, -123, 10, 0, -123, -123, 1, -123, -62,
- -123, -123, 14, -123, -86, -55, -122, -5, 15, -123,
- -123, -123, 129, -123, -123, -123, -123, -123, 45
+ -89, 143, -89, 10, 0, -89, -89, 31, -89, -62,
+ -89, -89, 15, -89, -88, -42, -73, -5, 16, -89,
+ -89, -89, 148, -89, -89, -89, -89, -89, 39
};
/* 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 -46
+#define YYTABLE_NINF -47
static const yytype_int16 yytable[] =
{
- 22, 98, 133, 100, 120, -38, -38, -8, 54, 33,
- 21, 58, 59, 60, 27, 29, 127, -38, -38, -38,
- 142, 134, 67, 113, 94, 143, 114, 159, 77, 77,
- 77, 166, 85, 95, 36, 169, 68, 69, 49, 86,
- -38, 70, 149, 135, 150, 48, 174, 91, 87, 55,
- 56, 75, 76, -38, 50, 151, 184, -8, 67, 99,
- 101, 57, 22, 104, 105, 106, 107, 108, 109, 110,
- 111, 112, 21, 141, 61, 148, 27, 29, 144, 79,
- 80, 147, 2, 3, 4, 51, 41, 62, 43, 122,
- 123, 157, 183, 115, 88, 81, 114, 63, 129, 64,
- 82, 168, 173, 83, 170, 84, 52, 171, 15, 130,
- 93, 34, 114, 102, 175, 116, 124, 117, 118, 179,
- 16, 17, 119, 87, 121, 126, 18, 136, 131, 145,
- 146, 152, 67, 154, 160, 155, -4, 1, 158, 161,
- 156, 165, 167, 2, 3, 4, 5, 181, 176, 177,
- 178, 180, 186, 6, 185, 7, 8, 9, 182, 67,
- 10, 11, 12, 97, 172, 189, 188, 13, 14, 15,
- 0, 2, 3, 4, 51, 89, 0, 0, 0, 0,
- 0, 16, 17, 187, 0, 0, -4, 18, 2, 3,
- 4, 51, 0, 0, 0, 52, 0, 15, 6, 0,
- 7, 8, 9, 0, 38, 0, 11, 12, 0, 16,
- 17, 39, 13, 14, 15, 65, 40, 0, 0, 0,
- 41, 42, 43, 44, 0, 0, 16, 17, 45, 0,
- 0, 139, 18, 2, 3, 4, 51, 0, 0, 0,
- 0, 0, 0, 6, 92, 7, 8, 9, 0, 0,
- 0, 11, 12, 0, 0, 0, 0, 13, 14, 15,
- 68, 69, 0, 0, 0, 70, 0, 71, 72, 73,
- 74, 16, 17, 68, 69, 75, 76, 18, 70, 103,
- 71, 72, 73, 74, 0, 68, 69, 96, 75, 76,
- 70, 0, 71, 72, 73, 74, 0, 68, 69, 96,
- 75, 76, 70, 103, 71, 72, 73, 74, 0, 68,
- 69, 0, 75, 76, 70, 0, 71, 72, 73, 74,
- 0, -45, -45, 0, 75, 76, -45, 0, 0, 0,
- -45, -45, 0, 0, 34, 0, -45, -45, 68, 69,
- 0, 0, 0, 70, 0, 0, 0, 73, 74, 0,
+ 22, 98, 120, 100, -8, -39, -39, -39, 54, 36,
+ 21, 58, 59, 60, 127, 27, 29, -39, -39, 38,
+ 134, 33, 67, 149, 94, 150, 39, 48, 77, 77,
+ 77, 40, 85, 95, 49, 41, 42, 43, 44, 86,
+ 142, -39, 135, 45, 50, 143, 113, 91, 87, 114,
+ 57, 133, -39, 151, -8, 55, 56, 61, 67, 99,
+ 101, 62, 22, 104, 105, 106, 107, 108, 109, 110,
+ 111, 112, 21, 79, 80, 148, 160, 27, 29, 41,
+ 167, 43, 115, 178, 170, 114, 141, 88, 63, 122,
+ 123, 144, 64, 187, 147, 82, 176, 81, 129, 83,
+ 84, 68, 69, 175, 157, 34, 70, 93, 188, 130,
+ -46, -46, 102, 114, 169, -46, 75, 76, 172, -46,
+ -46, 173, 116, 34, 117, -46, -46, 136, 177, 118,
+ 146, 119, 67, 87, 182, 121, 131, 124, -4, 1,
+ 156, 126, 191, 145, 154, 2, 3, 4, 5, 152,
+ 158, 155, 161, 159, 162, 6, 166, 7, 8, 9,
+ 67, 168, 10, 11, 12, 171, 179, 181, 180, 13,
+ 14, 15, 183, 2, 3, 4, 51, 189, 184, 185,
+ 186, 190, 194, 16, 17, 193, 195, 192, -4, 18,
+ 2, 3, 4, 51, 89, 174, 0, 52, 0, 15,
+ 6, 0, 7, 8, 9, 97, 0, 0, 11, 12,
+ 0, 16, 17, 0, 13, 14, 15, 18, 2, 3,
+ 4, 51, 0, 0, 0, 0, 0, 0, 16, 17,
+ 0, 0, 0, 139, 18, 2, 3, 4, 51, 0,
+ 0, 0, 52, 0, 15, 6, 0, 7, 8, 9,
+ 0, 0, 0, 11, 12, 0, 16, 17, 0, 13,
+ 14, 15, 65, 0, 92, 0, 0, 68, 69, 0,
+ 0, 0, 70, 16, 17, 0, 73, 74, 0, 18,
+ 68, 69, 75, 76, 0, 70, 0, 71, 72, 73,
+ 74, 0, 68, 69, 0, 75, 76, 70, 103, 71,
+ 72, 73, 74, 0, 68, 69, 96, 75, 76, 70,
+ 0, 71, 72, 73, 74, 0, 68, 69, 96, 75,
+ 76, 70, 103, 71, 72, 73, 74, 0, 68, 69,
+ 0, 75, 76, 70, 0, 71, 72, 73, 74, 0,
0, 0, 0, 75, 76
};
static const yytype_int16 yycheck[] =
{
- 0, 63, 124, 65, 90, 15, 16, 0, 13, 51,
- 0, 16, 17, 18, 0, 0, 102, 14, 15, 16,
- 50, 13, 27, 52, 35, 55, 55, 149, 33, 34,
- 35, 153, 11, 44, 10, 157, 38, 39, 11, 18,
- 50, 43, 14, 35, 16, 10, 168, 52, 27, 36,
- 37, 53, 54, 50, 10, 141, 178, 50, 63, 64,
- 65, 10, 62, 68, 69, 70, 71, 72, 73, 74,
- 75, 76, 62, 128, 0, 137, 62, 62, 133, 34,
- 35, 136, 7, 8, 9, 10, 27, 50, 29, 94,
- 95, 146, 178, 52, 35, 55, 55, 51, 103, 44,
- 11, 156, 164, 11, 159, 27, 31, 162, 33, 114,
- 10, 51, 55, 34, 169, 10, 52, 11, 11, 174,
- 45, 46, 11, 27, 10, 52, 51, 127, 10, 35,
- 135, 55, 137, 10, 21, 16, 0, 1, 34, 15,
- 145, 10, 32, 7, 8, 9, 10, 21, 16, 16,
- 34, 16, 32, 17, 16, 19, 20, 21, 21, 164,
- 24, 25, 26, 62, 163, 50, 32, 31, 32, 33,
- -1, 7, 8, 9, 10, 46, -1, -1, -1, -1,
- -1, 45, 46, 183, -1, -1, 50, 51, 7, 8,
- 9, 10, -1, -1, -1, 31, -1, 33, 17, -1,
- 19, 20, 21, -1, 11, -1, 25, 26, -1, 45,
- 46, 18, 31, 32, 33, 51, 23, -1, -1, -1,
- 27, 28, 29, 30, -1, -1, 45, 46, 35, -1,
- -1, 50, 51, 7, 8, 9, 10, -1, -1, -1,
- -1, -1, -1, 17, 22, 19, 20, 21, -1, -1,
- -1, 25, 26, -1, -1, -1, -1, 31, 32, 33,
- 38, 39, -1, -1, -1, 43, -1, 45, 46, 47,
- 48, 45, 46, 38, 39, 53, 54, 51, 43, 44,
- 45, 46, 47, 48, -1, 38, 39, 52, 53, 54,
- 43, -1, 45, 46, 47, 48, -1, 38, 39, 52,
- 53, 54, 43, 44, 45, 46, 47, 48, -1, 38,
- 39, -1, 53, 54, 43, -1, 45, 46, 47, 48,
- -1, 38, 39, -1, 53, 54, 43, -1, -1, -1,
- 47, 48, -1, -1, 51, -1, 53, 54, 38, 39,
- -1, -1, -1, 43, -1, -1, -1, 47, 48, -1,
+ 0, 63, 90, 65, 0, 14, 15, 16, 13, 10,
+ 0, 16, 17, 18, 102, 0, 0, 15, 16, 11,
+ 13, 51, 27, 14, 35, 16, 18, 10, 33, 34,
+ 35, 23, 11, 44, 11, 27, 28, 29, 30, 18,
+ 50, 50, 35, 35, 10, 55, 52, 52, 27, 55,
+ 10, 124, 50, 141, 50, 36, 37, 0, 63, 64,
+ 65, 50, 62, 68, 69, 70, 71, 72, 73, 74,
+ 75, 76, 62, 34, 35, 137, 149, 62, 62, 27,
+ 153, 29, 52, 171, 157, 55, 128, 35, 51, 94,
+ 95, 133, 44, 181, 136, 11, 169, 55, 103, 11,
+ 27, 38, 39, 165, 146, 51, 43, 10, 181, 114,
+ 38, 39, 34, 55, 156, 43, 53, 54, 160, 47,
+ 48, 163, 10, 51, 11, 53, 54, 127, 170, 11,
+ 135, 11, 137, 27, 176, 10, 10, 52, 0, 1,
+ 145, 52, 184, 35, 10, 7, 8, 9, 10, 55,
+ 50, 16, 21, 34, 15, 17, 10, 19, 20, 21,
+ 165, 32, 24, 25, 26, 14, 16, 34, 16, 31,
+ 32, 33, 16, 7, 8, 9, 10, 16, 178, 21,
+ 21, 32, 50, 45, 46, 32, 50, 187, 50, 51,
+ 7, 8, 9, 10, 46, 164, -1, 31, -1, 33,
+ 17, -1, 19, 20, 21, 62, -1, -1, 25, 26,
+ -1, 45, 46, -1, 31, 32, 33, 51, 7, 8,
+ 9, 10, -1, -1, -1, -1, -1, -1, 45, 46,
+ -1, -1, -1, 50, 51, 7, 8, 9, 10, -1,
+ -1, -1, 31, -1, 33, 17, -1, 19, 20, 21,
+ -1, -1, -1, 25, 26, -1, 45, 46, -1, 31,
+ 32, 33, 51, -1, 22, -1, -1, 38, 39, -1,
+ -1, -1, 43, 45, 46, -1, 47, 48, -1, 51,
+ 38, 39, 53, 54, -1, 43, -1, 45, 46, 47,
+ 48, -1, 38, 39, -1, 53, 54, 43, 44, 45,
+ 46, 47, 48, -1, 38, 39, 52, 53, 54, 43,
+ -1, 45, 46, 47, 48, -1, 38, 39, 52, 53,
+ 54, 43, 44, 45, 46, 47, 48, -1, 38, 39,
+ -1, 53, 54, 43, -1, 45, 46, 47, 48, -1,
-1, -1, -1, 53, 54
};
@@ -790,10 +791,11 @@ static const yytype_uint8 yystos[] =
70, 10, 73, 73, 52, 71, 52, 70, 72, 73,
73, 10, 81, 72, 13, 35, 60, 68, 74, 50,
60, 71, 50, 55, 71, 35, 73, 71, 65, 14,
- 16, 70, 55, 82, 10, 16, 73, 71, 34, 72,
- 21, 15, 63, 64, 69, 10, 72, 32, 71, 72,
- 71, 71, 63, 65, 72, 71, 16, 16, 34, 71,
- 16, 21, 21, 70, 72, 16, 32, 60, 32, 50
+ 16, 70, 55, 82, 10, 16, 73, 71, 50, 34,
+ 72, 21, 15, 63, 64, 69, 10, 72, 32, 71,
+ 72, 14, 71, 71, 63, 65, 72, 71, 70, 16,
+ 16, 34, 71, 16, 60, 21, 21, 70, 72, 16,
+ 32, 71, 60, 32, 50, 50
};
#define yyerrok (yyerrstatus = 0)
@@ -1705,7 +1707,19 @@ yyreduce:
break;
case 22:
-#line 182 "engines/director/lingo/lingo-gr.y"
+#line 180 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(4) - (12)].code));
+ WRITE_UINT32(&else1, (yyvsp[(9) - (12)].code));
+ WRITE_UINT32(&end, (yyvsp[(11) - (12)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; ;}
+ break;
+
+ case 23:
+#line 190 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
@@ -1714,8 +1728,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; ;}
break;
- case 23:
-#line 188 "engines/director/lingo/lingo-gr.y"
+ case 24:
+#line 196 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1726,8 +1740,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
break;
- case 24:
-#line 196 "engines/director/lingo/lingo-gr.y"
+ case 25:
+#line 204 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1738,8 +1752,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
break;
- case 27:
-#line 210 "engines/director/lingo/lingo-gr.y"
+ case 28:
+#line 218 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1750,8 +1764,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 3] = end; ;}
break;
- case 28:
-#line 218 "engines/director/lingo/lingo-gr.y"
+ case 29:
+#line 226 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (4)].code));
@@ -1762,23 +1776,23 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(2) - (4)].code) + 3] = end; ;}
break;
- case 29:
-#line 229 "engines/director/lingo/lingo-gr.y"
+ case 30:
+#line 237 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 30:
-#line 230 "engines/director/lingo/lingo-gr.y"
+ case 31:
+#line 238 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 32:
-#line 233 "engines/director/lingo/lingo-gr.y"
+ case 33:
+#line 241 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 33:
-#line 235 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 243 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1786,33 +1800,33 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 34:
-#line 241 "engines/director/lingo/lingo-gr.y"
+ case 35:
+#line 249 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
- case 35:
-#line 243 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 251 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
- case 36:
-#line 245 "engines/director/lingo/lingo-gr.y"
+ case 37:
+#line 253 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 37:
-#line 247 "engines/director/lingo/lingo-gr.y"
+ case 38:
+#line 255 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 38:
-#line 249 "engines/director/lingo/lingo-gr.y"
+ case 39:
+#line 257 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 41:
-#line 254 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 262 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1820,15 +1834,15 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 42:
-#line 259 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 267 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
- case 43:
-#line 262 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 270 "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));
@@ -1837,8 +1851,8 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 44:
-#line 268 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 276 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1849,121 +1863,121 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 45:
-#line 276 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 284 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 47:
-#line 280 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 288 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 48:
-#line 281 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 289 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 49:
-#line 282 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 290 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 50:
-#line 283 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 291 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 51:
-#line 284 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 292 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 52:
-#line 285 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 293 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 53:
-#line 286 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 294 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 54:
-#line 287 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 295 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 55:
-#line 288 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 296 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 56:
-#line 289 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 297 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 57:
-#line 290 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 298 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 58:
-#line 291 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 299 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 59:
-#line 294 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 302 "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 60:
-#line 295 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 303 "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 61:
-#line 296 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 304 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 63:
-#line 298 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 306 "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 65:
-#line 303 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 311 "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 66:
-#line 304 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 312 "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 67:
-#line 315 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 323 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 68:
-#line 316 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 324 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 69:
-#line 317 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 325 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 70:
-#line 318 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 326 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1971,8 +1985,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 71:
-#line 323 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 331 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1981,8 +1995,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 72:
-#line 329 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 337 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -1990,48 +2004,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 73:
-#line 336 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 344 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 74:
-#line 337 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 345 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 75:
-#line 338 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 346 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 76:
-#line 339 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 347 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 77:
-#line 342 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 350 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 78:
-#line 343 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 351 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 79:
-#line 344 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 352 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 80:
-#line 372 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 380 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 81:
-#line 373 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 381 "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);
@@ -2039,33 +2053,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 82:
-#line 379 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 387 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 83:
-#line 380 "engines/director/lingo/lingo-gr.y"
+ case 84:
+#line 388 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 84:
-#line 381 "engines/director/lingo/lingo-gr.y"
+ case 85:
+#line 389 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 85:
-#line 382 "engines/director/lingo/lingo-gr.y"
+ case 86:
+#line 390 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 86:
-#line 384 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 392 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 87:
-#line 387 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 395 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2074,24 +2088,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 88:
-#line 395 "engines/director/lingo/lingo-gr.y"
+ case 89:
+#line 403 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 89:
-#line 396 "engines/director/lingo/lingo-gr.y"
+ case 90:
+#line 404 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 90:
-#line 397 "engines/director/lingo/lingo-gr.y"
+ case 91:
+#line 405 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2095 "engines/director/lingo/lingo-gr.cpp"
+#line 2109 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2305,6 +2319,6 @@ yyreturn:
}
-#line 400 "engines/director/lingo/lingo-gr.y"
+#line 408 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index c0ec629..2b3f0cf 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -177,6 +177,14 @@ stmtoneliner: if cond tTHEN begin stmt end {
WRITE_UINT32(&end, $6);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ | if cond tTHEN begin stmt end '\n' tELSE begin stmt end '\n' {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&else1, $9);
+ WRITE_UINT32(&end, $11);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
;
ifstmt: if cond tTHEN stmtlist end tEND tIF {
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index d4a3bb9..bbe4275 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -2086,7 +2086,7 @@ namespace Director {
int Lingo::parse(const char *code) {
YY_BUFFER_STATE bp;
- yydebug = 1;
+ yydebug = 0;
yy_delete_buffer(YY_CURRENT_BUFFER);
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 8249b0b..2580f4f 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -102,7 +102,7 @@ namespace Director {
int Lingo::parse(const char *code) {
YY_BUFFER_STATE bp;
- yydebug = 1;
+ yydebug = 0;
yy_delete_buffer(YY_CURRENT_BUFFER);
Commit: 22baf62312a94f272f8780697853140ae3b30434
https://github.com/scummvm/scummvm/commit/22baf62312a94f272f8780697853140ae3b30434
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Added stub for 'the' entities
Changed paths:
A engines/director/lingo/lingo-the.cpp
A engines/director/lingo/lingo-the.h
engines/director/lingo/lingo.h
engines/director/module.mk
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
new file mode 100644
index 0000000..a0a2424
--- /dev/null
+++ b/engines/director/lingo/lingo-the.cpp
@@ -0,0 +1,113 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "engines/director/lingo/lingo.h"
+
+namespace Director {
+
+static struct TheEntityProto {
+ TheEntity entity;
+ const char *name;
+ bool hasID;
+} entities[] = {
+ { kTheFrame, "frame", false },
+ { kThePathName, "pathname", false },
+ { kTheMovie, "movie", false },
+ { kTheMouseH, "mouseh", false },
+ { kTheMouseV, "mousev", false },
+ { kTheSprite, "sprite", true },
+ { kThePerFrameHook, "perframehook", false },
+ { kTheTicks, "ticks", false },
+ { kTheTimer, "timer", false },
+ { kTheTimeoutLength,"timeoutlength",false },
+
+ { kTheNOEntity, NULL, false }
+};
+
+static struct TheEntityFieldProto {
+ TheEntity entity;
+ const char *name;
+ TheField field;
+} fields[] = {
+ { kTheSprite, "castnum", kTheCastNum },
+ { kTheSprite, "cursor", kTheCursor },
+ { kTheSprite, "loch", kTheLocH },
+ { kTheSprite, "locv", kTheLocV },
+
+ { kTheNOEntity, NULL, kTheNOField }
+};
+
+void Lingo::setTheEntity(TheEntity entity, int id, TheField field, Datum &d) {
+ switch (entity) {
+ case kTheSprite:
+ setTheSprite(id, field, d);
+ break;
+ case kThePerFrameHook:
+ warning("STUB: setting the perframehook");
+ break;
+ default:
+ error("Unprocessed setting field %d of entity %d", field, entity);
+ }
+}
+
+void Lingo::setTheSprite(int id, TheField field, Datum &d) {
+ switch (field) {
+ case kTheCastNum:
+ warning("STUB: setting thecastnum of sprite %d", id);
+ break;
+ default:
+ error("Unprocessed setting field %d of sprite", field);
+ }
+}
+
+Datum Lingo::getTheEntity(TheEntity entity, int id, TheField field) {
+ Datum d;
+
+ switch (entity) {
+ case kTheSprite:
+ d = getTheSprite(id, field);
+ break;
+ case kThePerFrameHook:
+ warning("STUB: getting the perframehook");
+ break;
+ default:
+ error("Unprocessed getting field %d of entity %d", field, entity);
+ }
+
+ return d;
+}
+
+Datum Lingo::getTheSprite(int id, TheField field) {
+ Datum d;
+
+ switch (field) {
+ case kTheCastNum:
+ warning("STUB: getting thecastnum of sprite %d", id);
+ break;
+ default:
+ error("Unprocessed getting field %d of sprite", field);
+ }
+
+ return d;
+}
+
+} // End of namespace Director
diff --git a/engines/director/lingo/lingo-the.h b/engines/director/lingo/lingo-the.h
new file mode 100644
index 0000000..e867283
--- /dev/null
+++ b/engines/director/lingo/lingo-the.h
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+ #ifndef DIRECTOR_LINGO_LINGO_THE_H
+ #define DIRECTOR_LINGO_LINGO_THE_H
+
+namespace Director {
+
+enum TheEntity {
+ kTheNOEntity = 0,
+ kTheFrame = 1,
+ kThePathName,
+ kTheMovie,
+ kTheMouseH,
+ kTheMouseV,
+ kTheSprite,
+ kThePerFrameHook,
+ kTheTicks,
+ kTheTimer,
+ kTheTimeoutLength
+};
+
+enum TheField {
+ kTheNOField = 0,
+ kTheCastNum = 1,
+ kTheCursor,
+ kTheLocH,
+ kTheLocV
+};
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 0f66706..8885b7f 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -31,6 +31,7 @@
#include "engines/director/director.h"
#include "engines/director/score.h"
#include "director/lingo/lingo-gr.h"
+#include "director/lingo/lingo-the.h"
namespace Director {
@@ -221,6 +222,12 @@ public:
void func_gotoprevious();
public:
+ void setTheEntity(TheEntity entity, int id, TheField field, Datum &d);
+ void setTheSprite(int id, TheField field, Datum &d);
+ Datum getTheEntity(TheEntity entity, int id, TheField field);
+ Datum getTheSprite(int id, TheField field);
+
+public:
ScriptData *_currentScript;
ScriptType _currentScriptType;
bool _returning;
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 273a133..90d27e7 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -14,7 +14,8 @@ MODULE_OBJS = \
lingo/lingo-code.o \
lingo/lingo-codegen.o \
lingo/lingo-funcs.o \
- lingo/lingo-lex.o
+ lingo/lingo-lex.o \
+ lingo/lingo-the.o
engines/director/lingo/lingo-lex.cpp: engines/director/lingo/lingo-lex.l
flex -o engines/director/lingo/lingo-lex.cpp engines/director/lingo/lingo-lex.l
Commit: 78555a4d3f77a5e604675416d2d700059faafe9f
https://github.com/scummvm/scummvm/commit/78555a4d3f77a5e604675416d2d700059faafe9f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Stub for labelstack
Changed paths:
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index ad78031..0f47202 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -219,4 +219,11 @@ int Lingo::codeId_(Common::String &name) {
return ret;
}
+void Lingo::codeLabel(int label) {
+ _labelstack.push_back(label);
+}
+
+void Lingo::processIf(int endlabel) {
+}
+
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 0bade4c..27c80f5 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -542,16 +542,16 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 92, 92, 93, 96, 97, 98, 99, 100, 101,
- 102, 103, 106, 112, 118, 126, 127, 128, 133, 144,
- 160, 174, 180, 190, 196, 204, 214, 215, 218, 226,
- 237, 238, 239, 241, 243, 249, 251, 253, 255, 257,
- 258, 259, 262, 267, 270, 276, 284, 287, 288, 289,
- 290, 291, 292, 293, 294, 295, 296, 297, 298, 299,
- 302, 303, 304, 305, 306, 308, 311, 312, 323, 324,
- 325, 326, 331, 337, 344, 345, 346, 347, 350, 351,
- 352, 380, 380, 387, 388, 389, 390, 392, 395, 403,
- 404, 405
+ 0, 93, 93, 94, 97, 98, 99, 100, 101, 102,
+ 103, 104, 107, 113, 119, 127, 128, 129, 134, 145,
+ 161, 175, 183, 195, 202, 211, 222, 223, 226, 232,
+ 240, 241, 242, 244, 246, 252, 257, 259, 261, 263,
+ 264, 265, 268, 273, 276, 282, 290, 293, 294, 295,
+ 296, 297, 298, 299, 300, 301, 302, 303, 304, 305,
+ 308, 309, 310, 311, 312, 314, 317, 318, 329, 330,
+ 331, 332, 337, 343, 350, 351, 352, 353, 356, 357,
+ 358, 386, 386, 393, 394, 395, 396, 398, 401, 409,
+ 410, 411
};
#endif
@@ -1610,17 +1610,17 @@ yyreduce:
switch (yyn)
{
case 8:
-#line 100 "engines/director/lingo/lingo-gr.y"
+#line 101 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 11:
-#line 103 "engines/director/lingo/lingo-gr.y"
+#line 104 "engines/director/lingo/lingo-gr.y"
{ yyerrok; ;}
break;
case 12:
-#line 106 "engines/director/lingo/lingo-gr.y"
+#line 107 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str());
@@ -1630,7 +1630,7 @@ yyreduce:
break;
case 13:
-#line 112 "engines/director/lingo/lingo-gr.y"
+#line 113 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1640,7 +1640,7 @@ yyreduce:
break;
case 14:
-#line 118 "engines/director/lingo/lingo-gr.y"
+#line 119 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1650,12 +1650,12 @@ yyreduce:
break;
case 15:
-#line 126 "engines/director/lingo/lingo-gr.y"
+#line 127 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 18:
-#line 133 "engines/director/lingo/lingo-gr.y"
+#line 134 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1665,7 +1665,7 @@ yyreduce:
break;
case 19:
-#line 144 "engines/director/lingo/lingo-gr.y"
+#line 145 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1681,7 +1681,7 @@ yyreduce:
break;
case 20:
-#line 160 "engines/director/lingo/lingo-gr.y"
+#line 161 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1697,39 +1697,44 @@ yyreduce:
break;
case 21:
-#line 174 "engines/director/lingo/lingo-gr.y"
+#line 175 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
WRITE_UINT32(&end, (yyvsp[(6) - (6)].code));
(*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 3] = end; ;}
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 3] = end; /* end, if cond fails */
+
+ g_lingo->processIf((yyvsp[(6) - (6)].code)); ;}
break;
case 22:
-#line 180 "engines/director/lingo/lingo-gr.y"
+#line 183 "engines/director/lingo/lingo-gr.y"
{
- inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (12)].code));
- WRITE_UINT32(&else1, (yyvsp[(9) - (12)].code));
- WRITE_UINT32(&end, (yyvsp[(11) - (12)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; ;}
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(4) - (12)].code));
+ WRITE_UINT32(&else1, (yyvsp[(9) - (12)].code));
+ WRITE_UINT32(&end, (yyvsp[(11) - (12)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; /* end, if cond fails */
+
+ g_lingo->processIf((yyvsp[(11) - (12)].code)); ;}
break;
case 23:
-#line 190 "engines/director/lingo/lingo-gr.y"
+#line 195 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
WRITE_UINT32(&end, (yyvsp[(5) - (7)].code));
(*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; ;}
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; /* end, if cond fails */
+ g_lingo->processIf((yyvsp[(5) - (7)].code)); ;}
break;
case 24:
-#line 196 "engines/director/lingo/lingo-gr.y"
+#line 202 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1737,11 +1742,12 @@ yyreduce:
WRITE_UINT32(&end, (yyvsp[(8) - (10)].code));
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; /* end, if cond fails */
+ g_lingo->processIf((yyvsp[(8) - (10)].code)); ;}
break;
case 25:
-#line 204 "engines/director/lingo/lingo-gr.y"
+#line 211 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1749,50 +1755,47 @@ yyreduce:
WRITE_UINT32(&end, (yyvsp[(8) - (10)].code));
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; ;}
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; /* end, if cond fails */
+ g_lingo->processIf((yyvsp[(8) - (10)].code)); ;}
break;
case 28:
-#line 218 "engines/director/lingo/lingo-gr.y"
+#line 226 "engines/director/lingo/lingo-gr.y"
{
- inst then = 0, else1 = 0, end = 0;
+ inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
- WRITE_UINT32(&else1, 0);
- WRITE_UINT32(&end, 0);
- (*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(2) - (6)].code) + 3] = end; ;}
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 1] = then; /* thenpart */
+
+ g_lingo->codeLabel((yyvsp[(1) - (6)].code)); ;}
break;
case 29:
-#line 226 "engines/director/lingo/lingo-gr.y"
+#line 232 "engines/director/lingo/lingo-gr.y"
{
- inst then = 0, else1 = 0, end = 0;
+ inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (4)].code));
- WRITE_UINT32(&else1, 0);
- WRITE_UINT32(&end, 0);
- (*g_lingo->_currentScript)[(yyvsp[(2) - (4)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(2) - (4)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(2) - (4)].code) + 3] = end; ;}
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (4)].code) + 1] = then; /* thenpart */
+
+ g_lingo->codeLabel((yyvsp[(1) - (4)].code)); ;}
break;
case 30:
-#line 237 "engines/director/lingo/lingo-gr.y"
+#line 240 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
case 31:
-#line 238 "engines/director/lingo/lingo-gr.y"
+#line 241 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
case 33:
-#line 241 "engines/director/lingo/lingo-gr.y"
+#line 244 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
case 34:
-#line 243 "engines/director/lingo/lingo-gr.y"
+#line 246 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1801,32 +1804,35 @@ yyreduce:
break;
case 35:
-#line 249 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
+#line 252 "engines/director/lingo/lingo-gr.y"
+ {
+ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
+ g_lingo->code3(STOP, STOP, STOP);
+ g_lingo->codeLabel(0); ;}
break;
case 36:
-#line 251 "engines/director/lingo/lingo-gr.y"
+#line 257 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
break;
case 37:
-#line 253 "engines/director/lingo/lingo-gr.y"
+#line 259 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 38:
-#line 255 "engines/director/lingo/lingo-gr.y"
+#line 261 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 39:
-#line 257 "engines/director/lingo/lingo-gr.y"
+#line 263 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 42:
-#line 262 "engines/director/lingo/lingo-gr.y"
+#line 268 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1835,14 +1841,14 @@ yyreduce:
break;
case 43:
-#line 267 "engines/director/lingo/lingo-gr.y"
+#line 273 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
case 44:
-#line 270 "engines/director/lingo/lingo-gr.y"
+#line 276 "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));
@@ -1852,7 +1858,7 @@ yyreduce:
break;
case 45:
-#line 276 "engines/director/lingo/lingo-gr.y"
+#line 282 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1864,120 +1870,120 @@ yyreduce:
break;
case 46:
-#line 284 "engines/director/lingo/lingo-gr.y"
+#line 290 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
case 48:
-#line 288 "engines/director/lingo/lingo-gr.y"
+#line 294 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
case 49:
-#line 289 "engines/director/lingo/lingo-gr.y"
+#line 295 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
case 50:
-#line 290 "engines/director/lingo/lingo-gr.y"
+#line 296 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
case 51:
-#line 291 "engines/director/lingo/lingo-gr.y"
+#line 297 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
case 52:
-#line 292 "engines/director/lingo/lingo-gr.y"
+#line 298 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
case 53:
-#line 293 "engines/director/lingo/lingo-gr.y"
+#line 299 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
case 54:
-#line 294 "engines/director/lingo/lingo-gr.y"
+#line 300 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
case 55:
-#line 295 "engines/director/lingo/lingo-gr.y"
+#line 301 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
case 56:
-#line 296 "engines/director/lingo/lingo-gr.y"
+#line 302 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
case 57:
-#line 297 "engines/director/lingo/lingo-gr.y"
+#line 303 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 58:
-#line 298 "engines/director/lingo/lingo-gr.y"
+#line 304 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 59:
-#line 299 "engines/director/lingo/lingo-gr.y"
+#line 305 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 60:
-#line 302 "engines/director/lingo/lingo-gr.y"
+#line 308 "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 61:
-#line 303 "engines/director/lingo/lingo-gr.y"
+#line 309 "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 62:
-#line 304 "engines/director/lingo/lingo-gr.y"
+#line 310 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 64:
-#line 306 "engines/director/lingo/lingo-gr.y"
+#line 312 "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 66:
-#line 311 "engines/director/lingo/lingo-gr.y"
+#line 317 "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 67:
-#line 312 "engines/director/lingo/lingo-gr.y"
+#line 318 "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 68:
-#line 323 "engines/director/lingo/lingo-gr.y"
+#line 329 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 69:
-#line 324 "engines/director/lingo/lingo-gr.y"
+#line 330 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 70:
-#line 325 "engines/director/lingo/lingo-gr.y"
+#line 331 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 71:
-#line 326 "engines/director/lingo/lingo-gr.y"
+#line 332 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1986,7 +1992,7 @@ yyreduce:
break;
case 72:
-#line 331 "engines/director/lingo/lingo-gr.y"
+#line 337 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -1996,7 +2002,7 @@ yyreduce:
break;
case 73:
-#line 337 "engines/director/lingo/lingo-gr.y"
+#line 343 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2005,47 +2011,47 @@ yyreduce:
break;
case 74:
-#line 344 "engines/director/lingo/lingo-gr.y"
+#line 350 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 75:
-#line 345 "engines/director/lingo/lingo-gr.y"
+#line 351 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 76:
-#line 346 "engines/director/lingo/lingo-gr.y"
+#line 352 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 77:
-#line 347 "engines/director/lingo/lingo-gr.y"
+#line 353 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 78:
-#line 350 "engines/director/lingo/lingo-gr.y"
+#line 356 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 79:
-#line 351 "engines/director/lingo/lingo-gr.y"
+#line 357 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 80:
-#line 352 "engines/director/lingo/lingo-gr.y"
+#line 358 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 81:
-#line 380 "engines/director/lingo/lingo-gr.y"
+#line 386 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 82:
-#line 381 "engines/director/lingo/lingo-gr.y"
+#line 387 "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);
@@ -2054,32 +2060,32 @@ yyreduce:
break;
case 83:
-#line 387 "engines/director/lingo/lingo-gr.y"
+#line 393 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 84:
-#line 388 "engines/director/lingo/lingo-gr.y"
+#line 394 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 85:
-#line 389 "engines/director/lingo/lingo-gr.y"
+#line 395 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 86:
-#line 390 "engines/director/lingo/lingo-gr.y"
+#line 396 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 87:
-#line 392 "engines/director/lingo/lingo-gr.y"
+#line 398 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
case 88:
-#line 395 "engines/director/lingo/lingo-gr.y"
+#line 401 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2089,23 +2095,23 @@ yyreduce:
break;
case 89:
-#line 403 "engines/director/lingo/lingo-gr.y"
+#line 409 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 90:
-#line 404 "engines/director/lingo/lingo-gr.y"
+#line 410 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
case 91:
-#line 405 "engines/director/lingo/lingo-gr.y"
+#line 411 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2109 "engines/director/lingo/lingo-gr.cpp"
+#line 2115 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2319,6 +2325,6 @@ yyreturn:
}
-#line 408 "engines/director/lingo/lingo-gr.y"
+#line 414 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 2b3f0cf..231877d 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -74,11 +74,12 @@ using namespace Director;
%token<i> INT
%token<f> FLOAT
%token<s> BLTIN ID STRING HANDLER
-%token tDOWN tELSE tELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO tMCI tMCIWAIT
-%token tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO tWITH tWHILE
+%token tDOWN tELSE tELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
+%token tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO
+%token tWITH tWHILE
%token tGE tLE tGT tLT tEQ tNEQ
-%type<code> asgn begin cond elseif end expr if repeatwhile repeatwith stmtlist
+%type<code> asgn begin elseif end expr if repeatwhile repeatwith stmtlist
%type<s> gotoframe gotomovie
%type<narg> argdef arglist
@@ -176,15 +177,19 @@ stmtoneliner: if cond tTHEN begin stmt end {
WRITE_UINT32(&then, $4);
WRITE_UINT32(&end, $6);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
+
+ g_lingo->processIf($6); }
| if cond tTHEN begin stmt end '\n' tELSE begin stmt end '\n' {
- inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, $4);
- WRITE_UINT32(&else1, $9);
- WRITE_UINT32(&end, $11);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&else1, $9);
+ WRITE_UINT32(&end, $11);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
+
+ g_lingo->processIf($11); }
;
ifstmt: if cond tTHEN stmtlist end tEND tIF {
@@ -192,7 +197,8 @@ ifstmt: if cond tTHEN stmtlist end tEND tIF {
WRITE_UINT32(&then, $4);
WRITE_UINT32(&end, $5);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
+ g_lingo->processIf($5); }
| if cond tTHEN stmtlist end tELSE stmtlist end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $4);
@@ -200,7 +206,8 @@ ifstmt: if cond tTHEN stmtlist end tEND tIF {
WRITE_UINT32(&end, $8);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
+ g_lingo->processIf($8); }
| if cond tTHEN stmtlist end begin elseifstmt end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $4);
@@ -208,7 +215,8 @@ ifstmt: if cond tTHEN stmtlist end tEND tIF {
WRITE_UINT32(&end, $8);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[$1 + 3] = end; } /* end, if cond fails */
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
+ g_lingo->processIf($8); }
;
elseifstmt: elseifstmt1 elseifstmt
@@ -216,22 +224,17 @@ elseifstmt: elseifstmt1 elseifstmt
;
elseifstmt1: elseif cond tTHEN begin stmt '\n' {
- inst then = 0, else1 = 0, end = 0;
+ inst then = 0;
WRITE_UINT32(&then, $4);
- WRITE_UINT32(&else1, 0);
- WRITE_UINT32(&end, 0);
- (*g_lingo->_currentScript)[$2 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$2 + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[$2 + 3] = end; } /* end, if cond fails */
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+
+ g_lingo->codeLabel($1); }
| elseif cond tTHEN stmtlist {
- inst then = 0, else1 = 0, end = 0;
+ inst then = 0;
WRITE_UINT32(&then, $4);
- WRITE_UINT32(&else1, 0);
- WRITE_UINT32(&end, 0);
- (*g_lingo->_currentScript)[$2 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$2 + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[$2 + 3] = end; } /* end, if cond fails */
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ g_lingo->codeLabel($1); }
;
cond: expr { g_lingo->code1(STOP); }
@@ -246,7 +249,10 @@ repeatwith: tREPEAT tWITH ID {
g_lingo->codeString($3->c_str());
delete $3; }
;
-if: tIF { $$ = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); }
+if: tIF {
+ $$ = g_lingo->code1(g_lingo->c_ifcode);
+ g_lingo->code3(STOP, STOP, STOP);
+ g_lingo->codeLabel(0); } // Mark beginning of the if() statement
;
elseif: tELSIF { $$ = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); }
;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 8885b7f..8300800 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -145,6 +145,7 @@ public:
Symbol *lookupVar(const char *name, bool create = true, bool putInGlobalList = false);
void cleanLocalVars();
void define(Common::String &s, int start, int nargs);
+ void processIf(int endLabel);
int alignTypes(Datum &d1, Datum &d2);
@@ -152,6 +153,7 @@ public:
int code2(inst code_1, inst code_2) { int o = code1(code_1); code1(code_2); return o; }
int code3(inst code_1, inst code_2, inst code_3) { int o = code1(code_1); code1(code_2); code1(code_3); return o; }
int codeString(const char *s);
+ void codeLabel(int label);
int calcStringAlignment(const char *s) {
return calcCodeAlignment(strlen(s) + 1);
@@ -236,6 +238,7 @@ public:
Common::Array<CFrame *> _callstack;
Common::Array<Common::String *> _argstack;
BuiltinHash _builtins;
+ Common::Array<int> _labelstack;
private:
int parse(const char *code);
Commit: 7ecc1f8da764f870b033167b5bb68c3a701e2ae7
https://github.com/scummvm/scummvm/commit/7ecc1f8da764f870b033167b5bb68c3a701e2ae7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Initial code for processIf()
Changed paths:
engines/director/lingo/lingo-codegen.cpp
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 0f47202..47f723f 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -188,7 +188,6 @@ void Lingo::codeArg(Common::String *s) {
void Lingo::codeArgStore() {
while (true) {
if (_argstack.empty()) {
- warning("Arg stack underflow");
break;
}
@@ -224,6 +223,30 @@ void Lingo::codeLabel(int label) {
}
void Lingo::processIf(int endlabel) {
+ inst ielse1, iend;
+ int else1 = endlabel;
+
+ WRITE_UINT32(&iend, endlabel);
+
+ while (true) {
+ if (_labelstack.empty()) {
+ warning("Label stack underflow");
+ break;
+ }
+
+ int label = _labelstack.back();
+ _labelstack.pop_back();
+
+ // This is beginning of our if()
+ if (label)
+ break;
+
+ WRITE_UINT32(&ielse1, else1);
+ (*_currentScript)[label + 2] = ielse1; /* elsepart */
+ (*_currentScript)[label + 3] = iend; /* end, if cond fails */
+
+ else1 = label;
+ }
}
}
Commit: 6d3f596a25406113cbbe5c03eb6a18bc7b72c5c1
https://github.com/scummvm/scummvm/commit/6d3f596a25406113cbbe5c03eb6a18bc7b72c5c1
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Add Cast, Window, Sprite fields enum
Changed paths:
engines/director/lingo/lingo-the.cpp
engines/director/lingo/lingo-the.h
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index a0a2424..778c967 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -35,10 +35,12 @@ static struct TheEntityProto {
{ kTheMouseH, "mouseh", false },
{ kTheMouseV, "mousev", false },
{ kTheSprite, "sprite", true },
+ { kTheCast, "cast", true },
{ kThePerFrameHook, "perframehook", false },
{ kTheTicks, "ticks", false },
{ kTheTimer, "timer", false },
{ kTheTimeoutLength,"timeoutlength",false },
+ { kTheWindow, "window", false },
{ kTheNOEntity, NULL, false }
};
@@ -52,6 +54,63 @@ static struct TheEntityFieldProto {
{ kTheSprite, "cursor", kTheCursor },
{ kTheSprite, "loch", kTheLocH },
{ kTheSprite, "locv", kTheLocV },
+ { kTheSprite, "backColor", kTheBackColor },
+ { kTheSprite, "blend", kTheBlend },
+ { kTheSprite, "bottom", kTheBottom },
+ { kTheSprite, "constraint", kTheConstraint },
+ { kTheSprite, "editableText", kTheEditableText },
+ { kTheSprite, "foreColor", kTheForeColor },
+ { kTheSprite, "height", kTheHeight },
+ { kTheSprite, "ink", kTheInk },
+ { kTheSprite, "left", kTheLeft },
+ { kTheSprite, "lineSize", kTheLineSize },
+ { kTheSprite, "moveable", kTheMoveable },
+ { kTheSprite, "movieRate", kTheMovieRate },
+ { kTheSprite, "movieTime", kTheMovieTime },
+ { kTheSprite, "right", kTheRight },
+ { kTheSprite, "stopTime", kTheStopTime },
+ { kTheSprite, "stretch", kTheStrech },
+ { kTheSprite, "startTime", kTheStartTime },
+ { kTheSprite, "scriptNum", kTheScriptNum },
+ { kTheSprite, "top", kTheTop },
+ { kTheSprite, "trails", kTheTrails },
+ { kTheSprite, "type", kTheType },
+ { kTheSprite, "visible", kTheVisible },
+ { kTheSprite, "volume", kTheVolume },
+ { kTheSprite, "width", kTheWidth },
+
+ { kTheCast, "backColor", kTheBackColor },
+ { kTheCast, "castType", kTheCastType },
+ { kTheCast, "controller", kTheController },
+ { kTheCast, "depth", kTheDepth },
+ { kTheCast, "directToStage",kTheDirectToStage },
+ { kTheCast, "filename", kTheFilename },
+ { kTheCast, "foreColor", kTheForeColor },
+ { kTheCast, "frameRate", kTheFrameRate },
+ { kTheCast, "hilite", kTheHilite },
+ { kTheCast, "height", kTheHeight },
+ { kTheCast, "loop", kTheLoop },
+ { kTheCast, "loaded", kTheLoaded },
+ { kTheCast, "modified", kTheModified },
+ { kTheCast, "number", kTheNumber },
+ { kTheCast, "name", kTheName },
+ { kTheCast, "palette", kThePalette },
+ { kTheCast, "pausedAtStart",kThePausedAtStart },
+ { kTheCast, "picture", kThePicture },
+ { kTheCast, "preload", kThePreload },
+ { kTheCast, "purgePriority",kThePurgePriority },
+ { kTheCast, "rect", kTheRect },
+ { kTheCast, "regPoint", kTheRegPoint },
+ { kTheCast, "scriptText", kTheScriptText },
+ { kTheCast, "size", kTheSize },
+ { kTheCast, "sound", kTheSound },
+ { kTheCast, "text", kTheText },
+ { kTheCast, "width", kTheWidth },
+
+ { kTheWindow, "drawRect", kTheDrawRect },
+ { kTheWindow, "filename", kTheFilename },
+ { kTheWindow, "sourceRect", kTheSourceRect },
+ { kTheWindow, "visible", kTheVisible },
{ kTheNOEntity, NULL, kTheNOField }
};
diff --git a/engines/director/lingo/lingo-the.h b/engines/director/lingo/lingo-the.h
index e867283..fba9924 100644
--- a/engines/director/lingo/lingo-the.h
+++ b/engines/director/lingo/lingo-the.h
@@ -33,18 +33,70 @@ enum TheEntity {
kTheMouseH,
kTheMouseV,
kTheSprite,
+ kTheCast,
kThePerFrameHook,
kTheTicks,
kTheTimer,
- kTheTimeoutLength
+ kTheTimeoutLength,
+ kTheWindow
};
enum TheField {
kTheNOField = 0,
kTheCastNum = 1,
+ kTheCastType,
+ kTheController,
kTheCursor,
+ kTheDepth,
+ kTheDirectToStage,
+ kTheDrawRect,
kTheLocH,
- kTheLocV
+ kTheLocV,
+ kTheBackColor,
+ kTheBlend,
+ kTheBottom,
+ kTheConstraint,
+ kTheEditableText,
+ kTheForeColor,
+ kTheFrameRate,
+ kTheFilename,
+ kTheHeight,
+ kTheHilite,
+ kTheInk,
+ kTheLeft,
+ kTheLineSize,
+ kTheLoop,
+ kTheLoaded,
+ kTheModified,
+ kTheMoveable,
+ kTheMovieRate,
+ kTheMovieTime,
+ kTheNumber,
+ kTheName,
+ kThePalette,
+ kThePausedAtStart,
+ kThePicture,
+ kThePreload,
+ kThePurgePriority,
+ kTheRect,
+ kTheRegPoint,
+ kTheRight,
+ kTheStopTime,
+ kTheStretch,
+ kTheStartTime,
+ kTheScriptNum,
+ kTheScriptText,
+ kTheSize,
+ kTheStrech,
+ kTheSound,
+ kTheSourceRect,
+ kTheText,
+ kTheTop,
+ kTheTrails,
+ kTheType,
+ kTheVisible,
+ kTheVolume,
+ kTheWidth
};
} // End of namespace Director
Commit: fb51685b07131d0fe62d2efd6d6eb068ae896792
https://github.com/scummvm/scummvm/commit/fb51685b07131d0fe62d2efd6d6eb068ae896792
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Add Menu, MenuItem, key, script entity enum
Changed paths:
engines/director/lingo/lingo-the.cpp
engines/director/lingo/lingo-the.h
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 778c967..168e9ee 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -29,19 +29,39 @@ static struct TheEntityProto {
const char *name;
bool hasID;
} entities[] = {
- { kTheFrame, "frame", false },
- { kThePathName, "pathname", false },
- { kTheMovie, "movie", false },
- { kTheMouseH, "mouseh", false },
- { kTheMouseV, "mousev", false },
- { kTheSprite, "sprite", true },
- { kTheCast, "cast", true },
- { kThePerFrameHook, "perframehook", false },
- { kTheTicks, "ticks", false },
- { kTheTimer, "timer", false },
- { kTheTimeoutLength,"timeoutlength",false },
- { kTheWindow, "window", false },
-
+ { kTheFrame, "frame", false },
+ { kThePathName, "pathname", false },
+ { kTheMovie, "movie", false },
+ { kTheMouseH, "mouseh", false },
+ { kTheMouseV, "mousev", false },
+ { kTheMouseDownScript, "mouseDownScript", false },
+ { kTheMouseUpScript, "mouseUpScript", false },
+ { kTheClickOn, "clickOn", false },
+ { kTheDoubleClick, "doubleClick", false },
+ { kTheLastClick, "lastClick", false },
+ { kTheLastFrame, "lastFrame", false },
+ { kTheLastEvent, "lastEvent", false },
+ { kTheMouseUp, "mouseUp", false },
+ { kTheMouseDown, "mouseDown", false },
+ { kTheRightMouseUp, "rightMouseUp", false },
+ { kTheRightMouseDown, "rightMouseDown", false },
+ { kTheStillDown, "stillDown", false },
+ { kTheKey, "key", false },
+ { kTheControlDown, "controlDown", false },
+ { kTheCommandDown, "commandDown", false },
+ { kTheShiftDown, "shiftDown", false },
+ { kTheOptionDown, "optionDown", false },
+ { kTheMenu, "menu", true },
+ { kTheMenus, "menus", false },
+ { kTheMenuItem, "menuitem", true },
+ { kTheMenuItems, "menuitems", true },
+ { kTheSprite, "sprite", true },
+ { kTheCast, "cast", true },
+ { kThePerFrameHook, "perframehook", false },
+ { kTheTicks, "ticks", false },
+ { kTheTimer, "timer", false },
+ { kTheTimeoutLength, "timeoutlength", false },
+ { kTheWindow, "window", false },
{ kTheNOEntity, NULL, false }
};
@@ -112,6 +132,16 @@ static struct TheEntityFieldProto {
{ kTheWindow, "sourceRect", kTheSourceRect },
{ kTheWindow, "visible", kTheVisible },
+ { kTheMenuItem, "checkmark", kTheCheckMark },
+ { kTheMenuItem, "enabled", kTheEnabled },
+ { kTheMenuItem, "name", kTheName },
+ { kTheMenuItem, "name", kTheScript },
+
+ { kTheMenu, "name", kTheName },
+
+ { kTheMenuItems,"number", kTheNumber },
+ { kTheMenus, "number", kTheNumber },
+
{ kTheNOEntity, NULL, kTheNOField }
};
diff --git a/engines/director/lingo/lingo-the.h b/engines/director/lingo/lingo-the.h
index fba9924..6fc62f8 100644
--- a/engines/director/lingo/lingo-the.h
+++ b/engines/director/lingo/lingo-the.h
@@ -29,22 +29,46 @@ enum TheEntity {
kTheNOEntity = 0,
kTheFrame = 1,
kThePathName,
+ kTheMenu,
+ kTheMenuItem,
+ kTheMenuItems,
+ kTheMenus,
kTheMovie,
kTheMouseH,
kTheMouseV,
+ kTheMouseDownScript,
+ kTheMouseUpScript,
+
kTheSprite,
kTheCast,
kThePerFrameHook,
kTheTicks,
kTheTimer,
kTheTimeoutLength,
- kTheWindow
+ kTheWindow,
+
+ kTheClickOn,
+ kTheDoubleClick,
+ kTheLastClick,
+ kTheLastFrame,
+ kTheLastEvent,
+ kTheMouseDown,
+ kTheMouseUp,
+ kTheRightMouseUp,
+ kTheRightMouseDown,
+ kTheStillDown,
+ kTheKey,
+ kTheControlDown,
+ kTheCommandDown,
+ kTheShiftDown,
+ kTheOptionDown
};
enum TheField {
kTheNOField = 0,
kTheCastNum = 1,
kTheCastType,
+ kTheCheckMark,
kTheController,
kTheCursor,
kTheDepth,
@@ -57,6 +81,7 @@ enum TheField {
kTheBottom,
kTheConstraint,
kTheEditableText,
+ kTheEnabled,
kTheForeColor,
kTheFrameRate,
kTheFilename,
@@ -84,6 +109,7 @@ enum TheField {
kTheStopTime,
kTheStretch,
kTheStartTime,
+ kTheScript,
kTheScriptNum,
kTheScriptText,
kTheSize,
Commit: bb469dc84d9935335372c3c84c99ea99c06c3be4
https://github.com/scummvm/scummvm/commit/bb469dc84d9935335372c3c84c99ea99c06c3be4
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Set/Get common sprite fields
Changed paths:
engines/director/lingo/lingo-the.cpp
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 168e9ee..f772d04 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -24,6 +24,8 @@
namespace Director {
+class Sprite;
+
static struct TheEntityProto {
TheEntity entity;
const char *name;
@@ -159,10 +161,28 @@ void Lingo::setTheEntity(TheEntity entity, int id, TheField field, Datum &d) {
}
void Lingo::setTheSprite(int id, TheField field, Datum &d) {
+ Sprite *sprite = _vm->_currentScore->getSpriteById(id);
+
switch (field) {
case kTheCastNum:
- warning("STUB: setting thecastnum of sprite %d", id);
+ if (_vm->_currentScore->_casts.contains(d.u.i)) {
+ sprite->_cast = _vm->_currentScore->_casts[d.u.i];
+ sprite->_castId = d.u.i;
+ }
+ break;
+ case kTheWidth:
+ sprite->_width = d.u.i;
+ break;
+ case kTheHeight:
+ sprite->_height = d.u.i;
break;
+ case kTheTrails:
+ sprite->_trails = d.u.i;
+ break;
+ case kTheInk:
+ sprite->_ink = static_cast<InkType>(d.u.i);
+ break;
+
default:
error("Unprocessed setting field %d of sprite", field);
}
@@ -187,10 +207,27 @@ Datum Lingo::getTheEntity(TheEntity entity, int id, TheField field) {
Datum Lingo::getTheSprite(int id, TheField field) {
Datum d;
-
+ Sprite *sprite = _vm->_currentScore->getSpriteById(id);
switch (field) {
case kTheCastNum:
- warning("STUB: getting thecastnum of sprite %d", id);
+ d.type = INT;
+ d.u.i = sprite->_castId;
+ break;
+ case kTheWidth:
+ d.type = INT;
+ d.u.i = sprite->_width;
+ break;
+ case kTheHeight:
+ d.type = INT;
+ d.u.i = sprite->_height;
+ break;
+ case kTheTrails:
+ d.type = INT;
+ d.u.i = sprite->_trails;
+ break;
+ case kTheInk:
+ d.type = INT;
+ d.u.i = sprite->_ink;
break;
default:
error("Unprocessed getting field %d of sprite", field);
@@ -199,4 +236,5 @@ Datum Lingo::getTheSprite(int id, TheField field) {
return d;
}
+
} // End of namespace Director
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 9e17498..dd3ab54 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -821,6 +821,14 @@ void Score::processEvents() {
}
}
+Sprite *Score::getSpriteById(uint16 id) {
+ if (_frames[_currentFrame]->_sprites[id]) {
+ return _frames[_currentFrame]->_sprites[id];
+ } else {
+ error("Sprite on frame %d width id %d not found", _currentFrame, id);
+ }
+}
+
Frame::Frame(DirectorEngine *vm) {
_vm = vm;
_transDuration = 0;
diff --git a/engines/director/score.h b/engines/director/score.h
index 8a3400b..ee0eaa2 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -356,6 +356,7 @@ public:
void loadCastData(Common::SeekableSubReadStreamEndian &stream);
void setCurrentFrame(uint16 frameId) { _currentFrame = frameId; }
Common::String getMacName() const { return _macName; }
+ Sprite *getSpriteById(uint16 id);
private:
void update();
void readVersion(uint32 rid);
Commit: 22f72fc2a71891368799f1400ab8278d0f8c1d7f
https://github.com/scummvm/scummvm/commit/22f72fc2a71891368799f1400ab8278d0f8c1d7f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Optimise 'the' setters and getters.
Changed paths:
engines/director/lingo/lingo-the.cpp
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index f772d04..4d54110 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -163,6 +163,8 @@ void Lingo::setTheEntity(TheEntity entity, int id, TheField field, Datum &d) {
void Lingo::setTheSprite(int id, TheField field, Datum &d) {
Sprite *sprite = _vm->_currentScore->getSpriteById(id);
+ d.toInt(); // Enforce Integer
+
switch (field) {
case kTheCastNum:
if (_vm->_currentScore->_casts.contains(d.u.i)) {
@@ -208,25 +210,23 @@ Datum Lingo::getTheEntity(TheEntity entity, int id, TheField field) {
Datum Lingo::getTheSprite(int id, TheField field) {
Datum d;
Sprite *sprite = _vm->_currentScore->getSpriteById(id);
+
+ d.type = INT;
+
switch (field) {
case kTheCastNum:
- d.type = INT;
d.u.i = sprite->_castId;
break;
case kTheWidth:
- d.type = INT;
d.u.i = sprite->_width;
break;
case kTheHeight:
- d.type = INT;
d.u.i = sprite->_height;
break;
case kTheTrails:
- d.type = INT;
d.u.i = sprite->_trails;
break;
case kTheInk:
- d.type = INT;
d.u.i = sprite->_ink;
break;
default:
Commit: 2dba6126b72cfcc1643e7623e6f558a41931bf37
https://github.com/scummvm/scummvm/commit/2dba6126b72cfcc1643e7623e6f558a41931bf37
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Eat all leading whitespaces
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index e145a4d..d9e4312 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -92,20 +92,22 @@ Common::Error DirectorEngine::run() {
_lingo = new Lingo(this);
_soundManager = new DirectorSound();
-#if 0
+#if 1
_lingo->addCode("--\n\
- if 5 then\n\
- exit\n\
- else if 6 then\n\
- put x\n\
- exit\n\
- else if 7 then exit\n\
- end if\n\
- if 5 then exit\n\
- else exit\n\
+ -- repeat with x = 1 to 5\n\
+ if x = 1 then\n\
+ put 1\n\
+ else if x = 2 then\n\
+ put 2.1\n\
+ put 2.2\n\
+ else if x = 3 then put 3\n\
+ end if\n\
+ if x = 4 then put 4\n\
+ else put 5\n\
+ -- end repeat\n\
", kMovieScript, 2);
-//_lingo->executeScript(kMovieScript, 2);
+_lingo->executeScript(kMovieScript, 2);
return Common::kNoError;
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index bbe4275..6abaa99 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -373,7 +373,7 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[124] =
+static yyconst flex_int16_t yy_accept[126] =
{ 0,
0, 0, 40, 38, 3, 36, 36, 38, 38, 38,
35, 35, 34, 35, 35, 32, 32, 32, 32, 32,
@@ -381,14 +381,14 @@ static yyconst flex_int16_t yy_accept[124] =
2, 2, 3, 36, 0, 29, 0, 37, 1, 33,
34, 31, 30, 32, 32, 32, 32, 32, 32, 32,
12, 5, 32, 32, 32, 32, 32, 32, 20, 32,
- 32, 32, 32, 32, 26, 32, 32, 1, 33, 32,
- 32, 8, 32, 32, 32, 32, 32, 32, 16, 32,
- 32, 32, 22, 32, 24, 32, 32, 32, 4, 7,
- 9, 32, 32, 13, 14, 32, 32, 32, 19, 32,
-
- 32, 25, 32, 27, 0, 10, 32, 15, 32, 18,
- 32, 32, 28, 0, 11, 32, 32, 23, 6, 17,
- 32, 21, 0
+ 32, 32, 32, 32, 26, 32, 32, 2, 2, 1,
+ 33, 32, 32, 8, 32, 32, 32, 32, 32, 32,
+ 16, 32, 32, 32, 22, 32, 24, 32, 32, 32,
+ 4, 7, 9, 32, 32, 13, 14, 32, 32, 32,
+
+ 19, 32, 32, 25, 32, 27, 0, 10, 32, 15,
+ 32, 18, 32, 32, 28, 0, 11, 32, 32, 23,
+ 6, 17, 32, 21, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -433,43 +433,43 @@ static yyconst flex_int32_t yy_meta[58] =
4, 4, 4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[127] =
+static yyconst flex_int16_t yy_base[129] =
{ 0,
- 0, 56, 250, 287, 60, 56, 63, 66, 236, 241,
- 287, 236, 62, 228, 203, 0, 46, 50, 46, 53,
+ 0, 56, 218, 295, 60, 56, 63, 66, 199, 167,
+ 295, 164, 62, 158, 157, 0, 46, 50, 46, 53,
62, 51, 75, 64, 64, 78, 68, 72, 93, 94,
- 123, 131, 141, 90, 145, 287, 161, 287, 0, 147,
- 108, 287, 287, 0, 45, 89, 112, 108, 125, 123,
+ 123, 131, 141, 90, 145, 295, 161, 295, 0, 147,
+ 108, 295, 295, 0, 45, 89, 112, 108, 125, 123,
0, 0, 122, 127, 139, 134, 125, 124, 0, 142,
- 131, 135, 133, 147, 0, 144, 137, 0, 112, 143,
- 152, 0, 141, 148, 161, 154, 158, 162, 161, 174,
- 168, 167, 0, 179, 0, 175, 179, 183, 0, 83,
- 0, 187, 192, 0, 0, 181, 195, 192, 0, 189,
-
- 199, 0, 196, 0, 233, 0, 193, 0, 201, 0,
- 198, 199, 0, 220, 0, 210, 210, 0, 287, 0,
- 213, 0, 287, 278, 118, 282
+ 131, 135, 133, 147, 0, 144, 137, 189, 193, 0,
+ 112, 155, 158, 0, 155, 174, 185, 176, 176, 176,
+ 172, 179, 177, 176, 0, 192, 0, 186, 189, 193,
+ 0, 83, 0, 197, 202, 0, 0, 191, 205, 203,
+
+ 0, 206, 217, 0, 217, 0, 241, 0, 216, 0,
+ 222, 0, 219, 216, 0, 229, 0, 220, 220, 0,
+ 295, 0, 224, 0, 295, 286, 118, 290
} ;
-static yyconst flex_int16_t yy_def[127] =
+static yyconst flex_int16_t yy_def[129] =
{ 0,
- 123, 1, 123, 123, 123, 123, 123, 123, 123, 124,
- 123, 123, 123, 123, 123, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 123, 123, 123, 123, 123, 123, 124, 123, 126, 123,
- 123, 123, 123, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 126, 123, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
-
- 125, 125, 125, 125, 123, 125, 125, 125, 125, 125,
- 125, 125, 125, 123, 125, 125, 125, 125, 123, 125,
- 125, 125, 0, 123, 123, 123
+ 125, 1, 125, 125, 125, 125, 125, 125, 125, 126,
+ 125, 125, 125, 125, 125, 127, 127, 127, 127, 127,
+ 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
+ 125, 125, 125, 125, 125, 125, 126, 125, 128, 125,
+ 125, 125, 125, 127, 127, 127, 127, 127, 127, 127,
+ 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
+ 127, 127, 127, 127, 127, 127, 127, 125, 125, 128,
+ 125, 127, 127, 127, 127, 127, 127, 127, 127, 127,
+ 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
+ 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
+
+ 127, 127, 127, 127, 127, 127, 125, 127, 127, 127,
+ 127, 127, 127, 127, 127, 125, 127, 127, 127, 127,
+ 125, 127, 127, 127, 0, 125, 125, 125
} ;
-static yyconst flex_int16_t yy_nxt[345] =
+static yyconst flex_int16_t yy_nxt[353] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
13, 14, 11, 15, 16, 16, 16, 17, 18, 19,
@@ -478,40 +478,41 @@ static yyconst flex_int16_t yy_nxt[345] =
18, 19, 20, 16, 21, 22, 23, 24, 25, 26,
27, 28, 29, 16, 16, 30, 16, 31, 34, 34,
32, 33, 34, 34, 35, 34, 34, 35, 34, 34,
- 35, 40, 41, 45, 46, 49, 47, 50, 54, 70,
- 51, 52, 58, 59, 105, 48, 62, 105, 53, 55,
+ 35, 40, 41, 45, 46, 49, 47, 50, 54, 72,
+ 51, 52, 58, 59, 107, 48, 62, 107, 53, 55,
63, 56, 34, 34, 45, 46, 49, 47, 50, 54,
- 70, 51, 57, 52, 58, 59, 48, 60, 62, 53,
- 61, 55, 63, 56, 64, 66, 67, 40, 41, 71,
- 65, 44, 69, 57, 33, 34, 34, 35, 60, 72,
- 73, 61, 35, 34, 34, 35, 64, 66, 67, 74,
- 71, 65, 33, 34, 34, 35, 35, 34, 34, 35,
- 75, 72, 73, 76, 77, 78, 79, 69, 80, 81,
- 82, 74, 83, 84, 85, 86, 87, 38, 88, 89,
- 90, 75, 91, 92, 76, 77, 93, 78, 79, 80,
- 81, 94, 82, 83, 84, 85, 95, 86, 87, 88,
- 89, 96, 90, 91, 92, 97, 98, 101, 93, 99,
-
- 100, 102, 94, 103, 104, 106, 107, 95, 108, 109,
- 110, 111, 96, 112, 113, 43, 97, 115, 98, 101,
- 99, 100, 102, 116, 103, 117, 104, 106, 107, 108,
- 118, 109, 110, 111, 105, 112, 113, 105, 115, 119,
- 42, 120, 121, 122, 39, 116, 117, 38, 36, 123,
- 123, 118, 123, 123, 123, 114, 123, 123, 123, 123,
- 123, 119, 120, 121, 122, 123, 123, 123, 123, 123,
- 123, 123, 123, 123, 123, 123, 123, 114, 37, 123,
- 37, 37, 68, 123, 123, 68, 3, 123, 123, 123,
- 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
-
- 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- 123, 123, 123, 123
+ 72, 51, 57, 52, 58, 59, 48, 60, 62, 53,
+ 61, 55, 63, 56, 64, 66, 67, 40, 41, 73,
+ 65, 44, 71, 57, 68, 34, 34, 69, 60, 74,
+ 75, 61, 69, 34, 34, 69, 64, 66, 67, 76,
+ 73, 65, 33, 34, 34, 35, 35, 34, 34, 35,
+ 77, 74, 75, 78, 79, 80, 81, 71, 82, 83,
+ 84, 76, 85, 86, 87, 88, 89, 38, 90, 43,
+ 42, 77, 39, 38, 78, 79, 92, 80, 81, 82,
+ 83, 91, 84, 85, 86, 87, 93, 88, 89, 90,
+ 68, 34, 34, 69, 69, 34, 34, 69, 92, 94,
+
+ 95, 100, 91, 96, 97, 98, 99, 93, 101, 102,
+ 103, 36, 104, 105, 106, 108, 109, 125, 110, 111,
+ 94, 112, 95, 100, 96, 97, 98, 99, 113, 101,
+ 102, 114, 103, 104, 105, 115, 106, 108, 109, 110,
+ 117, 111, 107, 112, 118, 107, 119, 120, 121, 125,
+ 113, 122, 123, 114, 124, 125, 125, 115, 125, 125,
+ 125, 117, 125, 116, 125, 125, 118, 119, 120, 125,
+ 121, 125, 122, 123, 125, 124, 125, 125, 125, 125,
+ 125, 125, 125, 125, 125, 116, 37, 125, 37, 37,
+ 70, 125, 125, 70, 3, 125, 125, 125, 125, 125,
+
+ 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
+ 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
+ 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
+ 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
+ 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
+ 125, 125
} ;
-static yyconst flex_int16_t yy_chk[345] =
+static yyconst flex_int16_t yy_chk[353] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -521,36 +522,37 @@ static yyconst flex_int16_t yy_chk[345] =
1, 1, 1, 1, 1, 1, 1, 2, 6, 6,
2, 5, 5, 5, 5, 7, 7, 8, 8, 8,
8, 13, 13, 17, 18, 19, 18, 20, 22, 45,
- 20, 21, 24, 25, 90, 18, 27, 90, 21, 23,
+ 20, 21, 24, 25, 92, 18, 27, 92, 21, 23,
28, 23, 34, 34, 17, 18, 19, 18, 20, 22,
45, 20, 23, 21, 24, 25, 18, 26, 27, 21,
26, 23, 28, 23, 29, 30, 30, 41, 41, 46,
- 29, 125, 69, 23, 31, 31, 31, 31, 26, 47,
+ 29, 127, 71, 23, 31, 31, 31, 31, 26, 47,
48, 26, 32, 32, 32, 32, 29, 30, 30, 49,
46, 29, 33, 33, 33, 33, 35, 35, 35, 35,
50, 47, 48, 53, 54, 55, 56, 40, 57, 58,
- 60, 49, 61, 62, 63, 64, 66, 37, 67, 70,
- 71, 50, 73, 74, 53, 54, 75, 55, 56, 57,
- 58, 76, 60, 61, 62, 63, 77, 64, 66, 67,
- 70, 78, 71, 73, 74, 79, 80, 84, 75, 81,
-
- 82, 86, 76, 87, 88, 92, 93, 77, 96, 97,
- 98, 100, 78, 101, 103, 15, 79, 107, 80, 84,
- 81, 82, 86, 109, 87, 111, 88, 92, 93, 96,
- 112, 97, 98, 100, 105, 101, 103, 105, 107, 114,
- 14, 116, 117, 121, 12, 109, 111, 10, 9, 3,
- 0, 112, 0, 0, 0, 105, 0, 0, 0, 0,
- 0, 114, 116, 117, 121, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 105, 124, 0,
- 124, 124, 126, 0, 0, 126, 123, 123, 123, 123,
- 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
-
- 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- 123, 123, 123, 123
+ 60, 49, 61, 62, 63, 64, 66, 37, 67, 15,
+ 14, 50, 12, 10, 53, 54, 73, 55, 56, 57,
+ 58, 72, 60, 61, 62, 63, 75, 64, 66, 67,
+ 68, 68, 68, 68, 69, 69, 69, 69, 73, 76,
+
+ 77, 82, 72, 78, 79, 80, 81, 75, 83, 84,
+ 86, 9, 88, 89, 90, 94, 95, 3, 98, 99,
+ 76, 100, 77, 82, 78, 79, 80, 81, 102, 83,
+ 84, 103, 86, 88, 89, 105, 90, 94, 95, 98,
+ 109, 99, 107, 100, 111, 107, 113, 114, 116, 0,
+ 102, 118, 119, 103, 123, 0, 0, 105, 0, 0,
+ 0, 109, 0, 107, 0, 0, 111, 113, 114, 0,
+ 116, 0, 118, 119, 0, 123, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 107, 126, 0, 126, 126,
+ 128, 0, 0, 128, 125, 125, 125, 125, 125, 125,
+
+ 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
+ 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
+ 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
+ 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
+ 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
+ 125, 125
} ;
static yy_state_type yy_last_accepting_state;
@@ -600,7 +602,7 @@ char *yytext;
int yyparse();
-#line 604 "engines/director/lingo/lingo-lex.cpp"
+#line 606 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -788,7 +790,7 @@ YY_DECL
#line 45 "engines/director/lingo/lingo-lex.l"
-#line 792 "engines/director/lingo/lingo-lex.cpp"
+#line 794 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -842,13 +844,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 >= 124 )
+ if ( yy_current_state >= 126 )
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] != 287 );
+ while ( yy_base[yy_current_state] != 295 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -1075,7 +1077,7 @@ YY_RULE_SETUP
#line 96 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1079 "engines/director/lingo/lingo-lex.cpp"
+#line 1081 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1368,7 +1370,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 >= 124 )
+ if ( yy_current_state >= 126 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1396,11 +1398,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 >= 124 )
+ if ( yy_current_state >= 126 )
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 == 123);
+ yy_is_jam = (yy_current_state == 125);
return yy_is_jam ? 0 : yy_current_state;
}
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 2580f4f..8ad8733 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -45,8 +45,8 @@ whitespace [\t ]
%%
--[^\r\n]*
-^{whitespace}
-[\t]+ { return ' '; }
+^{whitespace}+
+[\t]+ { return ' '; }
(?i:down) { return tDOWN; }
(?i:if) { return tIF; }
Commit: eb4ef6db565307d36fdcec52b66afceeb8c2a917
https://github.com/scummvm/scummvm/commit/eb4ef6db565307d36fdcec52b66afceeb8c2a917
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix if() generation
Changed paths:
engines/director/lingo/lingo-codegen.cpp
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 47f723f..2847c45 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -238,7 +238,7 @@ void Lingo::processIf(int endlabel) {
_labelstack.pop_back();
// This is beginning of our if()
- if (label)
+ if (!label)
break;
WRITE_UINT32(&ielse1, else1);
Commit: df626193634fe4faf76b75658044d30e6e7bf3d3
https://github.com/scummvm/scummvm/commit/df626193634fe4faf76b75658044d30e6e7bf3d3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Properly initialize class variables
Changed paths:
engines/director/director.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index d9e4312..a39894e 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -89,12 +89,28 @@ DirectorEngine::~DirectorEngine() {
Common::Error DirectorEngine::run() {
debug("Starting v%d Director game", getVersion());
+ _sharedCasts = nullptr;
+ _sharedSound = nullptr;
+ _sharedBMP = nullptr;
+ _sharedSTXT = nullptr;
+ _sharedDIB = nullptr;
+
+ _movies = nullptr;
+ _currentPalette = nullptr;
+
+ _macBinary = nullptr;
+ _soundManager = nullptr;
+
_lingo = new Lingo(this);
_soundManager = new DirectorSound();
-#if 1
+#if 0
+ _mainArchive = nullptr;
+ _currentScore = nullptr;
+
_lingo->addCode("--\n\
- -- repeat with x = 1 to 5\n\
+ --repeat with x = 1 to 5\n\
+ set x = 4\n\
if x = 1 then\n\
put 1\n\
else if x = 2 then\n\
@@ -104,7 +120,7 @@ Common::Error DirectorEngine::run() {
end if\n\
if x = 4 then put 4\n\
else put 5\n\
- -- end repeat\n\
+ --end repeat\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
Commit: b4670f602960be1ad3189989e2dec72bc08e1ab1
https://github.com/scummvm/scummvm/commit/b4670f602960be1ad3189989e2dec72bc08e1ab1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
JANITORIAL: Whitespace fixes
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 27c80f5..c0221a4 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -1716,7 +1716,7 @@ yyreduce:
WRITE_UINT32(&else1, (yyvsp[(9) - (12)].code));
WRITE_UINT32(&end, (yyvsp[(11) - (12)].code));
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf((yyvsp[(11) - (12)].code)); ;}
@@ -1728,8 +1728,8 @@ yyreduce:
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
WRITE_UINT32(&end, (yyvsp[(5) - (7)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; /* end, if cond fails */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf((yyvsp[(5) - (7)].code)); ;}
break;
@@ -1740,9 +1740,9 @@ yyreduce:
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
WRITE_UINT32(&else1, (yyvsp[(7) - (10)].code));
WRITE_UINT32(&end, (yyvsp[(8) - (10)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; /* end, if cond fails */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf((yyvsp[(8) - (10)].code)); ;}
break;
@@ -1753,9 +1753,9 @@ yyreduce:
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
WRITE_UINT32(&else1, (yyvsp[(6) - (10)].code));
WRITE_UINT32(&end, (yyvsp[(8) - (10)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; /* end, if cond fails */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf((yyvsp[(8) - (10)].code)); ;}
break;
@@ -1764,7 +1764,7 @@ yyreduce:
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 1] = then; /* thenpart */
g_lingo->codeLabel((yyvsp[(1) - (6)].code)); ;}
break;
@@ -1774,7 +1774,7 @@ yyreduce:
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (4)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (4)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (4)].code) + 1] = then; /* thenpart */
g_lingo->codeLabel((yyvsp[(1) - (4)].code)); ;}
break;
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 231877d..1670a08 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -104,7 +104,7 @@ programline:
| error { yyerrok; }
;
-asgn: tPUT expr tINTO ID {
+asgn: tPUT expr tINTO ID {
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString($4->c_str());
g_lingo->code1(g_lingo->c_assign);
@@ -131,7 +131,7 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
// statements
// end repeat
//
- | repeatwhile '(' cond ')' stmtlist end tEND tREPEAT {
+ | repeatwhile '(' cond ')' stmtlist end tEND tREPEAT {
inst body = 0, end = 0;
WRITE_UINT32(&body, $5);
WRITE_UINT32(&end, $6);
@@ -172,7 +172,7 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
(*g_lingo->_currentScript)[$1 + 5] = end; } /* end, if cond fails */
;
-stmtoneliner: if cond tTHEN begin stmt end {
+stmtoneliner: if cond tTHEN begin stmt end {
inst then = 0, end = 0;
WRITE_UINT32(&then, $4);
WRITE_UINT32(&end, $6);
@@ -186,36 +186,36 @@ stmtoneliner: if cond tTHEN begin stmt end {
WRITE_UINT32(&else1, $9);
WRITE_UINT32(&end, $11);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf($11); }
;
-ifstmt: if cond tTHEN stmtlist end tEND tIF {
+ifstmt: if cond tTHEN stmtlist end tEND tIF {
inst then = 0, end = 0;
WRITE_UINT32(&then, $4);
WRITE_UINT32(&end, $5);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf($5); }
| if cond tTHEN stmtlist end tELSE stmtlist end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $4);
WRITE_UINT32(&else1, $7);
WRITE_UINT32(&end, $8);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf($8); }
| if cond tTHEN stmtlist end begin elseifstmt end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $4);
WRITE_UINT32(&else1, $6);
WRITE_UINT32(&end, $8);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf($8); }
;
@@ -223,16 +223,16 @@ elseifstmt: elseifstmt1 elseifstmt
| elseifstmt1
;
-elseifstmt1: elseif cond tTHEN begin stmt '\n' {
+elseifstmt1: elseif cond tTHEN begin stmt '\n' {
inst then = 0;
WRITE_UINT32(&then, $4);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
g_lingo->codeLabel($1); }
| elseif cond tTHEN stmtlist {
inst then = 0;
WRITE_UINT32(&then, $4);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
g_lingo->codeLabel($1); }
;
@@ -265,21 +265,21 @@ stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
| stmtlist stmt
;
-expr: INT {
+expr: INT {
$$ = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
WRITE_UINT32(&i, $1);
g_lingo->code1(i); }
- | FLOAT {
+ | FLOAT {
$$ = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat($1); }
- | BLTIN '(' arglist ')' {
+ | 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; }
- | ID '(' arglist ')' {
+ | ID '(' arglist ')' {
$$ = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString($1->c_str());
@@ -287,7 +287,7 @@ expr: INT {
WRITE_UINT32(&numpar, $3);
g_lingo->code1(numpar);
delete $1; }
- | ID {
+ | ID {
$$ = g_lingo->codeId(*$1);
delete $1; }
| asgn
@@ -384,7 +384,7 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
// See also:
// on keyword
defn: tMACRO ID { g_lingo->_indef = true; }
- begin argdef '\n' argstore stmtlist {
+ begin argdef '\n' argstore stmtlist {
g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$2, $4, $5);
@@ -398,7 +398,7 @@ argdef: /* nothing */ { $$ = 0; }
argstore: /* nothing */ { g_lingo->codeArgStore(); }
;
-macro: ID begin arglist {
+macro: ID begin arglist {
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString($1->c_str());
inst numpar = 0;
Commit: 207609ac093d66ca9a9beed1c0d95afab69e9999
https://github.com/scummvm/scummvm/commit/207609ac093d66ca9a9beed1c0d95afab69e9999
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix 'else if' statement execution
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 918dea1..6151c1b 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -400,22 +400,29 @@ void Lingo::c_ifcode() {
Datum d;
int savepc = g_lingo->_pc; /* then part */
- int then = READ_UINT32(&(*g_lingo->_currentScript)[savepc]);
- int elsep = READ_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
- int end = READ_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
+ int then = READ_UINT32(&(*g_lingo->_currentScript)[savepc]);
+ int elsep = READ_UINT32(&(*g_lingo->_currentScript)[savepc + 1]);
+ int end = READ_UINT32(&(*g_lingo->_currentScript)[savepc + 2]);
+ int skipEnd = READ_UINT32(&(*g_lingo->_currentScript)[savepc + 3]);
- g_lingo->execute(savepc + 3); /* condition */
+ debug(8, "executing cond (have to %s end)", skipEnd ? "skip" : "execute");
+ g_lingo->execute(savepc + 4); /* condition */
d = g_lingo->pop();
if (d.toInt()) {
+ debug(8, "executing then");
g_lingo->execute(then);
} else if (elsep) { /* else part? */
+ debug(8, "executing else");
g_lingo->execute(elsep);
}
- if (!g_lingo->_returning)
+ if (!g_lingo->_returning && !skipEnd) {
g_lingo->_pc = end; /* next stmt */
+ debug(8, "executing end");
+ } else
+ debug(8, "Skipped end");
}
//************************
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 2847c45..10589b1 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -222,9 +222,9 @@ void Lingo::codeLabel(int label) {
_labelstack.push_back(label);
}
-void Lingo::processIf(int endlabel) {
+void Lingo::processIf(int elselabel, int endlabel) {
inst ielse1, iend;
- int else1 = endlabel;
+ int else1 = elselabel;
WRITE_UINT32(&iend, endlabel);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index c0221a4..e89b77a 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -430,7 +430,7 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 61
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 344
+#define YYLAST 332
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 56
@@ -439,7 +439,7 @@ union yyalloc
/* YYNRULES -- Number of rules. */
#define YYNRULES 91
/* YYNRULES -- Number of states. */
-#define YYNSTATES 196
+#define YYNSTATES 198
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -490,14 +490,14 @@ static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
20, 22, 24, 29, 34, 39, 41, 43, 45, 54,
- 66, 79, 86, 99, 107, 118, 129, 132, 134, 141,
- 146, 148, 152, 156, 159, 163, 165, 167, 168, 169,
- 170, 173, 176, 178, 180, 185, 190, 192, 194, 198,
- 202, 206, 210, 214, 218, 222, 226, 230, 233, 236,
- 240, 243, 246, 249, 251, 253, 256, 258, 262, 265,
- 268, 271, 274, 278, 281, 285, 288, 291, 293, 297,
- 300, 304, 305, 314, 315, 317, 321, 326, 327, 331,
- 332, 334
+ 66, 79, 86, 99, 107, 118, 129, 132, 134, 142,
+ 148, 150, 154, 158, 161, 165, 167, 169, 170, 171,
+ 172, 175, 178, 180, 182, 187, 192, 194, 196, 200,
+ 204, 208, 212, 216, 220, 224, 228, 232, 235, 238,
+ 242, 245, 248, 251, 253, 255, 258, 260, 264, 267,
+ 270, 273, 276, 280, 283, 287, 290, 293, 295, 299,
+ 302, 306, 307, 316, 317, 319, 323, 328, 329, 333,
+ 334, 336
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -516,27 +516,27 @@ static const yytype_int8 yyrhs[] =
65, 34, 72, 71, 16, 21, -1, 68, 65, 34,
72, 71, 14, 72, 71, 16, 21, -1, 68, 65,
34, 72, 71, 70, 63, 71, 16, 21, -1, 64,
- 63, -1, 64, -1, 69, 65, 34, 70, 60, 50,
- -1, 69, 65, 34, 72, -1, 73, -1, 73, 44,
- 73, -1, 51, 65, 52, -1, 32, 37, -1, 32,
- 36, 10, -1, 21, -1, 15, -1, -1, -1, -1,
- 72, 50, -1, 72, 60, -1, 7, -1, 8, -1,
- 9, 51, 84, 52, -1, 10, 51, 84, 52, -1,
- 10, -1, 59, -1, 73, 45, 73, -1, 73, 46,
- 73, -1, 73, 47, 73, -1, 73, 48, 73, -1,
- 73, 53, 73, -1, 73, 54, 73, -1, 73, 43,
- 73, -1, 73, 38, 73, -1, 73, 39, 73, -1,
- 45, 73, -1, 46, 73, -1, 51, 73, 52, -1,
- 25, 11, -1, 26, 10, -1, 31, 73, -1, 76,
- -1, 17, -1, 19, 75, -1, 10, -1, 75, 55,
- 10, -1, 20, 23, -1, 20, 28, -1, 20, 30,
- -1, 20, 77, -1, 20, 77, 78, -1, 20, 78,
- -1, 35, 18, 11, -1, 18, 11, -1, 35, 11,
- -1, 11, -1, 29, 27, 11, -1, 27, 11, -1,
- 35, 27, 11, -1, -1, 24, 10, 80, 70, 81,
- 50, 82, 72, -1, -1, 10, -1, 81, 55, 10,
- -1, 81, 50, 55, 10, -1, -1, 10, 70, 84,
- -1, -1, 73, -1, 84, 55, 73, -1
+ 63, -1, 64, -1, 69, 65, 34, 70, 60, 71,
+ 50, -1, 69, 65, 34, 72, 71, -1, 73, -1,
+ 73, 44, 73, -1, 51, 65, 52, -1, 32, 37,
+ -1, 32, 36, 10, -1, 21, -1, 15, -1, -1,
+ -1, -1, 72, 50, -1, 72, 60, -1, 7, -1,
+ 8, -1, 9, 51, 84, 52, -1, 10, 51, 84,
+ 52, -1, 10, -1, 59, -1, 73, 45, 73, -1,
+ 73, 46, 73, -1, 73, 47, 73, -1, 73, 48,
+ 73, -1, 73, 53, 73, -1, 73, 54, 73, -1,
+ 73, 43, 73, -1, 73, 38, 73, -1, 73, 39,
+ 73, -1, 45, 73, -1, 46, 73, -1, 51, 73,
+ 52, -1, 25, 11, -1, 26, 10, -1, 31, 73,
+ -1, 76, -1, 17, -1, 19, 75, -1, 10, -1,
+ 75, 55, 10, -1, 20, 23, -1, 20, 28, -1,
+ 20, 30, -1, 20, 77, -1, 20, 77, 78, -1,
+ 20, 78, -1, 35, 18, 11, -1, 18, 11, -1,
+ 35, 11, -1, 11, -1, 29, 27, 11, -1, 27,
+ 11, -1, 35, 27, 11, -1, -1, 24, 10, 80,
+ 70, 81, 50, 82, 72, -1, -1, 10, -1, 81,
+ 55, 10, -1, 81, 50, 55, 10, -1, -1, 10,
+ 70, 84, -1, -1, 73, -1, 84, 55, 73, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -545,13 +545,13 @@ static const yytype_uint16 yyrline[] =
0, 93, 93, 94, 97, 98, 99, 100, 101, 102,
103, 104, 107, 113, 119, 127, 128, 129, 134, 145,
161, 175, 183, 195, 202, 211, 222, 223, 226, 232,
- 240, 241, 242, 244, 246, 252, 257, 259, 261, 263,
- 264, 265, 268, 273, 276, 282, 290, 293, 294, 295,
- 296, 297, 298, 299, 300, 301, 302, 303, 304, 305,
- 308, 309, 310, 311, 312, 314, 317, 318, 329, 330,
- 331, 332, 337, 343, 350, 351, 352, 353, 356, 357,
- 358, 386, 386, 393, 394, 395, 396, 398, 401, 409,
- 410, 411
+ 240, 241, 242, 244, 246, 252, 258, 265, 267, 269,
+ 270, 271, 274, 279, 282, 288, 296, 299, 300, 301,
+ 302, 303, 304, 305, 306, 307, 308, 309, 310, 311,
+ 314, 315, 316, 317, 318, 320, 323, 324, 335, 336,
+ 337, 338, 343, 349, 356, 357, 358, 359, 362, 363,
+ 364, 392, 392, 399, 400, 401, 402, 404, 407, 415,
+ 416, 417
};
#endif
@@ -609,7 +609,7 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
1, 1, 4, 4, 4, 1, 1, 1, 8, 11,
- 12, 6, 12, 7, 10, 10, 2, 1, 6, 4,
+ 12, 6, 12, 7, 10, 10, 2, 1, 7, 5,
1, 3, 3, 2, 3, 1, 1, 0, 0, 0,
2, 2, 1, 1, 4, 4, 1, 1, 3, 3,
3, 3, 3, 3, 3, 3, 3, 2, 2, 3,
@@ -642,8 +642,8 @@ static const yytype_uint8 yydefact[] =
0, 0, 0, 39, 85, 0, 38, 39, 0, 39,
38, 23, 36, 38, 27, 0, 86, 82, 18, 39,
38, 37, 0, 0, 26, 0, 38, 0, 0, 0,
- 0, 37, 0, 0, 38, 24, 25, 0, 29, 0,
- 19, 0, 0, 20, 22, 28
+ 0, 37, 0, 0, 38, 24, 25, 0, 38, 0,
+ 19, 0, 38, 29, 20, 22, 0, 28
};
/* YYDEFGOTO[NTERM-NUM]. */
@@ -659,34 +659,34 @@ static const yytype_int16 yydefgoto[] =
#define YYPACT_NINF -89
static const yytype_int16 yypact[] =
{
- 138, -89, -89, -89, -30, 72, -89, -1, 8, -89,
- 17, 23, 34, 166, 19, 40, 166, 166, 166, 57,
- 11, 4, -89, -89, -89, 37, 48, 211, 290, -89,
- -89, -89, -89, 166, 166, 166, -89, 42, -89, 84,
- -89, 88, -89, 73, -89, 21, 52, -89, -89, -89,
- -89, 54, 166, -89, 242, 97, -89, -11, 63, 63,
- 266, -89, 138, 211, 166, 211, 78, 278, 166, 166,
- 166, 166, 166, 166, 166, 166, 166, 290, -6, 30,
- 58, 112, -89, -89, 113, -89, 118, 120, 106, -89,
- -89, 242, 125, -89, 166, 166, -89, -89, 85, 290,
- 89, 254, -9, 166, 290, 290, 290, 229, 229, 63,
- 63, 290, 290, -89, 166, -89, -89, -89, -89, -89,
- 126, -89, 290, 290, -89, 7, -89, 228, 183, 290,
- 290, -89, -10, 183, 108, 166, -89, 211, -89, -89,
- -89, 9, 94, 134, 135, 166, 290, 100, 119, -89,
- 131, 139, 146, -89, -89, 129, 290, -89, 151, -89,
- 183, -89, -89, -89, 139, 211, -89, 183, -89, -89,
- 183, -89, 150, 152, -89, 133, 183, 156, 228, 158,
- 159, 2, 161, 149, -89, -89, -89, 228, 183, 153,
- -89, 132, 136, -89, -89, -89
+ 138, -89, -89, -89, -2, 278, -89, 42, 96, -89,
+ 75, 76, 82, 134, 2, 84, 134, 134, 134, 86,
+ 45, 4, -89, -89, -89, 46, 52, 166, 266, -89,
+ -89, -89, -89, 134, 134, 134, -89, 44, -89, 91,
+ -89, 93, -89, 79, -89, 5, 47, -89, -89, -89,
+ -89, 59, 134, -89, -3, 101, -89, -11, 167, 167,
+ 242, -89, 138, 166, 134, 166, 83, 254, 134, 134,
+ 134, 134, 134, 134, 134, 134, 134, 266, -34, -18,
+ 58, 106, -89, -89, 107, -89, 109, 111, 108, -89,
+ -89, -3, 118, -89, 134, 134, -89, -89, 97, 266,
+ 98, 224, -9, 134, 266, 266, 266, 203, 203, 167,
+ 167, 266, 266, -89, 134, -89, -89, -89, -89, -89,
+ 124, -89, 266, 266, -89, -4, -89, 228, 183, 266,
+ 266, -89, -30, 183, 116, 134, -89, 166, -89, -89,
+ -89, 32, 81, 142, 137, 134, 266, 104, 122, -89,
+ 140, 151, 158, -89, -89, 145, 266, -89, 168, -89,
+ 183, -89, -89, -89, 151, 166, -89, 183, -89, -89,
+ 183, -89, 156, 165, -89, 152, 183, 178, 228, 174,
+ 175, 11, 182, 169, -89, -89, -89, 228, 183, 181,
+ -89, 157, -89, -89, -89, -89, 172, -89
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -89, 143, -89, 10, 0, -89, -89, 31, -89, -62,
- -89, -89, 15, -89, -88, -42, -73, -5, 16, -89,
- -89, -89, 148, -89, -89, -89, -89, -89, 39
+ -89, 161, -89, 10, 0, -89, -89, 54, -89, -62,
+ -89, -89, 15, -89, -88, -55, -69, -5, 17, -89,
+ -89, -89, 173, -89, -89, -89, -89, -89, 22
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -696,80 +696,78 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -47
static const yytype_int16 yytable[] =
{
- 22, 98, 120, 100, -8, -39, -39, -39, 54, 36,
- 21, 58, 59, 60, 127, 27, 29, -39, -39, 38,
- 134, 33, 67, 149, 94, 150, 39, 48, 77, 77,
- 77, 40, 85, 95, 49, 41, 42, 43, 44, 86,
- 142, -39, 135, 45, 50, 143, 113, 91, 87, 114,
- 57, 133, -39, 151, -8, 55, 56, 61, 67, 99,
- 101, 62, 22, 104, 105, 106, 107, 108, 109, 110,
- 111, 112, 21, 79, 80, 148, 160, 27, 29, 41,
- 167, 43, 115, 178, 170, 114, 141, 88, 63, 122,
- 123, 144, 64, 187, 147, 82, 176, 81, 129, 83,
- 84, 68, 69, 175, 157, 34, 70, 93, 188, 130,
- -46, -46, 102, 114, 169, -46, 75, 76, 172, -46,
- -46, 173, 116, 34, 117, -46, -46, 136, 177, 118,
- 146, 119, 67, 87, 182, 121, 131, 124, -4, 1,
- 156, 126, 191, 145, 154, 2, 3, 4, 5, 152,
- 158, 155, 161, 159, 162, 6, 166, 7, 8, 9,
- 67, 168, 10, 11, 12, 171, 179, 181, 180, 13,
- 14, 15, 183, 2, 3, 4, 51, 189, 184, 185,
- 186, 190, 194, 16, 17, 193, 195, 192, -4, 18,
- 2, 3, 4, 51, 89, 174, 0, 52, 0, 15,
- 6, 0, 7, 8, 9, 97, 0, 0, 11, 12,
- 0, 16, 17, 0, 13, 14, 15, 18, 2, 3,
- 4, 51, 0, 0, 0, 0, 0, 0, 16, 17,
+ 22, 98, 120, 100, -8, -39, -39, -39, 54, 134,
+ 21, 58, 59, 60, 127, 27, 85, 29, 113, 92,
+ 142, 114, 67, 86, 94, 143, -39, -39, 77, 77,
+ 77, 135, 87, 95, 115, 68, 69, 114, 55, 56,
+ 70, -39, 71, 72, 73, 74, 149, 91, 150, 33,
+ 75, 76, 36, 151, -8, 133, 79, 80, 67, 99,
+ 101, -39, 22, 104, 105, 106, 107, 108, 109, 110,
+ 111, 112, 21, 141, 41, 148, 43, 27, 144, 29,
+ 160, 147, 88, 178, 167, 48, 61, 49, 170, 122,
+ 123, 157, 50, 187, 57, 62, 64, 63, 129, 81,
+ 176, 169, 82, 175, 83, 172, 84, 38, 173, 130,
+ 34, 93, 188, 114, 39, 177, 116, 102, 117, 40,
+ 118, 182, 119, 41, 42, 43, 44, 136, 121, 191,
+ 146, 45, 67, 193, 131, 87, 152, 196, -4, 1,
+ 156, 2, 3, 4, 51, 2, 3, 4, 5, 124,
+ 126, 145, 154, 155, 158, 6, 159, 7, 8, 9,
+ 67, 161, 10, 11, 12, 52, 162, 15, 166, 13,
+ 14, 15, 179, 2, 3, 4, 51, 168, 184, 16,
+ 17, 180, 171, 16, 17, 18, 181, 192, -4, 18,
+ 2, 3, 4, 51, 183, 185, 186, 52, 189, 15,
+ 6, 190, 7, 8, 9, 68, 69, 195, 11, 12,
+ 70, 16, 17, 194, 13, 14, 15, 65, 174, 89,
+ 75, 76, 197, 97, 0, 0, 0, 0, 16, 17,
0, 0, 0, 139, 18, 2, 3, 4, 51, 0,
- 0, 0, 52, 0, 15, 6, 0, 7, 8, 9,
- 0, 0, 0, 11, 12, 0, 16, 17, 0, 13,
- 14, 15, 65, 0, 92, 0, 0, 68, 69, 0,
- 0, 0, 70, 16, 17, 0, 73, 74, 0, 18,
- 68, 69, 75, 76, 0, 70, 0, 71, 72, 73,
- 74, 0, 68, 69, 0, 75, 76, 70, 103, 71,
- 72, 73, 74, 0, 68, 69, 96, 75, 76, 70,
- 0, 71, 72, 73, 74, 0, 68, 69, 96, 75,
- 76, 70, 103, 71, 72, 73, 74, 0, 68, 69,
- 0, 75, 76, 70, 0, 71, 72, 73, 74, 0,
- 0, 0, 0, 75, 76
+ 0, 68, 69, 0, 0, 6, 70, 7, 8, 9,
+ 73, 74, 0, 11, 12, 0, 75, 76, 0, 13,
+ 14, 15, 68, 69, 0, 0, 0, 70, 103, 71,
+ 72, 73, 74, 16, 17, 0, 96, 75, 76, 18,
+ 68, 69, 0, 0, 0, 70, 0, 71, 72, 73,
+ 74, 0, 68, 69, 96, 75, 76, 70, 103, 71,
+ 72, 73, 74, 0, 68, 69, 0, 75, 76, 70,
+ 0, 71, 72, 73, 74, 0, -46, -46, 0, 75,
+ 76, -46, 0, 0, 0, -46, -46, 0, 0, 34,
+ 0, -46, -46
};
static const yytype_int16 yycheck[] =
{
- 0, 63, 90, 65, 0, 14, 15, 16, 13, 10,
- 0, 16, 17, 18, 102, 0, 0, 15, 16, 11,
- 13, 51, 27, 14, 35, 16, 18, 10, 33, 34,
- 35, 23, 11, 44, 11, 27, 28, 29, 30, 18,
- 50, 50, 35, 35, 10, 55, 52, 52, 27, 55,
- 10, 124, 50, 141, 50, 36, 37, 0, 63, 64,
+ 0, 63, 90, 65, 0, 14, 15, 16, 13, 13,
+ 0, 16, 17, 18, 102, 0, 11, 0, 52, 22,
+ 50, 55, 27, 18, 35, 55, 15, 16, 33, 34,
+ 35, 35, 27, 44, 52, 38, 39, 55, 36, 37,
+ 43, 50, 45, 46, 47, 48, 14, 52, 16, 51,
+ 53, 54, 10, 141, 50, 124, 34, 35, 63, 64,
65, 50, 62, 68, 69, 70, 71, 72, 73, 74,
- 75, 76, 62, 34, 35, 137, 149, 62, 62, 27,
- 153, 29, 52, 171, 157, 55, 128, 35, 51, 94,
- 95, 133, 44, 181, 136, 11, 169, 55, 103, 11,
- 27, 38, 39, 165, 146, 51, 43, 10, 181, 114,
- 38, 39, 34, 55, 156, 43, 53, 54, 160, 47,
- 48, 163, 10, 51, 11, 53, 54, 127, 170, 11,
- 135, 11, 137, 27, 176, 10, 10, 52, 0, 1,
- 145, 52, 184, 35, 10, 7, 8, 9, 10, 55,
- 50, 16, 21, 34, 15, 17, 10, 19, 20, 21,
- 165, 32, 24, 25, 26, 14, 16, 34, 16, 31,
- 32, 33, 16, 7, 8, 9, 10, 16, 178, 21,
- 21, 32, 50, 45, 46, 32, 50, 187, 50, 51,
- 7, 8, 9, 10, 46, 164, -1, 31, -1, 33,
- 17, -1, 19, 20, 21, 62, -1, -1, 25, 26,
- -1, 45, 46, -1, 31, 32, 33, 51, 7, 8,
- 9, 10, -1, -1, -1, -1, -1, -1, 45, 46,
+ 75, 76, 62, 128, 27, 137, 29, 62, 133, 62,
+ 149, 136, 35, 171, 153, 10, 0, 11, 157, 94,
+ 95, 146, 10, 181, 10, 50, 44, 51, 103, 55,
+ 169, 156, 11, 165, 11, 160, 27, 11, 163, 114,
+ 51, 10, 181, 55, 18, 170, 10, 34, 11, 23,
+ 11, 176, 11, 27, 28, 29, 30, 127, 10, 184,
+ 135, 35, 137, 188, 10, 27, 55, 192, 0, 1,
+ 145, 7, 8, 9, 10, 7, 8, 9, 10, 52,
+ 52, 35, 10, 16, 50, 17, 34, 19, 20, 21,
+ 165, 21, 24, 25, 26, 31, 15, 33, 10, 31,
+ 32, 33, 16, 7, 8, 9, 10, 32, 178, 45,
+ 46, 16, 14, 45, 46, 51, 34, 187, 50, 51,
+ 7, 8, 9, 10, 16, 21, 21, 31, 16, 33,
+ 17, 32, 19, 20, 21, 38, 39, 50, 25, 26,
+ 43, 45, 46, 32, 31, 32, 33, 51, 164, 46,
+ 53, 54, 50, 62, -1, -1, -1, -1, 45, 46,
-1, -1, -1, 50, 51, 7, 8, 9, 10, -1,
- -1, -1, 31, -1, 33, 17, -1, 19, 20, 21,
- -1, -1, -1, 25, 26, -1, 45, 46, -1, 31,
- 32, 33, 51, -1, 22, -1, -1, 38, 39, -1,
- -1, -1, 43, 45, 46, -1, 47, 48, -1, 51,
- 38, 39, 53, 54, -1, 43, -1, 45, 46, 47,
- 48, -1, 38, 39, -1, 53, 54, 43, 44, 45,
- 46, 47, 48, -1, 38, 39, 52, 53, 54, 43,
- -1, 45, 46, 47, 48, -1, 38, 39, 52, 53,
- 54, 43, 44, 45, 46, 47, 48, -1, 38, 39,
- -1, 53, 54, 43, -1, 45, 46, 47, 48, -1,
- -1, -1, -1, 53, 54
+ -1, 38, 39, -1, -1, 17, 43, 19, 20, 21,
+ 47, 48, -1, 25, 26, -1, 53, 54, -1, 31,
+ 32, 33, 38, 39, -1, -1, -1, 43, 44, 45,
+ 46, 47, 48, 45, 46, -1, 52, 53, 54, 51,
+ 38, 39, -1, -1, -1, 43, -1, 45, 46, 47,
+ 48, -1, 38, 39, 52, 53, 54, 43, 44, 45,
+ 46, 47, 48, -1, 38, 39, -1, 53, 54, 43,
+ -1, 45, 46, 47, 48, -1, 38, 39, -1, 53,
+ 54, 43, -1, -1, -1, 47, 48, -1, -1, 51,
+ -1, 53, 54
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -795,7 +793,7 @@ static const yytype_uint8 yystos[] =
72, 21, 15, 63, 64, 69, 10, 72, 32, 71,
72, 14, 71, 71, 63, 65, 72, 71, 70, 16,
16, 34, 71, 16, 60, 21, 21, 70, 72, 16,
- 32, 71, 60, 32, 50, 50
+ 32, 71, 60, 71, 32, 50, 71, 50
};
#define yyerrok (yyerrstatus = 0)
@@ -1705,7 +1703,7 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 3] = end; /* end, if cond fails */
- g_lingo->processIf((yyvsp[(6) - (6)].code)); ;}
+ g_lingo->processIf(0, 0); ;}
break;
case 22:
@@ -1719,7 +1717,7 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; /* end, if cond fails */
- g_lingo->processIf((yyvsp[(11) - (12)].code)); ;}
+ g_lingo->processIf(0, 0); ;}
break;
case 23:
@@ -1730,7 +1728,7 @@ yyreduce:
WRITE_UINT32(&end, (yyvsp[(5) - (7)].code));
(*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; /* end, if cond fails */
- g_lingo->processIf((yyvsp[(5) - (7)].code)); ;}
+ g_lingo->processIf(0, 0); ;}
break;
case 24:
@@ -1743,7 +1741,7 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; /* end, if cond fails */
- g_lingo->processIf((yyvsp[(8) - (10)].code)); ;}
+ g_lingo->processIf(0, 0); ;}
break;
case 25:
@@ -1756,27 +1754,27 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; /* end, if cond fails */
- g_lingo->processIf((yyvsp[(8) - (10)].code)); ;}
+ g_lingo->processIf(0, (yyvsp[(8) - (10)].code)); ;}
break;
case 28:
#line 226 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 1] = then; /* thenpart */
+ WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
- g_lingo->codeLabel((yyvsp[(1) - (6)].code)); ;}
+ g_lingo->codeLabel((yyvsp[(1) - (7)].code)); ;}
break;
case 29:
#line 232 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (4)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (4)].code) + 1] = then; /* thenpart */
+ WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (5)].code) + 1] = then; /* thenpart */
- g_lingo->codeLabel((yyvsp[(1) - (4)].code)); ;}
+ g_lingo->codeLabel((yyvsp[(1) - (5)].code)); ;}
break;
case 30:
@@ -1808,31 +1806,37 @@ yyreduce:
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
+ g_lingo->code1(0); // Do not skip end
g_lingo->codeLabel(0); ;}
break;
case 36:
-#line 257 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); ;}
+#line 258 "engines/director/lingo/lingo-gr.y"
+ {
+ inst skipEnd;
+ WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
+ (yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
+ g_lingo->code3(STOP, STOP, STOP);
+ g_lingo->code1(skipEnd); ;}
break;
case 37:
-#line 259 "engines/director/lingo/lingo-gr.y"
+#line 265 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 38:
-#line 261 "engines/director/lingo/lingo-gr.y"
+#line 267 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 39:
-#line 263 "engines/director/lingo/lingo-gr.y"
+#line 269 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 42:
-#line 268 "engines/director/lingo/lingo-gr.y"
+#line 274 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1841,14 +1845,14 @@ yyreduce:
break;
case 43:
-#line 273 "engines/director/lingo/lingo-gr.y"
+#line 279 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
case 44:
-#line 276 "engines/director/lingo/lingo-gr.y"
+#line 282 "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));
@@ -1858,7 +1862,7 @@ yyreduce:
break;
case 45:
-#line 282 "engines/director/lingo/lingo-gr.y"
+#line 288 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1870,120 +1874,120 @@ yyreduce:
break;
case 46:
-#line 290 "engines/director/lingo/lingo-gr.y"
+#line 296 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
case 48:
-#line 294 "engines/director/lingo/lingo-gr.y"
+#line 300 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
case 49:
-#line 295 "engines/director/lingo/lingo-gr.y"
+#line 301 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
case 50:
-#line 296 "engines/director/lingo/lingo-gr.y"
+#line 302 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
case 51:
-#line 297 "engines/director/lingo/lingo-gr.y"
+#line 303 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
case 52:
-#line 298 "engines/director/lingo/lingo-gr.y"
+#line 304 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
case 53:
-#line 299 "engines/director/lingo/lingo-gr.y"
+#line 305 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
case 54:
-#line 300 "engines/director/lingo/lingo-gr.y"
+#line 306 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
case 55:
-#line 301 "engines/director/lingo/lingo-gr.y"
+#line 307 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
case 56:
-#line 302 "engines/director/lingo/lingo-gr.y"
+#line 308 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
case 57:
-#line 303 "engines/director/lingo/lingo-gr.y"
+#line 309 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 58:
-#line 304 "engines/director/lingo/lingo-gr.y"
+#line 310 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 59:
-#line 305 "engines/director/lingo/lingo-gr.y"
+#line 311 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 60:
-#line 308 "engines/director/lingo/lingo-gr.y"
+#line 314 "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 61:
-#line 309 "engines/director/lingo/lingo-gr.y"
+#line 315 "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 62:
-#line 310 "engines/director/lingo/lingo-gr.y"
+#line 316 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 64:
-#line 312 "engines/director/lingo/lingo-gr.y"
+#line 318 "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 66:
-#line 317 "engines/director/lingo/lingo-gr.y"
+#line 323 "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 67:
-#line 318 "engines/director/lingo/lingo-gr.y"
+#line 324 "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 68:
-#line 329 "engines/director/lingo/lingo-gr.y"
+#line 335 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 69:
-#line 330 "engines/director/lingo/lingo-gr.y"
+#line 336 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 70:
-#line 331 "engines/director/lingo/lingo-gr.y"
+#line 337 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 71:
-#line 332 "engines/director/lingo/lingo-gr.y"
+#line 338 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1992,7 +1996,7 @@ yyreduce:
break;
case 72:
-#line 337 "engines/director/lingo/lingo-gr.y"
+#line 343 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2002,7 +2006,7 @@ yyreduce:
break;
case 73:
-#line 343 "engines/director/lingo/lingo-gr.y"
+#line 349 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2011,47 +2015,47 @@ yyreduce:
break;
case 74:
-#line 350 "engines/director/lingo/lingo-gr.y"
+#line 356 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 75:
-#line 351 "engines/director/lingo/lingo-gr.y"
+#line 357 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 76:
-#line 352 "engines/director/lingo/lingo-gr.y"
+#line 358 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 77:
-#line 353 "engines/director/lingo/lingo-gr.y"
+#line 359 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 78:
-#line 356 "engines/director/lingo/lingo-gr.y"
+#line 362 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 79:
-#line 357 "engines/director/lingo/lingo-gr.y"
+#line 363 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 80:
-#line 358 "engines/director/lingo/lingo-gr.y"
+#line 364 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 81:
-#line 386 "engines/director/lingo/lingo-gr.y"
+#line 392 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 82:
-#line 387 "engines/director/lingo/lingo-gr.y"
+#line 393 "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);
@@ -2060,32 +2064,32 @@ yyreduce:
break;
case 83:
-#line 393 "engines/director/lingo/lingo-gr.y"
+#line 399 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 84:
-#line 394 "engines/director/lingo/lingo-gr.y"
+#line 400 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 85:
-#line 395 "engines/director/lingo/lingo-gr.y"
+#line 401 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 86:
-#line 396 "engines/director/lingo/lingo-gr.y"
+#line 402 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 87:
-#line 398 "engines/director/lingo/lingo-gr.y"
+#line 404 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
case 88:
-#line 401 "engines/director/lingo/lingo-gr.y"
+#line 407 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2095,23 +2099,23 @@ yyreduce:
break;
case 89:
-#line 409 "engines/director/lingo/lingo-gr.y"
+#line 415 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 90:
-#line 410 "engines/director/lingo/lingo-gr.y"
+#line 416 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
case 91:
-#line 411 "engines/director/lingo/lingo-gr.y"
+#line 417 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2115 "engines/director/lingo/lingo-gr.cpp"
+#line 2119 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2325,6 +2329,6 @@ yyreturn:
}
-#line 414 "engines/director/lingo/lingo-gr.y"
+#line 420 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 1670a08..9fd8f3d 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -179,7 +179,7 @@ stmtoneliner: if cond tTHEN begin stmt end {
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
- g_lingo->processIf($6); }
+ g_lingo->processIf(0, 0); }
| if cond tTHEN begin stmt end '\n' tELSE begin stmt end '\n' {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $4);
@@ -189,7 +189,7 @@ stmtoneliner: if cond tTHEN begin stmt end {
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
- g_lingo->processIf($11); }
+ g_lingo->processIf(0, 0); }
;
ifstmt: if cond tTHEN stmtlist end tEND tIF {
@@ -198,7 +198,7 @@ ifstmt: if cond tTHEN stmtlist end tEND tIF {
WRITE_UINT32(&end, $5);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
- g_lingo->processIf($5); }
+ g_lingo->processIf(0, 0); }
| if cond tTHEN stmtlist end tELSE stmtlist end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $4);
@@ -207,7 +207,7 @@ ifstmt: if cond tTHEN stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
- g_lingo->processIf($8); }
+ g_lingo->processIf(0, 0); }
| if cond tTHEN stmtlist end begin elseifstmt end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $4);
@@ -216,20 +216,20 @@ ifstmt: if cond tTHEN stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
- g_lingo->processIf($8); }
+ g_lingo->processIf(0, $8); }
;
elseifstmt: elseifstmt1 elseifstmt
| elseifstmt1
;
-elseifstmt1: elseif cond tTHEN begin stmt '\n' {
+elseifstmt1: elseif cond tTHEN begin stmt end '\n' {
inst then = 0;
WRITE_UINT32(&then, $4);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
g_lingo->codeLabel($1); }
- | elseif cond tTHEN stmtlist {
+ | elseif cond tTHEN stmtlist end {
inst then = 0;
WRITE_UINT32(&then, $4);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
@@ -252,9 +252,15 @@ repeatwith: tREPEAT tWITH ID {
if: tIF {
$$ = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
+ g_lingo->code1(0); // Do not skip end
g_lingo->codeLabel(0); } // Mark beginning of the if() statement
;
-elseif: tELSIF { $$ = g_lingo->code1(g_lingo->c_ifcode); g_lingo->code3(STOP, STOP, STOP); }
+elseif: tELSIF {
+ inst skipEnd;
+ WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
+ $$ = g_lingo->code1(g_lingo->c_ifcode);
+ g_lingo->code3(STOP, STOP, STOP);
+ g_lingo->code1(skipEnd); }
;
begin: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 8300800..8527d33 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -145,7 +145,7 @@ public:
Symbol *lookupVar(const char *name, bool create = true, bool putInGlobalList = false);
void cleanLocalVars();
void define(Common::String &s, int start, int nargs);
- void processIf(int endLabel);
+ void processIf(int elselabel, int endlabel);
int alignTypes(Datum &d1, Datum &d2);
Commit: b5cfcd05f67c4426b277b78f2d4fee86becc0365
https://github.com/scummvm/scummvm/commit/b5cfcd05f67c4426b277b78f2d4fee86becc0365
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Switched right recursion to left in program rule
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index e89b77a..8cad3b9 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -503,7 +503,7 @@ static const yytype_uint16 yyprhs[] =
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 57, 0, -1, 58, 50, 57, -1, 58, -1, -1,
+ 57, 0, -1, 57, 50, 58, -1, 58, -1, -1,
79, -1, 74, -1, 83, -1, 59, -1, 61, -1,
60, -1, 1, -1, 31, 73, 22, 10, -1, 33,
10, 44, 73, -1, 33, 10, 35, 73, -1, 73,
@@ -659,34 +659,34 @@ static const yytype_int16 yydefgoto[] =
#define YYPACT_NINF -89
static const yytype_int16 yypact[] =
{
- 138, -89, -89, -89, -2, 278, -89, 42, 96, -89,
- 75, 76, 82, 134, 2, 84, 134, 134, 134, 86,
- 45, 4, -89, -89, -89, 46, 52, 166, 266, -89,
- -89, -89, -89, 134, 134, 134, -89, 44, -89, 91,
- -89, 93, -89, 79, -89, 5, 47, -89, -89, -89,
- -89, 59, 134, -89, -3, 101, -89, -11, 167, 167,
+ 138, -89, -89, -89, -46, 278, -89, 22, 96, -89,
+ 39, 31, 47, 134, 49, 66, 134, 134, 134, 4,
+ -89, 6, -89, -89, -89, 41, 50, 166, 266, -89,
+ -89, -89, -89, 134, 134, 134, -89, 44, -89, 95,
+ -89, 99, -89, 77, -89, 84, 93, -89, -89, -89,
+ -89, 65, 134, -89, -2, 103, -89, -28, -20, -20,
242, -89, 138, 166, 134, 166, 83, 254, 134, 134,
- 134, 134, 134, 134, 134, 134, 134, 266, -34, -18,
- 58, 106, -89, -89, 107, -89, 109, 111, 108, -89,
- -89, -3, 118, -89, 134, 134, -89, -89, 97, 266,
- 98, 224, -9, 134, 266, 266, 266, 203, 203, 167,
- 167, 266, 266, -89, 134, -89, -89, -89, -89, -89,
- 124, -89, 266, 266, -89, -4, -89, 228, 183, 266,
- 266, -89, -30, 183, 116, 134, -89, 166, -89, -89,
- -89, 32, 81, 142, 137, 134, 266, 104, 122, -89,
- 140, 151, 158, -89, -89, 145, 266, -89, 168, -89,
- 183, -89, -89, -89, 151, 166, -89, 183, -89, -89,
- 183, -89, 156, 165, -89, 152, 183, 178, 228, 174,
- 175, 11, 182, 169, -89, -89, -89, 228, 183, 181,
- -89, 157, -89, -89, -89, -89, 172, -89
+ 134, 134, 134, 134, 134, 134, 134, 266, -31, -17,
+ 63, 124, -89, -89, 125, -89, 139, 140, 108, -89,
+ -89, -2, 142, -89, 134, 134, -89, -89, 97, 266,
+ 101, 224, 11, 134, 266, 266, 266, 203, 203, -20,
+ -20, 266, 266, -89, 134, -89, -89, -89, -89, -89,
+ 144, -89, 266, 266, -89, -4, -89, 228, 183, 266,
+ 266, -89, 32, 183, 121, 134, -89, 166, -89, -89,
+ -89, 34, 106, 156, 152, 134, 266, 122, 143, -89,
+ 160, 167, 176, -89, -89, 162, 266, -89, 181, -89,
+ 183, -89, -89, -89, 167, 166, -89, 183, -89, -89,
+ 183, -89, 180, 182, -89, 171, 183, 185, 228, 186,
+ 189, 24, 190, 187, -89, -89, -89, 228, 183, 188,
+ -89, 163, -89, -89, -89, -89, 168, -89
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -89, 161, -89, 10, 0, -89, -89, 54, -89, -62,
+ -89, -89, 159, 10, 0, -89, -89, 58, -89, -62,
-89, -89, 15, -89, -88, -55, -69, -5, 17, -89,
- -89, -89, 173, -89, -89, -89, -89, -89, 22
+ -89, -89, 177, -89, -89, -89, -89, -89, 62
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -696,29 +696,29 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -47
static const yytype_int16 yytable[] =
{
- 22, 98, 120, 100, -8, -39, -39, -39, 54, 134,
- 21, 58, 59, 60, 127, 27, 85, 29, 113, 92,
- 142, 114, 67, 86, 94, 143, -39, -39, 77, 77,
- 77, 135, 87, 95, 115, 68, 69, 114, 55, 56,
- 70, -39, 71, 72, 73, 74, 149, 91, 150, 33,
- 75, 76, 36, 151, -8, 133, 79, 80, 67, 99,
+ 22, 98, 120, 100, 61, 33, -8, 94, 54, 134,
+ 21, 58, 59, 60, 127, 27, 95, 29, 68, 69,
+ 92, 113, 67, 70, 114, -39, -39, -39, 77, 77,
+ 77, 135, 36, 75, 76, 115, 68, 69, 114, -39,
+ -39, 70, 49, 71, 72, 73, 74, 91, 149, 48,
+ 150, 75, 76, 151, 62, 133, -8, 50, 67, 99,
101, -39, 22, 104, 105, 106, 107, 108, 109, 110,
- 111, 112, 21, 141, 41, 148, 43, 27, 144, 29,
- 160, 147, 88, 178, 167, 48, 61, 49, 170, 122,
- 123, 157, 50, 187, 57, 62, 64, 63, 129, 81,
- 176, 169, 82, 175, 83, 172, 84, 38, 173, 130,
- 34, 93, 188, 114, 39, 177, 116, 102, 117, 40,
- 118, 182, 119, 41, 42, 43, 44, 136, 121, 191,
- 146, 45, 67, 193, 131, 87, 152, 196, -4, 1,
+ 111, 112, 21, 141, -39, 148, 57, 27, 144, 29,
+ 160, 147, 142, 178, 167, 55, 56, 143, 170, 122,
+ 123, 157, 63, 187, 64, 85, 79, 80, 129, 81,
+ 176, 169, 86, 175, 84, 172, 82, 38, 173, 130,
+ 83, 87, 188, 93, 39, 177, 34, 102, 114, 40,
+ 41, 182, 43, 41, 42, 43, 44, 136, 88, 191,
+ 146, 45, 67, 193, 116, 87, 117, 196, -4, 1,
156, 2, 3, 4, 51, 2, 3, 4, 5, 124,
- 126, 145, 154, 155, 158, 6, 159, 7, 8, 9,
- 67, 161, 10, 11, 12, 52, 162, 15, 166, 13,
- 14, 15, 179, 2, 3, 4, 51, 168, 184, 16,
- 17, 180, 171, 16, 17, 18, 181, 192, -4, 18,
- 2, 3, 4, 51, 183, 185, 186, 52, 189, 15,
- 6, 190, 7, 8, 9, 68, 69, 195, 11, 12,
- 70, 16, 17, 194, 13, 14, 15, 65, 174, 89,
- 75, 76, 197, 97, 0, 0, 0, 0, 16, 17,
+ 118, 119, 121, 126, 131, 6, 145, 7, 8, 9,
+ 67, 152, 10, 11, 12, 52, 154, 15, 155, 13,
+ 14, 15, 158, 2, 3, 4, 51, 159, 184, 16,
+ 17, 161, 162, 16, 17, 18, 166, 192, -4, 18,
+ 2, 3, 4, 51, 168, 171, 179, 52, 180, 15,
+ 6, 183, 7, 8, 9, 181, 189, 185, 11, 12,
+ 186, 16, 17, 195, 13, 14, 15, 65, 197, 190,
+ 194, 97, 174, 89, 0, 0, 0, 0, 16, 17,
0, 0, 0, 139, 18, 2, 3, 4, 51, 0,
0, 68, 69, 0, 0, 6, 70, 7, 8, 9,
73, 74, 0, 11, 12, 0, 75, 76, 0, 13,
@@ -734,29 +734,29 @@ static const yytype_int16 yytable[] =
static const yytype_int16 yycheck[] =
{
- 0, 63, 90, 65, 0, 14, 15, 16, 13, 13,
- 0, 16, 17, 18, 102, 0, 11, 0, 52, 22,
- 50, 55, 27, 18, 35, 55, 15, 16, 33, 34,
- 35, 35, 27, 44, 52, 38, 39, 55, 36, 37,
- 43, 50, 45, 46, 47, 48, 14, 52, 16, 51,
- 53, 54, 10, 141, 50, 124, 34, 35, 63, 64,
+ 0, 63, 90, 65, 0, 51, 0, 35, 13, 13,
+ 0, 16, 17, 18, 102, 0, 44, 0, 38, 39,
+ 22, 52, 27, 43, 55, 14, 15, 16, 33, 34,
+ 35, 35, 10, 53, 54, 52, 38, 39, 55, 15,
+ 16, 43, 11, 45, 46, 47, 48, 52, 14, 10,
+ 16, 53, 54, 141, 50, 124, 50, 10, 63, 64,
65, 50, 62, 68, 69, 70, 71, 72, 73, 74,
- 75, 76, 62, 128, 27, 137, 29, 62, 133, 62,
- 149, 136, 35, 171, 153, 10, 0, 11, 157, 94,
- 95, 146, 10, 181, 10, 50, 44, 51, 103, 55,
- 169, 156, 11, 165, 11, 160, 27, 11, 163, 114,
- 51, 10, 181, 55, 18, 170, 10, 34, 11, 23,
- 11, 176, 11, 27, 28, 29, 30, 127, 10, 184,
- 135, 35, 137, 188, 10, 27, 55, 192, 0, 1,
+ 75, 76, 62, 128, 50, 137, 10, 62, 133, 62,
+ 149, 136, 50, 171, 153, 36, 37, 55, 157, 94,
+ 95, 146, 51, 181, 44, 11, 34, 35, 103, 55,
+ 169, 156, 18, 165, 27, 160, 11, 11, 163, 114,
+ 11, 27, 181, 10, 18, 170, 51, 34, 55, 23,
+ 27, 176, 29, 27, 28, 29, 30, 127, 35, 184,
+ 135, 35, 137, 188, 10, 27, 11, 192, 0, 1,
145, 7, 8, 9, 10, 7, 8, 9, 10, 52,
- 52, 35, 10, 16, 50, 17, 34, 19, 20, 21,
- 165, 21, 24, 25, 26, 31, 15, 33, 10, 31,
- 32, 33, 16, 7, 8, 9, 10, 32, 178, 45,
- 46, 16, 14, 45, 46, 51, 34, 187, 50, 51,
- 7, 8, 9, 10, 16, 21, 21, 31, 16, 33,
- 17, 32, 19, 20, 21, 38, 39, 50, 25, 26,
- 43, 45, 46, 32, 31, 32, 33, 51, 164, 46,
- 53, 54, 50, 62, -1, -1, -1, -1, 45, 46,
+ 11, 11, 10, 52, 10, 17, 35, 19, 20, 21,
+ 165, 55, 24, 25, 26, 31, 10, 33, 16, 31,
+ 32, 33, 50, 7, 8, 9, 10, 34, 178, 45,
+ 46, 21, 15, 45, 46, 51, 10, 187, 50, 51,
+ 7, 8, 9, 10, 32, 14, 16, 31, 16, 33,
+ 17, 16, 19, 20, 21, 34, 16, 21, 25, 26,
+ 21, 45, 46, 50, 31, 32, 33, 51, 50, 32,
+ 32, 62, 164, 46, -1, -1, -1, -1, 45, 46,
-1, -1, -1, 50, 51, 7, 8, 9, 10, -1,
-1, 38, 39, -1, -1, 17, 43, 19, 20, 21,
47, 48, -1, 25, 26, -1, 53, 54, -1, 31,
@@ -783,7 +783,7 @@ static const yytype_uint8 yystos[] =
73, 0, 50, 51, 44, 51, 65, 73, 38, 39,
43, 45, 46, 47, 48, 53, 54, 73, 84, 84,
84, 55, 11, 11, 27, 11, 18, 27, 35, 78,
- 80, 73, 22, 10, 35, 44, 52, 57, 65, 73,
+ 80, 73, 22, 10, 35, 44, 52, 58, 65, 73,
65, 73, 34, 44, 73, 73, 73, 73, 73, 73,
73, 73, 73, 52, 55, 52, 10, 11, 11, 11,
70, 10, 73, 73, 52, 71, 52, 70, 72, 73,
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 9fd8f3d..afd663d 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -90,7 +90,7 @@ using namespace Director;
%%
-program: programline '\n' program
+program: program '\n' programline
| programline
;
Commit: aac3497b739fb43c2ec232b1b53e317315071d4e
https://github.com/scummvm/scummvm/commit/aac3497b739fb43c2ec232b1b53e317315071d4e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Switched elsestmt rule to left recursion for more effectiveness
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 8cad3b9..959f0b6 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -515,8 +515,8 @@ static const yytype_int8 yyrhs[] =
60, 71, 50, 14, 70, 60, 71, 50, -1, 68,
65, 34, 72, 71, 16, 21, -1, 68, 65, 34,
72, 71, 14, 72, 71, 16, 21, -1, 68, 65,
- 34, 72, 71, 70, 63, 71, 16, 21, -1, 64,
- 63, -1, 64, -1, 69, 65, 34, 70, 60, 71,
+ 34, 72, 71, 70, 63, 71, 16, 21, -1, 63,
+ 64, -1, 64, -1, 69, 65, 34, 70, 60, 71,
50, -1, 69, 65, 34, 72, 71, -1, 73, -1,
73, 44, 73, -1, 51, 65, 52, -1, 32, 37,
-1, 32, 36, 10, -1, 21, -1, 15, -1, -1,
@@ -641,7 +641,7 @@ static const yytype_uint8 yydefact[] =
41, 37, 87, 0, 0, 0, 38, 21, 0, 39,
0, 0, 0, 39, 85, 0, 38, 39, 0, 39,
38, 23, 36, 38, 27, 0, 86, 82, 18, 39,
- 38, 37, 0, 0, 26, 0, 38, 0, 0, 0,
+ 38, 37, 0, 26, 0, 0, 38, 0, 0, 0,
0, 37, 0, 0, 38, 24, 25, 0, 38, 0,
19, 0, 38, 29, 20, 22, 0, 28
};
@@ -675,8 +675,8 @@ static const yytype_int16 yypact[] =
266, -89, 32, 183, 121, 134, -89, 166, -89, -89,
-89, 34, 106, 156, 152, 134, 266, 122, 143, -89,
160, 167, 176, -89, -89, 162, 266, -89, 181, -89,
- 183, -89, -89, -89, 167, 166, -89, 183, -89, -89,
- 183, -89, 180, 182, -89, 171, 183, 185, 228, 186,
+ 183, -89, -89, 167, -89, 166, -89, 183, -89, -89,
+ 183, -89, 180, -89, 182, 171, 183, 185, 228, 186,
189, 24, 190, 187, -89, -89, -89, 228, 183, 188,
-89, 163, -89, -89, -89, -89, 168, -89
};
@@ -684,7 +684,7 @@ static const yytype_int16 yypact[] =
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -89, -89, 159, 10, 0, -89, -89, 58, -89, -62,
+ -89, -89, 159, 10, 0, -89, -89, -89, 59, -62,
-89, -89, 15, -89, -88, -55, -69, -5, 17, -89,
-89, -89, 177, -89, -89, -89, -89, -89, 62
};
@@ -706,7 +706,7 @@ static const yytype_int16 yytable[] =
111, 112, 21, 141, -39, 148, 57, 27, 144, 29,
160, 147, 142, 178, 167, 55, 56, 143, 170, 122,
123, 157, 63, 187, 64, 85, 79, 80, 129, 81,
- 176, 169, 86, 175, 84, 172, 82, 38, 173, 130,
+ 176, 169, 86, 175, 84, 172, 82, 38, 174, 130,
83, 87, 188, 93, 39, 177, 34, 102, 114, 40,
41, 182, 43, 41, 42, 43, 44, 136, 88, 191,
146, 45, 67, 193, 116, 87, 117, 196, -4, 1,
@@ -718,7 +718,7 @@ static const yytype_int16 yytable[] =
2, 3, 4, 51, 168, 171, 179, 52, 180, 15,
6, 183, 7, 8, 9, 181, 189, 185, 11, 12,
186, 16, 17, 195, 13, 14, 15, 65, 197, 190,
- 194, 97, 174, 89, 0, 0, 0, 0, 16, 17,
+ 194, 97, 173, 89, 0, 0, 0, 0, 16, 17,
0, 0, 0, 139, 18, 2, 3, 4, 51, 0,
0, 68, 69, 0, 0, 6, 70, 7, 8, 9,
73, 74, 0, 11, 12, 0, 75, 76, 0, 13,
@@ -756,7 +756,7 @@ static const yytype_int16 yycheck[] =
7, 8, 9, 10, 32, 14, 16, 31, 16, 33,
17, 16, 19, 20, 21, 34, 16, 21, 25, 26,
21, 45, 46, 50, 31, 32, 33, 51, 50, 32,
- 32, 62, 164, 46, -1, -1, -1, -1, 45, 46,
+ 32, 62, 163, 46, -1, -1, -1, -1, 45, 46,
-1, -1, -1, 50, 51, 7, 8, 9, 10, -1,
-1, 38, 39, -1, -1, 17, 43, 19, 20, 21,
47, 48, -1, 25, 26, -1, 53, 54, -1, 31,
@@ -791,7 +791,7 @@ static const yytype_uint8 yystos[] =
60, 71, 50, 55, 71, 35, 73, 71, 65, 14,
16, 70, 55, 82, 10, 16, 73, 71, 50, 34,
72, 21, 15, 63, 64, 69, 10, 72, 32, 71,
- 72, 14, 71, 71, 63, 65, 72, 71, 70, 16,
+ 72, 14, 71, 64, 71, 65, 72, 71, 70, 16,
16, 34, 71, 16, 60, 21, 21, 70, 72, 16,
32, 71, 60, 71, 32, 50, 71, 50
};
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index afd663d..fd5245d 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -219,7 +219,7 @@ ifstmt: if cond tTHEN stmtlist end tEND tIF {
g_lingo->processIf(0, $8); }
;
-elseifstmt: elseifstmt1 elseifstmt
+elseifstmt: elseifstmt elseifstmt1
| elseifstmt1
;
Commit: 445bf8f5daca5ab8ba80f7e1b03a13ddd062829b
https://github.com/scummvm/scummvm/commit/445bf8f5daca5ab8ba80f7e1b03a13ddd062829b
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add sprite controlling fields
Changed paths:
engines/director/lingo/lingo-the.cpp
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 4d54110..59bd248 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -184,6 +184,15 @@ void Lingo::setTheSprite(int id, TheField field, Datum &d) {
case kTheInk:
sprite->_ink = static_cast<InkType>(d.u.i);
break;
+ case kTheLocH:
+ sprite->_startPoint.x = d.u.i;
+ break;
+ case kTheLocV:
+ sprite->_startPoint.y = d.u.i;
+ break;
+ case kTheConstraint:
+ sprite->_constraint = d.u.i;
+ break;
default:
error("Unprocessed setting field %d of sprite", field);
@@ -229,6 +238,18 @@ Datum Lingo::getTheSprite(int id, TheField field) {
case kTheInk:
d.u.i = sprite->_ink;
break;
+ case kTheInk:
+ sprite->_ink = static_cast<InkType>(d.u.i);
+ break;
+ case kTheLocH:
+ d.u.i = sprite->_startPoint.x;
+ break;
+ case kTheLocV:
+ d.u.i = sprite->_startPoint.y;
+ break;
+ case kTheConstraint:
+ d.u.i = sprite->_constraint;
+ break;
default:
error("Unprocessed getting field %d of sprite", field);
}
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index dd3ab54..53b2662 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1535,6 +1535,8 @@ Sprite::Sprite() {
_flags = 0;
_height = 0;
_castId = 0;
+ _constraint = 0;
+ _moveable = 0;
_castId = 0;
}
diff --git a/engines/director/score.h b/engines/director/score.h
index ee0eaa2..2f17783 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -286,6 +286,10 @@ public:
Common::Point _startPoint;
uint16 _width;
uint16 _height;
+ //TODO: default constraint = 0, if turned on, sprite is constrainted to the bounding rect
+ //As i know, constrainted != 0 only if sprite moveable
+ byte _constraint;
+ byte _moveable;
};
class Frame {
Commit: 98603a48d574011e1b457504e9a8b735bff0d466
https://github.com/scummvm/scummvm/commit/98603a48d574011e1b457504e9a8b735bff0d466
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Change hasID to int
Changed paths:
engines/director/lingo/lingo-the.cpp
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 59bd248..5ee4155 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -29,41 +29,41 @@ class Sprite;
static struct TheEntityProto {
TheEntity entity;
const char *name;
- bool hasID;
+ int hasID;
} entities[] = {
- { kTheFrame, "frame", false },
- { kThePathName, "pathname", false },
- { kTheMovie, "movie", false },
- { kTheMouseH, "mouseh", false },
- { kTheMouseV, "mousev", false },
- { kTheMouseDownScript, "mouseDownScript", false },
- { kTheMouseUpScript, "mouseUpScript", false },
- { kTheClickOn, "clickOn", false },
- { kTheDoubleClick, "doubleClick", false },
- { kTheLastClick, "lastClick", false },
- { kTheLastFrame, "lastFrame", false },
- { kTheLastEvent, "lastEvent", false },
- { kTheMouseUp, "mouseUp", false },
- { kTheMouseDown, "mouseDown", false },
- { kTheRightMouseUp, "rightMouseUp", false },
- { kTheRightMouseDown, "rightMouseDown", false },
- { kTheStillDown, "stillDown", false },
- { kTheKey, "key", false },
- { kTheControlDown, "controlDown", false },
- { kTheCommandDown, "commandDown", false },
- { kTheShiftDown, "shiftDown", false },
- { kTheOptionDown, "optionDown", false },
- { kTheMenu, "menu", true },
- { kTheMenus, "menus", false },
- { kTheMenuItem, "menuitem", true },
- { kTheMenuItems, "menuitems", true },
- { kTheSprite, "sprite", true },
- { kTheCast, "cast", true },
- { kThePerFrameHook, "perframehook", false },
- { kTheTicks, "ticks", false },
- { kTheTimer, "timer", false },
- { kTheTimeoutLength, "timeoutlength", false },
- { kTheWindow, "window", false },
+ { kTheFrame, "frame", VOID },
+ { kThePathName, "pathname", VOID },
+ { kTheMovie, "movie", VOID },
+ { kTheMouseH, "mouseh", VOID },
+ { kTheMouseV, "mousev", VOID },
+ { kTheMouseDownScript, "mouseDownScript", VOID },
+ { kTheMouseUpScript, "mouseUpScript", VOID },
+ { kTheClickOn, "clickOn", VOID },
+ { kTheDoubleClick, "doubleClick", VOID },
+ { kTheLastClick, "lastClick", VOID },
+ { kTheLastFrame, "lastFrame", VOID },
+ { kTheLastEvent, "lastEvent", VOID },
+ { kTheMouseUp, "mouseUp", VOID },
+ { kTheMouseDown, "mouseDown", VOID },
+ { kTheRightMouseUp, "rightMouseUp", VOID },
+ { kTheRightMouseDown, "rightMouseDown", VOID },
+ { kTheStillDown, "stillDown", VOID },
+ { kTheKey, "key", VOID },
+ { kTheControlDown, "controlDown", VOID },
+ { kTheCommandDown, "commandDown", VOID },
+ { kTheShiftDown, "shiftDown", VOID },
+ { kTheOptionDown, "optionDown", VOID },
+ { kTheMenu, "menu", INT },
+ { kTheMenus, "menus", VOID },
+ { kTheMenuItem, "menuitem", STRING }, // int?
+ { kTheMenuItems, "menuitems", VOID },
+ { kTheSprite, "sprite", INT },
+ { kTheCast, "cast", INT }, // string?
+ { kThePerFrameHook, "perframehook", VOID },
+ { kTheTicks, "ticks", VOID },
+ { kTheTimer, "timer", VOID },
+ { kTheTimeoutLength, "timeoutlength", VOID },
+ { kTheWindow, "window", VOID },
{ kTheNOEntity, NULL, false }
};
@@ -238,9 +238,6 @@ Datum Lingo::getTheSprite(int id, TheField field) {
case kTheInk:
d.u.i = sprite->_ink;
break;
- case kTheInk:
- sprite->_ink = static_cast<InkType>(d.u.i);
- break;
case kTheLocH:
d.u.i = sprite->_startPoint.x;
break;
Commit: 1808dcdc3011d7e7ceed9cad98410e99ec0f61c0
https://github.com/scummvm/scummvm/commit/1808dcdc3011d7e7ceed9cad98410e99ec0f61c0
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add modified flag, Lingo: Handle some common cast fields
Changed paths:
engines/director/lingo/lingo-the.cpp
engines/director/lingo/lingo.h
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 5ee4155..b3c0702 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -101,33 +101,42 @@ static struct TheEntityFieldProto {
{ kTheSprite, "volume", kTheVolume },
{ kTheSprite, "width", kTheWidth },
- { kTheCast, "backColor", kTheBackColor },
+ //Common cast fields
+ { kTheCast, "width", kTheWidth },
+ { kTheCast, "height", kTheHeight },
+ { kTheCast, "filename", kTheFilename },
+ { kTheCast, "scriptText", kTheScriptText },
{ kTheCast, "castType", kTheCastType },
+ { kTheCast, "name", kTheName },
+ { kTheCast, "rect", kTheRect },
+ { kTheCast, "number", kTheNumber },
+ { kTheCast, "modified", kTheModified },
+ { kTheCast, "loaded", kTheLoaded },
+ { kTheCast, "purgePriority",kThePurgePriority }, //0 Never purge, 1 Purge Last, 2 Purge next, 2 Purge normal
+
+ //Shape fields
+ { kTheCast, "backColor", kTheBackColor },
+ { kTheCast, "foreColor", kTheForeColor },
+
+ //Digital video fields
{ kTheCast, "controller", kTheController },
- { kTheCast, "depth", kTheDepth },
{ kTheCast, "directToStage",kTheDirectToStage },
- { kTheCast, "filename", kTheFilename },
- { kTheCast, "foreColor", kTheForeColor },
{ kTheCast, "frameRate", kTheFrameRate },
- { kTheCast, "hilite", kTheHilite },
- { kTheCast, "height", kTheHeight },
{ kTheCast, "loop", kTheLoop },
- { kTheCast, "loaded", kTheLoaded },
- { kTheCast, "modified", kTheModified },
- { kTheCast, "number", kTheNumber },
- { kTheCast, "name", kTheName },
- { kTheCast, "palette", kThePalette },
{ kTheCast, "pausedAtStart",kThePausedAtStart },
- { kTheCast, "picture", kThePicture },
{ kTheCast, "preload", kThePreload },
- { kTheCast, "purgePriority",kThePurgePriority },
- { kTheCast, "rect", kTheRect },
+ { kTheCast, "sound", kTheSound }, // 0-1 off-on
+
+ //Bitmap fields
+ { kTheCast, "depth", kTheDepth },
{ kTheCast, "regPoint", kTheRegPoint },
- { kTheCast, "scriptText", kTheScriptText },
+ { kTheCast, "palette", kThePalette },
+ { kTheCast, "picture", kThePicture },
+
+ //TextCast fields
{ kTheCast, "size", kTheSize },
- { kTheCast, "sound", kTheSound },
+ { kTheCast, "hilite", kTheHilite },
{ kTheCast, "text", kTheText },
- { kTheCast, "width", kTheWidth },
{ kTheWindow, "drawRect", kTheDrawRect },
{ kTheWindow, "filename", kTheFilename },
@@ -206,6 +215,8 @@ Datum Lingo::getTheEntity(TheEntity entity, int id, TheField field) {
case kTheSprite:
d = getTheSprite(id, field);
break;
+ case kTheCast:
+ d = getTheCast(id, field);
case kThePerFrameHook:
warning("STUB: getting the perframehook");
break;
@@ -254,5 +265,94 @@ Datum Lingo::getTheSprite(int id, TheField field) {
return d;
}
+Datum Lingo::getTheCast(int id, TheField field) {
+ Datum d;
+ d.type = INT;
+
+ Cast *cast;
+ if (!_vm->_currentScore->_casts.contains(id)) {
+
+ if (field == kTheLoaded) {
+ d.u.i = 0;
+ }
+
+ return d;
+ } else {
+ error ("Not cast %d found", id);
+ }
+ cast = _vm->_currentScore->_casts[id];
+
+ switch (field) {
+ case kTheCastType:
+ d.u.i = cast->type;
+ break;
+ case kTheWidth:
+ d.u.i = cast->initialRect.width();
+ break;
+ case kTheHeight:
+ d.u.i = cast->initialRect.height();
+ break;
+ case kTheBackColor:
+ {
+ if (cast->type != kCastShape)
+ error("Field %d of cast %d not found", field, id);
+ ShapeCast *shape = static_cast<ShapeCast *>(_vm->_currentScore->_casts[id]);
+ d.u.i = shape->bgCol;
+ }
+ break;
+ case kTheForeColor:
+ {
+ if (cast->type != kCastShape)
+ error("Field %d of cast %d not found", field, id);
+ ShapeCast *shape = static_cast<ShapeCast *>(_vm->_currentScore->_casts[id]);
+ d.u.i = shape->fgCol;
+ }
+ break;
+ case kTheLoaded:
+ d.u.i = 1; //Not loaded handled above
+ break;
+ default:
+ error("Unprocessed getting field %d of cast %d", field, id);
+ //TODO find out about String fields
+ }
+}
+
+void Lingo::setTheCast(int id, TheField field, Datum &d) {
+ Cast *cast = _vm->_currentScore->_casts[id];
+ switch (field) {
+ case kTheCastType:
+ cast->type = static_cast<CastType>(d.u.i);
+ cast->modified = 1;
+ break;
+ case kTheWidth:
+ cast->initialRect.setWidth(d.u.i);
+ cast->modified = 1;
+ break;
+ case kTheHeight:
+ cast->initialRect.setHeight(d.u.i);
+ cast->modified = 1;
+ break;
+ case kTheBackColor:
+ {
+ if (cast->type != kCastShape)
+ error("Field %d of cast %d not found", field, id);
+ ShapeCast *shape = static_cast<ShapeCast *>(_vm->_currentScore->_casts[id]);
+ shape->bgCol = d.u.i;
+ shape->modified = 1;
+ }
+ break;
+ case kTheForeColor:
+ {
+ if (cast->type != kCastShape)
+ error("Field %d of cast %d not found", field, id);
+ ShapeCast *shape = static_cast<ShapeCast *>(_vm->_currentScore->_casts[id]);
+ shape->fgCol = d.u.i;
+ shape->modified = 1;
+ }
+ break;
+ default:
+ error("Unprocessed getting field %d of cast %d", field, id);
+ }
+}
} // End of namespace Director
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 8527d33..de3847c 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -226,8 +226,10 @@ public:
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);
public:
ScriptData *_currentScript;
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 53b2662..24d0b34 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -654,6 +654,7 @@ BitmapCast::BitmapCast(Common::SeekableSubReadStreamEndian &stream) {
/*uint16 unk1 =*/ stream.readUint16();
/*uint16 unk2 =*/ stream.readUint16();
}
+ modified = 0;
}
TextCast::TextCast(Common::SeekableSubReadStreamEndian &stream) {
@@ -678,6 +679,7 @@ TextCast::TextCast(Common::SeekableSubReadStreamEndian &stream) {
textFlags.push_back(kTextFlagDoNotWrap);
//again supposition
fontSize = stream.readUint16();
+ modified = 0;
}
ShapeCast::ShapeCast(Common::SeekableSubReadStreamEndian &stream) {
@@ -691,6 +693,7 @@ ShapeCast::ShapeCast(Common::SeekableSubReadStreamEndian &stream) {
fillType = stream.readByte();
lineThickness = stream.readByte();
lineDirection = stream.readByte();
+ modified = 0;
}
Common::Rect Score::readRect(Common::SeekableSubReadStreamEndian &stream) {
diff --git a/engines/director/score.h b/engines/director/score.h
index 2f17783..b0164ed 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -170,6 +170,7 @@ enum TransitionType {
struct Cast {
CastType type;
Common::Rect initialRect;
+ byte modified;
};
struct BitmapCast : Cast {
Commit: d7bdda559d5c3f8f002cc23be23908cdd07a282e
https://github.com/scummvm/scummvm/commit/d7bdda559d5c3f8f002cc23be23908cdd07a282e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Merged if and oneline if grammar
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 959f0b6..25b242a 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -428,18 +428,18 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 61
+#define YYFINAL 60
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 332
+#define YYLAST 336
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 56
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 29
+#define YYNNTS 28
/* YYNRULES -- Number of rules. */
-#define YYNRULES 91
+#define YYNRULES 90
/* YYNRULES -- Number of states. */
-#define YYNSTATES 198
+#define YYNSTATES 195
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -489,69 +489,70 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
- 20, 22, 24, 29, 34, 39, 41, 43, 45, 54,
- 66, 79, 86, 99, 107, 118, 129, 132, 134, 142,
- 148, 150, 154, 158, 161, 165, 167, 169, 170, 171,
- 172, 175, 178, 180, 182, 187, 192, 194, 196, 200,
- 204, 208, 212, 216, 220, 224, 228, 232, 235, 238,
- 242, 245, 248, 251, 253, 255, 258, 260, 264, 267,
- 270, 273, 276, 280, 283, 287, 290, 293, 295, 299,
- 302, 306, 307, 316, 317, 319, 323, 328, 329, 333,
- 334, 336
+ 20, 22, 27, 32, 37, 39, 41, 43, 52, 64,
+ 77, 86, 93, 105, 118, 130, 133, 135, 143, 149,
+ 151, 155, 159, 162, 166, 168, 170, 171, 172, 173,
+ 176, 179, 181, 183, 188, 193, 195, 197, 201, 205,
+ 209, 213, 217, 221, 225, 229, 233, 236, 239, 243,
+ 246, 249, 252, 254, 256, 259, 261, 265, 268, 271,
+ 274, 277, 281, 284, 288, 291, 294, 296, 300, 303,
+ 307, 308, 317, 318, 320, 324, 329, 330, 334, 335,
+ 337
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
57, 0, -1, 57, 50, 58, -1, 58, -1, -1,
- 79, -1, 74, -1, 83, -1, 59, -1, 61, -1,
- 60, -1, 1, -1, 31, 73, 22, 10, -1, 33,
- 10, 44, 73, -1, 33, 10, 35, 73, -1, 73,
- -1, 74, -1, 62, -1, 66, 51, 65, 52, 72,
- 71, 16, 32, -1, 67, 44, 73, 71, 35, 73,
- 71, 72, 71, 16, 32, -1, 67, 44, 73, 71,
- 13, 35, 73, 71, 72, 71, 16, 32, -1, 68,
- 65, 34, 70, 60, 71, -1, 68, 65, 34, 70,
- 60, 71, 50, 14, 70, 60, 71, 50, -1, 68,
- 65, 34, 72, 71, 16, 21, -1, 68, 65, 34,
- 72, 71, 14, 72, 71, 16, 21, -1, 68, 65,
- 34, 72, 71, 70, 63, 71, 16, 21, -1, 63,
- 64, -1, 64, -1, 69, 65, 34, 70, 60, 71,
- 50, -1, 69, 65, 34, 72, 71, -1, 73, -1,
- 73, 44, 73, -1, 51, 65, 52, -1, 32, 37,
- -1, 32, 36, 10, -1, 21, -1, 15, -1, -1,
- -1, -1, 72, 50, -1, 72, 60, -1, 7, -1,
- 8, -1, 9, 51, 84, 52, -1, 10, 51, 84,
- 52, -1, 10, -1, 59, -1, 73, 45, 73, -1,
- 73, 46, 73, -1, 73, 47, 73, -1, 73, 48,
- 73, -1, 73, 53, 73, -1, 73, 54, 73, -1,
- 73, 43, 73, -1, 73, 38, 73, -1, 73, 39,
- 73, -1, 45, 73, -1, 46, 73, -1, 51, 73,
- 52, -1, 25, 11, -1, 26, 10, -1, 31, 73,
- -1, 76, -1, 17, -1, 19, 75, -1, 10, -1,
- 75, 55, 10, -1, 20, 23, -1, 20, 28, -1,
- 20, 30, -1, 20, 77, -1, 20, 77, 78, -1,
- 20, 78, -1, 35, 18, 11, -1, 18, 11, -1,
- 35, 11, -1, 11, -1, 29, 27, 11, -1, 27,
- 11, -1, 35, 27, 11, -1, -1, 24, 10, 80,
- 70, 81, 50, 82, 72, -1, -1, 10, -1, 81,
- 55, 10, -1, 81, 50, 55, 10, -1, -1, 10,
- 70, 84, -1, -1, 73, -1, 84, 55, 73, -1
+ 78, -1, 73, -1, 82, -1, 59, -1, 60, -1,
+ 1, -1, 31, 72, 22, 10, -1, 33, 10, 44,
+ 72, -1, 33, 10, 35, 72, -1, 72, -1, 73,
+ -1, 61, -1, 65, 51, 64, 52, 71, 70, 16,
+ 32, -1, 66, 44, 72, 70, 35, 72, 70, 71,
+ 70, 16, 32, -1, 66, 44, 72, 70, 13, 35,
+ 72, 70, 71, 70, 16, 32, -1, 67, 64, 34,
+ 50, 71, 70, 16, 21, -1, 67, 64, 34, 69,
+ 60, 70, -1, 67, 64, 34, 50, 71, 70, 14,
+ 71, 70, 16, 21, -1, 67, 64, 34, 69, 60,
+ 70, 50, 14, 69, 60, 70, 50, -1, 67, 64,
+ 34, 50, 71, 70, 69, 62, 70, 16, 21, -1,
+ 62, 63, -1, 63, -1, 68, 64, 34, 69, 60,
+ 70, 50, -1, 68, 64, 34, 71, 70, -1, 72,
+ -1, 72, 44, 72, -1, 51, 64, 52, -1, 32,
+ 37, -1, 32, 36, 10, -1, 21, -1, 15, -1,
+ -1, -1, -1, 71, 50, -1, 71, 60, -1, 7,
+ -1, 8, -1, 9, 51, 83, 52, -1, 10, 51,
+ 83, 52, -1, 10, -1, 59, -1, 72, 45, 72,
+ -1, 72, 46, 72, -1, 72, 47, 72, -1, 72,
+ 48, 72, -1, 72, 53, 72, -1, 72, 54, 72,
+ -1, 72, 43, 72, -1, 72, 38, 72, -1, 72,
+ 39, 72, -1, 45, 72, -1, 46, 72, -1, 51,
+ 72, 52, -1, 25, 11, -1, 26, 10, -1, 31,
+ 72, -1, 75, -1, 17, -1, 19, 74, -1, 10,
+ -1, 74, 55, 10, -1, 20, 23, -1, 20, 28,
+ -1, 20, 30, -1, 20, 76, -1, 20, 76, 77,
+ -1, 20, 77, -1, 35, 18, 11, -1, 18, 11,
+ -1, 35, 11, -1, 11, -1, 29, 27, 11, -1,
+ 27, 11, -1, 35, 27, 11, -1, -1, 24, 10,
+ 79, 69, 80, 50, 81, 71, -1, -1, 10, -1,
+ 80, 55, 10, -1, 80, 50, 55, 10, -1, -1,
+ 10, 69, 83, -1, -1, 72, -1, 83, 55, 72,
+ -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 93, 93, 94, 97, 98, 99, 100, 101, 102,
- 103, 104, 107, 113, 119, 127, 128, 129, 134, 145,
- 161, 175, 183, 195, 202, 211, 222, 223, 226, 232,
- 240, 241, 242, 244, 246, 252, 258, 265, 267, 269,
- 270, 271, 274, 279, 282, 288, 296, 299, 300, 301,
- 302, 303, 304, 305, 306, 307, 308, 309, 310, 311,
- 314, 315, 316, 317, 318, 320, 323, 324, 335, 336,
- 337, 338, 343, 349, 356, 357, 358, 359, 362, 363,
- 364, 392, 392, 399, 400, 401, 402, 404, 407, 415,
- 416, 417
+ 103, 106, 112, 118, 126, 127, 128, 133, 144, 160,
+ 174, 181, 189, 198, 208, 219, 220, 223, 229, 237,
+ 238, 239, 241, 243, 249, 255, 262, 264, 266, 267,
+ 268, 271, 276, 279, 285, 293, 296, 297, 298, 299,
+ 300, 301, 302, 303, 304, 305, 306, 307, 308, 311,
+ 312, 313, 314, 315, 317, 320, 321, 332, 333, 334,
+ 335, 340, 346, 353, 354, 355, 356, 359, 360, 361,
+ 389, 389, 396, 397, 398, 399, 401, 404, 412, 413,
+ 414
};
#endif
@@ -567,11 +568,10 @@ static const char *const yytname[] =
"tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tGE",
"tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'",
"'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "','", "$accept", "program",
- "programline", "asgn", "stmt", "stmtoneliner", "ifstmt", "elseifstmt",
- "elseifstmt1", "cond", "repeatwhile", "repeatwith", "if", "elseif",
- "begin", "end", "stmtlist", "expr", "func", "globallist", "gotofunc",
- "gotoframe", "gotomovie", "defn", "@1", "argdef", "argstore", "macro",
- "arglist", 0
+ "programline", "asgn", "stmt", "ifstmt", "elseifstmt", "elseifstmt1",
+ "cond", "repeatwhile", "repeatwith", "if", "elseif", "begin", "end",
+ "stmtlist", "expr", "func", "globallist", "gotofunc", "gotoframe",
+ "gotomovie", "defn", "@1", "argdef", "argstore", "macro", "arglist", 0
};
#endif
@@ -593,30 +593,30 @@ static const yytype_uint16 yytoknum[] =
static const yytype_uint8 yyr1[] =
{
0, 56, 57, 57, 58, 58, 58, 58, 58, 58,
- 58, 58, 59, 59, 59, 60, 60, 60, 60, 60,
- 60, 61, 61, 62, 62, 62, 63, 63, 64, 64,
- 65, 65, 65, 66, 67, 68, 69, 70, 71, 72,
- 72, 72, 73, 73, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
- 74, 74, 74, 74, 74, 74, 75, 75, 76, 76,
- 76, 76, 76, 76, 77, 77, 77, 77, 78, 78,
- 78, 80, 79, 81, 81, 81, 81, 82, 83, 84,
- 84, 84
+ 58, 59, 59, 59, 60, 60, 60, 60, 60, 60,
+ 61, 61, 61, 61, 61, 62, 62, 63, 63, 64,
+ 64, 64, 65, 66, 67, 68, 69, 70, 71, 71,
+ 71, 72, 72, 72, 72, 72, 72, 72, 72, 72,
+ 72, 72, 72, 72, 72, 72, 72, 72, 72, 73,
+ 73, 73, 73, 73, 73, 74, 74, 75, 75, 75,
+ 75, 75, 75, 76, 76, 76, 76, 77, 77, 77,
+ 79, 78, 80, 80, 80, 80, 81, 82, 83, 83,
+ 83
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 1, 1, 4, 4, 4, 1, 1, 1, 8, 11,
- 12, 6, 12, 7, 10, 10, 2, 1, 7, 5,
- 1, 3, 3, 2, 3, 1, 1, 0, 0, 0,
- 2, 2, 1, 1, 4, 4, 1, 1, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 2, 2, 3,
- 2, 2, 2, 1, 1, 2, 1, 3, 2, 2,
- 2, 2, 3, 2, 3, 2, 2, 1, 3, 2,
- 3, 0, 8, 0, 1, 3, 4, 0, 3, 0,
- 1, 3
+ 1, 4, 4, 4, 1, 1, 1, 8, 11, 12,
+ 8, 6, 11, 12, 11, 2, 1, 7, 5, 1,
+ 3, 3, 2, 3, 1, 1, 0, 0, 0, 2,
+ 2, 1, 1, 4, 4, 1, 1, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 2, 2, 3, 2,
+ 2, 2, 1, 1, 2, 1, 3, 2, 2, 2,
+ 2, 3, 2, 3, 2, 2, 1, 3, 2, 3,
+ 0, 8, 0, 1, 3, 4, 0, 3, 0, 1,
+ 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -624,150 +624,150 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 42, 43, 0, 37, 64, 0, 0, 35,
+ 0, 10, 41, 42, 0, 36, 63, 0, 0, 34,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 3, 47, 10, 9, 17, 0, 0, 0, 15, 6,
- 63, 5, 7, 89, 89, 89, 66, 65, 77, 0,
- 68, 0, 69, 0, 70, 0, 71, 73, 81, 60,
- 61, 46, 0, 47, 62, 0, 33, 0, 57, 58,
- 0, 1, 0, 0, 0, 0, 0, 30, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 90, 0, 0,
- 88, 0, 75, 79, 0, 76, 0, 0, 0, 72,
- 37, 0, 0, 34, 0, 0, 59, 2, 0, 38,
- 0, 0, 37, 0, 55, 56, 54, 48, 49, 50,
- 51, 52, 53, 44, 0, 45, 67, 78, 74, 80,
- 83, 12, 14, 13, 39, 0, 32, 0, 38, 31,
- 91, 84, 0, 38, 0, 0, 38, 0, 16, 40,
- 41, 37, 87, 0, 0, 0, 38, 21, 0, 39,
- 0, 0, 0, 39, 85, 0, 38, 39, 0, 39,
- 38, 23, 36, 38, 27, 0, 86, 82, 18, 39,
- 38, 37, 0, 26, 0, 0, 38, 0, 0, 0,
- 0, 37, 0, 0, 38, 24, 25, 0, 38, 0,
- 19, 0, 38, 29, 20, 22, 0, 28
+ 3, 46, 9, 16, 0, 0, 0, 14, 6, 62,
+ 5, 7, 88, 88, 88, 65, 64, 76, 0, 67,
+ 0, 68, 0, 69, 0, 70, 72, 80, 59, 60,
+ 45, 0, 46, 61, 0, 32, 0, 56, 57, 0,
+ 1, 0, 0, 0, 0, 0, 29, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 89, 0, 0, 87,
+ 0, 74, 78, 0, 75, 0, 0, 0, 71, 36,
+ 0, 0, 33, 0, 0, 58, 2, 0, 37, 0,
+ 0, 36, 0, 54, 55, 53, 47, 48, 49, 50,
+ 51, 52, 43, 0, 44, 66, 77, 73, 79, 82,
+ 11, 13, 12, 38, 0, 31, 38, 0, 30, 90,
+ 83, 0, 37, 0, 0, 37, 37, 15, 86, 0,
+ 39, 40, 0, 0, 37, 36, 21, 0, 38, 84,
+ 0, 37, 38, 38, 0, 0, 0, 85, 81, 17,
+ 38, 37, 37, 20, 35, 37, 26, 0, 36, 37,
+ 0, 0, 25, 0, 0, 0, 0, 0, 0, 0,
+ 36, 37, 0, 18, 22, 24, 0, 37, 0, 19,
+ 37, 28, 23, 0, 27
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 19, 20, 53, 140, 23, 24, 163, 164, 66,
- 25, 26, 137, 165, 35, 125, 128, 28, 138, 37,
- 30, 46, 47, 31, 90, 132, 153, 32, 78
+ -1, 19, 20, 52, 141, 23, 165, 166, 65, 24,
+ 25, 26, 167, 34, 124, 132, 27, 137, 36, 29,
+ 45, 46, 30, 89, 131, 148, 31, 77
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -89
+#define YYPACT_NINF -109
static const yytype_int16 yypact[] =
{
- 138, -89, -89, -89, -46, 278, -89, 22, 96, -89,
- 39, 31, 47, 134, 49, 66, 134, 134, 134, 4,
- -89, 6, -89, -89, -89, 41, 50, 166, 266, -89,
- -89, -89, -89, 134, 134, 134, -89, 44, -89, 95,
- -89, 99, -89, 77, -89, 84, 93, -89, -89, -89,
- -89, 65, 134, -89, -2, 103, -89, -28, -20, -20,
- 242, -89, 138, 166, 134, 166, 83, 254, 134, 134,
- 134, 134, 134, 134, 134, 134, 134, 266, -31, -17,
- 63, 124, -89, -89, 125, -89, 139, 140, 108, -89,
- -89, -2, 142, -89, 134, 134, -89, -89, 97, 266,
- 101, 224, 11, 134, 266, 266, 266, 203, 203, -20,
- -20, 266, 266, -89, 134, -89, -89, -89, -89, -89,
- 144, -89, 266, 266, -89, -4, -89, 228, 183, 266,
- 266, -89, 32, 183, 121, 134, -89, 166, -89, -89,
- -89, 34, 106, 156, 152, 134, 266, 122, 143, -89,
- 160, 167, 176, -89, -89, 162, 266, -89, 181, -89,
- 183, -89, -89, 167, -89, 166, -89, 183, -89, -89,
- 183, -89, 180, -89, 182, 171, 183, 185, 228, 186,
- 189, 24, 190, 187, -89, -89, -89, 228, 183, 188,
- -89, 163, -89, -89, -89, -89, 168, -89
+ 133, -109, -109, -109, -8, 282, -109, 41, 192, -109,
+ 43, 20, 64, 70, -14, 72, 70, 70, 70, 5,
+ -109, 6, -109, -109, 45, 42, 163, 270, -109, -109,
+ -109, -109, 70, 70, 70, -109, 37, -109, 83, -109,
+ 88, -109, 75, -109, 80, -20, -109, -109, -109, -109,
+ 58, 70, -109, 221, 102, -109, -18, -4, -4, 246,
+ -109, 133, 163, 70, 163, 79, 258, 70, 70, 70,
+ 70, 70, 70, 70, 70, 70, 270, 21, 35, 62,
+ 109, -109, -109, 111, -109, 112, 113, 93, -109, -109,
+ 221, 115, -109, 70, 70, -109, -109, 74, 270, 76,
+ 234, 81, 70, 270, 270, 270, -6, -6, -4, -4,
+ 270, 270, -109, 70, -109, -109, -109, -109, -109, 122,
+ -109, 270, 270, -109, -11, -109, -109, 225, 270, 270,
+ -109, -25, 180, 100, 70, 180, -109, -109, 82, 134,
+ -109, -109, 129, 70, 270, 22, 96, 137, -109, -109,
+ 116, 270, -109, -109, 128, 136, 141, -109, 180, -109,
+ -109, 180, 180, -109, -109, 136, -109, 163, -109, 180,
+ 140, 144, -109, 145, 135, 225, 147, 142, 146, 155,
+ 4, -109, 148, -109, -109, -109, 225, 180, 118, -109,
+ -109, -109, -109, 127, -109
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -89, -89, 159, 10, 0, -89, -89, -89, 59, -62,
- -89, -89, 15, -89, -88, -55, -69, -5, 17, -89,
- -89, -89, 177, -89, -89, -89, -89, -89, 62
+ -109, -109, 120, 10, 0, -109, -109, 17, -61, -109,
+ -109, -109, -109, -85, -51, -108, -5, 14, -109, -109,
+ -109, 150, -109, -109, -109, -109, -109, 71
};
/* 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 -47
+#define YYTABLE_NINF -46
static const yytype_int16 yytable[] =
{
- 22, 98, 120, 100, 61, 33, -8, 94, 54, 134,
- 21, 58, 59, 60, 127, 27, 95, 29, 68, 69,
- 92, 113, 67, 70, 114, -39, -39, -39, 77, 77,
- 77, 135, 36, 75, 76, 115, 68, 69, 114, -39,
- -39, 70, 49, 71, 72, 73, 74, 91, 149, 48,
- 150, 75, 76, 151, 62, 133, -8, 50, 67, 99,
- 101, -39, 22, 104, 105, 106, 107, 108, 109, 110,
- 111, 112, 21, 141, -39, 148, 57, 27, 144, 29,
- 160, 147, 142, 178, 167, 55, 56, 143, 170, 122,
- 123, 157, 63, 187, 64, 85, 79, 80, 129, 81,
- 176, 169, 86, 175, 84, 172, 82, 38, 174, 130,
- 83, 87, 188, 93, 39, 177, 34, 102, 114, 40,
- 41, 182, 43, 41, 42, 43, 44, 136, 88, 191,
- 146, 45, 67, 193, 116, 87, 117, 196, -4, 1,
- 156, 2, 3, 4, 51, 2, 3, 4, 5, 124,
- 118, 119, 121, 126, 131, 6, 145, 7, 8, 9,
- 67, 152, 10, 11, 12, 52, 154, 15, 155, 13,
- 14, 15, 158, 2, 3, 4, 51, 159, 184, 16,
- 17, 161, 162, 16, 17, 18, 166, 192, -4, 18,
- 2, 3, 4, 51, 168, 171, 179, 52, 180, 15,
- 6, 183, 7, 8, 9, 181, 189, 185, 11, 12,
- 186, 16, 17, 195, 13, 14, 15, 65, 197, 190,
- 194, 97, 173, 89, 0, 0, 0, 0, 16, 17,
- 0, 0, 0, 139, 18, 2, 3, 4, 51, 0,
- 0, 68, 69, 0, 0, 6, 70, 7, 8, 9,
- 73, 74, 0, 11, 12, 0, 75, 76, 0, 13,
- 14, 15, 68, 69, 0, 0, 0, 70, 103, 71,
- 72, 73, 74, 16, 17, 0, 96, 75, 76, 18,
- 68, 69, 0, 0, 0, 70, 0, 71, 72, 73,
- 74, 0, 68, 69, 96, 75, 76, 70, 103, 71,
- 72, 73, 74, 0, 68, 69, 0, 75, 76, 70,
- 0, 71, 72, 73, 74, 0, -46, -46, 0, 75,
- 76, -46, 0, 0, 0, -46, -46, 0, 0, 34,
- 0, -46, -46
+ 22, 97, 133, 99, 119, 60, -8, 40, 53, 42,
+ 21, 57, 58, 59, 28, 87, 127, 93, 135, -38,
+ -38, 66, 54, 55, 134, 138, 94, 76, 76, 76,
+ 139, 48, 67, 68, 67, 68, 153, 69, 154, 69,
+ 158, 72, 73, 32, 161, 162, 90, 74, 75, 74,
+ 75, 35, 169, 47, -38, 61, -8, 66, 98, 100,
+ 155, 22, 103, 104, 105, 106, 107, 108, 109, 110,
+ 111, 21, 187, 112, 49, 28, 113, 2, 3, 4,
+ 50, 142, 56, 175, 145, 146, 63, 114, 121, 122,
+ 113, 84, 80, 152, 81, 186, 62, 128, 85, 82,
+ 160, 51, 83, 15, 78, 79, 174, 86, 129, 33,
+ 170, 171, 92, 101, 173, 16, 17, 113, 176, 115,
+ 86, 18, 116, 117, 118, 120, 123, 136, 125, 144,
+ 188, 126, 130, -4, 1, 143, 191, 147, 151, 193,
+ 2, 3, 4, 5, 149, 150, 156, 157, 159, 163,
+ 6, 164, 7, 8, 9, 168, 177, 10, 11, 12,
+ 178, 179, 66, 182, 13, 14, 15, 184, 192, 180,
+ 2, 3, 4, 50, 183, 181, 185, 194, 16, 17,
+ 189, 96, 172, -4, 18, 0, 190, 2, 3, 4,
+ 50, 0, 0, 0, 51, 88, 15, 6, 0, 7,
+ 8, 9, 0, 37, 0, 11, 12, 0, 16, 17,
+ 38, 13, 14, 15, 64, 39, 0, 0, 0, 40,
+ 41, 42, 43, 0, 0, 16, 17, 44, 0, 0,
+ 140, 18, 2, 3, 4, 50, 0, 0, 0, 0,
+ 0, 0, 6, 91, 7, 8, 9, 0, 0, 0,
+ 11, 12, 0, 0, 0, 0, 13, 14, 15, 67,
+ 68, 0, 0, 0, 69, 0, 70, 71, 72, 73,
+ 16, 17, 67, 68, 74, 75, 18, 69, 102, 70,
+ 71, 72, 73, 0, 67, 68, 95, 74, 75, 69,
+ 0, 70, 71, 72, 73, 0, 67, 68, 95, 74,
+ 75, 69, 102, 70, 71, 72, 73, 0, 67, 68,
+ 0, 74, 75, 69, 0, 70, 71, 72, 73, 0,
+ -45, -45, 0, 74, 75, -45, 0, 0, 0, -45,
+ -45, 0, 0, 33, 0, -45, -45
};
static const yytype_int16 yycheck[] =
{
- 0, 63, 90, 65, 0, 51, 0, 35, 13, 13,
- 0, 16, 17, 18, 102, 0, 44, 0, 38, 39,
- 22, 52, 27, 43, 55, 14, 15, 16, 33, 34,
- 35, 35, 10, 53, 54, 52, 38, 39, 55, 15,
- 16, 43, 11, 45, 46, 47, 48, 52, 14, 10,
- 16, 53, 54, 141, 50, 124, 50, 10, 63, 64,
- 65, 50, 62, 68, 69, 70, 71, 72, 73, 74,
- 75, 76, 62, 128, 50, 137, 10, 62, 133, 62,
- 149, 136, 50, 171, 153, 36, 37, 55, 157, 94,
- 95, 146, 51, 181, 44, 11, 34, 35, 103, 55,
- 169, 156, 18, 165, 27, 160, 11, 11, 163, 114,
- 11, 27, 181, 10, 18, 170, 51, 34, 55, 23,
- 27, 176, 29, 27, 28, 29, 30, 127, 35, 184,
- 135, 35, 137, 188, 10, 27, 11, 192, 0, 1,
- 145, 7, 8, 9, 10, 7, 8, 9, 10, 52,
- 11, 11, 10, 52, 10, 17, 35, 19, 20, 21,
- 165, 55, 24, 25, 26, 31, 10, 33, 16, 31,
- 32, 33, 50, 7, 8, 9, 10, 34, 178, 45,
- 46, 21, 15, 45, 46, 51, 10, 187, 50, 51,
- 7, 8, 9, 10, 32, 14, 16, 31, 16, 33,
- 17, 16, 19, 20, 21, 34, 16, 21, 25, 26,
- 21, 45, 46, 50, 31, 32, 33, 51, 50, 32,
- 32, 62, 163, 46, -1, -1, -1, -1, 45, 46,
- -1, -1, -1, 50, 51, 7, 8, 9, 10, -1,
- -1, 38, 39, -1, -1, 17, 43, 19, 20, 21,
- 47, 48, -1, 25, 26, -1, 53, 54, -1, 31,
- 32, 33, 38, 39, -1, -1, -1, 43, 44, 45,
- 46, 47, 48, 45, 46, -1, 52, 53, 54, 51,
- 38, 39, -1, -1, -1, 43, -1, 45, 46, 47,
- 48, -1, 38, 39, 52, 53, 54, 43, 44, 45,
- 46, 47, 48, -1, 38, 39, -1, 53, 54, 43,
- -1, 45, 46, 47, 48, -1, 38, 39, -1, 53,
- 54, 43, -1, -1, -1, 47, 48, -1, -1, 51,
- -1, 53, 54
+ 0, 62, 13, 64, 89, 0, 0, 27, 13, 29,
+ 0, 16, 17, 18, 0, 35, 101, 35, 126, 15,
+ 16, 26, 36, 37, 35, 50, 44, 32, 33, 34,
+ 55, 11, 38, 39, 38, 39, 14, 43, 16, 43,
+ 148, 47, 48, 51, 152, 153, 51, 53, 54, 53,
+ 54, 10, 160, 10, 50, 50, 50, 62, 63, 64,
+ 145, 61, 67, 68, 69, 70, 71, 72, 73, 74,
+ 75, 61, 180, 52, 10, 61, 55, 7, 8, 9,
+ 10, 132, 10, 168, 135, 136, 44, 52, 93, 94,
+ 55, 11, 55, 144, 11, 180, 51, 102, 18, 11,
+ 151, 31, 27, 33, 33, 34, 167, 27, 113, 51,
+ 161, 162, 10, 34, 165, 45, 46, 55, 169, 10,
+ 27, 51, 11, 11, 11, 10, 52, 127, 52, 134,
+ 181, 50, 10, 0, 1, 35, 187, 55, 143, 190,
+ 7, 8, 9, 10, 10, 16, 50, 10, 32, 21,
+ 17, 15, 19, 20, 21, 14, 16, 24, 25, 26,
+ 16, 16, 167, 16, 31, 32, 33, 21, 50, 34,
+ 7, 8, 9, 10, 32, 175, 21, 50, 45, 46,
+ 32, 61, 165, 50, 51, -1, 186, 7, 8, 9,
+ 10, -1, -1, -1, 31, 45, 33, 17, -1, 19,
+ 20, 21, -1, 11, -1, 25, 26, -1, 45, 46,
+ 18, 31, 32, 33, 51, 23, -1, -1, -1, 27,
+ 28, 29, 30, -1, -1, 45, 46, 35, -1, -1,
+ 50, 51, 7, 8, 9, 10, -1, -1, -1, -1,
+ -1, -1, 17, 22, 19, 20, 21, -1, -1, -1,
+ 25, 26, -1, -1, -1, -1, 31, 32, 33, 38,
+ 39, -1, -1, -1, 43, -1, 45, 46, 47, 48,
+ 45, 46, 38, 39, 53, 54, 51, 43, 44, 45,
+ 46, 47, 48, -1, 38, 39, 52, 53, 54, 43,
+ -1, 45, 46, 47, 48, -1, 38, 39, 52, 53,
+ 54, 43, 44, 45, 46, 47, 48, -1, 38, 39,
+ -1, 53, 54, 43, -1, 45, 46, 47, 48, -1,
+ 38, 39, -1, 53, 54, 43, -1, -1, -1, 47,
+ 48, -1, -1, 51, -1, 53, 54
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -776,24 +776,24 @@ static const yytype_uint8 yystos[] =
{
0, 1, 7, 8, 9, 10, 17, 19, 20, 21,
24, 25, 26, 31, 32, 33, 45, 46, 51, 57,
- 58, 59, 60, 61, 62, 66, 67, 68, 73, 74,
- 76, 79, 83, 51, 51, 70, 10, 75, 11, 18,
- 23, 27, 28, 29, 30, 35, 77, 78, 10, 11,
- 10, 10, 31, 59, 73, 36, 37, 10, 73, 73,
- 73, 0, 50, 51, 44, 51, 65, 73, 38, 39,
- 43, 45, 46, 47, 48, 53, 54, 73, 84, 84,
- 84, 55, 11, 11, 27, 11, 18, 27, 35, 78,
- 80, 73, 22, 10, 35, 44, 52, 58, 65, 73,
- 65, 73, 34, 44, 73, 73, 73, 73, 73, 73,
- 73, 73, 73, 52, 55, 52, 10, 11, 11, 11,
- 70, 10, 73, 73, 52, 71, 52, 70, 72, 73,
- 73, 10, 81, 72, 13, 35, 60, 68, 74, 50,
- 60, 71, 50, 55, 71, 35, 73, 71, 65, 14,
- 16, 70, 55, 82, 10, 16, 73, 71, 50, 34,
- 72, 21, 15, 63, 64, 69, 10, 72, 32, 71,
- 72, 14, 71, 64, 71, 65, 72, 71, 70, 16,
- 16, 34, 71, 16, 60, 21, 21, 70, 72, 16,
- 32, 71, 60, 71, 32, 50, 71, 50
+ 58, 59, 60, 61, 65, 66, 67, 72, 73, 75,
+ 78, 82, 51, 51, 69, 10, 74, 11, 18, 23,
+ 27, 28, 29, 30, 35, 76, 77, 10, 11, 10,
+ 10, 31, 59, 72, 36, 37, 10, 72, 72, 72,
+ 0, 50, 51, 44, 51, 64, 72, 38, 39, 43,
+ 45, 46, 47, 48, 53, 54, 72, 83, 83, 83,
+ 55, 11, 11, 27, 11, 18, 27, 35, 77, 79,
+ 72, 22, 10, 35, 44, 52, 58, 64, 72, 64,
+ 72, 34, 44, 72, 72, 72, 72, 72, 72, 72,
+ 72, 72, 52, 55, 52, 10, 11, 11, 11, 69,
+ 10, 72, 72, 52, 70, 52, 50, 69, 72, 72,
+ 10, 80, 71, 13, 35, 71, 60, 73, 50, 55,
+ 50, 60, 70, 35, 72, 70, 70, 55, 81, 10,
+ 16, 72, 70, 14, 16, 69, 50, 10, 71, 32,
+ 70, 71, 71, 21, 15, 62, 63, 68, 14, 71,
+ 70, 70, 63, 70, 64, 69, 70, 16, 16, 16,
+ 34, 60, 16, 32, 21, 21, 69, 71, 70, 32,
+ 60, 70, 50, 70, 50
};
#define yyerrok (yyerrstatus = 0)
@@ -1612,13 +1612,13 @@ yyreduce:
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 11:
-#line 104 "engines/director/lingo/lingo-gr.y"
+ case 10:
+#line 103 "engines/director/lingo/lingo-gr.y"
{ yyerrok; ;}
break;
- case 12:
-#line 107 "engines/director/lingo/lingo-gr.y"
+ case 11:
+#line 106 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str());
@@ -1627,8 +1627,8 @@ yyreduce:
delete (yyvsp[(4) - (4)].s); ;}
break;
- case 13:
-#line 113 "engines/director/lingo/lingo-gr.y"
+ case 12:
+#line 112 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1637,8 +1637,8 @@ yyreduce:
delete (yyvsp[(2) - (4)].s); ;}
break;
- case 14:
-#line 119 "engines/director/lingo/lingo-gr.y"
+ case 13:
+#line 118 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1647,13 +1647,13 @@ yyreduce:
delete (yyvsp[(2) - (4)].s); ;}
break;
- case 15:
-#line 127 "engines/director/lingo/lingo-gr.y"
+ case 14:
+#line 126 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 18:
-#line 134 "engines/director/lingo/lingo-gr.y"
+ case 17:
+#line 133 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1662,8 +1662,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
- case 19:
-#line 145 "engines/director/lingo/lingo-gr.y"
+ case 18:
+#line 144 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1678,8 +1678,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
break;
- case 20:
-#line 161 "engines/director/lingo/lingo-gr.y"
+ case 19:
+#line 160 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1694,20 +1694,44 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
break;
- case 21:
-#line 175 "engines/director/lingo/lingo-gr.y"
+ case 20:
+#line 174 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
- WRITE_UINT32(&end, (yyvsp[(6) - (6)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 3] = end; /* end, if cond fails */
-
+ WRITE_UINT32(&then, (yyvsp[(5) - (8)].code));
+ WRITE_UINT32(&end, (yyvsp[(6) - (8)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); ;}
break;
+ case 21:
+#line 181 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
+ WRITE_UINT32(&end, (yyvsp[(6) - (6)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 3] = end; /* end, if cond fails */
+
+ g_lingo->processIf(0, 0); ;}
+ break;
+
case 22:
-#line 183 "engines/director/lingo/lingo-gr.y"
+#line 189 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
+ WRITE_UINT32(&else1, (yyvsp[(8) - (11)].code));
+ WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = end; /* end, if cond fails */
+ g_lingo->processIf(0, 0); ;}
+ break;
+
+ case 23:
+#line 198 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (12)].code));
@@ -1720,45 +1744,21 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 23:
-#line 195 "engines/director/lingo/lingo-gr.y"
- {
- inst then = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
- WRITE_UINT32(&end, (yyvsp[(5) - (7)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, 0); ;}
- break;
-
case 24:
-#line 202 "engines/director/lingo/lingo-gr.y"
- {
- inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
- WRITE_UINT32(&else1, (yyvsp[(7) - (10)].code));
- WRITE_UINT32(&end, (yyvsp[(8) - (10)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, 0); ;}
- break;
-
- case 25:
-#line 211 "engines/director/lingo/lingo-gr.y"
+#line 208 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
- WRITE_UINT32(&else1, (yyvsp[(6) - (10)].code));
- WRITE_UINT32(&end, (yyvsp[(8) - (10)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, (yyvsp[(8) - (10)].code)); ;}
+ WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
+ WRITE_UINT32(&else1, (yyvsp[(7) - (11)].code));
+ WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = end; /* end, if cond fails */
+ g_lingo->processIf(0, (yyvsp[(9) - (11)].code)); ;}
break;
- case 28:
-#line 226 "engines/director/lingo/lingo-gr.y"
+ case 27:
+#line 223 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
@@ -1767,8 +1767,8 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (7)].code)); ;}
break;
- case 29:
-#line 232 "engines/director/lingo/lingo-gr.y"
+ case 28:
+#line 229 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
@@ -1777,23 +1777,23 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (5)].code)); ;}
break;
- case 30:
-#line 240 "engines/director/lingo/lingo-gr.y"
+ case 29:
+#line 237 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 31:
-#line 241 "engines/director/lingo/lingo-gr.y"
+ case 30:
+#line 238 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 33:
-#line 244 "engines/director/lingo/lingo-gr.y"
+ case 32:
+#line 241 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 34:
-#line 246 "engines/director/lingo/lingo-gr.y"
+ case 33:
+#line 243 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1801,8 +1801,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 35:
-#line 252 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 249 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -1810,8 +1810,8 @@ yyreduce:
g_lingo->codeLabel(0); ;}
break;
- case 36:
-#line 258 "engines/director/lingo/lingo-gr.y"
+ case 35:
+#line 255 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -1820,23 +1820,23 @@ yyreduce:
g_lingo->code1(skipEnd); ;}
break;
- case 37:
-#line 265 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 262 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 38:
-#line 267 "engines/director/lingo/lingo-gr.y"
+ case 37:
+#line 264 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 39:
-#line 269 "engines/director/lingo/lingo-gr.y"
+ case 38:
+#line 266 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 42:
-#line 274 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 271 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1844,15 +1844,15 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 43:
-#line 279 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 276 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
- case 44:
-#line 282 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 279 "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));
@@ -1861,8 +1861,8 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 45:
-#line 288 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 285 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1873,121 +1873,121 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 46:
-#line 296 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 293 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 48:
-#line 300 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 297 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 49:
-#line 301 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 298 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 50:
-#line 302 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 299 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 51:
-#line 303 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 300 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 52:
-#line 304 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 301 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 53:
-#line 305 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 302 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 54:
-#line 306 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 303 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 55:
-#line 307 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 304 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 56:
-#line 308 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 305 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 57:
-#line 309 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 306 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 58:
-#line 310 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 307 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 59:
-#line 311 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 308 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 60:
-#line 314 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 311 "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 61:
-#line 315 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 312 "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 62:
-#line 316 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 313 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 64:
-#line 318 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 315 "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 66:
-#line 323 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 320 "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 67:
-#line 324 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 321 "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 68:
-#line 335 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 332 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 69:
-#line 336 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 333 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 70:
-#line 337 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 334 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 71:
-#line 338 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 335 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1995,8 +1995,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 72:
-#line 343 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 340 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2005,8 +2005,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 73:
-#line 349 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 346 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2014,48 +2014,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 74:
-#line 356 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 353 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 75:
-#line 357 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 354 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 76:
-#line 358 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 355 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 77:
-#line 359 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 356 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 78:
-#line 362 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 359 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 79:
-#line 363 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 360 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 80:
-#line 364 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 361 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 81:
-#line 392 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 389 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 82:
-#line 393 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 390 "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);
@@ -2063,33 +2063,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 83:
-#line 399 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 396 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 84:
-#line 400 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 397 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 85:
-#line 401 "engines/director/lingo/lingo-gr.y"
+ case 84:
+#line 398 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 86:
-#line 402 "engines/director/lingo/lingo-gr.y"
+ case 85:
+#line 399 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 87:
-#line 404 "engines/director/lingo/lingo-gr.y"
+ case 86:
+#line 401 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 88:
-#line 407 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 404 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2098,18 +2098,18 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 89:
-#line 415 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 412 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 90:
-#line 416 "engines/director/lingo/lingo-gr.y"
+ case 89:
+#line 413 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 91:
-#line 417 "engines/director/lingo/lingo-gr.y"
+ case 90:
+#line 414 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
@@ -2329,6 +2329,6 @@ yyreturn:
}
-#line 420 "engines/director/lingo/lingo-gr.y"
+#line 417 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index fd5245d..e7b4286 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -99,7 +99,6 @@ programline:
| func
| macro
| asgn { g_lingo->code1(g_lingo->c_xpop); }
- | stmtoneliner
| stmt
| error { yyerrok; }
;
@@ -172,13 +171,29 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
(*g_lingo->_currentScript)[$1 + 5] = end; } /* end, if cond fails */
;
-stmtoneliner: if cond tTHEN begin stmt end {
+ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF {
inst then = 0, end = 0;
- WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&then, $5);
WRITE_UINT32(&end, $6);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
-
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
+ g_lingo->processIf(0, 0); }
+ | if cond tTHEN begin stmt end {
+ inst then = 0, end = 0;
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&end, $6);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
+
+ g_lingo->processIf(0, 0); }
+ | if cond tTHEN '\n' stmtlist end tELSE stmtlist end tEND tIF {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, $5);
+ WRITE_UINT32(&else1, $8);
+ WRITE_UINT32(&end, $9);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
| if cond tTHEN begin stmt end '\n' tELSE begin stmt end '\n' {
inst then = 0, else1 = 0, end = 0;
@@ -190,33 +205,15 @@ stmtoneliner: if cond tTHEN begin stmt end {
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- ;
-
-ifstmt: if cond tTHEN stmtlist end tEND tIF {
- inst then = 0, end = 0;
- WRITE_UINT32(&then, $4);
- WRITE_UINT32(&end, $5);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, 0); }
- | if cond tTHEN stmtlist end tELSE stmtlist end tEND tIF {
+ | if cond tTHEN '\n' stmtlist end begin elseifstmt end tEND tIF {
inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&then, $5);
WRITE_UINT32(&else1, $7);
- WRITE_UINT32(&end, $8);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, 0); }
- | if cond tTHEN stmtlist end begin elseifstmt end tEND tIF {
- inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, $4);
- WRITE_UINT32(&else1, $6);
- WRITE_UINT32(&end, $8);
+ WRITE_UINT32(&end, $9);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, $8); }
+ g_lingo->processIf(0, $9); }
;
elseifstmt: elseifstmt elseifstmt1
Commit: e7a4f22b598ba0437bfbe7202198ad1fa9ed9f1c
https://github.com/scummvm/scummvm/commit/e7a4f22b598ba0437bfbe7202198ad1fa9ed9f1c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: More work on if statement overhaul
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index a39894e..8063cf8 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -109,8 +109,15 @@ Common::Error DirectorEngine::run() {
_currentScore = nullptr;
_lingo->addCode("--\n\
- --repeat with x = 1 to 5\n\
- set x = 4\n\
+ if x = 10 then put 10\n\
+-- elseif x = 11 then put 11\n\
+-- elseif x = 12 then put 12\n\
+", kMovieScript, 2);
+
+_lingo->executeScript(kMovieScript, 2);
+
+ _lingo->addCode("--\n\
+-- repeat with x = 1 to 5\n\
if x = 1 then\n\
put 1\n\
else if x = 2 then\n\
@@ -118,9 +125,12 @@ Common::Error DirectorEngine::run() {
put 2.2\n\
else if x = 3 then put 3\n\
end if\n\
- if x = 4 then put 4\n\
- else put 5\n\
- --end repeat\n\
+-- end repeat\n\
+ if x = 6 then put 6\n\
+ else put 0\n\
+-- if x = 10 then put 10\n\
+-- elseif x = 11 then put 11\n\
+-- elseif x = 12 then put 12\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 25b242a..8a0bfbe 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -430,7 +430,7 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 60
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 336
+#define YYLAST 305
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 56
@@ -439,7 +439,7 @@ union yyalloc
/* YYNRULES -- Number of rules. */
#define YYNRULES 90
/* YYNRULES -- Number of states. */
-#define YYNSTATES 195
+#define YYNSTATES 208
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -489,15 +489,15 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
- 20, 22, 27, 32, 37, 39, 41, 43, 52, 64,
- 77, 86, 93, 105, 118, 130, 133, 135, 143, 149,
- 151, 155, 159, 162, 166, 168, 170, 171, 172, 173,
- 176, 179, 181, 183, 188, 193, 195, 197, 201, 205,
- 209, 213, 217, 221, 225, 229, 233, 236, 239, 243,
- 246, 249, 252, 254, 256, 259, 261, 265, 268, 271,
- 274, 277, 281, 284, 288, 291, 294, 296, 300, 303,
- 307, 308, 317, 318, 320, 324, 329, 330, 334, 335,
- 337
+ 20, 22, 27, 32, 37, 39, 41, 43, 53, 66,
+ 80, 90, 98, 109, 124, 137, 150, 153, 155, 163,
+ 171, 173, 177, 181, 184, 188, 190, 192, 193, 194,
+ 198, 201, 203, 205, 210, 215, 217, 219, 223, 227,
+ 231, 235, 239, 243, 247, 251, 255, 258, 261, 265,
+ 268, 271, 274, 276, 278, 281, 283, 287, 290, 293,
+ 296, 299, 303, 306, 310, 313, 316, 318, 322, 325,
+ 329, 330, 339, 340, 342, 346, 351, 352, 356, 357,
+ 359
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -507,37 +507,39 @@ static const yytype_int8 yyrhs[] =
78, -1, 73, -1, 82, -1, 59, -1, 60, -1,
1, -1, 31, 72, 22, 10, -1, 33, 10, 44,
72, -1, 33, 10, 35, 72, -1, 72, -1, 73,
- -1, 61, -1, 65, 51, 64, 52, 71, 70, 16,
- 32, -1, 66, 44, 72, 70, 35, 72, 70, 71,
- 70, 16, 32, -1, 66, 44, 72, 70, 13, 35,
- 72, 70, 71, 70, 16, 32, -1, 67, 64, 34,
- 50, 71, 70, 16, 21, -1, 67, 64, 34, 69,
- 60, 70, -1, 67, 64, 34, 50, 71, 70, 14,
- 71, 70, 16, 21, -1, 67, 64, 34, 69, 60,
- 70, 50, 14, 69, 60, 70, 50, -1, 67, 64,
- 34, 50, 71, 70, 69, 62, 70, 16, 21, -1,
+ -1, 61, -1, 65, 51, 64, 52, 69, 71, 70,
+ 16, 32, -1, 66, 44, 72, 70, 35, 72, 70,
+ 69, 71, 70, 16, 32, -1, 66, 44, 72, 70,
+ 13, 35, 72, 70, 69, 71, 70, 16, 32, -1,
+ 67, 64, 34, 50, 69, 71, 70, 16, 21, -1,
+ 67, 64, 34, 69, 60, 70, 50, -1, 67, 64,
+ 34, 69, 60, 70, 50, 69, 62, 70, -1, 67,
+ 64, 34, 50, 69, 71, 70, 14, 50, 69, 71,
+ 70, 16, 21, -1, 67, 64, 34, 69, 60, 70,
+ 50, 14, 69, 60, 70, 50, -1, 67, 64, 34,
+ 50, 69, 71, 70, 69, 62, 70, 16, 21, -1,
62, 63, -1, 63, -1, 68, 64, 34, 69, 60,
- 70, 50, -1, 68, 64, 34, 71, 70, -1, 72,
- -1, 72, 44, 72, -1, 51, 64, 52, -1, 32,
- 37, -1, 32, 36, 10, -1, 21, -1, 15, -1,
- -1, -1, -1, 71, 50, -1, 71, 60, -1, 7,
- -1, 8, -1, 9, 51, 83, 52, -1, 10, 51,
- 83, 52, -1, 10, -1, 59, -1, 72, 45, 72,
- -1, 72, 46, 72, -1, 72, 47, 72, -1, 72,
- 48, 72, -1, 72, 53, 72, -1, 72, 54, 72,
- -1, 72, 43, 72, -1, 72, 38, 72, -1, 72,
- 39, 72, -1, 45, 72, -1, 46, 72, -1, 51,
- 72, 52, -1, 25, 11, -1, 26, 10, -1, 31,
- 72, -1, 75, -1, 17, -1, 19, 74, -1, 10,
- -1, 74, 55, 10, -1, 20, 23, -1, 20, 28,
- -1, 20, 30, -1, 20, 76, -1, 20, 76, 77,
- -1, 20, 77, -1, 35, 18, 11, -1, 18, 11,
- -1, 35, 11, -1, 11, -1, 29, 27, 11, -1,
- 27, 11, -1, 35, 27, 11, -1, -1, 24, 10,
- 79, 69, 80, 50, 81, 71, -1, -1, 10, -1,
- 80, 55, 10, -1, 80, 50, 55, 10, -1, -1,
- 10, 69, 83, -1, -1, 72, -1, 83, 55, 72,
- -1
+ 70, 50, -1, 68, 64, 34, 50, 69, 71, 70,
+ -1, 72, -1, 72, 44, 72, -1, 51, 64, 52,
+ -1, 32, 37, -1, 32, 36, 10, -1, 21, -1,
+ 15, -1, -1, -1, 71, 50, 60, -1, 60, 50,
+ -1, 7, -1, 8, -1, 9, 51, 83, 52, -1,
+ 10, 51, 83, 52, -1, 10, -1, 59, -1, 72,
+ 45, 72, -1, 72, 46, 72, -1, 72, 47, 72,
+ -1, 72, 48, 72, -1, 72, 53, 72, -1, 72,
+ 54, 72, -1, 72, 43, 72, -1, 72, 38, 72,
+ -1, 72, 39, 72, -1, 45, 72, -1, 46, 72,
+ -1, 51, 72, 52, -1, 25, 11, -1, 26, 10,
+ -1, 31, 72, -1, 75, -1, 17, -1, 19, 74,
+ -1, 10, -1, 74, 55, 10, -1, 20, 23, -1,
+ 20, 28, -1, 20, 30, -1, 20, 76, -1, 20,
+ 76, 77, -1, 20, 77, -1, 35, 18, 11, -1,
+ 18, 11, -1, 35, 11, -1, 11, -1, 29, 27,
+ 11, -1, 27, 11, -1, 35, 27, 11, -1, -1,
+ 24, 10, 79, 69, 80, 50, 81, 71, -1, -1,
+ 10, -1, 80, 55, 10, -1, 80, 50, 55, 10,
+ -1, -1, 10, 69, 83, -1, -1, 72, -1, 83,
+ 55, 72, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -545,14 +547,14 @@ static const yytype_uint16 yyrline[] =
{
0, 93, 93, 94, 97, 98, 99, 100, 101, 102,
103, 106, 112, 118, 126, 127, 128, 133, 144, 160,
- 174, 181, 189, 198, 208, 219, 220, 223, 229, 237,
- 238, 239, 241, 243, 249, 255, 262, 264, 266, 267,
- 268, 271, 276, 279, 285, 293, 296, 297, 298, 299,
- 300, 301, 302, 303, 304, 305, 306, 307, 308, 311,
- 312, 313, 314, 315, 317, 320, 321, 332, 333, 334,
- 335, 340, 346, 353, 354, 355, 356, 359, 360, 361,
- 389, 389, 396, 397, 398, 399, 401, 404, 412, 413,
- 414
+ 174, 181, 189, 197, 206, 216, 227, 228, 231, 237,
+ 245, 246, 247, 249, 251, 257, 263, 270, 272, 274,
+ 275, 278, 283, 286, 292, 300, 303, 304, 305, 306,
+ 307, 308, 309, 310, 311, 312, 313, 314, 315, 318,
+ 319, 320, 321, 322, 324, 327, 328, 339, 340, 341,
+ 342, 347, 353, 360, 361, 362, 363, 366, 367, 368,
+ 396, 396, 403, 404, 405, 406, 408, 411, 419, 420,
+ 421
};
#endif
@@ -594,8 +596,8 @@ static const yytype_uint8 yyr1[] =
{
0, 56, 57, 57, 58, 58, 58, 58, 58, 58,
58, 59, 59, 59, 60, 60, 60, 60, 60, 60,
- 61, 61, 61, 61, 61, 62, 62, 63, 63, 64,
- 64, 64, 65, 66, 67, 68, 69, 70, 71, 71,
+ 61, 61, 61, 61, 61, 61, 62, 62, 63, 63,
+ 64, 64, 64, 65, 66, 67, 68, 69, 70, 71,
71, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 72, 72, 73,
73, 73, 73, 73, 73, 74, 74, 75, 75, 75,
@@ -608,9 +610,9 @@ static const yytype_uint8 yyr1[] =
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 1, 4, 4, 4, 1, 1, 1, 8, 11, 12,
- 8, 6, 11, 12, 11, 2, 1, 7, 5, 1,
- 3, 3, 2, 3, 1, 1, 0, 0, 0, 2,
+ 1, 4, 4, 4, 1, 1, 1, 9, 12, 13,
+ 9, 7, 10, 14, 12, 12, 2, 1, 7, 7,
+ 1, 3, 3, 2, 3, 1, 1, 0, 0, 3,
2, 1, 1, 4, 4, 1, 1, 3, 3, 3,
3, 3, 3, 3, 3, 3, 2, 2, 3, 2,
2, 2, 1, 1, 2, 1, 3, 2, 2, 2,
@@ -624,69 +626,71 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 10, 41, 42, 0, 36, 63, 0, 0, 34,
+ 0, 10, 41, 42, 0, 37, 63, 0, 0, 35,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3, 46, 9, 16, 0, 0, 0, 14, 6, 62,
5, 7, 88, 88, 88, 65, 64, 76, 0, 67,
0, 68, 0, 69, 0, 70, 72, 80, 59, 60,
- 45, 0, 46, 61, 0, 32, 0, 56, 57, 0,
- 1, 0, 0, 0, 0, 0, 29, 0, 0, 0,
+ 45, 0, 46, 61, 0, 33, 0, 56, 57, 0,
+ 1, 0, 0, 0, 0, 0, 30, 0, 0, 0,
0, 0, 0, 0, 0, 0, 89, 0, 0, 87,
- 0, 74, 78, 0, 75, 0, 0, 0, 71, 36,
- 0, 0, 33, 0, 0, 58, 2, 0, 37, 0,
- 0, 36, 0, 54, 55, 53, 47, 48, 49, 50,
+ 0, 74, 78, 0, 75, 0, 0, 0, 71, 37,
+ 0, 0, 34, 0, 0, 58, 2, 0, 38, 0,
+ 0, 37, 0, 54, 55, 53, 47, 48, 49, 50,
51, 52, 43, 0, 44, 66, 77, 73, 79, 82,
- 11, 13, 12, 38, 0, 31, 38, 0, 30, 90,
- 83, 0, 37, 0, 0, 37, 37, 15, 86, 0,
- 39, 40, 0, 0, 37, 36, 21, 0, 38, 84,
- 0, 37, 38, 38, 0, 0, 0, 85, 81, 17,
- 38, 37, 37, 20, 35, 37, 26, 0, 36, 37,
- 0, 0, 25, 0, 0, 0, 0, 0, 0, 0,
- 36, 37, 0, 18, 22, 24, 0, 37, 0, 19,
- 37, 28, 23, 0, 27
+ 11, 13, 12, 37, 0, 32, 37, 0, 31, 90,
+ 83, 0, 0, 0, 0, 0, 38, 15, 86, 0,
+ 0, 38, 0, 38, 38, 0, 0, 0, 84, 40,
+ 0, 0, 38, 37, 37, 21, 85, 81, 39, 0,
+ 37, 0, 0, 0, 0, 37, 0, 17, 0, 38,
+ 37, 20, 36, 38, 27, 0, 0, 38, 38, 0,
+ 0, 26, 0, 0, 38, 22, 0, 0, 38, 0,
+ 37, 0, 0, 18, 0, 25, 37, 0, 24, 19,
+ 0, 0, 38, 23, 38, 0, 29, 28
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 19, 20, 52, 141, 23, 165, 166, 65, 24,
- 25, 26, 167, 34, 124, 132, 27, 137, 36, 29,
- 45, 46, 30, 89, 131, 148, 31, 77
+ -1, 19, 20, 52, 140, 23, 173, 174, 65, 24,
+ 25, 26, 175, 34, 124, 141, 27, 137, 36, 29,
+ 45, 46, 30, 89, 131, 147, 31, 77
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -109
+#define YYPACT_NINF -131
static const yytype_int16 yypact[] =
{
- 133, -109, -109, -109, -8, 282, -109, 41, 192, -109,
- 43, 20, 64, 70, -14, 72, 70, 70, 70, 5,
- -109, 6, -109, -109, 45, 42, 163, 270, -109, -109,
- -109, -109, 70, 70, 70, -109, 37, -109, 83, -109,
- 88, -109, 75, -109, 80, -20, -109, -109, -109, -109,
- 58, 70, -109, 221, 102, -109, -18, -4, -4, 246,
- -109, 133, 163, 70, 163, 79, 258, 70, 70, 70,
- 70, 70, 70, 70, 70, 70, 270, 21, 35, 62,
- 109, -109, -109, 111, -109, 112, 113, 93, -109, -109,
- 221, 115, -109, 70, 70, -109, -109, 74, 270, 76,
- 234, 81, 70, 270, 270, 270, -6, -6, -4, -4,
- 270, 270, -109, 70, -109, -109, -109, -109, -109, 122,
- -109, 270, 270, -109, -11, -109, -109, 225, 270, 270,
- -109, -25, 180, 100, 70, 180, -109, -109, 82, 134,
- -109, -109, 129, 70, 270, 22, 96, 137, -109, -109,
- 116, 270, -109, -109, 128, 136, 141, -109, 180, -109,
- -109, 180, 180, -109, -109, 136, -109, 163, -109, 180,
- 140, 144, -109, 145, 135, 225, 147, 142, 146, 155,
- 4, -109, 148, -109, -109, -109, 225, 180, 118, -109,
- -109, -109, -109, 127, -109
+ 148, -131, -131, -131, -44, 85, -131, 50, 205, -131,
+ 62, 72, 63, 144, 6, 75, 144, 144, 144, 2,
+ -131, 4, -131, -131, 27, 46, 176, 239, -131, -131,
+ -131, -131, 144, 144, 144, -131, 37, -131, 83, -131,
+ 84, -131, 76, -131, 69, 10, -131, -131, -131, -131,
+ 48, 144, -131, -13, 92, -131, -29, 67, 67, 215,
+ -131, 148, 176, 144, 176, 70, 227, 144, 144, 144,
+ 144, 144, 144, 144, 144, 144, 239, -32, -4, 52,
+ 102, -131, -131, 104, -131, 105, 107, 86, -131, -131,
+ -13, 109, -131, 144, 144, -131, -131, 73, 239, 79,
+ 203, 90, 144, 239, 239, 239, 251, 251, 67, 67,
+ 239, 239, -131, 144, -131, -131, -131, -131, -131, 112,
+ -131, 239, 239, -131, 1, -131, -131, 193, 239, 239,
+ -131, -31, 193, 108, 144, 193, -131, -131, 87, 134,
+ 96, 97, 144, 239, 97, 110, 152, 193, -131, -131,
+ 193, 147, 239, -131, 68, 150, -131, 97, -131, 139,
+ -131, 193, 116, 157, 167, -131, 167, -131, 193, 97,
+ -131, -131, -131, 167, -131, 176, 193, 167, 97, 171,
+ 193, -131, 172, 158, -131, -131, 175, 164, 97, 183,
+ 155, 156, 179, -131, 192, -131, -131, 193, -131, -131,
+ 194, 193, -131, -131, 97, 170, -131, -131
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -109, -109, 120, 10, 0, -109, -109, 17, -61, -109,
- -109, -109, -109, -85, -51, -108, -5, 14, -109, -109,
- -109, 150, -109, -109, -109, -109, -109, 71
+ -131, -131, 168, 16, 0, -131, 51, -124, -61, -131,
+ -131, -131, -131, -79, -43, -130, -5, 18, -131, -131,
+ -131, 185, -131, -131, -131, -131, -131, 22
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -696,78 +700,72 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -46
static const yytype_int16 yytable[] =
{
- 22, 97, 133, 99, 119, 60, -8, 40, 53, 42,
- 21, 57, 58, 59, 28, 87, 127, 93, 135, -38,
- -38, 66, 54, 55, 134, 138, 94, 76, 76, 76,
- 139, 48, 67, 68, 67, 68, 153, 69, 154, 69,
- 158, 72, 73, 32, 161, 162, 90, 74, 75, 74,
- 75, 35, 169, 47, -38, 61, -8, 66, 98, 100,
- 155, 22, 103, 104, 105, 106, 107, 108, 109, 110,
- 111, 21, 187, 112, 49, 28, 113, 2, 3, 4,
- 50, 142, 56, 175, 145, 146, 63, 114, 121, 122,
- 113, 84, 80, 152, 81, 186, 62, 128, 85, 82,
- 160, 51, 83, 15, 78, 79, 174, 86, 129, 33,
- 170, 171, 92, 101, 173, 16, 17, 113, 176, 115,
- 86, 18, 116, 117, 118, 120, 123, 136, 125, 144,
- 188, 126, 130, -4, 1, 143, 191, 147, 151, 193,
- 2, 3, 4, 5, 149, 150, 156, 157, 159, 163,
- 6, 164, 7, 8, 9, 168, 177, 10, 11, 12,
- 178, 179, 66, 182, 13, 14, 15, 184, 192, 180,
- 2, 3, 4, 50, 183, 181, 185, 194, 16, 17,
- 189, 96, 172, -4, 18, 0, 190, 2, 3, 4,
- 50, 0, 0, 0, 51, 88, 15, 6, 0, 7,
- 8, 9, 0, 37, 0, 11, 12, 0, 16, 17,
- 38, 13, 14, 15, 64, 39, 0, 0, 0, 40,
- 41, 42, 43, 0, 0, 16, 17, 44, 0, 0,
- 140, 18, 2, 3, 4, 50, 0, 0, 0, 0,
- 0, 0, 6, 91, 7, 8, 9, 0, 0, 0,
- 11, 12, 0, 0, 0, 0, 13, 14, 15, 67,
- 68, 0, 0, 0, 69, 0, 70, 71, 72, 73,
- 16, 17, 67, 68, 74, 75, 18, 69, 102, 70,
- 71, 72, 73, 0, 67, 68, 95, 74, 75, 69,
- 0, 70, 71, 72, 73, 0, 67, 68, 95, 74,
- 75, 69, 102, 70, 71, 72, 73, 0, 67, 68,
- 0, 74, 75, 69, 0, 70, 71, 72, 73, 0,
- -45, -45, 0, 74, 75, -45, 0, 0, 0, -45,
- -45, 0, 0, 33, 0, -45, -45
+ 22, 97, 60, 99, -8, 144, 93, 32, 53, 91,
+ 119, 57, 58, 59, 133, 94, 21, 157, 28, 138,
+ 112, 66, 127, 113, 139, 67, 68, 76, 76, 76,
+ 69, 169, 70, 71, 72, 73, 134, 40, 178, 42,
+ 74, 75, 54, 55, 132, 87, 90, 135, 114, 181,
+ 188, 113, 61, 181, -8, 78, 79, 66, 98, 100,
+ 35, 22, 103, 104, 105, 106, 107, 108, 109, 110,
+ 111, 204, 47, 49, 161, 164, 166, 21, 62, 28,
+ 84, 168, 162, 48, 163, 56, 176, 85, 121, 122,
+ 63, 180, 80, 145, 81, 82, 86, 128, 151, 33,
+ 153, 154, 92, 83, 101, 67, 68, 113, 129, 160,
+ 69, 197, 115, 86, 183, 116, 117, 201, 118, 120,
+ 74, 75, 130, -45, -45, 123, 179, 136, -45, 143,
+ 182, 125, -45, -45, 185, 186, 33, 152, -45, -45,
+ 126, 191, 146, 142, 148, 194, 149, 150, -4, 1,
+ 158, 2, 3, 4, 50, 2, 3, 4, 5, 205,
+ 155, 206, 156, 159, 165, 6, 170, 7, 8, 9,
+ 66, 167, 10, 11, 12, 51, 184, 15, 171, 13,
+ 14, 15, 172, 2, 3, 4, 50, 187, 189, 16,
+ 17, 192, 190, 16, 17, 18, 193, 202, -4, 18,
+ 2, 3, 4, 50, 195, 196, 198, 51, 200, 15,
+ 6, 199, 7, 8, 9, 203, 37, 177, 11, 12,
+ 207, 16, 17, 38, 13, 14, 15, 64, 39, 96,
+ 88, 0, 40, 41, 42, 43, 0, 0, 16, 17,
+ 44, 67, 68, 0, 18, 0, 69, 102, 70, 71,
+ 72, 73, 0, 67, 68, 95, 74, 75, 69, 0,
+ 70, 71, 72, 73, 0, 67, 68, 95, 74, 75,
+ 69, 102, 70, 71, 72, 73, 0, 67, 68, 0,
+ 74, 75, 69, 0, 70, 71, 72, 73, 0, 67,
+ 68, 0, 74, 75, 69, 0, 0, 0, 72, 73,
+ 0, 0, 0, 0, 74, 75
};
static const yytype_int16 yycheck[] =
{
- 0, 62, 13, 64, 89, 0, 0, 27, 13, 29,
- 0, 16, 17, 18, 0, 35, 101, 35, 126, 15,
- 16, 26, 36, 37, 35, 50, 44, 32, 33, 34,
- 55, 11, 38, 39, 38, 39, 14, 43, 16, 43,
- 148, 47, 48, 51, 152, 153, 51, 53, 54, 53,
- 54, 10, 160, 10, 50, 50, 50, 62, 63, 64,
- 145, 61, 67, 68, 69, 70, 71, 72, 73, 74,
- 75, 61, 180, 52, 10, 61, 55, 7, 8, 9,
- 10, 132, 10, 168, 135, 136, 44, 52, 93, 94,
- 55, 11, 55, 144, 11, 180, 51, 102, 18, 11,
- 151, 31, 27, 33, 33, 34, 167, 27, 113, 51,
- 161, 162, 10, 34, 165, 45, 46, 55, 169, 10,
- 27, 51, 11, 11, 11, 10, 52, 127, 52, 134,
- 181, 50, 10, 0, 1, 35, 187, 55, 143, 190,
- 7, 8, 9, 10, 10, 16, 50, 10, 32, 21,
- 17, 15, 19, 20, 21, 14, 16, 24, 25, 26,
- 16, 16, 167, 16, 31, 32, 33, 21, 50, 34,
- 7, 8, 9, 10, 32, 175, 21, 50, 45, 46,
- 32, 61, 165, 50, 51, -1, 186, 7, 8, 9,
- 10, -1, -1, -1, 31, 45, 33, 17, -1, 19,
- 20, 21, -1, 11, -1, 25, 26, -1, 45, 46,
- 18, 31, 32, 33, 51, 23, -1, -1, -1, 27,
- 28, 29, 30, -1, -1, 45, 46, 35, -1, -1,
- 50, 51, 7, 8, 9, 10, -1, -1, -1, -1,
- -1, -1, 17, 22, 19, 20, 21, -1, -1, -1,
- 25, 26, -1, -1, -1, -1, 31, 32, 33, 38,
- 39, -1, -1, -1, 43, -1, 45, 46, 47, 48,
- 45, 46, 38, 39, 53, 54, 51, 43, 44, 45,
- 46, 47, 48, -1, 38, 39, 52, 53, 54, 43,
- -1, 45, 46, 47, 48, -1, 38, 39, 52, 53,
- 54, 43, 44, 45, 46, 47, 48, -1, 38, 39,
- -1, 53, 54, 43, -1, 45, 46, 47, 48, -1,
- 38, 39, -1, 53, 54, 43, -1, -1, -1, 47,
- 48, -1, -1, 51, -1, 53, 54
+ 0, 62, 0, 64, 0, 135, 35, 51, 13, 22,
+ 89, 16, 17, 18, 13, 44, 0, 147, 0, 50,
+ 52, 26, 101, 55, 55, 38, 39, 32, 33, 34,
+ 43, 161, 45, 46, 47, 48, 35, 27, 168, 29,
+ 53, 54, 36, 37, 123, 35, 51, 126, 52, 173,
+ 180, 55, 50, 177, 50, 33, 34, 62, 63, 64,
+ 10, 61, 67, 68, 69, 70, 71, 72, 73, 74,
+ 75, 201, 10, 10, 153, 154, 155, 61, 51, 61,
+ 11, 160, 14, 11, 16, 10, 165, 18, 93, 94,
+ 44, 170, 55, 136, 11, 11, 27, 102, 141, 51,
+ 143, 144, 10, 27, 34, 38, 39, 55, 113, 152,
+ 43, 190, 10, 27, 175, 11, 11, 196, 11, 10,
+ 53, 54, 10, 38, 39, 52, 169, 127, 43, 134,
+ 173, 52, 47, 48, 177, 178, 51, 142, 53, 54,
+ 50, 184, 55, 35, 10, 188, 50, 50, 0, 1,
+ 150, 7, 8, 9, 10, 7, 8, 9, 10, 202,
+ 50, 204, 10, 16, 14, 17, 50, 19, 20, 21,
+ 175, 32, 24, 25, 26, 31, 176, 33, 21, 31,
+ 32, 33, 15, 7, 8, 9, 10, 16, 16, 45,
+ 46, 16, 34, 45, 46, 51, 32, 197, 50, 51,
+ 7, 8, 9, 10, 21, 50, 50, 31, 16, 33,
+ 17, 32, 19, 20, 21, 21, 11, 166, 25, 26,
+ 50, 45, 46, 18, 31, 32, 33, 51, 23, 61,
+ 45, -1, 27, 28, 29, 30, -1, -1, 45, 46,
+ 35, 38, 39, -1, 51, -1, 43, 44, 45, 46,
+ 47, 48, -1, 38, 39, 52, 53, 54, 43, -1,
+ 45, 46, 47, 48, -1, 38, 39, 52, 53, 54,
+ 43, 44, 45, 46, 47, 48, -1, 38, 39, -1,
+ 53, 54, 43, -1, 45, 46, 47, 48, -1, 38,
+ 39, -1, 53, 54, 43, -1, -1, -1, 47, 48,
+ -1, -1, -1, -1, 53, 54
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -787,13 +785,14 @@ static const yytype_uint8 yystos[] =
72, 34, 44, 72, 72, 72, 72, 72, 72, 72,
72, 72, 52, 55, 52, 10, 11, 11, 11, 69,
10, 72, 72, 52, 70, 52, 50, 69, 72, 72,
- 10, 80, 71, 13, 35, 71, 60, 73, 50, 55,
- 50, 60, 70, 35, 72, 70, 70, 55, 81, 10,
- 16, 72, 70, 14, 16, 69, 50, 10, 71, 32,
- 70, 71, 71, 21, 15, 62, 63, 68, 14, 71,
- 70, 70, 63, 70, 64, 69, 70, 16, 16, 16,
- 34, 60, 16, 32, 21, 21, 69, 71, 70, 32,
- 60, 70, 50, 70, 50
+ 10, 80, 69, 13, 35, 69, 60, 73, 50, 55,
+ 60, 71, 35, 72, 71, 70, 55, 81, 10, 50,
+ 50, 70, 72, 70, 70, 50, 10, 71, 60, 16,
+ 70, 69, 14, 16, 69, 14, 69, 32, 69, 71,
+ 50, 21, 15, 62, 63, 68, 69, 62, 71, 70,
+ 69, 63, 70, 64, 60, 70, 70, 16, 71, 16,
+ 34, 70, 16, 32, 70, 21, 50, 69, 50, 32,
+ 16, 69, 60, 21, 71, 70, 70, 50
};
#define yyerrok (yyerrstatus = 0)
@@ -1656,52 +1655,52 @@ yyreduce:
#line 133 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
- WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
- WRITE_UINT32(&end, (yyvsp[(6) - (8)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = body; /* body of loop */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
+ WRITE_UINT32(&body, (yyvsp[(5) - (9)].code));
+ WRITE_UINT32(&end, (yyvsp[(7) - (9)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 1] = body; /* body of loop */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 2] = end; ;}
break;
case 18:
#line 144 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
- WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
- WRITE_UINT32(&finish, (yyvsp[(6) - (11)].code));
- WRITE_UINT32(&body, (yyvsp[(8) - (11)].code));
- WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
+ WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
+ WRITE_UINT32(&finish, (yyvsp[(6) - (12)].code));
+ WRITE_UINT32(&body, (yyvsp[(8) - (12)].code));
+ WRITE_UINT32(&end, (yyvsp[(10) - (12)].code));
WRITE_UINT32(&inc, 1);
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = init; /* initial count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = finish;/* final count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = body; /* body of loop */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 4] = inc; /* increment */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = init; /* initial count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = finish;/* final count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = body; /* body of loop */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 4] = inc; /* increment */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
break;
case 19:
#line 160 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
- WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
- WRITE_UINT32(&finish, (yyvsp[(7) - (12)].code));
- WRITE_UINT32(&body, (yyvsp[(9) - (12)].code));
- WRITE_UINT32(&end, (yyvsp[(10) - (12)].code));
+ WRITE_UINT32(&init, (yyvsp[(3) - (13)].code));
+ WRITE_UINT32(&finish, (yyvsp[(7) - (13)].code));
+ WRITE_UINT32(&body, (yyvsp[(9) - (13)].code));
+ WRITE_UINT32(&end, (yyvsp[(11) - (13)].code));
WRITE_UINT32(&inc, -1);
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = init; /* initial count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = finish;/* final count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = body; /* body of loop */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 4] = inc; /* increment */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (13)].code) + 1] = init; /* initial count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (13)].code) + 2] = finish;/* final count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (13)].code) + 3] = body; /* body of loop */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (13)].code) + 4] = inc; /* increment */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (13)].code) + 5] = end; ;}
break;
case 20:
#line 174 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(5) - (8)].code));
- WRITE_UINT32(&end, (yyvsp[(6) - (8)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 3] = end; /* end, if cond fails */
+ WRITE_UINT32(&then, (yyvsp[(5) - (9)].code));
+ WRITE_UINT32(&end, (yyvsp[(7) - (9)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); ;}
break;
@@ -1709,10 +1708,10 @@ yyreduce:
#line 181 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
- WRITE_UINT32(&end, (yyvsp[(6) - (6)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 3] = end; /* end, if cond fails */
+ WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
+ WRITE_UINT32(&end, (yyvsp[(6) - (7)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); ;}
break;
@@ -1720,18 +1719,30 @@ yyreduce:
case 22:
#line 189 "engines/director/lingo/lingo-gr.y"
{
+ inst then = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
+ WRITE_UINT32(&end, (yyvsp[(10) - (10)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; /* end, if cond fails */
+
+ g_lingo->processIf(0, (yyvsp[(8) - (10)].code)); ;}
+ break;
+
+ case 23:
+#line 197 "engines/director/lingo/lingo-gr.y"
+ {
inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
- WRITE_UINT32(&else1, (yyvsp[(8) - (11)].code));
- WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = end; /* end, if cond fails */
+ WRITE_UINT32(&then, (yyvsp[(5) - (14)].code));
+ WRITE_UINT32(&else1, (yyvsp[(10) - (14)].code));
+ WRITE_UINT32(&end, (yyvsp[(12) - (14)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (14)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (14)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (14)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); ;}
break;
- case 23:
-#line 198 "engines/director/lingo/lingo-gr.y"
+ case 24:
+#line 206 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (12)].code));
@@ -1744,21 +1755,21 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 24:
-#line 208 "engines/director/lingo/lingo-gr.y"
+ case 25:
+#line 216 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
- WRITE_UINT32(&else1, (yyvsp[(7) - (11)].code));
- WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, (yyvsp[(9) - (11)].code)); ;}
+ WRITE_UINT32(&then, (yyvsp[(5) - (12)].code));
+ WRITE_UINT32(&else1, (yyvsp[(8) - (12)].code));
+ WRITE_UINT32(&end, (yyvsp[(10) - (12)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; /* end, if cond fails */
+ g_lingo->processIf(0, (yyvsp[(10) - (12)].code)); ;}
break;
- case 27:
-#line 223 "engines/director/lingo/lingo-gr.y"
+ case 28:
+#line 231 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
@@ -1767,33 +1778,33 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (7)].code)); ;}
break;
- case 28:
-#line 229 "engines/director/lingo/lingo-gr.y"
+ case 29:
+#line 237 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (5)].code) + 1] = then; /* thenpart */
+ WRITE_UINT32(&then, (yyvsp[(5) - (7)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
- g_lingo->codeLabel((yyvsp[(1) - (5)].code)); ;}
+ g_lingo->codeLabel((yyvsp[(1) - (7)].code)); ;}
break;
- case 29:
-#line 237 "engines/director/lingo/lingo-gr.y"
+ case 30:
+#line 245 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 30:
-#line 238 "engines/director/lingo/lingo-gr.y"
+ case 31:
+#line 246 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 32:
-#line 241 "engines/director/lingo/lingo-gr.y"
+ case 33:
+#line 249 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 33:
-#line 243 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 251 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1801,8 +1812,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 34:
-#line 249 "engines/director/lingo/lingo-gr.y"
+ case 35:
+#line 257 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -1810,8 +1821,8 @@ yyreduce:
g_lingo->codeLabel(0); ;}
break;
- case 35:
-#line 255 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 263 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -1820,23 +1831,18 @@ yyreduce:
g_lingo->code1(skipEnd); ;}
break;
- case 36:
-#line 262 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->_currentScript->size(); ;}
- break;
-
case 37:
-#line 264 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
+#line 270 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 38:
-#line 266 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->_currentScript->size(); ;}
+#line 272 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 41:
-#line 271 "engines/director/lingo/lingo-gr.y"
+#line 278 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1845,14 +1851,14 @@ yyreduce:
break;
case 42:
-#line 276 "engines/director/lingo/lingo-gr.y"
+#line 283 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
case 43:
-#line 279 "engines/director/lingo/lingo-gr.y"
+#line 286 "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));
@@ -1862,7 +1868,7 @@ yyreduce:
break;
case 44:
-#line 285 "engines/director/lingo/lingo-gr.y"
+#line 292 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1874,120 +1880,120 @@ yyreduce:
break;
case 45:
-#line 293 "engines/director/lingo/lingo-gr.y"
+#line 300 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
case 47:
-#line 297 "engines/director/lingo/lingo-gr.y"
+#line 304 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
case 48:
-#line 298 "engines/director/lingo/lingo-gr.y"
+#line 305 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
case 49:
-#line 299 "engines/director/lingo/lingo-gr.y"
+#line 306 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
case 50:
-#line 300 "engines/director/lingo/lingo-gr.y"
+#line 307 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
case 51:
-#line 301 "engines/director/lingo/lingo-gr.y"
+#line 308 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
case 52:
-#line 302 "engines/director/lingo/lingo-gr.y"
+#line 309 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
case 53:
-#line 303 "engines/director/lingo/lingo-gr.y"
+#line 310 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
case 54:
-#line 304 "engines/director/lingo/lingo-gr.y"
+#line 311 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
case 55:
-#line 305 "engines/director/lingo/lingo-gr.y"
+#line 312 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
case 56:
-#line 306 "engines/director/lingo/lingo-gr.y"
+#line 313 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 57:
-#line 307 "engines/director/lingo/lingo-gr.y"
+#line 314 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 58:
-#line 308 "engines/director/lingo/lingo-gr.y"
+#line 315 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 59:
-#line 311 "engines/director/lingo/lingo-gr.y"
+#line 318 "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 60:
-#line 312 "engines/director/lingo/lingo-gr.y"
+#line 319 "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 61:
-#line 313 "engines/director/lingo/lingo-gr.y"
+#line 320 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 63:
-#line 315 "engines/director/lingo/lingo-gr.y"
+#line 322 "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 65:
-#line 320 "engines/director/lingo/lingo-gr.y"
+#line 327 "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 66:
-#line 321 "engines/director/lingo/lingo-gr.y"
+#line 328 "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 67:
-#line 332 "engines/director/lingo/lingo-gr.y"
+#line 339 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 68:
-#line 333 "engines/director/lingo/lingo-gr.y"
+#line 340 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 69:
-#line 334 "engines/director/lingo/lingo-gr.y"
+#line 341 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 70:
-#line 335 "engines/director/lingo/lingo-gr.y"
+#line 342 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1996,7 +2002,7 @@ yyreduce:
break;
case 71:
-#line 340 "engines/director/lingo/lingo-gr.y"
+#line 347 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2006,7 +2012,7 @@ yyreduce:
break;
case 72:
-#line 346 "engines/director/lingo/lingo-gr.y"
+#line 353 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2015,47 +2021,47 @@ yyreduce:
break;
case 73:
-#line 353 "engines/director/lingo/lingo-gr.y"
+#line 360 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 74:
-#line 354 "engines/director/lingo/lingo-gr.y"
+#line 361 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 75:
-#line 355 "engines/director/lingo/lingo-gr.y"
+#line 362 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 76:
-#line 356 "engines/director/lingo/lingo-gr.y"
+#line 363 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 77:
-#line 359 "engines/director/lingo/lingo-gr.y"
+#line 366 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 78:
-#line 360 "engines/director/lingo/lingo-gr.y"
+#line 367 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 79:
-#line 361 "engines/director/lingo/lingo-gr.y"
+#line 368 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 80:
-#line 389 "engines/director/lingo/lingo-gr.y"
+#line 396 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 81:
-#line 390 "engines/director/lingo/lingo-gr.y"
+#line 397 "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);
@@ -2064,32 +2070,32 @@ yyreduce:
break;
case 82:
-#line 396 "engines/director/lingo/lingo-gr.y"
+#line 403 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 83:
-#line 397 "engines/director/lingo/lingo-gr.y"
+#line 404 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 84:
-#line 398 "engines/director/lingo/lingo-gr.y"
+#line 405 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 85:
-#line 399 "engines/director/lingo/lingo-gr.y"
+#line 406 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 86:
-#line 401 "engines/director/lingo/lingo-gr.y"
+#line 408 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
case 87:
-#line 404 "engines/director/lingo/lingo-gr.y"
+#line 411 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2099,23 +2105,23 @@ yyreduce:
break;
case 88:
-#line 412 "engines/director/lingo/lingo-gr.y"
+#line 419 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 89:
-#line 413 "engines/director/lingo/lingo-gr.y"
+#line 420 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
case 90:
-#line 414 "engines/director/lingo/lingo-gr.y"
+#line 421 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2119 "engines/director/lingo/lingo-gr.cpp"
+#line 2125 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2329,6 +2335,6 @@ yyreturn:
}
-#line 417 "engines/director/lingo/lingo-gr.y"
+#line 424 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index e7b4286..0ca6018 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -79,7 +79,7 @@ using namespace Director;
%token tWITH tWHILE
%token tGE tLE tGT tLT tEQ tNEQ
-%type<code> asgn begin elseif end expr if repeatwhile repeatwith stmtlist
+%type<code> asgn begin elseif end expr if repeatwhile repeatwith
%type<s> gotoframe gotomovie
%type<narg> argdef arglist
@@ -130,10 +130,10 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
// statements
// end repeat
//
- | repeatwhile '(' cond ')' stmtlist end tEND tREPEAT {
+ | repeatwhile '(' cond ')' begin stmtlist end tEND tREPEAT {
inst body = 0, end = 0;
WRITE_UINT32(&body, $5);
- WRITE_UINT32(&end, $6);
+ WRITE_UINT32(&end, $7);
(*g_lingo->_currentScript)[$1 + 1] = body; /* body of loop */
(*g_lingo->_currentScript)[$1 + 2] = end; } /* end, if cond fails */
;
@@ -141,12 +141,12 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
// statements
// end repeat
//
- | repeatwith '=' expr end tTO expr end stmtlist end tEND tREPEAT {
+ | repeatwith '=' expr end tTO expr end begin stmtlist end tEND tREPEAT {
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, $3);
WRITE_UINT32(&finish, $6);
WRITE_UINT32(&body, $8);
- WRITE_UINT32(&end, $9);
+ WRITE_UINT32(&end, $10);
WRITE_UINT32(&inc, 1);
(*g_lingo->_currentScript)[$1 + 1] = init; /* initial count value */
(*g_lingo->_currentScript)[$1 + 2] = finish;/* final count value */
@@ -157,12 +157,12 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
// statements
// end repeat
//
- | repeatwith '=' expr end tDOWN tTO expr end stmtlist end tEND tREPEAT {
+ | repeatwith '=' expr end tDOWN tTO expr end begin stmtlist end tEND tREPEAT {
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, $3);
WRITE_UINT32(&finish, $7);
WRITE_UINT32(&body, $9);
- WRITE_UINT32(&end, $10);
+ WRITE_UINT32(&end, $11);
WRITE_UINT32(&inc, -1);
(*g_lingo->_currentScript)[$1 + 1] = init; /* initial count value */
(*g_lingo->_currentScript)[$1 + 2] = finish;/* final count value */
@@ -171,14 +171,14 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
(*g_lingo->_currentScript)[$1 + 5] = end; } /* end, if cond fails */
;
-ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF {
+ifstmt: if cond tTHEN '\n' begin stmtlist end tEND tIF {
inst then = 0, end = 0;
WRITE_UINT32(&then, $5);
- WRITE_UINT32(&end, $6);
+ WRITE_UINT32(&end, $7);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN begin stmt end {
+ | if cond tTHEN begin stmt end '\n' {
inst then = 0, end = 0;
WRITE_UINT32(&then, $4);
WRITE_UINT32(&end, $6);
@@ -186,16 +186,24 @@ ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN '\n' stmtlist end tELSE stmtlist end tEND tIF {
+ | if cond tTHEN begin stmt end '\n' begin elseifstmt end {
+ inst then = 0, end = 0;
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&end, $10);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
+
+ g_lingo->processIf(0, $8); }
+ | if cond tTHEN '\n' begin stmtlist end tELSE '\n' begin stmtlist end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
- WRITE_UINT32(&else1, $8);
- WRITE_UINT32(&end, $9);
+ WRITE_UINT32(&else1, $10);
+ WRITE_UINT32(&end, $12);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN begin stmt end '\n' tELSE begin stmt end '\n' {
+ | if cond tTHEN begin stmt end '\n' tELSE begin stmt end '\n' {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $4);
WRITE_UINT32(&else1, $9);
@@ -205,15 +213,15 @@ ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN '\n' stmtlist end begin elseifstmt end tEND tIF {
+ | if cond tTHEN '\n' begin stmtlist end begin elseifstmt end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
- WRITE_UINT32(&else1, $7);
- WRITE_UINT32(&end, $9);
+ WRITE_UINT32(&else1, $8);
+ WRITE_UINT32(&end, $10);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, $9); }
+ g_lingo->processIf(0, $10); }
;
elseifstmt: elseifstmt elseifstmt1
@@ -226,9 +234,9 @@ elseifstmt1: elseif cond tTHEN begin stmt end '\n' {
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
g_lingo->codeLabel($1); }
- | elseif cond tTHEN stmtlist end {
+ | elseif cond tTHEN '\n' begin stmtlist end {
inst then = 0;
- WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&then, $5);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
g_lingo->codeLabel($1); }
@@ -263,9 +271,8 @@ begin: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
;
end: /* nothing */ { g_lingo->code1(STOP); $$ = g_lingo->_currentScript->size(); }
;
-stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
- | stmtlist '\n'
- | stmtlist stmt
+stmtlist: stmtlist '\n' stmt
+ | stmt '\n'
;
expr: INT {
Commit: 7710390ab4e2d46bff7e0c7a43e30d6ca6378ca9
https://github.com/scummvm/scummvm/commit/7710390ab4e2d46bff7e0c7a43e30d6ca6378ca9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
Revert "DIRECTOR: Lingo: More work on if statement overhaul"
This reverts commit 0f5a094d7fd30121994d8f2d486b171791cf5968.
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 8063cf8..a39894e 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -109,15 +109,8 @@ Common::Error DirectorEngine::run() {
_currentScore = nullptr;
_lingo->addCode("--\n\
- if x = 10 then put 10\n\
--- elseif x = 11 then put 11\n\
--- elseif x = 12 then put 12\n\
-", kMovieScript, 2);
-
-_lingo->executeScript(kMovieScript, 2);
-
- _lingo->addCode("--\n\
--- repeat with x = 1 to 5\n\
+ --repeat with x = 1 to 5\n\
+ set x = 4\n\
if x = 1 then\n\
put 1\n\
else if x = 2 then\n\
@@ -125,12 +118,9 @@ _lingo->executeScript(kMovieScript, 2);
put 2.2\n\
else if x = 3 then put 3\n\
end if\n\
--- end repeat\n\
- if x = 6 then put 6\n\
- else put 0\n\
--- if x = 10 then put 10\n\
--- elseif x = 11 then put 11\n\
--- elseif x = 12 then put 12\n\
+ if x = 4 then put 4\n\
+ else put 5\n\
+ --end repeat\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 8a0bfbe..25b242a 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -430,7 +430,7 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 60
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 305
+#define YYLAST 336
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 56
@@ -439,7 +439,7 @@ union yyalloc
/* YYNRULES -- Number of rules. */
#define YYNRULES 90
/* YYNRULES -- Number of states. */
-#define YYNSTATES 208
+#define YYNSTATES 195
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -489,15 +489,15 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
- 20, 22, 27, 32, 37, 39, 41, 43, 53, 66,
- 80, 90, 98, 109, 124, 137, 150, 153, 155, 163,
- 171, 173, 177, 181, 184, 188, 190, 192, 193, 194,
- 198, 201, 203, 205, 210, 215, 217, 219, 223, 227,
- 231, 235, 239, 243, 247, 251, 255, 258, 261, 265,
- 268, 271, 274, 276, 278, 281, 283, 287, 290, 293,
- 296, 299, 303, 306, 310, 313, 316, 318, 322, 325,
- 329, 330, 339, 340, 342, 346, 351, 352, 356, 357,
- 359
+ 20, 22, 27, 32, 37, 39, 41, 43, 52, 64,
+ 77, 86, 93, 105, 118, 130, 133, 135, 143, 149,
+ 151, 155, 159, 162, 166, 168, 170, 171, 172, 173,
+ 176, 179, 181, 183, 188, 193, 195, 197, 201, 205,
+ 209, 213, 217, 221, 225, 229, 233, 236, 239, 243,
+ 246, 249, 252, 254, 256, 259, 261, 265, 268, 271,
+ 274, 277, 281, 284, 288, 291, 294, 296, 300, 303,
+ 307, 308, 317, 318, 320, 324, 329, 330, 334, 335,
+ 337
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -507,39 +507,37 @@ static const yytype_int8 yyrhs[] =
78, -1, 73, -1, 82, -1, 59, -1, 60, -1,
1, -1, 31, 72, 22, 10, -1, 33, 10, 44,
72, -1, 33, 10, 35, 72, -1, 72, -1, 73,
- -1, 61, -1, 65, 51, 64, 52, 69, 71, 70,
- 16, 32, -1, 66, 44, 72, 70, 35, 72, 70,
- 69, 71, 70, 16, 32, -1, 66, 44, 72, 70,
- 13, 35, 72, 70, 69, 71, 70, 16, 32, -1,
- 67, 64, 34, 50, 69, 71, 70, 16, 21, -1,
- 67, 64, 34, 69, 60, 70, 50, -1, 67, 64,
- 34, 69, 60, 70, 50, 69, 62, 70, -1, 67,
- 64, 34, 50, 69, 71, 70, 14, 50, 69, 71,
- 70, 16, 21, -1, 67, 64, 34, 69, 60, 70,
- 50, 14, 69, 60, 70, 50, -1, 67, 64, 34,
- 50, 69, 71, 70, 69, 62, 70, 16, 21, -1,
+ -1, 61, -1, 65, 51, 64, 52, 71, 70, 16,
+ 32, -1, 66, 44, 72, 70, 35, 72, 70, 71,
+ 70, 16, 32, -1, 66, 44, 72, 70, 13, 35,
+ 72, 70, 71, 70, 16, 32, -1, 67, 64, 34,
+ 50, 71, 70, 16, 21, -1, 67, 64, 34, 69,
+ 60, 70, -1, 67, 64, 34, 50, 71, 70, 14,
+ 71, 70, 16, 21, -1, 67, 64, 34, 69, 60,
+ 70, 50, 14, 69, 60, 70, 50, -1, 67, 64,
+ 34, 50, 71, 70, 69, 62, 70, 16, 21, -1,
62, 63, -1, 63, -1, 68, 64, 34, 69, 60,
- 70, 50, -1, 68, 64, 34, 50, 69, 71, 70,
- -1, 72, -1, 72, 44, 72, -1, 51, 64, 52,
- -1, 32, 37, -1, 32, 36, 10, -1, 21, -1,
- 15, -1, -1, -1, 71, 50, 60, -1, 60, 50,
- -1, 7, -1, 8, -1, 9, 51, 83, 52, -1,
- 10, 51, 83, 52, -1, 10, -1, 59, -1, 72,
- 45, 72, -1, 72, 46, 72, -1, 72, 47, 72,
- -1, 72, 48, 72, -1, 72, 53, 72, -1, 72,
- 54, 72, -1, 72, 43, 72, -1, 72, 38, 72,
- -1, 72, 39, 72, -1, 45, 72, -1, 46, 72,
- -1, 51, 72, 52, -1, 25, 11, -1, 26, 10,
- -1, 31, 72, -1, 75, -1, 17, -1, 19, 74,
- -1, 10, -1, 74, 55, 10, -1, 20, 23, -1,
- 20, 28, -1, 20, 30, -1, 20, 76, -1, 20,
- 76, 77, -1, 20, 77, -1, 35, 18, 11, -1,
- 18, 11, -1, 35, 11, -1, 11, -1, 29, 27,
- 11, -1, 27, 11, -1, 35, 27, 11, -1, -1,
- 24, 10, 79, 69, 80, 50, 81, 71, -1, -1,
- 10, -1, 80, 55, 10, -1, 80, 50, 55, 10,
- -1, -1, 10, 69, 83, -1, -1, 72, -1, 83,
- 55, 72, -1
+ 70, 50, -1, 68, 64, 34, 71, 70, -1, 72,
+ -1, 72, 44, 72, -1, 51, 64, 52, -1, 32,
+ 37, -1, 32, 36, 10, -1, 21, -1, 15, -1,
+ -1, -1, -1, 71, 50, -1, 71, 60, -1, 7,
+ -1, 8, -1, 9, 51, 83, 52, -1, 10, 51,
+ 83, 52, -1, 10, -1, 59, -1, 72, 45, 72,
+ -1, 72, 46, 72, -1, 72, 47, 72, -1, 72,
+ 48, 72, -1, 72, 53, 72, -1, 72, 54, 72,
+ -1, 72, 43, 72, -1, 72, 38, 72, -1, 72,
+ 39, 72, -1, 45, 72, -1, 46, 72, -1, 51,
+ 72, 52, -1, 25, 11, -1, 26, 10, -1, 31,
+ 72, -1, 75, -1, 17, -1, 19, 74, -1, 10,
+ -1, 74, 55, 10, -1, 20, 23, -1, 20, 28,
+ -1, 20, 30, -1, 20, 76, -1, 20, 76, 77,
+ -1, 20, 77, -1, 35, 18, 11, -1, 18, 11,
+ -1, 35, 11, -1, 11, -1, 29, 27, 11, -1,
+ 27, 11, -1, 35, 27, 11, -1, -1, 24, 10,
+ 79, 69, 80, 50, 81, 71, -1, -1, 10, -1,
+ 80, 55, 10, -1, 80, 50, 55, 10, -1, -1,
+ 10, 69, 83, -1, -1, 72, -1, 83, 55, 72,
+ -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -547,14 +545,14 @@ static const yytype_uint16 yyrline[] =
{
0, 93, 93, 94, 97, 98, 99, 100, 101, 102,
103, 106, 112, 118, 126, 127, 128, 133, 144, 160,
- 174, 181, 189, 197, 206, 216, 227, 228, 231, 237,
- 245, 246, 247, 249, 251, 257, 263, 270, 272, 274,
- 275, 278, 283, 286, 292, 300, 303, 304, 305, 306,
- 307, 308, 309, 310, 311, 312, 313, 314, 315, 318,
- 319, 320, 321, 322, 324, 327, 328, 339, 340, 341,
- 342, 347, 353, 360, 361, 362, 363, 366, 367, 368,
- 396, 396, 403, 404, 405, 406, 408, 411, 419, 420,
- 421
+ 174, 181, 189, 198, 208, 219, 220, 223, 229, 237,
+ 238, 239, 241, 243, 249, 255, 262, 264, 266, 267,
+ 268, 271, 276, 279, 285, 293, 296, 297, 298, 299,
+ 300, 301, 302, 303, 304, 305, 306, 307, 308, 311,
+ 312, 313, 314, 315, 317, 320, 321, 332, 333, 334,
+ 335, 340, 346, 353, 354, 355, 356, 359, 360, 361,
+ 389, 389, 396, 397, 398, 399, 401, 404, 412, 413,
+ 414
};
#endif
@@ -596,8 +594,8 @@ static const yytype_uint8 yyr1[] =
{
0, 56, 57, 57, 58, 58, 58, 58, 58, 58,
58, 59, 59, 59, 60, 60, 60, 60, 60, 60,
- 61, 61, 61, 61, 61, 61, 62, 62, 63, 63,
- 64, 64, 64, 65, 66, 67, 68, 69, 70, 71,
+ 61, 61, 61, 61, 61, 62, 62, 63, 63, 64,
+ 64, 64, 65, 66, 67, 68, 69, 70, 71, 71,
71, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 72, 72, 73,
73, 73, 73, 73, 73, 74, 74, 75, 75, 75,
@@ -610,9 +608,9 @@ static const yytype_uint8 yyr1[] =
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 1, 4, 4, 4, 1, 1, 1, 9, 12, 13,
- 9, 7, 10, 14, 12, 12, 2, 1, 7, 7,
- 1, 3, 3, 2, 3, 1, 1, 0, 0, 3,
+ 1, 4, 4, 4, 1, 1, 1, 8, 11, 12,
+ 8, 6, 11, 12, 11, 2, 1, 7, 5, 1,
+ 3, 3, 2, 3, 1, 1, 0, 0, 0, 2,
2, 1, 1, 4, 4, 1, 1, 3, 3, 3,
3, 3, 3, 3, 3, 3, 2, 2, 3, 2,
2, 2, 1, 1, 2, 1, 3, 2, 2, 2,
@@ -626,71 +624,69 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 10, 41, 42, 0, 37, 63, 0, 0, 35,
+ 0, 10, 41, 42, 0, 36, 63, 0, 0, 34,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3, 46, 9, 16, 0, 0, 0, 14, 6, 62,
5, 7, 88, 88, 88, 65, 64, 76, 0, 67,
0, 68, 0, 69, 0, 70, 72, 80, 59, 60,
- 45, 0, 46, 61, 0, 33, 0, 56, 57, 0,
- 1, 0, 0, 0, 0, 0, 30, 0, 0, 0,
+ 45, 0, 46, 61, 0, 32, 0, 56, 57, 0,
+ 1, 0, 0, 0, 0, 0, 29, 0, 0, 0,
0, 0, 0, 0, 0, 0, 89, 0, 0, 87,
- 0, 74, 78, 0, 75, 0, 0, 0, 71, 37,
- 0, 0, 34, 0, 0, 58, 2, 0, 38, 0,
- 0, 37, 0, 54, 55, 53, 47, 48, 49, 50,
+ 0, 74, 78, 0, 75, 0, 0, 0, 71, 36,
+ 0, 0, 33, 0, 0, 58, 2, 0, 37, 0,
+ 0, 36, 0, 54, 55, 53, 47, 48, 49, 50,
51, 52, 43, 0, 44, 66, 77, 73, 79, 82,
- 11, 13, 12, 37, 0, 32, 37, 0, 31, 90,
- 83, 0, 0, 0, 0, 0, 38, 15, 86, 0,
- 0, 38, 0, 38, 38, 0, 0, 0, 84, 40,
- 0, 0, 38, 37, 37, 21, 85, 81, 39, 0,
- 37, 0, 0, 0, 0, 37, 0, 17, 0, 38,
- 37, 20, 36, 38, 27, 0, 0, 38, 38, 0,
- 0, 26, 0, 0, 38, 22, 0, 0, 38, 0,
- 37, 0, 0, 18, 0, 25, 37, 0, 24, 19,
- 0, 0, 38, 23, 38, 0, 29, 28
+ 11, 13, 12, 38, 0, 31, 38, 0, 30, 90,
+ 83, 0, 37, 0, 0, 37, 37, 15, 86, 0,
+ 39, 40, 0, 0, 37, 36, 21, 0, 38, 84,
+ 0, 37, 38, 38, 0, 0, 0, 85, 81, 17,
+ 38, 37, 37, 20, 35, 37, 26, 0, 36, 37,
+ 0, 0, 25, 0, 0, 0, 0, 0, 0, 0,
+ 36, 37, 0, 18, 22, 24, 0, 37, 0, 19,
+ 37, 28, 23, 0, 27
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 19, 20, 52, 140, 23, 173, 174, 65, 24,
- 25, 26, 175, 34, 124, 141, 27, 137, 36, 29,
- 45, 46, 30, 89, 131, 147, 31, 77
+ -1, 19, 20, 52, 141, 23, 165, 166, 65, 24,
+ 25, 26, 167, 34, 124, 132, 27, 137, 36, 29,
+ 45, 46, 30, 89, 131, 148, 31, 77
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -131
+#define YYPACT_NINF -109
static const yytype_int16 yypact[] =
{
- 148, -131, -131, -131, -44, 85, -131, 50, 205, -131,
- 62, 72, 63, 144, 6, 75, 144, 144, 144, 2,
- -131, 4, -131, -131, 27, 46, 176, 239, -131, -131,
- -131, -131, 144, 144, 144, -131, 37, -131, 83, -131,
- 84, -131, 76, -131, 69, 10, -131, -131, -131, -131,
- 48, 144, -131, -13, 92, -131, -29, 67, 67, 215,
- -131, 148, 176, 144, 176, 70, 227, 144, 144, 144,
- 144, 144, 144, 144, 144, 144, 239, -32, -4, 52,
- 102, -131, -131, 104, -131, 105, 107, 86, -131, -131,
- -13, 109, -131, 144, 144, -131, -131, 73, 239, 79,
- 203, 90, 144, 239, 239, 239, 251, 251, 67, 67,
- 239, 239, -131, 144, -131, -131, -131, -131, -131, 112,
- -131, 239, 239, -131, 1, -131, -131, 193, 239, 239,
- -131, -31, 193, 108, 144, 193, -131, -131, 87, 134,
- 96, 97, 144, 239, 97, 110, 152, 193, -131, -131,
- 193, 147, 239, -131, 68, 150, -131, 97, -131, 139,
- -131, 193, 116, 157, 167, -131, 167, -131, 193, 97,
- -131, -131, -131, 167, -131, 176, 193, 167, 97, 171,
- 193, -131, 172, 158, -131, -131, 175, 164, 97, 183,
- 155, 156, 179, -131, 192, -131, -131, 193, -131, -131,
- 194, 193, -131, -131, 97, 170, -131, -131
+ 133, -109, -109, -109, -8, 282, -109, 41, 192, -109,
+ 43, 20, 64, 70, -14, 72, 70, 70, 70, 5,
+ -109, 6, -109, -109, 45, 42, 163, 270, -109, -109,
+ -109, -109, 70, 70, 70, -109, 37, -109, 83, -109,
+ 88, -109, 75, -109, 80, -20, -109, -109, -109, -109,
+ 58, 70, -109, 221, 102, -109, -18, -4, -4, 246,
+ -109, 133, 163, 70, 163, 79, 258, 70, 70, 70,
+ 70, 70, 70, 70, 70, 70, 270, 21, 35, 62,
+ 109, -109, -109, 111, -109, 112, 113, 93, -109, -109,
+ 221, 115, -109, 70, 70, -109, -109, 74, 270, 76,
+ 234, 81, 70, 270, 270, 270, -6, -6, -4, -4,
+ 270, 270, -109, 70, -109, -109, -109, -109, -109, 122,
+ -109, 270, 270, -109, -11, -109, -109, 225, 270, 270,
+ -109, -25, 180, 100, 70, 180, -109, -109, 82, 134,
+ -109, -109, 129, 70, 270, 22, 96, 137, -109, -109,
+ 116, 270, -109, -109, 128, 136, 141, -109, 180, -109,
+ -109, 180, 180, -109, -109, 136, -109, 163, -109, 180,
+ 140, 144, -109, 145, 135, 225, 147, 142, 146, 155,
+ 4, -109, 148, -109, -109, -109, 225, 180, 118, -109,
+ -109, -109, -109, 127, -109
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -131, -131, 168, 16, 0, -131, 51, -124, -61, -131,
- -131, -131, -131, -79, -43, -130, -5, 18, -131, -131,
- -131, 185, -131, -131, -131, -131, -131, 22
+ -109, -109, 120, 10, 0, -109, -109, 17, -61, -109,
+ -109, -109, -109, -85, -51, -108, -5, 14, -109, -109,
+ -109, 150, -109, -109, -109, -109, -109, 71
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -700,72 +696,78 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -46
static const yytype_int16 yytable[] =
{
- 22, 97, 60, 99, -8, 144, 93, 32, 53, 91,
- 119, 57, 58, 59, 133, 94, 21, 157, 28, 138,
- 112, 66, 127, 113, 139, 67, 68, 76, 76, 76,
- 69, 169, 70, 71, 72, 73, 134, 40, 178, 42,
- 74, 75, 54, 55, 132, 87, 90, 135, 114, 181,
- 188, 113, 61, 181, -8, 78, 79, 66, 98, 100,
- 35, 22, 103, 104, 105, 106, 107, 108, 109, 110,
- 111, 204, 47, 49, 161, 164, 166, 21, 62, 28,
- 84, 168, 162, 48, 163, 56, 176, 85, 121, 122,
- 63, 180, 80, 145, 81, 82, 86, 128, 151, 33,
- 153, 154, 92, 83, 101, 67, 68, 113, 129, 160,
- 69, 197, 115, 86, 183, 116, 117, 201, 118, 120,
- 74, 75, 130, -45, -45, 123, 179, 136, -45, 143,
- 182, 125, -45, -45, 185, 186, 33, 152, -45, -45,
- 126, 191, 146, 142, 148, 194, 149, 150, -4, 1,
- 158, 2, 3, 4, 50, 2, 3, 4, 5, 205,
- 155, 206, 156, 159, 165, 6, 170, 7, 8, 9,
- 66, 167, 10, 11, 12, 51, 184, 15, 171, 13,
- 14, 15, 172, 2, 3, 4, 50, 187, 189, 16,
- 17, 192, 190, 16, 17, 18, 193, 202, -4, 18,
- 2, 3, 4, 50, 195, 196, 198, 51, 200, 15,
- 6, 199, 7, 8, 9, 203, 37, 177, 11, 12,
- 207, 16, 17, 38, 13, 14, 15, 64, 39, 96,
- 88, 0, 40, 41, 42, 43, 0, 0, 16, 17,
- 44, 67, 68, 0, 18, 0, 69, 102, 70, 71,
- 72, 73, 0, 67, 68, 95, 74, 75, 69, 0,
- 70, 71, 72, 73, 0, 67, 68, 95, 74, 75,
- 69, 102, 70, 71, 72, 73, 0, 67, 68, 0,
- 74, 75, 69, 0, 70, 71, 72, 73, 0, 67,
- 68, 0, 74, 75, 69, 0, 0, 0, 72, 73,
- 0, 0, 0, 0, 74, 75
+ 22, 97, 133, 99, 119, 60, -8, 40, 53, 42,
+ 21, 57, 58, 59, 28, 87, 127, 93, 135, -38,
+ -38, 66, 54, 55, 134, 138, 94, 76, 76, 76,
+ 139, 48, 67, 68, 67, 68, 153, 69, 154, 69,
+ 158, 72, 73, 32, 161, 162, 90, 74, 75, 74,
+ 75, 35, 169, 47, -38, 61, -8, 66, 98, 100,
+ 155, 22, 103, 104, 105, 106, 107, 108, 109, 110,
+ 111, 21, 187, 112, 49, 28, 113, 2, 3, 4,
+ 50, 142, 56, 175, 145, 146, 63, 114, 121, 122,
+ 113, 84, 80, 152, 81, 186, 62, 128, 85, 82,
+ 160, 51, 83, 15, 78, 79, 174, 86, 129, 33,
+ 170, 171, 92, 101, 173, 16, 17, 113, 176, 115,
+ 86, 18, 116, 117, 118, 120, 123, 136, 125, 144,
+ 188, 126, 130, -4, 1, 143, 191, 147, 151, 193,
+ 2, 3, 4, 5, 149, 150, 156, 157, 159, 163,
+ 6, 164, 7, 8, 9, 168, 177, 10, 11, 12,
+ 178, 179, 66, 182, 13, 14, 15, 184, 192, 180,
+ 2, 3, 4, 50, 183, 181, 185, 194, 16, 17,
+ 189, 96, 172, -4, 18, 0, 190, 2, 3, 4,
+ 50, 0, 0, 0, 51, 88, 15, 6, 0, 7,
+ 8, 9, 0, 37, 0, 11, 12, 0, 16, 17,
+ 38, 13, 14, 15, 64, 39, 0, 0, 0, 40,
+ 41, 42, 43, 0, 0, 16, 17, 44, 0, 0,
+ 140, 18, 2, 3, 4, 50, 0, 0, 0, 0,
+ 0, 0, 6, 91, 7, 8, 9, 0, 0, 0,
+ 11, 12, 0, 0, 0, 0, 13, 14, 15, 67,
+ 68, 0, 0, 0, 69, 0, 70, 71, 72, 73,
+ 16, 17, 67, 68, 74, 75, 18, 69, 102, 70,
+ 71, 72, 73, 0, 67, 68, 95, 74, 75, 69,
+ 0, 70, 71, 72, 73, 0, 67, 68, 95, 74,
+ 75, 69, 102, 70, 71, 72, 73, 0, 67, 68,
+ 0, 74, 75, 69, 0, 70, 71, 72, 73, 0,
+ -45, -45, 0, 74, 75, -45, 0, 0, 0, -45,
+ -45, 0, 0, 33, 0, -45, -45
};
static const yytype_int16 yycheck[] =
{
- 0, 62, 0, 64, 0, 135, 35, 51, 13, 22,
- 89, 16, 17, 18, 13, 44, 0, 147, 0, 50,
- 52, 26, 101, 55, 55, 38, 39, 32, 33, 34,
- 43, 161, 45, 46, 47, 48, 35, 27, 168, 29,
- 53, 54, 36, 37, 123, 35, 51, 126, 52, 173,
- 180, 55, 50, 177, 50, 33, 34, 62, 63, 64,
- 10, 61, 67, 68, 69, 70, 71, 72, 73, 74,
- 75, 201, 10, 10, 153, 154, 155, 61, 51, 61,
- 11, 160, 14, 11, 16, 10, 165, 18, 93, 94,
- 44, 170, 55, 136, 11, 11, 27, 102, 141, 51,
- 143, 144, 10, 27, 34, 38, 39, 55, 113, 152,
- 43, 190, 10, 27, 175, 11, 11, 196, 11, 10,
- 53, 54, 10, 38, 39, 52, 169, 127, 43, 134,
- 173, 52, 47, 48, 177, 178, 51, 142, 53, 54,
- 50, 184, 55, 35, 10, 188, 50, 50, 0, 1,
- 150, 7, 8, 9, 10, 7, 8, 9, 10, 202,
- 50, 204, 10, 16, 14, 17, 50, 19, 20, 21,
- 175, 32, 24, 25, 26, 31, 176, 33, 21, 31,
- 32, 33, 15, 7, 8, 9, 10, 16, 16, 45,
- 46, 16, 34, 45, 46, 51, 32, 197, 50, 51,
- 7, 8, 9, 10, 21, 50, 50, 31, 16, 33,
- 17, 32, 19, 20, 21, 21, 11, 166, 25, 26,
- 50, 45, 46, 18, 31, 32, 33, 51, 23, 61,
- 45, -1, 27, 28, 29, 30, -1, -1, 45, 46,
- 35, 38, 39, -1, 51, -1, 43, 44, 45, 46,
- 47, 48, -1, 38, 39, 52, 53, 54, 43, -1,
- 45, 46, 47, 48, -1, 38, 39, 52, 53, 54,
- 43, 44, 45, 46, 47, 48, -1, 38, 39, -1,
- 53, 54, 43, -1, 45, 46, 47, 48, -1, 38,
- 39, -1, 53, 54, 43, -1, -1, -1, 47, 48,
- -1, -1, -1, -1, 53, 54
+ 0, 62, 13, 64, 89, 0, 0, 27, 13, 29,
+ 0, 16, 17, 18, 0, 35, 101, 35, 126, 15,
+ 16, 26, 36, 37, 35, 50, 44, 32, 33, 34,
+ 55, 11, 38, 39, 38, 39, 14, 43, 16, 43,
+ 148, 47, 48, 51, 152, 153, 51, 53, 54, 53,
+ 54, 10, 160, 10, 50, 50, 50, 62, 63, 64,
+ 145, 61, 67, 68, 69, 70, 71, 72, 73, 74,
+ 75, 61, 180, 52, 10, 61, 55, 7, 8, 9,
+ 10, 132, 10, 168, 135, 136, 44, 52, 93, 94,
+ 55, 11, 55, 144, 11, 180, 51, 102, 18, 11,
+ 151, 31, 27, 33, 33, 34, 167, 27, 113, 51,
+ 161, 162, 10, 34, 165, 45, 46, 55, 169, 10,
+ 27, 51, 11, 11, 11, 10, 52, 127, 52, 134,
+ 181, 50, 10, 0, 1, 35, 187, 55, 143, 190,
+ 7, 8, 9, 10, 10, 16, 50, 10, 32, 21,
+ 17, 15, 19, 20, 21, 14, 16, 24, 25, 26,
+ 16, 16, 167, 16, 31, 32, 33, 21, 50, 34,
+ 7, 8, 9, 10, 32, 175, 21, 50, 45, 46,
+ 32, 61, 165, 50, 51, -1, 186, 7, 8, 9,
+ 10, -1, -1, -1, 31, 45, 33, 17, -1, 19,
+ 20, 21, -1, 11, -1, 25, 26, -1, 45, 46,
+ 18, 31, 32, 33, 51, 23, -1, -1, -1, 27,
+ 28, 29, 30, -1, -1, 45, 46, 35, -1, -1,
+ 50, 51, 7, 8, 9, 10, -1, -1, -1, -1,
+ -1, -1, 17, 22, 19, 20, 21, -1, -1, -1,
+ 25, 26, -1, -1, -1, -1, 31, 32, 33, 38,
+ 39, -1, -1, -1, 43, -1, 45, 46, 47, 48,
+ 45, 46, 38, 39, 53, 54, 51, 43, 44, 45,
+ 46, 47, 48, -1, 38, 39, 52, 53, 54, 43,
+ -1, 45, 46, 47, 48, -1, 38, 39, 52, 53,
+ 54, 43, 44, 45, 46, 47, 48, -1, 38, 39,
+ -1, 53, 54, 43, -1, 45, 46, 47, 48, -1,
+ 38, 39, -1, 53, 54, 43, -1, -1, -1, 47,
+ 48, -1, -1, 51, -1, 53, 54
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -785,14 +787,13 @@ static const yytype_uint8 yystos[] =
72, 34, 44, 72, 72, 72, 72, 72, 72, 72,
72, 72, 52, 55, 52, 10, 11, 11, 11, 69,
10, 72, 72, 52, 70, 52, 50, 69, 72, 72,
- 10, 80, 69, 13, 35, 69, 60, 73, 50, 55,
- 60, 71, 35, 72, 71, 70, 55, 81, 10, 50,
- 50, 70, 72, 70, 70, 50, 10, 71, 60, 16,
- 70, 69, 14, 16, 69, 14, 69, 32, 69, 71,
- 50, 21, 15, 62, 63, 68, 69, 62, 71, 70,
- 69, 63, 70, 64, 60, 70, 70, 16, 71, 16,
- 34, 70, 16, 32, 70, 21, 50, 69, 50, 32,
- 16, 69, 60, 21, 71, 70, 70, 50
+ 10, 80, 71, 13, 35, 71, 60, 73, 50, 55,
+ 50, 60, 70, 35, 72, 70, 70, 55, 81, 10,
+ 16, 72, 70, 14, 16, 69, 50, 10, 71, 32,
+ 70, 71, 71, 21, 15, 62, 63, 68, 14, 71,
+ 70, 70, 63, 70, 64, 69, 70, 16, 16, 16,
+ 34, 60, 16, 32, 21, 21, 69, 71, 70, 32,
+ 60, 70, 50, 70, 50
};
#define yyerrok (yyerrstatus = 0)
@@ -1655,52 +1656,52 @@ yyreduce:
#line 133 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
- WRITE_UINT32(&body, (yyvsp[(5) - (9)].code));
- WRITE_UINT32(&end, (yyvsp[(7) - (9)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 1] = body; /* body of loop */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 2] = end; ;}
+ WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
+ WRITE_UINT32(&end, (yyvsp[(6) - (8)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = body; /* body of loop */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
case 18:
#line 144 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
- WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
- WRITE_UINT32(&finish, (yyvsp[(6) - (12)].code));
- WRITE_UINT32(&body, (yyvsp[(8) - (12)].code));
- WRITE_UINT32(&end, (yyvsp[(10) - (12)].code));
+ WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
+ WRITE_UINT32(&finish, (yyvsp[(6) - (11)].code));
+ WRITE_UINT32(&body, (yyvsp[(8) - (11)].code));
+ WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
WRITE_UINT32(&inc, 1);
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = init; /* initial count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = finish;/* final count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = body; /* body of loop */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 4] = inc; /* increment */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = init; /* initial count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = finish;/* final count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = body; /* body of loop */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 4] = inc; /* increment */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
break;
case 19:
#line 160 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
- WRITE_UINT32(&init, (yyvsp[(3) - (13)].code));
- WRITE_UINT32(&finish, (yyvsp[(7) - (13)].code));
- WRITE_UINT32(&body, (yyvsp[(9) - (13)].code));
- WRITE_UINT32(&end, (yyvsp[(11) - (13)].code));
+ WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
+ WRITE_UINT32(&finish, (yyvsp[(7) - (12)].code));
+ WRITE_UINT32(&body, (yyvsp[(9) - (12)].code));
+ WRITE_UINT32(&end, (yyvsp[(10) - (12)].code));
WRITE_UINT32(&inc, -1);
- (*g_lingo->_currentScript)[(yyvsp[(1) - (13)].code) + 1] = init; /* initial count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (13)].code) + 2] = finish;/* final count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (13)].code) + 3] = body; /* body of loop */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (13)].code) + 4] = inc; /* increment */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (13)].code) + 5] = end; ;}
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = init; /* initial count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = finish;/* final count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = body; /* body of loop */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 4] = inc; /* increment */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
break;
case 20:
#line 174 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(5) - (9)].code));
- WRITE_UINT32(&end, (yyvsp[(7) - (9)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (9)].code) + 3] = end; /* end, if cond fails */
+ WRITE_UINT32(&then, (yyvsp[(5) - (8)].code));
+ WRITE_UINT32(&end, (yyvsp[(6) - (8)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); ;}
break;
@@ -1708,10 +1709,10 @@ yyreduce:
#line 181 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
- WRITE_UINT32(&end, (yyvsp[(6) - (7)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; /* end, if cond fails */
+ WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
+ WRITE_UINT32(&end, (yyvsp[(6) - (6)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); ;}
break;
@@ -1719,30 +1720,18 @@ yyreduce:
case 22:
#line 189 "engines/director/lingo/lingo-gr.y"
{
- inst then = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
- WRITE_UINT32(&end, (yyvsp[(10) - (10)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; /* end, if cond fails */
-
- g_lingo->processIf(0, (yyvsp[(8) - (10)].code)); ;}
- break;
-
- case 23:
-#line 197 "engines/director/lingo/lingo-gr.y"
- {
inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(5) - (14)].code));
- WRITE_UINT32(&else1, (yyvsp[(10) - (14)].code));
- WRITE_UINT32(&end, (yyvsp[(12) - (14)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (14)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (14)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (14)].code) + 3] = end; /* end, if cond fails */
+ WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
+ WRITE_UINT32(&else1, (yyvsp[(8) - (11)].code));
+ WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); ;}
break;
- case 24:
-#line 206 "engines/director/lingo/lingo-gr.y"
+ case 23:
+#line 198 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (12)].code));
@@ -1755,21 +1744,21 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 25:
-#line 216 "engines/director/lingo/lingo-gr.y"
+ case 24:
+#line 208 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(5) - (12)].code));
- WRITE_UINT32(&else1, (yyvsp[(8) - (12)].code));
- WRITE_UINT32(&end, (yyvsp[(10) - (12)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, (yyvsp[(10) - (12)].code)); ;}
+ WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
+ WRITE_UINT32(&else1, (yyvsp[(7) - (11)].code));
+ WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = end; /* end, if cond fails */
+ g_lingo->processIf(0, (yyvsp[(9) - (11)].code)); ;}
break;
- case 28:
-#line 231 "engines/director/lingo/lingo-gr.y"
+ case 27:
+#line 223 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
@@ -1778,33 +1767,33 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (7)].code)); ;}
break;
- case 29:
-#line 237 "engines/director/lingo/lingo-gr.y"
+ case 28:
+#line 229 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
- WRITE_UINT32(&then, (yyvsp[(5) - (7)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
+ WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (5)].code) + 1] = then; /* thenpart */
- g_lingo->codeLabel((yyvsp[(1) - (7)].code)); ;}
+ g_lingo->codeLabel((yyvsp[(1) - (5)].code)); ;}
break;
- case 30:
-#line 245 "engines/director/lingo/lingo-gr.y"
+ case 29:
+#line 237 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 31:
-#line 246 "engines/director/lingo/lingo-gr.y"
+ case 30:
+#line 238 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 33:
-#line 249 "engines/director/lingo/lingo-gr.y"
+ case 32:
+#line 241 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 34:
-#line 251 "engines/director/lingo/lingo-gr.y"
+ case 33:
+#line 243 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1812,8 +1801,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 35:
-#line 257 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 249 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -1821,8 +1810,8 @@ yyreduce:
g_lingo->codeLabel(0); ;}
break;
- case 36:
-#line 263 "engines/director/lingo/lingo-gr.y"
+ case 35:
+#line 255 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -1831,18 +1820,23 @@ yyreduce:
g_lingo->code1(skipEnd); ;}
break;
- case 37:
-#line 270 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 262 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 38:
-#line 272 "engines/director/lingo/lingo-gr.y"
+ case 37:
+#line 264 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
+ case 38:
+#line 266 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = g_lingo->_currentScript->size(); ;}
+ break;
+
case 41:
-#line 278 "engines/director/lingo/lingo-gr.y"
+#line 271 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1851,14 +1845,14 @@ yyreduce:
break;
case 42:
-#line 283 "engines/director/lingo/lingo-gr.y"
+#line 276 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
case 43:
-#line 286 "engines/director/lingo/lingo-gr.y"
+#line 279 "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));
@@ -1868,7 +1862,7 @@ yyreduce:
break;
case 44:
-#line 292 "engines/director/lingo/lingo-gr.y"
+#line 285 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1880,120 +1874,120 @@ yyreduce:
break;
case 45:
-#line 300 "engines/director/lingo/lingo-gr.y"
+#line 293 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
case 47:
-#line 304 "engines/director/lingo/lingo-gr.y"
+#line 297 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
case 48:
-#line 305 "engines/director/lingo/lingo-gr.y"
+#line 298 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
case 49:
-#line 306 "engines/director/lingo/lingo-gr.y"
+#line 299 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
case 50:
-#line 307 "engines/director/lingo/lingo-gr.y"
+#line 300 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
case 51:
-#line 308 "engines/director/lingo/lingo-gr.y"
+#line 301 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
case 52:
-#line 309 "engines/director/lingo/lingo-gr.y"
+#line 302 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
case 53:
-#line 310 "engines/director/lingo/lingo-gr.y"
+#line 303 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
case 54:
-#line 311 "engines/director/lingo/lingo-gr.y"
+#line 304 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
case 55:
-#line 312 "engines/director/lingo/lingo-gr.y"
+#line 305 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
case 56:
-#line 313 "engines/director/lingo/lingo-gr.y"
+#line 306 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 57:
-#line 314 "engines/director/lingo/lingo-gr.y"
+#line 307 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 58:
-#line 315 "engines/director/lingo/lingo-gr.y"
+#line 308 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 59:
-#line 318 "engines/director/lingo/lingo-gr.y"
+#line 311 "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 60:
-#line 319 "engines/director/lingo/lingo-gr.y"
+#line 312 "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 61:
-#line 320 "engines/director/lingo/lingo-gr.y"
+#line 313 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 63:
-#line 322 "engines/director/lingo/lingo-gr.y"
+#line 315 "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 65:
-#line 327 "engines/director/lingo/lingo-gr.y"
+#line 320 "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 66:
-#line 328 "engines/director/lingo/lingo-gr.y"
+#line 321 "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 67:
-#line 339 "engines/director/lingo/lingo-gr.y"
+#line 332 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 68:
-#line 340 "engines/director/lingo/lingo-gr.y"
+#line 333 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 69:
-#line 341 "engines/director/lingo/lingo-gr.y"
+#line 334 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 70:
-#line 342 "engines/director/lingo/lingo-gr.y"
+#line 335 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2002,7 +1996,7 @@ yyreduce:
break;
case 71:
-#line 347 "engines/director/lingo/lingo-gr.y"
+#line 340 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2012,7 +2006,7 @@ yyreduce:
break;
case 72:
-#line 353 "engines/director/lingo/lingo-gr.y"
+#line 346 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2021,47 +2015,47 @@ yyreduce:
break;
case 73:
-#line 360 "engines/director/lingo/lingo-gr.y"
+#line 353 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 74:
-#line 361 "engines/director/lingo/lingo-gr.y"
+#line 354 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 75:
-#line 362 "engines/director/lingo/lingo-gr.y"
+#line 355 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 76:
-#line 363 "engines/director/lingo/lingo-gr.y"
+#line 356 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 77:
-#line 366 "engines/director/lingo/lingo-gr.y"
+#line 359 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 78:
-#line 367 "engines/director/lingo/lingo-gr.y"
+#line 360 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 79:
-#line 368 "engines/director/lingo/lingo-gr.y"
+#line 361 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 80:
-#line 396 "engines/director/lingo/lingo-gr.y"
+#line 389 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 81:
-#line 397 "engines/director/lingo/lingo-gr.y"
+#line 390 "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);
@@ -2070,32 +2064,32 @@ yyreduce:
break;
case 82:
-#line 403 "engines/director/lingo/lingo-gr.y"
+#line 396 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 83:
-#line 404 "engines/director/lingo/lingo-gr.y"
+#line 397 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 84:
-#line 405 "engines/director/lingo/lingo-gr.y"
+#line 398 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 85:
-#line 406 "engines/director/lingo/lingo-gr.y"
+#line 399 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 86:
-#line 408 "engines/director/lingo/lingo-gr.y"
+#line 401 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
case 87:
-#line 411 "engines/director/lingo/lingo-gr.y"
+#line 404 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2105,23 +2099,23 @@ yyreduce:
break;
case 88:
-#line 419 "engines/director/lingo/lingo-gr.y"
+#line 412 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 89:
-#line 420 "engines/director/lingo/lingo-gr.y"
+#line 413 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
case 90:
-#line 421 "engines/director/lingo/lingo-gr.y"
+#line 414 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2125 "engines/director/lingo/lingo-gr.cpp"
+#line 2119 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2335,6 +2329,6 @@ yyreturn:
}
-#line 424 "engines/director/lingo/lingo-gr.y"
+#line 417 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 0ca6018..e7b4286 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -79,7 +79,7 @@ using namespace Director;
%token tWITH tWHILE
%token tGE tLE tGT tLT tEQ tNEQ
-%type<code> asgn begin elseif end expr if repeatwhile repeatwith
+%type<code> asgn begin elseif end expr if repeatwhile repeatwith stmtlist
%type<s> gotoframe gotomovie
%type<narg> argdef arglist
@@ -130,10 +130,10 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
// statements
// end repeat
//
- | repeatwhile '(' cond ')' begin stmtlist end tEND tREPEAT {
+ | repeatwhile '(' cond ')' stmtlist end tEND tREPEAT {
inst body = 0, end = 0;
WRITE_UINT32(&body, $5);
- WRITE_UINT32(&end, $7);
+ WRITE_UINT32(&end, $6);
(*g_lingo->_currentScript)[$1 + 1] = body; /* body of loop */
(*g_lingo->_currentScript)[$1 + 2] = end; } /* end, if cond fails */
;
@@ -141,12 +141,12 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
// statements
// end repeat
//
- | repeatwith '=' expr end tTO expr end begin stmtlist end tEND tREPEAT {
+ | repeatwith '=' expr end tTO expr end stmtlist end tEND tREPEAT {
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, $3);
WRITE_UINT32(&finish, $6);
WRITE_UINT32(&body, $8);
- WRITE_UINT32(&end, $10);
+ WRITE_UINT32(&end, $9);
WRITE_UINT32(&inc, 1);
(*g_lingo->_currentScript)[$1 + 1] = init; /* initial count value */
(*g_lingo->_currentScript)[$1 + 2] = finish;/* final count value */
@@ -157,12 +157,12 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
// statements
// end repeat
//
- | repeatwith '=' expr end tDOWN tTO expr end begin stmtlist end tEND tREPEAT {
+ | repeatwith '=' expr end tDOWN tTO expr end stmtlist end tEND tREPEAT {
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, $3);
WRITE_UINT32(&finish, $7);
WRITE_UINT32(&body, $9);
- WRITE_UINT32(&end, $11);
+ WRITE_UINT32(&end, $10);
WRITE_UINT32(&inc, -1);
(*g_lingo->_currentScript)[$1 + 1] = init; /* initial count value */
(*g_lingo->_currentScript)[$1 + 2] = finish;/* final count value */
@@ -171,14 +171,14 @@ stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
(*g_lingo->_currentScript)[$1 + 5] = end; } /* end, if cond fails */
;
-ifstmt: if cond tTHEN '\n' begin stmtlist end tEND tIF {
+ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF {
inst then = 0, end = 0;
WRITE_UINT32(&then, $5);
- WRITE_UINT32(&end, $7);
+ WRITE_UINT32(&end, $6);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN begin stmt end '\n' {
+ | if cond tTHEN begin stmt end {
inst then = 0, end = 0;
WRITE_UINT32(&then, $4);
WRITE_UINT32(&end, $6);
@@ -186,24 +186,16 @@ ifstmt: if cond tTHEN '\n' begin stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN begin stmt end '\n' begin elseifstmt end {
- inst then = 0, end = 0;
- WRITE_UINT32(&then, $4);
- WRITE_UINT32(&end, $10);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
-
- g_lingo->processIf(0, $8); }
- | if cond tTHEN '\n' begin stmtlist end tELSE '\n' begin stmtlist end tEND tIF {
+ | if cond tTHEN '\n' stmtlist end tELSE stmtlist end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
- WRITE_UINT32(&else1, $10);
- WRITE_UINT32(&end, $12);
+ WRITE_UINT32(&else1, $8);
+ WRITE_UINT32(&end, $9);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN begin stmt end '\n' tELSE begin stmt end '\n' {
+ | if cond tTHEN begin stmt end '\n' tELSE begin stmt end '\n' {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $4);
WRITE_UINT32(&else1, $9);
@@ -213,15 +205,15 @@ ifstmt: if cond tTHEN '\n' begin stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN '\n' begin stmtlist end begin elseifstmt end tEND tIF {
+ | if cond tTHEN '\n' stmtlist end begin elseifstmt end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
- WRITE_UINT32(&else1, $8);
- WRITE_UINT32(&end, $10);
+ WRITE_UINT32(&else1, $7);
+ WRITE_UINT32(&end, $9);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, $10); }
+ g_lingo->processIf(0, $9); }
;
elseifstmt: elseifstmt elseifstmt1
@@ -234,9 +226,9 @@ elseifstmt1: elseif cond tTHEN begin stmt end '\n' {
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
g_lingo->codeLabel($1); }
- | elseif cond tTHEN '\n' begin stmtlist end {
+ | elseif cond tTHEN stmtlist end {
inst then = 0;
- WRITE_UINT32(&then, $5);
+ WRITE_UINT32(&then, $4);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
g_lingo->codeLabel($1); }
@@ -271,8 +263,9 @@ begin: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
;
end: /* nothing */ { g_lingo->code1(STOP); $$ = g_lingo->_currentScript->size(); }
;
-stmtlist: stmtlist '\n' stmt
- | stmt '\n'
+stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
+ | stmtlist '\n'
+ | stmtlist stmt
;
expr: INT {
Commit: a6ded367c831152252138ba2981be88f48401886
https://github.com/scummvm/scummvm/commit/a6ded367c831152252138ba2981be88f48401886
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Further work on one-liner ifs
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index a39894e..cc39573 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -109,8 +109,9 @@ Common::Error DirectorEngine::run() {
_currentScore = nullptr;
_lingo->addCode("--\n\
- --repeat with x = 1 to 5\n\
- set x = 4\n\
+ set x = 1\n\
+ if 5 then exit\n\
+ repeat with x = 1 to 5\n\
if x = 1 then\n\
put 1\n\
else if x = 2 then\n\
@@ -120,7 +121,7 @@ Common::Error DirectorEngine::run() {
end if\n\
if x = 4 then put 4\n\
else put 5\n\
- --end repeat\n\
+ end repeat\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 25b242a..c647d59 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -490,14 +490,14 @@ static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
20, 22, 27, 32, 37, 39, 41, 43, 52, 64,
- 77, 86, 93, 105, 118, 130, 133, 135, 143, 149,
- 151, 155, 159, 162, 166, 168, 170, 171, 172, 173,
- 176, 179, 181, 183, 188, 193, 195, 197, 201, 205,
- 209, 213, 217, 221, 225, 229, 233, 236, 239, 243,
- 246, 249, 252, 254, 256, 259, 261, 265, 268, 271,
- 274, 277, 281, 284, 288, 291, 294, 296, 300, 303,
- 307, 308, 317, 318, 320, 324, 329, 330, 334, 335,
- 337
+ 77, 86, 94, 106, 119, 131, 134, 136, 144, 150,
+ 152, 156, 160, 163, 167, 169, 171, 172, 173, 174,
+ 177, 180, 182, 184, 189, 194, 196, 198, 202, 206,
+ 210, 214, 218, 222, 226, 230, 234, 237, 240, 244,
+ 247, 250, 253, 255, 257, 260, 262, 266, 269, 272,
+ 275, 278, 282, 285, 289, 292, 295, 297, 301, 304,
+ 308, 309, 318, 319, 321, 325, 330, 331, 335, 336,
+ 338
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -512,32 +512,32 @@ static const yytype_int8 yyrhs[] =
70, 16, 32, -1, 66, 44, 72, 70, 13, 35,
72, 70, 71, 70, 16, 32, -1, 67, 64, 34,
50, 71, 70, 16, 21, -1, 67, 64, 34, 69,
- 60, 70, -1, 67, 64, 34, 50, 71, 70, 14,
- 71, 70, 16, 21, -1, 67, 64, 34, 69, 60,
- 70, 50, 14, 69, 60, 70, 50, -1, 67, 64,
- 34, 50, 71, 70, 69, 62, 70, 16, 21, -1,
- 62, 63, -1, 63, -1, 68, 64, 34, 69, 60,
- 70, 50, -1, 68, 64, 34, 71, 70, -1, 72,
- -1, 72, 44, 72, -1, 51, 64, 52, -1, 32,
- 37, -1, 32, 36, 10, -1, 21, -1, 15, -1,
- -1, -1, -1, 71, 50, -1, 71, 60, -1, 7,
- -1, 8, -1, 9, 51, 83, 52, -1, 10, 51,
- 83, 52, -1, 10, -1, 59, -1, 72, 45, 72,
- -1, 72, 46, 72, -1, 72, 47, 72, -1, 72,
- 48, 72, -1, 72, 53, 72, -1, 72, 54, 72,
- -1, 72, 43, 72, -1, 72, 38, 72, -1, 72,
- 39, 72, -1, 45, 72, -1, 46, 72, -1, 51,
- 72, 52, -1, 25, 11, -1, 26, 10, -1, 31,
- 72, -1, 75, -1, 17, -1, 19, 74, -1, 10,
- -1, 74, 55, 10, -1, 20, 23, -1, 20, 28,
- -1, 20, 30, -1, 20, 76, -1, 20, 76, 77,
- -1, 20, 77, -1, 35, 18, 11, -1, 18, 11,
- -1, 35, 11, -1, 11, -1, 29, 27, 11, -1,
- 27, 11, -1, 35, 27, 11, -1, -1, 24, 10,
- 79, 69, 80, 50, 81, 71, -1, -1, 10, -1,
- 80, 55, 10, -1, 80, 50, 55, 10, -1, -1,
- 10, 69, 83, -1, -1, 72, -1, 83, 55, 72,
- -1
+ 60, 70, 50, -1, 67, 64, 34, 50, 71, 70,
+ 14, 71, 70, 16, 21, -1, 67, 64, 34, 69,
+ 60, 70, 50, 14, 69, 60, 70, 50, -1, 67,
+ 64, 34, 50, 71, 70, 69, 62, 70, 16, 21,
+ -1, 62, 63, -1, 63, -1, 68, 64, 34, 69,
+ 60, 70, 50, -1, 68, 64, 34, 71, 70, -1,
+ 72, -1, 72, 44, 72, -1, 51, 64, 52, -1,
+ 32, 37, -1, 32, 36, 10, -1, 21, -1, 15,
+ -1, -1, -1, -1, 71, 50, -1, 71, 60, -1,
+ 7, -1, 8, -1, 9, 51, 83, 52, -1, 10,
+ 51, 83, 52, -1, 10, -1, 59, -1, 72, 45,
+ 72, -1, 72, 46, 72, -1, 72, 47, 72, -1,
+ 72, 48, 72, -1, 72, 53, 72, -1, 72, 54,
+ 72, -1, 72, 43, 72, -1, 72, 38, 72, -1,
+ 72, 39, 72, -1, 45, 72, -1, 46, 72, -1,
+ 51, 72, 52, -1, 25, 11, -1, 26, 10, -1,
+ 31, 72, -1, 75, -1, 17, -1, 19, 74, -1,
+ 10, -1, 74, 55, 10, -1, 20, 23, -1, 20,
+ 28, -1, 20, 30, -1, 20, 76, -1, 20, 76,
+ 77, -1, 20, 77, -1, 35, 18, 11, -1, 18,
+ 11, -1, 35, 11, -1, 11, -1, 29, 27, 11,
+ -1, 27, 11, -1, 35, 27, 11, -1, -1, 24,
+ 10, 79, 69, 80, 50, 81, 71, -1, -1, 10,
+ -1, 80, 55, 10, -1, 80, 50, 55, 10, -1,
+ -1, 10, 69, 83, -1, -1, 72, -1, 83, 55,
+ 72, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -609,7 +609,7 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
1, 4, 4, 4, 1, 1, 1, 8, 11, 12,
- 8, 6, 11, 12, 11, 2, 1, 7, 5, 1,
+ 8, 7, 11, 12, 11, 2, 1, 7, 5, 1,
3, 3, 2, 3, 1, 1, 0, 0, 0, 2,
2, 1, 1, 4, 4, 1, 1, 3, 3, 3,
3, 3, 3, 3, 3, 3, 2, 2, 3, 2,
@@ -638,8 +638,8 @@ static const yytype_uint8 yydefact[] =
51, 52, 43, 0, 44, 66, 77, 73, 79, 82,
11, 13, 12, 38, 0, 31, 38, 0, 30, 90,
83, 0, 37, 0, 0, 37, 37, 15, 86, 0,
- 39, 40, 0, 0, 37, 36, 21, 0, 38, 84,
- 0, 37, 38, 38, 0, 0, 0, 85, 81, 17,
+ 39, 40, 0, 0, 37, 36, 0, 0, 38, 84,
+ 0, 37, 38, 38, 0, 0, 21, 85, 81, 17,
38, 37, 37, 20, 35, 37, 26, 0, 36, 37,
0, 0, 25, 0, 0, 0, 0, 0, 0, 0,
36, 37, 0, 18, 22, 24, 0, 37, 0, 19,
@@ -1709,10 +1709,10 @@ yyreduce:
#line 181 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
- WRITE_UINT32(&end, (yyvsp[(6) - (6)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 3] = end; /* end, if cond fails */
+ WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
+ WRITE_UINT32(&end, (yyvsp[(6) - (7)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); ;}
break;
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index e7b4286..b337912 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -178,7 +178,7 @@ ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN begin stmt end {
+ | if cond tTHEN begin stmt end '\n' {
inst then = 0, end = 0;
WRITE_UINT32(&then, $4);
WRITE_UINT32(&end, $6);
@@ -195,7 +195,7 @@ ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN begin stmt end '\n' tELSE begin stmt end '\n' {
+ | if cond tTHEN begin stmt end '\n' tELSE begin stmt end '\n' {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $4);
WRITE_UINT32(&else1, $9);
Commit: 2415a4cb419a2b877ca8868871fddd4cb878b7ff
https://github.com/scummvm/scummvm/commit/2415a4cb419a2b877ca8868871fddd4cb878b7ff
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix mixing of one-line and multi-line ifs
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index cc39573..539846a 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -110,7 +110,8 @@ Common::Error DirectorEngine::run() {
_lingo->addCode("--\n\
set x = 1\n\
- if 5 then exit\n\
+ if x = 5 then exit\n\
+ else put 10.0\n\
repeat with x = 1 to 5\n\
if x = 1 then\n\
put 1\n\
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index c647d59..50370da 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -78,7 +78,7 @@
HANDLER = 267,
tDOWN = 268,
tELSE = 269,
- tELSIF = 270,
+ tNLELSIF = 270,
tEND = 271,
tEXIT = 272,
tFRAME = 273,
@@ -101,12 +101,13 @@
tTO = 290,
tWITH = 291,
tWHILE = 292,
- tGE = 293,
- tLE = 294,
- tGT = 295,
- tLT = 296,
- tEQ = 297,
- tNEQ = 298
+ tNLELSE = 293,
+ tGE = 294,
+ tLE = 295,
+ tGT = 296,
+ tLT = 297,
+ tEQ = 298,
+ tNEQ = 299
};
#endif
/* Tokens. */
@@ -122,7 +123,7 @@
#define HANDLER 267
#define tDOWN 268
#define tELSE 269
-#define tELSIF 270
+#define tNLELSIF 270
#define tEND 271
#define tEXIT 272
#define tFRAME 273
@@ -145,12 +146,13 @@
#define tTO 290
#define tWITH 291
#define tWHILE 292
-#define tGE 293
-#define tLE 294
-#define tGT 295
-#define tLT 296
-#define tEQ 297
-#define tNEQ 298
+#define tNLELSE 293
+#define tGE 294
+#define tLE 295
+#define tGT 296
+#define tLT 297
+#define tEQ 298
+#define tNEQ 299
@@ -202,7 +204,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 206 "engines/director/lingo/lingo-gr.cpp"
+#line 208 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -215,7 +217,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 219 "engines/director/lingo/lingo-gr.cpp"
+#line 221 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -428,22 +430,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 60
+#define YYFINAL 61
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 336
+#define YYLAST 389
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 56
+#define YYNTOKENS 57
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 28
+#define YYNNTS 30
/* YYNRULES -- Number of rules. */
-#define YYNRULES 90
+#define YYNRULES 92
/* YYNRULES -- Number of states. */
#define YYNSTATES 195
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 298
+#define YYMAXUTOK 299
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -452,12 +454,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 50, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 51, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 49, 2, 2,
- 51, 52, 47, 45, 55, 46, 2, 48, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 50, 2, 2,
+ 52, 53, 48, 46, 56, 47, 2, 49, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 54, 44, 53, 2, 2, 2, 2, 2, 2, 2,
+ 55, 45, 54, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -480,7 +482,7 @@ static const yytype_uint8 yytranslate[] =
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43
+ 35, 36, 37, 38, 39, 40, 41, 42, 43, 44
};
#if YYDEBUG
@@ -489,70 +491,69 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
- 20, 22, 27, 32, 37, 39, 41, 43, 52, 64,
- 77, 86, 94, 106, 119, 131, 134, 136, 144, 150,
- 152, 156, 160, 163, 167, 169, 171, 172, 173, 174,
- 177, 180, 182, 184, 189, 194, 196, 198, 202, 206,
- 210, 214, 218, 222, 226, 230, 234, 237, 240, 244,
- 247, 250, 253, 255, 257, 260, 262, 266, 269, 272,
- 275, 278, 282, 285, 289, 292, 295, 297, 301, 304,
- 308, 309, 318, 319, 321, 325, 330, 331, 335, 336,
- 338
+ 20, 22, 27, 32, 37, 39, 41, 43, 45, 54,
+ 66, 79, 88, 100, 112, 121, 122, 126, 129, 131,
+ 139, 145, 147, 151, 155, 158, 162, 164, 166, 167,
+ 168, 169, 172, 175, 177, 179, 184, 189, 191, 193,
+ 197, 201, 205, 209, 213, 217, 221, 225, 229, 232,
+ 235, 239, 242, 245, 248, 250, 252, 255, 257, 261,
+ 264, 267, 270, 273, 277, 280, 284, 287, 290, 292,
+ 296, 299, 303, 304, 313, 314, 316, 320, 325, 326,
+ 330, 331, 333
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 57, 0, -1, 57, 50, 58, -1, 58, -1, -1,
- 78, -1, 73, -1, 82, -1, 59, -1, 60, -1,
- 1, -1, 31, 72, 22, 10, -1, 33, 10, 44,
- 72, -1, 33, 10, 35, 72, -1, 72, -1, 73,
- -1, 61, -1, 65, 51, 64, 52, 71, 70, 16,
- 32, -1, 66, 44, 72, 70, 35, 72, 70, 71,
- 70, 16, 32, -1, 66, 44, 72, 70, 13, 35,
- 72, 70, 71, 70, 16, 32, -1, 67, 64, 34,
- 50, 71, 70, 16, 21, -1, 67, 64, 34, 69,
- 60, 70, 50, -1, 67, 64, 34, 50, 71, 70,
- 14, 71, 70, 16, 21, -1, 67, 64, 34, 69,
- 60, 70, 50, 14, 69, 60, 70, 50, -1, 67,
- 64, 34, 50, 71, 70, 69, 62, 70, 16, 21,
- -1, 62, 63, -1, 63, -1, 68, 64, 34, 69,
- 60, 70, 50, -1, 68, 64, 34, 71, 70, -1,
- 72, -1, 72, 44, 72, -1, 51, 64, 52, -1,
- 32, 37, -1, 32, 36, 10, -1, 21, -1, 15,
- -1, -1, -1, -1, 71, 50, -1, 71, 60, -1,
- 7, -1, 8, -1, 9, 51, 83, 52, -1, 10,
- 51, 83, 52, -1, 10, -1, 59, -1, 72, 45,
- 72, -1, 72, 46, 72, -1, 72, 47, 72, -1,
- 72, 48, 72, -1, 72, 53, 72, -1, 72, 54,
- 72, -1, 72, 43, 72, -1, 72, 38, 72, -1,
- 72, 39, 72, -1, 45, 72, -1, 46, 72, -1,
- 51, 72, 52, -1, 25, 11, -1, 26, 10, -1,
- 31, 72, -1, 75, -1, 17, -1, 19, 74, -1,
- 10, -1, 74, 55, 10, -1, 20, 23, -1, 20,
- 28, -1, 20, 30, -1, 20, 76, -1, 20, 76,
- 77, -1, 20, 77, -1, 35, 18, 11, -1, 18,
- 11, -1, 35, 11, -1, 11, -1, 29, 27, 11,
- -1, 27, 11, -1, 35, 27, 11, -1, -1, 24,
- 10, 79, 69, 80, 50, 81, 71, -1, -1, 10,
- -1, 80, 55, 10, -1, 80, 50, 55, 10, -1,
- -1, 10, 69, 83, -1, -1, 72, -1, 83, 55,
- 72, -1
+ 58, 0, -1, 58, 51, 59, -1, 59, -1, -1,
+ 81, -1, 76, -1, 85, -1, 60, -1, 62, -1,
+ 1, -1, 31, 75, 22, 10, -1, 33, 10, 45,
+ 75, -1, 33, 10, 35, 75, -1, 75, -1, 76,
+ -1, 61, -1, 63, -1, 68, 52, 67, 53, 74,
+ 73, 16, 32, -1, 69, 45, 75, 73, 35, 75,
+ 73, 74, 73, 16, 32, -1, 69, 45, 75, 73,
+ 13, 35, 75, 73, 74, 73, 16, 32, -1, 70,
+ 67, 34, 51, 74, 73, 16, 21, -1, 70, 67,
+ 34, 51, 74, 73, 14, 74, 73, 16, 21, -1,
+ 70, 67, 34, 51, 74, 73, 72, 65, 73, 16,
+ 21, -1, 70, 67, 34, 72, 61, 73, 64, 73,
+ -1, -1, 38, 72, 61, -1, 65, 66, -1, 66,
+ -1, 71, 67, 34, 72, 62, 73, 51, -1, 71,
+ 67, 34, 74, 73, -1, 75, -1, 75, 45, 75,
+ -1, 52, 67, 53, -1, 32, 37, -1, 32, 36,
+ 10, -1, 21, -1, 15, -1, -1, -1, -1, 74,
+ 51, -1, 74, 62, -1, 7, -1, 8, -1, 9,
+ 52, 86, 53, -1, 10, 52, 86, 53, -1, 10,
+ -1, 60, -1, 75, 46, 75, -1, 75, 47, 75,
+ -1, 75, 48, 75, -1, 75, 49, 75, -1, 75,
+ 54, 75, -1, 75, 55, 75, -1, 75, 44, 75,
+ -1, 75, 39, 75, -1, 75, 40, 75, -1, 46,
+ 75, -1, 47, 75, -1, 52, 75, 53, -1, 25,
+ 11, -1, 26, 10, -1, 31, 75, -1, 78, -1,
+ 17, -1, 19, 77, -1, 10, -1, 77, 56, 10,
+ -1, 20, 23, -1, 20, 28, -1, 20, 30, -1,
+ 20, 79, -1, 20, 79, 80, -1, 20, 80, -1,
+ 35, 18, 11, -1, 18, 11, -1, 35, 11, -1,
+ 11, -1, 29, 27, 11, -1, 27, 11, -1, 35,
+ 27, 11, -1, -1, 24, 10, 82, 72, 83, 51,
+ 84, 74, -1, -1, 10, -1, 83, 56, 10, -1,
+ 83, 51, 56, 10, -1, -1, 10, 72, 86, -1,
+ -1, 75, -1, 86, 56, 75, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 93, 93, 94, 97, 98, 99, 100, 101, 102,
- 103, 106, 112, 118, 126, 127, 128, 133, 144, 160,
- 174, 181, 189, 198, 208, 219, 220, 223, 229, 237,
- 238, 239, 241, 243, 249, 255, 262, 264, 266, 267,
- 268, 271, 276, 279, 285, 293, 296, 297, 298, 299,
- 300, 301, 302, 303, 304, 305, 306, 307, 308, 311,
- 312, 313, 314, 315, 317, 320, 321, 332, 333, 334,
- 335, 340, 346, 353, 354, 355, 356, 359, 360, 361,
- 389, 389, 396, 397, 398, 399, 401, 404, 412, 413,
- 414
+ 103, 106, 112, 118, 125, 126, 128, 129, 134, 145,
+ 161, 175, 182, 191, 200, 211, 212, 215, 216, 219,
+ 225, 233, 234, 235, 237, 239, 245, 251, 258, 260,
+ 262, 263, 264, 267, 272, 275, 281, 289, 292, 293,
+ 294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
+ 304, 307, 308, 309, 310, 311, 313, 316, 317, 328,
+ 329, 330, 331, 336, 342, 349, 350, 351, 352, 355,
+ 356, 357, 385, 385, 392, 393, 394, 395, 397, 400,
+ 408, 409, 410
};
#endif
@@ -562,16 +563,17 @@ static const yytype_uint16 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "CASTREF", "UNARY", "VOID", "VAR", "INT",
- "FLOAT", "BLTIN", "ID", "STRING", "HANDLER", "tDOWN", "tELSE", "tELSIF",
- "tEND", "tEXIT", "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP",
- "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS",
- "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tGE",
- "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='", "'+'", "'-'", "'*'", "'/'",
- "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "','", "$accept", "program",
- "programline", "asgn", "stmt", "ifstmt", "elseifstmt", "elseifstmt1",
- "cond", "repeatwhile", "repeatwith", "if", "elseif", "begin", "end",
- "stmtlist", "expr", "func", "globallist", "gotofunc", "gotoframe",
- "gotomovie", "defn", "@1", "argdef", "argstore", "macro", "arglist", 0
+ "FLOAT", "BLTIN", "ID", "STRING", "HANDLER", "tDOWN", "tELSE",
+ "tNLELSIF", "tEND", "tEXIT", "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO",
+ "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF",
+ "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH",
+ "tWHILE", "tNLELSE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='",
+ "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'",
+ "','", "$accept", "program", "programline", "asgn", "stmtoneliner",
+ "stmt", "ifstmt", "elsestmt", "elseifstmt", "elseifstmt1", "cond",
+ "repeatwhile", "repeatwith", "if", "elseif", "begin", "end", "stmtlist",
+ "expr", "func", "globallist", "gotofunc", "gotoframe", "gotomovie",
+ "defn", "@1", "argdef", "argstore", "macro", "arglist", 0
};
#endif
@@ -584,39 +586,39 @@ static const yytype_uint16 yytoknum[] =
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, 298, 61, 43, 45, 42, 47, 37,
- 10, 40, 41, 62, 60, 44
+ 295, 296, 297, 298, 299, 61, 43, 45, 42, 47,
+ 37, 10, 40, 41, 62, 60, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 56, 57, 57, 58, 58, 58, 58, 58, 58,
- 58, 59, 59, 59, 60, 60, 60, 60, 60, 60,
- 61, 61, 61, 61, 61, 62, 62, 63, 63, 64,
- 64, 64, 65, 66, 67, 68, 69, 70, 71, 71,
- 71, 72, 72, 72, 72, 72, 72, 72, 72, 72,
- 72, 72, 72, 72, 72, 72, 72, 72, 72, 73,
- 73, 73, 73, 73, 73, 74, 74, 75, 75, 75,
- 75, 75, 75, 76, 76, 76, 76, 77, 77, 77,
- 79, 78, 80, 80, 80, 80, 81, 82, 83, 83,
- 83
+ 0, 57, 58, 58, 59, 59, 59, 59, 59, 59,
+ 59, 60, 60, 60, 61, 61, 62, 62, 62, 62,
+ 62, 63, 63, 63, 63, 64, 64, 65, 65, 66,
+ 66, 67, 67, 67, 68, 69, 70, 71, 72, 73,
+ 74, 74, 74, 75, 75, 75, 75, 75, 75, 75,
+ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
+ 75, 76, 76, 76, 76, 76, 76, 77, 77, 78,
+ 78, 78, 78, 78, 78, 79, 79, 79, 79, 80,
+ 80, 80, 82, 81, 83, 83, 83, 83, 84, 85,
+ 86, 86, 86
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 1, 4, 4, 4, 1, 1, 1, 8, 11, 12,
- 8, 7, 11, 12, 11, 2, 1, 7, 5, 1,
- 3, 3, 2, 3, 1, 1, 0, 0, 0, 2,
- 2, 1, 1, 4, 4, 1, 1, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 2, 2, 3, 2,
- 2, 2, 1, 1, 2, 1, 3, 2, 2, 2,
- 2, 3, 2, 3, 2, 2, 1, 3, 2, 3,
- 0, 8, 0, 1, 3, 4, 0, 3, 0, 1,
- 3
+ 1, 4, 4, 4, 1, 1, 1, 1, 8, 11,
+ 12, 8, 11, 11, 8, 0, 3, 2, 1, 7,
+ 5, 1, 3, 3, 2, 3, 1, 1, 0, 0,
+ 0, 2, 2, 1, 1, 4, 4, 1, 1, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 2, 2,
+ 3, 2, 2, 2, 1, 1, 2, 1, 3, 2,
+ 2, 2, 2, 3, 2, 3, 2, 2, 1, 3,
+ 2, 3, 0, 8, 0, 1, 3, 4, 0, 3,
+ 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -624,150 +626,160 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 10, 41, 42, 0, 36, 63, 0, 0, 34,
+ 0, 10, 43, 44, 0, 38, 65, 0, 0, 36,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 3, 46, 9, 16, 0, 0, 0, 14, 6, 62,
- 5, 7, 88, 88, 88, 65, 64, 76, 0, 67,
- 0, 68, 0, 69, 0, 70, 72, 80, 59, 60,
- 45, 0, 46, 61, 0, 32, 0, 56, 57, 0,
- 1, 0, 0, 0, 0, 0, 29, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 89, 0, 0, 87,
- 0, 74, 78, 0, 75, 0, 0, 0, 71, 36,
- 0, 0, 33, 0, 0, 58, 2, 0, 37, 0,
- 0, 36, 0, 54, 55, 53, 47, 48, 49, 50,
- 51, 52, 43, 0, 44, 66, 77, 73, 79, 82,
- 11, 13, 12, 38, 0, 31, 38, 0, 30, 90,
- 83, 0, 37, 0, 0, 37, 37, 15, 86, 0,
- 39, 40, 0, 0, 37, 36, 0, 0, 38, 84,
- 0, 37, 38, 38, 0, 0, 21, 85, 81, 17,
- 38, 37, 37, 20, 35, 37, 26, 0, 36, 37,
- 0, 0, 25, 0, 0, 0, 0, 0, 0, 0,
- 36, 37, 0, 18, 22, 24, 0, 37, 0, 19,
- 37, 28, 23, 0, 27
+ 3, 48, 16, 9, 17, 0, 0, 0, 14, 6,
+ 64, 5, 7, 90, 90, 90, 67, 66, 78, 0,
+ 69, 0, 70, 0, 71, 0, 72, 74, 82, 61,
+ 62, 47, 0, 48, 63, 0, 34, 0, 58, 59,
+ 0, 1, 0, 0, 0, 0, 0, 31, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 91, 0, 0,
+ 89, 0, 76, 80, 0, 77, 0, 0, 0, 73,
+ 38, 0, 0, 35, 0, 0, 60, 2, 0, 39,
+ 0, 0, 38, 0, 56, 57, 55, 49, 50, 51,
+ 52, 53, 54, 45, 0, 46, 68, 79, 75, 81,
+ 84, 11, 13, 12, 40, 0, 33, 40, 0, 32,
+ 92, 85, 0, 39, 0, 0, 39, 39, 15, 88,
+ 0, 41, 42, 0, 0, 39, 38, 25, 0, 40,
+ 86, 0, 39, 40, 40, 0, 0, 38, 39, 87,
+ 83, 18, 40, 39, 39, 21, 37, 39, 28, 0,
+ 0, 24, 39, 0, 0, 27, 0, 0, 26, 0,
+ 0, 0, 0, 38, 0, 19, 22, 23, 0, 39,
+ 20, 39, 30, 0, 29
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 19, 20, 52, 141, 23, 165, 166, 65, 24,
- 25, 26, 167, 34, 124, 132, 27, 137, 36, 29,
- 45, 46, 30, 89, 131, 148, 31, 77
+ -1, 19, 20, 53, 22, 142, 24, 158, 167, 168,
+ 66, 25, 26, 27, 169, 35, 125, 133, 28, 138,
+ 37, 30, 46, 47, 31, 90, 132, 149, 32, 78
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -109
+#define YYPACT_NINF -123
static const yytype_int16 yypact[] =
{
- 133, -109, -109, -109, -8, 282, -109, 41, 192, -109,
- 43, 20, 64, 70, -14, 72, 70, 70, 70, 5,
- -109, 6, -109, -109, 45, 42, 163, 270, -109, -109,
- -109, -109, 70, 70, 70, -109, 37, -109, 83, -109,
- 88, -109, 75, -109, 80, -20, -109, -109, -109, -109,
- 58, 70, -109, 221, 102, -109, -18, -4, -4, 246,
- -109, 133, 163, 70, 163, 79, 258, 70, 70, 70,
- 70, 70, 70, 70, 70, 70, 270, 21, 35, 62,
- 109, -109, -109, 111, -109, 112, 113, 93, -109, -109,
- 221, 115, -109, 70, 70, -109, -109, 74, 270, 76,
- 234, 81, 70, 270, 270, 270, -6, -6, -4, -4,
- 270, 270, -109, 70, -109, -109, -109, -109, -109, 122,
- -109, 270, 270, -109, -11, -109, -109, 225, 270, 270,
- -109, -25, 180, 100, 70, 180, -109, -109, 82, 134,
- -109, -109, 129, 70, 270, 22, 96, 137, -109, -109,
- 116, 270, -109, -109, 128, 136, 141, -109, 180, -109,
- -109, 180, 180, -109, -109, 136, -109, 163, -109, 180,
- 140, 144, -109, 145, 135, 225, 147, 142, 146, 155,
- 4, -109, 148, -109, -109, -109, 225, 180, 118, -109,
- -109, -109, -109, 127, -109
+ 124, -123, -123, -123, -45, 317, -123, 24, 277, -123,
+ 39, 43, 51, 152, 9, 64, 152, 152, 152, 2,
+ -123, 4, -123, -123, -123, 26, 12, 198, 305, -123,
+ -123, -123, -123, 152, 152, 152, -123, 29, -123, 76,
+ -123, 77, -123, 66, -123, -2, -3, -123, -123, -123,
+ -123, 42, 152, -123, 237, 81, -123, -12, -4, -4,
+ 281, -123, 124, 198, 152, 198, 61, 293, 152, 152,
+ 152, 152, 152, 152, 152, 152, 152, 305, -38, -15,
+ 40, 87, -123, -123, 89, -123, 90, 91, 79, -123,
+ -123, 237, 93, -123, 152, 152, -123, -123, 55, 305,
+ 60, 269, 53, 152, 305, 305, 305, 334, 334, -4,
+ -4, 305, 305, -123, 152, -123, -123, -123, -123, -123,
+ 105, -123, 305, 305, -123, -8, -123, -123, 247, 305,
+ 305, -123, -14, 170, 82, 152, 170, -123, -123, 62,
+ 106, -123, -123, 104, 152, 305, 63, 83, 112, -123,
+ -123, 94, 305, -123, -123, 102, 113, -123, -123, -123,
+ 170, -123, -123, 170, 170, -123, -123, 113, -123, 198,
+ 247, -123, 170, 111, 119, -123, 121, 95, -123, 126,
+ 108, 125, 130, 5, 115, -123, -123, -123, 216, 170,
+ -123, -123, -123, 101, -123
};
/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int16 yypgoto[] =
+static const yytype_int8 yypgoto[] =
{
- -109, -109, 120, 10, 0, -109, -109, 17, -61, -109,
- -109, -109, -109, -85, -51, -108, -5, 14, -109, -109,
- -109, 150, -109, -109, -109, -109, -109, 71
+ -123, -123, 92, 10, -122, 0, -123, -123, -123, -9,
+ -62, -123, -123, -123, -123, -71, -53, -110, -5, 14,
+ -123, -123, -123, 107, -123, -123, -123, -123, -123, 47
};
/* 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 -46
+#define YYTABLE_NINF -48
static const yytype_int16 yytable[] =
{
- 22, 97, 133, 99, 119, 60, -8, 40, 53, 42,
- 21, 57, 58, 59, 28, 87, 127, 93, 135, -38,
- -38, 66, 54, 55, 134, 138, 94, 76, 76, 76,
- 139, 48, 67, 68, 67, 68, 153, 69, 154, 69,
- 158, 72, 73, 32, 161, 162, 90, 74, 75, 74,
- 75, 35, 169, 47, -38, 61, -8, 66, 98, 100,
- 155, 22, 103, 104, 105, 106, 107, 108, 109, 110,
- 111, 21, 187, 112, 49, 28, 113, 2, 3, 4,
- 50, 142, 56, 175, 145, 146, 63, 114, 121, 122,
- 113, 84, 80, 152, 81, 186, 62, 128, 85, 82,
- 160, 51, 83, 15, 78, 79, 174, 86, 129, 33,
- 170, 171, 92, 101, 173, 16, 17, 113, 176, 115,
- 86, 18, 116, 117, 118, 120, 123, 136, 125, 144,
- 188, 126, 130, -4, 1, 143, 191, 147, 151, 193,
- 2, 3, 4, 5, 149, 150, 156, 157, 159, 163,
- 6, 164, 7, 8, 9, 168, 177, 10, 11, 12,
- 178, 179, 66, 182, 13, 14, 15, 184, 192, 180,
- 2, 3, 4, 50, 183, 181, 185, 194, 16, 17,
- 189, 96, 172, -4, 18, 0, 190, 2, 3, 4,
- 50, 0, 0, 0, 51, 88, 15, 6, 0, 7,
- 8, 9, 0, 37, 0, 11, 12, 0, 16, 17,
- 38, 13, 14, 15, 64, 39, 0, 0, 0, 40,
- 41, 42, 43, 0, 0, 16, 17, 44, 0, 0,
- 140, 18, 2, 3, 4, 50, 0, 0, 0, 0,
- 0, 0, 6, 91, 7, 8, 9, 0, 0, 0,
- 11, 12, 0, 0, 0, 0, 13, 14, 15, 67,
- 68, 0, 0, 0, 69, 0, 70, 71, 72, 73,
- 16, 17, 67, 68, 74, 75, 18, 69, 102, 70,
- 71, 72, 73, 0, 67, 68, 95, 74, 75, 69,
- 0, 70, 71, 72, 73, 0, 67, 68, 95, 74,
- 75, 69, 102, 70, 71, 72, 73, 0, 67, 68,
- 0, 74, 75, 69, 0, 70, 71, 72, 73, 0,
- -45, -45, 0, 74, 75, -45, 0, 0, 0, -45,
- -45, 0, 0, 33, 0, -45, -45
+ 23, 98, 61, 100, -8, 134, 137, 33, 54, 85,
+ 21, 58, 59, 60, 29, 113, 86, 136, 114, 120,
+ -40, -40, 67, 94, 41, 87, 43, 135, 77, 77,
+ 77, 128, 88, 95, 36, 68, 69, 139, 115, 160,
+ 70, 114, 140, 163, 164, 55, 56, 91, 178, 48,
+ 75, 76, 172, 62, 49, -8, -40, 64, 67, 99,
+ 101, 50, 23, 104, 105, 106, 107, 108, 109, 110,
+ 111, 112, 21, 189, 57, 156, 29, 154, 63, 155,
+ 143, 79, 80, 146, 147, 81, 170, 82, 83, 122,
+ 123, 93, 153, 84, 34, 102, 114, 116, 129, 162,
+ 117, 118, 119, 121, 127, 171, 87, 177, 124, 130,
+ 173, 174, 188, 126, 176, 131, 150, 144, 148, 179,
+ 151, 157, 159, 165, -4, 1, 161, 180, 166, 183,
+ 145, 2, 3, 4, 5, 181, 192, 182, 193, 152,
+ 185, 6, 184, 7, 8, 9, 186, 190, 10, 11,
+ 12, 187, 194, 89, 97, 13, 14, 15, 175, 2,
+ 3, 4, 51, 0, 67, 0, 0, 0, 0, 0,
+ 16, 17, 0, 0, 0, -4, 18, 2, 3, 4,
+ 51, 0, 0, 52, 0, 15, 0, 6, 191, 7,
+ 8, 9, 0, 0, 0, 11, 12, 0, 16, 17,
+ 0, 13, 14, 15, 18, 2, 3, 4, 51, 0,
+ 0, 0, 0, 0, 0, 0, 16, 17, 0, 0,
+ 0, 141, 18, 2, 3, 4, 51, 0, 0, 52,
+ 0, 15, 0, 6, 0, 7, 8, 9, 0, 0,
+ 0, 11, 12, 0, 16, 17, 0, 13, 14, 15,
+ 65, 0, 0, 0, 2, 3, 4, 51, 0, 92,
+ 0, 0, 16, 17, 6, 0, 7, 8, 18, 0,
+ 0, 0, 11, 12, 0, 0, 68, 69, 13, 0,
+ 15, 70, 0, 71, 72, 73, 74, 0, 38, 0,
+ 0, 75, 76, 16, 17, 39, 0, 0, 0, 18,
+ 40, 0, 0, 0, 41, 42, 43, 44, 68, 69,
+ 0, 0, 45, 70, 103, 71, 72, 73, 74, 0,
+ 68, 69, 96, 75, 76, 70, 0, 71, 72, 73,
+ 74, 0, 68, 69, 96, 75, 76, 70, 103, 71,
+ 72, 73, 74, 0, 68, 69, 0, 75, 76, 70,
+ 0, 71, 72, 73, 74, 0, -47, -47, 0, 75,
+ 76, -47, 0, 0, 0, -47, -47, 0, 0, 34,
+ 0, -47, -47, 68, 69, 0, 0, 0, 70, 0,
+ 0, 0, 73, 74, 0, 0, 0, 0, 75, 76
};
static const yytype_int16 yycheck[] =
{
- 0, 62, 13, 64, 89, 0, 0, 27, 13, 29,
- 0, 16, 17, 18, 0, 35, 101, 35, 126, 15,
- 16, 26, 36, 37, 35, 50, 44, 32, 33, 34,
- 55, 11, 38, 39, 38, 39, 14, 43, 16, 43,
- 148, 47, 48, 51, 152, 153, 51, 53, 54, 53,
- 54, 10, 160, 10, 50, 50, 50, 62, 63, 64,
- 145, 61, 67, 68, 69, 70, 71, 72, 73, 74,
- 75, 61, 180, 52, 10, 61, 55, 7, 8, 9,
- 10, 132, 10, 168, 135, 136, 44, 52, 93, 94,
- 55, 11, 55, 144, 11, 180, 51, 102, 18, 11,
- 151, 31, 27, 33, 33, 34, 167, 27, 113, 51,
- 161, 162, 10, 34, 165, 45, 46, 55, 169, 10,
- 27, 51, 11, 11, 11, 10, 52, 127, 52, 134,
- 181, 50, 10, 0, 1, 35, 187, 55, 143, 190,
- 7, 8, 9, 10, 10, 16, 50, 10, 32, 21,
- 17, 15, 19, 20, 21, 14, 16, 24, 25, 26,
- 16, 16, 167, 16, 31, 32, 33, 21, 50, 34,
- 7, 8, 9, 10, 32, 175, 21, 50, 45, 46,
- 32, 61, 165, 50, 51, -1, 186, 7, 8, 9,
- 10, -1, -1, -1, 31, 45, 33, 17, -1, 19,
- 20, 21, -1, 11, -1, 25, 26, -1, 45, 46,
- 18, 31, 32, 33, 51, 23, -1, -1, -1, 27,
- 28, 29, 30, -1, -1, 45, 46, 35, -1, -1,
- 50, 51, 7, 8, 9, 10, -1, -1, -1, -1,
- -1, -1, 17, 22, 19, 20, 21, -1, -1, -1,
- 25, 26, -1, -1, -1, -1, 31, 32, 33, 38,
- 39, -1, -1, -1, 43, -1, 45, 46, 47, 48,
- 45, 46, 38, 39, 53, 54, 51, 43, 44, 45,
- 46, 47, 48, -1, 38, 39, 52, 53, 54, 43,
- -1, 45, 46, 47, 48, -1, 38, 39, 52, 53,
- 54, 43, 44, 45, 46, 47, 48, -1, 38, 39,
- -1, 53, 54, 43, -1, 45, 46, 47, 48, -1,
- 38, 39, -1, 53, 54, 43, -1, -1, -1, 47,
- 48, -1, -1, 51, -1, 53, 54
+ 0, 63, 0, 65, 0, 13, 128, 52, 13, 11,
+ 0, 16, 17, 18, 0, 53, 18, 127, 56, 90,
+ 15, 16, 27, 35, 27, 27, 29, 35, 33, 34,
+ 35, 102, 35, 45, 10, 39, 40, 51, 53, 149,
+ 44, 56, 56, 153, 154, 36, 37, 52, 170, 10,
+ 54, 55, 162, 51, 11, 51, 51, 45, 63, 64,
+ 65, 10, 62, 68, 69, 70, 71, 72, 73, 74,
+ 75, 76, 62, 183, 10, 146, 62, 14, 52, 16,
+ 133, 34, 35, 136, 137, 56, 157, 11, 11, 94,
+ 95, 10, 145, 27, 52, 34, 56, 10, 103, 152,
+ 11, 11, 11, 10, 51, 158, 27, 169, 53, 114,
+ 163, 164, 183, 53, 167, 10, 10, 35, 56, 172,
+ 16, 38, 10, 21, 0, 1, 32, 16, 15, 34,
+ 135, 7, 8, 9, 10, 16, 189, 16, 191, 144,
+ 32, 17, 16, 19, 20, 21, 21, 32, 24, 25,
+ 26, 21, 51, 46, 62, 31, 32, 33, 167, 7,
+ 8, 9, 10, -1, 169, -1, -1, -1, -1, -1,
+ 46, 47, -1, -1, -1, 51, 52, 7, 8, 9,
+ 10, -1, -1, 31, -1, 33, -1, 17, 188, 19,
+ 20, 21, -1, -1, -1, 25, 26, -1, 46, 47,
+ -1, 31, 32, 33, 52, 7, 8, 9, 10, -1,
+ -1, -1, -1, -1, -1, -1, 46, 47, -1, -1,
+ -1, 51, 52, 7, 8, 9, 10, -1, -1, 31,
+ -1, 33, -1, 17, -1, 19, 20, 21, -1, -1,
+ -1, 25, 26, -1, 46, 47, -1, 31, 32, 33,
+ 52, -1, -1, -1, 7, 8, 9, 10, -1, 22,
+ -1, -1, 46, 47, 17, -1, 19, 20, 52, -1,
+ -1, -1, 25, 26, -1, -1, 39, 40, 31, -1,
+ 33, 44, -1, 46, 47, 48, 49, -1, 11, -1,
+ -1, 54, 55, 46, 47, 18, -1, -1, -1, 52,
+ 23, -1, -1, -1, 27, 28, 29, 30, 39, 40,
+ -1, -1, 35, 44, 45, 46, 47, 48, 49, -1,
+ 39, 40, 53, 54, 55, 44, -1, 46, 47, 48,
+ 49, -1, 39, 40, 53, 54, 55, 44, 45, 46,
+ 47, 48, 49, -1, 39, 40, -1, 54, 55, 44,
+ -1, 46, 47, 48, 49, -1, 39, 40, -1, 54,
+ 55, 44, -1, -1, -1, 48, 49, -1, -1, 52,
+ -1, 54, 55, 39, 40, -1, -1, -1, 44, -1,
+ -1, -1, 48, 49, -1, -1, -1, -1, 54, 55
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -775,25 +787,25 @@ static const yytype_int16 yycheck[] =
static const yytype_uint8 yystos[] =
{
0, 1, 7, 8, 9, 10, 17, 19, 20, 21,
- 24, 25, 26, 31, 32, 33, 45, 46, 51, 57,
- 58, 59, 60, 61, 65, 66, 67, 72, 73, 75,
- 78, 82, 51, 51, 69, 10, 74, 11, 18, 23,
- 27, 28, 29, 30, 35, 76, 77, 10, 11, 10,
- 10, 31, 59, 72, 36, 37, 10, 72, 72, 72,
- 0, 50, 51, 44, 51, 64, 72, 38, 39, 43,
- 45, 46, 47, 48, 53, 54, 72, 83, 83, 83,
- 55, 11, 11, 27, 11, 18, 27, 35, 77, 79,
- 72, 22, 10, 35, 44, 52, 58, 64, 72, 64,
- 72, 34, 44, 72, 72, 72, 72, 72, 72, 72,
- 72, 72, 52, 55, 52, 10, 11, 11, 11, 69,
- 10, 72, 72, 52, 70, 52, 50, 69, 72, 72,
- 10, 80, 71, 13, 35, 71, 60, 73, 50, 55,
- 50, 60, 70, 35, 72, 70, 70, 55, 81, 10,
- 16, 72, 70, 14, 16, 69, 50, 10, 71, 32,
- 70, 71, 71, 21, 15, 62, 63, 68, 14, 71,
- 70, 70, 63, 70, 64, 69, 70, 16, 16, 16,
- 34, 60, 16, 32, 21, 21, 69, 71, 70, 32,
- 60, 70, 50, 70, 50
+ 24, 25, 26, 31, 32, 33, 46, 47, 52, 58,
+ 59, 60, 61, 62, 63, 68, 69, 70, 75, 76,
+ 78, 81, 85, 52, 52, 72, 10, 77, 11, 18,
+ 23, 27, 28, 29, 30, 35, 79, 80, 10, 11,
+ 10, 10, 31, 60, 75, 36, 37, 10, 75, 75,
+ 75, 0, 51, 52, 45, 52, 67, 75, 39, 40,
+ 44, 46, 47, 48, 49, 54, 55, 75, 86, 86,
+ 86, 56, 11, 11, 27, 11, 18, 27, 35, 80,
+ 82, 75, 22, 10, 35, 45, 53, 59, 67, 75,
+ 67, 75, 34, 45, 75, 75, 75, 75, 75, 75,
+ 75, 75, 75, 53, 56, 53, 10, 11, 11, 11,
+ 72, 10, 75, 75, 53, 73, 53, 51, 72, 75,
+ 75, 10, 83, 74, 13, 35, 74, 61, 76, 51,
+ 56, 51, 62, 73, 35, 75, 73, 73, 56, 84,
+ 10, 16, 75, 73, 14, 16, 72, 38, 64, 10,
+ 74, 32, 73, 74, 74, 21, 15, 65, 66, 71,
+ 72, 73, 74, 73, 73, 66, 73, 67, 61, 73,
+ 16, 16, 16, 34, 16, 32, 21, 21, 72, 74,
+ 32, 62, 73, 73, 51
};
#define yyerrok (yyerrstatus = 0)
@@ -1648,12 +1660,12 @@ yyreduce:
break;
case 14:
-#line 126 "engines/director/lingo/lingo-gr.y"
+#line 125 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 17:
-#line 133 "engines/director/lingo/lingo-gr.y"
+ case 18:
+#line 134 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1662,8 +1674,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
- case 18:
-#line 144 "engines/director/lingo/lingo-gr.y"
+ case 19:
+#line 145 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1678,8 +1690,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
break;
- case 19:
-#line 160 "engines/director/lingo/lingo-gr.y"
+ case 20:
+#line 161 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1694,8 +1706,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
break;
- case 20:
-#line 174 "engines/director/lingo/lingo-gr.y"
+ case 21:
+#line 175 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (8)].code));
@@ -1705,20 +1717,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 21:
-#line 181 "engines/director/lingo/lingo-gr.y"
- {
- inst then = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
- WRITE_UINT32(&end, (yyvsp[(6) - (7)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; /* end, if cond fails */
-
- g_lingo->processIf(0, 0); ;}
- break;
-
case 22:
-#line 189 "engines/director/lingo/lingo-gr.y"
+#line 182 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1731,21 +1731,7 @@ yyreduce:
break;
case 23:
-#line 198 "engines/director/lingo/lingo-gr.y"
- {
- inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (12)].code));
- WRITE_UINT32(&else1, (yyvsp[(9) - (12)].code));
- WRITE_UINT32(&end, (yyvsp[(11) - (12)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; /* end, if cond fails */
-
- g_lingo->processIf(0, 0); ;}
- break;
-
- case 24:
-#line 208 "engines/director/lingo/lingo-gr.y"
+#line 191 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1757,8 +1743,32 @@ yyreduce:
g_lingo->processIf(0, (yyvsp[(9) - (11)].code)); ;}
break;
- case 27:
-#line 223 "engines/director/lingo/lingo-gr.y"
+ case 24:
+#line 200 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(4) - (8)].code));
+ WRITE_UINT32(&else1, (yyvsp[(7) - (8)].code));
+ WRITE_UINT32(&end, (yyvsp[(8) - (8)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 3] = end; /* end, if cond fails */
+
+ g_lingo->processIf(0, 0); ;}
+ break;
+
+ case 25:
+#line 211 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = 0; ;}
+ break;
+
+ case 26:
+#line 212 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+ break;
+
+ case 29:
+#line 219 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
@@ -1767,8 +1777,8 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (7)].code)); ;}
break;
- case 28:
-#line 229 "engines/director/lingo/lingo-gr.y"
+ case 30:
+#line 225 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
@@ -1777,23 +1787,23 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (5)].code)); ;}
break;
- case 29:
-#line 237 "engines/director/lingo/lingo-gr.y"
+ case 31:
+#line 233 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 30:
-#line 238 "engines/director/lingo/lingo-gr.y"
+ case 32:
+#line 234 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 32:
-#line 241 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 237 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 33:
-#line 243 "engines/director/lingo/lingo-gr.y"
+ case 35:
+#line 239 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1801,8 +1811,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 34:
-#line 249 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 245 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -1810,8 +1820,8 @@ yyreduce:
g_lingo->codeLabel(0); ;}
break;
- case 35:
-#line 255 "engines/director/lingo/lingo-gr.y"
+ case 37:
+#line 251 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -1820,23 +1830,23 @@ yyreduce:
g_lingo->code1(skipEnd); ;}
break;
- case 36:
-#line 262 "engines/director/lingo/lingo-gr.y"
+ case 38:
+#line 258 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 37:
-#line 264 "engines/director/lingo/lingo-gr.y"
+ case 39:
+#line 260 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 38:
-#line 266 "engines/director/lingo/lingo-gr.y"
+ case 40:
+#line 262 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 41:
-#line 271 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 267 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1844,15 +1854,15 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 42:
-#line 276 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 272 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
- case 43:
-#line 279 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 275 "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));
@@ -1861,8 +1871,8 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 44:
-#line 285 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 281 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1873,121 +1883,121 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 45:
-#line 293 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 289 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 47:
-#line 297 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 293 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 48:
-#line 298 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 294 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 49:
-#line 299 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 295 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 50:
-#line 300 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 296 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 51:
-#line 301 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 297 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 52:
-#line 302 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 298 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 53:
-#line 303 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 299 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 54:
-#line 304 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 300 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 55:
-#line 305 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 301 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 56:
-#line 306 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 302 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 57:
-#line 307 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 303 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 58:
-#line 308 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 304 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 59:
-#line 311 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 307 "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 60:
-#line 312 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 308 "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 61:
-#line 313 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 309 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 63:
-#line 315 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 311 "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 65:
-#line 320 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 316 "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 66:
-#line 321 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 317 "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 67:
-#line 332 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 328 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 68:
-#line 333 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 329 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 69:
-#line 334 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 330 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 70:
-#line 335 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 331 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -1995,8 +2005,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 71:
-#line 340 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 336 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2005,8 +2015,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 72:
-#line 346 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 342 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2014,48 +2024,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 73:
-#line 353 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 349 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 74:
-#line 354 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 350 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 75:
-#line 355 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 351 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 76:
-#line 356 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 352 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 77:
-#line 359 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 355 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 78:
-#line 360 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 356 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 79:
-#line 361 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 357 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 80:
-#line 389 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 385 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 81:
-#line 390 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 386 "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);
@@ -2063,33 +2073,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 82:
-#line 396 "engines/director/lingo/lingo-gr.y"
+ case 84:
+#line 392 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 83:
-#line 397 "engines/director/lingo/lingo-gr.y"
+ case 85:
+#line 393 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 84:
-#line 398 "engines/director/lingo/lingo-gr.y"
+ case 86:
+#line 394 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 85:
-#line 399 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 395 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 86:
-#line 401 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 397 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 87:
-#line 404 "engines/director/lingo/lingo-gr.y"
+ case 89:
+#line 400 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2098,24 +2108,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 88:
-#line 412 "engines/director/lingo/lingo-gr.y"
+ case 90:
+#line 408 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 89:
-#line 413 "engines/director/lingo/lingo-gr.y"
+ case 91:
+#line 409 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 90:
-#line 414 "engines/director/lingo/lingo-gr.y"
+ case 92:
+#line 410 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2119 "engines/director/lingo/lingo-gr.cpp"
+#line 2129 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2329,6 +2339,6 @@ yyreturn:
}
-#line 417 "engines/director/lingo/lingo-gr.y"
+#line 413 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 4216ad6..62462ae 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -51,7 +51,7 @@
HANDLER = 267,
tDOWN = 268,
tELSE = 269,
- tELSIF = 270,
+ tNLELSIF = 270,
tEND = 271,
tEXIT = 272,
tFRAME = 273,
@@ -74,12 +74,13 @@
tTO = 290,
tWITH = 291,
tWHILE = 292,
- tGE = 293,
- tLE = 294,
- tGT = 295,
- tLT = 296,
- tEQ = 297,
- tNEQ = 298
+ tNLELSE = 293,
+ tGE = 294,
+ tLE = 295,
+ tGT = 296,
+ tLT = 297,
+ tEQ = 298,
+ tNEQ = 299
};
#endif
/* Tokens. */
@@ -95,7 +96,7 @@
#define HANDLER 267
#define tDOWN 268
#define tELSE 269
-#define tELSIF 270
+#define tNLELSIF 270
#define tEND 271
#define tEXIT 272
#define tFRAME 273
@@ -118,12 +119,13 @@
#define tTO 290
#define tWITH 291
#define tWHILE 292
-#define tGE 293
-#define tLE 294
-#define tGT 295
-#define tLT 296
-#define tEQ 297
-#define tNEQ 298
+#define tNLELSE 293
+#define tGE 294
+#define tLE 295
+#define tGT 296
+#define tLT 297
+#define tEQ 298
+#define tNEQ 299
@@ -139,7 +141,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 143 "engines/director/lingo/lingo-gr.hpp"
+#line 145 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index b337912..d65e683 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -74,12 +74,12 @@ using namespace Director;
%token<i> INT
%token<f> FLOAT
%token<s> BLTIN ID STRING HANDLER
-%token tDOWN tELSE tELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
+%token tDOWN tELSE tNLELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
%token tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO
-%token tWITH tWHILE
+%token tWITH tWHILE tNLELSE
%token tGE tLE tGT tLT tEQ tNEQ
-%type<code> asgn begin elseif end expr if repeatwhile repeatwith stmtlist
+%type<code> asgn begin elseif elsestmt end expr if repeatwhile repeatwith stmtlist
%type<s> gotoframe gotomovie
%type<narg> argdef arglist
@@ -122,9 +122,10 @@ asgn: tPUT expr tINTO ID {
$$ = $4;
delete $2; }
;
-
-stmt: expr { g_lingo->code1(g_lingo->c_xpop); }
+stmtoneliner: expr { g_lingo->code1(g_lingo->c_xpop); }
| func
+ ;
+stmt: stmtoneliner
| ifstmt
// repeat while (expression = TRUE)
// statements
@@ -178,14 +179,6 @@ ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN begin stmt end '\n' {
- inst then = 0, end = 0;
- WRITE_UINT32(&then, $4);
- WRITE_UINT32(&end, $6);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
-
- g_lingo->processIf(0, 0); }
| if cond tTHEN '\n' stmtlist end tELSE stmtlist end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
@@ -195,16 +188,6 @@ ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN begin stmt end '\n' tELSE begin stmt end '\n' {
- inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, $4);
- WRITE_UINT32(&else1, $9);
- WRITE_UINT32(&end, $11);
- (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
-
- g_lingo->processIf(0, 0); }
| if cond tTHEN '\n' stmtlist end begin elseifstmt end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
@@ -214,6 +197,19 @@ ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, $9); }
+ | if cond tTHEN begin stmtoneliner end elsestmt end {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&else1, $7);
+ WRITE_UINT32(&end, $8);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
+
+ g_lingo->processIf(0, 0); }
+ ;
+elsestmt: /* nothing */ { $$ = 0; }
+ | tNLELSE begin stmtoneliner { $$ = $2; }
;
elseifstmt: elseifstmt elseifstmt1
@@ -252,7 +248,7 @@ if: tIF {
g_lingo->code1(0); // Do not skip end
g_lingo->codeLabel(0); } // Mark beginning of the if() statement
;
-elseif: tELSIF {
+elseif: tNLELSIF {
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
$$ = g_lingo->code1(g_lingo->c_ifcode);
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 6abaa99..d302e38 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 39
-#define YY_END_OF_BUFFER 40
+#define YY_NUM_RULES 40
+#define YY_END_OF_BUFFER 41
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,22 +373,23 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[126] =
+static yyconst flex_int16_t yy_accept[132] =
{ 0,
- 0, 0, 40, 38, 3, 36, 36, 38, 38, 38,
- 35, 35, 34, 35, 35, 32, 32, 32, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
- 2, 2, 3, 36, 0, 29, 0, 37, 1, 33,
- 34, 31, 30, 32, 32, 32, 32, 32, 32, 32,
- 12, 5, 32, 32, 32, 32, 32, 32, 20, 32,
- 32, 32, 32, 32, 26, 32, 32, 2, 2, 1,
- 33, 32, 32, 8, 32, 32, 32, 32, 32, 32,
- 16, 32, 32, 32, 22, 32, 24, 32, 32, 32,
- 4, 7, 9, 32, 32, 13, 14, 32, 32, 32,
-
- 19, 32, 32, 25, 32, 27, 0, 10, 32, 15,
- 32, 18, 32, 32, 28, 0, 11, 32, 32, 23,
- 6, 17, 32, 21, 0
+ 0, 0, 41, 39, 3, 37, 37, 39, 39, 39,
+ 36, 36, 35, 36, 36, 33, 33, 33, 33, 33,
+ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
+ 2, 2, 3, 37, 0, 0, 37, 30, 0, 38,
+ 1, 34, 35, 32, 31, 33, 33, 33, 33, 33,
+ 33, 33, 13, 5, 33, 33, 33, 33, 33, 33,
+ 21, 33, 33, 33, 33, 33, 27, 33, 33, 2,
+ 2, 0, 1, 34, 33, 33, 9, 33, 33, 33,
+ 33, 33, 33, 17, 33, 33, 33, 23, 33, 25,
+ 33, 33, 33, 0, 4, 8, 10, 33, 33, 14,
+
+ 15, 33, 33, 33, 20, 33, 33, 26, 33, 28,
+ 0, 11, 33, 16, 33, 19, 33, 33, 29, 7,
+ 12, 33, 33, 24, 0, 18, 33, 0, 22, 6,
+ 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -433,126 +434,132 @@ static yyconst flex_int32_t yy_meta[58] =
4, 4, 4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[129] =
+static yyconst flex_int16_t yy_base[135] =
{ 0,
- 0, 56, 218, 295, 60, 56, 63, 66, 199, 167,
- 295, 164, 62, 158, 157, 0, 46, 50, 46, 53,
- 62, 51, 75, 64, 64, 78, 68, 72, 93, 94,
- 123, 131, 141, 90, 145, 295, 161, 295, 0, 147,
- 108, 295, 295, 0, 45, 89, 112, 108, 125, 123,
- 0, 0, 122, 127, 139, 134, 125, 124, 0, 142,
- 131, 135, 133, 147, 0, 144, 137, 189, 193, 0,
- 112, 155, 158, 0, 155, 174, 185, 176, 176, 176,
- 172, 179, 177, 176, 0, 192, 0, 186, 189, 193,
- 0, 83, 0, 197, 202, 0, 0, 191, 205, 203,
-
- 0, 206, 217, 0, 217, 0, 241, 0, 216, 0,
- 222, 0, 219, 216, 0, 229, 0, 220, 220, 0,
- 295, 0, 224, 0, 295, 286, 118, 290
+ 0, 56, 212, 320, 60, 64, 68, 72, 175, 180,
+ 320, 174, 49, 169, 167, 0, 50, 54, 50, 57,
+ 66, 55, 79, 68, 68, 82, 72, 76, 97, 98,
+ 127, 135, 145, 94, 149, 153, 157, 320, 167, 320,
+ 0, 158, 112, 320, 320, 0, 49, 93, 116, 112,
+ 129, 135, 0, 0, 132, 137, 150, 145, 136, 135,
+ 0, 154, 143, 147, 145, 159, 0, 156, 149, 201,
+ 205, 168, 0, 116, 172, 192, 0, 181, 189, 200,
+ 190, 190, 191, 187, 200, 193, 192, 0, 208, 0,
+ 202, 205, 209, 204, 0, 0, 0, 213, 222, 0,
+
+ 0, 213, 229, 229, 0, 229, 240, 0, 238, 0,
+ 239, 0, 235, 0, 238, 0, 235, 232, 0, 87,
+ 0, 233, 234, 0, 266, 0, 238, 252, 0, 320,
+ 320, 311, 122, 315
} ;
-static yyconst flex_int16_t yy_def[129] =
+static yyconst flex_int16_t yy_def[135] =
{ 0,
- 125, 1, 125, 125, 125, 125, 125, 125, 125, 126,
- 125, 125, 125, 125, 125, 127, 127, 127, 127, 127,
- 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
- 125, 125, 125, 125, 125, 125, 126, 125, 128, 125,
- 125, 125, 125, 127, 127, 127, 127, 127, 127, 127,
- 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
- 127, 127, 127, 127, 127, 127, 127, 125, 125, 128,
- 125, 127, 127, 127, 127, 127, 127, 127, 127, 127,
- 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
- 127, 127, 127, 127, 127, 127, 127, 127, 127, 127,
-
- 127, 127, 127, 127, 127, 127, 125, 127, 127, 127,
- 127, 127, 127, 127, 127, 125, 127, 127, 127, 127,
- 125, 127, 127, 127, 0, 125, 125, 125
+ 131, 1, 131, 131, 131, 131, 131, 131, 131, 132,
+ 131, 131, 131, 131, 131, 133, 133, 133, 133, 133,
+ 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
+ 131, 131, 131, 131, 131, 131, 131, 131, 132, 131,
+ 134, 131, 131, 131, 131, 133, 133, 133, 133, 133,
+ 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
+ 133, 133, 133, 133, 133, 133, 133, 133, 133, 131,
+ 131, 131, 134, 131, 133, 133, 133, 133, 133, 133,
+ 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
+ 133, 133, 133, 131, 133, 133, 133, 133, 133, 133,
+
+ 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
+ 131, 133, 133, 133, 133, 133, 133, 133, 133, 131,
+ 133, 133, 133, 133, 131, 133, 133, 131, 133, 131,
+ 0, 131, 131, 131
} ;
-static yyconst flex_int16_t yy_nxt[353] =
+static yyconst flex_int16_t yy_nxt[378] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
13, 14, 11, 15, 16, 16, 16, 17, 18, 19,
20, 16, 21, 16, 22, 23, 24, 25, 26, 27,
28, 29, 16, 16, 30, 16, 16, 16, 16, 17,
18, 19, 20, 16, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 16, 16, 30, 16, 31, 34, 34,
- 32, 33, 34, 34, 35, 34, 34, 35, 34, 34,
- 35, 40, 41, 45, 46, 49, 47, 50, 54, 72,
- 51, 52, 58, 59, 107, 48, 62, 107, 53, 55,
- 63, 56, 34, 34, 45, 46, 49, 47, 50, 54,
-
- 72, 51, 57, 52, 58, 59, 48, 60, 62, 53,
- 61, 55, 63, 56, 64, 66, 67, 40, 41, 73,
- 65, 44, 71, 57, 68, 34, 34, 69, 60, 74,
- 75, 61, 69, 34, 34, 69, 64, 66, 67, 76,
- 73, 65, 33, 34, 34, 35, 35, 34, 34, 35,
- 77, 74, 75, 78, 79, 80, 81, 71, 82, 83,
- 84, 76, 85, 86, 87, 88, 89, 38, 90, 43,
- 42, 77, 39, 38, 78, 79, 92, 80, 81, 82,
- 83, 91, 84, 85, 86, 87, 93, 88, 89, 90,
- 68, 34, 34, 69, 69, 34, 34, 69, 92, 94,
-
- 95, 100, 91, 96, 97, 98, 99, 93, 101, 102,
- 103, 36, 104, 105, 106, 108, 109, 125, 110, 111,
- 94, 112, 95, 100, 96, 97, 98, 99, 113, 101,
- 102, 114, 103, 104, 105, 115, 106, 108, 109, 110,
- 117, 111, 107, 112, 118, 107, 119, 120, 121, 125,
- 113, 122, 123, 114, 124, 125, 125, 115, 125, 125,
- 125, 117, 125, 116, 125, 125, 118, 119, 120, 125,
- 121, 125, 122, 123, 125, 124, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 116, 37, 125, 37, 37,
- 70, 125, 125, 70, 3, 125, 125, 125, 125, 125,
-
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125
+ 27, 28, 29, 16, 16, 30, 16, 31, 42, 43,
+ 32, 33, 34, 34, 35, 36, 37, 37, 36, 36,
+ 37, 37, 36, 35, 34, 34, 35, 47, 48, 51,
+ 49, 52, 56, 75, 53, 54, 60, 61, 125, 50,
+ 64, 125, 55, 57, 65, 58, 34, 34, 47, 48,
+
+ 51, 49, 52, 56, 75, 53, 59, 54, 60, 61,
+ 50, 62, 64, 55, 63, 57, 65, 58, 66, 68,
+ 69, 42, 43, 76, 67, 46, 74, 59, 70, 34,
+ 34, 71, 62, 77, 78, 63, 71, 34, 34, 71,
+ 66, 68, 69, 79, 76, 67, 33, 34, 34, 35,
+ 35, 34, 34, 35, 36, 77, 78, 36, 36, 37,
+ 37, 36, 80, 81, 82, 79, 83, 84, 74, 85,
+ 86, 72, 87, 40, 88, 89, 90, 91, 92, 45,
+ 93, 44, 41, 80, 81, 82, 40, 38, 83, 84,
+ 85, 86, 94, 72, 87, 88, 89, 90, 95, 91,
+
+ 92, 93, 70, 34, 34, 71, 71, 34, 34, 71,
+ 96, 131, 97, 94, 98, 99, 131, 100, 101, 95,
+ 102, 103, 104, 131, 105, 106, 107, 131, 108, 109,
+ 110, 112, 96, 97, 111, 98, 113, 99, 100, 101,
+ 114, 102, 103, 115, 104, 105, 106, 116, 107, 108,
+ 109, 117, 110, 112, 118, 111, 119, 120, 113, 121,
+ 122, 114, 123, 124, 126, 115, 127, 125, 129, 116,
+ 125, 130, 131, 117, 131, 131, 118, 131, 119, 120,
+ 121, 131, 122, 123, 124, 126, 131, 127, 128, 129,
+ 131, 131, 131, 130, 131, 131, 131, 131, 131, 131,
+
+ 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
+ 128, 39, 131, 39, 39, 73, 131, 131, 73, 3,
+ 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
+ 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
+ 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
+ 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
+ 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
+ 131, 131, 131, 131, 131, 131, 131
} ;
-static yyconst flex_int16_t yy_chk[353] =
+static yyconst flex_int16_t yy_chk[378] =
{ 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, 6, 6,
- 2, 5, 5, 5, 5, 7, 7, 8, 8, 8,
- 8, 13, 13, 17, 18, 19, 18, 20, 22, 45,
- 20, 21, 24, 25, 92, 18, 27, 92, 21, 23,
- 28, 23, 34, 34, 17, 18, 19, 18, 20, 22,
-
- 45, 20, 23, 21, 24, 25, 18, 26, 27, 21,
- 26, 23, 28, 23, 29, 30, 30, 41, 41, 46,
- 29, 127, 71, 23, 31, 31, 31, 31, 26, 47,
- 48, 26, 32, 32, 32, 32, 29, 30, 30, 49,
- 46, 29, 33, 33, 33, 33, 35, 35, 35, 35,
- 50, 47, 48, 53, 54, 55, 56, 40, 57, 58,
- 60, 49, 61, 62, 63, 64, 66, 37, 67, 15,
- 14, 50, 12, 10, 53, 54, 73, 55, 56, 57,
- 58, 72, 60, 61, 62, 63, 75, 64, 66, 67,
- 68, 68, 68, 68, 69, 69, 69, 69, 73, 76,
-
- 77, 82, 72, 78, 79, 80, 81, 75, 83, 84,
- 86, 9, 88, 89, 90, 94, 95, 3, 98, 99,
- 76, 100, 77, 82, 78, 79, 80, 81, 102, 83,
- 84, 103, 86, 88, 89, 105, 90, 94, 95, 98,
- 109, 99, 107, 100, 111, 107, 113, 114, 116, 0,
- 102, 118, 119, 103, 123, 0, 0, 105, 0, 0,
- 0, 109, 0, 107, 0, 0, 111, 113, 114, 0,
- 116, 0, 118, 119, 0, 123, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 107, 126, 0, 126, 126,
- 128, 0, 0, 128, 125, 125, 125, 125, 125, 125,
-
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,
- 125, 125
+ 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, 17, 18, 19,
+ 18, 20, 22, 47, 20, 21, 24, 25, 120, 18,
+ 27, 120, 21, 23, 28, 23, 34, 34, 17, 18,
+
+ 19, 18, 20, 22, 47, 20, 23, 21, 24, 25,
+ 18, 26, 27, 21, 26, 23, 28, 23, 29, 30,
+ 30, 43, 43, 48, 29, 133, 74, 23, 31, 31,
+ 31, 31, 26, 49, 50, 26, 32, 32, 32, 32,
+ 29, 30, 30, 51, 48, 29, 33, 33, 33, 33,
+ 35, 35, 35, 35, 36, 49, 50, 36, 37, 37,
+ 37, 37, 52, 55, 56, 51, 57, 58, 42, 59,
+ 60, 36, 62, 39, 63, 64, 65, 66, 68, 15,
+ 69, 14, 12, 52, 55, 56, 10, 9, 57, 58,
+ 59, 60, 72, 36, 62, 63, 64, 65, 75, 66,
+
+ 68, 69, 70, 70, 70, 70, 71, 71, 71, 71,
+ 76, 3, 78, 72, 79, 80, 0, 81, 82, 75,
+ 83, 84, 85, 0, 86, 87, 89, 0, 91, 92,
+ 93, 98, 76, 78, 94, 79, 99, 80, 81, 82,
+ 102, 83, 84, 103, 85, 86, 87, 104, 89, 91,
+ 92, 106, 93, 98, 107, 94, 109, 111, 99, 113,
+ 115, 102, 117, 118, 122, 103, 123, 125, 127, 104,
+ 125, 128, 0, 106, 0, 0, 107, 0, 109, 111,
+ 113, 0, 115, 117, 118, 122, 0, 123, 125, 127,
+ 0, 0, 0, 128, 0, 0, 0, 0, 0, 0,
+
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 125, 132, 0, 132, 132, 134, 0, 0, 134, 131,
+ 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
+ 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
+ 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
+ 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
+ 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
+ 131, 131, 131, 131, 131, 131, 131
} ;
static yy_state_type yy_last_accepting_state;
@@ -602,7 +609,7 @@ char *yytext;
int yyparse();
-#line 606 "engines/director/lingo/lingo-lex.cpp"
+#line 613 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -790,7 +797,7 @@ YY_DECL
#line 45 "engines/director/lingo/lingo-lex.l"
-#line 794 "engines/director/lingo/lingo-lex.cpp"
+#line 801 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -844,13 +851,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 >= 126 )
+ if ( yy_current_state >= 132 )
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] != 295 );
+ while ( yy_base[yy_current_state] != 320 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -900,138 +907,145 @@ YY_RULE_SETUP
{ return tIF; }
YY_BREAK
case 6:
+/* rule 6 can match eol */
YY_RULE_SETUP
#line 53 "engines/director/lingo/lingo-lex.l"
-{ return tELSIF; }
+{ return tNLELSIF; }
YY_BREAK
case 7:
+/* rule 7 can match eol */
YY_RULE_SETUP
#line 54 "engines/director/lingo/lingo-lex.l"
-{ return tELSE; }
+{ return tNLELSE; }
YY_BREAK
case 8:
YY_RULE_SETUP
#line 55 "engines/director/lingo/lingo-lex.l"
-{ return tEND; }
+{ return tELSE; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 56 "engines/director/lingo/lingo-lex.l"
-{ return tEXIT; }
+{ return tEND; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 57 "engines/director/lingo/lingo-lex.l"
-{ return tFRAME; }
+{ return tEXIT; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 58 "engines/director/lingo/lingo-lex.l"
-{ return tGLOBAL; }
+{ return tFRAME; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 59 "engines/director/lingo/lingo-lex.l"
-{ return tGO; }
+{ return tGLOBAL; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 60 "engines/director/lingo/lingo-lex.l"
-{ return tINTO; }
+{ return tGO; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 61 "engines/director/lingo/lingo-lex.l"
-{ return tLOOP; }
+{ return tINTO; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 62 "engines/director/lingo/lingo-lex.l"
-{ return tMACRO; }
+{ return tLOOP; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 63 "engines/director/lingo/lingo-lex.l"
-{ return tMCI; }
+{ return tMACRO; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 64 "engines/director/lingo/lingo-lex.l"
-{ return tMCIWAIT; }
+{ return tMCI; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 65 "engines/director/lingo/lingo-lex.l"
-{ return tMOVIE; }
+{ return tMCIWAIT; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 66 "engines/director/lingo/lingo-lex.l"
-{ return tNEXT; }
+{ return tMOVIE; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 67 "engines/director/lingo/lingo-lex.l"
-{ return tOF; }
+{ return tNEXT; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 68 "engines/director/lingo/lingo-lex.l"
-{ return tPREVIOUS; }
+{ return tOF; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 69 "engines/director/lingo/lingo-lex.l"
-{ return tPUT; }
+{ return tPREVIOUS; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 70 "engines/director/lingo/lingo-lex.l"
-{ return tREPEAT; }
+{ return tPUT; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 71 "engines/director/lingo/lingo-lex.l"
-{ return tSET; }
+{ return tREPEAT; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 72 "engines/director/lingo/lingo-lex.l"
-{ return tTHEN; }
+{ return tSET; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 73 "engines/director/lingo/lingo-lex.l"
-{ return tTO; }
+{ return tTHEN; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 74 "engines/director/lingo/lingo-lex.l"
-{ return tWITH; }
+{ return tTO; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 75 "engines/director/lingo/lingo-lex.l"
-{ return tWHILE; }
+{ return tWITH; }
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 77 "engines/director/lingo/lingo-lex.l"
-{ return tNEQ; }
+#line 76 "engines/director/lingo/lingo-lex.l"
+{ return tWHILE; }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 78 "engines/director/lingo/lingo-lex.l"
-{ return tGE; }
+{ return tNEQ; }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 79 "engines/director/lingo/lingo-lex.l"
-{ return tLE; }
+{ return tGE; }
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 81 "engines/director/lingo/lingo-lex.l"
+#line 80 "engines/director/lingo/lingo-lex.l"
+{ return tLE; }
+ YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 82 "engines/director/lingo/lingo-lex.l"
{
yylval.s = new Common::String(yytext);
@@ -1041,43 +1055,43 @@ YY_RULE_SETUP
return ID;
}
YY_BREAK
-case 33:
-YY_RULE_SETUP
-#line 89 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
- YY_BREAK
case 34:
YY_RULE_SETUP
#line 90 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 35:
YY_RULE_SETUP
#line 91 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+{ yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 36:
-/* rule 36 can match eol */
YY_RULE_SETUP
#line 92 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ return *yytext; }
YY_BREAK
case 37:
+/* rule 37 can match eol */
YY_RULE_SETUP
#line 93 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return '\n'; }
YY_BREAK
case 38:
YY_RULE_SETUP
#line 94 "engines/director/lingo/lingo-lex.l"
-
+{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 96 "engines/director/lingo/lingo-lex.l"
+#line 95 "engines/director/lingo/lingo-lex.l"
+
+ YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 97 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1081 "engines/director/lingo/lingo-lex.cpp"
+#line 1095 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1370,7 +1384,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 >= 126 )
+ if ( yy_current_state >= 132 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1398,11 +1412,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 >= 126 )
+ if ( yy_current_state >= 132 )
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 == 125);
+ yy_is_jam = (yy_current_state == 131);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2077,7 +2091,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 96 "engines/director/lingo/lingo-lex.l"
+#line 97 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 8ad8733..c340bd6 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -50,7 +50,8 @@ whitespace [\t ]
(?i:down) { return tDOWN; }
(?i:if) { return tIF; }
-(?i:else[\t ]+if) { return tELSIF; }
+(?i:[\n\r]+[\t ]+else[\t ]+if) { return tNLELSIF; }
+(?i:[\n\r]+[\t ]+else) { return tNLELSE; }
(?i:else) { return tELSE; }
(?i:end) { return tEND; }
(?i:exit) { return tEXIT; }
Commit: 1745917752f5ec85f8a3b2b65dc1b2321aa576ab
https://github.com/scummvm/scummvm/commit/1745917752f5ec85f8a3b2b65dc1b2321aa576ab
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Further work on combined if statements
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 539846a..29b62e2 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -109,6 +109,9 @@ Common::Error DirectorEngine::run() {
_currentScore = nullptr;
_lingo->addCode("--\n\
+ if x = 3 then exit\n\
+ else if x = 4 then put 4\n\
+ else put 10.0\n\
set x = 1\n\
if x = 5 then exit\n\
else put 10.0\n\
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 50370da..2b8e37a 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -432,16 +432,16 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 61
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 389
+#define YYLAST 383
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 57
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 30
+#define YYNNTS 31
/* YYNRULES -- Number of rules. */
-#define YYNRULES 92
+#define YYNRULES 95
/* YYNRULES -- Number of states. */
-#define YYNSTATES 195
+#define YYNSTATES 204
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -492,53 +492,55 @@ static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
20, 22, 27, 32, 37, 39, 41, 43, 45, 54,
- 66, 79, 88, 100, 112, 121, 122, 126, 129, 131,
- 139, 145, 147, 151, 155, 158, 162, 164, 166, 167,
- 168, 169, 172, 175, 177, 179, 184, 189, 191, 193,
- 197, 201, 205, 209, 213, 217, 221, 225, 229, 232,
- 235, 239, 242, 245, 248, 250, 252, 255, 257, 261,
- 264, 267, 270, 273, 277, 280, 284, 287, 290, 292,
- 296, 299, 303, 304, 313, 314, 316, 320, 325, 326,
- 330, 331, 333
+ 66, 79, 88, 100, 112, 119, 130, 141, 142, 146,
+ 149, 151, 158, 160, 166, 168, 172, 176, 179, 183,
+ 185, 187, 188, 189, 190, 193, 196, 198, 200, 205,
+ 210, 212, 214, 218, 222, 226, 230, 234, 238, 242,
+ 246, 250, 253, 256, 260, 263, 266, 269, 271, 273,
+ 276, 278, 282, 285, 288, 291, 294, 298, 301, 305,
+ 308, 311, 313, 317, 320, 324, 325, 334, 335, 337,
+ 341, 346, 347, 351, 352, 354
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
58, 0, -1, 58, 51, 59, -1, 59, -1, -1,
- 81, -1, 76, -1, 85, -1, 60, -1, 62, -1,
- 1, -1, 31, 75, 22, 10, -1, 33, 10, 45,
- 75, -1, 33, 10, 35, 75, -1, 75, -1, 76,
- -1, 61, -1, 63, -1, 68, 52, 67, 53, 74,
- 73, 16, 32, -1, 69, 45, 75, 73, 35, 75,
- 73, 74, 73, 16, 32, -1, 69, 45, 75, 73,
- 13, 35, 75, 73, 74, 73, 16, 32, -1, 70,
- 67, 34, 51, 74, 73, 16, 21, -1, 70, 67,
- 34, 51, 74, 73, 14, 74, 73, 16, 21, -1,
- 70, 67, 34, 51, 74, 73, 72, 65, 73, 16,
- 21, -1, 70, 67, 34, 72, 61, 73, 64, 73,
- -1, -1, 38, 72, 61, -1, 65, 66, -1, 66,
- -1, 71, 67, 34, 72, 62, 73, 51, -1, 71,
- 67, 34, 74, 73, -1, 75, -1, 75, 45, 75,
- -1, 52, 67, 53, -1, 32, 37, -1, 32, 36,
- 10, -1, 21, -1, 15, -1, -1, -1, -1, 74,
- 51, -1, 74, 62, -1, 7, -1, 8, -1, 9,
- 52, 86, 53, -1, 10, 52, 86, 53, -1, 10,
- -1, 60, -1, 75, 46, 75, -1, 75, 47, 75,
- -1, 75, 48, 75, -1, 75, 49, 75, -1, 75,
- 54, 75, -1, 75, 55, 75, -1, 75, 44, 75,
- -1, 75, 39, 75, -1, 75, 40, 75, -1, 46,
- 75, -1, 47, 75, -1, 52, 75, 53, -1, 25,
- 11, -1, 26, 10, -1, 31, 75, -1, 78, -1,
- 17, -1, 19, 77, -1, 10, -1, 77, 56, 10,
- -1, 20, 23, -1, 20, 28, -1, 20, 30, -1,
- 20, 79, -1, 20, 79, 80, -1, 20, 80, -1,
- 35, 18, 11, -1, 18, 11, -1, 35, 11, -1,
- 11, -1, 29, 27, 11, -1, 27, 11, -1, 35,
- 27, 11, -1, -1, 24, 10, 82, 72, 83, 51,
- 84, 74, -1, -1, 10, -1, 83, 56, 10, -1,
- 83, 51, 56, 10, -1, -1, 10, 72, 86, -1,
- -1, 75, -1, 86, 56, 75, -1
+ 82, -1, 77, -1, 86, -1, 60, -1, 62, -1,
+ 1, -1, 31, 76, 22, 10, -1, 33, 10, 45,
+ 76, -1, 33, 10, 35, 76, -1, 76, -1, 77,
+ -1, 61, -1, 63, -1, 69, 52, 68, 53, 75,
+ 74, 16, 32, -1, 70, 45, 76, 74, 35, 76,
+ 74, 75, 74, 16, 32, -1, 70, 45, 76, 74,
+ 13, 35, 76, 74, 75, 74, 16, 32, -1, 71,
+ 68, 34, 51, 75, 74, 16, 21, -1, 71, 68,
+ 34, 51, 75, 74, 14, 75, 74, 16, 21, -1,
+ 71, 68, 34, 51, 75, 74, 73, 65, 74, 16,
+ 21, -1, 71, 68, 34, 73, 61, 74, -1, 71,
+ 68, 34, 73, 61, 74, 38, 73, 61, 74, -1,
+ 71, 68, 34, 73, 61, 74, 66, 74, 64, 74,
+ -1, -1, 38, 73, 61, -1, 65, 67, -1, 67,
+ -1, 72, 68, 34, 73, 62, 74, -1, 66, -1,
+ 72, 68, 34, 75, 74, -1, 76, -1, 76, 45,
+ 76, -1, 52, 68, 53, -1, 32, 37, -1, 32,
+ 36, 10, -1, 21, -1, 15, -1, -1, -1, -1,
+ 75, 51, -1, 75, 62, -1, 7, -1, 8, -1,
+ 9, 52, 87, 53, -1, 10, 52, 87, 53, -1,
+ 10, -1, 60, -1, 76, 46, 76, -1, 76, 47,
+ 76, -1, 76, 48, 76, -1, 76, 49, 76, -1,
+ 76, 54, 76, -1, 76, 55, 76, -1, 76, 44,
+ 76, -1, 76, 39, 76, -1, 76, 40, 76, -1,
+ 46, 76, -1, 47, 76, -1, 52, 76, 53, -1,
+ 25, 11, -1, 26, 10, -1, 31, 76, -1, 79,
+ -1, 17, -1, 19, 78, -1, 10, -1, 78, 56,
+ 10, -1, 20, 23, -1, 20, 28, -1, 20, 30,
+ -1, 20, 80, -1, 20, 80, 81, -1, 20, 81,
+ -1, 35, 18, 11, -1, 18, 11, -1, 35, 11,
+ -1, 11, -1, 29, 27, 11, -1, 27, 11, -1,
+ 35, 27, 11, -1, -1, 24, 10, 83, 73, 84,
+ 51, 85, 75, -1, -1, 10, -1, 84, 56, 10,
+ -1, 84, 51, 56, 10, -1, -1, 10, 73, 87,
+ -1, -1, 76, -1, 87, 56, 76, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -546,14 +548,14 @@ static const yytype_uint16 yyrline[] =
{
0, 93, 93, 94, 97, 98, 99, 100, 101, 102,
103, 106, 112, 118, 125, 126, 128, 129, 134, 145,
- 161, 175, 182, 191, 200, 211, 212, 215, 216, 219,
- 225, 233, 234, 235, 237, 239, 245, 251, 258, 260,
- 262, 263, 264, 267, 272, 275, 281, 289, 292, 293,
- 294, 295, 296, 297, 298, 299, 300, 301, 302, 303,
- 304, 307, 308, 309, 310, 311, 313, 316, 317, 328,
- 329, 330, 331, 336, 342, 349, 350, 351, 352, 355,
- 356, 357, 385, 385, 392, 393, 394, 395, 397, 400,
- 408, 409, 410
+ 161, 175, 182, 191, 200, 210, 220, 231, 232, 235,
+ 236, 239, 246, 247, 255, 256, 257, 259, 261, 267,
+ 273, 280, 282, 284, 285, 286, 289, 294, 297, 303,
+ 311, 314, 315, 316, 317, 318, 319, 320, 321, 322,
+ 323, 324, 325, 326, 329, 330, 331, 332, 333, 335,
+ 338, 339, 350, 351, 352, 353, 358, 364, 371, 372,
+ 373, 374, 377, 378, 379, 407, 407, 414, 415, 416,
+ 417, 419, 422, 430, 431, 432
};
#endif
@@ -570,10 +572,11 @@ static const char *const yytname[] =
"tWHILE", "tNLELSE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='",
"'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'",
"','", "$accept", "program", "programline", "asgn", "stmtoneliner",
- "stmt", "ifstmt", "elsestmt", "elseifstmt", "elseifstmt1", "cond",
- "repeatwhile", "repeatwith", "if", "elseif", "begin", "end", "stmtlist",
- "expr", "func", "globallist", "gotofunc", "gotoframe", "gotomovie",
- "defn", "@1", "argdef", "argstore", "macro", "arglist", 0
+ "stmt", "ifstmt", "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
+ "elseifstmt1", "cond", "repeatwhile", "repeatwith", "if", "elseif",
+ "begin", "end", "stmtlist", "expr", "func", "globallist", "gotofunc",
+ "gotoframe", "gotomovie", "defn", "@1", "argdef", "argstore", "macro",
+ "arglist", 0
};
#endif
@@ -596,14 +599,14 @@ static const yytype_uint8 yyr1[] =
{
0, 57, 58, 58, 59, 59, 59, 59, 59, 59,
59, 60, 60, 60, 61, 61, 62, 62, 62, 62,
- 62, 63, 63, 63, 63, 64, 64, 65, 65, 66,
- 66, 67, 67, 67, 68, 69, 70, 71, 72, 73,
- 74, 74, 74, 75, 75, 75, 75, 75, 75, 75,
- 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
- 75, 76, 76, 76, 76, 76, 76, 77, 77, 78,
- 78, 78, 78, 78, 78, 79, 79, 79, 79, 80,
- 80, 80, 82, 81, 83, 83, 83, 83, 84, 85,
- 86, 86, 86
+ 62, 63, 63, 63, 63, 63, 63, 64, 64, 65,
+ 65, 66, 67, 67, 68, 68, 68, 69, 70, 71,
+ 72, 73, 74, 75, 75, 75, 76, 76, 76, 76,
+ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
+ 76, 76, 76, 76, 77, 77, 77, 77, 77, 77,
+ 78, 78, 79, 79, 79, 79, 79, 79, 80, 80,
+ 80, 80, 81, 81, 81, 83, 82, 84, 84, 84,
+ 84, 85, 86, 87, 87, 87
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -611,14 +614,14 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
1, 4, 4, 4, 1, 1, 1, 1, 8, 11,
- 12, 8, 11, 11, 8, 0, 3, 2, 1, 7,
- 5, 1, 3, 3, 2, 3, 1, 1, 0, 0,
- 0, 2, 2, 1, 1, 4, 4, 1, 1, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 2, 2,
- 3, 2, 2, 2, 1, 1, 2, 1, 3, 2,
- 2, 2, 2, 3, 2, 3, 2, 2, 1, 3,
- 2, 3, 0, 8, 0, 1, 3, 4, 0, 3,
- 0, 1, 3
+ 12, 8, 11, 11, 6, 10, 10, 0, 3, 2,
+ 1, 6, 1, 5, 1, 3, 3, 2, 3, 1,
+ 1, 0, 0, 0, 2, 2, 1, 1, 4, 4,
+ 1, 1, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 2, 2, 3, 2, 2, 2, 1, 1, 2,
+ 1, 3, 2, 2, 2, 2, 3, 2, 3, 2,
+ 2, 1, 3, 2, 3, 0, 8, 0, 1, 3,
+ 4, 0, 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -626,160 +629,164 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 10, 43, 44, 0, 38, 65, 0, 0, 36,
+ 0, 10, 46, 47, 0, 41, 68, 0, 0, 39,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 3, 48, 16, 9, 17, 0, 0, 0, 14, 6,
- 64, 5, 7, 90, 90, 90, 67, 66, 78, 0,
- 69, 0, 70, 0, 71, 0, 72, 74, 82, 61,
- 62, 47, 0, 48, 63, 0, 34, 0, 58, 59,
- 0, 1, 0, 0, 0, 0, 0, 31, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 91, 0, 0,
- 89, 0, 76, 80, 0, 77, 0, 0, 0, 73,
- 38, 0, 0, 35, 0, 0, 60, 2, 0, 39,
- 0, 0, 38, 0, 56, 57, 55, 49, 50, 51,
- 52, 53, 54, 45, 0, 46, 68, 79, 75, 81,
- 84, 11, 13, 12, 40, 0, 33, 40, 0, 32,
- 92, 85, 0, 39, 0, 0, 39, 39, 15, 88,
- 0, 41, 42, 0, 0, 39, 38, 25, 0, 40,
- 86, 0, 39, 40, 40, 0, 0, 38, 39, 87,
- 83, 18, 40, 39, 39, 21, 37, 39, 28, 0,
- 0, 24, 39, 0, 0, 27, 0, 0, 26, 0,
- 0, 0, 0, 38, 0, 19, 22, 23, 0, 39,
- 20, 39, 30, 0, 29
+ 3, 51, 16, 9, 17, 0, 0, 0, 14, 6,
+ 67, 5, 7, 93, 93, 93, 70, 69, 81, 0,
+ 72, 0, 73, 0, 74, 0, 75, 77, 85, 64,
+ 65, 50, 0, 51, 66, 0, 37, 0, 61, 62,
+ 0, 1, 0, 0, 0, 0, 0, 34, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 94, 0, 0,
+ 92, 0, 79, 83, 0, 80, 0, 0, 0, 76,
+ 41, 0, 0, 38, 0, 0, 63, 2, 0, 42,
+ 0, 0, 41, 0, 59, 60, 58, 52, 53, 54,
+ 55, 56, 57, 48, 0, 49, 71, 82, 78, 84,
+ 87, 11, 13, 12, 43, 0, 36, 43, 0, 35,
+ 95, 88, 0, 42, 0, 0, 42, 42, 15, 91,
+ 0, 44, 45, 0, 0, 42, 41, 24, 0, 43,
+ 89, 0, 42, 43, 43, 0, 0, 40, 41, 42,
+ 0, 90, 86, 18, 43, 42, 42, 21, 42, 32,
+ 30, 0, 0, 27, 0, 42, 0, 0, 29, 0,
+ 0, 42, 41, 42, 41, 0, 0, 0, 0, 41,
+ 25, 0, 26, 0, 0, 19, 22, 23, 42, 28,
+ 42, 20, 33, 31
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 19, 20, 53, 22, 142, 24, 158, 167, 168,
- 66, 25, 26, 27, 169, 35, 125, 133, 28, 138,
- 37, 30, 46, 47, 31, 90, 132, 149, 32, 78
+ -1, 19, 20, 53, 22, 142, 24, 183, 168, 169,
+ 170, 66, 25, 26, 27, 171, 193, 125, 133, 28,
+ 138, 37, 30, 46, 47, 31, 90, 132, 149, 32,
+ 78
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -123
+#define YYPACT_NINF -124
static const yytype_int16 yypact[] =
{
- 124, -123, -123, -123, -45, 317, -123, 24, 277, -123,
- 39, 43, 51, 152, 9, 64, 152, 152, 152, 2,
- -123, 4, -123, -123, -123, 26, 12, 198, 305, -123,
- -123, -123, -123, 152, 152, 152, -123, 29, -123, 76,
- -123, 77, -123, 66, -123, -2, -3, -123, -123, -123,
- -123, 42, 152, -123, 237, 81, -123, -12, -4, -4,
- 281, -123, 124, 198, 152, 198, 61, 293, 152, 152,
- 152, 152, 152, 152, 152, 152, 152, 305, -38, -15,
- 40, 87, -123, -123, 89, -123, 90, 91, 79, -123,
- -123, 237, 93, -123, 152, 152, -123, -123, 55, 305,
- 60, 269, 53, 152, 305, 305, 305, 334, 334, -4,
- -4, 305, 305, -123, 152, -123, -123, -123, -123, -123,
- 105, -123, 305, 305, -123, -8, -123, -123, 247, 305,
- 305, -123, -14, 170, 82, 152, 170, -123, -123, 62,
- 106, -123, -123, 104, 152, 305, 63, 83, 112, -123,
- -123, 94, 305, -123, -123, 102, 113, -123, -123, -123,
- 170, -123, -123, 170, 170, -123, -123, 113, -123, 198,
- 247, -123, 170, 111, 119, -123, 121, 95, -123, 126,
- 108, 125, 130, 5, 115, -123, -123, -123, 216, 170,
- -123, -123, -123, 101, -123
+ 143, -124, -124, -124, -39, 328, -124, 35, 287, -124,
+ 40, 15, 41, 172, -25, 46, 172, 172, 172, 3,
+ -124, 7, -124, -124, -124, 8, 18, 218, 316, -124,
+ -124, -124, -124, 172, 172, 172, -124, 31, -124, 77,
+ -124, 78, -124, 63, -124, 13, 32, -124, -124, -124,
+ -124, 39, 172, -124, 86, 82, -124, -20, -17, -17,
+ 292, -124, 143, 218, 172, 218, 60, 304, 172, 172,
+ 172, 172, 172, 172, 172, 172, 172, 316, -23, -1,
+ 47, 87, -124, -124, 90, -124, 91, 94, 79, -124,
+ -124, 86, 99, -124, 172, 172, -124, -124, 58, 316,
+ 59, 280, 66, 172, 316, 316, 316, 240, 240, -17,
+ -17, 316, 316, -124, 172, -124, -124, -124, -124, -124,
+ 108, -124, 316, 316, -124, -3, -124, -124, 266, 316,
+ 316, -124, -8, 189, 84, 172, 189, -124, -124, 64,
+ 111, -124, -124, 106, 172, 316, 25, -9, 114, -124,
+ -124, 95, 316, -124, -124, 107, 122, -124, -124, -124,
+ 218, -124, 189, -124, -124, 189, 189, -124, 122, -124,
+ -124, 218, 266, 100, 105, 189, 131, 133, -124, 139,
+ 123, -124, -124, -124, -124, 140, 126, 138, 144, -7,
+ -124, 266, -124, 235, 134, -124, -124, -124, 189, -124,
+ -124, -124, -124, -124
};
/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int8 yypgoto[] =
+static const yytype_int16 yypgoto[] =
{
- -123, -123, 92, 10, -122, 0, -123, -123, -123, -9,
- -62, -123, -123, -123, -123, -71, -53, -110, -5, 14,
- -123, -123, -123, 107, -123, -123, -123, -123, -123, 47
+ -124, -124, 109, 16, -123, 0, -124, -124, -124, 23,
+ 5, -61, -124, -124, -124, 30, -4, -52, -107, 1,
+ 21, -124, -124, -124, 137, -124, -124, -124, -124, -124,
+ 45
};
/* 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 -48
+#define YYTABLE_NINF -51
static const yytype_int16 yytable[] =
{
- 23, 98, 61, 100, -8, 134, 137, 33, 54, 85,
- 21, 58, 59, 60, 29, 113, 86, 136, 114, 120,
- -40, -40, 67, 94, 41, 87, 43, 135, 77, 77,
- 77, 128, 88, 95, 36, 68, 69, 139, 115, 160,
- 70, 114, 140, 163, 164, 55, 56, 91, 178, 48,
- 75, 76, 172, 62, 49, -8, -40, 64, 67, 99,
- 101, 50, 23, 104, 105, 106, 107, 108, 109, 110,
- 111, 112, 21, 189, 57, 156, 29, 154, 63, 155,
- 143, 79, 80, 146, 147, 81, 170, 82, 83, 122,
- 123, 93, 153, 84, 34, 102, 114, 116, 129, 162,
- 117, 118, 119, 121, 127, 171, 87, 177, 124, 130,
- 173, 174, 188, 126, 176, 131, 150, 144, 148, 179,
- 151, 157, 159, 165, -4, 1, 161, 180, 166, 183,
- 145, 2, 3, 4, 5, 181, 192, 182, 193, 152,
- 185, 6, 184, 7, 8, 9, 186, 190, 10, 11,
- 12, 187, 194, 89, 97, 13, 14, 15, 175, 2,
- 3, 4, 51, 0, 67, 0, 0, 0, 0, 0,
- 16, 17, 0, 0, 0, -4, 18, 2, 3, 4,
- 51, 0, 0, 52, 0, 15, 0, 6, 191, 7,
- 8, 9, 0, 0, 0, 11, 12, 0, 16, 17,
- 0, 13, 14, 15, 18, 2, 3, 4, 51, 0,
- 0, 0, 0, 0, 0, 0, 16, 17, 0, 0,
- 0, 141, 18, 2, 3, 4, 51, 0, 0, 52,
- 0, 15, 0, 6, 0, 7, 8, 9, 0, 0,
- 0, 11, 12, 0, 16, 17, 0, 13, 14, 15,
- 65, 0, 0, 0, 2, 3, 4, 51, 0, 92,
- 0, 0, 16, 17, 6, 0, 7, 8, 18, 0,
- 0, 0, 11, 12, 0, 0, 68, 69, 13, 0,
- 15, 70, 0, 71, 72, 73, 74, 0, 38, 0,
- 0, 75, 76, 16, 17, 39, 0, 0, 0, 18,
- 40, 0, 0, 0, 41, 42, 43, 44, 68, 69,
- 0, 0, 45, 70, 103, 71, 72, 73, 74, 0,
- 68, 69, 96, 75, 76, 70, 0, 71, 72, 73,
- 74, 0, 68, 69, 96, 75, 76, 70, 103, 71,
- 72, 73, 74, 0, 68, 69, 0, 75, 76, 70,
- 0, 71, 72, 73, 74, 0, -47, -47, 0, 75,
- 76, -47, 0, 0, 0, -47, -47, 0, 0, 34,
- 0, -47, -47, 68, 69, 0, 0, 0, 70, 0,
- 0, 0, 73, 74, 0, 0, 0, 0, 75, 76
+ 23, 35, 98, 61, 100, 137, 157, -8, -43, -43,
+ 134, 55, 56, 33, 54, 94, 21, 58, 59, 60,
+ 136, 29, 68, 69, 85, 95, 49, 70, 67, 158,
+ 113, 86, 135, 114, 77, 77, 77, 75, 76, 154,
+ 87, 155, 162, 139, -43, 36, 165, 166, 140, 181,
+ 48, 50, 115, 91, 62, 114, 57, 175, -8, 41,
+ 63, 43, 23, 64, 67, 99, 101, 88, 199, 104,
+ 105, 106, 107, 108, 109, 110, 111, 112, 21, 79,
+ 80, 143, 198, 29, 146, 147, 120, 81, 82, 83,
+ 84, 34, 93, 153, 102, 122, 123, 116, 128, 174,
+ 164, 117, 118, 114, 129, 119, 87, 173, 92, 121,
+ 180, 124, 126, 176, 177, 130, 179, 127, 131, 144,
+ 148, 150, 151, 185, 161, 68, 69, 163, 167, 190,
+ 70, 192, 71, 72, 73, 74, 145, 157, 182, 184,
+ 75, 76, 156, -4, 1, 152, 202, 186, 203, 187,
+ 2, 3, 4, 5, 172, 188, 194, 189, 195, 196,
+ 6, 67, 7, 8, 9, 197, 201, 10, 11, 12,
+ 159, 97, 67, 178, 13, 14, 15, 160, 191, 2,
+ 3, 4, 51, 89, 0, 0, 0, 0, 0, 16,
+ 17, 0, 0, 200, -4, 18, 2, 3, 4, 51,
+ 0, 0, 0, 52, 0, 15, 6, 0, 7, 8,
+ 9, 0, 0, 0, 11, 12, 0, 0, 16, 17,
+ 13, 14, 15, 0, 18, 2, 3, 4, 51, 0,
+ 0, 0, 0, 0, 0, 16, 17, 0, 0, 0,
+ 141, 18, 2, 3, 4, 51, 0, 0, 0, 52,
+ 0, 15, 6, 0, 7, 8, 9, 0, 0, 0,
+ 11, 12, 0, 0, 16, 17, 13, 14, 15, 0,
+ 65, 0, 0, 2, 3, 4, 51, 0, 0, 68,
+ 69, 16, 17, 6, 70, 7, 8, 18, 73, 74,
+ 0, 11, 12, 0, 75, 76, 0, 13, 38, 15,
+ 0, 0, 0, 0, 0, 39, 0, 0, 0, 0,
+ 40, 0, 16, 17, 41, 42, 43, 44, 18, 68,
+ 69, 0, 45, 0, 70, 103, 71, 72, 73, 74,
+ 0, 68, 69, 96, 75, 76, 70, 0, 71, 72,
+ 73, 74, 0, 68, 69, 96, 75, 76, 70, 103,
+ 71, 72, 73, 74, 0, 68, 69, 0, 75, 76,
+ 70, 0, 71, 72, 73, 74, 0, -50, -50, 0,
+ 75, 76, -50, 0, 0, 0, -50, -50, 0, 0,
+ 34, 0, -50, -50
};
static const yytype_int16 yycheck[] =
{
- 0, 63, 0, 65, 0, 13, 128, 52, 13, 11,
- 0, 16, 17, 18, 0, 53, 18, 127, 56, 90,
- 15, 16, 27, 35, 27, 27, 29, 35, 33, 34,
- 35, 102, 35, 45, 10, 39, 40, 51, 53, 149,
- 44, 56, 56, 153, 154, 36, 37, 52, 170, 10,
- 54, 55, 162, 51, 11, 51, 51, 45, 63, 64,
- 65, 10, 62, 68, 69, 70, 71, 72, 73, 74,
- 75, 76, 62, 183, 10, 146, 62, 14, 52, 16,
- 133, 34, 35, 136, 137, 56, 157, 11, 11, 94,
- 95, 10, 145, 27, 52, 34, 56, 10, 103, 152,
- 11, 11, 11, 10, 51, 158, 27, 169, 53, 114,
- 163, 164, 183, 53, 167, 10, 10, 35, 56, 172,
- 16, 38, 10, 21, 0, 1, 32, 16, 15, 34,
- 135, 7, 8, 9, 10, 16, 189, 16, 191, 144,
- 32, 17, 16, 19, 20, 21, 21, 32, 24, 25,
- 26, 21, 51, 46, 62, 31, 32, 33, 167, 7,
- 8, 9, 10, -1, 169, -1, -1, -1, -1, -1,
- 46, 47, -1, -1, -1, 51, 52, 7, 8, 9,
- 10, -1, -1, 31, -1, 33, -1, 17, 188, 19,
- 20, 21, -1, -1, -1, 25, 26, -1, 46, 47,
- -1, 31, 32, 33, 52, 7, 8, 9, 10, -1,
- -1, -1, -1, -1, -1, -1, 46, 47, -1, -1,
- -1, 51, 52, 7, 8, 9, 10, -1, -1, 31,
- -1, 33, -1, 17, -1, 19, 20, 21, -1, -1,
- -1, 25, 26, -1, 46, 47, -1, 31, 32, 33,
- 52, -1, -1, -1, 7, 8, 9, 10, -1, 22,
- -1, -1, 46, 47, 17, -1, 19, 20, 52, -1,
- -1, -1, 25, 26, -1, -1, 39, 40, 31, -1,
- 33, 44, -1, 46, 47, 48, 49, -1, 11, -1,
- -1, 54, 55, 46, 47, 18, -1, -1, -1, 52,
- 23, -1, -1, -1, 27, 28, 29, 30, 39, 40,
- -1, -1, 35, 44, 45, 46, 47, 48, 49, -1,
- 39, 40, 53, 54, 55, 44, -1, 46, 47, 48,
- 49, -1, 39, 40, 53, 54, 55, 44, 45, 46,
- 47, 48, 49, -1, 39, 40, -1, 54, 55, 44,
- -1, 46, 47, 48, 49, -1, 39, 40, -1, 54,
- 55, 44, -1, -1, -1, 48, 49, -1, -1, 52,
- -1, 54, 55, 39, 40, -1, -1, -1, 44, -1,
- -1, -1, 48, 49, -1, -1, -1, -1, 54, 55
+ 0, 5, 63, 0, 65, 128, 15, 0, 15, 16,
+ 13, 36, 37, 52, 13, 35, 0, 16, 17, 18,
+ 127, 0, 39, 40, 11, 45, 11, 44, 27, 38,
+ 53, 18, 35, 56, 33, 34, 35, 54, 55, 14,
+ 27, 16, 149, 51, 51, 10, 153, 154, 56, 172,
+ 10, 10, 53, 52, 51, 56, 10, 164, 51, 27,
+ 52, 29, 62, 45, 63, 64, 65, 35, 191, 68,
+ 69, 70, 71, 72, 73, 74, 75, 76, 62, 34,
+ 35, 133, 189, 62, 136, 137, 90, 56, 11, 11,
+ 27, 52, 10, 145, 34, 94, 95, 10, 102, 160,
+ 152, 11, 11, 56, 103, 11, 27, 159, 22, 10,
+ 171, 53, 53, 165, 166, 114, 168, 51, 10, 35,
+ 56, 10, 16, 175, 10, 39, 40, 32, 21, 181,
+ 44, 183, 46, 47, 48, 49, 135, 15, 38, 34,
+ 54, 55, 146, 0, 1, 144, 198, 16, 200, 16,
+ 7, 8, 9, 10, 158, 16, 16, 34, 32, 21,
+ 17, 160, 19, 20, 21, 21, 32, 24, 25, 26,
+ 147, 62, 171, 168, 31, 32, 33, 147, 182, 7,
+ 8, 9, 10, 46, -1, -1, -1, -1, -1, 46,
+ 47, -1, -1, 193, 51, 52, 7, 8, 9, 10,
+ -1, -1, -1, 31, -1, 33, 17, -1, 19, 20,
+ 21, -1, -1, -1, 25, 26, -1, -1, 46, 47,
+ 31, 32, 33, -1, 52, 7, 8, 9, 10, -1,
+ -1, -1, -1, -1, -1, 46, 47, -1, -1, -1,
+ 51, 52, 7, 8, 9, 10, -1, -1, -1, 31,
+ -1, 33, 17, -1, 19, 20, 21, -1, -1, -1,
+ 25, 26, -1, -1, 46, 47, 31, 32, 33, -1,
+ 52, -1, -1, 7, 8, 9, 10, -1, -1, 39,
+ 40, 46, 47, 17, 44, 19, 20, 52, 48, 49,
+ -1, 25, 26, -1, 54, 55, -1, 31, 11, 33,
+ -1, -1, -1, -1, -1, 18, -1, -1, -1, -1,
+ 23, -1, 46, 47, 27, 28, 29, 30, 52, 39,
+ 40, -1, 35, -1, 44, 45, 46, 47, 48, 49,
+ -1, 39, 40, 53, 54, 55, 44, -1, 46, 47,
+ 48, 49, -1, 39, 40, 53, 54, 55, 44, 45,
+ 46, 47, 48, 49, -1, 39, 40, -1, 54, 55,
+ 44, -1, 46, 47, 48, 49, -1, 39, 40, -1,
+ 54, 55, 44, -1, -1, -1, 48, 49, -1, -1,
+ 52, -1, 54, 55
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -788,24 +795,25 @@ static const yytype_uint8 yystos[] =
{
0, 1, 7, 8, 9, 10, 17, 19, 20, 21,
24, 25, 26, 31, 32, 33, 46, 47, 52, 58,
- 59, 60, 61, 62, 63, 68, 69, 70, 75, 76,
- 78, 81, 85, 52, 52, 72, 10, 77, 11, 18,
- 23, 27, 28, 29, 30, 35, 79, 80, 10, 11,
- 10, 10, 31, 60, 75, 36, 37, 10, 75, 75,
- 75, 0, 51, 52, 45, 52, 67, 75, 39, 40,
- 44, 46, 47, 48, 49, 54, 55, 75, 86, 86,
- 86, 56, 11, 11, 27, 11, 18, 27, 35, 80,
- 82, 75, 22, 10, 35, 45, 53, 59, 67, 75,
- 67, 75, 34, 45, 75, 75, 75, 75, 75, 75,
- 75, 75, 75, 53, 56, 53, 10, 11, 11, 11,
- 72, 10, 75, 75, 53, 73, 53, 51, 72, 75,
- 75, 10, 83, 74, 13, 35, 74, 61, 76, 51,
- 56, 51, 62, 73, 35, 75, 73, 73, 56, 84,
- 10, 16, 75, 73, 14, 16, 72, 38, 64, 10,
- 74, 32, 73, 74, 74, 21, 15, 65, 66, 71,
- 72, 73, 74, 73, 73, 66, 73, 67, 61, 73,
- 16, 16, 16, 34, 16, 32, 21, 21, 72, 74,
- 32, 62, 73, 73, 51
+ 59, 60, 61, 62, 63, 69, 70, 71, 76, 77,
+ 79, 82, 86, 52, 52, 73, 10, 78, 11, 18,
+ 23, 27, 28, 29, 30, 35, 80, 81, 10, 11,
+ 10, 10, 31, 60, 76, 36, 37, 10, 76, 76,
+ 76, 0, 51, 52, 45, 52, 68, 76, 39, 40,
+ 44, 46, 47, 48, 49, 54, 55, 76, 87, 87,
+ 87, 56, 11, 11, 27, 11, 18, 27, 35, 81,
+ 83, 76, 22, 10, 35, 45, 53, 59, 68, 76,
+ 68, 76, 34, 45, 76, 76, 76, 76, 76, 76,
+ 76, 76, 76, 53, 56, 53, 10, 11, 11, 11,
+ 73, 10, 76, 76, 53, 74, 53, 51, 73, 76,
+ 76, 10, 84, 75, 13, 35, 75, 61, 77, 51,
+ 56, 51, 62, 74, 35, 76, 74, 74, 56, 85,
+ 10, 16, 76, 74, 14, 16, 73, 15, 38, 66,
+ 72, 10, 75, 32, 74, 75, 75, 21, 65, 66,
+ 67, 72, 73, 74, 68, 75, 74, 74, 67, 74,
+ 68, 61, 38, 64, 34, 74, 16, 16, 16, 34,
+ 74, 73, 74, 73, 16, 32, 21, 21, 75, 61,
+ 62, 32, 74, 74
};
#define yyerrok (yyerrstatus = 0)
@@ -1747,38 +1755,66 @@ yyreduce:
#line 200 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (8)].code));
- WRITE_UINT32(&else1, (yyvsp[(7) - (8)].code));
- WRITE_UINT32(&end, (yyvsp[(8) - (8)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 3] = end; /* end, if cond fails */
+ WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
+ WRITE_UINT32(&else1, 0);
+ WRITE_UINT32(&end, (yyvsp[(6) - (6)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); ;}
break;
case 25:
-#line 211 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = 0; ;}
+#line 210 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
+ WRITE_UINT32(&else1, (yyvsp[(8) - (10)].code));
+ WRITE_UINT32(&end, (yyvsp[(10) - (10)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; /* end, if cond fails */
+
+ g_lingo->processIf(0, 0); ;}
break;
case 26:
-#line 212 "engines/director/lingo/lingo-gr.y"
+#line 220 "engines/director/lingo/lingo-gr.y"
+ {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
+ WRITE_UINT32(&else1, (yyvsp[(6) - (10)].code));
+ WRITE_UINT32(&end, (yyvsp[(10) - (10)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = end; /* end, if cond fails */
+
+ g_lingo->processIf(0, (yyvsp[(10) - (10)].code)); ;}
+ break;
+
+ case 27:
+#line 231 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = 0; ;}
+ break;
+
+ case 28:
+#line 232 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 29:
-#line 219 "engines/director/lingo/lingo-gr.y"
+ case 31:
+#line 239 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
- WRITE_UINT32(&then, (yyvsp[(4) - (7)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
+ WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (6)].code) + 1] = then; /* thenpart */
- g_lingo->codeLabel((yyvsp[(1) - (7)].code)); ;}
+ g_lingo->codeLabel((yyvsp[(1) - (6)].code)); ;}
break;
- case 30:
-#line 225 "engines/director/lingo/lingo-gr.y"
+ case 33:
+#line 247 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
@@ -1787,23 +1823,23 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (5)].code)); ;}
break;
- case 31:
-#line 233 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 255 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 32:
-#line 234 "engines/director/lingo/lingo-gr.y"
+ case 35:
+#line 256 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 34:
-#line 237 "engines/director/lingo/lingo-gr.y"
+ case 37:
+#line 259 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 35:
-#line 239 "engines/director/lingo/lingo-gr.y"
+ case 38:
+#line 261 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1811,8 +1847,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 36:
-#line 245 "engines/director/lingo/lingo-gr.y"
+ case 39:
+#line 267 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -1820,8 +1856,8 @@ yyreduce:
g_lingo->codeLabel(0); ;}
break;
- case 37:
-#line 251 "engines/director/lingo/lingo-gr.y"
+ case 40:
+#line 273 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -1830,23 +1866,23 @@ yyreduce:
g_lingo->code1(skipEnd); ;}
break;
- case 38:
-#line 258 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 280 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 39:
-#line 260 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 282 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 40:
-#line 262 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 284 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 43:
-#line 267 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 289 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1854,15 +1890,15 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 44:
-#line 272 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 294 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
- case 45:
-#line 275 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 297 "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));
@@ -1871,8 +1907,8 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 46:
-#line 281 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 303 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1883,121 +1919,121 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 47:
-#line 289 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 311 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 49:
-#line 293 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 315 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 50:
-#line 294 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 316 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 51:
-#line 295 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 317 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 52:
-#line 296 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 318 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 53:
-#line 297 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 319 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 54:
-#line 298 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 320 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 55:
-#line 299 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 321 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 56:
-#line 300 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 322 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 57:
-#line 301 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 323 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 58:
-#line 302 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 324 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 59:
-#line 303 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 325 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 60:
-#line 304 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 326 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 61:
-#line 307 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 329 "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 62:
-#line 308 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 330 "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 63:
-#line 309 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 331 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 65:
-#line 311 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 333 "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 67:
-#line 316 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 338 "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 68:
-#line 317 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 339 "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 69:
-#line 328 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 350 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 70:
-#line 329 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 351 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 71:
-#line 330 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 352 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 72:
-#line 331 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 353 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2005,8 +2041,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 73:
-#line 336 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 358 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2015,8 +2051,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 74:
-#line 342 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 364 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2024,48 +2060,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 75:
-#line 349 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 371 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 76:
-#line 350 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 372 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 77:
-#line 351 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 373 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 78:
-#line 352 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 374 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 79:
-#line 355 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 377 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 80:
-#line 356 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 378 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 81:
-#line 357 "engines/director/lingo/lingo-gr.y"
+ case 84:
+#line 379 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 82:
-#line 385 "engines/director/lingo/lingo-gr.y"
+ case 85:
+#line 407 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 83:
-#line 386 "engines/director/lingo/lingo-gr.y"
+ case 86:
+#line 408 "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);
@@ -2073,33 +2109,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 84:
-#line 392 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 414 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 85:
-#line 393 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 415 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 86:
-#line 394 "engines/director/lingo/lingo-gr.y"
+ case 89:
+#line 416 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 87:
-#line 395 "engines/director/lingo/lingo-gr.y"
+ case 90:
+#line 417 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 88:
-#line 397 "engines/director/lingo/lingo-gr.y"
+ case 91:
+#line 419 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 89:
-#line 400 "engines/director/lingo/lingo-gr.y"
+ case 92:
+#line 422 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2108,24 +2144,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 90:
-#line 408 "engines/director/lingo/lingo-gr.y"
+ case 93:
+#line 430 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 91:
-#line 409 "engines/director/lingo/lingo-gr.y"
+ case 94:
+#line 431 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 92:
-#line 410 "engines/director/lingo/lingo-gr.y"
+ case 95:
+#line 432 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2129 "engines/director/lingo/lingo-gr.cpp"
+#line 2165 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2339,6 +2375,6 @@ yyreturn:
}
-#line 413 "engines/director/lingo/lingo-gr.y"
+#line 435 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index d65e683..221c721 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -79,7 +79,7 @@ using namespace Director;
%token tWITH tWHILE tNLELSE
%token tGE tLE tGT tLT tEQ tNEQ
-%type<code> asgn begin elseif elsestmt end expr if repeatwhile repeatwith stmtlist
+%type<code> asgn begin elseif elsestmtoneliner end expr if repeatwhile repeatwith stmtlist
%type<s> gotoframe gotomovie
%type<narg> argdef arglist
@@ -197,18 +197,38 @@ ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, $9); }
- | if cond tTHEN begin stmtoneliner end elsestmt end {
+ | if cond tTHEN begin stmtoneliner end {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $4);
- WRITE_UINT32(&else1, $7);
- WRITE_UINT32(&end, $8);
+ WRITE_UINT32(&else1, 0);
+ WRITE_UINT32(&end, $6);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
+ | if cond tTHEN begin stmtoneliner end tNLELSE begin stmtoneliner end {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&else1, $8);
+ WRITE_UINT32(&end, $10);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
+
+ g_lingo->processIf(0, 0); }
+ | if cond tTHEN begin stmtoneliner end elseifstmtoneliner end elsestmtoneliner end {
+ inst then = 0, else1 = 0, end = 0;
+ WRITE_UINT32(&then, $4);
+ WRITE_UINT32(&else1, $6);
+ WRITE_UINT32(&end, $10);
+ (*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
+
+ g_lingo->processIf(0, $10); }
;
-elsestmt: /* nothing */ { $$ = 0; }
+elsestmtoneliner: /* nothing */ { $$ = 0; }
| tNLELSE begin stmtoneliner { $$ = $2; }
;
@@ -216,12 +236,14 @@ elseifstmt: elseifstmt elseifstmt1
| elseifstmt1
;
-elseifstmt1: elseif cond tTHEN begin stmt end '\n' {
+elseifstmtoneliner: elseif cond tTHEN begin stmt end {
inst then = 0;
WRITE_UINT32(&then, $4);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
g_lingo->codeLabel($1); }
+
+elseifstmt1: elseifstmtoneliner
| elseif cond tTHEN stmtlist end {
inst then = 0;
WRITE_UINT32(&then, $4);
Commit: 6636c9006bf9e274f6d7e85556f3426e4b3594df
https://github.com/scummvm/scummvm/commit/6636c9006bf9e274f6d7e85556f3426e4b3594df
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Provide error position in the file
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 29b62e2..8dc9ca7 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -121,7 +121,7 @@ Common::Error DirectorEngine::run() {
else if x = 2 then\n\
put 2.1\n\
put 2.2\n\
- else if x = 3 then put 3\n\
+ else if x = 3 then put 3\n\
end if\n\
if x = 4 then put 4\n\
else put 5\n\
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 2b8e37a..f295ea0 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -169,7 +169,7 @@
extern int yylex();
extern int yyparse();
-void yyerror(char *s) { error("%s", s); }
+void yyerror(char *s) { error("%s at line %d col %d", s, Director::g_lingo->_linenumber, Director::g_lingo->_colnumber); }
using namespace Director;
@@ -432,16 +432,16 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 61
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 383
+#define YYLAST 384
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 57
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 31
+#define YYNNTS 32
/* YYNRULES -- Number of rules. */
-#define YYNRULES 95
+#define YYNRULES 96
/* YYNRULES -- Number of states. */
-#define YYNSTATES 204
+#define YYNSTATES 205
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -490,72 +490,72 @@ static const yytype_uint8 yytranslate[] =
YYRHS. */
static const yytype_uint16 yyprhs[] =
{
- 0, 0, 3, 7, 9, 10, 12, 14, 16, 18,
- 20, 22, 27, 32, 37, 39, 41, 43, 45, 54,
- 66, 79, 88, 100, 112, 119, 130, 141, 142, 146,
- 149, 151, 158, 160, 166, 168, 172, 176, 179, 183,
- 185, 187, 188, 189, 190, 193, 196, 198, 200, 205,
- 210, 212, 214, 218, 222, 226, 230, 234, 238, 242,
- 246, 250, 253, 256, 260, 263, 266, 269, 271, 273,
- 276, 278, 282, 285, 288, 291, 294, 298, 301, 305,
- 308, 311, 313, 317, 320, 324, 325, 334, 335, 337,
- 341, 346, 347, 351, 352, 354
+ 0, 0, 3, 7, 9, 11, 12, 14, 16, 18,
+ 20, 22, 24, 29, 34, 39, 41, 43, 45, 47,
+ 56, 68, 81, 90, 102, 114, 121, 132, 143, 144,
+ 148, 151, 153, 160, 162, 168, 170, 174, 178, 181,
+ 185, 187, 189, 190, 191, 192, 195, 198, 200, 202,
+ 207, 212, 214, 216, 220, 224, 228, 232, 236, 240,
+ 244, 248, 252, 255, 258, 262, 265, 268, 271, 273,
+ 275, 278, 280, 284, 287, 290, 293, 296, 300, 303,
+ 307, 310, 313, 315, 319, 322, 326, 327, 336, 337,
+ 339, 343, 348, 349, 353, 354, 356
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 58, 0, -1, 58, 51, 59, -1, 59, -1, -1,
- 82, -1, 77, -1, 86, -1, 60, -1, 62, -1,
- 1, -1, 31, 76, 22, 10, -1, 33, 10, 45,
- 76, -1, 33, 10, 35, 76, -1, 76, -1, 77,
- -1, 61, -1, 63, -1, 69, 52, 68, 53, 75,
- 74, 16, 32, -1, 70, 45, 76, 74, 35, 76,
- 74, 75, 74, 16, 32, -1, 70, 45, 76, 74,
- 13, 35, 76, 74, 75, 74, 16, 32, -1, 71,
- 68, 34, 51, 75, 74, 16, 21, -1, 71, 68,
- 34, 51, 75, 74, 14, 75, 74, 16, 21, -1,
- 71, 68, 34, 51, 75, 74, 73, 65, 74, 16,
- 21, -1, 71, 68, 34, 73, 61, 74, -1, 71,
- 68, 34, 73, 61, 74, 38, 73, 61, 74, -1,
- 71, 68, 34, 73, 61, 74, 66, 74, 64, 74,
- -1, -1, 38, 73, 61, -1, 65, 67, -1, 67,
- -1, 72, 68, 34, 73, 62, 74, -1, 66, -1,
- 72, 68, 34, 75, 74, -1, 76, -1, 76, 45,
- 76, -1, 52, 68, 53, -1, 32, 37, -1, 32,
- 36, 10, -1, 21, -1, 15, -1, -1, -1, -1,
- 75, 51, -1, 75, 62, -1, 7, -1, 8, -1,
- 9, 52, 87, 53, -1, 10, 52, 87, 53, -1,
- 10, -1, 60, -1, 76, 46, 76, -1, 76, 47,
- 76, -1, 76, 48, 76, -1, 76, 49, 76, -1,
- 76, 54, 76, -1, 76, 55, 76, -1, 76, 44,
- 76, -1, 76, 39, 76, -1, 76, 40, 76, -1,
- 46, 76, -1, 47, 76, -1, 52, 76, 53, -1,
- 25, 11, -1, 26, 10, -1, 31, 76, -1, 79,
- -1, 17, -1, 19, 78, -1, 10, -1, 78, 56,
- 10, -1, 20, 23, -1, 20, 28, -1, 20, 30,
- -1, 20, 80, -1, 20, 80, 81, -1, 20, 81,
- -1, 35, 18, 11, -1, 18, 11, -1, 35, 11,
- -1, 11, -1, 29, 27, 11, -1, 27, 11, -1,
- 35, 27, 11, -1, -1, 24, 10, 83, 73, 84,
- 51, 85, 75, -1, -1, 10, -1, 84, 56, 10,
- -1, 84, 51, 56, 10, -1, -1, 10, 73, 87,
- -1, -1, 76, -1, 87, 56, 76, -1
+ 58, 0, -1, 58, 59, 60, -1, 60, -1, 51,
+ -1, -1, 83, -1, 78, -1, 87, -1, 61, -1,
+ 63, -1, 1, -1, 31, 77, 22, 10, -1, 33,
+ 10, 45, 77, -1, 33, 10, 35, 77, -1, 77,
+ -1, 78, -1, 62, -1, 64, -1, 70, 52, 69,
+ 53, 76, 75, 16, 32, -1, 71, 45, 77, 75,
+ 35, 77, 75, 76, 75, 16, 32, -1, 71, 45,
+ 77, 75, 13, 35, 77, 75, 76, 75, 16, 32,
+ -1, 72, 69, 34, 59, 76, 75, 16, 21, -1,
+ 72, 69, 34, 59, 76, 75, 14, 76, 75, 16,
+ 21, -1, 72, 69, 34, 59, 76, 75, 74, 66,
+ 75, 16, 21, -1, 72, 69, 34, 74, 62, 75,
+ -1, 72, 69, 34, 74, 62, 75, 38, 74, 62,
+ 75, -1, 72, 69, 34, 74, 62, 75, 67, 75,
+ 65, 75, -1, -1, 38, 74, 62, -1, 66, 68,
+ -1, 68, -1, 73, 69, 34, 74, 63, 75, -1,
+ 67, -1, 73, 69, 34, 76, 75, -1, 77, -1,
+ 77, 45, 77, -1, 52, 69, 53, -1, 32, 37,
+ -1, 32, 36, 10, -1, 21, -1, 15, -1, -1,
+ -1, -1, 76, 59, -1, 76, 63, -1, 7, -1,
+ 8, -1, 9, 52, 88, 53, -1, 10, 52, 88,
+ 53, -1, 10, -1, 61, -1, 77, 46, 77, -1,
+ 77, 47, 77, -1, 77, 48, 77, -1, 77, 49,
+ 77, -1, 77, 54, 77, -1, 77, 55, 77, -1,
+ 77, 44, 77, -1, 77, 39, 77, -1, 77, 40,
+ 77, -1, 46, 77, -1, 47, 77, -1, 52, 77,
+ 53, -1, 25, 11, -1, 26, 10, -1, 31, 77,
+ -1, 80, -1, 17, -1, 19, 79, -1, 10, -1,
+ 79, 56, 10, -1, 20, 23, -1, 20, 28, -1,
+ 20, 30, -1, 20, 81, -1, 20, 81, 82, -1,
+ 20, 82, -1, 35, 18, 11, -1, 18, 11, -1,
+ 35, 11, -1, 11, -1, 29, 27, 11, -1, 27,
+ 11, -1, 35, 27, 11, -1, -1, 24, 10, 84,
+ 74, 85, 59, 86, 76, -1, -1, 10, -1, 85,
+ 56, 10, -1, 85, 59, 56, 10, -1, -1, 10,
+ 74, 88, -1, -1, 77, -1, 88, 56, 77, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 93, 93, 94, 97, 98, 99, 100, 101, 102,
- 103, 106, 112, 118, 125, 126, 128, 129, 134, 145,
- 161, 175, 182, 191, 200, 210, 220, 231, 232, 235,
- 236, 239, 246, 247, 255, 256, 257, 259, 261, 267,
- 273, 280, 282, 284, 285, 286, 289, 294, 297, 303,
- 311, 314, 315, 316, 317, 318, 319, 320, 321, 322,
- 323, 324, 325, 326, 329, 330, 331, 332, 333, 335,
- 338, 339, 350, 351, 352, 353, 358, 364, 371, 372,
- 373, 374, 377, 378, 379, 407, 407, 414, 415, 416,
- 417, 419, 422, 430, 431, 432
+ 0, 93, 93, 94, 97, 102, 103, 104, 105, 106,
+ 107, 108, 111, 117, 123, 130, 131, 133, 134, 139,
+ 150, 166, 180, 187, 196, 205, 215, 225, 236, 237,
+ 240, 241, 244, 251, 252, 260, 261, 262, 264, 266,
+ 272, 278, 285, 287, 289, 290, 291, 294, 299, 302,
+ 308, 316, 319, 320, 321, 322, 323, 324, 325, 326,
+ 327, 328, 329, 330, 331, 334, 335, 336, 337, 338,
+ 340, 343, 344, 355, 356, 357, 358, 363, 369, 376,
+ 377, 378, 379, 382, 383, 384, 412, 412, 419, 420,
+ 421, 422, 424, 427, 435, 436, 437
};
#endif
@@ -571,7 +571,7 @@ static const char *const yytname[] =
"tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH",
"tWHILE", "tNLELSE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='",
"'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'",
- "','", "$accept", "program", "programline", "asgn", "stmtoneliner",
+ "','", "$accept", "program", "nl", "programline", "asgn", "stmtoneliner",
"stmt", "ifstmt", "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
"elseifstmt1", "cond", "repeatwhile", "repeatwith", "if", "elseif",
"begin", "end", "stmtlist", "expr", "func", "globallist", "gotofunc",
@@ -597,31 +597,31 @@ static const yytype_uint16 yytoknum[] =
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 57, 58, 58, 59, 59, 59, 59, 59, 59,
- 59, 60, 60, 60, 61, 61, 62, 62, 62, 62,
- 62, 63, 63, 63, 63, 63, 63, 64, 64, 65,
- 65, 66, 67, 67, 68, 68, 68, 69, 70, 71,
- 72, 73, 74, 75, 75, 75, 76, 76, 76, 76,
- 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
- 76, 76, 76, 76, 77, 77, 77, 77, 77, 77,
- 78, 78, 79, 79, 79, 79, 79, 79, 80, 80,
- 80, 80, 81, 81, 81, 83, 82, 84, 84, 84,
- 84, 85, 86, 87, 87, 87
+ 0, 57, 58, 58, 59, 60, 60, 60, 60, 60,
+ 60, 60, 61, 61, 61, 62, 62, 63, 63, 63,
+ 63, 63, 64, 64, 64, 64, 64, 64, 65, 65,
+ 66, 66, 67, 68, 68, 69, 69, 69, 70, 71,
+ 72, 73, 74, 75, 76, 76, 76, 77, 77, 77,
+ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 77, 78, 78, 78, 78, 78,
+ 78, 79, 79, 80, 80, 80, 80, 80, 80, 81,
+ 81, 81, 81, 82, 82, 82, 84, 83, 85, 85,
+ 85, 85, 86, 87, 88, 88, 88
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
- 0, 2, 3, 1, 0, 1, 1, 1, 1, 1,
- 1, 4, 4, 4, 1, 1, 1, 1, 8, 11,
- 12, 8, 11, 11, 6, 10, 10, 0, 3, 2,
- 1, 6, 1, 5, 1, 3, 3, 2, 3, 1,
- 1, 0, 0, 0, 2, 2, 1, 1, 4, 4,
- 1, 1, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 2, 2, 3, 2, 2, 2, 1, 1, 2,
- 1, 3, 2, 2, 2, 2, 3, 2, 3, 2,
- 2, 1, 3, 2, 3, 0, 8, 0, 1, 3,
- 4, 0, 3, 0, 1, 3
+ 0, 2, 3, 1, 1, 0, 1, 1, 1, 1,
+ 1, 1, 4, 4, 4, 1, 1, 1, 1, 8,
+ 11, 12, 8, 11, 11, 6, 10, 10, 0, 3,
+ 2, 1, 6, 1, 5, 1, 3, 3, 2, 3,
+ 1, 1, 0, 0, 0, 2, 2, 1, 1, 4,
+ 4, 1, 1, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 2, 2, 3, 2, 2, 2, 1, 1,
+ 2, 1, 3, 2, 2, 2, 2, 3, 2, 3,
+ 2, 2, 1, 3, 2, 3, 0, 8, 0, 1,
+ 3, 4, 0, 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -629,36 +629,36 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 10, 46, 47, 0, 41, 68, 0, 0, 39,
+ 0, 11, 47, 48, 0, 42, 69, 0, 0, 40,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 3, 51, 16, 9, 17, 0, 0, 0, 14, 6,
- 67, 5, 7, 93, 93, 93, 70, 69, 81, 0,
- 72, 0, 73, 0, 74, 0, 75, 77, 85, 64,
- 65, 50, 0, 51, 66, 0, 37, 0, 61, 62,
- 0, 1, 0, 0, 0, 0, 0, 34, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 94, 0, 0,
- 92, 0, 79, 83, 0, 80, 0, 0, 0, 76,
- 41, 0, 0, 38, 0, 0, 63, 2, 0, 42,
- 0, 0, 41, 0, 59, 60, 58, 52, 53, 54,
- 55, 56, 57, 48, 0, 49, 71, 82, 78, 84,
- 87, 11, 13, 12, 43, 0, 36, 43, 0, 35,
- 95, 88, 0, 42, 0, 0, 42, 42, 15, 91,
- 0, 44, 45, 0, 0, 42, 41, 24, 0, 43,
- 89, 0, 42, 43, 43, 0, 0, 40, 41, 42,
- 0, 90, 86, 18, 43, 42, 42, 21, 42, 32,
- 30, 0, 0, 27, 0, 42, 0, 0, 29, 0,
- 0, 42, 41, 42, 41, 0, 0, 0, 0, 41,
- 25, 0, 26, 0, 0, 19, 22, 23, 42, 28,
- 42, 20, 33, 31
+ 3, 52, 17, 10, 18, 0, 0, 0, 15, 7,
+ 68, 6, 8, 94, 94, 94, 71, 70, 82, 0,
+ 73, 0, 74, 0, 75, 0, 76, 78, 86, 65,
+ 66, 51, 0, 52, 67, 0, 38, 0, 62, 63,
+ 0, 1, 4, 0, 0, 0, 0, 0, 35, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 95, 0,
+ 0, 93, 0, 80, 84, 0, 81, 0, 0, 0,
+ 77, 42, 0, 0, 39, 0, 0, 64, 2, 0,
+ 43, 0, 0, 42, 0, 60, 61, 59, 53, 54,
+ 55, 56, 57, 58, 49, 0, 50, 72, 83, 79,
+ 85, 88, 12, 14, 13, 44, 0, 37, 44, 0,
+ 36, 96, 89, 0, 43, 0, 0, 43, 43, 16,
+ 0, 92, 45, 46, 0, 0, 43, 42, 25, 90,
+ 0, 44, 0, 43, 44, 44, 0, 0, 41, 42,
+ 43, 0, 91, 87, 19, 44, 43, 43, 22, 43,
+ 33, 31, 0, 0, 28, 0, 43, 0, 0, 30,
+ 0, 0, 43, 42, 43, 42, 0, 0, 0, 0,
+ 42, 26, 0, 27, 0, 0, 20, 23, 24, 43,
+ 29, 43, 21, 34, 32
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 19, 20, 53, 22, 142, 24, 183, 168, 169,
- 170, 66, 25, 26, 27, 171, 193, 125, 133, 28,
- 138, 37, 30, 46, 47, 31, 90, 132, 149, 32,
- 78
+ -1, 19, 142, 20, 53, 22, 143, 24, 184, 169,
+ 170, 171, 67, 25, 26, 27, 172, 194, 126, 134,
+ 28, 139, 37, 30, 46, 47, 31, 91, 133, 151,
+ 32, 79
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
@@ -666,127 +666,127 @@ static const yytype_int16 yydefgoto[] =
#define YYPACT_NINF -124
static const yytype_int16 yypact[] =
{
- 143, -124, -124, -124, -39, 328, -124, 35, 287, -124,
- 40, 15, 41, 172, -25, 46, 172, 172, 172, 3,
- -124, 7, -124, -124, -124, 8, 18, 218, 316, -124,
- -124, -124, -124, 172, 172, 172, -124, 31, -124, 77,
- -124, 78, -124, 63, -124, 13, 32, -124, -124, -124,
- -124, 39, 172, -124, 86, 82, -124, -20, -17, -17,
- 292, -124, 143, 218, 172, 218, 60, 304, 172, 172,
- 172, 172, 172, 172, 172, 172, 172, 316, -23, -1,
- 47, 87, -124, -124, 90, -124, 91, 94, 79, -124,
- -124, 86, 99, -124, 172, 172, -124, -124, 58, 316,
- 59, 280, 66, 172, 316, 316, 316, 240, 240, -17,
- -17, 316, 316, -124, 172, -124, -124, -124, -124, -124,
- 108, -124, 316, 316, -124, -3, -124, -124, 266, 316,
- 316, -124, -8, 189, 84, 172, 189, -124, -124, 64,
- 111, -124, -124, 106, 172, 316, 25, -9, 114, -124,
- -124, 95, 316, -124, -124, 107, 122, -124, -124, -124,
- 218, -124, 189, -124, -124, 189, 189, -124, 122, -124,
- -124, 218, 266, 100, 105, 189, 131, 133, -124, 139,
- 123, -124, -124, -124, -124, 140, 126, 138, 144, -7,
- -124, 266, -124, 235, 134, -124, -124, -124, 189, -124,
- -124, -124, -124, -124
+ 144, -124, -124, -124, -40, 329, -124, 23, 288, -124,
+ 28, 29, 37, 173, 6, 42, 173, 173, 173, 7,
+ -124, 9, -124, -124, -124, 5, 17, 219, 317, -124,
+ -124, -124, -124, 173, 173, 173, -124, 8, -124, 50,
+ -124, 57, -124, 53, -124, 12, -3, -124, -124, -124,
+ -124, 38, 173, -124, 87, 71, -124, -14, 148, 148,
+ 293, -124, -124, 144, 219, 173, 219, 55, 305, 173,
+ 173, 173, 173, 173, 173, 173, 173, 173, 317, -12,
+ -2, 35, 82, -124, -124, 84, -124, 91, 92, 66,
+ -124, -124, 87, 88, -124, 173, 173, -124, -124, 51,
+ 317, 54, 281, 59, 173, 317, 317, 317, 241, 241,
+ 148, 148, 317, 317, -124, 173, -124, -124, -124, -124,
+ -124, 96, -124, 317, 317, -124, 2, -124, -124, 267,
+ 317, 317, -124, -43, 190, 77, 173, 190, -124, -124,
+ 103, 63, -124, -124, 104, 173, 317, 13, -13, -124,
+ 111, -124, 90, 317, -124, -124, 102, 110, -124, -124,
+ -124, 219, -124, 190, -124, -124, 190, 190, -124, 110,
+ -124, -124, 219, 267, 100, 94, 190, 113, 123, -124,
+ 124, 114, -124, -124, -124, -124, 134, 125, 135, 137,
+ -5, -124, 267, -124, 236, 127, -124, -124, -124, 190,
+ -124, -124, -124, -124, -124
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -124, -124, 109, 16, -123, 0, -124, -124, -124, 23,
- 5, -61, -124, -124, -124, 30, -4, -52, -107, 1,
- 21, -124, -124, -124, 137, -124, -124, -124, -124, -124,
- 45
+ -124, -124, -15, 97, 16, -123, 0, -124, -124, -124,
+ 18, 3, -61, -124, -124, -124, 19, -4, -52, -106,
+ 1, 20, -124, -124, -124, 128, -124, -124, -124, -124,
+ -124, 21
};
/* 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 -51
+#define YYTABLE_NINF -52
static const yytype_int16 yytable[] =
{
- 23, 35, 98, 61, 100, 137, 157, -8, -43, -43,
- 134, 55, 56, 33, 54, 94, 21, 58, 59, 60,
- 136, 29, 68, 69, 85, 95, 49, 70, 67, 158,
- 113, 86, 135, 114, 77, 77, 77, 75, 76, 154,
- 87, 155, 162, 139, -43, 36, 165, 166, 140, 181,
- 48, 50, 115, 91, 62, 114, 57, 175, -8, 41,
- 63, 43, 23, 64, 67, 99, 101, 88, 199, 104,
- 105, 106, 107, 108, 109, 110, 111, 112, 21, 79,
- 80, 143, 198, 29, 146, 147, 120, 81, 82, 83,
- 84, 34, 93, 153, 102, 122, 123, 116, 128, 174,
- 164, 117, 118, 114, 129, 119, 87, 173, 92, 121,
- 180, 124, 126, 176, 177, 130, 179, 127, 131, 144,
- 148, 150, 151, 185, 161, 68, 69, 163, 167, 190,
- 70, 192, 71, 72, 73, 74, 145, 157, 182, 184,
- 75, 76, 156, -4, 1, 152, 202, 186, 203, 187,
- 2, 3, 4, 5, 172, 188, 194, 189, 195, 196,
- 6, 67, 7, 8, 9, 197, 201, 10, 11, 12,
- 159, 97, 67, 178, 13, 14, 15, 160, 191, 2,
- 3, 4, 51, 89, 0, 0, 0, 0, 0, 16,
- 17, 0, 0, 200, -4, 18, 2, 3, 4, 51,
- 0, 0, 0, 52, 0, 15, 6, 0, 7, 8,
- 9, 0, 0, 0, 11, 12, 0, 0, 16, 17,
- 13, 14, 15, 0, 18, 2, 3, 4, 51, 0,
- 0, 0, 0, 0, 0, 16, 17, 0, 0, 0,
- 141, 18, 2, 3, 4, 51, 0, 0, 0, 52,
- 0, 15, 6, 0, 7, 8, 9, 0, 0, 0,
- 11, 12, 0, 0, 16, 17, 13, 14, 15, 0,
- 65, 0, 0, 2, 3, 4, 51, 0, 0, 68,
- 69, 16, 17, 6, 70, 7, 8, 18, 73, 74,
- 0, 11, 12, 0, 75, 76, 0, 13, 38, 15,
- 0, 0, 0, 0, 0, 39, 0, 0, 0, 0,
- 40, 0, 16, 17, 41, 42, 43, 44, 18, 68,
- 69, 0, 45, 0, 70, 103, 71, 72, 73, 74,
- 0, 68, 69, 96, 75, 76, 70, 0, 71, 72,
- 73, 74, 0, 68, 69, 96, 75, 76, 70, 103,
- 71, 72, 73, 74, 0, 68, 69, 0, 75, 76,
- 70, 0, 71, 72, 73, 74, 0, -50, -50, 0,
- 75, 76, -50, 0, 0, 0, -50, -50, 0, 0,
- 34, 0, -50, -50
+ 23, 35, 158, 99, 63, 101, 138, 61, 62, -9,
+ -44, -44, 33, 140, 54, 135, 21, 58, 59, 60,
+ 29, 95, 137, 86, 41, 159, 43, 155, 68, 156,
+ 87, 96, 89, 36, 78, 78, 78, 136, 48, 88,
+ 49, 114, 55, 56, 115, 163, -44, 50, 166, 167,
+ 182, 116, 57, 92, 115, 80, 81, 64, 62, 176,
+ -9, 83, 65, 23, 82, 68, 100, 102, 84, 200,
+ 105, 106, 107, 108, 109, 110, 111, 112, 113, 21,
+ 85, 94, 144, 29, 199, 147, 148, 121, 128, 103,
+ 34, 115, 117, 88, 154, 118, 123, 124, 122, 129,
+ 175, 165, 119, 120, 125, 130, 132, 127, 174, 93,
+ 62, 181, 145, 149, 177, 178, 131, 180, 141, 150,
+ 152, 162, 164, 168, 186, 158, 69, 70, 185, 187,
+ 191, 71, 193, 72, 73, 74, 75, 146, 183, 188,
+ 189, 76, 77, 157, -5, 1, 153, 203, 190, 204,
+ 195, 2, 3, 4, 5, 173, 197, 196, 198, 202,
+ 98, 6, 68, 7, 8, 9, 160, 161, 10, 11,
+ 12, 0, 179, 68, 90, 13, 14, 15, 0, 192,
+ 2, 3, 4, 51, 0, 0, 0, 69, 70, 0,
+ 16, 17, 71, 0, 201, -5, 18, 2, 3, 4,
+ 51, 0, 76, 77, 52, 0, 15, 6, 0, 7,
+ 8, 9, 0, 0, 0, 11, 12, 0, 0, 16,
+ 17, 13, 14, 15, 0, 18, 2, 3, 4, 51,
+ 0, 0, 0, 0, 0, 0, 16, 17, 0, 0,
+ 0, 62, 18, 2, 3, 4, 51, 0, 0, 0,
+ 52, 0, 15, 6, 0, 7, 8, 9, 0, 0,
+ 0, 11, 12, 0, 0, 16, 17, 13, 14, 15,
+ 0, 66, 0, 0, 2, 3, 4, 51, 0, 0,
+ 69, 70, 16, 17, 6, 71, 7, 8, 18, 74,
+ 75, 0, 11, 12, 0, 76, 77, 0, 13, 38,
+ 15, 0, 0, 0, 0, 0, 39, 0, 0, 0,
+ 0, 40, 0, 16, 17, 41, 42, 43, 44, 18,
+ 69, 70, 0, 45, 0, 71, 104, 72, 73, 74,
+ 75, 0, 69, 70, 97, 76, 77, 71, 0, 72,
+ 73, 74, 75, 0, 69, 70, 97, 76, 77, 71,
+ 104, 72, 73, 74, 75, 0, 69, 70, 0, 76,
+ 77, 71, 0, 72, 73, 74, 75, 0, -51, -51,
+ 0, 76, 77, -51, 0, 0, 0, -51, -51, 0,
+ 0, 34, 0, -51, -51
};
static const yytype_int16 yycheck[] =
{
- 0, 5, 63, 0, 65, 128, 15, 0, 15, 16,
- 13, 36, 37, 52, 13, 35, 0, 16, 17, 18,
- 127, 0, 39, 40, 11, 45, 11, 44, 27, 38,
- 53, 18, 35, 56, 33, 34, 35, 54, 55, 14,
- 27, 16, 149, 51, 51, 10, 153, 154, 56, 172,
- 10, 10, 53, 52, 51, 56, 10, 164, 51, 27,
- 52, 29, 62, 45, 63, 64, 65, 35, 191, 68,
- 69, 70, 71, 72, 73, 74, 75, 76, 62, 34,
- 35, 133, 189, 62, 136, 137, 90, 56, 11, 11,
- 27, 52, 10, 145, 34, 94, 95, 10, 102, 160,
- 152, 11, 11, 56, 103, 11, 27, 159, 22, 10,
- 171, 53, 53, 165, 166, 114, 168, 51, 10, 35,
- 56, 10, 16, 175, 10, 39, 40, 32, 21, 181,
- 44, 183, 46, 47, 48, 49, 135, 15, 38, 34,
- 54, 55, 146, 0, 1, 144, 198, 16, 200, 16,
- 7, 8, 9, 10, 158, 16, 16, 34, 32, 21,
- 17, 160, 19, 20, 21, 21, 32, 24, 25, 26,
- 147, 62, 171, 168, 31, 32, 33, 147, 182, 7,
- 8, 9, 10, 46, -1, -1, -1, -1, -1, 46,
- 47, -1, -1, 193, 51, 52, 7, 8, 9, 10,
- -1, -1, -1, 31, -1, 33, 17, -1, 19, 20,
- 21, -1, -1, -1, 25, 26, -1, -1, 46, 47,
- 31, 32, 33, -1, 52, 7, 8, 9, 10, -1,
- -1, -1, -1, -1, -1, 46, 47, -1, -1, -1,
- 51, 52, 7, 8, 9, 10, -1, -1, -1, 31,
- -1, 33, 17, -1, 19, 20, 21, -1, -1, -1,
- 25, 26, -1, -1, 46, 47, 31, 32, 33, -1,
- 52, -1, -1, 7, 8, 9, 10, -1, -1, 39,
- 40, 46, 47, 17, 44, 19, 20, 52, 48, 49,
- -1, 25, 26, -1, 54, 55, -1, 31, 11, 33,
- -1, -1, -1, -1, -1, 18, -1, -1, -1, -1,
- 23, -1, 46, 47, 27, 28, 29, 30, 52, 39,
- 40, -1, 35, -1, 44, 45, 46, 47, 48, 49,
- -1, 39, 40, 53, 54, 55, 44, -1, 46, 47,
- 48, 49, -1, 39, 40, 53, 54, 55, 44, 45,
- 46, 47, 48, 49, -1, 39, 40, -1, 54, 55,
- 44, -1, 46, 47, 48, 49, -1, 39, 40, -1,
- 54, 55, 44, -1, -1, -1, 48, 49, -1, -1,
- 52, -1, 54, 55
+ 0, 5, 15, 64, 19, 66, 129, 0, 51, 0,
+ 15, 16, 52, 56, 13, 13, 0, 16, 17, 18,
+ 0, 35, 128, 11, 27, 38, 29, 14, 27, 16,
+ 18, 45, 35, 10, 33, 34, 35, 35, 10, 27,
+ 11, 53, 36, 37, 56, 151, 51, 10, 154, 155,
+ 173, 53, 10, 52, 56, 34, 35, 52, 51, 165,
+ 51, 11, 45, 63, 56, 64, 65, 66, 11, 192,
+ 69, 70, 71, 72, 73, 74, 75, 76, 77, 63,
+ 27, 10, 134, 63, 190, 137, 138, 91, 103, 34,
+ 52, 56, 10, 27, 146, 11, 95, 96, 10, 103,
+ 161, 153, 11, 11, 53, 104, 10, 53, 160, 22,
+ 51, 172, 35, 10, 166, 167, 115, 169, 133, 56,
+ 16, 10, 32, 21, 176, 15, 39, 40, 34, 16,
+ 182, 44, 184, 46, 47, 48, 49, 136, 38, 16,
+ 16, 54, 55, 147, 0, 1, 145, 199, 34, 201,
+ 16, 7, 8, 9, 10, 159, 21, 32, 21, 32,
+ 63, 17, 161, 19, 20, 21, 148, 148, 24, 25,
+ 26, -1, 169, 172, 46, 31, 32, 33, -1, 183,
+ 7, 8, 9, 10, -1, -1, -1, 39, 40, -1,
+ 46, 47, 44, -1, 194, 51, 52, 7, 8, 9,
+ 10, -1, 54, 55, 31, -1, 33, 17, -1, 19,
+ 20, 21, -1, -1, -1, 25, 26, -1, -1, 46,
+ 47, 31, 32, 33, -1, 52, 7, 8, 9, 10,
+ -1, -1, -1, -1, -1, -1, 46, 47, -1, -1,
+ -1, 51, 52, 7, 8, 9, 10, -1, -1, -1,
+ 31, -1, 33, 17, -1, 19, 20, 21, -1, -1,
+ -1, 25, 26, -1, -1, 46, 47, 31, 32, 33,
+ -1, 52, -1, -1, 7, 8, 9, 10, -1, -1,
+ 39, 40, 46, 47, 17, 44, 19, 20, 52, 48,
+ 49, -1, 25, 26, -1, 54, 55, -1, 31, 11,
+ 33, -1, -1, -1, -1, -1, 18, -1, -1, -1,
+ -1, 23, -1, 46, 47, 27, 28, 29, 30, 52,
+ 39, 40, -1, 35, -1, 44, 45, 46, 47, 48,
+ 49, -1, 39, 40, 53, 54, 55, 44, -1, 46,
+ 47, 48, 49, -1, 39, 40, 53, 54, 55, 44,
+ 45, 46, 47, 48, 49, -1, 39, 40, -1, 54,
+ 55, 44, -1, 46, 47, 48, 49, -1, 39, 40,
+ -1, 54, 55, 44, -1, -1, -1, 48, 49, -1,
+ -1, 52, -1, 54, 55
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -795,25 +795,25 @@ static const yytype_uint8 yystos[] =
{
0, 1, 7, 8, 9, 10, 17, 19, 20, 21,
24, 25, 26, 31, 32, 33, 46, 47, 52, 58,
- 59, 60, 61, 62, 63, 69, 70, 71, 76, 77,
- 79, 82, 86, 52, 52, 73, 10, 78, 11, 18,
- 23, 27, 28, 29, 30, 35, 80, 81, 10, 11,
- 10, 10, 31, 60, 76, 36, 37, 10, 76, 76,
- 76, 0, 51, 52, 45, 52, 68, 76, 39, 40,
- 44, 46, 47, 48, 49, 54, 55, 76, 87, 87,
- 87, 56, 11, 11, 27, 11, 18, 27, 35, 81,
- 83, 76, 22, 10, 35, 45, 53, 59, 68, 76,
- 68, 76, 34, 45, 76, 76, 76, 76, 76, 76,
- 76, 76, 76, 53, 56, 53, 10, 11, 11, 11,
- 73, 10, 76, 76, 53, 74, 53, 51, 73, 76,
- 76, 10, 84, 75, 13, 35, 75, 61, 77, 51,
- 56, 51, 62, 74, 35, 76, 74, 74, 56, 85,
- 10, 16, 76, 74, 14, 16, 73, 15, 38, 66,
- 72, 10, 75, 32, 74, 75, 75, 21, 65, 66,
- 67, 72, 73, 74, 68, 75, 74, 74, 67, 74,
- 68, 61, 38, 64, 34, 74, 16, 16, 16, 34,
- 74, 73, 74, 73, 16, 32, 21, 21, 75, 61,
- 62, 32, 74, 74
+ 60, 61, 62, 63, 64, 70, 71, 72, 77, 78,
+ 80, 83, 87, 52, 52, 74, 10, 79, 11, 18,
+ 23, 27, 28, 29, 30, 35, 81, 82, 10, 11,
+ 10, 10, 31, 61, 77, 36, 37, 10, 77, 77,
+ 77, 0, 51, 59, 52, 45, 52, 69, 77, 39,
+ 40, 44, 46, 47, 48, 49, 54, 55, 77, 88,
+ 88, 88, 56, 11, 11, 27, 11, 18, 27, 35,
+ 82, 84, 77, 22, 10, 35, 45, 53, 60, 69,
+ 77, 69, 77, 34, 45, 77, 77, 77, 77, 77,
+ 77, 77, 77, 77, 53, 56, 53, 10, 11, 11,
+ 11, 74, 10, 77, 77, 53, 75, 53, 59, 74,
+ 77, 77, 10, 85, 76, 13, 35, 76, 62, 78,
+ 56, 59, 59, 63, 75, 35, 77, 75, 75, 10,
+ 56, 86, 16, 77, 75, 14, 16, 74, 15, 38,
+ 67, 73, 10, 76, 32, 75, 76, 76, 21, 66,
+ 67, 68, 73, 74, 75, 69, 76, 75, 75, 68,
+ 75, 69, 62, 38, 65, 34, 75, 16, 16, 16,
+ 34, 75, 74, 75, 74, 16, 32, 21, 21, 76,
+ 62, 63, 32, 75, 75
};
#define yyerrok (yyerrstatus = 0)
@@ -1627,18 +1627,26 @@ yyreduce:
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
- case 8:
-#line 101 "engines/director/lingo/lingo-gr.y"
+ case 4:
+#line 97 "engines/director/lingo/lingo-gr.y"
+ {
+ g_lingo->_linenumber++;
+ g_lingo->_colnumber = 1;
+ ;}
+ break;
+
+ case 9:
+#line 106 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 10:
-#line 103 "engines/director/lingo/lingo-gr.y"
+ case 11:
+#line 108 "engines/director/lingo/lingo-gr.y"
{ yyerrok; ;}
break;
- case 11:
-#line 106 "engines/director/lingo/lingo-gr.y"
+ case 12:
+#line 111 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str());
@@ -1647,8 +1655,8 @@ yyreduce:
delete (yyvsp[(4) - (4)].s); ;}
break;
- case 12:
-#line 112 "engines/director/lingo/lingo-gr.y"
+ case 13:
+#line 117 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1657,8 +1665,8 @@ yyreduce:
delete (yyvsp[(2) - (4)].s); ;}
break;
- case 13:
-#line 118 "engines/director/lingo/lingo-gr.y"
+ case 14:
+#line 123 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1667,13 +1675,13 @@ yyreduce:
delete (yyvsp[(2) - (4)].s); ;}
break;
- case 14:
-#line 125 "engines/director/lingo/lingo-gr.y"
+ case 15:
+#line 130 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 18:
-#line 134 "engines/director/lingo/lingo-gr.y"
+ case 19:
+#line 139 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1682,8 +1690,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
- case 19:
-#line 145 "engines/director/lingo/lingo-gr.y"
+ case 20:
+#line 150 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1698,8 +1706,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
break;
- case 20:
-#line 161 "engines/director/lingo/lingo-gr.y"
+ case 21:
+#line 166 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1714,8 +1722,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
break;
- case 21:
-#line 175 "engines/director/lingo/lingo-gr.y"
+ case 22:
+#line 180 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (8)].code));
@@ -1725,8 +1733,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 22:
-#line 182 "engines/director/lingo/lingo-gr.y"
+ case 23:
+#line 187 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1738,8 +1746,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 23:
-#line 191 "engines/director/lingo/lingo-gr.y"
+ case 24:
+#line 196 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1751,8 +1759,8 @@ yyreduce:
g_lingo->processIf(0, (yyvsp[(9) - (11)].code)); ;}
break;
- case 24:
-#line 200 "engines/director/lingo/lingo-gr.y"
+ case 25:
+#line 205 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1765,8 +1773,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 25:
-#line 210 "engines/director/lingo/lingo-gr.y"
+ case 26:
+#line 215 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1779,8 +1787,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 26:
-#line 220 "engines/director/lingo/lingo-gr.y"
+ case 27:
+#line 225 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1793,18 +1801,18 @@ yyreduce:
g_lingo->processIf(0, (yyvsp[(10) - (10)].code)); ;}
break;
- case 27:
-#line 231 "engines/director/lingo/lingo-gr.y"
+ case 28:
+#line 236 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = 0; ;}
break;
- case 28:
-#line 232 "engines/director/lingo/lingo-gr.y"
+ case 29:
+#line 237 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 31:
-#line 239 "engines/director/lingo/lingo-gr.y"
+ case 32:
+#line 244 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1813,8 +1821,8 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (6)].code)); ;}
break;
- case 33:
-#line 247 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 252 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
@@ -1823,23 +1831,23 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (5)].code)); ;}
break;
- case 34:
-#line 255 "engines/director/lingo/lingo-gr.y"
+ case 35:
+#line 260 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 35:
-#line 256 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 261 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 37:
-#line 259 "engines/director/lingo/lingo-gr.y"
+ case 38:
+#line 264 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 38:
-#line 261 "engines/director/lingo/lingo-gr.y"
+ case 39:
+#line 266 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1847,8 +1855,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 39:
-#line 267 "engines/director/lingo/lingo-gr.y"
+ case 40:
+#line 272 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -1856,8 +1864,8 @@ yyreduce:
g_lingo->codeLabel(0); ;}
break;
- case 40:
-#line 273 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 278 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -1866,23 +1874,23 @@ yyreduce:
g_lingo->code1(skipEnd); ;}
break;
- case 41:
-#line 280 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 285 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 42:
-#line 282 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 287 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 43:
-#line 284 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 289 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 46:
-#line 289 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 294 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1890,15 +1898,15 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 47:
-#line 294 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 299 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
- case 48:
-#line 297 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 302 "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));
@@ -1907,8 +1915,8 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 49:
-#line 303 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 308 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1919,121 +1927,121 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 50:
-#line 311 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 316 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 52:
-#line 315 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 320 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 53:
-#line 316 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 321 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 54:
-#line 317 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 322 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 55:
-#line 318 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 323 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 56:
-#line 319 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 324 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 57:
-#line 320 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 325 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 58:
-#line 321 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 326 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 59:
-#line 322 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 327 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 60:
-#line 323 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 328 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 61:
-#line 324 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 329 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 62:
-#line 325 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 330 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 63:
-#line 326 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 331 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 64:
-#line 329 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 334 "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 65:
-#line 330 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 335 "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 66:
-#line 331 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 336 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 68:
-#line 333 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 338 "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 70:
-#line 338 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 343 "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 71:
-#line 339 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 344 "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 72:
-#line 350 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 355 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 73:
-#line 351 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 356 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 74:
-#line 352 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 357 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 75:
-#line 353 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 358 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2041,8 +2049,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 76:
-#line 358 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 363 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2051,8 +2059,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 77:
-#line 364 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 369 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2060,48 +2068,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 78:
-#line 371 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 376 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 79:
-#line 372 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 377 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 80:
-#line 373 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 378 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 81:
-#line 374 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 379 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 82:
-#line 377 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 382 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 83:
-#line 378 "engines/director/lingo/lingo-gr.y"
+ case 84:
+#line 383 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 84:
-#line 379 "engines/director/lingo/lingo-gr.y"
+ case 85:
+#line 384 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 85:
-#line 407 "engines/director/lingo/lingo-gr.y"
+ case 86:
+#line 412 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 86:
-#line 408 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 413 "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);
@@ -2109,33 +2117,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 87:
-#line 414 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 419 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 88:
-#line 415 "engines/director/lingo/lingo-gr.y"
+ case 89:
+#line 420 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 89:
-#line 416 "engines/director/lingo/lingo-gr.y"
+ case 90:
+#line 421 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 90:
-#line 417 "engines/director/lingo/lingo-gr.y"
+ case 91:
+#line 422 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 91:
-#line 419 "engines/director/lingo/lingo-gr.y"
+ case 92:
+#line 424 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 92:
-#line 422 "engines/director/lingo/lingo-gr.y"
+ case 93:
+#line 427 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2144,24 +2152,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 93:
-#line 430 "engines/director/lingo/lingo-gr.y"
+ case 94:
+#line 435 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 94:
-#line 431 "engines/director/lingo/lingo-gr.y"
+ case 95:
+#line 436 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 95:
-#line 432 "engines/director/lingo/lingo-gr.y"
+ case 96:
+#line 437 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2165 "engines/director/lingo/lingo-gr.cpp"
+#line 2173 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2375,6 +2383,6 @@ yyreturn:
}
-#line 435 "engines/director/lingo/lingo-gr.y"
+#line 440 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 221c721..e5d5e72 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -56,7 +56,7 @@
extern int yylex();
extern int yyparse();
-void yyerror(char *s) { error("%s", s); }
+void yyerror(char *s) { error("%s at line %d col %d", s, Director::g_lingo->_linenumber, Director::g_lingo->_colnumber); }
using namespace Director;
@@ -90,10 +90,15 @@ using namespace Director;
%%
-program: program '\n' programline
+program: program nl programline
| programline
;
+nl: '\n' {
+ g_lingo->_linenumber++;
+ g_lingo->_colnumber = 1;
+ }
+
programline:
| defn
| func
@@ -172,14 +177,14 @@ stmt: stmtoneliner
(*g_lingo->_currentScript)[$1 + 5] = end; } /* end, if cond fails */
;
-ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF {
+ifstmt: if cond tTHEN nl stmtlist end tEND tIF {
inst then = 0, end = 0;
WRITE_UINT32(&then, $5);
WRITE_UINT32(&end, $6);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN '\n' stmtlist end tELSE stmtlist end tEND tIF {
+ | if cond tTHEN nl stmtlist end tELSE stmtlist end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
WRITE_UINT32(&else1, $8);
@@ -188,7 +193,7 @@ ifstmt: if cond tTHEN '\n' stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN '\n' stmtlist end begin elseifstmt end tEND tIF {
+ | if cond tTHEN nl stmtlist end begin elseifstmt end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
WRITE_UINT32(&else1, $7);
@@ -282,7 +287,7 @@ begin: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
end: /* nothing */ { g_lingo->code1(STOP); $$ = g_lingo->_currentScript->size(); }
;
stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
- | stmtlist '\n'
+ | stmtlist nl
| stmtlist stmt
;
@@ -405,7 +410,7 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
// See also:
// on keyword
defn: tMACRO ID { g_lingo->_indef = true; }
- begin argdef '\n' argstore stmtlist {
+ begin argdef nl argstore stmtlist {
g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$2, $4, $5);
@@ -414,7 +419,7 @@ defn: tMACRO ID { g_lingo->_indef = true; }
argdef: /* nothing */ { $$ = 0; }
| ID { g_lingo->codeArg($1); $$ = 1; }
| argdef ',' ID { g_lingo->codeArg($3); $$ = $1 + 1; }
- | argdef '\n' ',' ID { g_lingo->codeArg($4); $$ = $1 + 1; }
+ | argdef nl ',' ID { g_lingo->codeArg($4); $$ = $1 + 1; }
;
argstore: /* nothing */ { g_lingo->codeArgStore(); }
;
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index d302e38..60ae123 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -608,8 +608,21 @@ char *yytext;
#include "director/lingo/lingo-gr.h"
int yyparse();
+static void count() {
+ Director::g_lingo->_colnumber += strlen(yytext);
+}
+
+static void countnl() {
+ char *p = yytext;
-#line 613 "engines/director/lingo/lingo-lex.cpp"
+ while(*p == '\n' || *p == '\r')
+ p++;
+
+ Director::g_lingo->_linenumber++;
+ Director::g_lingo->_colnumber = strlen(p);
+}
+
+#line 626 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -794,10 +807,10 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 45 "engines/director/lingo/lingo-lex.l"
+#line 58 "engines/director/lingo/lingo-lex.l"
-#line 801 "engines/director/lingo/lingo-lex.cpp"
+#line 814 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -883,170 +896,171 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 47 "engines/director/lingo/lingo-lex.l"
+#line 60 "engines/director/lingo/lingo-lex.l"
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 48 "engines/director/lingo/lingo-lex.l"
-
+#line 61 "engines/director/lingo/lingo-lex.l"
+{ count(); }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 49 "engines/director/lingo/lingo-lex.l"
-{ return ' '; }
+#line 62 "engines/director/lingo/lingo-lex.l"
+{ count(); return ' '; }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 51 "engines/director/lingo/lingo-lex.l"
-{ return tDOWN; }
+#line 64 "engines/director/lingo/lingo-lex.l"
+{ count(); return tDOWN; }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 52 "engines/director/lingo/lingo-lex.l"
-{ return tIF; }
+#line 65 "engines/director/lingo/lingo-lex.l"
+{ count(); return tIF; }
YY_BREAK
case 6:
/* rule 6 can match eol */
YY_RULE_SETUP
-#line 53 "engines/director/lingo/lingo-lex.l"
-{ return tNLELSIF; }
+#line 66 "engines/director/lingo/lingo-lex.l"
+{ countnl(); return tNLELSIF; }
YY_BREAK
case 7:
/* rule 7 can match eol */
YY_RULE_SETUP
-#line 54 "engines/director/lingo/lingo-lex.l"
-{ return tNLELSE; }
+#line 67 "engines/director/lingo/lingo-lex.l"
+{ countnl(); return tNLELSE; }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 55 "engines/director/lingo/lingo-lex.l"
-{ return tELSE; }
+#line 68 "engines/director/lingo/lingo-lex.l"
+{ count(); return tELSE; }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 56 "engines/director/lingo/lingo-lex.l"
-{ return tEND; }
+#line 69 "engines/director/lingo/lingo-lex.l"
+{ count(); return tEND; }
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 57 "engines/director/lingo/lingo-lex.l"
-{ return tEXIT; }
+#line 70 "engines/director/lingo/lingo-lex.l"
+{ count(); return tEXIT; }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 58 "engines/director/lingo/lingo-lex.l"
-{ return tFRAME; }
+#line 71 "engines/director/lingo/lingo-lex.l"
+{ count(); return tFRAME; }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 59 "engines/director/lingo/lingo-lex.l"
-{ return tGLOBAL; }
+#line 72 "engines/director/lingo/lingo-lex.l"
+{ count(); return tGLOBAL; }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 60 "engines/director/lingo/lingo-lex.l"
-{ return tGO; }
+#line 73 "engines/director/lingo/lingo-lex.l"
+{ count(); return tGO; }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 61 "engines/director/lingo/lingo-lex.l"
-{ return tINTO; }
+#line 74 "engines/director/lingo/lingo-lex.l"
+{ count(); return tINTO; }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 62 "engines/director/lingo/lingo-lex.l"
-{ return tLOOP; }
+#line 75 "engines/director/lingo/lingo-lex.l"
+{ count(); return tLOOP; }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 63 "engines/director/lingo/lingo-lex.l"
-{ return tMACRO; }
+#line 76 "engines/director/lingo/lingo-lex.l"
+{ count(); return tMACRO; }
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 64 "engines/director/lingo/lingo-lex.l"
-{ return tMCI; }
+#line 77 "engines/director/lingo/lingo-lex.l"
+{ count(); return tMCI; }
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 65 "engines/director/lingo/lingo-lex.l"
-{ return tMCIWAIT; }
+#line 78 "engines/director/lingo/lingo-lex.l"
+{ count(); return tMCIWAIT; }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 66 "engines/director/lingo/lingo-lex.l"
-{ return tMOVIE; }
+#line 79 "engines/director/lingo/lingo-lex.l"
+{ count(); return tMOVIE; }
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 67 "engines/director/lingo/lingo-lex.l"
-{ return tNEXT; }
+#line 80 "engines/director/lingo/lingo-lex.l"
+{ count(); return tNEXT; }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 68 "engines/director/lingo/lingo-lex.l"
-{ return tOF; }
+#line 81 "engines/director/lingo/lingo-lex.l"
+{ count(); return tOF; }
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 69 "engines/director/lingo/lingo-lex.l"
-{ return tPREVIOUS; }
+#line 82 "engines/director/lingo/lingo-lex.l"
+{ count(); return tPREVIOUS; }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 70 "engines/director/lingo/lingo-lex.l"
-{ return tPUT; }
+#line 83 "engines/director/lingo/lingo-lex.l"
+{ count(); return tPUT; }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 71 "engines/director/lingo/lingo-lex.l"
-{ return tREPEAT; }
+#line 84 "engines/director/lingo/lingo-lex.l"
+{ count(); return tREPEAT; }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 72 "engines/director/lingo/lingo-lex.l"
-{ return tSET; }
+#line 85 "engines/director/lingo/lingo-lex.l"
+{ count(); return tSET; }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 73 "engines/director/lingo/lingo-lex.l"
-{ return tTHEN; }
+#line 86 "engines/director/lingo/lingo-lex.l"
+{ count(); return tTHEN; }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 74 "engines/director/lingo/lingo-lex.l"
-{ return tTO; }
+#line 87 "engines/director/lingo/lingo-lex.l"
+{ count(); return tTO; }
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 75 "engines/director/lingo/lingo-lex.l"
-{ return tWITH; }
+#line 88 "engines/director/lingo/lingo-lex.l"
+{ count(); return tWITH; }
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 76 "engines/director/lingo/lingo-lex.l"
-{ return tWHILE; }
+#line 89 "engines/director/lingo/lingo-lex.l"
+{ count(); return tWHILE; }
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 78 "engines/director/lingo/lingo-lex.l"
-{ return tNEQ; }
+#line 91 "engines/director/lingo/lingo-lex.l"
+{ count(); return tNEQ; }
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 79 "engines/director/lingo/lingo-lex.l"
-{ return tGE; }
+#line 92 "engines/director/lingo/lingo-lex.l"
+{ count(); return tGE; }
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 80 "engines/director/lingo/lingo-lex.l"
-{ return tLE; }
+#line 93 "engines/director/lingo/lingo-lex.l"
+{ count(); return tLE; }
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 82 "engines/director/lingo/lingo-lex.l"
+#line 95 "engines/director/lingo/lingo-lex.l"
{
+ count();
yylval.s = new Common::String(yytext);
if (Director::g_lingo->_builtins.contains(yytext))
@@ -1057,41 +1071,41 @@ YY_RULE_SETUP
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 90 "engines/director/lingo/lingo-lex.l"
-{ yylval.f = atof(yytext); return FLOAT; }
+#line 104 "engines/director/lingo/lingo-lex.l"
+{ count(); yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 91 "engines/director/lingo/lingo-lex.l"
-{ yylval.i = strtol(yytext, NULL, 10); return INT; }
+#line 105 "engines/director/lingo/lingo-lex.l"
+{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 92 "engines/director/lingo/lingo-lex.l"
-{ return *yytext; }
+#line 106 "engines/director/lingo/lingo-lex.l"
+{ count(); return *yytext; }
YY_BREAK
case 37:
/* rule 37 can match eol */
YY_RULE_SETUP
-#line 93 "engines/director/lingo/lingo-lex.l"
+#line 107 "engines/director/lingo/lingo-lex.l"
{ return '\n'; }
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 94 "engines/director/lingo/lingo-lex.l"
-{ yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+#line 108 "engines/director/lingo/lingo-lex.l"
+{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 95 "engines/director/lingo/lingo-lex.l"
+#line 109 "engines/director/lingo/lingo-lex.l"
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 97 "engines/director/lingo/lingo-lex.l"
+#line 111 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1095 "engines/director/lingo/lingo-lex.cpp"
+#line 1109 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -2091,7 +2105,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 97 "engines/director/lingo/lingo-lex.l"
+#line 111 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index c340bd6..43b25f7 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -31,6 +31,19 @@
#include "director/lingo/lingo-gr.h"
int yyparse();
+static void count() {
+ Director::g_lingo->_colnumber += strlen(yytext);
+}
+
+static void countnl() {
+ char *p = yytext;
+
+ while(*p == '\n' || *p == '\r')
+ p++;
+
+ Director::g_lingo->_linenumber++;
+ Director::g_lingo->_colnumber = strlen(p);
+}
%}
@@ -45,41 +58,42 @@ whitespace [\t ]
%%
--[^\r\n]*
-^{whitespace}+
-[\t]+ { return ' '; }
-
-(?i:down) { return tDOWN; }
-(?i:if) { return tIF; }
-(?i:[\n\r]+[\t ]+else[\t ]+if) { return tNLELSIF; }
-(?i:[\n\r]+[\t ]+else) { return tNLELSE; }
-(?i:else) { return tELSE; }
-(?i:end) { return tEND; }
-(?i:exit) { return tEXIT; }
-(?i:frame) { return tFRAME; }
-(?i:global) { return tGLOBAL; }
-(?i:go) { return tGO; }
-(?i:into) { return tINTO; }
-(?i:loop) { return tLOOP; }
-(?i:macro) { return tMACRO; }
-(?i:mci) { return tMCI; }
-(?i:mciwait) { return tMCIWAIT; }
-(?i:movie) { return tMOVIE; }
-(?i:next) { return tNEXT; }
-(?i:of) { return tOF; }
-(?i:previous) { return tPREVIOUS; }
-(?i:put) { return tPUT; }
-(?i:repeat) { return tREPEAT; }
-(?i:set) { return tSET; }
-(?i:then) { return tTHEN; }
-(?i:to) { return tTO; }
-(?i:with) { return tWITH; }
-(?i:while) { return tWHILE; }
-
-[!][=] { return tNEQ; }
-[>][=] { return tGE; }
-[<][=] { return tLE; }
+^{whitespace}+ { count(); }
+[\t]+ { count(); return ' '; }
+
+(?i:down) { count(); return tDOWN; }
+(?i:if) { count(); return tIF; }
+(?i:[\n\r]+[\t ]+else[\t ]+if) { countnl(); return tNLELSIF; }
+(?i:[\n\r]+[\t ]+else) { countnl(); return tNLELSE; }
+(?i:else) { count(); return tELSE; }
+(?i:end) { count(); return tEND; }
+(?i:exit) { count(); return tEXIT; }
+(?i:frame) { count(); return tFRAME; }
+(?i:global) { count(); return tGLOBAL; }
+(?i:go) { count(); return tGO; }
+(?i:into) { count(); return tINTO; }
+(?i:loop) { count(); return tLOOP; }
+(?i:macro) { count(); return tMACRO; }
+(?i:mci) { count(); return tMCI; }
+(?i:mciwait) { count(); return tMCIWAIT; }
+(?i:movie) { count(); return tMOVIE; }
+(?i:next) { count(); return tNEXT; }
+(?i:of) { count(); return tOF; }
+(?i:previous) { count(); return tPREVIOUS; }
+(?i:put) { count(); return tPUT; }
+(?i:repeat) { count(); return tREPEAT; }
+(?i:set) { count(); return tSET; }
+(?i:then) { count(); return tTHEN; }
+(?i:to) { count(); return tTO; }
+(?i:with) { count(); return tWITH; }
+(?i:while) { count(); return tWHILE; }
+
+[!][=] { count(); return tNEQ; }
+[>][=] { count(); return tGE; }
+[<][=] { count(); return tLE; }
{identifier} {
+ count();
yylval.s = new Common::String(yytext);
if (Director::g_lingo->_builtins.contains(yytext))
@@ -87,11 +101,11 @@ whitespace [\t ]
return ID;
}
-{constfloat} { yylval.f = atof(yytext); return FLOAT; }
-{constinteger} { yylval.i = strtol(yytext, NULL, 10); return INT; }
-{operator} { return *yytext; }
+{constfloat} { count(); yylval.f = atof(yytext); return FLOAT; }
+{constinteger} { count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
+{operator} { count(); return *yytext; }
{newline} { return '\n'; }
-{conststring} { yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{conststring} { count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
.
%%
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index b1befd9..1ab0e89 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -89,6 +89,8 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
_returning = false;
_indef = false;
+ _linenumber = _colnumber = 0;
+
warning("Lingo Inited");
}
@@ -108,6 +110,8 @@ void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
_currentScriptType = type;
_scripts[type][id] = _currentScript;
+ _linenumber = _colnumber = 1;
+
// macros have conflicting grammar. Thus we ease life for the parser.
if (code.contains("\nmacro ")) {
const char *begin = strstr(code.c_str(), "\nmacro ") + 1;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index de3847c..d88f705 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -242,6 +242,9 @@ public:
BuiltinHash _builtins;
Common::Array<int> _labelstack;
+ int _linenumber;
+ int _colnumber;
+
private:
int parse(const char *code);
void push(Datum d);
Commit: bfe252edac5e5c0de769cfee7dff4ce8b4ba4487
https://github.com/scummvm/scummvm/commit/bfe252edac5e5c0de769cfee7dff4ce8b4ba4487
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix multiline if statements
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 8dc9ca7..b41468d 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -109,19 +109,19 @@ Common::Error DirectorEngine::run() {
_currentScore = nullptr;
_lingo->addCode("--\n\
- if x = 3 then exit\n\
- else if x = 4 then put 4\n\
- else put 10.0\n\
set x = 1\n\
if x = 5 then exit\n\
else put 10.0\n\
repeat with x = 1 to 5\n\
+ if x = 3 then put 30\n\
+ else if x = 4 then put 40\n\
+ else put 10.0\n\
if x = 1 then\n\
put 1\n\
else if x = 2 then\n\
put 2.1\n\
put 2.2\n\
- else if x = 3 then put 3\n\
+ else if x = 3 then put 3\n\
end if\n\
if x = 4 then put 4\n\
else put 5\n\
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index f295ea0..eea173f 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -432,7 +432,7 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 61
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 384
+#define YYLAST 392
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 57
@@ -441,7 +441,7 @@ union yyalloc
/* YYNRULES -- Number of rules. */
#define YYNRULES 96
/* YYNRULES -- Number of states. */
-#define YYNSTATES 205
+#define YYNSTATES 206
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -492,14 +492,14 @@ static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 11, 12, 14, 16, 18,
20, 22, 24, 29, 34, 39, 41, 43, 45, 47,
- 56, 68, 81, 90, 102, 114, 121, 132, 143, 144,
- 148, 151, 153, 160, 162, 168, 170, 174, 178, 181,
- 185, 187, 189, 190, 191, 192, 195, 198, 200, 202,
- 207, 212, 214, 216, 220, 224, 228, 232, 236, 240,
- 244, 248, 252, 255, 258, 262, 265, 268, 271, 273,
- 275, 278, 280, 284, 287, 290, 293, 296, 300, 303,
- 307, 310, 313, 315, 319, 322, 326, 327, 336, 337,
- 339, 343, 348, 349, 353, 354, 356
+ 56, 68, 81, 90, 102, 115, 122, 133, 144, 145,
+ 149, 152, 154, 161, 163, 169, 171, 175, 179, 182,
+ 186, 188, 190, 191, 192, 193, 196, 199, 201, 203,
+ 208, 213, 215, 217, 221, 225, 229, 233, 237, 241,
+ 245, 249, 253, 256, 259, 263, 266, 269, 272, 274,
+ 276, 279, 281, 285, 288, 291, 294, 297, 301, 304,
+ 308, 311, 314, 316, 320, 323, 327, 328, 337, 338,
+ 340, 344, 349, 350, 354, 355, 357
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -516,31 +516,32 @@ static const yytype_int8 yyrhs[] =
-1, 72, 69, 34, 59, 76, 75, 16, 21, -1,
72, 69, 34, 59, 76, 75, 14, 76, 75, 16,
21, -1, 72, 69, 34, 59, 76, 75, 74, 66,
- 75, 16, 21, -1, 72, 69, 34, 74, 62, 75,
- -1, 72, 69, 34, 74, 62, 75, 38, 74, 62,
- 75, -1, 72, 69, 34, 74, 62, 75, 67, 75,
- 65, 75, -1, -1, 38, 74, 62, -1, 66, 68,
- -1, 68, -1, 73, 69, 34, 74, 63, 75, -1,
- 67, -1, 73, 69, 34, 76, 75, -1, 77, -1,
- 77, 45, 77, -1, 52, 69, 53, -1, 32, 37,
- -1, 32, 36, 10, -1, 21, -1, 15, -1, -1,
- -1, -1, 76, 59, -1, 76, 63, -1, 7, -1,
- 8, -1, 9, 52, 88, 53, -1, 10, 52, 88,
- 53, -1, 10, -1, 61, -1, 77, 46, 77, -1,
- 77, 47, 77, -1, 77, 48, 77, -1, 77, 49,
- 77, -1, 77, 54, 77, -1, 77, 55, 77, -1,
- 77, 44, 77, -1, 77, 39, 77, -1, 77, 40,
- 77, -1, 46, 77, -1, 47, 77, -1, 52, 77,
- 53, -1, 25, 11, -1, 26, 10, -1, 31, 77,
- -1, 80, -1, 17, -1, 19, 79, -1, 10, -1,
- 79, 56, 10, -1, 20, 23, -1, 20, 28, -1,
- 20, 30, -1, 20, 81, -1, 20, 81, 82, -1,
- 20, 82, -1, 35, 18, 11, -1, 18, 11, -1,
- 35, 11, -1, 11, -1, 29, 27, 11, -1, 27,
- 11, -1, 35, 27, 11, -1, -1, 24, 10, 84,
- 74, 85, 59, 86, 76, -1, -1, 10, -1, 85,
- 56, 10, -1, 85, 59, 56, 10, -1, -1, 10,
- 74, 88, -1, -1, 77, -1, 88, 56, 77, -1
+ 75, 59, 16, 21, -1, 72, 69, 34, 74, 62,
+ 75, -1, 72, 69, 34, 74, 62, 75, 38, 74,
+ 62, 75, -1, 72, 69, 34, 74, 62, 75, 67,
+ 75, 65, 75, -1, -1, 38, 74, 62, -1, 66,
+ 68, -1, 68, -1, 73, 69, 34, 74, 63, 75,
+ -1, 67, -1, 73, 69, 34, 76, 75, -1, 77,
+ -1, 77, 45, 77, -1, 52, 69, 53, -1, 32,
+ 37, -1, 32, 36, 10, -1, 21, -1, 15, -1,
+ -1, -1, -1, 76, 59, -1, 76, 63, -1, 7,
+ -1, 8, -1, 9, 52, 88, 53, -1, 10, 52,
+ 88, 53, -1, 10, -1, 61, -1, 77, 46, 77,
+ -1, 77, 47, 77, -1, 77, 48, 77, -1, 77,
+ 49, 77, -1, 77, 54, 77, -1, 77, 55, 77,
+ -1, 77, 44, 77, -1, 77, 39, 77, -1, 77,
+ 40, 77, -1, 46, 77, -1, 47, 77, -1, 52,
+ 77, 53, -1, 25, 11, -1, 26, 10, -1, 31,
+ 77, -1, 80, -1, 17, -1, 19, 79, -1, 10,
+ -1, 79, 56, 10, -1, 20, 23, -1, 20, 28,
+ -1, 20, 30, -1, 20, 81, -1, 20, 81, 82,
+ -1, 20, 82, -1, 35, 18, 11, -1, 18, 11,
+ -1, 35, 11, -1, 11, -1, 29, 27, 11, -1,
+ 27, 11, -1, 35, 27, 11, -1, -1, 24, 10,
+ 84, 74, 85, 59, 86, 76, -1, -1, 10, -1,
+ 85, 56, 10, -1, 85, 59, 56, 10, -1, -1,
+ 10, 74, 88, -1, -1, 77, -1, 88, 56, 77,
+ -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -614,7 +615,7 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 1, 0, 1, 1, 1, 1,
1, 1, 4, 4, 4, 1, 1, 1, 1, 8,
- 11, 12, 8, 11, 11, 6, 10, 10, 0, 3,
+ 11, 12, 8, 11, 12, 6, 10, 10, 0, 3,
2, 1, 6, 1, 5, 1, 3, 3, 2, 3,
1, 1, 0, 0, 0, 2, 2, 1, 1, 4,
4, 1, 1, 3, 3, 3, 3, 3, 3, 3,
@@ -648,8 +649,8 @@ static const yytype_uint8 yydefact[] =
43, 0, 91, 87, 19, 44, 43, 43, 22, 43,
33, 31, 0, 0, 28, 0, 43, 0, 0, 30,
0, 0, 43, 42, 43, 42, 0, 0, 0, 0,
- 42, 26, 0, 27, 0, 0, 20, 23, 24, 43,
- 29, 43, 21, 34, 32
+ 42, 26, 0, 27, 0, 0, 20, 23, 0, 43,
+ 29, 43, 21, 24, 34, 32
};
/* YYDEFGOTO[NTERM-NUM]. */
@@ -663,39 +664,39 @@ static const yytype_int16 yydefgoto[] =
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -124
+#define YYPACT_NINF -127
static const yytype_int16 yypact[] =
{
- 144, -124, -124, -124, -40, 329, -124, 23, 288, -124,
- 28, 29, 37, 173, 6, 42, 173, 173, 173, 7,
- -124, 9, -124, -124, -124, 5, 17, 219, 317, -124,
- -124, -124, -124, 173, 173, 173, -124, 8, -124, 50,
- -124, 57, -124, 53, -124, 12, -3, -124, -124, -124,
- -124, 38, 173, -124, 87, 71, -124, -14, 148, 148,
- 293, -124, -124, 144, 219, 173, 219, 55, 305, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 317, -12,
- -2, 35, 82, -124, -124, 84, -124, 91, 92, 66,
- -124, -124, 87, 88, -124, 173, 173, -124, -124, 51,
- 317, 54, 281, 59, 173, 317, 317, 317, 241, 241,
- 148, 148, 317, 317, -124, 173, -124, -124, -124, -124,
- -124, 96, -124, 317, 317, -124, 2, -124, -124, 267,
- 317, 317, -124, -43, 190, 77, 173, 190, -124, -124,
- 103, 63, -124, -124, 104, 173, 317, 13, -13, -124,
- 111, -124, 90, 317, -124, -124, 102, 110, -124, -124,
- -124, 219, -124, 190, -124, -124, 190, 190, -124, 110,
- -124, -124, 219, 267, 100, 94, 190, 113, 123, -124,
- 124, 114, -124, -124, -124, -124, 134, 125, 135, 137,
- -5, -124, 267, -124, 236, 127, -124, -124, -124, 190,
- -124, -124, -124, -124, -124
+ 164, -127, -127, -127, -18, -24, -127, 19, 308, -127,
+ 25, 54, 63, 123, -23, 73, 123, 123, 123, 8,
+ -127, 10, -127, -127, -127, 41, 39, 192, 337, -127,
+ -127, -127, -127, 123, 123, 123, -127, 42, -127, 99,
+ -127, 103, -127, 88, -127, 79, 33, -127, -127, -127,
+ -127, 65, 123, -127, -3, 109, -127, 13, 68, 68,
+ 313, -127, -127, 164, 192, 123, 192, 87, 325, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 337, 32,
+ 38, 70, 118, -127, -127, 124, -127, 125, 126, 102,
+ -127, -127, -3, 128, -127, 123, 123, -127, -127, 86,
+ 337, 91, 301, 94, 123, 337, 337, 337, 230, 230,
+ 68, 68, 337, 337, -127, 123, -127, -127, -127, -127,
+ -127, 136, -127, 337, 337, -127, -2, -127, -127, 287,
+ 337, 337, -127, -39, 210, 112, 123, 210, -127, -127,
+ 138, 93, -127, -127, 135, 123, 337, 89, 11, -127,
+ 142, -127, 121, 337, -127, -127, 137, 145, -127, -127,
+ -127, 192, -127, 210, -127, -127, 210, 210, -127, 145,
+ -127, -127, 192, 287, 129, 127, 210, 146, 152, -127,
+ 94, 144, -127, -127, -127, -127, 160, 148, 161, 170,
+ -9, -127, 287, -127, 256, 155, -127, -127, 171, 210,
+ -127, -127, -127, -127, -127, -127
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -124, -124, -15, 97, 16, -123, 0, -124, -124, -124,
- 18, 3, -61, -124, -124, -124, 19, -4, -52, -106,
- 1, 20, -124, -124, -124, 128, -124, -124, -124, -124,
- -124, 21
+ -127, -127, -17, 130, 4, -126, 0, -127, -127, -127,
+ 43, 29, -59, -127, -127, -127, 55, -4, -42, -101,
+ 5, 9, -127, -127, -127, 158, -127, -127, -127, -127,
+ -127, 21
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -705,88 +706,90 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -52
static const yytype_int16 yytable[] =
{
- 23, 35, 158, 99, 63, 101, 138, 61, 62, -9,
- -44, -44, 33, 140, 54, 135, 21, 58, 59, 60,
- 29, 95, 137, 86, 41, 159, 43, 155, 68, 156,
- 87, 96, 89, 36, 78, 78, 78, 136, 48, 88,
- 49, 114, 55, 56, 115, 163, -44, 50, 166, 167,
- 182, 116, 57, 92, 115, 80, 81, 64, 62, 176,
- -9, 83, 65, 23, 82, 68, 100, 102, 84, 200,
- 105, 106, 107, 108, 109, 110, 111, 112, 113, 21,
- 85, 94, 144, 29, 199, 147, 148, 121, 128, 103,
- 34, 115, 117, 88, 154, 118, 123, 124, 122, 129,
- 175, 165, 119, 120, 125, 130, 132, 127, 174, 93,
- 62, 181, 145, 149, 177, 178, 131, 180, 141, 150,
- 152, 162, 164, 168, 186, 158, 69, 70, 185, 187,
- 191, 71, 193, 72, 73, 74, 75, 146, 183, 188,
- 189, 76, 77, 157, -5, 1, 153, 203, 190, 204,
- 195, 2, 3, 4, 5, 173, 197, 196, 198, 202,
- 98, 6, 68, 7, 8, 9, 160, 161, 10, 11,
- 12, 0, 179, 68, 90, 13, 14, 15, 0, 192,
- 2, 3, 4, 51, 0, 0, 0, 69, 70, 0,
- 16, 17, 71, 0, 201, -5, 18, 2, 3, 4,
- 51, 0, 76, 77, 52, 0, 15, 6, 0, 7,
- 8, 9, 0, 0, 0, 11, 12, 0, 0, 16,
- 17, 13, 14, 15, 0, 18, 2, 3, 4, 51,
+ 23, 35, 63, 138, 21, 99, -44, 101, 61, 29,
+ -9, 135, 62, 55, 56, -51, -51, 140, 54, 93,
+ -51, 58, 59, 60, -51, -51, 158, 137, 34, 36,
+ -51, -51, 68, 136, 33, 48, 69, 70, 78, 78,
+ 78, 71, -44, 72, 73, 74, 75, 182, 95, 159,
+ 163, 76, 77, 166, 167, 80, 81, 92, 96, 62,
+ 41, -9, 43, 23, 176, 49, 200, 21, 89, 68,
+ 100, 102, 29, 50, 105, 106, 107, 108, 109, 110,
+ 111, 112, 113, 57, 65, 114, 128, 121, 115, 199,
+ 86, 116, 144, 64, 115, 147, 148, 87, 82, 129,
+ 123, 124, 175, 155, 154, 156, 88, 69, 70, 130,
+ 83, 165, 71, 181, 84, 85, 141, 34, 174, 94,
+ 131, 103, 76, 77, 177, 178, 115, 180, 117, 88,
+ 2, 3, 4, 51, 186, 118, 119, 120, 122, 125,
+ 191, 146, 193, 157, 127, 62, 132, 145, 149, 150,
+ 153, 152, 162, 164, 52, 173, 15, 204, 168, 205,
+ 158, 185, 187, 189, -5, 1, 68, 183, 188, 16,
+ 17, 2, 3, 4, 5, 18, 195, 68, 190, 192,
+ 196, 6, 197, 7, 8, 9, 198, 202, 10, 11,
+ 12, 160, 203, 98, 201, 13, 14, 15, 179, 2,
+ 3, 4, 51, 161, 90, 0, 0, 0, 0, 0,
+ 16, 17, 0, 0, 0, -5, 18, 2, 3, 4,
+ 51, 0, 0, 52, 0, 15, 0, 6, 0, 7,
+ 8, 9, 0, 0, 0, 11, 12, 0, 16, 17,
+ 0, 13, 14, 15, 66, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 16, 17, 0, 0,
- 0, 62, 18, 2, 3, 4, 51, 0, 0, 0,
- 52, 0, 15, 6, 0, 7, 8, 9, 0, 0,
- 0, 11, 12, 0, 0, 16, 17, 13, 14, 15,
- 0, 66, 0, 0, 2, 3, 4, 51, 0, 0,
- 69, 70, 16, 17, 6, 71, 7, 8, 18, 74,
- 75, 0, 11, 12, 0, 76, 77, 0, 13, 38,
+ 0, 62, 18, 2, 3, 4, 51, 0, 0, 69,
+ 70, 0, 0, 6, 71, 7, 8, 9, 74, 75,
+ 0, 11, 12, 0, 76, 77, 0, 13, 14, 15,
+ 0, 0, 0, 0, 2, 3, 4, 51, 0, 0,
+ 0, 0, 16, 17, 6, 0, 7, 8, 18, 0,
+ 0, 0, 11, 12, 0, 0, 0, 0, 13, 38,
15, 0, 0, 0, 0, 0, 39, 0, 0, 0,
0, 40, 0, 16, 17, 41, 42, 43, 44, 18,
69, 70, 0, 45, 0, 71, 104, 72, 73, 74,
75, 0, 69, 70, 97, 76, 77, 71, 0, 72,
73, 74, 75, 0, 69, 70, 97, 76, 77, 71,
104, 72, 73, 74, 75, 0, 69, 70, 0, 76,
- 77, 71, 0, 72, 73, 74, 75, 0, -51, -51,
- 0, 76, 77, -51, 0, 0, 0, -51, -51, 0,
- 0, 34, 0, -51, -51
+ 77, 71, 0, 72, 73, 74, 75, 0, 0, 0,
+ 0, 76, 77
};
static const yytype_int16 yycheck[] =
{
- 0, 5, 15, 64, 19, 66, 129, 0, 51, 0,
- 15, 16, 52, 56, 13, 13, 0, 16, 17, 18,
- 0, 35, 128, 11, 27, 38, 29, 14, 27, 16,
- 18, 45, 35, 10, 33, 34, 35, 35, 10, 27,
- 11, 53, 36, 37, 56, 151, 51, 10, 154, 155,
- 173, 53, 10, 52, 56, 34, 35, 52, 51, 165,
- 51, 11, 45, 63, 56, 64, 65, 66, 11, 192,
- 69, 70, 71, 72, 73, 74, 75, 76, 77, 63,
- 27, 10, 134, 63, 190, 137, 138, 91, 103, 34,
- 52, 56, 10, 27, 146, 11, 95, 96, 10, 103,
- 161, 153, 11, 11, 53, 104, 10, 53, 160, 22,
- 51, 172, 35, 10, 166, 167, 115, 169, 133, 56,
- 16, 10, 32, 21, 176, 15, 39, 40, 34, 16,
- 182, 44, 184, 46, 47, 48, 49, 136, 38, 16,
- 16, 54, 55, 147, 0, 1, 145, 199, 34, 201,
- 16, 7, 8, 9, 10, 159, 21, 32, 21, 32,
- 63, 17, 161, 19, 20, 21, 148, 148, 24, 25,
- 26, -1, 169, 172, 46, 31, 32, 33, -1, 183,
- 7, 8, 9, 10, -1, -1, -1, 39, 40, -1,
- 46, 47, 44, -1, 194, 51, 52, 7, 8, 9,
- 10, -1, 54, 55, 31, -1, 33, 17, -1, 19,
- 20, 21, -1, -1, -1, 25, 26, -1, -1, 46,
- 47, 31, 32, 33, -1, 52, 7, 8, 9, 10,
+ 0, 5, 19, 129, 0, 64, 15, 66, 0, 0,
+ 0, 13, 51, 36, 37, 39, 40, 56, 13, 22,
+ 44, 16, 17, 18, 48, 49, 15, 128, 52, 10,
+ 54, 55, 27, 35, 52, 10, 39, 40, 33, 34,
+ 35, 44, 51, 46, 47, 48, 49, 173, 35, 38,
+ 151, 54, 55, 154, 155, 34, 35, 52, 45, 51,
+ 27, 51, 29, 63, 165, 11, 192, 63, 35, 64,
+ 65, 66, 63, 10, 69, 70, 71, 72, 73, 74,
+ 75, 76, 77, 10, 45, 53, 103, 91, 56, 190,
+ 11, 53, 134, 52, 56, 137, 138, 18, 56, 103,
+ 95, 96, 161, 14, 146, 16, 27, 39, 40, 104,
+ 11, 153, 44, 172, 11, 27, 133, 52, 160, 10,
+ 115, 34, 54, 55, 166, 167, 56, 169, 10, 27,
+ 7, 8, 9, 10, 176, 11, 11, 11, 10, 53,
+ 182, 136, 184, 147, 53, 51, 10, 35, 10, 56,
+ 145, 16, 10, 32, 31, 159, 33, 199, 21, 201,
+ 15, 34, 16, 180, 0, 1, 161, 38, 16, 46,
+ 47, 7, 8, 9, 10, 52, 16, 172, 34, 183,
+ 32, 17, 21, 19, 20, 21, 16, 32, 24, 25,
+ 26, 148, 21, 63, 194, 31, 32, 33, 169, 7,
+ 8, 9, 10, 148, 46, -1, -1, -1, -1, -1,
+ 46, 47, -1, -1, -1, 51, 52, 7, 8, 9,
+ 10, -1, -1, 31, -1, 33, -1, 17, -1, 19,
+ 20, 21, -1, -1, -1, 25, 26, -1, 46, 47,
+ -1, 31, 32, 33, 52, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 46, 47, -1, -1,
- -1, 51, 52, 7, 8, 9, 10, -1, -1, -1,
- 31, -1, 33, 17, -1, 19, 20, 21, -1, -1,
- -1, 25, 26, -1, -1, 46, 47, 31, 32, 33,
- -1, 52, -1, -1, 7, 8, 9, 10, -1, -1,
- 39, 40, 46, 47, 17, 44, 19, 20, 52, 48,
- 49, -1, 25, 26, -1, 54, 55, -1, 31, 11,
+ -1, 51, 52, 7, 8, 9, 10, -1, -1, 39,
+ 40, -1, -1, 17, 44, 19, 20, 21, 48, 49,
+ -1, 25, 26, -1, 54, 55, -1, 31, 32, 33,
+ -1, -1, -1, -1, 7, 8, 9, 10, -1, -1,
+ -1, -1, 46, 47, 17, -1, 19, 20, 52, -1,
+ -1, -1, 25, 26, -1, -1, -1, -1, 31, 11,
33, -1, -1, -1, -1, -1, 18, -1, -1, -1,
-1, 23, -1, 46, 47, 27, 28, 29, 30, 52,
39, 40, -1, 35, -1, 44, 45, 46, 47, 48,
49, -1, 39, 40, 53, 54, 55, 44, -1, 46,
47, 48, 49, -1, 39, 40, 53, 54, 55, 44,
45, 46, 47, 48, 49, -1, 39, 40, -1, 54,
- 55, 44, -1, 46, 47, 48, 49, -1, 39, 40,
- -1, 54, 55, 44, -1, -1, -1, 48, 49, -1,
- -1, 52, -1, 54, 55
+ 55, 44, -1, 46, 47, 48, 49, -1, -1, -1,
+ -1, 54, 55
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -811,9 +814,9 @@ static const yytype_uint8 yystos[] =
56, 86, 16, 77, 75, 14, 16, 74, 15, 38,
67, 73, 10, 76, 32, 75, 76, 76, 21, 66,
67, 68, 73, 74, 75, 69, 76, 75, 75, 68,
- 75, 69, 62, 38, 65, 34, 75, 16, 16, 16,
- 34, 75, 74, 75, 74, 16, 32, 21, 21, 76,
- 62, 63, 32, 75, 75
+ 75, 69, 62, 38, 65, 34, 75, 16, 16, 59,
+ 34, 75, 74, 75, 74, 16, 32, 21, 16, 76,
+ 62, 63, 32, 21, 75, 75
};
#define yyerrok (yyerrstatus = 0)
@@ -1750,13 +1753,13 @@ yyreduce:
#line 196 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
- WRITE_UINT32(&else1, (yyvsp[(7) - (11)].code));
- WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, (yyvsp[(9) - (11)].code)); ;}
+ WRITE_UINT32(&then, (yyvsp[(5) - (12)].code));
+ WRITE_UINT32(&else1, (yyvsp[(7) - (12)].code));
+ WRITE_UINT32(&end, (yyvsp[(9) - (12)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; /* end, if cond fails */
+ g_lingo->processIf(0, (yyvsp[(9) - (12)].code)); ;}
break;
case 25:
@@ -2169,7 +2172,7 @@ yyreduce:
/* Line 1267 of yacc.c. */
-#line 2173 "engines/director/lingo/lingo-gr.cpp"
+#line 2176 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index e5d5e72..7653216 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -193,7 +193,7 @@ ifstmt: if cond tTHEN nl stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN nl stmtlist end begin elseifstmt end tEND tIF {
+ | if cond tTHEN nl stmtlist end begin elseifstmt end nl tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
WRITE_UINT32(&else1, $7);
Commit: 336f0bee9d49979bf527a1e7bb076aba0652f96e
https://github.com/scummvm/scummvm/commit/336f0bee9d49979bf527a1e7bb076aba0652f96e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Suport multiple one-line 'else if' statements
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index b41468d..09d70b4 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -115,6 +115,7 @@ Common::Error DirectorEngine::run() {
repeat with x = 1 to 5\n\
if x = 3 then put 30\n\
else if x = 4 then put 40\n\
+ else if x = 5 then put 50\n\
else put 10.0\n\
if x = 1 then\n\
put 1\n\
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index eea173f..049311e 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -437,11 +437,11 @@ union yyalloc
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 57
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 32
+#define YYNNTS 33
/* YYNRULES -- Number of rules. */
-#define YYNRULES 96
+#define YYNRULES 98
/* YYNRULES -- Number of states. */
-#define YYNSTATES 206
+#define YYNSTATES 208
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -493,55 +493,55 @@ static const yytype_uint16 yyprhs[] =
0, 0, 3, 7, 9, 11, 12, 14, 16, 18,
20, 22, 24, 29, 34, 39, 41, 43, 45, 47,
56, 68, 81, 90, 102, 115, 122, 133, 144, 145,
- 149, 152, 154, 161, 163, 169, 171, 175, 179, 182,
- 186, 188, 190, 191, 192, 193, 196, 199, 201, 203,
- 208, 213, 215, 217, 221, 225, 229, 233, 237, 241,
- 245, 249, 253, 256, 259, 263, 266, 269, 272, 274,
- 276, 279, 281, 285, 288, 291, 294, 297, 301, 304,
- 308, 311, 314, 316, 320, 323, 327, 328, 337, 338,
- 340, 344, 349, 350, 354, 355, 357
+ 149, 152, 154, 157, 159, 166, 168, 174, 176, 180,
+ 184, 187, 191, 193, 195, 196, 197, 198, 201, 204,
+ 206, 208, 213, 218, 220, 222, 226, 230, 234, 238,
+ 242, 246, 250, 254, 258, 261, 264, 268, 271, 274,
+ 277, 279, 281, 284, 286, 290, 293, 296, 299, 302,
+ 306, 309, 313, 316, 319, 321, 325, 328, 332, 333,
+ 342, 343, 345, 349, 354, 355, 359, 360, 362
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
58, 0, -1, 58, 59, 60, -1, 60, -1, 51,
- -1, -1, 83, -1, 78, -1, 87, -1, 61, -1,
- 63, -1, 1, -1, 31, 77, 22, 10, -1, 33,
- 10, 45, 77, -1, 33, 10, 35, 77, -1, 77,
- -1, 78, -1, 62, -1, 64, -1, 70, 52, 69,
- 53, 76, 75, 16, 32, -1, 71, 45, 77, 75,
- 35, 77, 75, 76, 75, 16, 32, -1, 71, 45,
- 77, 75, 13, 35, 77, 75, 76, 75, 16, 32,
- -1, 72, 69, 34, 59, 76, 75, 16, 21, -1,
- 72, 69, 34, 59, 76, 75, 14, 76, 75, 16,
- 21, -1, 72, 69, 34, 59, 76, 75, 74, 66,
- 75, 59, 16, 21, -1, 72, 69, 34, 74, 62,
- 75, -1, 72, 69, 34, 74, 62, 75, 38, 74,
- 62, 75, -1, 72, 69, 34, 74, 62, 75, 67,
- 75, 65, 75, -1, -1, 38, 74, 62, -1, 66,
- 68, -1, 68, -1, 73, 69, 34, 74, 63, 75,
- -1, 67, -1, 73, 69, 34, 76, 75, -1, 77,
- -1, 77, 45, 77, -1, 52, 69, 53, -1, 32,
- 37, -1, 32, 36, 10, -1, 21, -1, 15, -1,
- -1, -1, -1, 76, 59, -1, 76, 63, -1, 7,
- -1, 8, -1, 9, 52, 88, 53, -1, 10, 52,
- 88, 53, -1, 10, -1, 61, -1, 77, 46, 77,
- -1, 77, 47, 77, -1, 77, 48, 77, -1, 77,
- 49, 77, -1, 77, 54, 77, -1, 77, 55, 77,
- -1, 77, 44, 77, -1, 77, 39, 77, -1, 77,
- 40, 77, -1, 46, 77, -1, 47, 77, -1, 52,
- 77, 53, -1, 25, 11, -1, 26, 10, -1, 31,
- 77, -1, 80, -1, 17, -1, 19, 79, -1, 10,
- -1, 79, 56, 10, -1, 20, 23, -1, 20, 28,
- -1, 20, 30, -1, 20, 81, -1, 20, 81, 82,
- -1, 20, 82, -1, 35, 18, 11, -1, 18, 11,
- -1, 35, 11, -1, 11, -1, 29, 27, 11, -1,
- 27, 11, -1, 35, 27, 11, -1, -1, 24, 10,
- 84, 74, 85, 59, 86, 76, -1, -1, 10, -1,
- 85, 56, 10, -1, 85, 59, 56, 10, -1, -1,
- 10, 74, 88, -1, -1, 77, -1, 88, 56, 77,
- -1
+ -1, -1, 84, -1, 79, -1, 88, -1, 61, -1,
+ 63, -1, 1, -1, 31, 78, 22, 10, -1, 33,
+ 10, 45, 78, -1, 33, 10, 35, 78, -1, 78,
+ -1, 79, -1, 62, -1, 64, -1, 71, 52, 70,
+ 53, 77, 76, 16, 32, -1, 72, 45, 78, 76,
+ 35, 78, 76, 77, 76, 16, 32, -1, 72, 45,
+ 78, 76, 13, 35, 78, 76, 77, 76, 16, 32,
+ -1, 73, 70, 34, 59, 77, 76, 16, 21, -1,
+ 73, 70, 34, 59, 77, 76, 14, 77, 76, 16,
+ 21, -1, 73, 70, 34, 59, 77, 76, 75, 66,
+ 76, 59, 16, 21, -1, 73, 70, 34, 75, 62,
+ 76, -1, 73, 70, 34, 75, 62, 76, 38, 75,
+ 62, 76, -1, 73, 70, 34, 75, 62, 76, 67,
+ 76, 65, 76, -1, -1, 38, 75, 62, -1, 66,
+ 69, -1, 69, -1, 67, 68, -1, 68, -1, 74,
+ 70, 34, 75, 63, 76, -1, 67, -1, 74, 70,
+ 34, 77, 76, -1, 78, -1, 78, 45, 78, -1,
+ 52, 70, 53, -1, 32, 37, -1, 32, 36, 10,
+ -1, 21, -1, 15, -1, -1, -1, -1, 77, 59,
+ -1, 77, 63, -1, 7, -1, 8, -1, 9, 52,
+ 89, 53, -1, 10, 52, 89, 53, -1, 10, -1,
+ 61, -1, 78, 46, 78, -1, 78, 47, 78, -1,
+ 78, 48, 78, -1, 78, 49, 78, -1, 78, 54,
+ 78, -1, 78, 55, 78, -1, 78, 44, 78, -1,
+ 78, 39, 78, -1, 78, 40, 78, -1, 46, 78,
+ -1, 47, 78, -1, 52, 78, 53, -1, 25, 11,
+ -1, 26, 10, -1, 31, 78, -1, 81, -1, 17,
+ -1, 19, 80, -1, 10, -1, 80, 56, 10, -1,
+ 20, 23, -1, 20, 28, -1, 20, 30, -1, 20,
+ 82, -1, 20, 82, 83, -1, 20, 83, -1, 35,
+ 18, 11, -1, 18, 11, -1, 35, 11, -1, 11,
+ -1, 29, 27, 11, -1, 27, 11, -1, 35, 27,
+ 11, -1, -1, 24, 10, 85, 75, 86, 59, 87,
+ 77, -1, -1, 10, -1, 86, 56, 10, -1, 86,
+ 59, 56, 10, -1, -1, 10, 75, 89, -1, -1,
+ 78, -1, 89, 56, 78, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -550,13 +550,13 @@ static const yytype_uint16 yyrline[] =
0, 93, 93, 94, 97, 102, 103, 104, 105, 106,
107, 108, 111, 117, 123, 130, 131, 133, 134, 139,
150, 166, 180, 187, 196, 205, 215, 225, 236, 237,
- 240, 241, 244, 251, 252, 260, 261, 262, 264, 266,
- 272, 278, 285, 287, 289, 290, 291, 294, 299, 302,
- 308, 316, 319, 320, 321, 322, 323, 324, 325, 326,
- 327, 328, 329, 330, 331, 334, 335, 336, 337, 338,
- 340, 343, 344, 355, 356, 357, 358, 363, 369, 376,
- 377, 378, 379, 382, 383, 384, 412, 412, 419, 420,
- 421, 422, 424, 427, 435, 436, 437
+ 240, 241, 244, 245, 248, 256, 257, 265, 266, 267,
+ 269, 271, 277, 283, 290, 292, 294, 295, 296, 299,
+ 304, 307, 313, 321, 324, 325, 326, 327, 328, 329,
+ 330, 331, 332, 333, 334, 335, 336, 339, 340, 341,
+ 342, 343, 345, 348, 349, 360, 361, 362, 363, 368,
+ 374, 381, 382, 383, 384, 387, 388, 389, 417, 417,
+ 424, 425, 426, 427, 429, 432, 440, 441, 442
};
#endif
@@ -574,10 +574,10 @@ static const char *const yytname[] =
"'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'",
"','", "$accept", "program", "nl", "programline", "asgn", "stmtoneliner",
"stmt", "ifstmt", "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
- "elseifstmt1", "cond", "repeatwhile", "repeatwith", "if", "elseif",
- "begin", "end", "stmtlist", "expr", "func", "globallist", "gotofunc",
- "gotoframe", "gotomovie", "defn", "@1", "argdef", "argstore", "macro",
- "arglist", 0
+ "elseifstmtoneliner1", "elseifstmt1", "cond", "repeatwhile",
+ "repeatwith", "if", "elseif", "begin", "end", "stmtlist", "expr", "func",
+ "globallist", "gotofunc", "gotoframe", "gotomovie", "defn", "@1",
+ "argdef", "argstore", "macro", "arglist", 0
};
#endif
@@ -601,13 +601,13 @@ static const yytype_uint8 yyr1[] =
0, 57, 58, 58, 59, 60, 60, 60, 60, 60,
60, 60, 61, 61, 61, 62, 62, 63, 63, 63,
63, 63, 64, 64, 64, 64, 64, 64, 65, 65,
- 66, 66, 67, 68, 68, 69, 69, 69, 70, 71,
- 72, 73, 74, 75, 76, 76, 76, 77, 77, 77,
- 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
- 77, 77, 77, 77, 77, 78, 78, 78, 78, 78,
- 78, 79, 79, 80, 80, 80, 80, 80, 80, 81,
- 81, 81, 81, 82, 82, 82, 84, 83, 85, 85,
- 85, 85, 86, 87, 88, 88, 88
+ 66, 66, 67, 67, 68, 69, 69, 70, 70, 70,
+ 71, 72, 73, 74, 75, 76, 77, 77, 77, 78,
+ 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
+ 78, 78, 78, 78, 78, 78, 78, 79, 79, 79,
+ 79, 79, 79, 80, 80, 81, 81, 81, 81, 81,
+ 81, 82, 82, 82, 82, 83, 83, 83, 85, 84,
+ 86, 86, 86, 86, 87, 88, 89, 89, 89
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -616,13 +616,13 @@ static const yytype_uint8 yyr2[] =
0, 2, 3, 1, 1, 0, 1, 1, 1, 1,
1, 1, 4, 4, 4, 1, 1, 1, 1, 8,
11, 12, 8, 11, 12, 6, 10, 10, 0, 3,
- 2, 1, 6, 1, 5, 1, 3, 3, 2, 3,
- 1, 1, 0, 0, 0, 2, 2, 1, 1, 4,
- 4, 1, 1, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 2, 2, 3, 2, 2, 2, 1, 1,
- 2, 1, 3, 2, 2, 2, 2, 3, 2, 3,
- 2, 2, 1, 3, 2, 3, 0, 8, 0, 1,
- 3, 4, 0, 3, 0, 1, 3
+ 2, 1, 2, 1, 6, 1, 5, 1, 3, 3,
+ 2, 3, 1, 1, 0, 0, 0, 2, 2, 1,
+ 1, 4, 4, 1, 1, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 2, 2, 3, 2, 2, 2,
+ 1, 1, 2, 1, 3, 2, 2, 2, 2, 3,
+ 2, 3, 2, 2, 1, 3, 2, 3, 0, 8,
+ 0, 1, 3, 4, 0, 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -630,165 +630,165 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 47, 48, 0, 42, 69, 0, 0, 40,
+ 0, 11, 49, 50, 0, 44, 71, 0, 0, 42,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 3, 52, 17, 10, 18, 0, 0, 0, 15, 7,
- 68, 6, 8, 94, 94, 94, 71, 70, 82, 0,
- 73, 0, 74, 0, 75, 0, 76, 78, 86, 65,
- 66, 51, 0, 52, 67, 0, 38, 0, 62, 63,
- 0, 1, 4, 0, 0, 0, 0, 0, 35, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 95, 0,
- 0, 93, 0, 80, 84, 0, 81, 0, 0, 0,
- 77, 42, 0, 0, 39, 0, 0, 64, 2, 0,
- 43, 0, 0, 42, 0, 60, 61, 59, 53, 54,
- 55, 56, 57, 58, 49, 0, 50, 72, 83, 79,
- 85, 88, 12, 14, 13, 44, 0, 37, 44, 0,
- 36, 96, 89, 0, 43, 0, 0, 43, 43, 16,
- 0, 92, 45, 46, 0, 0, 43, 42, 25, 90,
- 0, 44, 0, 43, 44, 44, 0, 0, 41, 42,
- 43, 0, 91, 87, 19, 44, 43, 43, 22, 43,
- 33, 31, 0, 0, 28, 0, 43, 0, 0, 30,
- 0, 0, 43, 42, 43, 42, 0, 0, 0, 0,
- 42, 26, 0, 27, 0, 0, 20, 23, 0, 43,
- 29, 43, 21, 24, 34, 32
+ 3, 54, 17, 10, 18, 0, 0, 0, 15, 7,
+ 70, 6, 8, 96, 96, 96, 73, 72, 84, 0,
+ 75, 0, 76, 0, 77, 0, 78, 80, 88, 67,
+ 68, 53, 0, 54, 69, 0, 40, 0, 64, 65,
+ 0, 1, 4, 0, 0, 0, 0, 0, 37, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 97, 0,
+ 0, 95, 0, 82, 86, 0, 83, 0, 0, 0,
+ 79, 44, 0, 0, 41, 0, 0, 66, 2, 0,
+ 45, 0, 0, 44, 0, 62, 63, 61, 55, 56,
+ 57, 58, 59, 60, 51, 0, 52, 74, 85, 81,
+ 87, 90, 12, 14, 13, 46, 0, 39, 46, 0,
+ 38, 98, 91, 0, 45, 0, 0, 45, 45, 16,
+ 0, 94, 47, 48, 0, 0, 45, 44, 25, 92,
+ 0, 46, 0, 45, 46, 46, 0, 0, 43, 44,
+ 45, 33, 0, 93, 89, 19, 46, 45, 45, 22,
+ 45, 35, 31, 0, 0, 32, 28, 0, 45, 0,
+ 0, 30, 0, 0, 45, 44, 45, 44, 0, 0,
+ 0, 0, 44, 26, 0, 27, 0, 0, 20, 23,
+ 0, 45, 29, 45, 21, 24, 36, 34
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 19, 142, 20, 53, 22, 143, 24, 184, 169,
- 170, 171, 67, 25, 26, 27, 172, 194, 126, 134,
- 28, 139, 37, 30, 46, 47, 31, 91, 133, 151,
- 32, 79
+ -1, 19, 142, 20, 53, 22, 143, 24, 186, 170,
+ 171, 161, 172, 67, 25, 26, 27, 162, 196, 126,
+ 134, 28, 139, 37, 30, 46, 47, 31, 91, 133,
+ 151, 32, 79
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -127
+#define YYPACT_NINF -147
static const yytype_int16 yypact[] =
{
- 164, -127, -127, -127, -18, -24, -127, 19, 308, -127,
- 25, 54, 63, 123, -23, 73, 123, 123, 123, 8,
- -127, 10, -127, -127, -127, 41, 39, 192, 337, -127,
- -127, -127, -127, 123, 123, 123, -127, 42, -127, 99,
- -127, 103, -127, 88, -127, 79, 33, -127, -127, -127,
- -127, 65, 123, -127, -3, 109, -127, 13, 68, 68,
- 313, -127, -127, 164, 192, 123, 192, 87, 325, 123,
- 123, 123, 123, 123, 123, 123, 123, 123, 337, 32,
- 38, 70, 118, -127, -127, 124, -127, 125, 126, 102,
- -127, -127, -3, 128, -127, 123, 123, -127, -127, 86,
- 337, 91, 301, 94, 123, 337, 337, 337, 230, 230,
- 68, 68, 337, 337, -127, 123, -127, -127, -127, -127,
- -127, 136, -127, 337, 337, -127, -2, -127, -127, 287,
- 337, 337, -127, -39, 210, 112, 123, 210, -127, -127,
- 138, 93, -127, -127, 135, 123, 337, 89, 11, -127,
- 142, -127, 121, 337, -127, -127, 137, 145, -127, -127,
- -127, 192, -127, 210, -127, -127, 210, 210, -127, 145,
- -127, -127, 192, 287, 129, 127, 210, 146, 152, -127,
- 94, 144, -127, -127, -127, -127, 160, 148, 161, 170,
- -9, -127, 287, -127, 256, 155, -127, -127, 171, 210,
- -127, -127, -127, -127, -127, -127
+ 169, -147, -147, -147, -26, 337, -147, 46, 23, -147,
+ 50, 78, 51, 197, 11, 54, 197, 197, 197, 6,
+ -147, 8, -147, -147, -147, 38, 48, 243, 325, -147,
+ -147, -147, -147, 197, 197, 197, -147, 35, -147, 83,
+ -147, 89, -147, 76, -147, 12, 53, -147, -147, -147,
+ -147, 55, 197, -147, 282, 92, -147, -23, 95, 95,
+ 313, -147, -147, 169, 243, 197, 243, 71, 75, 197,
+ 197, 197, 197, 197, 197, 197, 197, 197, 325, -28,
+ 9, 52, 99, -147, -147, 102, -147, 116, 120, 105,
+ -147, -147, 282, 100, -147, 197, 197, -147, -147, 80,
+ 325, 84, 301, 90, 197, 325, 325, 325, 118, 118,
+ 95, 95, 325, 325, -147, 197, -147, -147, -147, -147,
+ -147, 130, -147, 325, 325, -147, 3, -147, -147, 292,
+ 325, 325, -147, -24, 215, 110, 197, 215, -147, -147,
+ 136, 96, -147, -147, 132, 197, 325, 69, -5, -147,
+ 141, -147, 121, 325, -147, -147, 133, 145, -147, -147,
+ 145, -147, 243, -147, 215, -147, -147, 215, 215, -147,
+ 145, 145, -147, 243, 292, -147, 125, 122, 215, 152,
+ 155, -147, 90, 140, -147, -147, -147, -147, 164, 150,
+ 162, 168, -6, -147, 292, -147, 261, 153, -147, -147,
+ 166, 215, -147, -147, -147, -147, -147, -147
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -127, -127, -17, 130, 4, -126, 0, -127, -127, -127,
- 43, 29, -59, -127, -127, -127, 55, -4, -42, -101,
- 5, 9, -127, -127, -127, 158, -127, -127, -127, -127,
- -127, 21
+ -147, -147, -17, 128, 7, -125, 0, -147, -147, -147,
+ 44, -129, 27, -61, -147, -147, -147, -146, -4, -42,
+ -111, 2, 21, -147, -147, -147, 157, -147, -147, -147,
+ -147, -147, -21
};
/* 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 -52
+#define YYTABLE_NINF -54
static const yytype_int16 yytable[] =
{
- 23, 35, 63, 138, 21, 99, -44, 101, 61, 29,
- -9, 135, 62, 55, 56, -51, -51, 140, 54, 93,
- -51, 58, 59, 60, -51, -51, 158, 137, 34, 36,
- -51, -51, 68, 136, 33, 48, 69, 70, 78, 78,
- 78, 71, -44, 72, 73, 74, 75, 182, 95, 159,
- 163, 76, 77, 166, 167, 80, 81, 92, 96, 62,
- 41, -9, 43, 23, 176, 49, 200, 21, 89, 68,
- 100, 102, 29, 50, 105, 106, 107, 108, 109, 110,
- 111, 112, 113, 57, 65, 114, 128, 121, 115, 199,
- 86, 116, 144, 64, 115, 147, 148, 87, 82, 129,
- 123, 124, 175, 155, 154, 156, 88, 69, 70, 130,
- 83, 165, 71, 181, 84, 85, 141, 34, 174, 94,
- 131, 103, 76, 77, 177, 178, 115, 180, 117, 88,
- 2, 3, 4, 51, 186, 118, 119, 120, 122, 125,
- 191, 146, 193, 157, 127, 62, 132, 145, 149, 150,
- 153, 152, 162, 164, 52, 173, 15, 204, 168, 205,
- 158, 185, 187, 189, -5, 1, 68, 183, 188, 16,
- 17, 2, 3, 4, 5, 18, 195, 68, 190, 192,
- 196, 6, 197, 7, 8, 9, 198, 202, 10, 11,
- 12, 160, 203, 98, 201, 13, 14, 15, 179, 2,
- 3, 4, 51, 161, 90, 0, 0, 0, 0, 0,
- 16, 17, 0, 0, 0, -5, 18, 2, 3, 4,
- 51, 0, 0, 52, 0, 15, 0, 6, 0, 7,
- 8, 9, 0, 0, 0, 11, 12, 0, 16, 17,
- 0, 13, 14, 15, 66, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 16, 17, 0, 0,
- 0, 62, 18, 2, 3, 4, 51, 0, 0, 69,
- 70, 0, 0, 6, 71, 7, 8, 9, 74, 75,
- 0, 11, 12, 0, 76, 77, 0, 13, 14, 15,
- 0, 0, 0, 0, 2, 3, 4, 51, 0, 0,
- 0, 0, 16, 17, 6, 0, 7, 8, 18, 0,
- 0, 0, 11, 12, 0, 0, 0, 0, 13, 38,
- 15, 0, 0, 0, 0, 0, 39, 0, 0, 0,
- 0, 40, 0, 16, 17, 41, 42, 43, 44, 18,
- 69, 70, 0, 45, 0, 71, 104, 72, 73, 74,
+ 23, 35, 63, 99, 138, 101, 61, 21, -9, -46,
+ 158, 173, 95, 80, 81, 54, 135, 137, 58, 59,
+ 60, 29, 96, 86, 173, 114, 33, 62, 115, 68,
+ 87, 175, 140, 159, 38, 78, 78, 78, 136, 88,
+ 164, 39, 175, 167, 168, -46, 40, 55, 56, 184,
+ 41, 42, 43, 44, 92, 178, 36, 62, 45, -9,
+ 48, 50, 116, 23, 57, 115, 68, 100, 102, 202,
+ 21, 105, 106, 107, 108, 109, 110, 111, 112, 113,
+ 41, 201, 43, 155, 29, 156, 128, 121, 89, 49,
+ 64, 82, 144, 65, 83, 147, 148, 123, 124, 129,
+ 84, 177, 94, 85, 154, 103, 130, 34, 115, 117,
+ 122, 166, 183, 118, 69, 70, 141, 131, 176, 71,
+ 104, 72, 73, 74, 75, 179, 180, 119, 182, 76,
+ 77, 120, 88, 125, 69, 70, 188, 127, 146, 71,
+ 132, 62, 193, 157, 195, 145, 149, 153, 152, 76,
+ 77, 163, 150, 165, 169, 174, 187, 69, 70, 206,
+ 158, 207, 71, 185, 68, 191, 74, 75, 189, -5,
+ 1, 190, 76, 77, 192, 68, 2, 3, 4, 5,
+ 197, 194, 198, 199, 200, 204, 6, 205, 7, 8,
+ 9, 98, 160, 10, 11, 12, 203, 181, 0, 0,
+ 13, 14, 15, 90, 2, 3, 4, 51, 0, 0,
+ 0, 0, 0, 0, 0, 16, 17, 0, 0, 0,
+ -5, 18, 2, 3, 4, 51, 0, 0, 52, 0,
+ 15, 0, 6, 0, 7, 8, 9, 0, 0, 0,
+ 11, 12, 0, 16, 17, 0, 13, 14, 15, 18,
+ 2, 3, 4, 51, 0, 0, 0, 0, 0, 0,
+ 0, 16, 17, 0, 0, 0, 62, 18, 2, 3,
+ 4, 51, 0, 0, 52, 0, 15, 0, 6, 0,
+ 7, 8, 9, 0, 0, 0, 11, 12, 0, 16,
+ 17, 0, 13, 14, 15, 66, 0, 0, 0, 2,
+ 3, 4, 51, 0, 93, 0, 0, 16, 17, 6,
+ 0, 7, 8, 18, 0, 0, 0, 11, 12, 0,
+ 0, 69, 70, 13, 0, 15, 71, 0, 72, 73,
+ 74, 75, 0, 0, 0, 0, 76, 77, 16, 17,
+ 69, 70, 0, 0, 18, 71, 104, 72, 73, 74,
75, 0, 69, 70, 97, 76, 77, 71, 0, 72,
73, 74, 75, 0, 69, 70, 97, 76, 77, 71,
- 104, 72, 73, 74, 75, 0, 69, 70, 0, 76,
- 77, 71, 0, 72, 73, 74, 75, 0, 0, 0,
- 0, 76, 77
+ 0, 72, 73, 74, 75, 0, -53, -53, 0, 76,
+ 77, -53, 0, 0, 0, -53, -53, 0, 0, 34,
+ 0, -53, -53
};
static const yytype_int16 yycheck[] =
{
- 0, 5, 19, 129, 0, 64, 15, 66, 0, 0,
- 0, 13, 51, 36, 37, 39, 40, 56, 13, 22,
- 44, 16, 17, 18, 48, 49, 15, 128, 52, 10,
- 54, 55, 27, 35, 52, 10, 39, 40, 33, 34,
- 35, 44, 51, 46, 47, 48, 49, 173, 35, 38,
- 151, 54, 55, 154, 155, 34, 35, 52, 45, 51,
- 27, 51, 29, 63, 165, 11, 192, 63, 35, 64,
- 65, 66, 63, 10, 69, 70, 71, 72, 73, 74,
- 75, 76, 77, 10, 45, 53, 103, 91, 56, 190,
- 11, 53, 134, 52, 56, 137, 138, 18, 56, 103,
- 95, 96, 161, 14, 146, 16, 27, 39, 40, 104,
- 11, 153, 44, 172, 11, 27, 133, 52, 160, 10,
- 115, 34, 54, 55, 166, 167, 56, 169, 10, 27,
- 7, 8, 9, 10, 176, 11, 11, 11, 10, 53,
- 182, 136, 184, 147, 53, 51, 10, 35, 10, 56,
- 145, 16, 10, 32, 31, 159, 33, 199, 21, 201,
- 15, 34, 16, 180, 0, 1, 161, 38, 16, 46,
- 47, 7, 8, 9, 10, 52, 16, 172, 34, 183,
- 32, 17, 21, 19, 20, 21, 16, 32, 24, 25,
- 26, 148, 21, 63, 194, 31, 32, 33, 169, 7,
- 8, 9, 10, 148, 46, -1, -1, -1, -1, -1,
- 46, 47, -1, -1, -1, 51, 52, 7, 8, 9,
- 10, -1, -1, 31, -1, 33, -1, 17, -1, 19,
- 20, 21, -1, -1, -1, 25, 26, -1, 46, 47,
- -1, 31, 32, 33, 52, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 46, 47, -1, -1,
- -1, 51, 52, 7, 8, 9, 10, -1, -1, 39,
- 40, -1, -1, 17, 44, 19, 20, 21, 48, 49,
- -1, 25, 26, -1, 54, 55, -1, 31, 32, 33,
- -1, -1, -1, -1, 7, 8, 9, 10, -1, -1,
- -1, -1, 46, 47, 17, -1, 19, 20, 52, -1,
- -1, -1, 25, 26, -1, -1, -1, -1, 31, 11,
- 33, -1, -1, -1, -1, -1, 18, -1, -1, -1,
- -1, 23, -1, 46, 47, 27, 28, 29, 30, 52,
- 39, 40, -1, 35, -1, 44, 45, 46, 47, 48,
+ 0, 5, 19, 64, 129, 66, 0, 0, 0, 15,
+ 15, 157, 35, 34, 35, 13, 13, 128, 16, 17,
+ 18, 0, 45, 11, 170, 53, 52, 51, 56, 27,
+ 18, 160, 56, 38, 11, 33, 34, 35, 35, 27,
+ 151, 18, 171, 154, 155, 51, 23, 36, 37, 174,
+ 27, 28, 29, 30, 52, 166, 10, 51, 35, 51,
+ 10, 10, 53, 63, 10, 56, 64, 65, 66, 194,
+ 63, 69, 70, 71, 72, 73, 74, 75, 76, 77,
+ 27, 192, 29, 14, 63, 16, 103, 91, 35, 11,
+ 52, 56, 134, 45, 11, 137, 138, 95, 96, 103,
+ 11, 162, 10, 27, 146, 34, 104, 52, 56, 10,
+ 10, 153, 173, 11, 39, 40, 133, 115, 160, 44,
+ 45, 46, 47, 48, 49, 167, 168, 11, 170, 54,
+ 55, 11, 27, 53, 39, 40, 178, 53, 136, 44,
+ 10, 51, 184, 147, 186, 35, 10, 145, 16, 54,
+ 55, 10, 56, 32, 21, 159, 34, 39, 40, 201,
+ 15, 203, 44, 38, 162, 182, 48, 49, 16, 0,
+ 1, 16, 54, 55, 34, 173, 7, 8, 9, 10,
+ 16, 185, 32, 21, 16, 32, 17, 21, 19, 20,
+ 21, 63, 148, 24, 25, 26, 196, 170, -1, -1,
+ 31, 32, 33, 46, 7, 8, 9, 10, -1, -1,
+ -1, -1, -1, -1, -1, 46, 47, -1, -1, -1,
+ 51, 52, 7, 8, 9, 10, -1, -1, 31, -1,
+ 33, -1, 17, -1, 19, 20, 21, -1, -1, -1,
+ 25, 26, -1, 46, 47, -1, 31, 32, 33, 52,
+ 7, 8, 9, 10, -1, -1, -1, -1, -1, -1,
+ -1, 46, 47, -1, -1, -1, 51, 52, 7, 8,
+ 9, 10, -1, -1, 31, -1, 33, -1, 17, -1,
+ 19, 20, 21, -1, -1, -1, 25, 26, -1, 46,
+ 47, -1, 31, 32, 33, 52, -1, -1, -1, 7,
+ 8, 9, 10, -1, 22, -1, -1, 46, 47, 17,
+ -1, 19, 20, 52, -1, -1, -1, 25, 26, -1,
+ -1, 39, 40, 31, -1, 33, 44, -1, 46, 47,
+ 48, 49, -1, -1, -1, -1, 54, 55, 46, 47,
+ 39, 40, -1, -1, 52, 44, 45, 46, 47, 48,
49, -1, 39, 40, 53, 54, 55, 44, -1, 46,
47, 48, 49, -1, 39, 40, 53, 54, 55, 44,
- 45, 46, 47, 48, 49, -1, 39, 40, -1, 54,
- 55, 44, -1, 46, 47, 48, 49, -1, -1, -1,
+ -1, 46, 47, 48, 49, -1, 39, 40, -1, 54,
+ 55, 44, -1, -1, -1, 48, 49, -1, -1, 52,
-1, 54, 55
};
@@ -798,25 +798,25 @@ static const yytype_uint8 yystos[] =
{
0, 1, 7, 8, 9, 10, 17, 19, 20, 21,
24, 25, 26, 31, 32, 33, 46, 47, 52, 58,
- 60, 61, 62, 63, 64, 70, 71, 72, 77, 78,
- 80, 83, 87, 52, 52, 74, 10, 79, 11, 18,
- 23, 27, 28, 29, 30, 35, 81, 82, 10, 11,
- 10, 10, 31, 61, 77, 36, 37, 10, 77, 77,
- 77, 0, 51, 59, 52, 45, 52, 69, 77, 39,
- 40, 44, 46, 47, 48, 49, 54, 55, 77, 88,
- 88, 88, 56, 11, 11, 27, 11, 18, 27, 35,
- 82, 84, 77, 22, 10, 35, 45, 53, 60, 69,
- 77, 69, 77, 34, 45, 77, 77, 77, 77, 77,
- 77, 77, 77, 77, 53, 56, 53, 10, 11, 11,
- 11, 74, 10, 77, 77, 53, 75, 53, 59, 74,
- 77, 77, 10, 85, 76, 13, 35, 76, 62, 78,
- 56, 59, 59, 63, 75, 35, 77, 75, 75, 10,
- 56, 86, 16, 77, 75, 14, 16, 74, 15, 38,
- 67, 73, 10, 76, 32, 75, 76, 76, 21, 66,
- 67, 68, 73, 74, 75, 69, 76, 75, 75, 68,
- 75, 69, 62, 38, 65, 34, 75, 16, 16, 59,
- 34, 75, 74, 75, 74, 16, 32, 21, 16, 76,
- 62, 63, 32, 21, 75, 75
+ 60, 61, 62, 63, 64, 71, 72, 73, 78, 79,
+ 81, 84, 88, 52, 52, 75, 10, 80, 11, 18,
+ 23, 27, 28, 29, 30, 35, 82, 83, 10, 11,
+ 10, 10, 31, 61, 78, 36, 37, 10, 78, 78,
+ 78, 0, 51, 59, 52, 45, 52, 70, 78, 39,
+ 40, 44, 46, 47, 48, 49, 54, 55, 78, 89,
+ 89, 89, 56, 11, 11, 27, 11, 18, 27, 35,
+ 83, 85, 78, 22, 10, 35, 45, 53, 60, 70,
+ 78, 70, 78, 34, 45, 78, 78, 78, 78, 78,
+ 78, 78, 78, 78, 53, 56, 53, 10, 11, 11,
+ 11, 75, 10, 78, 78, 53, 76, 53, 59, 75,
+ 78, 78, 10, 86, 77, 13, 35, 77, 62, 79,
+ 56, 59, 59, 63, 76, 35, 78, 76, 76, 10,
+ 56, 87, 16, 78, 76, 14, 16, 75, 15, 38,
+ 67, 68, 74, 10, 77, 32, 76, 77, 77, 21,
+ 66, 67, 69, 74, 75, 68, 76, 70, 77, 76,
+ 76, 69, 76, 70, 62, 38, 65, 34, 76, 16,
+ 16, 59, 34, 76, 75, 76, 75, 16, 32, 21,
+ 16, 77, 62, 63, 32, 21, 76, 76
};
#define yyerrok (yyerrstatus = 0)
@@ -1814,8 +1814,8 @@ yyreduce:
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 32:
-#line 244 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 248 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1824,8 +1824,8 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (6)].code)); ;}
break;
- case 34:
-#line 252 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 257 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
@@ -1834,23 +1834,23 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (5)].code)); ;}
break;
- case 35:
-#line 260 "engines/director/lingo/lingo-gr.y"
+ case 37:
+#line 265 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 36:
-#line 261 "engines/director/lingo/lingo-gr.y"
+ case 38:
+#line 266 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 38:
-#line 264 "engines/director/lingo/lingo-gr.y"
+ case 40:
+#line 269 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 39:
-#line 266 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 271 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1858,8 +1858,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 40:
-#line 272 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 277 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -1867,8 +1867,8 @@ yyreduce:
g_lingo->codeLabel(0); ;}
break;
- case 41:
-#line 278 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 283 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -1877,23 +1877,23 @@ yyreduce:
g_lingo->code1(skipEnd); ;}
break;
- case 42:
-#line 285 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 290 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 43:
-#line 287 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 292 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 44:
-#line 289 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 294 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 47:
-#line 294 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 299 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1901,15 +1901,15 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 48:
-#line 299 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 304 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
- case 49:
-#line 302 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 307 "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));
@@ -1918,8 +1918,8 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 50:
-#line 308 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 313 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1930,121 +1930,121 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 51:
-#line 316 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 321 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 53:
-#line 320 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 325 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 54:
-#line 321 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 326 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 55:
-#line 322 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 327 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 56:
-#line 323 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 328 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 57:
-#line 324 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 329 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 58:
-#line 325 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 330 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 59:
-#line 326 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 331 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 60:
-#line 327 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 332 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 61:
-#line 328 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 333 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 62:
-#line 329 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 334 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 63:
-#line 330 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 335 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 64:
-#line 331 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 336 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 65:
-#line 334 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 339 "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 66:
-#line 335 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 340 "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 67:
-#line 336 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 341 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 69:
-#line 338 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 343 "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 71:
-#line 343 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 348 "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 72:
-#line 344 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 349 "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 73:
-#line 355 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 360 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 74:
-#line 356 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 361 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 75:
-#line 357 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 362 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 76:
-#line 358 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 363 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2052,8 +2052,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 77:
-#line 363 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 368 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2062,8 +2062,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 78:
-#line 369 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 374 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2071,48 +2071,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 79:
-#line 376 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 381 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 80:
-#line 377 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 382 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 81:
-#line 378 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 383 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 82:
-#line 379 "engines/director/lingo/lingo-gr.y"
+ case 84:
+#line 384 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 83:
-#line 382 "engines/director/lingo/lingo-gr.y"
+ case 85:
+#line 387 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 84:
-#line 383 "engines/director/lingo/lingo-gr.y"
+ case 86:
+#line 388 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 85:
-#line 384 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 389 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 86:
-#line 412 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 417 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 87:
-#line 413 "engines/director/lingo/lingo-gr.y"
+ case 89:
+#line 418 "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);
@@ -2120,33 +2120,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 88:
-#line 419 "engines/director/lingo/lingo-gr.y"
+ case 90:
+#line 424 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 89:
-#line 420 "engines/director/lingo/lingo-gr.y"
+ case 91:
+#line 425 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 90:
-#line 421 "engines/director/lingo/lingo-gr.y"
+ case 92:
+#line 426 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 91:
-#line 422 "engines/director/lingo/lingo-gr.y"
+ case 93:
+#line 427 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 92:
-#line 424 "engines/director/lingo/lingo-gr.y"
+ case 94:
+#line 429 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 93:
-#line 427 "engines/director/lingo/lingo-gr.y"
+ case 95:
+#line 432 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2155,18 +2155,18 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 94:
-#line 435 "engines/director/lingo/lingo-gr.y"
+ case 96:
+#line 440 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 95:
-#line 436 "engines/director/lingo/lingo-gr.y"
+ case 97:
+#line 441 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 96:
-#line 437 "engines/director/lingo/lingo-gr.y"
+ case 98:
+#line 442 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
@@ -2386,6 +2386,6 @@ yyreturn:
}
-#line 440 "engines/director/lingo/lingo-gr.y"
+#line 445 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 7653216..d58cb22 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -241,12 +241,17 @@ elseifstmt: elseifstmt elseifstmt1
| elseifstmt1
;
-elseifstmtoneliner: elseif cond tTHEN begin stmt end {
+elseifstmtoneliner: elseifstmtoneliner elseifstmtoneliner1
+ | elseifstmtoneliner1
+ ;
+
+elseifstmtoneliner1: elseif cond tTHEN begin stmt end {
inst then = 0;
WRITE_UINT32(&then, $4);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
g_lingo->codeLabel($1); }
+ ;
elseifstmt1: elseifstmtoneliner
| elseif cond tTHEN stmtlist end {
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 43b25f7..c3ae83c 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -88,9 +88,9 @@ whitespace [\t ]
(?i:with) { count(); return tWITH; }
(?i:while) { count(); return tWHILE; }
-[!][=] { count(); return tNEQ; }
-[>][=] { count(); return tGE; }
-[<][=] { count(); return tLE; }
+[!][=] { count(); return tNEQ; }
+[>][=] { count(); return tGE; }
+[<][=] { count(); return tLE; }
{identifier} {
count();
Commit: 4763228ef36bc8af38567f4ccbf4583051da0740
https://github.com/scummvm/scummvm/commit/4763228ef36bc8af38567f4ccbf4583051da0740
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Added string constants as expressions
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 09d70b4..6c92584 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -127,6 +127,7 @@ Common::Error DirectorEngine::run() {
if x = 4 then put 4\n\
else put 5\n\
end repeat\n\
+ set z = \"foo\"\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 6151c1b..72e771d 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -116,6 +116,16 @@ void Lingo::c_fconstpush() {
g_lingo->push(d);
}
+void Lingo::c_stringpush() {
+ Datum d;
+ char *s = (char *)&(*g_lingo->_currentScript)[g_lingo->_pc];
+ g_lingo->_pc += g_lingo->calcStringAlignment(s);
+
+ d.u.s = new Common::String(s);
+ d.type = STRING;
+ g_lingo->push(d);
+}
+
void Lingo::c_varpush() {
char *name = (char *)&(*g_lingo->_currentScript)[g_lingo->_pc];
Datum d;
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 049311e..ed7a3c4 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -430,18 +430,18 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 61
+#define YYFINAL 62
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 392
+#define YYLAST 380
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 57
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 33
/* YYNRULES -- Number of rules. */
-#define YYNRULES 98
+#define YYNRULES 99
/* YYNRULES -- Number of states. */
-#define YYNSTATES 208
+#define YYNSTATES 209
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -495,11 +495,11 @@ static const yytype_uint16 yyprhs[] =
56, 68, 81, 90, 102, 115, 122, 133, 144, 145,
149, 152, 154, 157, 159, 166, 168, 174, 176, 180,
184, 187, 191, 193, 195, 196, 197, 198, 201, 204,
- 206, 208, 213, 218, 220, 222, 226, 230, 234, 238,
- 242, 246, 250, 254, 258, 261, 264, 268, 271, 274,
- 277, 279, 281, 284, 286, 290, 293, 296, 299, 302,
- 306, 309, 313, 316, 319, 321, 325, 328, 332, 333,
- 342, 343, 345, 349, 354, 355, 359, 360, 362
+ 206, 208, 210, 215, 220, 222, 224, 228, 232, 236,
+ 240, 244, 248, 252, 256, 260, 263, 266, 270, 273,
+ 276, 279, 281, 283, 286, 288, 292, 295, 298, 301,
+ 304, 308, 311, 315, 318, 321, 323, 327, 330, 334,
+ 335, 344, 345, 347, 351, 356, 357, 361, 362, 364
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -525,23 +525,23 @@ static const yytype_int8 yyrhs[] =
34, 77, 76, -1, 78, -1, 78, 45, 78, -1,
52, 70, 53, -1, 32, 37, -1, 32, 36, 10,
-1, 21, -1, 15, -1, -1, -1, -1, 77, 59,
- -1, 77, 63, -1, 7, -1, 8, -1, 9, 52,
- 89, 53, -1, 10, 52, 89, 53, -1, 10, -1,
- 61, -1, 78, 46, 78, -1, 78, 47, 78, -1,
- 78, 48, 78, -1, 78, 49, 78, -1, 78, 54,
- 78, -1, 78, 55, 78, -1, 78, 44, 78, -1,
- 78, 39, 78, -1, 78, 40, 78, -1, 46, 78,
- -1, 47, 78, -1, 52, 78, 53, -1, 25, 11,
- -1, 26, 10, -1, 31, 78, -1, 81, -1, 17,
- -1, 19, 80, -1, 10, -1, 80, 56, 10, -1,
- 20, 23, -1, 20, 28, -1, 20, 30, -1, 20,
- 82, -1, 20, 82, 83, -1, 20, 83, -1, 35,
- 18, 11, -1, 18, 11, -1, 35, 11, -1, 11,
- -1, 29, 27, 11, -1, 27, 11, -1, 35, 27,
- 11, -1, -1, 24, 10, 85, 75, 86, 59, 87,
- 77, -1, -1, 10, -1, 86, 56, 10, -1, 86,
- 59, 56, 10, -1, -1, 10, 75, 89, -1, -1,
- 78, -1, 89, 56, 78, -1
+ -1, 77, 63, -1, 7, -1, 8, -1, 11, -1,
+ 9, 52, 89, 53, -1, 10, 52, 89, 53, -1,
+ 10, -1, 61, -1, 78, 46, 78, -1, 78, 47,
+ 78, -1, 78, 48, 78, -1, 78, 49, 78, -1,
+ 78, 54, 78, -1, 78, 55, 78, -1, 78, 44,
+ 78, -1, 78, 39, 78, -1, 78, 40, 78, -1,
+ 46, 78, -1, 47, 78, -1, 52, 78, 53, -1,
+ 25, 11, -1, 26, 10, -1, 31, 78, -1, 81,
+ -1, 17, -1, 19, 80, -1, 10, -1, 80, 56,
+ 10, -1, 20, 23, -1, 20, 28, -1, 20, 30,
+ -1, 20, 82, -1, 20, 82, 83, -1, 20, 83,
+ -1, 35, 18, 11, -1, 18, 11, -1, 35, 11,
+ -1, 11, -1, 29, 27, 11, -1, 27, 11, -1,
+ 35, 27, 11, -1, -1, 24, 10, 85, 75, 86,
+ 59, 87, 77, -1, -1, 10, -1, 86, 56, 10,
+ -1, 86, 59, 56, 10, -1, -1, 10, 75, 89,
+ -1, -1, 78, -1, 89, 56, 78, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -552,11 +552,11 @@ static const yytype_uint16 yyrline[] =
150, 166, 180, 187, 196, 205, 215, 225, 236, 237,
240, 241, 244, 245, 248, 256, 257, 265, 266, 267,
269, 271, 277, 283, 290, 292, 294, 295, 296, 299,
- 304, 307, 313, 321, 324, 325, 326, 327, 328, 329,
- 330, 331, 332, 333, 334, 335, 336, 339, 340, 341,
- 342, 343, 345, 348, 349, 360, 361, 362, 363, 368,
- 374, 381, 382, 383, 384, 387, 388, 389, 417, 417,
- 424, 425, 426, 427, 429, 432, 440, 441, 442
+ 304, 307, 310, 316, 324, 327, 328, 329, 330, 331,
+ 332, 333, 334, 335, 336, 337, 338, 339, 342, 343,
+ 344, 345, 346, 348, 351, 352, 363, 364, 365, 366,
+ 371, 377, 384, 385, 386, 387, 390, 391, 392, 420,
+ 420, 427, 428, 429, 430, 432, 435, 443, 444, 445
};
#endif
@@ -604,10 +604,10 @@ static const yytype_uint8 yyr1[] =
66, 66, 67, 67, 68, 69, 69, 70, 70, 70,
71, 72, 73, 74, 75, 76, 77, 77, 77, 78,
78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
- 78, 78, 78, 78, 78, 78, 78, 79, 79, 79,
- 79, 79, 79, 80, 80, 81, 81, 81, 81, 81,
- 81, 82, 82, 82, 82, 83, 83, 83, 85, 84,
- 86, 86, 86, 86, 87, 88, 89, 89, 89
+ 78, 78, 78, 78, 78, 78, 78, 78, 79, 79,
+ 79, 79, 79, 79, 80, 80, 81, 81, 81, 81,
+ 81, 81, 82, 82, 82, 82, 83, 83, 83, 85,
+ 84, 86, 86, 86, 86, 87, 88, 89, 89, 89
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -618,11 +618,11 @@ static const yytype_uint8 yyr2[] =
11, 12, 8, 11, 12, 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, 4, 4, 1, 1, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 2, 2, 3, 2, 2, 2,
- 1, 1, 2, 1, 3, 2, 2, 2, 2, 3,
- 2, 3, 2, 2, 1, 3, 2, 3, 0, 8,
- 0, 1, 3, 4, 0, 3, 0, 1, 3
+ 1, 1, 4, 4, 1, 1, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 2, 2, 3, 2, 2,
+ 2, 1, 1, 2, 1, 3, 2, 2, 2, 2,
+ 3, 2, 3, 2, 2, 1, 3, 2, 3, 0,
+ 8, 0, 1, 3, 4, 0, 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -630,193 +630,191 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 49, 50, 0, 44, 71, 0, 0, 42,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 3, 54, 17, 10, 18, 0, 0, 0, 15, 7,
- 70, 6, 8, 96, 96, 96, 73, 72, 84, 0,
- 75, 0, 76, 0, 77, 0, 78, 80, 88, 67,
- 68, 53, 0, 54, 69, 0, 40, 0, 64, 65,
- 0, 1, 4, 0, 0, 0, 0, 0, 37, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 97, 0,
- 0, 95, 0, 82, 86, 0, 83, 0, 0, 0,
- 79, 44, 0, 0, 41, 0, 0, 66, 2, 0,
- 45, 0, 0, 44, 0, 62, 63, 61, 55, 56,
- 57, 58, 59, 60, 51, 0, 52, 74, 85, 81,
- 87, 90, 12, 14, 13, 46, 0, 39, 46, 0,
- 38, 98, 91, 0, 45, 0, 0, 45, 45, 16,
- 0, 94, 47, 48, 0, 0, 45, 44, 25, 92,
- 0, 46, 0, 45, 46, 46, 0, 0, 43, 44,
- 45, 33, 0, 93, 89, 19, 46, 45, 45, 22,
- 45, 35, 31, 0, 0, 32, 28, 0, 45, 0,
- 0, 30, 0, 0, 45, 44, 45, 44, 0, 0,
- 0, 0, 44, 26, 0, 27, 0, 0, 20, 23,
- 0, 45, 29, 45, 21, 24, 36, 34
+ 0, 11, 49, 50, 0, 44, 51, 72, 0, 0,
+ 42, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 3, 55, 17, 10, 18, 0, 0, 0, 15,
+ 7, 71, 6, 8, 97, 97, 97, 74, 73, 85,
+ 0, 76, 0, 77, 0, 78, 0, 79, 81, 89,
+ 68, 69, 54, 0, 55, 70, 0, 40, 0, 65,
+ 66, 0, 1, 4, 0, 0, 0, 0, 0, 37,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 98,
+ 0, 0, 96, 0, 83, 87, 0, 84, 0, 0,
+ 0, 80, 44, 0, 0, 41, 0, 0, 67, 2,
+ 0, 45, 0, 0, 44, 0, 63, 64, 62, 56,
+ 57, 58, 59, 60, 61, 52, 0, 53, 75, 86,
+ 82, 88, 91, 12, 14, 13, 46, 0, 39, 46,
+ 0, 38, 99, 92, 0, 45, 0, 0, 45, 45,
+ 16, 0, 95, 47, 48, 0, 0, 45, 44, 25,
+ 93, 0, 46, 0, 45, 46, 46, 0, 0, 43,
+ 44, 45, 33, 0, 94, 90, 19, 46, 45, 45,
+ 22, 45, 35, 31, 0, 0, 32, 28, 0, 45,
+ 0, 0, 30, 0, 0, 45, 44, 45, 44, 0,
+ 0, 0, 0, 44, 26, 0, 27, 0, 0, 20,
+ 23, 0, 45, 29, 45, 21, 24, 36, 34
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 19, 142, 20, 53, 22, 143, 24, 186, 170,
- 171, 161, 172, 67, 25, 26, 27, 162, 196, 126,
- 134, 28, 139, 37, 30, 46, 47, 31, 91, 133,
- 151, 32, 79
+ -1, 20, 143, 21, 54, 23, 144, 25, 187, 171,
+ 172, 162, 173, 68, 26, 27, 28, 163, 197, 127,
+ 135, 29, 140, 38, 31, 47, 48, 32, 92, 134,
+ 152, 33, 80
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -147
+#define YYPACT_NINF -150
static const yytype_int16 yypact[] =
{
- 169, -147, -147, -147, -26, 337, -147, 46, 23, -147,
- 50, 78, 51, 197, 11, 54, 197, 197, 197, 6,
- -147, 8, -147, -147, -147, 38, 48, 243, 325, -147,
- -147, -147, -147, 197, 197, 197, -147, 35, -147, 83,
- -147, 89, -147, 76, -147, 12, 53, -147, -147, -147,
- -147, 55, 197, -147, 282, 92, -147, -23, 95, 95,
- 313, -147, -147, 169, 243, 197, 243, 71, 75, 197,
- 197, 197, 197, 197, 197, 197, 197, 197, 325, -28,
- 9, 52, 99, -147, -147, 102, -147, 116, 120, 105,
- -147, -147, 282, 100, -147, 197, 197, -147, -147, 80,
- 325, 84, 301, 90, 197, 325, 325, 325, 118, 118,
- 95, 95, 325, 325, -147, 197, -147, -147, -147, -147,
- -147, 130, -147, 325, 325, -147, 3, -147, -147, 292,
- 325, 325, -147, -24, 215, 110, 197, 215, -147, -147,
- 136, 96, -147, -147, 132, 197, 325, 69, -5, -147,
- 141, -147, 121, 325, -147, -147, 133, 145, -147, -147,
- 145, -147, 243, -147, 215, -147, -147, 215, 215, -147,
- 145, 145, -147, 243, 292, -147, 125, 122, 215, 152,
- 155, -147, 90, 140, -147, -147, -147, -147, 164, 150,
- 162, 168, -6, -147, 292, -147, 261, 153, -147, -147,
- 166, 215, -147, -147, -147, -147, -147, -147
+ 152, -150, -150, -150, -41, 55, -150, -150, 51, 296,
+ -150, 73, 81, 95, 180, 16, 105, 180, 180, 180,
+ 4, -150, 8, -150, -150, -150, 39, 76, 226, 325,
+ -150, -150, -150, -150, 180, 180, 180, -150, 62, -150,
+ 112, -150, 114, -150, 103, -150, 3, 21, -150, -150,
+ -150, -150, 79, 180, -150, 80, 122, -150, -7, -13,
+ -13, 301, -150, -150, 152, 226, 180, 226, 99, 313,
+ 180, 180, 180, 180, 180, 180, 180, 180, 180, 325,
+ 37, 58, 83, 126, -150, -150, 129, -150, 130, 131,
+ 110, -150, -150, 80, 133, -150, 180, 180, -150, -150,
+ 92, 325, 93, 289, 97, 180, 325, 325, 325, 249,
+ 249, -13, -13, 325, 325, -150, 180, -150, -150, -150,
+ -150, -150, 139, -150, 325, 325, -150, -1, -150, -150,
+ 275, 325, 325, -150, 57, 198, 115, 180, 198, -150,
+ -150, 141, 98, -150, -150, 142, 180, 325, 46, -5,
+ -150, 145, -150, 125, 325, -150, -150, 146, 151, -150,
+ -150, 151, -150, 226, -150, 198, -150, -150, 198, 198,
+ -150, 151, 151, -150, 226, 275, -150, 132, 134, 198,
+ 158, 163, -150, 97, 147, -150, -150, -150, -150, 164,
+ 154, 171, 177, -8, -150, 275, -150, 244, 162, -150,
+ -150, 174, 198, -150, -150, -150, -150, -150, -150
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -147, -147, -17, 128, 7, -125, 0, -147, -147, -147,
- 44, -129, 27, -61, -147, -147, -147, -146, -4, -42,
- -111, 2, 21, -147, -147, -147, 157, -147, -147, -147,
- -147, -147, -21
+ -150, -150, -18, 136, 6, -106, 0, -150, -150, -150,
+ 47, -121, 30, -62, -150, -150, -150, -149, -4, -122,
+ -71, 1, 23, -150, -150, -150, 155, -150, -150, -150,
+ -150, -150, 9
};
/* 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 -54
+#define YYTABLE_NINF -55
static const yytype_int16 yytable[] =
{
- 23, 35, 63, 99, 138, 101, 61, 21, -9, -46,
- 158, 173, 95, 80, 81, 54, 135, 137, 58, 59,
- 60, 29, 96, 86, 173, 114, 33, 62, 115, 68,
- 87, 175, 140, 159, 38, 78, 78, 78, 136, 88,
- 164, 39, 175, 167, 168, -46, 40, 55, 56, 184,
- 41, 42, 43, 44, 92, 178, 36, 62, 45, -9,
- 48, 50, 116, 23, 57, 115, 68, 100, 102, 202,
- 21, 105, 106, 107, 108, 109, 110, 111, 112, 113,
- 41, 201, 43, 155, 29, 156, 128, 121, 89, 49,
- 64, 82, 144, 65, 83, 147, 148, 123, 124, 129,
- 84, 177, 94, 85, 154, 103, 130, 34, 115, 117,
- 122, 166, 183, 118, 69, 70, 141, 131, 176, 71,
- 104, 72, 73, 74, 75, 179, 180, 119, 182, 76,
- 77, 120, 88, 125, 69, 70, 188, 127, 146, 71,
- 132, 62, 193, 157, 195, 145, 149, 153, 152, 76,
- 77, 163, 150, 165, 169, 174, 187, 69, 70, 206,
- 158, 207, 71, 185, 68, 191, 74, 75, 189, -5,
- 1, 190, 76, 77, 192, 68, 2, 3, 4, 5,
- 197, 194, 198, 199, 200, 204, 6, 205, 7, 8,
- 9, 98, 160, 10, 11, 12, 203, 181, 0, 0,
- 13, 14, 15, 90, 2, 3, 4, 51, 0, 0,
- 0, 0, 0, 0, 0, 16, 17, 0, 0, 0,
- -5, 18, 2, 3, 4, 51, 0, 0, 52, 0,
- 15, 0, 6, 0, 7, 8, 9, 0, 0, 0,
- 11, 12, 0, 16, 17, 0, 13, 14, 15, 18,
- 2, 3, 4, 51, 0, 0, 0, 0, 0, 0,
- 0, 16, 17, 0, 0, 0, 62, 18, 2, 3,
- 4, 51, 0, 0, 52, 0, 15, 0, 6, 0,
- 7, 8, 9, 0, 0, 0, 11, 12, 0, 16,
- 17, 0, 13, 14, 15, 66, 0, 0, 0, 2,
- 3, 4, 51, 0, 93, 0, 0, 16, 17, 6,
- 0, 7, 8, 18, 0, 0, 0, 11, 12, 0,
- 0, 69, 70, 13, 0, 15, 71, 0, 72, 73,
- 74, 75, 0, 0, 0, 0, 76, 77, 16, 17,
- 69, 70, 0, 0, 18, 71, 104, 72, 73, 74,
- 75, 0, 69, 70, 97, 76, 77, 71, 0, 72,
- 73, 74, 75, 0, 69, 70, 97, 76, 77, 71,
- 0, 72, 73, 74, 75, 0, -53, -53, 0, 76,
- 77, -53, 0, 0, 0, -53, -53, 0, 0, 34,
- 0, -53, -53
+ 24, 36, 64, 100, 62, 102, 22, -46, -9, 174,
+ 159, 34, 136, 145, 87, 55, 148, 149, 59, 60,
+ 61, 88, 174, 30, 139, 155, 70, 71, 96, 69,
+ 89, 72, 167, 160, 137, 79, 79, 79, 97, 177,
+ 176, 77, 78, -46, 81, 82, 180, 181, 42, 183,
+ 44, 176, 56, 57, 93, 63, 90, 189, 138, -9,
+ 156, 37, 157, 194, 24, 196, 69, 101, 103, 185,
+ 22, 106, 107, 108, 109, 110, 111, 112, 113, 114,
+ 207, 165, 208, 49, 168, 169, 129, 30, 122, 203,
+ 115, 65, 50, 116, -54, -54, 179, 124, 125, -54,
+ 130, 178, 94, -54, -54, 51, 131, 35, 63, -54,
+ -54, 117, 184, 141, 116, 58, 142, 132, 83, 70,
+ 71, 66, 202, 84, 72, 85, 73, 74, 75, 76,
+ 86, 35, 95, 104, 77, 78, 118, 89, 147, 116,
+ 119, 120, 121, 123, 158, 126, 128, 154, 63, 133,
+ 146, 150, -5, 1, 151, 164, 175, 166, 153, 2,
+ 3, 4, 5, 6, 69, 192, 159, 170, 188, 7,
+ 186, 8, 9, 10, 190, 69, 11, 12, 13, 191,
+ 198, 193, 195, 14, 15, 16, 199, 2, 3, 4,
+ 52, 6, 200, 201, 205, 206, 161, 204, 17, 18,
+ 99, 182, 91, -5, 19, 2, 3, 4, 52, 6,
+ 0, 53, 0, 16, 0, 7, 0, 8, 9, 10,
+ 0, 0, 0, 12, 13, 0, 17, 18, 0, 14,
+ 15, 16, 19, 2, 3, 4, 52, 6, 0, 0,
+ 0, 0, 0, 0, 17, 18, 0, 0, 0, 63,
+ 19, 2, 3, 4, 52, 6, 0, 53, 0, 16,
+ 0, 7, 0, 8, 9, 10, 0, 0, 0, 12,
+ 13, 0, 17, 18, 0, 14, 15, 16, 67, 0,
+ 0, 0, 2, 3, 4, 52, 6, 0, 70, 71,
+ 17, 18, 7, 72, 8, 9, 19, 75, 76, 0,
+ 12, 13, 0, 77, 78, 0, 14, 39, 16, 0,
+ 0, 0, 0, 0, 40, 0, 0, 0, 0, 41,
+ 0, 17, 18, 42, 43, 44, 45, 19, 70, 71,
+ 0, 46, 0, 72, 105, 73, 74, 75, 76, 0,
+ 70, 71, 98, 77, 78, 72, 0, 73, 74, 75,
+ 76, 0, 70, 71, 98, 77, 78, 72, 105, 73,
+ 74, 75, 76, 0, 70, 71, 0, 77, 78, 72,
+ 0, 73, 74, 75, 76, 0, 0, 0, 0, 77,
+ 78
};
static const yytype_int16 yycheck[] =
{
- 0, 5, 19, 64, 129, 66, 0, 0, 0, 15,
- 15, 157, 35, 34, 35, 13, 13, 128, 16, 17,
- 18, 0, 45, 11, 170, 53, 52, 51, 56, 27,
- 18, 160, 56, 38, 11, 33, 34, 35, 35, 27,
- 151, 18, 171, 154, 155, 51, 23, 36, 37, 174,
- 27, 28, 29, 30, 52, 166, 10, 51, 35, 51,
- 10, 10, 53, 63, 10, 56, 64, 65, 66, 194,
- 63, 69, 70, 71, 72, 73, 74, 75, 76, 77,
- 27, 192, 29, 14, 63, 16, 103, 91, 35, 11,
- 52, 56, 134, 45, 11, 137, 138, 95, 96, 103,
- 11, 162, 10, 27, 146, 34, 104, 52, 56, 10,
- 10, 153, 173, 11, 39, 40, 133, 115, 160, 44,
- 45, 46, 47, 48, 49, 167, 168, 11, 170, 54,
- 55, 11, 27, 53, 39, 40, 178, 53, 136, 44,
- 10, 51, 184, 147, 186, 35, 10, 145, 16, 54,
- 55, 10, 56, 32, 21, 159, 34, 39, 40, 201,
- 15, 203, 44, 38, 162, 182, 48, 49, 16, 0,
- 1, 16, 54, 55, 34, 173, 7, 8, 9, 10,
- 16, 185, 32, 21, 16, 32, 17, 21, 19, 20,
- 21, 63, 148, 24, 25, 26, 196, 170, -1, -1,
- 31, 32, 33, 46, 7, 8, 9, 10, -1, -1,
- -1, -1, -1, -1, -1, 46, 47, -1, -1, -1,
- 51, 52, 7, 8, 9, 10, -1, -1, 31, -1,
- 33, -1, 17, -1, 19, 20, 21, -1, -1, -1,
- 25, 26, -1, 46, 47, -1, 31, 32, 33, 52,
- 7, 8, 9, 10, -1, -1, -1, -1, -1, -1,
- -1, 46, 47, -1, -1, -1, 51, 52, 7, 8,
- 9, 10, -1, -1, 31, -1, 33, -1, 17, -1,
- 19, 20, 21, -1, -1, -1, 25, 26, -1, 46,
- 47, -1, 31, 32, 33, 52, -1, -1, -1, 7,
- 8, 9, 10, -1, 22, -1, -1, 46, 47, 17,
- -1, 19, 20, 52, -1, -1, -1, 25, 26, -1,
- -1, 39, 40, 31, -1, 33, 44, -1, 46, 47,
- 48, 49, -1, -1, -1, -1, 54, 55, 46, 47,
- 39, 40, -1, -1, 52, 44, 45, 46, 47, 48,
- 49, -1, 39, 40, 53, 54, 55, 44, -1, 46,
- 47, 48, 49, -1, 39, 40, 53, 54, 55, 44,
- -1, 46, 47, 48, 49, -1, 39, 40, -1, 54,
- 55, 44, -1, -1, -1, 48, 49, -1, -1, 52,
- -1, 54, 55
+ 0, 5, 20, 65, 0, 67, 0, 15, 0, 158,
+ 15, 52, 13, 135, 11, 14, 138, 139, 17, 18,
+ 19, 18, 171, 0, 130, 147, 39, 40, 35, 28,
+ 27, 44, 154, 38, 35, 34, 35, 36, 45, 161,
+ 161, 54, 55, 51, 35, 36, 168, 169, 27, 171,
+ 29, 172, 36, 37, 53, 51, 35, 179, 129, 51,
+ 14, 10, 16, 185, 64, 187, 65, 66, 67, 175,
+ 64, 70, 71, 72, 73, 74, 75, 76, 77, 78,
+ 202, 152, 204, 10, 155, 156, 104, 64, 92, 195,
+ 53, 52, 11, 56, 39, 40, 167, 96, 97, 44,
+ 104, 163, 22, 48, 49, 10, 105, 52, 51, 54,
+ 55, 53, 174, 56, 56, 10, 134, 116, 56, 39,
+ 40, 45, 193, 11, 44, 11, 46, 47, 48, 49,
+ 27, 52, 10, 34, 54, 55, 10, 27, 137, 56,
+ 11, 11, 11, 10, 148, 53, 53, 146, 51, 10,
+ 35, 10, 0, 1, 56, 10, 160, 32, 16, 7,
+ 8, 9, 10, 11, 163, 183, 15, 21, 34, 17,
+ 38, 19, 20, 21, 16, 174, 24, 25, 26, 16,
+ 16, 34, 186, 31, 32, 33, 32, 7, 8, 9,
+ 10, 11, 21, 16, 32, 21, 149, 197, 46, 47,
+ 64, 171, 47, 51, 52, 7, 8, 9, 10, 11,
+ -1, 31, -1, 33, -1, 17, -1, 19, 20, 21,
+ -1, -1, -1, 25, 26, -1, 46, 47, -1, 31,
+ 32, 33, 52, 7, 8, 9, 10, 11, -1, -1,
+ -1, -1, -1, -1, 46, 47, -1, -1, -1, 51,
+ 52, 7, 8, 9, 10, 11, -1, 31, -1, 33,
+ -1, 17, -1, 19, 20, 21, -1, -1, -1, 25,
+ 26, -1, 46, 47, -1, 31, 32, 33, 52, -1,
+ -1, -1, 7, 8, 9, 10, 11, -1, 39, 40,
+ 46, 47, 17, 44, 19, 20, 52, 48, 49, -1,
+ 25, 26, -1, 54, 55, -1, 31, 11, 33, -1,
+ -1, -1, -1, -1, 18, -1, -1, -1, -1, 23,
+ -1, 46, 47, 27, 28, 29, 30, 52, 39, 40,
+ -1, 35, -1, 44, 45, 46, 47, 48, 49, -1,
+ 39, 40, 53, 54, 55, 44, -1, 46, 47, 48,
+ 49, -1, 39, 40, 53, 54, 55, 44, 45, 46,
+ 47, 48, 49, -1, 39, 40, -1, 54, 55, 44,
+ -1, 46, 47, 48, 49, -1, -1, -1, -1, 54,
+ 55
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 7, 8, 9, 10, 17, 19, 20, 21,
- 24, 25, 26, 31, 32, 33, 46, 47, 52, 58,
- 60, 61, 62, 63, 64, 71, 72, 73, 78, 79,
- 81, 84, 88, 52, 52, 75, 10, 80, 11, 18,
- 23, 27, 28, 29, 30, 35, 82, 83, 10, 11,
- 10, 10, 31, 61, 78, 36, 37, 10, 78, 78,
- 78, 0, 51, 59, 52, 45, 52, 70, 78, 39,
- 40, 44, 46, 47, 48, 49, 54, 55, 78, 89,
- 89, 89, 56, 11, 11, 27, 11, 18, 27, 35,
- 83, 85, 78, 22, 10, 35, 45, 53, 60, 70,
- 78, 70, 78, 34, 45, 78, 78, 78, 78, 78,
- 78, 78, 78, 78, 53, 56, 53, 10, 11, 11,
- 11, 75, 10, 78, 78, 53, 76, 53, 59, 75,
- 78, 78, 10, 86, 77, 13, 35, 77, 62, 79,
- 56, 59, 59, 63, 76, 35, 78, 76, 76, 10,
- 56, 87, 16, 78, 76, 14, 16, 75, 15, 38,
- 67, 68, 74, 10, 77, 32, 76, 77, 77, 21,
- 66, 67, 69, 74, 75, 68, 76, 70, 77, 76,
- 76, 69, 76, 70, 62, 38, 65, 34, 76, 16,
- 16, 59, 34, 76, 75, 76, 75, 16, 32, 21,
- 16, 77, 62, 63, 32, 21, 76, 76
+ 0, 1, 7, 8, 9, 10, 11, 17, 19, 20,
+ 21, 24, 25, 26, 31, 32, 33, 46, 47, 52,
+ 58, 60, 61, 62, 63, 64, 71, 72, 73, 78,
+ 79, 81, 84, 88, 52, 52, 75, 10, 80, 11,
+ 18, 23, 27, 28, 29, 30, 35, 82, 83, 10,
+ 11, 10, 10, 31, 61, 78, 36, 37, 10, 78,
+ 78, 78, 0, 51, 59, 52, 45, 52, 70, 78,
+ 39, 40, 44, 46, 47, 48, 49, 54, 55, 78,
+ 89, 89, 89, 56, 11, 11, 27, 11, 18, 27,
+ 35, 83, 85, 78, 22, 10, 35, 45, 53, 60,
+ 70, 78, 70, 78, 34, 45, 78, 78, 78, 78,
+ 78, 78, 78, 78, 78, 53, 56, 53, 10, 11,
+ 11, 11, 75, 10, 78, 78, 53, 76, 53, 59,
+ 75, 78, 78, 10, 86, 77, 13, 35, 77, 62,
+ 79, 56, 59, 59, 63, 76, 35, 78, 76, 76,
+ 10, 56, 87, 16, 78, 76, 14, 16, 75, 15,
+ 38, 67, 68, 74, 10, 77, 32, 76, 77, 77,
+ 21, 66, 67, 69, 74, 75, 68, 76, 70, 77,
+ 76, 76, 69, 76, 70, 62, 38, 65, 34, 76,
+ 16, 16, 59, 34, 76, 75, 76, 75, 16, 32,
+ 21, 16, 77, 62, 63, 32, 21, 76, 76
};
#define yyerrok (yyerrstatus = 0)
@@ -1911,6 +1909,13 @@ yyreduce:
case 51:
#line 307 "engines/director/lingo/lingo-gr.y"
{
+ (yyval.code) = g_lingo->code1(g_lingo->c_stringpush);
+ g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;}
+ break;
+
+ case 52:
+#line 310 "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));
@@ -1918,8 +1923,8 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 52:
-#line 313 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 316 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1930,121 +1935,121 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 53:
-#line 321 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 324 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 55:
-#line 325 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 328 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 56:
-#line 326 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 329 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 57:
-#line 327 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 330 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 58:
-#line 328 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 331 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 59:
-#line 329 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 332 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 60:
-#line 330 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 333 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 61:
-#line 331 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 334 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 62:
-#line 332 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 335 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 63:
-#line 333 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 336 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 64:
-#line 334 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 337 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 65:
-#line 335 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 338 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 66:
-#line 336 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 339 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 67:
-#line 339 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 342 "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 68:
-#line 340 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 343 "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 69:
-#line 341 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 344 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 71:
-#line 343 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 346 "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 73:
-#line 348 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 351 "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 74:
-#line 349 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 352 "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 75:
-#line 360 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 363 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 76:
-#line 361 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 364 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 77:
-#line 362 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 365 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 78:
-#line 363 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 366 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2052,8 +2057,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 79:
-#line 368 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 371 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2062,8 +2067,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 80:
-#line 374 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 377 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2071,48 +2076,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 81:
-#line 381 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
- break;
-
case 82:
-#line 382 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+#line 384 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 83:
-#line 383 "engines/director/lingo/lingo-gr.y"
+#line 385 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 84:
-#line 384 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+#line 386 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 85:
#line 387 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 86:
-#line 388 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+#line 390 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 87:
-#line 389 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 391 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 88:
-#line 417 "engines/director/lingo/lingo-gr.y"
- { g_lingo->_indef = true; ;}
+#line 392 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 89:
-#line 418 "engines/director/lingo/lingo-gr.y"
+#line 420 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->_indef = true; ;}
+ break;
+
+ case 90:
+#line 421 "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);
@@ -2120,33 +2125,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 90:
-#line 424 "engines/director/lingo/lingo-gr.y"
+ case 91:
+#line 427 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 91:
-#line 425 "engines/director/lingo/lingo-gr.y"
+ case 92:
+#line 428 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 92:
-#line 426 "engines/director/lingo/lingo-gr.y"
+ case 93:
+#line 429 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 93:
-#line 427 "engines/director/lingo/lingo-gr.y"
+ case 94:
+#line 430 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 94:
-#line 429 "engines/director/lingo/lingo-gr.y"
+ case 95:
+#line 432 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 95:
-#line 432 "engines/director/lingo/lingo-gr.y"
+ case 96:
+#line 435 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2155,24 +2160,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 96:
-#line 440 "engines/director/lingo/lingo-gr.y"
+ case 97:
+#line 443 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 97:
-#line 441 "engines/director/lingo/lingo-gr.y"
+ case 98:
+#line 444 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 98:
-#line 442 "engines/director/lingo/lingo-gr.y"
+ case 99:
+#line 445 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2176 "engines/director/lingo/lingo-gr.cpp"
+#line 2181 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2386,6 +2391,6 @@ yyreturn:
}
-#line 445 "engines/director/lingo/lingo-gr.y"
+#line 448 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index d58cb22..b76000a 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -304,6 +304,9 @@ expr: INT {
| FLOAT {
$$ = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat($1); }
+ | 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);
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index d88f705..cc9f0ac 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -98,6 +98,7 @@ struct Datum { /* interpreter stack type */
union {
int i;
float f;
+ Common::String *s;
Symbol *sym;
} u;
@@ -178,6 +179,7 @@ public:
static void c_negate();
static void c_constpush();
static void c_fconstpush();
+ static void c_stringpush();
static void c_varpush();
static void c_assign();
bool verify(Symbol *s);
Commit: 598be95ab4379fac72af28c35a087ed681a8731a
https://github.com/scummvm/scummvm/commit/598be95ab4379fac72af28c35a087ed681a8731a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Support string Datum printing
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 6c92584..d18dcc5 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -127,7 +127,8 @@ Common::Error DirectorEngine::run() {
if x = 4 then put 4\n\
else put 5\n\
end repeat\n\
- set z = \"foo\"\n\
+ set z = \"foo bar baz\"\n\
+ put z\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 72e771d..67345e1 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -92,6 +92,9 @@ void Lingo::c_printtop(void) {
warning("Nameless var. val: %d", d.u.sym->u.val);
}
break;
+ case STRING:
+ warning("%s", d.u.s->c_str());
+ break;
default:
warning("--unknown--");
}
@@ -169,7 +172,7 @@ void Lingo::c_assign() {
}
bool Lingo::verify(Symbol *s) {
- if (s->type != INT && s->type != VOID && s->type != FLOAT) {
+ if (s->type != INT && s->type != VOID && s->type != FLOAT && s->type != STRING) {
warning("attempt to evaluate non-variable '%s'", s->name);
return false;
Commit: cca71376b7ffdc539548e9daa72963ebac990a07
https://github.com/scummvm/scummvm/commit/cca71376b7ffdc539548e9daa72963ebac990a07
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implemented '&' string operator
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index d18dcc5..040eaac 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -128,7 +128,9 @@ Common::Error DirectorEngine::run() {
else put 5\n\
end repeat\n\
set z = \"foo bar baz\"\n\
+ set z1 = z & \" meow\"\n\
put z\n\
+ put z1\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 67345e1..2c79719 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -160,15 +160,25 @@ void Lingo::c_assign() {
return;
}
- if (d1.u.sym->type != INT && d1.u.sym->type != VOID) {
+ if (d1.u.sym->type != INT && d1.u.sym->type != VOID &&
+ d1.u.sym->type != FLOAT && d1.u.sym->type != STRING) {
warning("assignment to non-variable '%s'", d1.u.sym->name);
return;
}
- d1.u.sym->u.val = d2.u.i;
+ if (d1.u.sym->type == STRING) // Free memory if needed
+ delete d1.u.sym->u.str;
+
+ if (d2.type == INT)
+ d1.u.sym->u.val = d2.u.i;
+ else if (d2.type == FLOAT)
+ d1.u.sym->u.fval = d2.u.f;
+ else if (d2.type == STRING)
+ d1.u.sym->u.str = new Common::String(*d2.u.s);
+
d1.u.sym->type = d2.type;
- g_lingo->push(d2);
+ g_lingo->push(d1);
}
bool Lingo::verify(Symbol *s) {
@@ -266,6 +276,21 @@ void Lingo::c_negate() {
g_lingo->push(d);
}
+void Lingo::c_ampersand() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ if (d1.type != STRING || d2.type != STRING) {
+ error("Wrong operands for & operation: %d %d", d1.type, d2.type);
+ }
+
+ *d1.u.s += *d2.u.s;
+
+ delete d2.u.s;
+
+ g_lingo->push(d1);
+}
+
void Lingo::c_eq() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index ed7a3c4..da427d3 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -432,16 +432,16 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 62
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 380
+#define YYLAST 439
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 57
+#define YYNTOKENS 58
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 33
/* YYNRULES -- Number of rules. */
-#define YYNRULES 99
+#define YYNRULES 100
/* YYNRULES -- Number of states. */
-#define YYNSTATES 209
+#define YYNSTATES 211
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -456,8 +456,8 @@ static const yytype_uint8 yytranslate[] =
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
51, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 50, 2, 2,
- 52, 53, 48, 46, 56, 47, 2, 49, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 50, 56, 2,
+ 52, 53, 48, 46, 57, 47, 2, 49, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
55, 45, 54, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -496,52 +496,54 @@ static const yytype_uint16 yyprhs[] =
149, 152, 154, 157, 159, 166, 168, 174, 176, 180,
184, 187, 191, 193, 195, 196, 197, 198, 201, 204,
206, 208, 210, 215, 220, 222, 224, 228, 232, 236,
- 240, 244, 248, 252, 256, 260, 263, 266, 270, 273,
- 276, 279, 281, 283, 286, 288, 292, 295, 298, 301,
- 304, 308, 311, 315, 318, 321, 323, 327, 330, 334,
- 335, 344, 345, 347, 351, 356, 357, 361, 362, 364
+ 240, 244, 248, 252, 256, 260, 264, 267, 270, 274,
+ 277, 280, 283, 285, 287, 290, 292, 296, 299, 302,
+ 305, 308, 312, 315, 319, 322, 325, 327, 331, 334,
+ 338, 339, 348, 349, 351, 355, 360, 361, 365, 366,
+ 368
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 58, 0, -1, 58, 59, 60, -1, 60, -1, 51,
- -1, -1, 84, -1, 79, -1, 88, -1, 61, -1,
- 63, -1, 1, -1, 31, 78, 22, 10, -1, 33,
- 10, 45, 78, -1, 33, 10, 35, 78, -1, 78,
- -1, 79, -1, 62, -1, 64, -1, 71, 52, 70,
- 53, 77, 76, 16, 32, -1, 72, 45, 78, 76,
- 35, 78, 76, 77, 76, 16, 32, -1, 72, 45,
- 78, 76, 13, 35, 78, 76, 77, 76, 16, 32,
- -1, 73, 70, 34, 59, 77, 76, 16, 21, -1,
- 73, 70, 34, 59, 77, 76, 14, 77, 76, 16,
- 21, -1, 73, 70, 34, 59, 77, 76, 75, 66,
- 76, 59, 16, 21, -1, 73, 70, 34, 75, 62,
- 76, -1, 73, 70, 34, 75, 62, 76, 38, 75,
- 62, 76, -1, 73, 70, 34, 75, 62, 76, 67,
- 76, 65, 76, -1, -1, 38, 75, 62, -1, 66,
- 69, -1, 69, -1, 67, 68, -1, 68, -1, 74,
- 70, 34, 75, 63, 76, -1, 67, -1, 74, 70,
- 34, 77, 76, -1, 78, -1, 78, 45, 78, -1,
- 52, 70, 53, -1, 32, 37, -1, 32, 36, 10,
- -1, 21, -1, 15, -1, -1, -1, -1, 77, 59,
- -1, 77, 63, -1, 7, -1, 8, -1, 11, -1,
- 9, 52, 89, 53, -1, 10, 52, 89, 53, -1,
- 10, -1, 61, -1, 78, 46, 78, -1, 78, 47,
- 78, -1, 78, 48, 78, -1, 78, 49, 78, -1,
- 78, 54, 78, -1, 78, 55, 78, -1, 78, 44,
- 78, -1, 78, 39, 78, -1, 78, 40, 78, -1,
- 46, 78, -1, 47, 78, -1, 52, 78, 53, -1,
- 25, 11, -1, 26, 10, -1, 31, 78, -1, 81,
- -1, 17, -1, 19, 80, -1, 10, -1, 80, 56,
- 10, -1, 20, 23, -1, 20, 28, -1, 20, 30,
- -1, 20, 82, -1, 20, 82, 83, -1, 20, 83,
- -1, 35, 18, 11, -1, 18, 11, -1, 35, 11,
- -1, 11, -1, 29, 27, 11, -1, 27, 11, -1,
- 35, 27, 11, -1, -1, 24, 10, 85, 75, 86,
- 59, 87, 77, -1, -1, 10, -1, 86, 56, 10,
- -1, 86, 59, 56, 10, -1, -1, 10, 75, 89,
- -1, -1, 78, -1, 89, 56, 78, -1
+ 59, 0, -1, 59, 60, 61, -1, 61, -1, 51,
+ -1, -1, 85, -1, 80, -1, 89, -1, 62, -1,
+ 64, -1, 1, -1, 31, 79, 22, 10, -1, 33,
+ 10, 45, 79, -1, 33, 10, 35, 79, -1, 79,
+ -1, 80, -1, 63, -1, 65, -1, 72, 52, 71,
+ 53, 78, 77, 16, 32, -1, 73, 45, 79, 77,
+ 35, 79, 77, 78, 77, 16, 32, -1, 73, 45,
+ 79, 77, 13, 35, 79, 77, 78, 77, 16, 32,
+ -1, 74, 71, 34, 60, 78, 77, 16, 21, -1,
+ 74, 71, 34, 60, 78, 77, 14, 78, 77, 16,
+ 21, -1, 74, 71, 34, 60, 78, 77, 76, 67,
+ 77, 60, 16, 21, -1, 74, 71, 34, 76, 63,
+ 77, -1, 74, 71, 34, 76, 63, 77, 38, 76,
+ 63, 77, -1, 74, 71, 34, 76, 63, 77, 68,
+ 77, 66, 77, -1, -1, 38, 76, 63, -1, 67,
+ 70, -1, 70, -1, 68, 69, -1, 69, -1, 75,
+ 71, 34, 76, 64, 77, -1, 68, -1, 75, 71,
+ 34, 78, 77, -1, 79, -1, 79, 45, 79, -1,
+ 52, 71, 53, -1, 32, 37, -1, 32, 36, 10,
+ -1, 21, -1, 15, -1, -1, -1, -1, 78, 60,
+ -1, 78, 64, -1, 7, -1, 8, -1, 11, -1,
+ 9, 52, 90, 53, -1, 10, 52, 90, 53, -1,
+ 10, -1, 62, -1, 79, 46, 79, -1, 79, 47,
+ 79, -1, 79, 48, 79, -1, 79, 49, 79, -1,
+ 79, 54, 79, -1, 79, 55, 79, -1, 79, 44,
+ 79, -1, 79, 39, 79, -1, 79, 40, 79, -1,
+ 79, 56, 79, -1, 46, 79, -1, 47, 79, -1,
+ 52, 79, 53, -1, 25, 11, -1, 26, 10, -1,
+ 31, 79, -1, 82, -1, 17, -1, 19, 81, -1,
+ 10, -1, 81, 57, 10, -1, 20, 23, -1, 20,
+ 28, -1, 20, 30, -1, 20, 83, -1, 20, 83,
+ 84, -1, 20, 84, -1, 35, 18, 11, -1, 18,
+ 11, -1, 35, 11, -1, 11, -1, 29, 27, 11,
+ -1, 27, 11, -1, 35, 27, 11, -1, -1, 24,
+ 10, 86, 76, 87, 60, 88, 78, -1, -1, 10,
+ -1, 87, 57, 10, -1, 87, 60, 57, 10, -1,
+ -1, 10, 76, 90, -1, -1, 79, -1, 90, 57,
+ 79, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -553,10 +555,11 @@ static const yytype_uint16 yyrline[] =
240, 241, 244, 245, 248, 256, 257, 265, 266, 267,
269, 271, 277, 283, 290, 292, 294, 295, 296, 299,
304, 307, 310, 316, 324, 327, 328, 329, 330, 331,
- 332, 333, 334, 335, 336, 337, 338, 339, 342, 343,
- 344, 345, 346, 348, 351, 352, 363, 364, 365, 366,
- 371, 377, 384, 385, 386, 387, 390, 391, 392, 420,
- 420, 427, 428, 429, 430, 432, 435, 443, 444, 445
+ 332, 333, 334, 335, 336, 337, 338, 339, 340, 343,
+ 344, 345, 346, 347, 349, 352, 353, 364, 365, 366,
+ 367, 372, 378, 385, 386, 387, 388, 391, 392, 393,
+ 421, 421, 428, 429, 430, 431, 433, 436, 444, 445,
+ 446
};
#endif
@@ -572,12 +575,12 @@ static const char *const yytname[] =
"tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH",
"tWHILE", "tNLELSE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='",
"'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'",
- "','", "$accept", "program", "nl", "programline", "asgn", "stmtoneliner",
- "stmt", "ifstmt", "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
- "elseifstmtoneliner1", "elseifstmt1", "cond", "repeatwhile",
- "repeatwith", "if", "elseif", "begin", "end", "stmtlist", "expr", "func",
- "globallist", "gotofunc", "gotoframe", "gotomovie", "defn", "@1",
- "argdef", "argstore", "macro", "arglist", 0
+ "'&'", "','", "$accept", "program", "nl", "programline", "asgn",
+ "stmtoneliner", "stmt", "ifstmt", "elsestmtoneliner", "elseifstmt",
+ "elseifstmtoneliner", "elseifstmtoneliner1", "elseifstmt1", "cond",
+ "repeatwhile", "repeatwith", "if", "elseif", "begin", "end", "stmtlist",
+ "expr", "func", "globallist", "gotofunc", "gotoframe", "gotomovie",
+ "defn", "@1", "argdef", "argstore", "macro", "arglist", 0
};
#endif
@@ -591,23 +594,24 @@ static const yytype_uint16 yytoknum[] =
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 61, 43, 45, 42, 47,
- 37, 10, 40, 41, 62, 60, 44
+ 37, 10, 40, 41, 62, 60, 38, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 57, 58, 58, 59, 60, 60, 60, 60, 60,
- 60, 60, 61, 61, 61, 62, 62, 63, 63, 63,
- 63, 63, 64, 64, 64, 64, 64, 64, 65, 65,
- 66, 66, 67, 67, 68, 69, 69, 70, 70, 70,
- 71, 72, 73, 74, 75, 76, 77, 77, 77, 78,
- 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
- 78, 78, 78, 78, 78, 78, 78, 78, 79, 79,
- 79, 79, 79, 79, 80, 80, 81, 81, 81, 81,
- 81, 81, 82, 82, 82, 82, 83, 83, 83, 85,
- 84, 86, 86, 86, 86, 87, 88, 89, 89, 89
+ 0, 58, 59, 59, 60, 61, 61, 61, 61, 61,
+ 61, 61, 62, 62, 62, 63, 63, 64, 64, 64,
+ 64, 64, 65, 65, 65, 65, 65, 65, 66, 66,
+ 67, 67, 68, 68, 69, 70, 70, 71, 71, 71,
+ 72, 73, 74, 75, 76, 77, 78, 78, 78, 79,
+ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
+ 79, 79, 79, 79, 79, 79, 79, 79, 79, 80,
+ 80, 80, 80, 80, 80, 81, 81, 82, 82, 82,
+ 82, 82, 82, 83, 83, 83, 83, 84, 84, 84,
+ 86, 85, 87, 87, 87, 87, 88, 89, 90, 90,
+ 90
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -619,10 +623,11 @@ static const yytype_uint8 yyr2[] =
2, 1, 2, 1, 6, 1, 5, 1, 3, 3,
2, 3, 1, 1, 0, 0, 0, 2, 2, 1,
1, 1, 4, 4, 1, 1, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 2, 2, 3, 2, 2,
- 2, 1, 1, 2, 1, 3, 2, 2, 2, 2,
- 3, 2, 3, 2, 2, 1, 3, 2, 3, 0,
- 8, 0, 1, 3, 4, 0, 3, 0, 1, 3
+ 3, 3, 3, 3, 3, 3, 2, 2, 3, 2,
+ 2, 2, 1, 1, 2, 1, 3, 2, 2, 2,
+ 2, 3, 2, 3, 2, 2, 1, 3, 2, 3,
+ 0, 8, 0, 1, 3, 4, 0, 3, 0, 1,
+ 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -630,36 +635,37 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 49, 50, 0, 44, 51, 72, 0, 0,
+ 0, 11, 49, 50, 0, 44, 51, 73, 0, 0,
42, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 3, 55, 17, 10, 18, 0, 0, 0, 15,
- 7, 71, 6, 8, 97, 97, 97, 74, 73, 85,
- 0, 76, 0, 77, 0, 78, 0, 79, 81, 89,
- 68, 69, 54, 0, 55, 70, 0, 40, 0, 65,
- 66, 0, 1, 4, 0, 0, 0, 0, 0, 37,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 98,
- 0, 0, 96, 0, 83, 87, 0, 84, 0, 0,
- 0, 80, 44, 0, 0, 41, 0, 0, 67, 2,
- 0, 45, 0, 0, 44, 0, 63, 64, 62, 56,
- 57, 58, 59, 60, 61, 52, 0, 53, 75, 86,
- 82, 88, 91, 12, 14, 13, 46, 0, 39, 46,
- 0, 38, 99, 92, 0, 45, 0, 0, 45, 45,
- 16, 0, 95, 47, 48, 0, 0, 45, 44, 25,
- 93, 0, 46, 0, 45, 46, 46, 0, 0, 43,
- 44, 45, 33, 0, 94, 90, 19, 46, 45, 45,
- 22, 45, 35, 31, 0, 0, 32, 28, 0, 45,
- 0, 0, 30, 0, 0, 45, 44, 45, 44, 0,
- 0, 0, 0, 44, 26, 0, 27, 0, 0, 20,
- 23, 0, 45, 29, 45, 21, 24, 36, 34
+ 7, 72, 6, 8, 98, 98, 98, 75, 74, 86,
+ 0, 77, 0, 78, 0, 79, 0, 80, 82, 90,
+ 69, 70, 54, 0, 55, 71, 0, 40, 0, 66,
+ 67, 0, 1, 4, 0, 0, 0, 0, 0, 37,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 99, 0, 0, 97, 0, 84, 88, 0, 85, 0,
+ 0, 0, 81, 44, 0, 0, 41, 0, 0, 68,
+ 2, 0, 45, 0, 0, 44, 0, 63, 64, 62,
+ 56, 57, 58, 59, 60, 61, 65, 52, 0, 53,
+ 76, 87, 83, 89, 92, 12, 14, 13, 46, 0,
+ 39, 46, 0, 38, 100, 93, 0, 45, 0, 0,
+ 45, 45, 16, 0, 96, 47, 48, 0, 0, 45,
+ 44, 25, 94, 0, 46, 0, 45, 46, 46, 0,
+ 0, 43, 44, 45, 33, 0, 95, 91, 19, 46,
+ 45, 45, 22, 45, 35, 31, 0, 0, 32, 28,
+ 0, 45, 0, 0, 30, 0, 0, 45, 44, 45,
+ 44, 0, 0, 0, 0, 44, 26, 0, 27, 0,
+ 0, 20, 23, 0, 45, 29, 45, 21, 24, 36,
+ 34
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 20, 143, 21, 54, 23, 144, 25, 187, 171,
- 172, 162, 173, 68, 26, 27, 28, 163, 197, 127,
- 135, 29, 140, 38, 31, 47, 48, 32, 92, 134,
- 152, 33, 80
+ -1, 20, 145, 21, 54, 23, 146, 25, 189, 173,
+ 174, 164, 175, 68, 26, 27, 28, 165, 199, 129,
+ 137, 29, 142, 38, 31, 47, 48, 32, 93, 136,
+ 154, 33, 81
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
@@ -667,36 +673,37 @@ static const yytype_int16 yydefgoto[] =
#define YYPACT_NINF -150
static const yytype_int16 yypact[] =
{
- 152, -150, -150, -150, -41, 55, -150, -150, 51, 296,
- -150, 73, 81, 95, 180, 16, 105, 180, 180, 180,
- 4, -150, 8, -150, -150, -150, 39, 76, 226, 325,
- -150, -150, -150, -150, 180, 180, 180, -150, 62, -150,
- 112, -150, 114, -150, 103, -150, 3, 21, -150, -150,
- -150, -150, 79, 180, -150, 80, 122, -150, -7, -13,
- -13, 301, -150, -150, 152, 226, 180, 226, 99, 313,
- 180, 180, 180, 180, 180, 180, 180, 180, 180, 325,
- 37, 58, 83, 126, -150, -150, 129, -150, 130, 131,
- 110, -150, -150, 80, 133, -150, 180, 180, -150, -150,
- 92, 325, 93, 289, 97, 180, 325, 325, 325, 249,
- 249, -13, -13, 325, 325, -150, 180, -150, -150, -150,
- -150, -150, 139, -150, 325, 325, -150, -1, -150, -150,
- 275, 325, 325, -150, 57, 198, 115, 180, 198, -150,
- -150, 141, 98, -150, -150, 142, 180, 325, 46, -5,
- -150, 145, -150, 125, 325, -150, -150, 146, 151, -150,
- -150, 151, -150, 226, -150, 198, -150, -150, 198, 198,
- -150, 151, 151, -150, 226, 275, -150, 132, 134, 198,
- 158, 163, -150, 97, 147, -150, -150, -150, -150, 164,
- 154, 171, 177, -8, -150, 275, -150, 244, 162, -150,
- -150, 174, 198, -150, -150, -150, -150, -150, -150
+ 162, -150, -150, -150, -21, 383, -150, -150, 15, 329,
+ -150, 32, 42, 50, 84, -23, 52, 84, 84, 84,
+ 7, -150, 8, -150, -150, -150, 13, 18, 236, 370,
+ -150, -150, -150, -150, 84, 84, 84, -150, 25, -150,
+ 72, -150, 73, -150, 59, -150, 5, 12, -150, -150,
+ -150, -150, 36, 84, -150, 295, 80, -150, 11, 83,
+ 83, 339, -150, -150, 162, 236, 84, 236, 62, 357,
+ 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
+ 370, -27, 4, 40, 90, -150, -150, 91, -150, 93,
+ 94, 79, -150, -150, 295, 98, -150, 84, 84, -150,
+ -150, 57, 370, 58, 321, 65, 84, 370, 370, 370,
+ 182, 182, 83, 83, 370, 370, 370, -150, 84, -150,
+ -150, -150, -150, -150, 110, -150, 370, 370, -150, -1,
+ -150, -150, 285, 370, 370, -150, -29, 208, 89, 84,
+ 208, -150, -150, 115, 69, -150, -150, 113, 84, 370,
+ 34, -5, -150, 122, -150, 101, 370, -150, -150, 120,
+ 119, -150, -150, 119, -150, 236, -150, 208, -150, -150,
+ 208, 208, -150, 119, 119, -150, 236, 285, -150, 106,
+ 114, 208, 131, 134, -150, 65, 117, -150, -150, -150,
+ -150, 136, 123, 133, 140, -6, -150, 285, -150, 254,
+ 125, -150, -150, 139, 208, -150, -150, -150, -150, -150,
+ -150
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -150, -150, -18, 136, 6, -106, 0, -150, -150, -150,
- 47, -121, 30, -62, -150, -150, -150, -149, -4, -122,
- -71, 1, 23, -150, -150, -150, 155, -150, -150, -150,
- -150, -150, 9
+ -150, -150, -18, 100, 6, -128, 0, -150, -150, -150,
+ 14, -136, 2, -62, -150, -150, -150, -149, -4, -28,
+ -114, 1, 21, -150, -150, -150, 121, -150, -150, -150,
+ -150, -150, 16
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -706,88 +713,98 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -55
static const yytype_int16 yytable[] =
{
- 24, 36, 64, 100, 62, 102, 22, -46, -9, 174,
- 159, 34, 136, 145, 87, 55, 148, 149, 59, 60,
- 61, 88, 174, 30, 139, 155, 70, 71, 96, 69,
- 89, 72, 167, 160, 137, 79, 79, 79, 97, 177,
- 176, 77, 78, -46, 81, 82, 180, 181, 42, 183,
- 44, 176, 56, 57, 93, 63, 90, 189, 138, -9,
- 156, 37, 157, 194, 24, 196, 69, 101, 103, 185,
- 22, 106, 107, 108, 109, 110, 111, 112, 113, 114,
- 207, 165, 208, 49, 168, 169, 129, 30, 122, 203,
- 115, 65, 50, 116, -54, -54, 179, 124, 125, -54,
- 130, 178, 94, -54, -54, 51, 131, 35, 63, -54,
- -54, 117, 184, 141, 116, 58, 142, 132, 83, 70,
- 71, 66, 202, 84, 72, 85, 73, 74, 75, 76,
- 86, 35, 95, 104, 77, 78, 118, 89, 147, 116,
- 119, 120, 121, 123, 158, 126, 128, 154, 63, 133,
- 146, 150, -5, 1, 151, 164, 175, 166, 153, 2,
- 3, 4, 5, 6, 69, 192, 159, 170, 188, 7,
- 186, 8, 9, 10, 190, 69, 11, 12, 13, 191,
- 198, 193, 195, 14, 15, 16, 199, 2, 3, 4,
- 52, 6, 200, 201, 205, 206, 161, 204, 17, 18,
- 99, 182, 91, -5, 19, 2, 3, 4, 52, 6,
- 0, 53, 0, 16, 0, 7, 0, 8, 9, 10,
- 0, 0, 0, 12, 13, 0, 17, 18, 0, 14,
- 15, 16, 19, 2, 3, 4, 52, 6, 0, 0,
+ 24, 36, 64, 101, 141, 103, 22, 62, -9, -46,
+ 161, 176, 138, 56, 57, 55, 88, 140, 59, 60,
+ 61, 30, 63, 89, 176, 37, 117, 178, 143, 69,
+ 118, 34, 90, 162, 139, 80, 80, 80, 178, 42,
+ 167, 44, 49, 170, 171, -46, 97, 91, 158, 187,
+ 159, 82, 83, 50, 94, 181, 98, 119, 63, -9,
+ 51, 118, 58, 66, 24, 65, 69, 102, 104, 205,
+ 22, 107, 108, 109, 110, 111, 112, 113, 114, 115,
+ 116, 204, 84, 85, 86, 30, 87, 131, 35, 124,
+ 96, 2, 3, 4, 52, 6, 105, 118, 126, 127,
+ 120, 132, 121, 180, 122, 123, 90, 133, 125, 147,
+ 128, 130, 150, 151, 186, 53, 63, 16, 144, 134,
+ 135, 157, 70, 71, 148, 152, 153, 72, 169, 155,
+ 17, 18, 166, 168, 161, 179, 19, 77, 78, 79,
+ 149, 172, 182, 183, 188, 185, 160, 192, 190, 156,
+ 193, 195, 200, 191, 202, 201, 203, 207, 177, 196,
+ 208, 198, -5, 1, 100, 163, 69, 194, 92, 2,
+ 3, 4, 5, 6, 0, 184, 209, 69, 210, 7,
+ 0, 8, 9, 10, 197, 0, 11, 12, 13, 0,
+ 0, 0, 0, 14, 15, 16, 0, 0, 0, 206,
+ 0, 0, 0, 0, 0, 0, 0, 0, 17, 18,
+ 0, 0, 0, -5, 19, 2, 3, 4, 52, 6,
+ 0, 70, 71, 0, 0, 7, 72, 8, 9, 10,
+ 75, 76, 0, 12, 13, 0, 77, 78, 79, 14,
+ 15, 16, 0, 2, 3, 4, 52, 6, 0, 0,
0, 0, 0, 0, 17, 18, 0, 0, 0, 63,
19, 2, 3, 4, 52, 6, 0, 53, 0, 16,
0, 7, 0, 8, 9, 10, 0, 0, 0, 12,
13, 0, 17, 18, 0, 14, 15, 16, 67, 0,
- 0, 0, 2, 3, 4, 52, 6, 0, 70, 71,
- 17, 18, 7, 72, 8, 9, 19, 75, 76, 0,
- 12, 13, 0, 77, 78, 0, 14, 39, 16, 0,
- 0, 0, 0, 0, 40, 0, 0, 0, 0, 41,
- 0, 17, 18, 42, 43, 44, 45, 19, 70, 71,
- 0, 46, 0, 72, 105, 73, 74, 75, 76, 0,
- 70, 71, 98, 77, 78, 72, 0, 73, 74, 75,
- 76, 0, 70, 71, 98, 77, 78, 72, 105, 73,
- 74, 75, 76, 0, 70, 71, 0, 77, 78, 72,
- 0, 73, 74, 75, 76, 0, 0, 0, 0, 77,
- 78
+ 0, 0, 2, 3, 4, 52, 6, 0, 0, 0,
+ 17, 18, 7, 0, 8, 9, 19, 0, 0, 0,
+ 12, 13, 0, 0, 0, 0, 14, 95, 16, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 17, 18, 0, 70, 71, 0, 19, 0, 72,
+ 39, 73, 74, 75, 76, 0, 0, 40, 0, 77,
+ 78, 79, 41, 0, 0, 0, 42, 43, 44, 45,
+ 70, 71, 0, 0, 46, 72, 106, 73, 74, 75,
+ 76, 0, 0, 0, 99, 77, 78, 79, 70, 71,
+ 0, 0, 0, 72, 0, 73, 74, 75, 76, 0,
+ 0, 0, 99, 77, 78, 79, 70, 71, 0, 0,
+ 0, 72, 106, 73, 74, 75, 76, 0, 0, 70,
+ 71, 77, 78, 79, 72, 0, 73, 74, 75, 76,
+ 0, 0, -54, -54, 77, 78, 79, -54, 0, 0,
+ 0, -54, -54, 0, 0, 35, 0, -54, -54, -54
};
static const yytype_int16 yycheck[] =
{
- 0, 5, 20, 65, 0, 67, 0, 15, 0, 158,
- 15, 52, 13, 135, 11, 14, 138, 139, 17, 18,
- 19, 18, 171, 0, 130, 147, 39, 40, 35, 28,
- 27, 44, 154, 38, 35, 34, 35, 36, 45, 161,
- 161, 54, 55, 51, 35, 36, 168, 169, 27, 171,
- 29, 172, 36, 37, 53, 51, 35, 179, 129, 51,
- 14, 10, 16, 185, 64, 187, 65, 66, 67, 175,
+ 0, 5, 20, 65, 132, 67, 0, 0, 0, 15,
+ 15, 160, 13, 36, 37, 14, 11, 131, 17, 18,
+ 19, 0, 51, 18, 173, 10, 53, 163, 57, 28,
+ 57, 52, 27, 38, 35, 34, 35, 36, 174, 27,
+ 154, 29, 10, 157, 158, 51, 35, 35, 14, 177,
+ 16, 35, 36, 11, 53, 169, 45, 53, 51, 51,
+ 10, 57, 10, 45, 64, 52, 65, 66, 67, 197,
64, 70, 71, 72, 73, 74, 75, 76, 77, 78,
- 202, 152, 204, 10, 155, 156, 104, 64, 92, 195,
- 53, 52, 11, 56, 39, 40, 167, 96, 97, 44,
- 104, 163, 22, 48, 49, 10, 105, 52, 51, 54,
- 55, 53, 174, 56, 56, 10, 134, 116, 56, 39,
- 40, 45, 193, 11, 44, 11, 46, 47, 48, 49,
- 27, 52, 10, 34, 54, 55, 10, 27, 137, 56,
- 11, 11, 11, 10, 148, 53, 53, 146, 51, 10,
- 35, 10, 0, 1, 56, 10, 160, 32, 16, 7,
- 8, 9, 10, 11, 163, 183, 15, 21, 34, 17,
- 38, 19, 20, 21, 16, 174, 24, 25, 26, 16,
- 16, 34, 186, 31, 32, 33, 32, 7, 8, 9,
- 10, 11, 21, 16, 32, 21, 149, 197, 46, 47,
- 64, 171, 47, 51, 52, 7, 8, 9, 10, 11,
- -1, 31, -1, 33, -1, 17, -1, 19, 20, 21,
- -1, -1, -1, 25, 26, -1, 46, 47, -1, 31,
- 32, 33, 52, 7, 8, 9, 10, 11, -1, -1,
+ 79, 195, 57, 11, 11, 64, 27, 105, 52, 93,
+ 10, 7, 8, 9, 10, 11, 34, 57, 97, 98,
+ 10, 105, 11, 165, 11, 11, 27, 106, 10, 137,
+ 53, 53, 140, 141, 176, 31, 51, 33, 136, 118,
+ 10, 149, 39, 40, 35, 10, 57, 44, 156, 16,
+ 46, 47, 10, 32, 15, 163, 52, 54, 55, 56,
+ 139, 21, 170, 171, 38, 173, 150, 16, 34, 148,
+ 16, 34, 16, 181, 21, 32, 16, 32, 162, 187,
+ 21, 189, 0, 1, 64, 151, 165, 185, 47, 7,
+ 8, 9, 10, 11, -1, 173, 204, 176, 206, 17,
+ -1, 19, 20, 21, 188, -1, 24, 25, 26, -1,
+ -1, -1, -1, 31, 32, 33, -1, -1, -1, 199,
+ -1, -1, -1, -1, -1, -1, -1, -1, 46, 47,
+ -1, -1, -1, 51, 52, 7, 8, 9, 10, 11,
+ -1, 39, 40, -1, -1, 17, 44, 19, 20, 21,
+ 48, 49, -1, 25, 26, -1, 54, 55, 56, 31,
+ 32, 33, -1, 7, 8, 9, 10, 11, -1, -1,
-1, -1, -1, -1, 46, 47, -1, -1, -1, 51,
52, 7, 8, 9, 10, 11, -1, 31, -1, 33,
-1, 17, -1, 19, 20, 21, -1, -1, -1, 25,
26, -1, 46, 47, -1, 31, 32, 33, 52, -1,
- -1, -1, 7, 8, 9, 10, 11, -1, 39, 40,
- 46, 47, 17, 44, 19, 20, 52, 48, 49, -1,
- 25, 26, -1, 54, 55, -1, 31, 11, 33, -1,
- -1, -1, -1, -1, 18, -1, -1, -1, -1, 23,
- -1, 46, 47, 27, 28, 29, 30, 52, 39, 40,
- -1, 35, -1, 44, 45, 46, 47, 48, 49, -1,
- 39, 40, 53, 54, 55, 44, -1, 46, 47, 48,
- 49, -1, 39, 40, 53, 54, 55, 44, 45, 46,
- 47, 48, 49, -1, 39, 40, -1, 54, 55, 44,
- -1, 46, 47, 48, 49, -1, -1, -1, -1, 54,
- 55
+ -1, -1, 7, 8, 9, 10, 11, -1, -1, -1,
+ 46, 47, 17, -1, 19, 20, 52, -1, -1, -1,
+ 25, 26, -1, -1, -1, -1, 31, 22, 33, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 46, 47, -1, 39, 40, -1, 52, -1, 44,
+ 11, 46, 47, 48, 49, -1, -1, 18, -1, 54,
+ 55, 56, 23, -1, -1, -1, 27, 28, 29, 30,
+ 39, 40, -1, -1, 35, 44, 45, 46, 47, 48,
+ 49, -1, -1, -1, 53, 54, 55, 56, 39, 40,
+ -1, -1, -1, 44, -1, 46, 47, 48, 49, -1,
+ -1, -1, 53, 54, 55, 56, 39, 40, -1, -1,
+ -1, 44, 45, 46, 47, 48, 49, -1, -1, 39,
+ 40, 54, 55, 56, 44, -1, 46, 47, 48, 49,
+ -1, -1, 39, 40, 54, 55, 56, 44, -1, -1,
+ -1, 48, 49, -1, -1, 52, -1, 54, 55, 56
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -796,25 +813,26 @@ static const yytype_uint8 yystos[] =
{
0, 1, 7, 8, 9, 10, 11, 17, 19, 20,
21, 24, 25, 26, 31, 32, 33, 46, 47, 52,
- 58, 60, 61, 62, 63, 64, 71, 72, 73, 78,
- 79, 81, 84, 88, 52, 52, 75, 10, 80, 11,
- 18, 23, 27, 28, 29, 30, 35, 82, 83, 10,
- 11, 10, 10, 31, 61, 78, 36, 37, 10, 78,
- 78, 78, 0, 51, 59, 52, 45, 52, 70, 78,
- 39, 40, 44, 46, 47, 48, 49, 54, 55, 78,
- 89, 89, 89, 56, 11, 11, 27, 11, 18, 27,
- 35, 83, 85, 78, 22, 10, 35, 45, 53, 60,
- 70, 78, 70, 78, 34, 45, 78, 78, 78, 78,
- 78, 78, 78, 78, 78, 53, 56, 53, 10, 11,
- 11, 11, 75, 10, 78, 78, 53, 76, 53, 59,
- 75, 78, 78, 10, 86, 77, 13, 35, 77, 62,
- 79, 56, 59, 59, 63, 76, 35, 78, 76, 76,
- 10, 56, 87, 16, 78, 76, 14, 16, 75, 15,
- 38, 67, 68, 74, 10, 77, 32, 76, 77, 77,
- 21, 66, 67, 69, 74, 75, 68, 76, 70, 77,
- 76, 76, 69, 76, 70, 62, 38, 65, 34, 76,
- 16, 16, 59, 34, 76, 75, 76, 75, 16, 32,
- 21, 16, 77, 62, 63, 32, 21, 76, 76
+ 59, 61, 62, 63, 64, 65, 72, 73, 74, 79,
+ 80, 82, 85, 89, 52, 52, 76, 10, 81, 11,
+ 18, 23, 27, 28, 29, 30, 35, 83, 84, 10,
+ 11, 10, 10, 31, 62, 79, 36, 37, 10, 79,
+ 79, 79, 0, 51, 60, 52, 45, 52, 71, 79,
+ 39, 40, 44, 46, 47, 48, 49, 54, 55, 56,
+ 79, 90, 90, 90, 57, 11, 11, 27, 11, 18,
+ 27, 35, 84, 86, 79, 22, 10, 35, 45, 53,
+ 61, 71, 79, 71, 79, 34, 45, 79, 79, 79,
+ 79, 79, 79, 79, 79, 79, 79, 53, 57, 53,
+ 10, 11, 11, 11, 76, 10, 79, 79, 53, 77,
+ 53, 60, 76, 79, 79, 10, 87, 78, 13, 35,
+ 78, 63, 80, 57, 60, 60, 64, 77, 35, 79,
+ 77, 77, 10, 57, 88, 16, 79, 77, 14, 16,
+ 76, 15, 38, 68, 69, 75, 10, 78, 32, 77,
+ 78, 78, 21, 67, 68, 70, 75, 76, 69, 77,
+ 71, 78, 77, 77, 70, 77, 71, 63, 38, 66,
+ 34, 77, 16, 16, 60, 34, 77, 76, 77, 76,
+ 16, 32, 21, 16, 78, 63, 64, 32, 21, 77,
+ 77
};
#define yyerrok (yyerrstatus = 0)
@@ -1989,67 +2007,72 @@ yyreduce:
case 65:
#line 337 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+ { g_lingo->code1(g_lingo->c_ampersand); ;}
break;
case 66:
#line 338 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 67:
#line 339 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 68:
-#line 342 "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); ;}
+#line 340 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 69:
#line 343 "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); ;}
+ { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 70:
#line 344 "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 71:
+#line 345 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 72:
-#line 346 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 347 "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 74:
-#line 351 "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 75:
#line 352 "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); ;}
+ { g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;}
break;
case 76:
-#line 363 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoloop); ;}
+#line 353 "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 77:
#line 364 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotonext); ;}
+ { g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 78:
#line 365 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoprevious); ;}
+ { g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 79:
#line 366 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gotoprevious); ;}
+ break;
+
+ case 80:
+#line 367 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2057,8 +2080,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 80:
-#line 371 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 372 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2067,8 +2090,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 81:
-#line 377 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 378 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2076,14 +2099,9 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 82:
-#line 384 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
- break;
-
case 83:
#line 385 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 84:
@@ -2093,31 +2111,36 @@ yyreduce:
case 85:
#line 387 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 86:
-#line 390 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 388 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 87:
#line 391 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 88:
#line 392 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 89:
-#line 420 "engines/director/lingo/lingo-gr.y"
- { g_lingo->_indef = true; ;}
+#line 393 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 90:
#line 421 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->_indef = true; ;}
+ break;
+
+ case 91:
+#line 422 "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);
@@ -2125,33 +2148,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 91:
-#line 427 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 0; ;}
- break;
-
case 92:
#line 428 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
+ { (yyval.narg) = 0; ;}
break;
case 93:
#line 429 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
+ { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 94:
#line 430 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
+ { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 95:
-#line 432 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArgStore(); ;}
+#line 431 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 96:
-#line 435 "engines/director/lingo/lingo-gr.y"
+#line 433 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArgStore(); ;}
+ break;
+
+ case 97:
+#line 436 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2160,24 +2183,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 97:
-#line 443 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 0; ;}
- break;
-
case 98:
#line 444 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 1; ;}
+ { (yyval.narg) = 0; ;}
break;
case 99:
#line 445 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = 1; ;}
+ break;
+
+ case 100:
+#line 446 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2181 "engines/director/lingo/lingo-gr.cpp"
+#line 2204 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2391,6 +2414,6 @@ yyreturn:
}
-#line 448 "engines/director/lingo/lingo-gr.y"
+#line 449 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index b76000a..002b454 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -334,6 +334,7 @@ expr: INT {
| expr tNEQ expr { g_lingo->code1(g_lingo->c_neq); }
| expr tGE expr { g_lingo->code1(g_lingo->c_ge); }
| expr tLE expr { g_lingo->code1(g_lingo->c_le); }
+ | expr '&' expr { g_lingo->code1(g_lingo->c_ampersand); }
| '+' expr %prec UNARY { $$ = $2; }
| '-' expr %prec UNARY { $$ = $2; g_lingo->code1(g_lingo->c_negate); }
| '(' expr ')' { $$ = $2; }
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 60ae123..76a11be 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -397,7 +397,7 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 5, 6, 7, 1, 1, 8, 1, 1, 8,
+ 1, 5, 6, 7, 1, 1, 8, 8, 1, 8,
8, 8, 8, 8, 9, 10, 8, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 8, 1, 12,
13, 14, 1, 1, 15, 16, 17, 18, 19, 20,
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index c3ae83c..7b04c6b 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -51,7 +51,7 @@ identifier [_[:alpha:]][_[:alnum:]]*
constfloat [[:digit:]]+\.[[:digit:]]*
constinteger [[:digit:]]+
conststring \"[^\"\n]*\"
-operator [-+*/%=^:,()><]
+operator [-+*/%=^:,()><&]
newline [ \t]*[\n\r]+
whitespace [\t ]
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index cc9f0ac..f6aa565 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -81,10 +81,10 @@ struct Symbol { /* symbol table entry */
char *name;
int type;
union {
- int val; /* VAR */
- float fval; /* FLOAT */
- ScriptData *defn; /* FUNCTION, PROCEDURE */
- char *str; /* STRING */
+ int val; /* VAR */
+ float fval; /* FLOAT */
+ ScriptData *defn; /* FUNCTION, PROCEDURE */
+ Common::String *str; /* STRING */
} u;
int nargs;
bool global;
@@ -172,11 +172,14 @@ public:
static void c_xpop();
static void c_printtop();
+
static void c_add();
static void c_sub();
static void c_mul();
static void c_div();
static void c_negate();
+ static void c_ampersand();
+
static void c_constpush();
static void c_fconstpush();
static void c_stringpush();
Commit: caa29882933467f42d3b6235001dc2e37d6e6495
https://github.com/scummvm/scummvm/commit/caa29882933467f42d3b6235001dc2e37d6e6495
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fixed c_eval and made correctly processing different types
Changed paths:
engines/director/lingo/lingo-code.cpp
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 2c79719..2f0e554 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -207,7 +207,13 @@ void Lingo::c_eval() {
return;
d.type = d.u.sym->type;
- d.u.i = d.u.sym->u.val;
+
+ if (d.u.sym->type == INT)
+ d.u.i = d.u.sym->u.val;
+ else if (d.u.sym->type == FLOAT)
+ d.u.f = d.u.sym->u.fval;
+ else if (d.u.sym->type == STRING)
+ d.u.s = new Common::String(*d.u.sym->u.str);
g_lingo->push(d);
}
Commit: 458d1e5f78372b39768c21b20b99a6eb498a4029
https://github.com/scummvm/scummvm/commit/458d1e5f78372b39768c21b20b99a6eb498a4029
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Aligned Datum and Symbol union member names
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 2f0e554..a532764 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -89,7 +89,7 @@ void Lingo::c_printtop(void) {
if (d.u.sym->name)
warning("var: %s", d.u.sym->name);
else
- warning("Nameless var. val: %d", d.u.sym->u.val);
+ warning("Nameless var. val: %d", d.u.sym->u.i);
}
break;
case STRING:
@@ -136,7 +136,7 @@ void Lingo::c_varpush() {
d.u.sym = g_lingo->lookupVar(name);
if (d.u.sym->type == CASTREF) {
d.type = INT;
- int val = d.u.sym->u.val;
+ int val = d.u.sym->u.i;
delete d.u.sym;
@@ -167,16 +167,16 @@ void Lingo::c_assign() {
}
if (d1.u.sym->type == STRING) // Free memory if needed
- delete d1.u.sym->u.str;
+ delete d1.u.sym->u.s;
if (d2.type == INT)
- d1.u.sym->u.val = d2.u.i;
+ d1.u.sym->u.i = d2.u.i;
else if (d2.type == FLOAT)
- d1.u.sym->u.fval = d2.u.f;
+ d1.u.sym->u.f = d2.u.f;
else if (d2.type == STRING)
- d1.u.sym->u.str = new Common::String(*d2.u.s);
+ d1.u.sym->u.s = new Common::String(*d2.u.s);
- d1.u.sym->type = d2.type;
+ d1.u.sym->type = d2.type;
g_lingo->push(d1);
}
@@ -209,11 +209,11 @@ void Lingo::c_eval() {
d.type = d.u.sym->type;
if (d.u.sym->type == INT)
- d.u.i = d.u.sym->u.val;
+ d.u.i = d.u.sym->u.i;
else if (d.u.sym->type == FLOAT)
- d.u.f = d.u.sym->u.fval;
+ d.u.f = d.u.sym->u.f;
else if (d.u.sym->type == STRING)
- d.u.s = new Common::String(*d.u.sym->u.str);
+ d.u.s = new Common::String(*d.u.sym->u.s);
g_lingo->push(d);
}
@@ -419,7 +419,7 @@ void Lingo::c_repeatwithcode(void) {
g_lingo->execute(init); /* condition */
d = g_lingo->pop();
d.toInt();
- counter->u.val = d.u.i;
+ counter->u.i = d.u.i;
counter->type = INT;
while (true) {
@@ -427,12 +427,12 @@ void Lingo::c_repeatwithcode(void) {
if (g_lingo->_returning)
break;
- counter->u.val += inc;
+ counter->u.i += inc;
g_lingo->execute(finish); /* condition */
d = g_lingo->pop();
d.toInt();
- if (counter->u.val == d.u.i + inc)
+ if (counter->u.i == d.u.i + inc)
break;
}
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 10589b1..771cfc5 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -81,7 +81,7 @@ Symbol *Lingo::lookupVar(const char *name, bool create, bool putInGlobalList) {
sym = new Symbol;
sym->type = CASTREF;
- sym->u.val = val;
+ sym->u.i = val;
return sym;
}
@@ -96,7 +96,7 @@ Symbol *Lingo::lookupVar(const char *name, bool create, bool putInGlobalList) {
sym->name = (char *)calloc(strlen(name) + 1, 1);
Common::strlcpy(sym->name, name, strlen(name) + 1);
sym->type = VOID;
- sym->u.val = 0;
+ sym->u.i = 0;
(*_localvars)[name] = sym;
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 1ab0e89..b24c55b 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -70,7 +70,7 @@ struct EventHandlerType {
Symbol::Symbol() {
name = NULL;
type = VOID;
- u.str = NULL;
+ u.s = NULL;
nargs = 0;
global = false;
}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index f6aa565..5320d88 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -81,10 +81,10 @@ struct Symbol { /* symbol table entry */
char *name;
int type;
union {
- int val; /* VAR */
- float fval; /* FLOAT */
- ScriptData *defn; /* FUNCTION, PROCEDURE */
- Common::String *str; /* STRING */
+ int i; /* VAR */
+ float f; /* FLOAT */
+ ScriptData *defn; /* FUNCTION, PROCEDURE */
+ Common::String *s; /* STRING */
} u;
int nargs;
bool global;
Commit: 82f78708e78254a6a5c80e1265724b75594e2389
https://github.com/scummvm/scummvm/commit/82f78708e78254a6a5c80e1265724b75594e2389
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fixed <> operator, added logical operations and &&
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 040eaac..2f77234 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -129,6 +129,7 @@ Common::Error DirectorEngine::run() {
end repeat\n\
set z = \"foo bar baz\"\n\
set z1 = z & \" meow\"\n\
+ set z1 = z1 && \"woof\"\n\
put z\n\
put z1\n\
", kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index a532764..b2b96ad 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -297,6 +297,56 @@ void Lingo::c_ampersand() {
g_lingo->push(d1);
}
+void Lingo::c_concat() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ if (d1.type != STRING || d2.type != STRING) {
+ error("Wrong operands for & operation: %d %d", d1.type, d2.type);
+ }
+
+ *d1.u.s += " ";
+ *d1.u.s += *d2.u.s;
+
+ delete d2.u.s;
+
+ g_lingo->push(d1);
+}
+
+void Lingo::c_and() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.toInt();
+ d2.toInt();
+
+ d1.u.i = (d1.u.i && d2.u.i) ? 1 : 0;
+
+ g_lingo->push(d1);
+}
+
+void Lingo::c_or() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.toInt();
+ d2.toInt();
+
+ d1.u.i = (d1.u.i || d2.u.i) ? 1 : 0;
+
+ g_lingo->push(d1);
+}
+
+void Lingo::c_not() {
+ Datum d = g_lingo->pop();
+
+ d.toInt();
+
+ d.u.i = ~d.u.i ? 1 : 0;
+
+ g_lingo->push(d);
+}
+
void Lingo::c_eq() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index da427d3..2077d5c 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -107,7 +107,11 @@
tGT = 296,
tLT = 297,
tEQ = 298,
- tNEQ = 299
+ tNEQ = 299,
+ tAND = 300,
+ tOR = 301,
+ tNOT = 302,
+ tCONCAT = 303
};
#endif
/* Tokens. */
@@ -153,6 +157,10 @@
#define tLT 297
#define tEQ 298
#define tNEQ 299
+#define tAND 300
+#define tOR 301
+#define tNOT 302
+#define tCONCAT 303
@@ -204,7 +212,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 208 "engines/director/lingo/lingo-gr.cpp"
+#line 216 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -217,7 +225,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 221 "engines/director/lingo/lingo-gr.cpp"
+#line 229 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -430,22 +438,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 62
+#define YYFINAL 64
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 439
+#define YYLAST 540
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 58
+#define YYNTOKENS 62
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 33
/* YYNRULES -- Number of rules. */
-#define YYNRULES 100
+#define YYNRULES 104
/* YYNRULES -- Number of states. */
-#define YYNSTATES 211
+#define YYNSTATES 219
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 299
+#define YYMAXUTOK 303
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -454,12 +462,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 51, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 55, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 50, 56, 2,
- 52, 53, 48, 46, 57, 47, 2, 49, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 54, 60, 2,
+ 56, 57, 52, 50, 61, 51, 2, 53, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 55, 45, 54, 2, 2, 2, 2, 2, 2, 2,
+ 59, 49, 58, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -482,7 +490,8 @@ static const yytype_uint8 yytranslate[] =
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 44
+ 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48
};
#if YYDEBUG
@@ -496,54 +505,55 @@ static const yytype_uint16 yyprhs[] =
149, 152, 154, 157, 159, 166, 168, 174, 176, 180,
184, 187, 191, 193, 195, 196, 197, 198, 201, 204,
206, 208, 210, 215, 220, 222, 224, 228, 232, 236,
- 240, 244, 248, 252, 256, 260, 264, 267, 270, 274,
- 277, 280, 283, 285, 287, 290, 292, 296, 299, 302,
- 305, 308, 312, 315, 319, 322, 325, 327, 331, 334,
- 338, 339, 348, 349, 351, 355, 360, 361, 365, 366,
- 368
+ 240, 244, 248, 252, 256, 260, 264, 268, 271, 275,
+ 279, 282, 285, 289, 292, 295, 298, 300, 302, 305,
+ 307, 311, 314, 317, 320, 323, 327, 330, 334, 337,
+ 340, 342, 346, 349, 353, 354, 363, 364, 366, 370,
+ 375, 376, 380, 381, 383
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 59, 0, -1, 59, 60, 61, -1, 61, -1, 51,
- -1, -1, 85, -1, 80, -1, 89, -1, 62, -1,
- 64, -1, 1, -1, 31, 79, 22, 10, -1, 33,
- 10, 45, 79, -1, 33, 10, 35, 79, -1, 79,
- -1, 80, -1, 63, -1, 65, -1, 72, 52, 71,
- 53, 78, 77, 16, 32, -1, 73, 45, 79, 77,
- 35, 79, 77, 78, 77, 16, 32, -1, 73, 45,
- 79, 77, 13, 35, 79, 77, 78, 77, 16, 32,
- -1, 74, 71, 34, 60, 78, 77, 16, 21, -1,
- 74, 71, 34, 60, 78, 77, 14, 78, 77, 16,
- 21, -1, 74, 71, 34, 60, 78, 77, 76, 67,
- 77, 60, 16, 21, -1, 74, 71, 34, 76, 63,
- 77, -1, 74, 71, 34, 76, 63, 77, 38, 76,
- 63, 77, -1, 74, 71, 34, 76, 63, 77, 68,
- 77, 66, 77, -1, -1, 38, 76, 63, -1, 67,
- 70, -1, 70, -1, 68, 69, -1, 69, -1, 75,
- 71, 34, 76, 64, 77, -1, 68, -1, 75, 71,
- 34, 78, 77, -1, 79, -1, 79, 45, 79, -1,
- 52, 71, 53, -1, 32, 37, -1, 32, 36, 10,
- -1, 21, -1, 15, -1, -1, -1, -1, 78, 60,
- -1, 78, 64, -1, 7, -1, 8, -1, 11, -1,
- 9, 52, 90, 53, -1, 10, 52, 90, 53, -1,
- 10, -1, 62, -1, 79, 46, 79, -1, 79, 47,
- 79, -1, 79, 48, 79, -1, 79, 49, 79, -1,
- 79, 54, 79, -1, 79, 55, 79, -1, 79, 44,
- 79, -1, 79, 39, 79, -1, 79, 40, 79, -1,
- 79, 56, 79, -1, 46, 79, -1, 47, 79, -1,
- 52, 79, 53, -1, 25, 11, -1, 26, 10, -1,
- 31, 79, -1, 82, -1, 17, -1, 19, 81, -1,
- 10, -1, 81, 57, 10, -1, 20, 23, -1, 20,
- 28, -1, 20, 30, -1, 20, 83, -1, 20, 83,
- 84, -1, 20, 84, -1, 35, 18, 11, -1, 18,
- 11, -1, 35, 11, -1, 11, -1, 29, 27, 11,
- -1, 27, 11, -1, 35, 27, 11, -1, -1, 24,
- 10, 86, 76, 87, 60, 88, 78, -1, -1, 10,
- -1, 87, 57, 10, -1, 87, 60, 57, 10, -1,
- -1, 10, 76, 90, -1, -1, 79, -1, 90, 57,
- 79, -1
+ 63, 0, -1, 63, 64, 65, -1, 65, -1, 55,
+ -1, -1, 89, -1, 84, -1, 93, -1, 66, -1,
+ 68, -1, 1, -1, 31, 83, 22, 10, -1, 33,
+ 10, 49, 83, -1, 33, 10, 35, 83, -1, 83,
+ -1, 84, -1, 67, -1, 69, -1, 76, 56, 75,
+ 57, 82, 81, 16, 32, -1, 77, 49, 83, 81,
+ 35, 83, 81, 82, 81, 16, 32, -1, 77, 49,
+ 83, 81, 13, 35, 83, 81, 82, 81, 16, 32,
+ -1, 78, 75, 34, 64, 82, 81, 16, 21, -1,
+ 78, 75, 34, 64, 82, 81, 14, 82, 81, 16,
+ 21, -1, 78, 75, 34, 64, 82, 81, 80, 71,
+ 81, 64, 16, 21, -1, 78, 75, 34, 80, 67,
+ 81, -1, 78, 75, 34, 80, 67, 81, 38, 80,
+ 67, 81, -1, 78, 75, 34, 80, 67, 81, 72,
+ 81, 70, 81, -1, -1, 38, 80, 67, -1, 71,
+ 74, -1, 74, -1, 72, 73, -1, 73, -1, 79,
+ 75, 34, 80, 68, 81, -1, 72, -1, 79, 75,
+ 34, 82, 81, -1, 83, -1, 83, 49, 83, -1,
+ 56, 75, 57, -1, 32, 37, -1, 32, 36, 10,
+ -1, 21, -1, 15, -1, -1, -1, -1, 82, 64,
+ -1, 82, 68, -1, 7, -1, 8, -1, 11, -1,
+ 9, 56, 94, 57, -1, 10, 56, 94, 57, -1,
+ 10, -1, 66, -1, 83, 50, 83, -1, 83, 51,
+ 83, -1, 83, 52, 83, -1, 83, 53, 83, -1,
+ 83, 58, 83, -1, 83, 59, 83, -1, 83, 44,
+ 83, -1, 83, 39, 83, -1, 83, 40, 83, -1,
+ 83, 45, 83, -1, 83, 46, 83, -1, 47, 83,
+ -1, 83, 60, 83, -1, 83, 48, 83, -1, 50,
+ 83, -1, 51, 83, -1, 56, 83, 57, -1, 25,
+ 11, -1, 26, 10, -1, 31, 83, -1, 86, -1,
+ 17, -1, 19, 85, -1, 10, -1, 85, 61, 10,
+ -1, 20, 23, -1, 20, 28, -1, 20, 30, -1,
+ 20, 87, -1, 20, 87, 88, -1, 20, 88, -1,
+ 35, 18, 11, -1, 18, 11, -1, 35, 11, -1,
+ 11, -1, 29, 27, 11, -1, 27, 11, -1, 35,
+ 27, 11, -1, -1, 24, 10, 90, 80, 91, 64,
+ 92, 82, -1, -1, 10, -1, 91, 61, 10, -1,
+ 91, 64, 61, 10, -1, -1, 10, 80, 94, -1,
+ -1, 83, -1, 94, 61, 83, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -555,11 +565,11 @@ static const yytype_uint16 yyrline[] =
240, 241, 244, 245, 248, 256, 257, 265, 266, 267,
269, 271, 277, 283, 290, 292, 294, 295, 296, 299,
304, 307, 310, 316, 324, 327, 328, 329, 330, 331,
- 332, 333, 334, 335, 336, 337, 338, 339, 340, 343,
- 344, 345, 346, 347, 349, 352, 353, 364, 365, 366,
- 367, 372, 378, 385, 386, 387, 388, 391, 392, 393,
- 421, 421, 428, 429, 430, 431, 433, 436, 444, 445,
- 446
+ 332, 333, 334, 335, 336, 337, 338, 339, 340, 341,
+ 342, 343, 344, 347, 348, 349, 350, 351, 353, 356,
+ 357, 368, 369, 370, 371, 376, 382, 389, 390, 391,
+ 392, 395, 396, 397, 425, 425, 432, 433, 434, 435,
+ 437, 440, 448, 449, 450
};
#endif
@@ -573,14 +583,15 @@ static const char *const yytname[] =
"tNLELSIF", "tEND", "tEXIT", "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO",
"tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF",
"tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH",
- "tWHILE", "tNLELSE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "'='",
- "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'",
- "'&'", "','", "$accept", "program", "nl", "programline", "asgn",
- "stmtoneliner", "stmt", "ifstmt", "elsestmtoneliner", "elseifstmt",
- "elseifstmtoneliner", "elseifstmtoneliner1", "elseifstmt1", "cond",
- "repeatwhile", "repeatwith", "if", "elseif", "begin", "end", "stmtlist",
- "expr", "func", "globallist", "gotofunc", "gotoframe", "gotomovie",
- "defn", "@1", "argdef", "argstore", "macro", "arglist", 0
+ "tWHILE", "tNLELSE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "tAND",
+ "tOR", "tNOT", "tCONCAT", "'='", "'+'", "'-'", "'*'", "'/'", "'%'",
+ "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','", "$accept", "program",
+ "nl", "programline", "asgn", "stmtoneliner", "stmt", "ifstmt",
+ "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
+ "elseifstmtoneliner1", "elseifstmt1", "cond", "repeatwhile",
+ "repeatwith", "if", "elseif", "begin", "end", "stmtlist", "expr", "func",
+ "globallist", "gotofunc", "gotoframe", "gotomovie", "defn", "@1",
+ "argdef", "argstore", "macro", "arglist", 0
};
#endif
@@ -593,25 +604,26 @@ static const yytype_uint16 yytoknum[] =
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, 298, 299, 61, 43, 45, 42, 47,
- 37, 10, 40, 41, 62, 60, 38, 44
+ 295, 296, 297, 298, 299, 300, 301, 302, 303, 61,
+ 43, 45, 42, 47, 37, 10, 40, 41, 62, 60,
+ 38, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 58, 59, 59, 60, 61, 61, 61, 61, 61,
- 61, 61, 62, 62, 62, 63, 63, 64, 64, 64,
- 64, 64, 65, 65, 65, 65, 65, 65, 66, 66,
- 67, 67, 68, 68, 69, 70, 70, 71, 71, 71,
- 72, 73, 74, 75, 76, 77, 78, 78, 78, 79,
- 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
- 79, 79, 79, 79, 79, 79, 79, 79, 79, 80,
- 80, 80, 80, 80, 80, 81, 81, 82, 82, 82,
- 82, 82, 82, 83, 83, 83, 83, 84, 84, 84,
- 86, 85, 87, 87, 87, 87, 88, 89, 90, 90,
- 90
+ 0, 62, 63, 63, 64, 65, 65, 65, 65, 65,
+ 65, 65, 66, 66, 66, 67, 67, 68, 68, 68,
+ 68, 68, 69, 69, 69, 69, 69, 69, 70, 70,
+ 71, 71, 72, 72, 73, 74, 74, 75, 75, 75,
+ 76, 77, 78, 79, 80, 81, 82, 82, 82, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 84, 84, 84, 84, 84, 84, 85,
+ 85, 86, 86, 86, 86, 86, 86, 87, 87, 87,
+ 87, 88, 88, 88, 90, 89, 91, 91, 91, 91,
+ 92, 93, 94, 94, 94
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -623,11 +635,11 @@ static const yytype_uint8 yyr2[] =
2, 1, 2, 1, 6, 1, 5, 1, 3, 3,
2, 3, 1, 1, 0, 0, 0, 2, 2, 1,
1, 1, 4, 4, 1, 1, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 2, 2, 3, 2,
- 2, 2, 1, 1, 2, 1, 3, 2, 2, 2,
- 2, 3, 2, 3, 2, 2, 1, 3, 2, 3,
- 0, 8, 0, 1, 3, 4, 0, 3, 0, 1,
- 3
+ 3, 3, 3, 3, 3, 3, 3, 2, 3, 3,
+ 2, 2, 3, 2, 2, 2, 1, 1, 2, 1,
+ 3, 2, 2, 2, 2, 3, 2, 3, 2, 2,
+ 1, 3, 2, 3, 0, 8, 0, 1, 3, 4,
+ 0, 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -635,75 +647,75 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 49, 50, 0, 44, 51, 73, 0, 0,
+ 0, 11, 49, 50, 0, 44, 51, 77, 0, 0,
42, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 3, 55, 17, 10, 18, 0, 0, 0, 15,
- 7, 72, 6, 8, 98, 98, 98, 75, 74, 86,
- 0, 77, 0, 78, 0, 79, 0, 80, 82, 90,
- 69, 70, 54, 0, 55, 71, 0, 40, 0, 66,
- 67, 0, 1, 4, 0, 0, 0, 0, 0, 37,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 99, 0, 0, 97, 0, 84, 88, 0, 85, 0,
- 0, 0, 81, 44, 0, 0, 41, 0, 0, 68,
- 2, 0, 45, 0, 0, 44, 0, 63, 64, 62,
- 56, 57, 58, 59, 60, 61, 65, 52, 0, 53,
- 76, 87, 83, 89, 92, 12, 14, 13, 46, 0,
- 39, 46, 0, 38, 100, 93, 0, 45, 0, 0,
- 45, 45, 16, 0, 96, 47, 48, 0, 0, 45,
- 44, 25, 94, 0, 46, 0, 45, 46, 46, 0,
- 0, 43, 44, 45, 33, 0, 95, 91, 19, 46,
- 45, 45, 22, 45, 35, 31, 0, 0, 32, 28,
- 0, 45, 0, 0, 30, 0, 0, 45, 44, 45,
- 44, 0, 0, 0, 0, 44, 26, 0, 27, 0,
- 0, 20, 23, 0, 45, 29, 45, 21, 24, 36,
- 34
+ 0, 0, 3, 55, 17, 10, 18, 0, 0, 0,
+ 15, 7, 76, 6, 8, 102, 102, 102, 79, 78,
+ 90, 0, 81, 0, 82, 0, 83, 0, 84, 86,
+ 94, 73, 74, 54, 0, 55, 75, 0, 40, 0,
+ 67, 70, 71, 0, 1, 4, 0, 0, 0, 0,
+ 0, 37, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 103, 0, 0, 101, 0,
+ 88, 92, 0, 89, 0, 0, 0, 85, 44, 0,
+ 0, 41, 0, 0, 72, 2, 0, 45, 0, 0,
+ 44, 0, 63, 64, 62, 65, 66, 69, 56, 57,
+ 58, 59, 60, 61, 68, 52, 0, 53, 80, 91,
+ 87, 93, 96, 12, 14, 13, 46, 0, 39, 46,
+ 0, 38, 104, 97, 0, 45, 0, 0, 45, 45,
+ 16, 0, 100, 47, 48, 0, 0, 45, 44, 25,
+ 98, 0, 46, 0, 45, 46, 46, 0, 0, 43,
+ 44, 45, 33, 0, 99, 95, 19, 46, 45, 45,
+ 22, 45, 35, 31, 0, 0, 32, 28, 0, 45,
+ 0, 0, 30, 0, 0, 45, 44, 45, 44, 0,
+ 0, 0, 0, 44, 26, 0, 27, 0, 0, 20,
+ 23, 0, 45, 29, 45, 21, 24, 36, 34
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 20, 145, 21, 54, 23, 146, 25, 189, 173,
- 174, 164, 175, 68, 26, 27, 28, 165, 199, 129,
- 137, 29, 142, 38, 31, 47, 48, 32, 93, 136,
- 154, 33, 81
+ -1, 21, 153, 22, 55, 24, 154, 26, 197, 181,
+ 182, 172, 183, 70, 27, 28, 29, 173, 207, 137,
+ 145, 30, 150, 39, 32, 48, 49, 33, 98, 144,
+ 162, 34, 86
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -150
+#define YYPACT_NINF -156
static const yytype_int16 yypact[] =
{
- 162, -150, -150, -150, -21, 383, -150, -150, 15, 329,
- -150, 32, 42, 50, 84, -23, 52, 84, 84, 84,
- 7, -150, 8, -150, -150, -150, 13, 18, 236, 370,
- -150, -150, -150, -150, 84, 84, 84, -150, 25, -150,
- 72, -150, 73, -150, 59, -150, 5, 12, -150, -150,
- -150, -150, 36, 84, -150, 295, 80, -150, 11, 83,
- 83, 339, -150, -150, 162, 236, 84, 236, 62, 357,
- 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
- 370, -27, 4, 40, 90, -150, -150, 91, -150, 93,
- 94, 79, -150, -150, 295, 98, -150, 84, 84, -150,
- -150, 57, 370, 58, 321, 65, 84, 370, 370, 370,
- 182, 182, 83, 83, 370, 370, 370, -150, 84, -150,
- -150, -150, -150, -150, 110, -150, 370, 370, -150, -1,
- -150, -150, 285, 370, 370, -150, -29, 208, 89, 84,
- 208, -150, -150, 115, 69, -150, -150, 113, 84, 370,
- 34, -5, -150, 122, -150, 101, 370, -150, -150, 120,
- 119, -150, -150, 119, -150, 236, -150, 208, -150, -150,
- 208, 208, -150, 119, 119, -150, 236, 285, -150, 106,
- 114, 208, 131, 134, -150, 65, 117, -150, -150, -150,
- -150, 136, 123, 133, 140, -6, -150, 285, -150, 254,
- 125, -150, -150, 139, 208, -150, -150, -150, -150, -150,
- -150
+ 170, -156, -156, -156, -48, 441, -156, -156, 36, 108,
+ -156, 39, 43, 45, 326, 5, 50, 326, 326, 326,
+ 326, 4, -156, 9, -156, -156, -156, 11, 12, 333,
+ 424, -156, -156, -156, -156, 326, 326, 326, -156, 26,
+ -156, 51, -156, 54, -156, 63, -156, 16, 18, -156,
+ -156, -156, -156, 37, 326, -156, 346, 82, -156, -21,
+ 480, 480, 480, 385, -156, -156, 170, 333, 326, 333,
+ 61, 407, 326, 326, 326, 326, 326, 326, 326, 326,
+ 326, 326, 326, 326, 326, 424, -25, -17, 40, 87,
+ -156, -156, 91, -156, 92, 96, 71, -156, -156, 346,
+ 100, -156, 326, 326, -156, -156, 55, 424, 57, 363,
+ 56, 326, 424, 424, 424, 424, 424, 424, 463, 463,
+ 480, 480, 424, 424, 424, -156, 326, -156, -156, -156,
+ -156, -156, 106, -156, 424, 424, -156, -2, -156, -156,
+ 299, 424, 424, -156, -31, 220, 83, 326, 220, -156,
+ -156, 107, 60, -156, -156, 111, 326, 424, 1, -3,
+ -156, 113, -156, 101, 424, -156, -156, 103, 119, -156,
+ -156, 119, -156, 333, -156, 220, -156, -156, 220, 220,
+ -156, 119, 119, -156, 333, 299, -156, 104, 105, 220,
+ 125, 128, -156, 56, 116, -156, -156, -156, -156, 129,
+ 115, 130, 136, -5, -156, 299, -156, 270, 121, -156,
+ -156, 134, 220, -156, -156, -156, -156, -156, -156
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -150, -150, -18, 100, 6, -128, 0, -150, -150, -150,
- 14, -136, 2, -62, -150, -150, -150, -149, -4, -28,
- -114, 1, 21, -150, -150, -150, 121, -150, -150, -150,
- -150, -150, 16
+ -156, -156, -19, 90, 6, -117, 0, -156, -156, -156,
+ 3, -153, -24, -64, -156, -156, -156, -155, -4, -49,
+ -114, 2, 7, -156, -156, -156, 112, -156, -156, -156,
+ -156, -156, 21
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -713,98 +725,120 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -55
static const yytype_int16 yytable[] =
{
- 24, 36, 64, 101, 141, 103, 22, 62, -9, -46,
- 161, 176, 138, 56, 57, 55, 88, 140, 59, 60,
- 61, 30, 63, 89, 176, 37, 117, 178, 143, 69,
- 118, 34, 90, 162, 139, 80, 80, 80, 178, 42,
- 167, 44, 49, 170, 171, -46, 97, 91, 158, 187,
- 159, 82, 83, 50, 94, 181, 98, 119, 63, -9,
- 51, 118, 58, 66, 24, 65, 69, 102, 104, 205,
- 22, 107, 108, 109, 110, 111, 112, 113, 114, 115,
- 116, 204, 84, 85, 86, 30, 87, 131, 35, 124,
- 96, 2, 3, 4, 52, 6, 105, 118, 126, 127,
- 120, 132, 121, 180, 122, 123, 90, 133, 125, 147,
- 128, 130, 150, 151, 186, 53, 63, 16, 144, 134,
- 135, 157, 70, 71, 148, 152, 153, 72, 169, 155,
- 17, 18, 166, 168, 161, 179, 19, 77, 78, 79,
- 149, 172, 182, 183, 188, 185, 160, 192, 190, 156,
- 193, 195, 200, 191, 202, 201, 203, 207, 177, 196,
- 208, 198, -5, 1, 100, 163, 69, 194, 92, 2,
- 3, 4, 5, 6, 0, 184, 209, 69, 210, 7,
- 0, 8, 9, 10, 197, 0, 11, 12, 13, 0,
- 0, 0, 0, 14, 15, 16, 0, 0, 0, 206,
- 0, 0, 0, 0, 0, 0, 0, 0, 17, 18,
- 0, 0, 0, -5, 19, 2, 3, 4, 52, 6,
- 0, 70, 71, 0, 0, 7, 72, 8, 9, 10,
- 75, 76, 0, 12, 13, 0, 77, 78, 79, 14,
- 15, 16, 0, 2, 3, 4, 52, 6, 0, 0,
- 0, 0, 0, 0, 17, 18, 0, 0, 0, 63,
- 19, 2, 3, 4, 52, 6, 0, 53, 0, 16,
- 0, 7, 0, 8, 9, 10, 0, 0, 0, 12,
- 13, 0, 17, 18, 0, 14, 15, 16, 67, 0,
- 0, 0, 2, 3, 4, 52, 6, 0, 0, 0,
- 17, 18, 7, 0, 8, 9, 19, 0, 0, 0,
- 12, 13, 0, 0, 0, 0, 14, 95, 16, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 17, 18, 0, 70, 71, 0, 19, 0, 72,
- 39, 73, 74, 75, 76, 0, 0, 40, 0, 77,
- 78, 79, 41, 0, 0, 0, 42, 43, 44, 45,
- 70, 71, 0, 0, 46, 72, 106, 73, 74, 75,
- 76, 0, 0, 0, 99, 77, 78, 79, 70, 71,
- 0, 0, 0, 72, 0, 73, 74, 75, 76, 0,
- 0, 0, 99, 77, 78, 79, 70, 71, 0, 0,
- 0, 72, 106, 73, 74, 75, 76, 0, 0, 70,
- 71, 77, 78, 79, 72, 0, 73, 74, 75, 76,
- 0, 0, -54, -54, 77, 78, 79, -54, 0, 0,
- 0, -54, -54, 0, 0, 35, 0, -54, -54, -54
+ 25, 37, 66, 106, 64, 108, 23, 31, 35, -9,
+ -46, 146, 169, 184, 102, 166, 56, 167, 186, 60,
+ 61, 62, 63, 149, 65, 148, 184, 93, 103, 186,
+ 151, 71, 125, 147, 94, 170, 126, 85, 85, 85,
+ 127, 57, 58, 95, 126, 43, 38, 45, 175, 50,
+ -46, 178, 179, 96, 51, 52, 99, 87, 88, 65,
+ 59, 68, 90, 189, -9, 91, 25, 67, 195, 71,
+ 107, 109, 23, 31, 112, 113, 114, 115, 116, 117,
+ 118, 119, 120, 121, 122, 123, 124, 89, 213, 212,
+ 92, 139, 101, 36, 132, 110, 155, 128, 95, 158,
+ 159, 126, 129, 130, 134, 135, 140, 131, 165, 188,
+ 133, 65, 136, 141, 138, 177, 143, 160, 156, 40,
+ 194, 161, 187, 174, 180, 152, 41, 163, 142, 190,
+ 191, 42, 193, 176, 169, 43, 44, 45, 46, 198,
+ 199, 200, 196, 47, 201, 208, 204, 209, 206, 157,
+ 203, 210, 211, 215, 168, 216, 105, 192, 164, 0,
+ 97, 0, 171, 217, 0, 218, 185, 0, 0, 0,
+ -5, 1, 0, 0, 202, 71, 0, 2, 3, 4,
+ 5, 6, 0, 0, 0, 0, 71, 7, 0, 8,
+ 9, 10, 205, 0, 11, 12, 13, 0, 0, 0,
+ 0, 14, 15, 16, 0, 0, 0, 214, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 17, 0, 0,
+ 18, 19, 0, 0, 0, -5, 20, 2, 3, 4,
+ 53, 6, 0, 0, 0, 0, 0, 7, 0, 8,
+ 9, 10, 0, 0, 0, 12, 13, 0, 0, 0,
+ 0, 14, 15, 16, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 17, 0, 0,
+ 18, 19, 0, 0, 0, 65, 20, 2, 3, 4,
+ 53, 6, 0, 0, 0, 0, 0, 7, 0, 8,
+ 9, 10, 0, 0, 0, 12, 13, 0, 0, 0,
+ 0, 14, 15, 16, 0, 0, 2, 3, 4, 53,
+ 6, 0, 0, 0, 0, 0, 7, 17, 8, 9,
+ 18, 19, 0, 0, 12, 13, 20, 0, 0, 0,
+ 14, 0, 16, 2, 3, 4, 53, 6, 0, 0,
+ 2, 3, 4, 53, 6, 0, 17, 0, 0, 18,
+ 19, 0, 0, 0, 0, 20, 0, 54, 0, 16,
+ 0, 0, 0, 0, 54, 0, 16, 0, 100, 0,
+ 0, 0, 0, 17, 0, 0, 18, 19, 0, 0,
+ 17, 0, 20, 18, 19, 72, 73, 0, 0, 69,
+ 74, 75, 76, 0, 77, 0, 78, 79, 80, 81,
+ 0, 0, 72, 73, 82, 83, 84, 74, 75, 76,
+ 0, 77, 111, 78, 79, 80, 81, 0, 0, 0,
+ 104, 82, 83, 84, 72, 73, 0, 0, 0, 74,
+ 75, 76, 0, 77, 0, 78, 79, 80, 81, 0,
+ 0, 0, 104, 82, 83, 84, 72, 73, 0, 0,
+ 0, 74, 75, 76, 0, 77, 111, 78, 79, 80,
+ 81, 0, 0, 72, 73, 82, 83, 84, 74, 75,
+ 76, 0, 77, 0, 78, 79, 80, 81, 0, 0,
+ -54, -54, 82, 83, 84, -54, -54, -54, 0, -54,
+ 0, 0, 0, -54, -54, 0, 0, 36, 0, -54,
+ -54, -54, 72, 73, 0, 0, 0, 74, 75, 76,
+ 0, 77, 0, 0, 0, 80, 81, 0, 0, 72,
+ 73, 82, 83, 84, 74, 75, 76, 0, 77, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 82, 83,
+ 84
};
static const yytype_int16 yycheck[] =
{
- 0, 5, 20, 65, 132, 67, 0, 0, 0, 15,
- 15, 160, 13, 36, 37, 14, 11, 131, 17, 18,
- 19, 0, 51, 18, 173, 10, 53, 163, 57, 28,
- 57, 52, 27, 38, 35, 34, 35, 36, 174, 27,
- 154, 29, 10, 157, 158, 51, 35, 35, 14, 177,
- 16, 35, 36, 11, 53, 169, 45, 53, 51, 51,
- 10, 57, 10, 45, 64, 52, 65, 66, 67, 197,
- 64, 70, 71, 72, 73, 74, 75, 76, 77, 78,
- 79, 195, 57, 11, 11, 64, 27, 105, 52, 93,
- 10, 7, 8, 9, 10, 11, 34, 57, 97, 98,
- 10, 105, 11, 165, 11, 11, 27, 106, 10, 137,
- 53, 53, 140, 141, 176, 31, 51, 33, 136, 118,
- 10, 149, 39, 40, 35, 10, 57, 44, 156, 16,
- 46, 47, 10, 32, 15, 163, 52, 54, 55, 56,
- 139, 21, 170, 171, 38, 173, 150, 16, 34, 148,
- 16, 34, 16, 181, 21, 32, 16, 32, 162, 187,
- 21, 189, 0, 1, 64, 151, 165, 185, 47, 7,
- 8, 9, 10, 11, -1, 173, 204, 176, 206, 17,
- -1, 19, 20, 21, 188, -1, 24, 25, 26, -1,
- -1, -1, -1, 31, 32, 33, -1, -1, -1, 199,
- -1, -1, -1, -1, -1, -1, -1, -1, 46, 47,
- -1, -1, -1, 51, 52, 7, 8, 9, 10, 11,
- -1, 39, 40, -1, -1, 17, 44, 19, 20, 21,
- 48, 49, -1, 25, 26, -1, 54, 55, 56, 31,
- 32, 33, -1, 7, 8, 9, 10, 11, -1, -1,
- -1, -1, -1, -1, 46, 47, -1, -1, -1, 51,
- 52, 7, 8, 9, 10, 11, -1, 31, -1, 33,
- -1, 17, -1, 19, 20, 21, -1, -1, -1, 25,
- 26, -1, 46, 47, -1, 31, 32, 33, 52, -1,
- -1, -1, 7, 8, 9, 10, 11, -1, -1, -1,
- 46, 47, 17, -1, 19, 20, 52, -1, -1, -1,
- 25, 26, -1, -1, -1, -1, 31, 22, 33, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 46, 47, -1, 39, 40, -1, 52, -1, 44,
- 11, 46, 47, 48, 49, -1, -1, 18, -1, 54,
- 55, 56, 23, -1, -1, -1, 27, 28, 29, 30,
- 39, 40, -1, -1, 35, 44, 45, 46, 47, 48,
- 49, -1, -1, -1, 53, 54, 55, 56, 39, 40,
- -1, -1, -1, 44, -1, 46, 47, 48, 49, -1,
- -1, -1, 53, 54, 55, 56, 39, 40, -1, -1,
- -1, 44, 45, 46, 47, 48, 49, -1, -1, 39,
- 40, 54, 55, 56, 44, -1, 46, 47, 48, 49,
- -1, -1, 39, 40, 54, 55, 56, 44, -1, -1,
- -1, 48, 49, -1, -1, 52, -1, 54, 55, 56
+ 0, 5, 21, 67, 0, 69, 0, 0, 56, 0,
+ 15, 13, 15, 168, 35, 14, 14, 16, 171, 17,
+ 18, 19, 20, 140, 55, 139, 181, 11, 49, 182,
+ 61, 29, 57, 35, 18, 38, 61, 35, 36, 37,
+ 57, 36, 37, 27, 61, 27, 10, 29, 162, 10,
+ 55, 165, 166, 35, 11, 10, 54, 36, 37, 55,
+ 10, 49, 11, 177, 55, 11, 66, 56, 185, 67,
+ 68, 69, 66, 66, 72, 73, 74, 75, 76, 77,
+ 78, 79, 80, 81, 82, 83, 84, 61, 205, 203,
+ 27, 110, 10, 56, 98, 34, 145, 10, 27, 148,
+ 149, 61, 11, 11, 102, 103, 110, 11, 157, 173,
+ 10, 55, 57, 111, 57, 164, 10, 10, 35, 11,
+ 184, 61, 171, 10, 21, 144, 18, 16, 126, 178,
+ 179, 23, 181, 32, 15, 27, 28, 29, 30, 34,
+ 189, 16, 38, 35, 16, 16, 195, 32, 197, 147,
+ 34, 21, 16, 32, 158, 21, 66, 181, 156, -1,
+ 48, -1, 159, 212, -1, 214, 170, -1, -1, -1,
+ 0, 1, -1, -1, 193, 173, -1, 7, 8, 9,
+ 10, 11, -1, -1, -1, -1, 184, 17, -1, 19,
+ 20, 21, 196, -1, 24, 25, 26, -1, -1, -1,
+ -1, 31, 32, 33, -1, -1, -1, 207, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 47, -1, -1,
+ 50, 51, -1, -1, -1, 55, 56, 7, 8, 9,
+ 10, 11, -1, -1, -1, -1, -1, 17, -1, 19,
+ 20, 21, -1, -1, -1, 25, 26, -1, -1, -1,
+ -1, 31, 32, 33, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 47, -1, -1,
+ 50, 51, -1, -1, -1, 55, 56, 7, 8, 9,
+ 10, 11, -1, -1, -1, -1, -1, 17, -1, 19,
+ 20, 21, -1, -1, -1, 25, 26, -1, -1, -1,
+ -1, 31, 32, 33, -1, -1, 7, 8, 9, 10,
+ 11, -1, -1, -1, -1, -1, 17, 47, 19, 20,
+ 50, 51, -1, -1, 25, 26, 56, -1, -1, -1,
+ 31, -1, 33, 7, 8, 9, 10, 11, -1, -1,
+ 7, 8, 9, 10, 11, -1, 47, -1, -1, 50,
+ 51, -1, -1, -1, -1, 56, -1, 31, -1, 33,
+ -1, -1, -1, -1, 31, -1, 33, -1, 22, -1,
+ -1, -1, -1, 47, -1, -1, 50, 51, -1, -1,
+ 47, -1, 56, 50, 51, 39, 40, -1, -1, 56,
+ 44, 45, 46, -1, 48, -1, 50, 51, 52, 53,
+ -1, -1, 39, 40, 58, 59, 60, 44, 45, 46,
+ -1, 48, 49, 50, 51, 52, 53, -1, -1, -1,
+ 57, 58, 59, 60, 39, 40, -1, -1, -1, 44,
+ 45, 46, -1, 48, -1, 50, 51, 52, 53, -1,
+ -1, -1, 57, 58, 59, 60, 39, 40, -1, -1,
+ -1, 44, 45, 46, -1, 48, 49, 50, 51, 52,
+ 53, -1, -1, 39, 40, 58, 59, 60, 44, 45,
+ 46, -1, 48, -1, 50, 51, 52, 53, -1, -1,
+ 39, 40, 58, 59, 60, 44, 45, 46, -1, 48,
+ -1, -1, -1, 52, 53, -1, -1, 56, -1, 58,
+ 59, 60, 39, 40, -1, -1, -1, 44, 45, 46,
+ -1, 48, -1, -1, -1, 52, 53, -1, -1, 39,
+ 40, 58, 59, 60, 44, 45, 46, -1, 48, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 58, 59,
+ 60
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -812,27 +846,27 @@ static const yytype_int16 yycheck[] =
static const yytype_uint8 yystos[] =
{
0, 1, 7, 8, 9, 10, 11, 17, 19, 20,
- 21, 24, 25, 26, 31, 32, 33, 46, 47, 52,
- 59, 61, 62, 63, 64, 65, 72, 73, 74, 79,
- 80, 82, 85, 89, 52, 52, 76, 10, 81, 11,
- 18, 23, 27, 28, 29, 30, 35, 83, 84, 10,
- 11, 10, 10, 31, 62, 79, 36, 37, 10, 79,
- 79, 79, 0, 51, 60, 52, 45, 52, 71, 79,
- 39, 40, 44, 46, 47, 48, 49, 54, 55, 56,
- 79, 90, 90, 90, 57, 11, 11, 27, 11, 18,
- 27, 35, 84, 86, 79, 22, 10, 35, 45, 53,
- 61, 71, 79, 71, 79, 34, 45, 79, 79, 79,
- 79, 79, 79, 79, 79, 79, 79, 53, 57, 53,
- 10, 11, 11, 11, 76, 10, 79, 79, 53, 77,
- 53, 60, 76, 79, 79, 10, 87, 78, 13, 35,
- 78, 63, 80, 57, 60, 60, 64, 77, 35, 79,
- 77, 77, 10, 57, 88, 16, 79, 77, 14, 16,
- 76, 15, 38, 68, 69, 75, 10, 78, 32, 77,
- 78, 78, 21, 67, 68, 70, 75, 76, 69, 77,
- 71, 78, 77, 77, 70, 77, 71, 63, 38, 66,
- 34, 77, 16, 16, 60, 34, 77, 76, 77, 76,
- 16, 32, 21, 16, 78, 63, 64, 32, 21, 77,
- 77
+ 21, 24, 25, 26, 31, 32, 33, 47, 50, 51,
+ 56, 63, 65, 66, 67, 68, 69, 76, 77, 78,
+ 83, 84, 86, 89, 93, 56, 56, 80, 10, 85,
+ 11, 18, 23, 27, 28, 29, 30, 35, 87, 88,
+ 10, 11, 10, 10, 31, 66, 83, 36, 37, 10,
+ 83, 83, 83, 83, 0, 55, 64, 56, 49, 56,
+ 75, 83, 39, 40, 44, 45, 46, 48, 50, 51,
+ 52, 53, 58, 59, 60, 83, 94, 94, 94, 61,
+ 11, 11, 27, 11, 18, 27, 35, 88, 90, 83,
+ 22, 10, 35, 49, 57, 65, 75, 83, 75, 83,
+ 34, 49, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 57, 61, 57, 10, 11,
+ 11, 11, 80, 10, 83, 83, 57, 81, 57, 64,
+ 80, 83, 83, 10, 91, 82, 13, 35, 82, 67,
+ 84, 61, 64, 64, 68, 81, 35, 83, 81, 81,
+ 10, 61, 92, 16, 83, 81, 14, 16, 80, 15,
+ 38, 72, 73, 79, 10, 82, 32, 81, 82, 82,
+ 21, 71, 72, 74, 79, 80, 73, 81, 75, 82,
+ 81, 81, 74, 81, 75, 67, 38, 70, 34, 81,
+ 16, 16, 64, 34, 81, 80, 81, 80, 16, 32,
+ 21, 16, 82, 67, 68, 32, 21, 81, 81
};
#define yyerrok (yyerrstatus = 0)
@@ -2007,72 +2041,92 @@ yyreduce:
case 65:
#line 337 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_ampersand); ;}
+ { g_lingo->code1(g_lingo->c_and); ;}
break;
case 66:
#line 338 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+ { g_lingo->code1(g_lingo->c_or); ;}
break;
case 67:
#line 339 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
+ { g_lingo->code1(g_lingo->c_not); ;}
break;
case 68:
#line 340 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+ { g_lingo->code1(g_lingo->c_ampersand); ;}
break;
case 69:
-#line 343 "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); ;}
+#line 341 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_concat); ;}
break;
case 70:
-#line 344 "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); ;}
+#line 342 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 71:
-#line 345 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_printtop); ;}
+#line 343 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
+ break;
+
+ case 72:
+#line 344 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 73:
#line 347 "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 74:
+#line 348 "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 75:
+#line 349 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_printtop); ;}
+ break;
+
+ case 77:
+#line 351 "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 75:
-#line 352 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 356 "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 76:
-#line 353 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 357 "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 77:
-#line 364 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 368 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 78:
-#line 365 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 369 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 79:
-#line 366 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 370 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 80:
-#line 367 "engines/director/lingo/lingo-gr.y"
+ case 84:
+#line 371 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2080,8 +2134,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 81:
-#line 372 "engines/director/lingo/lingo-gr.y"
+ case 85:
+#line 376 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2090,8 +2144,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 82:
-#line 378 "engines/director/lingo/lingo-gr.y"
+ case 86:
+#line 382 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2099,48 +2153,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 83:
-#line 385 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 389 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 84:
-#line 386 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 390 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 85:
-#line 387 "engines/director/lingo/lingo-gr.y"
+ case 89:
+#line 391 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 86:
-#line 388 "engines/director/lingo/lingo-gr.y"
+ case 90:
+#line 392 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 87:
-#line 391 "engines/director/lingo/lingo-gr.y"
+ case 91:
+#line 395 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 88:
-#line 392 "engines/director/lingo/lingo-gr.y"
+ case 92:
+#line 396 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 89:
-#line 393 "engines/director/lingo/lingo-gr.y"
+ case 93:
+#line 397 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 90:
-#line 421 "engines/director/lingo/lingo-gr.y"
+ case 94:
+#line 425 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 91:
-#line 422 "engines/director/lingo/lingo-gr.y"
+ case 95:
+#line 426 "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);
@@ -2148,33 +2202,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 92:
-#line 428 "engines/director/lingo/lingo-gr.y"
+ case 96:
+#line 432 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 93:
-#line 429 "engines/director/lingo/lingo-gr.y"
+ case 97:
+#line 433 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 94:
-#line 430 "engines/director/lingo/lingo-gr.y"
+ case 98:
+#line 434 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 95:
-#line 431 "engines/director/lingo/lingo-gr.y"
+ case 99:
+#line 435 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 96:
-#line 433 "engines/director/lingo/lingo-gr.y"
+ case 100:
+#line 437 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 97:
-#line 436 "engines/director/lingo/lingo-gr.y"
+ case 101:
+#line 440 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2183,24 +2237,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 98:
-#line 444 "engines/director/lingo/lingo-gr.y"
+ case 102:
+#line 448 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 99:
-#line 445 "engines/director/lingo/lingo-gr.y"
+ case 103:
+#line 449 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 100:
-#line 446 "engines/director/lingo/lingo-gr.y"
+ case 104:
+#line 450 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2204 "engines/director/lingo/lingo-gr.cpp"
+#line 2258 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2414,6 +2468,6 @@ yyreturn:
}
-#line 449 "engines/director/lingo/lingo-gr.y"
+#line 453 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 62462ae..a22d489 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -80,7 +80,11 @@
tGT = 296,
tLT = 297,
tEQ = 298,
- tNEQ = 299
+ tNEQ = 299,
+ tAND = 300,
+ tOR = 301,
+ tNOT = 302,
+ tCONCAT = 303
};
#endif
/* Tokens. */
@@ -126,6 +130,10 @@
#define tLT 297
#define tEQ 298
#define tNEQ 299
+#define tAND 300
+#define tOR 301
+#define tNOT 302
+#define tCONCAT 303
@@ -141,7 +149,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 145 "engines/director/lingo/lingo-gr.hpp"
+#line 153 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 002b454..155b615 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -77,7 +77,7 @@ using namespace Director;
%token tDOWN tELSE tNLELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
%token tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO
%token tWITH tWHILE tNLELSE
-%token tGE tLE tGT tLT tEQ tNEQ
+%token tGE tLE tGT tLT tEQ tNEQ tAND tOR tNOT tCONCAT
%type<code> asgn begin elseif elsestmtoneliner end expr if repeatwhile repeatwith stmtlist
%type<s> gotoframe gotomovie
@@ -334,7 +334,11 @@ expr: INT {
| expr tNEQ expr { g_lingo->code1(g_lingo->c_neq); }
| expr tGE expr { g_lingo->code1(g_lingo->c_ge); }
| expr tLE expr { g_lingo->code1(g_lingo->c_le); }
+ | expr tAND expr { g_lingo->code1(g_lingo->c_and); }
+ | expr tOR expr { g_lingo->code1(g_lingo->c_or); }
+ | tNOT expr %prec UNARY { g_lingo->code1(g_lingo->c_not); }
| expr '&' expr { g_lingo->code1(g_lingo->c_ampersand); }
+ | expr tCONCAT expr { g_lingo->code1(g_lingo->c_concat); }
| '+' expr %prec UNARY { $$ = $2; }
| '-' expr %prec UNARY { $$ = $2; g_lingo->code1(g_lingo->c_negate); }
| '(' expr ')' { $$ = $2; }
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 76a11be..0a0af11 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 40
-#define YY_END_OF_BUFFER 41
+#define YY_NUM_RULES 44
+#define YY_END_OF_BUFFER 45
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,23 +373,23 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[132] =
+static yyconst flex_int16_t yy_accept[139] =
{ 0,
- 0, 0, 41, 39, 3, 37, 37, 39, 39, 39,
- 36, 36, 35, 36, 36, 33, 33, 33, 33, 33,
- 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
- 2, 2, 3, 37, 0, 0, 37, 30, 0, 38,
- 1, 34, 35, 32, 31, 33, 33, 33, 33, 33,
- 33, 33, 13, 5, 33, 33, 33, 33, 33, 33,
- 21, 33, 33, 33, 33, 33, 27, 33, 33, 2,
- 2, 0, 1, 34, 33, 33, 9, 33, 33, 33,
- 33, 33, 33, 17, 33, 33, 33, 23, 33, 25,
- 33, 33, 33, 0, 4, 8, 10, 33, 33, 14,
-
- 15, 33, 33, 33, 20, 33, 33, 26, 33, 28,
- 0, 11, 33, 16, 33, 19, 33, 33, 29, 7,
- 12, 33, 33, 24, 0, 18, 33, 0, 22, 6,
- 0
+ 0, 0, 45, 43, 3, 41, 41, 43, 43, 40,
+ 40, 40, 39, 40, 40, 37, 37, 37, 37, 37,
+ 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+ 37, 2, 2, 3, 41, 0, 0, 41, 0, 42,
+ 36, 1, 38, 39, 35, 33, 34, 37, 37, 37,
+ 37, 37, 37, 37, 37, 14, 6, 37, 37, 37,
+ 37, 37, 37, 37, 23, 24, 37, 37, 37, 37,
+ 37, 30, 37, 37, 2, 2, 0, 1, 38, 4,
+ 37, 37, 10, 37, 37, 37, 37, 37, 37, 18,
+ 37, 37, 22, 37, 26, 37, 28, 37, 37, 37,
+
+ 0, 5, 9, 11, 37, 37, 15, 16, 37, 37,
+ 37, 21, 37, 37, 29, 37, 31, 0, 12, 37,
+ 17, 37, 20, 37, 37, 32, 8, 13, 37, 37,
+ 27, 0, 19, 37, 0, 25, 7, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -397,13 +397,13 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 5, 6, 7, 1, 1, 8, 8, 1, 8,
- 8, 8, 8, 8, 9, 10, 8, 11, 11, 11,
- 11, 11, 11, 11, 11, 11, 11, 8, 1, 12,
+ 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, 8, 24, 1, 37, 38, 39, 40,
+ 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,
@@ -434,90 +434,95 @@ static yyconst flex_int32_t yy_meta[58] =
4, 4, 4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[135] =
+static yyconst flex_int16_t yy_base[142] =
{ 0,
- 0, 56, 212, 320, 60, 64, 68, 72, 175, 180,
- 320, 174, 49, 169, 167, 0, 50, 54, 50, 57,
- 66, 55, 79, 68, 68, 82, 72, 76, 97, 98,
- 127, 135, 145, 94, 149, 153, 157, 320, 167, 320,
- 0, 158, 112, 320, 320, 0, 49, 93, 116, 112,
- 129, 135, 0, 0, 132, 137, 150, 145, 136, 135,
- 0, 154, 143, 147, 145, 159, 0, 156, 149, 201,
- 205, 168, 0, 116, 172, 192, 0, 181, 189, 200,
- 190, 190, 191, 187, 200, 193, 192, 0, 208, 0,
- 202, 205, 209, 204, 0, 0, 0, 213, 222, 0,
-
- 0, 213, 229, 229, 0, 229, 240, 0, 238, 0,
- 239, 0, 235, 0, 238, 0, 235, 232, 0, 87,
- 0, 233, 234, 0, 266, 0, 238, 252, 0, 320,
- 320, 311, 122, 315
+ 0, 56, 149, 335, 60, 64, 68, 72, 138, 335,
+ 131, 128, 49, 65, 121, 53, 0, 53, 57, 53,
+ 60, 69, 58, 82, 94, 78, 61, 97, 99, 102,
+ 103, 150, 154, 158, 124, 162, 131, 166, 126, 335,
+ 335, 0, 89, 131, 335, 335, 335, 0, 105, 138,
+ 143, 157, 153, 162, 151, 0, 0, 148, 153, 165,
+ 160, 151, 150, 155, 0, 0, 169, 158, 162, 160,
+ 174, 0, 173, 171, 217, 223, 184, 0, 84, 0,
+ 187, 197, 0, 191, 203, 201, 203, 203, 203, 199,
+ 213, 208, 0, 207, 0, 218, 0, 215, 218, 223,
+
+ 216, 0, 0, 0, 229, 234, 0, 0, 223, 241,
+ 238, 0, 237, 250, 0, 247, 0, 250, 0, 248,
+ 0, 251, 0, 248, 245, 0, 85, 0, 248, 248,
+ 0, 281, 0, 253, 265, 0, 335, 335, 326, 88,
+ 330
} ;
-static yyconst flex_int16_t yy_def[135] =
+static yyconst flex_int16_t yy_def[142] =
{ 0,
- 131, 1, 131, 131, 131, 131, 131, 131, 131, 132,
- 131, 131, 131, 131, 131, 133, 133, 133, 133, 133,
- 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
- 131, 131, 131, 131, 131, 131, 131, 131, 132, 131,
- 134, 131, 131, 131, 131, 133, 133, 133, 133, 133,
- 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
- 133, 133, 133, 133, 133, 133, 133, 133, 133, 131,
- 131, 131, 134, 131, 133, 133, 133, 133, 133, 133,
- 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
- 133, 133, 133, 131, 133, 133, 133, 133, 133, 133,
-
- 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
- 131, 133, 133, 133, 133, 133, 133, 133, 133, 131,
- 133, 133, 133, 133, 131, 133, 133, 131, 133, 131,
- 0, 131, 131, 131
+ 138, 1, 138, 138, 138, 138, 138, 138, 139, 138,
+ 138, 138, 138, 138, 138, 140, 140, 140, 140, 140,
+ 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+ 140, 138, 138, 138, 138, 138, 138, 138, 139, 138,
+ 138, 141, 138, 138, 138, 138, 138, 140, 140, 140,
+ 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+ 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+ 140, 140, 140, 140, 138, 138, 138, 141, 138, 140,
+ 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+ 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+
+ 138, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+ 140, 140, 140, 140, 140, 140, 140, 138, 140, 140,
+ 140, 140, 140, 140, 140, 140, 138, 140, 140, 140,
+ 140, 138, 140, 140, 138, 140, 138, 0, 138, 138,
+ 138
} ;
-static yyconst flex_int16_t yy_nxt[378] =
+static yyconst flex_int16_t yy_nxt[393] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
- 13, 14, 11, 15, 16, 16, 16, 17, 18, 19,
- 20, 16, 21, 16, 22, 23, 24, 25, 26, 27,
- 28, 29, 16, 16, 30, 16, 16, 16, 16, 17,
- 18, 19, 20, 16, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 16, 16, 30, 16, 31, 42, 43,
- 32, 33, 34, 34, 35, 36, 37, 37, 36, 36,
- 37, 37, 36, 35, 34, 34, 35, 47, 48, 51,
- 49, 52, 56, 75, 53, 54, 60, 61, 125, 50,
- 64, 125, 55, 57, 65, 58, 34, 34, 47, 48,
-
- 51, 49, 52, 56, 75, 53, 59, 54, 60, 61,
- 50, 62, 64, 55, 63, 57, 65, 58, 66, 68,
- 69, 42, 43, 76, 67, 46, 74, 59, 70, 34,
- 34, 71, 62, 77, 78, 63, 71, 34, 34, 71,
- 66, 68, 69, 79, 76, 67, 33, 34, 34, 35,
- 35, 34, 34, 35, 36, 77, 78, 36, 36, 37,
- 37, 36, 80, 81, 82, 79, 83, 84, 74, 85,
- 86, 72, 87, 40, 88, 89, 90, 91, 92, 45,
- 93, 44, 41, 80, 81, 82, 40, 38, 83, 84,
- 85, 86, 94, 72, 87, 88, 89, 90, 95, 91,
-
- 92, 93, 70, 34, 34, 71, 71, 34, 34, 71,
- 96, 131, 97, 94, 98, 99, 131, 100, 101, 95,
- 102, 103, 104, 131, 105, 106, 107, 131, 108, 109,
- 110, 112, 96, 97, 111, 98, 113, 99, 100, 101,
- 114, 102, 103, 115, 104, 105, 106, 116, 107, 108,
- 109, 117, 110, 112, 118, 111, 119, 120, 113, 121,
- 122, 114, 123, 124, 126, 115, 127, 125, 129, 116,
- 125, 130, 131, 117, 131, 131, 118, 131, 119, 120,
- 121, 131, 122, 123, 124, 126, 131, 127, 128, 129,
- 131, 131, 131, 130, 131, 131, 131, 131, 131, 131,
-
- 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
- 128, 39, 131, 39, 39, 73, 131, 131, 73, 3,
- 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
- 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
- 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
- 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
- 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
- 131, 131, 131, 131, 131, 131, 131
+ 13, 14, 10, 15, 16, 17, 17, 18, 19, 20,
+ 21, 17, 22, 17, 23, 24, 25, 26, 27, 28,
+ 29, 30, 17, 17, 31, 17, 16, 17, 17, 18,
+ 19, 20, 21, 17, 22, 23, 24, 25, 26, 27,
+ 28, 29, 30, 17, 17, 31, 17, 32, 43, 44,
+ 33, 34, 35, 35, 36, 37, 38, 38, 37, 37,
+ 38, 38, 37, 36, 35, 35, 36, 45, 46, 49,
+ 50, 51, 54, 52, 55, 59, 132, 56, 57, 132,
+ 67, 48, 53, 68, 79, 58, 60, 65, 61, 79,
+
+ 49, 50, 51, 54, 52, 55, 59, 66, 56, 62,
+ 57, 67, 63, 53, 68, 69, 58, 70, 60, 65,
+ 61, 64, 80, 71, 73, 74, 35, 35, 66, 72,
+ 62, 40, 37, 47, 63, 37, 42, 69, 41, 70,
+ 43, 44, 64, 40, 80, 71, 73, 74, 138, 77,
+ 72, 75, 35, 35, 76, 76, 35, 35, 76, 34,
+ 35, 35, 36, 36, 35, 35, 36, 37, 38, 38,
+ 37, 77, 81, 82, 83, 84, 85, 138, 86, 87,
+ 88, 89, 90, 138, 91, 92, 93, 94, 138, 95,
+ 96, 97, 98, 81, 82, 99, 83, 84, 85, 86,
+
+ 87, 88, 100, 89, 90, 91, 92, 93, 101, 94,
+ 95, 96, 97, 102, 98, 103, 106, 99, 75, 35,
+ 35, 76, 104, 100, 76, 35, 35, 76, 105, 101,
+ 107, 108, 109, 110, 102, 111, 114, 103, 106, 112,
+ 113, 115, 116, 104, 117, 138, 118, 119, 120, 105,
+ 121, 107, 108, 109, 110, 122, 123, 111, 114, 124,
+ 112, 113, 115, 116, 125, 126, 117, 118, 127, 119,
+ 120, 121, 128, 129, 138, 130, 131, 122, 123, 133,
+ 134, 124, 132, 136, 137, 132, 125, 126, 138, 138,
+ 127, 138, 138, 128, 138, 129, 130, 131, 138, 138,
+
+ 133, 134, 138, 135, 136, 138, 137, 138, 138, 138,
+ 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
+ 138, 138, 138, 138, 138, 135, 39, 138, 39, 39,
+ 78, 138, 138, 78, 3, 138, 138, 138, 138, 138,
+ 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
+ 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
+ 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
+ 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
+ 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
+ 138, 138
+
} ;
-static yyconst flex_int16_t yy_chk[378] =
+static yyconst flex_int16_t yy_chk[393] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -526,40 +531,43 @@ static yyconst flex_int16_t yy_chk[378] =
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, 17, 18, 19,
- 18, 20, 22, 47, 20, 21, 24, 25, 120, 18,
- 27, 120, 21, 23, 28, 23, 34, 34, 17, 18,
-
- 19, 18, 20, 22, 47, 20, 23, 21, 24, 25,
- 18, 26, 27, 21, 26, 23, 28, 23, 29, 30,
- 30, 43, 43, 48, 29, 133, 74, 23, 31, 31,
- 31, 31, 26, 49, 50, 26, 32, 32, 32, 32,
- 29, 30, 30, 51, 48, 29, 33, 33, 33, 33,
- 35, 35, 35, 35, 36, 49, 50, 36, 37, 37,
- 37, 37, 52, 55, 56, 51, 57, 58, 42, 59,
- 60, 36, 62, 39, 63, 64, 65, 66, 68, 15,
- 69, 14, 12, 52, 55, 56, 10, 9, 57, 58,
- 59, 60, 72, 36, 62, 63, 64, 65, 75, 66,
-
- 68, 69, 70, 70, 70, 70, 71, 71, 71, 71,
- 76, 3, 78, 72, 79, 80, 0, 81, 82, 75,
- 83, 84, 85, 0, 86, 87, 89, 0, 91, 92,
- 93, 98, 76, 78, 94, 79, 99, 80, 81, 82,
- 102, 83, 84, 103, 85, 86, 87, 104, 89, 91,
- 92, 106, 93, 98, 107, 94, 109, 111, 99, 113,
- 115, 102, 117, 118, 122, 103, 123, 125, 127, 104,
- 125, 128, 0, 106, 0, 0, 107, 0, 109, 111,
- 113, 0, 115, 117, 118, 122, 0, 123, 125, 127,
- 0, 0, 0, 128, 0, 0, 0, 0, 0, 0,
-
+ 7, 7, 7, 8, 8, 8, 8, 14, 14, 16,
+ 18, 19, 20, 19, 21, 23, 127, 21, 22, 127,
+ 27, 140, 19, 27, 79, 22, 24, 26, 24, 43,
+
+ 16, 18, 19, 20, 19, 21, 23, 26, 21, 24,
+ 22, 27, 25, 19, 27, 28, 22, 29, 24, 26,
+ 24, 25, 49, 30, 31, 31, 35, 35, 26, 30,
+ 24, 39, 37, 15, 25, 37, 12, 28, 11, 29,
+ 44, 44, 25, 9, 49, 30, 31, 31, 3, 37,
+ 30, 32, 32, 32, 32, 33, 33, 33, 33, 34,
+ 34, 34, 34, 36, 36, 36, 36, 38, 38, 38,
+ 38, 37, 50, 51, 52, 53, 54, 0, 55, 58,
+ 59, 60, 61, 0, 62, 63, 64, 67, 0, 68,
+ 69, 70, 71, 50, 51, 73, 52, 53, 54, 55,
+
+ 58, 59, 74, 60, 61, 62, 63, 64, 77, 67,
+ 68, 69, 70, 81, 71, 82, 86, 73, 75, 75,
+ 75, 75, 84, 74, 76, 76, 76, 76, 85, 77,
+ 87, 88, 89, 90, 81, 91, 96, 82, 86, 92,
+ 94, 98, 99, 84, 100, 0, 101, 105, 106, 85,
+ 109, 87, 88, 89, 90, 110, 111, 91, 96, 113,
+ 92, 94, 98, 99, 114, 116, 100, 101, 118, 105,
+ 106, 109, 120, 122, 0, 124, 125, 110, 111, 129,
+ 130, 113, 132, 134, 135, 132, 114, 116, 0, 0,
+ 118, 0, 0, 120, 0, 122, 124, 125, 0, 0,
+
+ 129, 130, 0, 132, 134, 0, 135, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 125, 132, 0, 132, 132, 134, 0, 0, 134, 131,
- 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
- 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
- 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
- 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
- 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
- 131, 131, 131, 131, 131, 131, 131
+ 0, 0, 0, 0, 0, 132, 139, 0, 139, 139,
+ 141, 0, 0, 141, 138, 138, 138, 138, 138, 138,
+ 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
+ 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
+ 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
+ 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
+ 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
+ 138, 138
+
} ;
static yy_state_type yy_last_accepting_state;
@@ -622,7 +630,7 @@ static void countnl() {
Director::g_lingo->_colnumber = strlen(p);
}
-#line 626 "engines/director/lingo/lingo-lex.cpp"
+#line 634 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -810,7 +818,7 @@ YY_DECL
#line 58 "engines/director/lingo/lingo-lex.l"
-#line 814 "engines/director/lingo/lingo-lex.cpp"
+#line 822 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -864,13 +872,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 >= 132 )
+ if ( yy_current_state >= 139 )
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] != 320 );
+ while ( yy_base[yy_current_state] != 335 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -912,153 +920,173 @@ YY_RULE_SETUP
case 4:
YY_RULE_SETUP
#line 64 "engines/director/lingo/lingo-lex.l"
-{ count(); return tDOWN; }
+{ count(); return tAND; }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 65 "engines/director/lingo/lingo-lex.l"
-{ count(); return tIF; }
+{ count(); return tDOWN; }
YY_BREAK
case 6:
-/* rule 6 can match eol */
YY_RULE_SETUP
#line 66 "engines/director/lingo/lingo-lex.l"
-{ countnl(); return tNLELSIF; }
+{ count(); return tIF; }
YY_BREAK
case 7:
/* rule 7 can match eol */
YY_RULE_SETUP
#line 67 "engines/director/lingo/lingo-lex.l"
-{ countnl(); return tNLELSE; }
+{ countnl(); return tNLELSIF; }
YY_BREAK
case 8:
+/* rule 8 can match eol */
YY_RULE_SETUP
#line 68 "engines/director/lingo/lingo-lex.l"
-{ count(); return tELSE; }
+{ countnl(); return tNLELSE; }
YY_BREAK
case 9:
YY_RULE_SETUP
#line 69 "engines/director/lingo/lingo-lex.l"
-{ count(); return tEND; }
+{ count(); return tELSE; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 70 "engines/director/lingo/lingo-lex.l"
-{ count(); return tEXIT; }
+{ count(); return tEND; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 71 "engines/director/lingo/lingo-lex.l"
-{ count(); return tFRAME; }
+{ count(); return tEXIT; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 72 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGLOBAL; }
+{ count(); return tFRAME; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 73 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGO; }
+{ count(); return tGLOBAL; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 74 "engines/director/lingo/lingo-lex.l"
-{ count(); return tINTO; }
+{ count(); return tGO; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 75 "engines/director/lingo/lingo-lex.l"
-{ count(); return tLOOP; }
+{ count(); return tINTO; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 76 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMACRO; }
+{ count(); return tLOOP; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 77 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMCI; }
+{ count(); return tMACRO; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 78 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMCIWAIT; }
+{ count(); return tMCI; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 79 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMOVIE; }
+{ count(); return tMCIWAIT; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 80 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNEXT; }
+{ count(); return tMOVIE; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 81 "engines/director/lingo/lingo-lex.l"
-{ count(); return tOF; }
+{ count(); return tNEXT; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 82 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPREVIOUS; }
+{ count(); return tNOT; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 83 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPUT; }
+{ count(); return tOF; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 84 "engines/director/lingo/lingo-lex.l"
-{ count(); return tREPEAT; }
+{ count(); return tOR; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 85 "engines/director/lingo/lingo-lex.l"
-{ count(); return tSET; }
+{ count(); return tPREVIOUS; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 86 "engines/director/lingo/lingo-lex.l"
-{ count(); return tTHEN; }
+{ count(); return tPUT; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 87 "engines/director/lingo/lingo-lex.l"
-{ count(); return tTO; }
+{ count(); return tREPEAT; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 88 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWITH; }
+{ count(); return tSET; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 89 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWHILE; }
+{ count(); return tTHEN; }
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 91 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNEQ; }
+#line 90 "engines/director/lingo/lingo-lex.l"
+{ count(); return tTO; }
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 92 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGE; }
+#line 91 "engines/director/lingo/lingo-lex.l"
+{ count(); return tWITH; }
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 93 "engines/director/lingo/lingo-lex.l"
-{ count(); return tLE; }
+#line 92 "engines/director/lingo/lingo-lex.l"
+{ count(); return tWHILE; }
YY_BREAK
case 33:
YY_RULE_SETUP
+#line 94 "engines/director/lingo/lingo-lex.l"
+{ count(); return tNEQ; }
+ YY_BREAK
+case 34:
+YY_RULE_SETUP
#line 95 "engines/director/lingo/lingo-lex.l"
+{ count(); return tGE; }
+ YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 96 "engines/director/lingo/lingo-lex.l"
+{ count(); return tLE; }
+ YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 97 "engines/director/lingo/lingo-lex.l"
+{ count(); return tCONCAT; }
+ YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 99 "engines/director/lingo/lingo-lex.l"
{
count();
yylval.s = new Common::String(yytext);
@@ -1069,43 +1097,43 @@ YY_RULE_SETUP
return ID;
}
YY_BREAK
-case 34:
+case 38:
YY_RULE_SETUP
-#line 104 "engines/director/lingo/lingo-lex.l"
+#line 108 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
-case 35:
+case 39:
YY_RULE_SETUP
-#line 105 "engines/director/lingo/lingo-lex.l"
+#line 109 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
-case 36:
+case 40:
YY_RULE_SETUP
-#line 106 "engines/director/lingo/lingo-lex.l"
+#line 110 "engines/director/lingo/lingo-lex.l"
{ count(); return *yytext; }
YY_BREAK
-case 37:
-/* rule 37 can match eol */
+case 41:
+/* rule 41 can match eol */
YY_RULE_SETUP
-#line 107 "engines/director/lingo/lingo-lex.l"
+#line 111 "engines/director/lingo/lingo-lex.l"
{ return '\n'; }
YY_BREAK
-case 38:
+case 42:
YY_RULE_SETUP
-#line 108 "engines/director/lingo/lingo-lex.l"
+#line 112 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
-case 39:
+case 43:
YY_RULE_SETUP
-#line 109 "engines/director/lingo/lingo-lex.l"
+#line 113 "engines/director/lingo/lingo-lex.l"
YY_BREAK
-case 40:
+case 44:
YY_RULE_SETUP
-#line 111 "engines/director/lingo/lingo-lex.l"
+#line 115 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1109 "engines/director/lingo/lingo-lex.cpp"
+#line 1137 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1398,7 +1426,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 >= 132 )
+ if ( yy_current_state >= 139 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1426,11 +1454,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 >= 132 )
+ if ( yy_current_state >= 139 )
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 == 131);
+ yy_is_jam = (yy_current_state == 138);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2105,7 +2133,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 111 "engines/director/lingo/lingo-lex.l"
+#line 115 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 7b04c6b..d241993 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -61,6 +61,7 @@ whitespace [\t ]
^{whitespace}+ { count(); }
[\t]+ { count(); return ' '; }
+(?i:and) { count(); return tAND; }
(?i:down) { count(); return tDOWN; }
(?i:if) { count(); return tIF; }
(?i:[\n\r]+[\t ]+else[\t ]+if) { countnl(); return tNLELSIF; }
@@ -78,7 +79,9 @@ whitespace [\t ]
(?i:mciwait) { count(); return tMCIWAIT; }
(?i:movie) { count(); return tMOVIE; }
(?i:next) { count(); return tNEXT; }
+(?i:not) { count(); return tNOT; }
(?i:of) { count(); return tOF; }
+(?i:or) { count(); return tOR; }
(?i:previous) { count(); return tPREVIOUS; }
(?i:put) { count(); return tPUT; }
(?i:repeat) { count(); return tREPEAT; }
@@ -88,9 +91,10 @@ whitespace [\t ]
(?i:with) { count(); return tWITH; }
(?i:while) { count(); return tWHILE; }
-[!][=] { count(); return tNEQ; }
+[<][>] { count(); return tNEQ; }
[>][=] { count(); return tGE; }
[<][=] { count(); return tLE; }
+[&][&] { count(); return tCONCAT; }
{identifier} {
count();
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 5320d88..449b055 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -178,7 +178,13 @@ public:
static void c_mul();
static void c_div();
static void c_negate();
+
+ static void c_and();
+ static void c_or();
+ static void c_not();
+
static void c_ampersand();
+ static void c_concat();
static void c_constpush();
static void c_fconstpush();
Commit: a8498f41a0c890870e053024abac0506152729a7
https://github.com/scummvm/scummvm/commit/a8498f41a0c890870e053024abac0506152729a7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Made & and && work with any type
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index b2b96ad..a576f1c 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -286,9 +286,8 @@ void Lingo::c_ampersand() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- if (d1.type != STRING || d2.type != STRING) {
- error("Wrong operands for & operation: %d %d", d1.type, d2.type);
- }
+ d1.toString();
+ d2.toString();
*d1.u.s += *d2.u.s;
@@ -301,9 +300,8 @@ void Lingo::c_concat() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
- if (d1.type != STRING || d2.type != STRING) {
- error("Wrong operands for & operation: %d %d", d1.type, d2.type);
- }
+ d1.toString();
+ d2.toString();
*d1.u.s += " ";
*d1.u.s += *d2.u.s;
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index b24c55b..fec6b64 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -210,4 +210,26 @@ float Datum::toFloat() {
return u.f;
}
+Common::String *Datum::toString() {
+ Common::String *s = new Common::String;
+ switch (type) {
+ case INT:
+ s->format("%d", u.i);
+ break;
+ case FLOAT:
+ s->format("%f", u.f);
+ break;
+ case STRING:
+ delete s;
+ s = u.s;
+ default:
+ warning("Incorrect operation toInt() for type: %d", type);
+ }
+
+ u.s = s;
+ type = STRING;
+
+ return u.s;
+}
+
} // End of namespace Director
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 449b055..c88efab 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -106,6 +106,7 @@ struct Datum { /* interpreter stack type */
float toFloat();
int toInt();
+ Common::String *toString();
};
struct Builtin {
Commit: 40856e6d06c4a71ccabcafcacaebc8fa23549ca3
https://github.com/scummvm/scummvm/commit/40856e6d06c4a71ccabcafcacaebc8fa23549ca3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implemented string() built-in function
Changed paths:
engines/director/lingo/lingo-builtins.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 0fe742a..48de072 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -41,6 +41,7 @@ static struct BuiltinProto {
{ "random", Lingo::b_random, 1},
{ "sin", Lingo::b_sin, 1},
{ "sqrt", Lingo::b_sqrt, 1},
+ { "string", Lingo::b_string, 1},
{ "tan", Lingo::b_tan, 1},
{ 0, 0, 0 }
};
@@ -145,6 +146,12 @@ void Lingo::b_sqrt() {
g_lingo->push(d);
}
+void Lingo::b_string() {
+ Datum d = g_lingo->pop();
+ d.toString();
+ g_lingo->push(d);
+}
+
void Lingo::b_tan() {
Datum d = g_lingo->pop();
d.toFloat();
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index c88efab..8cb454f3 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -226,6 +226,7 @@ public:
static void b_random();
static void b_sin();
static void b_sqrt();
+ static void b_string();
static void b_tan();
void func_mci(Common::String &s);
Commit: bb8fd6a8990f8364fc6411ba98ec4716429c98d8
https://github.com/scummvm/scummvm/commit/bb8fd6a8990f8364fc6411ba98ec4716429c98d8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implemented length() built-in function
Changed paths:
engines/director/lingo/lingo-builtins.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 48de072..696aca1 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -35,6 +35,7 @@ static struct BuiltinProto {
{ "exp", Lingo::b_exp, 1},
{ "float", Lingo::b_float, 1},
{ "integer",Lingo::b_integer, 1},
+ { "length", Lingo::b_length, 1},
{ "log", Lingo::b_log, 1},
{ "pi", Lingo::b_pi, 0},
{ "power", Lingo::b_power, 2},
@@ -97,6 +98,20 @@ void Lingo::b_integer() {
g_lingo->push(d);
}
+void Lingo::b_length() {
+ Datum d = g_lingo->pop();
+
+ if (d.type != STRING)
+ error("Incorrect type for 'length' function: %d", d.type);
+
+ int len = strlen(d.u.s->c_str());
+ delete d.u.s;
+
+ d.u.i = len;
+ d.type = INT;
+ g_lingo->push(d);
+}
+
void Lingo::b_log() {
Datum d = g_lingo->pop();
d.toFloat();
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 8cb454f3..eca9b41 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -220,6 +220,7 @@ public:
static void b_exp();
static void b_float();
static void b_integer();
+ static void b_length();
static void b_log();
static void b_pi();
static void b_power();
Commit: 8084989605853dd23e265a1f649e36611bdbfd99
https://github.com/scummvm/scummvm/commit/8084989605853dd23e265a1f649e36611bdbfd99
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implemented chars() function and added more debug for type printing
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-builtins.cpp
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 2f77234..97e7c70 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -132,6 +132,9 @@ Common::Error DirectorEngine::run() {
set z1 = z1 && \"woof\"\n\
put z\n\
put z1\n\
+ put chars(\"Macromedia\", 6, 6)\n\
+ put chars(\"Macromedia\", 6, 10)\n\
+ put chars(\"Macromedia\", 6, 15)\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 696aca1..873e844 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -29,21 +29,24 @@ static struct BuiltinProto {
void (*func)(void);
int nparams;
} builtins[] = {
+ // Math
{ "abs", Lingo::b_abs, 1},
{ "atan", Lingo::b_atan, 1},
{ "cos", Lingo::b_cos, 1},
{ "exp", Lingo::b_exp, 1},
{ "float", Lingo::b_float, 1},
{ "integer",Lingo::b_integer, 1},
- { "length", Lingo::b_length, 1},
{ "log", Lingo::b_log, 1},
{ "pi", Lingo::b_pi, 0},
{ "power", Lingo::b_power, 2},
{ "random", Lingo::b_random, 1},
{ "sin", Lingo::b_sin, 1},
{ "sqrt", Lingo::b_sqrt, 1},
- { "string", Lingo::b_string, 1},
{ "tan", Lingo::b_tan, 1},
+ // String
+ { "chars", Lingo::b_chars, 3},
+ { "length", Lingo::b_length, 1},
+ { "string", Lingo::b_string, 1},
{ 0, 0, 0 }
};
@@ -53,6 +56,9 @@ void Lingo::initBuiltIns() {
}
}
+///////////////////
+// Math
+///////////////////
void Lingo::b_abs() {
Datum d = g_lingo->pop();
@@ -98,20 +104,6 @@ void Lingo::b_integer() {
g_lingo->push(d);
}
-void Lingo::b_length() {
- Datum d = g_lingo->pop();
-
- if (d.type != STRING)
- error("Incorrect type for 'length' function: %d", d.type);
-
- int len = strlen(d.u.s->c_str());
- delete d.u.s;
-
- d.u.i = len;
- d.type = INT;
- g_lingo->push(d);
-}
-
void Lingo::b_log() {
Datum d = g_lingo->pop();
d.toFloat();
@@ -161,17 +153,59 @@ void Lingo::b_sqrt() {
g_lingo->push(d);
}
-void Lingo::b_string() {
+void Lingo::b_tan() {
Datum d = g_lingo->pop();
- d.toString();
+ d.toFloat();
+ d.u.f = tan(d.u.f);
g_lingo->push(d);
}
-void Lingo::b_tan() {
+///////////////////
+// String
+///////////////////
+void Lingo::b_chars() {
+ Datum to = g_lingo->pop();
+ Datum from = g_lingo->pop();
+ Datum s = g_lingo->pop();
+
+ if (s.type != STRING)
+ error("Incorrect type for 'chars' function: %s", s.type2str());
+
+ to.toInt();
+ from.toInt();
+
+ int len = strlen(s.u.s->c_str());
+ int f = MAX(0, MIN(len, from.u.i - 1));
+ int t = MAX(0, MIN(len, to.u.i));
+
+ Common::String *res = new Common::String(&(s.u.s->c_str()[f]), &(s.u.s->c_str()[t]));
+
+ delete s.u.s;
+
+ s.u.s = res;
+ s.type = STRING;
+ g_lingo->push(s);
+}
+
+void Lingo::b_length() {
Datum d = g_lingo->pop();
- d.toFloat();
- d.u.f = tan(d.u.f);
+
+ if (d.type != STRING)
+ error("Incorrect type for 'length' function: %s", d.type2str());
+
+ int len = strlen(d.u.s->c_str());
+ delete d.u.s;
+
+ d.u.i = len;
+ d.type = INT;
+ g_lingo->push(d);
+}
+
+void Lingo::b_string() {
+ Datum d = g_lingo->pop();
+ d.toString();
g_lingo->push(d);
}
+
}
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index fec6b64..9ec89ff 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -188,7 +188,7 @@ int Datum::toInt() {
type = INT;
break;
default:
- warning("Incorrect operation toInt() for type: %d", type);
+ warning("Incorrect operation toInt() for type: %s", type2str());
}
return u.i;
@@ -204,7 +204,7 @@ float Datum::toFloat() {
// no-op
break;
default:
- warning("Incorrect operation toFloat() for type: %d", type);
+ warning("Incorrect operation toFloat() for type: %s", type2str());
}
return u.f;
@@ -223,7 +223,7 @@ Common::String *Datum::toString() {
delete s;
s = u.s;
default:
- warning("Incorrect operation toInt() for type: %d", type);
+ warning("Incorrect operation toInt() for type: %s", type2str());
}
u.s = s;
@@ -232,4 +232,22 @@ Common::String *Datum::toString() {
return u.s;
}
+const char *Datum::type2str() {
+ static char res[20];
+
+ switch (type) {
+ case INT:
+ return "INT";
+ case FLOAT:
+ return "FLOAT";
+ case STRING:
+ return "STRING";
+ case CASTREF:
+ return "CASTREF";
+ default:
+ snprintf(res, 20, "-- (%d) --", type);
+ return res;
+ }
+}
+
} // End of namespace Director
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index eca9b41..162bb5f 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -107,6 +107,8 @@ struct Datum { /* interpreter stack type */
float toFloat();
int toInt();
Common::String *toString();
+
+ const char *type2str();
};
struct Builtin {
@@ -216,6 +218,7 @@ public:
static void b_abs();
static void b_atan();
+ static void b_chars();
static void b_cos();
static void b_exp();
static void b_float();
Commit: da408c0ad03429a4cbe9718491c1130fef47e1d1
https://github.com/scummvm/scummvm/commit/da408c0ad03429a4cbe9718491c1130fef47e1d1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implement 'contains' and 'starts' string operators
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 97e7c70..107a9a5 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -134,7 +134,9 @@ Common::Error DirectorEngine::run() {
put z1\n\
put chars(\"Macromedia\", 6, 6)\n\
put chars(\"Macromedia\", 6, 10)\n\
- put chars(\"Macromedia\", 6, 15)\n\
+ put chars(\"Macromedia\", -1, 15)\n\
+ if z1 contains \"Me\xafW\" then put \"Contains\"\n\
+ else put \"Doesn't contain\"\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index a576f1c..817f9c9 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -311,6 +311,52 @@ void Lingo::c_concat() {
g_lingo->push(d1);
}
+void Lingo::c_contains() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.toString();
+ d2.toString();
+
+ Common::String *s1 = g_lingo->toLowercaseMac(d1.u.s);
+ Common::String *s2 = g_lingo->toLowercaseMac(d2.u.s);
+
+ int res = s1->contains(*s2) ? 1 : 0;
+
+ delete d1.u.s;
+ delete d2.u.s;
+ delete s1;
+ delete s2;
+
+ d1.type = INT;
+ d1.u.i = res;
+
+ g_lingo->push(d1);
+}
+
+void Lingo::c_starts() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ d1.toString();
+ d2.toString();
+
+ Common::String *s1 = g_lingo->toLowercaseMac(d1.u.s);
+ Common::String *s2 = g_lingo->toLowercaseMac(d2.u.s);
+
+ int res = s1->hasPrefix(*s2) ? 1 : 0;
+
+ delete d1.u.s;
+ delete d2.u.s;
+ delete s1;
+ delete s2;
+
+ d1.type = INT;
+ d1.u.i = res;
+
+ g_lingo->push(d1);
+}
+
void Lingo::c_and() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 2077d5c..f5c4e3d 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -111,7 +111,9 @@
tAND = 300,
tOR = 301,
tNOT = 302,
- tCONCAT = 303
+ tCONCAT = 303,
+ tCONTAINS = 304,
+ tSTARTS = 305
};
#endif
/* Tokens. */
@@ -161,6 +163,8 @@
#define tOR 301
#define tNOT 302
#define tCONCAT 303
+#define tCONTAINS 304
+#define tSTARTS 305
@@ -212,7 +216,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 216 "engines/director/lingo/lingo-gr.cpp"
+#line 220 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -225,7 +229,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 229 "engines/director/lingo/lingo-gr.cpp"
+#line 233 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -440,20 +444,20 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 64
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 540
+#define YYLAST 544
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 62
+#define YYNTOKENS 64
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 33
/* YYNRULES -- Number of rules. */
-#define YYNRULES 104
+#define YYNRULES 106
/* YYNRULES -- Number of states. */
-#define YYNSTATES 219
+#define YYNSTATES 223
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 303
+#define YYMAXUTOK 305
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -462,12 +466,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 55, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 57, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 54, 60, 2,
- 56, 57, 52, 50, 61, 51, 2, 53, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 56, 62, 2,
+ 58, 59, 54, 52, 63, 53, 2, 55, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 59, 49, 58, 2, 2, 2, 2, 2, 2, 2,
+ 61, 51, 60, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -491,7 +495,7 @@ static const yytype_uint8 yytranslate[] =
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48
+ 45, 46, 47, 48, 49, 50
};
#if YYDEBUG
@@ -506,70 +510,71 @@ static const yytype_uint16 yyprhs[] =
184, 187, 191, 193, 195, 196, 197, 198, 201, 204,
206, 208, 210, 215, 220, 222, 224, 228, 232, 236,
240, 244, 248, 252, 256, 260, 264, 268, 271, 275,
- 279, 282, 285, 289, 292, 295, 298, 300, 302, 305,
- 307, 311, 314, 317, 320, 323, 327, 330, 334, 337,
- 340, 342, 346, 349, 353, 354, 363, 364, 366, 370,
- 375, 376, 380, 381, 383
+ 279, 283, 287, 290, 293, 297, 300, 303, 306, 308,
+ 310, 313, 315, 319, 322, 325, 328, 331, 335, 338,
+ 342, 345, 348, 350, 354, 357, 361, 362, 371, 372,
+ 374, 378, 383, 384, 388, 389, 391
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 63, 0, -1, 63, 64, 65, -1, 65, -1, 55,
- -1, -1, 89, -1, 84, -1, 93, -1, 66, -1,
- 68, -1, 1, -1, 31, 83, 22, 10, -1, 33,
- 10, 49, 83, -1, 33, 10, 35, 83, -1, 83,
- -1, 84, -1, 67, -1, 69, -1, 76, 56, 75,
- 57, 82, 81, 16, 32, -1, 77, 49, 83, 81,
- 35, 83, 81, 82, 81, 16, 32, -1, 77, 49,
- 83, 81, 13, 35, 83, 81, 82, 81, 16, 32,
- -1, 78, 75, 34, 64, 82, 81, 16, 21, -1,
- 78, 75, 34, 64, 82, 81, 14, 82, 81, 16,
- 21, -1, 78, 75, 34, 64, 82, 81, 80, 71,
- 81, 64, 16, 21, -1, 78, 75, 34, 80, 67,
- 81, -1, 78, 75, 34, 80, 67, 81, 38, 80,
- 67, 81, -1, 78, 75, 34, 80, 67, 81, 72,
- 81, 70, 81, -1, -1, 38, 80, 67, -1, 71,
- 74, -1, 74, -1, 72, 73, -1, 73, -1, 79,
- 75, 34, 80, 68, 81, -1, 72, -1, 79, 75,
- 34, 82, 81, -1, 83, -1, 83, 49, 83, -1,
- 56, 75, 57, -1, 32, 37, -1, 32, 36, 10,
- -1, 21, -1, 15, -1, -1, -1, -1, 82, 64,
- -1, 82, 68, -1, 7, -1, 8, -1, 11, -1,
- 9, 56, 94, 57, -1, 10, 56, 94, 57, -1,
- 10, -1, 66, -1, 83, 50, 83, -1, 83, 51,
- 83, -1, 83, 52, 83, -1, 83, 53, 83, -1,
- 83, 58, 83, -1, 83, 59, 83, -1, 83, 44,
- 83, -1, 83, 39, 83, -1, 83, 40, 83, -1,
- 83, 45, 83, -1, 83, 46, 83, -1, 47, 83,
- -1, 83, 60, 83, -1, 83, 48, 83, -1, 50,
- 83, -1, 51, 83, -1, 56, 83, 57, -1, 25,
- 11, -1, 26, 10, -1, 31, 83, -1, 86, -1,
- 17, -1, 19, 85, -1, 10, -1, 85, 61, 10,
- -1, 20, 23, -1, 20, 28, -1, 20, 30, -1,
- 20, 87, -1, 20, 87, 88, -1, 20, 88, -1,
- 35, 18, 11, -1, 18, 11, -1, 35, 11, -1,
- 11, -1, 29, 27, 11, -1, 27, 11, -1, 35,
- 27, 11, -1, -1, 24, 10, 90, 80, 91, 64,
- 92, 82, -1, -1, 10, -1, 91, 61, 10, -1,
- 91, 64, 61, 10, -1, -1, 10, 80, 94, -1,
- -1, 83, -1, 94, 61, 83, -1
+ 65, 0, -1, 65, 66, 67, -1, 67, -1, 57,
+ -1, -1, 91, -1, 86, -1, 95, -1, 68, -1,
+ 70, -1, 1, -1, 31, 85, 22, 10, -1, 33,
+ 10, 51, 85, -1, 33, 10, 35, 85, -1, 85,
+ -1, 86, -1, 69, -1, 71, -1, 78, 58, 77,
+ 59, 84, 83, 16, 32, -1, 79, 51, 85, 83,
+ 35, 85, 83, 84, 83, 16, 32, -1, 79, 51,
+ 85, 83, 13, 35, 85, 83, 84, 83, 16, 32,
+ -1, 80, 77, 34, 66, 84, 83, 16, 21, -1,
+ 80, 77, 34, 66, 84, 83, 14, 84, 83, 16,
+ 21, -1, 80, 77, 34, 66, 84, 83, 82, 73,
+ 83, 66, 16, 21, -1, 80, 77, 34, 82, 69,
+ 83, -1, 80, 77, 34, 82, 69, 83, 38, 82,
+ 69, 83, -1, 80, 77, 34, 82, 69, 83, 74,
+ 83, 72, 83, -1, -1, 38, 82, 69, -1, 73,
+ 76, -1, 76, -1, 74, 75, -1, 75, -1, 81,
+ 77, 34, 82, 70, 83, -1, 74, -1, 81, 77,
+ 34, 84, 83, -1, 85, -1, 85, 51, 85, -1,
+ 58, 77, 59, -1, 32, 37, -1, 32, 36, 10,
+ -1, 21, -1, 15, -1, -1, -1, -1, 84, 66,
+ -1, 84, 70, -1, 7, -1, 8, -1, 11, -1,
+ 9, 58, 96, 59, -1, 10, 58, 96, 59, -1,
+ 10, -1, 68, -1, 85, 52, 85, -1, 85, 53,
+ 85, -1, 85, 54, 85, -1, 85, 55, 85, -1,
+ 85, 60, 85, -1, 85, 61, 85, -1, 85, 44,
+ 85, -1, 85, 39, 85, -1, 85, 40, 85, -1,
+ 85, 45, 85, -1, 85, 46, 85, -1, 47, 85,
+ -1, 85, 62, 85, -1, 85, 48, 85, -1, 85,
+ 49, 85, -1, 85, 50, 85, -1, 52, 85, -1,
+ 53, 85, -1, 58, 85, 59, -1, 25, 11, -1,
+ 26, 10, -1, 31, 85, -1, 88, -1, 17, -1,
+ 19, 87, -1, 10, -1, 87, 63, 10, -1, 20,
+ 23, -1, 20, 28, -1, 20, 30, -1, 20, 89,
+ -1, 20, 89, 90, -1, 20, 90, -1, 35, 18,
+ 11, -1, 18, 11, -1, 35, 11, -1, 11, -1,
+ 29, 27, 11, -1, 27, 11, -1, 35, 27, 11,
+ -1, -1, 24, 10, 92, 82, 93, 66, 94, 84,
+ -1, -1, 10, -1, 93, 63, 10, -1, 93, 66,
+ 63, 10, -1, -1, 10, 82, 96, -1, -1, 85,
+ -1, 96, 63, 85, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 93, 93, 94, 97, 102, 103, 104, 105, 106,
- 107, 108, 111, 117, 123, 130, 131, 133, 134, 139,
- 150, 166, 180, 187, 196, 205, 215, 225, 236, 237,
- 240, 241, 244, 245, 248, 256, 257, 265, 266, 267,
- 269, 271, 277, 283, 290, 292, 294, 295, 296, 299,
- 304, 307, 310, 316, 324, 327, 328, 329, 330, 331,
- 332, 333, 334, 335, 336, 337, 338, 339, 340, 341,
- 342, 343, 344, 347, 348, 349, 350, 351, 353, 356,
- 357, 368, 369, 370, 371, 376, 382, 389, 390, 391,
- 392, 395, 396, 397, 425, 425, 432, 433, 434, 435,
- 437, 440, 448, 449, 450
+ 0, 94, 94, 95, 98, 103, 104, 105, 106, 107,
+ 108, 109, 112, 118, 124, 131, 132, 134, 135, 140,
+ 151, 167, 181, 188, 197, 206, 216, 226, 237, 238,
+ 241, 242, 245, 246, 249, 257, 258, 266, 267, 268,
+ 270, 272, 278, 284, 291, 293, 295, 296, 297, 300,
+ 305, 308, 311, 317, 325, 328, 329, 330, 331, 332,
+ 333, 334, 335, 336, 337, 338, 339, 340, 341, 342,
+ 343, 344, 345, 346, 347, 350, 351, 352, 353, 354,
+ 356, 359, 360, 371, 372, 373, 374, 379, 385, 392,
+ 393, 394, 395, 398, 399, 400, 428, 428, 435, 436,
+ 437, 438, 440, 443, 451, 452, 453
};
#endif
@@ -584,10 +589,10 @@ static const char *const yytname[] =
"tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF",
"tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH",
"tWHILE", "tNLELSE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "tAND",
- "tOR", "tNOT", "tCONCAT", "'='", "'+'", "'-'", "'*'", "'/'", "'%'",
- "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','", "$accept", "program",
- "nl", "programline", "asgn", "stmtoneliner", "stmt", "ifstmt",
- "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
+ "tOR", "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS", "'='", "'+'", "'-'",
+ "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','",
+ "$accept", "program", "nl", "programline", "asgn", "stmtoneliner",
+ "stmt", "ifstmt", "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
"elseifstmtoneliner1", "elseifstmt1", "cond", "repeatwhile",
"repeatwith", "if", "elseif", "begin", "end", "stmtlist", "expr", "func",
"globallist", "gotofunc", "gotoframe", "gotomovie", "defn", "@1",
@@ -604,26 +609,26 @@ static const yytype_uint16 yytoknum[] =
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, 298, 299, 300, 301, 302, 303, 61,
- 43, 45, 42, 47, 37, 10, 40, 41, 62, 60,
- 38, 44
+ 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
+ 305, 61, 43, 45, 42, 47, 37, 10, 40, 41,
+ 62, 60, 38, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 62, 63, 63, 64, 65, 65, 65, 65, 65,
- 65, 65, 66, 66, 66, 67, 67, 68, 68, 68,
- 68, 68, 69, 69, 69, 69, 69, 69, 70, 70,
- 71, 71, 72, 72, 73, 74, 74, 75, 75, 75,
- 76, 77, 78, 79, 80, 81, 82, 82, 82, 83,
- 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
- 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
- 83, 83, 83, 84, 84, 84, 84, 84, 84, 85,
- 85, 86, 86, 86, 86, 86, 86, 87, 87, 87,
- 87, 88, 88, 88, 90, 89, 91, 91, 91, 91,
- 92, 93, 94, 94, 94
+ 0, 64, 65, 65, 66, 67, 67, 67, 67, 67,
+ 67, 67, 68, 68, 68, 69, 69, 70, 70, 70,
+ 70, 70, 71, 71, 71, 71, 71, 71, 72, 72,
+ 73, 73, 74, 74, 75, 76, 76, 77, 77, 77,
+ 78, 79, 80, 81, 82, 83, 84, 84, 84, 85,
+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
+ 85, 85, 85, 85, 85, 86, 86, 86, 86, 86,
+ 86, 87, 87, 88, 88, 88, 88, 88, 88, 89,
+ 89, 89, 89, 90, 90, 90, 92, 91, 93, 93,
+ 93, 93, 94, 95, 96, 96, 96
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -636,10 +641,10 @@ static const yytype_uint8 yyr2[] =
2, 3, 1, 1, 0, 0, 0, 2, 2, 1,
1, 1, 4, 4, 1, 1, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 2, 3, 3,
- 2, 2, 3, 2, 2, 2, 1, 1, 2, 1,
- 3, 2, 2, 2, 2, 3, 2, 3, 2, 2,
- 1, 3, 2, 3, 0, 8, 0, 1, 3, 4,
- 0, 3, 0, 1, 3
+ 3, 3, 2, 2, 3, 2, 2, 2, 1, 1,
+ 2, 1, 3, 2, 2, 2, 2, 3, 2, 3,
+ 2, 2, 1, 3, 2, 3, 0, 8, 0, 1,
+ 3, 4, 0, 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -647,75 +652,77 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 49, 50, 0, 44, 51, 77, 0, 0,
+ 0, 11, 49, 50, 0, 44, 51, 79, 0, 0,
42, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 3, 55, 17, 10, 18, 0, 0, 0,
- 15, 7, 76, 6, 8, 102, 102, 102, 79, 78,
- 90, 0, 81, 0, 82, 0, 83, 0, 84, 86,
- 94, 73, 74, 54, 0, 55, 75, 0, 40, 0,
- 67, 70, 71, 0, 1, 4, 0, 0, 0, 0,
+ 15, 7, 78, 6, 8, 104, 104, 104, 81, 80,
+ 92, 0, 83, 0, 84, 0, 85, 0, 86, 88,
+ 96, 75, 76, 54, 0, 55, 77, 0, 40, 0,
+ 67, 72, 73, 0, 1, 4, 0, 0, 0, 0,
0, 37, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 103, 0, 0, 101, 0,
- 88, 92, 0, 89, 0, 0, 0, 85, 44, 0,
- 0, 41, 0, 0, 72, 2, 0, 45, 0, 0,
- 44, 0, 63, 64, 62, 65, 66, 69, 56, 57,
- 58, 59, 60, 61, 68, 52, 0, 53, 80, 91,
- 87, 93, 96, 12, 14, 13, 46, 0, 39, 46,
- 0, 38, 104, 97, 0, 45, 0, 0, 45, 45,
- 16, 0, 100, 47, 48, 0, 0, 45, 44, 25,
- 98, 0, 46, 0, 45, 46, 46, 0, 0, 43,
- 44, 45, 33, 0, 99, 95, 19, 46, 45, 45,
- 22, 45, 35, 31, 0, 0, 32, 28, 0, 45,
- 0, 0, 30, 0, 0, 45, 44, 45, 44, 0,
- 0, 0, 0, 44, 26, 0, 27, 0, 0, 20,
- 23, 0, 45, 29, 45, 21, 24, 36, 34
+ 0, 0, 0, 0, 0, 0, 0, 105, 0, 0,
+ 103, 0, 90, 94, 0, 91, 0, 0, 0, 87,
+ 44, 0, 0, 41, 0, 0, 74, 2, 0, 45,
+ 0, 0, 44, 0, 63, 64, 62, 65, 66, 69,
+ 70, 71, 56, 57, 58, 59, 60, 61, 68, 52,
+ 0, 53, 82, 93, 89, 95, 98, 12, 14, 13,
+ 46, 0, 39, 46, 0, 38, 106, 99, 0, 45,
+ 0, 0, 45, 45, 16, 0, 102, 47, 48, 0,
+ 0, 45, 44, 25, 100, 0, 46, 0, 45, 46,
+ 46, 0, 0, 43, 44, 45, 33, 0, 101, 97,
+ 19, 46, 45, 45, 22, 45, 35, 31, 0, 0,
+ 32, 28, 0, 45, 0, 0, 30, 0, 0, 45,
+ 44, 45, 44, 0, 0, 0, 0, 44, 26, 0,
+ 27, 0, 0, 20, 23, 0, 45, 29, 45, 21,
+ 24, 36, 34
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 21, 153, 22, 55, 24, 154, 26, 197, 181,
- 182, 172, 183, 70, 27, 28, 29, 173, 207, 137,
- 145, 30, 150, 39, 32, 48, 49, 33, 98, 144,
- 162, 34, 86
+ -1, 21, 157, 22, 55, 24, 158, 26, 201, 185,
+ 186, 176, 187, 70, 27, 28, 29, 177, 211, 141,
+ 149, 30, 154, 39, 32, 48, 49, 33, 100, 148,
+ 166, 34, 88
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -156
+#define YYPACT_NINF -159
static const yytype_int16 yypact[] =
{
- 170, -156, -156, -156, -48, 441, -156, -156, 36, 108,
- -156, 39, 43, 45, 326, 5, 50, 326, 326, 326,
- 326, 4, -156, 9, -156, -156, -156, 11, 12, 333,
- 424, -156, -156, -156, -156, 326, 326, 326, -156, 26,
- -156, 51, -156, 54, -156, 63, -156, 16, 18, -156,
- -156, -156, -156, 37, 326, -156, 346, 82, -156, -21,
- 480, 480, 480, 385, -156, -156, 170, 333, 326, 333,
- 61, 407, 326, 326, 326, 326, 326, 326, 326, 326,
- 326, 326, 326, 326, 326, 424, -25, -17, 40, 87,
- -156, -156, 91, -156, 92, 96, 71, -156, -156, 346,
- 100, -156, 326, 326, -156, -156, 55, 424, 57, 363,
- 56, 326, 424, 424, 424, 424, 424, 424, 463, 463,
- 480, 480, 424, 424, 424, -156, 326, -156, -156, -156,
- -156, -156, 106, -156, 424, 424, -156, -2, -156, -156,
- 299, 424, 424, -156, -31, 220, 83, 326, 220, -156,
- -156, 107, 60, -156, -156, 111, 326, 424, 1, -3,
- -156, 113, -156, 101, 424, -156, -156, 103, 119, -156,
- -156, 119, -156, 333, -156, 220, -156, -156, 220, 220,
- -156, 119, 119, -156, 333, 299, -156, 104, 105, 220,
- 125, 128, -156, 56, 116, -156, -156, -156, -156, 129,
- 115, 130, 136, -5, -156, 299, -156, 270, 121, -156,
- -156, 134, 220, -156, -156, -156, -156, -156, -156
+ 174, -159, -159, -159, -43, 439, -159, -159, 25, 116,
+ -159, 30, 33, 31, 312, 13, 49, 312, 312, 312,
+ 312, 4, -159, 8, -159, -159, -159, 9, 11, 319,
+ 420, -159, -159, -159, -159, 312, 312, 312, -159, 5,
+ -159, 53, -159, 80, -159, 65, -159, -1, 1, -159,
+ -159, -159, -159, 36, 312, -159, 334, 50, -159, -22,
+ 482, 482, 482, 377, -159, -159, 174, 319, 312, 319,
+ 61, 401, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 420, -17, -16,
+ 35, 89, -159, -159, 91, -159, 92, 93, 78, -159,
+ -159, 334, 101, -159, 312, 312, -159, -159, 55, 420,
+ 58, 353, 62, 312, 420, 420, 420, 420, 420, 420,
+ 420, 420, 463, 463, 482, 482, 420, 420, 420, -159,
+ 312, -159, -159, -159, -159, -159, 102, -159, 420, 420,
+ -159, -2, -159, -159, 284, 420, 420, -159, -39, 226,
+ 83, 312, 226, -159, -159, 110, 59, -159, -159, 105,
+ 312, 420, 39, -6, -159, 115, -159, 94, 420, -159,
+ -159, 107, 120, -159, -159, 120, -159, 319, -159, 226,
+ -159, -159, 226, 226, -159, 120, 120, -159, 319, 284,
+ -159, 98, 103, 226, 122, 124, -159, 62, 108, -159,
+ -159, -159, -159, 132, 118, 131, 138, -3, -159, 284,
+ -159, 255, 123, -159, -159, 135, 226, -159, -159, -159,
+ -159, -159, -159
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -156, -156, -19, 90, 6, -117, 0, -156, -156, -156,
- 3, -153, -24, -64, -156, -156, -156, -155, -4, -49,
- -114, 2, 7, -156, -156, -156, 112, -156, -156, -156,
- -156, -156, 21
+ -159, -159, -19, 95, 6, -99, 0, -159, -159, -159,
+ 10, -152, -28, -64, -159, -159, -159, -158, -4, -52,
+ -118, 2, 7, -159, -159, -159, 111, -159, -159, -159,
+ -159, -159, 21
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -725,120 +732,120 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -55
static const yytype_int16 yytable[] =
{
- 25, 37, 66, 106, 64, 108, 23, 31, 35, -9,
- -46, 146, 169, 184, 102, 166, 56, 167, 186, 60,
- 61, 62, 63, 149, 65, 148, 184, 93, 103, 186,
- 151, 71, 125, 147, 94, 170, 126, 85, 85, 85,
- 127, 57, 58, 95, 126, 43, 38, 45, 175, 50,
- -46, 178, 179, 96, 51, 52, 99, 87, 88, 65,
- 59, 68, 90, 189, -9, 91, 25, 67, 195, 71,
- 107, 109, 23, 31, 112, 113, 114, 115, 116, 117,
- 118, 119, 120, 121, 122, 123, 124, 89, 213, 212,
- 92, 139, 101, 36, 132, 110, 155, 128, 95, 158,
- 159, 126, 129, 130, 134, 135, 140, 131, 165, 188,
- 133, 65, 136, 141, 138, 177, 143, 160, 156, 40,
- 194, 161, 187, 174, 180, 152, 41, 163, 142, 190,
- 191, 42, 193, 176, 169, 43, 44, 45, 46, 198,
- 199, 200, 196, 47, 201, 208, 204, 209, 206, 157,
- 203, 210, 211, 215, 168, 216, 105, 192, 164, 0,
- 97, 0, 171, 217, 0, 218, 185, 0, 0, 0,
- -5, 1, 0, 0, 202, 71, 0, 2, 3, 4,
- 5, 6, 0, 0, 0, 0, 71, 7, 0, 8,
- 9, 10, 205, 0, 11, 12, 13, 0, 0, 0,
- 0, 14, 15, 16, 0, 0, 0, 214, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 17, 0, 0,
- 18, 19, 0, 0, 0, -5, 20, 2, 3, 4,
- 53, 6, 0, 0, 0, 0, 0, 7, 0, 8,
- 9, 10, 0, 0, 0, 12, 13, 0, 0, 0,
- 0, 14, 15, 16, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 17, 0, 0,
- 18, 19, 0, 0, 0, 65, 20, 2, 3, 4,
- 53, 6, 0, 0, 0, 0, 0, 7, 0, 8,
- 9, 10, 0, 0, 0, 12, 13, 0, 0, 0,
- 0, 14, 15, 16, 0, 0, 2, 3, 4, 53,
- 6, 0, 0, 0, 0, 0, 7, 17, 8, 9,
- 18, 19, 0, 0, 12, 13, 20, 0, 0, 0,
- 14, 0, 16, 2, 3, 4, 53, 6, 0, 0,
- 2, 3, 4, 53, 6, 0, 17, 0, 0, 18,
- 19, 0, 0, 0, 0, 20, 0, 54, 0, 16,
- 0, 0, 0, 0, 54, 0, 16, 0, 100, 0,
- 0, 0, 0, 17, 0, 0, 18, 19, 0, 0,
- 17, 0, 20, 18, 19, 72, 73, 0, 0, 69,
- 74, 75, 76, 0, 77, 0, 78, 79, 80, 81,
- 0, 0, 72, 73, 82, 83, 84, 74, 75, 76,
- 0, 77, 111, 78, 79, 80, 81, 0, 0, 0,
- 104, 82, 83, 84, 72, 73, 0, 0, 0, 74,
- 75, 76, 0, 77, 0, 78, 79, 80, 81, 0,
- 0, 0, 104, 82, 83, 84, 72, 73, 0, 0,
- 0, 74, 75, 76, 0, 77, 111, 78, 79, 80,
- 81, 0, 0, 72, 73, 82, 83, 84, 74, 75,
- 76, 0, 77, 0, 78, 79, 80, 81, 0, 0,
- -54, -54, 82, 83, 84, -54, -54, -54, 0, -54,
+ 25, 37, 66, 108, 64, 110, 23, 31, -9, 173,
+ 95, 150, -46, 104, 188, 35, 56, 96, 65, 60,
+ 61, 62, 63, 190, 155, 152, 97, 188, 43, 105,
+ 45, 71, 174, 151, 190, 38, 98, 87, 87, 87,
+ 50, 52, 129, 131, 51, 153, 130, 130, 179, 57,
+ 58, 182, 183, 170, -46, 171, 101, 89, 90, 59,
+ 103, 65, 68, 193, 92, -9, 25, 67, 91, 71,
+ 109, 111, 23, 31, 114, 115, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 125, 126, 127, 128, 216,
+ 199, 93, 94, 143, 36, 112, 136, 159, 130, 132,
+ 162, 163, 133, 134, 135, 97, 138, 139, 144, 169,
+ 217, 137, 147, 192, 140, 145, 181, 142, 160, 65,
+ 164, 167, 165, 191, 198, 178, 180, 40, 184, 156,
+ 194, 195, 146, 197, 41, 173, 200, 202, 204, 42,
+ 205, 203, 207, 43, 44, 45, 46, 208, 212, 210,
+ 213, 47, 214, 161, 215, 219, 220, 196, 172, 99,
+ 0, 107, 168, 0, 221, 0, 222, 0, 0, 0,
+ 189, 0, 0, 175, -5, 1, 0, 0, 206, 71,
+ 0, 2, 3, 4, 5, 6, 0, 0, 0, 0,
+ 71, 7, 0, 8, 9, 10, 209, 0, 11, 12,
+ 13, 0, 0, 0, 0, 14, 15, 16, 0, 0,
+ 0, 218, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 17, 0, 0, 0, 0, 18, 19, 0, 0,
+ 0, -5, 20, 2, 3, 4, 53, 6, 0, 0,
+ 0, 0, 0, 7, 0, 8, 9, 10, 0, 0,
+ 0, 12, 13, 0, 0, 0, 0, 14, 15, 16,
+ 0, 0, 2, 3, 4, 53, 6, 0, 0, 0,
+ 0, 0, 7, 17, 8, 9, 10, 0, 18, 19,
+ 12, 13, 0, 65, 20, 0, 14, 15, 16, 0,
+ 0, 2, 3, 4, 53, 6, 0, 0, 0, 0,
+ 0, 7, 17, 8, 9, 0, 0, 18, 19, 12,
+ 13, 0, 0, 20, 0, 14, 0, 16, 0, 2,
+ 3, 4, 53, 6, 0, 0, 2, 3, 4, 53,
+ 6, 17, 0, 0, 0, 0, 18, 19, 0, 0,
+ 0, 0, 20, 54, 0, 16, 0, 0, 0, 0,
+ 54, 0, 16, 0, 0, 0, 102, 0, 0, 17,
+ 0, 0, 0, 0, 18, 19, 17, 0, 0, 0,
+ 20, 18, 19, 72, 73, 0, 0, 69, 74, 75,
+ 76, 0, 77, 78, 79, 0, 80, 81, 82, 83,
+ 0, 0, 72, 73, 84, 85, 86, 74, 75, 76,
+ 0, 77, 78, 79, 113, 80, 81, 82, 83, 0,
+ 0, 0, 106, 84, 85, 86, 72, 73, 0, 0,
+ 0, 74, 75, 76, 0, 77, 78, 79, 0, 80,
+ 81, 82, 83, 0, 0, 0, 106, 84, 85, 86,
+ 72, 73, 0, 0, 0, 74, 75, 76, 0, 77,
+ 78, 79, 113, 80, 81, 82, 83, 0, 0, 72,
+ 73, 84, 85, 86, 74, 75, 76, 0, 77, 78,
+ 79, 0, 80, 81, 82, 83, 0, 0, -54, -54,
+ 84, 85, 86, -54, -54, -54, 0, -54, -54, -54,
0, 0, 0, -54, -54, 0, 0, 36, 0, -54,
-54, -54, 72, 73, 0, 0, 0, 74, 75, 76,
- 0, 77, 0, 0, 0, 80, 81, 0, 0, 72,
- 73, 82, 83, 84, 74, 75, 76, 0, 77, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 82, 83,
- 84
+ 0, 77, 78, 79, 0, 0, 0, 82, 83, 0,
+ 0, 72, 73, 84, 85, 86, 74, 75, 76, 0,
+ 77, 78, 79, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 84, 85, 86
};
static const yytype_int16 yycheck[] =
{
- 0, 5, 21, 67, 0, 69, 0, 0, 56, 0,
- 15, 13, 15, 168, 35, 14, 14, 16, 171, 17,
- 18, 19, 20, 140, 55, 139, 181, 11, 49, 182,
- 61, 29, 57, 35, 18, 38, 61, 35, 36, 37,
- 57, 36, 37, 27, 61, 27, 10, 29, 162, 10,
- 55, 165, 166, 35, 11, 10, 54, 36, 37, 55,
- 10, 49, 11, 177, 55, 11, 66, 56, 185, 67,
+ 0, 5, 21, 67, 0, 69, 0, 0, 0, 15,
+ 11, 13, 15, 35, 172, 58, 14, 18, 57, 17,
+ 18, 19, 20, 175, 63, 143, 27, 185, 27, 51,
+ 29, 29, 38, 35, 186, 10, 35, 35, 36, 37,
+ 10, 10, 59, 59, 11, 144, 63, 63, 166, 36,
+ 37, 169, 170, 14, 57, 16, 54, 36, 37, 10,
+ 10, 57, 51, 181, 11, 57, 66, 58, 63, 67,
68, 69, 66, 66, 72, 73, 74, 75, 76, 77,
- 78, 79, 80, 81, 82, 83, 84, 61, 205, 203,
- 27, 110, 10, 56, 98, 34, 145, 10, 27, 148,
- 149, 61, 11, 11, 102, 103, 110, 11, 157, 173,
- 10, 55, 57, 111, 57, 164, 10, 10, 35, 11,
- 184, 61, 171, 10, 21, 144, 18, 16, 126, 178,
- 179, 23, 181, 32, 15, 27, 28, 29, 30, 34,
- 189, 16, 38, 35, 16, 16, 195, 32, 197, 147,
- 34, 21, 16, 32, 158, 21, 66, 181, 156, -1,
- 48, -1, 159, 212, -1, 214, 170, -1, -1, -1,
- 0, 1, -1, -1, 193, 173, -1, 7, 8, 9,
- 10, 11, -1, -1, -1, -1, 184, 17, -1, 19,
- 20, 21, 196, -1, 24, 25, 26, -1, -1, -1,
- -1, 31, 32, 33, -1, -1, -1, 207, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 47, -1, -1,
- 50, 51, -1, -1, -1, 55, 56, 7, 8, 9,
- 10, 11, -1, -1, -1, -1, -1, 17, -1, 19,
- 20, 21, -1, -1, -1, 25, 26, -1, -1, -1,
- -1, 31, 32, 33, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 47, -1, -1,
- 50, 51, -1, -1, -1, 55, 56, 7, 8, 9,
- 10, 11, -1, -1, -1, -1, -1, 17, -1, 19,
- 20, 21, -1, -1, -1, 25, 26, -1, -1, -1,
- -1, 31, 32, 33, -1, -1, 7, 8, 9, 10,
- 11, -1, -1, -1, -1, -1, 17, 47, 19, 20,
- 50, 51, -1, -1, 25, 26, 56, -1, -1, -1,
- 31, -1, 33, 7, 8, 9, 10, 11, -1, -1,
- 7, 8, 9, 10, 11, -1, 47, -1, -1, 50,
- 51, -1, -1, -1, -1, 56, -1, 31, -1, 33,
- -1, -1, -1, -1, 31, -1, 33, -1, 22, -1,
- -1, -1, -1, 47, -1, -1, 50, 51, -1, -1,
- 47, -1, 56, 50, 51, 39, 40, -1, -1, 56,
- 44, 45, 46, -1, 48, -1, 50, 51, 52, 53,
- -1, -1, 39, 40, 58, 59, 60, 44, 45, 46,
- -1, 48, 49, 50, 51, 52, 53, -1, -1, -1,
- 57, 58, 59, 60, 39, 40, -1, -1, -1, 44,
- 45, 46, -1, 48, -1, 50, 51, 52, 53, -1,
- -1, -1, 57, 58, 59, 60, 39, 40, -1, -1,
- -1, 44, 45, 46, -1, 48, 49, 50, 51, 52,
- 53, -1, -1, 39, 40, 58, 59, 60, 44, 45,
- 46, -1, 48, -1, 50, 51, 52, 53, -1, -1,
- 39, 40, 58, 59, 60, 44, 45, 46, -1, 48,
- -1, -1, -1, 52, 53, -1, -1, 56, -1, 58,
- 59, 60, 39, 40, -1, -1, -1, 44, 45, 46,
- -1, 48, -1, -1, -1, 52, 53, -1, -1, 39,
- 40, 58, 59, 60, 44, 45, 46, -1, 48, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 58, 59,
- 60
+ 78, 79, 80, 81, 82, 83, 84, 85, 86, 207,
+ 189, 11, 27, 112, 58, 34, 100, 149, 63, 10,
+ 152, 153, 11, 11, 11, 27, 104, 105, 112, 161,
+ 209, 10, 10, 177, 59, 113, 168, 59, 35, 57,
+ 10, 16, 63, 175, 188, 10, 32, 11, 21, 148,
+ 182, 183, 130, 185, 18, 15, 38, 34, 16, 23,
+ 16, 193, 34, 27, 28, 29, 30, 199, 16, 201,
+ 32, 35, 21, 151, 16, 32, 21, 185, 162, 48,
+ -1, 66, 160, -1, 216, -1, 218, -1, -1, -1,
+ 174, -1, -1, 163, 0, 1, -1, -1, 197, 177,
+ -1, 7, 8, 9, 10, 11, -1, -1, -1, -1,
+ 188, 17, -1, 19, 20, 21, 200, -1, 24, 25,
+ 26, -1, -1, -1, -1, 31, 32, 33, -1, -1,
+ -1, 211, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 47, -1, -1, -1, -1, 52, 53, -1, -1,
+ -1, 57, 58, 7, 8, 9, 10, 11, -1, -1,
+ -1, -1, -1, 17, -1, 19, 20, 21, -1, -1,
+ -1, 25, 26, -1, -1, -1, -1, 31, 32, 33,
+ -1, -1, 7, 8, 9, 10, 11, -1, -1, -1,
+ -1, -1, 17, 47, 19, 20, 21, -1, 52, 53,
+ 25, 26, -1, 57, 58, -1, 31, 32, 33, -1,
+ -1, 7, 8, 9, 10, 11, -1, -1, -1, -1,
+ -1, 17, 47, 19, 20, -1, -1, 52, 53, 25,
+ 26, -1, -1, 58, -1, 31, -1, 33, -1, 7,
+ 8, 9, 10, 11, -1, -1, 7, 8, 9, 10,
+ 11, 47, -1, -1, -1, -1, 52, 53, -1, -1,
+ -1, -1, 58, 31, -1, 33, -1, -1, -1, -1,
+ 31, -1, 33, -1, -1, -1, 22, -1, -1, 47,
+ -1, -1, -1, -1, 52, 53, 47, -1, -1, -1,
+ 58, 52, 53, 39, 40, -1, -1, 58, 44, 45,
+ 46, -1, 48, 49, 50, -1, 52, 53, 54, 55,
+ -1, -1, 39, 40, 60, 61, 62, 44, 45, 46,
+ -1, 48, 49, 50, 51, 52, 53, 54, 55, -1,
+ -1, -1, 59, 60, 61, 62, 39, 40, -1, -1,
+ -1, 44, 45, 46, -1, 48, 49, 50, -1, 52,
+ 53, 54, 55, -1, -1, -1, 59, 60, 61, 62,
+ 39, 40, -1, -1, -1, 44, 45, 46, -1, 48,
+ 49, 50, 51, 52, 53, 54, 55, -1, -1, 39,
+ 40, 60, 61, 62, 44, 45, 46, -1, 48, 49,
+ 50, -1, 52, 53, 54, 55, -1, -1, 39, 40,
+ 60, 61, 62, 44, 45, 46, -1, 48, 49, 50,
+ -1, -1, -1, 54, 55, -1, -1, 58, -1, 60,
+ 61, 62, 39, 40, -1, -1, -1, 44, 45, 46,
+ -1, 48, 49, 50, -1, -1, -1, 54, 55, -1,
+ -1, 39, 40, 60, 61, 62, 44, 45, 46, -1,
+ 48, 49, 50, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 60, 61, 62
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -846,27 +853,28 @@ static const yytype_int16 yycheck[] =
static const yytype_uint8 yystos[] =
{
0, 1, 7, 8, 9, 10, 11, 17, 19, 20,
- 21, 24, 25, 26, 31, 32, 33, 47, 50, 51,
- 56, 63, 65, 66, 67, 68, 69, 76, 77, 78,
- 83, 84, 86, 89, 93, 56, 56, 80, 10, 85,
- 11, 18, 23, 27, 28, 29, 30, 35, 87, 88,
- 10, 11, 10, 10, 31, 66, 83, 36, 37, 10,
- 83, 83, 83, 83, 0, 55, 64, 56, 49, 56,
- 75, 83, 39, 40, 44, 45, 46, 48, 50, 51,
- 52, 53, 58, 59, 60, 83, 94, 94, 94, 61,
- 11, 11, 27, 11, 18, 27, 35, 88, 90, 83,
- 22, 10, 35, 49, 57, 65, 75, 83, 75, 83,
- 34, 49, 83, 83, 83, 83, 83, 83, 83, 83,
- 83, 83, 83, 83, 83, 57, 61, 57, 10, 11,
- 11, 11, 80, 10, 83, 83, 57, 81, 57, 64,
- 80, 83, 83, 10, 91, 82, 13, 35, 82, 67,
- 84, 61, 64, 64, 68, 81, 35, 83, 81, 81,
- 10, 61, 92, 16, 83, 81, 14, 16, 80, 15,
- 38, 72, 73, 79, 10, 82, 32, 81, 82, 82,
- 21, 71, 72, 74, 79, 80, 73, 81, 75, 82,
- 81, 81, 74, 81, 75, 67, 38, 70, 34, 81,
- 16, 16, 64, 34, 81, 80, 81, 80, 16, 32,
- 21, 16, 82, 67, 68, 32, 21, 81, 81
+ 21, 24, 25, 26, 31, 32, 33, 47, 52, 53,
+ 58, 65, 67, 68, 69, 70, 71, 78, 79, 80,
+ 85, 86, 88, 91, 95, 58, 58, 82, 10, 87,
+ 11, 18, 23, 27, 28, 29, 30, 35, 89, 90,
+ 10, 11, 10, 10, 31, 68, 85, 36, 37, 10,
+ 85, 85, 85, 85, 0, 57, 66, 58, 51, 58,
+ 77, 85, 39, 40, 44, 45, 46, 48, 49, 50,
+ 52, 53, 54, 55, 60, 61, 62, 85, 96, 96,
+ 96, 63, 11, 11, 27, 11, 18, 27, 35, 90,
+ 92, 85, 22, 10, 35, 51, 59, 67, 77, 85,
+ 77, 85, 34, 51, 85, 85, 85, 85, 85, 85,
+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 59,
+ 63, 59, 10, 11, 11, 11, 82, 10, 85, 85,
+ 59, 83, 59, 66, 82, 85, 85, 10, 93, 84,
+ 13, 35, 84, 69, 86, 63, 66, 66, 70, 83,
+ 35, 85, 83, 83, 10, 63, 94, 16, 85, 83,
+ 14, 16, 82, 15, 38, 74, 75, 81, 10, 84,
+ 32, 83, 84, 84, 21, 73, 74, 76, 81, 82,
+ 75, 83, 77, 84, 83, 83, 76, 83, 77, 69,
+ 38, 72, 34, 83, 16, 16, 66, 34, 83, 82,
+ 83, 82, 16, 32, 21, 16, 84, 69, 70, 32,
+ 21, 83, 83
};
#define yyerrok (yyerrstatus = 0)
@@ -1681,7 +1689,7 @@ yyreduce:
switch (yyn)
{
case 4:
-#line 97 "engines/director/lingo/lingo-gr.y"
+#line 98 "engines/director/lingo/lingo-gr.y"
{
g_lingo->_linenumber++;
g_lingo->_colnumber = 1;
@@ -1689,17 +1697,17 @@ yyreduce:
break;
case 9:
-#line 106 "engines/director/lingo/lingo-gr.y"
+#line 107 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 11:
-#line 108 "engines/director/lingo/lingo-gr.y"
+#line 109 "engines/director/lingo/lingo-gr.y"
{ yyerrok; ;}
break;
case 12:
-#line 111 "engines/director/lingo/lingo-gr.y"
+#line 112 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str());
@@ -1709,7 +1717,7 @@ yyreduce:
break;
case 13:
-#line 117 "engines/director/lingo/lingo-gr.y"
+#line 118 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1719,7 +1727,7 @@ yyreduce:
break;
case 14:
-#line 123 "engines/director/lingo/lingo-gr.y"
+#line 124 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1729,12 +1737,12 @@ yyreduce:
break;
case 15:
-#line 130 "engines/director/lingo/lingo-gr.y"
+#line 131 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 19:
-#line 139 "engines/director/lingo/lingo-gr.y"
+#line 140 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1744,7 +1752,7 @@ yyreduce:
break;
case 20:
-#line 150 "engines/director/lingo/lingo-gr.y"
+#line 151 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1760,7 +1768,7 @@ yyreduce:
break;
case 21:
-#line 166 "engines/director/lingo/lingo-gr.y"
+#line 167 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1776,7 +1784,7 @@ yyreduce:
break;
case 22:
-#line 180 "engines/director/lingo/lingo-gr.y"
+#line 181 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (8)].code));
@@ -1787,7 +1795,7 @@ yyreduce:
break;
case 23:
-#line 187 "engines/director/lingo/lingo-gr.y"
+#line 188 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1800,7 +1808,7 @@ yyreduce:
break;
case 24:
-#line 196 "engines/director/lingo/lingo-gr.y"
+#line 197 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (12)].code));
@@ -1813,7 +1821,7 @@ yyreduce:
break;
case 25:
-#line 205 "engines/director/lingo/lingo-gr.y"
+#line 206 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1827,7 +1835,7 @@ yyreduce:
break;
case 26:
-#line 215 "engines/director/lingo/lingo-gr.y"
+#line 216 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1841,7 +1849,7 @@ yyreduce:
break;
case 27:
-#line 225 "engines/director/lingo/lingo-gr.y"
+#line 226 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1855,17 +1863,17 @@ yyreduce:
break;
case 28:
-#line 236 "engines/director/lingo/lingo-gr.y"
+#line 237 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = 0; ;}
break;
case 29:
-#line 237 "engines/director/lingo/lingo-gr.y"
+#line 238 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 34:
-#line 248 "engines/director/lingo/lingo-gr.y"
+#line 249 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1875,7 +1883,7 @@ yyreduce:
break;
case 36:
-#line 257 "engines/director/lingo/lingo-gr.y"
+#line 258 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
@@ -1885,22 +1893,22 @@ yyreduce:
break;
case 37:
-#line 265 "engines/director/lingo/lingo-gr.y"
+#line 266 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
case 38:
-#line 266 "engines/director/lingo/lingo-gr.y"
+#line 267 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
case 40:
-#line 269 "engines/director/lingo/lingo-gr.y"
+#line 270 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
case 41:
-#line 271 "engines/director/lingo/lingo-gr.y"
+#line 272 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1909,7 +1917,7 @@ yyreduce:
break;
case 42:
-#line 277 "engines/director/lingo/lingo-gr.y"
+#line 278 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -1918,7 +1926,7 @@ yyreduce:
break;
case 43:
-#line 283 "engines/director/lingo/lingo-gr.y"
+#line 284 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -1928,22 +1936,22 @@ yyreduce:
break;
case 44:
-#line 290 "engines/director/lingo/lingo-gr.y"
+#line 291 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 45:
-#line 292 "engines/director/lingo/lingo-gr.y"
+#line 293 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 46:
-#line 294 "engines/director/lingo/lingo-gr.y"
+#line 295 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 49:
-#line 299 "engines/director/lingo/lingo-gr.y"
+#line 300 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1952,21 +1960,21 @@ yyreduce:
break;
case 50:
-#line 304 "engines/director/lingo/lingo-gr.y"
+#line 305 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
case 51:
-#line 307 "engines/director/lingo/lingo-gr.y"
+#line 308 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_stringpush);
g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;}
break;
case 52:
-#line 310 "engines/director/lingo/lingo-gr.y"
+#line 311 "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));
@@ -1976,7 +1984,7 @@ yyreduce:
break;
case 53:
-#line 316 "engines/director/lingo/lingo-gr.y"
+#line 317 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1988,145 +1996,155 @@ yyreduce:
break;
case 54:
-#line 324 "engines/director/lingo/lingo-gr.y"
+#line 325 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
case 56:
-#line 328 "engines/director/lingo/lingo-gr.y"
+#line 329 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
case 57:
-#line 329 "engines/director/lingo/lingo-gr.y"
+#line 330 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
case 58:
-#line 330 "engines/director/lingo/lingo-gr.y"
+#line 331 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
case 59:
-#line 331 "engines/director/lingo/lingo-gr.y"
+#line 332 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
case 60:
-#line 332 "engines/director/lingo/lingo-gr.y"
+#line 333 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
case 61:
-#line 333 "engines/director/lingo/lingo-gr.y"
+#line 334 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
case 62:
-#line 334 "engines/director/lingo/lingo-gr.y"
+#line 335 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
case 63:
-#line 335 "engines/director/lingo/lingo-gr.y"
+#line 336 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
case 64:
-#line 336 "engines/director/lingo/lingo-gr.y"
+#line 337 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
case 65:
-#line 337 "engines/director/lingo/lingo-gr.y"
+#line 338 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_and); ;}
break;
case 66:
-#line 338 "engines/director/lingo/lingo-gr.y"
+#line 339 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_or); ;}
break;
case 67:
-#line 339 "engines/director/lingo/lingo-gr.y"
+#line 340 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_not); ;}
break;
case 68:
-#line 340 "engines/director/lingo/lingo-gr.y"
+#line 341 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ampersand); ;}
break;
case 69:
-#line 341 "engines/director/lingo/lingo-gr.y"
+#line 342 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_concat); ;}
break;
case 70:
-#line 342 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+#line 343 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_contains); ;}
break;
case 71:
-#line 343 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
+#line 344 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_starts); ;}
break;
case 72:
-#line 344 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+#line 345 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 73:
+#line 346 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
+ break;
+
+ case 74:
#line 347 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+ break;
+
+ case 75:
+#line 350 "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 74:
-#line 348 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 351 "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 75:
-#line 349 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 352 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 77:
-#line 351 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 354 "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 79:
-#line 356 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 359 "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 80:
-#line 357 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 360 "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 81:
-#line 368 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 371 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 82:
-#line 369 "engines/director/lingo/lingo-gr.y"
+ case 84:
+#line 372 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 83:
-#line 370 "engines/director/lingo/lingo-gr.y"
+ case 85:
+#line 373 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 84:
-#line 371 "engines/director/lingo/lingo-gr.y"
+ case 86:
+#line 374 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2134,8 +2152,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 85:
-#line 376 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 379 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2144,8 +2162,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 86:
-#line 382 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 385 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2153,48 +2171,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 87:
-#line 389 "engines/director/lingo/lingo-gr.y"
+ case 89:
+#line 392 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 88:
-#line 390 "engines/director/lingo/lingo-gr.y"
+ case 90:
+#line 393 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 89:
-#line 391 "engines/director/lingo/lingo-gr.y"
+ case 91:
+#line 394 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 90:
-#line 392 "engines/director/lingo/lingo-gr.y"
+ case 92:
+#line 395 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 91:
-#line 395 "engines/director/lingo/lingo-gr.y"
+ case 93:
+#line 398 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 92:
-#line 396 "engines/director/lingo/lingo-gr.y"
+ case 94:
+#line 399 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 93:
-#line 397 "engines/director/lingo/lingo-gr.y"
+ case 95:
+#line 400 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 94:
-#line 425 "engines/director/lingo/lingo-gr.y"
+ case 96:
+#line 428 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 95:
-#line 426 "engines/director/lingo/lingo-gr.y"
+ case 97:
+#line 429 "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);
@@ -2202,33 +2220,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 96:
-#line 432 "engines/director/lingo/lingo-gr.y"
+ case 98:
+#line 435 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 97:
-#line 433 "engines/director/lingo/lingo-gr.y"
+ case 99:
+#line 436 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 98:
-#line 434 "engines/director/lingo/lingo-gr.y"
+ case 100:
+#line 437 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 99:
-#line 435 "engines/director/lingo/lingo-gr.y"
+ case 101:
+#line 438 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 100:
-#line 437 "engines/director/lingo/lingo-gr.y"
+ case 102:
+#line 440 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 101:
-#line 440 "engines/director/lingo/lingo-gr.y"
+ case 103:
+#line 443 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2237,24 +2255,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 102:
-#line 448 "engines/director/lingo/lingo-gr.y"
+ case 104:
+#line 451 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 103:
-#line 449 "engines/director/lingo/lingo-gr.y"
+ case 105:
+#line 452 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 104:
-#line 450 "engines/director/lingo/lingo-gr.y"
+ case 106:
+#line 453 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2258 "engines/director/lingo/lingo-gr.cpp"
+#line 2276 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2468,6 +2486,6 @@ yyreturn:
}
-#line 453 "engines/director/lingo/lingo-gr.y"
+#line 456 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index a22d489..3c349b7 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -84,7 +84,9 @@
tAND = 300,
tOR = 301,
tNOT = 302,
- tCONCAT = 303
+ tCONCAT = 303,
+ tCONTAINS = 304,
+ tSTARTS = 305
};
#endif
/* Tokens. */
@@ -134,6 +136,8 @@
#define tOR 301
#define tNOT 302
#define tCONCAT 303
+#define tCONTAINS 304
+#define tSTARTS 305
@@ -149,7 +153,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 153 "engines/director/lingo/lingo-gr.hpp"
+#line 157 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 155b615..d0618af 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -77,7 +77,8 @@ using namespace Director;
%token tDOWN tELSE tNLELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
%token tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO
%token tWITH tWHILE tNLELSE
-%token tGE tLE tGT tLT tEQ tNEQ tAND tOR tNOT tCONCAT
+%token tGE tLE tGT tLT tEQ tNEQ tAND tOR tNOT
+%token tCONCAT tCONTAINS tSTARTS
%type<code> asgn begin elseif elsestmtoneliner end expr if repeatwhile repeatwith stmtlist
%type<s> gotoframe gotomovie
@@ -339,6 +340,8 @@ expr: INT {
| tNOT expr %prec UNARY { g_lingo->code1(g_lingo->c_not); }
| expr '&' expr { g_lingo->code1(g_lingo->c_ampersand); }
| expr tCONCAT expr { g_lingo->code1(g_lingo->c_concat); }
+ | expr tCONTAINS expr { g_lingo->code1(g_lingo->c_contains); }
+ | expr tSTARTS expr { g_lingo->code1(g_lingo->c_starts); }
| '+' expr %prec UNARY { $$ = $2; }
| '-' expr %prec UNARY { $$ = $2; g_lingo->code1(g_lingo->c_negate); }
| '(' expr ')' { $$ = $2; }
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 0a0af11..b419574 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 44
-#define YY_END_OF_BUFFER 45
+#define YY_NUM_RULES 46
+#define YY_END_OF_BUFFER 47
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,23 +373,25 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[139] =
+static yyconst flex_int16_t yy_accept[152] =
{ 0,
- 0, 0, 45, 43, 3, 41, 41, 43, 43, 40,
- 40, 40, 39, 40, 40, 37, 37, 37, 37, 37,
- 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
- 37, 2, 2, 3, 41, 0, 0, 41, 0, 42,
- 36, 1, 38, 39, 35, 33, 34, 37, 37, 37,
- 37, 37, 37, 37, 37, 14, 6, 37, 37, 37,
- 37, 37, 37, 37, 23, 24, 37, 37, 37, 37,
- 37, 30, 37, 37, 2, 2, 0, 1, 38, 4,
- 37, 37, 10, 37, 37, 37, 37, 37, 37, 18,
- 37, 37, 22, 37, 26, 37, 28, 37, 37, 37,
-
- 0, 5, 9, 11, 37, 37, 15, 16, 37, 37,
- 37, 21, 37, 37, 29, 37, 31, 0, 12, 37,
- 17, 37, 20, 37, 37, 32, 8, 13, 37, 37,
- 27, 0, 19, 37, 0, 25, 7, 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,
+ 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, 0, 39, 13, 39, 18, 39,
+ 21, 39, 39, 39, 34, 9, 39, 14, 39, 39,
+ 28, 30, 0, 39, 20, 39, 0, 5, 26, 8,
+ 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -434,95 +436,98 @@ static yyconst flex_int32_t yy_meta[58] =
4, 4, 4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[142] =
+static yyconst flex_int16_t yy_base[155] =
{ 0,
- 0, 56, 149, 335, 60, 64, 68, 72, 138, 335,
- 131, 128, 49, 65, 121, 53, 0, 53, 57, 53,
- 60, 69, 58, 82, 94, 78, 61, 97, 99, 102,
- 103, 150, 154, 158, 124, 162, 131, 166, 126, 335,
- 335, 0, 89, 131, 335, 335, 335, 0, 105, 138,
- 143, 157, 153, 162, 151, 0, 0, 148, 153, 165,
- 160, 151, 150, 155, 0, 0, 169, 158, 162, 160,
- 174, 0, 173, 171, 217, 223, 184, 0, 84, 0,
- 187, 197, 0, 191, 203, 201, 203, 203, 203, 199,
- 213, 208, 0, 207, 0, 218, 0, 215, 218, 223,
-
- 216, 0, 0, 0, 229, 234, 0, 0, 223, 241,
- 238, 0, 237, 250, 0, 247, 0, 250, 0, 248,
- 0, 251, 0, 248, 245, 0, 85, 0, 248, 248,
- 0, 281, 0, 253, 265, 0, 335, 335, 326, 88,
- 330
+ 0, 56, 186, 352, 60, 64, 68, 72, 173, 352,
+ 143, 141, 49, 65, 132, 53, 0, 53, 54, 58,
+ 54, 61, 70, 59, 83, 95, 79, 62, 98, 105,
+ 103, 104, 138, 151, 157, 125, 161, 165, 169, 132,
+ 352, 352, 0, 108, 123, 352, 352, 352, 0, 117,
+ 141, 134, 144, 158, 154, 163, 152, 0, 0, 149,
+ 154, 166, 162, 153, 152, 159, 0, 0, 173, 162,
+ 166, 165, 189, 191, 0, 188, 181, 217, 225, 192,
+ 0, 85, 0, 191, 197, 206, 0, 199, 209, 220,
+ 211, 211, 211, 207, 214, 211, 0, 212, 0, 229,
+
+ 0, 220, 224, 228, 232, 226, 240, 0, 0, 0,
+ 246, 251, 0, 0, 240, 254, 254, 0, 252, 264,
+ 249, 0, 263, 0, 264, 261, 0, 261, 0, 267,
+ 0, 264, 261, 263, 0, 86, 269, 0, 266, 266,
+ 0, 0, 298, 277, 0, 278, 290, 0, 0, 352,
+ 352, 343, 89, 347
} ;
-static yyconst flex_int16_t yy_def[142] =
+static yyconst flex_int16_t yy_def[155] =
{ 0,
- 138, 1, 138, 138, 138, 138, 138, 138, 139, 138,
- 138, 138, 138, 138, 138, 140, 140, 140, 140, 140,
- 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
- 140, 138, 138, 138, 138, 138, 138, 138, 139, 138,
- 138, 141, 138, 138, 138, 138, 138, 140, 140, 140,
- 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
- 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
- 140, 140, 140, 140, 138, 138, 138, 141, 138, 140,
- 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
- 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
-
- 138, 140, 140, 140, 140, 140, 140, 140, 140, 140,
- 140, 140, 140, 140, 140, 140, 140, 138, 140, 140,
- 140, 140, 140, 140, 140, 140, 138, 140, 140, 140,
- 140, 138, 140, 140, 138, 140, 138, 0, 138, 138,
- 138
+ 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, 152,
+ 151, 151, 154, 151, 151, 151, 151, 151, 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, 151,
+ 0, 151, 151, 151
} ;
-static yyconst flex_int16_t yy_nxt[393] =
+static yyconst flex_int16_t yy_nxt[410] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
- 13, 14, 10, 15, 16, 17, 17, 18, 19, 20,
- 21, 17, 22, 17, 23, 24, 25, 26, 27, 28,
- 29, 30, 17, 17, 31, 17, 16, 17, 17, 18,
- 19, 20, 21, 17, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 17, 17, 31, 17, 32, 43, 44,
- 33, 34, 35, 35, 36, 37, 38, 38, 37, 37,
- 38, 38, 37, 36, 35, 35, 36, 45, 46, 49,
- 50, 51, 54, 52, 55, 59, 132, 56, 57, 132,
- 67, 48, 53, 68, 79, 58, 60, 65, 61, 79,
-
- 49, 50, 51, 54, 52, 55, 59, 66, 56, 62,
- 57, 67, 63, 53, 68, 69, 58, 70, 60, 65,
- 61, 64, 80, 71, 73, 74, 35, 35, 66, 72,
- 62, 40, 37, 47, 63, 37, 42, 69, 41, 70,
- 43, 44, 64, 40, 80, 71, 73, 74, 138, 77,
- 72, 75, 35, 35, 76, 76, 35, 35, 76, 34,
- 35, 35, 36, 36, 35, 35, 36, 37, 38, 38,
- 37, 77, 81, 82, 83, 84, 85, 138, 86, 87,
- 88, 89, 90, 138, 91, 92, 93, 94, 138, 95,
- 96, 97, 98, 81, 82, 99, 83, 84, 85, 86,
-
- 87, 88, 100, 89, 90, 91, 92, 93, 101, 94,
- 95, 96, 97, 102, 98, 103, 106, 99, 75, 35,
- 35, 76, 104, 100, 76, 35, 35, 76, 105, 101,
- 107, 108, 109, 110, 102, 111, 114, 103, 106, 112,
- 113, 115, 116, 104, 117, 138, 118, 119, 120, 105,
- 121, 107, 108, 109, 110, 122, 123, 111, 114, 124,
- 112, 113, 115, 116, 125, 126, 117, 118, 127, 119,
- 120, 121, 128, 129, 138, 130, 131, 122, 123, 133,
- 134, 124, 132, 136, 137, 132, 125, 126, 138, 138,
- 127, 138, 138, 128, 138, 129, 130, 131, 138, 138,
-
- 133, 134, 138, 135, 136, 138, 137, 138, 138, 138,
- 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
- 138, 138, 138, 138, 138, 135, 39, 138, 39, 39,
- 78, 138, 138, 78, 3, 138, 138, 138, 138, 138,
- 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
- 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
- 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
- 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
- 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
- 138, 138
-
+ 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, 44, 45,
+ 34, 35, 36, 36, 37, 38, 39, 39, 38, 38,
+ 39, 39, 38, 37, 36, 36, 37, 46, 47, 50,
+ 51, 52, 53, 56, 54, 57, 61, 143, 58, 59,
+ 143, 69, 49, 55, 70, 82, 60, 62, 67, 63,
+
+ 50, 51, 52, 53, 56, 54, 57, 61, 68, 58,
+ 64, 59, 69, 65, 55, 70, 71, 60, 82, 62,
+ 67, 63, 66, 72, 74, 76, 77, 36, 36, 68,
+ 75, 64, 44, 45, 83, 65, 73, 41, 71, 78,
+ 36, 36, 79, 66, 48, 72, 74, 76, 77, 43,
+ 42, 75, 79, 36, 36, 79, 83, 73, 35, 36,
+ 36, 37, 37, 36, 36, 37, 38, 84, 85, 38,
+ 38, 39, 39, 38, 86, 87, 88, 89, 41, 90,
+ 91, 92, 93, 80, 94, 151, 95, 96, 84, 85,
+ 97, 98, 151, 99, 100, 86, 101, 87, 88, 89,
+
+ 90, 91, 92, 102, 93, 80, 94, 95, 96, 103,
+ 104, 97, 105, 98, 99, 100, 106, 101, 78, 36,
+ 36, 79, 107, 108, 109, 102, 79, 36, 36, 79,
+ 110, 103, 104, 105, 111, 112, 117, 106, 113, 114,
+ 115, 116, 118, 107, 108, 119, 109, 120, 151, 121,
+ 122, 110, 123, 124, 126, 111, 125, 112, 117, 113,
+ 114, 115, 116, 118, 127, 128, 119, 129, 130, 120,
+ 121, 122, 131, 123, 132, 124, 126, 125, 133, 151,
+ 134, 135, 136, 137, 151, 138, 127, 128, 129, 139,
+ 130, 140, 141, 142, 131, 144, 132, 145, 146, 143,
+
+ 133, 134, 143, 135, 136, 137, 138, 148, 149, 150,
+ 151, 139, 140, 141, 142, 151, 144, 151, 145, 146,
+ 147, 151, 151, 151, 151, 151, 151, 151, 148, 149,
+ 151, 150, 151, 151, 151, 151, 151, 151, 151, 151,
+ 151, 151, 147, 40, 151, 40, 40, 81, 151, 151,
+ 81, 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
} ;
-static yyconst flex_int16_t yy_chk[393] =
+static yyconst flex_int16_t yy_chk[410] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -532,42 +537,43 @@ static yyconst flex_int16_t yy_chk[393] =
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, 20, 19, 21, 23, 127, 21, 22, 127,
- 27, 140, 19, 27, 79, 22, 24, 26, 24, 43,
-
- 16, 18, 19, 20, 19, 21, 23, 26, 21, 24,
- 22, 27, 25, 19, 27, 28, 22, 29, 24, 26,
- 24, 25, 49, 30, 31, 31, 35, 35, 26, 30,
- 24, 39, 37, 15, 25, 37, 12, 28, 11, 29,
- 44, 44, 25, 9, 49, 30, 31, 31, 3, 37,
- 30, 32, 32, 32, 32, 33, 33, 33, 33, 34,
- 34, 34, 34, 36, 36, 36, 36, 38, 38, 38,
- 38, 37, 50, 51, 52, 53, 54, 0, 55, 58,
- 59, 60, 61, 0, 62, 63, 64, 67, 0, 68,
- 69, 70, 71, 50, 51, 73, 52, 53, 54, 55,
-
- 58, 59, 74, 60, 61, 62, 63, 64, 77, 67,
- 68, 69, 70, 81, 71, 82, 86, 73, 75, 75,
- 75, 75, 84, 74, 76, 76, 76, 76, 85, 77,
- 87, 88, 89, 90, 81, 91, 96, 82, 86, 92,
- 94, 98, 99, 84, 100, 0, 101, 105, 106, 85,
- 109, 87, 88, 89, 90, 110, 111, 91, 96, 113,
- 92, 94, 98, 99, 114, 116, 100, 101, 118, 105,
- 106, 109, 120, 122, 0, 124, 125, 110, 111, 129,
- 130, 113, 132, 134, 135, 132, 114, 116, 0, 0,
- 118, 0, 0, 120, 0, 122, 124, 125, 0, 0,
-
- 129, 130, 0, 132, 134, 0, 135, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 132, 139, 0, 139, 139,
- 141, 0, 0, 141, 138, 138, 138, 138, 138, 138,
- 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
- 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
- 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
- 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
- 138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
- 138, 138
-
+ 18, 19, 20, 21, 20, 22, 24, 136, 22, 23,
+ 136, 28, 153, 20, 28, 82, 23, 25, 27, 25,
+
+ 16, 18, 19, 20, 21, 20, 22, 24, 27, 22,
+ 25, 23, 28, 26, 20, 28, 29, 23, 44, 25,
+ 27, 25, 26, 30, 31, 32, 32, 36, 36, 27,
+ 31, 25, 45, 45, 50, 26, 30, 40, 29, 33,
+ 33, 33, 33, 26, 15, 30, 31, 32, 32, 12,
+ 11, 31, 34, 34, 34, 34, 50, 30, 35, 35,
+ 35, 35, 37, 37, 37, 37, 38, 51, 52, 38,
+ 39, 39, 39, 39, 53, 54, 55, 56, 9, 57,
+ 60, 61, 62, 38, 63, 3, 64, 65, 51, 52,
+ 66, 69, 0, 70, 71, 53, 72, 54, 55, 56,
+
+ 57, 60, 61, 73, 62, 38, 63, 64, 65, 74,
+ 76, 66, 77, 69, 70, 71, 80, 72, 78, 78,
+ 78, 78, 84, 85, 86, 73, 79, 79, 79, 79,
+ 88, 74, 76, 77, 89, 90, 95, 80, 91, 92,
+ 93, 94, 96, 84, 85, 98, 86, 100, 0, 102,
+ 103, 88, 104, 105, 107, 89, 106, 90, 95, 91,
+ 92, 93, 94, 96, 111, 112, 98, 115, 116, 100,
+ 102, 103, 117, 104, 119, 105, 107, 106, 120, 0,
+ 121, 123, 125, 126, 0, 128, 111, 112, 115, 130,
+ 116, 132, 133, 134, 117, 137, 119, 139, 140, 143,
+
+ 120, 121, 143, 123, 125, 126, 128, 144, 146, 147,
+ 0, 130, 132, 133, 134, 0, 137, 0, 139, 140,
+ 143, 0, 0, 0, 0, 0, 0, 0, 144, 146,
+ 0, 147, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 143, 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
} ;
static yy_state_type yy_last_accepting_state;
@@ -630,7 +636,7 @@ static void countnl() {
Director::g_lingo->_colnumber = strlen(p);
}
-#line 634 "engines/director/lingo/lingo-lex.cpp"
+#line 640 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -818,7 +824,7 @@ YY_DECL
#line 58 "engines/director/lingo/lingo-lex.l"
-#line 822 "engines/director/lingo/lingo-lex.cpp"
+#line 828 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -872,13 +878,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 >= 139 )
+ if ( yy_current_state >= 152 )
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] != 335 );
+ while ( yy_base[yy_current_state] != 352 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -925,168 +931,178 @@ YY_RULE_SETUP
case 5:
YY_RULE_SETUP
#line 65 "engines/director/lingo/lingo-lex.l"
-{ count(); return tDOWN; }
+{ count(); return tCONTAINS; }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 66 "engines/director/lingo/lingo-lex.l"
-{ count(); return tIF; }
+{ count(); return tDOWN; }
YY_BREAK
case 7:
-/* rule 7 can match eol */
YY_RULE_SETUP
#line 67 "engines/director/lingo/lingo-lex.l"
-{ countnl(); return tNLELSIF; }
+{ count(); return tIF; }
YY_BREAK
case 8:
/* rule 8 can match eol */
YY_RULE_SETUP
#line 68 "engines/director/lingo/lingo-lex.l"
-{ countnl(); return tNLELSE; }
+{ countnl(); return tNLELSIF; }
YY_BREAK
case 9:
+/* rule 9 can match eol */
YY_RULE_SETUP
#line 69 "engines/director/lingo/lingo-lex.l"
-{ count(); return tELSE; }
+{ countnl(); return tNLELSE; }
YY_BREAK
case 10:
YY_RULE_SETUP
#line 70 "engines/director/lingo/lingo-lex.l"
-{ count(); return tEND; }
+{ count(); return tELSE; }
YY_BREAK
case 11:
YY_RULE_SETUP
#line 71 "engines/director/lingo/lingo-lex.l"
-{ count(); return tEXIT; }
+{ count(); return tEND; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 72 "engines/director/lingo/lingo-lex.l"
-{ count(); return tFRAME; }
+{ count(); return tEXIT; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 73 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGLOBAL; }
+{ count(); return tFRAME; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 74 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGO; }
+{ count(); return tGLOBAL; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 75 "engines/director/lingo/lingo-lex.l"
-{ count(); return tINTO; }
+{ count(); return tGO; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 76 "engines/director/lingo/lingo-lex.l"
-{ count(); return tLOOP; }
+{ count(); return tINTO; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 77 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMACRO; }
+{ count(); return tLOOP; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 78 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMCI; }
+{ count(); return tMACRO; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 79 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMCIWAIT; }
+{ count(); return tMCI; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 80 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMOVIE; }
+{ count(); return tMCIWAIT; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 81 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNEXT; }
+{ count(); return tMOVIE; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 82 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNOT; }
+{ count(); return tNEXT; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 83 "engines/director/lingo/lingo-lex.l"
-{ count(); return tOF; }
+{ count(); return tNOT; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 84 "engines/director/lingo/lingo-lex.l"
-{ count(); return tOR; }
+{ count(); return tOF; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 85 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPREVIOUS; }
+{ count(); return tOR; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 86 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPUT; }
+{ count(); return tPREVIOUS; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 87 "engines/director/lingo/lingo-lex.l"
-{ count(); return tREPEAT; }
+{ count(); return tPUT; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 88 "engines/director/lingo/lingo-lex.l"
-{ count(); return tSET; }
+{ count(); return tREPEAT; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 89 "engines/director/lingo/lingo-lex.l"
-{ count(); return tTHEN; }
+{ count(); return tSET; }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 90 "engines/director/lingo/lingo-lex.l"
-{ count(); return tTO; }
+{ count(); return tSTARTS; }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 91 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWITH; }
+{ count(); return tTHEN; }
YY_BREAK
case 32:
YY_RULE_SETUP
#line 92 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWHILE; }
+{ count(); return tTO; }
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 94 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNEQ; }
+#line 93 "engines/director/lingo/lingo-lex.l"
+{ count(); return tWITH; }
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 95 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGE; }
+#line 94 "engines/director/lingo/lingo-lex.l"
+{ count(); return tWHILE; }
YY_BREAK
case 35:
YY_RULE_SETUP
#line 96 "engines/director/lingo/lingo-lex.l"
-{ count(); return tLE; }
+{ count(); return tNEQ; }
YY_BREAK
case 36:
YY_RULE_SETUP
#line 97 "engines/director/lingo/lingo-lex.l"
-{ count(); return tCONCAT; }
+{ count(); return tGE; }
YY_BREAK
case 37:
YY_RULE_SETUP
+#line 98 "engines/director/lingo/lingo-lex.l"
+{ count(); return tLE; }
+ YY_BREAK
+case 38:
+YY_RULE_SETUP
#line 99 "engines/director/lingo/lingo-lex.l"
+{ count(); return tCONCAT; }
+ YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 101 "engines/director/lingo/lingo-lex.l"
{
count();
yylval.s = new Common::String(yytext);
@@ -1097,43 +1113,43 @@ YY_RULE_SETUP
return ID;
}
YY_BREAK
-case 38:
-YY_RULE_SETUP
-#line 108 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.f = atof(yytext); return FLOAT; }
- YY_BREAK
-case 39:
-YY_RULE_SETUP
-#line 109 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
- YY_BREAK
case 40:
YY_RULE_SETUP
#line 110 "engines/director/lingo/lingo-lex.l"
-{ count(); return *yytext; }
+{ count(); yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 41:
-/* rule 41 can match eol */
YY_RULE_SETUP
#line 111 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 42:
YY_RULE_SETUP
#line 112 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ count(); return *yytext; }
YY_BREAK
case 43:
+/* rule 43 can match eol */
YY_RULE_SETUP
#line 113 "engines/director/lingo/lingo-lex.l"
-
+{ return '\n'; }
YY_BREAK
case 44:
YY_RULE_SETUP
+#line 114 "engines/director/lingo/lingo-lex.l"
+{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+ YY_BREAK
+case 45:
+YY_RULE_SETUP
#line 115 "engines/director/lingo/lingo-lex.l"
+
+ YY_BREAK
+case 46:
+YY_RULE_SETUP
+#line 117 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1137 "engines/director/lingo/lingo-lex.cpp"
+#line 1153 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1426,7 +1442,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 >= 139 )
+ if ( yy_current_state >= 152 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1454,11 +1470,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 >= 139 )
+ if ( yy_current_state >= 152 )
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 == 138);
+ yy_is_jam = (yy_current_state == 151);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2133,7 +2149,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 115 "engines/director/lingo/lingo-lex.l"
+#line 117 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index d241993..6a78a3f 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -62,6 +62,7 @@ whitespace [\t ]
[\t]+ { count(); return ' '; }
(?i:and) { count(); return tAND; }
+(?i:contains) { count(); return tCONTAINS; }
(?i:down) { count(); return tDOWN; }
(?i:if) { count(); return tIF; }
(?i:[\n\r]+[\t ]+else[\t ]+if) { countnl(); return tNLELSIF; }
@@ -86,6 +87,7 @@ whitespace [\t ]
(?i:put) { count(); return tPUT; }
(?i:repeat) { count(); return tREPEAT; }
(?i:set) { count(); return tSET; }
+(?i:starts) { count(); return tSTARTS; }
(?i:then) { count(); return tTHEN; }
(?i:to) { count(); return tTO; }
(?i:with) { count(); return tWITH; }
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 9ec89ff..9fe17f3 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -222,8 +222,9 @@ Common::String *Datum::toString() {
case STRING:
delete s;
s = u.s;
+ break;
default:
- warning("Incorrect operation toInt() for type: %s", type2str());
+ warning("Incorrect operation toString() for type: %s", type2str());
}
u.s = s;
@@ -250,4 +251,44 @@ const char *Datum::type2str() {
}
}
+// This is table for built-in Macintosh font lowercasing.
+// '.' means that the symbol should be not changed, rest
+// of the symbols are stripping the diacritics
+// The table starts from 0x80
+//
+// TODO: Check it for correctness.
+static char lowerCaseConvert[] =
+"aacenoua" // 80
+"aaaaacee" // 88
+"eeiiiino" // 90
+"oooouuuu" // 98
+"........" // a0
+".......o" // a8
+"........" // b0
+".......o" // b8
+"........" // c0
+".. aao.." // c8
+"--.....y";// d0-d8
+
+Common::String *Lingo::toLowercaseMac(Common::String *s) {
+ Common::String *res = new Common::String;
+ const unsigned char *p = (const unsigned char *)s->c_str();
+
+ while (*p) {
+ if (*p >= 0x80 && *p <= 0xd8) {
+ if (lowerCaseConvert[*p - 0x80] != '.')
+ *res += lowerCaseConvert[*p - 0x80];
+ else
+ *res += *p;
+ } else if (*p < 0x80) {
+ *res += tolower(*p);
+ } else {
+ error("Unacceptable symbol in toLowercaseMac: %c", *p);
+ }
+ p++;
+ }
+
+ return res;
+}
+
} // End of namespace Director
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 162bb5f..f3b36f9 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -142,6 +142,8 @@ public:
void initBuiltIns();
+ Common::String *toLowercaseMac(Common::String *s);
+
public:
void execute(int pc);
void pushContext();
@@ -188,6 +190,8 @@ public:
static void c_ampersand();
static void c_concat();
+ static void c_contains();
+ static void c_starts();
static void c_constpush();
static void c_fconstpush();
Commit: 0b64438dbd3b2ff3579b47da9a46b274b2acde79
https://github.com/scummvm/scummvm/commit/0b64438dbd3b2ff3579b47da9a46b274b2acde79
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Added more 'the' entities. Implemented the floatPrecision entity
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-the.cpp
engines/director/lingo/lingo-the.h
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 107a9a5..5a6c8ec 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -120,7 +120,7 @@ Common::Error DirectorEngine::run() {
if x = 1 then\n\
put 1\n\
else if x = 2 then\n\
- put 2.1\n\
+ put 1232.12345678901234\n\
put 2.2\n\
else if x = 3 then put 3\n\
end if\n\
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 817f9c9..f7dc403 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -80,7 +80,7 @@ void Lingo::c_printtop(void) {
warning("%d", d.u.i);
break;
case FLOAT:
- warning("%f", d.u.f);
+ warning(g_lingo->_floatPrecisionFormat.c_str(), d.u.f);
break;
case VAR:
if (!d.u.sym) {
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index b3c0702..410be8e 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -31,38 +31,47 @@ static struct TheEntityProto {
const char *name;
int hasID;
} entities[] = {
- { kTheFrame, "frame", VOID },
- { kThePathName, "pathname", VOID },
- { kTheMovie, "movie", VOID },
- { kTheMouseH, "mouseh", VOID },
- { kTheMouseV, "mousev", VOID },
- { kTheMouseDownScript, "mouseDownScript", VOID },
- { kTheMouseUpScript, "mouseUpScript", VOID },
+ { kTheCast, "cast", INT }, // string?
{ kTheClickOn, "clickOn", VOID },
+ { kTheColorDepth, "colorDepth", VOID },
+ { kTheColorQD, "colorQD", VOID },
+ { kTheCommandDown, "commandDown", VOID },
+ { kTheControlDown, "controlDown", VOID },
{ kTheDoubleClick, "doubleClick", VOID },
+ { kTheExitLock, "exitlock", VOID },
+ { kTheFloatPrecision, "floatPrecision", VOID },
+ { kTheFrame, "frame", VOID },
+ { kTheItemDelimiter, "itemDelimiter", VOID },
+ { kTheKey, "key", VOID },
{ kTheLastClick, "lastClick", VOID },
- { kTheLastFrame, "lastFrame", VOID },
{ kTheLastEvent, "lastEvent", VOID },
- { kTheMouseUp, "mouseUp", VOID },
- { kTheMouseDown, "mouseDown", VOID },
- { kTheRightMouseUp, "rightMouseUp", VOID },
- { kTheRightMouseDown, "rightMouseDown", VOID },
- { kTheStillDown, "stillDown", VOID },
- { kTheKey, "key", VOID },
- { kTheControlDown, "controlDown", VOID },
- { kTheCommandDown, "commandDown", VOID },
- { kTheShiftDown, "shiftDown", VOID },
- { kTheOptionDown, "optionDown", VOID },
+ { kTheLastFrame, "lastFrame", VOID },
{ kTheMenu, "menu", INT },
{ kTheMenus, "menus", VOID },
{ kTheMenuItem, "menuitem", STRING }, // int?
{ kTheMenuItems, "menuitems", VOID },
- { kTheSprite, "sprite", INT },
- { kTheCast, "cast", INT }, // string?
+ { kTheMouseDown, "mouseDown", VOID },
+ { kTheMouseDownScript, "mouseDownScript", VOID },
+ { kTheMouseH, "mouseh", VOID },
+ { kTheMouseUp, "mouseUp", VOID },
+ { kTheMouseUpScript, "mouseUpScript", VOID },
+ { kTheMouseV, "mousev", VOID },
+ { kTheMovie, "movie", VOID },
+ { kTheMultiSound, "multiSound", VOID },
+ { kTheOptionDown, "optionDown", VOID },
+ { kThePathName, "pathname", VOID },
{ kThePerFrameHook, "perframehook", VOID },
+ { kThePreloadEventAbort,"preloadEventAbort",VOID },
+ { kTheRightMouseDown, "rightMouseDown", VOID },
+ { kTheRightMouseUp, "rightMouseUp", VOID },
+ { kTheRomanLingo, "romanLingo", VOID },
+ { kTheShiftDown, "shiftDown", VOID },
+ { kTheSprite, "sprite", INT },
+ { kTheStage, "stage", VOID },
+ { kTheStillDown, "stillDown", VOID },
{ kTheTicks, "ticks", VOID },
- { kTheTimer, "timer", VOID },
{ kTheTimeoutLength, "timeoutlength", VOID },
+ { kTheTimer, "timer", VOID },
{ kTheWindow, "window", VOID },
{ kTheNOEntity, NULL, false }
};
@@ -72,47 +81,47 @@ static struct TheEntityFieldProto {
const char *name;
TheField field;
} fields[] = {
- { kTheSprite, "castnum", kTheCastNum },
- { kTheSprite, "cursor", kTheCursor },
- { kTheSprite, "loch", kTheLocH },
- { kTheSprite, "locv", kTheLocV },
- { kTheSprite, "backColor", kTheBackColor },
- { kTheSprite, "blend", kTheBlend },
- { kTheSprite, "bottom", kTheBottom },
- { kTheSprite, "constraint", kTheConstraint },
- { kTheSprite, "editableText", kTheEditableText },
- { kTheSprite, "foreColor", kTheForeColor },
- { kTheSprite, "height", kTheHeight },
- { kTheSprite, "ink", kTheInk },
- { kTheSprite, "left", kTheLeft },
- { kTheSprite, "lineSize", kTheLineSize },
- { kTheSprite, "moveable", kTheMoveable },
- { kTheSprite, "movieRate", kTheMovieRate },
- { kTheSprite, "movieTime", kTheMovieTime },
- { kTheSprite, "right", kTheRight },
- { kTheSprite, "stopTime", kTheStopTime },
- { kTheSprite, "stretch", kTheStrech },
- { kTheSprite, "startTime", kTheStartTime },
- { kTheSprite, "scriptNum", kTheScriptNum },
- { kTheSprite, "top", kTheTop },
- { kTheSprite, "trails", kTheTrails },
- { kTheSprite, "type", kTheType },
- { kTheSprite, "visible", kTheVisible },
- { kTheSprite, "volume", kTheVolume },
- { kTheSprite, "width", kTheWidth },
+ { kTheSprite, "backColor", kTheBackColor },
+ { kTheSprite, "blend", kTheBlend },
+ { kTheSprite, "bottom", kTheBottom },
+ { kTheSprite, "castnum", kTheCastNum },
+ { kTheSprite, "constraint", kTheConstraint },
+ { kTheSprite, "cursor", kTheCursor },
+ { kTheSprite, "editableText", kTheEditableText },
+ { kTheSprite, "foreColor", kTheForeColor },
+ { kTheSprite, "height", kTheHeight },
+ { kTheSprite, "ink", kTheInk },
+ { kTheSprite, "left", kTheLeft },
+ { kTheSprite, "lineSize", kTheLineSize },
+ { kTheSprite, "loch", kTheLocH },
+ { kTheSprite, "locv", kTheLocV },
+ { kTheSprite, "moveable", kTheMoveable },
+ { kTheSprite, "movieRate", kTheMovieRate },
+ { kTheSprite, "movieTime", kTheMovieTime },
+ { kTheSprite, "right", kTheRight },
+ { kTheSprite, "scriptNum", kTheScriptNum },
+ { kTheSprite, "startTime", kTheStartTime },
+ { kTheSprite, "stretch", kTheStrech },
+ { kTheSprite, "stopTime", kTheStopTime },
+ { kTheSprite, "top", kTheTop },
+ { kTheSprite, "trails", kTheTrails },
+ { kTheSprite, "type", kTheType },
+ { kTheSprite, "visible", kTheVisible },
+ { kTheSprite, "volume", kTheVolume },
+ { kTheSprite, "width", kTheWidth },
//Common cast fields
- { kTheCast, "width", kTheWidth },
- { kTheCast, "height", kTheHeight },
- { kTheCast, "filename", kTheFilename },
- { kTheCast, "scriptText", kTheScriptText },
{ kTheCast, "castType", kTheCastType },
+ { kTheCast, "filename", kTheFilename },
+ { kTheCast, "height", kTheHeight },
+ { kTheCast, "loaded", kTheLoaded },
+ { kTheCast, "modified", kTheModified },
{ kTheCast, "name", kTheName },
- { kTheCast, "rect", kTheRect },
{ kTheCast, "number", kTheNumber },
- { kTheCast, "modified", kTheModified },
- { kTheCast, "loaded", kTheLoaded },
- { kTheCast, "purgePriority",kThePurgePriority }, //0 Never purge, 1 Purge Last, 2 Purge next, 2 Purge normal
+ { kTheCast, "rect", kTheRect },
+ { kTheCast, "purgePriority",kThePurgePriority }, // 0 Never purge, 1 Purge Last, 2 Purge next, 2 Purge normal
+ { kTheCast, "scriptText", kTheScriptText },
+ { kTheCast, "width", kTheWidth },
//Shape fields
{ kTheCast, "backColor", kTheBackColor },
@@ -134,8 +143,8 @@ static struct TheEntityFieldProto {
{ kTheCast, "picture", kThePicture },
//TextCast fields
- { kTheCast, "size", kTheSize },
{ kTheCast, "hilite", kTheHilite },
+ { kTheCast, "size", kTheSize },
{ kTheCast, "text", kTheText },
{ kTheWindow, "drawRect", kTheDrawRect },
@@ -146,7 +155,7 @@ static struct TheEntityFieldProto {
{ kTheMenuItem, "checkmark", kTheCheckMark },
{ kTheMenuItem, "enabled", kTheEnabled },
{ kTheMenuItem, "name", kTheName },
- { kTheMenuItem, "name", kTheScript },
+ { kTheMenuItem, "script", kTheScript },
{ kTheMenu, "name", kTheName },
@@ -164,6 +173,11 @@ void Lingo::setTheEntity(TheEntity entity, int id, TheField field, Datum &d) {
case kThePerFrameHook:
warning("STUB: setting the perframehook");
break;
+ case kTheFloatPrecision:
+ _floatPrecision = d.toInt();
+ _floatPrecision = MAX(0, MIN(_floatPrecision, 19)); // 0 to 19
+ _floatPrecisionFormat.format("%%.%df", _floatPrecision);
+ break;
default:
error("Unprocessed setting field %d of entity %d", field, entity);
}
@@ -220,6 +234,10 @@ Datum Lingo::getTheEntity(TheEntity entity, int id, TheField field) {
case kThePerFrameHook:
warning("STUB: getting the perframehook");
break;
+ case kTheFloatPrecision:
+ d.type = INT;
+ d.u.i = _floatPrecision;
+ break;
default:
error("Unprocessed getting field %d of entity %d", field, entity);
}
diff --git a/engines/director/lingo/lingo-the.h b/engines/director/lingo/lingo-the.h
index 6fc62f8..c3ee20f 100644
--- a/engines/director/lingo/lingo-the.h
+++ b/engines/director/lingo/lingo-the.h
@@ -61,7 +61,17 @@ enum TheEntity {
kTheControlDown,
kTheCommandDown,
kTheShiftDown,
- kTheOptionDown
+ kTheOptionDown,
+
+ kTheColorDepth,
+ kTheColorQD,
+ kTheExitLock,
+ kTheFloatPrecision,
+ kTheItemDelimiter,
+ kTheMultiSound,
+ kThePreloadEventAbort,
+ kTheRomanLingo,
+ kTheStage
};
enum TheField {
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 9fe17f3..a73820d 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -91,6 +91,9 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
_linenumber = _colnumber = 0;
+ _floatPrecision = 4;
+ _floatPrecisionFormat = "%.4f";
+
warning("Lingo Inited");
}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index f3b36f9..ea41762 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -266,6 +266,8 @@ public:
int _linenumber;
int _colnumber;
+ Common::String _floatPrecisionFormat;
+
private:
int parse(const char *code);
void push(Datum d);
@@ -285,6 +287,8 @@ private:
StackData _stack;
DirectorEngine *_vm;
+
+ int _floatPrecision;
};
extern Lingo *g_lingo;
Commit: 996b909b0e880298d3e7bb3b7682968ab1e6199b
https://github.com/scummvm/scummvm/commit/996b909b0e880298d3e7bb3b7682968ab1e6199b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: FLOAT actually has to have double precision. Switching.
Changed paths:
engines/director/lingo/lingo-builtins.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 873e844..0555a13 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -73,7 +73,7 @@ void Lingo::b_abs() {
void Lingo::b_atan() {
Datum d = g_lingo->pop();
d.toFloat();
- d.u.f = atanf(d.u.f);
+ d.u.f = atan(d.u.f);
g_lingo->push(d);
}
@@ -88,7 +88,7 @@ void Lingo::b_exp() {
Datum d = g_lingo->pop();
d.toInt(); // Lingo uses int, so we're enforcing it
d.toFloat();
- d.u.f = expf(d.u.f);
+ d.u.f = exp(d.u.f);
g_lingo->push(d);
}
@@ -107,14 +107,14 @@ void Lingo::b_integer() {
void Lingo::b_log() {
Datum d = g_lingo->pop();
d.toFloat();
- d.u.f = logf(d.u.f);
+ d.u.f = log(d.u.f);
g_lingo->push(d);
}
void Lingo::b_pi() {
Datum d;
d.toFloat();
- d.u.f = 3.14159265358;
+ d.u.f = 3.14159265358979;
g_lingo->push(d);
}
@@ -123,7 +123,7 @@ void Lingo::b_power() {
Datum d2 = g_lingo->pop();
d1.toFloat();
d2.toFloat();
- d1.u.f = powf(d2.u.f, d1.u.f);
+ d1.u.f = pow(d2.u.f, d1.u.f);
g_lingo->push(d1);
}
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index f7dc403..24325be 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -111,10 +111,10 @@ void Lingo::c_constpush() {
void Lingo::c_fconstpush() {
Datum d;
inst i = (*g_lingo->_currentScript)[g_lingo->_pc];
- d.u.f = *((float *)&i);
+ d.u.f = *((double *)&i);
d.type = FLOAT;
- g_lingo->_pc += g_lingo->calcCodeAlignment(sizeof(float));
+ g_lingo->_pc += g_lingo->calcCodeAlignment(sizeof(double));
g_lingo->push(d);
}
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 771cfc5..a7a004e 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -164,8 +164,8 @@ int Lingo::codeString(const char *str) {
return _currentScript->size();
}
-int Lingo::codeFloat(float f) {
- int numInsts = calcCodeAlignment(sizeof(float));
+int Lingo::codeFloat(double f) {
+ int numInsts = calcCodeAlignment(sizeof(double));
// Where we copy the string over
int pos = _currentScript->size();
@@ -174,7 +174,7 @@ int Lingo::codeFloat(float f) {
for (int i = 0; i < numInsts; i++)
_currentScript->push_back(0);
- float *dst = (float *)((byte *)&_currentScript->front() + pos * sizeof(inst));
+ double *dst = (double *)((byte *)&_currentScript->front() + pos * sizeof(inst));
*dst = f;
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index f5c4e3d..50d34d9 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -211,7 +211,7 @@ typedef union YYSTYPE
{
Common::String *s;
int i;
- float f;
+ double f;
int code;
int narg; /* number of arguments */
}
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 3c349b7..b809af7 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -148,7 +148,7 @@ typedef union YYSTYPE
{
Common::String *s;
int i;
- float f;
+ double f;
int code;
int narg; /* number of arguments */
}
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index d0618af..6af9ca1 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -65,7 +65,7 @@ using namespace Director;
%union {
Common::String *s;
int i;
- float f;
+ double f;
int code;
int narg; /* number of arguments */
}
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index a73820d..b05c62c5 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -197,10 +197,10 @@ int Datum::toInt() {
return u.i;
}
-float Datum::toFloat() {
+double Datum::toFloat() {
switch (type) {
case INT:
- u.f = (float)u.i;
+ u.f = (double)u.i;
type = FLOAT;
break;
case FLOAT:
@@ -220,7 +220,7 @@ Common::String *Datum::toString() {
s->format("%d", u.i);
break;
case FLOAT:
- s->format("%f", u.f);
+ s->format(g_lingo->_floatPrecisionFormat.c_str(), u.f);
break;
case STRING:
delete s;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index ea41762..d8cd64d 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -82,7 +82,7 @@ struct Symbol { /* symbol table entry */
int type;
union {
int i; /* VAR */
- float f; /* FLOAT */
+ double f; /* FLOAT */
ScriptData *defn; /* FUNCTION, PROCEDURE */
Common::String *s; /* STRING */
} u;
@@ -97,14 +97,14 @@ struct Datum { /* interpreter stack type */
union {
int i;
- float f;
+ double f;
Common::String *s;
Symbol *sym;
} u;
Datum() { u.sym = NULL; type = VOID; }
- float toFloat();
+ double toFloat();
int toInt();
Common::String *toString();
@@ -173,7 +173,7 @@ public:
void codeArgStore();
int codeId(Common::String &s);
int codeId_(Common::String &s);
- int codeFloat(float f);
+ int codeFloat(double f);
static void c_xpop();
static void c_printtop();
Commit: 4552b2b056303d450729093d673578d2217850aa
https://github.com/scummvm/scummvm/commit/4552b2b056303d450729093d673578d2217850aa
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
JANITORIAL: Fix whitespaces
Changed paths:
engines/director/detection_tables.h
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index f451641..c966fb1 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -202,7 +202,7 @@ static const DirectorGameDescription gameDescriptions[] = {
// Developed by IJsfontein, published by Tivola
// File version of MVM.EXE is 6.0.2.32
// The game disc is a hybrid CD-ROM containing both the Windows and the Macintosh release.
-
+
"melements", "",
{
{"CHECK.DXR", 0, "c31ee30eebd24a8cf31691fc9926daa4", 901820},
@@ -221,7 +221,7 @@ static const DirectorGameDescription gameDescriptions[] = {
{
{
// Masters of the Elements - English (from rootfather)
-
+
"melements", "",
{
{"check.dxr", 0, "36f42340e819d1532c850880afe16581", 898206},
@@ -244,7 +244,7 @@ static const DirectorGameDescription gameDescriptions[] = {
// Developed by IJsfontein, published by Tivola
// File version of MVM.EXE is 6.0.2.32
// The game disc is a hybrid CD-ROM containing both the Windows and the Macintosh release.
-
+
"melements", "",
{
{"CHECK.DXR", 0, "d1cd0ed95b0e30597e0089bf3e5caf0f", 575414},
@@ -263,7 +263,7 @@ static const DirectorGameDescription gameDescriptions[] = {
{
{
// Masters of the Elements - German (from rootfather)
-
+
"melements", "",
{
{"check.dxr", 0, "9c81934b7616ab077f44825b8afaa83e", 575426},
Commit: 1673eeba705692a895a932323ffeb1d12fffea66
https://github.com/scummvm/scummvm/commit/1673eeba705692a895a932323ffeb1d12fffea66
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Print VOID type
Changed paths:
engines/director/lingo/lingo.cpp
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index b05c62c5..c111624 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -248,6 +248,8 @@ const char *Datum::type2str() {
return "STRING";
case CASTREF:
return "CASTREF";
+ case VOID:
+ return "VOID";
default:
snprintf(res, 20, "-- (%d) --", type);
return res;
Commit: e11c036ba8c49d89c9276da9313d63ec3ca22dc7
https://github.com/scummvm/scummvm/commit/e11c036ba8c49d89c9276da9313d63ec3ca22dc7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix multiline if() statements
Changed paths:
engines/director/director.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 5a6c8ec..bbd7916 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -135,8 +135,11 @@ Common::Error DirectorEngine::run() {
put chars(\"Macromedia\", 6, 6)\n\
put chars(\"Macromedia\", 6, 10)\n\
put chars(\"Macromedia\", -1, 15)\n\
- if z1 contains \"Me\xafW\" then put \"Contains\"\n\
- else put \"Doesn't contain\"\n\
+ if z1 contains \"Me\xafW\" then\n\
+ put \"Contains\"\n\
+ else\n\
+ put \"Doesn't contain\"\n\
+ end if\n\
", kMovieScript, 2);
_lingo->executeScript(kMovieScript, 2);
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 50d34d9..3aef479 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -528,7 +528,7 @@ static const yytype_int8 yyrhs[] =
35, 85, 83, 84, 83, 16, 32, -1, 79, 51,
85, 83, 13, 35, 85, 83, 84, 83, 16, 32,
-1, 80, 77, 34, 66, 84, 83, 16, 21, -1,
- 80, 77, 34, 66, 84, 83, 14, 84, 83, 16,
+ 80, 77, 34, 66, 84, 83, 38, 84, 83, 16,
21, -1, 80, 77, 34, 66, 84, 83, 82, 73,
83, 66, 16, 21, -1, 80, 77, 34, 82, 69,
83, -1, 80, 77, 34, 82, 69, 83, 38, 82,
@@ -669,8 +669,8 @@ static const yytype_uint8 yydefact[] =
46, 0, 39, 46, 0, 38, 106, 99, 0, 45,
0, 0, 45, 45, 16, 0, 102, 47, 48, 0,
0, 45, 44, 25, 100, 0, 46, 0, 45, 46,
- 46, 0, 0, 43, 44, 45, 33, 0, 101, 97,
- 19, 46, 45, 45, 22, 45, 35, 31, 0, 0,
+ 0, 46, 0, 43, 44, 45, 33, 0, 101, 97,
+ 19, 46, 45, 22, 45, 45, 35, 31, 0, 0,
32, 28, 0, 45, 0, 0, 30, 0, 0, 45,
44, 45, 44, 0, 0, 0, 0, 44, 26, 0,
27, 0, 0, 20, 23, 0, 45, 29, 45, 21,
@@ -688,41 +688,41 @@ static const yytype_int16 yydefgoto[] =
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -159
+#define YYPACT_NINF -162
static const yytype_int16 yypact[] =
{
- 174, -159, -159, -159, -43, 439, -159, -159, 25, 116,
- -159, 30, 33, 31, 312, 13, 49, 312, 312, 312,
- 312, 4, -159, 8, -159, -159, -159, 9, 11, 319,
- 420, -159, -159, -159, -159, 312, 312, 312, -159, 5,
- -159, 53, -159, 80, -159, 65, -159, -1, 1, -159,
- -159, -159, -159, 36, 312, -159, 334, 50, -159, -22,
- 482, 482, 482, 377, -159, -159, 174, 319, 312, 319,
- 61, 401, 312, 312, 312, 312, 312, 312, 312, 312,
- 312, 312, 312, 312, 312, 312, 312, 420, -17, -16,
- 35, 89, -159, -159, 91, -159, 92, 93, 78, -159,
- -159, 334, 101, -159, 312, 312, -159, -159, 55, 420,
- 58, 353, 62, 312, 420, 420, 420, 420, 420, 420,
- 420, 420, 463, 463, 482, 482, 420, 420, 420, -159,
- 312, -159, -159, -159, -159, -159, 102, -159, 420, 420,
- -159, -2, -159, -159, 284, 420, 420, -159, -39, 226,
- 83, 312, 226, -159, -159, 110, 59, -159, -159, 105,
- 312, 420, 39, -6, -159, 115, -159, 94, 420, -159,
- -159, 107, 120, -159, -159, 120, -159, 319, -159, 226,
- -159, -159, 226, 226, -159, 120, 120, -159, 319, 284,
- -159, 98, 103, 226, 122, 124, -159, 62, 108, -159,
- -159, -159, -159, 132, 118, 131, 138, -3, -159, 284,
- -159, 255, 123, -159, -159, 135, 226, -159, -159, -159,
- -159, -159, -159
+ 174, -162, -162, -162, -34, 439, -162, -162, 30, 18,
+ -162, 42, 44, 47, 312, 25, 49, 312, 312, 312,
+ 312, 8, -162, 10, -162, -162, -162, 5, 41, 319,
+ 420, -162, -162, -162, -162, 312, 312, 312, -162, 32,
+ -162, 86, -162, 87, -162, 72, -162, 83, -12, -162,
+ -162, -162, -162, 53, 312, -162, 334, 92, -162, -17,
+ 482, 482, 482, 377, -162, -162, 174, 319, 312, 319,
+ 71, 401, 312, 312, 312, 312, 312, 312, 312, 312,
+ 312, 312, 312, 312, 312, 312, 312, 420, -5, 1,
+ 51, 106, -162, -162, 107, -162, 109, 110, 90, -162,
+ -162, 334, 112, -162, 312, 312, -162, -162, 64, 420,
+ 66, 353, 70, 312, 420, 420, 420, 420, 420, 420,
+ 420, 420, 463, 463, 482, 482, 420, 420, 420, -162,
+ 312, -162, -162, -162, -162, -162, 118, -162, 420, 420,
+ -162, -2, -162, -162, 284, 420, 420, -162, -14, 226,
+ 95, 312, 226, -162, -162, 121, 74, -162, -162, 122,
+ 312, 420, 12, -3, -162, 124, -162, 108, 420, -162,
+ 120, -162, 127, -162, -162, 127, -162, 319, -162, 226,
+ -162, -162, 226, -162, 226, 127, 127, -162, 319, 284,
+ -162, 101, 111, 226, 130, 131, -162, 70, 114, -162,
+ -162, -162, -162, 133, 119, 134, 138, -6, -162, 284,
+ -162, 255, 125, -162, -162, 135, 226, -162, -162, -162,
+ -162, -162, -162
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -159, -159, -19, 95, 6, -99, 0, -159, -159, -159,
- 10, -152, -28, -64, -159, -159, -159, -158, -4, -52,
- -118, 2, 7, -159, -159, -159, 111, -159, -159, -159,
- -159, -159, 21
+ -162, -162, -19, 77, 6, -100, 0, -162, -162, -162,
+ 3, -161, -26, -64, -162, -162, -162, -159, -4, -49,
+ -139, 2, 7, -162, -162, -162, 113, -162, -162, -162,
+ -162, -162, 54
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -732,24 +732,24 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -55
static const yytype_int16 yytable[] =
{
- 25, 37, 66, 108, 64, 110, 23, 31, -9, 173,
- 95, 150, -46, 104, 188, 35, 56, 96, 65, 60,
- 61, 62, 63, 190, 155, 152, 97, 188, 43, 105,
- 45, 71, 174, 151, 190, 38, 98, 87, 87, 87,
- 50, 52, 129, 131, 51, 153, 130, 130, 179, 57,
- 58, 182, 183, 170, -46, 171, 101, 89, 90, 59,
- 103, 65, 68, 193, 92, -9, 25, 67, 91, 71,
+ 25, 37, 66, 108, 152, 110, 23, 31, 64, -46,
+ -9, 150, 173, 188, 190, 43, 56, 45, 104, 60,
+ 61, 62, 63, 98, 35, 190, 188, 179, 170, 40,
+ 182, 71, 184, 151, 105, 174, 41, 87, 87, 87,
+ 38, 42, 193, 65, 153, 43, 44, 45, 46, 155,
+ 171, -46, 50, 47, 129, 51, 101, 52, 130, 59,
+ 131, 57, 58, 67, 130, 65, 25, -9, 216, 71,
109, 111, 23, 31, 114, 115, 116, 117, 118, 119,
- 120, 121, 122, 123, 124, 125, 126, 127, 128, 216,
- 199, 93, 94, 143, 36, 112, 136, 159, 130, 132,
- 162, 163, 133, 134, 135, 97, 138, 139, 144, 169,
- 217, 137, 147, 192, 140, 145, 181, 142, 160, 65,
- 164, 167, 165, 191, 198, 178, 180, 40, 184, 156,
- 194, 195, 146, 197, 41, 173, 200, 202, 204, 42,
- 205, 203, 207, 43, 44, 45, 46, 208, 212, 210,
- 213, 47, 214, 161, 215, 219, 220, 196, 172, 99,
- 0, 107, 168, 0, 221, 0, 222, 0, 0, 0,
- 189, 0, 0, 175, -5, 1, 0, 0, 206, 71,
+ 120, 121, 122, 123, 124, 125, 126, 127, 128, 199,
+ 89, 90, 68, 143, 95, 91, 136, 92, 93, 94,
+ 159, 96, 103, 162, 163, 112, 138, 139, 144, 217,
+ 97, 36, 169, 192, 130, 145, 132, 97, 133, 181,
+ 134, 135, 137, 140, 198, 142, 191, 65, 147, 156,
+ 160, 164, 146, 194, 178, 195, 197, 165, 167, 200,
+ 180, 183, 173, 107, 203, 202, 204, 205, 207, 212,
+ 208, 213, 210, 161, 215, 214, 220, 219, 172, 196,
+ 0, 99, 168, 0, 0, 0, 175, 221, 0, 222,
+ 189, 0, 0, 0, -5, 1, 0, 0, 206, 71,
0, 2, 3, 4, 5, 6, 0, 0, 0, 0,
71, 7, 0, 8, 9, 10, 209, 0, 11, 12,
13, 0, 0, 0, 0, 14, 15, 16, 0, 0,
@@ -791,24 +791,24 @@ static const yytype_int16 yytable[] =
static const yytype_int16 yycheck[] =
{
- 0, 5, 21, 67, 0, 69, 0, 0, 0, 15,
- 11, 13, 15, 35, 172, 58, 14, 18, 57, 17,
- 18, 19, 20, 175, 63, 143, 27, 185, 27, 51,
- 29, 29, 38, 35, 186, 10, 35, 35, 36, 37,
- 10, 10, 59, 59, 11, 144, 63, 63, 166, 36,
- 37, 169, 170, 14, 57, 16, 54, 36, 37, 10,
- 10, 57, 51, 181, 11, 57, 66, 58, 63, 67,
+ 0, 5, 21, 67, 143, 69, 0, 0, 0, 15,
+ 0, 13, 15, 172, 175, 27, 14, 29, 35, 17,
+ 18, 19, 20, 35, 58, 186, 185, 166, 16, 11,
+ 169, 29, 171, 35, 51, 38, 18, 35, 36, 37,
+ 10, 23, 181, 57, 144, 27, 28, 29, 30, 63,
+ 38, 57, 10, 35, 59, 11, 54, 10, 63, 10,
+ 59, 36, 37, 58, 63, 57, 66, 57, 207, 67,
68, 69, 66, 66, 72, 73, 74, 75, 76, 77,
- 78, 79, 80, 81, 82, 83, 84, 85, 86, 207,
- 189, 11, 27, 112, 58, 34, 100, 149, 63, 10,
- 152, 153, 11, 11, 11, 27, 104, 105, 112, 161,
- 209, 10, 10, 177, 59, 113, 168, 59, 35, 57,
- 10, 16, 63, 175, 188, 10, 32, 11, 21, 148,
- 182, 183, 130, 185, 18, 15, 38, 34, 16, 23,
- 16, 193, 34, 27, 28, 29, 30, 199, 16, 201,
- 32, 35, 21, 151, 16, 32, 21, 185, 162, 48,
- -1, 66, 160, -1, 216, -1, 218, -1, -1, -1,
- 174, -1, -1, 163, 0, 1, -1, -1, 197, 177,
+ 78, 79, 80, 81, 82, 83, 84, 85, 86, 189,
+ 36, 37, 51, 112, 11, 63, 100, 11, 11, 27,
+ 149, 18, 10, 152, 153, 34, 104, 105, 112, 209,
+ 27, 58, 161, 177, 63, 113, 10, 27, 11, 168,
+ 11, 11, 10, 59, 188, 59, 175, 57, 10, 148,
+ 35, 10, 130, 182, 10, 184, 185, 63, 16, 38,
+ 32, 21, 15, 66, 193, 34, 16, 16, 34, 16,
+ 199, 32, 201, 151, 16, 21, 21, 32, 162, 185,
+ -1, 48, 160, -1, -1, -1, 163, 216, -1, 218,
+ 174, -1, -1, -1, 0, 1, -1, -1, 197, 177,
-1, 7, 8, 9, 10, 11, -1, -1, -1, -1,
188, 17, -1, 19, 20, 21, 200, -1, 24, 25,
26, -1, -1, -1, -1, 31, 32, 33, -1, -1,
@@ -869,8 +869,8 @@ static const yytype_uint8 yystos[] =
59, 83, 59, 66, 82, 85, 85, 10, 93, 84,
13, 35, 84, 69, 86, 63, 66, 66, 70, 83,
35, 85, 83, 83, 10, 63, 94, 16, 85, 83,
- 14, 16, 82, 15, 38, 74, 75, 81, 10, 84,
- 32, 83, 84, 84, 21, 73, 74, 76, 81, 82,
+ 16, 38, 82, 15, 38, 74, 75, 81, 10, 84,
+ 32, 83, 84, 21, 84, 73, 74, 76, 81, 82,
75, 83, 77, 84, 83, 83, 76, 83, 77, 69,
38, 72, 34, 83, 16, 16, 66, 34, 83, 82,
83, 82, 16, 32, 21, 16, 84, 69, 70, 32,
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 6af9ca1..3006176 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -185,7 +185,7 @@ ifstmt: if cond tTHEN nl stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN nl stmtlist end tELSE stmtlist end tEND tIF {
+ | if cond tTHEN nl stmtlist end tNLELSE stmtlist end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
WRITE_UINT32(&else1, $8);
Commit: 31ec69c0e81b7d468482237a8de473bd9a7e23cc
https://github.com/scummvm/scummvm/commit/31ec69c0e81b7d468482237a8de473bd9a7e23cc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Added detection for Spaceship Warlock
Changed paths:
engines/director/detection.cpp
engines/director/detection_tables.h
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index 0815dd9..68aa4e7 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -66,16 +66,17 @@ bool DirectorEngine::hasFeature(EngineFeature f) const {
} // End of Namespace Director
static const PlainGameDescriptor directorGames[] = {
- { "director", "Macromedia Director Game" },
- { "gundam0079", "Gundam 0079: The War for Earth" },
- { "jewels", "Jewels of the Oracle" },
- { "jman", "The Journeyman Project" },
- { "majestic", "Majestic Part I: Alien Encounter" },
- { "melements", "Masters of the Elements" },
- { "spyclub", "Spy Club" },
- { "amber", "AMBER: Journeys Beyond"},
- { "vvvampire", "Victor Vector & Yondo: The Vampire's Coffin"},
- { "vvdinosaur", "Victor Vector & Yondo: The Last Dinosaur Egg"},
+ { "director", "Macromedia Director Game" },
+ { "gundam0079", "Gundam 0079: The War for Earth" },
+ { "jewels", "Jewels of the Oracle" },
+ { "jman", "The Journeyman Project" },
+ { "majestic", "Majestic Part I: Alien Encounter" },
+ { "melements", "Masters of the Elements" },
+ { "spyclub", "Spy Club" },
+ { "amber", "AMBER: Journeys Beyond"},
+ { "vvvampire", "Victor Vector & Yondo: The Vampire's Coffin"},
+ { "vvdinosaur", "Victor Vector & Yondo: The Last Dinosaur Egg"},
+ { "warlock", "Spaceship Warlock"},
{ 0, 0 }
};
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index c966fb1..bdaecf8 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -363,6 +363,48 @@ static const DirectorGameDescription gameDescriptions[] = {
3
},
+ {
+ {
+ "warlock",
+ "",
+ AD_ENTRY1s("Spaceship Warlock.bin", "cfa68a1bc49251497ebde18e5fc9c217", 271107),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_MACRESFORK,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 2
+ },
+
+ {
+ {
+ "warlock",
+ "",
+ AD_ENTRY1s("SSWARLCK.EXE", "65d06b5fef155a2473434571aff5bc29", 370867),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 2
+ },
+
+ {
+ {
+ "warlock",
+ "",
+ AD_ENTRY1s("SSWDEMO.EXE", "65d06b5fef155a2473434571aff5bc29", 370934),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_DEMO,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 2
+ },
+
{ AD_TABLE_END_MARKER, GID_GENERIC, 0 }
};
Commit: 6b4cff264588f73170da1b31121a9176efcadeba
https://github.com/scummvm/scummvm/commit/6b4cff264588f73170da1b31121a9176efcadeba
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Added detection for Windows JMP version
Changed paths:
engines/director/detection.cpp
engines/director/detection_tables.h
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index 68aa4e7..97b5014 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -235,6 +235,8 @@ const ADGameDescription *DirectorMetaEngine::fallbackDetect(const FileMap &allFi
s_fallbackFileNameBuffer[50] = '\0';
desc->desc.filesDescriptions[0].fileName = s_fallbackFileNameBuffer;
+ warning("Director fallback detection D%d", desc->version);
+
return (ADGameDescription *)desc;
}
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index bdaecf8..d242b87 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -158,6 +158,34 @@ static const DirectorGameDescription gameDescriptions[] = {
{
"jman",
"",
+ AD_ENTRY1s("JMAN.EXE", "7c8230a804abf9353b05627a675b5ffb", 375282),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 3
+ },
+
+ {
+ {
+ "jman",
+ "",
+ AD_ENTRY1s("JMDEMO.EXE", "7c8230a804abf9353b05627a675b5ffb", 375305),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_DEMO,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 3
+ },
+
+ {
+ {
+ "jman",
+ "",
AD_ENTRY1("JOURNEY.EXE", "65d06b5fef155a2473434571aff5bc29"),
Common::JA_JPN,
Common::kPlatformWindows,
Commit: 1f0005c4e269ec8d9b848b85e40ab11d7d67a979
https://github.com/scummvm/scummvm/commit/1f0005c4e269ec8d9b848b85e40ab11d7d67a979
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Initial code for Lingo test suite. Uses special game target
Changed paths:
A engines/director/lingo/tests/goto.lingo
A engines/director/lingo/tests/if.lingo
A engines/director/lingo/tests/lingotests.lingo
A engines/director/lingo/tests/loops.lingo
A engines/director/lingo/tests/macros.lingo
A engines/director/lingo/tests/math.lingo
A engines/director/lingo/tests/mci.lingo
A engines/director/lingo/tests/strings.lingo
engines/director/detection.cpp
engines/director/detection_tables.h
engines/director/director.cpp
engines/director/director.h
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index 97b5014..b0fea29 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -67,6 +67,7 @@ bool DirectorEngine::hasFeature(EngineFeature f) const {
static const PlainGameDescriptor directorGames[] = {
{ "director", "Macromedia Director Game" },
+ { "directortest", "Macromedia Director Test Target" },
{ "gundam0079", "Gundam 0079: The War for Earth" },
{ "jewels", "Jewels of the Oracle" },
{ "jman", "The Journeyman Project" },
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index d242b87..8c9c9f1 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -28,6 +28,20 @@ namespace Director {
static const DirectorGameDescription gameDescriptions[] = {
{
{
+ "directortest",
+ "",
+ AD_ENTRY1("lingotests.lingo", 0),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_TEST,
+ 3
+ },
+
+ {
+ {
"gundam0079",
"",
AD_ENTRY1("Gundam0079.exe", "1a7acbba10a7246ba58c1d53fc7203f5"),
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index bbd7916..58a5459 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -104,158 +104,14 @@ Common::Error DirectorEngine::run() {
_lingo = new Lingo(this);
_soundManager = new DirectorSound();
-#if 0
- _mainArchive = nullptr;
- _currentScore = nullptr;
-
- _lingo->addCode("--\n\
- set x = 1\n\
- if x = 5 then exit\n\
- else put 10.0\n\
- repeat with x = 1 to 5\n\
- if x = 3 then put 30\n\
- else if x = 4 then put 40\n\
- else if x = 5 then put 50\n\
- else put 10.0\n\
- if x = 1 then\n\
- put 1\n\
- else if x = 2 then\n\
- put 1232.12345678901234\n\
- put 2.2\n\
- else if x = 3 then put 3\n\
- end if\n\
- if x = 4 then put 4\n\
- else put 5\n\
- end repeat\n\
- set z = \"foo bar baz\"\n\
- set z1 = z & \" meow\"\n\
- set z1 = z1 && \"woof\"\n\
- put z\n\
- put z1\n\
- put chars(\"Macromedia\", 6, 6)\n\
- put chars(\"Macromedia\", 6, 10)\n\
- put chars(\"Macromedia\", -1, 15)\n\
- if z1 contains \"Me\xafW\" then\n\
- put \"Contains\"\n\
- else\n\
- put \"Doesn't contain\"\n\
- end if\n\
-", kMovieScript, 2);
-
-_lingo->executeScript(kMovieScript, 2);
-
-return Common::kNoError;
-
- _lingo->addCode("--\n\
-macro SHIPX\n\
-global x, y\n\
-set x = Random(5)\n\
-if x = 1 then\n\
-go \"Zoom\"\n\
-exit\n\
-end if\n\
-if x >1 then\n\
-set y = 10\n\
-exit\n\
-end if\n\
-put 100\n\
-\n\
---\n\
-macro ZIPX\n\
-set x = Random(5)\n\
-if x = 1 then\n\
-go \"ZIP\"\n\
-exit\n\
-end if\n\
-if x >1 then\n\
-put x\n\
-exit\n\
-end if\n\
-\n\
---\n\
-macro check par1, par2 \n\
-, par3\n\
-if par1 = 3 then\n\
- put -3\n\
-else\n\
- put 0\n\
-end if \n\
-if par2 = 2 then \n\
- put 2 \n\
-else \n\
- put 0\n\
-end if\n\
-put par1\n\
-put par2\n\
-put par3\n\
-", kMovieScript, 1);
-
-_lingo->addCode("check(2, 3)\n\
-global x, y\n\
-set y = 8\n\
-shipx\n\
-put x\n\
-zipx\n\
-put x\n\
-put y\n\
-check(1, 2, 3)\n\
-check 4, 5, 6\n\
-check 7, 8\n\
-if random(4) > 2 then put 1000\n\
-set z = 5.5\n\
-set z1 = 2\n\
-set z2 = z / z1\n\
-put z\n\
-put z1\n\
-put z2\n\
-put integer(z2)\n\
-put cos(z2)\n\
-", kMovieScript, 2);
-
-_lingo->executeScript(kMovieScript, 2);
-
-return Common::kNoError;
-
-
- _lingo->addCode("mci \"open MM\\T005045a.wav type WaveAudio alias T005045a\"\n\
- mci \"play T005045a from 22710 to 32872\"", kMovieScript, 1);
-
- _lingo->addCode("go to frame \"Open23\" of movie \"OpenCabin23\"\n\
-go \"CARDBACK\"\n\
-go movie \"BAR 1\"\n\
-go to \"Open23\" of movie \"OpenCabin23\"\n\
-go to \"Chair\"\n\
-set x = 2 + 3 * (4 / 2)\n\
-put x\n", kMovieScript, 2);
-
-_lingo->addCode("set x = 5\n\
-if x <= 5 then set x = 6 end if\n\
-if (x = 5) then\n\
- set x = 7 -- this is comment\n\
-else\n\
- set x = 8\n\
- -- this is another comment\n\
-end if\n\
-put x\n\
--- this is more comment\n\
-set y = 1\n\
-repeat while (y < 5)\n\
- set y = y + 1\n\
- put y\n\
-end repeat\n\
-\n\
-repeat with z = 10 to 15\n\
- put z\n\
-end repeat\n\
-repeat with y = 5 down to 1\n\
-put y\n\
-end repeat\n\
-", kMovieScript, 3);
-
- _lingo->executeScript(kMovieScript, 3);
+ if (getGameID() == GID_TEST) {
+ _mainArchive = nullptr;
+ _currentScore = nullptr;
- return Common::kNoError;
-#endif
+ _lingo->runTests();
+
+ return Common::kNoError;
+ }
//FIXME
_mainArchive = new RIFFArchive();
diff --git a/engines/director/director.h b/engines/director/director.h
index bb08099..0d4ffa7 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -39,7 +39,8 @@ class MacResManager;
namespace Director {
enum DirectorGameID {
- GID_GENERIC
+ GID_GENERIC,
+ GID_TEST
};
class Archive;
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index c111624..26fdfc2 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -296,4 +296,24 @@ Common::String *Lingo::toLowercaseMac(Common::String *s) {
return res;
}
+void Lingo::runTests() {
+ Common::File inFile;
+ Common::ArchiveMemberList fileList;
+ SearchMan.listMatchingMembers(fileList, "*.lingo");
+
+ int counter = 1;
+
+ for (Common::ArchiveMemberList::iterator it = fileList.begin(); it != fileList.end(); ++it) {
+ Common::ArchiveMember const &m = **it;
+ Common::SeekableReadStream *const stream = m.createReadStream();
+ if (stream) {
+ uint size = stream->size();
+
+ warning("Executing file %s of size %d", m.getName().c_str(), size);
+ }
+
+ inFile.close();
+ }
+}
+
} // End of namespace Director
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index d8cd64d..6aa7917 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -144,6 +144,8 @@ public:
Common::String *toLowercaseMac(Common::String *s);
+ void runTests();
+
public:
void execute(int pc);
void pushContext();
diff --git a/engines/director/lingo/tests/goto.lingo b/engines/director/lingo/tests/goto.lingo
new file mode 100644
index 0000000..250ea24
--- /dev/null
+++ b/engines/director/lingo/tests/goto.lingo
@@ -0,0 +1,5 @@
+go to frame "Open23" of movie "OpenCabin23"
+go "CARDBACK"
+go movie "BAR 1"
+go to "Open23" of movie "OpenCabin23"
+go to "Chair"
diff --git a/engines/director/lingo/tests/if.lingo b/engines/director/lingo/tests/if.lingo
new file mode 100644
index 0000000..c9bdaca
--- /dev/null
+++ b/engines/director/lingo/tests/if.lingo
@@ -0,0 +1,20 @@
+--
+set x = 1
+if x = 5 then exit
+else put 10.0
+
+repeat with x = 1 to 5
+ if x = 3 then put 30
+ else if x = 4 then put 40
+ else if x = 5 then put 50
+ else put 10.0
+ if x = 1 then
+ put 1
+ else if x = 2 then
+ put 1232.12345678901234
+ put 2.2
+ else if x = 3 then put 3
+ end if
+ if x = 4 then put 4
+ else put 5
+end repeat
diff --git a/engines/director/lingo/tests/lingotests.lingo b/engines/director/lingo/tests/lingotests.lingo
new file mode 100644
index 0000000..e69de29
diff --git a/engines/director/lingo/tests/loops.lingo b/engines/director/lingo/tests/loops.lingo
new file mode 100644
index 0000000..0c7592a
--- /dev/null
+++ b/engines/director/lingo/tests/loops.lingo
@@ -0,0 +1,22 @@
+set x = 5
+if x <= 5 then set x = 6 end if
+if (x = 5) then
+set x = 7 -- this is comment
+else
+set x = 8
+-- this is another comment
+end if
+put x
+-- this is more comment
+set y = 1
+repeat while (y < 5)
+set y = y + 1
+put y
+end repeat
+
+repeat with z = 10 to 15
+put z
+end repeat
+repeat with y = 5 down to 1
+put y
+end repeat
diff --git a/engines/director/lingo/tests/macros.lingo b/engines/director/lingo/tests/macros.lingo
new file mode 100644
index 0000000..9167f1d
--- /dev/null
+++ b/engines/director/lingo/tests/macros.lingo
@@ -0,0 +1,55 @@
+--
+macro SHIPX
+global x, y
+set x = Random(5)
+if x = 1 then
+go \"Zoom\"
+exit
+end if
+if x >1 then
+set y = 10
+exit
+end if
+put 100
+
+--
+macro ZIPX
+set x = Random(5)
+if x = 1 then
+go \"ZIP\"
+exit
+end if
+if x >1 then
+put x
+exit
+end if
+
+--
+macro check par1, par2
+, par3
+if par1 = 3 then
+put -3
+else
+put 0
+end if
+if par2 = 2 then
+put 2
+else
+put 0
+end if
+put par1
+put par2
+put par3
+", kMovieScript, 1);
+
+_lingo->addCode("check(2, 3)
+global x, y
+set y = 8
+shipx
+put x
+zipx
+put x
+put y
+check(1, 2, 3)
+check 4, 5, 6
+check 7, 8
diff --git a/engines/director/lingo/tests/math.lingo b/engines/director/lingo/tests/math.lingo
new file mode 100644
index 0000000..d4b3d96
--- /dev/null
+++ b/engines/director/lingo/tests/math.lingo
@@ -0,0 +1,12 @@
+if random(4) > 2 then put 1000
+set z = 5.5
+set z1 = 2
+set z2 = z / z1
+put z
+put z1
+put z2
+put integer(z2)
+put cos(z2)
+
+set x = 2 + 3 * (4 / 2)
+put x
diff --git a/engines/director/lingo/tests/mci.lingo b/engines/director/lingo/tests/mci.lingo
new file mode 100644
index 0000000..04130bf
--- /dev/null
+++ b/engines/director/lingo/tests/mci.lingo
@@ -0,0 +1,2 @@
+mci "open MM\T005045a.wav type WaveAudio alias T005045a"
+mci "play T005045a from 22710 to 32872"
diff --git a/engines/director/lingo/tests/strings.lingo b/engines/director/lingo/tests/strings.lingo
new file mode 100644
index 0000000..568eb74
--- /dev/null
+++ b/engines/director/lingo/tests/strings.lingo
@@ -0,0 +1,13 @@
+set z = "foo bar baz"
+set z1 = z & " meow"
+set z1 = z1 && "woof"
+put z
+put z1
+put chars("Macromedia", 6, 6)
+put chars("Macromedia", 6, 10)
+put chars("Macromedia", -1, 15)
+if z1 contains "MeÍW" then
+ put "Contains"
+else
+ put "Doesn't contain"
+end if
Commit: 46138a2c9dc1fd333f40bee3e661dc83dff06e43
https://github.com/scummvm/scummvm/commit/46138a2c9dc1fd333f40bee3e661dc83dff06e43
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Made addCode() accept const char *
Changed paths:
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
engines/director/score.cpp
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 26fdfc2..a7362d1 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -100,10 +100,10 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
Lingo::~Lingo() {
}
-void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
+void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
code += '\n';
- debug(2, "Add code \"%s\" for type %d with id %d", code.c_str(), type, id);
+ debug(2, "Add code \"%s\" for type %d with id %d", code, type, id);
if (_scripts[type].contains(id)) {
delete _scripts[type][id];
@@ -115,15 +115,17 @@ void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
_linenumber = _colnumber = 1;
+ const char *begin, *end;
+
// macros have conflicting grammar. Thus we ease life for the parser.
- if (code.contains("\nmacro ")) {
- const char *begin = strstr(code.c_str(), "\nmacro ") + 1;
- const char *end;
+ if ((begin = strstr(code, "\nmacro "))) {
bool first = true;
+ begin += 1;
+
while ((end = strstr(begin, "\nmacro "))) {
if (first) {
- begin = code.c_str();
+ begin = code;
first = false;
}
Common::String chunk(begin, end);
@@ -137,7 +139,7 @@ void Lingo::addCode(Common::String code, ScriptType type, uint16 id) {
parse(begin);
} else {
- parse(code.c_str());
+ parse(code);
code1(STOP);
}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 6aa7917..1509c1d 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -135,7 +135,7 @@ public:
Lingo(DirectorEngine *vm);
~Lingo();
- void addCode(Common::String code, ScriptType type, uint16 id);
+ void addCode(const char *code, ScriptType type, uint16 id);
void executeScript(ScriptType type, uint16 id);
void processEvent(LEvent event, int entityId);
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 24d0b34..4ca2998 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -340,8 +340,8 @@ void Score::loadActions(Common::SeekableSubReadStreamEndian &stream) {
Common::HashMap<uint16, Common::String>::iterator j;
for (j = _actions.begin(); j != _actions.end(); ++j)
- if (j->_value != "")
- _lingo->addCode(j->_value, kFrameScript, j->_key);
+ if (!j->_value.empty())
+ _lingo->addCode(j->_value.c_str(), kFrameScript, j->_key);
if (!ConfMan.getBool("dump_scripts"))
return;
@@ -368,10 +368,10 @@ void Score::loadScriptText(Common::SeekableSubReadStreamEndian &stream) {
script += ch;
}
- if (script != "")
- _lingo->addCode(script, kMovieScript, _movieScriptCount);
+ if (!script.empty())
+ _lingo->addCode(script.c_str(), kMovieScript, _movieScriptCount);
- if (ConfMan.getBool("dump_scripts") && (script != "")) {
+ if (ConfMan.getBool("dump_scripts") && (!script.empty())) {
dumpScript(_movieScriptCount, kMovieScript, script);
}
@@ -427,8 +427,8 @@ void Score::loadCastInfo(Common::SeekableSubReadStreamEndian &stream, uint16 id)
ci->script = castStrings[0];
- if (ci->script != "") {
- _lingo->addCode(ci->script, kSpriteScript, id);
+ if (!ci->script.empty()) {
+ _lingo->addCode(ci->script.c_str(), kSpriteScript, id);
}
if (!ConfMan.getBool("dump_scripts")) {
@@ -525,8 +525,8 @@ void Score::loadFileInfo(Common::SeekableSubReadStreamEndian &stream) {
Common::Array<Common::String> fileInfoStrings = loadStrings(stream, _flags);
_script = fileInfoStrings[0];
- if (_script != "") {
- _lingo->addCode(_script, kMovieScript, _movieScriptCount);
+ if (!_script.empty()) {
+ _lingo->addCode(_script.c_str(), kMovieScript, _movieScriptCount);
}
if (!ConfMan.getBool("dump_scripts")) {
Commit: 9c8848b8ffff5df0f332b2e2d92cef9604179e27
https://github.com/scummvm/scummvm/commit/9c8848b8ffff5df0f332b2e2d92cef9604179e27
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Dump scripts before execution, not after
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 4ca2998..80c7fd7 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -339,17 +339,15 @@ void Score::loadActions(Common::SeekableSubReadStreamEndian &stream) {
Common::HashMap<uint16, Common::String>::iterator j;
+ if (ConfMan.getBool("dump_scripts"))
+ for (j = _actions.begin(); j != _actions.end(); ++j) {
+ if (!j->_value.empty())
+ dumpScript(j->_key, kFrameScript, j->_value);
+ }
+
for (j = _actions.begin(); j != _actions.end(); ++j)
if (!j->_value.empty())
_lingo->addCode(j->_value.c_str(), kFrameScript, j->_key);
-
- if (!ConfMan.getBool("dump_scripts"))
- return;
-
- for (j = _actions.begin(); j != _actions.end(); ++j) {
- if (j->_value != "")
- dumpScript(j->_key, kFrameScript, j->_value);
- }
}
void Score::loadScriptText(Common::SeekableSubReadStreamEndian &stream) {
@@ -368,13 +366,12 @@ void Score::loadScriptText(Common::SeekableSubReadStreamEndian &stream) {
script += ch;
}
+ if (!script.empty() && ConfMan.getBool("dump_scripts"))
+ dumpScript(_movieScriptCount, kMovieScript, script);
+
if (!script.empty())
_lingo->addCode(script.c_str(), kMovieScript, _movieScriptCount);
- if (ConfMan.getBool("dump_scripts") && (!script.empty())) {
- dumpScript(_movieScriptCount, kMovieScript, script);
- }
-
_movieScriptCount++;
}
@@ -427,13 +424,11 @@ void Score::loadCastInfo(Common::SeekableSubReadStreamEndian &stream, uint16 id)
ci->script = castStrings[0];
- if (!ci->script.empty()) {
- _lingo->addCode(ci->script.c_str(), kSpriteScript, id);
- }
-
- if (!ConfMan.getBool("dump_scripts")) {
+ if (!ci->script.empty() && ConfMan.getBool("dump_scripts"))
dumpScript(id, kSpriteScript, ci->script);
- }
+
+ if (!ci->script.empty())
+ _lingo->addCode(ci->script.c_str(), kSpriteScript, id);
ci->name = getString(castStrings[1]);
ci->directory = getString(castStrings[2]);
@@ -525,13 +520,11 @@ void Score::loadFileInfo(Common::SeekableSubReadStreamEndian &stream) {
Common::Array<Common::String> fileInfoStrings = loadStrings(stream, _flags);
_script = fileInfoStrings[0];
- if (!_script.empty()) {
- _lingo->addCode(_script.c_str(), kMovieScript, _movieScriptCount);
- }
-
- if (!ConfMan.getBool("dump_scripts")) {
+ if (!_script.empty() && ConfMan.getBool("dump_scripts"))
dumpScript(_movieScriptCount, kMovieScript, _script);
- }
+
+ if (!_script.empty())
+ _lingo->addCode(_script.c_str(), kMovieScript, _movieScriptCount);
_movieScriptCount++;
_changedBy = fileInfoStrings[1];
Commit: bb7e9b64b6e8eeeff90b5496a465f62f1bd8e705
https://github.com/scummvm/scummvm/commit/bb7e9b64b6e8eeeff90b5496a465f62f1bd8e705
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Unify dumpScript() signature
Changed paths:
engines/director/lingo/lingo.cpp
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index a7362d1..b9a7488 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -101,8 +101,6 @@ Lingo::~Lingo() {
}
void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
- code += '\n';
-
debug(2, "Add code \"%s\" for type %d with id %d", code, type, id);
if (_scripts[type].contains(id)) {
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 80c7fd7..6352e43 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -342,7 +342,7 @@ void Score::loadActions(Common::SeekableSubReadStreamEndian &stream) {
if (ConfMan.getBool("dump_scripts"))
for (j = _actions.begin(); j != _actions.end(); ++j) {
if (!j->_value.empty())
- dumpScript(j->_key, kFrameScript, j->_value);
+ dumpScript(j->_value.c_str(), kFrameScript, j->_key);
}
for (j = _actions.begin(); j != _actions.end(); ++j)
@@ -367,7 +367,7 @@ void Score::loadScriptText(Common::SeekableSubReadStreamEndian &stream) {
}
if (!script.empty() && ConfMan.getBool("dump_scripts"))
- dumpScript(_movieScriptCount, kMovieScript, script);
+ dumpScript(script.c_str(), kMovieScript, _movieScriptCount);
if (!script.empty())
_lingo->addCode(script.c_str(), kMovieScript, _movieScriptCount);
@@ -387,7 +387,7 @@ void Score::setStartToLabel(Common::String label) {
warning("Label %s not found", label.c_str());
}
-void Score::dumpScript(uint16 id, ScriptType type, Common::String script) {
+void Score::dumpScript(const char *script, ScriptType type, uint16 id) {
Common::DumpFile out;
Common::String typeName;
char buf[256];
@@ -411,7 +411,7 @@ void Score::dumpScript(uint16 id, ScriptType type, Common::String script) {
return;
}
- out.writeString(script);
+ out.write(script, strlen(script));
out.flush();
out.close();
@@ -425,7 +425,7 @@ void Score::loadCastInfo(Common::SeekableSubReadStreamEndian &stream, uint16 id)
ci->script = castStrings[0];
if (!ci->script.empty() && ConfMan.getBool("dump_scripts"))
- dumpScript(id, kSpriteScript, ci->script);
+ dumpScript(ci->script.c_str(), kSpriteScript, id);
if (!ci->script.empty())
_lingo->addCode(ci->script.c_str(), kSpriteScript, id);
@@ -521,7 +521,7 @@ void Score::loadFileInfo(Common::SeekableSubReadStreamEndian &stream) {
_script = fileInfoStrings[0];
if (!_script.empty() && ConfMan.getBool("dump_scripts"))
- dumpScript(_movieScriptCount, kMovieScript, _script);
+ dumpScript(_script.c_str(), kMovieScript, _movieScriptCount);
if (!_script.empty())
_lingo->addCode(_script.c_str(), kMovieScript, _movieScriptCount);
diff --git a/engines/director/score.h b/engines/director/score.h
index b0164ed..005e6f8 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -375,7 +375,7 @@ private:
void loadScriptText(Common::SeekableSubReadStreamEndian &stream);
void loadFileInfo(Common::SeekableSubReadStreamEndian &stream);
void loadFontMap(Common::SeekableSubReadStreamEndian &stream);
- void dumpScript(uint16 id, ScriptType type, Common::String script);
+ void dumpScript(const char *script, ScriptType type, uint16 id);
Common::String getString(Common::String str);
Common::Array<Common::String> loadStrings(Common::SeekableSubReadStreamEndian &stream, uint32 &entryType, bool hasHeader = true);
Commit: 855db111fcfca11224f77255a01bef50eb386961
https://github.com/scummvm/scummvm/commit/855db111fcfca11224f77255a01bef50eb386961
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Execute test suite
Changed paths:
A engines/director/lingo/tests/macros2.lingo
engines/director/lingo/lingo.cpp
engines/director/lingo/tests/macros.lingo
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index b9a7488..dd3d0cd 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -309,7 +309,18 @@ void Lingo::runTests() {
if (stream) {
uint size = stream->size();
+ char *script = (char *)calloc(size + 1, 1);
+
+ stream->read(script, size);
+
warning("Executing file %s of size %d", m.getName().c_str(), size);
+
+ addCode(script, kMovieScript, counter);
+ executeScript(kMovieScript, counter);
+
+ free(script);
+
+ counter++;
}
inFile.close();
diff --git a/engines/director/lingo/tests/macros.lingo b/engines/director/lingo/tests/macros.lingo
index 9167f1d..a75dc4c 100644
--- a/engines/director/lingo/tests/macros.lingo
+++ b/engines/director/lingo/tests/macros.lingo
@@ -40,16 +40,3 @@ end if
put par1
put par2
put par3
-", kMovieScript, 1);
-
-_lingo->addCode("check(2, 3)
-global x, y
-set y = 8
-shipx
-put x
-zipx
-put x
-put y
-check(1, 2, 3)
-check 4, 5, 6
-check 7, 8
diff --git a/engines/director/lingo/tests/macros2.lingo b/engines/director/lingo/tests/macros2.lingo
new file mode 100644
index 0000000..b587ae4
--- /dev/null
+++ b/engines/director/lingo/tests/macros2.lingo
@@ -0,0 +1,11 @@
+check(2, 3)
+global x, y
+set y = 8
+shipx
+put x
+zipx
+put x
+put y
+check(1, 2, 3)
+check 4, 5, 6
+check 7, 8
Commit: aa45e48355e670b2d8807515fa3158c0a130fcfb
https://github.com/scummvm/scummvm/commit/aa45e48355e670b2d8807515fa3158c0a130fcfb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Better error recovery and further work on if() statements
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
engines/director/lingo/tests/macros.lingo
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 3aef479..adb97fe 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -79,41 +79,42 @@
tDOWN = 268,
tELSE = 269,
tNLELSIF = 270,
- tEND = 271,
- tEXIT = 272,
- tFRAME = 273,
- tGLOBAL = 274,
- tGO = 275,
- tIF = 276,
- tINTO = 277,
- tLOOP = 278,
- tMACRO = 279,
- tMCI = 280,
- tMCIWAIT = 281,
- tMOVIE = 282,
- tNEXT = 283,
- tOF = 284,
- tPREVIOUS = 285,
- tPUT = 286,
- tREPEAT = 287,
- tSET = 288,
- tTHEN = 289,
- tTO = 290,
- tWITH = 291,
- tWHILE = 292,
- tNLELSE = 293,
- tGE = 294,
- tLE = 295,
- tGT = 296,
- tLT = 297,
- tEQ = 298,
- tNEQ = 299,
- tAND = 300,
- tOR = 301,
- tNOT = 302,
- tCONCAT = 303,
- tCONTAINS = 304,
- tSTARTS = 305
+ tENDIF = 271,
+ tENDREPEAT = 272,
+ tEXIT = 273,
+ tFRAME = 274,
+ tGLOBAL = 275,
+ tGO = 276,
+ tIF = 277,
+ tINTO = 278,
+ tLOOP = 279,
+ tMACRO = 280,
+ tMCI = 281,
+ tMCIWAIT = 282,
+ tMOVIE = 283,
+ tNEXT = 284,
+ tOF = 285,
+ tPREVIOUS = 286,
+ tPUT = 287,
+ tREPEAT = 288,
+ tSET = 289,
+ tTHEN = 290,
+ tTO = 291,
+ tWITH = 292,
+ tWHILE = 293,
+ tNLELSE = 294,
+ tGE = 295,
+ tLE = 296,
+ tGT = 297,
+ tLT = 298,
+ tEQ = 299,
+ tNEQ = 300,
+ tAND = 301,
+ tOR = 302,
+ tNOT = 303,
+ tCONCAT = 304,
+ tCONTAINS = 305,
+ tSTARTS = 306
};
#endif
/* Tokens. */
@@ -130,41 +131,42 @@
#define tDOWN 268
#define tELSE 269
#define tNLELSIF 270
-#define tEND 271
-#define tEXIT 272
-#define tFRAME 273
-#define tGLOBAL 274
-#define tGO 275
-#define tIF 276
-#define tINTO 277
-#define tLOOP 278
-#define tMACRO 279
-#define tMCI 280
-#define tMCIWAIT 281
-#define tMOVIE 282
-#define tNEXT 283
-#define tOF 284
-#define tPREVIOUS 285
-#define tPUT 286
-#define tREPEAT 287
-#define tSET 288
-#define tTHEN 289
-#define tTO 290
-#define tWITH 291
-#define tWHILE 292
-#define tNLELSE 293
-#define tGE 294
-#define tLE 295
-#define tGT 296
-#define tLT 297
-#define tEQ 298
-#define tNEQ 299
-#define tAND 300
-#define tOR 301
-#define tNOT 302
-#define tCONCAT 303
-#define tCONTAINS 304
-#define tSTARTS 305
+#define tENDIF 271
+#define tENDREPEAT 272
+#define tEXIT 273
+#define tFRAME 274
+#define tGLOBAL 275
+#define tGO 276
+#define tIF 277
+#define tINTO 278
+#define tLOOP 279
+#define tMACRO 280
+#define tMCI 281
+#define tMCIWAIT 282
+#define tMOVIE 283
+#define tNEXT 284
+#define tOF 285
+#define tPREVIOUS 286
+#define tPUT 287
+#define tREPEAT 288
+#define tSET 289
+#define tTHEN 290
+#define tTO 291
+#define tWITH 292
+#define tWHILE 293
+#define tNLELSE 294
+#define tGE 295
+#define tLE 296
+#define tGT 297
+#define tLT 298
+#define tEQ 299
+#define tNEQ 300
+#define tAND 301
+#define tOR 302
+#define tNOT 303
+#define tCONCAT 304
+#define tCONTAINS 305
+#define tSTARTS 306
@@ -181,9 +183,10 @@
extern int yylex();
extern int yyparse();
-void yyerror(char *s) { error("%s at line %d col %d", s, Director::g_lingo->_linenumber, Director::g_lingo->_colnumber); }
using namespace Director;
+void yyerror(char *s) { g_lingo->_hadError = true; warning("%s at line %d col %d", s, Director::g_lingo->_linenumber, Director::g_lingo->_colnumber); }
+
@@ -207,7 +210,7 @@ using namespace Director;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 65 "engines/director/lingo/lingo-gr.y"
+#line 66 "engines/director/lingo/lingo-gr.y"
{
Common::String *s;
int i;
@@ -216,7 +219,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 220 "engines/director/lingo/lingo-gr.cpp"
+#line 223 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -229,7 +232,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 233 "engines/director/lingo/lingo-gr.cpp"
+#line 236 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -442,22 +445,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 64
+#define YYFINAL 65
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 544
+#define YYLAST 534
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 64
+#define YYNTOKENS 65
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 33
/* YYNRULES -- Number of rules. */
-#define YYNRULES 106
+#define YYNRULES 105
/* YYNRULES -- Number of states. */
-#define YYNSTATES 223
+#define YYNSTATES 221
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 305
+#define YYMAXUTOK 306
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -466,12 +469,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 57, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 58, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 56, 62, 2,
- 58, 59, 54, 52, 63, 53, 2, 55, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 57, 63, 2,
+ 59, 60, 55, 53, 64, 54, 2, 56, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 61, 51, 60, 2, 2, 2, 2, 2, 2, 2,
+ 62, 52, 61, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -495,7 +498,7 @@ static const yytype_uint8 yytranslate[] =
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50
+ 45, 46, 47, 48, 49, 50, 51
};
#if YYDEBUG
@@ -503,78 +506,78 @@ static const yytype_uint8 yytranslate[] =
YYRHS. */
static const yytype_uint16 yyprhs[] =
{
- 0, 0, 3, 7, 9, 11, 12, 14, 16, 18,
- 20, 22, 24, 29, 34, 39, 41, 43, 45, 47,
- 56, 68, 81, 90, 102, 115, 122, 133, 144, 145,
- 149, 152, 154, 157, 159, 166, 168, 174, 176, 180,
- 184, 187, 191, 193, 195, 196, 197, 198, 201, 204,
- 206, 208, 210, 215, 220, 222, 224, 228, 232, 236,
- 240, 244, 248, 252, 256, 260, 264, 268, 271, 275,
- 279, 283, 287, 290, 293, 297, 300, 303, 306, 308,
- 310, 313, 315, 319, 322, 325, 328, 331, 335, 338,
- 342, 345, 348, 350, 354, 357, 361, 362, 371, 372,
- 374, 378, 383, 384, 388, 389, 391
+ 0, 0, 3, 7, 9, 12, 14, 15, 17, 19,
+ 21, 23, 25, 30, 35, 40, 42, 44, 46, 48,
+ 56, 67, 79, 87, 99, 111, 118, 129, 140, 141,
+ 145, 148, 150, 153, 155, 162, 164, 170, 172, 176,
+ 180, 183, 187, 189, 191, 192, 193, 197, 199, 201,
+ 203, 205, 210, 215, 217, 219, 223, 227, 231, 235,
+ 239, 243, 247, 251, 255, 259, 263, 266, 270, 274,
+ 278, 282, 285, 288, 292, 295, 298, 301, 303, 305,
+ 308, 310, 314, 317, 320, 323, 326, 330, 333, 337,
+ 340, 343, 345, 349, 352, 356, 357, 367, 368, 370,
+ 374, 379, 380, 384, 385, 387
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 65, 0, -1, 65, 66, 67, -1, 67, -1, 57,
- -1, -1, 91, -1, 86, -1, 95, -1, 68, -1,
- 70, -1, 1, -1, 31, 85, 22, 10, -1, 33,
- 10, 51, 85, -1, 33, 10, 35, 85, -1, 85,
- -1, 86, -1, 69, -1, 71, -1, 78, 58, 77,
- 59, 84, 83, 16, 32, -1, 79, 51, 85, 83,
- 35, 85, 83, 84, 83, 16, 32, -1, 79, 51,
- 85, 83, 13, 35, 85, 83, 84, 83, 16, 32,
- -1, 80, 77, 34, 66, 84, 83, 16, 21, -1,
- 80, 77, 34, 66, 84, 83, 38, 84, 83, 16,
- 21, -1, 80, 77, 34, 66, 84, 83, 82, 73,
- 83, 66, 16, 21, -1, 80, 77, 34, 82, 69,
- 83, -1, 80, 77, 34, 82, 69, 83, 38, 82,
- 69, 83, -1, 80, 77, 34, 82, 69, 83, 74,
- 83, 72, 83, -1, -1, 38, 82, 69, -1, 73,
- 76, -1, 76, -1, 74, 75, -1, 75, -1, 81,
- 77, 34, 82, 70, 83, -1, 74, -1, 81, 77,
- 34, 84, 83, -1, 85, -1, 85, 51, 85, -1,
- 58, 77, 59, -1, 32, 37, -1, 32, 36, 10,
- -1, 21, -1, 15, -1, -1, -1, -1, 84, 66,
- -1, 84, 70, -1, 7, -1, 8, -1, 11, -1,
- 9, 58, 96, 59, -1, 10, 58, 96, 59, -1,
- 10, -1, 68, -1, 85, 52, 85, -1, 85, 53,
- 85, -1, 85, 54, 85, -1, 85, 55, 85, -1,
- 85, 60, 85, -1, 85, 61, 85, -1, 85, 44,
- 85, -1, 85, 39, 85, -1, 85, 40, 85, -1,
- 85, 45, 85, -1, 85, 46, 85, -1, 47, 85,
- -1, 85, 62, 85, -1, 85, 48, 85, -1, 85,
- 49, 85, -1, 85, 50, 85, -1, 52, 85, -1,
- 53, 85, -1, 58, 85, 59, -1, 25, 11, -1,
- 26, 10, -1, 31, 85, -1, 88, -1, 17, -1,
- 19, 87, -1, 10, -1, 87, 63, 10, -1, 20,
- 23, -1, 20, 28, -1, 20, 30, -1, 20, 89,
- -1, 20, 89, 90, -1, 20, 90, -1, 35, 18,
- 11, -1, 18, 11, -1, 35, 11, -1, 11, -1,
- 29, 27, 11, -1, 27, 11, -1, 35, 27, 11,
- -1, -1, 24, 10, 92, 82, 93, 66, 94, 84,
- -1, -1, 10, -1, 93, 63, 10, -1, 93, 66,
- 63, 10, -1, -1, 10, 82, 96, -1, -1, 85,
- -1, 96, 63, 85, -1
+ 66, 0, -1, 66, 67, 68, -1, 68, -1, 1,
+ 58, -1, 58, -1, -1, 92, -1, 87, -1, 96,
+ -1, 69, -1, 71, -1, 32, 86, 23, 10, -1,
+ 34, 10, 52, 86, -1, 34, 10, 36, 86, -1,
+ 86, -1, 87, -1, 70, -1, 72, -1, 79, 59,
+ 78, 60, 85, 84, 17, -1, 80, 52, 86, 84,
+ 36, 86, 84, 85, 84, 17, -1, 80, 52, 86,
+ 84, 13, 36, 86, 84, 85, 84, 17, -1, 81,
+ 78, 35, 67, 85, 84, 16, -1, 81, 78, 35,
+ 67, 85, 84, 39, 85, 84, 67, 16, -1, 81,
+ 78, 35, 67, 85, 84, 83, 74, 84, 67, 16,
+ -1, 81, 78, 35, 83, 70, 84, -1, 81, 78,
+ 35, 83, 70, 84, 39, 83, 70, 84, -1, 81,
+ 78, 35, 83, 70, 84, 75, 84, 73, 84, -1,
+ -1, 39, 83, 70, -1, 74, 77, -1, 77, -1,
+ 75, 76, -1, 76, -1, 82, 78, 35, 83, 71,
+ 84, -1, 75, -1, 82, 78, 35, 85, 84, -1,
+ 86, -1, 86, 52, 86, -1, 59, 78, 60, -1,
+ 33, 38, -1, 33, 37, 10, -1, 22, -1, 15,
+ -1, -1, -1, 85, 67, 71, -1, 71, -1, 7,
+ -1, 8, -1, 11, -1, 9, 59, 97, 60, -1,
+ 10, 59, 97, 60, -1, 10, -1, 69, -1, 86,
+ 53, 86, -1, 86, 54, 86, -1, 86, 55, 86,
+ -1, 86, 56, 86, -1, 86, 61, 86, -1, 86,
+ 62, 86, -1, 86, 45, 86, -1, 86, 40, 86,
+ -1, 86, 41, 86, -1, 86, 46, 86, -1, 86,
+ 47, 86, -1, 48, 86, -1, 86, 63, 86, -1,
+ 86, 49, 86, -1, 86, 50, 86, -1, 86, 51,
+ 86, -1, 53, 86, -1, 54, 86, -1, 59, 86,
+ 60, -1, 26, 11, -1, 27, 10, -1, 32, 86,
+ -1, 89, -1, 18, -1, 20, 88, -1, 10, -1,
+ 88, 64, 10, -1, 21, 24, -1, 21, 29, -1,
+ 21, 31, -1, 21, 90, -1, 21, 90, 91, -1,
+ 21, 91, -1, 36, 19, 11, -1, 19, 11, -1,
+ 36, 11, -1, 11, -1, 30, 28, 11, -1, 28,
+ 11, -1, 36, 28, 11, -1, -1, 25, 10, 93,
+ 83, 94, 67, 95, 85, 67, -1, -1, 10, -1,
+ 94, 64, 10, -1, 94, 67, 64, 10, -1, -1,
+ 10, 83, 97, -1, -1, 86, -1, 97, 64, 86,
+ -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 94, 94, 95, 98, 103, 104, 105, 106, 107,
- 108, 109, 112, 118, 124, 131, 132, 134, 135, 140,
- 151, 167, 181, 188, 197, 206, 216, 226, 237, 238,
- 241, 242, 245, 246, 249, 257, 258, 266, 267, 268,
- 270, 272, 278, 284, 291, 293, 295, 296, 297, 300,
- 305, 308, 311, 317, 325, 328, 329, 330, 331, 332,
- 333, 334, 335, 336, 337, 338, 339, 340, 341, 342,
- 343, 344, 345, 346, 347, 350, 351, 352, 353, 354,
- 356, 359, 360, 371, 372, 373, 374, 379, 385, 392,
- 393, 394, 395, 398, 399, 400, 428, 428, 435, 436,
- 437, 438, 440, 443, 451, 452, 453
+ 0, 95, 95, 96, 97, 100, 105, 106, 107, 108,
+ 109, 110, 113, 119, 125, 132, 133, 135, 136, 141,
+ 152, 168, 182, 189, 198, 207, 217, 227, 238, 239,
+ 242, 243, 246, 247, 250, 258, 259, 267, 268, 269,
+ 271, 273, 279, 285, 292, 294, 296, 297, 300, 305,
+ 308, 311, 317, 325, 328, 329, 330, 331, 332, 333,
+ 334, 335, 336, 337, 338, 339, 340, 341, 342, 343,
+ 344, 345, 346, 347, 350, 351, 352, 353, 354, 356,
+ 359, 360, 371, 372, 373, 374, 379, 385, 392, 393,
+ 394, 395, 398, 399, 400, 428, 428, 435, 436, 437,
+ 438, 440, 443, 451, 452, 453
};
#endif
@@ -585,9 +588,9 @@ static const char *const yytname[] =
{
"$end", "error", "$undefined", "CASTREF", "UNARY", "VOID", "VAR", "INT",
"FLOAT", "BLTIN", "ID", "STRING", "HANDLER", "tDOWN", "tELSE",
- "tNLELSIF", "tEND", "tEXIT", "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO",
- "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF",
- "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH",
+ "tNLELSIF", "tENDIF", "tENDREPEAT", "tEXIT", "tFRAME", "tGLOBAL", "tGO",
+ "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT",
+ "tOF", "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH",
"tWHILE", "tNLELSE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "tAND",
"tOR", "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS", "'='", "'+'", "'-'",
"'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','",
@@ -610,41 +613,41 @@ static const yytype_uint16 yytoknum[] =
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 61, 43, 45, 42, 47, 37, 10, 40, 41,
- 62, 60, 38, 44
+ 305, 306, 61, 43, 45, 42, 47, 37, 10, 40,
+ 41, 62, 60, 38, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 64, 65, 65, 66, 67, 67, 67, 67, 67,
- 67, 67, 68, 68, 68, 69, 69, 70, 70, 70,
- 70, 70, 71, 71, 71, 71, 71, 71, 72, 72,
- 73, 73, 74, 74, 75, 76, 76, 77, 77, 77,
- 78, 79, 80, 81, 82, 83, 84, 84, 84, 85,
- 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
- 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
- 85, 85, 85, 85, 85, 86, 86, 86, 86, 86,
- 86, 87, 87, 88, 88, 88, 88, 88, 88, 89,
- 89, 89, 89, 90, 90, 90, 92, 91, 93, 93,
- 93, 93, 94, 95, 96, 96, 96
+ 0, 65, 66, 66, 66, 67, 68, 68, 68, 68,
+ 68, 68, 69, 69, 69, 70, 70, 71, 71, 71,
+ 71, 71, 72, 72, 72, 72, 72, 72, 73, 73,
+ 74, 74, 75, 75, 76, 77, 77, 78, 78, 78,
+ 79, 80, 81, 82, 83, 84, 85, 85, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 87, 87, 87, 87, 87, 87,
+ 88, 88, 89, 89, 89, 89, 89, 89, 90, 90,
+ 90, 90, 91, 91, 91, 93, 92, 94, 94, 94,
+ 94, 95, 96, 97, 97, 97
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
- 0, 2, 3, 1, 1, 0, 1, 1, 1, 1,
- 1, 1, 4, 4, 4, 1, 1, 1, 1, 8,
- 11, 12, 8, 11, 12, 6, 10, 10, 0, 3,
+ 0, 2, 3, 1, 2, 1, 0, 1, 1, 1,
+ 1, 1, 4, 4, 4, 1, 1, 1, 1, 7,
+ 10, 11, 7, 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, 4, 1, 1, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 2, 3, 3,
- 3, 3, 2, 2, 3, 2, 2, 2, 1, 1,
- 2, 1, 3, 2, 2, 2, 2, 3, 2, 3,
- 2, 2, 1, 3, 2, 3, 0, 8, 0, 1,
- 3, 4, 0, 3, 0, 1, 3
+ 2, 3, 1, 1, 0, 0, 3, 1, 1, 1,
+ 1, 4, 4, 1, 1, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 2, 3, 3, 3,
+ 3, 2, 2, 3, 2, 2, 2, 1, 1, 2,
+ 1, 3, 2, 2, 2, 2, 3, 2, 3, 2,
+ 2, 1, 3, 2, 3, 0, 9, 0, 1, 3,
+ 4, 0, 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -652,229 +655,227 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 11, 49, 50, 0, 44, 51, 79, 0, 0,
+ 0, 0, 48, 49, 0, 44, 50, 78, 0, 0,
42, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 3, 55, 17, 10, 18, 0, 0, 0,
- 15, 7, 78, 6, 8, 104, 104, 104, 81, 80,
- 92, 0, 83, 0, 84, 0, 85, 0, 86, 88,
- 96, 75, 76, 54, 0, 55, 77, 0, 40, 0,
- 67, 72, 73, 0, 1, 4, 0, 0, 0, 0,
- 0, 37, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 105, 0, 0,
- 103, 0, 90, 94, 0, 91, 0, 0, 0, 87,
- 44, 0, 0, 41, 0, 0, 74, 2, 0, 45,
- 0, 0, 44, 0, 63, 64, 62, 65, 66, 69,
- 70, 71, 56, 57, 58, 59, 60, 61, 68, 52,
- 0, 53, 82, 93, 89, 95, 98, 12, 14, 13,
- 46, 0, 39, 46, 0, 38, 106, 99, 0, 45,
- 0, 0, 45, 45, 16, 0, 102, 47, 48, 0,
- 0, 45, 44, 25, 100, 0, 46, 0, 45, 46,
- 0, 46, 0, 43, 44, 45, 33, 0, 101, 97,
- 19, 46, 45, 22, 45, 45, 35, 31, 0, 0,
- 32, 28, 0, 45, 0, 0, 30, 0, 0, 45,
- 44, 45, 44, 0, 0, 0, 0, 44, 26, 0,
- 27, 0, 0, 20, 23, 0, 45, 29, 45, 21,
- 24, 36, 34
+ 0, 0, 3, 54, 17, 11, 18, 0, 0, 0,
+ 15, 8, 77, 7, 9, 4, 103, 103, 103, 80,
+ 79, 91, 0, 82, 0, 83, 0, 84, 0, 85,
+ 87, 95, 74, 75, 53, 0, 54, 76, 0, 40,
+ 0, 66, 71, 72, 0, 1, 5, 6, 0, 0,
+ 0, 0, 37, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 104, 0,
+ 0, 102, 0, 89, 93, 0, 90, 0, 0, 0,
+ 86, 44, 0, 0, 41, 0, 0, 73, 2, 0,
+ 45, 0, 0, 44, 0, 62, 63, 61, 64, 65,
+ 68, 69, 70, 55, 56, 57, 58, 59, 60, 67,
+ 51, 0, 52, 81, 92, 88, 94, 97, 12, 14,
+ 13, 0, 0, 39, 0, 0, 38, 105, 98, 0,
+ 47, 45, 16, 0, 0, 45, 45, 0, 101, 0,
+ 0, 0, 45, 44, 25, 99, 0, 0, 46, 19,
+ 45, 0, 22, 0, 0, 43, 44, 45, 33, 0,
+ 100, 0, 0, 45, 0, 45, 35, 31, 0, 0,
+ 32, 28, 0, 96, 45, 0, 0, 30, 0, 0,
+ 45, 44, 45, 44, 0, 20, 0, 0, 0, 26,
+ 0, 27, 0, 21, 23, 24, 45, 29, 45, 36,
+ 34
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 21, 157, 22, 55, 24, 158, 26, 201, 185,
- 186, 176, 187, 70, 27, 28, 29, 177, 211, 141,
- 149, 30, 154, 39, 32, 48, 49, 33, 100, 148,
- 166, 34, 88
+ -1, 21, 159, 22, 56, 24, 150, 26, 202, 185,
+ 186, 178, 187, 71, 27, 28, 29, 179, 212, 142,
+ 151, 30, 152, 40, 32, 49, 50, 33, 101, 149,
+ 167, 34, 89
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -162
+#define YYPACT_NINF -167
static const yytype_int16 yypact[] =
{
- 174, -162, -162, -162, -34, 439, -162, -162, 30, 18,
- -162, 42, 44, 47, 312, 25, 49, 312, 312, 312,
- 312, 8, -162, 10, -162, -162, -162, 5, 41, 319,
- 420, -162, -162, -162, -162, 312, 312, 312, -162, 32,
- -162, 86, -162, 87, -162, 72, -162, 83, -12, -162,
- -162, -162, -162, 53, 312, -162, 334, 92, -162, -17,
- 482, 482, 482, 377, -162, -162, 174, 319, 312, 319,
- 71, 401, 312, 312, 312, 312, 312, 312, 312, 312,
- 312, 312, 312, 312, 312, 312, 312, 420, -5, 1,
- 51, 106, -162, -162, 107, -162, 109, 110, 90, -162,
- -162, 334, 112, -162, 312, 312, -162, -162, 64, 420,
- 66, 353, 70, 312, 420, 420, 420, 420, 420, 420,
- 420, 420, 463, 463, 482, 482, 420, 420, 420, -162,
- 312, -162, -162, -162, -162, -162, 118, -162, 420, 420,
- -162, -2, -162, -162, 284, 420, 420, -162, -14, 226,
- 95, 312, 226, -162, -162, 121, 74, -162, -162, 122,
- 312, 420, 12, -3, -162, 124, -162, 108, 420, -162,
- 120, -162, 127, -162, -162, 127, -162, 319, -162, 226,
- -162, -162, 226, -162, 226, 127, 127, -162, 319, 284,
- -162, 101, 111, 226, 130, 131, -162, 70, 114, -162,
- -162, -162, -162, 133, 119, 134, 138, -6, -162, 284,
- -162, 255, 125, -162, -162, 135, 226, -162, -162, -162,
- -162, -162, -162
+ 181, -50, -167, -167, -49, 428, -167, -167, 25, 134,
+ -167, 45, 47, 78, 320, -11, 81, 320, 320, 320,
+ 320, 4, -167, 28, -167, -167, -167, 33, 53, 327,
+ 409, -167, -167, -167, -167, -167, 320, 320, 320, -167,
+ 30, -167, 88, -167, 96, -167, 85, -167, 18, 67,
+ -167, -167, -167, -167, 56, 320, -167, -2, 110, -167,
+ -29, 471, 471, 471, 366, -167, -167, 234, 327, 320,
+ 327, 86, 390, 320, 320, 320, 320, 320, 320, 320,
+ 320, 320, 320, 320, 320, 320, 320, 320, 409, 42,
+ 52, 58, 114, -167, -167, 116, -167, 119, 121, 97,
+ -167, -167, -2, 123, -167, 320, 320, -167, -167, 79,
+ 409, 80, 342, 83, 320, 409, 409, 409, 409, 409,
+ 409, 409, 409, 452, 452, 471, 471, 409, 409, 409,
+ -167, 320, -167, -167, -167, -167, -167, 128, -167, 409,
+ 409, 263, 5, -167, 263, 292, 409, 409, -167, -24,
+ -167, 83, -167, 106, 320, 83, -167, 133, 84, 263,
+ 127, 320, 409, 3, -9, -167, 137, 263, -167, -167,
+ 409, 263, -167, 263, 136, -167, -167, 136, -167, 327,
+ -167, 83, 263, 83, 83, 136, 136, -167, 327, 292,
+ -167, 115, 120, 263, 83, 140, 83, -167, 83, 131,
+ -167, -167, -167, -167, 150, -167, 152, 153, 263, -167,
+ 292, -167, 263, -167, -167, -167, 83, -167, -167, -167,
+ -167
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -162, -162, -19, 77, 6, -100, 0, -162, -162, -162,
- 3, -161, -26, -64, -162, -162, -162, -159, -4, -49,
- -139, 2, 7, -162, -162, -162, 113, -162, -162, -162,
- -162, -162, 54
+ -167, -167, -20, 104, 16, -123, 0, -167, -167, -167,
+ 11, -166, -8, -65, -167, -167, -167, -149, -3, -66,
+ -36, -5, 17, -167, -167, -167, 130, -167, -167, -167,
+ -167, -167, 19
};
/* 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 -55
+#define YYTABLE_NINF -54
static const yytype_int16 yytable[] =
{
- 25, 37, 66, 108, 152, 110, 23, 31, 64, -46,
- -9, 150, 173, 188, 190, 43, 56, 45, 104, 60,
- 61, 62, 63, 98, 35, 190, 188, 179, 170, 40,
- 182, 71, 184, 151, 105, 174, 41, 87, 87, 87,
- 38, 42, 193, 65, 153, 43, 44, 45, 46, 155,
- 171, -46, 50, 47, 129, 51, 101, 52, 130, 59,
- 131, 57, 58, 67, 130, 65, 25, -9, 216, 71,
- 109, 111, 23, 31, 114, 115, 116, 117, 118, 119,
- 120, 121, 122, 123, 124, 125, 126, 127, 128, 199,
- 89, 90, 68, 143, 95, 91, 136, 92, 93, 94,
- 159, 96, 103, 162, 163, 112, 138, 139, 144, 217,
- 97, 36, 169, 192, 130, 145, 132, 97, 133, 181,
- 134, 135, 137, 140, 198, 142, 191, 65, 147, 156,
- 160, 164, 146, 194, 178, 195, 197, 165, 167, 200,
- 180, 183, 173, 107, 203, 202, 204, 205, 207, 212,
- 208, 213, 210, 161, 215, 214, 220, 219, 172, 196,
- 0, 99, 168, 0, 0, 0, 175, 221, 0, 222,
- 189, 0, 0, 0, -5, 1, 0, 0, 206, 71,
- 0, 2, 3, 4, 5, 6, 0, 0, 0, 0,
- 71, 7, 0, 8, 9, 10, 209, 0, 11, 12,
- 13, 0, 0, 0, 0, 14, 15, 16, 0, 0,
- 0, 218, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 17, 0, 0, 0, 0, 18, 19, 0, 0,
- 0, -5, 20, 2, 3, 4, 53, 6, 0, 0,
- 0, 0, 0, 7, 0, 8, 9, 10, 0, 0,
- 0, 12, 13, 0, 0, 0, 0, 14, 15, 16,
- 0, 0, 2, 3, 4, 53, 6, 0, 0, 0,
- 0, 0, 7, 17, 8, 9, 10, 0, 18, 19,
- 12, 13, 0, 65, 20, 0, 14, 15, 16, 0,
- 0, 2, 3, 4, 53, 6, 0, 0, 0, 0,
- 0, 7, 17, 8, 9, 0, 0, 18, 19, 12,
- 13, 0, 0, 20, 0, 14, 0, 16, 0, 2,
- 3, 4, 53, 6, 0, 0, 2, 3, 4, 53,
- 6, 17, 0, 0, 0, 0, 18, 19, 0, 0,
- 0, 0, 20, 54, 0, 16, 0, 0, 0, 0,
- 54, 0, 16, 0, 0, 0, 102, 0, 0, 17,
- 0, 0, 0, 0, 18, 19, 17, 0, 0, 0,
- 20, 18, 19, 72, 73, 0, 0, 69, 74, 75,
- 76, 0, 77, 78, 79, 0, 80, 81, 82, 83,
- 0, 0, 72, 73, 84, 85, 86, 74, 75, 76,
- 0, 77, 78, 79, 113, 80, 81, 82, 83, 0,
- 0, 0, 106, 84, 85, 86, 72, 73, 0, 0,
- 0, 74, 75, 76, 0, 77, 78, 79, 0, 80,
- 81, 82, 83, 0, 0, 0, 106, 84, 85, 86,
- 72, 73, 0, 0, 0, 74, 75, 76, 0, 77,
- 78, 79, 113, 80, 81, 82, 83, 0, 0, 72,
- 73, 84, 85, 86, 74, 75, 76, 0, 77, 78,
- 79, 0, 80, 81, 82, 83, 0, 0, -54, -54,
- 84, 85, 86, -54, -54, -54, 0, -54, -54, -54,
- 0, 0, 0, -54, -54, 0, 0, 36, 0, -54,
- -54, -54, 72, 73, 0, 0, 0, 74, 75, 76,
- 0, 77, 78, 79, 0, 0, 0, 82, 83, 0,
- 0, 72, 73, 84, 85, 86, 74, 75, 76, 0,
- 77, 78, 79, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 84, 85, 86
+ 25, 67, 38, 109, 65, 111, 175, 105, 35, 57,
+ 36, 190, 61, 62, 63, 64, 23, 31, 153, 172,
+ 190, 103, 156, 106, 72, 188, 58, 59, -10, 96,
+ 176, 88, 88, 88, 66, 39, 188, 97, 73, 74,
+ 157, 154, 173, 75, 76, 77, 98, 78, 79, 80,
+ 102, 81, 82, 83, 84, 51, 90, 91, 52, 85,
+ 86, 87, 66, 72, 110, 112, 200, 25, 115, 116,
+ 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
+ 127, 128, 129, 23, 31, 160, -10, 217, 53, 163,
+ 164, 60, 68, 144, 92, 44, 171, 46, 137, 93,
+ 139, 140, 130, 99, 182, 69, 131, 94, 155, 146,
+ 145, 191, 132, 95, 192, 37, 131, 195, 196, 198,
+ 104, 113, 131, 199, 133, 98, 147, 134, 204, 158,
+ 135, 181, 136, 138, 209, 183, 211, 184, 148, 141,
+ 143, 66, 161, 165, 169, 41, 194, 180, 166, 162,
+ 219, 175, 220, 42, 201, 203, 170, 205, 43, 168,
+ 174, 193, 44, 45, 46, 47, 208, 213, 214, 215,
+ 48, 108, 216, 189, 72, 177, 206, 197, 207, 100,
+ 0, -6, 1, 72, 0, 0, 0, 0, 2, 3,
+ 4, 5, 6, 168, 0, 0, 0, 0, 210, 7,
+ 0, 8, 9, 10, 0, 0, 11, 12, 13, 0,
+ 0, 0, 218, 14, 15, 16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 17,
+ 0, 0, 0, 0, 18, 19, 0, 0, 0, -6,
+ 20, 2, 3, 4, 5, 6, 0, 0, 0, 0,
+ 0, 0, 7, 0, 8, 9, 10, 0, 0, 11,
+ 12, 13, 0, 0, 0, 0, 14, 15, 16, 0,
+ 2, 3, 4, 54, 6, 0, 0, 0, 0, 0,
+ 0, 7, 17, 8, 9, 10, 0, 18, 19, 12,
+ 13, 0, 0, 20, 0, 14, 15, 16, 0, 2,
+ 3, 4, 54, 6, 0, 0, 0, 0, 0, 0,
+ 7, 17, 8, 9, 0, 0, 18, 19, 12, 13,
+ 0, 0, 20, 0, 14, 0, 16, 2, 3, 4,
+ 54, 6, 0, 0, 2, 3, 4, 54, 6, 0,
+ 17, 0, 0, 0, 0, 18, 19, 0, 0, 0,
+ 0, 20, 55, 0, 16, 0, 0, 0, 0, 55,
+ 0, 16, 0, 0, 0, 0, 0, 0, 17, 0,
+ 0, 0, 0, 18, 19, 17, 0, 0, 0, 20,
+ 18, 19, 73, 74, 0, 0, 70, 75, 76, 77,
+ 0, 78, 79, 80, 114, 81, 82, 83, 84, 0,
+ 0, 0, 107, 85, 86, 87, 73, 74, 0, 0,
+ 0, 75, 76, 77, 0, 78, 79, 80, 0, 81,
+ 82, 83, 84, 0, 0, 0, 107, 85, 86, 87,
+ 73, 74, 0, 0, 0, 75, 76, 77, 0, 78,
+ 79, 80, 114, 81, 82, 83, 84, 0, 0, 73,
+ 74, 85, 86, 87, 75, 76, 77, 0, 78, 79,
+ 80, 0, 81, 82, 83, 84, 0, 0, -53, -53,
+ 85, 86, 87, -53, -53, -53, 0, -53, -53, -53,
+ 0, 0, 0, -53, -53, 0, 0, 37, 0, -53,
+ -53, -53, 73, 74, 0, 0, 0, 75, 76, 77,
+ 0, 78, 79, 80, 0, 0, 0, 83, 84, 0,
+ 0, 73, 74, 85, 86, 87, 75, 76, 77, 0,
+ 78, 79, 80, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 85, 86, 87
};
static const yytype_int16 yycheck[] =
{
- 0, 5, 21, 67, 143, 69, 0, 0, 0, 15,
- 0, 13, 15, 172, 175, 27, 14, 29, 35, 17,
- 18, 19, 20, 35, 58, 186, 185, 166, 16, 11,
- 169, 29, 171, 35, 51, 38, 18, 35, 36, 37,
- 10, 23, 181, 57, 144, 27, 28, 29, 30, 63,
- 38, 57, 10, 35, 59, 11, 54, 10, 63, 10,
- 59, 36, 37, 58, 63, 57, 66, 57, 207, 67,
- 68, 69, 66, 66, 72, 73, 74, 75, 76, 77,
- 78, 79, 80, 81, 82, 83, 84, 85, 86, 189,
- 36, 37, 51, 112, 11, 63, 100, 11, 11, 27,
- 149, 18, 10, 152, 153, 34, 104, 105, 112, 209,
- 27, 58, 161, 177, 63, 113, 10, 27, 11, 168,
- 11, 11, 10, 59, 188, 59, 175, 57, 10, 148,
- 35, 10, 130, 182, 10, 184, 185, 63, 16, 38,
- 32, 21, 15, 66, 193, 34, 16, 16, 34, 16,
- 199, 32, 201, 151, 16, 21, 21, 32, 162, 185,
- -1, 48, 160, -1, -1, -1, 163, 216, -1, 218,
- 174, -1, -1, -1, 0, 1, -1, -1, 197, 177,
- -1, 7, 8, 9, 10, 11, -1, -1, -1, -1,
- 188, 17, -1, 19, 20, 21, 200, -1, 24, 25,
- 26, -1, -1, -1, -1, 31, 32, 33, -1, -1,
- -1, 211, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 47, -1, -1, -1, -1, 52, 53, -1, -1,
- -1, 57, 58, 7, 8, 9, 10, 11, -1, -1,
- -1, -1, -1, 17, -1, 19, 20, 21, -1, -1,
- -1, 25, 26, -1, -1, -1, -1, 31, 32, 33,
- -1, -1, 7, 8, 9, 10, 11, -1, -1, -1,
- -1, -1, 17, 47, 19, 20, 21, -1, 52, 53,
- 25, 26, -1, 57, 58, -1, 31, 32, 33, -1,
- -1, 7, 8, 9, 10, 11, -1, -1, -1, -1,
- -1, 17, 47, 19, 20, -1, -1, 52, 53, 25,
- 26, -1, -1, 58, -1, 31, -1, 33, -1, 7,
- 8, 9, 10, 11, -1, -1, 7, 8, 9, 10,
- 11, 47, -1, -1, -1, -1, 52, 53, -1, -1,
- -1, -1, 58, 31, -1, 33, -1, -1, -1, -1,
- 31, -1, 33, -1, -1, -1, 22, -1, -1, 47,
- -1, -1, -1, -1, 52, 53, 47, -1, -1, -1,
- 58, 52, 53, 39, 40, -1, -1, 58, 44, 45,
- 46, -1, 48, 49, 50, -1, 52, 53, 54, 55,
- -1, -1, 39, 40, 60, 61, 62, 44, 45, 46,
- -1, 48, 49, 50, 51, 52, 53, 54, 55, -1,
- -1, -1, 59, 60, 61, 62, 39, 40, -1, -1,
- -1, 44, 45, 46, -1, 48, 49, 50, -1, 52,
- 53, 54, 55, -1, -1, -1, 59, 60, 61, 62,
- 39, 40, -1, -1, -1, 44, 45, 46, -1, 48,
- 49, 50, 51, 52, 53, 54, 55, -1, -1, 39,
- 40, 60, 61, 62, 44, 45, 46, -1, 48, 49,
- 50, -1, 52, 53, 54, 55, -1, -1, 39, 40,
- 60, 61, 62, 44, 45, 46, -1, 48, 49, 50,
- -1, -1, -1, 54, 55, -1, -1, 58, -1, 60,
- 61, 62, 39, 40, -1, -1, -1, 44, 45, 46,
- -1, 48, 49, 50, -1, -1, -1, 54, 55, -1,
- -1, 39, 40, 60, 61, 62, 44, 45, 46, -1,
- 48, 49, 50, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 60, 61, 62
+ 0, 21, 5, 68, 0, 70, 15, 36, 58, 14,
+ 59, 177, 17, 18, 19, 20, 0, 0, 13, 16,
+ 186, 23, 145, 52, 29, 174, 37, 38, 0, 11,
+ 39, 36, 37, 38, 58, 10, 185, 19, 40, 41,
+ 64, 36, 39, 45, 46, 47, 28, 49, 50, 51,
+ 55, 53, 54, 55, 56, 10, 37, 38, 11, 61,
+ 62, 63, 58, 68, 69, 70, 189, 67, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
+ 85, 86, 87, 67, 67, 151, 58, 210, 10, 155,
+ 156, 10, 59, 113, 64, 28, 162, 30, 101, 11,
+ 105, 106, 60, 36, 170, 52, 64, 11, 144, 114,
+ 113, 177, 60, 28, 179, 59, 64, 183, 184, 185,
+ 10, 35, 64, 188, 10, 28, 131, 11, 194, 149,
+ 11, 167, 11, 10, 200, 171, 202, 173, 10, 60,
+ 60, 58, 36, 10, 17, 11, 182, 10, 64, 154,
+ 216, 15, 218, 19, 39, 35, 161, 17, 24, 159,
+ 163, 181, 28, 29, 30, 31, 35, 17, 16, 16,
+ 36, 67, 208, 176, 179, 164, 196, 185, 198, 49,
+ -1, 0, 1, 188, -1, -1, -1, -1, 7, 8,
+ 9, 10, 11, 193, -1, -1, -1, -1, 201, 18,
+ -1, 20, 21, 22, -1, -1, 25, 26, 27, -1,
+ -1, -1, 212, 32, 33, 34, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 48,
+ -1, -1, -1, -1, 53, 54, -1, -1, -1, 58,
+ 59, 7, 8, 9, 10, 11, -1, -1, -1, -1,
+ -1, -1, 18, -1, 20, 21, 22, -1, -1, 25,
+ 26, 27, -1, -1, -1, -1, 32, 33, 34, -1,
+ 7, 8, 9, 10, 11, -1, -1, -1, -1, -1,
+ -1, 18, 48, 20, 21, 22, -1, 53, 54, 26,
+ 27, -1, -1, 59, -1, 32, 33, 34, -1, 7,
+ 8, 9, 10, 11, -1, -1, -1, -1, -1, -1,
+ 18, 48, 20, 21, -1, -1, 53, 54, 26, 27,
+ -1, -1, 59, -1, 32, -1, 34, 7, 8, 9,
+ 10, 11, -1, -1, 7, 8, 9, 10, 11, -1,
+ 48, -1, -1, -1, -1, 53, 54, -1, -1, -1,
+ -1, 59, 32, -1, 34, -1, -1, -1, -1, 32,
+ -1, 34, -1, -1, -1, -1, -1, -1, 48, -1,
+ -1, -1, -1, 53, 54, 48, -1, -1, -1, 59,
+ 53, 54, 40, 41, -1, -1, 59, 45, 46, 47,
+ -1, 49, 50, 51, 52, 53, 54, 55, 56, -1,
+ -1, -1, 60, 61, 62, 63, 40, 41, -1, -1,
+ -1, 45, 46, 47, -1, 49, 50, 51, -1, 53,
+ 54, 55, 56, -1, -1, -1, 60, 61, 62, 63,
+ 40, 41, -1, -1, -1, 45, 46, 47, -1, 49,
+ 50, 51, 52, 53, 54, 55, 56, -1, -1, 40,
+ 41, 61, 62, 63, 45, 46, 47, -1, 49, 50,
+ 51, -1, 53, 54, 55, 56, -1, -1, 40, 41,
+ 61, 62, 63, 45, 46, 47, -1, 49, 50, 51,
+ -1, -1, -1, 55, 56, -1, -1, 59, -1, 61,
+ 62, 63, 40, 41, -1, -1, -1, 45, 46, 47,
+ -1, 49, 50, 51, -1, -1, -1, 55, 56, -1,
+ -1, 40, 41, 61, 62, 63, 45, 46, 47, -1,
+ 49, 50, 51, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 61, 62, 63
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 7, 8, 9, 10, 11, 17, 19, 20,
- 21, 24, 25, 26, 31, 32, 33, 47, 52, 53,
- 58, 65, 67, 68, 69, 70, 71, 78, 79, 80,
- 85, 86, 88, 91, 95, 58, 58, 82, 10, 87,
- 11, 18, 23, 27, 28, 29, 30, 35, 89, 90,
- 10, 11, 10, 10, 31, 68, 85, 36, 37, 10,
- 85, 85, 85, 85, 0, 57, 66, 58, 51, 58,
- 77, 85, 39, 40, 44, 45, 46, 48, 49, 50,
- 52, 53, 54, 55, 60, 61, 62, 85, 96, 96,
- 96, 63, 11, 11, 27, 11, 18, 27, 35, 90,
- 92, 85, 22, 10, 35, 51, 59, 67, 77, 85,
- 77, 85, 34, 51, 85, 85, 85, 85, 85, 85,
- 85, 85, 85, 85, 85, 85, 85, 85, 85, 59,
- 63, 59, 10, 11, 11, 11, 82, 10, 85, 85,
- 59, 83, 59, 66, 82, 85, 85, 10, 93, 84,
- 13, 35, 84, 69, 86, 63, 66, 66, 70, 83,
- 35, 85, 83, 83, 10, 63, 94, 16, 85, 83,
- 16, 38, 82, 15, 38, 74, 75, 81, 10, 84,
- 32, 83, 84, 21, 84, 73, 74, 76, 81, 82,
- 75, 83, 77, 84, 83, 83, 76, 83, 77, 69,
- 38, 72, 34, 83, 16, 16, 66, 34, 83, 82,
- 83, 82, 16, 32, 21, 16, 84, 69, 70, 32,
- 21, 83, 83
+ 0, 1, 7, 8, 9, 10, 11, 18, 20, 21,
+ 22, 25, 26, 27, 32, 33, 34, 48, 53, 54,
+ 59, 66, 68, 69, 70, 71, 72, 79, 80, 81,
+ 86, 87, 89, 92, 96, 58, 59, 59, 83, 10,
+ 88, 11, 19, 24, 28, 29, 30, 31, 36, 90,
+ 91, 10, 11, 10, 10, 32, 69, 86, 37, 38,
+ 10, 86, 86, 86, 86, 0, 58, 67, 59, 52,
+ 59, 78, 86, 40, 41, 45, 46, 47, 49, 50,
+ 51, 53, 54, 55, 56, 61, 62, 63, 86, 97,
+ 97, 97, 64, 11, 11, 28, 11, 19, 28, 36,
+ 91, 93, 86, 23, 10, 36, 52, 60, 68, 78,
+ 86, 78, 86, 35, 52, 86, 86, 86, 86, 86,
+ 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
+ 60, 64, 60, 10, 11, 11, 11, 83, 10, 86,
+ 86, 60, 84, 60, 67, 83, 86, 86, 10, 94,
+ 71, 85, 87, 13, 36, 85, 70, 64, 67, 67,
+ 84, 36, 86, 84, 84, 10, 64, 95, 71, 17,
+ 86, 84, 16, 39, 83, 15, 39, 75, 76, 82,
+ 10, 85, 84, 85, 85, 74, 75, 77, 82, 83,
+ 76, 84, 78, 67, 85, 84, 84, 77, 84, 78,
+ 70, 39, 73, 35, 84, 17, 67, 67, 35, 84,
+ 83, 84, 83, 17, 16, 16, 85, 70, 71, 84,
+ 84
};
#define yyerrok (yyerrstatus = 0)
@@ -1689,25 +1690,25 @@ yyreduce:
switch (yyn)
{
case 4:
-#line 98 "engines/director/lingo/lingo-gr.y"
+#line 97 "engines/director/lingo/lingo-gr.y"
+ { yyerrok; ;}
+ break;
+
+ case 5:
+#line 100 "engines/director/lingo/lingo-gr.y"
{
g_lingo->_linenumber++;
g_lingo->_colnumber = 1;
;}
break;
- case 9:
-#line 107 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_xpop); ;}
- break;
-
- case 11:
+ case 10:
#line 109 "engines/director/lingo/lingo-gr.y"
- { yyerrok; ;}
+ { g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 12:
-#line 112 "engines/director/lingo/lingo-gr.y"
+#line 113 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str());
@@ -1717,7 +1718,7 @@ yyreduce:
break;
case 13:
-#line 118 "engines/director/lingo/lingo-gr.y"
+#line 119 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1727,7 +1728,7 @@ yyreduce:
break;
case 14:
-#line 124 "engines/director/lingo/lingo-gr.y"
+#line 125 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1737,65 +1738,65 @@ yyreduce:
break;
case 15:
-#line 131 "engines/director/lingo/lingo-gr.y"
+#line 132 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 19:
-#line 140 "engines/director/lingo/lingo-gr.y"
+#line 141 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
- WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
- WRITE_UINT32(&end, (yyvsp[(6) - (8)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = body; /* body of loop */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
+ WRITE_UINT32(&body, (yyvsp[(5) - (7)].code));
+ WRITE_UINT32(&end, (yyvsp[(6) - (7)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = body; /* body of loop */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 2] = end; ;}
break;
case 20:
-#line 151 "engines/director/lingo/lingo-gr.y"
+#line 152 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
- WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
- WRITE_UINT32(&finish, (yyvsp[(6) - (11)].code));
- WRITE_UINT32(&body, (yyvsp[(8) - (11)].code));
- WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
+ WRITE_UINT32(&init, (yyvsp[(3) - (10)].code));
+ WRITE_UINT32(&finish, (yyvsp[(6) - (10)].code));
+ WRITE_UINT32(&body, (yyvsp[(8) - (10)].code));
+ WRITE_UINT32(&end, (yyvsp[(9) - (10)].code));
WRITE_UINT32(&inc, 1);
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = init; /* initial count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = finish;/* final count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = body; /* body of loop */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 4] = inc; /* increment */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = init; /* initial count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = finish;/* final count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = body; /* body of loop */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 4] = inc; /* increment */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 5] = end; ;}
break;
case 21:
-#line 167 "engines/director/lingo/lingo-gr.y"
+#line 168 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
- WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
- WRITE_UINT32(&finish, (yyvsp[(7) - (12)].code));
- WRITE_UINT32(&body, (yyvsp[(9) - (12)].code));
- WRITE_UINT32(&end, (yyvsp[(10) - (12)].code));
+ WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
+ WRITE_UINT32(&finish, (yyvsp[(7) - (11)].code));
+ WRITE_UINT32(&body, (yyvsp[(9) - (11)].code));
+ WRITE_UINT32(&end, (yyvsp[(10) - (11)].code));
WRITE_UINT32(&inc, -1);
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = init; /* initial count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = finish;/* final count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = body; /* body of loop */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 4] = inc; /* increment */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = init; /* initial count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = finish;/* final count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = body; /* body of loop */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 4] = inc; /* increment */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
break;
case 22:
-#line 181 "engines/director/lingo/lingo-gr.y"
+#line 182 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(5) - (8)].code));
- WRITE_UINT32(&end, (yyvsp[(6) - (8)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 3] = end; /* end, if cond fails */
+ WRITE_UINT32(&then, (yyvsp[(5) - (7)].code));
+ WRITE_UINT32(&end, (yyvsp[(6) - (7)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); ;}
break;
case 23:
-#line 188 "engines/director/lingo/lingo-gr.y"
+#line 189 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1808,20 +1809,20 @@ yyreduce:
break;
case 24:
-#line 197 "engines/director/lingo/lingo-gr.y"
+#line 198 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(5) - (12)].code));
- WRITE_UINT32(&else1, (yyvsp[(7) - (12)].code));
- WRITE_UINT32(&end, (yyvsp[(9) - (12)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, (yyvsp[(9) - (12)].code)); ;}
+ WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
+ WRITE_UINT32(&else1, (yyvsp[(7) - (11)].code));
+ WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = end; /* end, if cond fails */
+ g_lingo->processIf(0, (yyvsp[(9) - (11)].code)); ;}
break;
case 25:
-#line 206 "engines/director/lingo/lingo-gr.y"
+#line 207 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1835,7 +1836,7 @@ yyreduce:
break;
case 26:
-#line 216 "engines/director/lingo/lingo-gr.y"
+#line 217 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1849,7 +1850,7 @@ yyreduce:
break;
case 27:
-#line 226 "engines/director/lingo/lingo-gr.y"
+#line 227 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1863,17 +1864,17 @@ yyreduce:
break;
case 28:
-#line 237 "engines/director/lingo/lingo-gr.y"
+#line 238 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = 0; ;}
break;
case 29:
-#line 238 "engines/director/lingo/lingo-gr.y"
+#line 239 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 34:
-#line 249 "engines/director/lingo/lingo-gr.y"
+#line 250 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1883,7 +1884,7 @@ yyreduce:
break;
case 36:
-#line 258 "engines/director/lingo/lingo-gr.y"
+#line 259 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
@@ -1893,22 +1894,22 @@ yyreduce:
break;
case 37:
-#line 266 "engines/director/lingo/lingo-gr.y"
+#line 267 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
case 38:
-#line 267 "engines/director/lingo/lingo-gr.y"
+#line 268 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
case 40:
-#line 270 "engines/director/lingo/lingo-gr.y"
+#line 271 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
case 41:
-#line 272 "engines/director/lingo/lingo-gr.y"
+#line 273 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1917,7 +1918,7 @@ yyreduce:
break;
case 42:
-#line 278 "engines/director/lingo/lingo-gr.y"
+#line 279 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -1926,7 +1927,7 @@ yyreduce:
break;
case 43:
-#line 284 "engines/director/lingo/lingo-gr.y"
+#line 285 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -1936,21 +1937,16 @@ yyreduce:
break;
case 44:
-#line 291 "engines/director/lingo/lingo-gr.y"
+#line 292 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 45:
-#line 293 "engines/director/lingo/lingo-gr.y"
+#line 294 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 46:
-#line 295 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = g_lingo->_currentScript->size(); ;}
- break;
-
- case 49:
+ case 48:
#line 300 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
@@ -1959,21 +1955,21 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 50:
+ case 49:
#line 305 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
- case 51:
+ case 50:
#line 308 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_stringpush);
g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;}
break;
- case 52:
+ case 51:
#line 311 "engines/director/lingo/lingo-gr.y"
{
if ((yyvsp[(3) - (4)].narg) != g_lingo->_builtins[*(yyvsp[(1) - (4)].s)]->nargs)
@@ -1983,7 +1979,7 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 53:
+ case 52:
#line 317 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
@@ -1995,155 +1991,155 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 54:
+ case 53:
#line 325 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 56:
+ case 55:
#line 329 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 57:
+ case 56:
#line 330 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 58:
+ case 57:
#line 331 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 59:
+ case 58:
#line 332 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 60:
+ case 59:
#line 333 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 61:
+ case 60:
#line 334 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 62:
+ case 61:
#line 335 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 63:
+ case 62:
#line 336 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 64:
+ case 63:
#line 337 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 65:
+ case 64:
#line 338 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_and); ;}
break;
- case 66:
+ case 65:
#line 339 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_or); ;}
break;
- case 67:
+ case 66:
#line 340 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_not); ;}
break;
- case 68:
+ case 67:
#line 341 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ampersand); ;}
break;
- case 69:
+ case 68:
#line 342 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_concat); ;}
break;
- case 70:
+ case 69:
#line 343 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_contains); ;}
break;
- case 71:
+ case 70:
#line 344 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_starts); ;}
break;
- case 72:
+ case 71:
#line 345 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 73:
+ case 72:
#line 346 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 74:
+ case 73:
#line 347 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 75:
+ case 74:
#line 350 "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 76:
+ case 75:
#line 351 "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 77:
+ case 76:
#line 352 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 79:
+ case 78:
#line 354 "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 81:
+ case 80:
#line 359 "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 82:
+ case 81:
#line 360 "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 83:
+ case 82:
#line 371 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 84:
+ case 83:
#line 372 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 85:
+ case 84:
#line 373 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 86:
+ case 85:
#line 374 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
@@ -2152,7 +2148,7 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 87:
+ case 86:
#line 379 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
@@ -2162,7 +2158,7 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 88:
+ case 87:
#line 385 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
@@ -2171,81 +2167,81 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 89:
+ case 88:
#line 392 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 90:
+ case 89:
#line 393 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 91:
+ case 90:
#line 394 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 92:
+ case 91:
#line 395 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 93:
+ case 92:
#line 398 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 94:
+ case 93:
#line 399 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 95:
+ case 94:
#line 400 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 96:
+ case 95:
#line 428 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 97:
+ case 96:
#line 429 "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);
- g_lingo->define(*(yyvsp[(2) - (8)].s), (yyvsp[(4) - (8)].code), (yyvsp[(5) - (8)].narg));
+ g_lingo->define(*(yyvsp[(2) - (9)].s), (yyvsp[(4) - (9)].code), (yyvsp[(5) - (9)].narg));
g_lingo->_indef = false; ;}
break;
- case 98:
+ case 97:
#line 435 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 99:
+ case 98:
#line 436 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 100:
+ case 99:
#line 437 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 101:
+ case 100:
#line 438 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 102:
+ case 101:
#line 440 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 103:
+ case 102:
#line 443 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
@@ -2255,24 +2251,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 104:
+ case 103:
#line 451 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 105:
+ case 104:
#line 452 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 106:
+ case 105:
#line 453 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2276 "engines/director/lingo/lingo-gr.cpp"
+#line 2272 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index b809af7..bf99268 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -52,41 +52,42 @@
tDOWN = 268,
tELSE = 269,
tNLELSIF = 270,
- tEND = 271,
- tEXIT = 272,
- tFRAME = 273,
- tGLOBAL = 274,
- tGO = 275,
- tIF = 276,
- tINTO = 277,
- tLOOP = 278,
- tMACRO = 279,
- tMCI = 280,
- tMCIWAIT = 281,
- tMOVIE = 282,
- tNEXT = 283,
- tOF = 284,
- tPREVIOUS = 285,
- tPUT = 286,
- tREPEAT = 287,
- tSET = 288,
- tTHEN = 289,
- tTO = 290,
- tWITH = 291,
- tWHILE = 292,
- tNLELSE = 293,
- tGE = 294,
- tLE = 295,
- tGT = 296,
- tLT = 297,
- tEQ = 298,
- tNEQ = 299,
- tAND = 300,
- tOR = 301,
- tNOT = 302,
- tCONCAT = 303,
- tCONTAINS = 304,
- tSTARTS = 305
+ tENDIF = 271,
+ tENDREPEAT = 272,
+ tEXIT = 273,
+ tFRAME = 274,
+ tGLOBAL = 275,
+ tGO = 276,
+ tIF = 277,
+ tINTO = 278,
+ tLOOP = 279,
+ tMACRO = 280,
+ tMCI = 281,
+ tMCIWAIT = 282,
+ tMOVIE = 283,
+ tNEXT = 284,
+ tOF = 285,
+ tPREVIOUS = 286,
+ tPUT = 287,
+ tREPEAT = 288,
+ tSET = 289,
+ tTHEN = 290,
+ tTO = 291,
+ tWITH = 292,
+ tWHILE = 293,
+ tNLELSE = 294,
+ tGE = 295,
+ tLE = 296,
+ tGT = 297,
+ tLT = 298,
+ tEQ = 299,
+ tNEQ = 300,
+ tAND = 301,
+ tOR = 302,
+ tNOT = 303,
+ tCONCAT = 304,
+ tCONTAINS = 305,
+ tSTARTS = 306
};
#endif
/* Tokens. */
@@ -103,48 +104,49 @@
#define tDOWN 268
#define tELSE 269
#define tNLELSIF 270
-#define tEND 271
-#define tEXIT 272
-#define tFRAME 273
-#define tGLOBAL 274
-#define tGO 275
-#define tIF 276
-#define tINTO 277
-#define tLOOP 278
-#define tMACRO 279
-#define tMCI 280
-#define tMCIWAIT 281
-#define tMOVIE 282
-#define tNEXT 283
-#define tOF 284
-#define tPREVIOUS 285
-#define tPUT 286
-#define tREPEAT 287
-#define tSET 288
-#define tTHEN 289
-#define tTO 290
-#define tWITH 291
-#define tWHILE 292
-#define tNLELSE 293
-#define tGE 294
-#define tLE 295
-#define tGT 296
-#define tLT 297
-#define tEQ 298
-#define tNEQ 299
-#define tAND 300
-#define tOR 301
-#define tNOT 302
-#define tCONCAT 303
-#define tCONTAINS 304
-#define tSTARTS 305
+#define tENDIF 271
+#define tENDREPEAT 272
+#define tEXIT 273
+#define tFRAME 274
+#define tGLOBAL 275
+#define tGO 276
+#define tIF 277
+#define tINTO 278
+#define tLOOP 279
+#define tMACRO 280
+#define tMCI 281
+#define tMCIWAIT 282
+#define tMOVIE 283
+#define tNEXT 284
+#define tOF 285
+#define tPREVIOUS 286
+#define tPUT 287
+#define tREPEAT 288
+#define tSET 289
+#define tTHEN 290
+#define tTO 291
+#define tWITH 292
+#define tWHILE 293
+#define tNLELSE 294
+#define tGE 295
+#define tLE 296
+#define tGT 297
+#define tLT 298
+#define tEQ 299
+#define tNEQ 300
+#define tAND 301
+#define tOR 302
+#define tNOT 303
+#define tCONCAT 304
+#define tCONTAINS 305
+#define tSTARTS 306
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 65 "engines/director/lingo/lingo-gr.y"
+#line 66 "engines/director/lingo/lingo-gr.y"
{
Common::String *s;
int i;
@@ -153,7 +155,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 157 "engines/director/lingo/lingo-gr.hpp"
+#line 159 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 3006176..4e1778f 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -56,9 +56,10 @@
extern int yylex();
extern int yyparse();
-void yyerror(char *s) { error("%s at line %d col %d", s, Director::g_lingo->_linenumber, Director::g_lingo->_colnumber); }
using namespace Director;
+void yyerror(char *s) { g_lingo->_hadError = true; warning("%s at line %d col %d", s, Director::g_lingo->_linenumber, Director::g_lingo->_colnumber); }
+
%}
@@ -74,7 +75,7 @@ using namespace Director;
%token<i> INT
%token<f> FLOAT
%token<s> BLTIN ID STRING HANDLER
-%token tDOWN tELSE tNLELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
+%token tDOWN tELSE tNLELSIF tENDIF tENDREPEAT tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
%token tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO
%token tWITH tWHILE tNLELSE
%token tGE tLE tGT tLT tEQ tNEQ tAND tOR tNOT
@@ -93,6 +94,7 @@ using namespace Director;
program: program nl programline
| programline
+ | error '\n' { yyerrok; }
;
nl: '\n' {
@@ -100,13 +102,12 @@ nl: '\n' {
g_lingo->_colnumber = 1;
}
-programline:
+programline: /* empty */
| defn
| func
| macro
| asgn { g_lingo->code1(g_lingo->c_xpop); }
| stmt
- | error { yyerrok; }
;
asgn: tPUT expr tINTO ID {
@@ -137,7 +138,7 @@ stmt: stmtoneliner
// statements
// end repeat
//
- | repeatwhile '(' cond ')' stmtlist end tEND tREPEAT {
+ | repeatwhile '(' cond ')' stmtlist end tENDREPEAT {
inst body = 0, end = 0;
WRITE_UINT32(&body, $5);
WRITE_UINT32(&end, $6);
@@ -148,7 +149,7 @@ stmt: stmtoneliner
// statements
// end repeat
//
- | repeatwith '=' expr end tTO expr end stmtlist end tEND tREPEAT {
+ | repeatwith '=' expr end tTO expr end stmtlist end tENDREPEAT {
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, $3);
WRITE_UINT32(&finish, $6);
@@ -164,7 +165,7 @@ stmt: stmtoneliner
// statements
// end repeat
//
- | repeatwith '=' expr end tDOWN tTO expr end stmtlist end tEND tREPEAT {
+ | repeatwith '=' expr end tDOWN tTO expr end stmtlist end tENDREPEAT {
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, $3);
WRITE_UINT32(&finish, $7);
@@ -178,14 +179,14 @@ stmt: stmtoneliner
(*g_lingo->_currentScript)[$1 + 5] = end; } /* end, if cond fails */
;
-ifstmt: if cond tTHEN nl stmtlist end tEND tIF {
+ifstmt: if cond tTHEN nl stmtlist end tENDIF {
inst then = 0, end = 0;
WRITE_UINT32(&then, $5);
WRITE_UINT32(&end, $6);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN nl stmtlist end tNLELSE stmtlist end tEND tIF {
+ | if cond tTHEN nl stmtlist end tNLELSE stmtlist end nl tENDIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
WRITE_UINT32(&else1, $8);
@@ -194,7 +195,7 @@ ifstmt: if cond tTHEN nl stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN nl stmtlist end begin elseifstmt end nl tEND tIF {
+ | if cond tTHEN nl stmtlist end begin elseifstmt end nl tENDIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
WRITE_UINT32(&else1, $7);
@@ -292,9 +293,8 @@ begin: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
;
end: /* nothing */ { g_lingo->code1(STOP); $$ = g_lingo->_currentScript->size(); }
;
-stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
- | stmtlist nl
- | stmtlist stmt
+stmtlist: stmtlist nl stmt
+ | stmt
;
expr: INT {
@@ -426,7 +426,7 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
// See also:
// on keyword
defn: tMACRO ID { g_lingo->_indef = true; }
- begin argdef nl argstore stmtlist {
+ begin argdef nl argstore stmtlist nl {
g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$2, $4, $5);
@@ -435,7 +435,7 @@ defn: tMACRO ID { g_lingo->_indef = true; }
argdef: /* nothing */ { $$ = 0; }
| ID { g_lingo->codeArg($1); $$ = 1; }
| argdef ',' ID { g_lingo->codeArg($3); $$ = $1 + 1; }
- | argdef nl ',' ID { g_lingo->codeArg($4); $$ = $1 + 1; }
+ | argdef nl ',' ID { g_lingo->codeArg($4); $$ = $1 + 1; }
;
argstore: /* nothing */ { g_lingo->codeArgStore(); }
;
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index b419574..737548f 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[161] =
{ 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,
- 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, 0, 39, 13, 39, 18, 39,
- 21, 39, 39, 39, 34, 9, 39, 14, 39, 39,
- 28, 30, 0, 39, 20, 39, 0, 5, 26, 8,
- 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,
+ 45, 39, 1, 41, 42, 38, 36, 37, 40, 40,
+ 40, 40, 40, 40, 40, 40, 40, 16, 7, 40,
+ 40, 40, 40, 40, 40, 40, 25, 26, 40, 40,
+ 40, 40, 40, 40, 33, 40, 40, 2, 2, 0,
+ 1, 41, 4, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 20, 40, 40, 24, 40, 28, 40,
+
+ 30, 40, 40, 40, 40, 0, 40, 6, 10, 0,
+ 13, 40, 40, 17, 18, 40, 40, 40, 23, 40,
+ 40, 40, 32, 40, 34, 0, 40, 0, 0, 14,
+ 40, 19, 40, 22, 40, 40, 40, 35, 9, 40,
+ 11, 0, 15, 40, 40, 29, 31, 0, 40, 0,
+ 21, 40, 0, 5, 0, 27, 8, 0, 12, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -436,49 +436,51 @@ static yyconst flex_int32_t yy_meta[58] =
4, 4, 4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[155] =
+static yyconst flex_int16_t yy_base[164] =
{ 0,
- 0, 56, 186, 352, 60, 64, 68, 72, 173, 352,
- 143, 141, 49, 65, 132, 53, 0, 53, 54, 58,
+ 0, 56, 249, 374, 60, 64, 68, 72, 187, 374,
+ 178, 170, 49, 65, 138, 53, 0, 53, 54, 58,
54, 61, 70, 59, 83, 95, 79, 62, 98, 105,
- 103, 104, 138, 151, 157, 125, 161, 165, 169, 132,
- 352, 352, 0, 108, 123, 352, 352, 352, 0, 117,
+ 103, 104, 138, 151, 157, 125, 161, 165, 169, 144,
+ 374, 374, 0, 134, 123, 374, 374, 374, 0, 117,
141, 134, 144, 158, 154, 163, 152, 0, 0, 149,
154, 166, 162, 153, 152, 159, 0, 0, 173, 162,
166, 165, 189, 191, 0, 188, 181, 217, 225, 192,
- 0, 85, 0, 191, 197, 206, 0, 199, 209, 220,
+ 0, 127, 0, 191, 197, 206, 86, 199, 209, 220,
211, 211, 211, 207, 214, 211, 0, 212, 0, 229,
- 0, 220, 224, 228, 232, 226, 240, 0, 0, 0,
- 246, 251, 0, 0, 240, 254, 254, 0, 252, 264,
- 249, 0, 263, 0, 264, 261, 0, 261, 0, 267,
- 0, 264, 261, 263, 0, 86, 269, 0, 266, 266,
- 0, 0, 298, 277, 0, 278, 290, 0, 0, 352,
- 352, 343, 89, 347
+ 0, 220, 224, 228, 232, 226, 240, 0, 0, 263,
+ 0, 247, 254, 0, 0, 245, 260, 260, 0, 257,
+ 266, 251, 0, 265, 0, 266, 264, 269, 271, 0,
+ 267, 0, 272, 0, 270, 267, 269, 0, 91, 278,
+ 374, 281, 0, 283, 283, 0, 0, 320, 287, 304,
+ 0, 296, 304, 0, 313, 0, 374, 298, 374, 374,
+ 365, 115, 369
} ;
-static yyconst flex_int16_t yy_def[155] =
+static yyconst flex_int16_t yy_def[164] =
{ 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, 152,
- 151, 151, 154, 151, 151, 151, 151, 151, 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, 151,
- 0, 151, 151, 151
+ 160, 1, 160, 160, 160, 160, 160, 160, 161, 160,
+ 160, 160, 160, 160, 160, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 160, 160, 160, 160, 160, 160, 160, 161,
+ 160, 160, 163, 160, 160, 160, 160, 160, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 160, 160, 160,
+ 163, 160, 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
+
+ 162, 162, 162, 162, 162, 160, 162, 162, 162, 160,
+ 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
+ 162, 162, 162, 162, 162, 160, 162, 160, 160, 162,
+ 162, 162, 162, 162, 162, 162, 162, 162, 160, 162,
+ 160, 160, 162, 162, 162, 162, 162, 160, 162, 160,
+ 162, 162, 160, 162, 160, 162, 160, 160, 160, 0,
+ 160, 160, 160
} ;
-static yyconst flex_int16_t yy_nxt[410] =
+static yyconst flex_int16_t yy_nxt[432] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
13, 14, 10, 15, 16, 17, 18, 19, 20, 21,
@@ -488,46 +490,49 @@ static yyconst flex_int16_t yy_nxt[410] =
29, 30, 31, 17, 17, 32, 17, 33, 44, 45,
34, 35, 36, 36, 37, 38, 39, 39, 38, 38,
39, 39, 38, 37, 36, 36, 37, 46, 47, 50,
- 51, 52, 53, 56, 54, 57, 61, 143, 58, 59,
- 143, 69, 49, 55, 70, 82, 60, 62, 67, 63,
+ 51, 52, 53, 56, 54, 57, 61, 110, 58, 59,
+ 110, 69, 148, 55, 70, 148, 60, 62, 67, 63,
50, 51, 52, 53, 56, 54, 57, 61, 68, 58,
- 64, 59, 69, 65, 55, 70, 71, 60, 82, 62,
+ 64, 59, 69, 65, 55, 70, 71, 60, 49, 62,
67, 63, 66, 72, 74, 76, 77, 36, 36, 68,
- 75, 64, 44, 45, 83, 65, 73, 41, 71, 78,
- 36, 36, 79, 66, 48, 72, 74, 76, 77, 43,
- 42, 75, 79, 36, 36, 79, 83, 73, 35, 36,
+ 75, 64, 44, 45, 83, 65, 73, 82, 71, 78,
+ 36, 36, 79, 66, 82, 72, 74, 76, 77, 41,
+ 48, 75, 79, 36, 36, 79, 83, 73, 35, 36,
36, 37, 37, 36, 36, 37, 38, 84, 85, 38,
- 38, 39, 39, 38, 86, 87, 88, 89, 41, 90,
- 91, 92, 93, 80, 94, 151, 95, 96, 84, 85,
- 97, 98, 151, 99, 100, 86, 101, 87, 88, 89,
+ 38, 39, 39, 38, 86, 87, 88, 89, 43, 90,
+ 91, 92, 93, 80, 94, 42, 95, 96, 84, 85,
+ 97, 98, 41, 99, 100, 86, 101, 87, 88, 89,
90, 91, 92, 102, 93, 80, 94, 95, 96, 103,
104, 97, 105, 98, 99, 100, 106, 101, 78, 36,
36, 79, 107, 108, 109, 102, 79, 36, 36, 79,
- 110, 103, 104, 105, 111, 112, 117, 106, 113, 114,
- 115, 116, 118, 107, 108, 119, 109, 120, 151, 121,
- 122, 110, 123, 124, 126, 111, 125, 112, 117, 113,
- 114, 115, 116, 118, 127, 128, 119, 129, 130, 120,
- 121, 122, 131, 123, 132, 124, 126, 125, 133, 151,
- 134, 135, 136, 137, 151, 138, 127, 128, 129, 139,
- 130, 140, 141, 142, 131, 144, 132, 145, 146, 143,
-
- 133, 134, 143, 135, 136, 137, 138, 148, 149, 150,
- 151, 139, 140, 141, 142, 151, 144, 151, 145, 146,
- 147, 151, 151, 151, 151, 151, 151, 151, 148, 149,
- 151, 150, 151, 151, 151, 151, 151, 151, 151, 151,
- 151, 151, 147, 40, 151, 40, 40, 81, 151, 151,
- 81, 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
+ 111, 103, 104, 105, 112, 113, 118, 106, 114, 115,
+ 116, 117, 119, 107, 108, 120, 109, 121, 160, 122,
+ 123, 111, 124, 125, 127, 112, 126, 113, 118, 114,
+ 115, 116, 117, 119, 110, 130, 120, 110, 131, 121,
+ 122, 123, 132, 124, 133, 125, 127, 126, 134, 135,
+ 136, 160, 137, 138, 139, 128, 140, 130, 141, 142,
+ 131, 143, 129, 132, 144, 160, 133, 145, 146, 147,
+
+ 134, 135, 136, 137, 149, 138, 139, 128, 140, 150,
+ 141, 142, 143, 129, 151, 152, 144, 154, 145, 146,
+ 147, 148, 155, 157, 148, 149, 156, 158, 160, 159,
+ 150, 160, 160, 160, 160, 151, 152, 160, 154, 160,
+ 160, 160, 153, 160, 155, 157, 160, 156, 160, 158,
+ 159, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+ 160, 160, 160, 160, 153, 40, 160, 40, 40, 81,
+ 160, 160, 81, 3, 160, 160, 160, 160, 160, 160,
+ 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+ 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+
+ 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+ 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+ 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+ 160
} ;
-static yyconst flex_int16_t yy_chk[410] =
+static yyconst flex_int16_t yy_chk[432] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -537,43 +542,46 @@ static yyconst flex_int16_t yy_chk[410] =
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, 20, 21, 20, 22, 24, 136, 22, 23,
- 136, 28, 153, 20, 28, 82, 23, 25, 27, 25,
+ 18, 19, 20, 21, 20, 22, 24, 87, 22, 23,
+ 87, 28, 139, 20, 28, 139, 23, 25, 27, 25,
16, 18, 19, 20, 21, 20, 22, 24, 27, 22,
- 25, 23, 28, 26, 20, 28, 29, 23, 44, 25,
+ 25, 23, 28, 26, 20, 28, 29, 23, 162, 25,
27, 25, 26, 30, 31, 32, 32, 36, 36, 27,
- 31, 25, 45, 45, 50, 26, 30, 40, 29, 33,
- 33, 33, 33, 26, 15, 30, 31, 32, 32, 12,
- 11, 31, 34, 34, 34, 34, 50, 30, 35, 35,
+ 31, 25, 45, 45, 50, 26, 30, 82, 29, 33,
+ 33, 33, 33, 26, 44, 30, 31, 32, 32, 40,
+ 15, 31, 34, 34, 34, 34, 50, 30, 35, 35,
35, 35, 37, 37, 37, 37, 38, 51, 52, 38,
- 39, 39, 39, 39, 53, 54, 55, 56, 9, 57,
- 60, 61, 62, 38, 63, 3, 64, 65, 51, 52,
- 66, 69, 0, 70, 71, 53, 72, 54, 55, 56,
+ 39, 39, 39, 39, 53, 54, 55, 56, 12, 57,
+ 60, 61, 62, 38, 63, 11, 64, 65, 51, 52,
+ 66, 69, 9, 70, 71, 53, 72, 54, 55, 56,
57, 60, 61, 73, 62, 38, 63, 64, 65, 74,
76, 66, 77, 69, 70, 71, 80, 72, 78, 78,
78, 78, 84, 85, 86, 73, 79, 79, 79, 79,
88, 74, 76, 77, 89, 90, 95, 80, 91, 92,
- 93, 94, 96, 84, 85, 98, 86, 100, 0, 102,
+ 93, 94, 96, 84, 85, 98, 86, 100, 3, 102,
103, 88, 104, 105, 107, 89, 106, 90, 95, 91,
- 92, 93, 94, 96, 111, 112, 98, 115, 116, 100,
- 102, 103, 117, 104, 119, 105, 107, 106, 120, 0,
- 121, 123, 125, 126, 0, 128, 111, 112, 115, 130,
- 116, 132, 133, 134, 117, 137, 119, 139, 140, 143,
-
- 120, 121, 143, 123, 125, 126, 128, 144, 146, 147,
- 0, 130, 132, 133, 134, 0, 137, 0, 139, 140,
- 143, 0, 0, 0, 0, 0, 0, 0, 144, 146,
- 0, 147, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 143, 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
+ 92, 93, 94, 96, 110, 112, 98, 110, 113, 100,
+ 102, 103, 116, 104, 117, 105, 107, 106, 118, 120,
+ 121, 0, 122, 124, 126, 110, 127, 112, 128, 129,
+ 113, 131, 110, 116, 133, 0, 117, 135, 136, 137,
+
+ 118, 120, 121, 122, 140, 124, 126, 110, 127, 142,
+ 128, 129, 131, 110, 144, 145, 133, 149, 135, 136,
+ 137, 148, 150, 153, 148, 140, 152, 155, 0, 158,
+ 142, 0, 0, 0, 0, 144, 145, 0, 149, 0,
+ 0, 0, 148, 0, 150, 153, 0, 152, 0, 155,
+ 158, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 148, 161, 0, 161, 161, 163,
+ 0, 0, 163, 160, 160, 160, 160, 160, 160, 160,
+ 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+ 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+
+ 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+ 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+ 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+ 160
} ;
static yy_state_type yy_last_accepting_state;
@@ -636,7 +644,7 @@ static void countnl() {
Director::g_lingo->_colnumber = strlen(p);
}
-#line 640 "engines/director/lingo/lingo-lex.cpp"
+#line 648 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -824,7 +832,7 @@ YY_DECL
#line 58 "engines/director/lingo/lingo-lex.l"
-#line 828 "engines/director/lingo/lingo-lex.cpp"
+#line 836 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -878,13 +886,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 >= 161 )
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] != 352 );
+ while ( yy_base[yy_current_state] != 374 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -963,146 +971,151 @@ YY_RULE_SETUP
case 11:
YY_RULE_SETUP
#line 71 "engines/director/lingo/lingo-lex.l"
-{ count(); return tEND; }
+{ count(); return tENDIF; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 72 "engines/director/lingo/lingo-lex.l"
-{ count(); return tEXIT; }
+{ count(); return tENDREPEAT; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 73 "engines/director/lingo/lingo-lex.l"
-{ count(); return tFRAME; }
+{ count(); return tEXIT; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 74 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGLOBAL; }
+{ count(); return tFRAME; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 75 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGO; }
+{ count(); return tGLOBAL; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 76 "engines/director/lingo/lingo-lex.l"
-{ count(); return tINTO; }
+{ count(); return tGO; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 77 "engines/director/lingo/lingo-lex.l"
-{ count(); return tLOOP; }
+{ count(); return tINTO; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 78 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMACRO; }
+{ count(); return tLOOP; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 79 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMCI; }
+{ count(); return tMACRO; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 80 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMCIWAIT; }
+{ count(); return tMCI; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 81 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMOVIE; }
+{ count(); return tMCIWAIT; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 82 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNEXT; }
+{ count(); return tMOVIE; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 83 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNOT; }
+{ count(); return tNEXT; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 84 "engines/director/lingo/lingo-lex.l"
-{ count(); return tOF; }
+{ count(); return tNOT; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 85 "engines/director/lingo/lingo-lex.l"
-{ count(); return tOR; }
+{ count(); return tOF; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 86 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPREVIOUS; }
+{ count(); return tOR; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 87 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPUT; }
+{ count(); return tPREVIOUS; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 88 "engines/director/lingo/lingo-lex.l"
-{ count(); return tREPEAT; }
+{ count(); return tPUT; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 89 "engines/director/lingo/lingo-lex.l"
-{ count(); return tSET; }
+{ count(); return tREPEAT; }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 90 "engines/director/lingo/lingo-lex.l"
-{ count(); return tSTARTS; }
+{ count(); return tSET; }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 91 "engines/director/lingo/lingo-lex.l"
-{ count(); return tTHEN; }
+{ count(); return tSTARTS; }
YY_BREAK
case 32:
YY_RULE_SETUP
#line 92 "engines/director/lingo/lingo-lex.l"
-{ count(); return tTO; }
+{ count(); return tTHEN; }
YY_BREAK
case 33:
YY_RULE_SETUP
#line 93 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWITH; }
+{ count(); return tTO; }
YY_BREAK
case 34:
YY_RULE_SETUP
#line 94 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWHILE; }
+{ count(); return tWITH; }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 96 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNEQ; }
+#line 95 "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; }
+{ count(); return tNEQ; }
YY_BREAK
case 37:
YY_RULE_SETUP
#line 98 "engines/director/lingo/lingo-lex.l"
-{ count(); return tLE; }
+{ count(); return tGE; }
YY_BREAK
case 38:
YY_RULE_SETUP
#line 99 "engines/director/lingo/lingo-lex.l"
-{ count(); return tCONCAT; }
+{ count(); return tLE; }
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 101 "engines/director/lingo/lingo-lex.l"
+#line 100 "engines/director/lingo/lingo-lex.l"
+{ count(); return tCONCAT; }
+ YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 102 "engines/director/lingo/lingo-lex.l"
{
count();
yylval.s = new Common::String(yytext);
@@ -1113,43 +1126,43 @@ YY_RULE_SETUP
return ID;
}
YY_BREAK
-case 40:
-YY_RULE_SETUP
-#line 110 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.f = atof(yytext); return FLOAT; }
- YY_BREAK
case 41:
YY_RULE_SETUP
#line 111 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ count(); yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 42:
YY_RULE_SETUP
#line 112 "engines/director/lingo/lingo-lex.l"
-{ count(); return *yytext; }
+{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 43:
-/* rule 43 can match eol */
YY_RULE_SETUP
#line 113 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ count(); return *yytext; }
YY_BREAK
case 44:
+/* rule 44 can match eol */
YY_RULE_SETUP
#line 114 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return '\n'; }
YY_BREAK
case 45:
YY_RULE_SETUP
#line 115 "engines/director/lingo/lingo-lex.l"
-
+{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 117 "engines/director/lingo/lingo-lex.l"
+#line 116 "engines/director/lingo/lingo-lex.l"
+
+ YY_BREAK
+case 47:
+YY_RULE_SETUP
+#line 118 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1153 "engines/director/lingo/lingo-lex.cpp"
+#line 1166 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1442,7 +1455,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 >= 161 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1470,11 +1483,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 >= 161 )
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 == 160);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2149,7 +2162,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 117 "engines/director/lingo/lingo-lex.l"
+#line 118 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 6a78a3f..4b0f8fe 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -68,7 +68,8 @@ whitespace [\t ]
(?i:[\n\r]+[\t ]+else[\t ]+if) { countnl(); return tNLELSIF; }
(?i:[\n\r]+[\t ]+else) { countnl(); return tNLELSE; }
(?i:else) { count(); return tELSE; }
-(?i:end) { count(); return tEND; }
+(?i:end[\t ]+if) { count(); return tENDIF; }
+(?i:end[\t ]+repeat) { count(); return tENDREPEAT; }
(?i:exit) { count(); return tEXIT; }
(?i:frame) { count(); return tFRAME; }
(?i:global) { count(); return tGLOBAL; }
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index dd3d0cd..09e3805 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -91,6 +91,8 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
_linenumber = _colnumber = 0;
+ _hadError = false;
+
_floatPrecision = 4;
_floatPrecisionFormat = "%.4f";
@@ -112,6 +114,7 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
_scripts[type][id] = _currentScript;
_linenumber = _colnumber = 1;
+ _hadError = false;
const char *begin, *end;
@@ -126,7 +129,9 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
begin = code;
first = false;
}
- Common::String chunk(begin, end);
+ Common::String chunk(begin, end + 1);
+
+ debug(2, "Code chunk\n#####\n%s#####", chunk.c_str());
parse(chunk.c_str());
@@ -135,6 +140,7 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
begin = end + 1;
}
+ _hadError = false;
parse(begin);
} else {
parse(code);
@@ -315,8 +321,13 @@ void Lingo::runTests() {
warning("Executing file %s of size %d", m.getName().c_str(), size);
+ _hadError = false;
addCode(script, kMovieScript, counter);
- executeScript(kMovieScript, counter);
+
+ if (!_hadError)
+ executeScript(kMovieScript, counter);
+ else
+ warning("Skipping execution");
free(script);
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 1509c1d..9e8e6f1 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -270,6 +270,8 @@ public:
Common::String _floatPrecisionFormat;
+ bool _hadError;
+
private:
int parse(const char *code);
void push(Datum d);
diff --git a/engines/director/lingo/tests/macros.lingo b/engines/director/lingo/tests/macros.lingo
index a75dc4c..7ffa557 100644
--- a/engines/director/lingo/tests/macros.lingo
+++ b/engines/director/lingo/tests/macros.lingo
@@ -3,7 +3,7 @@ macro SHIPX
global x, y
set x = Random(5)
if x = 1 then
-go \"Zoom\"
+go "Zoom"
exit
end if
if x >1 then
@@ -16,7 +16,7 @@ put 100
macro ZIPX
set x = Random(5)
if x = 1 then
-go \"ZIP\"
+go "ZIP"
exit
end if
if x >1 then
Commit: dff575bea4451113a8268709d2b0c4c8004f61a6
https://github.com/scummvm/scummvm/commit/dff575bea4451113a8268709d2b0c4c8004f61a6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Further work on if() statement
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index adb97fe..ff46cb4 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -79,42 +79,41 @@
tDOWN = 268,
tELSE = 269,
tNLELSIF = 270,
- tENDIF = 271,
- tENDREPEAT = 272,
- tEXIT = 273,
- tFRAME = 274,
- tGLOBAL = 275,
- tGO = 276,
- tIF = 277,
- tINTO = 278,
- tLOOP = 279,
- tMACRO = 280,
- tMCI = 281,
- tMCIWAIT = 282,
- tMOVIE = 283,
- tNEXT = 284,
- tOF = 285,
- tPREVIOUS = 286,
- tPUT = 287,
- tREPEAT = 288,
- tSET = 289,
- tTHEN = 290,
- tTO = 291,
- tWITH = 292,
- tWHILE = 293,
- tNLELSE = 294,
- tGE = 295,
- tLE = 296,
- tGT = 297,
- tLT = 298,
- tEQ = 299,
- tNEQ = 300,
- tAND = 301,
- tOR = 302,
- tNOT = 303,
- tCONCAT = 304,
- tCONTAINS = 305,
- tSTARTS = 306
+ tEND = 271,
+ tEXIT = 272,
+ tFRAME = 273,
+ tGLOBAL = 274,
+ tGO = 275,
+ tIF = 276,
+ tINTO = 277,
+ tLOOP = 278,
+ tMACRO = 279,
+ tMCI = 280,
+ tMCIWAIT = 281,
+ tMOVIE = 282,
+ tNEXT = 283,
+ tOF = 284,
+ tPREVIOUS = 285,
+ tPUT = 286,
+ tREPEAT = 287,
+ tSET = 288,
+ tTHEN = 289,
+ tTO = 290,
+ tWITH = 291,
+ tWHILE = 292,
+ tNLELSE = 293,
+ tGE = 294,
+ tLE = 295,
+ tGT = 296,
+ tLT = 297,
+ tEQ = 298,
+ tNEQ = 299,
+ tAND = 300,
+ tOR = 301,
+ tNOT = 302,
+ tCONCAT = 303,
+ tCONTAINS = 304,
+ tSTARTS = 305
};
#endif
/* Tokens. */
@@ -131,42 +130,41 @@
#define tDOWN 268
#define tELSE 269
#define tNLELSIF 270
-#define tENDIF 271
-#define tENDREPEAT 272
-#define tEXIT 273
-#define tFRAME 274
-#define tGLOBAL 275
-#define tGO 276
-#define tIF 277
-#define tINTO 278
-#define tLOOP 279
-#define tMACRO 280
-#define tMCI 281
-#define tMCIWAIT 282
-#define tMOVIE 283
-#define tNEXT 284
-#define tOF 285
-#define tPREVIOUS 286
-#define tPUT 287
-#define tREPEAT 288
-#define tSET 289
-#define tTHEN 290
-#define tTO 291
-#define tWITH 292
-#define tWHILE 293
-#define tNLELSE 294
-#define tGE 295
-#define tLE 296
-#define tGT 297
-#define tLT 298
-#define tEQ 299
-#define tNEQ 300
-#define tAND 301
-#define tOR 302
-#define tNOT 303
-#define tCONCAT 304
-#define tCONTAINS 305
-#define tSTARTS 306
+#define tEND 271
+#define tEXIT 272
+#define tFRAME 273
+#define tGLOBAL 274
+#define tGO 275
+#define tIF 276
+#define tINTO 277
+#define tLOOP 278
+#define tMACRO 279
+#define tMCI 280
+#define tMCIWAIT 281
+#define tMOVIE 282
+#define tNEXT 283
+#define tOF 284
+#define tPREVIOUS 285
+#define tPUT 286
+#define tREPEAT 287
+#define tSET 288
+#define tTHEN 289
+#define tTO 290
+#define tWITH 291
+#define tWHILE 292
+#define tNLELSE 293
+#define tGE 294
+#define tLE 295
+#define tGT 296
+#define tLT 297
+#define tEQ 298
+#define tNEQ 299
+#define tAND 300
+#define tOR 301
+#define tNOT 302
+#define tCONCAT 303
+#define tCONTAINS 304
+#define tSTARTS 305
@@ -219,7 +217,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 223 "engines/director/lingo/lingo-gr.cpp"
+#line 221 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -232,7 +230,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 236 "engines/director/lingo/lingo-gr.cpp"
+#line 234 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -447,20 +445,20 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 65
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 534
+#define YYLAST 555
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 65
+#define YYNTOKENS 64
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 33
/* YYNRULES -- Number of rules. */
-#define YYNRULES 105
+#define YYNRULES 106
/* YYNRULES -- Number of states. */
-#define YYNSTATES 221
+#define YYNSTATES 225
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 306
+#define YYMAXUTOK 305
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -469,12 +467,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 58, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 57, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 57, 63, 2,
- 59, 60, 55, 53, 64, 54, 2, 56, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 56, 62, 2,
+ 58, 59, 54, 52, 63, 53, 2, 55, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 62, 52, 61, 2, 2, 2, 2, 2, 2, 2,
+ 61, 51, 60, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -498,7 +496,7 @@ static const yytype_uint8 yytranslate[] =
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51
+ 45, 46, 47, 48, 49, 50
};
#if YYDEBUG
@@ -508,60 +506,60 @@ static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 12, 14, 15, 17, 19,
21, 23, 25, 30, 35, 40, 42, 44, 46, 48,
- 56, 67, 79, 87, 99, 111, 118, 129, 140, 141,
- 145, 148, 150, 153, 155, 162, 164, 170, 172, 176,
- 180, 183, 187, 189, 191, 192, 193, 197, 199, 201,
- 203, 205, 210, 215, 217, 219, 223, 227, 231, 235,
- 239, 243, 247, 251, 255, 259, 263, 266, 270, 274,
- 278, 282, 285, 288, 292, 295, 298, 301, 303, 305,
- 308, 310, 314, 317, 320, 323, 326, 330, 333, 337,
- 340, 343, 345, 349, 352, 356, 357, 367, 368, 370,
- 374, 379, 380, 384, 385, 387
+ 57, 69, 82, 91, 104, 117, 124, 135, 146, 147,
+ 151, 154, 156, 159, 161, 168, 170, 176, 178, 182,
+ 186, 189, 193, 195, 197, 198, 199, 200, 203, 206,
+ 208, 210, 212, 217, 222, 224, 226, 230, 234, 238,
+ 242, 246, 250, 254, 258, 262, 266, 270, 273, 277,
+ 281, 285, 289, 292, 295, 299, 302, 305, 308, 310,
+ 312, 315, 317, 321, 324, 327, 330, 333, 337, 340,
+ 344, 347, 350, 352, 356, 359, 363, 364, 373, 374,
+ 376, 380, 385, 386, 390, 391, 393
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 66, 0, -1, 66, 67, 68, -1, 68, -1, 1,
- 58, -1, 58, -1, -1, 92, -1, 87, -1, 96,
- -1, 69, -1, 71, -1, 32, 86, 23, 10, -1,
- 34, 10, 52, 86, -1, 34, 10, 36, 86, -1,
- 86, -1, 87, -1, 70, -1, 72, -1, 79, 59,
- 78, 60, 85, 84, 17, -1, 80, 52, 86, 84,
- 36, 86, 84, 85, 84, 17, -1, 80, 52, 86,
- 84, 13, 36, 86, 84, 85, 84, 17, -1, 81,
- 78, 35, 67, 85, 84, 16, -1, 81, 78, 35,
- 67, 85, 84, 39, 85, 84, 67, 16, -1, 81,
- 78, 35, 67, 85, 84, 83, 74, 84, 67, 16,
- -1, 81, 78, 35, 83, 70, 84, -1, 81, 78,
- 35, 83, 70, 84, 39, 83, 70, 84, -1, 81,
- 78, 35, 83, 70, 84, 75, 84, 73, 84, -1,
- -1, 39, 83, 70, -1, 74, 77, -1, 77, -1,
- 75, 76, -1, 76, -1, 82, 78, 35, 83, 71,
- 84, -1, 75, -1, 82, 78, 35, 85, 84, -1,
- 86, -1, 86, 52, 86, -1, 59, 78, 60, -1,
- 33, 38, -1, 33, 37, 10, -1, 22, -1, 15,
- -1, -1, -1, 85, 67, 71, -1, 71, -1, 7,
- -1, 8, -1, 11, -1, 9, 59, 97, 60, -1,
- 10, 59, 97, 60, -1, 10, -1, 69, -1, 86,
- 53, 86, -1, 86, 54, 86, -1, 86, 55, 86,
- -1, 86, 56, 86, -1, 86, 61, 86, -1, 86,
- 62, 86, -1, 86, 45, 86, -1, 86, 40, 86,
- -1, 86, 41, 86, -1, 86, 46, 86, -1, 86,
- 47, 86, -1, 48, 86, -1, 86, 63, 86, -1,
- 86, 49, 86, -1, 86, 50, 86, -1, 86, 51,
- 86, -1, 53, 86, -1, 54, 86, -1, 59, 86,
- 60, -1, 26, 11, -1, 27, 10, -1, 32, 86,
- -1, 89, -1, 18, -1, 20, 88, -1, 10, -1,
- 88, 64, 10, -1, 21, 24, -1, 21, 29, -1,
- 21, 31, -1, 21, 90, -1, 21, 90, 91, -1,
- 21, 91, -1, 36, 19, 11, -1, 19, 11, -1,
- 36, 11, -1, 11, -1, 30, 28, 11, -1, 28,
- 11, -1, 36, 28, 11, -1, -1, 25, 10, 93,
- 83, 94, 67, 95, 85, 67, -1, -1, 10, -1,
- 94, 64, 10, -1, 94, 67, 64, 10, -1, -1,
- 10, 83, 97, -1, -1, 86, -1, 97, 64, 86,
- -1
+ 65, 0, -1, 65, 66, 67, -1, 67, -1, 1,
+ 57, -1, 57, -1, -1, 91, -1, 86, -1, 95,
+ -1, 68, -1, 70, -1, 31, 85, 22, 10, -1,
+ 33, 10, 51, 85, -1, 33, 10, 35, 85, -1,
+ 85, -1, 86, -1, 69, -1, 71, -1, 78, 58,
+ 77, 59, 84, 83, 16, 32, -1, 79, 51, 85,
+ 83, 35, 85, 83, 84, 83, 16, 32, -1, 79,
+ 51, 85, 83, 13, 35, 85, 83, 84, 83, 16,
+ 32, -1, 80, 77, 34, 66, 84, 83, 16, 21,
+ -1, 80, 77, 34, 66, 84, 83, 38, 84, 83,
+ 66, 16, 21, -1, 80, 77, 34, 66, 84, 83,
+ 82, 73, 83, 66, 16, 21, -1, 80, 77, 34,
+ 82, 69, 83, -1, 80, 77, 34, 82, 69, 83,
+ 38, 82, 69, 83, -1, 80, 77, 34, 82, 69,
+ 83, 74, 83, 72, 83, -1, -1, 38, 82, 69,
+ -1, 73, 76, -1, 76, -1, 74, 75, -1, 75,
+ -1, 81, 77, 34, 82, 70, 83, -1, 74, -1,
+ 81, 77, 34, 84, 83, -1, 85, -1, 85, 51,
+ 85, -1, 58, 77, 59, -1, 32, 37, -1, 32,
+ 36, 10, -1, 21, -1, 15, -1, -1, -1, -1,
+ 84, 66, -1, 84, 70, -1, 7, -1, 8, -1,
+ 11, -1, 9, 58, 96, 59, -1, 10, 58, 96,
+ 59, -1, 10, -1, 68, -1, 85, 52, 85, -1,
+ 85, 53, 85, -1, 85, 54, 85, -1, 85, 55,
+ 85, -1, 85, 60, 85, -1, 85, 61, 85, -1,
+ 85, 44, 85, -1, 85, 39, 85, -1, 85, 40,
+ 85, -1, 85, 45, 85, -1, 85, 46, 85, -1,
+ 47, 85, -1, 85, 62, 85, -1, 85, 48, 85,
+ -1, 85, 49, 85, -1, 85, 50, 85, -1, 52,
+ 85, -1, 53, 85, -1, 58, 85, 59, -1, 25,
+ 11, -1, 26, 10, -1, 31, 85, -1, 88, -1,
+ 17, -1, 19, 87, -1, 10, -1, 87, 63, 10,
+ -1, 20, 23, -1, 20, 28, -1, 20, 30, -1,
+ 20, 89, -1, 20, 89, 90, -1, 20, 90, -1,
+ 35, 18, 11, -1, 18, 11, -1, 35, 11, -1,
+ 11, -1, 29, 27, 11, -1, 27, 11, -1, 35,
+ 27, 11, -1, -1, 24, 10, 92, 82, 93, 66,
+ 94, 84, -1, -1, 10, -1, 93, 63, 10, -1,
+ 93, 66, 63, 10, -1, -1, 10, 82, 96, -1,
+ -1, 85, -1, 96, 63, 85, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -571,13 +569,13 @@ static const yytype_uint16 yyrline[] =
109, 110, 113, 119, 125, 132, 133, 135, 136, 141,
152, 168, 182, 189, 198, 207, 217, 227, 238, 239,
242, 243, 246, 247, 250, 258, 259, 267, 268, 269,
- 271, 273, 279, 285, 292, 294, 296, 297, 300, 305,
- 308, 311, 317, 325, 328, 329, 330, 331, 332, 333,
+ 271, 273, 279, 285, 292, 294, 296, 297, 298, 301,
+ 306, 309, 312, 318, 326, 329, 330, 331, 332, 333,
334, 335, 336, 337, 338, 339, 340, 341, 342, 343,
- 344, 345, 346, 347, 350, 351, 352, 353, 354, 356,
- 359, 360, 371, 372, 373, 374, 379, 385, 392, 393,
- 394, 395, 398, 399, 400, 428, 428, 435, 436, 437,
- 438, 440, 443, 451, 452, 453
+ 344, 345, 346, 347, 348, 351, 352, 353, 354, 355,
+ 357, 360, 361, 372, 373, 374, 375, 380, 386, 393,
+ 394, 395, 396, 399, 400, 401, 429, 429, 436, 437,
+ 438, 439, 441, 444, 452, 453, 454
};
#endif
@@ -588,9 +586,9 @@ static const char *const yytname[] =
{
"$end", "error", "$undefined", "CASTREF", "UNARY", "VOID", "VAR", "INT",
"FLOAT", "BLTIN", "ID", "STRING", "HANDLER", "tDOWN", "tELSE",
- "tNLELSIF", "tENDIF", "tENDREPEAT", "tEXIT", "tFRAME", "tGLOBAL", "tGO",
- "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT",
- "tOF", "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH",
+ "tNLELSIF", "tEND", "tEXIT", "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO",
+ "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF",
+ "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH",
"tWHILE", "tNLELSE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "tAND",
"tOR", "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS", "'='", "'+'", "'-'",
"'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','",
@@ -613,41 +611,41 @@ static const yytype_uint16 yytoknum[] =
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 61, 43, 45, 42, 47, 37, 10, 40,
- 41, 62, 60, 38, 44
+ 305, 61, 43, 45, 42, 47, 37, 10, 40, 41,
+ 62, 60, 38, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 65, 66, 66, 66, 67, 68, 68, 68, 68,
- 68, 68, 69, 69, 69, 70, 70, 71, 71, 71,
- 71, 71, 72, 72, 72, 72, 72, 72, 73, 73,
- 74, 74, 75, 75, 76, 77, 77, 78, 78, 78,
- 79, 80, 81, 82, 83, 84, 85, 85, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 87, 87, 87, 87, 87, 87,
- 88, 88, 89, 89, 89, 89, 89, 89, 90, 90,
- 90, 90, 91, 91, 91, 93, 92, 94, 94, 94,
- 94, 95, 96, 97, 97, 97
+ 0, 64, 65, 65, 65, 66, 67, 67, 67, 67,
+ 67, 67, 68, 68, 68, 69, 69, 70, 70, 70,
+ 70, 70, 71, 71, 71, 71, 71, 71, 72, 72,
+ 73, 73, 74, 74, 75, 76, 76, 77, 77, 77,
+ 78, 79, 80, 81, 82, 83, 84, 84, 84, 85,
+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
+ 85, 85, 85, 85, 85, 86, 86, 86, 86, 86,
+ 86, 87, 87, 88, 88, 88, 88, 88, 88, 89,
+ 89, 89, 89, 90, 90, 90, 92, 91, 93, 93,
+ 93, 93, 94, 95, 96, 96, 96
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 2, 1, 0, 1, 1, 1,
- 1, 1, 4, 4, 4, 1, 1, 1, 1, 7,
- 10, 11, 7, 11, 11, 6, 10, 10, 0, 3,
+ 1, 1, 4, 4, 4, 1, 1, 1, 1, 8,
+ 11, 12, 8, 12, 12, 6, 10, 10, 0, 3,
2, 1, 2, 1, 6, 1, 5, 1, 3, 3,
- 2, 3, 1, 1, 0, 0, 3, 1, 1, 1,
- 1, 4, 4, 1, 1, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 2, 3, 3, 3,
- 3, 2, 2, 3, 2, 2, 2, 1, 1, 2,
- 1, 3, 2, 2, 2, 2, 3, 2, 3, 2,
- 2, 1, 3, 2, 3, 0, 9, 0, 1, 3,
- 4, 0, 3, 0, 1, 3
+ 2, 3, 1, 1, 0, 0, 0, 2, 2, 1,
+ 1, 1, 4, 4, 1, 1, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 2, 3, 3,
+ 3, 3, 2, 2, 3, 2, 2, 2, 1, 1,
+ 2, 1, 3, 2, 2, 2, 2, 3, 2, 3,
+ 2, 2, 1, 3, 2, 3, 0, 8, 0, 1,
+ 3, 4, 0, 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -655,125 +653,129 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 0, 48, 49, 0, 44, 50, 78, 0, 0,
+ 0, 0, 49, 50, 0, 44, 51, 79, 0, 0,
42, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 3, 54, 17, 11, 18, 0, 0, 0,
- 15, 8, 77, 7, 9, 4, 103, 103, 103, 80,
- 79, 91, 0, 82, 0, 83, 0, 84, 0, 85,
- 87, 95, 74, 75, 53, 0, 54, 76, 0, 40,
- 0, 66, 71, 72, 0, 1, 5, 6, 0, 0,
+ 0, 0, 3, 55, 17, 11, 18, 0, 0, 0,
+ 15, 8, 78, 7, 9, 4, 104, 104, 104, 81,
+ 80, 92, 0, 83, 0, 84, 0, 85, 0, 86,
+ 88, 96, 75, 76, 54, 0, 55, 77, 0, 40,
+ 0, 67, 72, 73, 0, 1, 5, 6, 0, 0,
0, 0, 37, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 104, 0,
- 0, 102, 0, 89, 93, 0, 90, 0, 0, 0,
- 86, 44, 0, 0, 41, 0, 0, 73, 2, 0,
- 45, 0, 0, 44, 0, 62, 63, 61, 64, 65,
- 68, 69, 70, 55, 56, 57, 58, 59, 60, 67,
- 51, 0, 52, 81, 92, 88, 94, 97, 12, 14,
- 13, 0, 0, 39, 0, 0, 38, 105, 98, 0,
- 47, 45, 16, 0, 0, 45, 45, 0, 101, 0,
- 0, 0, 45, 44, 25, 99, 0, 0, 46, 19,
- 45, 0, 22, 0, 0, 43, 44, 45, 33, 0,
- 100, 0, 0, 45, 0, 45, 35, 31, 0, 0,
- 32, 28, 0, 96, 45, 0, 0, 30, 0, 0,
- 45, 44, 45, 44, 0, 20, 0, 0, 0, 26,
- 0, 27, 0, 21, 23, 24, 45, 29, 45, 36,
- 34
+ 0, 0, 0, 0, 0, 0, 0, 0, 105, 0,
+ 0, 103, 0, 90, 94, 0, 91, 0, 0, 0,
+ 87, 44, 0, 0, 41, 0, 0, 74, 2, 0,
+ 45, 0, 0, 44, 0, 63, 64, 62, 65, 66,
+ 69, 70, 71, 56, 57, 58, 59, 60, 61, 68,
+ 52, 0, 53, 82, 93, 89, 95, 98, 12, 14,
+ 13, 46, 0, 39, 46, 0, 38, 106, 99, 0,
+ 45, 0, 0, 45, 45, 16, 0, 102, 47, 48,
+ 0, 0, 45, 44, 25, 100, 0, 46, 0, 45,
+ 46, 0, 46, 0, 43, 44, 45, 33, 0, 101,
+ 97, 19, 46, 45, 22, 0, 45, 35, 31, 0,
+ 0, 32, 28, 0, 45, 0, 0, 30, 0, 0,
+ 45, 44, 45, 44, 0, 0, 0, 0, 44, 26,
+ 0, 27, 0, 0, 20, 0, 0, 45, 29, 45,
+ 21, 23, 24, 36, 34
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 21, 159, 22, 56, 24, 150, 26, 202, 185,
- 186, 178, 187, 71, 27, 28, 29, 179, 212, 142,
- 151, 30, 152, 40, 32, 49, 50, 33, 101, 149,
+ -1, 21, 158, 22, 56, 24, 159, 26, 202, 186,
+ 187, 177, 188, 71, 27, 28, 29, 178, 212, 142,
+ 150, 30, 155, 40, 32, 49, 50, 33, 101, 149,
167, 34, 89
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -167
+#define YYPACT_NINF -161
static const yytype_int16 yypact[] =
{
- 181, -50, -167, -167, -49, 428, -167, -167, 25, 134,
- -167, 45, 47, 78, 320, -11, 81, 320, 320, 320,
- 320, 4, -167, 28, -167, -167, -167, 33, 53, 327,
- 409, -167, -167, -167, -167, -167, 320, 320, 320, -167,
- 30, -167, 88, -167, 96, -167, 85, -167, 18, 67,
- -167, -167, -167, -167, 56, 320, -167, -2, 110, -167,
- -29, 471, 471, 471, 366, -167, -167, 234, 327, 320,
- 327, 86, 390, 320, 320, 320, 320, 320, 320, 320,
- 320, 320, 320, 320, 320, 320, 320, 320, 409, 42,
- 52, 58, 114, -167, -167, 116, -167, 119, 121, 97,
- -167, -167, -2, 123, -167, 320, 320, -167, -167, 79,
- 409, 80, 342, 83, 320, 409, 409, 409, 409, 409,
- 409, 409, 409, 452, 452, 471, 471, 409, 409, 409,
- -167, 320, -167, -167, -167, -167, -167, 128, -167, 409,
- 409, 263, 5, -167, 263, 292, 409, 409, -167, -24,
- -167, 83, -167, 106, 320, 83, -167, 133, 84, 263,
- 127, 320, 409, 3, -9, -167, 137, 263, -167, -167,
- 409, 263, -167, 263, 136, -167, -167, 136, -167, 327,
- -167, 83, 263, 83, 83, 136, 136, -167, 327, 292,
- -167, 115, 120, 263, 83, 140, 83, -167, 83, 131,
- -167, -167, -167, -167, 150, -167, 152, 153, 263, -167,
- 292, -167, 263, -167, -167, -167, 83, -167, -167, -167,
- -167
+ 175, -49, -161, -161, -15, 469, -161, -161, 32, 118,
+ -161, 52, 40, 82, 342, 24, 83, 342, 342, 342,
+ 342, 9, -161, 11, -161, -161, -161, 37, 47, 349,
+ 450, -161, -161, -161, -161, -161, 342, 342, 342, -161,
+ 43, -161, 99, -161, 101, -161, 87, -161, 36, 29,
+ -161, -161, -161, -161, 57, 342, -161, 364, 107, -161,
+ -10, -16, -16, -16, 407, -161, -161, 227, 349, 342,
+ 349, 85, 431, 342, 342, 342, 342, 342, 342, 342,
+ 342, 342, 342, 342, 342, 342, 342, 342, 450, 41,
+ 42, 58, 110, -161, -161, 111, -161, 112, 115, 100,
+ -161, -161, 364, 121, -161, 342, 342, -161, -161, 69,
+ 450, 78, 383, 81, 342, 450, 450, 450, 450, 450,
+ 450, 450, 450, 493, 493, -16, -16, 450, 450, 450,
+ -161, 342, -161, -161, -161, -161, -161, 129, -161, 450,
+ 450, -161, 1, -161, -161, 314, 450, 450, -161, 33,
+ 256, 105, 342, 256, -161, -161, 132, 89, -161, -161,
+ 128, 342, 450, -1, -3, -161, 140, -161, 123, 450,
+ -161, 135, -161, 142, -161, -161, 142, -161, 349, -161,
+ 256, -161, -161, 256, -161, 256, 142, 142, -161, 349,
+ 314, -161, 120, 126, 256, 145, 81, -161, 81, 130,
+ -161, -161, -161, -161, 146, 133, 151, 153, -5, -161,
+ 314, -161, 285, 138, -161, 152, 157, 256, -161, -161,
+ -161, -161, -161, -161, -161
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -167, -167, -20, 104, 16, -123, 0, -167, -167, -167,
- 11, -166, -8, -65, -167, -167, -167, -149, -3, -66,
- -36, -5, 17, -167, -167, -167, 130, -167, -167, -167,
- -167, -167, 19
+ -161, -161, -19, 114, 6, -141, 0, -161, -161, -161,
+ 8, -128, -12, -65, -161, -161, -161, -160, -4, -51,
+ -117, 2, 7, -161, -161, -161, 139, -161, -161, -161,
+ -161, -161, -20
};
/* 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 -54
+#define YYTABLE_NINF -55
static const yytype_int16 yytable[] =
{
- 25, 67, 38, 109, 65, 111, 175, 105, 35, 57,
- 36, 190, 61, 62, 63, 64, 23, 31, 153, 172,
- 190, 103, 156, 106, 72, 188, 58, 59, -10, 96,
- 176, 88, 88, 88, 66, 39, 188, 97, 73, 74,
- 157, 154, 173, 75, 76, 77, 98, 78, 79, 80,
- 102, 81, 82, 83, 84, 51, 90, 91, 52, 85,
- 86, 87, 66, 72, 110, 112, 200, 25, 115, 116,
- 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
- 127, 128, 129, 23, 31, 160, -10, 217, 53, 163,
- 164, 60, 68, 144, 92, 44, 171, 46, 137, 93,
- 139, 140, 130, 99, 182, 69, 131, 94, 155, 146,
- 145, 191, 132, 95, 192, 37, 131, 195, 196, 198,
- 104, 113, 131, 199, 133, 98, 147, 134, 204, 158,
- 135, 181, 136, 138, 209, 183, 211, 184, 148, 141,
- 143, 66, 161, 165, 169, 41, 194, 180, 166, 162,
- 219, 175, 220, 42, 201, 203, 170, 205, 43, 168,
- 174, 193, 44, 45, 46, 47, 208, 213, 214, 215,
- 48, 108, 216, 189, 72, 177, 206, 197, 207, 100,
- 0, -6, 1, 72, 0, 0, 0, 0, 2, 3,
- 4, 5, 6, 168, 0, 0, 0, 0, 210, 7,
- 0, 8, 9, 10, 0, 0, 11, 12, 13, 0,
- 0, 0, 218, 14, 15, 16, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 17,
- 0, 0, 0, 0, 18, 19, 0, 0, 0, -6,
- 20, 2, 3, 4, 5, 6, 0, 0, 0, 0,
- 0, 0, 7, 0, 8, 9, 10, 0, 0, 11,
+ 25, 38, 67, 109, 154, 111, 23, 31, 35, 65,
+ -46, -10, 174, 189, 151, 171, 57, 90, 91, 61,
+ 62, 63, 64, 73, 74, 105, 189, 153, 75, 76,
+ 77, 72, 78, 79, 80, 175, 152, 172, 88, 88,
+ 88, 106, 39, 36, 85, 86, 87, 96, 191, 200,
+ 180, 52, -46, 183, 97, 185, 44, 102, 46, 191,
+ 58, 59, 51, 98, 99, 194, 66, 25, -10, 218,
+ 72, 110, 112, 23, 31, 115, 116, 117, 118, 119,
+ 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
+ 66, 217, 53, 60, 144, 68, 156, 137, 69, 160,
+ 130, 132, 163, 164, 131, 131, 92, 139, 140, 145,
+ 93, 170, 94, 193, 95, 37, 146, 104, 182, 113,
+ 133, 131, 134, 135, 199, 192, 136, 98, 141, 41,
+ 157, 138, 195, 147, 196, 198, 42, 143, 66, 148,
+ 161, 43, 165, 204, 168, 44, 45, 46, 47, 209,
+ 179, 211, 166, 48, 162, 181, 184, 174, 201, 173,
+ 203, 205, 213, 169, 208, 214, 223, 215, 224, 216,
+ 220, 190, 176, 221, 197, -6, 1, 206, 222, 207,
+ 72, 108, 2, 3, 4, 5, 6, 0, 100, 0,
+ 0, 72, 7, 0, 8, 9, 10, 210, 0, 11,
12, 13, 0, 0, 0, 0, 14, 15, 16, 0,
- 2, 3, 4, 54, 6, 0, 0, 0, 0, 0,
- 0, 7, 17, 8, 9, 10, 0, 18, 19, 12,
- 13, 0, 0, 20, 0, 14, 15, 16, 0, 2,
- 3, 4, 54, 6, 0, 0, 0, 0, 0, 0,
- 7, 17, 8, 9, 0, 0, 18, 19, 12, 13,
- 0, 0, 20, 0, 14, 0, 16, 2, 3, 4,
- 54, 6, 0, 0, 2, 3, 4, 54, 6, 0,
- 17, 0, 0, 0, 0, 18, 19, 0, 0, 0,
- 0, 20, 55, 0, 16, 0, 0, 0, 0, 55,
- 0, 16, 0, 0, 0, 0, 0, 0, 17, 0,
- 0, 0, 0, 18, 19, 17, 0, 0, 0, 20,
- 18, 19, 73, 74, 0, 0, 70, 75, 76, 77,
+ 0, 0, 219, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 17, 0, 0, 0, 0, 18, 19, 0,
+ 0, 0, -6, 20, 2, 3, 4, 5, 6, 0,
+ 0, 0, 0, 0, 7, 0, 8, 9, 10, 0,
+ 0, 11, 12, 13, 0, 0, 0, 0, 14, 15,
+ 16, 0, 0, 2, 3, 4, 54, 6, 0, 0,
+ 0, 0, 0, 7, 17, 8, 9, 10, 0, 18,
+ 19, 12, 13, 0, 0, 20, 0, 14, 15, 16,
+ 0, 0, 2, 3, 4, 54, 6, 0, 0, 0,
+ 0, 0, 7, 17, 8, 9, 10, 0, 18, 19,
+ 12, 13, 0, 66, 20, 0, 14, 15, 16, 0,
+ 0, 2, 3, 4, 54, 6, 0, 0, 0, 0,
+ 0, 7, 17, 8, 9, 0, 0, 18, 19, 12,
+ 13, 0, 0, 20, 0, 14, 0, 16, 0, 2,
+ 3, 4, 54, 6, 0, 0, 2, 3, 4, 54,
+ 6, 17, 0, 0, 0, 0, 18, 19, 0, 0,
+ 0, 0, 20, 55, 0, 16, 0, 0, 0, 0,
+ 55, 0, 16, 0, 0, 0, 103, 0, 0, 17,
+ 0, 0, 0, 0, 18, 19, 17, 0, 0, 0,
+ 20, 18, 19, 73, 74, 0, 0, 70, 75, 76,
+ 77, 0, 78, 79, 80, 0, 81, 82, 83, 84,
+ 0, 0, 73, 74, 85, 86, 87, 75, 76, 77,
0, 78, 79, 80, 114, 81, 82, 83, 84, 0,
0, 0, 107, 85, 86, 87, 73, 74, 0, 0,
0, 75, 76, 77, 0, 78, 79, 80, 0, 81,
@@ -781,101 +783,101 @@ static const yytype_int16 yytable[] =
73, 74, 0, 0, 0, 75, 76, 77, 0, 78,
79, 80, 114, 81, 82, 83, 84, 0, 0, 73,
74, 85, 86, 87, 75, 76, 77, 0, 78, 79,
- 80, 0, 81, 82, 83, 84, 0, 0, -53, -53,
- 85, 86, 87, -53, -53, -53, 0, -53, -53, -53,
- 0, 0, 0, -53, -53, 0, 0, 37, 0, -53,
- -53, -53, 73, 74, 0, 0, 0, 75, 76, 77,
+ 80, 0, 81, 82, 83, 84, 0, 0, -54, -54,
+ 85, 86, 87, -54, -54, -54, 0, -54, -54, -54,
+ 0, 0, 0, -54, -54, 0, 0, 37, 0, -54,
+ -54, -54, 73, 74, 0, 0, 0, 75, 76, 77,
0, 78, 79, 80, 0, 0, 0, 83, 84, 0,
- 0, 73, 74, 85, 86, 87, 75, 76, 77, 0,
- 78, 79, 80, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 85, 86, 87
+ 0, 0, 0, 85, 86, 87
};
static const yytype_int16 yycheck[] =
{
- 0, 21, 5, 68, 0, 70, 15, 36, 58, 14,
- 59, 177, 17, 18, 19, 20, 0, 0, 13, 16,
- 186, 23, 145, 52, 29, 174, 37, 38, 0, 11,
- 39, 36, 37, 38, 58, 10, 185, 19, 40, 41,
- 64, 36, 39, 45, 46, 47, 28, 49, 50, 51,
- 55, 53, 54, 55, 56, 10, 37, 38, 11, 61,
- 62, 63, 58, 68, 69, 70, 189, 67, 73, 74,
- 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
- 85, 86, 87, 67, 67, 151, 58, 210, 10, 155,
- 156, 10, 59, 113, 64, 28, 162, 30, 101, 11,
- 105, 106, 60, 36, 170, 52, 64, 11, 144, 114,
- 113, 177, 60, 28, 179, 59, 64, 183, 184, 185,
- 10, 35, 64, 188, 10, 28, 131, 11, 194, 149,
- 11, 167, 11, 10, 200, 171, 202, 173, 10, 60,
- 60, 58, 36, 10, 17, 11, 182, 10, 64, 154,
- 216, 15, 218, 19, 39, 35, 161, 17, 24, 159,
- 163, 181, 28, 29, 30, 31, 35, 17, 16, 16,
- 36, 67, 208, 176, 179, 164, 196, 185, 198, 49,
- -1, 0, 1, 188, -1, -1, -1, -1, 7, 8,
- 9, 10, 11, 193, -1, -1, -1, -1, 201, 18,
- -1, 20, 21, 22, -1, -1, 25, 26, 27, -1,
- -1, -1, 212, 32, 33, 34, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 48,
- -1, -1, -1, -1, 53, 54, -1, -1, -1, 58,
- 59, 7, 8, 9, 10, 11, -1, -1, -1, -1,
- -1, -1, 18, -1, 20, 21, 22, -1, -1, 25,
- 26, 27, -1, -1, -1, -1, 32, 33, 34, -1,
- 7, 8, 9, 10, 11, -1, -1, -1, -1, -1,
- -1, 18, 48, 20, 21, 22, -1, 53, 54, 26,
- 27, -1, -1, 59, -1, 32, 33, 34, -1, 7,
- 8, 9, 10, 11, -1, -1, -1, -1, -1, -1,
- 18, 48, 20, 21, -1, -1, 53, 54, 26, 27,
- -1, -1, 59, -1, 32, -1, 34, 7, 8, 9,
- 10, 11, -1, -1, 7, 8, 9, 10, 11, -1,
- 48, -1, -1, -1, -1, 53, 54, -1, -1, -1,
- -1, 59, 32, -1, 34, -1, -1, -1, -1, 32,
- -1, 34, -1, -1, -1, -1, -1, -1, 48, -1,
- -1, -1, -1, 53, 54, 48, -1, -1, -1, 59,
- 53, 54, 40, 41, -1, -1, 59, 45, 46, 47,
- -1, 49, 50, 51, 52, 53, 54, 55, 56, -1,
- -1, -1, 60, 61, 62, 63, 40, 41, -1, -1,
- -1, 45, 46, 47, -1, 49, 50, 51, -1, 53,
- 54, 55, 56, -1, -1, -1, 60, 61, 62, 63,
- 40, 41, -1, -1, -1, 45, 46, 47, -1, 49,
- 50, 51, 52, 53, 54, 55, 56, -1, -1, 40,
- 41, 61, 62, 63, 45, 46, 47, -1, 49, 50,
- 51, -1, 53, 54, 55, 56, -1, -1, 40, 41,
- 61, 62, 63, 45, 46, 47, -1, 49, 50, 51,
- -1, -1, -1, 55, 56, -1, -1, 59, -1, 61,
- 62, 63, 40, 41, -1, -1, -1, 45, 46, 47,
- -1, 49, 50, 51, -1, -1, -1, 55, 56, -1,
- -1, 40, 41, 61, 62, 63, 45, 46, 47, -1,
- 49, 50, 51, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 61, 62, 63
+ 0, 5, 21, 68, 145, 70, 0, 0, 57, 0,
+ 15, 0, 15, 173, 13, 16, 14, 37, 38, 17,
+ 18, 19, 20, 39, 40, 35, 186, 144, 44, 45,
+ 46, 29, 48, 49, 50, 38, 35, 38, 36, 37,
+ 38, 51, 10, 58, 60, 61, 62, 11, 176, 190,
+ 167, 11, 57, 170, 18, 172, 27, 55, 29, 187,
+ 36, 37, 10, 27, 35, 182, 57, 67, 57, 210,
+ 68, 69, 70, 67, 67, 73, 74, 75, 76, 77,
+ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
+ 57, 208, 10, 10, 113, 58, 63, 101, 51, 150,
+ 59, 59, 153, 154, 63, 63, 63, 105, 106, 113,
+ 11, 162, 11, 178, 27, 58, 114, 10, 169, 34,
+ 10, 63, 11, 11, 189, 176, 11, 27, 59, 11,
+ 149, 10, 183, 131, 185, 186, 18, 59, 57, 10,
+ 35, 23, 10, 194, 16, 27, 28, 29, 30, 200,
+ 10, 202, 63, 35, 152, 32, 21, 15, 38, 163,
+ 34, 16, 16, 161, 34, 32, 217, 16, 219, 16,
+ 32, 175, 164, 21, 186, 0, 1, 196, 21, 198,
+ 178, 67, 7, 8, 9, 10, 11, -1, 49, -1,
+ -1, 189, 17, -1, 19, 20, 21, 201, -1, 24,
+ 25, 26, -1, -1, -1, -1, 31, 32, 33, -1,
+ -1, -1, 212, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 47, -1, -1, -1, -1, 52, 53, -1,
+ -1, -1, 57, 58, 7, 8, 9, 10, 11, -1,
+ -1, -1, -1, -1, 17, -1, 19, 20, 21, -1,
+ -1, 24, 25, 26, -1, -1, -1, -1, 31, 32,
+ 33, -1, -1, 7, 8, 9, 10, 11, -1, -1,
+ -1, -1, -1, 17, 47, 19, 20, 21, -1, 52,
+ 53, 25, 26, -1, -1, 58, -1, 31, 32, 33,
+ -1, -1, 7, 8, 9, 10, 11, -1, -1, -1,
+ -1, -1, 17, 47, 19, 20, 21, -1, 52, 53,
+ 25, 26, -1, 57, 58, -1, 31, 32, 33, -1,
+ -1, 7, 8, 9, 10, 11, -1, -1, -1, -1,
+ -1, 17, 47, 19, 20, -1, -1, 52, 53, 25,
+ 26, -1, -1, 58, -1, 31, -1, 33, -1, 7,
+ 8, 9, 10, 11, -1, -1, 7, 8, 9, 10,
+ 11, 47, -1, -1, -1, -1, 52, 53, -1, -1,
+ -1, -1, 58, 31, -1, 33, -1, -1, -1, -1,
+ 31, -1, 33, -1, -1, -1, 22, -1, -1, 47,
+ -1, -1, -1, -1, 52, 53, 47, -1, -1, -1,
+ 58, 52, 53, 39, 40, -1, -1, 58, 44, 45,
+ 46, -1, 48, 49, 50, -1, 52, 53, 54, 55,
+ -1, -1, 39, 40, 60, 61, 62, 44, 45, 46,
+ -1, 48, 49, 50, 51, 52, 53, 54, 55, -1,
+ -1, -1, 59, 60, 61, 62, 39, 40, -1, -1,
+ -1, 44, 45, 46, -1, 48, 49, 50, -1, 52,
+ 53, 54, 55, -1, -1, -1, 59, 60, 61, 62,
+ 39, 40, -1, -1, -1, 44, 45, 46, -1, 48,
+ 49, 50, 51, 52, 53, 54, 55, -1, -1, 39,
+ 40, 60, 61, 62, 44, 45, 46, -1, 48, 49,
+ 50, -1, 52, 53, 54, 55, -1, -1, 39, 40,
+ 60, 61, 62, 44, 45, 46, -1, 48, 49, 50,
+ -1, -1, -1, 54, 55, -1, -1, 58, -1, 60,
+ 61, 62, 39, 40, -1, -1, -1, 44, 45, 46,
+ -1, 48, 49, 50, -1, -1, -1, 54, 55, -1,
+ -1, -1, -1, 60, 61, 62
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 7, 8, 9, 10, 11, 18, 20, 21,
- 22, 25, 26, 27, 32, 33, 34, 48, 53, 54,
- 59, 66, 68, 69, 70, 71, 72, 79, 80, 81,
- 86, 87, 89, 92, 96, 58, 59, 59, 83, 10,
- 88, 11, 19, 24, 28, 29, 30, 31, 36, 90,
- 91, 10, 11, 10, 10, 32, 69, 86, 37, 38,
- 10, 86, 86, 86, 86, 0, 58, 67, 59, 52,
- 59, 78, 86, 40, 41, 45, 46, 47, 49, 50,
- 51, 53, 54, 55, 56, 61, 62, 63, 86, 97,
- 97, 97, 64, 11, 11, 28, 11, 19, 28, 36,
- 91, 93, 86, 23, 10, 36, 52, 60, 68, 78,
- 86, 78, 86, 35, 52, 86, 86, 86, 86, 86,
- 86, 86, 86, 86, 86, 86, 86, 86, 86, 86,
- 60, 64, 60, 10, 11, 11, 11, 83, 10, 86,
- 86, 60, 84, 60, 67, 83, 86, 86, 10, 94,
- 71, 85, 87, 13, 36, 85, 70, 64, 67, 67,
- 84, 36, 86, 84, 84, 10, 64, 95, 71, 17,
- 86, 84, 16, 39, 83, 15, 39, 75, 76, 82,
- 10, 85, 84, 85, 85, 74, 75, 77, 82, 83,
- 76, 84, 78, 67, 85, 84, 84, 77, 84, 78,
- 70, 39, 73, 35, 84, 17, 67, 67, 35, 84,
- 83, 84, 83, 17, 16, 16, 85, 70, 71, 84,
- 84
+ 0, 1, 7, 8, 9, 10, 11, 17, 19, 20,
+ 21, 24, 25, 26, 31, 32, 33, 47, 52, 53,
+ 58, 65, 67, 68, 69, 70, 71, 78, 79, 80,
+ 85, 86, 88, 91, 95, 57, 58, 58, 82, 10,
+ 87, 11, 18, 23, 27, 28, 29, 30, 35, 89,
+ 90, 10, 11, 10, 10, 31, 68, 85, 36, 37,
+ 10, 85, 85, 85, 85, 0, 57, 66, 58, 51,
+ 58, 77, 85, 39, 40, 44, 45, 46, 48, 49,
+ 50, 52, 53, 54, 55, 60, 61, 62, 85, 96,
+ 96, 96, 63, 11, 11, 27, 11, 18, 27, 35,
+ 90, 92, 85, 22, 10, 35, 51, 59, 67, 77,
+ 85, 77, 85, 34, 51, 85, 85, 85, 85, 85,
+ 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
+ 59, 63, 59, 10, 11, 11, 11, 82, 10, 85,
+ 85, 59, 83, 59, 66, 82, 85, 85, 10, 93,
+ 84, 13, 35, 84, 69, 86, 63, 66, 66, 70,
+ 83, 35, 85, 83, 83, 10, 63, 94, 16, 85,
+ 83, 16, 38, 82, 15, 38, 74, 75, 81, 10,
+ 84, 32, 83, 84, 21, 84, 73, 74, 76, 81,
+ 82, 75, 83, 77, 84, 83, 83, 76, 83, 77,
+ 69, 38, 72, 34, 83, 16, 66, 66, 34, 83,
+ 82, 83, 82, 16, 32, 16, 16, 84, 69, 70,
+ 32, 21, 21, 83, 83
};
#define yyerrok (yyerrstatus = 0)
@@ -1746,52 +1748,52 @@ yyreduce:
#line 141 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
- WRITE_UINT32(&body, (yyvsp[(5) - (7)].code));
- WRITE_UINT32(&end, (yyvsp[(6) - (7)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = body; /* body of loop */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 2] = end; ;}
+ WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
+ WRITE_UINT32(&end, (yyvsp[(6) - (8)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = body; /* body of loop */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
case 20:
#line 152 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
- WRITE_UINT32(&init, (yyvsp[(3) - (10)].code));
- WRITE_UINT32(&finish, (yyvsp[(6) - (10)].code));
- WRITE_UINT32(&body, (yyvsp[(8) - (10)].code));
- WRITE_UINT32(&end, (yyvsp[(9) - (10)].code));
+ WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
+ WRITE_UINT32(&finish, (yyvsp[(6) - (11)].code));
+ WRITE_UINT32(&body, (yyvsp[(8) - (11)].code));
+ WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
WRITE_UINT32(&inc, 1);
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 1] = init; /* initial count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 2] = finish;/* final count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 3] = body; /* body of loop */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 4] = inc; /* increment */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (10)].code) + 5] = end; ;}
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = init; /* initial count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = finish;/* final count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = body; /* body of loop */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 4] = inc; /* increment */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
break;
case 21:
#line 168 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
- WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
- WRITE_UINT32(&finish, (yyvsp[(7) - (11)].code));
- WRITE_UINT32(&body, (yyvsp[(9) - (11)].code));
- WRITE_UINT32(&end, (yyvsp[(10) - (11)].code));
+ WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
+ WRITE_UINT32(&finish, (yyvsp[(7) - (12)].code));
+ WRITE_UINT32(&body, (yyvsp[(9) - (12)].code));
+ WRITE_UINT32(&end, (yyvsp[(10) - (12)].code));
WRITE_UINT32(&inc, -1);
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = init; /* initial count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = finish;/* final count value */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = body; /* body of loop */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 4] = inc; /* increment */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = init; /* initial count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = finish;/* final count value */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = body; /* body of loop */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 4] = inc; /* increment */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
break;
case 22:
#line 182 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(5) - (7)].code));
- WRITE_UINT32(&end, (yyvsp[(6) - (7)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (7)].code) + 3] = end; /* end, if cond fails */
+ WRITE_UINT32(&then, (yyvsp[(5) - (8)].code));
+ WRITE_UINT32(&end, (yyvsp[(6) - (8)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); ;}
break;
@@ -1799,12 +1801,12 @@ yyreduce:
#line 189 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
- WRITE_UINT32(&else1, (yyvsp[(8) - (11)].code));
- WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = end; /* end, if cond fails */
+ WRITE_UINT32(&then, (yyvsp[(5) - (12)].code));
+ WRITE_UINT32(&else1, (yyvsp[(8) - (12)].code));
+ WRITE_UINT32(&end, (yyvsp[(9) - (12)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); ;}
break;
@@ -1812,13 +1814,13 @@ yyreduce:
#line 198 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
- WRITE_UINT32(&else1, (yyvsp[(7) - (11)].code));
- WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, (yyvsp[(9) - (11)].code)); ;}
+ WRITE_UINT32(&then, (yyvsp[(5) - (12)].code));
+ WRITE_UINT32(&else1, (yyvsp[(7) - (12)].code));
+ WRITE_UINT32(&end, (yyvsp[(9) - (12)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; /* end, if cond fails */
+ g_lingo->processIf(0, (yyvsp[(9) - (12)].code)); ;}
break;
case 25:
@@ -1946,8 +1948,8 @@ yyreduce:
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 48:
-#line 300 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 301 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1955,22 +1957,22 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 49:
-#line 305 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 306 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
- case 50:
-#line 308 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 309 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_stringpush);
g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;}
break;
- case 51:
-#line 311 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 312 "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));
@@ -1979,8 +1981,8 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 52:
-#line 317 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 318 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1991,156 +1993,156 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 53:
-#line 325 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 326 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 55:
-#line 329 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_add); ;}
- break;
-
case 56:
#line 330 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_sub); ;}
+ { g_lingo->code1(g_lingo->c_add); ;}
break;
case 57:
#line 331 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_mul); ;}
+ { g_lingo->code1(g_lingo->c_sub); ;}
break;
case 58:
#line 332 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_div); ;}
+ { g_lingo->code1(g_lingo->c_mul); ;}
break;
case 59:
#line 333 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gt); ;}
+ { g_lingo->code1(g_lingo->c_div); ;}
break;
case 60:
#line 334 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_lt); ;}
+ { g_lingo->code1(g_lingo->c_gt); ;}
break;
case 61:
#line 335 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_neq); ;}
+ { g_lingo->code1(g_lingo->c_lt); ;}
break;
case 62:
#line 336 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_ge); ;}
+ { g_lingo->code1(g_lingo->c_neq); ;}
break;
case 63:
#line 337 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_le); ;}
+ { g_lingo->code1(g_lingo->c_ge); ;}
break;
case 64:
#line 338 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_and); ;}
+ { g_lingo->code1(g_lingo->c_le); ;}
break;
case 65:
#line 339 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_or); ;}
+ { g_lingo->code1(g_lingo->c_and); ;}
break;
case 66:
#line 340 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_not); ;}
+ { g_lingo->code1(g_lingo->c_or); ;}
break;
case 67:
#line 341 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_ampersand); ;}
+ { g_lingo->code1(g_lingo->c_not); ;}
break;
case 68:
#line 342 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_concat); ;}
+ { g_lingo->code1(g_lingo->c_ampersand); ;}
break;
case 69:
#line 343 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_contains); ;}
+ { g_lingo->code1(g_lingo->c_concat); ;}
break;
case 70:
#line 344 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_starts); ;}
+ { g_lingo->code1(g_lingo->c_contains); ;}
break;
case 71:
#line 345 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+ { g_lingo->code1(g_lingo->c_starts); ;}
break;
case 72:
#line 346 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 73:
#line 347 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 74:
-#line 350 "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); ;}
+#line 348 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 75:
#line 351 "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); ;}
+ { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str()); delete (yyvsp[(2) - (2)].s); ;}
break;
case 76:
#line 352 "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 77:
+#line 353 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 78:
-#line 354 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 355 "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 80:
-#line 359 "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 81:
#line 360 "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); ;}
+ { g_lingo->code1(g_lingo->c_global); g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); delete (yyvsp[(1) - (1)].s); ;}
break;
case 82:
-#line 371 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoloop); ;}
+#line 361 "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 83:
#line 372 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotonext); ;}
+ { g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 84:
#line 373 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_gotoprevious); ;}
+ { g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 85:
#line 374 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_gotoprevious); ;}
+ break;
+
+ case 86:
+#line 375 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2148,8 +2150,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 86:
-#line 379 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 380 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2158,8 +2160,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 87:
-#line 385 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 386 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2167,14 +2169,9 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 88:
-#line 392 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
- break;
-
case 89:
#line 393 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 90:
@@ -2184,65 +2181,70 @@ yyreduce:
case 91:
#line 395 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 92:
-#line 398 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 396 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 93:
#line 399 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 94:
#line 400 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 95:
-#line 428 "engines/director/lingo/lingo-gr.y"
- { g_lingo->_indef = true; ;}
+#line 401 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 96:
#line 429 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->_indef = true; ;}
+ break;
+
+ case 97:
+#line 430 "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);
- g_lingo->define(*(yyvsp[(2) - (9)].s), (yyvsp[(4) - (9)].code), (yyvsp[(5) - (9)].narg));
+ g_lingo->define(*(yyvsp[(2) - (8)].s), (yyvsp[(4) - (8)].code), (yyvsp[(5) - (8)].narg));
g_lingo->_indef = false; ;}
break;
- case 97:
-#line 435 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 0; ;}
- break;
-
case 98:
#line 436 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
+ { (yyval.narg) = 0; ;}
break;
case 99:
#line 437 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
+ { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 100:
#line 438 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
+ { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 101:
-#line 440 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArgStore(); ;}
+#line 439 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 102:
-#line 443 "engines/director/lingo/lingo-gr.y"
+#line 441 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArgStore(); ;}
+ break;
+
+ case 103:
+#line 444 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2251,24 +2253,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 103:
-#line 451 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 0; ;}
- break;
-
case 104:
#line 452 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 1; ;}
+ { (yyval.narg) = 0; ;}
break;
case 105:
#line 453 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = 1; ;}
+ break;
+
+ case 106:
+#line 454 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2272 "engines/director/lingo/lingo-gr.cpp"
+#line 2274 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2482,6 +2484,6 @@ yyreturn:
}
-#line 456 "engines/director/lingo/lingo-gr.y"
+#line 457 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index bf99268..18a462a 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -52,42 +52,41 @@
tDOWN = 268,
tELSE = 269,
tNLELSIF = 270,
- tENDIF = 271,
- tENDREPEAT = 272,
- tEXIT = 273,
- tFRAME = 274,
- tGLOBAL = 275,
- tGO = 276,
- tIF = 277,
- tINTO = 278,
- tLOOP = 279,
- tMACRO = 280,
- tMCI = 281,
- tMCIWAIT = 282,
- tMOVIE = 283,
- tNEXT = 284,
- tOF = 285,
- tPREVIOUS = 286,
- tPUT = 287,
- tREPEAT = 288,
- tSET = 289,
- tTHEN = 290,
- tTO = 291,
- tWITH = 292,
- tWHILE = 293,
- tNLELSE = 294,
- tGE = 295,
- tLE = 296,
- tGT = 297,
- tLT = 298,
- tEQ = 299,
- tNEQ = 300,
- tAND = 301,
- tOR = 302,
- tNOT = 303,
- tCONCAT = 304,
- tCONTAINS = 305,
- tSTARTS = 306
+ tEND = 271,
+ tEXIT = 272,
+ tFRAME = 273,
+ tGLOBAL = 274,
+ tGO = 275,
+ tIF = 276,
+ tINTO = 277,
+ tLOOP = 278,
+ tMACRO = 279,
+ tMCI = 280,
+ tMCIWAIT = 281,
+ tMOVIE = 282,
+ tNEXT = 283,
+ tOF = 284,
+ tPREVIOUS = 285,
+ tPUT = 286,
+ tREPEAT = 287,
+ tSET = 288,
+ tTHEN = 289,
+ tTO = 290,
+ tWITH = 291,
+ tWHILE = 292,
+ tNLELSE = 293,
+ tGE = 294,
+ tLE = 295,
+ tGT = 296,
+ tLT = 297,
+ tEQ = 298,
+ tNEQ = 299,
+ tAND = 300,
+ tOR = 301,
+ tNOT = 302,
+ tCONCAT = 303,
+ tCONTAINS = 304,
+ tSTARTS = 305
};
#endif
/* Tokens. */
@@ -104,42 +103,41 @@
#define tDOWN 268
#define tELSE 269
#define tNLELSIF 270
-#define tENDIF 271
-#define tENDREPEAT 272
-#define tEXIT 273
-#define tFRAME 274
-#define tGLOBAL 275
-#define tGO 276
-#define tIF 277
-#define tINTO 278
-#define tLOOP 279
-#define tMACRO 280
-#define tMCI 281
-#define tMCIWAIT 282
-#define tMOVIE 283
-#define tNEXT 284
-#define tOF 285
-#define tPREVIOUS 286
-#define tPUT 287
-#define tREPEAT 288
-#define tSET 289
-#define tTHEN 290
-#define tTO 291
-#define tWITH 292
-#define tWHILE 293
-#define tNLELSE 294
-#define tGE 295
-#define tLE 296
-#define tGT 297
-#define tLT 298
-#define tEQ 299
-#define tNEQ 300
-#define tAND 301
-#define tOR 302
-#define tNOT 303
-#define tCONCAT 304
-#define tCONTAINS 305
-#define tSTARTS 306
+#define tEND 271
+#define tEXIT 272
+#define tFRAME 273
+#define tGLOBAL 274
+#define tGO 275
+#define tIF 276
+#define tINTO 277
+#define tLOOP 278
+#define tMACRO 279
+#define tMCI 280
+#define tMCIWAIT 281
+#define tMOVIE 282
+#define tNEXT 283
+#define tOF 284
+#define tPREVIOUS 285
+#define tPUT 286
+#define tREPEAT 287
+#define tSET 288
+#define tTHEN 289
+#define tTO 290
+#define tWITH 291
+#define tWHILE 292
+#define tNLELSE 293
+#define tGE 294
+#define tLE 295
+#define tGT 296
+#define tLT 297
+#define tEQ 298
+#define tNEQ 299
+#define tAND 300
+#define tOR 301
+#define tNOT 302
+#define tCONCAT 303
+#define tCONTAINS 304
+#define tSTARTS 305
@@ -155,7 +153,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 159 "engines/director/lingo/lingo-gr.hpp"
+#line 157 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 4e1778f..f88e36d 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -75,7 +75,7 @@ void yyerror(char *s) { g_lingo->_hadError = true; warning("%s at line %d col %d
%token<i> INT
%token<f> FLOAT
%token<s> BLTIN ID STRING HANDLER
-%token tDOWN tELSE tNLELSIF tENDIF tENDREPEAT tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
+%token tDOWN tELSE tNLELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
%token tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO
%token tWITH tWHILE tNLELSE
%token tGE tLE tGT tLT tEQ tNEQ tAND tOR tNOT
@@ -138,7 +138,7 @@ stmt: stmtoneliner
// statements
// end repeat
//
- | repeatwhile '(' cond ')' stmtlist end tENDREPEAT {
+ | repeatwhile '(' cond ')' stmtlist end tEND tREPEAT {
inst body = 0, end = 0;
WRITE_UINT32(&body, $5);
WRITE_UINT32(&end, $6);
@@ -149,7 +149,7 @@ stmt: stmtoneliner
// statements
// end repeat
//
- | repeatwith '=' expr end tTO expr end stmtlist end tENDREPEAT {
+ | repeatwith '=' expr end tTO expr end stmtlist end tEND tREPEAT {
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, $3);
WRITE_UINT32(&finish, $6);
@@ -165,7 +165,7 @@ stmt: stmtoneliner
// statements
// end repeat
//
- | repeatwith '=' expr end tDOWN tTO expr end stmtlist end tENDREPEAT {
+ | repeatwith '=' expr end tDOWN tTO expr end stmtlist end tEND tREPEAT {
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, $3);
WRITE_UINT32(&finish, $7);
@@ -179,14 +179,14 @@ stmt: stmtoneliner
(*g_lingo->_currentScript)[$1 + 5] = end; } /* end, if cond fails */
;
-ifstmt: if cond tTHEN nl stmtlist end tENDIF {
+ifstmt: if cond tTHEN nl stmtlist end tEND tIF {
inst then = 0, end = 0;
WRITE_UINT32(&then, $5);
WRITE_UINT32(&end, $6);
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN nl stmtlist end tNLELSE stmtlist end nl tENDIF {
+ | if cond tTHEN nl stmtlist end tNLELSE stmtlist end nl tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
WRITE_UINT32(&else1, $8);
@@ -195,7 +195,7 @@ ifstmt: if cond tTHEN nl stmtlist end tENDIF {
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN nl stmtlist end begin elseifstmt end nl tENDIF {
+ | if cond tTHEN nl stmtlist end begin elseifstmt end nl tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
WRITE_UINT32(&else1, $7);
@@ -293,8 +293,9 @@ begin: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
;
end: /* nothing */ { g_lingo->code1(STOP); $$ = g_lingo->_currentScript->size(); }
;
-stmtlist: stmtlist nl stmt
- | stmt
+stmtlist: /* nothing */
+ | stmtlist nl
+ | stmtlist stmt
;
expr: INT {
@@ -426,7 +427,7 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
// See also:
// on keyword
defn: tMACRO ID { g_lingo->_indef = true; }
- begin argdef nl argstore stmtlist nl {
+ begin argdef nl argstore stmtlist {
g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$2, $4, $5);
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 737548f..b419574 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 47
-#define YY_END_OF_BUFFER 48
+#define YY_NUM_RULES 46
+#define YY_END_OF_BUFFER 47
/* 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[161] =
+static yyconst flex_int16_t yy_accept[152] =
{ 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,
- 45, 39, 1, 41, 42, 38, 36, 37, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 16, 7, 40,
- 40, 40, 40, 40, 40, 40, 25, 26, 40, 40,
- 40, 40, 40, 40, 33, 40, 40, 2, 2, 0,
- 1, 41, 4, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 20, 40, 40, 24, 40, 28, 40,
-
- 30, 40, 40, 40, 40, 0, 40, 6, 10, 0,
- 13, 40, 40, 17, 18, 40, 40, 40, 23, 40,
- 40, 40, 32, 40, 34, 0, 40, 0, 0, 14,
- 40, 19, 40, 22, 40, 40, 40, 35, 9, 40,
- 11, 0, 15, 40, 40, 29, 31, 0, 40, 0,
- 21, 40, 0, 5, 0, 27, 8, 0, 12, 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,
+ 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, 0, 39, 13, 39, 18, 39,
+ 21, 39, 39, 39, 34, 9, 39, 14, 39, 39,
+ 28, 30, 0, 39, 20, 39, 0, 5, 26, 8,
+ 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -436,51 +436,49 @@ static yyconst flex_int32_t yy_meta[58] =
4, 4, 4, 4, 4, 4, 4
} ;
-static yyconst flex_int16_t yy_base[164] =
+static yyconst flex_int16_t yy_base[155] =
{ 0,
- 0, 56, 249, 374, 60, 64, 68, 72, 187, 374,
- 178, 170, 49, 65, 138, 53, 0, 53, 54, 58,
+ 0, 56, 186, 352, 60, 64, 68, 72, 173, 352,
+ 143, 141, 49, 65, 132, 53, 0, 53, 54, 58,
54, 61, 70, 59, 83, 95, 79, 62, 98, 105,
- 103, 104, 138, 151, 157, 125, 161, 165, 169, 144,
- 374, 374, 0, 134, 123, 374, 374, 374, 0, 117,
+ 103, 104, 138, 151, 157, 125, 161, 165, 169, 132,
+ 352, 352, 0, 108, 123, 352, 352, 352, 0, 117,
141, 134, 144, 158, 154, 163, 152, 0, 0, 149,
154, 166, 162, 153, 152, 159, 0, 0, 173, 162,
166, 165, 189, 191, 0, 188, 181, 217, 225, 192,
- 0, 127, 0, 191, 197, 206, 86, 199, 209, 220,
+ 0, 85, 0, 191, 197, 206, 0, 199, 209, 220,
211, 211, 211, 207, 214, 211, 0, 212, 0, 229,
- 0, 220, 224, 228, 232, 226, 240, 0, 0, 263,
- 0, 247, 254, 0, 0, 245, 260, 260, 0, 257,
- 266, 251, 0, 265, 0, 266, 264, 269, 271, 0,
- 267, 0, 272, 0, 270, 267, 269, 0, 91, 278,
- 374, 281, 0, 283, 283, 0, 0, 320, 287, 304,
- 0, 296, 304, 0, 313, 0, 374, 298, 374, 374,
- 365, 115, 369
+ 0, 220, 224, 228, 232, 226, 240, 0, 0, 0,
+ 246, 251, 0, 0, 240, 254, 254, 0, 252, 264,
+ 249, 0, 263, 0, 264, 261, 0, 261, 0, 267,
+ 0, 264, 261, 263, 0, 86, 269, 0, 266, 266,
+ 0, 0, 298, 277, 0, 278, 290, 0, 0, 352,
+ 352, 343, 89, 347
} ;
-static yyconst flex_int16_t yy_def[164] =
+static yyconst flex_int16_t yy_def[155] =
{ 0,
- 160, 1, 160, 160, 160, 160, 160, 160, 161, 160,
- 160, 160, 160, 160, 160, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 160, 160, 160, 160, 160, 160, 160, 161,
- 160, 160, 163, 160, 160, 160, 160, 160, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 160, 160, 160,
- 163, 160, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
-
- 162, 162, 162, 162, 162, 160, 162, 162, 162, 160,
- 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 160, 162, 160, 160, 162,
- 162, 162, 162, 162, 162, 162, 162, 162, 160, 162,
- 160, 160, 162, 162, 162, 162, 162, 160, 162, 160,
- 162, 162, 160, 162, 160, 162, 160, 160, 160, 0,
- 160, 160, 160
+ 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, 152,
+ 151, 151, 154, 151, 151, 151, 151, 151, 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, 151,
+ 0, 151, 151, 151
} ;
-static yyconst flex_int16_t yy_nxt[432] =
+static yyconst flex_int16_t yy_nxt[410] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
13, 14, 10, 15, 16, 17, 18, 19, 20, 21,
@@ -490,49 +488,46 @@ static yyconst flex_int16_t yy_nxt[432] =
29, 30, 31, 17, 17, 32, 17, 33, 44, 45,
34, 35, 36, 36, 37, 38, 39, 39, 38, 38,
39, 39, 38, 37, 36, 36, 37, 46, 47, 50,
- 51, 52, 53, 56, 54, 57, 61, 110, 58, 59,
- 110, 69, 148, 55, 70, 148, 60, 62, 67, 63,
+ 51, 52, 53, 56, 54, 57, 61, 143, 58, 59,
+ 143, 69, 49, 55, 70, 82, 60, 62, 67, 63,
50, 51, 52, 53, 56, 54, 57, 61, 68, 58,
- 64, 59, 69, 65, 55, 70, 71, 60, 49, 62,
+ 64, 59, 69, 65, 55, 70, 71, 60, 82, 62,
67, 63, 66, 72, 74, 76, 77, 36, 36, 68,
- 75, 64, 44, 45, 83, 65, 73, 82, 71, 78,
- 36, 36, 79, 66, 82, 72, 74, 76, 77, 41,
- 48, 75, 79, 36, 36, 79, 83, 73, 35, 36,
+ 75, 64, 44, 45, 83, 65, 73, 41, 71, 78,
+ 36, 36, 79, 66, 48, 72, 74, 76, 77, 43,
+ 42, 75, 79, 36, 36, 79, 83, 73, 35, 36,
36, 37, 37, 36, 36, 37, 38, 84, 85, 38,
- 38, 39, 39, 38, 86, 87, 88, 89, 43, 90,
- 91, 92, 93, 80, 94, 42, 95, 96, 84, 85,
- 97, 98, 41, 99, 100, 86, 101, 87, 88, 89,
+ 38, 39, 39, 38, 86, 87, 88, 89, 41, 90,
+ 91, 92, 93, 80, 94, 151, 95, 96, 84, 85,
+ 97, 98, 151, 99, 100, 86, 101, 87, 88, 89,
90, 91, 92, 102, 93, 80, 94, 95, 96, 103,
104, 97, 105, 98, 99, 100, 106, 101, 78, 36,
36, 79, 107, 108, 109, 102, 79, 36, 36, 79,
- 111, 103, 104, 105, 112, 113, 118, 106, 114, 115,
- 116, 117, 119, 107, 108, 120, 109, 121, 160, 122,
- 123, 111, 124, 125, 127, 112, 126, 113, 118, 114,
- 115, 116, 117, 119, 110, 130, 120, 110, 131, 121,
- 122, 123, 132, 124, 133, 125, 127, 126, 134, 135,
- 136, 160, 137, 138, 139, 128, 140, 130, 141, 142,
- 131, 143, 129, 132, 144, 160, 133, 145, 146, 147,
-
- 134, 135, 136, 137, 149, 138, 139, 128, 140, 150,
- 141, 142, 143, 129, 151, 152, 144, 154, 145, 146,
- 147, 148, 155, 157, 148, 149, 156, 158, 160, 159,
- 150, 160, 160, 160, 160, 151, 152, 160, 154, 160,
- 160, 160, 153, 160, 155, 157, 160, 156, 160, 158,
- 159, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 153, 40, 160, 40, 40, 81,
- 160, 160, 81, 3, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
-
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160
+ 110, 103, 104, 105, 111, 112, 117, 106, 113, 114,
+ 115, 116, 118, 107, 108, 119, 109, 120, 151, 121,
+ 122, 110, 123, 124, 126, 111, 125, 112, 117, 113,
+ 114, 115, 116, 118, 127, 128, 119, 129, 130, 120,
+ 121, 122, 131, 123, 132, 124, 126, 125, 133, 151,
+ 134, 135, 136, 137, 151, 138, 127, 128, 129, 139,
+ 130, 140, 141, 142, 131, 144, 132, 145, 146, 143,
+
+ 133, 134, 143, 135, 136, 137, 138, 148, 149, 150,
+ 151, 139, 140, 141, 142, 151, 144, 151, 145, 146,
+ 147, 151, 151, 151, 151, 151, 151, 151, 148, 149,
+ 151, 150, 151, 151, 151, 151, 151, 151, 151, 151,
+ 151, 151, 147, 40, 151, 40, 40, 81, 151, 151,
+ 81, 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
} ;
-static yyconst flex_int16_t yy_chk[432] =
+static yyconst flex_int16_t yy_chk[410] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -542,46 +537,43 @@ static yyconst flex_int16_t yy_chk[432] =
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, 20, 21, 20, 22, 24, 87, 22, 23,
- 87, 28, 139, 20, 28, 139, 23, 25, 27, 25,
+ 18, 19, 20, 21, 20, 22, 24, 136, 22, 23,
+ 136, 28, 153, 20, 28, 82, 23, 25, 27, 25,
16, 18, 19, 20, 21, 20, 22, 24, 27, 22,
- 25, 23, 28, 26, 20, 28, 29, 23, 162, 25,
+ 25, 23, 28, 26, 20, 28, 29, 23, 44, 25,
27, 25, 26, 30, 31, 32, 32, 36, 36, 27,
- 31, 25, 45, 45, 50, 26, 30, 82, 29, 33,
- 33, 33, 33, 26, 44, 30, 31, 32, 32, 40,
- 15, 31, 34, 34, 34, 34, 50, 30, 35, 35,
+ 31, 25, 45, 45, 50, 26, 30, 40, 29, 33,
+ 33, 33, 33, 26, 15, 30, 31, 32, 32, 12,
+ 11, 31, 34, 34, 34, 34, 50, 30, 35, 35,
35, 35, 37, 37, 37, 37, 38, 51, 52, 38,
- 39, 39, 39, 39, 53, 54, 55, 56, 12, 57,
- 60, 61, 62, 38, 63, 11, 64, 65, 51, 52,
- 66, 69, 9, 70, 71, 53, 72, 54, 55, 56,
+ 39, 39, 39, 39, 53, 54, 55, 56, 9, 57,
+ 60, 61, 62, 38, 63, 3, 64, 65, 51, 52,
+ 66, 69, 0, 70, 71, 53, 72, 54, 55, 56,
57, 60, 61, 73, 62, 38, 63, 64, 65, 74,
76, 66, 77, 69, 70, 71, 80, 72, 78, 78,
78, 78, 84, 85, 86, 73, 79, 79, 79, 79,
88, 74, 76, 77, 89, 90, 95, 80, 91, 92,
- 93, 94, 96, 84, 85, 98, 86, 100, 3, 102,
+ 93, 94, 96, 84, 85, 98, 86, 100, 0, 102,
103, 88, 104, 105, 107, 89, 106, 90, 95, 91,
- 92, 93, 94, 96, 110, 112, 98, 110, 113, 100,
- 102, 103, 116, 104, 117, 105, 107, 106, 118, 120,
- 121, 0, 122, 124, 126, 110, 127, 112, 128, 129,
- 113, 131, 110, 116, 133, 0, 117, 135, 136, 137,
-
- 118, 120, 121, 122, 140, 124, 126, 110, 127, 142,
- 128, 129, 131, 110, 144, 145, 133, 149, 135, 136,
- 137, 148, 150, 153, 148, 140, 152, 155, 0, 158,
- 142, 0, 0, 0, 0, 144, 145, 0, 149, 0,
- 0, 0, 148, 0, 150, 153, 0, 152, 0, 155,
- 158, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 148, 161, 0, 161, 161, 163,
- 0, 0, 163, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
-
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160
+ 92, 93, 94, 96, 111, 112, 98, 115, 116, 100,
+ 102, 103, 117, 104, 119, 105, 107, 106, 120, 0,
+ 121, 123, 125, 126, 0, 128, 111, 112, 115, 130,
+ 116, 132, 133, 134, 117, 137, 119, 139, 140, 143,
+
+ 120, 121, 143, 123, 125, 126, 128, 144, 146, 147,
+ 0, 130, 132, 133, 134, 0, 137, 0, 139, 140,
+ 143, 0, 0, 0, 0, 0, 0, 0, 144, 146,
+ 0, 147, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 143, 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
} ;
static yy_state_type yy_last_accepting_state;
@@ -644,7 +636,7 @@ static void countnl() {
Director::g_lingo->_colnumber = strlen(p);
}
-#line 648 "engines/director/lingo/lingo-lex.cpp"
+#line 640 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -832,7 +824,7 @@ YY_DECL
#line 58 "engines/director/lingo/lingo-lex.l"
-#line 836 "engines/director/lingo/lingo-lex.cpp"
+#line 828 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -886,13 +878,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 >= 161 )
+ if ( yy_current_state >= 152 )
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] != 374 );
+ while ( yy_base[yy_current_state] != 352 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -971,151 +963,146 @@ YY_RULE_SETUP
case 11:
YY_RULE_SETUP
#line 71 "engines/director/lingo/lingo-lex.l"
-{ count(); return tENDIF; }
+{ count(); return tEND; }
YY_BREAK
case 12:
YY_RULE_SETUP
#line 72 "engines/director/lingo/lingo-lex.l"
-{ count(); return tENDREPEAT; }
+{ count(); return tEXIT; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 73 "engines/director/lingo/lingo-lex.l"
-{ count(); return tEXIT; }
+{ count(); return tFRAME; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 74 "engines/director/lingo/lingo-lex.l"
-{ count(); return tFRAME; }
+{ count(); return tGLOBAL; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 75 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGLOBAL; }
+{ count(); return tGO; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 76 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGO; }
+{ count(); return tINTO; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 77 "engines/director/lingo/lingo-lex.l"
-{ count(); return tINTO; }
+{ count(); return tLOOP; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 78 "engines/director/lingo/lingo-lex.l"
-{ count(); return tLOOP; }
+{ count(); return tMACRO; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 79 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMACRO; }
+{ count(); return tMCI; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 80 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMCI; }
+{ count(); return tMCIWAIT; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 81 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMCIWAIT; }
+{ count(); return tMOVIE; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 82 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMOVIE; }
+{ count(); return tNEXT; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 83 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNEXT; }
+{ count(); return tNOT; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 84 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNOT; }
+{ count(); return tOF; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 85 "engines/director/lingo/lingo-lex.l"
-{ count(); return tOF; }
+{ count(); return tOR; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 86 "engines/director/lingo/lingo-lex.l"
-{ count(); return tOR; }
+{ count(); return tPREVIOUS; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 87 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPREVIOUS; }
+{ count(); return tPUT; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 88 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPUT; }
+{ count(); return tREPEAT; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 89 "engines/director/lingo/lingo-lex.l"
-{ count(); return tREPEAT; }
+{ count(); return tSET; }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 90 "engines/director/lingo/lingo-lex.l"
-{ count(); return tSET; }
+{ count(); return tSTARTS; }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 91 "engines/director/lingo/lingo-lex.l"
-{ count(); return tSTARTS; }
+{ count(); return tTHEN; }
YY_BREAK
case 32:
YY_RULE_SETUP
#line 92 "engines/director/lingo/lingo-lex.l"
-{ count(); return tTHEN; }
+{ count(); return tTO; }
YY_BREAK
case 33:
YY_RULE_SETUP
#line 93 "engines/director/lingo/lingo-lex.l"
-{ count(); return tTO; }
+{ count(); return tWITH; }
YY_BREAK
case 34:
YY_RULE_SETUP
#line 94 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWITH; }
+{ count(); return tWHILE; }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 95 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWHILE; }
+#line 96 "engines/director/lingo/lingo-lex.l"
+{ count(); return tNEQ; }
YY_BREAK
case 36:
YY_RULE_SETUP
#line 97 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNEQ; }
+{ count(); return tGE; }
YY_BREAK
case 37:
YY_RULE_SETUP
#line 98 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGE; }
+{ count(); return tLE; }
YY_BREAK
case 38:
YY_RULE_SETUP
#line 99 "engines/director/lingo/lingo-lex.l"
-{ count(); return tLE; }
- YY_BREAK
-case 39:
-YY_RULE_SETUP
-#line 100 "engines/director/lingo/lingo-lex.l"
{ count(); return tCONCAT; }
YY_BREAK
-case 40:
+case 39:
YY_RULE_SETUP
-#line 102 "engines/director/lingo/lingo-lex.l"
+#line 101 "engines/director/lingo/lingo-lex.l"
{
count();
yylval.s = new Common::String(yytext);
@@ -1126,43 +1113,43 @@ YY_RULE_SETUP
return ID;
}
YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 110 "engines/director/lingo/lingo-lex.l"
+{ count(); yylval.f = atof(yytext); return FLOAT; }
+ YY_BREAK
case 41:
YY_RULE_SETUP
#line 111 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.f = atof(yytext); return FLOAT; }
+{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 42:
YY_RULE_SETUP
#line 112 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ count(); return *yytext; }
YY_BREAK
case 43:
+/* rule 43 can match eol */
YY_RULE_SETUP
#line 113 "engines/director/lingo/lingo-lex.l"
-{ count(); return *yytext; }
+{ return '\n'; }
YY_BREAK
case 44:
-/* rule 44 can match eol */
YY_RULE_SETUP
#line 114 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
case 45:
YY_RULE_SETUP
#line 115 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
- YY_BREAK
-case 46:
-YY_RULE_SETUP
-#line 116 "engines/director/lingo/lingo-lex.l"
YY_BREAK
-case 47:
+case 46:
YY_RULE_SETUP
-#line 118 "engines/director/lingo/lingo-lex.l"
+#line 117 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1166 "engines/director/lingo/lingo-lex.cpp"
+#line 1153 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1455,7 +1442,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 >= 161 )
+ if ( yy_current_state >= 152 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1483,11 +1470,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 >= 161 )
+ if ( yy_current_state >= 152 )
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 == 160);
+ yy_is_jam = (yy_current_state == 151);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2162,7 +2149,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 118 "engines/director/lingo/lingo-lex.l"
+#line 117 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 4b0f8fe..6a78a3f 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -68,8 +68,7 @@ whitespace [\t ]
(?i:[\n\r]+[\t ]+else[\t ]+if) { countnl(); return tNLELSIF; }
(?i:[\n\r]+[\t ]+else) { countnl(); return tNLELSE; }
(?i:else) { count(); return tELSE; }
-(?i:end[\t ]+if) { count(); return tENDIF; }
-(?i:end[\t ]+repeat) { count(); return tENDREPEAT; }
+(?i:end) { count(); return tEND; }
(?i:exit) { count(); return tEXIT; }
(?i:frame) { count(); return tFRAME; }
(?i:global) { count(); return tGLOBAL; }
Commit: c4e1d08d4a868801fc522d0d27aa6693ddac6114
https://github.com/scummvm/scummvm/commit/c4e1d08d4a868801fc522d0d27aa6693ddac6114
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Added default Mac palette
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 6352e43..776768b 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -44,6 +44,72 @@
namespace Director {
+static byte defaultPalette[768] = {
+ 0, 0, 0, 17, 17, 17, 34, 34, 34, 68, 68, 68,
+ 85, 85, 85, 119, 119, 119, 136, 136, 136, 170, 170, 170,
+ 187, 187, 187, 221, 221, 221, 238, 238, 238, 0, 0, 17,
+ 0, 0, 34, 0, 0, 68, 0, 0, 85, 0, 0, 119,
+ 0, 0, 136, 0, 0, 170, 0, 0, 187, 0, 0, 221,
+ 0, 0, 238, 0, 17, 0, 0, 34, 0, 0, 68, 0,
+ 0, 85, 0, 0, 119, 0, 0, 136, 0, 0, 170, 0,
+ 0, 187, 0, 0, 221, 0, 0, 238, 0, 17, 0, 0,
+ 34, 0, 0, 68, 0, 0, 85, 0, 0, 119, 0, 0,
+ 136, 0, 0, 170, 0, 0, 187, 0, 0, 221, 0, 0,
+ 238, 0, 0, 0, 0, 51, 0, 0, 102, 0, 0, 153,
+ 0, 0, 204, 0, 0, 255, 0, 51, 0, 0, 51, 51,
+ 0, 51, 102, 0, 51, 153, 0, 51, 204, 0, 51, 255,
+ 0, 102, 0, 0, 102, 51, 0, 102, 102, 0, 102, 153,
+ 0, 102, 204, 0, 102, 255, 0, 153, 0, 0, 153, 51,
+ 0, 153, 102, 0, 153, 153, 0, 153, 204, 0, 153, 255,
+ 0, 204, 0, 0, 204, 51, 0, 204, 102, 0, 204, 153,
+ 0, 204, 204, 0, 204, 255, 0, 255, 0, 0, 255, 51,
+ 0, 255, 102, 0, 255, 153, 0, 255, 204, 0, 255, 255,
+ 51, 0, 0, 51, 0, 51, 51, 0, 102, 51, 0, 153,
+ 51, 0, 204, 51, 0, 255, 51, 51, 0, 51, 51, 51,
+ 51, 51, 102, 51, 51, 153, 51, 51, 204, 51, 51, 255,
+ 51, 102, 0, 51, 102, 51, 51, 102, 102, 51, 102, 153,
+ 51, 102, 204, 51, 102, 255, 51, 153, 0, 51, 153, 51,
+ 51, 153, 102, 51, 153, 153, 51, 153, 204, 51, 153, 255,
+ 51, 204, 0, 51, 204, 51, 51, 204, 102, 51, 204, 153,
+ 51, 204, 204, 51, 204, 255, 51, 255, 0, 51, 255, 51,
+ 51, 255, 102, 51, 255, 153, 51, 255, 204, 51, 255, 255,
+ 102, 0, 0, 102, 0, 51, 102, 0, 102, 102, 0, 153,
+ 102, 0, 204, 102, 0, 255, 102, 51, 0, 102, 51, 51,
+ 102, 51, 102, 102, 51, 153, 102, 51, 204, 102, 51, 255,
+ 102, 102, 0, 102, 102, 51, 102, 102, 102, 102, 102, 153,
+ 102, 102, 204, 102, 102, 255, 102, 153, 0, 102, 153, 51,
+ 102, 153, 102, 102, 153, 153, 102, 153, 204, 102, 153, 255,
+ 102, 204, 0, 102, 204, 51, 102, 204, 102, 102, 204, 153,
+ 102, 204, 204, 102, 204, 255, 102, 255, 0, 102, 255, 51,
+ 102, 255, 102, 102, 255, 153, 102, 255, 204, 102, 255, 255,
+ 153, 0, 0, 153, 0, 51, 153, 0, 102, 153, 0, 153,
+ 153, 0, 204, 153, 0, 255, 153, 51, 0, 153, 51, 51,
+ 153, 51, 102, 153, 51, 153, 153, 51, 204, 153, 51, 255,
+ 153, 102, 0, 153, 102, 51, 153, 102, 102, 153, 102, 153,
+ 153, 102, 204, 153, 102, 255, 153, 153, 0, 153, 153, 51,
+ 153, 153, 102, 153, 153, 153, 153, 153, 204, 153, 153, 255,
+ 153, 204, 0, 153, 204, 51, 153, 204, 102, 153, 204, 153,
+ 153, 204, 204, 153, 204, 255, 153, 255, 0, 153, 255, 51,
+ 153, 255, 102, 153, 255, 153, 153, 255, 204, 153, 255, 255,
+ 204, 0, 0, 204, 0, 51, 204, 0, 102, 204, 0, 153,
+ 204, 0, 204, 204, 0, 255, 204, 51, 0, 204, 51, 51,
+ 204, 51, 102, 204, 51, 153, 204, 51, 204, 204, 51, 255,
+ 204, 102, 0, 204, 102, 51, 204, 102, 102, 204, 102, 153,
+ 204, 102, 204, 204, 102, 255, 204, 153, 0, 204, 153, 51,
+ 204, 153, 102, 204, 153, 153, 204, 153, 204, 204, 153, 255,
+ 204, 204, 0, 204, 204, 51, 204, 204, 102, 204, 204, 153,
+ 204, 204, 204, 204, 204, 255, 204, 255, 0, 204, 255, 51,
+ 204, 255, 102, 204, 255, 153, 204, 255, 204, 204, 255, 255,
+ 255, 0, 0, 255, 0, 51, 255, 0, 102, 255, 0, 153,
+ 255, 0, 204, 255, 0, 255, 255, 51, 0, 255, 51, 51,
+ 255, 51, 102, 255, 51, 153, 255, 51, 204, 255, 51, 255,
+ 255, 102, 0, 255, 102, 51, 255, 102, 102, 255, 102, 153,
+ 255, 102, 204, 255, 102, 255, 255, 153, 0, 255, 153, 51,
+ 255, 153, 102, 255, 153, 153, 255, 153, 204, 255, 153, 255,
+ 255, 204, 0, 255, 204, 51, 255, 204, 102, 255, 204, 153,
+ 255, 204, 204, 255, 204, 255, 255, 255, 0, 255, 255, 51,
+ 255, 255, 102, 255, 255, 153, 255, 255, 204, 255, 255, 255 };
+
Score::Score(DirectorEngine *vm) {
loadMacFonts();
_vm = vm;
@@ -69,15 +135,18 @@ void Score::loadArchive() {
Common::Array<uint16> clutList = _movieArchive->getResourceIDList(MKTAG('C','L','U','T'));
if (clutList.size() > 1)
- error("More than one palette was found");
-
- if (clutList.size() == 0)
- error("CLUT not found");
+ warning("More than one palette was found (%d)", clutList.size());
- Common::SeekableSubReadStreamEndian *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]);
+ if (clutList.size() == 0) {
+ warning("CLUT resource not found, using default Mac palette");
+ g_system->getPaletteManager()->setPalette(defaultPalette, 0, 256);
+ _vm->setPalette(defaultPalette, 256);
+ } else {
+ Common::SeekableSubReadStreamEndian *pal = _movieArchive->getResource(MKTAG('C', 'L', 'U', 'T'), clutList[0]);
- loadPalette(*pal);
- g_system->getPaletteManager()->setPalette(_vm->getPalette(), 0, _vm->getPaletteColorCount());
+ loadPalette(*pal);
+ g_system->getPaletteManager()->setPalette(_vm->getPalette(), 0, _vm->getPaletteColorCount());
+ }
assert(_movieArchive->hasResource(MKTAG('V','W','S','C'), 1024));
assert(_movieArchive->hasResource(MKTAG('V','W','C','F'), 1024));
Commit: 7f87a90179d87d95a09bc48b11ccf9ac9065699c
https://github.com/scummvm/scummvm/commit/7f87a90179d87d95a09bc48b11ccf9ac9065699c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix crash on parse error
Changed paths:
engines/director/lingo/lingo.cpp
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 09e3805..3a24ceb 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -148,7 +148,8 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
code1(STOP);
}
- Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst));
+ if (_currentScript->size())
+ Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst));
}
void Lingo::executeScript(ScriptType type, uint16 id) {
Commit: d86b95b3070bad2e99a2a1130fc0687d8f3fe426
https://github.com/scummvm/scummvm/commit/d86b95b3070bad2e99a2a1130fc0687d8f3fe426
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix compilation for scripts with no leading spaces
Changed paths:
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index b419574..f3d80d6 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -379,18 +379,18 @@ static yyconst flex_int16_t yy_accept[152] =
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,
- 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, 0, 39, 13, 39, 18, 39,
- 21, 39, 39, 39, 34, 9, 39, 14, 39, 39,
- 28, 30, 0, 39, 20, 39, 0, 5, 26, 8,
+ 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
} ;
@@ -438,23 +438,23 @@ static yyconst flex_int32_t yy_meta[58] =
static yyconst flex_int16_t yy_base[155] =
{ 0,
- 0, 56, 186, 352, 60, 64, 68, 72, 173, 352,
- 143, 141, 49, 65, 132, 53, 0, 53, 54, 58,
- 54, 61, 70, 59, 83, 95, 79, 62, 98, 105,
- 103, 104, 138, 151, 157, 125, 161, 165, 169, 132,
- 352, 352, 0, 108, 123, 352, 352, 352, 0, 117,
- 141, 134, 144, 158, 154, 163, 152, 0, 0, 149,
- 154, 166, 162, 153, 152, 159, 0, 0, 173, 162,
- 166, 165, 189, 191, 0, 188, 181, 217, 225, 192,
- 0, 85, 0, 191, 197, 206, 0, 199, 209, 220,
- 211, 211, 211, 207, 214, 211, 0, 212, 0, 229,
-
- 0, 220, 224, 228, 232, 226, 240, 0, 0, 0,
- 246, 251, 0, 0, 240, 254, 254, 0, 252, 264,
- 249, 0, 263, 0, 264, 261, 0, 261, 0, 267,
- 0, 264, 261, 263, 0, 86, 269, 0, 266, 266,
- 0, 0, 298, 277, 0, 278, 290, 0, 0, 352,
- 352, 343, 89, 347
+ 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
} ;
static yyconst flex_int16_t yy_def[155] =
@@ -462,72 +462,73 @@ static yyconst flex_int16_t yy_def[155] =
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, 152,
- 151, 151, 154, 151, 151, 151, 151, 151, 153, 153,
+ 153, 153, 151, 151, 151, 151, 151, 151, 151, 151,
+ 152, 151, 151, 154, 151, 151, 151, 151, 151, 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, 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, 151, 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, 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, 151,
+ 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[410] =
+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, 44, 45,
+ 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, 46, 47, 50,
- 51, 52, 53, 56, 54, 57, 61, 143, 58, 59,
- 143, 69, 49, 55, 70, 82, 60, 62, 67, 63,
-
- 50, 51, 52, 53, 56, 54, 57, 61, 68, 58,
- 64, 59, 69, 65, 55, 70, 71, 60, 82, 62,
- 67, 63, 66, 72, 74, 76, 77, 36, 36, 68,
- 75, 64, 44, 45, 83, 65, 73, 41, 71, 78,
- 36, 36, 79, 66, 48, 72, 74, 76, 77, 43,
- 42, 75, 79, 36, 36, 79, 83, 73, 35, 36,
- 36, 37, 37, 36, 36, 37, 38, 84, 85, 38,
- 38, 39, 39, 38, 86, 87, 88, 89, 41, 90,
- 91, 92, 93, 80, 94, 151, 95, 96, 84, 85,
- 97, 98, 151, 99, 100, 86, 101, 87, 88, 89,
-
- 90, 91, 92, 102, 93, 80, 94, 95, 96, 103,
- 104, 97, 105, 98, 99, 100, 106, 101, 78, 36,
- 36, 79, 107, 108, 109, 102, 79, 36, 36, 79,
- 110, 103, 104, 105, 111, 112, 117, 106, 113, 114,
- 115, 116, 118, 107, 108, 119, 109, 120, 151, 121,
- 122, 110, 123, 124, 126, 111, 125, 112, 117, 113,
- 114, 115, 116, 118, 127, 128, 119, 129, 130, 120,
- 121, 122, 131, 123, 132, 124, 126, 125, 133, 151,
- 134, 135, 136, 137, 151, 138, 127, 128, 129, 139,
- 130, 140, 141, 142, 131, 144, 132, 145, 146, 143,
-
- 133, 134, 143, 135, 136, 137, 138, 148, 149, 150,
- 151, 139, 140, 141, 142, 151, 144, 151, 145, 146,
- 147, 151, 151, 151, 151, 151, 151, 151, 148, 149,
- 151, 150, 151, 151, 151, 151, 151, 151, 151, 151,
- 151, 151, 147, 40, 151, 40, 40, 81, 151, 151,
- 81, 3, 151, 151, 151, 151, 151, 151, 151, 151,
+ 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, 151, 151, 151, 151, 151, 151, 151, 151,
+ 151
} ;
-static yyconst flex_int16_t yy_chk[410] =
+static yyconst flex_int16_t yy_chk[412] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -537,43 +538,44 @@ static yyconst flex_int16_t yy_chk[410] =
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, 20, 21, 20, 22, 24, 136, 22, 23,
- 136, 28, 153, 20, 28, 82, 23, 25, 27, 25,
-
- 16, 18, 19, 20, 21, 20, 22, 24, 27, 22,
- 25, 23, 28, 26, 20, 28, 29, 23, 44, 25,
- 27, 25, 26, 30, 31, 32, 32, 36, 36, 27,
- 31, 25, 45, 45, 50, 26, 30, 40, 29, 33,
- 33, 33, 33, 26, 15, 30, 31, 32, 32, 12,
- 11, 31, 34, 34, 34, 34, 50, 30, 35, 35,
- 35, 35, 37, 37, 37, 37, 38, 51, 52, 38,
- 39, 39, 39, 39, 53, 54, 55, 56, 9, 57,
- 60, 61, 62, 38, 63, 3, 64, 65, 51, 52,
- 66, 69, 0, 70, 71, 53, 72, 54, 55, 56,
-
- 57, 60, 61, 73, 62, 38, 63, 64, 65, 74,
- 76, 66, 77, 69, 70, 71, 80, 72, 78, 78,
- 78, 78, 84, 85, 86, 73, 79, 79, 79, 79,
- 88, 74, 76, 77, 89, 90, 95, 80, 91, 92,
- 93, 94, 96, 84, 85, 98, 86, 100, 0, 102,
- 103, 88, 104, 105, 107, 89, 106, 90, 95, 91,
- 92, 93, 94, 96, 111, 112, 98, 115, 116, 100,
- 102, 103, 117, 104, 119, 105, 107, 106, 120, 0,
- 121, 123, 125, 126, 0, 128, 111, 112, 115, 130,
- 116, 132, 133, 134, 117, 137, 119, 139, 140, 143,
-
- 120, 121, 143, 123, 125, 126, 128, 144, 146, 147,
- 0, 130, 132, 133, 134, 0, 137, 0, 139, 140,
- 143, 0, 0, 0, 0, 0, 0, 0, 144, 146,
- 0, 147, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 143, 152, 0, 152, 152, 154, 0, 0,
- 154, 151, 151, 151, 151, 151, 151, 151, 151, 151,
+ 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, 151, 151, 151, 151, 151, 151, 151, 151,
+ 151
} ;
static yy_state_type yy_last_accepting_state;
@@ -636,7 +638,7 @@ static void countnl() {
Director::g_lingo->_colnumber = strlen(p);
}
-#line 640 "engines/director/lingo/lingo-lex.cpp"
+#line 642 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -824,7 +826,7 @@ YY_DECL
#line 58 "engines/director/lingo/lingo-lex.l"
-#line 828 "engines/director/lingo/lingo-lex.cpp"
+#line 830 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -884,7 +886,7 @@ yy_match:
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 352 );
+ while ( yy_base[yy_current_state] != 354 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -1149,7 +1151,7 @@ YY_RULE_SETUP
#line 117 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1153 "engines/director/lingo/lingo-lex.cpp"
+#line 1155 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 6a78a3f..b7dfecb 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -65,8 +65,8 @@ whitespace [\t ]
(?i:contains) { count(); return tCONTAINS; }
(?i:down) { count(); return tDOWN; }
(?i:if) { count(); return tIF; }
-(?i:[\n\r]+[\t ]+else[\t ]+if) { countnl(); return tNLELSIF; }
-(?i:[\n\r]+[\t ]+else) { countnl(); return tNLELSE; }
+(?i:[\n\r]+[\t ]*else[\t ]+if) { countnl(); return tNLELSIF; }
+(?i:[\n\r]+[\t ]*else) { countnl(); return tNLELSE; }
(?i:else) { count(); return tELSE; }
(?i:end) { count(); return tEND; }
(?i:exit) { count(); return tEXIT; }
Commit: ffdb3f9d0f8f05b1735f7b447485d2d126c05c09
https://github.com/scummvm/scummvm/commit/ffdb3f9d0f8f05b1735f7b447485d2d126c05c09
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix if() statement code generation
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index ff46cb4..e04aacd 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -1948,6 +1948,11 @@ yyreduce:
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
+ case 46:
+#line 296 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = g_lingo->_currentScript->size(); ;}
+ break;
+
case 49:
#line 301 "engines/director/lingo/lingo-gr.y"
{
@@ -2270,7 +2275,7 @@ yyreduce:
/* Line 1267 of yacc.c. */
-#line 2274 "engines/director/lingo/lingo-gr.cpp"
+#line 2279 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index f88e36d..4e2c657 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -293,7 +293,7 @@ begin: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
;
end: /* nothing */ { g_lingo->code1(STOP); $$ = g_lingo->_currentScript->size(); }
;
-stmtlist: /* nothing */
+stmtlist: /* nothing */ { $$ = g_lingo->_currentScript->size(); }
| stmtlist nl
| stmtlist stmt
;
Commit: 4d2e4a8c7345ae996b9ed6c8c3fbc3bc5f063ac8
https://github.com/scummvm/scummvm/commit/4d2e4a8c7345ae996b9ed6c8c3fbc3bc5f063ac8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Nicer error recovery during execution
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-funcs.cpp
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 24325be..a8881d7 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -608,14 +608,25 @@ void Lingo::c_call() {
Common::String name((char *)&(*g_lingo->_currentScript)[g_lingo->_pc]);
g_lingo->_pc += g_lingo->calcStringAlignment(name.c_str());
+ int nargs = READ_UINT32(&(*g_lingo->_currentScript)[g_lingo->_pc++]);
+
if (!g_lingo->_handlers.contains(name)) {
- error("Call to undefined handler '%s'", name.c_str());
+ warning("Call to undefined handler '%s'. Dropping %d stack items", name.c_str(), nargs);
+
+ for (int i = 0; i < nargs; i++)
+ g_lingo->pop();
+
+ // Push dummy value
+ Datum d;
+ d.u.i = 0;
+ d.type = VOID;
+ g_lingo->push(d);
+
+ return;
}
Symbol *sym = g_lingo->_handlers[name];
- int nargs = READ_UINT32(&(*g_lingo->_currentScript)[g_lingo->_pc++]);
-
for (int i = nargs; i < sym->nargs; i++) {
Datum d;
@@ -643,6 +654,12 @@ void Lingo::c_call() {
}
void Lingo::c_procret() {
+ if (!g_lingo->_callstack.size()) {
+ warning("Call stack underflow");
+ g_lingo->_returning = true;
+ return;
+ }
+
CFrame *fp = g_lingo->_callstack.back();
g_lingo->_currentScript = fp->retscript;
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index fbb65ea..50120cf 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -190,7 +190,7 @@ void Lingo::func_mciwait(Common::String &s) {
}
void Lingo::func_goto(Common::String &frame, Common::String &movie) {
- if (!_vm->_movies->contains(movie))
+ if (!_vm->_movies || !_vm->_movies->contains(movie))
error("Movie %s does not exist", movie.c_str());
_vm->_currentScore = _vm->_movies->getVal(movie);
Commit: 5e99a9858ba10e29e9b3b735ea9f40b19a559561
https://github.com/scummvm/scummvm/commit/5e99a9858ba10e29e9b3b735ea9f40b19a559561
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Gracefully return when movie does not exits
Changed paths:
engines/director/lingo/lingo-funcs.cpp
diff --git a/engines/director/lingo/lingo-funcs.cpp b/engines/director/lingo/lingo-funcs.cpp
index 50120cf..08b3d45 100644
--- a/engines/director/lingo/lingo-funcs.cpp
+++ b/engines/director/lingo/lingo-funcs.cpp
@@ -190,8 +190,10 @@ void Lingo::func_mciwait(Common::String &s) {
}
void Lingo::func_goto(Common::String &frame, Common::String &movie) {
- if (!_vm->_movies || !_vm->_movies->contains(movie))
- error("Movie %s does not exist", movie.c_str());
+ if (!_vm->_movies || !_vm->_movies->contains(movie)) {
+ warning("Movie %s does not exist", movie.c_str());
+ return;
+ }
_vm->_currentScore = _vm->_movies->getVal(movie);
_vm->_currentScore->loadArchive();
Commit: 903f57ab2d9a7de5350383b6fcfe4b77de08ab10
https://github.com/scummvm/scummvm/commit/903f57ab2d9a7de5350383b6fcfe4b77de08ab10
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix loop test
Changed paths:
engines/director/lingo/tests/loops.lingo
diff --git a/engines/director/lingo/tests/loops.lingo b/engines/director/lingo/tests/loops.lingo
index 0c7592a..e4c5cce 100644
--- a/engines/director/lingo/tests/loops.lingo
+++ b/engines/director/lingo/tests/loops.lingo
@@ -1,5 +1,5 @@
set x = 5
-if x <= 5 then set x = 6 end if
+if x <= 5 then set x = 6
if (x = 5) then
set x = 7 -- this is comment
else
Commit: 847b1c0a034a81b68568cd86598c5f8b8510bd8e
https://github.com/scummvm/scummvm/commit/847b1c0a034a81b68568cd86598c5f8b8510bd8e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Do not error out on unacceptable characters in toLowercaseMac()
Changed paths:
engines/director/lingo/lingo.cpp
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 3a24ceb..fd9d0a5 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -295,7 +295,9 @@ Common::String *Lingo::toLowercaseMac(Common::String *s) {
} else if (*p < 0x80) {
*res += tolower(*p);
} else {
- error("Unacceptable symbol in toLowercaseMac: %c", *p);
+ warning("Unacceptable symbol in toLowercaseMac: %c", *p);
+
+ *res += *p;
}
p++;
}
Commit: fa4c1710d126b2d74cbdd784c59ea435cdc0d1e5
https://github.com/scummvm/scummvm/commit/fa4c1710d126b2d74cbdd784c59ea435cdc0d1e5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Smoother tests handling
Changed paths:
engines/director/lingo/lingo.cpp
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index fd9d0a5..7c7f51e 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -140,7 +140,7 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
begin = end + 1;
}
- _hadError = false;
+ _hadError = true; // HACK: This is for preventing test execution
parse(begin);
} else {
parse(code);
@@ -148,7 +148,7 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
code1(STOP);
}
- if (_currentScript->size())
+ if (_currentScript->size() && !_hadError)
Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst));
}
@@ -158,6 +158,8 @@ void Lingo::executeScript(ScriptType type, uint16 id) {
return;
}
+ debug(2, "Executing script type: %d, id: %d", type, id);
+
_currentScript = _scripts[type][id];
_pc = 0;
_returning = false;
@@ -322,7 +324,7 @@ void Lingo::runTests() {
stream->read(script, size);
- warning("Executing file %s of size %d", m.getName().c_str(), size);
+ warning("Compiling file %s of size %d, id: %d", m.getName().c_str(), size, counter);
_hadError = false;
addCode(script, kMovieScript, counter);
Commit: d72670e29decf23c8fa7af692615ff85bc97673c
https://github.com/scummvm/scummvm/commit/d72670e29decf23c8fa7af692615ff85bc97673c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix multiline if() statement
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index e04aacd..b0312e3 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -454,7 +454,7 @@ union yyalloc
/* YYNRULES -- Number of rules. */
#define YYNRULES 106
/* YYNRULES -- Number of states. */
-#define YYNSTATES 225
+#define YYNSTATES 224
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -506,15 +506,15 @@ static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 12, 14, 15, 17, 19,
21, 23, 25, 30, 35, 40, 42, 44, 46, 48,
- 57, 69, 82, 91, 104, 117, 124, 135, 146, 147,
- 151, 154, 156, 159, 161, 168, 170, 176, 178, 182,
- 186, 189, 193, 195, 197, 198, 199, 200, 203, 206,
- 208, 210, 212, 217, 222, 224, 226, 230, 234, 238,
- 242, 246, 250, 254, 258, 262, 266, 270, 273, 277,
- 281, 285, 289, 292, 295, 299, 302, 305, 308, 310,
- 312, 315, 317, 321, 324, 327, 330, 333, 337, 340,
- 344, 347, 350, 352, 356, 359, 363, 364, 373, 374,
- 376, 380, 385, 386, 390, 391, 393
+ 57, 69, 82, 91, 103, 116, 123, 134, 145, 146,
+ 150, 153, 155, 158, 160, 167, 169, 175, 177, 181,
+ 185, 188, 192, 194, 196, 197, 198, 199, 202, 205,
+ 207, 209, 211, 216, 221, 223, 225, 229, 233, 237,
+ 241, 245, 249, 253, 257, 261, 265, 269, 272, 276,
+ 280, 284, 288, 291, 294, 298, 301, 304, 307, 309,
+ 311, 314, 316, 320, 323, 326, 329, 332, 336, 339,
+ 343, 346, 349, 351, 355, 358, 362, 363, 372, 373,
+ 375, 379, 384, 385, 389, 390, 392
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -530,36 +530,36 @@ static const yytype_int8 yyrhs[] =
51, 85, 83, 13, 35, 85, 83, 84, 83, 16,
32, -1, 80, 77, 34, 66, 84, 83, 16, 21,
-1, 80, 77, 34, 66, 84, 83, 38, 84, 83,
- 66, 16, 21, -1, 80, 77, 34, 66, 84, 83,
- 82, 73, 83, 66, 16, 21, -1, 80, 77, 34,
+ 16, 21, -1, 80, 77, 34, 66, 84, 83, 82,
+ 73, 83, 66, 16, 21, -1, 80, 77, 34, 82,
+ 69, 83, -1, 80, 77, 34, 82, 69, 83, 38,
82, 69, 83, -1, 80, 77, 34, 82, 69, 83,
- 38, 82, 69, 83, -1, 80, 77, 34, 82, 69,
- 83, 74, 83, 72, 83, -1, -1, 38, 82, 69,
- -1, 73, 76, -1, 76, -1, 74, 75, -1, 75,
- -1, 81, 77, 34, 82, 70, 83, -1, 74, -1,
- 81, 77, 34, 84, 83, -1, 85, -1, 85, 51,
- 85, -1, 58, 77, 59, -1, 32, 37, -1, 32,
- 36, 10, -1, 21, -1, 15, -1, -1, -1, -1,
- 84, 66, -1, 84, 70, -1, 7, -1, 8, -1,
- 11, -1, 9, 58, 96, 59, -1, 10, 58, 96,
- 59, -1, 10, -1, 68, -1, 85, 52, 85, -1,
- 85, 53, 85, -1, 85, 54, 85, -1, 85, 55,
- 85, -1, 85, 60, 85, -1, 85, 61, 85, -1,
- 85, 44, 85, -1, 85, 39, 85, -1, 85, 40,
- 85, -1, 85, 45, 85, -1, 85, 46, 85, -1,
- 47, 85, -1, 85, 62, 85, -1, 85, 48, 85,
- -1, 85, 49, 85, -1, 85, 50, 85, -1, 52,
- 85, -1, 53, 85, -1, 58, 85, 59, -1, 25,
- 11, -1, 26, 10, -1, 31, 85, -1, 88, -1,
- 17, -1, 19, 87, -1, 10, -1, 87, 63, 10,
- -1, 20, 23, -1, 20, 28, -1, 20, 30, -1,
- 20, 89, -1, 20, 89, 90, -1, 20, 90, -1,
- 35, 18, 11, -1, 18, 11, -1, 35, 11, -1,
- 11, -1, 29, 27, 11, -1, 27, 11, -1, 35,
- 27, 11, -1, -1, 24, 10, 92, 82, 93, 66,
- 94, 84, -1, -1, 10, -1, 93, 63, 10, -1,
- 93, 66, 63, 10, -1, -1, 10, 82, 96, -1,
- -1, 85, -1, 96, 63, 85, -1
+ 74, 83, 72, 83, -1, -1, 38, 82, 69, -1,
+ 73, 76, -1, 76, -1, 74, 75, -1, 75, -1,
+ 81, 77, 34, 82, 70, 83, -1, 74, -1, 81,
+ 77, 34, 84, 83, -1, 85, -1, 85, 51, 85,
+ -1, 58, 77, 59, -1, 32, 37, -1, 32, 36,
+ 10, -1, 21, -1, 15, -1, -1, -1, -1, 84,
+ 66, -1, 84, 70, -1, 7, -1, 8, -1, 11,
+ -1, 9, 58, 96, 59, -1, 10, 58, 96, 59,
+ -1, 10, -1, 68, -1, 85, 52, 85, -1, 85,
+ 53, 85, -1, 85, 54, 85, -1, 85, 55, 85,
+ -1, 85, 60, 85, -1, 85, 61, 85, -1, 85,
+ 44, 85, -1, 85, 39, 85, -1, 85, 40, 85,
+ -1, 85, 45, 85, -1, 85, 46, 85, -1, 47,
+ 85, -1, 85, 62, 85, -1, 85, 48, 85, -1,
+ 85, 49, 85, -1, 85, 50, 85, -1, 52, 85,
+ -1, 53, 85, -1, 58, 85, 59, -1, 25, 11,
+ -1, 26, 10, -1, 31, 85, -1, 88, -1, 17,
+ -1, 19, 87, -1, 10, -1, 87, 63, 10, -1,
+ 20, 23, -1, 20, 28, -1, 20, 30, -1, 20,
+ 89, -1, 20, 89, 90, -1, 20, 90, -1, 35,
+ 18, 11, -1, 18, 11, -1, 35, 11, -1, 11,
+ -1, 29, 27, 11, -1, 27, 11, -1, 35, 27,
+ 11, -1, -1, 24, 10, 92, 82, 93, 66, 94,
+ 84, -1, -1, 10, -1, 93, 63, 10, -1, 93,
+ 66, 63, 10, -1, -1, 10, 82, 96, -1, -1,
+ 85, -1, 96, 63, 85, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -637,7 +637,7 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 2, 1, 0, 1, 1, 1,
1, 1, 4, 4, 4, 1, 1, 1, 1, 8,
- 11, 12, 8, 12, 12, 6, 10, 10, 0, 3,
+ 11, 12, 8, 11, 12, 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, 4, 1, 1, 3, 3, 3, 3,
@@ -671,11 +671,11 @@ static const yytype_uint8 yydefact[] =
45, 0, 0, 45, 45, 16, 0, 102, 47, 48,
0, 0, 45, 44, 25, 100, 0, 46, 0, 45,
46, 0, 46, 0, 43, 44, 45, 33, 0, 101,
- 97, 19, 46, 45, 22, 0, 45, 35, 31, 0,
+ 97, 19, 46, 45, 22, 45, 45, 35, 31, 0,
0, 32, 28, 0, 45, 0, 0, 30, 0, 0,
45, 44, 45, 44, 0, 0, 0, 0, 44, 26,
- 0, 27, 0, 0, 20, 0, 0, 45, 29, 45,
- 21, 23, 24, 36, 34
+ 0, 27, 0, 0, 20, 23, 0, 45, 29, 45,
+ 21, 24, 36, 34
};
/* YYDEFGOTO[NTERM-NUM]. */
@@ -711,18 +711,18 @@ static const yytype_int16 yypact[] =
128, 342, 450, -1, -3, -161, 140, -161, 123, 450,
-161, 135, -161, 142, -161, -161, 142, -161, 349, -161,
256, -161, -161, 256, -161, 256, 142, 142, -161, 349,
- 314, -161, 120, 126, 256, 145, 81, -161, 81, 130,
- -161, -161, -161, -161, 146, 133, 151, 153, -5, -161,
- 314, -161, 285, 138, -161, 152, 157, 256, -161, -161,
- -161, -161, -161, -161, -161
+ 314, -161, 120, 126, 256, 145, 146, -161, 81, 130,
+ -161, -161, -161, -161, 149, 137, 151, 154, -5, -161,
+ 314, -161, 285, 141, -161, -161, 153, 256, -161, -161,
+ -161, -161, -161, -161
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
-161, -161, -19, 114, 6, -141, 0, -161, -161, -161,
- 8, -128, -12, -65, -161, -161, -161, -160, -4, -51,
- -117, 2, 7, -161, -161, -161, 139, -161, -161, -161,
+ 3, -128, -9, -65, -161, -161, -161, -160, -4, -51,
+ -117, 2, 7, -161, -161, -161, 138, -161, -161, -161,
-161, -161, -20
};
@@ -749,9 +749,9 @@ static const yytype_int16 yytable[] =
157, 138, 195, 147, 196, 198, 42, 143, 66, 148,
161, 43, 165, 204, 168, 44, 45, 46, 47, 209,
179, 211, 166, 48, 162, 181, 184, 174, 201, 173,
- 203, 205, 213, 169, 208, 214, 223, 215, 224, 216,
- 220, 190, 176, 221, 197, -6, 1, 206, 222, 207,
- 72, 108, 2, 3, 4, 5, 6, 0, 100, 0,
+ 203, 205, 206, 169, 208, 213, 222, 176, 223, 214,
+ 216, 190, 215, 220, 221, -6, 1, 197, 0, 207,
+ 72, 108, 2, 3, 4, 5, 6, 100, 0, 0,
0, 72, 7, 0, 8, 9, 10, 210, 0, 11,
12, 13, 0, 0, 0, 0, 14, 15, 16, 0,
0, 0, 219, 0, 0, 0, 0, 0, 0, 0,
@@ -809,9 +809,9 @@ static const yytype_int16 yycheck[] =
149, 10, 183, 131, 185, 186, 18, 59, 57, 10,
35, 23, 10, 194, 16, 27, 28, 29, 30, 200,
10, 202, 63, 35, 152, 32, 21, 15, 38, 163,
- 34, 16, 16, 161, 34, 32, 217, 16, 219, 16,
- 32, 175, 164, 21, 186, 0, 1, 196, 21, 198,
- 178, 67, 7, 8, 9, 10, 11, -1, 49, -1,
+ 34, 16, 16, 161, 34, 16, 217, 164, 219, 32,
+ 16, 175, 21, 32, 21, 0, 1, 186, -1, 198,
+ 178, 67, 7, 8, 9, 10, 11, 49, -1, -1,
-1, 189, 17, -1, 19, 20, 21, 201, -1, 24,
25, 26, -1, -1, -1, -1, 31, 32, 33, -1,
-1, -1, 212, -1, -1, -1, -1, -1, -1, -1,
@@ -875,9 +875,9 @@ static const yytype_uint8 yystos[] =
83, 16, 38, 82, 15, 38, 74, 75, 81, 10,
84, 32, 83, 84, 21, 84, 73, 74, 76, 81,
82, 75, 83, 77, 84, 83, 83, 76, 83, 77,
- 69, 38, 72, 34, 83, 16, 66, 66, 34, 83,
- 82, 83, 82, 16, 32, 16, 16, 84, 69, 70,
- 32, 21, 21, 83, 83
+ 69, 38, 72, 34, 83, 16, 16, 66, 34, 83,
+ 82, 83, 82, 16, 32, 21, 16, 84, 69, 70,
+ 32, 21, 83, 83
};
#define yyerrok (yyerrstatus = 0)
@@ -1801,12 +1801,12 @@ yyreduce:
#line 189 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(5) - (12)].code));
- WRITE_UINT32(&else1, (yyvsp[(8) - (12)].code));
- WRITE_UINT32(&end, (yyvsp[(9) - (12)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; /* end, if cond fails */
+ WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
+ WRITE_UINT32(&else1, (yyvsp[(8) - (11)].code));
+ WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); ;}
break;
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 4e2c657..f1b5a49 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -186,7 +186,7 @@ ifstmt: if cond tTHEN nl stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 1] = then; /* thenpart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN nl stmtlist end tNLELSE stmtlist end nl tEND tIF {
+ | if cond tTHEN nl stmtlist end tNLELSE stmtlist end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
WRITE_UINT32(&else1, $8);
Commit: 52fa9646b0639d5fcb19e841bd5bdbcbf470596a
https://github.com/scummvm/scummvm/commit/52fa9646b0639d5fcb19e841bd5bdbcbf470596a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Improved support for multiple 'else if' statements
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/tests/if.lingo
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index b0312e3..577afc1 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -183,7 +183,10 @@ extern int yylex();
extern int yyparse();
using namespace Director;
-void yyerror(char *s) { g_lingo->_hadError = true; warning("%s at line %d col %d", s, Director::g_lingo->_linenumber, Director::g_lingo->_colnumber); }
+void yyerror(char *s) {
+ g_lingo->_hadError = true;
+ warning("%s at line %d col %d", s, g_lingo->_linenumber, g_lingo->_colnumber);
+}
@@ -208,7 +211,7 @@ void yyerror(char *s) { g_lingo->_hadError = true; warning("%s at line %d col %d
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 66 "engines/director/lingo/lingo-gr.y"
+#line 69 "engines/director/lingo/lingo-gr.y"
{
Common::String *s;
int i;
@@ -217,7 +220,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 221 "engines/director/lingo/lingo-gr.cpp"
+#line 224 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -230,7 +233,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 234 "engines/director/lingo/lingo-gr.cpp"
+#line 237 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -445,7 +448,7 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 65
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 555
+#define YYLAST 573
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 64
@@ -454,7 +457,7 @@ union yyalloc
/* YYNRULES -- Number of rules. */
#define YYNRULES 106
/* YYNRULES -- Number of states. */
-#define YYNSTATES 224
+#define YYNSTATES 223
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -506,15 +509,15 @@ static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 12, 14, 15, 17, 19,
21, 23, 25, 30, 35, 40, 42, 44, 46, 48,
- 57, 69, 82, 91, 103, 116, 123, 134, 145, 146,
- 150, 153, 155, 158, 160, 167, 169, 175, 177, 181,
- 185, 188, 192, 194, 196, 197, 198, 199, 202, 205,
- 207, 209, 211, 216, 221, 223, 225, 229, 233, 237,
- 241, 245, 249, 253, 257, 261, 265, 269, 272, 276,
- 280, 284, 288, 291, 294, 298, 301, 304, 307, 309,
- 311, 314, 316, 320, 323, 326, 329, 332, 336, 339,
- 343, 346, 349, 351, 355, 358, 362, 363, 372, 373,
- 375, 379, 384, 385, 389, 390, 392
+ 57, 69, 82, 91, 103, 115, 122, 133, 144, 145,
+ 149, 152, 154, 157, 159, 166, 168, 174, 176, 180,
+ 184, 187, 191, 193, 195, 196, 197, 198, 201, 204,
+ 206, 208, 210, 215, 220, 222, 224, 228, 232, 236,
+ 240, 244, 248, 252, 256, 260, 264, 268, 271, 275,
+ 279, 283, 287, 290, 293, 297, 300, 303, 306, 308,
+ 310, 313, 315, 319, 322, 325, 328, 331, 335, 338,
+ 342, 345, 348, 350, 354, 357, 361, 362, 371, 372,
+ 374, 378, 383, 384, 388, 389, 391
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -531,51 +534,51 @@ static const yytype_int8 yyrhs[] =
32, -1, 80, 77, 34, 66, 84, 83, 16, 21,
-1, 80, 77, 34, 66, 84, 83, 38, 84, 83,
16, 21, -1, 80, 77, 34, 66, 84, 83, 82,
- 73, 83, 66, 16, 21, -1, 80, 77, 34, 82,
- 69, 83, -1, 80, 77, 34, 82, 69, 83, 38,
- 82, 69, 83, -1, 80, 77, 34, 82, 69, 83,
- 74, 83, 72, 83, -1, -1, 38, 82, 69, -1,
- 73, 76, -1, 76, -1, 74, 75, -1, 75, -1,
- 81, 77, 34, 82, 70, 83, -1, 74, -1, 81,
- 77, 34, 84, 83, -1, 85, -1, 85, 51, 85,
- -1, 58, 77, 59, -1, 32, 37, -1, 32, 36,
- 10, -1, 21, -1, 15, -1, -1, -1, -1, 84,
- 66, -1, 84, 70, -1, 7, -1, 8, -1, 11,
- -1, 9, 58, 96, 59, -1, 10, 58, 96, 59,
- -1, 10, -1, 68, -1, 85, 52, 85, -1, 85,
- 53, 85, -1, 85, 54, 85, -1, 85, 55, 85,
- -1, 85, 60, 85, -1, 85, 61, 85, -1, 85,
- 44, 85, -1, 85, 39, 85, -1, 85, 40, 85,
- -1, 85, 45, 85, -1, 85, 46, 85, -1, 47,
- 85, -1, 85, 62, 85, -1, 85, 48, 85, -1,
- 85, 49, 85, -1, 85, 50, 85, -1, 52, 85,
- -1, 53, 85, -1, 58, 85, 59, -1, 25, 11,
- -1, 26, 10, -1, 31, 85, -1, 88, -1, 17,
- -1, 19, 87, -1, 10, -1, 87, 63, 10, -1,
- 20, 23, -1, 20, 28, -1, 20, 30, -1, 20,
- 89, -1, 20, 89, 90, -1, 20, 90, -1, 35,
- 18, 11, -1, 18, 11, -1, 35, 11, -1, 11,
- -1, 29, 27, 11, -1, 27, 11, -1, 35, 27,
- 11, -1, -1, 24, 10, 92, 82, 93, 66, 94,
- 84, -1, -1, 10, -1, 93, 63, 10, -1, 93,
- 66, 63, 10, -1, -1, 10, 82, 96, -1, -1,
- 85, -1, 96, 63, 85, -1
+ 73, 83, 16, 21, -1, 80, 77, 34, 82, 69,
+ 83, -1, 80, 77, 34, 82, 69, 83, 38, 82,
+ 69, 83, -1, 80, 77, 34, 82, 69, 83, 74,
+ 83, 72, 83, -1, -1, 38, 82, 69, -1, 73,
+ 76, -1, 76, -1, 74, 75, -1, 75, -1, 81,
+ 77, 34, 82, 70, 83, -1, 74, -1, 81, 77,
+ 34, 84, 83, -1, 85, -1, 85, 51, 85, -1,
+ 58, 77, 59, -1, 32, 37, -1, 32, 36, 10,
+ -1, 21, -1, 15, -1, -1, -1, -1, 84, 66,
+ -1, 84, 70, -1, 7, -1, 8, -1, 11, -1,
+ 9, 58, 96, 59, -1, 10, 58, 96, 59, -1,
+ 10, -1, 68, -1, 85, 52, 85, -1, 85, 53,
+ 85, -1, 85, 54, 85, -1, 85, 55, 85, -1,
+ 85, 60, 85, -1, 85, 61, 85, -1, 85, 44,
+ 85, -1, 85, 39, 85, -1, 85, 40, 85, -1,
+ 85, 45, 85, -1, 85, 46, 85, -1, 47, 85,
+ -1, 85, 62, 85, -1, 85, 48, 85, -1, 85,
+ 49, 85, -1, 85, 50, 85, -1, 52, 85, -1,
+ 53, 85, -1, 58, 85, 59, -1, 25, 11, -1,
+ 26, 10, -1, 31, 85, -1, 88, -1, 17, -1,
+ 19, 87, -1, 10, -1, 87, 63, 10, -1, 20,
+ 23, -1, 20, 28, -1, 20, 30, -1, 20, 89,
+ -1, 20, 89, 90, -1, 20, 90, -1, 35, 18,
+ 11, -1, 18, 11, -1, 35, 11, -1, 11, -1,
+ 29, 27, 11, -1, 27, 11, -1, 35, 27, 11,
+ -1, -1, 24, 10, 92, 82, 93, 66, 94, 84,
+ -1, -1, 10, -1, 93, 63, 10, -1, 93, 66,
+ 63, 10, -1, -1, 10, 82, 96, -1, -1, 85,
+ -1, 96, 63, 85, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 95, 95, 96, 97, 100, 105, 106, 107, 108,
- 109, 110, 113, 119, 125, 132, 133, 135, 136, 141,
- 152, 168, 182, 189, 198, 207, 217, 227, 238, 239,
- 242, 243, 246, 247, 250, 258, 259, 267, 268, 269,
- 271, 273, 279, 285, 292, 294, 296, 297, 298, 301,
- 306, 309, 312, 318, 326, 329, 330, 331, 332, 333,
- 334, 335, 336, 337, 338, 339, 340, 341, 342, 343,
- 344, 345, 346, 347, 348, 351, 352, 353, 354, 355,
- 357, 360, 361, 372, 373, 374, 375, 380, 386, 393,
- 394, 395, 396, 399, 400, 401, 429, 429, 436, 437,
- 438, 439, 441, 444, 452, 453, 454
+ 0, 98, 98, 99, 100, 103, 108, 109, 110, 111,
+ 112, 113, 116, 122, 128, 135, 136, 138, 139, 144,
+ 155, 171, 185, 192, 201, 210, 220, 230, 241, 242,
+ 245, 246, 249, 250, 253, 261, 262, 270, 271, 272,
+ 274, 276, 282, 288, 295, 297, 299, 300, 301, 304,
+ 309, 312, 315, 321, 329, 332, 333, 334, 335, 336,
+ 337, 338, 339, 340, 341, 342, 343, 344, 345, 346,
+ 347, 348, 349, 350, 351, 354, 355, 356, 357, 358,
+ 360, 363, 364, 375, 376, 377, 378, 383, 389, 396,
+ 397, 398, 399, 402, 403, 404, 432, 432, 439, 440,
+ 441, 442, 444, 447, 455, 456, 457
};
#endif
@@ -637,7 +640,7 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 2, 1, 0, 1, 1, 1,
1, 1, 4, 4, 4, 1, 1, 1, 1, 8,
- 11, 12, 8, 11, 12, 6, 10, 10, 0, 3,
+ 11, 12, 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, 4, 1, 1, 3, 3, 3, 3,
@@ -674,8 +677,8 @@ static const yytype_uint8 yydefact[] =
97, 19, 46, 45, 22, 45, 45, 35, 31, 0,
0, 32, 28, 0, 45, 0, 0, 30, 0, 0,
45, 44, 45, 44, 0, 0, 0, 0, 44, 26,
- 0, 27, 0, 0, 20, 23, 0, 45, 29, 45,
- 21, 24, 36, 34
+ 0, 27, 0, 0, 20, 23, 24, 45, 29, 45,
+ 21, 36, 34
};
/* YYDEFGOTO[NTERM-NUM]. */
@@ -689,41 +692,41 @@ static const yytype_int16 yydefgoto[] =
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -161
+#define YYPACT_NINF -145
static const yytype_int16 yypact[] =
{
- 175, -49, -161, -161, -15, 469, -161, -161, 32, 118,
- -161, 52, 40, 82, 342, 24, 83, 342, 342, 342,
- 342, 9, -161, 11, -161, -161, -161, 37, 47, 349,
- 450, -161, -161, -161, -161, -161, 342, 342, 342, -161,
- 43, -161, 99, -161, 101, -161, 87, -161, 36, 29,
- -161, -161, -161, -161, 57, 342, -161, 364, 107, -161,
- -10, -16, -16, -16, 407, -161, -161, 227, 349, 342,
- 349, 85, 431, 342, 342, 342, 342, 342, 342, 342,
- 342, 342, 342, 342, 342, 342, 342, 342, 450, 41,
- 42, 58, 110, -161, -161, 111, -161, 112, 115, 100,
- -161, -161, 364, 121, -161, 342, 342, -161, -161, 69,
- 450, 78, 383, 81, 342, 450, 450, 450, 450, 450,
- 450, 450, 450, 493, 493, -16, -16, 450, 450, 450,
- -161, 342, -161, -161, -161, -161, -161, 129, -161, 450,
- 450, -161, 1, -161, -161, 314, 450, 450, -161, 33,
- 256, 105, 342, 256, -161, -161, 132, 89, -161, -161,
- 128, 342, 450, -1, -3, -161, 140, -161, 123, 450,
- -161, 135, -161, 142, -161, -161, 142, -161, 349, -161,
- 256, -161, -161, 256, -161, 256, 142, 142, -161, 349,
- 314, -161, 120, 126, 256, 145, 146, -161, 81, 130,
- -161, -161, -161, -161, 149, 137, 151, 154, -5, -161,
- 314, -161, 285, 141, -161, -161, 153, 256, -161, -161,
- -161, -161, -161, -161
+ 174, -46, -145, -145, -9, 468, -145, -145, 47, 5,
+ -145, 54, 57, 82, 341, 23, 83, 341, 341, 341,
+ 341, 4, -145, 9, -145, -145, -145, 40, 50, 348,
+ 449, -145, -145, -145, -145, -145, 341, 341, 341, -145,
+ 39, -145, 94, -145, 97, -145, 84, -145, -1, 16,
+ -145, -145, -145, -145, 52, 341, -145, 363, 104, -145,
+ -10, 511, 511, 511, 406, -145, -145, 226, 348, 341,
+ 348, 86, 430, 341, 341, 341, 341, 341, 341, 341,
+ 341, 341, 341, 341, 341, 341, 341, 341, 449, -15,
+ 36, 53, 107, -145, -145, 110, -145, 111, 112, 91,
+ -145, -145, 363, 115, -145, 341, 341, -145, -145, 68,
+ 449, 69, 382, 72, 341, 449, 449, 449, 449, 449,
+ 449, 449, 449, 492, 492, 511, 511, 449, 449, 449,
+ -145, 341, -145, -145, -145, -145, -145, 121, -145, 449,
+ 449, -145, 11, -145, -145, 313, 449, 449, -145, 33,
+ 255, 99, 341, 255, -145, -145, 127, 75, -145, -145,
+ 123, 341, 449, -2, -7, -145, 130, -145, 109, 449,
+ -145, 122, -145, 131, -145, -145, 131, -145, 348, -145,
+ 255, -145, -145, 255, -145, 255, 131, 131, -145, 348,
+ 313, -145, 113, 108, 255, 129, 132, -145, 133, 120,
+ -145, -145, -145, -145, 139, 124, 126, 136, -3, -145,
+ 313, -145, 284, 128, -145, -145, -145, 255, -145, -145,
+ -145, -145, -145
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -161, -161, -19, 114, 6, -141, 0, -161, -161, -161,
- 3, -128, -9, -65, -161, -161, -161, -160, -4, -51,
- -117, 2, 7, -161, -161, -161, 138, -161, -161, -161,
- -161, -161, -20
+ -145, -145, -19, 96, 6, -138, 0, -145, -145, -145,
+ -6, -129, -25, -65, -145, -145, -145, -144, -4, -50,
+ -117, 1, 22, -145, -145, -145, 116, -145, -145, -145,
+ -145, -145, 25
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -733,122 +736,126 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -55
static const yytype_int16 yytable[] =
{
- 25, 38, 67, 109, 154, 111, 23, 31, 35, 65,
- -46, -10, 174, 189, 151, 171, 57, 90, 91, 61,
- 62, 63, 64, 73, 74, 105, 189, 153, 75, 76,
- 77, 72, 78, 79, 80, 175, 152, 172, 88, 88,
- 88, 106, 39, 36, 85, 86, 87, 96, 191, 200,
- 180, 52, -46, 183, 97, 185, 44, 102, 46, 191,
- 58, 59, 51, 98, 99, 194, 66, 25, -10, 218,
- 72, 110, 112, 23, 31, 115, 116, 117, 118, 119,
- 120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
- 66, 217, 53, 60, 144, 68, 156, 137, 69, 160,
- 130, 132, 163, 164, 131, 131, 92, 139, 140, 145,
- 93, 170, 94, 193, 95, 37, 146, 104, 182, 113,
- 133, 131, 134, 135, 199, 192, 136, 98, 141, 41,
- 157, 138, 195, 147, 196, 198, 42, 143, 66, 148,
- 161, 43, 165, 204, 168, 44, 45, 46, 47, 209,
- 179, 211, 166, 48, 162, 181, 184, 174, 201, 173,
- 203, 205, 206, 169, 208, 213, 222, 176, 223, 214,
- 216, 190, 215, 220, 221, -6, 1, 197, 0, 207,
- 72, 108, 2, 3, 4, 5, 6, 100, 0, 0,
- 0, 72, 7, 0, 8, 9, 10, 210, 0, 11,
- 12, 13, 0, 0, 0, 0, 14, 15, 16, 0,
+ 25, 38, 67, 109, 65, 111, 23, 154, 174, -10,
+ 96, 35, -46, -46, 171, 57, 41, 97, 61, 62,
+ 63, 64, 31, 42, 151, 105, 98, 153, 43, 189,
+ 72, 175, 44, 45, 46, 47, 172, 88, 88, 88,
+ 48, 106, 189, 44, 130, 46, 152, 191, 131, 36,
+ 180, 99, 200, 183, -46, 185, 102, 39, 191, 58,
+ 59, 66, 90, 91, 51, 194, -10, 25, 52, 72,
+ 110, 112, 218, 23, 115, 116, 117, 118, 119, 120,
+ 121, 122, 123, 124, 125, 126, 127, 128, 129, 31,
+ 66, 217, 53, 60, 144, 132, 156, 137, 68, 131,
+ 160, 69, 92, 163, 164, 93, 139, 140, 94, 145,
+ 37, 95, 170, 193, 104, 146, 131, 133, 98, 182,
+ 113, 134, 135, 136, 199, 138, 192, 141, 143, 66,
+ 157, 148, 147, 195, 161, 196, 198, 165, 166, 168,
+ 179, 181, 203, 184, 204, 205, 174, 215, 206, 207,
+ 209, 201, 211, 162, 208, 213, 214, 216, 176, 173,
+ 220, 197, 169, 108, 0, 100, 0, 221, 0, 222,
+ 0, 190, 0, 0, -6, 1, 0, 0, 0, 72,
+ 0, 2, 3, 4, 5, 6, 0, 0, 0, 0,
+ 72, 7, 0, 8, 9, 10, 0, 210, 11, 12,
+ 13, 0, 0, 0, 0, 14, 15, 16, 0, 0,
0, 0, 219, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 17, 0, 0, 0, 0, 18, 19, 0,
- 0, 0, -6, 20, 2, 3, 4, 5, 6, 0,
- 0, 0, 0, 0, 7, 0, 8, 9, 10, 0,
- 0, 11, 12, 13, 0, 0, 0, 0, 14, 15,
- 16, 0, 0, 2, 3, 4, 54, 6, 0, 0,
- 0, 0, 0, 7, 17, 8, 9, 10, 0, 18,
- 19, 12, 13, 0, 0, 20, 0, 14, 15, 16,
+ 0, 17, 0, 0, 0, 0, 18, 19, 0, 0,
+ 0, -6, 20, 2, 3, 4, 5, 6, 0, 0,
+ 0, 0, 0, 7, 0, 8, 9, 10, 0, 0,
+ 11, 12, 13, 0, 0, 0, 0, 14, 15, 16,
0, 0, 2, 3, 4, 54, 6, 0, 0, 0,
0, 0, 7, 17, 8, 9, 10, 0, 18, 19,
- 12, 13, 0, 66, 20, 0, 14, 15, 16, 0,
+ 12, 13, 0, 0, 20, 0, 14, 15, 16, 0,
0, 2, 3, 4, 54, 6, 0, 0, 0, 0,
- 0, 7, 17, 8, 9, 0, 0, 18, 19, 12,
- 13, 0, 0, 20, 0, 14, 0, 16, 0, 2,
- 3, 4, 54, 6, 0, 0, 2, 3, 4, 54,
- 6, 17, 0, 0, 0, 0, 18, 19, 0, 0,
- 0, 0, 20, 55, 0, 16, 0, 0, 0, 0,
- 55, 0, 16, 0, 0, 0, 103, 0, 0, 17,
- 0, 0, 0, 0, 18, 19, 17, 0, 0, 0,
- 20, 18, 19, 73, 74, 0, 0, 70, 75, 76,
- 77, 0, 78, 79, 80, 0, 81, 82, 83, 84,
- 0, 0, 73, 74, 85, 86, 87, 75, 76, 77,
- 0, 78, 79, 80, 114, 81, 82, 83, 84, 0,
- 0, 0, 107, 85, 86, 87, 73, 74, 0, 0,
- 0, 75, 76, 77, 0, 78, 79, 80, 0, 81,
- 82, 83, 84, 0, 0, 0, 107, 85, 86, 87,
- 73, 74, 0, 0, 0, 75, 76, 77, 0, 78,
- 79, 80, 114, 81, 82, 83, 84, 0, 0, 73,
- 74, 85, 86, 87, 75, 76, 77, 0, 78, 79,
- 80, 0, 81, 82, 83, 84, 0, 0, -54, -54,
- 85, 86, 87, -54, -54, -54, 0, -54, -54, -54,
- 0, 0, 0, -54, -54, 0, 0, 37, 0, -54,
- -54, -54, 73, 74, 0, 0, 0, 75, 76, 77,
- 0, 78, 79, 80, 0, 0, 0, 83, 84, 0,
- 0, 0, 0, 85, 86, 87
+ 0, 7, 17, 8, 9, 10, 0, 18, 19, 12,
+ 13, 0, 66, 20, 0, 14, 15, 16, 0, 0,
+ 2, 3, 4, 54, 6, 0, 0, 0, 0, 0,
+ 7, 17, 8, 9, 0, 0, 18, 19, 12, 13,
+ 0, 0, 20, 0, 14, 0, 16, 0, 2, 3,
+ 4, 54, 6, 0, 0, 2, 3, 4, 54, 6,
+ 17, 0, 0, 0, 0, 18, 19, 0, 0, 0,
+ 0, 20, 55, 0, 16, 0, 0, 0, 0, 55,
+ 0, 16, 0, 0, 0, 103, 0, 0, 17, 0,
+ 0, 0, 0, 18, 19, 17, 0, 0, 0, 20,
+ 18, 19, 73, 74, 0, 0, 70, 75, 76, 77,
+ 0, 78, 79, 80, 0, 81, 82, 83, 84, 0,
+ 0, 73, 74, 85, 86, 87, 75, 76, 77, 0,
+ 78, 79, 80, 114, 81, 82, 83, 84, 0, 0,
+ 0, 107, 85, 86, 87, 73, 74, 0, 0, 0,
+ 75, 76, 77, 0, 78, 79, 80, 0, 81, 82,
+ 83, 84, 0, 0, 0, 107, 85, 86, 87, 73,
+ 74, 0, 0, 0, 75, 76, 77, 0, 78, 79,
+ 80, 114, 81, 82, 83, 84, 0, 0, 73, 74,
+ 85, 86, 87, 75, 76, 77, 0, 78, 79, 80,
+ 0, 81, 82, 83, 84, 0, 0, -54, -54, 85,
+ 86, 87, -54, -54, -54, 0, -54, -54, -54, 0,
+ 0, 0, -54, -54, 0, 0, 37, 0, -54, -54,
+ -54, 73, 74, 0, 0, 0, 75, 76, 77, 0,
+ 78, 79, 80, 0, 0, 0, 83, 84, 0, 0,
+ 73, 74, 85, 86, 87, 75, 76, 77, 0, 78,
+ 79, 80, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 85, 86, 87
};
static const yytype_int16 yycheck[] =
{
- 0, 5, 21, 68, 145, 70, 0, 0, 57, 0,
- 15, 0, 15, 173, 13, 16, 14, 37, 38, 17,
- 18, 19, 20, 39, 40, 35, 186, 144, 44, 45,
- 46, 29, 48, 49, 50, 38, 35, 38, 36, 37,
- 38, 51, 10, 58, 60, 61, 62, 11, 176, 190,
- 167, 11, 57, 170, 18, 172, 27, 55, 29, 187,
- 36, 37, 10, 27, 35, 182, 57, 67, 57, 210,
- 68, 69, 70, 67, 67, 73, 74, 75, 76, 77,
- 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
- 57, 208, 10, 10, 113, 58, 63, 101, 51, 150,
- 59, 59, 153, 154, 63, 63, 63, 105, 106, 113,
- 11, 162, 11, 178, 27, 58, 114, 10, 169, 34,
- 10, 63, 11, 11, 189, 176, 11, 27, 59, 11,
- 149, 10, 183, 131, 185, 186, 18, 59, 57, 10,
- 35, 23, 10, 194, 16, 27, 28, 29, 30, 200,
- 10, 202, 63, 35, 152, 32, 21, 15, 38, 163,
- 34, 16, 16, 161, 34, 16, 217, 164, 219, 32,
- 16, 175, 21, 32, 21, 0, 1, 186, -1, 198,
- 178, 67, 7, 8, 9, 10, 11, 49, -1, -1,
- -1, 189, 17, -1, 19, 20, 21, 201, -1, 24,
- 25, 26, -1, -1, -1, -1, 31, 32, 33, -1,
+ 0, 5, 21, 68, 0, 70, 0, 145, 15, 0,
+ 11, 57, 15, 16, 16, 14, 11, 18, 17, 18,
+ 19, 20, 0, 18, 13, 35, 27, 144, 23, 173,
+ 29, 38, 27, 28, 29, 30, 38, 36, 37, 38,
+ 35, 51, 186, 27, 59, 29, 35, 176, 63, 58,
+ 167, 35, 190, 170, 57, 172, 55, 10, 187, 36,
+ 37, 57, 37, 38, 10, 182, 57, 67, 11, 68,
+ 69, 70, 210, 67, 73, 74, 75, 76, 77, 78,
+ 79, 80, 81, 82, 83, 84, 85, 86, 87, 67,
+ 57, 208, 10, 10, 113, 59, 63, 101, 58, 63,
+ 150, 51, 63, 153, 154, 11, 105, 106, 11, 113,
+ 58, 27, 162, 178, 10, 114, 63, 10, 27, 169,
+ 34, 11, 11, 11, 189, 10, 176, 59, 59, 57,
+ 149, 10, 131, 183, 35, 185, 186, 10, 63, 16,
+ 10, 32, 34, 21, 194, 16, 15, 21, 16, 16,
+ 200, 38, 202, 152, 34, 16, 32, 21, 164, 163,
+ 32, 186, 161, 67, -1, 49, -1, 217, -1, 219,
+ -1, 175, -1, -1, 0, 1, -1, -1, -1, 178,
+ -1, 7, 8, 9, 10, 11, -1, -1, -1, -1,
+ 189, 17, -1, 19, 20, 21, -1, 201, 24, 25,
+ 26, -1, -1, -1, -1, 31, 32, 33, -1, -1,
-1, -1, 212, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 47, -1, -1, -1, -1, 52, 53, -1,
- -1, -1, 57, 58, 7, 8, 9, 10, 11, -1,
- -1, -1, -1, -1, 17, -1, 19, 20, 21, -1,
- -1, 24, 25, 26, -1, -1, -1, -1, 31, 32,
- 33, -1, -1, 7, 8, 9, 10, 11, -1, -1,
- -1, -1, -1, 17, 47, 19, 20, 21, -1, 52,
- 53, 25, 26, -1, -1, 58, -1, 31, 32, 33,
+ -1, 47, -1, -1, -1, -1, 52, 53, -1, -1,
+ -1, 57, 58, 7, 8, 9, 10, 11, -1, -1,
+ -1, -1, -1, 17, -1, 19, 20, 21, -1, -1,
+ 24, 25, 26, -1, -1, -1, -1, 31, 32, 33,
-1, -1, 7, 8, 9, 10, 11, -1, -1, -1,
-1, -1, 17, 47, 19, 20, 21, -1, 52, 53,
- 25, 26, -1, 57, 58, -1, 31, 32, 33, -1,
+ 25, 26, -1, -1, 58, -1, 31, 32, 33, -1,
-1, 7, 8, 9, 10, 11, -1, -1, -1, -1,
- -1, 17, 47, 19, 20, -1, -1, 52, 53, 25,
- 26, -1, -1, 58, -1, 31, -1, 33, -1, 7,
- 8, 9, 10, 11, -1, -1, 7, 8, 9, 10,
- 11, 47, -1, -1, -1, -1, 52, 53, -1, -1,
- -1, -1, 58, 31, -1, 33, -1, -1, -1, -1,
- 31, -1, 33, -1, -1, -1, 22, -1, -1, 47,
- -1, -1, -1, -1, 52, 53, 47, -1, -1, -1,
- 58, 52, 53, 39, 40, -1, -1, 58, 44, 45,
- 46, -1, 48, 49, 50, -1, 52, 53, 54, 55,
- -1, -1, 39, 40, 60, 61, 62, 44, 45, 46,
- -1, 48, 49, 50, 51, 52, 53, 54, 55, -1,
- -1, -1, 59, 60, 61, 62, 39, 40, -1, -1,
- -1, 44, 45, 46, -1, 48, 49, 50, -1, 52,
- 53, 54, 55, -1, -1, -1, 59, 60, 61, 62,
- 39, 40, -1, -1, -1, 44, 45, 46, -1, 48,
- 49, 50, 51, 52, 53, 54, 55, -1, -1, 39,
- 40, 60, 61, 62, 44, 45, 46, -1, 48, 49,
- 50, -1, 52, 53, 54, 55, -1, -1, 39, 40,
+ -1, 17, 47, 19, 20, 21, -1, 52, 53, 25,
+ 26, -1, 57, 58, -1, 31, 32, 33, -1, -1,
+ 7, 8, 9, 10, 11, -1, -1, -1, -1, -1,
+ 17, 47, 19, 20, -1, -1, 52, 53, 25, 26,
+ -1, -1, 58, -1, 31, -1, 33, -1, 7, 8,
+ 9, 10, 11, -1, -1, 7, 8, 9, 10, 11,
+ 47, -1, -1, -1, -1, 52, 53, -1, -1, -1,
+ -1, 58, 31, -1, 33, -1, -1, -1, -1, 31,
+ -1, 33, -1, -1, -1, 22, -1, -1, 47, -1,
+ -1, -1, -1, 52, 53, 47, -1, -1, -1, 58,
+ 52, 53, 39, 40, -1, -1, 58, 44, 45, 46,
+ -1, 48, 49, 50, -1, 52, 53, 54, 55, -1,
+ -1, 39, 40, 60, 61, 62, 44, 45, 46, -1,
+ 48, 49, 50, 51, 52, 53, 54, 55, -1, -1,
+ -1, 59, 60, 61, 62, 39, 40, -1, -1, -1,
+ 44, 45, 46, -1, 48, 49, 50, -1, 52, 53,
+ 54, 55, -1, -1, -1, 59, 60, 61, 62, 39,
+ 40, -1, -1, -1, 44, 45, 46, -1, 48, 49,
+ 50, 51, 52, 53, 54, 55, -1, -1, 39, 40,
60, 61, 62, 44, 45, 46, -1, 48, 49, 50,
- -1, -1, -1, 54, 55, -1, -1, 58, -1, 60,
- 61, 62, 39, 40, -1, -1, -1, 44, 45, 46,
- -1, 48, 49, 50, -1, -1, -1, 54, 55, -1,
- -1, -1, -1, 60, 61, 62
+ -1, 52, 53, 54, 55, -1, -1, 39, 40, 60,
+ 61, 62, 44, 45, 46, -1, 48, 49, 50, -1,
+ -1, -1, 54, 55, -1, -1, 58, -1, 60, 61,
+ 62, 39, 40, -1, -1, -1, 44, 45, 46, -1,
+ 48, 49, 50, -1, -1, -1, 54, 55, -1, -1,
+ 39, 40, 60, 61, 62, 44, 45, 46, -1, 48,
+ 49, 50, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 60, 61, 62
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -875,9 +882,9 @@ static const yytype_uint8 yystos[] =
83, 16, 38, 82, 15, 38, 74, 75, 81, 10,
84, 32, 83, 84, 21, 84, 73, 74, 76, 81,
82, 75, 83, 77, 84, 83, 83, 76, 83, 77,
- 69, 38, 72, 34, 83, 16, 16, 66, 34, 83,
- 82, 83, 82, 16, 32, 21, 16, 84, 69, 70,
- 32, 21, 83, 83
+ 69, 38, 72, 34, 83, 16, 16, 16, 34, 83,
+ 82, 83, 82, 16, 32, 21, 21, 84, 69, 70,
+ 32, 83, 83
};
#define yyerrok (yyerrstatus = 0)
@@ -1692,12 +1699,12 @@ yyreduce:
switch (yyn)
{
case 4:
-#line 97 "engines/director/lingo/lingo-gr.y"
+#line 100 "engines/director/lingo/lingo-gr.y"
{ yyerrok; ;}
break;
case 5:
-#line 100 "engines/director/lingo/lingo-gr.y"
+#line 103 "engines/director/lingo/lingo-gr.y"
{
g_lingo->_linenumber++;
g_lingo->_colnumber = 1;
@@ -1705,12 +1712,12 @@ yyreduce:
break;
case 10:
-#line 109 "engines/director/lingo/lingo-gr.y"
+#line 112 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 12:
-#line 113 "engines/director/lingo/lingo-gr.y"
+#line 116 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str());
@@ -1720,7 +1727,7 @@ yyreduce:
break;
case 13:
-#line 119 "engines/director/lingo/lingo-gr.y"
+#line 122 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1730,7 +1737,7 @@ yyreduce:
break;
case 14:
-#line 125 "engines/director/lingo/lingo-gr.y"
+#line 128 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1740,12 +1747,12 @@ yyreduce:
break;
case 15:
-#line 132 "engines/director/lingo/lingo-gr.y"
+#line 135 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 19:
-#line 141 "engines/director/lingo/lingo-gr.y"
+#line 144 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1755,7 +1762,7 @@ yyreduce:
break;
case 20:
-#line 152 "engines/director/lingo/lingo-gr.y"
+#line 155 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1771,7 +1778,7 @@ yyreduce:
break;
case 21:
-#line 168 "engines/director/lingo/lingo-gr.y"
+#line 171 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1787,7 +1794,7 @@ yyreduce:
break;
case 22:
-#line 182 "engines/director/lingo/lingo-gr.y"
+#line 185 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (8)].code));
@@ -1798,7 +1805,7 @@ yyreduce:
break;
case 23:
-#line 189 "engines/director/lingo/lingo-gr.y"
+#line 192 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1811,20 +1818,20 @@ yyreduce:
break;
case 24:
-#line 198 "engines/director/lingo/lingo-gr.y"
+#line 201 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
- WRITE_UINT32(&then, (yyvsp[(5) - (12)].code));
- WRITE_UINT32(&else1, (yyvsp[(7) - (12)].code));
- WRITE_UINT32(&end, (yyvsp[(9) - (12)].code));
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 1] = then; /* thenpart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 2] = else1; /* elsepart */
- (*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 3] = end; /* end, if cond fails */
- g_lingo->processIf(0, (yyvsp[(9) - (12)].code)); ;}
+ WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
+ WRITE_UINT32(&else1, (yyvsp[(7) - (11)].code));
+ WRITE_UINT32(&end, (yyvsp[(9) - (11)].code));
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 1] = then; /* thenpart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 2] = else1; /* elsepart */
+ (*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 3] = end; /* end, if cond fails */
+ g_lingo->processIf(0, (yyvsp[(9) - (11)].code)); ;}
break;
case 25:
-#line 207 "engines/director/lingo/lingo-gr.y"
+#line 210 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1838,7 +1845,7 @@ yyreduce:
break;
case 26:
-#line 217 "engines/director/lingo/lingo-gr.y"
+#line 220 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1852,7 +1859,7 @@ yyreduce:
break;
case 27:
-#line 227 "engines/director/lingo/lingo-gr.y"
+#line 230 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1866,17 +1873,17 @@ yyreduce:
break;
case 28:
-#line 238 "engines/director/lingo/lingo-gr.y"
+#line 241 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = 0; ;}
break;
case 29:
-#line 239 "engines/director/lingo/lingo-gr.y"
+#line 242 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 34:
-#line 250 "engines/director/lingo/lingo-gr.y"
+#line 253 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1886,7 +1893,7 @@ yyreduce:
break;
case 36:
-#line 259 "engines/director/lingo/lingo-gr.y"
+#line 262 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
@@ -1896,22 +1903,22 @@ yyreduce:
break;
case 37:
-#line 267 "engines/director/lingo/lingo-gr.y"
+#line 270 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
case 38:
-#line 268 "engines/director/lingo/lingo-gr.y"
+#line 271 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
case 40:
-#line 271 "engines/director/lingo/lingo-gr.y"
+#line 274 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
case 41:
-#line 273 "engines/director/lingo/lingo-gr.y"
+#line 276 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1920,7 +1927,7 @@ yyreduce:
break;
case 42:
-#line 279 "engines/director/lingo/lingo-gr.y"
+#line 282 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -1929,7 +1936,7 @@ yyreduce:
break;
case 43:
-#line 285 "engines/director/lingo/lingo-gr.y"
+#line 288 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -1939,22 +1946,22 @@ yyreduce:
break;
case 44:
-#line 292 "engines/director/lingo/lingo-gr.y"
+#line 295 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 45:
-#line 294 "engines/director/lingo/lingo-gr.y"
+#line 297 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 46:
-#line 296 "engines/director/lingo/lingo-gr.y"
+#line 299 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 49:
-#line 301 "engines/director/lingo/lingo-gr.y"
+#line 304 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1963,21 +1970,21 @@ yyreduce:
break;
case 50:
-#line 306 "engines/director/lingo/lingo-gr.y"
+#line 309 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
case 51:
-#line 309 "engines/director/lingo/lingo-gr.y"
+#line 312 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_stringpush);
g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;}
break;
case 52:
-#line 312 "engines/director/lingo/lingo-gr.y"
+#line 315 "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));
@@ -1987,7 +1994,7 @@ yyreduce:
break;
case 53:
-#line 318 "engines/director/lingo/lingo-gr.y"
+#line 321 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -1999,155 +2006,155 @@ yyreduce:
break;
case 54:
-#line 326 "engines/director/lingo/lingo-gr.y"
+#line 329 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
case 56:
-#line 330 "engines/director/lingo/lingo-gr.y"
+#line 333 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
case 57:
-#line 331 "engines/director/lingo/lingo-gr.y"
+#line 334 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
case 58:
-#line 332 "engines/director/lingo/lingo-gr.y"
+#line 335 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
case 59:
-#line 333 "engines/director/lingo/lingo-gr.y"
+#line 336 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
case 60:
-#line 334 "engines/director/lingo/lingo-gr.y"
+#line 337 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
case 61:
-#line 335 "engines/director/lingo/lingo-gr.y"
+#line 338 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
case 62:
-#line 336 "engines/director/lingo/lingo-gr.y"
+#line 339 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
case 63:
-#line 337 "engines/director/lingo/lingo-gr.y"
+#line 340 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
case 64:
-#line 338 "engines/director/lingo/lingo-gr.y"
+#line 341 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
case 65:
-#line 339 "engines/director/lingo/lingo-gr.y"
+#line 342 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_and); ;}
break;
case 66:
-#line 340 "engines/director/lingo/lingo-gr.y"
+#line 343 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_or); ;}
break;
case 67:
-#line 341 "engines/director/lingo/lingo-gr.y"
+#line 344 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_not); ;}
break;
case 68:
-#line 342 "engines/director/lingo/lingo-gr.y"
+#line 345 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ampersand); ;}
break;
case 69:
-#line 343 "engines/director/lingo/lingo-gr.y"
+#line 346 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_concat); ;}
break;
case 70:
-#line 344 "engines/director/lingo/lingo-gr.y"
+#line 347 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_contains); ;}
break;
case 71:
-#line 345 "engines/director/lingo/lingo-gr.y"
+#line 348 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_starts); ;}
break;
case 72:
-#line 346 "engines/director/lingo/lingo-gr.y"
+#line 349 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 73:
-#line 347 "engines/director/lingo/lingo-gr.y"
+#line 350 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 74:
-#line 348 "engines/director/lingo/lingo-gr.y"
+#line 351 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 75:
-#line 351 "engines/director/lingo/lingo-gr.y"
+#line 354 "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 76:
-#line 352 "engines/director/lingo/lingo-gr.y"
+#line 355 "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 77:
-#line 353 "engines/director/lingo/lingo-gr.y"
+#line 356 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 79:
-#line 355 "engines/director/lingo/lingo-gr.y"
+#line 358 "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 81:
-#line 360 "engines/director/lingo/lingo-gr.y"
+#line 363 "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 82:
-#line 361 "engines/director/lingo/lingo-gr.y"
+#line 364 "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 83:
-#line 372 "engines/director/lingo/lingo-gr.y"
+#line 375 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 84:
-#line 373 "engines/director/lingo/lingo-gr.y"
+#line 376 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 85:
-#line 374 "engines/director/lingo/lingo-gr.y"
+#line 377 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 86:
-#line 375 "engines/director/lingo/lingo-gr.y"
+#line 378 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2156,7 +2163,7 @@ yyreduce:
break;
case 87:
-#line 380 "engines/director/lingo/lingo-gr.y"
+#line 383 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2166,7 +2173,7 @@ yyreduce:
break;
case 88:
-#line 386 "engines/director/lingo/lingo-gr.y"
+#line 389 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2175,47 +2182,47 @@ yyreduce:
break;
case 89:
-#line 393 "engines/director/lingo/lingo-gr.y"
+#line 396 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 90:
-#line 394 "engines/director/lingo/lingo-gr.y"
+#line 397 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 91:
-#line 395 "engines/director/lingo/lingo-gr.y"
+#line 398 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 92:
-#line 396 "engines/director/lingo/lingo-gr.y"
+#line 399 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 93:
-#line 399 "engines/director/lingo/lingo-gr.y"
+#line 402 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 94:
-#line 400 "engines/director/lingo/lingo-gr.y"
+#line 403 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 95:
-#line 401 "engines/director/lingo/lingo-gr.y"
+#line 404 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 96:
-#line 429 "engines/director/lingo/lingo-gr.y"
+#line 432 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 97:
-#line 430 "engines/director/lingo/lingo-gr.y"
+#line 433 "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);
@@ -2224,32 +2231,32 @@ yyreduce:
break;
case 98:
-#line 436 "engines/director/lingo/lingo-gr.y"
+#line 439 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 99:
-#line 437 "engines/director/lingo/lingo-gr.y"
+#line 440 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 100:
-#line 438 "engines/director/lingo/lingo-gr.y"
+#line 441 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 101:
-#line 439 "engines/director/lingo/lingo-gr.y"
+#line 442 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 102:
-#line 441 "engines/director/lingo/lingo-gr.y"
+#line 444 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
case 103:
-#line 444 "engines/director/lingo/lingo-gr.y"
+#line 447 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2259,23 +2266,23 @@ yyreduce:
break;
case 104:
-#line 452 "engines/director/lingo/lingo-gr.y"
+#line 455 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 105:
-#line 453 "engines/director/lingo/lingo-gr.y"
+#line 456 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
case 106:
-#line 454 "engines/director/lingo/lingo-gr.y"
+#line 457 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2279 "engines/director/lingo/lingo-gr.cpp"
+#line 2286 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2489,6 +2496,6 @@ yyreturn:
}
-#line 457 "engines/director/lingo/lingo-gr.y"
+#line 460 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 18a462a..1ee7394 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -144,7 +144,7 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 66 "engines/director/lingo/lingo-gr.y"
+#line 69 "engines/director/lingo/lingo-gr.y"
{
Common::String *s;
int i;
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index f1b5a49..adb2075 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -58,7 +58,10 @@ extern int yylex();
extern int yyparse();
using namespace Director;
-void yyerror(char *s) { g_lingo->_hadError = true; warning("%s at line %d col %d", s, Director::g_lingo->_linenumber, Director::g_lingo->_colnumber); }
+void yyerror(char *s) {
+ g_lingo->_hadError = true;
+ warning("%s at line %d col %d", s, g_lingo->_linenumber, g_lingo->_colnumber);
+}
%}
@@ -195,7 +198,7 @@ ifstmt: if cond tTHEN nl stmtlist end tEND tIF {
(*g_lingo->_currentScript)[$1 + 2] = else1; /* elsepart */
(*g_lingo->_currentScript)[$1 + 3] = end; /* end, if cond fails */
g_lingo->processIf(0, 0); }
- | if cond tTHEN nl stmtlist end begin elseifstmt end nl tEND tIF {
+ | if cond tTHEN nl stmtlist end begin elseifstmt end tEND tIF {
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, $5);
WRITE_UINT32(&else1, $7);
diff --git a/engines/director/lingo/tests/if.lingo b/engines/director/lingo/tests/if.lingo
index c9bdaca..8f1e239 100644
--- a/engines/director/lingo/tests/if.lingo
+++ b/engines/director/lingo/tests/if.lingo
@@ -3,7 +3,7 @@ set x = 1
if x = 5 then exit
else put 10.0
-repeat with x = 1 to 5
+repeat with x = 1 to 6
if x = 3 then put 30
else if x = 4 then put 40
else if x = 5 then put 50
@@ -13,8 +13,15 @@ repeat with x = 1 to 5
else if x = 2 then
put 1232.12345678901234
put 2.2
- else if x = 3 then put 3
+ else if x = 3 then
+ put 3
+ else if x = 4 then
+ put 4
+ else if x = 5 then
+ put 5
+ else if x = 6 then
+ put 6
end if
- if x = 4 then put 4
- else put 5
+ if x = 4 then put 40
+ else put 50
end repeat
Commit: 3a4fbc936793d6e70f9a2eb2e1f8100895dc8dfa
https://github.com/scummvm/scummvm/commit/3a4fbc936793d6e70f9a2eb2e1f8100895dc8dfa
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Initial code for 'the' entity handling
Changed paths:
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo-the.cpp
engines/director/lingo/lingo-the.h
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index f3d80d6..668e783 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 b7dfecb..6b14bfc 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 410be8e..b631732 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 c3ee20f..c867b8d 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 9e8e6f1..5dc6c07 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -123,6 +123,9 @@ typedef Common::Array<Datum> StackData;
typedef Common::HashMap<Common::String, Symbol *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> SymbolHash;
typedef Common::HashMap<Common::String, Builtin *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> BuiltinHash;
+typedef Common::HashMap<Common::String, TheEntity *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> TheEntityHash;
+typedef Common::HashMap<Common::String, TheEntityField *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> 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<CFrame *> _callstack;
Common::Array<Common::String *> _argstack;
BuiltinHash _builtins;
+ TheEntityHash _theEntities;
+ TheEntityFieldHash _theEntityFields;
Common::Array<int> _labelstack;
int _linenumber;
Commit: 8136267ada2c346510baa1258cd12dd436974365
https://github.com/scummvm/scummvm/commit/8136267ada2c346510baa1258cd12dd436974365
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Use namespace in lexer
Changed paths:
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 668e783..58d052e 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -625,9 +625,11 @@ char *yytext;
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-gr.h"
+using namespace Director;
+
int yyparse();
static void count() {
- Director::g_lingo->_colnumber += strlen(yytext);
+ g_lingo->_colnumber += strlen(yytext);
}
static void countnl() {
@@ -636,11 +638,11 @@ static void countnl() {
while(*p == '\n' || *p == '\r')
p++;
- Director::g_lingo->_linenumber++;
- Director::g_lingo->_colnumber = strlen(p);
+ g_lingo->_linenumber++;
+ g_lingo->_colnumber = strlen(p);
}
-#line 644 "engines/director/lingo/lingo-lex.cpp"
+#line 646 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -825,10 +827,10 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 58 "engines/director/lingo/lingo-lex.l"
+#line 60 "engines/director/lingo/lingo-lex.l"
-#line 832 "engines/director/lingo/lingo-lex.cpp"
+#line 834 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -914,159 +916,159 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 60 "engines/director/lingo/lingo-lex.l"
+#line 62 "engines/director/lingo/lingo-lex.l"
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 61 "engines/director/lingo/lingo-lex.l"
+#line 63 "engines/director/lingo/lingo-lex.l"
{ count(); }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 62 "engines/director/lingo/lingo-lex.l"
+#line 64 "engines/director/lingo/lingo-lex.l"
{ count(); return ' '; }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 64 "engines/director/lingo/lingo-lex.l"
+#line 66 "engines/director/lingo/lingo-lex.l"
{ count(); return tAND; }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 65 "engines/director/lingo/lingo-lex.l"
+#line 67 "engines/director/lingo/lingo-lex.l"
{ count(); return tCONTAINS; }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 66 "engines/director/lingo/lingo-lex.l"
+#line 68 "engines/director/lingo/lingo-lex.l"
{ count(); return tDOWN; }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 67 "engines/director/lingo/lingo-lex.l"
+#line 69 "engines/director/lingo/lingo-lex.l"
{ count(); return tIF; }
YY_BREAK
case 8:
/* rule 8 can match eol */
YY_RULE_SETUP
-#line 68 "engines/director/lingo/lingo-lex.l"
+#line 70 "engines/director/lingo/lingo-lex.l"
{ countnl(); return tNLELSIF; }
YY_BREAK
case 9:
/* rule 9 can match eol */
YY_RULE_SETUP
-#line 69 "engines/director/lingo/lingo-lex.l"
+#line 71 "engines/director/lingo/lingo-lex.l"
{ countnl(); return tNLELSE; }
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 70 "engines/director/lingo/lingo-lex.l"
+#line 72 "engines/director/lingo/lingo-lex.l"
{ count(); return tELSE; }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 71 "engines/director/lingo/lingo-lex.l"
+#line 73 "engines/director/lingo/lingo-lex.l"
{ count(); return tEND; }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 72 "engines/director/lingo/lingo-lex.l"
+#line 74 "engines/director/lingo/lingo-lex.l"
{ count(); return tEXIT; }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 73 "engines/director/lingo/lingo-lex.l"
+#line 75 "engines/director/lingo/lingo-lex.l"
{ count(); return tFRAME; }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 74 "engines/director/lingo/lingo-lex.l"
+#line 76 "engines/director/lingo/lingo-lex.l"
{ count(); return tGLOBAL; }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 75 "engines/director/lingo/lingo-lex.l"
+#line 77 "engines/director/lingo/lingo-lex.l"
{ count(); return tGO; }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 76 "engines/director/lingo/lingo-lex.l"
+#line 78 "engines/director/lingo/lingo-lex.l"
{ count(); return tINTO; }
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 77 "engines/director/lingo/lingo-lex.l"
+#line 79 "engines/director/lingo/lingo-lex.l"
{ count(); return tLOOP; }
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 78 "engines/director/lingo/lingo-lex.l"
+#line 80 "engines/director/lingo/lingo-lex.l"
{ count(); return tMACRO; }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 79 "engines/director/lingo/lingo-lex.l"
+#line 81 "engines/director/lingo/lingo-lex.l"
{ count(); return tMCI; }
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 80 "engines/director/lingo/lingo-lex.l"
+#line 82 "engines/director/lingo/lingo-lex.l"
{ count(); return tMCIWAIT; }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 81 "engines/director/lingo/lingo-lex.l"
+#line 83 "engines/director/lingo/lingo-lex.l"
{ count(); return tMOVIE; }
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 82 "engines/director/lingo/lingo-lex.l"
+#line 84 "engines/director/lingo/lingo-lex.l"
{ count(); return tNEXT; }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 83 "engines/director/lingo/lingo-lex.l"
+#line 85 "engines/director/lingo/lingo-lex.l"
{ count(); return tNOT; }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 84 "engines/director/lingo/lingo-lex.l"
+#line 86 "engines/director/lingo/lingo-lex.l"
{ count(); return tOF; }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 85 "engines/director/lingo/lingo-lex.l"
+#line 87 "engines/director/lingo/lingo-lex.l"
{ count(); return tOR; }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 86 "engines/director/lingo/lingo-lex.l"
+#line 88 "engines/director/lingo/lingo-lex.l"
{ count(); return tPREVIOUS; }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 87 "engines/director/lingo/lingo-lex.l"
+#line 89 "engines/director/lingo/lingo-lex.l"
{ count(); return tPUT; }
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 88 "engines/director/lingo/lingo-lex.l"
+#line 90 "engines/director/lingo/lingo-lex.l"
{ count(); return tREPEAT; }
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 89 "engines/director/lingo/lingo-lex.l"
+#line 91 "engines/director/lingo/lingo-lex.l"
{ count(); return tSET; }
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 90 "engines/director/lingo/lingo-lex.l"
+#line 92 "engines/director/lingo/lingo-lex.l"
{ count(); return tSTARTS; }
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 91 "engines/director/lingo/lingo-lex.l"
+#line 93 "engines/director/lingo/lingo-lex.l"
{
count();
@@ -1079,52 +1081,52 @@ YY_RULE_SETUP
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 100 "engines/director/lingo/lingo-lex.l"
+#line 102 "engines/director/lingo/lingo-lex.l"
{ count(); return tTHEN; }
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 101 "engines/director/lingo/lingo-lex.l"
+#line 103 "engines/director/lingo/lingo-lex.l"
{ count(); return tTO; }
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 102 "engines/director/lingo/lingo-lex.l"
+#line 104 "engines/director/lingo/lingo-lex.l"
{ count(); return tWITH; }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 103 "engines/director/lingo/lingo-lex.l"
+#line 105 "engines/director/lingo/lingo-lex.l"
{ count(); return tWHILE; }
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 105 "engines/director/lingo/lingo-lex.l"
+#line 107 "engines/director/lingo/lingo-lex.l"
{ count(); return tNEQ; }
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 106 "engines/director/lingo/lingo-lex.l"
+#line 108 "engines/director/lingo/lingo-lex.l"
{ count(); return tGE; }
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 107 "engines/director/lingo/lingo-lex.l"
+#line 109 "engines/director/lingo/lingo-lex.l"
{ count(); return tLE; }
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 108 "engines/director/lingo/lingo-lex.l"
+#line 110 "engines/director/lingo/lingo-lex.l"
{ count(); return tCONCAT; }
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 110 "engines/director/lingo/lingo-lex.l"
+#line 112 "engines/director/lingo/lingo-lex.l"
{
count();
yylval.s = new Common::String(yytext);
- if (Director::g_lingo->_builtins.contains(yytext))
+ if (g_lingo->_builtins.contains(yytext))
return BLTIN;
return ID;
@@ -1132,41 +1134,41 @@ YY_RULE_SETUP
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 119 "engines/director/lingo/lingo-lex.l"
+#line 121 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 120 "engines/director/lingo/lingo-lex.l"
+#line 122 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 121 "engines/director/lingo/lingo-lex.l"
+#line 123 "engines/director/lingo/lingo-lex.l"
{ count(); return *yytext; }
YY_BREAK
case 44:
/* rule 44 can match eol */
YY_RULE_SETUP
-#line 122 "engines/director/lingo/lingo-lex.l"
+#line 124 "engines/director/lingo/lingo-lex.l"
{ return '\n'; }
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 123 "engines/director/lingo/lingo-lex.l"
+#line 125 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 124 "engines/director/lingo/lingo-lex.l"
+#line 126 "engines/director/lingo/lingo-lex.l"
YY_BREAK
case 47:
YY_RULE_SETUP
-#line 126 "engines/director/lingo/lingo-lex.l"
+#line 128 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1170 "engines/director/lingo/lingo-lex.cpp"
+#line 1172 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -2166,7 +2168,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 126 "engines/director/lingo/lingo-lex.l"
+#line 128 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 6b14bfc..40f66a6 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -30,9 +30,11 @@
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-gr.h"
+using namespace Director;
+
int yyparse();
static void count() {
- Director::g_lingo->_colnumber += strlen(yytext);
+ g_lingo->_colnumber += strlen(yytext);
}
static void countnl() {
@@ -41,8 +43,8 @@ static void countnl() {
while(*p == '\n' || *p == '\r')
p++;
- Director::g_lingo->_linenumber++;
- Director::g_lingo->_colnumber = strlen(p);
+ g_lingo->_linenumber++;
+ g_lingo->_colnumber = strlen(p);
}
%}
@@ -111,7 +113,7 @@ whitespace [\t ]
count();
yylval.s = new Common::String(yytext);
- if (Director::g_lingo->_builtins.contains(yytext))
+ if (g_lingo->_builtins.contains(yytext))
return BLTIN;
return ID;
Commit: e15915b6a30d56a77c99eb9b3871cc75b4034b9c
https://github.com/scummvm/scummvm/commit/e15915b6a30d56a77c99eb9b3871cc75b4034b9c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Process simple 'the' entities
Changed paths:
A engines/director/lingo/tests/the.lingo
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo-the.cpp
engines/director/lingo/lingo-the.h
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index a8881d7..16bd7db 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -218,6 +218,32 @@ void Lingo::c_eval() {
g_lingo->push(d);
}
+void Lingo::c_theentitypush() {
+ inst e = (*g_lingo->_currentScript)[g_lingo->_pc++];
+ inst f = (*g_lingo->_currentScript)[g_lingo->_pc++];
+ inst i = (*g_lingo->_currentScript)[g_lingo->_pc++];
+
+ int entity = READ_UINT32(&e);
+ int field = READ_UINT32(&f);
+ int id = READ_UINT32(&i);
+
+ Datum d = g_lingo->getTheEntity(entity, id, field);
+ g_lingo->push(d);
+}
+
+void Lingo::c_theentityassign() {
+ inst e = (*g_lingo->_currentScript)[g_lingo->_pc++];
+ inst f = (*g_lingo->_currentScript)[g_lingo->_pc++];
+ inst i = (*g_lingo->_currentScript)[g_lingo->_pc++];
+
+ int entity = READ_UINT32(&e);
+ int field = READ_UINT32(&f);
+ int id = READ_UINT32(&i);
+
+ Datum d = g_lingo->pop();
+ g_lingo->setTheEntity(entity, id, field, d);
+}
+
void Lingo::c_add() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 577afc1..75bbfa3 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -71,49 +71,52 @@
VOID = 260,
VAR = 261,
INT = 262,
- FLOAT = 263,
- BLTIN = 264,
- ID = 265,
- STRING = 266,
- HANDLER = 267,
- tDOWN = 268,
- tELSE = 269,
- tNLELSIF = 270,
- tEND = 271,
- tEXIT = 272,
- tFRAME = 273,
- tGLOBAL = 274,
- tGO = 275,
- tIF = 276,
- tINTO = 277,
- tLOOP = 278,
- tMACRO = 279,
- tMCI = 280,
- tMCIWAIT = 281,
- tMOVIE = 282,
- tNEXT = 283,
- tOF = 284,
- tPREVIOUS = 285,
- tPUT = 286,
- tREPEAT = 287,
- tSET = 288,
- tTHEN = 289,
- tTO = 290,
- tWITH = 291,
- tWHILE = 292,
- tNLELSE = 293,
- tGE = 294,
- tLE = 295,
- tGT = 296,
- tLT = 297,
- tEQ = 298,
- tNEQ = 299,
- tAND = 300,
- tOR = 301,
- tNOT = 302,
- tCONCAT = 303,
- tCONTAINS = 304,
- tSTARTS = 305
+ THEENTITY = 263,
+ THEENTITYWITHID = 264,
+ THEFIELD = 265,
+ FLOAT = 266,
+ BLTIN = 267,
+ ID = 268,
+ STRING = 269,
+ HANDLER = 270,
+ tDOWN = 271,
+ tELSE = 272,
+ tNLELSIF = 273,
+ tEND = 274,
+ tEXIT = 275,
+ tFRAME = 276,
+ tGLOBAL = 277,
+ tGO = 278,
+ tIF = 279,
+ tINTO = 280,
+ tLOOP = 281,
+ tMACRO = 282,
+ tMCI = 283,
+ tMCIWAIT = 284,
+ tMOVIE = 285,
+ tNEXT = 286,
+ tOF = 287,
+ tPREVIOUS = 288,
+ tPUT = 289,
+ tREPEAT = 290,
+ tSET = 291,
+ tTHEN = 292,
+ tTO = 293,
+ tWITH = 294,
+ tWHILE = 295,
+ tNLELSE = 296,
+ tGE = 297,
+ tLE = 298,
+ tGT = 299,
+ tLT = 300,
+ tEQ = 301,
+ tNEQ = 302,
+ tAND = 303,
+ tOR = 304,
+ tNOT = 305,
+ tCONCAT = 306,
+ tCONTAINS = 307,
+ tSTARTS = 308
};
#endif
/* Tokens. */
@@ -122,49 +125,52 @@
#define VOID 260
#define VAR 261
#define INT 262
-#define FLOAT 263
-#define BLTIN 264
-#define ID 265
-#define STRING 266
-#define HANDLER 267
-#define tDOWN 268
-#define tELSE 269
-#define tNLELSIF 270
-#define tEND 271
-#define tEXIT 272
-#define tFRAME 273
-#define tGLOBAL 274
-#define tGO 275
-#define tIF 276
-#define tINTO 277
-#define tLOOP 278
-#define tMACRO 279
-#define tMCI 280
-#define tMCIWAIT 281
-#define tMOVIE 282
-#define tNEXT 283
-#define tOF 284
-#define tPREVIOUS 285
-#define tPUT 286
-#define tREPEAT 287
-#define tSET 288
-#define tTHEN 289
-#define tTO 290
-#define tWITH 291
-#define tWHILE 292
-#define tNLELSE 293
-#define tGE 294
-#define tLE 295
-#define tGT 296
-#define tLT 297
-#define tEQ 298
-#define tNEQ 299
-#define tAND 300
-#define tOR 301
-#define tNOT 302
-#define tCONCAT 303
-#define tCONTAINS 304
-#define tSTARTS 305
+#define THEENTITY 263
+#define THEENTITYWITHID 264
+#define THEFIELD 265
+#define FLOAT 266
+#define BLTIN 267
+#define ID 268
+#define STRING 269
+#define HANDLER 270
+#define tDOWN 271
+#define tELSE 272
+#define tNLELSIF 273
+#define tEND 274
+#define tEXIT 275
+#define tFRAME 276
+#define tGLOBAL 277
+#define tGO 278
+#define tIF 279
+#define tINTO 280
+#define tLOOP 281
+#define tMACRO 282
+#define tMCI 283
+#define tMCIWAIT 284
+#define tMOVIE 285
+#define tNEXT 286
+#define tOF 287
+#define tPREVIOUS 288
+#define tPUT 289
+#define tREPEAT 290
+#define tSET 291
+#define tTHEN 292
+#define tTO 293
+#define tWITH 294
+#define tWHILE 295
+#define tNLELSE 296
+#define tGE 297
+#define tLE 298
+#define tGT 299
+#define tLT 300
+#define tEQ 301
+#define tNEQ 302
+#define tAND 303
+#define tOR 304
+#define tNOT 305
+#define tCONCAT 306
+#define tCONTAINS 307
+#define tSTARTS 308
@@ -220,7 +226,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 224 "engines/director/lingo/lingo-gr.cpp"
+#line 230 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -233,7 +239,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 237 "engines/director/lingo/lingo-gr.cpp"
+#line 243 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -446,22 +452,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 65
+#define YYFINAL 67
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 573
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 64
+#define YYNTOKENS 67
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 33
/* YYNRULES -- Number of rules. */
-#define YYNRULES 106
+#define YYNRULES 109
/* YYNRULES -- Number of states. */
-#define YYNSTATES 223
+#define YYNSTATES 229
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 305
+#define YYMAXUTOK 308
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -470,12 +476,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 57, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 60, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 56, 62, 2,
- 58, 59, 54, 52, 63, 53, 2, 55, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 59, 65, 2,
+ 61, 62, 57, 55, 66, 56, 2, 58, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 61, 51, 60, 2, 2, 2, 2, 2, 2, 2,
+ 64, 54, 63, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -499,7 +505,7 @@ static const yytype_uint8 yytranslate[] =
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50
+ 45, 46, 47, 48, 49, 50, 51, 52, 53
};
#if YYDEBUG
@@ -508,77 +514,78 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 12, 14, 15, 17, 19,
- 21, 23, 25, 30, 35, 40, 42, 44, 46, 48,
- 57, 69, 82, 91, 103, 115, 122, 133, 144, 145,
- 149, 152, 154, 157, 159, 166, 168, 174, 176, 180,
- 184, 187, 191, 193, 195, 196, 197, 198, 201, 204,
- 206, 208, 210, 215, 220, 222, 224, 228, 232, 236,
- 240, 244, 248, 252, 256, 260, 264, 268, 271, 275,
- 279, 283, 287, 290, 293, 297, 300, 303, 306, 308,
- 310, 313, 315, 319, 322, 325, 328, 331, 335, 338,
- 342, 345, 348, 350, 354, 357, 361, 362, 371, 372,
- 374, 378, 383, 384, 388, 389, 391
+ 21, 23, 25, 30, 35, 40, 45, 50, 52, 54,
+ 56, 58, 67, 79, 92, 101, 113, 125, 132, 143,
+ 154, 155, 159, 162, 164, 167, 169, 176, 178, 184,
+ 186, 190, 194, 197, 201, 203, 205, 206, 207, 208,
+ 211, 214, 216, 218, 220, 225, 230, 232, 234, 236,
+ 240, 244, 248, 252, 256, 260, 264, 268, 272, 276,
+ 280, 283, 287, 291, 295, 299, 302, 305, 309, 312,
+ 315, 318, 320, 322, 325, 327, 331, 334, 337, 340,
+ 343, 347, 350, 354, 357, 360, 362, 366, 369, 373,
+ 374, 383, 384, 386, 390, 395, 396, 400, 401, 403
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 65, 0, -1, 65, 66, 67, -1, 67, -1, 1,
- 57, -1, 57, -1, -1, 91, -1, 86, -1, 95,
- -1, 68, -1, 70, -1, 31, 85, 22, 10, -1,
- 33, 10, 51, 85, -1, 33, 10, 35, 85, -1,
- 85, -1, 86, -1, 69, -1, 71, -1, 78, 58,
- 77, 59, 84, 83, 16, 32, -1, 79, 51, 85,
- 83, 35, 85, 83, 84, 83, 16, 32, -1, 79,
- 51, 85, 83, 13, 35, 85, 83, 84, 83, 16,
- 32, -1, 80, 77, 34, 66, 84, 83, 16, 21,
- -1, 80, 77, 34, 66, 84, 83, 38, 84, 83,
- 16, 21, -1, 80, 77, 34, 66, 84, 83, 82,
- 73, 83, 16, 21, -1, 80, 77, 34, 82, 69,
- 83, -1, 80, 77, 34, 82, 69, 83, 38, 82,
- 69, 83, -1, 80, 77, 34, 82, 69, 83, 74,
- 83, 72, 83, -1, -1, 38, 82, 69, -1, 73,
- 76, -1, 76, -1, 74, 75, -1, 75, -1, 81,
- 77, 34, 82, 70, 83, -1, 74, -1, 81, 77,
- 34, 84, 83, -1, 85, -1, 85, 51, 85, -1,
- 58, 77, 59, -1, 32, 37, -1, 32, 36, 10,
- -1, 21, -1, 15, -1, -1, -1, -1, 84, 66,
- -1, 84, 70, -1, 7, -1, 8, -1, 11, -1,
- 9, 58, 96, 59, -1, 10, 58, 96, 59, -1,
- 10, -1, 68, -1, 85, 52, 85, -1, 85, 53,
- 85, -1, 85, 54, 85, -1, 85, 55, 85, -1,
- 85, 60, 85, -1, 85, 61, 85, -1, 85, 44,
- 85, -1, 85, 39, 85, -1, 85, 40, 85, -1,
- 85, 45, 85, -1, 85, 46, 85, -1, 47, 85,
- -1, 85, 62, 85, -1, 85, 48, 85, -1, 85,
- 49, 85, -1, 85, 50, 85, -1, 52, 85, -1,
- 53, 85, -1, 58, 85, 59, -1, 25, 11, -1,
- 26, 10, -1, 31, 85, -1, 88, -1, 17, -1,
- 19, 87, -1, 10, -1, 87, 63, 10, -1, 20,
- 23, -1, 20, 28, -1, 20, 30, -1, 20, 89,
- -1, 20, 89, 90, -1, 20, 90, -1, 35, 18,
- 11, -1, 18, 11, -1, 35, 11, -1, 11, -1,
- 29, 27, 11, -1, 27, 11, -1, 35, 27, 11,
- -1, -1, 24, 10, 92, 82, 93, 66, 94, 84,
- -1, -1, 10, -1, 93, 63, 10, -1, 93, 66,
- 63, 10, -1, -1, 10, 82, 96, -1, -1, 85,
- -1, 96, 63, 85, -1
+ 68, 0, -1, 68, 69, 70, -1, 70, -1, 1,
+ 60, -1, 60, -1, -1, 94, -1, 89, -1, 98,
+ -1, 71, -1, 73, -1, 34, 88, 25, 13, -1,
+ 36, 13, 54, 88, -1, 36, 8, 54, 88, -1,
+ 36, 13, 38, 88, -1, 36, 8, 38, 88, -1,
+ 88, -1, 89, -1, 72, -1, 74, -1, 81, 61,
+ 80, 62, 87, 86, 19, 35, -1, 82, 54, 88,
+ 86, 38, 88, 86, 87, 86, 19, 35, -1, 82,
+ 54, 88, 86, 16, 38, 88, 86, 87, 86, 19,
+ 35, -1, 83, 80, 37, 69, 87, 86, 19, 24,
+ -1, 83, 80, 37, 69, 87, 86, 41, 87, 86,
+ 19, 24, -1, 83, 80, 37, 69, 87, 86, 85,
+ 76, 86, 19, 24, -1, 83, 80, 37, 85, 72,
+ 86, -1, 83, 80, 37, 85, 72, 86, 41, 85,
+ 72, 86, -1, 83, 80, 37, 85, 72, 86, 77,
+ 86, 75, 86, -1, -1, 41, 85, 72, -1, 76,
+ 79, -1, 79, -1, 77, 78, -1, 78, -1, 84,
+ 80, 37, 85, 73, 86, -1, 77, -1, 84, 80,
+ 37, 87, 86, -1, 88, -1, 88, 54, 88, -1,
+ 61, 80, 62, -1, 35, 40, -1, 35, 39, 13,
+ -1, 24, -1, 18, -1, -1, -1, -1, 87, 69,
+ -1, 87, 73, -1, 7, -1, 11, -1, 14, -1,
+ 12, 61, 99, 62, -1, 13, 61, 99, 62, -1,
+ 13, -1, 8, -1, 71, -1, 88, 55, 88, -1,
+ 88, 56, 88, -1, 88, 57, 88, -1, 88, 58,
+ 88, -1, 88, 63, 88, -1, 88, 64, 88, -1,
+ 88, 47, 88, -1, 88, 42, 88, -1, 88, 43,
+ 88, -1, 88, 48, 88, -1, 88, 49, 88, -1,
+ 50, 88, -1, 88, 65, 88, -1, 88, 51, 88,
+ -1, 88, 52, 88, -1, 88, 53, 88, -1, 55,
+ 88, -1, 56, 88, -1, 61, 88, 62, -1, 28,
+ 14, -1, 29, 13, -1, 34, 88, -1, 91, -1,
+ 20, -1, 22, 90, -1, 13, -1, 90, 66, 13,
+ -1, 23, 26, -1, 23, 31, -1, 23, 33, -1,
+ 23, 92, -1, 23, 92, 93, -1, 23, 93, -1,
+ 38, 21, 14, -1, 21, 14, -1, 38, 14, -1,
+ 14, -1, 32, 30, 14, -1, 30, 14, -1, 38,
+ 30, 14, -1, -1, 27, 13, 95, 85, 96, 69,
+ 97, 87, -1, -1, 13, -1, 96, 66, 13, -1,
+ 96, 69, 66, 13, -1, -1, 13, 85, 99, -1,
+ -1, 88, -1, 99, 66, 88, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 98, 98, 99, 100, 103, 108, 109, 110, 111,
- 112, 113, 116, 122, 128, 135, 136, 138, 139, 144,
- 155, 171, 185, 192, 201, 210, 220, 230, 241, 242,
- 245, 246, 249, 250, 253, 261, 262, 270, 271, 272,
- 274, 276, 282, 288, 295, 297, 299, 300, 301, 304,
- 309, 312, 315, 321, 329, 332, 333, 334, 335, 336,
- 337, 338, 339, 340, 341, 342, 343, 344, 345, 346,
- 347, 348, 349, 350, 351, 354, 355, 356, 357, 358,
- 360, 363, 364, 375, 376, 377, 378, 383, 389, 396,
- 397, 398, 399, 402, 403, 404, 432, 432, 439, 440,
- 441, 442, 444, 447, 455, 456, 457
+ 112, 113, 116, 122, 128, 136, 142, 150, 151, 153,
+ 154, 159, 170, 186, 200, 207, 216, 225, 235, 245,
+ 256, 257, 260, 261, 264, 265, 268, 276, 277, 285,
+ 286, 287, 289, 291, 297, 303, 310, 312, 314, 315,
+ 316, 319, 324, 327, 330, 336, 344, 347, 354, 355,
+ 356, 357, 358, 359, 360, 361, 362, 363, 364, 365,
+ 366, 367, 368, 369, 370, 371, 372, 373, 376, 377,
+ 378, 379, 380, 382, 385, 386, 397, 398, 399, 400,
+ 405, 411, 418, 419, 420, 421, 424, 425, 426, 454,
+ 454, 461, 462, 463, 464, 466, 469, 477, 478, 479
};
#endif
@@ -588,15 +595,16 @@ static const yytype_uint16 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "CASTREF", "UNARY", "VOID", "VAR", "INT",
- "FLOAT", "BLTIN", "ID", "STRING", "HANDLER", "tDOWN", "tELSE",
- "tNLELSIF", "tEND", "tEXIT", "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO",
- "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF",
- "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWITH",
- "tWHILE", "tNLELSE", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "tAND",
- "tOR", "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS", "'='", "'+'", "'-'",
- "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','",
- "$accept", "program", "nl", "programline", "asgn", "stmtoneliner",
- "stmt", "ifstmt", "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
+ "THEENTITY", "THEENTITYWITHID", "THEFIELD", "FLOAT", "BLTIN", "ID",
+ "STRING", "HANDLER", "tDOWN", "tELSE", "tNLELSIF", "tEND", "tEXIT",
+ "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI",
+ "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT",
+ "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tNLELSE", "tGE", "tLE",
+ "tGT", "tLT", "tEQ", "tNEQ", "tAND", "tOR", "tNOT", "tCONCAT",
+ "tCONTAINS", "tSTARTS", "'='", "'+'", "'-'", "'*'", "'/'", "'%'",
+ "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','", "$accept", "program",
+ "nl", "programline", "asgn", "stmtoneliner", "stmt", "ifstmt",
+ "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
"elseifstmtoneliner1", "elseifstmt1", "cond", "repeatwhile",
"repeatwith", "if", "elseif", "begin", "end", "stmtlist", "expr", "func",
"globallist", "gotofunc", "gotoframe", "gotomovie", "defn", "@1",
@@ -614,41 +622,41 @@ static const yytype_uint16 yytoknum[] =
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 61, 43, 45, 42, 47, 37, 10, 40, 41,
- 62, 60, 38, 44
+ 305, 306, 307, 308, 61, 43, 45, 42, 47, 37,
+ 10, 40, 41, 62, 60, 38, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 64, 65, 65, 65, 66, 67, 67, 67, 67,
- 67, 67, 68, 68, 68, 69, 69, 70, 70, 70,
- 70, 70, 71, 71, 71, 71, 71, 71, 72, 72,
- 73, 73, 74, 74, 75, 76, 76, 77, 77, 77,
- 78, 79, 80, 81, 82, 83, 84, 84, 84, 85,
- 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
- 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
- 85, 85, 85, 85, 85, 86, 86, 86, 86, 86,
- 86, 87, 87, 88, 88, 88, 88, 88, 88, 89,
- 89, 89, 89, 90, 90, 90, 92, 91, 93, 93,
- 93, 93, 94, 95, 96, 96, 96
+ 0, 67, 68, 68, 68, 69, 70, 70, 70, 70,
+ 70, 70, 71, 71, 71, 71, 71, 72, 72, 73,
+ 73, 73, 73, 73, 74, 74, 74, 74, 74, 74,
+ 75, 75, 76, 76, 77, 77, 78, 79, 79, 80,
+ 80, 80, 81, 82, 83, 84, 85, 86, 87, 87,
+ 87, 88, 88, 88, 88, 88, 88, 88, 88, 88,
+ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
+ 88, 88, 88, 88, 88, 88, 88, 88, 89, 89,
+ 89, 89, 89, 89, 90, 90, 91, 91, 91, 91,
+ 91, 91, 92, 92, 92, 92, 93, 93, 93, 95,
+ 94, 96, 96, 96, 96, 97, 98, 99, 99, 99
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 2, 1, 0, 1, 1, 1,
- 1, 1, 4, 4, 4, 1, 1, 1, 1, 8,
- 11, 12, 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, 4, 1, 1, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 2, 3, 3,
- 3, 3, 2, 2, 3, 2, 2, 2, 1, 1,
- 2, 1, 3, 2, 2, 2, 2, 3, 2, 3,
- 2, 2, 1, 3, 2, 3, 0, 8, 0, 1,
- 3, 4, 0, 3, 0, 1, 3
+ 1, 1, 4, 4, 4, 4, 4, 1, 1, 1,
+ 1, 8, 11, 12, 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, 4, 1, 1, 1, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 2, 3, 3, 3, 3, 2, 2, 3, 2, 2,
+ 2, 1, 1, 2, 1, 3, 2, 2, 2, 2,
+ 3, 2, 3, 2, 2, 1, 3, 2, 3, 0,
+ 8, 0, 1, 3, 4, 0, 3, 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -656,235 +664,235 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 0, 49, 50, 0, 44, 51, 79, 0, 0,
- 42, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 3, 55, 17, 11, 18, 0, 0, 0,
- 15, 8, 78, 7, 9, 4, 104, 104, 104, 81,
- 80, 92, 0, 83, 0, 84, 0, 85, 0, 86,
- 88, 96, 75, 76, 54, 0, 55, 77, 0, 40,
- 0, 67, 72, 73, 0, 1, 5, 6, 0, 0,
- 0, 0, 37, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 105, 0,
- 0, 103, 0, 90, 94, 0, 91, 0, 0, 0,
- 87, 44, 0, 0, 41, 0, 0, 74, 2, 0,
- 45, 0, 0, 44, 0, 63, 64, 62, 65, 66,
- 69, 70, 71, 56, 57, 58, 59, 60, 61, 68,
- 52, 0, 53, 82, 93, 89, 95, 98, 12, 14,
- 13, 46, 0, 39, 46, 0, 38, 106, 99, 0,
- 45, 0, 0, 45, 45, 16, 0, 102, 47, 48,
- 0, 0, 45, 44, 25, 100, 0, 46, 0, 45,
- 46, 0, 46, 0, 43, 44, 45, 33, 0, 101,
- 97, 19, 46, 45, 22, 45, 45, 35, 31, 0,
- 0, 32, 28, 0, 45, 0, 0, 30, 0, 0,
- 45, 44, 45, 44, 0, 0, 0, 0, 44, 26,
- 0, 27, 0, 0, 20, 23, 24, 45, 29, 45,
- 21, 36, 34
+ 0, 0, 51, 57, 52, 0, 46, 53, 82, 0,
+ 0, 44, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 3, 58, 19, 11, 20, 0, 0,
+ 0, 17, 8, 81, 7, 9, 4, 107, 107, 107,
+ 84, 83, 95, 0, 86, 0, 87, 0, 88, 0,
+ 89, 91, 99, 78, 79, 56, 0, 58, 80, 0,
+ 42, 0, 0, 70, 75, 76, 0, 1, 5, 6,
+ 0, 0, 0, 0, 39, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 108, 0, 0, 106, 0, 93, 97, 0, 94, 0,
+ 0, 0, 90, 46, 0, 0, 43, 0, 0, 0,
+ 0, 77, 2, 0, 47, 0, 0, 46, 0, 66,
+ 67, 65, 68, 69, 72, 73, 74, 59, 60, 61,
+ 62, 63, 64, 71, 54, 0, 55, 85, 96, 92,
+ 98, 101, 12, 16, 14, 15, 13, 48, 0, 41,
+ 48, 0, 40, 109, 102, 0, 47, 0, 0, 47,
+ 47, 18, 0, 105, 49, 50, 0, 0, 47, 46,
+ 27, 103, 0, 48, 0, 47, 48, 0, 48, 0,
+ 45, 46, 47, 35, 0, 104, 100, 21, 48, 47,
+ 24, 47, 47, 37, 33, 0, 0, 34, 30, 0,
+ 47, 0, 0, 32, 0, 0, 47, 46, 47, 46,
+ 0, 0, 0, 0, 46, 28, 0, 29, 0, 0,
+ 22, 25, 26, 47, 31, 47, 23, 38, 36
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 21, 158, 22, 56, 24, 159, 26, 202, 186,
- 187, 177, 188, 71, 27, 28, 29, 178, 212, 142,
- 150, 30, 155, 40, 32, 49, 50, 33, 101, 149,
- 167, 34, 89
+ -1, 22, 164, 23, 57, 25, 165, 27, 208, 192,
+ 193, 183, 194, 73, 28, 29, 30, 184, 218, 148,
+ 156, 31, 161, 41, 33, 50, 51, 34, 103, 155,
+ 173, 35, 91
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -145
+#define YYPACT_NINF -142
static const yytype_int16 yypact[] =
{
- 174, -46, -145, -145, -9, 468, -145, -145, 47, 5,
- -145, 54, 57, 82, 341, 23, 83, 341, 341, 341,
- 341, 4, -145, 9, -145, -145, -145, 40, 50, 348,
- 449, -145, -145, -145, -145, -145, 341, 341, 341, -145,
- 39, -145, 94, -145, 97, -145, 84, -145, -1, 16,
- -145, -145, -145, -145, 52, 341, -145, 363, 104, -145,
- -10, 511, 511, 511, 406, -145, -145, 226, 348, 341,
- 348, 86, 430, 341, 341, 341, 341, 341, 341, 341,
- 341, 341, 341, 341, 341, 341, 341, 341, 449, -15,
- 36, 53, 107, -145, -145, 110, -145, 111, 112, 91,
- -145, -145, 363, 115, -145, 341, 341, -145, -145, 68,
- 449, 69, 382, 72, 341, 449, 449, 449, 449, 449,
- 449, 449, 449, 492, 492, 511, 511, 449, 449, 449,
- -145, 341, -145, -145, -145, -145, -145, 121, -145, 449,
- 449, -145, 11, -145, -145, 313, 449, 449, -145, 33,
- 255, 99, 341, 255, -145, -145, 127, 75, -145, -145,
- 123, 341, 449, -2, -7, -145, 130, -145, 109, 449,
- -145, 122, -145, 131, -145, -145, 131, -145, 348, -145,
- 255, -145, -145, 255, -145, 255, 131, 131, -145, 348,
- 313, -145, 113, 108, 255, 129, 132, -145, 133, 120,
- -145, -145, -145, -145, 139, 124, 126, 136, -3, -145,
- 313, -145, 284, 128, -145, -145, -145, 255, -145, -145,
- -145, -145, -145
+ 138, -51, -142, -142, -142, -49, 465, -142, -142, 11,
+ -1, -142, 14, 27, 41, 224, 22, 88, 224, 224,
+ 224, 224, 4, -142, 10, -142, -142, -142, 31, 54,
+ 345, 446, -142, -142, -142, -142, -142, 224, 224, 224,
+ -142, 44, -142, 51, -142, 93, -142, 83, -142, 26,
+ 25, -142, -142, -142, -142, 59, 224, -142, 360, 108,
+ -142, -15, 5, 508, 508, 508, 403, -142, -142, 193,
+ 345, 224, 345, 87, 427, 224, 224, 224, 224, 224,
+ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
+ 446, 53, 56, 63, 114, -142, -142, 116, -142, 118,
+ 119, 106, -142, -142, 360, 124, -142, 224, 224, 224,
+ 224, -142, -142, 79, 446, 81, 379, 84, 224, 446,
+ 446, 446, 446, 446, 446, 446, 446, 489, 489, 508,
+ 508, 446, 446, 446, -142, 224, -142, -142, -142, -142,
+ -142, 134, -142, 446, 446, 446, 446, -142, -10, -142,
+ -142, 315, 446, 446, -142, 29, 233, 110, 224, 233,
+ -142, -142, 140, 89, -142, -142, 137, 224, 446, 17,
+ 3, -142, 155, -142, 135, 446, -142, 145, -142, 153,
+ -142, -142, 153, -142, 345, -142, 233, -142, -142, 233,
+ -142, 233, 153, 153, -142, 345, 315, -142, 136, 141,
+ 233, 156, 160, -142, 162, 146, -142, -142, -142, -142,
+ 163, 149, 161, 165, -11, -142, 315, -142, 284, 151,
+ -142, -142, -142, 233, -142, -142, -142, -142, -142
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -145, -145, -19, 96, 6, -138, 0, -145, -145, -145,
- -6, -129, -25, -65, -145, -145, -145, -144, -4, -50,
- -117, 1, 22, -145, -145, -145, 116, -145, -145, -145,
- -145, -145, 25
+ -142, -142, -20, 121, 18, -105, 0, -142, -142, -142,
+ 33, -140, 16, -67, -142, -142, -142, -141, -5, -66,
+ -128, -4, 19, -142, -142, -142, 142, -142, -142, -142,
+ -142, -142, 61
};
/* 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 -55
+#define YYTABLE_NINF -57
static const yytype_int16 yytable[] =
{
- 25, 38, 67, 109, 65, 111, 23, 154, 174, -10,
- 96, 35, -46, -46, 171, 57, 41, 97, 61, 62,
- 63, 64, 31, 42, 151, 105, 98, 153, 43, 189,
- 72, 175, 44, 45, 46, 47, 172, 88, 88, 88,
- 48, 106, 189, 44, 130, 46, 152, 191, 131, 36,
- 180, 99, 200, 183, -46, 185, 102, 39, 191, 58,
- 59, 66, 90, 91, 51, 194, -10, 25, 52, 72,
- 110, 112, 218, 23, 115, 116, 117, 118, 119, 120,
- 121, 122, 123, 124, 125, 126, 127, 128, 129, 31,
- 66, 217, 53, 60, 144, 132, 156, 137, 68, 131,
- 160, 69, 92, 163, 164, 93, 139, 140, 94, 145,
- 37, 95, 170, 193, 104, 146, 131, 133, 98, 182,
- 113, 134, 135, 136, 199, 138, 192, 141, 143, 66,
- 157, 148, 147, 195, 161, 196, 198, 165, 166, 168,
- 179, 181, 203, 184, 204, 205, 174, 215, 206, 207,
- 209, 201, 211, 162, 208, 213, 214, 216, 176, 173,
- 220, 197, 169, 108, 0, 100, 0, 221, 0, 222,
- 0, 190, 0, 0, -6, 1, 0, 0, 0, 72,
- 0, 2, 3, 4, 5, 6, 0, 0, 0, 0,
- 72, 7, 0, 8, 9, 10, 0, 210, 11, 12,
- 13, 0, 0, 0, 0, 14, 15, 16, 0, 0,
- 0, 0, 219, 0, 0, 0, 0, 0, 0, 0,
- 0, 17, 0, 0, 0, 0, 18, 19, 0, 0,
- 0, -6, 20, 2, 3, 4, 5, 6, 0, 0,
- 0, 0, 0, 7, 0, 8, 9, 10, 0, 0,
- 11, 12, 13, 0, 0, 0, 0, 14, 15, 16,
- 0, 0, 2, 3, 4, 54, 6, 0, 0, 0,
- 0, 0, 7, 17, 8, 9, 10, 0, 18, 19,
- 12, 13, 0, 0, 20, 0, 14, 15, 16, 0,
- 0, 2, 3, 4, 54, 6, 0, 0, 0, 0,
- 0, 7, 17, 8, 9, 10, 0, 18, 19, 12,
- 13, 0, 66, 20, 0, 14, 15, 16, 0, 0,
- 2, 3, 4, 54, 6, 0, 0, 0, 0, 0,
- 7, 17, 8, 9, 0, 0, 18, 19, 12, 13,
- 0, 0, 20, 0, 14, 0, 16, 0, 2, 3,
- 4, 54, 6, 0, 0, 2, 3, 4, 54, 6,
- 17, 0, 0, 0, 0, 18, 19, 0, 0, 0,
- 0, 20, 55, 0, 16, 0, 0, 0, 0, 55,
- 0, 16, 0, 0, 0, 103, 0, 0, 17, 0,
- 0, 0, 0, 18, 19, 17, 0, 0, 0, 20,
- 18, 19, 73, 74, 0, 0, 70, 75, 76, 77,
- 0, 78, 79, 80, 0, 81, 82, 83, 84, 0,
- 0, 73, 74, 85, 86, 87, 75, 76, 77, 0,
- 78, 79, 80, 114, 81, 82, 83, 84, 0, 0,
- 0, 107, 85, 86, 87, 73, 74, 0, 0, 0,
- 75, 76, 77, 0, 78, 79, 80, 0, 81, 82,
- 83, 84, 0, 0, 0, 107, 85, 86, 87, 73,
- 74, 0, 0, 0, 75, 76, 77, 0, 78, 79,
- 80, 114, 81, 82, 83, 84, 0, 0, 73, 74,
- 85, 86, 87, 75, 76, 77, 0, 78, 79, 80,
- 0, 81, 82, 83, 84, 0, 0, -54, -54, 85,
- 86, 87, -54, -54, -54, 0, -54, -54, -54, 0,
- 0, 0, -54, -54, 0, 0, 37, 0, -54, -54,
- -54, 73, 74, 0, 0, 0, 75, 76, 77, 0,
- 78, 79, 80, 0, 0, 0, 83, 84, 0, 0,
- 73, 74, 85, 86, 87, 75, 76, 77, 0, 78,
- 79, 80, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 85, 86, 87
+ 26, 39, 69, 113, 67, 115, 157, -48, -48, 36,
+ -10, 58, 37, 42, 63, 64, 65, 66, 24, 32,
+ 43, 180, 159, 107, 40, 44, 74, 52, 158, 45,
+ 46, 47, 48, 90, 90, 90, 177, 49, 195, 108,
+ 98, 53, 197, 109, 181, 186, 160, 99, 189, -48,
+ 191, 195, 104, 197, 54, 45, 100, 47, 178, 110,
+ 200, 59, 60, 101, 68, 95, 74, 114, 116, 26,
+ -10, 119, 120, 121, 122, 123, 124, 125, 126, 127,
+ 128, 129, 130, 131, 132, 133, 223, 24, 32, 68,
+ 166, 206, 70, 169, 170, 162, 61, 150, 141, 92,
+ 93, 62, 176, 143, 144, 145, 146, 96, 71, 188,
+ 94, 224, 151, 97, 152, 134, 198, 199, 136, 135,
+ 38, 106, 135, 201, 117, 202, 204, 137, 205, 135,
+ 138, 153, 139, 140, 210, 163, 100, 142, -6, 1,
+ 215, 147, 217, 149, 68, 2, 3, 154, 167, 4,
+ 5, 6, 7, 171, 168, 172, 174, 227, 8, 228,
+ 9, 10, 11, 175, 179, 12, 13, 14, 185, 190,
+ 187, 180, 15, 16, 17, 211, 196, 207, 209, 212,
+ 74, 213, 219, 214, 220, 221, 226, 0, 18, 222,
+ 112, 74, 102, 19, 20, 0, 0, 0, -6, 21,
+ 2, 3, 216, 182, 4, 5, 6, 7, 203, 0,
+ 0, 0, 0, 8, 0, 9, 10, 11, 225, 0,
+ 12, 13, 14, 0, 0, 0, 0, 15, 16, 17,
+ 0, 2, 3, 0, 0, 4, 5, 55, 7, 0,
+ 2, 3, 0, 18, 4, 5, 55, 7, 19, 20,
+ 0, 0, 0, 8, 21, 9, 10, 11, 56, 0,
+ 17, 13, 14, 0, 0, 0, 0, 15, 16, 17,
+ 0, 0, 0, 0, 18, 0, 0, 0, 0, 19,
+ 20, 0, 0, 18, 0, 21, 0, 0, 19, 20,
+ 0, 2, 3, 68, 21, 4, 5, 55, 7, 0,
+ 0, 0, 0, 0, 8, 0, 9, 10, 11, 0,
+ 0, 0, 13, 14, 0, 0, 0, 0, 15, 16,
+ 17, 0, 2, 3, 0, 0, 4, 5, 55, 7,
+ 0, 0, 0, 0, 18, 8, 0, 9, 10, 19,
+ 20, 0, 0, 13, 14, 21, 0, 0, 0, 15,
+ 0, 17, 2, 3, 0, 0, 4, 5, 55, 7,
+ 0, 0, 0, 0, 0, 18, 0, 0, 0, 0,
+ 19, 20, 0, 0, 0, 0, 21, 0, 0, 56,
+ 0, 17, 0, 0, 0, 105, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 18, 0, 0, 0, 0,
+ 19, 20, 75, 76, 0, 0, 72, 77, 78, 79,
+ 0, 80, 81, 82, 0, 83, 84, 85, 86, 0,
+ 0, 75, 76, 87, 88, 89, 77, 78, 79, 0,
+ 80, 81, 82, 118, 83, 84, 85, 86, 0, 0,
+ 0, 111, 87, 88, 89, 75, 76, 0, 0, 0,
+ 77, 78, 79, 0, 80, 81, 82, 0, 83, 84,
+ 85, 86, 0, 0, 0, 111, 87, 88, 89, 75,
+ 76, 0, 0, 0, 77, 78, 79, 0, 80, 81,
+ 82, 118, 83, 84, 85, 86, 0, 0, 75, 76,
+ 87, 88, 89, 77, 78, 79, 0, 80, 81, 82,
+ 0, 83, 84, 85, 86, 0, 0, -56, -56, 87,
+ 88, 89, -56, -56, -56, 0, -56, -56, -56, 0,
+ 0, 0, -56, -56, 0, 0, 38, 0, -56, -56,
+ -56, 75, 76, 0, 0, 0, 77, 78, 79, 0,
+ 80, 81, 82, 0, 0, 0, 85, 86, 0, 0,
+ 75, 76, 87, 88, 89, 77, 78, 79, 0, 80,
+ 81, 82, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 87, 88, 89
};
static const yytype_int16 yycheck[] =
{
- 0, 5, 21, 68, 0, 70, 0, 145, 15, 0,
- 11, 57, 15, 16, 16, 14, 11, 18, 17, 18,
- 19, 20, 0, 18, 13, 35, 27, 144, 23, 173,
- 29, 38, 27, 28, 29, 30, 38, 36, 37, 38,
- 35, 51, 186, 27, 59, 29, 35, 176, 63, 58,
- 167, 35, 190, 170, 57, 172, 55, 10, 187, 36,
- 37, 57, 37, 38, 10, 182, 57, 67, 11, 68,
- 69, 70, 210, 67, 73, 74, 75, 76, 77, 78,
- 79, 80, 81, 82, 83, 84, 85, 86, 87, 67,
- 57, 208, 10, 10, 113, 59, 63, 101, 58, 63,
- 150, 51, 63, 153, 154, 11, 105, 106, 11, 113,
- 58, 27, 162, 178, 10, 114, 63, 10, 27, 169,
- 34, 11, 11, 11, 189, 10, 176, 59, 59, 57,
- 149, 10, 131, 183, 35, 185, 186, 10, 63, 16,
- 10, 32, 34, 21, 194, 16, 15, 21, 16, 16,
- 200, 38, 202, 152, 34, 16, 32, 21, 164, 163,
- 32, 186, 161, 67, -1, 49, -1, 217, -1, 219,
- -1, 175, -1, -1, 0, 1, -1, -1, -1, 178,
- -1, 7, 8, 9, 10, 11, -1, -1, -1, -1,
- 189, 17, -1, 19, 20, 21, -1, 201, 24, 25,
- 26, -1, -1, -1, -1, 31, 32, 33, -1, -1,
- -1, -1, 212, -1, -1, -1, -1, -1, -1, -1,
- -1, 47, -1, -1, -1, -1, 52, 53, -1, -1,
- -1, 57, 58, 7, 8, 9, 10, 11, -1, -1,
- -1, -1, -1, 17, -1, 19, 20, 21, -1, -1,
- 24, 25, 26, -1, -1, -1, -1, 31, 32, 33,
- -1, -1, 7, 8, 9, 10, 11, -1, -1, -1,
- -1, -1, 17, 47, 19, 20, 21, -1, 52, 53,
- 25, 26, -1, -1, 58, -1, 31, 32, 33, -1,
- -1, 7, 8, 9, 10, 11, -1, -1, -1, -1,
- -1, 17, 47, 19, 20, 21, -1, 52, 53, 25,
- 26, -1, 57, 58, -1, 31, 32, 33, -1, -1,
- 7, 8, 9, 10, 11, -1, -1, -1, -1, -1,
- 17, 47, 19, 20, -1, -1, 52, 53, 25, 26,
- -1, -1, 58, -1, 31, -1, 33, -1, 7, 8,
- 9, 10, 11, -1, -1, 7, 8, 9, 10, 11,
- 47, -1, -1, -1, -1, 52, 53, -1, -1, -1,
- -1, 58, 31, -1, 33, -1, -1, -1, -1, 31,
- -1, 33, -1, -1, -1, 22, -1, -1, 47, -1,
- -1, -1, -1, 52, 53, 47, -1, -1, -1, 58,
- 52, 53, 39, 40, -1, -1, 58, 44, 45, 46,
- -1, 48, 49, 50, -1, 52, 53, 54, 55, -1,
- -1, 39, 40, 60, 61, 62, 44, 45, 46, -1,
- 48, 49, 50, 51, 52, 53, 54, 55, -1, -1,
- -1, 59, 60, 61, 62, 39, 40, -1, -1, -1,
- 44, 45, 46, -1, 48, 49, 50, -1, 52, 53,
- 54, 55, -1, -1, -1, 59, 60, 61, 62, 39,
- 40, -1, -1, -1, 44, 45, 46, -1, 48, 49,
- 50, 51, 52, 53, 54, 55, -1, -1, 39, 40,
- 60, 61, 62, 44, 45, 46, -1, 48, 49, 50,
- -1, 52, 53, 54, 55, -1, -1, 39, 40, 60,
- 61, 62, 44, 45, 46, -1, 48, 49, 50, -1,
- -1, -1, 54, 55, -1, -1, 58, -1, 60, 61,
- 62, 39, 40, -1, -1, -1, 44, 45, 46, -1,
- 48, 49, 50, -1, -1, -1, 54, 55, -1, -1,
- 39, 40, 60, 61, 62, 44, 45, 46, -1, 48,
- 49, 50, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 60, 61, 62
+ 0, 6, 22, 70, 0, 72, 16, 18, 19, 60,
+ 0, 15, 61, 14, 18, 19, 20, 21, 0, 0,
+ 21, 18, 150, 38, 13, 26, 30, 13, 38, 30,
+ 31, 32, 33, 37, 38, 39, 19, 38, 179, 54,
+ 14, 14, 182, 38, 41, 173, 151, 21, 176, 60,
+ 178, 192, 56, 193, 13, 30, 30, 32, 41, 54,
+ 188, 39, 40, 38, 60, 14, 70, 71, 72, 69,
+ 60, 75, 76, 77, 78, 79, 80, 81, 82, 83,
+ 84, 85, 86, 87, 88, 89, 214, 69, 69, 60,
+ 156, 196, 61, 159, 160, 66, 8, 117, 103, 38,
+ 39, 13, 168, 107, 108, 109, 110, 14, 54, 175,
+ 66, 216, 117, 30, 118, 62, 182, 184, 62, 66,
+ 61, 13, 66, 189, 37, 191, 192, 13, 195, 66,
+ 14, 135, 14, 14, 200, 155, 30, 13, 0, 1,
+ 206, 62, 208, 62, 60, 7, 8, 13, 38, 11,
+ 12, 13, 14, 13, 158, 66, 19, 223, 20, 225,
+ 22, 23, 24, 167, 169, 27, 28, 29, 13, 24,
+ 35, 18, 34, 35, 36, 19, 181, 41, 37, 19,
+ 184, 19, 19, 37, 35, 24, 35, -1, 50, 24,
+ 69, 195, 50, 55, 56, -1, -1, -1, 60, 61,
+ 7, 8, 207, 170, 11, 12, 13, 14, 192, -1,
+ -1, -1, -1, 20, -1, 22, 23, 24, 218, -1,
+ 27, 28, 29, -1, -1, -1, -1, 34, 35, 36,
+ -1, 7, 8, -1, -1, 11, 12, 13, 14, -1,
+ 7, 8, -1, 50, 11, 12, 13, 14, 55, 56,
+ -1, -1, -1, 20, 61, 22, 23, 24, 34, -1,
+ 36, 28, 29, -1, -1, -1, -1, 34, 35, 36,
+ -1, -1, -1, -1, 50, -1, -1, -1, -1, 55,
+ 56, -1, -1, 50, -1, 61, -1, -1, 55, 56,
+ -1, 7, 8, 60, 61, 11, 12, 13, 14, -1,
+ -1, -1, -1, -1, 20, -1, 22, 23, 24, -1,
+ -1, -1, 28, 29, -1, -1, -1, -1, 34, 35,
+ 36, -1, 7, 8, -1, -1, 11, 12, 13, 14,
+ -1, -1, -1, -1, 50, 20, -1, 22, 23, 55,
+ 56, -1, -1, 28, 29, 61, -1, -1, -1, 34,
+ -1, 36, 7, 8, -1, -1, 11, 12, 13, 14,
+ -1, -1, -1, -1, -1, 50, -1, -1, -1, -1,
+ 55, 56, -1, -1, -1, -1, 61, -1, -1, 34,
+ -1, 36, -1, -1, -1, 25, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 50, -1, -1, -1, -1,
+ 55, 56, 42, 43, -1, -1, 61, 47, 48, 49,
+ -1, 51, 52, 53, -1, 55, 56, 57, 58, -1,
+ -1, 42, 43, 63, 64, 65, 47, 48, 49, -1,
+ 51, 52, 53, 54, 55, 56, 57, 58, -1, -1,
+ -1, 62, 63, 64, 65, 42, 43, -1, -1, -1,
+ 47, 48, 49, -1, 51, 52, 53, -1, 55, 56,
+ 57, 58, -1, -1, -1, 62, 63, 64, 65, 42,
+ 43, -1, -1, -1, 47, 48, 49, -1, 51, 52,
+ 53, 54, 55, 56, 57, 58, -1, -1, 42, 43,
+ 63, 64, 65, 47, 48, 49, -1, 51, 52, 53,
+ -1, 55, 56, 57, 58, -1, -1, 42, 43, 63,
+ 64, 65, 47, 48, 49, -1, 51, 52, 53, -1,
+ -1, -1, 57, 58, -1, -1, 61, -1, 63, 64,
+ 65, 42, 43, -1, -1, -1, 47, 48, 49, -1,
+ 51, 52, 53, -1, -1, -1, 57, 58, -1, -1,
+ 42, 43, 63, 64, 65, 47, 48, 49, -1, 51,
+ 52, 53, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 63, 64, 65
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 7, 8, 9, 10, 11, 17, 19, 20,
- 21, 24, 25, 26, 31, 32, 33, 47, 52, 53,
- 58, 65, 67, 68, 69, 70, 71, 78, 79, 80,
- 85, 86, 88, 91, 95, 57, 58, 58, 82, 10,
- 87, 11, 18, 23, 27, 28, 29, 30, 35, 89,
- 90, 10, 11, 10, 10, 31, 68, 85, 36, 37,
- 10, 85, 85, 85, 85, 0, 57, 66, 58, 51,
- 58, 77, 85, 39, 40, 44, 45, 46, 48, 49,
- 50, 52, 53, 54, 55, 60, 61, 62, 85, 96,
- 96, 96, 63, 11, 11, 27, 11, 18, 27, 35,
- 90, 92, 85, 22, 10, 35, 51, 59, 67, 77,
- 85, 77, 85, 34, 51, 85, 85, 85, 85, 85,
- 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
- 59, 63, 59, 10, 11, 11, 11, 82, 10, 85,
- 85, 59, 83, 59, 66, 82, 85, 85, 10, 93,
- 84, 13, 35, 84, 69, 86, 63, 66, 66, 70,
- 83, 35, 85, 83, 83, 10, 63, 94, 16, 85,
- 83, 16, 38, 82, 15, 38, 74, 75, 81, 10,
- 84, 32, 83, 84, 21, 84, 73, 74, 76, 81,
- 82, 75, 83, 77, 84, 83, 83, 76, 83, 77,
- 69, 38, 72, 34, 83, 16, 16, 16, 34, 83,
- 82, 83, 82, 16, 32, 21, 21, 84, 69, 70,
- 32, 83, 83
+ 0, 1, 7, 8, 11, 12, 13, 14, 20, 22,
+ 23, 24, 27, 28, 29, 34, 35, 36, 50, 55,
+ 56, 61, 68, 70, 71, 72, 73, 74, 81, 82,
+ 83, 88, 89, 91, 94, 98, 60, 61, 61, 85,
+ 13, 90, 14, 21, 26, 30, 31, 32, 33, 38,
+ 92, 93, 13, 14, 13, 13, 34, 71, 88, 39,
+ 40, 8, 13, 88, 88, 88, 88, 0, 60, 69,
+ 61, 54, 61, 80, 88, 42, 43, 47, 48, 49,
+ 51, 52, 53, 55, 56, 57, 58, 63, 64, 65,
+ 88, 99, 99, 99, 66, 14, 14, 30, 14, 21,
+ 30, 38, 93, 95, 88, 25, 13, 38, 54, 38,
+ 54, 62, 70, 80, 88, 80, 88, 37, 54, 88,
+ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
+ 88, 88, 88, 88, 62, 66, 62, 13, 14, 14,
+ 14, 85, 13, 88, 88, 88, 88, 62, 86, 62,
+ 69, 85, 88, 88, 13, 96, 87, 16, 38, 87,
+ 72, 89, 66, 69, 69, 73, 86, 38, 88, 86,
+ 86, 13, 66, 97, 19, 88, 86, 19, 41, 85,
+ 18, 41, 77, 78, 84, 13, 87, 35, 86, 87,
+ 24, 87, 76, 77, 79, 84, 85, 78, 86, 80,
+ 87, 86, 86, 79, 86, 80, 72, 41, 75, 37,
+ 86, 19, 19, 19, 37, 86, 85, 86, 85, 19,
+ 35, 24, 24, 87, 72, 73, 35, 86, 86
};
#define yyerrok (yyerrstatus = 0)
@@ -1739,6 +1747,18 @@ yyreduce:
case 14:
#line 128 "engines/director/lingo/lingo-gr.y"
{
+ g_lingo->code1(g_lingo->c_theentityassign);
+ inst e = 0, f = 0, i = 0;
+ WRITE_UINT32(&e, (yyvsp[(2) - (4)].i));
+ WRITE_UINT32(&f, 0);
+ WRITE_UINT32(&i, 0);
+ g_lingo->code3(e, f, i);
+ (yyval.code) = (yyvsp[(4) - (4)].code); ;}
+ break;
+
+ case 15:
+#line 136 "engines/director/lingo/lingo-gr.y"
+ {
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
g_lingo->code1(g_lingo->c_assign);
@@ -1746,13 +1766,24 @@ yyreduce:
delete (yyvsp[(2) - (4)].s); ;}
break;
- case 15:
-#line 135 "engines/director/lingo/lingo-gr.y"
+ case 16:
+#line 142 "engines/director/lingo/lingo-gr.y"
+ {
+ g_lingo->code1(g_lingo->c_theentityassign);
+ inst e = 0, f = 0;
+ WRITE_UINT32(&e, (yyvsp[(2) - (4)].i));
+ WRITE_UINT32(&f, 0);
+ g_lingo->code2(e, f);
+ (yyval.code) = (yyvsp[(4) - (4)].code); ;}
+ break;
+
+ case 17:
+#line 150 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 19:
-#line 144 "engines/director/lingo/lingo-gr.y"
+ case 21:
+#line 159 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1761,8 +1792,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
- case 20:
-#line 155 "engines/director/lingo/lingo-gr.y"
+ case 22:
+#line 170 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1777,8 +1808,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
break;
- case 21:
-#line 171 "engines/director/lingo/lingo-gr.y"
+ case 23:
+#line 186 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1793,8 +1824,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
break;
- case 22:
-#line 185 "engines/director/lingo/lingo-gr.y"
+ case 24:
+#line 200 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (8)].code));
@@ -1804,8 +1835,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 23:
-#line 192 "engines/director/lingo/lingo-gr.y"
+ case 25:
+#line 207 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1817,8 +1848,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 24:
-#line 201 "engines/director/lingo/lingo-gr.y"
+ case 26:
+#line 216 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1830,8 +1861,8 @@ yyreduce:
g_lingo->processIf(0, (yyvsp[(9) - (11)].code)); ;}
break;
- case 25:
-#line 210 "engines/director/lingo/lingo-gr.y"
+ case 27:
+#line 225 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1844,8 +1875,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 26:
-#line 220 "engines/director/lingo/lingo-gr.y"
+ case 28:
+#line 235 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1858,8 +1889,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 27:
-#line 230 "engines/director/lingo/lingo-gr.y"
+ case 29:
+#line 245 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1872,18 +1903,18 @@ yyreduce:
g_lingo->processIf(0, (yyvsp[(10) - (10)].code)); ;}
break;
- case 28:
-#line 241 "engines/director/lingo/lingo-gr.y"
+ case 30:
+#line 256 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = 0; ;}
break;
- case 29:
-#line 242 "engines/director/lingo/lingo-gr.y"
+ case 31:
+#line 257 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 34:
-#line 253 "engines/director/lingo/lingo-gr.y"
+ case 36:
+#line 268 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1892,8 +1923,8 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (6)].code)); ;}
break;
- case 36:
-#line 262 "engines/director/lingo/lingo-gr.y"
+ case 38:
+#line 277 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
@@ -1902,23 +1933,23 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (5)].code)); ;}
break;
- case 37:
-#line 270 "engines/director/lingo/lingo-gr.y"
+ case 39:
+#line 285 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 38:
-#line 271 "engines/director/lingo/lingo-gr.y"
+ case 40:
+#line 286 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 40:
-#line 274 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 289 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 41:
-#line 276 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 291 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1926,8 +1957,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 42:
-#line 282 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 297 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -1935,8 +1966,8 @@ yyreduce:
g_lingo->codeLabel(0); ;}
break;
- case 43:
-#line 288 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 303 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -1945,23 +1976,23 @@ yyreduce:
g_lingo->code1(skipEnd); ;}
break;
- case 44:
-#line 295 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 310 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 45:
-#line 297 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 312 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 46:
-#line 299 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 314 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 49:
-#line 304 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 319 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -1969,22 +2000,22 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 50:
-#line 309 "engines/director/lingo/lingo-gr.y"
+ case 52:
+#line 324 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
- case 51:
-#line 312 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 327 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_stringpush);
g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;}
break;
- case 52:
-#line 315 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 330 "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));
@@ -1993,8 +2024,8 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 53:
-#line 321 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 336 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -2005,156 +2036,167 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 54:
-#line 329 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 344 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 56:
-#line 333 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 347 "engines/director/lingo/lingo-gr.y"
+ {
+ (yyval.code) = g_lingo->code1(g_lingo->c_theentitypush);
+ inst e = 0, f = 0, i = 0;
+ WRITE_UINT32(&e, (yyvsp[(1) - (1)].i));
+ WRITE_UINT32(&f, 0);
+ WRITE_UINT32(&i, 0);
+ g_lingo->code3(e, f, i); ;}
+ break;
+
+ case 59:
+#line 355 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 57:
-#line 334 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 356 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 58:
-#line 335 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 357 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 59:
-#line 336 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 358 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 60:
-#line 337 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 359 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 61:
-#line 338 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 360 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 62:
-#line 339 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 361 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 63:
-#line 340 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 362 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 64:
-#line 341 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 363 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 65:
-#line 342 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 364 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_and); ;}
break;
- case 66:
-#line 343 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 365 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_or); ;}
break;
- case 67:
-#line 344 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 366 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_not); ;}
break;
- case 68:
-#line 345 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 367 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ampersand); ;}
break;
- case 69:
-#line 346 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 368 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_concat); ;}
break;
- case 70:
-#line 347 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 369 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_contains); ;}
break;
- case 71:
-#line 348 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 370 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_starts); ;}
break;
- case 72:
-#line 349 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 371 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 73:
-#line 350 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 372 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 74:
-#line 351 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 373 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 75:
-#line 354 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 376 "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 76:
-#line 355 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 377 "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 77:
-#line 356 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 378 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 79:
-#line 358 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 380 "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 81:
-#line 363 "engines/director/lingo/lingo-gr.y"
+ case 84:
+#line 385 "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 82:
-#line 364 "engines/director/lingo/lingo-gr.y"
+ case 85:
+#line 386 "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 83:
-#line 375 "engines/director/lingo/lingo-gr.y"
+ case 86:
+#line 397 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 84:
-#line 376 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 398 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 85:
-#line 377 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 399 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 86:
-#line 378 "engines/director/lingo/lingo-gr.y"
+ case 89:
+#line 400 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2162,8 +2204,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 87:
-#line 383 "engines/director/lingo/lingo-gr.y"
+ case 90:
+#line 405 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2172,8 +2214,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 88:
-#line 389 "engines/director/lingo/lingo-gr.y"
+ case 91:
+#line 411 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2181,48 +2223,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 89:
-#line 396 "engines/director/lingo/lingo-gr.y"
+ case 92:
+#line 418 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 90:
-#line 397 "engines/director/lingo/lingo-gr.y"
+ case 93:
+#line 419 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 91:
-#line 398 "engines/director/lingo/lingo-gr.y"
+ case 94:
+#line 420 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 92:
-#line 399 "engines/director/lingo/lingo-gr.y"
+ case 95:
+#line 421 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 93:
-#line 402 "engines/director/lingo/lingo-gr.y"
+ case 96:
+#line 424 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 94:
-#line 403 "engines/director/lingo/lingo-gr.y"
+ case 97:
+#line 425 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 95:
-#line 404 "engines/director/lingo/lingo-gr.y"
+ case 98:
+#line 426 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 96:
-#line 432 "engines/director/lingo/lingo-gr.y"
+ case 99:
+#line 454 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 97:
-#line 433 "engines/director/lingo/lingo-gr.y"
+ case 100:
+#line 455 "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);
@@ -2230,33 +2272,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 98:
-#line 439 "engines/director/lingo/lingo-gr.y"
+ case 101:
+#line 461 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 99:
-#line 440 "engines/director/lingo/lingo-gr.y"
+ case 102:
+#line 462 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 100:
-#line 441 "engines/director/lingo/lingo-gr.y"
+ case 103:
+#line 463 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 101:
-#line 442 "engines/director/lingo/lingo-gr.y"
+ case 104:
+#line 464 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 102:
-#line 444 "engines/director/lingo/lingo-gr.y"
+ case 105:
+#line 466 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 103:
-#line 447 "engines/director/lingo/lingo-gr.y"
+ case 106:
+#line 469 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2265,24 +2307,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 104:
-#line 455 "engines/director/lingo/lingo-gr.y"
+ case 107:
+#line 477 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 105:
-#line 456 "engines/director/lingo/lingo-gr.y"
+ case 108:
+#line 478 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 106:
-#line 457 "engines/director/lingo/lingo-gr.y"
+ case 109:
+#line 479 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2286 "engines/director/lingo/lingo-gr.cpp"
+#line 2328 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2496,6 +2538,6 @@ yyreturn:
}
-#line 460 "engines/director/lingo/lingo-gr.y"
+#line 482 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 1ee7394..ea393a6 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -44,49 +44,52 @@
VOID = 260,
VAR = 261,
INT = 262,
- FLOAT = 263,
- BLTIN = 264,
- ID = 265,
- STRING = 266,
- HANDLER = 267,
- tDOWN = 268,
- tELSE = 269,
- tNLELSIF = 270,
- tEND = 271,
- tEXIT = 272,
- tFRAME = 273,
- tGLOBAL = 274,
- tGO = 275,
- tIF = 276,
- tINTO = 277,
- tLOOP = 278,
- tMACRO = 279,
- tMCI = 280,
- tMCIWAIT = 281,
- tMOVIE = 282,
- tNEXT = 283,
- tOF = 284,
- tPREVIOUS = 285,
- tPUT = 286,
- tREPEAT = 287,
- tSET = 288,
- tTHEN = 289,
- tTO = 290,
- tWITH = 291,
- tWHILE = 292,
- tNLELSE = 293,
- tGE = 294,
- tLE = 295,
- tGT = 296,
- tLT = 297,
- tEQ = 298,
- tNEQ = 299,
- tAND = 300,
- tOR = 301,
- tNOT = 302,
- tCONCAT = 303,
- tCONTAINS = 304,
- tSTARTS = 305
+ THEENTITY = 263,
+ THEENTITYWITHID = 264,
+ THEFIELD = 265,
+ FLOAT = 266,
+ BLTIN = 267,
+ ID = 268,
+ STRING = 269,
+ HANDLER = 270,
+ tDOWN = 271,
+ tELSE = 272,
+ tNLELSIF = 273,
+ tEND = 274,
+ tEXIT = 275,
+ tFRAME = 276,
+ tGLOBAL = 277,
+ tGO = 278,
+ tIF = 279,
+ tINTO = 280,
+ tLOOP = 281,
+ tMACRO = 282,
+ tMCI = 283,
+ tMCIWAIT = 284,
+ tMOVIE = 285,
+ tNEXT = 286,
+ tOF = 287,
+ tPREVIOUS = 288,
+ tPUT = 289,
+ tREPEAT = 290,
+ tSET = 291,
+ tTHEN = 292,
+ tTO = 293,
+ tWITH = 294,
+ tWHILE = 295,
+ tNLELSE = 296,
+ tGE = 297,
+ tLE = 298,
+ tGT = 299,
+ tLT = 300,
+ tEQ = 301,
+ tNEQ = 302,
+ tAND = 303,
+ tOR = 304,
+ tNOT = 305,
+ tCONCAT = 306,
+ tCONTAINS = 307,
+ tSTARTS = 308
};
#endif
/* Tokens. */
@@ -95,49 +98,52 @@
#define VOID 260
#define VAR 261
#define INT 262
-#define FLOAT 263
-#define BLTIN 264
-#define ID 265
-#define STRING 266
-#define HANDLER 267
-#define tDOWN 268
-#define tELSE 269
-#define tNLELSIF 270
-#define tEND 271
-#define tEXIT 272
-#define tFRAME 273
-#define tGLOBAL 274
-#define tGO 275
-#define tIF 276
-#define tINTO 277
-#define tLOOP 278
-#define tMACRO 279
-#define tMCI 280
-#define tMCIWAIT 281
-#define tMOVIE 282
-#define tNEXT 283
-#define tOF 284
-#define tPREVIOUS 285
-#define tPUT 286
-#define tREPEAT 287
-#define tSET 288
-#define tTHEN 289
-#define tTO 290
-#define tWITH 291
-#define tWHILE 292
-#define tNLELSE 293
-#define tGE 294
-#define tLE 295
-#define tGT 296
-#define tLT 297
-#define tEQ 298
-#define tNEQ 299
-#define tAND 300
-#define tOR 301
-#define tNOT 302
-#define tCONCAT 303
-#define tCONTAINS 304
-#define tSTARTS 305
+#define THEENTITY 263
+#define THEENTITYWITHID 264
+#define THEFIELD 265
+#define FLOAT 266
+#define BLTIN 267
+#define ID 268
+#define STRING 269
+#define HANDLER 270
+#define tDOWN 271
+#define tELSE 272
+#define tNLELSIF 273
+#define tEND 274
+#define tEXIT 275
+#define tFRAME 276
+#define tGLOBAL 277
+#define tGO 278
+#define tIF 279
+#define tINTO 280
+#define tLOOP 281
+#define tMACRO 282
+#define tMCI 283
+#define tMCIWAIT 284
+#define tMOVIE 285
+#define tNEXT 286
+#define tOF 287
+#define tPREVIOUS 288
+#define tPUT 289
+#define tREPEAT 290
+#define tSET 291
+#define tTHEN 292
+#define tTO 293
+#define tWITH 294
+#define tWHILE 295
+#define tNLELSE 296
+#define tGE 297
+#define tLE 298
+#define tGT 299
+#define tLT 300
+#define tEQ 301
+#define tNEQ 302
+#define tAND 303
+#define tOR 304
+#define tNOT 305
+#define tCONCAT 306
+#define tCONTAINS 307
+#define tSTARTS 308
@@ -153,7 +159,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 157 "engines/director/lingo/lingo-gr.hpp"
+#line 163 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index adb2075..f830505 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -75,7 +75,7 @@ void yyerror(char *s) {
}
%token CASTREF UNARY VOID VAR
-%token<i> INT
+%token<i> INT THEENTITY THEENTITYWITHID THEFIELD
%token<f> FLOAT
%token<s> BLTIN ID STRING HANDLER
%token tDOWN tELSE tNLELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
@@ -125,12 +125,27 @@ asgn: tPUT expr tINTO ID {
g_lingo->code1(g_lingo->c_assign);
$$ = $4;
delete $2; }
+ | tSET THEENTITY '=' expr {
+ g_lingo->code1(g_lingo->c_theentityassign);
+ inst e = 0, f = 0, i = 0;
+ WRITE_UINT32(&e, $2);
+ WRITE_UINT32(&f, 0);
+ WRITE_UINT32(&i, 0);
+ g_lingo->code3(e, f, i);
+ $$ = $4; }
| tSET ID tTO expr {
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString($2->c_str());
g_lingo->code1(g_lingo->c_assign);
$$ = $4;
delete $2; }
+ | tSET THEENTITY tTO expr {
+ g_lingo->code1(g_lingo->c_theentityassign);
+ inst e = 0, f = 0;
+ WRITE_UINT32(&e, $2);
+ WRITE_UINT32(&f, 0);
+ g_lingo->code2(e, f);
+ $$ = $4; }
;
stmtoneliner: expr { g_lingo->code1(g_lingo->c_xpop); }
| func
@@ -329,6 +344,13 @@ expr: INT {
| ID {
$$ = g_lingo->codeId(*$1);
delete $1; }
+ | THEENTITY {
+ $$ = g_lingo->code1(g_lingo->c_theentitypush);
+ inst e = 0, f = 0, i = 0;
+ WRITE_UINT32(&e, $1);
+ WRITE_UINT32(&f, 0);
+ WRITE_UINT32(&i, 0);
+ g_lingo->code3(e, f, i); }
| asgn
| expr '+' expr { g_lingo->code1(g_lingo->c_add); }
| expr '-' expr { g_lingo->code1(g_lingo->c_sub); }
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 58d052e..e8b376b 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -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, 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,
+ 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, 37, 1, 38, 39, 40, 41,
+
+ 42, 43, 44, 45, 46, 24, 24, 47, 48, 49,
+ 50, 51, 24, 52, 53, 54, 55, 56, 57, 58,
+ 24, 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,32 +429,32 @@ static yyconst flex_int32_t yy_ec[256] =
static yyconst flex_int32_t yy_meta[59] =
{ 0,
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
+ 5, 1, 1, 1, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 5, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 6
} ;
static yyconst flex_int16_t yy_base[158] =
{ 0,
- 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
+ 0, 57, 188, 380, 61, 65, 69, 73, 153, 380,
+ 137, 91, 50, 66, 85, 54, 0, 54, 55, 65,
+ 56, 66, 75, 59, 82, 87, 97, 95, 77, 102,
+ 108, 116, 161, 165, 169, 138, 173, 141, 177, 101,
+ 87, 380, 380, 0, 78, 141, 380, 380, 380, 0,
+ 113, 106, 100, 153, 167, 163, 172, 161, 0, 0,
+ 158, 163, 175, 170, 161, 162, 167, 0, 0, 181,
+ 170, 174, 172, 190, 188, 0, 191, 186, 229, 239,
+ 196, 0, 74, 0, 197, 208, 203, 0, 204, 212,
+ 223, 218, 218, 218, 215, 229, 222, 0, 221, 0,
+
+ 237, 0, 229, 259, 238, 243, 247, 252, 0, 0,
+ 0, 252, 258, 0, 0, 250, 259, 261, 0, 259,
+ 268, 255, 192, 0, 265, 0, 290, 268, 0, 268,
+ 0, 275, 0, 273, 270, 273, 308, 0, 314, 284,
+ 0, 280, 284, 0, 0, 279, 287, 0, 289, 380,
+ 0, 0, 380, 360, 362, 368, 373
} ;
static yyconst flex_int16_t yy_def[158] =
@@ -478,58 +478,59 @@ static yyconst flex_int16_t yy_def[158] =
155, 155, 0, 153, 153, 153, 153
} ;
-static yyconst flex_int16_t yy_nxt[426] =
+static yyconst flex_int16_t yy_nxt[439] =
{ 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,
+ 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, 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,
+ 51, 52, 53, 40, 83, 57, 62, 40, 83, 54,
+ 58, 55, 42, 59, 60, 72, 63, 49, 64, 44,
+
+ 56, 61, 51, 52, 53, 66, 40, 57, 62, 65,
+ 40, 54, 58, 55, 67, 59, 68, 60, 72, 63,
+ 73, 64, 56, 61, 70, 81, 69, 71, 66, 75,
+ 84, 65, 85, 74, 86, 76, 67, 77, 78, 68,
+ 36, 36, 38, 73, 43, 38, 70, 81, 69, 71,
+ 45, 46, 75, 84, 85, 74, 86, 76, 42, 40,
+ 77, 78, 79, 36, 36, 80, 80, 36, 36, 80,
+ 35, 36, 36, 37, 37, 36, 36, 37, 38, 39,
+ 39, 38, 40, 87, 88, 89, 90, 153, 91, 92,
+ 93, 94, 95, 123, 96, 40, 123, 97, 98, 99,
+
+ 153, 100, 101, 102, 103, 87, 104, 88, 89, 90,
+ 91, 92, 93, 105, 94, 95, 96, 106, 40, 97,
+ 98, 110, 99, 100, 101, 102, 107, 103, 108, 104,
+ 79, 36, 36, 80, 109, 111, 105, 112, 113, 106,
+ 80, 36, 36, 80, 110, 114, 115, 116, 107, 117,
+ 108, 118, 153, 119, 120, 121, 109, 111, 122, 112,
+ 123, 113, 125, 123, 126, 127, 128, 114, 115, 116,
+ 129, 117, 130, 132, 118, 119, 120, 131, 121, 133,
+ 122, 134, 135, 138, 125, 124, 136, 126, 127, 128,
+ 140, 139, 141, 129, 139, 130, 132, 142, 150, 131,
+
+ 143, 144, 133, 145, 134, 135, 138, 124, 136, 153,
+ 147, 148, 153, 140, 141, 139, 149, 151, 139, 152,
+ 142, 150, 143, 144, 153, 145, 153, 153, 153, 153,
+ 153, 153, 147, 148, 153, 153, 146, 153, 149, 151,
+ 153, 152, 153, 153, 153, 153, 153, 153, 153, 153,
+ 153, 153, 153, 153, 153, 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, 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 yyconst flex_int16_t yy_chk[426] =
+static yyconst flex_int16_t yy_chk[439] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -539,45 +540,46 @@ static yyconst flex_int16_t yy_chk[426] =
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,
+ 16, 18, 19, 6, 83, 21, 24, 7, 45, 20,
+ 22, 20, 41, 22, 23, 29, 25, 15, 25, 12,
+
+ 20, 23, 16, 18, 19, 26, 6, 21, 24, 25,
+ 7, 20, 22, 20, 26, 22, 27, 23, 29, 25,
+ 30, 25, 20, 23, 28, 40, 27, 28, 26, 31,
+ 51, 25, 52, 30, 53, 31, 26, 32, 32, 27,
+ 36, 36, 38, 30, 11, 38, 28, 40, 27, 28,
+ 46, 46, 31, 51, 52, 30, 53, 31, 9, 38,
+ 32, 32, 33, 33, 33, 33, 34, 34, 34, 34,
+ 35, 35, 35, 35, 37, 37, 37, 37, 39, 39,
+ 39, 39, 38, 54, 55, 56, 57, 3, 58, 61,
+ 62, 63, 64, 123, 65, 39, 123, 66, 67, 70,
+
+ 0, 71, 72, 73, 74, 54, 75, 55, 56, 57,
+ 58, 61, 62, 77, 63, 64, 65, 78, 39, 66,
+ 67, 87, 70, 71, 72, 73, 81, 74, 85, 75,
+ 79, 79, 79, 79, 86, 89, 77, 90, 91, 78,
+ 80, 80, 80, 80, 87, 92, 93, 94, 81, 95,
+ 85, 96, 0, 97, 99, 101, 86, 89, 103, 90,
+ 104, 91, 105, 104, 106, 107, 108, 92, 93, 94,
+ 112, 95, 113, 117, 96, 97, 99, 116, 101, 118,
+ 103, 120, 121, 125, 105, 104, 122, 106, 107, 108,
+ 128, 127, 130, 112, 127, 113, 117, 132, 146, 116,
+
+ 134, 135, 118, 136, 120, 121, 125, 104, 122, 137,
+ 140, 142, 137, 128, 130, 139, 143, 147, 139, 149,
+ 132, 146, 134, 135, 0, 136, 0, 0, 0, 0,
+ 0, 0, 140, 142, 0, 0, 139, 0, 143, 147,
+ 0, 149, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 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, 153, 153, 153, 153, 153
} ;
static yy_state_type yy_last_accepting_state;
@@ -642,7 +644,7 @@ static void countnl() {
g_lingo->_colnumber = strlen(p);
}
-#line 646 "engines/director/lingo/lingo-lex.cpp"
+#line 648 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -830,7 +832,7 @@ YY_DECL
#line 60 "engines/director/lingo/lingo-lex.l"
-#line 834 "engines/director/lingo/lingo-lex.cpp"
+#line 836 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -890,7 +892,7 @@ yy_match:
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 367 );
+ while ( yy_base[yy_current_state] != 380 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -1076,52 +1078,64 @@ YY_RULE_SETUP
while (*ptr == ' ' || *ptr == '\t')
ptr++;
- return tTHEN;
+ if (g_lingo->_theEntities.contains(ptr)) {
+ yylval.i = g_lingo->_theEntities[ptr]->entity;
+
+ if (g_lingo->_theEntities[ptr]->hasId)
+ return THEENTITYWITHID;
+ else
+ return THEENTITY;
+ } else if (g_lingo->_theEntityFields.contains(ptr)) {
+ yylval.i = g_lingo->_theEntityFields[ptr]->field;
+ return THEFIELD;
+ }
+
+ error("Unhandled the entity %s", ptr);
}
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 102 "engines/director/lingo/lingo-lex.l"
+#line 114 "engines/director/lingo/lingo-lex.l"
{ count(); return tTHEN; }
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 103 "engines/director/lingo/lingo-lex.l"
+#line 115 "engines/director/lingo/lingo-lex.l"
{ count(); return tTO; }
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 104 "engines/director/lingo/lingo-lex.l"
+#line 116 "engines/director/lingo/lingo-lex.l"
{ count(); return tWITH; }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 105 "engines/director/lingo/lingo-lex.l"
+#line 117 "engines/director/lingo/lingo-lex.l"
{ count(); return tWHILE; }
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 107 "engines/director/lingo/lingo-lex.l"
+#line 119 "engines/director/lingo/lingo-lex.l"
{ count(); return tNEQ; }
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 108 "engines/director/lingo/lingo-lex.l"
+#line 120 "engines/director/lingo/lingo-lex.l"
{ count(); return tGE; }
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 109 "engines/director/lingo/lingo-lex.l"
+#line 121 "engines/director/lingo/lingo-lex.l"
{ count(); return tLE; }
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 110 "engines/director/lingo/lingo-lex.l"
+#line 122 "engines/director/lingo/lingo-lex.l"
{ count(); return tCONCAT; }
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 112 "engines/director/lingo/lingo-lex.l"
+#line 124 "engines/director/lingo/lingo-lex.l"
{
count();
yylval.s = new Common::String(yytext);
@@ -1134,41 +1148,41 @@ YY_RULE_SETUP
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 121 "engines/director/lingo/lingo-lex.l"
+#line 133 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 122 "engines/director/lingo/lingo-lex.l"
+#line 134 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 123 "engines/director/lingo/lingo-lex.l"
+#line 135 "engines/director/lingo/lingo-lex.l"
{ count(); return *yytext; }
YY_BREAK
case 44:
/* rule 44 can match eol */
YY_RULE_SETUP
-#line 124 "engines/director/lingo/lingo-lex.l"
+#line 136 "engines/director/lingo/lingo-lex.l"
{ return '\n'; }
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 125 "engines/director/lingo/lingo-lex.l"
+#line 137 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 126 "engines/director/lingo/lingo-lex.l"
+#line 138 "engines/director/lingo/lingo-lex.l"
YY_BREAK
case 47:
YY_RULE_SETUP
-#line 128 "engines/director/lingo/lingo-lex.l"
+#line 140 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1172 "engines/director/lingo/lingo-lex.cpp"
+#line 1186 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -2168,7 +2182,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 128 "engines/director/lingo/lingo-lex.l"
+#line 140 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 40f66a6..1f1cd76 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -90,14 +90,26 @@ whitespace [\t ]
(?i:repeat) { count(); return tREPEAT; }
(?i:set) { count(); return tSET; }
(?i:starts) { count(); return tSTARTS; }
-(?i:the[ \t]+[:alpha:]+) {
+(?i:the[ \t]+[[:alpha:]]+) {
count();
const char *ptr = &yytext[4]; // Skip 'the '
while (*ptr == ' ' || *ptr == '\t')
ptr++;
- return tTHEN;
+ if (g_lingo->_theEntities.contains(ptr)) {
+ yylval.i = g_lingo->_theEntities[ptr]->entity;
+
+ if (g_lingo->_theEntities[ptr]->hasId)
+ return THEENTITYWITHID;
+ else
+ return THEENTITY;
+ } else if (g_lingo->_theEntityFields.contains(ptr)) {
+ yylval.i = g_lingo->_theEntityFields[ptr]->field;
+ return THEFIELD;
+ }
+
+ error("Unhandled the entity %s", ptr);
}
(?i:then) { count(); return tTHEN; }
(?i:to) { count(); return tTO; }
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index b631732..8680426 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -27,48 +27,48 @@ namespace Director {
class Sprite;
TheEntity entities[] = {
- { kTheCast, "cast", INT }, // string?
- { kTheClickOn, "clickOn", VOID },
- { kTheColorDepth, "colorDepth", VOID },
- { kTheColorQD, "colorQD", VOID },
- { kTheCommandDown, "commandDown", VOID },
- { kTheControlDown, "controlDown", VOID },
- { kTheDoubleClick, "doubleClick", VOID },
- { kTheExitLock, "exitlock", VOID },
- { kTheFloatPrecision, "floatPrecision", VOID },
- { kTheFrame, "frame", VOID },
- { kTheItemDelimiter, "itemDelimiter", VOID },
- { kTheKey, "key", VOID },
- { kTheLastClick, "lastClick", VOID },
- { kTheLastEvent, "lastEvent", VOID },
- { kTheLastFrame, "lastFrame", VOID },
- { kTheMenu, "menu", INT },
- { kTheMenus, "menus", VOID },
- { kTheMenuItem, "menuitem", STRING }, // int?
- { kTheMenuItems, "menuitems", VOID },
- { kTheMouseDown, "mouseDown", VOID },
- { kTheMouseDownScript, "mouseDownScript", VOID },
- { kTheMouseH, "mouseh", VOID },
- { kTheMouseUp, "mouseUp", VOID },
- { kTheMouseUpScript, "mouseUpScript", VOID },
- { kTheMouseV, "mousev", VOID },
- { kTheMovie, "movie", VOID },
- { kTheMultiSound, "multiSound", VOID },
- { kTheOptionDown, "optionDown", VOID },
- { kThePathName, "pathname", VOID },
- { kThePerFrameHook, "perframehook", VOID },
- { kThePreloadEventAbort,"preloadEventAbort",VOID },
- { kTheRightMouseDown, "rightMouseDown", VOID },
- { kTheRightMouseUp, "rightMouseUp", VOID },
- { kTheRomanLingo, "romanLingo", VOID },
- { kTheShiftDown, "shiftDown", VOID },
- { kTheSprite, "sprite", INT },
- { kTheStage, "stage", VOID },
- { kTheStillDown, "stillDown", VOID },
- { kTheTicks, "ticks", VOID },
- { kTheTimeoutLength, "timeoutlength", VOID },
- { kTheTimer, "timer", VOID },
- { kTheWindow, "window", VOID },
+ { kTheCast, "cast", true },
+ { kTheClickOn, "clickOn", false },
+ { kTheColorDepth, "colorDepth", false },
+ { kTheColorQD, "colorQD", false },
+ { kTheCommandDown, "commandDown", false },
+ { kTheControlDown, "controlDown", false },
+ { kTheDoubleClick, "doubleClick", false },
+ { kTheExitLock, "exitlock", false },
+ { kTheFloatPrecision, "floatPrecision", false },
+ { kTheFrame, "frame", false },
+ { kTheItemDelimiter, "itemDelimiter", false },
+ { kTheKey, "key", false },
+ { kTheLastClick, "lastClick", false },
+ { kTheLastEvent, "lastEvent", false },
+ { kTheLastFrame, "lastFrame", false },
+ { kTheMenu, "menu", true },
+ { kTheMenus, "menus", false },
+ { kTheMenuItem, "menuitem", true },
+ { kTheMenuItems, "menuitems", false },
+ { kTheMouseDown, "mouseDown", false },
+ { kTheMouseDownScript, "mouseDownScript", false },
+ { kTheMouseH, "mouseh", false },
+ { kTheMouseUp, "mouseUp", false },
+ { kTheMouseUpScript, "mouseUpScript", false },
+ { kTheMouseV, "mousev", false },
+ { kTheMovie, "movie", false },
+ { kTheMultiSound, "multiSound", false },
+ { kTheOptionDown, "optionDown", false },
+ { kThePathName, "pathname", false },
+ { kThePerFrameHook, "perframehook", false },
+ { kThePreloadEventAbort,"preloadEventAbort",false },
+ { kTheRightMouseDown, "rightMouseDown", false },
+ { kTheRightMouseUp, "rightMouseUp", false },
+ { kTheRomanLingo, "romanLingo", false },
+ { kTheShiftDown, "shiftDown", false },
+ { kTheSprite, "sprite", true },
+ { kTheStage, "stage", false },
+ { kTheStillDown, "stillDown", false },
+ { kTheTicks, "ticks", false },
+ { kTheTimeoutLength, "timeoutlength", false },
+ { kTheTimer, "timer", false },
+ { kTheWindow, "window", false },
{ kTheNOEntity, NULL, false }
};
@@ -173,7 +173,7 @@ void Lingo::initTheEntities() {
}
}
-void Lingo::setTheEntity(TheEntityType entity, int id, TheFieldType field, Datum &d) {
+void Lingo::setTheEntity(int entity, int id, int field, Datum &d) {
switch (entity) {
case kTheSprite:
setTheSprite(id, field, d);
@@ -184,14 +184,15 @@ void Lingo::setTheEntity(TheEntityType entity, int id, TheFieldType field, Datum
case kTheFloatPrecision:
_floatPrecision = d.toInt();
_floatPrecision = MAX(0, MIN(_floatPrecision, 19)); // 0 to 19
- _floatPrecisionFormat.format("%%.%df", _floatPrecision);
+ _floatPrecisionFormat = Common::String::format("%%.%df", _floatPrecision);
+ warning("set to %d: %s", _floatPrecision, _floatPrecisionFormat.c_str());
break;
default:
error("Unprocessed setting field %d of entity %d", field, entity);
}
}
-void Lingo::setTheSprite(int id, TheFieldType field, Datum &d) {
+void Lingo::setTheSprite(int id, int field, Datum &d) {
Sprite *sprite = _vm->_currentScore->getSpriteById(id);
d.toInt(); // Enforce Integer
@@ -230,7 +231,7 @@ void Lingo::setTheSprite(int id, TheFieldType field, Datum &d) {
}
}
-Datum Lingo::getTheEntity(TheEntityType entity, int id, TheFieldType field) {
+Datum Lingo::getTheEntity(int entity, int id, int field) {
Datum d;
switch (entity) {
@@ -253,7 +254,7 @@ Datum Lingo::getTheEntity(TheEntityType entity, int id, TheFieldType field) {
return d;
}
-Datum Lingo::getTheSprite(int id, TheFieldType field) {
+Datum Lingo::getTheSprite(int id, int field) {
Datum d;
Sprite *sprite = _vm->_currentScore->getSpriteById(id);
@@ -291,7 +292,7 @@ Datum Lingo::getTheSprite(int id, TheFieldType field) {
return d;
}
-Datum Lingo::getTheCast(int id, TheFieldType field) {
+Datum Lingo::getTheCast(int id, int field) {
Datum d;
d.type = INT;
@@ -343,7 +344,7 @@ Datum Lingo::getTheCast(int id, TheFieldType field) {
}
}
-void Lingo::setTheCast(int id, TheFieldType field, Datum &d) {
+void Lingo::setTheCast(int id, int 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 c867b8d..806c295 100644
--- a/engines/director/lingo/lingo-the.h
+++ b/engines/director/lingo/lingo-the.h
@@ -138,7 +138,7 @@ enum TheFieldType {
struct TheEntity {
TheEntityType entity;
const char *name;
- int idType;
+ bool hasId;
};
struct TheEntityField {
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 7c7f51e..ccbb668 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -82,6 +82,7 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
_eventHandlerTypes[t->handler] = t->name;
initBuiltIns();
+ initTheEntities();
_currentScript = 0;
_currentScriptType = kMovieScript;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 5dc6c07..f1fc96a 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -206,6 +206,10 @@ public:
static void c_assign();
bool verify(Symbol *s);
static void c_eval();
+
+ static void c_theentitypush();
+ static void c_theentityassign();
+
static void c_repeatwhilecode();
static void c_repeatwithcode();
static void c_ifcode();
@@ -251,12 +255,12 @@ public:
void func_gotoprevious();
public:
- 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);
+ void setTheEntity(int entity, int id, int field, Datum &d);
+ void setTheSprite(int id, int field, Datum &d);
+ void setTheCast(int id, int field, Datum &d);
+ Datum getTheEntity(int entity, int id, int field);
+ Datum getTheSprite(int id, int field);
+ Datum getTheCast(int id, int field);
public:
ScriptData *_currentScript;
diff --git a/engines/director/lingo/tests/the.lingo b/engines/director/lingo/tests/the.lingo
new file mode 100644
index 0000000..fbfbebd
--- /dev/null
+++ b/engines/director/lingo/tests/the.lingo
@@ -0,0 +1,3 @@
+put 1.0 / 3
+set the floatPrecision to 6
+put 1.0 / 3
Commit: 9763b62a78ba51b328fe336926a40fa0ffdde0be
https://github.com/scummvm/scummvm/commit/9763b62a78ba51b328fe336926a40fa0ffdde0be
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implement getting the entity fields
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo-the.cpp
engines/director/lingo/lingo.h
engines/director/lingo/tests/the.lingo
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 16bd7db..5b72345 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -221,11 +221,10 @@ void Lingo::c_eval() {
void Lingo::c_theentitypush() {
inst e = (*g_lingo->_currentScript)[g_lingo->_pc++];
inst f = (*g_lingo->_currentScript)[g_lingo->_pc++];
- inst i = (*g_lingo->_currentScript)[g_lingo->_pc++];
+ Datum id = g_lingo->pop();
int entity = READ_UINT32(&e);
int field = READ_UINT32(&f);
- int id = READ_UINT32(&i);
Datum d = g_lingo->getTheEntity(entity, id, field);
g_lingo->push(d);
@@ -234,14 +233,15 @@ void Lingo::c_theentitypush() {
void Lingo::c_theentityassign() {
inst e = (*g_lingo->_currentScript)[g_lingo->_pc++];
inst f = (*g_lingo->_currentScript)[g_lingo->_pc++];
- inst i = (*g_lingo->_currentScript)[g_lingo->_pc++];
+ Datum id = g_lingo->pop();
int entity = READ_UINT32(&e);
int field = READ_UINT32(&f);
- int id = READ_UINT32(&i);
Datum d = g_lingo->pop();
g_lingo->setTheEntity(entity, id, field, d);
+
+ g_lingo->push(d); // Dummy value
}
void Lingo::c_add() {
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 75bbfa3..d3a8892 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -73,50 +73,49 @@
INT = 262,
THEENTITY = 263,
THEENTITYWITHID = 264,
- THEFIELD = 265,
- FLOAT = 266,
- BLTIN = 267,
- ID = 268,
- STRING = 269,
- HANDLER = 270,
- tDOWN = 271,
- tELSE = 272,
- tNLELSIF = 273,
- tEND = 274,
- tEXIT = 275,
- tFRAME = 276,
- tGLOBAL = 277,
- tGO = 278,
- tIF = 279,
- tINTO = 280,
- tLOOP = 281,
- tMACRO = 282,
- tMCI = 283,
- tMCIWAIT = 284,
- tMOVIE = 285,
- tNEXT = 286,
- tOF = 287,
- tPREVIOUS = 288,
- tPUT = 289,
- tREPEAT = 290,
- tSET = 291,
- tTHEN = 292,
- tTO = 293,
- tWITH = 294,
- tWHILE = 295,
- tNLELSE = 296,
- tGE = 297,
- tLE = 298,
- tGT = 299,
- tLT = 300,
- tEQ = 301,
- tNEQ = 302,
- tAND = 303,
- tOR = 304,
- tNOT = 305,
- tCONCAT = 306,
- tCONTAINS = 307,
- tSTARTS = 308
+ FLOAT = 265,
+ BLTIN = 266,
+ ID = 267,
+ STRING = 268,
+ HANDLER = 269,
+ tDOWN = 270,
+ tELSE = 271,
+ tNLELSIF = 272,
+ tEND = 273,
+ tEXIT = 274,
+ tFRAME = 275,
+ tGLOBAL = 276,
+ tGO = 277,
+ tIF = 278,
+ tINTO = 279,
+ tLOOP = 280,
+ tMACRO = 281,
+ tMCI = 282,
+ tMCIWAIT = 283,
+ tMOVIE = 284,
+ tNEXT = 285,
+ tOF = 286,
+ tPREVIOUS = 287,
+ tPUT = 288,
+ tREPEAT = 289,
+ tSET = 290,
+ tTHEN = 291,
+ tTO = 292,
+ tWITH = 293,
+ tWHILE = 294,
+ tNLELSE = 295,
+ tGE = 296,
+ tLE = 297,
+ tGT = 298,
+ tLT = 299,
+ tEQ = 300,
+ tNEQ = 301,
+ tAND = 302,
+ tOR = 303,
+ tNOT = 304,
+ tCONCAT = 305,
+ tCONTAINS = 306,
+ tSTARTS = 307
};
#endif
/* Tokens. */
@@ -127,50 +126,49 @@
#define INT 262
#define THEENTITY 263
#define THEENTITYWITHID 264
-#define THEFIELD 265
-#define FLOAT 266
-#define BLTIN 267
-#define ID 268
-#define STRING 269
-#define HANDLER 270
-#define tDOWN 271
-#define tELSE 272
-#define tNLELSIF 273
-#define tEND 274
-#define tEXIT 275
-#define tFRAME 276
-#define tGLOBAL 277
-#define tGO 278
-#define tIF 279
-#define tINTO 280
-#define tLOOP 281
-#define tMACRO 282
-#define tMCI 283
-#define tMCIWAIT 284
-#define tMOVIE 285
-#define tNEXT 286
-#define tOF 287
-#define tPREVIOUS 288
-#define tPUT 289
-#define tREPEAT 290
-#define tSET 291
-#define tTHEN 292
-#define tTO 293
-#define tWITH 294
-#define tWHILE 295
-#define tNLELSE 296
-#define tGE 297
-#define tLE 298
-#define tGT 299
-#define tLT 300
-#define tEQ 301
-#define tNEQ 302
-#define tAND 303
-#define tOR 304
-#define tNOT 305
-#define tCONCAT 306
-#define tCONTAINS 307
-#define tSTARTS 308
+#define FLOAT 265
+#define BLTIN 266
+#define ID 267
+#define STRING 268
+#define HANDLER 269
+#define tDOWN 270
+#define tELSE 271
+#define tNLELSIF 272
+#define tEND 273
+#define tEXIT 274
+#define tFRAME 275
+#define tGLOBAL 276
+#define tGO 277
+#define tIF 278
+#define tINTO 279
+#define tLOOP 280
+#define tMACRO 281
+#define tMCI 282
+#define tMCIWAIT 283
+#define tMOVIE 284
+#define tNEXT 285
+#define tOF 286
+#define tPREVIOUS 287
+#define tPUT 288
+#define tREPEAT 289
+#define tSET 290
+#define tTHEN 291
+#define tTO 292
+#define tWITH 293
+#define tWHILE 294
+#define tNLELSE 295
+#define tGE 296
+#define tLE 297
+#define tGT 298
+#define tLT 299
+#define tEQ 300
+#define tNEQ 301
+#define tAND 302
+#define tOR 303
+#define tNOT 304
+#define tCONCAT 305
+#define tCONTAINS 306
+#define tSTARTS 307
@@ -222,11 +220,12 @@ typedef union YYSTYPE
Common::String *s;
int i;
double f;
+ int e[2]; // Entity + field
int code;
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 230 "engines/director/lingo/lingo-gr.cpp"
+#line 229 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -239,7 +238,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 243 "engines/director/lingo/lingo-gr.cpp"
+#line 242 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -452,22 +451,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 67
+#define YYFINAL 69
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 573
+#define YYLAST 599
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 67
+#define YYNTOKENS 66
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 33
/* YYNRULES -- Number of rules. */
-#define YYNRULES 109
+#define YYNRULES 110
/* YYNRULES -- Number of states. */
-#define YYNSTATES 229
+#define YYNSTATES 231
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 308
+#define YYMAXUTOK 307
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -476,12 +475,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 60, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 59, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 59, 65, 2,
- 61, 62, 57, 55, 66, 56, 2, 58, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 58, 64, 2,
+ 60, 61, 56, 54, 65, 55, 2, 57, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 64, 54, 63, 2, 2, 2, 2, 2, 2, 2,
+ 63, 53, 62, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -505,7 +504,7 @@ static const yytype_uint8 yytranslate[] =
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53
+ 45, 46, 47, 48, 49, 50, 51, 52
};
#if YYDEBUG
@@ -518,74 +517,76 @@ static const yytype_uint16 yyprhs[] =
56, 58, 67, 79, 92, 101, 113, 125, 132, 143,
154, 155, 159, 162, 164, 167, 169, 176, 178, 184,
186, 190, 194, 197, 201, 203, 205, 206, 207, 208,
- 211, 214, 216, 218, 220, 225, 230, 232, 234, 236,
- 240, 244, 248, 252, 256, 260, 264, 268, 272, 276,
- 280, 283, 287, 291, 295, 299, 302, 305, 309, 312,
- 315, 318, 320, 322, 325, 327, 331, 334, 337, 340,
- 343, 347, 350, 354, 357, 360, 362, 366, 369, 373,
- 374, 383, 384, 386, 390, 395, 396, 400, 401, 403
+ 211, 214, 216, 218, 220, 225, 230, 232, 234, 237,
+ 239, 243, 247, 251, 255, 259, 263, 267, 271, 275,
+ 279, 283, 286, 290, 294, 298, 302, 305, 308, 312,
+ 315, 318, 321, 323, 325, 328, 330, 334, 337, 340,
+ 343, 346, 350, 353, 357, 360, 363, 365, 369, 372,
+ 376, 377, 386, 387, 389, 393, 398, 399, 403, 404,
+ 406
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 68, 0, -1, 68, 69, 70, -1, 70, -1, 1,
- 60, -1, 60, -1, -1, 94, -1, 89, -1, 98,
- -1, 71, -1, 73, -1, 34, 88, 25, 13, -1,
- 36, 13, 54, 88, -1, 36, 8, 54, 88, -1,
- 36, 13, 38, 88, -1, 36, 8, 38, 88, -1,
- 88, -1, 89, -1, 72, -1, 74, -1, 81, 61,
- 80, 62, 87, 86, 19, 35, -1, 82, 54, 88,
- 86, 38, 88, 86, 87, 86, 19, 35, -1, 82,
- 54, 88, 86, 16, 38, 88, 86, 87, 86, 19,
- 35, -1, 83, 80, 37, 69, 87, 86, 19, 24,
- -1, 83, 80, 37, 69, 87, 86, 41, 87, 86,
- 19, 24, -1, 83, 80, 37, 69, 87, 86, 85,
- 76, 86, 19, 24, -1, 83, 80, 37, 85, 72,
- 86, -1, 83, 80, 37, 85, 72, 86, 41, 85,
- 72, 86, -1, 83, 80, 37, 85, 72, 86, 77,
- 86, 75, 86, -1, -1, 41, 85, 72, -1, 76,
- 79, -1, 79, -1, 77, 78, -1, 78, -1, 84,
- 80, 37, 85, 73, 86, -1, 77, -1, 84, 80,
- 37, 87, 86, -1, 88, -1, 88, 54, 88, -1,
- 61, 80, 62, -1, 35, 40, -1, 35, 39, 13,
- -1, 24, -1, 18, -1, -1, -1, -1, 87, 69,
- -1, 87, 73, -1, 7, -1, 11, -1, 14, -1,
- 12, 61, 99, 62, -1, 13, 61, 99, 62, -1,
- 13, -1, 8, -1, 71, -1, 88, 55, 88, -1,
- 88, 56, 88, -1, 88, 57, 88, -1, 88, 58,
- 88, -1, 88, 63, 88, -1, 88, 64, 88, -1,
- 88, 47, 88, -1, 88, 42, 88, -1, 88, 43,
- 88, -1, 88, 48, 88, -1, 88, 49, 88, -1,
- 50, 88, -1, 88, 65, 88, -1, 88, 51, 88,
- -1, 88, 52, 88, -1, 88, 53, 88, -1, 55,
- 88, -1, 56, 88, -1, 61, 88, 62, -1, 28,
- 14, -1, 29, 13, -1, 34, 88, -1, 91, -1,
- 20, -1, 22, 90, -1, 13, -1, 90, 66, 13,
- -1, 23, 26, -1, 23, 31, -1, 23, 33, -1,
- 23, 92, -1, 23, 92, 93, -1, 23, 93, -1,
- 38, 21, 14, -1, 21, 14, -1, 38, 14, -1,
- 14, -1, 32, 30, 14, -1, 30, 14, -1, 38,
- 30, 14, -1, -1, 27, 13, 95, 85, 96, 69,
- 97, 87, -1, -1, 13, -1, 96, 66, 13, -1,
- 96, 69, 66, 13, -1, -1, 13, 85, 99, -1,
- -1, 88, -1, 99, 66, 88, -1
+ 67, 0, -1, 67, 68, 69, -1, 69, -1, 1,
+ 59, -1, 59, -1, -1, 93, -1, 88, -1, 97,
+ -1, 70, -1, 72, -1, 33, 87, 24, 12, -1,
+ 35, 12, 53, 87, -1, 35, 8, 53, 87, -1,
+ 35, 12, 37, 87, -1, 35, 8, 37, 87, -1,
+ 87, -1, 88, -1, 71, -1, 73, -1, 80, 60,
+ 79, 61, 86, 85, 18, 34, -1, 81, 53, 87,
+ 85, 37, 87, 85, 86, 85, 18, 34, -1, 81,
+ 53, 87, 85, 15, 37, 87, 85, 86, 85, 18,
+ 34, -1, 82, 79, 36, 68, 86, 85, 18, 23,
+ -1, 82, 79, 36, 68, 86, 85, 40, 86, 85,
+ 18, 23, -1, 82, 79, 36, 68, 86, 85, 84,
+ 75, 85, 18, 23, -1, 82, 79, 36, 84, 71,
+ 85, -1, 82, 79, 36, 84, 71, 85, 40, 84,
+ 71, 85, -1, 82, 79, 36, 84, 71, 85, 76,
+ 85, 74, 85, -1, -1, 40, 84, 71, -1, 75,
+ 78, -1, 78, -1, 76, 77, -1, 77, -1, 83,
+ 79, 36, 84, 72, 85, -1, 76, -1, 83, 79,
+ 36, 86, 85, -1, 87, -1, 87, 53, 87, -1,
+ 60, 79, 61, -1, 34, 39, -1, 34, 38, 12,
+ -1, 23, -1, 17, -1, -1, -1, -1, 86, 68,
+ -1, 86, 72, -1, 7, -1, 10, -1, 13, -1,
+ 11, 60, 98, 61, -1, 12, 60, 98, 61, -1,
+ 12, -1, 8, -1, 9, 87, -1, 70, -1, 87,
+ 54, 87, -1, 87, 55, 87, -1, 87, 56, 87,
+ -1, 87, 57, 87, -1, 87, 62, 87, -1, 87,
+ 63, 87, -1, 87, 46, 87, -1, 87, 41, 87,
+ -1, 87, 42, 87, -1, 87, 47, 87, -1, 87,
+ 48, 87, -1, 49, 87, -1, 87, 64, 87, -1,
+ 87, 50, 87, -1, 87, 51, 87, -1, 87, 52,
+ 87, -1, 54, 87, -1, 55, 87, -1, 60, 87,
+ 61, -1, 27, 13, -1, 28, 12, -1, 33, 87,
+ -1, 90, -1, 19, -1, 21, 89, -1, 12, -1,
+ 89, 65, 12, -1, 22, 25, -1, 22, 30, -1,
+ 22, 32, -1, 22, 91, -1, 22, 91, 92, -1,
+ 22, 92, -1, 37, 20, 13, -1, 20, 13, -1,
+ 37, 13, -1, 13, -1, 31, 29, 13, -1, 29,
+ 13, -1, 37, 29, 13, -1, -1, 26, 12, 94,
+ 84, 95, 68, 96, 86, -1, -1, 12, -1, 95,
+ 65, 12, -1, 95, 68, 65, 12, -1, -1, 12,
+ 84, 98, -1, -1, 87, -1, 98, 65, 87, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 98, 98, 99, 100, 103, 108, 109, 110, 111,
- 112, 113, 116, 122, 128, 136, 142, 150, 151, 153,
- 154, 159, 170, 186, 200, 207, 216, 225, 235, 245,
- 256, 257, 260, 261, 264, 265, 268, 276, 277, 285,
- 286, 287, 289, 291, 297, 303, 310, 312, 314, 315,
- 316, 319, 324, 327, 330, 336, 344, 347, 354, 355,
- 356, 357, 358, 359, 360, 361, 362, 363, 364, 365,
- 366, 367, 368, 369, 370, 371, 372, 373, 376, 377,
- 378, 379, 380, 382, 385, 386, 397, 398, 399, 400,
- 405, 411, 418, 419, 420, 421, 424, 425, 426, 454,
- 454, 461, 462, 463, 464, 466, 469, 477, 478, 479
+ 0, 100, 100, 101, 102, 105, 110, 111, 112, 113,
+ 114, 115, 118, 124, 130, 138, 144, 153, 154, 156,
+ 157, 162, 173, 189, 203, 210, 219, 228, 238, 248,
+ 259, 260, 263, 264, 267, 268, 271, 279, 280, 288,
+ 289, 290, 292, 294, 300, 306, 313, 315, 317, 318,
+ 319, 322, 327, 330, 333, 339, 347, 350, 357, 363,
+ 364, 365, 366, 367, 368, 369, 370, 371, 372, 373,
+ 374, 375, 376, 377, 378, 379, 380, 381, 382, 385,
+ 386, 387, 388, 389, 391, 394, 395, 406, 407, 408,
+ 409, 414, 420, 427, 428, 429, 430, 433, 434, 435,
+ 463, 463, 470, 471, 472, 473, 475, 478, 486, 487,
+ 488
};
#endif
@@ -595,20 +596,19 @@ static const yytype_uint16 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "CASTREF", "UNARY", "VOID", "VAR", "INT",
- "THEENTITY", "THEENTITYWITHID", "THEFIELD", "FLOAT", "BLTIN", "ID",
- "STRING", "HANDLER", "tDOWN", "tELSE", "tNLELSIF", "tEND", "tEXIT",
- "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI",
- "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT",
- "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tNLELSE", "tGE", "tLE",
- "tGT", "tLT", "tEQ", "tNEQ", "tAND", "tOR", "tNOT", "tCONCAT",
- "tCONTAINS", "tSTARTS", "'='", "'+'", "'-'", "'*'", "'/'", "'%'",
- "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','", "$accept", "program",
- "nl", "programline", "asgn", "stmtoneliner", "stmt", "ifstmt",
- "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
- "elseifstmtoneliner1", "elseifstmt1", "cond", "repeatwhile",
- "repeatwith", "if", "elseif", "begin", "end", "stmtlist", "expr", "func",
- "globallist", "gotofunc", "gotoframe", "gotomovie", "defn", "@1",
- "argdef", "argstore", "macro", "arglist", 0
+ "THEENTITY", "THEENTITYWITHID", "FLOAT", "BLTIN", "ID", "STRING",
+ "HANDLER", "tDOWN", "tELSE", "tNLELSIF", "tEND", "tEXIT", "tFRAME",
+ "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT",
+ "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT", "tSET",
+ "tTHEN", "tTO", "tWITH", "tWHILE", "tNLELSE", "tGE", "tLE", "tGT", "tLT",
+ "tEQ", "tNEQ", "tAND", "tOR", "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS",
+ "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'",
+ "'<'", "'&'", "','", "$accept", "program", "nl", "programline", "asgn",
+ "stmtoneliner", "stmt", "ifstmt", "elsestmtoneliner", "elseifstmt",
+ "elseifstmtoneliner", "elseifstmtoneliner1", "elseifstmt1", "cond",
+ "repeatwhile", "repeatwith", "if", "elseif", "begin", "end", "stmtlist",
+ "expr", "func", "globallist", "gotofunc", "gotoframe", "gotomovie",
+ "defn", "@1", "argdef", "argstore", "macro", "arglist", 0
};
#endif
@@ -622,25 +622,26 @@ static const yytype_uint16 yytoknum[] =
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 308, 61, 43, 45, 42, 47, 37,
- 10, 40, 41, 62, 60, 38, 44
+ 305, 306, 307, 61, 43, 45, 42, 47, 37, 10,
+ 40, 41, 62, 60, 38, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 67, 68, 68, 68, 69, 70, 70, 70, 70,
- 70, 70, 71, 71, 71, 71, 71, 72, 72, 73,
- 73, 73, 73, 73, 74, 74, 74, 74, 74, 74,
- 75, 75, 76, 76, 77, 77, 78, 79, 79, 80,
- 80, 80, 81, 82, 83, 84, 85, 86, 87, 87,
- 87, 88, 88, 88, 88, 88, 88, 88, 88, 88,
- 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
- 88, 88, 88, 88, 88, 88, 88, 88, 89, 89,
- 89, 89, 89, 89, 90, 90, 91, 91, 91, 91,
- 91, 91, 92, 92, 92, 92, 93, 93, 93, 95,
- 94, 96, 96, 96, 96, 97, 98, 99, 99, 99
+ 0, 66, 67, 67, 67, 68, 69, 69, 69, 69,
+ 69, 69, 70, 70, 70, 70, 70, 71, 71, 72,
+ 72, 72, 72, 72, 73, 73, 73, 73, 73, 73,
+ 74, 74, 75, 75, 76, 76, 77, 78, 78, 79,
+ 79, 79, 80, 81, 82, 83, 84, 85, 86, 86,
+ 86, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 88,
+ 88, 88, 88, 88, 88, 89, 89, 90, 90, 90,
+ 90, 90, 90, 91, 91, 91, 91, 92, 92, 92,
+ 94, 93, 95, 95, 95, 95, 96, 97, 98, 98,
+ 98
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -651,12 +652,13 @@ static const yytype_uint8 yyr2[] =
1, 8, 11, 12, 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, 4, 1, 1, 1, 3,
+ 2, 1, 1, 1, 4, 4, 1, 1, 2, 1,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 2, 3, 3, 3, 3, 2, 2, 3, 2, 2,
- 2, 1, 1, 2, 1, 3, 2, 2, 2, 2,
- 3, 2, 3, 2, 2, 1, 3, 2, 3, 0,
- 8, 0, 1, 3, 4, 0, 3, 0, 1, 3
+ 3, 2, 3, 3, 3, 3, 2, 2, 3, 2,
+ 2, 2, 1, 1, 2, 1, 3, 2, 2, 2,
+ 2, 3, 2, 3, 2, 2, 1, 3, 2, 3,
+ 0, 8, 0, 1, 3, 4, 0, 3, 0, 1,
+ 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -664,77 +666,79 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 0, 51, 57, 52, 0, 46, 53, 82, 0,
- 0, 44, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 3, 58, 19, 11, 20, 0, 0,
- 0, 17, 8, 81, 7, 9, 4, 107, 107, 107,
- 84, 83, 95, 0, 86, 0, 87, 0, 88, 0,
- 89, 91, 99, 78, 79, 56, 0, 58, 80, 0,
- 42, 0, 0, 70, 75, 76, 0, 1, 5, 6,
- 0, 0, 0, 0, 39, 0, 0, 0, 0, 0,
+ 0, 0, 51, 57, 0, 52, 0, 46, 53, 83,
+ 0, 0, 44, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 59, 19, 11, 20, 0,
+ 0, 0, 17, 8, 82, 7, 9, 4, 56, 0,
+ 59, 58, 108, 108, 108, 85, 84, 96, 0, 87,
+ 0, 88, 0, 89, 0, 90, 92, 100, 79, 80,
+ 81, 0, 42, 0, 0, 71, 76, 77, 0, 1,
+ 5, 6, 0, 0, 0, 0, 39, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 108, 0, 0, 106, 0, 93, 97, 0, 94, 0,
- 0, 0, 90, 46, 0, 0, 43, 0, 0, 0,
- 0, 77, 2, 0, 47, 0, 0, 46, 0, 66,
- 67, 65, 68, 69, 72, 73, 74, 59, 60, 61,
- 62, 63, 64, 71, 54, 0, 55, 85, 96, 92,
- 98, 101, 12, 16, 14, 15, 13, 48, 0, 41,
- 48, 0, 40, 109, 102, 0, 47, 0, 0, 47,
- 47, 18, 0, 105, 49, 50, 0, 0, 47, 46,
- 27, 103, 0, 48, 0, 47, 48, 0, 48, 0,
- 45, 46, 47, 35, 0, 104, 100, 21, 48, 47,
- 24, 47, 47, 37, 33, 0, 0, 34, 30, 0,
- 47, 0, 0, 32, 0, 0, 47, 46, 47, 46,
- 0, 0, 0, 0, 46, 28, 0, 29, 0, 0,
- 22, 25, 26, 47, 31, 47, 23, 38, 36
+ 0, 0, 0, 109, 0, 0, 107, 0, 94, 98,
+ 0, 95, 0, 0, 0, 91, 46, 0, 43, 0,
+ 0, 0, 0, 78, 2, 0, 47, 0, 0, 46,
+ 0, 67, 68, 66, 69, 70, 73, 74, 75, 60,
+ 61, 62, 63, 64, 65, 72, 54, 0, 55, 86,
+ 97, 93, 99, 102, 12, 16, 14, 15, 13, 48,
+ 0, 41, 48, 0, 40, 110, 103, 0, 47, 0,
+ 0, 47, 47, 18, 0, 106, 49, 50, 0, 0,
+ 47, 46, 27, 104, 0, 48, 0, 47, 48, 0,
+ 48, 0, 45, 46, 47, 35, 0, 105, 101, 21,
+ 48, 47, 24, 47, 47, 37, 33, 0, 0, 34,
+ 30, 0, 47, 0, 0, 32, 0, 0, 47, 46,
+ 47, 46, 0, 0, 0, 0, 46, 28, 0, 29,
+ 0, 0, 22, 25, 26, 47, 31, 47, 23, 38,
+ 36
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 22, 164, 23, 57, 25, 165, 27, 208, 192,
- 193, 183, 194, 73, 28, 29, 30, 184, 218, 148,
- 156, 31, 161, 41, 33, 50, 51, 34, 103, 155,
- 173, 35, 91
+ -1, 23, 166, 24, 40, 26, 167, 28, 210, 194,
+ 195, 185, 196, 75, 29, 30, 31, 186, 220, 150,
+ 158, 32, 163, 46, 34, 55, 56, 35, 106, 157,
+ 175, 36, 94
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -142
+#define YYPACT_NINF -165
static const yytype_int16 yypact[] =
{
- 138, -51, -142, -142, -142, -49, 465, -142, -142, 11,
- -1, -142, 14, 27, 41, 224, 22, 88, 224, 224,
- 224, 224, 4, -142, 10, -142, -142, -142, 31, 54,
- 345, 446, -142, -142, -142, -142, -142, 224, 224, 224,
- -142, 44, -142, 51, -142, 93, -142, 83, -142, 26,
- 25, -142, -142, -142, -142, 59, 224, -142, 360, 108,
- -142, -15, 5, 508, 508, 508, 403, -142, -142, 193,
- 345, 224, 345, 87, 427, 224, 224, 224, 224, 224,
- 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
- 446, 53, 56, 63, 114, -142, -142, 116, -142, 118,
- 119, 106, -142, -142, 360, 124, -142, 224, 224, 224,
- 224, -142, -142, 79, 446, 81, 379, 84, 224, 446,
- 446, 446, 446, 446, 446, 446, 446, 489, 489, 508,
- 508, 446, 446, 446, -142, 224, -142, -142, -142, -142,
- -142, 134, -142, 446, 446, 446, 446, -142, -10, -142,
- -142, 315, 446, 446, -142, 29, 233, 110, 224, 233,
- -142, -142, 140, 89, -142, -142, 137, 224, 446, 17,
- 3, -142, 155, -142, 135, 446, -142, 145, -142, 153,
- -142, -142, 153, -142, 345, -142, 233, -142, -142, 233,
- -142, 233, 153, 153, -142, 345, 315, -142, 136, 141,
- 233, 156, 160, -142, 162, 146, -142, -142, -142, -142,
- 163, 149, 161, 165, -11, -142, 315, -142, 284, 151,
- -142, -142, -142, 233, -142, -142, -142, -142, -142
+ 173, -39, -165, -165, 343, -165, -38, 492, -165, -165,
+ 36, 120, -165, 41, 43, 53, 343, 23, 13, 343,
+ 343, 343, 343, 5, -165, 9, -165, -165, -165, 14,
+ 24, 372, 473, -165, -165, -165, -165, -165, 16, 343,
+ -165, 473, 343, 343, 343, -165, 17, -165, 54, -165,
+ 65, -165, 72, -165, 11, 29, -165, -165, -165, -165,
+ 387, 90, -165, -21, -19, 535, 535, 535, 430, -165,
+ -165, 227, 372, 343, 372, 68, 454, 343, 343, 343,
+ 343, 343, 343, 343, 343, 343, 343, 343, 343, 343,
+ 343, 343, 387, 473, -22, -2, 40, 96, -165, -165,
+ 97, -165, 98, 99, 80, -165, -165, 102, -165, 343,
+ 343, 343, 343, -165, -165, 60, 473, 62, 406, 66,
+ 343, 473, 473, 473, 473, 473, 473, 473, 473, 516,
+ 516, 535, 535, 473, 473, 473, -165, 343, -165, -165,
+ -165, -165, -165, 112, -165, 473, 473, 473, 473, -165,
+ -1, -165, -165, 314, 473, 473, -165, -24, 256, 89,
+ 343, 256, -165, -165, 116, 67, -165, -165, 117, 343,
+ 473, -3, -7, -165, 118, -165, 100, 473, -165, 119,
+ -165, 124, -165, -165, 124, -165, 372, -165, 256, -165,
+ -165, 256, -165, 256, 124, 124, -165, 372, 314, -165,
+ 103, 110, 256, 130, 136, -165, 138, 122, -165, -165,
+ -165, -165, 141, 126, 139, 140, -5, -165, 314, -165,
+ 285, 127, -165, -165, -165, 256, -165, -165, -165, -165,
+ -165
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -142, -142, -20, 121, 18, -105, 0, -142, -142, -142,
- 33, -140, 16, -67, -142, -142, -142, -141, -5, -66,
- -128, -4, 19, -142, -142, -142, 142, -142, -142, -142,
- -142, -142, 61
+ -165, -165, -20, 93, 2, -146, 0, -165, -165, -165,
+ -4, -140, -28, -66, -165, -165, -165, -164, -6, -55,
+ -133, 7, 4, -165, -165, -165, 114, -165, -165, -165,
+ -165, -165, 26
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -744,155 +748,160 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -57
static const yytype_int16 yytable[] =
{
- 26, 39, 69, 113, 67, 115, 157, -48, -48, 36,
- -10, 58, 37, 42, 63, 64, 65, 66, 24, 32,
- 43, 180, 159, 107, 40, 44, 74, 52, 158, 45,
- 46, 47, 48, 90, 90, 90, 177, 49, 195, 108,
- 98, 53, 197, 109, 181, 186, 160, 99, 189, -48,
- 191, 195, 104, 197, 54, 45, 100, 47, 178, 110,
- 200, 59, 60, 101, 68, 95, 74, 114, 116, 26,
- -10, 119, 120, 121, 122, 123, 124, 125, 126, 127,
- 128, 129, 130, 131, 132, 133, 223, 24, 32, 68,
- 166, 206, 70, 169, 170, 162, 61, 150, 141, 92,
- 93, 62, 176, 143, 144, 145, 146, 96, 71, 188,
- 94, 224, 151, 97, 152, 134, 198, 199, 136, 135,
- 38, 106, 135, 201, 117, 202, 204, 137, 205, 135,
- 138, 153, 139, 140, 210, 163, 100, 142, -6, 1,
- 215, 147, 217, 149, 68, 2, 3, 154, 167, 4,
- 5, 6, 7, 171, 168, 172, 174, 227, 8, 228,
- 9, 10, 11, 175, 179, 12, 13, 14, 185, 190,
- 187, 180, 15, 16, 17, 211, 196, 207, 209, 212,
- 74, 213, 219, 214, 220, 221, 226, 0, 18, 222,
- 112, 74, 102, 19, 20, 0, 0, 0, -6, 21,
- 2, 3, 216, 182, 4, 5, 6, 7, 203, 0,
- 0, 0, 0, 8, 0, 9, 10, 11, 225, 0,
- 12, 13, 14, 0, 0, 0, 0, 15, 16, 17,
- 0, 2, 3, 0, 0, 4, 5, 55, 7, 0,
- 2, 3, 0, 18, 4, 5, 55, 7, 19, 20,
- 0, 0, 0, 8, 21, 9, 10, 11, 56, 0,
- 17, 13, 14, 0, 0, 0, 0, 15, 16, 17,
- 0, 0, 0, 0, 18, 0, 0, 0, 0, 19,
- 20, 0, 0, 18, 0, 21, 0, 0, 19, 20,
- 0, 2, 3, 68, 21, 4, 5, 55, 7, 0,
- 0, 0, 0, 0, 8, 0, 9, 10, 11, 0,
- 0, 0, 13, 14, 0, 0, 0, 0, 15, 16,
- 17, 0, 2, 3, 0, 0, 4, 5, 55, 7,
- 0, 0, 0, 0, 18, 8, 0, 9, 10, 19,
- 20, 0, 0, 13, 14, 21, 0, 0, 0, 15,
- 0, 17, 2, 3, 0, 0, 4, 5, 55, 7,
- 0, 0, 0, 0, 0, 18, 0, 0, 0, 0,
- 19, 20, 0, 0, 0, 0, 21, 0, 0, 56,
- 0, 17, 0, 0, 0, 105, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 18, 0, 0, 0, 0,
- 19, 20, 75, 76, 0, 0, 72, 77, 78, 79,
- 0, 80, 81, 82, 0, 83, 84, 85, 86, 0,
- 0, 75, 76, 87, 88, 89, 77, 78, 79, 0,
- 80, 81, 82, 118, 83, 84, 85, 86, 0, 0,
- 0, 111, 87, 88, 89, 75, 76, 0, 0, 0,
- 77, 78, 79, 0, 80, 81, 82, 0, 83, 84,
- 85, 86, 0, 0, 0, 111, 87, 88, 89, 75,
- 76, 0, 0, 0, 77, 78, 79, 0, 80, 81,
- 82, 118, 83, 84, 85, 86, 0, 0, 75, 76,
- 87, 88, 89, 77, 78, 79, 0, 80, 81, 82,
- 0, 83, 84, 85, 86, 0, 0, -56, -56, 87,
- 88, 89, -56, -56, -56, 0, -56, -56, -56, 0,
- 0, 0, -56, -56, 0, 0, 38, 0, -56, -56,
- -56, 75, 76, 0, 0, 0, 77, 78, 79, 0,
- 80, 81, 82, 0, 0, 0, 85, 86, 0, 0,
- 75, 76, 87, 88, 89, 77, 78, 79, 0, 80,
- 81, 82, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 87, 88, 89
+ 27, 44, 25, 71, 33, 69, 115, 162, 117, -10,
+ 182, 41, -48, -48, 159, 179, 109, 197, 111, 161,
+ 37, 63, 42, 60, 101, 64, 65, 66, 67, 68,
+ 197, 102, 110, 183, 112, 70, 160, 180, 76, 136,
+ 103, 164, 188, 137, 199, 191, 92, 193, 45, 93,
+ 93, 93, 208, 57, -48, 199, 58, 202, 50, 138,
+ 52, 61, 62, 137, 70, 59, 104, 98, -10, 95,
+ 96, 27, 226, 25, 72, 33, 43, 73, 99, 76,
+ 116, 118, 97, 225, 121, 122, 123, 124, 125, 126,
+ 127, 128, 129, 130, 131, 132, 133, 134, 135, 152,
+ 143, 100, 108, 168, 119, 137, 171, 172, 139, 103,
+ 140, 141, 142, 153, 144, 178, 145, 146, 147, 148,
+ 201, 149, 190, 151, 156, 70, 169, 154, 173, 200,
+ 187, 207, 174, 47, 189, 176, 203, 165, 204, 206,
+ 48, 182, 192, 209, 155, 49, 211, 212, 213, 50,
+ 51, 52, 53, 217, 214, 219, 215, 54, 216, 221,
+ 222, 228, 223, 224, 114, 181, 205, 170, 184, 105,
+ 229, 0, 230, -6, 1, 0, 177, 198, 0, 0,
+ 2, 3, 4, 5, 6, 7, 8, 0, 0, 0,
+ 0, 0, 9, 76, 10, 11, 12, 0, 0, 13,
+ 14, 15, 0, 218, 76, 0, 16, 17, 18, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 227, 0, 19, 0, 0, 0, 0, 20, 21, 0,
+ 0, 0, -6, 22, 2, 3, 4, 5, 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, 2, 3, 4, 5, 6, 38, 8,
+ 0, 0, 0, 0, 0, 9, 19, 10, 11, 12,
+ 0, 20, 21, 14, 15, 0, 0, 22, 0, 16,
+ 17, 18, 2, 3, 4, 5, 6, 38, 8, 0,
+ 0, 0, 0, 0, 9, 19, 10, 11, 12, 0,
+ 20, 21, 14, 15, 0, 70, 22, 0, 16, 17,
+ 18, 2, 3, 4, 5, 6, 38, 8, 0, 0,
+ 0, 0, 0, 9, 19, 10, 11, 0, 0, 20,
+ 21, 14, 15, 0, 0, 22, 0, 16, 0, 18,
+ 2, 3, 4, 5, 6, 38, 8, 0, 0, 0,
+ 0, 0, 0, 19, 0, 0, 0, 0, 20, 21,
+ 0, 0, 0, 0, 22, 0, 39, 0, 18, 2,
+ 3, 4, 5, 6, 38, 8, 0, 0, 0, 0,
+ 0, 0, 19, 0, 0, 0, 0, 20, 21, 0,
+ 0, 0, 0, 22, 0, 39, 0, 18, 0, 0,
+ 0, 107, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 19, 0, 0, 0, 0, 20, 21, 77, 78,
+ 0, 0, 74, 79, 80, 81, 0, 82, 83, 84,
+ 0, 85, 86, 87, 88, 0, 0, 77, 78, 89,
+ 90, 91, 79, 80, 81, 0, 82, 83, 84, 120,
+ 85, 86, 87, 88, 0, 0, 0, 113, 89, 90,
+ 91, 77, 78, 0, 0, 0, 79, 80, 81, 0,
+ 82, 83, 84, 0, 85, 86, 87, 88, 0, 0,
+ 0, 113, 89, 90, 91, 77, 78, 0, 0, 0,
+ 79, 80, 81, 0, 82, 83, 84, 120, 85, 86,
+ 87, 88, 0, 0, 77, 78, 89, 90, 91, 79,
+ 80, 81, 0, 82, 83, 84, 0, 85, 86, 87,
+ 88, 0, 0, -56, -56, 89, 90, 91, -56, -56,
+ -56, 0, -56, -56, -56, 0, 0, 0, -56, -56,
+ 0, 0, 43, 0, -56, -56, -56, 77, 78, 0,
+ 0, 0, 79, 80, 81, 0, 82, 83, 84, 0,
+ 0, 0, 87, 88, 0, 0, 77, 78, 89, 90,
+ 91, 79, 80, 81, 0, 82, 83, 84, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 89, 90, 91
};
static const yytype_int16 yycheck[] =
{
- 0, 6, 22, 70, 0, 72, 16, 18, 19, 60,
- 0, 15, 61, 14, 18, 19, 20, 21, 0, 0,
- 21, 18, 150, 38, 13, 26, 30, 13, 38, 30,
- 31, 32, 33, 37, 38, 39, 19, 38, 179, 54,
- 14, 14, 182, 38, 41, 173, 151, 21, 176, 60,
- 178, 192, 56, 193, 13, 30, 30, 32, 41, 54,
- 188, 39, 40, 38, 60, 14, 70, 71, 72, 69,
- 60, 75, 76, 77, 78, 79, 80, 81, 82, 83,
- 84, 85, 86, 87, 88, 89, 214, 69, 69, 60,
- 156, 196, 61, 159, 160, 66, 8, 117, 103, 38,
- 39, 13, 168, 107, 108, 109, 110, 14, 54, 175,
- 66, 216, 117, 30, 118, 62, 182, 184, 62, 66,
- 61, 13, 66, 189, 37, 191, 192, 13, 195, 66,
- 14, 135, 14, 14, 200, 155, 30, 13, 0, 1,
- 206, 62, 208, 62, 60, 7, 8, 13, 38, 11,
- 12, 13, 14, 13, 158, 66, 19, 223, 20, 225,
- 22, 23, 24, 167, 169, 27, 28, 29, 13, 24,
- 35, 18, 34, 35, 36, 19, 181, 41, 37, 19,
- 184, 19, 19, 37, 35, 24, 35, -1, 50, 24,
- 69, 195, 50, 55, 56, -1, -1, -1, 60, 61,
- 7, 8, 207, 170, 11, 12, 13, 14, 192, -1,
- -1, -1, -1, 20, -1, 22, 23, 24, 218, -1,
- 27, 28, 29, -1, -1, -1, -1, 34, 35, 36,
- -1, 7, 8, -1, -1, 11, 12, 13, 14, -1,
- 7, 8, -1, 50, 11, 12, 13, 14, 55, 56,
- -1, -1, -1, 20, 61, 22, 23, 24, 34, -1,
- 36, 28, 29, -1, -1, -1, -1, 34, 35, 36,
- -1, -1, -1, -1, 50, -1, -1, -1, -1, 55,
- 56, -1, -1, 50, -1, 61, -1, -1, 55, 56,
- -1, 7, 8, 60, 61, 11, 12, 13, 14, -1,
- -1, -1, -1, -1, 20, -1, 22, 23, 24, -1,
- -1, -1, 28, 29, -1, -1, -1, -1, 34, 35,
- 36, -1, 7, 8, -1, -1, 11, 12, 13, 14,
- -1, -1, -1, -1, 50, 20, -1, 22, 23, 55,
- 56, -1, -1, 28, 29, 61, -1, -1, -1, 34,
- -1, 36, 7, 8, -1, -1, 11, 12, 13, 14,
- -1, -1, -1, -1, -1, 50, -1, -1, -1, -1,
- 55, 56, -1, -1, -1, -1, 61, -1, -1, 34,
- -1, 36, -1, -1, -1, 25, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 50, -1, -1, -1, -1,
- 55, 56, 42, 43, -1, -1, 61, 47, 48, 49,
- -1, 51, 52, 53, -1, 55, 56, 57, 58, -1,
- -1, 42, 43, 63, 64, 65, 47, 48, 49, -1,
- 51, 52, 53, 54, 55, 56, 57, 58, -1, -1,
- -1, 62, 63, 64, 65, 42, 43, -1, -1, -1,
- 47, 48, 49, -1, 51, 52, 53, -1, 55, 56,
- 57, 58, -1, -1, -1, 62, 63, 64, 65, 42,
- 43, -1, -1, -1, 47, 48, 49, -1, 51, 52,
- 53, 54, 55, 56, 57, 58, -1, -1, 42, 43,
- 63, 64, 65, 47, 48, 49, -1, 51, 52, 53,
- -1, 55, 56, 57, 58, -1, -1, 42, 43, 63,
- 64, 65, 47, 48, 49, -1, 51, 52, 53, -1,
- -1, -1, 57, 58, -1, -1, 61, -1, 63, 64,
- 65, 42, 43, -1, -1, -1, 47, 48, 49, -1,
- 51, 52, 53, -1, -1, -1, 57, 58, -1, -1,
- 42, 43, 63, 64, 65, 47, 48, 49, -1, 51,
- 52, 53, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 63, 64, 65
+ 0, 7, 0, 23, 0, 0, 72, 153, 74, 0,
+ 17, 4, 17, 18, 15, 18, 37, 181, 37, 152,
+ 59, 8, 60, 16, 13, 12, 19, 20, 21, 22,
+ 194, 20, 53, 40, 53, 59, 37, 40, 31, 61,
+ 29, 65, 175, 65, 184, 178, 39, 180, 12, 42,
+ 43, 44, 198, 12, 59, 195, 13, 190, 29, 61,
+ 31, 38, 39, 65, 59, 12, 37, 13, 59, 43,
+ 44, 71, 218, 71, 60, 71, 60, 53, 13, 72,
+ 73, 74, 65, 216, 77, 78, 79, 80, 81, 82,
+ 83, 84, 85, 86, 87, 88, 89, 90, 91, 119,
+ 106, 29, 12, 158, 36, 65, 161, 162, 12, 29,
+ 13, 13, 13, 119, 12, 170, 109, 110, 111, 112,
+ 186, 61, 177, 61, 12, 59, 37, 120, 12, 184,
+ 12, 197, 65, 13, 34, 18, 191, 157, 193, 194,
+ 20, 17, 23, 40, 137, 25, 36, 202, 18, 29,
+ 30, 31, 32, 208, 18, 210, 18, 37, 36, 18,
+ 34, 34, 23, 23, 71, 171, 194, 160, 172, 55,
+ 225, -1, 227, 0, 1, -1, 169, 183, -1, -1,
+ 7, 8, 9, 10, 11, 12, 13, -1, -1, -1,
+ -1, -1, 19, 186, 21, 22, 23, -1, -1, 26,
+ 27, 28, -1, 209, 197, -1, 33, 34, 35, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 220, -1, 49, -1, -1, -1, -1, 54, 55, -1,
+ -1, -1, 59, 60, 7, 8, 9, 10, 11, 12,
+ 13, -1, -1, -1, -1, -1, 19, -1, 21, 22,
+ 23, -1, -1, 26, 27, 28, -1, -1, -1, -1,
+ 33, 34, 35, 7, 8, 9, 10, 11, 12, 13,
+ -1, -1, -1, -1, -1, 19, 49, 21, 22, 23,
+ -1, 54, 55, 27, 28, -1, -1, 60, -1, 33,
+ 34, 35, 7, 8, 9, 10, 11, 12, 13, -1,
+ -1, -1, -1, -1, 19, 49, 21, 22, 23, -1,
+ 54, 55, 27, 28, -1, 59, 60, -1, 33, 34,
+ 35, 7, 8, 9, 10, 11, 12, 13, -1, -1,
+ -1, -1, -1, 19, 49, 21, 22, -1, -1, 54,
+ 55, 27, 28, -1, -1, 60, -1, 33, -1, 35,
+ 7, 8, 9, 10, 11, 12, 13, -1, -1, -1,
+ -1, -1, -1, 49, -1, -1, -1, -1, 54, 55,
+ -1, -1, -1, -1, 60, -1, 33, -1, 35, 7,
+ 8, 9, 10, 11, 12, 13, -1, -1, -1, -1,
+ -1, -1, 49, -1, -1, -1, -1, 54, 55, -1,
+ -1, -1, -1, 60, -1, 33, -1, 35, -1, -1,
+ -1, 24, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 49, -1, -1, -1, -1, 54, 55, 41, 42,
+ -1, -1, 60, 46, 47, 48, -1, 50, 51, 52,
+ -1, 54, 55, 56, 57, -1, -1, 41, 42, 62,
+ 63, 64, 46, 47, 48, -1, 50, 51, 52, 53,
+ 54, 55, 56, 57, -1, -1, -1, 61, 62, 63,
+ 64, 41, 42, -1, -1, -1, 46, 47, 48, -1,
+ 50, 51, 52, -1, 54, 55, 56, 57, -1, -1,
+ -1, 61, 62, 63, 64, 41, 42, -1, -1, -1,
+ 46, 47, 48, -1, 50, 51, 52, 53, 54, 55,
+ 56, 57, -1, -1, 41, 42, 62, 63, 64, 46,
+ 47, 48, -1, 50, 51, 52, -1, 54, 55, 56,
+ 57, -1, -1, 41, 42, 62, 63, 64, 46, 47,
+ 48, -1, 50, 51, 52, -1, -1, -1, 56, 57,
+ -1, -1, 60, -1, 62, 63, 64, 41, 42, -1,
+ -1, -1, 46, 47, 48, -1, 50, 51, 52, -1,
+ -1, -1, 56, 57, -1, -1, 41, 42, 62, 63,
+ 64, 46, 47, 48, -1, 50, 51, 52, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 62, 63, 64
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 7, 8, 11, 12, 13, 14, 20, 22,
- 23, 24, 27, 28, 29, 34, 35, 36, 50, 55,
- 56, 61, 68, 70, 71, 72, 73, 74, 81, 82,
- 83, 88, 89, 91, 94, 98, 60, 61, 61, 85,
- 13, 90, 14, 21, 26, 30, 31, 32, 33, 38,
- 92, 93, 13, 14, 13, 13, 34, 71, 88, 39,
- 40, 8, 13, 88, 88, 88, 88, 0, 60, 69,
- 61, 54, 61, 80, 88, 42, 43, 47, 48, 49,
- 51, 52, 53, 55, 56, 57, 58, 63, 64, 65,
- 88, 99, 99, 99, 66, 14, 14, 30, 14, 21,
- 30, 38, 93, 95, 88, 25, 13, 38, 54, 38,
- 54, 62, 70, 80, 88, 80, 88, 37, 54, 88,
- 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
- 88, 88, 88, 88, 62, 66, 62, 13, 14, 14,
- 14, 85, 13, 88, 88, 88, 88, 62, 86, 62,
- 69, 85, 88, 88, 13, 96, 87, 16, 38, 87,
- 72, 89, 66, 69, 69, 73, 86, 38, 88, 86,
- 86, 13, 66, 97, 19, 88, 86, 19, 41, 85,
- 18, 41, 77, 78, 84, 13, 87, 35, 86, 87,
- 24, 87, 76, 77, 79, 84, 85, 78, 86, 80,
- 87, 86, 86, 79, 86, 80, 72, 41, 75, 37,
- 86, 19, 19, 19, 37, 86, 85, 86, 85, 19,
- 35, 24, 24, 87, 72, 73, 35, 86, 86
+ 0, 1, 7, 8, 9, 10, 11, 12, 13, 19,
+ 21, 22, 23, 26, 27, 28, 33, 34, 35, 49,
+ 54, 55, 60, 67, 69, 70, 71, 72, 73, 80,
+ 81, 82, 87, 88, 90, 93, 97, 59, 12, 33,
+ 70, 87, 60, 60, 84, 12, 89, 13, 20, 25,
+ 29, 30, 31, 32, 37, 91, 92, 12, 13, 12,
+ 87, 38, 39, 8, 12, 87, 87, 87, 87, 0,
+ 59, 68, 60, 53, 60, 79, 87, 41, 42, 46,
+ 47, 48, 50, 51, 52, 54, 55, 56, 57, 62,
+ 63, 64, 87, 87, 98, 98, 98, 65, 13, 13,
+ 29, 13, 20, 29, 37, 92, 94, 24, 12, 37,
+ 53, 37, 53, 61, 69, 79, 87, 79, 87, 36,
+ 53, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 61, 65, 61, 12,
+ 13, 13, 13, 84, 12, 87, 87, 87, 87, 61,
+ 85, 61, 68, 84, 87, 87, 12, 95, 86, 15,
+ 37, 86, 71, 88, 65, 68, 68, 72, 85, 37,
+ 87, 85, 85, 12, 65, 96, 18, 87, 85, 18,
+ 40, 84, 17, 40, 76, 77, 83, 12, 86, 34,
+ 85, 86, 23, 86, 75, 76, 78, 83, 84, 77,
+ 85, 79, 86, 85, 85, 78, 85, 79, 71, 40,
+ 74, 36, 85, 18, 18, 18, 36, 85, 84, 85,
+ 84, 18, 34, 23, 23, 86, 71, 72, 34, 85,
+ 85
};
#define yyerrok (yyerrstatus = 0)
@@ -1707,12 +1716,12 @@ yyreduce:
switch (yyn)
{
case 4:
-#line 100 "engines/director/lingo/lingo-gr.y"
+#line 102 "engines/director/lingo/lingo-gr.y"
{ yyerrok; ;}
break;
case 5:
-#line 103 "engines/director/lingo/lingo-gr.y"
+#line 105 "engines/director/lingo/lingo-gr.y"
{
g_lingo->_linenumber++;
g_lingo->_colnumber = 1;
@@ -1720,12 +1729,12 @@ yyreduce:
break;
case 10:
-#line 112 "engines/director/lingo/lingo-gr.y"
+#line 114 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 12:
-#line 116 "engines/director/lingo/lingo-gr.y"
+#line 118 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str());
@@ -1735,7 +1744,7 @@ yyreduce:
break;
case 13:
-#line 122 "engines/director/lingo/lingo-gr.y"
+#line 124 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1745,19 +1754,19 @@ yyreduce:
break;
case 14:
-#line 128 "engines/director/lingo/lingo-gr.y"
+#line 130 "engines/director/lingo/lingo-gr.y"
{
+ g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id
g_lingo->code1(g_lingo->c_theentityassign);
- inst e = 0, f = 0, i = 0;
- WRITE_UINT32(&e, (yyvsp[(2) - (4)].i));
- WRITE_UINT32(&f, 0);
- WRITE_UINT32(&i, 0);
- g_lingo->code3(e, f, i);
+ inst e = 0, f = 0;
+ WRITE_UINT32(&e, (yyvsp[(2) - (4)].e)[0]);
+ WRITE_UINT32(&f, (yyvsp[(2) - (4)].e)[1]);
+ g_lingo->code2(e, f);
(yyval.code) = (yyvsp[(4) - (4)].code); ;}
break;
case 15:
-#line 136 "engines/director/lingo/lingo-gr.y"
+#line 138 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1767,23 +1776,24 @@ yyreduce:
break;
case 16:
-#line 142 "engines/director/lingo/lingo-gr.y"
+#line 144 "engines/director/lingo/lingo-gr.y"
{
+ g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id
g_lingo->code1(g_lingo->c_theentityassign);
inst e = 0, f = 0;
- WRITE_UINT32(&e, (yyvsp[(2) - (4)].i));
- WRITE_UINT32(&f, 0);
+ WRITE_UINT32(&e, (yyvsp[(2) - (4)].e)[0]);
+ WRITE_UINT32(&f, (yyvsp[(2) - (4)].e)[1]);
g_lingo->code2(e, f);
(yyval.code) = (yyvsp[(4) - (4)].code); ;}
break;
case 17:
-#line 150 "engines/director/lingo/lingo-gr.y"
+#line 153 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 21:
-#line 159 "engines/director/lingo/lingo-gr.y"
+#line 162 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1793,7 +1803,7 @@ yyreduce:
break;
case 22:
-#line 170 "engines/director/lingo/lingo-gr.y"
+#line 173 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1809,7 +1819,7 @@ yyreduce:
break;
case 23:
-#line 186 "engines/director/lingo/lingo-gr.y"
+#line 189 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1825,7 +1835,7 @@ yyreduce:
break;
case 24:
-#line 200 "engines/director/lingo/lingo-gr.y"
+#line 203 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (8)].code));
@@ -1836,7 +1846,7 @@ yyreduce:
break;
case 25:
-#line 207 "engines/director/lingo/lingo-gr.y"
+#line 210 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1849,7 +1859,7 @@ yyreduce:
break;
case 26:
-#line 216 "engines/director/lingo/lingo-gr.y"
+#line 219 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1862,7 +1872,7 @@ yyreduce:
break;
case 27:
-#line 225 "engines/director/lingo/lingo-gr.y"
+#line 228 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1876,7 +1886,7 @@ yyreduce:
break;
case 28:
-#line 235 "engines/director/lingo/lingo-gr.y"
+#line 238 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1890,7 +1900,7 @@ yyreduce:
break;
case 29:
-#line 245 "engines/director/lingo/lingo-gr.y"
+#line 248 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1904,17 +1914,17 @@ yyreduce:
break;
case 30:
-#line 256 "engines/director/lingo/lingo-gr.y"
+#line 259 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = 0; ;}
break;
case 31:
-#line 257 "engines/director/lingo/lingo-gr.y"
+#line 260 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 36:
-#line 268 "engines/director/lingo/lingo-gr.y"
+#line 271 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1924,7 +1934,7 @@ yyreduce:
break;
case 38:
-#line 277 "engines/director/lingo/lingo-gr.y"
+#line 280 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
@@ -1934,22 +1944,22 @@ yyreduce:
break;
case 39:
-#line 285 "engines/director/lingo/lingo-gr.y"
+#line 288 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
case 40:
-#line 286 "engines/director/lingo/lingo-gr.y"
+#line 289 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
case 42:
-#line 289 "engines/director/lingo/lingo-gr.y"
+#line 292 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
case 43:
-#line 291 "engines/director/lingo/lingo-gr.y"
+#line 294 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1958,7 +1968,7 @@ yyreduce:
break;
case 44:
-#line 297 "engines/director/lingo/lingo-gr.y"
+#line 300 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -1967,7 +1977,7 @@ yyreduce:
break;
case 45:
-#line 303 "engines/director/lingo/lingo-gr.y"
+#line 306 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -1977,22 +1987,22 @@ yyreduce:
break;
case 46:
-#line 310 "engines/director/lingo/lingo-gr.y"
+#line 313 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 47:
-#line 312 "engines/director/lingo/lingo-gr.y"
+#line 315 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 48:
-#line 314 "engines/director/lingo/lingo-gr.y"
+#line 317 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 51:
-#line 319 "engines/director/lingo/lingo-gr.y"
+#line 322 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -2001,21 +2011,21 @@ yyreduce:
break;
case 52:
-#line 324 "engines/director/lingo/lingo-gr.y"
+#line 327 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
case 53:
-#line 327 "engines/director/lingo/lingo-gr.y"
+#line 330 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_stringpush);
g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;}
break;
case 54:
-#line 330 "engines/director/lingo/lingo-gr.y"
+#line 333 "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));
@@ -2025,7 +2035,7 @@ yyreduce:
break;
case 55:
-#line 336 "engines/director/lingo/lingo-gr.y"
+#line 339 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -2037,166 +2047,176 @@ yyreduce:
break;
case 56:
-#line 344 "engines/director/lingo/lingo-gr.y"
+#line 347 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
case 57:
-#line 347 "engines/director/lingo/lingo-gr.y"
+#line 350 "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);
+ inst e = 0, f = 0;
+ WRITE_UINT32(&e, (yyvsp[(1) - (1)].e)[0]);
+ WRITE_UINT32(&f, (yyvsp[(1) - (1)].e)[1]);
+ g_lingo->code2(e, f); ;}
+ break;
+
+ case 58:
+#line 357 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_theentitypush);
- inst e = 0, f = 0, i = 0;
- WRITE_UINT32(&e, (yyvsp[(1) - (1)].i));
- WRITE_UINT32(&f, 0);
- WRITE_UINT32(&i, 0);
- g_lingo->code3(e, f, i); ;}
+ inst e = 0, f = 0;
+ WRITE_UINT32(&e, (yyvsp[(1) - (2)].e)[0]);
+ WRITE_UINT32(&f, (yyvsp[(1) - (2)].e)[1]);
+ g_lingo->code2(e, f); ;}
break;
- case 59:
-#line 355 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 364 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 60:
-#line 356 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 365 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 61:
-#line 357 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 366 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 62:
-#line 358 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 367 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 63:
-#line 359 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 368 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 64:
-#line 360 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 369 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 65:
-#line 361 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 370 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 66:
-#line 362 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 371 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 67:
-#line 363 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 372 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 68:
-#line 364 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 373 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_and); ;}
break;
- case 69:
-#line 365 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 374 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_or); ;}
break;
- case 70:
-#line 366 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 375 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_not); ;}
break;
- case 71:
-#line 367 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 376 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ampersand); ;}
break;
- case 72:
-#line 368 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 377 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_concat); ;}
break;
- case 73:
-#line 369 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 378 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_contains); ;}
break;
- case 74:
-#line 370 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 379 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_starts); ;}
break;
- case 75:
-#line 371 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 380 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 76:
-#line 372 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 381 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 77:
-#line 373 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 382 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 78:
-#line 376 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 385 "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 79:
-#line 377 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 386 "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 80:
-#line 378 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 387 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 82:
-#line 380 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 389 "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 84:
-#line 385 "engines/director/lingo/lingo-gr.y"
+ case 85:
+#line 394 "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 85:
-#line 386 "engines/director/lingo/lingo-gr.y"
+ case 86:
+#line 395 "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 86:
-#line 397 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 406 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 87:
-#line 398 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 407 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 88:
-#line 399 "engines/director/lingo/lingo-gr.y"
+ case 89:
+#line 408 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 89:
-#line 400 "engines/director/lingo/lingo-gr.y"
+ case 90:
+#line 409 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2204,8 +2224,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 90:
-#line 405 "engines/director/lingo/lingo-gr.y"
+ case 91:
+#line 414 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2214,8 +2234,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 91:
-#line 411 "engines/director/lingo/lingo-gr.y"
+ case 92:
+#line 420 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2223,48 +2243,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 92:
-#line 418 "engines/director/lingo/lingo-gr.y"
+ case 93:
+#line 427 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 93:
-#line 419 "engines/director/lingo/lingo-gr.y"
+ case 94:
+#line 428 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 94:
-#line 420 "engines/director/lingo/lingo-gr.y"
+ case 95:
+#line 429 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 95:
-#line 421 "engines/director/lingo/lingo-gr.y"
+ case 96:
+#line 430 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 96:
-#line 424 "engines/director/lingo/lingo-gr.y"
+ case 97:
+#line 433 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 97:
-#line 425 "engines/director/lingo/lingo-gr.y"
+ case 98:
+#line 434 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 98:
-#line 426 "engines/director/lingo/lingo-gr.y"
+ case 99:
+#line 435 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 99:
-#line 454 "engines/director/lingo/lingo-gr.y"
+ case 100:
+#line 463 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 100:
-#line 455 "engines/director/lingo/lingo-gr.y"
+ case 101:
+#line 464 "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);
@@ -2272,33 +2292,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 101:
-#line 461 "engines/director/lingo/lingo-gr.y"
+ case 102:
+#line 470 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 102:
-#line 462 "engines/director/lingo/lingo-gr.y"
+ case 103:
+#line 471 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 103:
-#line 463 "engines/director/lingo/lingo-gr.y"
+ case 104:
+#line 472 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 104:
-#line 464 "engines/director/lingo/lingo-gr.y"
+ case 105:
+#line 473 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 105:
-#line 466 "engines/director/lingo/lingo-gr.y"
+ case 106:
+#line 475 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 106:
-#line 469 "engines/director/lingo/lingo-gr.y"
+ case 107:
+#line 478 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2307,24 +2327,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 107:
-#line 477 "engines/director/lingo/lingo-gr.y"
+ case 108:
+#line 486 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 108:
-#line 478 "engines/director/lingo/lingo-gr.y"
+ case 109:
+#line 487 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 109:
-#line 479 "engines/director/lingo/lingo-gr.y"
+ case 110:
+#line 488 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2328 "engines/director/lingo/lingo-gr.cpp"
+#line 2348 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2538,6 +2558,6 @@ yyreturn:
}
-#line 482 "engines/director/lingo/lingo-gr.y"
+#line 491 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index ea393a6..2841e61 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -46,50 +46,49 @@
INT = 262,
THEENTITY = 263,
THEENTITYWITHID = 264,
- THEFIELD = 265,
- FLOAT = 266,
- BLTIN = 267,
- ID = 268,
- STRING = 269,
- HANDLER = 270,
- tDOWN = 271,
- tELSE = 272,
- tNLELSIF = 273,
- tEND = 274,
- tEXIT = 275,
- tFRAME = 276,
- tGLOBAL = 277,
- tGO = 278,
- tIF = 279,
- tINTO = 280,
- tLOOP = 281,
- tMACRO = 282,
- tMCI = 283,
- tMCIWAIT = 284,
- tMOVIE = 285,
- tNEXT = 286,
- tOF = 287,
- tPREVIOUS = 288,
- tPUT = 289,
- tREPEAT = 290,
- tSET = 291,
- tTHEN = 292,
- tTO = 293,
- tWITH = 294,
- tWHILE = 295,
- tNLELSE = 296,
- tGE = 297,
- tLE = 298,
- tGT = 299,
- tLT = 300,
- tEQ = 301,
- tNEQ = 302,
- tAND = 303,
- tOR = 304,
- tNOT = 305,
- tCONCAT = 306,
- tCONTAINS = 307,
- tSTARTS = 308
+ FLOAT = 265,
+ BLTIN = 266,
+ ID = 267,
+ STRING = 268,
+ HANDLER = 269,
+ tDOWN = 270,
+ tELSE = 271,
+ tNLELSIF = 272,
+ tEND = 273,
+ tEXIT = 274,
+ tFRAME = 275,
+ tGLOBAL = 276,
+ tGO = 277,
+ tIF = 278,
+ tINTO = 279,
+ tLOOP = 280,
+ tMACRO = 281,
+ tMCI = 282,
+ tMCIWAIT = 283,
+ tMOVIE = 284,
+ tNEXT = 285,
+ tOF = 286,
+ tPREVIOUS = 287,
+ tPUT = 288,
+ tREPEAT = 289,
+ tSET = 290,
+ tTHEN = 291,
+ tTO = 292,
+ tWITH = 293,
+ tWHILE = 294,
+ tNLELSE = 295,
+ tGE = 296,
+ tLE = 297,
+ tGT = 298,
+ tLT = 299,
+ tEQ = 300,
+ tNEQ = 301,
+ tAND = 302,
+ tOR = 303,
+ tNOT = 304,
+ tCONCAT = 305,
+ tCONTAINS = 306,
+ tSTARTS = 307
};
#endif
/* Tokens. */
@@ -100,50 +99,49 @@
#define INT 262
#define THEENTITY 263
#define THEENTITYWITHID 264
-#define THEFIELD 265
-#define FLOAT 266
-#define BLTIN 267
-#define ID 268
-#define STRING 269
-#define HANDLER 270
-#define tDOWN 271
-#define tELSE 272
-#define tNLELSIF 273
-#define tEND 274
-#define tEXIT 275
-#define tFRAME 276
-#define tGLOBAL 277
-#define tGO 278
-#define tIF 279
-#define tINTO 280
-#define tLOOP 281
-#define tMACRO 282
-#define tMCI 283
-#define tMCIWAIT 284
-#define tMOVIE 285
-#define tNEXT 286
-#define tOF 287
-#define tPREVIOUS 288
-#define tPUT 289
-#define tREPEAT 290
-#define tSET 291
-#define tTHEN 292
-#define tTO 293
-#define tWITH 294
-#define tWHILE 295
-#define tNLELSE 296
-#define tGE 297
-#define tLE 298
-#define tGT 299
-#define tLT 300
-#define tEQ 301
-#define tNEQ 302
-#define tAND 303
-#define tOR 304
-#define tNOT 305
-#define tCONCAT 306
-#define tCONTAINS 307
-#define tSTARTS 308
+#define FLOAT 265
+#define BLTIN 266
+#define ID 267
+#define STRING 268
+#define HANDLER 269
+#define tDOWN 270
+#define tELSE 271
+#define tNLELSIF 272
+#define tEND 273
+#define tEXIT 274
+#define tFRAME 275
+#define tGLOBAL 276
+#define tGO 277
+#define tIF 278
+#define tINTO 279
+#define tLOOP 280
+#define tMACRO 281
+#define tMCI 282
+#define tMCIWAIT 283
+#define tMOVIE 284
+#define tNEXT 285
+#define tOF 286
+#define tPREVIOUS 287
+#define tPUT 288
+#define tREPEAT 289
+#define tSET 290
+#define tTHEN 291
+#define tTO 292
+#define tWITH 293
+#define tWHILE 294
+#define tNLELSE 295
+#define tGE 296
+#define tLE 297
+#define tGT 298
+#define tLT 299
+#define tEQ 300
+#define tNEQ 301
+#define tAND 302
+#define tOR 303
+#define tNOT 304
+#define tCONCAT 305
+#define tCONTAINS 306
+#define tSTARTS 307
@@ -155,11 +153,12 @@ typedef union YYSTYPE
Common::String *s;
int i;
double f;
+ int e[2]; // Entity + field
int code;
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 163 "engines/director/lingo/lingo-gr.hpp"
+#line 162 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index f830505..cc0d1fd 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -70,12 +70,14 @@ void yyerror(char *s) {
Common::String *s;
int i;
double f;
+ int e[2]; // Entity + field
int code;
int narg; /* number of arguments */
}
%token CASTREF UNARY VOID VAR
-%token<i> INT THEENTITY THEENTITYWITHID THEFIELD
+%token<i> INT
+%token<e> THEENTITY THEENTITYWITHID
%token<f> FLOAT
%token<s> BLTIN ID STRING HANDLER
%token tDOWN tELSE tNLELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
@@ -126,12 +128,12 @@ asgn: tPUT expr tINTO ID {
$$ = $4;
delete $2; }
| tSET THEENTITY '=' expr {
+ g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id
g_lingo->code1(g_lingo->c_theentityassign);
- inst e = 0, f = 0, i = 0;
- WRITE_UINT32(&e, $2);
- WRITE_UINT32(&f, 0);
- WRITE_UINT32(&i, 0);
- g_lingo->code3(e, f, i);
+ inst e = 0, f = 0;
+ WRITE_UINT32(&e, $2[0]);
+ WRITE_UINT32(&f, $2[1]);
+ g_lingo->code2(e, f);
$$ = $4; }
| tSET ID tTO expr {
g_lingo->code1(g_lingo->c_varpush);
@@ -140,10 +142,11 @@ asgn: tPUT expr tINTO ID {
$$ = $4;
delete $2; }
| tSET THEENTITY tTO expr {
+ g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id
g_lingo->code1(g_lingo->c_theentityassign);
inst e = 0, f = 0;
- WRITE_UINT32(&e, $2);
- WRITE_UINT32(&f, 0);
+ WRITE_UINT32(&e, $2[0]);
+ WRITE_UINT32(&f, $2[1]);
g_lingo->code2(e, f);
$$ = $4; }
;
@@ -345,12 +348,18 @@ expr: INT {
$$ = g_lingo->codeId(*$1);
delete $1; }
| THEENTITY {
+ $$ = g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id
+ g_lingo->code1(g_lingo->c_theentitypush);
+ inst e = 0, f = 0;
+ WRITE_UINT32(&e, $1[0]);
+ WRITE_UINT32(&f, $1[1]);
+ g_lingo->code2(e, f); }
+ | THEENTITYWITHID expr {
$$ = g_lingo->code1(g_lingo->c_theentitypush);
- inst e = 0, f = 0, i = 0;
- WRITE_UINT32(&e, $1);
- WRITE_UINT32(&f, 0);
- WRITE_UINT32(&i, 0);
- g_lingo->code3(e, f, i); }
+ inst e = 0, f = 0;
+ WRITE_UINT32(&e, $1[0]);
+ WRITE_UINT32(&f, $1[1]);
+ g_lingo->code2(e, f); }
| asgn
| expr '+' expr { g_lingo->code1(g_lingo->c_add); }
| expr '-' expr { g_lingo->code1(g_lingo->c_sub); }
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index e8b376b..fabac3f 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 47
-#define YY_END_OF_BUFFER 48
+#define YY_NUM_RULES 48
+#define YY_END_OF_BUFFER 49
/* 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[154] =
+static yyconst flex_int16_t yy_accept[159] =
{ 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
+ 0, 0, 49, 47, 3, 45, 45, 47, 47, 44,
+ 44, 44, 43, 44, 44, 41, 41, 41, 41, 41,
+ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+ 41, 41, 2, 2, 3, 45, 0, 0, 45, 0,
+ 0, 46, 40, 1, 42, 43, 39, 37, 38, 41,
+ 41, 41, 41, 41, 41, 41, 41, 41, 15, 7,
+ 41, 41, 41, 41, 41, 41, 41, 24, 25, 41,
+ 41, 41, 41, 41, 41, 34, 41, 41, 2, 2,
+ 0, 1, 42, 4, 41, 41, 41, 11, 41, 41,
+ 41, 41, 41, 41, 19, 41, 41, 23, 41, 27,
+
+ 41, 29, 41, 41, 41, 41, 0, 41, 6, 10,
+ 12, 41, 41, 16, 17, 41, 41, 41, 22, 41,
+ 41, 41, 0, 33, 41, 35, 9, 41, 13, 41,
+ 18, 41, 21, 41, 41, 41, 32, 36, 0, 41,
+ 14, 41, 41, 28, 30, 0, 0, 41, 20, 41,
+ 0, 8, 5, 26, 0, 0, 31, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -436,13 +436,13 @@ static yyconst flex_int32_t yy_meta[59] =
6, 6, 6, 6, 6, 6, 6, 6
} ;
-static yyconst flex_int16_t yy_base[158] =
+static yyconst flex_int16_t yy_base[164] =
{ 0,
- 0, 57, 188, 380, 61, 65, 69, 73, 153, 380,
+ 0, 57, 188, 395, 61, 65, 69, 73, 153, 395,
137, 91, 50, 66, 85, 54, 0, 54, 55, 65,
56, 66, 75, 59, 82, 87, 97, 95, 77, 102,
108, 116, 161, 165, 169, 138, 173, 141, 177, 101,
- 87, 380, 380, 0, 78, 141, 380, 380, 380, 0,
+ 87, 395, 395, 0, 78, 141, 395, 395, 395, 0,
113, 106, 100, 153, 167, 163, 172, 161, 0, 0,
158, 163, 175, 170, 161, 162, 167, 0, 0, 181,
170, 174, 172, 190, 188, 0, 191, 186, 229, 239,
@@ -453,32 +453,34 @@ static yyconst flex_int16_t yy_base[158] =
0, 252, 258, 0, 0, 250, 259, 261, 0, 259,
268, 255, 192, 0, 265, 0, 290, 268, 0, 268,
0, 275, 0, 273, 270, 273, 308, 0, 314, 284,
- 0, 280, 284, 0, 0, 279, 287, 0, 289, 380,
- 0, 0, 380, 360, 362, 368, 373
+ 0, 280, 284, 0, 0, 320, 298, 289, 0, 296,
+ 308, 395, 0, 0, 327, 333, 338, 395, 370, 372,
+ 378, 383, 388
} ;
-static yyconst flex_int16_t yy_def[158] =
+static yyconst flex_int16_t yy_def[164] =
{ 0,
- 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
+ 158, 1, 158, 158, 158, 158, 158, 158, 159, 158,
+ 158, 158, 158, 158, 158, 160, 160, 160, 160, 160,
+ 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+ 160, 160, 158, 158, 158, 158, 158, 158, 158, 158,
+ 159, 158, 158, 161, 158, 158, 158, 158, 158, 160,
+ 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+ 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+ 160, 160, 160, 160, 160, 160, 160, 160, 158, 158,
+ 158, 161, 158, 160, 160, 160, 160, 160, 160, 160,
+ 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+
+ 160, 160, 160, 160, 160, 160, 158, 160, 160, 160,
+ 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+ 160, 160, 162, 160, 160, 160, 158, 160, 160, 160,
+ 160, 160, 160, 160, 160, 160, 162, 160, 158, 160,
+ 160, 160, 160, 160, 160, 158, 158, 160, 160, 160,
+ 158, 158, 160, 160, 158, 163, 163, 0, 158, 158,
+ 158, 158, 158
} ;
-static yyconst flex_int16_t yy_nxt[439] =
+static yyconst flex_int16_t yy_nxt[454] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
13, 14, 10, 15, 16, 17, 18, 19, 20, 21,
@@ -499,38 +501,40 @@ static yyconst flex_int16_t yy_nxt[439] =
45, 46, 75, 84, 85, 74, 86, 76, 42, 40,
77, 78, 79, 36, 36, 80, 80, 36, 36, 80,
35, 36, 36, 37, 37, 36, 36, 37, 38, 39,
- 39, 38, 40, 87, 88, 89, 90, 153, 91, 92,
+ 39, 38, 40, 87, 88, 89, 90, 158, 91, 92,
93, 94, 95, 123, 96, 40, 123, 97, 98, 99,
- 153, 100, 101, 102, 103, 87, 104, 88, 89, 90,
+ 158, 100, 101, 102, 103, 87, 104, 88, 89, 90,
91, 92, 93, 105, 94, 95, 96, 106, 40, 97,
98, 110, 99, 100, 101, 102, 107, 103, 108, 104,
79, 36, 36, 80, 109, 111, 105, 112, 113, 106,
80, 36, 36, 80, 110, 114, 115, 116, 107, 117,
- 108, 118, 153, 119, 120, 121, 109, 111, 122, 112,
+ 108, 118, 158, 119, 120, 121, 109, 111, 122, 112,
123, 113, 125, 123, 126, 127, 128, 114, 115, 116,
129, 117, 130, 132, 118, 119, 120, 131, 121, 133,
122, 134, 135, 138, 125, 124, 136, 126, 127, 128,
- 140, 139, 141, 129, 139, 130, 132, 142, 150, 131,
-
- 143, 144, 133, 145, 134, 135, 138, 124, 136, 153,
- 147, 148, 153, 140, 141, 139, 149, 151, 139, 152,
- 142, 150, 143, 144, 153, 145, 153, 153, 153, 153,
- 153, 153, 147, 148, 153, 153, 146, 153, 149, 151,
- 153, 152, 153, 153, 153, 153, 153, 153, 153, 153,
- 153, 153, 153, 153, 153, 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, 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
+ 140, 139, 141, 129, 139, 130, 132, 142, 158, 131,
+
+ 143, 144, 133, 145, 134, 135, 138, 124, 136, 146,
+ 148, 149, 146, 140, 141, 139, 150, 152, 139, 153,
+ 142, 146, 143, 144, 146, 145, 154, 155, 156, 158,
+ 158, 156, 148, 149, 156, 158, 147, 156, 150, 158,
+ 152, 153, 158, 158, 158, 158, 158, 151, 154, 158,
+ 155, 158, 158, 158, 158, 158, 158, 158, 158, 147,
+ 158, 158, 158, 158, 158, 158, 158, 158, 158, 151,
+ 41, 41, 158, 41, 41, 41, 50, 50, 82, 82,
+ 158, 158, 82, 82, 137, 158, 158, 158, 137, 157,
+ 158, 158, 158, 157, 3, 158, 158, 158, 158, 158,
+
+ 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
+ 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
+ 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
+ 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
+ 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
+ 158, 158, 158
} ;
-static yyconst flex_int16_t yy_chk[439] =
+static yyconst flex_int16_t yy_chk[454] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -563,23 +567,25 @@ static yyconst flex_int16_t yy_chk[439] =
104, 91, 105, 104, 106, 107, 108, 92, 93, 94,
112, 95, 113, 117, 96, 97, 99, 116, 101, 118,
103, 120, 121, 125, 105, 104, 122, 106, 107, 108,
- 128, 127, 130, 112, 127, 113, 117, 132, 146, 116,
+ 128, 127, 130, 112, 127, 113, 117, 132, 0, 116,
134, 135, 118, 136, 120, 121, 125, 104, 122, 137,
- 140, 142, 137, 128, 130, 139, 143, 147, 139, 149,
- 132, 146, 134, 135, 0, 136, 0, 0, 0, 0,
- 0, 0, 140, 142, 0, 0, 139, 0, 143, 147,
- 0, 149, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 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
+ 140, 142, 137, 128, 130, 139, 143, 147, 139, 148,
+ 132, 146, 134, 135, 146, 136, 150, 151, 155, 0,
+ 0, 155, 140, 142, 156, 0, 139, 156, 143, 157,
+ 147, 148, 157, 0, 0, 0, 0, 146, 150, 0,
+ 151, 0, 0, 0, 0, 0, 0, 0, 0, 139,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 146,
+ 159, 159, 0, 159, 159, 159, 160, 160, 161, 161,
+ 0, 0, 161, 161, 162, 0, 0, 0, 162, 163,
+ 0, 0, 0, 163, 158, 158, 158, 158, 158, 158,
+
+ 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
+ 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
+ 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
+ 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
+ 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
+ 158, 158, 158
} ;
static yy_state_type yy_last_accepting_state;
@@ -644,7 +650,7 @@ static void countnl() {
g_lingo->_colnumber = strlen(p);
}
-#line 648 "engines/director/lingo/lingo-lex.cpp"
+#line 654 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -832,7 +838,7 @@ YY_DECL
#line 60 "engines/director/lingo/lingo-lex.l"
-#line 836 "engines/director/lingo/lingo-lex.cpp"
+#line 842 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -886,13 +892,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 >= 154 )
+ if ( yy_current_state >= 159 )
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] != 380 );
+ while ( yy_base[yy_current_state] != 395 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -1078,16 +1084,33 @@ YY_RULE_SETUP
while (*ptr == ' ' || *ptr == '\t')
ptr++;
+ Common::String field;
+ while (*ptr != ' ' && *ptr != '\t')
+ field += *ptr++;
+
+ if (!g_lingo->_theEntityFields.contains(field)) {
+ error("Unhandled the field %s", ptr);
+ }
+
+ while (*ptr == ' ' || *ptr == '\t')
+ ptr++;
+
+ ptr += 3; // Skip 'of '
+
+ while (*ptr == ' ' || *ptr == '\t')
+ ptr++;
+
if (g_lingo->_theEntities.contains(ptr)) {
- yylval.i = g_lingo->_theEntities[ptr]->entity;
+ if (g_lingo->_theEntityFields[field]->entity != g_lingo->_theEntities[ptr]->entity)
+ error("Unsupported field '%s' for entity '%s'", field.c_str(), ptr);
+
+ yylval.e[0] = g_lingo->_theEntities[ptr]->entity;
+ yylval.e[1] = g_lingo->_theEntityFields[field]->field;
if (g_lingo->_theEntities[ptr]->hasId)
return THEENTITYWITHID;
else
return THEENTITY;
- } else if (g_lingo->_theEntityFields.contains(ptr)) {
- yylval.i = g_lingo->_theEntityFields[ptr]->field;
- return THEFIELD;
}
error("Unhandled the entity %s", ptr);
@@ -1095,47 +1118,72 @@ YY_RULE_SETUP
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 114 "engines/director/lingo/lingo-lex.l"
-{ count(); return tTHEN; }
+#line 131 "engines/director/lingo/lingo-lex.l"
+{
+ count();
+
+ const char *ptr = &yytext[4]; // Skip 'the '
+ while (*ptr == ' ' || *ptr == '\t')
+ ptr++;
+
+ if (g_lingo->_theEntities.contains(ptr)) {
+ yylval.e[0] = g_lingo->_theEntities[ptr]->entity;
+ yylval.e[1] = 0; // No field
+
+ if (g_lingo->_theEntities[ptr]->hasId)
+ return THEENTITYWITHID;
+ else
+ return THEENTITY;
+ } else if (g_lingo->_theEntityFields.contains(ptr)) {
+ error("the field without entity: %s", ptr);
+ }
+
+ error("Unhandled the entity %s", ptr);
+ }
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 115 "engines/director/lingo/lingo-lex.l"
-{ count(); return tTO; }
+#line 152 "engines/director/lingo/lingo-lex.l"
+{ count(); return tTHEN; }
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 116 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWITH; }
+#line 153 "engines/director/lingo/lingo-lex.l"
+{ count(); return tTO; }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 117 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWHILE; }
+#line 154 "engines/director/lingo/lingo-lex.l"
+{ count(); return tWITH; }
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 119 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNEQ; }
+#line 155 "engines/director/lingo/lingo-lex.l"
+{ count(); return tWHILE; }
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 120 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGE; }
+#line 157 "engines/director/lingo/lingo-lex.l"
+{ count(); return tNEQ; }
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 121 "engines/director/lingo/lingo-lex.l"
-{ count(); return tLE; }
+#line 158 "engines/director/lingo/lingo-lex.l"
+{ count(); return tGE; }
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 122 "engines/director/lingo/lingo-lex.l"
-{ count(); return tCONCAT; }
+#line 159 "engines/director/lingo/lingo-lex.l"
+{ count(); return tLE; }
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 124 "engines/director/lingo/lingo-lex.l"
+#line 160 "engines/director/lingo/lingo-lex.l"
+{ count(); return tCONCAT; }
+ YY_BREAK
+case 41:
+YY_RULE_SETUP
+#line 162 "engines/director/lingo/lingo-lex.l"
{
count();
yylval.s = new Common::String(yytext);
@@ -1146,43 +1194,43 @@ YY_RULE_SETUP
return ID;
}
YY_BREAK
-case 41:
+case 42:
YY_RULE_SETUP
-#line 133 "engines/director/lingo/lingo-lex.l"
+#line 171 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
-case 42:
+case 43:
YY_RULE_SETUP
-#line 134 "engines/director/lingo/lingo-lex.l"
+#line 172 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
-case 43:
+case 44:
YY_RULE_SETUP
-#line 135 "engines/director/lingo/lingo-lex.l"
+#line 173 "engines/director/lingo/lingo-lex.l"
{ count(); return *yytext; }
YY_BREAK
-case 44:
-/* rule 44 can match eol */
+case 45:
+/* rule 45 can match eol */
YY_RULE_SETUP
-#line 136 "engines/director/lingo/lingo-lex.l"
+#line 174 "engines/director/lingo/lingo-lex.l"
{ return '\n'; }
YY_BREAK
-case 45:
+case 46:
YY_RULE_SETUP
-#line 137 "engines/director/lingo/lingo-lex.l"
+#line 175 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
-case 46:
+case 47:
YY_RULE_SETUP
-#line 138 "engines/director/lingo/lingo-lex.l"
+#line 176 "engines/director/lingo/lingo-lex.l"
YY_BREAK
-case 47:
+case 48:
YY_RULE_SETUP
-#line 140 "engines/director/lingo/lingo-lex.l"
+#line 178 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1186 "engines/director/lingo/lingo-lex.cpp"
+#line 1234 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1475,7 +1523,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 >= 154 )
+ if ( yy_current_state >= 159 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1503,11 +1551,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 >= 154 )
+ if ( yy_current_state >= 159 )
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 == 153);
+ yy_is_jam = (yy_current_state == 158);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2182,7 +2230,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 140 "engines/director/lingo/lingo-lex.l"
+#line 178 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 1f1cd76..4739d20 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -90,6 +90,44 @@ whitespace [\t ]
(?i:repeat) { count(); return tREPEAT; }
(?i:set) { count(); return tSET; }
(?i:starts) { count(); return tSTARTS; }
+(?i:the[ \t]+[[:alpha:]]+[\t ]+of[\t ]+[[:alpha:]]+) {
+ count();
+
+ const char *ptr = &yytext[4]; // Skip 'the '
+ while (*ptr == ' ' || *ptr == '\t')
+ ptr++;
+
+ Common::String field;
+ while (*ptr != ' ' && *ptr != '\t')
+ field += *ptr++;
+
+ if (!g_lingo->_theEntityFields.contains(field)) {
+ error("Unhandled the field %s", ptr);
+ }
+
+ while (*ptr == ' ' || *ptr == '\t')
+ ptr++;
+
+ ptr += 3; // Skip 'of '
+
+ while (*ptr == ' ' || *ptr == '\t')
+ ptr++;
+
+ if (g_lingo->_theEntities.contains(ptr)) {
+ if (g_lingo->_theEntityFields[field]->entity != g_lingo->_theEntities[ptr]->entity)
+ error("Unsupported field '%s' for entity '%s'", field.c_str(), ptr);
+
+ yylval.e[0] = g_lingo->_theEntities[ptr]->entity;
+ yylval.e[1] = g_lingo->_theEntityFields[field]->field;
+
+ if (g_lingo->_theEntities[ptr]->hasId)
+ return THEENTITYWITHID;
+ else
+ return THEENTITY;
+ }
+
+ error("Unhandled the entity %s", ptr);
+ }
(?i:the[ \t]+[[:alpha:]]+) {
count();
@@ -98,15 +136,15 @@ whitespace [\t ]
ptr++;
if (g_lingo->_theEntities.contains(ptr)) {
- yylval.i = g_lingo->_theEntities[ptr]->entity;
+ yylval.e[0] = g_lingo->_theEntities[ptr]->entity;
+ yylval.e[1] = 0; // No field
if (g_lingo->_theEntities[ptr]->hasId)
return THEENTITYWITHID;
else
return THEENTITY;
} else if (g_lingo->_theEntityFields.contains(ptr)) {
- yylval.i = g_lingo->_theEntityFields[ptr]->field;
- return THEFIELD;
+ error("the field without entity: %s", ptr);
}
error("Unhandled the entity %s", ptr);
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 8680426..aaeec3e 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -173,7 +173,7 @@ void Lingo::initTheEntities() {
}
}
-void Lingo::setTheEntity(int entity, int id, int field, Datum &d) {
+void Lingo::setTheEntity(int entity, Datum &id, int field, Datum &d) {
switch (entity) {
case kTheSprite:
setTheSprite(id, field, d);
@@ -192,7 +192,14 @@ void Lingo::setTheEntity(int entity, int id, int field, Datum &d) {
}
}
-void Lingo::setTheSprite(int id, int field, Datum &d) {
+void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
+ int id = 0;
+
+ if (id1.type == INT)
+ id = id1.u.i;
+ else
+ warning("Unknown the sprite id type: %s", id1.type2str());
+
Sprite *sprite = _vm->_currentScore->getSpriteById(id);
d.toInt(); // Enforce Integer
@@ -231,7 +238,7 @@ void Lingo::setTheSprite(int id, int field, Datum &d) {
}
}
-Datum Lingo::getTheEntity(int entity, int id, int field) {
+Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
Datum d;
switch (entity) {
@@ -254,8 +261,15 @@ Datum Lingo::getTheEntity(int entity, int id, int field) {
return d;
}
-Datum Lingo::getTheSprite(int id, int field) {
+Datum Lingo::getTheSprite(Datum &id1, int field) {
Datum d;
+ int id = 0;
+
+ if (id1.type == INT)
+ id = id1.u.i;
+ else
+ warning("Unknown the sprite id type: %s", id1.type2str());
+
Sprite *sprite = _vm->_currentScore->getSpriteById(id);
d.type = INT;
@@ -292,13 +306,19 @@ Datum Lingo::getTheSprite(int id, int field) {
return d;
}
-Datum Lingo::getTheCast(int id, int field) {
+Datum Lingo::getTheCast(Datum &id1, int field) {
Datum d;
d.type = INT;
+ int id = 0;
+
+ if (id1.type == INT)
+ id = id1.u.i;
+ else
+ warning("Unknown the cast id type: %s", id1.type2str());
+
Cast *cast;
if (!_vm->_currentScore->_casts.contains(id)) {
-
if (field == kTheLoaded) {
d.u.i = 0;
}
@@ -344,7 +364,14 @@ Datum Lingo::getTheCast(int id, int field) {
}
}
-void Lingo::setTheCast(int id, int field, Datum &d) {
+void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
+ int id = 0;
+
+ if (id1.type == INT)
+ id = id1.u.i;
+ else
+ warning("Unknown the sprite id type: %s", id1.type2str());
+
Cast *cast = _vm->_currentScore->_casts[id];
switch (field) {
case kTheCastType:
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index f1fc96a..5eed201 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -255,12 +255,12 @@ public:
void func_gotoprevious();
public:
- void setTheEntity(int entity, int id, int field, Datum &d);
- void setTheSprite(int id, int field, Datum &d);
- void setTheCast(int id, int field, Datum &d);
- Datum getTheEntity(int entity, int id, int field);
- Datum getTheSprite(int id, int field);
- Datum getTheCast(int id, int field);
+ void setTheEntity(int entity, Datum &id, int field, Datum &d);
+ void setTheSprite(Datum &id, int field, Datum &d);
+ void setTheCast(Datum &id, int field, Datum &d);
+ Datum getTheEntity(int entity, Datum &id, int field);
+ Datum getTheSprite(Datum &id, int field);
+ Datum getTheCast(Datum &id, int field);
public:
ScriptData *_currentScript;
diff --git a/engines/director/lingo/tests/the.lingo b/engines/director/lingo/tests/the.lingo
index fbfbebd..2376dd8 100644
--- a/engines/director/lingo/tests/the.lingo
+++ b/engines/director/lingo/tests/the.lingo
@@ -1,3 +1,4 @@
put 1.0 / 3
set the floatPrecision to 6
put 1.0 / 3
+put the loch of sprite 4
Commit: d08e030da65717479aa7640458066a00ff541c72
https://github.com/scummvm/scummvm/commit/d08e030da65717479aa7640458066a00ff541c72
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implement setting the entity fields
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-the.cpp
engines/director/lingo/lingo.h
engines/director/lingo/tests/the.lingo
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 5b72345..9dd8021 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -244,6 +244,13 @@ void Lingo::c_theentityassign() {
g_lingo->push(d); // Dummy value
}
+void Lingo::c_swap() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+ g_lingo->push(d2);
+ g_lingo->push(d1);
+}
+
void Lingo::c_add() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index d3a8892..b4fb67a 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -451,18 +451,18 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 69
+#define YYFINAL 70
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 599
+#define YYLAST 639
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 66
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 33
/* YYNRULES -- Number of rules. */
-#define YYNRULES 110
+#define YYNRULES 112
/* YYNRULES -- Number of states. */
-#define YYNSTATES 231
+#define YYNSTATES 237
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -513,17 +513,17 @@ static const yytype_uint8 yytranslate[] =
static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 12, 14, 15, 17, 19,
- 21, 23, 25, 30, 35, 40, 45, 50, 52, 54,
- 56, 58, 67, 79, 92, 101, 113, 125, 132, 143,
- 154, 155, 159, 162, 164, 167, 169, 176, 178, 184,
- 186, 190, 194, 197, 201, 203, 205, 206, 207, 208,
- 211, 214, 216, 218, 220, 225, 230, 232, 234, 237,
- 239, 243, 247, 251, 255, 259, 263, 267, 271, 275,
- 279, 283, 286, 290, 294, 298, 302, 305, 308, 312,
- 315, 318, 321, 323, 325, 328, 330, 334, 337, 340,
- 343, 346, 350, 353, 357, 360, 363, 365, 369, 372,
- 376, 377, 386, 387, 389, 393, 398, 399, 403, 404,
- 406
+ 21, 23, 25, 30, 35, 40, 46, 51, 56, 62,
+ 64, 66, 68, 70, 79, 91, 104, 113, 125, 137,
+ 144, 155, 166, 167, 171, 174, 176, 179, 181, 188,
+ 190, 196, 198, 202, 206, 209, 213, 215, 217, 218,
+ 219, 220, 223, 226, 228, 230, 232, 237, 242, 244,
+ 246, 249, 251, 255, 259, 263, 267, 271, 275, 279,
+ 283, 287, 291, 295, 298, 302, 306, 310, 314, 317,
+ 320, 324, 327, 330, 333, 335, 337, 340, 342, 346,
+ 349, 352, 355, 358, 362, 365, 369, 372, 375, 377,
+ 381, 384, 388, 389, 398, 399, 401, 405, 410, 411,
+ 415, 416, 418
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -533,60 +533,62 @@ static const yytype_int8 yyrhs[] =
59, -1, 59, -1, -1, 93, -1, 88, -1, 97,
-1, 70, -1, 72, -1, 33, 87, 24, 12, -1,
35, 12, 53, 87, -1, 35, 8, 53, 87, -1,
- 35, 12, 37, 87, -1, 35, 8, 37, 87, -1,
- 87, -1, 88, -1, 71, -1, 73, -1, 80, 60,
- 79, 61, 86, 85, 18, 34, -1, 81, 53, 87,
- 85, 37, 87, 85, 86, 85, 18, 34, -1, 81,
- 53, 87, 85, 15, 37, 87, 85, 86, 85, 18,
- 34, -1, 82, 79, 36, 68, 86, 85, 18, 23,
- -1, 82, 79, 36, 68, 86, 85, 40, 86, 85,
- 18, 23, -1, 82, 79, 36, 68, 86, 85, 84,
- 75, 85, 18, 23, -1, 82, 79, 36, 84, 71,
- 85, -1, 82, 79, 36, 84, 71, 85, 40, 84,
- 71, 85, -1, 82, 79, 36, 84, 71, 85, 76,
- 85, 74, 85, -1, -1, 40, 84, 71, -1, 75,
- 78, -1, 78, -1, 76, 77, -1, 77, -1, 83,
- 79, 36, 84, 72, 85, -1, 76, -1, 83, 79,
- 36, 86, 85, -1, 87, -1, 87, 53, 87, -1,
- 60, 79, 61, -1, 34, 39, -1, 34, 38, 12,
- -1, 23, -1, 17, -1, -1, -1, -1, 86, 68,
- -1, 86, 72, -1, 7, -1, 10, -1, 13, -1,
- 11, 60, 98, 61, -1, 12, 60, 98, 61, -1,
- 12, -1, 8, -1, 9, 87, -1, 70, -1, 87,
- 54, 87, -1, 87, 55, 87, -1, 87, 56, 87,
- -1, 87, 57, 87, -1, 87, 62, 87, -1, 87,
- 63, 87, -1, 87, 46, 87, -1, 87, 41, 87,
- -1, 87, 42, 87, -1, 87, 47, 87, -1, 87,
- 48, 87, -1, 49, 87, -1, 87, 64, 87, -1,
- 87, 50, 87, -1, 87, 51, 87, -1, 87, 52,
- 87, -1, 54, 87, -1, 55, 87, -1, 60, 87,
- 61, -1, 27, 13, -1, 28, 12, -1, 33, 87,
- -1, 90, -1, 19, -1, 21, 89, -1, 12, -1,
- 89, 65, 12, -1, 22, 25, -1, 22, 30, -1,
- 22, 32, -1, 22, 91, -1, 22, 91, 92, -1,
- 22, 92, -1, 37, 20, 13, -1, 20, 13, -1,
- 37, 13, -1, 13, -1, 31, 29, 13, -1, 29,
- 13, -1, 37, 29, 13, -1, -1, 26, 12, 94,
- 84, 95, 68, 96, 86, -1, -1, 12, -1, 95,
- 65, 12, -1, 95, 68, 65, 12, -1, -1, 12,
- 84, 98, -1, -1, 87, -1, 98, 65, 87, -1
+ 35, 9, 87, 53, 87, -1, 35, 12, 37, 87,
+ -1, 35, 8, 37, 87, -1, 35, 9, 87, 37,
+ 87, -1, 87, -1, 88, -1, 71, -1, 73, -1,
+ 80, 60, 79, 61, 86, 85, 18, 34, -1, 81,
+ 53, 87, 85, 37, 87, 85, 86, 85, 18, 34,
+ -1, 81, 53, 87, 85, 15, 37, 87, 85, 86,
+ 85, 18, 34, -1, 82, 79, 36, 68, 86, 85,
+ 18, 23, -1, 82, 79, 36, 68, 86, 85, 40,
+ 86, 85, 18, 23, -1, 82, 79, 36, 68, 86,
+ 85, 84, 75, 85, 18, 23, -1, 82, 79, 36,
+ 84, 71, 85, -1, 82, 79, 36, 84, 71, 85,
+ 40, 84, 71, 85, -1, 82, 79, 36, 84, 71,
+ 85, 76, 85, 74, 85, -1, -1, 40, 84, 71,
+ -1, 75, 78, -1, 78, -1, 76, 77, -1, 77,
+ -1, 83, 79, 36, 84, 72, 85, -1, 76, -1,
+ 83, 79, 36, 86, 85, -1, 87, -1, 87, 53,
+ 87, -1, 60, 79, 61, -1, 34, 39, -1, 34,
+ 38, 12, -1, 23, -1, 17, -1, -1, -1, -1,
+ 86, 68, -1, 86, 72, -1, 7, -1, 10, -1,
+ 13, -1, 11, 60, 98, 61, -1, 12, 60, 98,
+ 61, -1, 12, -1, 8, -1, 9, 87, -1, 70,
+ -1, 87, 54, 87, -1, 87, 55, 87, -1, 87,
+ 56, 87, -1, 87, 57, 87, -1, 87, 62, 87,
+ -1, 87, 63, 87, -1, 87, 46, 87, -1, 87,
+ 41, 87, -1, 87, 42, 87, -1, 87, 47, 87,
+ -1, 87, 48, 87, -1, 49, 87, -1, 87, 64,
+ 87, -1, 87, 50, 87, -1, 87, 51, 87, -1,
+ 87, 52, 87, -1, 54, 87, -1, 55, 87, -1,
+ 60, 87, 61, -1, 27, 13, -1, 28, 12, -1,
+ 33, 87, -1, 90, -1, 19, -1, 21, 89, -1,
+ 12, -1, 89, 65, 12, -1, 22, 25, -1, 22,
+ 30, -1, 22, 32, -1, 22, 91, -1, 22, 91,
+ 92, -1, 22, 92, -1, 37, 20, 13, -1, 20,
+ 13, -1, 37, 13, -1, 13, -1, 31, 29, 13,
+ -1, 29, 13, -1, 37, 29, 13, -1, -1, 26,
+ 12, 94, 84, 95, 68, 96, 86, -1, -1, 12,
+ -1, 95, 65, 12, -1, 95, 68, 65, 12, -1,
+ -1, 12, 84, 98, -1, -1, 87, -1, 98, 65,
+ 87, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 100, 100, 101, 102, 105, 110, 111, 112, 113,
- 114, 115, 118, 124, 130, 138, 144, 153, 154, 156,
- 157, 162, 173, 189, 203, 210, 219, 228, 238, 248,
- 259, 260, 263, 264, 267, 268, 271, 279, 280, 288,
- 289, 290, 292, 294, 300, 306, 313, 315, 317, 318,
- 319, 322, 327, 330, 333, 339, 347, 350, 357, 363,
- 364, 365, 366, 367, 368, 369, 370, 371, 372, 373,
- 374, 375, 376, 377, 378, 379, 380, 381, 382, 385,
- 386, 387, 388, 389, 391, 394, 395, 406, 407, 408,
- 409, 414, 420, 427, 428, 429, 430, 433, 434, 435,
- 463, 463, 470, 471, 472, 473, 475, 478, 486, 487,
- 488
+ 114, 115, 118, 124, 130, 138, 146, 152, 160, 169,
+ 170, 172, 173, 178, 189, 205, 219, 226, 235, 244,
+ 254, 264, 275, 276, 279, 280, 283, 284, 287, 295,
+ 296, 304, 305, 306, 308, 310, 316, 322, 329, 331,
+ 333, 334, 335, 338, 343, 346, 349, 355, 363, 366,
+ 373, 379, 380, 381, 382, 383, 384, 385, 386, 387,
+ 388, 389, 390, 391, 392, 393, 394, 395, 396, 397,
+ 398, 401, 402, 403, 404, 405, 407, 410, 411, 422,
+ 423, 424, 425, 430, 436, 443, 444, 445, 446, 449,
+ 450, 451, 479, 479, 486, 487, 488, 489, 491, 494,
+ 502, 503, 504
};
#endif
@@ -631,34 +633,34 @@ static const yytype_uint16 yytoknum[] =
static const yytype_uint8 yyr1[] =
{
0, 66, 67, 67, 67, 68, 69, 69, 69, 69,
- 69, 69, 70, 70, 70, 70, 70, 71, 71, 72,
- 72, 72, 72, 72, 73, 73, 73, 73, 73, 73,
- 74, 74, 75, 75, 76, 76, 77, 78, 78, 79,
- 79, 79, 80, 81, 82, 83, 84, 85, 86, 86,
- 86, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 69, 69, 70, 70, 70, 70, 70, 70, 70, 71,
+ 71, 72, 72, 72, 72, 72, 73, 73, 73, 73,
+ 73, 73, 74, 74, 75, 75, 76, 76, 77, 78,
+ 78, 79, 79, 79, 80, 81, 82, 83, 84, 85,
+ 86, 86, 86, 87, 87, 87, 87, 87, 87, 87,
87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 88,
- 88, 88, 88, 88, 88, 89, 89, 90, 90, 90,
- 90, 90, 90, 91, 91, 91, 91, 92, 92, 92,
- 94, 93, 95, 95, 95, 95, 96, 97, 98, 98,
- 98
+ 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+ 87, 88, 88, 88, 88, 88, 88, 89, 89, 90,
+ 90, 90, 90, 90, 90, 91, 91, 91, 91, 92,
+ 92, 92, 94, 93, 95, 95, 95, 95, 96, 97,
+ 98, 98, 98
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 2, 1, 0, 1, 1, 1,
- 1, 1, 4, 4, 4, 4, 4, 1, 1, 1,
- 1, 8, 11, 12, 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, 4, 1, 1, 2, 1,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 2, 3, 3, 3, 3, 2, 2, 3, 2,
- 2, 2, 1, 1, 2, 1, 3, 2, 2, 2,
- 2, 3, 2, 3, 2, 2, 1, 3, 2, 3,
- 0, 8, 0, 1, 3, 4, 0, 3, 0, 1,
- 3
+ 1, 1, 4, 4, 4, 5, 4, 4, 5, 1,
+ 1, 1, 1, 8, 11, 12, 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, 4, 1, 1,
+ 2, 1, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 3, 3, 3, 3, 2, 2,
+ 3, 2, 2, 2, 1, 1, 2, 1, 3, 2,
+ 2, 2, 2, 3, 2, 3, 2, 2, 1, 3,
+ 2, 3, 0, 8, 0, 1, 3, 4, 0, 3,
+ 0, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -666,197 +668,205 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 0, 51, 57, 0, 52, 0, 46, 53, 83,
- 0, 0, 44, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 3, 59, 19, 11, 20, 0,
- 0, 0, 17, 8, 82, 7, 9, 4, 56, 0,
- 59, 58, 108, 108, 108, 85, 84, 96, 0, 87,
- 0, 88, 0, 89, 0, 90, 92, 100, 79, 80,
- 81, 0, 42, 0, 0, 71, 76, 77, 0, 1,
- 5, 6, 0, 0, 0, 0, 39, 0, 0, 0,
+ 0, 0, 53, 59, 0, 54, 0, 48, 55, 85,
+ 0, 0, 46, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 3, 61, 21, 11, 22, 0,
+ 0, 0, 19, 8, 84, 7, 9, 4, 58, 0,
+ 61, 60, 110, 110, 110, 87, 86, 98, 0, 89,
+ 0, 90, 0, 91, 0, 92, 94, 102, 81, 82,
+ 83, 0, 44, 0, 0, 0, 73, 78, 79, 0,
+ 1, 5, 6, 0, 0, 0, 0, 41, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 109, 0, 0, 107, 0, 94, 98,
- 0, 95, 0, 0, 0, 91, 46, 0, 43, 0,
- 0, 0, 0, 78, 2, 0, 47, 0, 0, 46,
- 0, 67, 68, 66, 69, 70, 73, 74, 75, 60,
- 61, 62, 63, 64, 65, 72, 54, 0, 55, 86,
- 97, 93, 99, 102, 12, 16, 14, 15, 13, 48,
- 0, 41, 48, 0, 40, 110, 103, 0, 47, 0,
- 0, 47, 47, 18, 0, 106, 49, 50, 0, 0,
- 47, 46, 27, 104, 0, 48, 0, 47, 48, 0,
- 48, 0, 45, 46, 47, 35, 0, 105, 101, 21,
- 48, 47, 24, 47, 47, 37, 33, 0, 0, 34,
- 30, 0, 47, 0, 0, 32, 0, 0, 47, 46,
- 47, 46, 0, 0, 0, 0, 46, 28, 0, 29,
- 0, 0, 22, 25, 26, 47, 31, 47, 23, 38,
- 36
+ 0, 0, 0, 0, 111, 0, 0, 109, 0, 96,
+ 100, 0, 97, 0, 0, 0, 93, 48, 0, 45,
+ 0, 0, 0, 0, 0, 80, 2, 0, 49, 0,
+ 0, 48, 0, 69, 70, 68, 71, 72, 75, 76,
+ 77, 62, 63, 64, 65, 66, 67, 74, 56, 0,
+ 57, 88, 99, 95, 101, 104, 12, 17, 14, 0,
+ 0, 16, 13, 50, 0, 43, 50, 0, 42, 112,
+ 105, 0, 18, 15, 49, 0, 0, 49, 49, 20,
+ 0, 108, 51, 52, 0, 0, 49, 48, 29, 106,
+ 0, 50, 0, 49, 50, 0, 50, 0, 47, 48,
+ 49, 37, 0, 107, 103, 23, 50, 49, 26, 49,
+ 49, 39, 35, 0, 0, 36, 32, 0, 49, 0,
+ 0, 34, 0, 0, 49, 48, 49, 48, 0, 0,
+ 0, 0, 48, 30, 0, 31, 0, 0, 24, 27,
+ 28, 49, 33, 49, 25, 40, 38
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 23, 166, 24, 40, 26, 167, 28, 210, 194,
- 195, 185, 196, 75, 29, 30, 31, 186, 220, 150,
- 158, 32, 163, 46, 34, 55, 56, 35, 106, 157,
- 175, 36, 94
+ -1, 23, 172, 24, 40, 26, 173, 28, 216, 200,
+ 201, 191, 202, 76, 29, 30, 31, 192, 226, 154,
+ 164, 32, 169, 46, 34, 55, 56, 35, 107, 161,
+ 181, 36, 95
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -165
+#define YYPACT_NINF -172
static const yytype_int16 yypact[] =
{
- 173, -39, -165, -165, 343, -165, -38, 492, -165, -165,
- 36, 120, -165, 41, 43, 53, 343, 23, 13, 343,
- 343, 343, 343, 5, -165, 9, -165, -165, -165, 14,
- 24, 372, 473, -165, -165, -165, -165, -165, 16, 343,
- -165, 473, 343, 343, 343, -165, 17, -165, 54, -165,
- 65, -165, 72, -165, 11, 29, -165, -165, -165, -165,
- 387, 90, -165, -21, -19, 535, 535, 535, 430, -165,
- -165, 227, 372, 343, 372, 68, 454, 343, 343, 343,
- 343, 343, 343, 343, 343, 343, 343, 343, 343, 343,
- 343, 343, 387, 473, -22, -2, 40, 96, -165, -165,
- 97, -165, 98, 99, 80, -165, -165, 102, -165, 343,
- 343, 343, 343, -165, -165, 60, 473, 62, 406, 66,
- 343, 473, 473, 473, 473, 473, 473, 473, 473, 516,
- 516, 535, 535, 473, 473, 473, -165, 343, -165, -165,
- -165, -165, -165, 112, -165, 473, 473, 473, 473, -165,
- -1, -165, -165, 314, 473, 473, -165, -24, 256, 89,
- 343, 256, -165, -165, 116, 67, -165, -165, 117, 343,
- 473, -3, -7, -165, 118, -165, 100, 473, -165, 119,
- -165, 124, -165, -165, 124, -165, 372, -165, 256, -165,
- -165, 256, -165, 256, 124, 124, -165, 372, 314, -165,
- 103, 110, 256, 130, 136, -165, 138, 122, -165, -165,
- -165, -165, 141, 126, 139, 140, -5, -165, 314, -165,
- 285, 127, -165, -165, -165, 256, -165, -165, -165, -165,
- -165
+ 189, -41, -172, -172, 359, -172, -30, 532, -172, -172,
+ 28, 150, -172, 43, 47, 52, 359, 11, 49, 359,
+ 359, 359, 359, 6, -172, 9, -172, -172, -172, 15,
+ 16, 388, 513, -172, -172, -172, -172, -172, 36, 359,
+ -172, 513, 359, 359, 359, -172, 32, -172, 86, -172,
+ 89, -172, 74, -172, 19, 25, -172, -172, -172, -172,
+ 403, 92, -172, -20, 359, -9, 575, 575, 575, 470,
+ -172, -172, 243, 388, 359, 388, 69, 494, 359, 359,
+ 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
+ 359, 359, 359, 403, 513, -2, 5, 41, 95, -172,
+ -172, 96, -172, 97, 98, 79, -172, -172, 100, -172,
+ 359, 359, 427, 359, 359, -172, -172, 57, 513, 58,
+ 446, 61, 359, 513, 513, 513, 513, 513, 513, 513,
+ 513, 556, 556, 575, 575, 513, 513, 513, -172, 359,
+ -172, -172, -172, -172, -172, 109, -172, 513, 513, 359,
+ 359, 513, 513, -172, -1, -172, -172, 330, 513, 513,
+ -172, -38, 513, 513, 272, 93, 359, 272, -172, -172,
+ 111, 64, -172, -172, 108, 359, 513, -3, -5, -172,
+ 119, -172, 101, 513, -172, 114, -172, 115, -172, -172,
+ 115, -172, 388, -172, 272, -172, -172, 272, -172, 272,
+ 115, 115, -172, 388, 330, -172, 94, 102, 272, 121,
+ 123, -172, 126, 110, -172, -172, -172, -172, 127, 113,
+ 125, 128, -7, -172, 330, -172, 301, 120, -172, -172,
+ -172, 272, -172, -172, -172, -172, -172
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -165, -165, -20, 93, 2, -146, 0, -165, -165, -165,
- -4, -140, -28, -66, -165, -165, -165, -164, -6, -55,
- -133, 7, 4, -165, -165, -165, 114, -165, -165, -165,
- -165, -165, 26
+ -172, -172, -21, 77, 8, -153, 0, -172, -172, -172,
+ -23, -170, -44, -70, -172, -172, -172, -171, -6, -40,
+ -143, 3, 26, -172, -172, -172, 103, -172, -172, -172,
+ -172, -172, 30
};
/* 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 -57
+#define YYTABLE_NINF -59
static const yytype_int16 yytable[] =
{
- 27, 44, 25, 71, 33, 69, 115, 162, 117, -10,
- 182, 41, -48, -48, 159, 179, 109, 197, 111, 161,
- 37, 63, 42, 60, 101, 64, 65, 66, 67, 68,
- 197, 102, 110, 183, 112, 70, 160, 180, 76, 136,
- 103, 164, 188, 137, 199, 191, 92, 193, 45, 93,
- 93, 93, 208, 57, -48, 199, 58, 202, 50, 138,
- 52, 61, 62, 137, 70, 59, 104, 98, -10, 95,
- 96, 27, 226, 25, 72, 33, 43, 73, 99, 76,
- 116, 118, 97, 225, 121, 122, 123, 124, 125, 126,
- 127, 128, 129, 130, 131, 132, 133, 134, 135, 152,
- 143, 100, 108, 168, 119, 137, 171, 172, 139, 103,
- 140, 141, 142, 153, 144, 178, 145, 146, 147, 148,
- 201, 149, 190, 151, 156, 70, 169, 154, 173, 200,
- 187, 207, 174, 47, 189, 176, 203, 165, 204, 206,
- 48, 182, 192, 209, 155, 49, 211, 212, 213, 50,
- 51, 52, 53, 217, 214, 219, 215, 54, 216, 221,
- 222, 228, 223, 224, 114, 181, 205, 170, 184, 105,
- 229, 0, 230, -6, 1, 0, 177, 198, 0, 0,
+ 27, 44, 72, 117, 168, 119, 70, 41, 25, -10,
+ -50, -50, 188, 167, 165, 185, 203, 110, 37, 60,
+ 205, 71, 66, 67, 68, 69, 33, 170, 113, 203,
+ 42, 205, 102, 111, 77, 189, 166, 186, 194, 103,
+ 45, 197, 93, 199, 114, 94, 94, 94, 104, 61,
+ 62, 214, -50, 208, 50, 57, 52, 63, 64, 138,
+ 58, 65, 105, 139, 59, 71, 140, 112, -10, 74,
+ 139, 232, 27, 96, 97, 73, 77, 118, 120, 231,
+ 25, 123, 124, 125, 126, 127, 128, 129, 130, 131,
+ 132, 133, 134, 135, 136, 137, 43, 98, 33, 99,
+ 156, 145, 100, 101, 109, 121, 139, 141, 104, 142,
+ 143, 144, 146, 147, 148, 157, 151, 152, 153, 155,
+ 71, 160, 207, 179, 174, 158, 182, 177, 178, 180,
+ 175, 193, 188, 213, 215, 195, 184, 198, 217, 219,
+ 171, 220, 159, 196, 221, 227, 222, 228, 229, 116,
+ 206, 230, 162, 163, 234, 190, 211, 209, 106, 210,
+ 212, 0, 0, 47, 0, 0, 0, 0, 218, 176,
+ 48, 187, 0, 0, 223, 49, 225, 0, 183, 50,
+ 51, 52, 53, 204, 0, 0, 0, 54, 0, -6,
+ 1, 235, 0, 236, 0, 77, 2, 3, 4, 5,
+ 6, 7, 8, 0, 0, 0, 77, 0, 9, 224,
+ 10, 11, 12, 0, 0, 13, 14, 15, 0, 0,
+ 0, 0, 16, 17, 18, 0, 233, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 19, 0,
+ 0, 0, 0, 20, 21, 0, 0, 0, -6, 22,
2, 3, 4, 5, 6, 7, 8, 0, 0, 0,
- 0, 0, 9, 76, 10, 11, 12, 0, 0, 13,
- 14, 15, 0, 218, 76, 0, 16, 17, 18, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 227, 0, 19, 0, 0, 0, 0, 20, 21, 0,
- 0, 0, -6, 22, 2, 3, 4, 5, 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, 2, 3, 4, 5, 6, 38, 8,
- 0, 0, 0, 0, 0, 9, 19, 10, 11, 12,
- 0, 20, 21, 14, 15, 0, 0, 22, 0, 16,
- 17, 18, 2, 3, 4, 5, 6, 38, 8, 0,
- 0, 0, 0, 0, 9, 19, 10, 11, 12, 0,
- 20, 21, 14, 15, 0, 70, 22, 0, 16, 17,
- 18, 2, 3, 4, 5, 6, 38, 8, 0, 0,
- 0, 0, 0, 9, 19, 10, 11, 0, 0, 20,
- 21, 14, 15, 0, 0, 22, 0, 16, 0, 18,
- 2, 3, 4, 5, 6, 38, 8, 0, 0, 0,
- 0, 0, 0, 19, 0, 0, 0, 0, 20, 21,
- 0, 0, 0, 0, 22, 0, 39, 0, 18, 2,
+ 0, 0, 9, 0, 10, 11, 12, 0, 0, 13,
+ 14, 15, 0, 0, 0, 0, 16, 17, 18, 2,
3, 4, 5, 6, 38, 8, 0, 0, 0, 0,
- 0, 0, 19, 0, 0, 0, 0, 20, 21, 0,
- 0, 0, 0, 22, 0, 39, 0, 18, 0, 0,
- 0, 107, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 19, 0, 0, 0, 0, 20, 21, 77, 78,
- 0, 0, 74, 79, 80, 81, 0, 82, 83, 84,
- 0, 85, 86, 87, 88, 0, 0, 77, 78, 89,
- 90, 91, 79, 80, 81, 0, 82, 83, 84, 120,
- 85, 86, 87, 88, 0, 0, 0, 113, 89, 90,
- 91, 77, 78, 0, 0, 0, 79, 80, 81, 0,
- 82, 83, 84, 0, 85, 86, 87, 88, 0, 0,
- 0, 113, 89, 90, 91, 77, 78, 0, 0, 0,
- 79, 80, 81, 0, 82, 83, 84, 120, 85, 86,
- 87, 88, 0, 0, 77, 78, 89, 90, 91, 79,
- 80, 81, 0, 82, 83, 84, 0, 85, 86, 87,
- 88, 0, 0, -56, -56, 89, 90, 91, -56, -56,
- -56, 0, -56, -56, -56, 0, 0, 0, -56, -56,
- 0, 0, 43, 0, -56, -56, -56, 77, 78, 0,
- 0, 0, 79, 80, 81, 0, 82, 83, 84, 0,
- 0, 0, 87, 88, 0, 0, 77, 78, 89, 90,
- 91, 79, 80, 81, 0, 82, 83, 84, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 89, 90, 91
+ 0, 9, 19, 10, 11, 12, 0, 20, 21, 14,
+ 15, 0, 0, 22, 0, 16, 17, 18, 2, 3,
+ 4, 5, 6, 38, 8, 0, 0, 0, 0, 0,
+ 9, 19, 10, 11, 12, 0, 20, 21, 14, 15,
+ 0, 71, 22, 0, 16, 17, 18, 2, 3, 4,
+ 5, 6, 38, 8, 0, 0, 0, 0, 0, 9,
+ 19, 10, 11, 0, 0, 20, 21, 14, 15, 0,
+ 0, 22, 0, 16, 0, 18, 2, 3, 4, 5,
+ 6, 38, 8, 0, 0, 0, 0, 0, 0, 19,
+ 0, 0, 0, 0, 20, 21, 0, 0, 0, 0,
+ 22, 0, 39, 0, 18, 2, 3, 4, 5, 6,
+ 38, 8, 0, 0, 0, 0, 0, 0, 19, 0,
+ 0, 0, 0, 20, 21, 0, 0, 0, 0, 22,
+ 0, 39, 0, 18, 0, 0, 0, 108, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 19, 0, 0,
+ 0, 0, 20, 21, 78, 79, 0, 0, 75, 80,
+ 81, 82, 0, 83, 84, 85, 0, 86, 87, 88,
+ 89, 0, 0, 0, 149, 90, 91, 92, 78, 79,
+ 0, 0, 0, 80, 81, 82, 0, 83, 84, 85,
+ 150, 86, 87, 88, 89, 0, 0, 78, 79, 90,
+ 91, 92, 80, 81, 82, 0, 83, 84, 85, 122,
+ 86, 87, 88, 89, 0, 0, 0, 115, 90, 91,
+ 92, 78, 79, 0, 0, 0, 80, 81, 82, 0,
+ 83, 84, 85, 0, 86, 87, 88, 89, 0, 0,
+ 0, 115, 90, 91, 92, 78, 79, 0, 0, 0,
+ 80, 81, 82, 0, 83, 84, 85, 122, 86, 87,
+ 88, 89, 0, 0, 78, 79, 90, 91, 92, 80,
+ 81, 82, 0, 83, 84, 85, 0, 86, 87, 88,
+ 89, 0, 0, -58, -58, 90, 91, 92, -58, -58,
+ -58, 0, -58, -58, -58, 0, 0, 0, -58, -58,
+ 0, 0, 43, 0, -58, -58, -58, 78, 79, 0,
+ 0, 0, 80, 81, 82, 0, 83, 84, 85, 0,
+ 0, 0, 88, 89, 0, 0, 78, 79, 90, 91,
+ 92, 80, 81, 82, 0, 83, 84, 85, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 90, 91, 92
};
static const yytype_int16 yycheck[] =
{
- 0, 7, 0, 23, 0, 0, 72, 153, 74, 0,
- 17, 4, 17, 18, 15, 18, 37, 181, 37, 152,
- 59, 8, 60, 16, 13, 12, 19, 20, 21, 22,
- 194, 20, 53, 40, 53, 59, 37, 40, 31, 61,
- 29, 65, 175, 65, 184, 178, 39, 180, 12, 42,
- 43, 44, 198, 12, 59, 195, 13, 190, 29, 61,
- 31, 38, 39, 65, 59, 12, 37, 13, 59, 43,
- 44, 71, 218, 71, 60, 71, 60, 53, 13, 72,
- 73, 74, 65, 216, 77, 78, 79, 80, 81, 82,
- 83, 84, 85, 86, 87, 88, 89, 90, 91, 119,
- 106, 29, 12, 158, 36, 65, 161, 162, 12, 29,
- 13, 13, 13, 119, 12, 170, 109, 110, 111, 112,
- 186, 61, 177, 61, 12, 59, 37, 120, 12, 184,
- 12, 197, 65, 13, 34, 18, 191, 157, 193, 194,
- 20, 17, 23, 40, 137, 25, 36, 202, 18, 29,
- 30, 31, 32, 208, 18, 210, 18, 37, 36, 18,
- 34, 34, 23, 23, 71, 171, 194, 160, 172, 55,
- 225, -1, 227, 0, 1, -1, 169, 183, -1, -1,
+ 0, 7, 23, 73, 157, 75, 0, 4, 0, 0,
+ 17, 18, 17, 156, 15, 18, 187, 37, 59, 16,
+ 190, 59, 19, 20, 21, 22, 0, 65, 37, 200,
+ 60, 201, 13, 53, 31, 40, 37, 40, 181, 20,
+ 12, 184, 39, 186, 53, 42, 43, 44, 29, 38,
+ 39, 204, 59, 196, 29, 12, 31, 8, 9, 61,
+ 13, 12, 37, 65, 12, 59, 61, 64, 59, 53,
+ 65, 224, 72, 43, 44, 60, 73, 74, 75, 222,
+ 72, 78, 79, 80, 81, 82, 83, 84, 85, 86,
+ 87, 88, 89, 90, 91, 92, 60, 65, 72, 13,
+ 121, 107, 13, 29, 12, 36, 65, 12, 29, 13,
+ 13, 13, 12, 110, 111, 121, 113, 114, 61, 61,
+ 59, 12, 192, 12, 164, 122, 18, 167, 168, 65,
+ 37, 12, 17, 203, 40, 34, 176, 23, 36, 18,
+ 161, 18, 139, 183, 18, 18, 36, 34, 23, 72,
+ 190, 23, 149, 150, 34, 178, 200, 197, 55, 199,
+ 200, -1, -1, 13, -1, -1, -1, -1, 208, 166,
+ 20, 177, -1, -1, 214, 25, 216, -1, 175, 29,
+ 30, 31, 32, 189, -1, -1, -1, 37, -1, 0,
+ 1, 231, -1, 233, -1, 192, 7, 8, 9, 10,
+ 11, 12, 13, -1, -1, -1, 203, -1, 19, 215,
+ 21, 22, 23, -1, -1, 26, 27, 28, -1, -1,
+ -1, -1, 33, 34, 35, -1, 226, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 49, -1,
+ -1, -1, -1, 54, 55, -1, -1, -1, 59, 60,
7, 8, 9, 10, 11, 12, 13, -1, -1, -1,
- -1, -1, 19, 186, 21, 22, 23, -1, -1, 26,
- 27, 28, -1, 209, 197, -1, 33, 34, 35, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 220, -1, 49, -1, -1, -1, -1, 54, 55, -1,
- -1, -1, 59, 60, 7, 8, 9, 10, 11, 12,
- 13, -1, -1, -1, -1, -1, 19, -1, 21, 22,
- 23, -1, -1, 26, 27, 28, -1, -1, -1, -1,
- 33, 34, 35, 7, 8, 9, 10, 11, 12, 13,
- -1, -1, -1, -1, -1, 19, 49, 21, 22, 23,
- -1, 54, 55, 27, 28, -1, -1, 60, -1, 33,
- 34, 35, 7, 8, 9, 10, 11, 12, 13, -1,
- -1, -1, -1, -1, 19, 49, 21, 22, 23, -1,
- 54, 55, 27, 28, -1, 59, 60, -1, 33, 34,
- 35, 7, 8, 9, 10, 11, 12, 13, -1, -1,
- -1, -1, -1, 19, 49, 21, 22, -1, -1, 54,
- 55, 27, 28, -1, -1, 60, -1, 33, -1, 35,
- 7, 8, 9, 10, 11, 12, 13, -1, -1, -1,
- -1, -1, -1, 49, -1, -1, -1, -1, 54, 55,
- -1, -1, -1, -1, 60, -1, 33, -1, 35, 7,
+ -1, -1, 19, -1, 21, 22, 23, -1, -1, 26,
+ 27, 28, -1, -1, -1, -1, 33, 34, 35, 7,
8, 9, 10, 11, 12, 13, -1, -1, -1, -1,
- -1, -1, 49, -1, -1, -1, -1, 54, 55, -1,
- -1, -1, -1, 60, -1, 33, -1, 35, -1, -1,
- -1, 24, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 49, -1, -1, -1, -1, 54, 55, 41, 42,
- -1, -1, 60, 46, 47, 48, -1, 50, 51, 52,
- -1, 54, 55, 56, 57, -1, -1, 41, 42, 62,
+ -1, 19, 49, 21, 22, 23, -1, 54, 55, 27,
+ 28, -1, -1, 60, -1, 33, 34, 35, 7, 8,
+ 9, 10, 11, 12, 13, -1, -1, -1, -1, -1,
+ 19, 49, 21, 22, 23, -1, 54, 55, 27, 28,
+ -1, 59, 60, -1, 33, 34, 35, 7, 8, 9,
+ 10, 11, 12, 13, -1, -1, -1, -1, -1, 19,
+ 49, 21, 22, -1, -1, 54, 55, 27, 28, -1,
+ -1, 60, -1, 33, -1, 35, 7, 8, 9, 10,
+ 11, 12, 13, -1, -1, -1, -1, -1, -1, 49,
+ -1, -1, -1, -1, 54, 55, -1, -1, -1, -1,
+ 60, -1, 33, -1, 35, 7, 8, 9, 10, 11,
+ 12, 13, -1, -1, -1, -1, -1, -1, 49, -1,
+ -1, -1, -1, 54, 55, -1, -1, -1, -1, 60,
+ -1, 33, -1, 35, -1, -1, -1, 24, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 49, -1, -1,
+ -1, -1, 54, 55, 41, 42, -1, -1, 60, 46,
+ 47, 48, -1, 50, 51, 52, -1, 54, 55, 56,
+ 57, -1, -1, -1, 37, 62, 63, 64, 41, 42,
+ -1, -1, -1, 46, 47, 48, -1, 50, 51, 52,
+ 53, 54, 55, 56, 57, -1, -1, 41, 42, 62,
63, 64, 46, 47, 48, -1, 50, 51, 52, 53,
54, 55, 56, 57, -1, -1, -1, 61, 62, 63,
64, 41, 42, -1, -1, -1, 46, 47, 48, -1,
@@ -884,24 +894,24 @@ static const yytype_uint8 yystos[] =
81, 82, 87, 88, 90, 93, 97, 59, 12, 33,
70, 87, 60, 60, 84, 12, 89, 13, 20, 25,
29, 30, 31, 32, 37, 91, 92, 12, 13, 12,
- 87, 38, 39, 8, 12, 87, 87, 87, 87, 0,
- 59, 68, 60, 53, 60, 79, 87, 41, 42, 46,
- 47, 48, 50, 51, 52, 54, 55, 56, 57, 62,
- 63, 64, 87, 87, 98, 98, 98, 65, 13, 13,
- 29, 13, 20, 29, 37, 92, 94, 24, 12, 37,
- 53, 37, 53, 61, 69, 79, 87, 79, 87, 36,
- 53, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 61, 65, 61, 12,
- 13, 13, 13, 84, 12, 87, 87, 87, 87, 61,
- 85, 61, 68, 84, 87, 87, 12, 95, 86, 15,
- 37, 86, 71, 88, 65, 68, 68, 72, 85, 37,
- 87, 85, 85, 12, 65, 96, 18, 87, 85, 18,
- 40, 84, 17, 40, 76, 77, 83, 12, 86, 34,
- 85, 86, 23, 86, 75, 76, 78, 83, 84, 77,
- 85, 79, 86, 85, 85, 78, 85, 79, 71, 40,
- 74, 36, 85, 18, 18, 18, 36, 85, 84, 85,
- 84, 18, 34, 23, 23, 86, 71, 72, 34, 85,
- 85
+ 87, 38, 39, 8, 9, 12, 87, 87, 87, 87,
+ 0, 59, 68, 60, 53, 60, 79, 87, 41, 42,
+ 46, 47, 48, 50, 51, 52, 54, 55, 56, 57,
+ 62, 63, 64, 87, 87, 98, 98, 98, 65, 13,
+ 13, 29, 13, 20, 29, 37, 92, 94, 24, 12,
+ 37, 53, 87, 37, 53, 61, 69, 79, 87, 79,
+ 87, 36, 53, 87, 87, 87, 87, 87, 87, 87,
+ 87, 87, 87, 87, 87, 87, 87, 87, 61, 65,
+ 61, 12, 13, 13, 13, 84, 12, 87, 87, 37,
+ 53, 87, 87, 61, 85, 61, 68, 84, 87, 87,
+ 12, 95, 87, 87, 86, 15, 37, 86, 71, 88,
+ 65, 68, 68, 72, 85, 37, 87, 85, 85, 12,
+ 65, 96, 18, 87, 85, 18, 40, 84, 17, 40,
+ 76, 77, 83, 12, 86, 34, 85, 86, 23, 86,
+ 75, 76, 78, 83, 84, 77, 85, 79, 86, 85,
+ 85, 78, 85, 79, 71, 40, 74, 36, 85, 18,
+ 18, 18, 36, 85, 84, 85, 84, 18, 34, 23,
+ 23, 86, 71, 72, 34, 85, 85
};
#define yyerrok (yyerrstatus = 0)
@@ -1768,6 +1778,18 @@ yyreduce:
case 15:
#line 138 "engines/director/lingo/lingo-gr.y"
{
+ g_lingo->code1(g_lingo->c_swap);
+ g_lingo->code1(g_lingo->c_theentityassign);
+ inst e = 0, f = 0;
+ WRITE_UINT32(&e, (yyvsp[(2) - (5)].e)[0]);
+ WRITE_UINT32(&f, (yyvsp[(2) - (5)].e)[1]);
+ g_lingo->code2(e, f);
+ (yyval.code) = (yyvsp[(5) - (5)].code); ;}
+ break;
+
+ case 16:
+#line 146 "engines/director/lingo/lingo-gr.y"
+ {
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
g_lingo->code1(g_lingo->c_assign);
@@ -1775,8 +1797,8 @@ yyreduce:
delete (yyvsp[(2) - (4)].s); ;}
break;
- case 16:
-#line 144 "engines/director/lingo/lingo-gr.y"
+ case 17:
+#line 152 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id
g_lingo->code1(g_lingo->c_theentityassign);
@@ -1787,13 +1809,25 @@ yyreduce:
(yyval.code) = (yyvsp[(4) - (4)].code); ;}
break;
- case 17:
-#line 153 "engines/director/lingo/lingo-gr.y"
+ case 18:
+#line 160 "engines/director/lingo/lingo-gr.y"
+ {
+ g_lingo->code1(g_lingo->c_swap);
+ g_lingo->code1(g_lingo->c_theentityassign);
+ inst e = 0, f = 0;
+ WRITE_UINT32(&e, (yyvsp[(2) - (5)].e)[0]);
+ WRITE_UINT32(&f, (yyvsp[(2) - (5)].e)[1]);
+ g_lingo->code2(e, f);
+ (yyval.code) = (yyvsp[(5) - (5)].code); ;}
+ break;
+
+ case 19:
+#line 169 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
- case 21:
-#line 162 "engines/director/lingo/lingo-gr.y"
+ case 23:
+#line 178 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1802,8 +1836,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (8)].code) + 2] = end; ;}
break;
- case 22:
-#line 173 "engines/director/lingo/lingo-gr.y"
+ case 24:
+#line 189 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1818,8 +1852,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (11)].code) + 5] = end; ;}
break;
- case 23:
-#line 189 "engines/director/lingo/lingo-gr.y"
+ case 25:
+#line 205 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1834,8 +1868,8 @@ yyreduce:
(*g_lingo->_currentScript)[(yyvsp[(1) - (12)].code) + 5] = end; ;}
break;
- case 24:
-#line 203 "engines/director/lingo/lingo-gr.y"
+ case 26:
+#line 219 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (8)].code));
@@ -1845,8 +1879,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 25:
-#line 210 "engines/director/lingo/lingo-gr.y"
+ case 27:
+#line 226 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1858,8 +1892,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 26:
-#line 219 "engines/director/lingo/lingo-gr.y"
+ case 28:
+#line 235 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1871,8 +1905,8 @@ yyreduce:
g_lingo->processIf(0, (yyvsp[(9) - (11)].code)); ;}
break;
- case 27:
-#line 228 "engines/director/lingo/lingo-gr.y"
+ case 29:
+#line 244 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1885,8 +1919,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 28:
-#line 238 "engines/director/lingo/lingo-gr.y"
+ case 30:
+#line 254 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1899,8 +1933,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 29:
-#line 248 "engines/director/lingo/lingo-gr.y"
+ case 31:
+#line 264 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1913,18 +1947,18 @@ yyreduce:
g_lingo->processIf(0, (yyvsp[(10) - (10)].code)); ;}
break;
- case 30:
-#line 259 "engines/director/lingo/lingo-gr.y"
+ case 32:
+#line 275 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = 0; ;}
break;
- case 31:
-#line 260 "engines/director/lingo/lingo-gr.y"
+ case 33:
+#line 276 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 36:
-#line 271 "engines/director/lingo/lingo-gr.y"
+ case 38:
+#line 287 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1933,8 +1967,8 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (6)].code)); ;}
break;
- case 38:
-#line 280 "engines/director/lingo/lingo-gr.y"
+ case 40:
+#line 296 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
@@ -1943,23 +1977,23 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (5)].code)); ;}
break;
- case 39:
-#line 288 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 304 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 40:
-#line 289 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 305 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 42:
-#line 292 "engines/director/lingo/lingo-gr.y"
+ case 44:
+#line 308 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 43:
-#line 294 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 310 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -1967,8 +2001,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 44:
-#line 300 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 316 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -1976,8 +2010,8 @@ yyreduce:
g_lingo->codeLabel(0); ;}
break;
- case 45:
-#line 306 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 322 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -1986,23 +2020,23 @@ yyreduce:
g_lingo->code1(skipEnd); ;}
break;
- case 46:
-#line 313 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 329 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 47:
-#line 315 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 331 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 48:
-#line 317 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 333 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 51:
-#line 322 "engines/director/lingo/lingo-gr.y"
+ case 53:
+#line 338 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -2010,22 +2044,22 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 52:
-#line 327 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 343 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
- case 53:
-#line 330 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 346 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_stringpush);
g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;}
break;
- case 54:
-#line 333 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 349 "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));
@@ -2034,8 +2068,8 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 55:
-#line 339 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 355 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -2046,15 +2080,15 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 56:
-#line 347 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 363 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 57:
-#line 350 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 366 "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);
@@ -2064,8 +2098,8 @@ yyreduce:
g_lingo->code2(e, f); ;}
break;
- case 58:
-#line 357 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 373 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_theentitypush);
inst e = 0, f = 0;
@@ -2074,149 +2108,149 @@ yyreduce:
g_lingo->code2(e, f); ;}
break;
- case 60:
-#line 364 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 380 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 61:
-#line 365 "engines/director/lingo/lingo-gr.y"
+ case 63:
+#line 381 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 62:
-#line 366 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 382 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 63:
-#line 367 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 383 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 64:
-#line 368 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 384 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 65:
-#line 369 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 385 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 66:
-#line 370 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 386 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 67:
-#line 371 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 387 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 68:
-#line 372 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 388 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 69:
-#line 373 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 389 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_and); ;}
break;
- case 70:
-#line 374 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 390 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_or); ;}
break;
- case 71:
-#line 375 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 391 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_not); ;}
break;
- case 72:
-#line 376 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 392 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ampersand); ;}
break;
- case 73:
-#line 377 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 393 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_concat); ;}
break;
- case 74:
-#line 378 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 394 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_contains); ;}
break;
- case 75:
-#line 379 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 395 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_starts); ;}
break;
- case 76:
-#line 380 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 396 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 77:
-#line 381 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 397 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 78:
-#line 382 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 398 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 79:
-#line 385 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 401 "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 80:
-#line 386 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 402 "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 81:
-#line 387 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 403 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 83:
-#line 389 "engines/director/lingo/lingo-gr.y"
+ case 85:
+#line 405 "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 85:
-#line 394 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 410 "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 86:
-#line 395 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 411 "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 87:
-#line 406 "engines/director/lingo/lingo-gr.y"
+ case 89:
+#line 422 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 88:
-#line 407 "engines/director/lingo/lingo-gr.y"
+ case 90:
+#line 423 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 89:
-#line 408 "engines/director/lingo/lingo-gr.y"
+ case 91:
+#line 424 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 90:
-#line 409 "engines/director/lingo/lingo-gr.y"
+ case 92:
+#line 425 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2224,8 +2258,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 91:
-#line 414 "engines/director/lingo/lingo-gr.y"
+ case 93:
+#line 430 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2234,8 +2268,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 92:
-#line 420 "engines/director/lingo/lingo-gr.y"
+ case 94:
+#line 436 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2243,48 +2277,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 93:
-#line 427 "engines/director/lingo/lingo-gr.y"
+ case 95:
+#line 443 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 94:
-#line 428 "engines/director/lingo/lingo-gr.y"
+ case 96:
+#line 444 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 95:
-#line 429 "engines/director/lingo/lingo-gr.y"
+ case 97:
+#line 445 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 96:
-#line 430 "engines/director/lingo/lingo-gr.y"
+ case 98:
+#line 446 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 97:
-#line 433 "engines/director/lingo/lingo-gr.y"
+ case 99:
+#line 449 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 98:
-#line 434 "engines/director/lingo/lingo-gr.y"
+ case 100:
+#line 450 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 99:
-#line 435 "engines/director/lingo/lingo-gr.y"
+ case 101:
+#line 451 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 100:
-#line 463 "engines/director/lingo/lingo-gr.y"
+ case 102:
+#line 479 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 101:
-#line 464 "engines/director/lingo/lingo-gr.y"
+ case 103:
+#line 480 "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);
@@ -2292,33 +2326,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 102:
-#line 470 "engines/director/lingo/lingo-gr.y"
+ case 104:
+#line 486 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 103:
-#line 471 "engines/director/lingo/lingo-gr.y"
+ case 105:
+#line 487 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 104:
-#line 472 "engines/director/lingo/lingo-gr.y"
+ case 106:
+#line 488 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 105:
-#line 473 "engines/director/lingo/lingo-gr.y"
+ case 107:
+#line 489 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 106:
-#line 475 "engines/director/lingo/lingo-gr.y"
+ case 108:
+#line 491 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 107:
-#line 478 "engines/director/lingo/lingo-gr.y"
+ case 109:
+#line 494 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2327,24 +2361,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 108:
-#line 486 "engines/director/lingo/lingo-gr.y"
+ case 110:
+#line 502 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 109:
-#line 487 "engines/director/lingo/lingo-gr.y"
+ case 111:
+#line 503 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 110:
-#line 488 "engines/director/lingo/lingo-gr.y"
+ case 112:
+#line 504 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2348 "engines/director/lingo/lingo-gr.cpp"
+#line 2382 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2558,6 +2592,6 @@ yyreturn:
}
-#line 491 "engines/director/lingo/lingo-gr.y"
+#line 507 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index cc0d1fd..9a374d0 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -135,6 +135,14 @@ asgn: tPUT expr tINTO ID {
WRITE_UINT32(&f, $2[1]);
g_lingo->code2(e, f);
$$ = $4; }
+ | tSET THEENTITYWITHID expr '=' expr {
+ g_lingo->code1(g_lingo->c_swap);
+ g_lingo->code1(g_lingo->c_theentityassign);
+ inst e = 0, f = 0;
+ WRITE_UINT32(&e, $2[0]);
+ WRITE_UINT32(&f, $2[1]);
+ g_lingo->code2(e, f);
+ $$ = $5; }
| tSET ID tTO expr {
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString($2->c_str());
@@ -149,6 +157,14 @@ asgn: tPUT expr tINTO ID {
WRITE_UINT32(&f, $2[1]);
g_lingo->code2(e, f);
$$ = $4; }
+ | tSET THEENTITYWITHID expr tTO expr {
+ g_lingo->code1(g_lingo->c_swap);
+ g_lingo->code1(g_lingo->c_theentityassign);
+ inst e = 0, f = 0;
+ WRITE_UINT32(&e, $2[0]);
+ WRITE_UINT32(&f, $2[1]);
+ g_lingo->code2(e, f);
+ $$ = $5; }
;
stmtoneliner: expr { g_lingo->code1(g_lingo->c_xpop); }
| func
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index aaeec3e..670494c 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -200,10 +200,10 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
else
warning("Unknown the sprite id type: %s", id1.type2str());
- Sprite *sprite = _vm->_currentScore->getSpriteById(id);
-
d.toInt(); // Enforce Integer
+ Sprite *sprite = _vm->_currentScore->getSpriteById(id);
+
switch (field) {
case kTheCastNum:
if (_vm->_currentScore->_casts.contains(d.u.i)) {
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 5eed201..254cf76 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -207,6 +207,8 @@ public:
bool verify(Symbol *s);
static void c_eval();
+ static void c_swap();
+
static void c_theentitypush();
static void c_theentityassign();
diff --git a/engines/director/lingo/tests/the.lingo b/engines/director/lingo/tests/the.lingo
index 2376dd8..75782ab 100644
--- a/engines/director/lingo/tests/the.lingo
+++ b/engines/director/lingo/tests/the.lingo
@@ -2,3 +2,4 @@ put 1.0 / 3
set the floatPrecision to 6
put 1.0 / 3
put the loch of sprite 4
+set the loch of sprite 5 to 10
Commit: 0ad467f832dc92df4f2cb975d467792af6037431
https://github.com/scummvm/scummvm/commit/0ad467f832dc92df4f2cb975d467792af6037431
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Do not error out on non-existent sprites/casts
Changed paths:
engines/director/lingo/lingo-the.cpp
engines/director/score.cpp
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 670494c..e2f63aa 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -188,7 +188,7 @@ void Lingo::setTheEntity(int entity, Datum &id, int field, Datum &d) {
warning("set to %d: %s", _floatPrecision, _floatPrecisionFormat.c_str());
break;
default:
- error("Unprocessed setting field %d of entity %d", field, entity);
+ warning("Unprocessed setting field %d of entity %d", field, entity);
}
}
@@ -202,8 +202,16 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
d.toInt(); // Enforce Integer
+ if (!_vm->_currentScore) {
+ warning("The sprite %d field %d setting over non-active score", id, field);
+ return;
+ }
+
Sprite *sprite = _vm->_currentScore->getSpriteById(id);
+ if (!sprite)
+ return;
+
switch (field) {
case kTheCastNum:
if (_vm->_currentScore->_casts.contains(d.u.i)) {
@@ -234,7 +242,7 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
break;
default:
- error("Unprocessed setting field %d of sprite", field);
+ warning("Unprocessed setting field %d of sprite", field);
}
}
@@ -255,7 +263,7 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
d.u.i = _floatPrecision;
break;
default:
- error("Unprocessed getting field %d of entity %d", field, entity);
+ warning("Unprocessed getting field %d of entity %d", field, entity);
}
return d;
@@ -270,8 +278,16 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
else
warning("Unknown the sprite id type: %s", id1.type2str());
+ if (!_vm->_currentScore) {
+ warning("The sprite %d field %d setting over non-active score", id, field);
+ return d;
+ }
+
Sprite *sprite = _vm->_currentScore->getSpriteById(id);
+ if (!sprite)
+ return d;
+
d.type = INT;
switch (field) {
@@ -300,7 +316,7 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
d.u.i = sprite->_constraint;
break;
default:
- error("Unprocessed getting field %d of sprite", field);
+ warning("Unprocessed getting field %d of sprite", field);
}
return d;
@@ -308,8 +324,6 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
Datum Lingo::getTheCast(Datum &id1, int field) {
Datum d;
- d.type = INT;
-
int id = 0;
if (id1.type == INT)
@@ -317,18 +331,27 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
else
warning("Unknown the cast id type: %s", id1.type2str());
+ if (!_vm->_currentScore) {
+ warning("The cast %d field %d setting over non-active score", id, field);
+ return d;
+ }
+
Cast *cast;
if (!_vm->_currentScore->_casts.contains(id)) {
if (field == kTheLoaded) {
+ d.type = INT;
d.u.i = 0;
}
return d;
} else {
- error ("Not cast %d found", id);
+ warning("The cast %d found", id);
+ return d;
}
cast = _vm->_currentScore->_casts[id];
+ d.type = INT;
+
switch (field) {
case kTheCastType:
d.u.i = cast->type;
@@ -341,16 +364,24 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
break;
case kTheBackColor:
{
- if (cast->type != kCastShape)
- error("Field %d of cast %d not found", field, id);
+ if (cast->type != kCastShape) {
+ warning("Field %d of cast %d not found", field, id);
+ d.type = VOID;
+ return d;
+ }
+
ShapeCast *shape = static_cast<ShapeCast *>(_vm->_currentScore->_casts[id]);
d.u.i = shape->bgCol;
}
break;
case kTheForeColor:
{
- if (cast->type != kCastShape)
- error("Field %d of cast %d not found", field, id);
+ if (cast->type != kCastShape) {
+ warning("Field %d of cast %d not found", field, id);
+ d.type = VOID;
+ return d;
+ }
+
ShapeCast *shape = static_cast<ShapeCast *>(_vm->_currentScore->_casts[id]);
d.u.i = shape->fgCol;
}
@@ -359,7 +390,7 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
d.u.i = 1; //Not loaded handled above
break;
default:
- error("Unprocessed getting field %d of cast %d", field, id);
+ warning("Unprocessed getting field %d of cast %d", field, id);
//TODO find out about String fields
}
}
@@ -370,9 +401,20 @@ void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
if (id1.type == INT)
id = id1.u.i;
else
- warning("Unknown the sprite id type: %s", id1.type2str());
+ warning("Unknown the cast id type: %s", id1.type2str());
+
+ if (!_vm->_currentScore) {
+ warning("The cast %d field %d setting over non-active score", id, field);
+ return;
+ }
Cast *cast = _vm->_currentScore->_casts[id];
+
+ if (!cast) {
+ warning("The cast %d found", id);
+ return;
+ }
+
switch (field) {
case kTheCastType:
cast->type = static_cast<CastType>(d.u.i);
@@ -388,8 +430,9 @@ void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
break;
case kTheBackColor:
{
- if (cast->type != kCastShape)
- error("Field %d of cast %d not found", field, id);
+ if (cast->type != kCastShape) {
+ warning("Field %d of cast %d not found", field, id);
+ }
ShapeCast *shape = static_cast<ShapeCast *>(_vm->_currentScore->_casts[id]);
shape->bgCol = d.u.i;
shape->modified = 1;
@@ -397,15 +440,17 @@ void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
break;
case kTheForeColor:
{
- if (cast->type != kCastShape)
- error("Field %d of cast %d not found", field, id);
+ if (cast->type != kCastShape) {
+ warning("Field %d of cast %d not found", field, id);
+ return;
+ }
ShapeCast *shape = static_cast<ShapeCast *>(_vm->_currentScore->_casts[id]);
shape->fgCol = d.u.i;
shape->modified = 1;
}
break;
default:
- error("Unprocessed getting field %d of cast %d", field, id);
+ warning("Unprocessed getting field %d of cast %d", field, id);
}
}
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 776768b..15b197c 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -890,7 +890,8 @@ Sprite *Score::getSpriteById(uint16 id) {
if (_frames[_currentFrame]->_sprites[id]) {
return _frames[_currentFrame]->_sprites[id];
} else {
- error("Sprite on frame %d width id %d not found", _currentFrame, id);
+ warning("Sprite on frame %d width id %d not found", _currentFrame, id);
+ return nullptr;
}
}
Commit: fb81d0b823587870c3ac0ac07285671f904f6cd5
https://github.com/scummvm/scummvm/commit/fb81d0b823587870c3ac0ac07285671f904f6cd5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Better error handling for 'the' entities
Changed paths:
engines/director/lingo/lingo-the.cpp
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index e2f63aa..00af1dd 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -195,10 +195,12 @@ void Lingo::setTheEntity(int entity, Datum &id, int field, Datum &d) {
void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
int id = 0;
- if (id1.type == INT)
+ if (id1.type == INT) {
id = id1.u.i;
- else
+ } else {
warning("Unknown the sprite id type: %s", id1.type2str());
+ return;
+ }
d.toInt(); // Enforce Integer
@@ -264,6 +266,7 @@ Datum Lingo::getTheEntity(int entity, Datum &id, int field) {
break;
default:
warning("Unprocessed getting field %d of entity %d", field, entity);
+ d.type = VOID;
}
return d;
@@ -273,10 +276,12 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
Datum d;
int id = 0;
- if (id1.type == INT)
+ if (id1.type == INT) {
id = id1.u.i;
- else
+ } else {
warning("Unknown the sprite id type: %s", id1.type2str());
+ return d;
+ }
if (!_vm->_currentScore) {
warning("The sprite %d field %d setting over non-active score", id, field);
@@ -317,6 +322,7 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
break;
default:
warning("Unprocessed getting field %d of sprite", field);
+ d.type = VOID;
}
return d;
@@ -326,10 +332,12 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
Datum d;
int id = 0;
- if (id1.type == INT)
+ if (id1.type == INT) {
id = id1.u.i;
- else
+ } else {
warning("Unknown the cast id type: %s", id1.type2str());
+ return d;
+ }
if (!_vm->_currentScore) {
warning("The cast %d field %d setting over non-active score", id, field);
@@ -391,17 +399,22 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
break;
default:
warning("Unprocessed getting field %d of cast %d", field, id);
+ d.type = VOID;
//TODO find out about String fields
}
+
+ return d;
}
void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
int id = 0;
- if (id1.type == INT)
+ if (id1.type == INT) {
id = id1.u.i;
- else
+ } else {
warning("Unknown the cast id type: %s", id1.type2str());
+ return;
+ }
if (!_vm->_currentScore) {
warning("The cast %d field %d setting over non-active score", id, field);
Commit: c6406042afc834ff3ecc10a2dddbbb199090869c
https://github.com/scummvm/scummvm/commit/c6406042afc834ff3ecc10a2dddbbb199090869c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Extended 'the' test
Changed paths:
engines/director/lingo/tests/the.lingo
diff --git a/engines/director/lingo/tests/the.lingo b/engines/director/lingo/tests/the.lingo
index 75782ab..65c0d6e 100644
--- a/engines/director/lingo/tests/the.lingo
+++ b/engines/director/lingo/tests/the.lingo
@@ -3,3 +3,4 @@ set the floatPrecision to 6
put 1.0 / 3
put the loch of sprite 4
set the loch of sprite 5 to 10
+set the castnum of sprite 8 to the number of cast "A Blank Castmember"
Commit: 8b20d3d67bcec592999376ca0cb3d3dede4d6789
https://github.com/scummvm/scummvm/commit/8b20d3d67bcec592999376ca0cb3d3dede4d6789
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Distinguish same name the fields for different the entities
Changed paths:
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo-the.cpp
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index fabac3f..b40ca07 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -1088,10 +1088,6 @@ YY_RULE_SETUP
while (*ptr != ' ' && *ptr != '\t')
field += *ptr++;
- if (!g_lingo->_theEntityFields.contains(field)) {
- error("Unhandled the field %s", ptr);
- }
-
while (*ptr == ' ' || *ptr == '\t')
ptr++;
@@ -1101,6 +1097,12 @@ YY_RULE_SETUP
ptr++;
if (g_lingo->_theEntities.contains(ptr)) {
+ field = Common::String::format("%d%s", g_lingo->_theEntities[ptr]->entity, field.c_str());
+
+ if (!g_lingo->_theEntityFields.contains(field)) {
+ error("Unhandled the field %s", ptr);
+ }
+
if (g_lingo->_theEntityFields[field]->entity != g_lingo->_theEntities[ptr]->entity)
error("Unsupported field '%s' for entity '%s'", field.c_str(), ptr);
@@ -1118,7 +1120,7 @@ YY_RULE_SETUP
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 131 "engines/director/lingo/lingo-lex.l"
+#line 133 "engines/director/lingo/lingo-lex.l"
{
count();
@@ -1134,8 +1136,6 @@ YY_RULE_SETUP
return THEENTITYWITHID;
else
return THEENTITY;
- } else if (g_lingo->_theEntityFields.contains(ptr)) {
- error("the field without entity: %s", ptr);
}
error("Unhandled the entity %s", ptr);
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 4739d20..9113ac3 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -101,10 +101,6 @@ whitespace [\t ]
while (*ptr != ' ' && *ptr != '\t')
field += *ptr++;
- if (!g_lingo->_theEntityFields.contains(field)) {
- error("Unhandled the field %s", ptr);
- }
-
while (*ptr == ' ' || *ptr == '\t')
ptr++;
@@ -114,6 +110,12 @@ whitespace [\t ]
ptr++;
if (g_lingo->_theEntities.contains(ptr)) {
+ field = Common::String::format("%d%s", g_lingo->_theEntities[ptr]->entity, field.c_str());
+
+ if (!g_lingo->_theEntityFields.contains(field)) {
+ error("Unhandled the field %s", ptr);
+ }
+
if (g_lingo->_theEntityFields[field]->entity != g_lingo->_theEntities[ptr]->entity)
error("Unsupported field '%s' for entity '%s'", field.c_str(), ptr);
@@ -143,8 +145,6 @@ whitespace [\t ]
return THEENTITYWITHID;
else
return THEENTITY;
- } else if (g_lingo->_theEntityFields.contains(ptr)) {
- error("the field without entity: %s", ptr);
}
error("Unhandled the entity %s", ptr);
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index 00af1dd..b2e412f 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -168,7 +168,7 @@ void Lingo::initTheEntities() {
TheEntityField *f = fields;
while (f->entity != kTheNOEntity) {
- _theEntityFields[f->name] = f;
+ _theEntityFields[Common::String::format("%d%s", f->entity, f->name)] = f;
f++;
}
}
Commit: a84d8c44e4053aa4210bb18e7235199a3d91e45d
https://github.com/scummvm/scummvm/commit/a84d8c44e4053aa4210bb18e7235199a3d91e45d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Initial code for splitting factory and method input
Changed paths:
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index ccbb668..837dfa0 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -94,6 +94,8 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
_hadError = false;
+ _inFactory = false;
+
_floatPrecision = 4;
_floatPrecisionFormat = "%.4f";
@@ -103,6 +105,28 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
Lingo::~Lingo() {
}
+const char *Lingo::findNextDefinition(const char *s) {
+ const char *res;
+
+ if ((res = strstr(s, "\nmacro "))) {
+ return res;
+ } else if ((res = strstr(s, "\nfactory "))) {
+ return res;
+ } else if (_inFactory && (res = strstr(s, "method "))) {
+ if (s == res)
+ return res;
+
+ // Check that this is the first token on the line
+ const char *tres = res;
+ while (tres > s && (*tres == ' ' || *tres == '\t') && *tres != '\n')
+ tres--;
+ if (*tres == '\n')
+ return res;
+ }
+
+ return nullptr;
+}
+
void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
debug(2, "Add code \"%s\" for type %d with id %d", code, type, id);
@@ -119,19 +143,26 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
const char *begin, *end;
- // macros have conflicting grammar. Thus we ease life for the parser.
- if ((begin = strstr(code, "\nmacro "))) {
+ // macros and factories have conflicting grammar. Thus we ease life for the parser.
+ if ((begin = findNextDefinition(code))) {
bool first = true;
begin += 1;
- while ((end = strstr(begin, "\nmacro "))) {
+ while ((end = findNextDefinition(begin))) {
if (first) {
begin = code;
first = false;
}
Common::String chunk(begin, end + 1);
+ if (chunk.hasPrefix("factory") || chunk.hasPrefix("method"))
+ _inFactory = true;
+ else if (chunk.hasPrefix("macro"))
+ _inFactory = false;
+ else
+ _inFactory = false;
+
debug(2, "Code chunk\n#####\n%s#####", chunk.c_str());
parse(chunk.c_str());
@@ -149,6 +180,8 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
code1(STOP);
}
+ _inFactory = false;
+
if (_currentScript->size() && !_hadError)
Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst));
}
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 254cf76..462b14d 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -150,6 +150,9 @@ public:
void runTests();
+private:
+ const char *findNextDefinition(const char *s);
+
public:
void execute(int pc);
void pushContext();
@@ -284,6 +287,8 @@ public:
bool _hadError;
+ bool _inFactory;
+
private:
int parse(const char *code);
void push(Datum d);
Commit: 7c0bb9e6a14cf6dc0874bbabd7e41ce2f212caeb
https://github.com/scummvm/scummvm/commit/7c0bb9e6a14cf6dc0874bbabd7e41ce2f212caeb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Added 'factory' keyword test
Changed paths:
A engines/director/lingo/tests/factory.lingo
diff --git a/engines/director/lingo/tests/factory.lingo b/engines/director/lingo/tests/factory.lingo
new file mode 100644
index 0000000..d458ba4
--- /dev/null
+++ b/engines/director/lingo/tests/factory.lingo
@@ -0,0 +1,66 @@
+--
+macro AimGun2
+global aim1
+set aim1 = aim2(mNew)
+--
+factory aim2
+method mNew
+ dontpassevent
+ global aim1
+ set the locv of sprite 24 to 540
+method mMove x, y
+ set the locH of sprite 15 to x
+ set the locV of sprite 15 to y-250
+method mAtFrame
+ dontpassevent
+ me(mMove, the mouseH, the mouseV)
+method fire
+ global fire1, targeth, targetv
+ set fire1 = fire2(mNew)
+ set the perframehook to fire1
+ me(mDispose)
+method mExit
+ set the perframehook to false
+ postfire
+ me(mDispose)
+method mDispose
+ global aim1
+ set aim1 = 1
+ when keydown then nothing
+--
+factory fire2
+method mNew
+ dontpassevent
+ set the castnum of sprite 14 to f15
+method mAtFrame
+ Global StartH, StartV, targetv, stepH, stepV, bcast
+ dontpassevent
+ set the castnum of sprite 14 to bcast
+ set the LocV of sprite 14 to (startV-stepV)
+ if sprite 14 intersects 10 and (startV-6) <= targetV then
+ set the castnum of sprite 14 to f16
+ set the perframehook to false
+ me(hit)
+ exit
+ end if
+ if startV < targetV or bcast>g17 then
+ set the perframehook to false
+ set the locV of sprite 14 to 340
+ aimgun2
+ exit
+ end if
+ set startV to (startV-stepV)
+ set bcast = bcast + 1
+method hit
+ global KillLoc
+ set killloc to the loch of sprite 3
+ go "Death"
+ set the locV of sprite 14 to 400
+ aimgun2
+method mDispose
+ global fire1
+ set fire1 = 0
+--
+macro KillIt2
+global KillLoc
+set the locH of sprite 3 to KillLoc
Commit: 2676e252e45dd82c59b1e69ab177f2d2f9e35957
https://github.com/scummvm/scummvm/commit/2676e252e45dd82c59b1e69ab177f2d2f9e35957
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Added bytecode doc from http://fileformats.archiveteam.org/wiki/Lingo_bytecode
Changed paths:
A engines/director/lingo/tests/Lingo bytecode.html
diff --git a/engines/director/lingo/tests/Lingo bytecode.html b/engines/director/lingo/tests/Lingo bytecode.html
new file mode 100644
index 0000000..1fcb4a3
--- /dev/null
+++ b/engines/director/lingo/tests/Lingo bytecode.html
@@ -0,0 +1,2360 @@
+<!DOCTYPE html>
+<!-- saved from url=(0054)http://fileformats.archiveteam.org/wiki/Lingo_bytecode -->
+<html lang="en" dir="ltr" class="client-js gr__fileformats_archiveteam_org"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Lingo bytecode - Just Solve the File Format Problem</title>
+
+<meta name="generator" content="MediaWiki 1.19.2">
+<link rel="shortcut icon" href="http://fileformats.archiveteam.org/favicon.ico">
+<link rel="search" type="application/opensearchdescription+xml" href="http://fileformats.archiveteam.org/opensearch_desc.php" title="Just Solve the File Format Problem (en)">
+<link rel="EditURI" type="application/rsd+xml" href="http://fileformats.archiveteam.org/api.php?action=rsd">
+<link rel="copyright" href="http://creativecommons.org/publicdomain/zero/1.0/">
+<link rel="alternate" type="application/atom+xml" title="Just Solve the File Format Problem Atom feed" href="http://fileformats.archiveteam.org/index.php?title=Special:RecentChanges&feed=atom">
+<link rel="stylesheet" href="./Lingo bytecode - Just Solve the File Format Problem_files/load.php">
+<style type="text/css" media="all">.js-messagebox{margin:1em 5%;padding:0.5em 2.5%;border:1px solid #ccc;background-color:#fcfcfc;font-size:0.8em}.js-messagebox .js-messagebox-group{margin:1px;padding:0.5em 2.5%;border-bottom:1px solid #ddd}.js-messagebox .js-messagebox-group:last-child{border-bottom:thin none transparent}
+
+/* cache key: justsolve:resourceloader:filter:minify-css:7:8b08bdc91c52a9ffba396dccfb5b473c */
+
+
+.mw-collapsible-toggle{float:right} li .mw-collapsible-toggle{float:none} .mw-collapsible-toggle-li{list-style:none}
+
+/* cache key: justsolve:resourceloader:filter:minify-css:7:4250852ed2349a0d4d0fc6509a3e7d4c */
+</style><meta name="ResourceLoaderDynamicStyles" content="">
+<style>a:lang(ar),a:lang(ckb),a:lang(fa),a:lang(kk-arab),a:lang(mzn),a:lang(ps),a:lang(ur){text-decoration:none}a.new,#quickbar a.new{color:#ba0000}
+
+/* cache key: justsolve:resourceloader:filter:minify-css:7:c88e2bcd56513749bec09a7e29cb3ffa */
+</style>
+
+<script src="./Lingo bytecode - Just Solve the File Format Problem_files/load(1).php"></script><script src="./Lingo bytecode - Just Solve the File Format Problem_files/load(2).php"></script>
+<script>if(window.mw){
+mw.config.set({"wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Lingo_bytecode","wgTitle":"Lingo bytecode","wgCurRevisionId":25053,"wgArticleId":6263,"wgIsArticle":true,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["File Formats","Electronic File Formats","Development","FormatInfo without extensions","FormatInfo without mimetypes"],"wgBreakFrames":false,"wgPageContentLanguage":"en","wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgRelevantPageName":"Lingo_bytecode","wgRestrictionEdit":[],"wgRestrictionMove":[]});
+}</script><script>if(window.mw){
+mw.loader.implement("user.options",function($){mw.user.options.set({"ccmeonemails":0,"cols":80,"date":"default","diffonly":0,"disablemail":0,"disablesuggest":0,"editfont":"default","editondblclick":0,"editsection":1,"editsectiononrightclick":0,"enotifminoredits":0,"enotifrevealaddr":0,"enotifusertalkpages":1,"enotifwatchlistpages":0,"extendwatchlist":0,"externaldiff":0,"externaleditor":0,"fancysig":0,"forceeditsummary":0,"gender":"unknown","hideminor":0,"hidepatrolled":0,"highlightbroken":1,"imagesize":2,"justify":0,"math":1,"minordefault":0,"newpageshidepatrolled":0,"nocache":0,"noconvertlink":0,"norollbackdiff":0,"numberheadings":0,"previewonfirst":0,"previewontop":1,"quickbar":5,"rcdays":7,"rclimit":50,"rememberpassword":0,"rows":25,"searchlimit":20,"showhiddencats":0,"showjumplinks":1,"shownumberswatching":1,"showtoc":1,"showtoolbar":1,"skin":"vector","stubthreshold":0,"thumbsize":2,"underline":2,"uselivepreview":0,"usenewrc":0,"watchcreations":0,"watchdefault":0,"watchdeletion":0,
+"watchlistdays":3,"watchlisthideanons":0,"watchlisthidebots":0,"watchlisthideliu":0,"watchlisthideminor":0,"watchlisthideown":0,"watchlisthidepatrolled":0,"watchmoves":0,"wllimit":250,"variant":"en","language":"en","searchNs0":true,"searchNs1":false,"searchNs2":false,"searchNs3":false,"searchNs4":false,"searchNs5":false,"searchNs6":false,"searchNs7":false,"searchNs8":false,"searchNs9":false,"searchNs10":false,"searchNs11":false,"searchNs12":false,"searchNs13":false,"searchNs14":false,"searchNs15":false});;},{},{});mw.loader.implement("user.tokens",function($){mw.user.tokens.set({"editToken":"+\\","watchToken":false});;},{},{});
+
+/* cache key: justsolve:resourceloader:filter:minify-js:7:9983699ab6150ffa89a90653b2338ac8 */
+}</script>
+<script>if(window.mw){
+mw.loader.load(["mediawiki.page.startup","mediawiki.legacy.wikibits","mediawiki.legacy.ajax"]);
+}</script><script type="text/javascript" src="./Lingo bytecode - Just Solve the File Format Problem_files/load(3).php"></script>
+<!--[if lt IE 7]><style type="text/css">body{behavior:url("/skins/vector/csshover.min.htc")}</style><![endif]--><meta name="chromesniffer" id="chromesniffer_meta" content="{"MediaWiki":-1,"jQuery":"1.7.1"}"><script type="text/javascript" src="chrome-extension://homgcnaoacgigpkkljjjekpignblkeae/detector.js"></script></head>
+<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-Lingo_bytecode skin-vector action-view" data-gr-c-s-loaded="true">
+ <div id="mw-page-base" class="noprint"></div>
+ <div id="mw-head-base" class="noprint"></div>
+ <!-- content -->
+ <div id="content" class="mw-body">
+ <a id="top"></a>
+ <div id="mw-js-message" style="display:none;" class="js-messagebox"></div>
+ <!-- firstHeading -->
+ <h1 id="firstHeading" class="firstHeading">
+ <span dir="auto">Lingo bytecode</span>
+ </h1>
+ <!-- /firstHeading -->
+ <!-- bodyContent -->
+ <div id="bodyContent">
+ <!-- tagline -->
+ <div id="siteSub">From Just Solve the File Format Problem</div>
+ <!-- /tagline -->
+ <!-- subtitle -->
+ <div id="contentSub"></div>
+ <!-- /subtitle -->
+ <!-- jumpto -->
+ <div id="jump-to-nav" class="mw-jump">
+ Jump to: <a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#mw-head">navigation</a>,
+ <a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#p-search">search</a>
+ </div>
+ <!-- /jumpto -->
+ <!-- bodycontent -->
+ <div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr"><table class="infobox formatinfo" border="0" style="float: right; border: 1px solid #666666; max-width: 25%; overflow: hidden; background-color: #F8E0F7; padding: 0.25em; margin: 0.25em 1em;">
+<tbody><tr>
+<th colspan="2"><a href="http://fileformats.archiveteam.org/wiki/File_Formats" title="File Formats">File Format</a></th>
+</tr>
+
+<tr>
+<th>Name</th>
+<td>Lingo bytecode</td>
+</tr>
+
+
+<tr>
+<th> Ontology
+</th>
+<td>
+<ul><li>
+<a href="http://fileformats.archiveteam.org/wiki/Electronic_File_Formats" title="Electronic File Formats">Electronic File Formats</a>
+<ul><li>
+<a href="http://fileformats.archiveteam.org/wiki/Development" title="Development">Development</a>
+<ul><li>
+<strong class="selflink">Lingo bytecode</strong>
+</li></ul>
+</li></ul>
+</li></ul>
+</td>
+</tr>
+
+
+
+</tbody></table>
+<p>This is a partial, work-in-progress examination of the bytecode created when Lingo code is compiled in Macromedia Director 4.0. It describes instructions for a stack-based virtual machine. This virtual machine is sometimes known as the IML, or Idealized Machine Layer.
+</p><p>Each instruction is one, two or three bytes.
+</p>
+<ul><li> If the first byte is in the range 0x00-0x3F, then the full instruction is one byte.
+</li><li> If the first byte is in the range 0x40-0x7F, then the full instruction is two bytes.
+</li><li> If the first byte is in the range 0x80-0xFF, then the full instruction is three bytes.
+</li></ul>
+<p>Constant blobs like string literals are stored after the bytecode, and referred to by records that are six bytes long regardless of the actual length of the data. This means the first constant will be referred to as 0x00, the second constant as 0x06, the third as 0x0C, and so on. Integer literals over 32767 and floating-point number literals are also stored as constants.
+</p><p>There is also a namelist for referring to external identifiers, stored separately from the bytecode. This is a simple array of strings.
+</p>
+<table id="toc" class="toc"><tbody><tr><td><div id="toctitle"><h2>Contents</h2><span class="toctoggle"> [<a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#" class="internal" id="togglelink">hide</a>] </span></div>
+<ul>
+<li class="toclevel-1 tocsection-1"><a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#One-Byte_Instructions"><span class="tocnumber">1</span> <span class="toctext">One-Byte Instructions</span></a></li>
+<li class="toclevel-1 tocsection-2"><a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#Two-Byte_Instructions"><span class="tocnumber">2</span> <span class="toctext">Two-Byte Instructions</span></a></li>
+<li class="toclevel-1 tocsection-3"><a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#Three_Byte_Instructions"><span class="tocnumber">3</span> <span class="toctext">Three Byte Instructions</span></a></li>
+<li class="toclevel-1 tocsection-4"><a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#Syntactic_Sugar"><span class="tocnumber">4</span> <span class="toctext">Syntactic Sugar</span></a></li>
+<li class="toclevel-1 tocsection-5"><a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#Lscr_bytecode-container_chunk_layout"><span class="tocnumber">5</span> <span class="toctext">Lscr bytecode-container chunk layout</span></a>
+<ul>
+<li class="toclevel-2 tocsection-6"><a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#Header"><span class="tocnumber">5.1</span> <span class="toctext">Header</span></a></li>
+<li class="toclevel-2 tocsection-7"><a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#Function_Record"><span class="tocnumber">5.2</span> <span class="toctext">Function Record</span></a></li>
+<li class="toclevel-2 tocsection-8"><a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#Bytecode_Trailer"><span class="tocnumber">5.3</span> <span class="toctext">Bytecode Trailer</span></a></li>
+<li class="toclevel-2 tocsection-9"><a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#Constants"><span class="tocnumber">5.4</span> <span class="toctext">Constants</span></a></li>
+</ul>
+</li>
+<li class="toclevel-1 tocsection-10"><a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#Projector_File_.28Windows.29"><span class="tocnumber">6</span> <span class="toctext">Projector File (Windows)</span></a>
+<ul>
+<li class="toclevel-2 tocsection-11"><a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#Director_3.0"><span class="tocnumber">6.1</span> <span class="toctext">Director 3.0</span></a></li>
+<li class="toclevel-2 tocsection-12"><a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#Director_4.0"><span class="tocnumber">6.2</span> <span class="toctext">Director 4.0</span></a></li>
+</ul>
+</li>
+</ul>
+</td></tr></tbody></table>
+<h1> <span class="mw-headline" id="One-Byte_Instructions"> One-Byte Instructions </span></h1>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 01
+</th>
+<td> <code>exit</code>
+</td>
+<td>
+</td>
+<td>
+</td>
+<td> Leave the current function immediately and return to its caller. Automatically added as the final step of a function.
+</td></tr>
+<tr>
+<th> 02
+</th></tr>
+<tr>
+<th> 03
+</th>
+<td>
+<p><code>0</code>
+</p><p><code>FALSE</code>
+</p>
+</td>
+<td>
+</td>
+<td> +1
+</td>
+<td>
+<p>Push zero onto the stack.
+</p>
+</td></tr>
+<tr>
+<th> 04
+</th>
+<td> <code>(a * b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two values from the stack, multiply them together and push the result.
+</td></tr>
+<tr>
+<th> 05
+</th>
+<td> <code>(a + b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two values from the stack, add them together and push the result.
+</td></tr>
+<tr>
+<th> 06
+</th>
+<td> <code>(a - b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two values from the stack, subtract the second from the first and push the result.
+</td></tr>
+<tr>
+<th> 07
+</th>
+<td> <code>(a / b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two values from the stack, divide the first by the second and push the result.
+</td></tr>
+<tr>
+<th> 08
+</th>
+<td> <code>(a mod b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two values from the stack, perform a modulo operation and push the result.
+</td></tr>
+<tr>
+<th> 09
+</th>
+<td> <code>(-a)</code>
+</td>
+<td> -1
+</td>
+<td> +1
+</td>
+<td> Pop one value from the stack, negate it and push the result.
+</td></tr>
+<tr>
+<th> 0A
+</th>
+<td> <code>(a & b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two values from the stack, concatenate them and push the resulting string.
+</td></tr>
+<tr>
+<th> 0B
+</th>
+<td> <code>(a && b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two values from the stack, concatenate them with one space character added in between, and push the resulting string.
+</td></tr>
+<tr>
+<th> 0C
+</th>
+<td> <code>(a < b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two values from the stack, push 1 if the first is less than the second and 0 if not.
+</td></tr>
+<tr>
+<th> 0D
+</th>
+<td> <code>(a <= b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two values from the stack, push 1 if the first is less than or equal to the second and 0 if not.
+</td></tr>
+<tr>
+<th> 0E
+</th>
+<td> <code>(a <> b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two values from the stack, push 0 if the two values are the same and 1 if they are not.
+</td></tr>
+<tr>
+<th> 0F
+</th>
+<td> <code>(a = b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two values from the stack, push 1 if the two values are the same and 0 if they are not.
+</td></tr>
+<tr>
+<th> 10
+</th>
+<td> <code>(a > b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two values from the stack, push 1 if the first is greater than the second and 0 if not.
+</td></tr>
+<tr>
+<th> 11
+</th>
+<td> <code>(a >= b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two values from the stack, push 1 if the first is greater than or equal to the sceond and 0 if not.
+</td></tr>
+<tr>
+<th> 12
+</th>
+<td> <code>(a and b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two values from the stack, push 1 if both are logically true and 0 if not.
+</td></tr>
+<tr>
+<th> 13
+</th>
+<td> <code>(a or b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two values from the stack, push 1 if either are logically true and 0 if not.
+</td></tr>
+<tr>
+<th> 14
+</th>
+<td> <code>(not a)</code>
+</td>
+<td> -1
+</td>
+<td> +1
+</td>
+<td> Pop one value from the stack, push 0 if it is logically true and 1 if not.
+</td></tr>
+<tr>
+<th> 15
+</th>
+<td> <code>(a contains b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td>
+<p>Pop two values from the stack, push 1 if the first is a string that contains the second and 0 if not.
+</p><p>The text comparison is case-insensitive and ignores diacritic marks, e.g. "a" and "Ã…" are treated the same.
+</p>
+</td></tr>
+<tr>
+<th> 16
+</th>
+<td> <code>(a starts b)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td>
+<p>Pop two values from the stack, push 1 if the first is a string that begins with second string and 0 if not.
+</p><p>The text comparison is case-insensitive and ignores diacritic marks, e.g. "a" and "Ã…" are treated the same.
+</p>
+</td></tr>
+<tr>
+<th> 17
+</th>
+<td> <code>(char a of c)</code>
+<p><code>(char a to b of c)</code>
+</p><p><code>(item 1 to 3 of someItems)</code>
+</p>
+</td>
+<td> -9
+</td>
+<td> +1
+</td>
+<td> String slice/split operation. It takes nine arguments from the stack:
+<table class="wikitable">
+
+<tbody><tr>
+<th> -9
+</th>
+<td> First char position
+</td></tr>
+<tr>
+<th> -8
+</th>
+<td> Last char position
+</td></tr>
+<tr>
+<th> -7
+</th>
+<td> First word position
+</td></tr>
+<tr>
+<th> -6
+</th>
+<td> Last word position
+</td></tr>
+<tr>
+<th> -5
+</th>
+<td> First item position <i>(items separated by</i> <code>the itemDelimiter</code><i>, which is a comma by default)</i>
+</td></tr>
+<tr>
+<th> -4
+</th>
+<td> Last item position
+</td></tr>
+<tr>
+<th> -3
+</th>
+<td> First line position
+</td></tr>
+<tr>
+<th> -2
+</th>
+<td> Last line position
+</td></tr>
+<tr>
+<th> -1
+</th>
+<td> The string to slice
+</td></tr></tbody></table>
+<p>The positions used here are one-based, so zero is invalid as a position and is instead used to indicate unused parameters. Only one "first X position" can be set, the rest must be zero. The corresponding "last X position" may either be set too, or it can be zero, in which case the first position will also be used as the last.
+</p>
+</td></tr>
+<tr>
+<th> 18
+</th>
+<td> <code>hilite word 1 of field 10</code>
+</td>
+<td> -9
+</td>
+<td>
+</td>
+<td> Highlight (select) some text. The nine arguments taken from the stack are:
+<table class="wikitable">
+
+<tbody><tr>
+<th> -9
+</th>
+<td> First char position
+</td></tr>
+<tr>
+<th> -8
+</th>
+<td> Last char position
+</td></tr>
+<tr>
+<th> -7
+</th>
+<td> First word position
+</td></tr>
+<tr>
+<th> -6
+</th>
+<td> Last word position
+</td></tr>
+<tr>
+<th> -5
+</th>
+<td> First item position
+</td></tr>
+<tr>
+<th> -4
+</th>
+<td> Last item position
+</td></tr>
+<tr>
+<th> -3
+</th>
+<td> First line position
+</td></tr>
+<tr>
+<th> -2
+</th>
+<td> Last line position
+</td></tr>
+<tr>
+<th> -1
+</th>
+<td> Field number (cast ID)
+</td></tr></tbody></table>
+<p>The positions used here are one-based, so zero is invalid as a position and is instead used to indicate unused parameters. Only one "first X position" can be set, the rest must be zero. The corresponding "last X position" may either be set too, or it can be zero, in which case the first position will also be used as the last.
+</p>
+</td></tr>
+<tr>
+<th> 19
+</th>
+<td> <code>(sprite 1 intersects 2)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two sprite IDs and push 1 if the bounding rectangles of the two sprites touch at all, or 0 if they do not.
+</td></tr>
+<tr>
+<th> 1A
+</th>
+<td> <code>(sprite 1 within 2)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td> Pop two sprite IDs and push 1 if the bounding rectangle of the first is entirely inside the bounding rectangle of the second, or 0 if not.
+</td></tr>
+<tr>
+<th> 1B
+</th>
+<td> <code>(field 1)</code>
+</td>
+<td> -1
+</td>
+<td> +1
+</td>
+<td> Pop a cast ID (name or number), push the value of that cast member's <code>text</code> property.
+</td></tr>
+<tr>
+<th> 1C
+</th>
+<td> <code>tell someObject to go to frame 1</code>
+</td>
+<td> -1
+</td>
+<td>
+</td>
+<td> Pop an object from the stack and begin running subsequent bytecodes in the context of that object, until code 1D is encountered.
+</td></tr>
+<tr>
+<th> 1D
+</th>
+<td> <code>tell someObject to go to frame 1</code>
+</td>
+<td>
+</td>
+<td>
+</td>
+<td> Marker for the end of a sequence of bytecodes started by 1C. Similar to 01 except for nested bytecode chunks instead of the main one.
+</td></tr>
+<tr>
+<th> 1E
+</th>
+<td>
+</td>
+<td> -1
+</td>
+<td> +1
+</td>
+<td> Some kind of list transformation or check, seen used just before setting the actorList to []. More research is needed to know exactly what is happening there.
+</td></tr>
+<tr>
+<th> 1F
+</th>
+<td> <code>[#key: value]</code>
+</td>
+<td> -1
+</td>
+<td> +1
+</td>
+<td> Pops a list that must be in the form [#symbol1, val1, #symbol2, val2 ...] to transform into [#symbol1: val1, #symbol2: val2 ...]
+</td></tr></tbody></table>
+<h1> <span class="mw-headline" id="Two-Byte_Instructions"> Two-Byte Instructions </span></h1>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 41 XX
+</th>
+<td> <code>1</code> .. <code>127</code>
+</td>
+<td>
+</td>
+<td> +1
+</td>
+<td> Push integer of value XX, which must be between 1 and 127, inclusive. To push zero, use 03. To push larger integers, use 81 XX YY.
+</td></tr>
+<tr>
+<th> 42 XX
+</th>
+<td> <code>a, b, c</code>
+</td>
+<td> -XX
+</td>
+<td> +1
+</td>
+<td> Pop the specified number of values off the top of the stack, create an unparenthesized argument list containing them (i.e. for a call statement like <code>myFunction 1, 2, 3</code>), and push that to the stack.
+</td></tr>
+<tr>
+<th> 43 XX
+</th>
+<td> <code>[a, b, c]</code>
+</td>
+<td> -XX
+</td>
+<td> +1
+</td>
+<td> Pop the specified number of values off the top of the stack, create a list for them (which can also be used for a parenthesized call expression like <code>set result = myFunction(1, 2, 3)</code>), and push that to the stack.
+</td></tr>
+<tr>
+<th> 44 XX
+</th>
+<td>
+<p><code>"literal"</code>
+</p><p><code>0.5</code>
+</p><p><code>32768</code>
+</p>
+</td>
+<td>
+</td>
+<td> +1
+</td>
+<td> Push a constant from local constant records onto the stack. These records seem to be six bytes long (regardless of the actual size of the constant value), so pushing the first one is <code>44 00</code>, the second is <code>44 06</code>, the third is <code>44 0C</code>, etc.
+</td></tr>
+<tr>
+<th> 45 XX
+</th>
+<td> <code>#symbol</code>
+</td>
+<td>
+</td>
+<td> +1
+</td>
+<td> Push a symbol with a name from namelist[XX]. Note that the name will be stored as "name", not "#name".
+</td></tr>
+<tr>
+<th> 46 XX
+</th></tr>
+<tr>
+<th> 47 XX
+</th></tr>
+<tr>
+<th> 48 XX
+</th></tr>
+<tr>
+<th> 49 XX
+</th>
+<td>
+<p><code>(someGlobal)</code>
+</p><p><i>where previously declared:</i>
+</p><p><code>global someGlobal</code>
+</p>
+</td>
+<td>
+</td>
+<td> +1
+</td>
+<td> Push the value of a global variable with a name from namelist[XX].
+</td></tr>
+<tr>
+<th> 4A XX
+</th></tr>
+<tr>
+<th> 4B XX
+</th>
+<td> <code>(someParam)</code>
+</td>
+<td>
+</td>
+<td> +1
+</td>
+<td> Push the value of a function call parameter. The parameter records seem to be 6 bytes long, so the first is pushed with 4B 00, the second with 4B 06, etc.
+</td></tr>
+<tr>
+<th> 4C XX
+</th>
+<td> <code>(someLocal)</code>
+</td>
+<td>
+</td>
+<td> +1
+</td>
+<td> Push the value of a local variable. The local variable records seem to be 6 bytes long, so the first is pushed with <code>4C 00</code>, the second with <code>4C 06</code>, etc.
+</td></tr>
+<tr>
+<th> 4D XX
+</th></tr>
+<tr>
+<th> 4E XX
+</th></tr>
+
+<tr>
+<th> 4F XX
+</th>
+<td> <code>set someGlobal = 0</code>
+</td>
+<td> -1
+</td>
+<td>
+</td>
+<td> Pop one value and use it to set the global variable with name from namelist[XX].
+</td></tr>
+<tr>
+<th> 50 XX
+</th></tr>
+<tr>
+<th> 51 XX
+</th></tr>
+<tr>
+<th> 52 XX
+</th>
+<td> <code>set someLocal = 0</code>
+</td>
+<td> -1
+</td>
+<td>
+</td>
+<td> Pop one value and use it to set a local variable. See code 4C 00 for a note about local variable records.
+</td></tr>
+<tr>
+<th> 53 XX
+</th></tr>
+<tr>
+<th> 54 XX
+</th>
+<td> <code>end repeat</code>
+</td>
+<td>
+</td>
+<td>
+</td>
+<td> Unconditional backwards jump by XX bytes, relative to the first byte of this instruction.
+</td></tr>
+<tr>
+<th> 55 XX
+</th></tr>
+<tr>
+<th> 56 XX
+</th>
+<td> <code>localFunction(1,2,3)</code>
+</td>
+<td> -1
+</td>
+<td> +1 or +0
+</td>
+<td> Call a function defined in this script with the name at namelist[XX]. The top value on the stack must be an argument list. If the argument list was created with code 43 XX, one return value will be pushed to the stack. If the argument list was created with code 42 XX, no return value will be pushed.
+</td></tr>
+<tr>
+<th> 57 XX
+</th>
+<td> <code>someFunction 1,2,3</code>
+<p><code>(someFunction(1,2,3))</code>
+</p>
+</td>
+<td> -1
+</td>
+<td> +1 OR +0
+</td>
+<td> Call the external function with name from namelist[XX]. The top value on the stack must be an argument list. If the argument list was created with code 43 XX, one return value will be pushed to the stack. If the argument list was created with code 42 XX, no return value will be pushed.
+</td></tr>
+<tr>
+<th> 58 XX
+</th>
+<td> <code>someObject(mSomeMethod, 1,2,3)</code>
+</td>
+<td> -2
+</td>
+<td> +1 OR +0
+</td>
+<td> Pop [argument list, call target] to make a method call. If the call target is a literal number, this indicates a local variable is the target. It must be divided by six to get the actual local variable number. The first argument of the argument list will be a symbol with the name of the method. Note: It is still unclear what difference the value of XX makes. It has been seen as 0x01 and 0x05. More research is needed to know more. (Possibly local variables vs. call parameters?)
+</td></tr>
+<tr>
+<th> 59 16
+</th>
+<td> <code>put "extra" into textVar</code>
+</td>
+<td> -1
+</td>
+<td>
+</td>
+<td> (Not sure how the target value is specified, needs more research)
+</td></tr>
+<tr>
+<th> 59 25
+</th>
+<td> <code>put "extra" after textVar</code>
+</td>
+<td> -1
+</td>
+<td>
+</td>
+<td> (See above)
+</td></tr>
+<tr>
+<th> 59 35
+</th>
+<td> <code>put "extra" before textVar</code>
+</td>
+<td> -1
+</td>
+<td>
+</td>
+<td> (See above)
+</td></tr>
+<tr>
+<th> 5A XX
+</th></tr>
+<tr>
+<th> 5B 05
+</th>
+<td> <code>delete word 3 of textVar</code>
+</td>
+<td> -1
+</td>
+<td>
+</td>
+<td> (See above)
+</td></tr>
+<tr>
+<th> 5C 00
+</th>
+<td>
+<p><code>(the abbr time)</code>
+</p><p><code>(the short date)</code>
+</p><p><code>(the last word in someText)</code>
+</p>
+</td>
+<td> -1 OR -2
+</td>
+<td> +1
+</td>
+<td>
+<p>If the top value is one of the following setting IDs, pop it from the stack, and push the current value of the setting:
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 00
+</th>
+<td> <code>the floatPrecision</code>
+</td></tr>
+<tr>
+<th> 01
+</th>
+<td> <code>the mouseDownScript</code>
+</td></tr>
+<tr>
+<th> 02
+</th>
+<td> <code>the mouseUpScript</code>
+</td></tr>
+<tr>
+<th> 03
+</th>
+<td> <code>the keyDownScript</code>
+</td></tr>
+<tr>
+<th> 04
+</th>
+<td> <code>the keyUpScript</code>
+</td></tr>
+<tr>
+<th> 05
+</th>
+<td> <code>the timeoutScript</code>
+</td></tr></tbody></table>
+<p>If the top value is a time-formatting ID, pop it from the stack, and push the current time formatted using it:
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 06
+</th>
+<td> <code>the short time</code>
+</td>
+<td> 1:09 AM
+</td></tr>
+<tr>
+<th> 07
+</th>
+<td> <code>the abbreviated time</code>, <code>the abbrev time</code>, <code>the abbr time</code>
+</td>
+<td> 1:09 AM
+</td></tr>
+<tr>
+<th> 08
+</th>
+<td> <code>the long time</code>
+</td>
+<td> 1:09:38 AM
+</td></tr></tbody></table>
+<p>If the top value is a date-formatting ID, pop it from the stack, and push the current date formatted using it:
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 09
+</th>
+<td> <code>the short date</code>
+</td>
+<td> 3/4/16
+</td></tr>
+<tr>
+<th> 0A
+</th>
+<td> <code>the abbreviated date</code>, <code>the abbrev date</code>, <code>the abbr date</code>
+</td>
+<td> Mon, Mar 14, 2016
+</td></tr>
+<tr>
+<th> 0B
+</th>
+<td> <code>the long date</code>
+</td>
+<td> Monday, March 14, 2016
+</td></tr></tbody></table>
+<p>If the top value is a slice type ID, pop both it and the previous value from the stack. The previous value will be a string, slice the last "bit" of it according to the slice type, and push the sliced value:
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 0C
+</th>
+<td> <code>the last char</code>
+</td></tr>
+<tr>
+<th> 0D
+</th>
+<td> <code>the last word</code>
+</td></tr>
+<tr>
+<th> 0E
+</th>
+<td> <code>the last item</code>
+</td></tr>
+<tr>
+<th> 0F
+</th>
+<td> <code>the last line</code>
+</td></tr></tbody></table>
+</td></tr>
+<tr>
+<th> 5C 01
+</th>
+<td> <code>(the number of chars in someText)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td>
+<p>Pop [text, stat ID] and push the stat value for the given text, using these stat IDs:
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 01
+</th>
+<td> chars
+</td></tr>
+<tr>
+<th> 02
+</th>
+<td> words
+</td></tr>
+<tr>
+<th> 03
+</th>
+<td> items <i>(separated by</i> <code>the itemDelimiter</code><i>, which is a comma by default)</i>
+</td></tr>
+<tr>
+<th> 04
+</th>
+<td> lines
+</td></tr></tbody></table>
+</td></tr>
+<tr>
+<th> 5C 02
+</th>
+<td> <code>(the name of menu 1)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td>
+<p>Pop [menu ID, property ID] and push the value of the specified menu property, using these property IDs:
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 01
+</th>
+<td> <code>name</code>
+</td></tr>
+<tr>
+<th> 02
+</th>
+<td> <code>number of menuItems</code>
+</td></tr></tbody></table>
+</td></tr>
+<tr>
+<th> 5C 03
+</th>
+<td> <code>(the name of menuItem 3 of menu 1)</code>
+</td>
+<td> -3
+</td>
+<td> +1
+</td>
+<td>
+<p>Pop [item ID, menu ID, property ID] and push the value of the specified menu item property, using these property IDs:
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 01
+</th>
+<td> <code>name</code>
+</td></tr>
+<tr>
+<th> 02
+</th>
+<td> <code>checkMark</code>
+</td></tr>
+<tr>
+<th> 03
+</th>
+<td> <code>enabled</code>
+</td></tr>
+<tr>
+<th> 04
+</th>
+<td> <code>script</code>
+</td></tr></tbody></table>
+</td></tr>
+<tr>
+<th> 5C 04
+</th>
+<td> <code>(the volume of sound 1)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td>
+<p>Pop [sound ID, property ID] and push the value of the specified sound property, using these property IDs:
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 01
+</th>
+<td> <code>volume</code> (0 to 255)
+</td></tr></tbody></table>
+</td></tr>
+<tr>
+<th> 5C 06
+</th>
+<td> <code>(the cursor of sprite 3)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td>
+<p>Pop [sprite ID, property ID] and push the value of the specified sprite property, using these property IDs:
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 01
+</th>
+<td> <code>type</code>
+</td></tr>
+<tr>
+<th> 02
+</th>
+<td> <code>backColor</code>
+</td></tr>
+<tr>
+<th> 03
+</th>
+<td> <code>bottom</code>
+</td></tr>
+<tr>
+<th> 04
+</th>
+<td> <code>castNum</code>
+</td></tr>
+<tr>
+<th> 05
+</th>
+<td> <code>constraint</code>
+</td></tr>
+<tr>
+<th> 06
+</th>
+<td> <code>cursor</code>
+</td></tr>
+<tr>
+<th> 07
+</th>
+<td> <code>foreColor</code>
+</td></tr>
+<tr>
+<th> 08
+</th>
+<td> <code>height</code>
+</td></tr>
+<tr>
+<th> 0A
+</th>
+<td> <code>ink</code>
+</td></tr>
+<tr>
+<th> 0B
+</th>
+<td> <code>left</code>
+</td></tr>
+<tr>
+<th> 0C
+</th>
+<td> <code>lineSize</code>
+</td></tr>
+<tr>
+<th> 0D
+</th>
+<td> <code>locH</code>
+</td></tr>
+<tr>
+<th> 0E
+</th>
+<td> <code>locV</code>
+</td></tr>
+<tr>
+<th> 0F
+</th>
+<td> <code>movieRate</code>
+</td></tr>
+<tr>
+<th> 10
+</th>
+<td> <code>movieTime</code>
+</td></tr>
+<tr>
+<th> 12
+</th>
+<td> <code>puppet</code>
+</td></tr>
+<tr>
+<th> 13
+</th>
+<td> <code>right</code>
+</td></tr>
+<tr>
+<th> 14
+</th>
+<td> <code>startTime</code>
+</td></tr>
+<tr>
+<th> 15
+</th>
+<td> <code>stopTime</code>
+</td></tr>
+<tr>
+<th> 16
+</th>
+<td> <code>stretch</code>
+</td></tr>
+<tr>
+<th> 17
+</th>
+<td> <code>top</code>
+</td></tr>
+<tr>
+<th> 18
+</th>
+<td> <code>trails</code>
+</td></tr>
+<tr>
+<th> 19
+</th>
+<td> <code>visible</code>
+</td></tr>
+<tr>
+<th> 1A
+</th>
+<td> <code>volume</code> (-256 to 256, <= 0 is silent)
+</td></tr>
+<tr>
+<th> 1B
+</th>
+<td> <code>width</code>
+</td></tr>
+<tr>
+<th> 1D
+</th>
+<td> <code>scriptNum</code>
+</td></tr>
+<tr>
+<th> 1E
+</th>
+<td> <code>moveableSprite</code>
+</td></tr>
+<tr>
+<th> 20
+</th>
+<td> <code>scoreColor</code>
+</td></tr></tbody></table>
+<p>The values for <code>type</code> are:
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 0
+</th>
+<td> inactive
+</td></tr>
+<tr>
+<th> 1
+</th>
+<td> bitmap
+</td></tr>
+<tr>
+<th> 2
+</th>
+<td> rectangle
+</td></tr>
+<tr>
+<th> 3
+</th>
+<td> rounded rectangle
+</td></tr>
+<tr>
+<th> 4
+</th>
+<td> oval
+</td></tr>
+<tr>
+<th> 5
+</th>
+<td> line top-left to bottom-right
+</td></tr>
+<tr>
+<th> 6
+</th>
+<td> line bottom-left to top-right
+</td></tr>
+<tr>
+<th> 7
+</th>
+<td> text
+</td></tr>
+<tr>
+<th> 8
+</th>
+<td> button
+</td></tr>
+<tr>
+<th> 9
+</th>
+<td> checkbox
+</td></tr>
+<tr>
+<th> 10
+</th>
+<td> radio button
+</td></tr>
+<tr>
+<th> 16
+</th>
+<td> undetermined (try the castType of the associated cast member)
+</td></tr></tbody></table>
+</td></tr>
+<tr>
+<th> 5C 07
+</th>
+<td> <code>(the exitLock)</code>
+</td>
+<td> -1
+</td>
+<td> +1
+</td>
+<td>
+<p>Pop a setting ID from the stack and push its value, using these setting IDs:
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 01
+</th>
+<td> <code>the beepOn</code>
+</td></tr>
+<tr>
+<th> 02
+</th>
+<td> <code>the buttonStyle</code>
+</td></tr>
+<tr>
+<th> 03
+</th>
+<td> <code>the centerStage</code>
+</td></tr>
+<tr>
+<th> 04
+</th>
+<td> <code>the checkBoxAccess</code>
+</td></tr>
+<tr>
+<th> 05
+</th>
+<td> <code>the checkBoxType</code>
+</td></tr>
+<tr>
+<th> 06
+</th>
+<td> <code>the colorDepth</code>
+</td></tr>
+<tr>
+<th> 08
+</th>
+<td> <code>the exitLock</code>
+</td></tr>
+<tr>
+<th> 09
+</th>
+<td> <code>the fixStageSize</code>
+</td></tr>
+<tr>
+<th> 13
+</th>
+<td> <code>the timeoutLapsed</code>
+</td></tr>
+<tr>
+<th> 17
+</th>
+<td> <code>the selEnd</code>
+</td></tr>
+<tr>
+<th> 18
+</th>
+<td> <code>the selStart</code>
+</td></tr>
+<tr>
+<th> 19
+</th>
+<td> <code>the soundEnabled</code>
+</td></tr>
+<tr>
+<th> 1A
+</th>
+<td> <code>the soundLevel</code>
+</td></tr>
+<tr>
+<th> 1B
+</th>
+<td> <code>the stageColor</code>
+</td></tr>
+<tr>
+<th> 1D
+</th>
+<td> <code>the stillDown</code>
+</td></tr>
+<tr>
+<th> 1E
+</th>
+<td> <code>the timeoutKeyDown</code>
+</td></tr>
+<tr>
+<th> 1F
+</th>
+<td> <code>the timeoutLength</code>
+</td></tr>
+<tr>
+<th> 20
+</th>
+<td> <code>the timeoutMouse</code>
+</td></tr>
+<tr>
+<th> 21
+</th>
+<td> <code>the timeoutPlay</code>
+</td></tr>
+<tr>
+<th> 22
+</th>
+<td> <code>the timer</code>
+</td></tr></tbody></table>
+</td></tr>
+<tr>
+<th> 5C 08
+</th>
+<td> <code>(the number of castMembers)</code>
+</td>
+<td> -1
+</td>
+<td> +1
+</td>
+<td>
+<p>Pop a stat ID from the stack and push the stat, using these stat IDs:
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 01
+</th>
+<td> <code>the perFrameHook</code>
+</td></tr>
+<tr>
+<th> 02
+</th>
+<td> <code>number of castMembers</code>
+</td></tr>
+<tr>
+<th> 03
+</th>
+<td> <code>number of menus</code>
+</td></tr></tbody></table>
+</td></tr>
+<tr>
+<th> 5C 09
+</th>
+<td>
+<p><code>(the picture of cast "bob")</code>
+</p><p><code>(the name of cast 3)</code>
+</p>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td>
+<p>Pop [cast ID, property ID] from the stack and push the value of the cast property, using these property IDs:
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 01
+</th>
+<td> <code>name</code>
+</td></tr>
+<tr>
+<th> 02
+</th>
+<td> <code>text</code>
+</td></tr>
+<tr>
+<th> 08
+</th>
+<td> <code>picture</code>
+</td></tr>
+<tr>
+<th> 0A
+</th>
+<td> <code>number</code>
+</td></tr>
+<tr>
+<th> 0B
+</th>
+<td> <code>size</code>
+</td></tr>
+<tr>
+<th> 11
+</th>
+<td> <code>foreColor</code>
+</td></tr>
+<tr>
+<th> 12
+</th>
+<td> <code>backColor</code>
+</td></tr></tbody></table>
+</td></tr>
+<tr>
+<th> 5C 0C
+</th>
+<td> <code>(the textSize of field 1)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td>
+<p>Pop [field ID, property ID] and push the value of the property for the given field according to these property IDs:
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 03
+</th>
+<td> <code>textStyle</code>
+</td></tr>
+<tr>
+<th> 04
+</th>
+<td> <code>textFont</code>
+</td></tr>
+<tr>
+<th> 05
+</th>
+<td> <code>textHeight</code>
+</td></tr>
+<tr>
+<th> 06
+</th>
+<td> <code>textAlign</code>
+</td></tr>
+<tr>
+<th> 07
+</th>
+<td> <code>textSize</code>
+</td></tr></tbody></table>
+</td></tr>
+<tr>
+<th> 5C 0D
+</th>
+<td> <code>(the sound of cast 5)</code>
+</td>
+<td> -2
+</td>
+<td> +1
+</td>
+<td>
+<p>Pop [cast ID, property ID] and push the value of property for the given cast according to these property IDs:
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 10
+</th>
+<td> <code>sound</code>
+</td></tr></tbody></table>
+</td></tr>
+<tr>
+<th> 5D 00
+</th>
+<td> <code>when keyDown then beep</code>
+</td>
+<td> -2
+</td>
+<td>
+</td>
+<td>
+<p>Pop [statement, eventID] and set the statement (Lingo source code in a text string) to run on the given event:
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 01
+</th>
+<td> <code>mouseDown</code>
+</td></tr>
+<tr>
+<th> 02
+</th>
+<td> <code>mouseUp</code>
+</td></tr>
+<tr>
+<th> 03
+</th>
+<td> <code>keyDown</code>
+</td></tr>
+<tr>
+<th> 04
+</th>
+<td> <code>keyUp</code>
+</td></tr>
+<tr>
+<th> 05
+</th>
+<td> <code>timeOut</code>
+</td></tr></tbody></table>
+</td></tr>
+<tr>
+<th> 5D 03
+</th>
+<td> <code>set the enabled of menuItem 3 of menu 5 to FALSE</code>
+</td>
+<td> -4
+</td>
+<td>
+</td>
+<td> Pop [menuItem ID, menu ID, new value, property ID] and set the menu item property. See the table for code 5C 03 for menu item property IDs.
+</td></tr>
+<tr>
+<th> 5D 04
+</th>
+<td> <code>set the volume of sound 3 to 255</code>
+</td>
+<td> -3
+</td>
+<td>
+</td>
+<td> Pop [sound ID, new value, property ID] and set the menu item property. See the table for code 5C 04 for sound property IDs.
+</td></tr>
+<tr>
+<th> 5D 06
+</th>
+<td> <code>set the constraint of sprite 3 to 0</code>
+</td>
+<td> -3
+</td>
+<td>
+</td>
+<td> Pop [sprite ID, new value, property ID] and set the sprite property. See the table for code 5C 06 for sprite property IDs.
+</td></tr>
+<tr>
+<th> 5D 07
+</th>
+<td> <code>set the exitLock to TRUE</code>
+</td>
+<td> -2
+</td>
+<td>
+</td>
+<td> Pop [new value, setting ID] and change the relevant setting. See the table for code 5C 07 for setting IDs.
+</td></tr>
+<tr>
+<th> 5D 09
+</th>
+<td> <code>set the backColor of cast "bob" to 0</code>
+</td>
+<td> -3
+</td>
+<td>
+</td>
+<td> Pop [cast ID, new value, property ID] and set the cast property. See the table for code 5C 09 for cast property IDs.
+</td></tr>
+<tr>
+<th> 5D 0C
+</th>
+<td> <code>set the textAlign of field 3 to "right"</code>
+</td>
+<td> -3
+</td>
+<td>
+</td>
+<td> Pop [field ID, new value, property ID] and set the field property. See the table for code 5C 0C for cast property IDs.
+</td></tr>
+<tr>
+<th> 5D 0D
+</th>
+<td> <code>set the sound of cast 3 to TRUE</code>
+</td>
+<td> -3
+</td>
+<td>
+</td>
+<td> Pop [cast ID, new value, property ID] and set the cast property. See the table for code 5C 0D for cast property IDs.
+</td></tr>
+<tr>
+<th> 5E XX
+</th></tr>
+<tr>
+<th> 5F XX
+</th>
+<td> <code>(the someProperty)</code>
+</td>
+<td>
+</td>
+<td> +1
+</td>
+<td> Push the value of the contextual property with the name at namelist[XX].
+</td></tr>
+<tr>
+<th> 60 XX
+</th>
+<td> <code>set the someProperty to 0</code>
+</td>
+<td> -1
+</td>
+<td>
+</td>
+<td> Pop a value and use it to set the contextual property with the name at namelist[XX].
+</td></tr>
+<tr>
+<th> 61 XX
+</th>
+<td> <code>(the someProperty of someVariable)</code>
+</td>
+<td> -1
+</td>
+<td> +1
+</td>
+<td> Pop a property-owning object from the stack, and push the value of this object's property with the name at namelist[XX].
+</td></tr>
+<tr>
+<th> 62 XX
+</th>
+<td> <code>set the someProperty of someVariable to 1</code>
+</td>
+<td> -2
+</td>
+<td>
+</td>
+<td> Pop [property-owning object, new value] from the stack and set the property of the object with the name at namelist[XX].
+</td></tr>
+<tr>
+<th> 63 XX
+</th>
+<td> <code>tell someObject to go to frame 1</code>
+</td>
+<td> -1
+</td>
+<td>
+</td>
+<td> Remote call: Similar to 57 XX except runs in the context of a <code>tell ... to</code> block.
+</td></tr>
+<tr>
+<th> 64 XX
+</th>
+<td>
+</td>
+<td>
+</td>
+<td> +1
+</td>
+<td>
+<p>Push a copy of a value already on the stack, relative to the top where 00 is the top slot, 01 is one slot beneath the top, etc.
+</p><p>This is used by the compiler when generating bytecode for the <code>repeat with i in list</code> block, to keep state in the loop without allocating new local variables.
+</p>
+</td></tr>
+<tr>
+<th> 65 XX
+</th>
+<td>
+</td>
+<td> -XX
+</td>
+<td>
+</td>
+<td>
+<p>Pop and discard XX values from the top of the stack.
+</p><p>This is used in the bytecode generated for a <code>repeat with i in list</code> block, to clean up at the end.
+</p>
+</td></tr>
+<tr>
+<th> 66 XX
+</th>
+<td> <code>(the pathName)</code>
+</td>
+<td> -1
+</td>
+<td> +1
+</td>
+<td> Pop an empty list and push the value of a read-only property named at namelist[XX].
+</td></tr></tbody></table>
+<h1> <span class="mw-headline" id="Three_Byte_Instructions"> Three Byte Instructions </span></h1>
+<table class="wikitable">
+
+<tbody><tr>
+<th> 81 XX YY
+</th>
+<td> <code>128</code> .. <code>32767</code>
+</td>
+<td>
+</td>
+<td> +1
+</td>
+<td> Push the integer ((XX * 0x100) + YY). Larger integers and floats are pushed using constants.
+</td></tr>
+<tr>
+<th> 82 XX YY
+</th>
+<td> <code>someFunc 1, 2, 3,</code> <i>(...)</i> <code>254, 255, 256, 257</code>
+</td>
+<td> -((XX * 0x100) + YY)
+</td>
+<td> +1
+</td>
+<td> Pop ((XX * 0x100) + YY) values from the stack and push a no-return-value argument list object containing these values. Similar to code 42 XX, only necessary when there are more than 255 arguments in the list.
+</td></tr>
+
+<tr>
+<th> 83 XX YY
+</th>
+<td> <code>[1, 2, 3,</code> <i>(...)</i> <code>254, 255, 256, 257]</code>
+</td>
+<td> -((XX * 0x100) + YY)
+</td>
+<td> +1
+</td>
+<td> Pop ((XX * 0x100) + YY) values from the stack and push a list object containing these values. Similar to code 43 XX, only necessary when there are more than 255 items in the list.
+</td></tr>
+<tr>
+<th> 93 XX YY
+</th>
+<td>
+<p><code>else</code>
+</p><p><code>exit repeat</code>
+</p><p><code>next repeat</code>
+</p>
+</td>
+<td>
+</td>
+<td>
+</td>
+<td> Unconditional jump: Advance by ((XX * 0x100) + YY) bytes, relative to the first byte of this instruction (i.e. it may be 3 more than you are expecting)
+<p>(<code>next repeat</code> jumps forward to <code>end repeat</code> instead of jumping back itself)
+</p>
+</td></tr>
+<tr>
+<th> 95 XX YY
+</th>
+<td>
+<p><code>if somethingIsTrue then</code>
+</p><p><code>repeat while somethingIsTrue</code>
+</p>
+</td>
+<td> -1
+</td>
+<td>
+</td>
+<td> Conditional jump: Pop a value, and if it is logically FALSE, advance by ((XX * 0x100) + YY) bytes, relative to the first byte of this instruction
+</td></tr></tbody></table>
+<h1> <span class="mw-headline" id="Syntactic_Sugar"> Syntactic Sugar </span></h1>
+<p>Some functions get special syntax when written out in source code, but under the hood, the compiler just transforms it into more regular syntax. Here is a mapping that shows the equivalent in plain, generalized Lingo that gets used for the bytecode.
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> Specialized Syntax
+</th>
+<th> Generalized Syntax
+</th></tr>
+<tr>
+<td><code>play frame 10 of movie "theMovie"</code>
+</td>
+<td><code>play 10, "theMovie"</code>
+</td></tr>
+<tr>
+<td><code>play frame 10</code>
+</td>
+<td><code>play 10</code>
+</td></tr>
+<tr>
+<td><code>play movie "theMovie"</code>
+</td>
+<td><code>play 1, "theMovie"</code>
+</td></tr>
+<tr>
+<td><code>play done</code>
+</td>
+<td><code>play</code>
+</td></tr>
+<tr>
+<td><pre>repeat with i = 15 to 20
+ ...
+
+end repeat</pre>
+</td>
+<td><pre>set i = 15
+repeat while i <= 20
+ ...
+ set i = i + 1
+end repeat</pre>
+</td></tr>
+<tr>
+<td><pre>repeat with i = 15 down to 10
+ ...
+
+end repeat</pre>
+</td>
+<td><pre>set i = 15
+repeat while i >= 10
+ ...
+ set i = i - 1
+end repeat</pre>
+</td></tr>
+<tr>
+<td><code>sound playFile 1, "Thunder"</code>
+</td>
+<td><code>sound #playFile, 1, "Thunder"</code>
+</td></tr>
+<tr>
+<td><code>sound fadeIn 5</code>
+</td>
+<td><code>sound #fadeIn, 5</code>
+</td></tr>
+<tr>
+<td><code>sound fadeIn 5, 10</code>
+</td>
+<td><code>sound #fadeIn, 5, 10</code>
+</td></tr>
+<tr>
+<td><code>sound fadeOut 5</code>
+</td>
+<td><code>sound #fadeOut, 5</code>
+</td></tr>
+<tr>
+<td><code>sound fadeOut 5, 10</code>
+</td>
+<td><code>sound #fadeOut, 5, 10</code>
+</td></tr>
+<tr>
+<td><code>sound stop 1</code>
+</td>
+<td><code>sound #stop, 1</code>
+</td></tr>
+<tr>
+<td><code>sound close 1</code>
+</td>
+<td><code>sound #close, 1</code>
+</td></tr>
+<tr>
+<td><code>go to frame 10</code>
+<p><code>go frame 10</code>
+</p><p><code>go to 10</code>
+</p>
+</td>
+<td><code>go 10</code>
+</td></tr>
+<tr>
+<td><code>go to movie "theMovie"</code>
+<p><code>go movie "theMovie"</code>
+</p>
+</td>
+<td><code>go 1, "theMovie"</code>
+</td></tr>
+<tr>
+<td><code>go to frame 10 of movie "theMovie"</code>
+<p><code>go frame 10 of movie "theMovie"</code>
+</p><p><code>go to 10 of movie "theMovie"</code>
+</p><p><code>go 10 of movie "theMovie"</code>
+</p>
+</td>
+<td><code>go 10, "theMovie"</code>
+</td></tr>
+<tr>
+<td><code>go loop</code>
+</td>
+<td><code>go #loop</code>
+</td></tr>
+<tr>
+<td><code>go next</code>
+</td>
+<td><code>go #next</code>
+</td></tr>
+<tr>
+<td><code>go previous</code>
+</td>
+<td><code>go #previous</code>
+</td></tr>
+<tr>
+<td><code>open "document" with "application"</code>
+</td>
+<td><code>open "document", "application"</code>
+</td></tr>
+<tr>
+<td><code>set obj = GetObject()<br>obj(mSomeMethod, 1, 2, 3)</code>
+</td>
+<td><code>set obj = GetObject()<br>obj(#mSomeMethod, 1, 2, 3)</code>
+</td></tr></tbody></table>
+<h1> <span class="mw-headline" id="Lscr_bytecode-container_chunk_layout"> <code>Lscr</code> bytecode-container chunk layout </span></h1>
+<h2> <span class="mw-headline" id="Header"> Header </span></h2>
+<table class="wikitable">
+
+<tbody><tr>
+<td colspan="3">...
+</td></tr>
+<tr>
+<th> $0040-$0041
+</th>
+<td> uint16
+</td>
+<td> Offset to the function records block
+</td></tr>
+<tr>
+<td colspan="3">...
+</td></tr>
+<tr>
+<th> $004E-$004F
+</th>
+<td> uint16
+</td>
+<td> Number of constants
+</td></tr>
+<tr>
+<td colspan="3">...
+</td></tr>
+<tr>
+<th> $0048-$0049
+</th>
+<td> uint16
+</td>
+<td> Number of function records
+</td></tr>
+<tr>
+<td colspan="3">...
+</td></tr>
+<tr>
+<th> $0052-$0053
+</th>
+<td> uint16
+</td>
+<td> Offset to the constant records block
+</td></tr>
+<tr>
+<td colspan="3">...
+</td></tr>
+<tr>
+<th> $005A-$005B
+</th>
+<td> uint16
+</td>
+<td> Base address for constant data
+</td></tr></tbody></table>
+<h2> <span class="mw-headline" id="Function_Record"> Function Record </span></h2>
+<p>Each function record is 42 bytes long.
+</p>
+<table class="wikitable">
+
+<tbody><tr>
+<th> $0000-$0001
+</th>
+<td> uint16
+</td>
+<td> Namelist index for the function's name, or 0xFFFF if there is no name(?)
+</td></tr>
+<tr>
+<th> $0002-$0003
+</th>
+<td> uint16
+</td>
+<td> Unknown
+</td></tr>
+<tr>
+<th> $0004-$0007
+</th>
+<td> uint32
+</td>
+<td> Length of the function bytecode in bytes
+</td></tr>
+<tr>
+<th> $0008-$000B
+</th>
+<td> uint32
+</td>
+<td> Offset to the function bytecode
+</td></tr>
+<tr>
+<th> $000C-$000D
+</th>
+<td> uint16
+</td>
+<td> Number of arguments
+</td></tr>
+<tr>
+<th> $000E-$0011
+</th>
+<td> uint32
+</td>
+<td> Unknown
+</td></tr>
+<tr>
+<th> $0012-$0013
+</th>
+<td> uint16
+</td>
+<td> Number of local variables
+</td></tr>
+<tr>
+<th> $0014-$0017
+</th>
+<td> uint32
+</td>
+<td> Unknown
+</td></tr>
+<tr>
+<th> $0018-$0019
+</th>
+<td> uint16
+</td>
+<td> Count (C)
+</td></tr>
+<tr>
+<th> $001A-$001D
+</th>
+<td> uint32
+</td>
+<td> Unknown
+</td></tr>
+<tr>
+<th> $001E-$0021
+</th>
+<td> uint32
+</td>
+<td> Unknown
+</td></tr>
+<tr>
+<th> $0022-$0023
+</th>
+<td> uint16
+</td>
+<td> Unknown
+</td></tr>
+<tr>
+<th> $0024-$0025
+</th>
+<td> uint16
+</td>
+<td> Count (D)
+</td></tr>
+<tr>
+<th> $0026-$0029
+</th>
+<td> uint32
+</td>
+<td> Unknown
+</td></tr></tbody></table>
+<h2> <span class="mw-headline" id="Bytecode_Trailer"> Bytecode Trailer </span></h2>
+<p>After the bytecode section for a function (determined using the offset and length fields from the function record), and then after an additional padding byte if there are an odd number of bytes in the bytecode, are the following values:
+</p>
+<ul><li> For each argument: uint16 namelist index for the argument's name
+</li><li> For each local variable: uint16 namelist index for the variable's name
+</li><li> Count (C) * uint16
+</li><li> Count (D) * uint8
+</li><li> A padding byte if Count (D) is an odd number
+</li></ul>
+<h2> <span class="mw-headline" id="Constants"> Constants </span></h2>
+<p>Each constant record is six bytes long and has this format:
+</p>
+<ul><li> uint16: Value type ID
+</li><li> uint32: Data address, relative to the base address given in the header
+</li></ul>
+<p>Here is how the value type IDs correspond to the data found at the given address:
+</p>
+<table class="wikitable">
+<tbody><tr>
+<th> 01
+</th>
+<td> Text string
+</td>
+<td> uint32 length (including null terminator) followed immediately by the character data
+</td></tr>
+<tr>
+<th> 04
+</th>
+<td> 32-bit unsigned integer
+</td>
+<td> "Data address" not an address, but the value itself
+</td></tr>
+<tr>
+<th> 09
+</th>
+<td> Floating point
+</td>
+<td> uint32 length followed by the floating point data. In practice, the length always seems to be 10, so the number is an 80-bit extended precision number.
+</td></tr></tbody></table>
+<h1> <span class="mw-headline" id="Projector_File_.28Windows.29"> Projector File (Windows) </span></h1>
+<h2> <span class="mw-headline" id="Director_3.0"> Director 3.0 </span></h2>
+<p>At the very end of the projector executable is a 32-bit little-endian file address.
+</p><p>At this location is found:
+</p>
+<ul><li> 7 bytes: Not sure/more research needed
+</li><li> uint32: Length of the RIFF block
+</li><li> uint8: Length of the original RIFF file's name
+</li><li> ASCII: Original RIFF file's name
+</li><li> uint8: Length of the original RIFF file's parent folder
+</li><li> ASCII: Original RIFF file's parent folder
+</li><li> RIFF block
+</li></ul>
+<h2> <span class="mw-headline" id="Director_4.0"> Director 4.0 </span></h2>
+<p>At the very end of the projector executable is a 32-bit little-endian file address.
+</p><p>At this location is found:
+</p>
+<ul><li> ASCII "PJ93"
+</li><li> The file address of the main RIFF data file
+</li><li> Six further addresses for other embedded data (more research required to know more about these)
+</li></ul>
+
+<!--
+NewPP limit report
+Preprocessor node count: 196/1000000
+Post-expand include size: 1279/2097152 bytes
+Template argument size: 338/2097152 bytes
+Expensive parser function count: 0/100
+-->
+
+<!-- Saved in parser cache with key justsolve:pcache:idhash:6263-0!*!0!!en!*!* and timestamp 20160712223455 -->
+</div> <!-- /bodycontent -->
+ <!-- printfooter -->
+ <div class="printfooter">
+ Retrieved from "<a href="http://fileformats.archiveteam.org/index.php?title=Lingo_bytecode&oldid=25053">http://fileformats.archiveteam.org/index.php?title=Lingo_bytecode&oldid=25053</a>" </div>
+ <!-- /printfooter -->
+ <!-- catlinks -->
+ <div id="catlinks" class="catlinks"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="http://fileformats.archiveteam.org/wiki/Special:Categories" title="Special:Categories">Categories</a>: <ul><li><a href="http://fileformats.archiveteam.org/wiki/Category:File_Formats" title="Category:File Formats">File Formats</a></li><li><a href="http://fileformats.archiveteam.org/wiki/Category:Electronic_File_Formats" title="Category:Electronic File Formats">Electronic File Formats</a></li><li><a href="http://fileformats.archiveteam.org/wiki/Category:Development" title="Category:Development">Development</a></li></ul></div><div id="mw-hidden-catlinks" class="mw-hidden-catlinks mw-hidden-cats-hidden">Hidden categories: <ul><li><a href="http://fileformats.archiveteam.org/wiki/Category:FormatInfo_without_extensions" title="Category:FormatInfo without extensions">FormatInfo without extensions</a></li><li><a href="http://fileformats.archiveteam.org/wiki/Category:FormatInfo_without_mimetypes" title="Category:FormatInfo without mimetypes">FormatInfo without mimetypes</a></li></ul></div></div> <!-- /catlinks -->
+ <div class="visualClear"></div>
+ <!-- debughtml -->
+ <!-- /debughtml -->
+ </div>
+ <!-- /bodyContent -->
+ </div>
+ <!-- /content -->
+ <!-- header -->
+ <div id="mw-head" class="noprint">
+
+<!-- 0 -->
+<div id="p-personal" class="">
+ <h5>Personal tools</h5>
+ <ul>
+ <li id="pt-login"><a href="http://fileformats.archiveteam.org/index.php?title=Special:UserLogin&returnto=Lingo+bytecode" title="You are encouraged to log in; however, it is not mandatory [ctrl-option-o]" accesskey="o">Log in / create account</a></li>
+ </ul>
+</div>
+
+<!-- /0 -->
+ <div id="left-navigation">
+
+<!-- 0 -->
+<div id="p-namespaces" class="vectorTabs">
+ <h5>Namespaces</h5>
+ <ul>
+ <li id="ca-nstab-main" class="selected"><span><a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode" title="View the content page [ctrl-option-c]" accesskey="c">Page</a></span></li>
+ <li id="ca-talk" class="new"><span><a href="http://fileformats.archiveteam.org/index.php?title=Talk:Lingo_bytecode&action=edit&redlink=1" title="Discussion about the content page [ctrl-option-t]" accesskey="t">Discussion</a></span></li>
+ </ul>
+</div>
+
+<!-- /0 -->
+
+<!-- 1 -->
+<div id="p-variants" class="vectorMenu emptyPortlet">
+ <h4>
+ </h4>
+ <h5><span>Variants</span><a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#"></a></h5>
+ <div class="menu">
+ <ul>
+ </ul>
+ </div>
+</div>
+
+<!-- /1 -->
+ </div>
+ <div id="right-navigation">
+
+<!-- 0 -->
+<div id="p-views" class="vectorTabs">
+ <h5>Views</h5>
+ <ul>
+ <li id="ca-view" class="selected"><span><a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode">Read</a></span></li>
+ <li id="ca-viewsource"><span><a href="http://fileformats.archiveteam.org/index.php?title=Lingo_bytecode&action=edit" title="This page is protected.
+You can view its source [ctrl-option-e]" accesskey="e">View source</a></span></li>
+ <li id="ca-history" class="collapsible"><span><a href="http://fileformats.archiveteam.org/index.php?title=Lingo_bytecode&action=history" title="Past revisions of this page [ctrl-option-h]" accesskey="h">View history</a></span></li>
+ </ul>
+</div>
+
+<!-- /0 -->
+
+<!-- 1 -->
+<div id="p-cactions" class="vectorMenu emptyPortlet">
+ <h5><span>Actions</span><a href="http://fileformats.archiveteam.org/wiki/Lingo_bytecode#"></a></h5>
+ <div class="menu">
+ <ul>
+ </ul>
+ </div>
+</div>
+
+<!-- /1 -->
+
+<!-- 2 -->
+<div id="p-search">
+ <h5><label for="searchInput">Search</label></h5>
+ <form action="http://fileformats.archiveteam.org/index.php" id="searchform">
+ <div>
+ <input type="search" name="search" title="Search Just Solve the File Format Problem [ctrl-option-f]" accesskey="f" id="searchInput"> <input type="submit" name="go" value="Go" title="Go to a page with this exact name if exists" id="searchGoButton" class="searchButton"> <input type="submit" name="fulltext" value="Search" title="Search the pages for this text" id="mw-searchButton" class="searchButton"> <input type="hidden" name="title" value="Special:Search">
+ </div>
+ </form>
+</div>
+
+<!-- /2 -->
+ </div>
+ </div>
+ <!-- /header -->
+ <!-- panel -->
+ <div id="mw-panel" class="noprint">
+ <!-- logo -->
+ <div id="p-logo"><a style="background-image: url(/thumbsup.png);" href="http://fileformats.archiveteam.org/wiki/Main_Page" title="Visit the main page"></a></div>
+ <!-- /logo -->
+
+<!-- navigation -->
+<div class="portal" id="p-navigation">
+ <h5>Navigation</h5>
+ <div class="body">
+ <ul>
+ <li id="n-mainpage-description"><a href="http://fileformats.archiveteam.org/wiki/Main_Page" title="Visit the main page [ctrl-option-z]" accesskey="z">Main page</a></li>
+ <li id="n-File-formats"><a href="http://fileformats.archiveteam.org/wiki/File_Formats">File formats</a></li>
+ <li id="n-Formats-by-extension"><a href="http://fileformats.archiveteam.org/wiki/Category:File_formats_by_extension">Formats by extension</a></li>
+ <li id="n-Still-more-extensions"><a href="http://fileformats.archiveteam.org/wiki/Category:File_Format_Extension">Still more extensions</a></li>
+ <li id="n-Software"><a href="http://fileformats.archiveteam.org/wiki/Software">Software</a></li>
+ <li id="n-Glossary"><a href="http://fileformats.archiveteam.org/wiki/Glossary">Glossary</a></li>
+ <li id="n-Library"><a href="http://fileformats.archiveteam.org/wiki/Library">Library</a></li>
+ <li id="n-Sources"><a href="http://fileformats.archiveteam.org/wiki/Sources">Sources</a></li>
+ <li id="n-Categories"><a href="http://fileformats.archiveteam.org/wiki/Category:Top_Level_Categories">Categories</a></li>
+ <li id="n-portal"><a href="http://fileformats.archiveteam.org/wiki/Just_Solve_the_File_Format_Problem:Community_portal" title="About the project, what you can do, where to find things">Community portal</a></li>
+ <li id="n-recentchanges"><a href="http://fileformats.archiveteam.org/wiki/Special:RecentChanges" title="A list of recent changes in the wiki [ctrl-option-r]" accesskey="r">Recent changes</a></li>
+ <li id="n-randompage"><a href="http://fileformats.archiveteam.org/wiki/Special:Random" title="Load a random page [ctrl-option-x]" accesskey="x">Random page</a></li>
+ </ul>
+ </div>
+</div>
+
+<!-- /navigation -->
+
+<!-- SEARCH -->
+
+<!-- /SEARCH -->
+
+<!-- TOOLBOX -->
+<div class="portal" id="p-tb">
+ <h5>Toolbox</h5>
+ <div class="body">
+ <ul>
+ <li id="t-whatlinkshere"><a href="http://fileformats.archiveteam.org/wiki/Special:WhatLinksHere/Lingo_bytecode" title="A list of all wiki pages that link here [ctrl-option-j]" accesskey="j">What links here</a></li>
+ <li id="t-recentchangeslinked"><a href="http://fileformats.archiveteam.org/wiki/Special:RecentChangesLinked/Lingo_bytecode" title="Recent changes in pages linked from this page [ctrl-option-k]" accesskey="k">Related changes</a></li>
+ <li id="t-specialpages"><a href="http://fileformats.archiveteam.org/wiki/Special:SpecialPages" title="A list of all special pages [ctrl-option-q]" accesskey="q">Special pages</a></li>
+ <li><a href="http://fileformats.archiveteam.org/index.php?title=Lingo_bytecode&printable=yes" rel="alternate">Printable version</a></li>
+ <li id="t-permalink"><a href="http://fileformats.archiveteam.org/index.php?title=Lingo_bytecode&oldid=25053" title="Permanent link to this revision of the page">Permanent link</a></li>
+ </ul>
+ </div>
+</div>
+
+<!-- /TOOLBOX -->
+
+<!-- LANGUAGES -->
+
+<!-- /LANGUAGES -->
+ </div>
+ <!-- /panel -->
+ <!-- footer -->
+ <div id="footer">
+ <ul id="footer-info">
+ <li id="footer-info-lastmod"> This page was last modified on 17 March 2016, at 18:25.</li>
+ <li id="footer-info-viewcount">This page has been accessed 586 times.</li>
+ <li id="footer-info-copyright">Content is available under <a class="external" href="http://creativecommons.org/publicdomain/zero/1.0/">Creative Commons 0</a>.</li>
+ </ul>
+ <ul id="footer-places">
+ <li id="footer-places-privacy"><a href="http://fileformats.archiveteam.org/wiki/Just_Solve_the_File_Format_Problem:Privacy_policy" title="Just Solve the File Format Problem:Privacy policy">Privacy policy</a></li>
+ <li id="footer-places-about"><a href="http://fileformats.archiveteam.org/wiki/Just_Solve_the_File_Format_Problem:About" title="Just Solve the File Format Problem:About">About Just Solve the File Format Problem</a></li>
+ <li id="footer-places-disclaimer"><a href="http://fileformats.archiveteam.org/wiki/Just_Solve_the_File_Format_Problem:General_disclaimer" title="Just Solve the File Format Problem:General disclaimer">Disclaimers</a></li>
+ </ul>
+ <ul id="footer-icons" class="noprint">
+ <li id="footer-copyrightico">
+ <a href="http://creativecommons.org/publicdomain/zero/1.0/"><img src="./Lingo bytecode - Just Solve the File Format Problem_files/cc-0.png" alt="Creative Commons 0" width="88" height="31"></a>
+ </li>
+ <li id="footer-poweredbyico">
+ <a href="http://www.mediawiki.org/"><img src="./Lingo bytecode - Just Solve the File Format Problem_files/poweredby_mediawiki_88x31.png" alt="Powered by MediaWiki" width="88" height="31"></a>
+ </li>
+ </ul>
+ <div style="clear:both"></div>
+ </div>
+ <!-- /footer -->
+ <script src="./Lingo bytecode - Just Solve the File Format Problem_files/load(4).php"></script>
+<script>if(window.mw){
+mw.loader.load(["mediawiki.user","mediawiki.page.ready"], null, true);
+}</script><script src="./Lingo bytecode - Just Solve the File Format Problem_files/load(5).php" type="text/javascript"></script>
+<!-- Served in 0.102 secs. -->
+
+
+<script type="text/javascript" src="chrome-extension://cmjeonfdjdekpggjkoknhhkcifnaichh/src/rules.js"></script><script type="text/javascript" src="chrome-extension://cmjeonfdjdekpggjkoknhhkcifnaichh/src/inject.js"></script></body><span class="gr__tooltip"><span class="gr__tooltip-content"></span><i class="gr__tooltip-logo"></i><span class="gr__triangle"></span></span></html>
\ No newline at end of file
Commit: e1b2759d06ddff1b959cc3c86203c73439d01b3c
https://github.com/scummvm/scummvm/commit/e1b2759d06ddff1b959cc3c86203c73439d01b3c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Initial code for factory/method definition
Changed paths:
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index a7a004e..553213c 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -123,11 +123,14 @@ void Lingo::cleanLocalVars() {
delete g_lingo->_localvars;
}
-void Lingo::define(Common::String &name, int start, int nargs) {
+void Lingo::define(Common::String &name, int start, int nargs, Common::String *prefix) {
debug(3, "define(\"%s\", %d, %d, %d)", name.c_str(), start, _currentScript->size() - 1, nargs);
Symbol *sym;
+ if (prefix)
+ name = *prefix + "-" + name;
+
if (!_handlers.contains(name)) { // Create variable if it was not defined
sym = new Symbol;
@@ -249,4 +252,8 @@ void Lingo::processIf(int elselabel, int endlabel) {
}
}
+void Lingo::codeFactory(Common::String &name) {
+ _currentFactory = name;
+}
+
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index b4fb67a..035302f 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -104,18 +104,20 @@
tWITH = 293,
tWHILE = 294,
tNLELSE = 295,
- tGE = 296,
- tLE = 297,
- tGT = 298,
- tLT = 299,
- tEQ = 300,
- tNEQ = 301,
- tAND = 302,
- tOR = 303,
- tNOT = 304,
- tCONCAT = 305,
- tCONTAINS = 306,
- tSTARTS = 307
+ tFACTORY = 296,
+ tMETHOD = 297,
+ tGE = 298,
+ tLE = 299,
+ tGT = 300,
+ tLT = 301,
+ tEQ = 302,
+ tNEQ = 303,
+ tAND = 304,
+ tOR = 305,
+ tNOT = 306,
+ tCONCAT = 307,
+ tCONTAINS = 308,
+ tSTARTS = 309
};
#endif
/* Tokens. */
@@ -157,18 +159,20 @@
#define tWITH 293
#define tWHILE 294
#define tNLELSE 295
-#define tGE 296
-#define tLE 297
-#define tGT 298
-#define tLT 299
-#define tEQ 300
-#define tNEQ 301
-#define tAND 302
-#define tOR 303
-#define tNOT 304
-#define tCONCAT 305
-#define tCONTAINS 306
-#define tSTARTS 307
+#define tFACTORY 296
+#define tMETHOD 297
+#define tGE 298
+#define tLE 299
+#define tGT 300
+#define tLT 301
+#define tEQ 302
+#define tNEQ 303
+#define tAND 304
+#define tOR 305
+#define tNOT 306
+#define tCONCAT 307
+#define tCONTAINS 308
+#define tSTARTS 309
@@ -225,7 +229,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 229 "engines/director/lingo/lingo-gr.cpp"
+#line 233 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -238,7 +242,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 242 "engines/director/lingo/lingo-gr.cpp"
+#line 246 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -451,22 +455,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 70
+#define YYFINAL 74
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 639
+#define YYLAST 626
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 66
+#define YYNTOKENS 68
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 33
+#define YYNNTS 34
/* YYNRULES -- Number of rules. */
-#define YYNRULES 112
+#define YYNRULES 115
/* YYNRULES -- Number of states. */
-#define YYNSTATES 237
+#define YYNSTATES 247
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 307
+#define YYMAXUTOK 309
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -475,12 +479,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 59, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 61, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 58, 64, 2,
- 60, 61, 56, 54, 65, 55, 2, 57, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 60, 66, 2,
+ 62, 63, 58, 56, 67, 57, 2, 59, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 63, 53, 62, 2, 2, 2, 2, 2, 2, 2,
+ 65, 55, 64, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -504,7 +508,7 @@ static const yytype_uint8 yytranslate[] =
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54
};
#if YYDEBUG
@@ -522,56 +526,57 @@ static const yytype_uint16 yyprhs[] =
283, 287, 291, 295, 298, 302, 306, 310, 314, 317,
320, 324, 327, 330, 333, 335, 337, 340, 342, 346,
349, 352, 355, 358, 362, 365, 369, 372, 375, 377,
- 381, 384, 388, 389, 398, 399, 401, 405, 410, 411,
- 415, 416, 418
+ 381, 384, 388, 389, 398, 401, 402, 411, 412, 414,
+ 418, 423, 424, 428, 429, 431
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 67, 0, -1, 67, 68, 69, -1, 69, -1, 1,
- 59, -1, 59, -1, -1, 93, -1, 88, -1, 97,
- -1, 70, -1, 72, -1, 33, 87, 24, 12, -1,
- 35, 12, 53, 87, -1, 35, 8, 53, 87, -1,
- 35, 9, 87, 53, 87, -1, 35, 12, 37, 87,
- -1, 35, 8, 37, 87, -1, 35, 9, 87, 37,
- 87, -1, 87, -1, 88, -1, 71, -1, 73, -1,
- 80, 60, 79, 61, 86, 85, 18, 34, -1, 81,
- 53, 87, 85, 37, 87, 85, 86, 85, 18, 34,
- -1, 81, 53, 87, 85, 15, 37, 87, 85, 86,
- 85, 18, 34, -1, 82, 79, 36, 68, 86, 85,
- 18, 23, -1, 82, 79, 36, 68, 86, 85, 40,
- 86, 85, 18, 23, -1, 82, 79, 36, 68, 86,
- 85, 84, 75, 85, 18, 23, -1, 82, 79, 36,
- 84, 71, 85, -1, 82, 79, 36, 84, 71, 85,
- 40, 84, 71, 85, -1, 82, 79, 36, 84, 71,
- 85, 76, 85, 74, 85, -1, -1, 40, 84, 71,
- -1, 75, 78, -1, 78, -1, 76, 77, -1, 77,
- -1, 83, 79, 36, 84, 72, 85, -1, 76, -1,
- 83, 79, 36, 86, 85, -1, 87, -1, 87, 53,
- 87, -1, 60, 79, 61, -1, 34, 39, -1, 34,
+ 69, 0, -1, 69, 70, 71, -1, 71, -1, 1,
+ 61, -1, 61, -1, -1, 95, -1, 90, -1, 100,
+ -1, 72, -1, 74, -1, 33, 89, 24, 12, -1,
+ 35, 12, 55, 89, -1, 35, 8, 55, 89, -1,
+ 35, 9, 89, 55, 89, -1, 35, 12, 37, 89,
+ -1, 35, 8, 37, 89, -1, 35, 9, 89, 37,
+ 89, -1, 89, -1, 90, -1, 73, -1, 75, -1,
+ 82, 62, 81, 63, 88, 87, 18, 34, -1, 83,
+ 55, 89, 87, 37, 89, 87, 88, 87, 18, 34,
+ -1, 83, 55, 89, 87, 15, 37, 89, 87, 88,
+ 87, 18, 34, -1, 84, 81, 36, 70, 88, 87,
+ 18, 23, -1, 84, 81, 36, 70, 88, 87, 40,
+ 88, 87, 18, 23, -1, 84, 81, 36, 70, 88,
+ 87, 86, 77, 87, 18, 23, -1, 84, 81, 36,
+ 86, 73, 87, -1, 84, 81, 36, 86, 73, 87,
+ 40, 86, 73, 87, -1, 84, 81, 36, 86, 73,
+ 87, 78, 87, 76, 87, -1, -1, 40, 86, 73,
+ -1, 77, 80, -1, 80, -1, 78, 79, -1, 79,
+ -1, 85, 81, 36, 86, 74, 87, -1, 78, -1,
+ 85, 81, 36, 88, 87, -1, 89, -1, 89, 55,
+ 89, -1, 62, 81, 63, -1, 34, 39, -1, 34,
38, 12, -1, 23, -1, 17, -1, -1, -1, -1,
- 86, 68, -1, 86, 72, -1, 7, -1, 10, -1,
- 13, -1, 11, 60, 98, 61, -1, 12, 60, 98,
- 61, -1, 12, -1, 8, -1, 9, 87, -1, 70,
- -1, 87, 54, 87, -1, 87, 55, 87, -1, 87,
- 56, 87, -1, 87, 57, 87, -1, 87, 62, 87,
- -1, 87, 63, 87, -1, 87, 46, 87, -1, 87,
- 41, 87, -1, 87, 42, 87, -1, 87, 47, 87,
- -1, 87, 48, 87, -1, 49, 87, -1, 87, 64,
- 87, -1, 87, 50, 87, -1, 87, 51, 87, -1,
- 87, 52, 87, -1, 54, 87, -1, 55, 87, -1,
- 60, 87, 61, -1, 27, 13, -1, 28, 12, -1,
- 33, 87, -1, 90, -1, 19, -1, 21, 89, -1,
- 12, -1, 89, 65, 12, -1, 22, 25, -1, 22,
- 30, -1, 22, 32, -1, 22, 91, -1, 22, 91,
- 92, -1, 22, 92, -1, 37, 20, 13, -1, 20,
+ 88, 70, -1, 88, 74, -1, 7, -1, 10, -1,
+ 13, -1, 11, 62, 101, 63, -1, 12, 62, 101,
+ 63, -1, 12, -1, 8, -1, 9, 89, -1, 72,
+ -1, 89, 56, 89, -1, 89, 57, 89, -1, 89,
+ 58, 89, -1, 89, 59, 89, -1, 89, 64, 89,
+ -1, 89, 65, 89, -1, 89, 48, 89, -1, 89,
+ 43, 89, -1, 89, 44, 89, -1, 89, 49, 89,
+ -1, 89, 50, 89, -1, 51, 89, -1, 89, 66,
+ 89, -1, 89, 52, 89, -1, 89, 53, 89, -1,
+ 89, 54, 89, -1, 56, 89, -1, 57, 89, -1,
+ 62, 89, 63, -1, 27, 13, -1, 28, 12, -1,
+ 33, 89, -1, 92, -1, 19, -1, 21, 91, -1,
+ 12, -1, 91, 67, 12, -1, 22, 25, -1, 22,
+ 30, -1, 22, 32, -1, 22, 93, -1, 22, 93,
+ 94, -1, 22, 94, -1, 37, 20, 13, -1, 20,
13, -1, 37, 13, -1, 13, -1, 31, 29, 13,
-1, 29, 13, -1, 37, 29, 13, -1, -1, 26,
- 12, 94, 84, 95, 68, 96, 86, -1, -1, 12,
- -1, 95, 65, 12, -1, 95, 68, 65, 12, -1,
- -1, 12, 84, 98, -1, -1, 87, -1, 98, 65,
- 87, -1
+ 12, 96, 86, 98, 70, 99, 88, -1, 41, 12,
+ -1, -1, 42, 12, 97, 86, 98, 70, 99, 88,
+ -1, -1, 12, -1, 98, 67, 12, -1, 98, 70,
+ 67, 12, -1, -1, 12, 86, 101, -1, -1, 89,
+ -1, 101, 67, 89, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -587,8 +592,8 @@ static const yytype_uint16 yyrline[] =
388, 389, 390, 391, 392, 393, 394, 395, 396, 397,
398, 401, 402, 403, 404, 405, 407, 410, 411, 422,
423, 424, 425, 430, 436, 443, 444, 445, 446, 449,
- 450, 451, 479, 479, 486, 487, 488, 489, 491, 494,
- 502, 503, 504
+ 450, 451, 479, 479, 485, 488, 488, 494, 495, 496,
+ 497, 499, 503, 511, 512, 513
};
#endif
@@ -602,15 +607,16 @@ static const char *const yytname[] =
"HANDLER", "tDOWN", "tELSE", "tNLELSIF", "tEND", "tEXIT", "tFRAME",
"tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT",
"tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT", "tSET",
- "tTHEN", "tTO", "tWITH", "tWHILE", "tNLELSE", "tGE", "tLE", "tGT", "tLT",
- "tEQ", "tNEQ", "tAND", "tOR", "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS",
- "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'",
- "'<'", "'&'", "','", "$accept", "program", "nl", "programline", "asgn",
- "stmtoneliner", "stmt", "ifstmt", "elsestmtoneliner", "elseifstmt",
- "elseifstmtoneliner", "elseifstmtoneliner1", "elseifstmt1", "cond",
- "repeatwhile", "repeatwith", "if", "elseif", "begin", "end", "stmtlist",
- "expr", "func", "globallist", "gotofunc", "gotoframe", "gotomovie",
- "defn", "@1", "argdef", "argstore", "macro", "arglist", 0
+ "tTHEN", "tTO", "tWITH", "tWHILE", "tNLELSE", "tFACTORY", "tMETHOD",
+ "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "tAND", "tOR", "tNOT",
+ "tCONCAT", "tCONTAINS", "tSTARTS", "'='", "'+'", "'-'", "'*'", "'/'",
+ "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','", "$accept",
+ "program", "nl", "programline", "asgn", "stmtoneliner", "stmt", "ifstmt",
+ "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
+ "elseifstmtoneliner1", "elseifstmt1", "cond", "repeatwhile",
+ "repeatwith", "if", "elseif", "begin", "end", "stmtlist", "expr", "func",
+ "globallist", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "@2",
+ "argdef", "argstore", "macro", "arglist", 0
};
#endif
@@ -624,26 +630,26 @@ static const yytype_uint16 yytoknum[] =
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 61, 43, 45, 42, 47, 37, 10,
- 40, 41, 62, 60, 38, 44
+ 305, 306, 307, 308, 309, 61, 43, 45, 42, 47,
+ 37, 10, 40, 41, 62, 60, 38, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 66, 67, 67, 67, 68, 69, 69, 69, 69,
- 69, 69, 70, 70, 70, 70, 70, 70, 70, 71,
- 71, 72, 72, 72, 72, 72, 73, 73, 73, 73,
- 73, 73, 74, 74, 75, 75, 76, 76, 77, 78,
- 78, 79, 79, 79, 80, 81, 82, 83, 84, 85,
- 86, 86, 86, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
- 87, 88, 88, 88, 88, 88, 88, 89, 89, 90,
- 90, 90, 90, 90, 90, 91, 91, 91, 91, 92,
- 92, 92, 94, 93, 95, 95, 95, 95, 96, 97,
- 98, 98, 98
+ 0, 68, 69, 69, 69, 70, 71, 71, 71, 71,
+ 71, 71, 72, 72, 72, 72, 72, 72, 72, 73,
+ 73, 74, 74, 74, 74, 74, 75, 75, 75, 75,
+ 75, 75, 76, 76, 77, 77, 78, 78, 79, 80,
+ 80, 81, 81, 81, 82, 83, 84, 85, 86, 87,
+ 88, 88, 88, 89, 89, 89, 89, 89, 89, 89,
+ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
+ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
+ 89, 90, 90, 90, 90, 90, 90, 91, 91, 92,
+ 92, 92, 92, 92, 92, 93, 93, 93, 93, 94,
+ 94, 94, 96, 95, 95, 97, 95, 98, 98, 98,
+ 98, 99, 100, 101, 101, 101
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -659,8 +665,8 @@ static const yytype_uint8 yyr2[] =
3, 3, 3, 2, 3, 3, 3, 3, 2, 2,
3, 2, 2, 2, 1, 1, 2, 1, 3, 2,
2, 2, 2, 3, 2, 3, 2, 2, 1, 3,
- 2, 3, 0, 8, 0, 1, 3, 4, 0, 3,
- 0, 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
@@ -670,24 +676,25 @@ static const yytype_uint8 yydefact[] =
{
0, 0, 53, 59, 0, 54, 0, 48, 55, 85,
0, 0, 46, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 3, 61, 21, 11, 22, 0,
- 0, 0, 19, 8, 84, 7, 9, 4, 58, 0,
- 61, 60, 110, 110, 110, 87, 86, 98, 0, 89,
- 0, 90, 0, 91, 0, 92, 94, 102, 81, 82,
- 83, 0, 44, 0, 0, 0, 73, 78, 79, 0,
- 1, 5, 6, 0, 0, 0, 0, 41, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 111, 0, 0, 109, 0, 96,
- 100, 0, 97, 0, 0, 0, 93, 48, 0, 45,
- 0, 0, 0, 0, 0, 80, 2, 0, 49, 0,
- 0, 48, 0, 69, 70, 68, 71, 72, 75, 76,
- 77, 62, 63, 64, 65, 66, 67, 74, 56, 0,
- 57, 88, 99, 95, 101, 104, 12, 17, 14, 0,
- 0, 16, 13, 50, 0, 43, 50, 0, 42, 112,
- 105, 0, 18, 15, 49, 0, 0, 49, 49, 20,
- 0, 108, 51, 52, 0, 0, 49, 48, 29, 106,
- 0, 50, 0, 49, 50, 0, 50, 0, 47, 48,
- 49, 37, 0, 107, 103, 23, 50, 49, 26, 49,
+ 0, 0, 0, 0, 0, 0, 3, 61, 21, 11,
+ 22, 0, 0, 0, 19, 8, 84, 7, 9, 4,
+ 58, 0, 61, 60, 113, 113, 113, 87, 86, 98,
+ 0, 89, 0, 90, 0, 91, 0, 92, 94, 102,
+ 81, 82, 83, 0, 44, 0, 0, 0, 104, 105,
+ 73, 78, 79, 0, 1, 5, 6, 0, 0, 0,
+ 0, 41, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 114, 0,
+ 0, 112, 0, 96, 100, 0, 97, 0, 0, 0,
+ 93, 48, 0, 45, 0, 0, 0, 0, 0, 48,
+ 80, 2, 0, 49, 0, 0, 48, 0, 69, 70,
+ 68, 71, 72, 75, 76, 77, 62, 63, 64, 65,
+ 66, 67, 74, 56, 0, 57, 88, 99, 95, 101,
+ 107, 12, 17, 14, 0, 0, 16, 13, 107, 50,
+ 0, 43, 50, 0, 42, 115, 108, 0, 18, 15,
+ 0, 49, 0, 0, 49, 49, 20, 0, 111, 111,
+ 51, 52, 0, 0, 49, 48, 29, 109, 0, 50,
+ 50, 0, 49, 50, 0, 50, 0, 47, 48, 49,
+ 37, 0, 110, 103, 106, 23, 50, 49, 26, 49,
49, 39, 35, 0, 0, 36, 32, 0, 49, 0,
0, 34, 0, 0, 49, 48, 49, 48, 0, 0,
0, 0, 48, 30, 0, 31, 0, 0, 24, 27,
@@ -697,50 +704,51 @@ static const yytype_uint8 yydefact[] =
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 23, 172, 24, 40, 26, 173, 28, 216, 200,
- 201, 191, 202, 76, 29, 30, 31, 192, 226, 154,
- 164, 32, 169, 46, 34, 55, 56, 35, 107, 161,
- 181, 36, 95
+ -1, 25, 180, 26, 42, 28, 181, 30, 226, 210,
+ 211, 200, 212, 80, 31, 32, 33, 201, 236, 160,
+ 171, 34, 176, 48, 36, 57, 58, 37, 111, 119,
+ 167, 189, 38, 99
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -172
+#define YYPACT_NINF -178
static const yytype_int16 yypact[] =
{
- 189, -41, -172, -172, 359, -172, -30, 532, -172, -172,
- 28, 150, -172, 43, 47, 52, 359, 11, 49, 359,
- 359, 359, 359, 6, -172, 9, -172, -172, -172, 15,
- 16, 388, 513, -172, -172, -172, -172, -172, 36, 359,
- -172, 513, 359, 359, 359, -172, 32, -172, 86, -172,
- 89, -172, 74, -172, 19, 25, -172, -172, -172, -172,
- 403, 92, -172, -20, 359, -9, 575, 575, 575, 470,
- -172, -172, 243, 388, 359, 388, 69, 494, 359, 359,
- 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
- 359, 359, 359, 403, 513, -2, 5, 41, 95, -172,
- -172, 96, -172, 97, 98, 79, -172, -172, 100, -172,
- 359, 359, 427, 359, 359, -172, -172, 57, 513, 58,
- 446, 61, 359, 513, 513, 513, 513, 513, 513, 513,
- 513, 556, 556, 575, 575, 513, 513, 513, -172, 359,
- -172, -172, -172, -172, -172, 109, -172, 513, 513, 359,
- 359, 513, 513, -172, -1, -172, -172, 330, 513, 513,
- -172, -38, 513, 513, 272, 93, 359, 272, -172, -172,
- 111, 64, -172, -172, 108, 359, 513, -3, -5, -172,
- 119, -172, 101, 513, -172, 114, -172, 115, -172, -172,
- 115, -172, 388, -172, 272, -172, -172, 272, -172, 272,
- 115, 115, -172, 388, 330, -172, 94, 102, 272, 121,
- 123, -172, 126, 110, -172, -172, -172, -172, 127, 113,
- 125, 128, -7, -172, 330, -172, 301, 120, -172, -172,
- -172, 272, -172, -172, -172, -172, -172
+ 199, -40, -178, -178, 2, -178, -21, 517, -178, -178,
+ 32, 128, -178, 38, 42, 49, 2, 43, 98, 58,
+ 86, 2, 2, 2, 2, 4, -178, 7, -178, -178,
+ -178, 47, 56, 236, 498, -178, -178, -178, -178, -178,
+ 52, 2, -178, 498, 2, 2, 2, -178, 57, -178,
+ 109, -178, 110, -178, 96, -178, 23, 40, -178, -178,
+ -178, -178, 388, 114, -178, -17, 2, -7, -178, -178,
+ 560, 560, 560, 455, -178, -178, 255, 236, 2, 236,
+ 91, 479, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 388, 498, 45,
+ 54, 62, 119, -178, -178, 121, -178, 122, 125, 103,
+ -178, -178, 127, -178, 2, 2, 412, 2, 2, -178,
+ -178, -178, 77, 498, 80, 431, 88, 2, 498, 498,
+ 498, 498, 498, 498, 498, 498, 541, 541, 560, 560,
+ 498, 498, 498, -178, 2, -178, -178, -178, -178, -178,
+ 138, -178, 498, 498, 2, 2, 498, 498, 138, -178,
+ 3, -178, -178, 373, 498, 498, -178, 5, 498, 498,
+ 5, 311, 115, 2, 311, -178, -178, 139, 95, 95,
+ -178, -178, 145, 2, 498, 9, -1, -178, 152, -178,
+ -178, 132, 498, -178, 144, -178, 151, -178, -178, 151,
+ -178, 236, -178, 311, 311, -178, -178, 311, -178, 311,
+ 151, 151, -178, 236, 373, -178, 130, 137, 311, 157,
+ 158, -178, 159, 142, -178, -178, -178, -178, 163, 148,
+ 160, 162, 14, -178, 373, -178, 342, 153, -178, -178,
+ -178, 311, -178, -178, -178, -178, -178
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -172, -172, -21, 77, 8, -153, 0, -172, -172, -172,
- -23, -170, -44, -70, -172, -172, -172, -171, -6, -40,
- -143, 3, 26, -172, -172, -172, 103, -172, -172, -172,
- -172, -172, 30
+ -178, -178, -23, 113, 26, -160, 0, -178, -178, -178,
+ 8, -148, -20, -71, -178, -178, -178, -177, -6, -38,
+ -133, 1, 28, -178, -178, -178, 134, -178, -178, -178,
+ 35, 16, -178, 55
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -750,138 +758,136 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -59
static const yytype_int16 yytable[] =
{
- 27, 44, 72, 117, 168, 119, 70, 41, 25, -10,
- -50, -50, 188, 167, 165, 185, 203, 110, 37, 60,
- 205, 71, 66, 67, 68, 69, 33, 170, 113, 203,
- 42, 205, 102, 111, 77, 189, 166, 186, 194, 103,
- 45, 197, 93, 199, 114, 94, 94, 94, 104, 61,
- 62, 214, -50, 208, 50, 57, 52, 63, 64, 138,
- 58, 65, 105, 139, 59, 71, 140, 112, -10, 74,
- 139, 232, 27, 96, 97, 73, 77, 118, 120, 231,
- 25, 123, 124, 125, 126, 127, 128, 129, 130, 131,
- 132, 133, 134, 135, 136, 137, 43, 98, 33, 99,
- 156, 145, 100, 101, 109, 121, 139, 141, 104, 142,
- 143, 144, 146, 147, 148, 157, 151, 152, 153, 155,
- 71, 160, 207, 179, 174, 158, 182, 177, 178, 180,
- 175, 193, 188, 213, 215, 195, 184, 198, 217, 219,
- 171, 220, 159, 196, 221, 227, 222, 228, 229, 116,
- 206, 230, 162, 163, 234, 190, 211, 209, 106, 210,
- 212, 0, 0, 47, 0, 0, 0, 0, 218, 176,
- 48, 187, 0, 0, 223, 49, 225, 0, 183, 50,
- 51, 52, 53, 204, 0, 0, 0, 54, 0, -6,
- 1, 235, 0, 236, 0, 77, 2, 3, 4, 5,
- 6, 7, 8, 0, 0, 0, 77, 0, 9, 224,
+ 29, 46, 76, 175, 74, 43, 122, -10, 124, 2,
+ 3, 4, 5, 6, 40, 8, 197, 62, 172, 213,
+ 114, 39, 70, 71, 72, 73, 27, 194, 35, 174,
+ 117, -50, -50, 213, 81, 41, 106, 18, 115, 198,
+ 173, 44, 97, 107, 47, 98, 98, 98, 118, 195,
+ 59, 215, 108, 21, 224, 60, 203, 204, 22, 23,
+ 207, 61, 209, 215, 24, 75, 75, 116, -10, 52,
+ 68, 54, 177, 218, 242, -50, 29, 109, 81, 123,
+ 125, 63, 64, 128, 129, 130, 131, 132, 133, 134,
+ 135, 136, 137, 138, 139, 140, 141, 142, 69, 241,
+ 100, 101, 27, 162, 35, 150, 65, 66, 143, 77,
+ 67, 78, 144, 158, 45, 152, 153, 145, 156, 157,
+ 163, 144, 103, 104, 102, 105, 113, 126, 164, 144,
+ 217, 146, 108, 182, 147, 148, 185, 186, 149, 151,
+ 159, 49, 223, 161, 178, 165, 193, 179, 50, 75,
+ 166, 187, 183, 51, 206, 168, 169, 52, 53, 54,
+ 55, 216, 188, 191, 202, 56, 205, 208, 197, 219,
+ 225, 220, 222, 227, 184, 229, 230, 231, 232, 196,
+ 228, 237, 238, 239, 192, 240, 233, 244, 235, 121,
+ 221, 110, 214, 170, 199, 190, 0, 0, 0, -6,
+ 1, 0, 81, 245, 0, 246, 2, 3, 4, 5,
+ 6, 7, 8, 0, 81, 0, 0, 0, 9, 234,
10, 11, 12, 0, 0, 13, 14, 15, 0, 0,
- 0, 0, 16, 17, 18, 0, 233, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 19, 0,
- 0, 0, 0, 20, 21, 0, 0, 0, -6, 22,
- 2, 3, 4, 5, 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, 2,
- 3, 4, 5, 6, 38, 8, 0, 0, 0, 0,
- 0, 9, 19, 10, 11, 12, 0, 20, 21, 14,
- 15, 0, 0, 22, 0, 16, 17, 18, 2, 3,
- 4, 5, 6, 38, 8, 0, 0, 0, 0, 0,
- 9, 19, 10, 11, 12, 0, 20, 21, 14, 15,
- 0, 71, 22, 0, 16, 17, 18, 2, 3, 4,
- 5, 6, 38, 8, 0, 0, 0, 0, 0, 9,
- 19, 10, 11, 0, 0, 20, 21, 14, 15, 0,
- 0, 22, 0, 16, 0, 18, 2, 3, 4, 5,
- 6, 38, 8, 0, 0, 0, 0, 0, 0, 19,
- 0, 0, 0, 0, 20, 21, 0, 0, 0, 0,
- 22, 0, 39, 0, 18, 2, 3, 4, 5, 6,
- 38, 8, 0, 0, 0, 0, 0, 0, 19, 0,
- 0, 0, 0, 20, 21, 0, 0, 0, 0, 22,
- 0, 39, 0, 18, 0, 0, 0, 108, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 19, 0, 0,
- 0, 0, 20, 21, 78, 79, 0, 0, 75, 80,
- 81, 82, 0, 83, 84, 85, 0, 86, 87, 88,
- 89, 0, 0, 0, 149, 90, 91, 92, 78, 79,
- 0, 0, 0, 80, 81, 82, 0, 83, 84, 85,
- 150, 86, 87, 88, 89, 0, 0, 78, 79, 90,
- 91, 92, 80, 81, 82, 0, 83, 84, 85, 122,
- 86, 87, 88, 89, 0, 0, 0, 115, 90, 91,
- 92, 78, 79, 0, 0, 0, 80, 81, 82, 0,
- 83, 84, 85, 0, 86, 87, 88, 89, 0, 0,
- 0, 115, 90, 91, 92, 78, 79, 0, 0, 0,
- 80, 81, 82, 0, 83, 84, 85, 122, 86, 87,
- 88, 89, 0, 0, 78, 79, 90, 91, 92, 80,
- 81, 82, 0, 83, 84, 85, 0, 86, 87, 88,
- 89, 0, 0, -58, -58, 90, 91, 92, -58, -58,
- -58, 0, -58, -58, -58, 0, 0, 0, -58, -58,
- 0, 0, 43, 0, -58, -58, -58, 78, 79, 0,
- 0, 0, 80, 81, 82, 0, 83, 84, 85, 0,
- 0, 0, 88, 89, 0, 0, 78, 79, 90, 91,
- 92, 80, 81, 82, 0, 83, 84, 85, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 90, 91, 92
+ 0, 0, 16, 17, 18, 0, 243, 0, 0, 0,
+ 19, 20, 0, 2, 3, 4, 5, 6, 40, 8,
+ 21, 0, 0, 0, 0, 22, 23, 0, 0, 0,
+ -6, 24, 2, 3, 4, 5, 6, 7, 8, 41,
+ 0, 18, 0, 0, 9, 0, 10, 11, 12, 0,
+ 0, 13, 14, 15, 0, 0, 0, 21, 16, 17,
+ 18, 0, 22, 23, 0, 0, 19, 20, 79, 0,
+ 0, 0, 0, 0, 0, 0, 21, 0, 0, 0,
+ 0, 22, 23, 0, 0, 0, 0, 24, 2, 3,
+ 4, 5, 6, 40, 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, 2,
+ 3, 4, 5, 6, 40, 8, 0, 0, 0, 0,
+ 0, 9, 21, 10, 11, 12, 0, 22, 23, 14,
+ 15, 0, 75, 24, 0, 16, 17, 18, 0, 0,
+ 2, 3, 4, 5, 6, 40, 8, 0, 0, 0,
+ 0, 0, 9, 21, 10, 11, 0, 0, 22, 23,
+ 14, 15, 0, 0, 24, 0, 16, 0, 18, 0,
+ 0, 0, 112, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 21, 0, 0, 0, 0, 22,
+ 23, 82, 83, 0, 0, 24, 84, 85, 86, 0,
+ 87, 88, 89, 0, 90, 91, 92, 93, 0, 154,
+ 0, 0, 94, 95, 96, 82, 83, 0, 0, 0,
+ 84, 85, 86, 0, 87, 88, 89, 155, 90, 91,
+ 92, 93, 0, 0, 82, 83, 94, 95, 96, 84,
+ 85, 86, 0, 87, 88, 89, 127, 90, 91, 92,
+ 93, 0, 0, 0, 120, 94, 95, 96, 82, 83,
+ 0, 0, 0, 84, 85, 86, 0, 87, 88, 89,
+ 0, 90, 91, 92, 93, 0, 0, 0, 120, 94,
+ 95, 96, 82, 83, 0, 0, 0, 84, 85, 86,
+ 0, 87, 88, 89, 127, 90, 91, 92, 93, 0,
+ 0, 82, 83, 94, 95, 96, 84, 85, 86, 0,
+ 87, 88, 89, 0, 90, 91, 92, 93, 0, 0,
+ -58, -58, 94, 95, 96, -58, -58, -58, 0, -58,
+ -58, -58, 0, 0, 0, -58, -58, 0, 0, 45,
+ 0, -58, -58, -58, 82, 83, 0, 0, 0, 84,
+ 85, 86, 0, 87, 88, 89, 0, 0, 0, 92,
+ 93, 0, 0, 82, 83, 94, 95, 96, 84, 85,
+ 86, 0, 87, 88, 89, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 94, 95, 96
};
static const yytype_int16 yycheck[] =
{
- 0, 7, 23, 73, 157, 75, 0, 4, 0, 0,
- 17, 18, 17, 156, 15, 18, 187, 37, 59, 16,
- 190, 59, 19, 20, 21, 22, 0, 65, 37, 200,
- 60, 201, 13, 53, 31, 40, 37, 40, 181, 20,
- 12, 184, 39, 186, 53, 42, 43, 44, 29, 38,
- 39, 204, 59, 196, 29, 12, 31, 8, 9, 61,
- 13, 12, 37, 65, 12, 59, 61, 64, 59, 53,
- 65, 224, 72, 43, 44, 60, 73, 74, 75, 222,
- 72, 78, 79, 80, 81, 82, 83, 84, 85, 86,
- 87, 88, 89, 90, 91, 92, 60, 65, 72, 13,
- 121, 107, 13, 29, 12, 36, 65, 12, 29, 13,
- 13, 13, 12, 110, 111, 121, 113, 114, 61, 61,
- 59, 12, 192, 12, 164, 122, 18, 167, 168, 65,
- 37, 12, 17, 203, 40, 34, 176, 23, 36, 18,
- 161, 18, 139, 183, 18, 18, 36, 34, 23, 72,
- 190, 23, 149, 150, 34, 178, 200, 197, 55, 199,
- 200, -1, -1, 13, -1, -1, -1, -1, 208, 166,
- 20, 177, -1, -1, 214, 25, 216, -1, 175, 29,
- 30, 31, 32, 189, -1, -1, -1, 37, -1, 0,
- 1, 231, -1, 233, -1, 192, 7, 8, 9, 10,
- 11, 12, 13, -1, -1, -1, 203, -1, 19, 215,
+ 0, 7, 25, 163, 0, 4, 77, 0, 79, 7,
+ 8, 9, 10, 11, 12, 13, 17, 16, 15, 196,
+ 37, 61, 21, 22, 23, 24, 0, 18, 0, 162,
+ 37, 17, 18, 210, 33, 33, 13, 35, 55, 40,
+ 37, 62, 41, 20, 12, 44, 45, 46, 55, 40,
+ 12, 199, 29, 51, 214, 13, 189, 190, 56, 57,
+ 193, 12, 195, 211, 62, 61, 61, 66, 61, 29,
+ 12, 31, 67, 206, 234, 61, 76, 37, 77, 78,
+ 79, 38, 39, 82, 83, 84, 85, 86, 87, 88,
+ 89, 90, 91, 92, 93, 94, 95, 96, 12, 232,
+ 45, 46, 76, 126, 76, 111, 8, 9, 63, 62,
+ 12, 55, 67, 119, 62, 114, 115, 63, 117, 118,
+ 126, 67, 13, 13, 67, 29, 12, 36, 127, 67,
+ 201, 12, 29, 171, 13, 13, 174, 175, 13, 12,
+ 63, 13, 213, 63, 167, 144, 184, 170, 20, 61,
+ 12, 12, 37, 25, 192, 154, 155, 29, 30, 31,
+ 32, 199, 67, 18, 12, 37, 34, 23, 17, 207,
+ 40, 209, 210, 36, 173, 18, 18, 18, 36, 185,
+ 218, 18, 34, 23, 183, 23, 224, 34, 226, 76,
+ 210, 57, 198, 158, 186, 179, -1, -1, -1, 0,
+ 1, -1, 201, 241, -1, 243, 7, 8, 9, 10,
+ 11, 12, 13, -1, 213, -1, -1, -1, 19, 225,
21, 22, 23, -1, -1, 26, 27, 28, -1, -1,
- -1, -1, 33, 34, 35, -1, 226, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 49, -1,
- -1, -1, -1, 54, 55, -1, -1, -1, 59, 60,
- 7, 8, 9, 10, 11, 12, 13, -1, -1, -1,
- -1, -1, 19, -1, 21, 22, 23, -1, -1, 26,
- 27, 28, -1, -1, -1, -1, 33, 34, 35, 7,
- 8, 9, 10, 11, 12, 13, -1, -1, -1, -1,
- -1, 19, 49, 21, 22, 23, -1, 54, 55, 27,
- 28, -1, -1, 60, -1, 33, 34, 35, 7, 8,
+ -1, -1, 33, 34, 35, -1, 236, -1, -1, -1,
+ 41, 42, -1, 7, 8, 9, 10, 11, 12, 13,
+ 51, -1, -1, -1, -1, 56, 57, -1, -1, -1,
+ 61, 62, 7, 8, 9, 10, 11, 12, 13, 33,
+ -1, 35, -1, -1, 19, -1, 21, 22, 23, -1,
+ -1, 26, 27, 28, -1, -1, -1, 51, 33, 34,
+ 35, -1, 56, 57, -1, -1, 41, 42, 62, -1,
+ -1, -1, -1, -1, -1, -1, 51, -1, -1, -1,
+ -1, 56, 57, -1, -1, -1, -1, 62, 7, 8,
9, 10, 11, 12, 13, -1, -1, -1, -1, -1,
- 19, 49, 21, 22, 23, -1, 54, 55, 27, 28,
- -1, 59, 60, -1, 33, 34, 35, 7, 8, 9,
- 10, 11, 12, 13, -1, -1, -1, -1, -1, 19,
- 49, 21, 22, -1, -1, 54, 55, 27, 28, -1,
- -1, 60, -1, 33, -1, 35, 7, 8, 9, 10,
- 11, 12, 13, -1, -1, -1, -1, -1, -1, 49,
- -1, -1, -1, -1, 54, 55, -1, -1, -1, -1,
- 60, -1, 33, -1, 35, 7, 8, 9, 10, 11,
- 12, 13, -1, -1, -1, -1, -1, -1, 49, -1,
- -1, -1, -1, 54, 55, -1, -1, -1, -1, 60,
- -1, 33, -1, 35, -1, -1, -1, 24, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 49, -1, -1,
- -1, -1, 54, 55, 41, 42, -1, -1, 60, 46,
- 47, 48, -1, 50, 51, 52, -1, 54, 55, 56,
- 57, -1, -1, -1, 37, 62, 63, 64, 41, 42,
- -1, -1, -1, 46, 47, 48, -1, 50, 51, 52,
- 53, 54, 55, 56, 57, -1, -1, 41, 42, 62,
- 63, 64, 46, 47, 48, -1, 50, 51, 52, 53,
- 54, 55, 56, 57, -1, -1, -1, 61, 62, 63,
- 64, 41, 42, -1, -1, -1, 46, 47, 48, -1,
- 50, 51, 52, -1, 54, 55, 56, 57, -1, -1,
- -1, 61, 62, 63, 64, 41, 42, -1, -1, -1,
- 46, 47, 48, -1, 50, 51, 52, 53, 54, 55,
- 56, 57, -1, -1, 41, 42, 62, 63, 64, 46,
- 47, 48, -1, 50, 51, 52, -1, 54, 55, 56,
- 57, -1, -1, 41, 42, 62, 63, 64, 46, 47,
- 48, -1, 50, 51, 52, -1, -1, -1, 56, 57,
- -1, -1, 60, -1, 62, 63, 64, 41, 42, -1,
- -1, -1, 46, 47, 48, -1, 50, 51, 52, -1,
- -1, -1, 56, 57, -1, -1, 41, 42, 62, 63,
- 64, 46, 47, 48, -1, 50, 51, 52, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 62, 63, 64
+ 19, -1, 21, 22, 23, -1, -1, -1, 27, 28,
+ -1, -1, -1, -1, 33, 34, 35, -1, -1, 7,
+ 8, 9, 10, 11, 12, 13, -1, -1, -1, -1,
+ -1, 19, 51, 21, 22, 23, -1, 56, 57, 27,
+ 28, -1, 61, 62, -1, 33, 34, 35, -1, -1,
+ 7, 8, 9, 10, 11, 12, 13, -1, -1, -1,
+ -1, -1, 19, 51, 21, 22, -1, -1, 56, 57,
+ 27, 28, -1, -1, 62, -1, 33, -1, 35, -1,
+ -1, -1, 24, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 51, -1, -1, -1, -1, 56,
+ 57, 43, 44, -1, -1, 62, 48, 49, 50, -1,
+ 52, 53, 54, -1, 56, 57, 58, 59, -1, 37,
+ -1, -1, 64, 65, 66, 43, 44, -1, -1, -1,
+ 48, 49, 50, -1, 52, 53, 54, 55, 56, 57,
+ 58, 59, -1, -1, 43, 44, 64, 65, 66, 48,
+ 49, 50, -1, 52, 53, 54, 55, 56, 57, 58,
+ 59, -1, -1, -1, 63, 64, 65, 66, 43, 44,
+ -1, -1, -1, 48, 49, 50, -1, 52, 53, 54,
+ -1, 56, 57, 58, 59, -1, -1, -1, 63, 64,
+ 65, 66, 43, 44, -1, -1, -1, 48, 49, 50,
+ -1, 52, 53, 54, 55, 56, 57, 58, 59, -1,
+ -1, 43, 44, 64, 65, 66, 48, 49, 50, -1,
+ 52, 53, 54, -1, 56, 57, 58, 59, -1, -1,
+ 43, 44, 64, 65, 66, 48, 49, 50, -1, 52,
+ 53, 54, -1, -1, -1, 58, 59, -1, -1, 62,
+ -1, 64, 65, 66, 43, 44, -1, -1, -1, 48,
+ 49, 50, -1, 52, 53, 54, -1, -1, -1, 58,
+ 59, -1, -1, 43, 44, 64, 65, 66, 48, 49,
+ 50, -1, 52, 53, 54, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 64, 65, 66
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -889,29 +895,30 @@ static const yytype_int16 yycheck[] =
static const yytype_uint8 yystos[] =
{
0, 1, 7, 8, 9, 10, 11, 12, 13, 19,
- 21, 22, 23, 26, 27, 28, 33, 34, 35, 49,
- 54, 55, 60, 67, 69, 70, 71, 72, 73, 80,
- 81, 82, 87, 88, 90, 93, 97, 59, 12, 33,
- 70, 87, 60, 60, 84, 12, 89, 13, 20, 25,
- 29, 30, 31, 32, 37, 91, 92, 12, 13, 12,
- 87, 38, 39, 8, 9, 12, 87, 87, 87, 87,
- 0, 59, 68, 60, 53, 60, 79, 87, 41, 42,
- 46, 47, 48, 50, 51, 52, 54, 55, 56, 57,
- 62, 63, 64, 87, 87, 98, 98, 98, 65, 13,
- 13, 29, 13, 20, 29, 37, 92, 94, 24, 12,
- 37, 53, 87, 37, 53, 61, 69, 79, 87, 79,
- 87, 36, 53, 87, 87, 87, 87, 87, 87, 87,
- 87, 87, 87, 87, 87, 87, 87, 87, 61, 65,
- 61, 12, 13, 13, 13, 84, 12, 87, 87, 37,
- 53, 87, 87, 61, 85, 61, 68, 84, 87, 87,
- 12, 95, 87, 87, 86, 15, 37, 86, 71, 88,
- 65, 68, 68, 72, 85, 37, 87, 85, 85, 12,
- 65, 96, 18, 87, 85, 18, 40, 84, 17, 40,
- 76, 77, 83, 12, 86, 34, 85, 86, 23, 86,
- 75, 76, 78, 83, 84, 77, 85, 79, 86, 85,
- 85, 78, 85, 79, 71, 40, 74, 36, 85, 18,
- 18, 18, 36, 85, 84, 85, 84, 18, 34, 23,
- 23, 86, 71, 72, 34, 85, 85
+ 21, 22, 23, 26, 27, 28, 33, 34, 35, 41,
+ 42, 51, 56, 57, 62, 69, 71, 72, 73, 74,
+ 75, 82, 83, 84, 89, 90, 92, 95, 100, 61,
+ 12, 33, 72, 89, 62, 62, 86, 12, 91, 13,
+ 20, 25, 29, 30, 31, 32, 37, 93, 94, 12,
+ 13, 12, 89, 38, 39, 8, 9, 12, 12, 12,
+ 89, 89, 89, 89, 0, 61, 70, 62, 55, 62,
+ 81, 89, 43, 44, 48, 49, 50, 52, 53, 54,
+ 56, 57, 58, 59, 64, 65, 66, 89, 89, 101,
+ 101, 101, 67, 13, 13, 29, 13, 20, 29, 37,
+ 94, 96, 24, 12, 37, 55, 89, 37, 55, 97,
+ 63, 71, 81, 89, 81, 89, 36, 55, 89, 89,
+ 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
+ 89, 89, 89, 63, 67, 63, 12, 13, 13, 13,
+ 86, 12, 89, 89, 37, 55, 89, 89, 86, 63,
+ 87, 63, 70, 86, 89, 89, 12, 98, 89, 89,
+ 98, 88, 15, 37, 88, 73, 90, 67, 70, 70,
+ 70, 74, 87, 37, 89, 87, 87, 12, 67, 99,
+ 99, 18, 89, 87, 18, 40, 86, 17, 40, 78,
+ 79, 85, 12, 88, 88, 34, 87, 88, 23, 88,
+ 77, 78, 80, 85, 86, 79, 87, 81, 88, 87,
+ 87, 80, 87, 81, 73, 40, 76, 36, 87, 18,
+ 18, 18, 36, 87, 86, 87, 86, 18, 34, 23,
+ 23, 88, 73, 74, 34, 87, 87
};
#define yyerrok (yyerrstatus = 0)
@@ -2327,32 +2334,53 @@ yyreduce:
break;
case 104:
-#line 486 "engines/director/lingo/lingo-gr.y"
- { (yyval.narg) = 0; ;}
+#line 485 "engines/director/lingo/lingo-gr.y"
+ {
+ g_lingo->codeFactory(*(yyvsp[(2) - (2)].s));
+ ;}
break;
case 105:
-#line 487 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
+#line 488 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->_indef = true; ;}
break;
case 106:
-#line 488 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
+#line 489 "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);
+ g_lingo->define(*(yyvsp[(2) - (8)].s), (yyvsp[(4) - (8)].code), (yyvsp[(5) - (8)].narg), &g_lingo->_currentFactory);
+ g_lingo->_indef = false; ;}
break;
case 107:
-#line 489 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
+#line 494 "engines/director/lingo/lingo-gr.y"
+ { (yyval.narg) = 0; ;}
break;
case 108:
-#line 491 "engines/director/lingo/lingo-gr.y"
- { g_lingo->codeArgStore(); ;}
+#line 495 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 109:
-#line 494 "engines/director/lingo/lingo-gr.y"
+#line 496 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
+ break;
+
+ case 110:
+#line 497 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
+ break;
+
+ case 111:
+#line 499 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->codeArgStore(); ;}
+ break;
+
+ case 112:
+#line 503 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2361,24 +2389,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 110:
-#line 502 "engines/director/lingo/lingo-gr.y"
+ case 113:
+#line 511 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 111:
-#line 503 "engines/director/lingo/lingo-gr.y"
+ case 114:
+#line 512 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 112:
-#line 504 "engines/director/lingo/lingo-gr.y"
+ case 115:
+#line 513 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2382 "engines/director/lingo/lingo-gr.cpp"
+#line 2410 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2592,6 +2620,6 @@ yyreturn:
}
-#line 507 "engines/director/lingo/lingo-gr.y"
+#line 516 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 2841e61..9ef3b17 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -77,18 +77,20 @@
tWITH = 293,
tWHILE = 294,
tNLELSE = 295,
- tGE = 296,
- tLE = 297,
- tGT = 298,
- tLT = 299,
- tEQ = 300,
- tNEQ = 301,
- tAND = 302,
- tOR = 303,
- tNOT = 304,
- tCONCAT = 305,
- tCONTAINS = 306,
- tSTARTS = 307
+ tFACTORY = 296,
+ tMETHOD = 297,
+ tGE = 298,
+ tLE = 299,
+ tGT = 300,
+ tLT = 301,
+ tEQ = 302,
+ tNEQ = 303,
+ tAND = 304,
+ tOR = 305,
+ tNOT = 306,
+ tCONCAT = 307,
+ tCONTAINS = 308,
+ tSTARTS = 309
};
#endif
/* Tokens. */
@@ -130,18 +132,20 @@
#define tWITH 293
#define tWHILE 294
#define tNLELSE 295
-#define tGE 296
-#define tLE 297
-#define tGT 298
-#define tLT 299
-#define tEQ 300
-#define tNEQ 301
-#define tAND 302
-#define tOR 303
-#define tNOT 304
-#define tCONCAT 305
-#define tCONTAINS 306
-#define tSTARTS 307
+#define tFACTORY 296
+#define tMETHOD 297
+#define tGE 298
+#define tLE 299
+#define tGT 300
+#define tLT 301
+#define tEQ 302
+#define tNEQ 303
+#define tAND 304
+#define tOR 305
+#define tNOT 306
+#define tCONCAT 307
+#define tCONTAINS 308
+#define tSTARTS 309
@@ -158,7 +162,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 162 "engines/director/lingo/lingo-gr.hpp"
+#line 166 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 9a374d0..9bdb29e 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -82,7 +82,7 @@ void yyerror(char *s) {
%token<s> BLTIN ID STRING HANDLER
%token tDOWN tELSE tNLELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
%token tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO
-%token tWITH tWHILE tNLELSE
+%token tWITH tWHILE tNLELSE tFACTORY tMETHOD
%token tGE tLE tGT tLT tEQ tNEQ tAND tOR tNOT
%token tCONCAT tCONTAINS tSTARTS
@@ -477,12 +477,20 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
// See also:
// on keyword
defn: tMACRO ID { g_lingo->_indef = true; }
- begin argdef nl argstore stmtlist {
+ begin argdef nl argstore stmtlist {
g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
g_lingo->code1(g_lingo->c_procret);
g_lingo->define(*$2, $4, $5);
g_lingo->_indef = false; }
- ;
+ | tFACTORY ID {
+ g_lingo->codeFactory(*$2);
+ }
+ | tMETHOD ID { g_lingo->_indef = true; }
+ begin argdef nl argstore stmtlist {
+ g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
+ g_lingo->code1(g_lingo->c_procret);
+ g_lingo->define(*$2, $4, $5, &g_lingo->_currentFactory);
+ g_lingo->_indef = false; } ;
argdef: /* nothing */ { $$ = 0; }
| ID { g_lingo->codeArg($1); $$ = 1; }
| argdef ',' ID { g_lingo->codeArg($3); $$ = $1 + 1; }
@@ -491,6 +499,7 @@ argdef: /* nothing */ { $$ = 0; }
argstore: /* nothing */ { g_lingo->codeArgStore(); }
;
+
macro: ID begin arglist {
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString($1->c_str());
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index b40ca07..111574c 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 48
-#define YY_END_OF_BUFFER 49
+#define YY_NUM_RULES 50
+#define YY_END_OF_BUFFER 51
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,25 +373,26 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[159] =
+static yyconst flex_int16_t yy_accept[170] =
{ 0,
- 0, 0, 49, 47, 3, 45, 45, 47, 47, 44,
- 44, 44, 43, 44, 44, 41, 41, 41, 41, 41,
- 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
- 41, 41, 2, 2, 3, 45, 0, 0, 45, 0,
- 0, 46, 40, 1, 42, 43, 39, 37, 38, 41,
- 41, 41, 41, 41, 41, 41, 41, 41, 15, 7,
- 41, 41, 41, 41, 41, 41, 41, 24, 25, 41,
- 41, 41, 41, 41, 41, 34, 41, 41, 2, 2,
- 0, 1, 42, 4, 41, 41, 41, 11, 41, 41,
- 41, 41, 41, 41, 19, 41, 41, 23, 41, 27,
-
- 41, 29, 41, 41, 41, 41, 0, 41, 6, 10,
- 12, 41, 41, 16, 17, 41, 41, 41, 22, 41,
- 41, 41, 0, 33, 41, 35, 9, 41, 13, 41,
- 18, 41, 21, 41, 41, 41, 32, 36, 0, 41,
- 14, 41, 41, 28, 30, 0, 0, 41, 20, 41,
- 0, 8, 5, 26, 0, 0, 31, 0
+ 0, 0, 51, 49, 3, 47, 47, 49, 49, 46,
+ 46, 46, 45, 46, 46, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 2, 2, 3, 47, 0, 0, 47, 0,
+ 0, 48, 42, 1, 44, 45, 41, 39, 40, 43,
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 16,
+ 7, 43, 43, 43, 43, 43, 43, 43, 43, 26,
+ 27, 43, 43, 43, 43, 43, 43, 36, 43, 43,
+ 2, 2, 0, 1, 44, 4, 43, 43, 43, 11,
+ 43, 43, 43, 43, 43, 43, 43, 20, 43, 43,
+
+ 43, 25, 43, 29, 43, 31, 43, 43, 43, 43,
+ 0, 43, 6, 10, 13, 43, 43, 43, 17, 18,
+ 43, 43, 43, 43, 24, 43, 43, 43, 0, 35,
+ 43, 37, 9, 43, 43, 14, 43, 19, 43, 43,
+ 23, 43, 43, 43, 34, 38, 0, 43, 43, 15,
+ 43, 22, 43, 30, 32, 0, 0, 43, 12, 21,
+ 43, 0, 8, 5, 28, 0, 0, 33, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -404,12 +405,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, 24, 24,
- 1, 1, 1, 7, 37, 1, 38, 39, 40, 41,
+ 24, 30, 31, 32, 33, 34, 35, 36, 37, 24,
+ 1, 1, 1, 7, 38, 1, 39, 40, 41, 42,
- 42, 43, 44, 45, 46, 24, 24, 47, 48, 49,
- 50, 51, 24, 52, 53, 54, 55, 56, 57, 58,
- 24, 24, 1, 1, 1, 1, 1, 1, 1, 1,
+ 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,
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,166 +427,172 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[59] =
+static yyconst flex_int32_t yy_meta[61] =
{ 0,
1, 2, 3, 4, 2, 1, 1, 1, 1, 1,
5, 1, 1, 1, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 5, 6, 6, 6,
+ 6, 6, 6, 6, 6, 6, 6, 5, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6
+ 6, 6, 6, 6, 6, 6, 6, 6, 6, 6
} ;
-static yyconst flex_int16_t yy_base[164] =
+static yyconst flex_int16_t yy_base[175] =
{ 0,
- 0, 57, 188, 395, 61, 65, 69, 73, 153, 395,
- 137, 91, 50, 66, 85, 54, 0, 54, 55, 65,
- 56, 66, 75, 59, 82, 87, 97, 95, 77, 102,
- 108, 116, 161, 165, 169, 138, 173, 141, 177, 101,
- 87, 395, 395, 0, 78, 141, 395, 395, 395, 0,
- 113, 106, 100, 153, 167, 163, 172, 161, 0, 0,
- 158, 163, 175, 170, 161, 162, 167, 0, 0, 181,
- 170, 174, 172, 190, 188, 0, 191, 186, 229, 239,
- 196, 0, 74, 0, 197, 208, 203, 0, 204, 212,
- 223, 218, 218, 218, 215, 229, 222, 0, 221, 0,
-
- 237, 0, 229, 259, 238, 243, 247, 252, 0, 0,
- 0, 252, 258, 0, 0, 250, 259, 261, 0, 259,
- 268, 255, 192, 0, 265, 0, 290, 268, 0, 268,
- 0, 275, 0, 273, 270, 273, 308, 0, 314, 284,
- 0, 280, 284, 0, 0, 320, 298, 289, 0, 296,
- 308, 395, 0, 0, 327, 333, 338, 395, 370, 372,
- 378, 383, 388
+ 0, 59, 356, 417, 63, 67, 71, 75, 346, 417,
+ 343, 181, 52, 68, 132, 56, 0, 56, 57, 67,
+ 72, 68, 68, 69, 112, 70, 79, 103, 81, 103,
+ 106, 115, 139, 145, 162, 101, 166, 170, 174, 135,
+ 133, 417, 417, 0, 90, 163, 417, 417, 417, 0,
+ 112, 153, 146, 151, 166, 162, 169, 172, 163, 0,
+ 0, 160, 167, 171, 173, 166, 165, 164, 169, 0,
+ 0, 183, 174, 178, 184, 204, 206, 0, 204, 199,
+ 230, 242, 205, 0, 80, 0, 205, 211, 209, 0,
+ 208, 209, 216, 232, 222, 224, 225, 221, 235, 235,
+
+ 230, 0, 232, 0, 248, 0, 239, 266, 249, 248,
+ 256, 262, 0, 0, 0, 252, 264, 269, 0, 0,
+ 258, 272, 262, 269, 0, 272, 281, 266, 192, 0,
+ 281, 0, 300, 281, 276, 0, 285, 0, 291, 297,
+ 0, 289, 286, 291, 321, 0, 325, 304, 295, 0,
+ 302, 0, 302, 0, 0, 341, 305, 305, 0, 0,
+ 306, 322, 417, 0, 0, 342, 348, 359, 417, 392,
+ 394, 400, 405, 410
} ;
-static yyconst flex_int16_t yy_def[164] =
+static yyconst flex_int16_t yy_def[175] =
{ 0,
- 158, 1, 158, 158, 158, 158, 158, 158, 159, 158,
- 158, 158, 158, 158, 158, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 158, 158, 158, 158, 158, 158, 158, 158,
- 159, 158, 158, 161, 158, 158, 158, 158, 158, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 158, 158,
- 158, 161, 158, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
-
- 160, 160, 160, 160, 160, 160, 158, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 160, 160,
- 160, 160, 162, 160, 160, 160, 158, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 162, 160, 158, 160,
- 160, 160, 160, 160, 160, 158, 158, 160, 160, 160,
- 158, 158, 160, 160, 158, 163, 163, 0, 158, 158,
- 158, 158, 158
+ 169, 1, 169, 169, 169, 169, 169, 169, 170, 169,
+ 169, 169, 169, 169, 169, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 169, 169, 169, 169, 169, 169, 169, 169,
+ 170, 169, 169, 172, 169, 169, 169, 169, 169, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 169, 169, 169, 172, 169, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 169, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 173, 171,
+ 171, 171, 169, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 173, 171, 169, 171, 171, 171,
+ 171, 171, 171, 171, 171, 169, 169, 171, 171, 171,
+ 171, 169, 169, 171, 171, 169, 174, 174, 0, 169,
+ 169, 169, 169, 169
} ;
-static yyconst flex_int16_t yy_nxt[454] =
+static yyconst flex_int16_t yy_nxt[478] =
{ 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, 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, 83, 57, 62, 40, 83, 54,
- 58, 55, 42, 59, 60, 72, 63, 49, 64, 44,
-
- 56, 61, 51, 52, 53, 66, 40, 57, 62, 65,
- 40, 54, 58, 55, 67, 59, 68, 60, 72, 63,
- 73, 64, 56, 61, 70, 81, 69, 71, 66, 75,
- 84, 65, 85, 74, 86, 76, 67, 77, 78, 68,
- 36, 36, 38, 73, 43, 38, 70, 81, 69, 71,
- 45, 46, 75, 84, 85, 74, 86, 76, 42, 40,
- 77, 78, 79, 36, 36, 80, 80, 36, 36, 80,
- 35, 36, 36, 37, 37, 36, 36, 37, 38, 39,
- 39, 38, 40, 87, 88, 89, 90, 158, 91, 92,
- 93, 94, 95, 123, 96, 40, 123, 97, 98, 99,
-
- 158, 100, 101, 102, 103, 87, 104, 88, 89, 90,
- 91, 92, 93, 105, 94, 95, 96, 106, 40, 97,
- 98, 110, 99, 100, 101, 102, 107, 103, 108, 104,
- 79, 36, 36, 80, 109, 111, 105, 112, 113, 106,
- 80, 36, 36, 80, 110, 114, 115, 116, 107, 117,
- 108, 118, 158, 119, 120, 121, 109, 111, 122, 112,
- 123, 113, 125, 123, 126, 127, 128, 114, 115, 116,
- 129, 117, 130, 132, 118, 119, 120, 131, 121, 133,
- 122, 134, 135, 138, 125, 124, 136, 126, 127, 128,
- 140, 139, 141, 129, 139, 130, 132, 142, 158, 131,
-
- 143, 144, 133, 145, 134, 135, 138, 124, 136, 146,
- 148, 149, 146, 140, 141, 139, 150, 152, 139, 153,
- 142, 146, 143, 144, 146, 145, 154, 155, 156, 158,
- 158, 156, 148, 149, 156, 158, 147, 156, 150, 158,
- 152, 153, 158, 158, 158, 158, 158, 151, 154, 158,
- 155, 158, 158, 158, 158, 158, 158, 158, 158, 147,
- 158, 158, 158, 158, 158, 158, 158, 158, 158, 151,
- 41, 41, 158, 41, 41, 41, 50, 50, 82, 82,
- 158, 158, 82, 82, 137, 158, 158, 158, 137, 157,
- 158, 158, 158, 157, 3, 158, 158, 158, 158, 158,
-
- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
- 158, 158, 158
+ 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, 68, 40,
+ 85, 54, 59, 55, 62, 60, 63, 69, 70, 74,
+
+ 85, 58, 56, 36, 36, 51, 52, 53, 71, 40,
+ 57, 61, 68, 40, 54, 59, 55, 62, 60, 63,
+ 69, 75, 70, 74, 58, 56, 64, 77, 65, 86,
+ 66, 71, 72, 78, 76, 73, 79, 80, 42, 67,
+ 81, 36, 36, 82, 49, 75, 82, 36, 36, 82,
+ 64, 77, 65, 86, 66, 72, 78, 76, 73, 83,
+ 79, 80, 67, 35, 36, 36, 37, 37, 36, 36,
+ 37, 38, 45, 46, 38, 38, 39, 39, 38, 87,
+ 88, 89, 83, 90, 91, 92, 93, 97, 40, 44,
+ 94, 95, 40, 129, 96, 98, 129, 99, 100, 101,
+
+ 102, 103, 87, 88, 89, 104, 105, 90, 91, 92,
+ 93, 97, 40, 94, 95, 106, 40, 96, 107, 98,
+ 99, 100, 101, 102, 108, 103, 109, 114, 104, 105,
+ 110, 81, 36, 36, 82, 111, 112, 113, 106, 115,
+ 116, 117, 107, 82, 36, 36, 82, 118, 108, 119,
+ 109, 114, 120, 110, 121, 122, 123, 124, 111, 112,
+ 113, 125, 115, 116, 117, 126, 127, 129, 128, 132,
+ 129, 118, 119, 131, 133, 120, 134, 121, 122, 135,
+ 123, 124, 136, 137, 125, 138, 139, 141, 126, 140,
+ 127, 128, 130, 132, 142, 143, 131, 144, 133, 146,
+
+ 134, 147, 135, 148, 147, 149, 136, 137, 138, 150,
+ 139, 141, 140, 151, 152, 130, 153, 154, 142, 143,
+ 144, 155, 156, 146, 163, 156, 147, 148, 149, 147,
+ 158, 159, 150, 160, 161, 164, 165, 151, 152, 153,
+ 154, 166, 156, 167, 155, 156, 167, 157, 163, 167,
+ 43, 42, 167, 158, 159, 169, 160, 161, 164, 165,
+ 169, 169, 169, 169, 169, 166, 169, 169, 162, 169,
+ 169, 157, 169, 169, 169, 169, 169, 169, 169, 169,
+ 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
+ 169, 162, 41, 41, 169, 41, 41, 41, 50, 50,
+
+ 84, 84, 169, 169, 84, 84, 145, 169, 169, 169,
+ 145, 168, 169, 169, 169, 168, 3, 169, 169, 169,
+ 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
+ 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
+ 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
+ 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
+ 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
+ 169, 169, 169, 169, 169, 169, 169
} ;
-static yyconst flex_int16_t yy_chk[454] =
+static yyconst flex_int16_t yy_chk[478] =
{ 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, 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, 83, 21, 24, 7, 45, 20,
- 22, 20, 41, 22, 23, 29, 25, 15, 25, 12,
-
- 20, 23, 16, 18, 19, 26, 6, 21, 24, 25,
- 7, 20, 22, 20, 26, 22, 27, 23, 29, 25,
- 30, 25, 20, 23, 28, 40, 27, 28, 26, 31,
- 51, 25, 52, 30, 53, 31, 26, 32, 32, 27,
- 36, 36, 38, 30, 11, 38, 28, 40, 27, 28,
- 46, 46, 31, 51, 52, 30, 53, 31, 9, 38,
- 32, 32, 33, 33, 33, 33, 34, 34, 34, 34,
- 35, 35, 35, 35, 37, 37, 37, 37, 39, 39,
- 39, 39, 38, 54, 55, 56, 57, 3, 58, 61,
- 62, 63, 64, 123, 65, 39, 123, 66, 67, 70,
-
- 0, 71, 72, 73, 74, 54, 75, 55, 56, 57,
- 58, 61, 62, 77, 63, 64, 65, 78, 39, 66,
- 67, 87, 70, 71, 72, 73, 81, 74, 85, 75,
- 79, 79, 79, 79, 86, 89, 77, 90, 91, 78,
- 80, 80, 80, 80, 87, 92, 93, 94, 81, 95,
- 85, 96, 0, 97, 99, 101, 86, 89, 103, 90,
- 104, 91, 105, 104, 106, 107, 108, 92, 93, 94,
- 112, 95, 113, 117, 96, 97, 99, 116, 101, 118,
- 103, 120, 121, 125, 105, 104, 122, 106, 107, 108,
- 128, 127, 130, 112, 127, 113, 117, 132, 0, 116,
-
- 134, 135, 118, 136, 120, 121, 125, 104, 122, 137,
- 140, 142, 137, 128, 130, 139, 143, 147, 139, 148,
- 132, 146, 134, 135, 146, 136, 150, 151, 155, 0,
- 0, 155, 140, 142, 156, 0, 139, 156, 143, 157,
- 147, 148, 157, 0, 0, 0, 0, 146, 150, 0,
- 151, 0, 0, 0, 0, 0, 0, 0, 0, 139,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 146,
- 159, 159, 0, 159, 159, 159, 160, 160, 161, 161,
- 0, 0, 161, 161, 162, 0, 0, 0, 162, 163,
- 0, 0, 0, 163, 158, 158, 158, 158, 158, 158,
-
- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
- 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
- 158, 158, 158
+ 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, 26, 7,
+ 85, 20, 22, 20, 23, 22, 24, 26, 27, 29,
+
+ 45, 21, 20, 36, 36, 16, 18, 19, 27, 6,
+ 21, 23, 26, 7, 20, 22, 20, 23, 22, 24,
+ 26, 30, 27, 29, 21, 20, 25, 31, 25, 51,
+ 25, 27, 28, 31, 30, 28, 32, 32, 41, 25,
+ 33, 33, 33, 33, 15, 30, 34, 34, 34, 34,
+ 25, 31, 25, 51, 25, 28, 31, 30, 28, 40,
+ 32, 32, 25, 35, 35, 35, 35, 37, 37, 37,
+ 37, 38, 46, 46, 38, 39, 39, 39, 39, 52,
+ 53, 54, 40, 55, 56, 57, 58, 64, 38, 12,
+ 59, 62, 39, 129, 63, 65, 129, 66, 67, 68,
+
+ 69, 72, 52, 53, 54, 73, 74, 55, 56, 57,
+ 58, 64, 38, 59, 62, 75, 39, 63, 76, 65,
+ 66, 67, 68, 69, 77, 72, 79, 89, 73, 74,
+ 80, 81, 81, 81, 81, 83, 87, 88, 75, 91,
+ 92, 93, 76, 82, 82, 82, 82, 94, 77, 95,
+ 79, 89, 96, 80, 97, 98, 99, 100, 83, 87,
+ 88, 101, 91, 92, 93, 103, 105, 108, 107, 110,
+ 108, 94, 95, 109, 111, 96, 112, 97, 98, 116,
+ 99, 100, 117, 118, 101, 121, 122, 124, 103, 123,
+ 105, 107, 108, 110, 126, 127, 109, 128, 111, 131,
+
+ 112, 133, 116, 134, 133, 135, 117, 118, 121, 137,
+ 122, 124, 123, 139, 140, 108, 142, 143, 126, 127,
+ 128, 144, 145, 131, 157, 145, 147, 134, 135, 147,
+ 148, 149, 137, 151, 153, 158, 161, 139, 140, 142,
+ 143, 162, 156, 166, 144, 156, 166, 147, 157, 167,
+ 11, 9, 167, 148, 149, 3, 151, 153, 158, 161,
+ 168, 0, 0, 168, 0, 162, 0, 0, 156, 0,
+ 0, 147, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 156, 170, 170, 0, 170, 170, 170, 171, 171,
+
+ 172, 172, 0, 0, 172, 172, 173, 0, 0, 0,
+ 173, 174, 0, 0, 0, 174, 169, 169, 169, 169,
+ 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
+ 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
+ 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
+ 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
+ 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
+ 169, 169, 169, 169, 169, 169, 169
} ;
static yy_state_type yy_last_accepting_state;
@@ -650,7 +657,7 @@ static void countnl() {
g_lingo->_colnumber = strlen(p);
}
-#line 654 "engines/director/lingo/lingo-lex.cpp"
+#line 661 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -838,7 +845,7 @@ YY_DECL
#line 60 "engines/director/lingo/lingo-lex.l"
-#line 842 "engines/director/lingo/lingo-lex.cpp"
+#line 849 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -892,13 +899,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 >= 159 )
+ if ( yy_current_state >= 170 )
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] != 395 );
+ while ( yy_base[yy_current_state] != 417 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -982,101 +989,111 @@ YY_RULE_SETUP
case 12:
YY_RULE_SETUP
#line 74 "engines/director/lingo/lingo-lex.l"
-{ count(); return tEXIT; }
+{ count(); return tFACTORY; }
YY_BREAK
case 13:
YY_RULE_SETUP
#line 75 "engines/director/lingo/lingo-lex.l"
-{ count(); return tFRAME; }
+{ count(); return tEXIT; }
YY_BREAK
case 14:
YY_RULE_SETUP
#line 76 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGLOBAL; }
+{ count(); return tFRAME; }
YY_BREAK
case 15:
YY_RULE_SETUP
#line 77 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGO; }
+{ count(); return tGLOBAL; }
YY_BREAK
case 16:
YY_RULE_SETUP
#line 78 "engines/director/lingo/lingo-lex.l"
-{ count(); return tINTO; }
+{ count(); return tGO; }
YY_BREAK
case 17:
YY_RULE_SETUP
#line 79 "engines/director/lingo/lingo-lex.l"
-{ count(); return tLOOP; }
+{ count(); return tINTO; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 80 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMACRO; }
+{ count(); return tLOOP; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 81 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMCI; }
+{ count(); return tMACRO; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 82 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMCIWAIT; }
+{ count(); return tMCI; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 83 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMOVIE; }
+{ count(); return tMCIWAIT; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 84 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNEXT; }
+{ count(); return tMETHOD; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 85 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNOT; }
+{ count(); return tMOVIE; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 86 "engines/director/lingo/lingo-lex.l"
-{ count(); return tOF; }
+{ count(); return tNEXT; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 87 "engines/director/lingo/lingo-lex.l"
-{ count(); return tOR; }
+{ count(); return tNOT; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 88 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPREVIOUS; }
+{ count(); return tOF; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 89 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPUT; }
+{ count(); return tOR; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 90 "engines/director/lingo/lingo-lex.l"
-{ count(); return tREPEAT; }
+{ count(); return tPREVIOUS; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 91 "engines/director/lingo/lingo-lex.l"
-{ count(); return tSET; }
+{ count(); return tPUT; }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 92 "engines/director/lingo/lingo-lex.l"
-{ count(); return tSTARTS; }
+{ count(); return tREPEAT; }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 93 "engines/director/lingo/lingo-lex.l"
+{ count(); return tSET; }
+ YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 94 "engines/director/lingo/lingo-lex.l"
+{ count(); return tSTARTS; }
+ YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 95 "engines/director/lingo/lingo-lex.l"
{
count();
@@ -1118,9 +1135,9 @@ YY_RULE_SETUP
error("Unhandled the entity %s", ptr);
}
YY_BREAK
-case 32:
+case 34:
YY_RULE_SETUP
-#line 133 "engines/director/lingo/lingo-lex.l"
+#line 135 "engines/director/lingo/lingo-lex.l"
{
count();
@@ -1141,49 +1158,49 @@ YY_RULE_SETUP
error("Unhandled the entity %s", ptr);
}
YY_BREAK
-case 33:
-YY_RULE_SETUP
-#line 152 "engines/director/lingo/lingo-lex.l"
-{ count(); return tTHEN; }
- YY_BREAK
-case 34:
-YY_RULE_SETUP
-#line 153 "engines/director/lingo/lingo-lex.l"
-{ count(); return tTO; }
- YY_BREAK
case 35:
YY_RULE_SETUP
#line 154 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWITH; }
+{ count(); return tTHEN; }
YY_BREAK
case 36:
YY_RULE_SETUP
#line 155 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWHILE; }
+{ count(); return tTO; }
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 157 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNEQ; }
+#line 156 "engines/director/lingo/lingo-lex.l"
+{ count(); return tWITH; }
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 158 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGE; }
+#line 157 "engines/director/lingo/lingo-lex.l"
+{ count(); return tWHILE; }
YY_BREAK
case 39:
YY_RULE_SETUP
#line 159 "engines/director/lingo/lingo-lex.l"
-{ count(); return tLE; }
+{ count(); return tNEQ; }
YY_BREAK
case 40:
YY_RULE_SETUP
#line 160 "engines/director/lingo/lingo-lex.l"
-{ count(); return tCONCAT; }
+{ count(); return tGE; }
YY_BREAK
case 41:
YY_RULE_SETUP
+#line 161 "engines/director/lingo/lingo-lex.l"
+{ count(); return tLE; }
+ YY_BREAK
+case 42:
+YY_RULE_SETUP
#line 162 "engines/director/lingo/lingo-lex.l"
+{ count(); return tCONCAT; }
+ YY_BREAK
+case 43:
+YY_RULE_SETUP
+#line 164 "engines/director/lingo/lingo-lex.l"
{
count();
yylval.s = new Common::String(yytext);
@@ -1194,43 +1211,43 @@ YY_RULE_SETUP
return ID;
}
YY_BREAK
-case 42:
-YY_RULE_SETUP
-#line 171 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.f = atof(yytext); return FLOAT; }
- YY_BREAK
-case 43:
-YY_RULE_SETUP
-#line 172 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
- YY_BREAK
case 44:
YY_RULE_SETUP
#line 173 "engines/director/lingo/lingo-lex.l"
-{ count(); return *yytext; }
+{ count(); yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 45:
-/* rule 45 can match eol */
YY_RULE_SETUP
#line 174 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 46:
YY_RULE_SETUP
#line 175 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ count(); return *yytext; }
YY_BREAK
case 47:
+/* rule 47 can match eol */
YY_RULE_SETUP
#line 176 "engines/director/lingo/lingo-lex.l"
-
+{ return '\n'; }
YY_BREAK
case 48:
YY_RULE_SETUP
+#line 177 "engines/director/lingo/lingo-lex.l"
+{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+ YY_BREAK
+case 49:
+YY_RULE_SETUP
#line 178 "engines/director/lingo/lingo-lex.l"
+
+ YY_BREAK
+case 50:
+YY_RULE_SETUP
+#line 180 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1234 "engines/director/lingo/lingo-lex.cpp"
+#line 1251 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1523,7 +1540,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 >= 159 )
+ if ( yy_current_state >= 170 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1551,11 +1568,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 >= 159 )
+ if ( yy_current_state >= 170 )
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 == 158);
+ yy_is_jam = (yy_current_state == 169);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2230,7 +2247,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 178 "engines/director/lingo/lingo-lex.l"
+#line 180 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 9113ac3..dd1fbac 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -71,6 +71,7 @@ whitespace [\t ]
(?i:[\n\r]+[\t ]*else) { countnl(); return tNLELSE; }
(?i:else) { count(); return tELSE; }
(?i:end) { count(); return tEND; }
+(?i:factory) { count(); return tFACTORY; }
(?i:exit) { count(); return tEXIT; }
(?i:frame) { count(); return tFRAME; }
(?i:global) { count(); return tGLOBAL; }
@@ -80,6 +81,7 @@ whitespace [\t ]
(?i:macro) { count(); return tMACRO; }
(?i:mci) { count(); return tMCI; }
(?i:mciwait) { count(); return tMCIWAIT; }
+(?i:method) { count(); return tMETHOD; }
(?i:movie) { count(); return tMOVIE; }
(?i:next) { count(); return tNEXT; }
(?i:not) { count(); return tNOT; }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 462b14d..953e90b 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -159,7 +159,7 @@ public:
void popContext();
Symbol *lookupVar(const char *name, bool create = true, bool putInGlobalList = false);
void cleanLocalVars();
- void define(Common::String &s, int start, int nargs);
+ void define(Common::String &s, int start, int nargs, Common::String *prefix = NULL);
void processIf(int elselabel, int endlabel);
int alignTypes(Datum &d1, Datum &d2);
@@ -183,6 +183,7 @@ public:
int codeId(Common::String &s);
int codeId_(Common::String &s);
int codeFloat(double f);
+ void codeFactory(Common::String &s);
static void c_xpop();
static void c_printtop();
@@ -288,6 +289,7 @@ public:
bool _hadError;
bool _inFactory;
+ Common::String _currentFactory;
private:
int parse(const char *code);
Commit: 5f0f0193f921008bf2deb5e249e40936aada8483
https://github.com/scummvm/scummvm/commit/5f0f0193f921008bf2deb5e249e40936aada8483
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix splitting code to sections
Changed paths:
engines/director/lingo/lingo.cpp
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 837dfa0..8302c59 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -106,25 +106,35 @@ Lingo::~Lingo() {
}
const char *Lingo::findNextDefinition(const char *s) {
- const char *res;
+ const char *res = s;
- if ((res = strstr(s, "\nmacro "))) {
- return res;
- } else if ((res = strstr(s, "\nfactory "))) {
- return res;
- } else if (_inFactory && (res = strstr(s, "method "))) {
- if (s == res)
+ while (*res) {
+ while (*res && (*res == ' ' || *res == '\t' || *res == '\n'))
+ res++;
+
+ if (!*res)
+ return NULL;
+
+ if (!strncmp(res, "macro ", 6)) {
+ warning("See macro");
+ return res;
+ }
+
+ if (!strncmp(res, "factory ", 8)) {
+ warning("See factory");
return res;
+ }
- // Check that this is the first token on the line
- const char *tres = res;
- while (tres > s && (*tres == ' ' || *tres == '\t') && *tres != '\n')
- tres--;
- if (*tres == '\n')
+ if (!strncmp(res, "method ", 7)) {
+ warning("See method");
return res;
+ }
+
+ while (*res && *res != '\n')
+ res++;
}
- return nullptr;
+ return NULL;
}
void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
@@ -147,14 +157,13 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
if ((begin = findNextDefinition(code))) {
bool first = true;
- begin += 1;
+ while ((end = findNextDefinition(begin + 1))) {
- while ((end = findNextDefinition(begin))) {
if (first) {
begin = code;
first = false;
}
- Common::String chunk(begin, end + 1);
+ Common::String chunk(begin, end - 1);
if (chunk.hasPrefix("factory") || chunk.hasPrefix("method"))
_inFactory = true;
@@ -163,13 +172,13 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
else
_inFactory = false;
- debug(2, "Code chunk\n#####\n%s#####", chunk.c_str());
+ debug(2, "Code chunk:\n#####\n%s#####", chunk.c_str());
parse(chunk.c_str());
_currentScript->clear();
- begin = end + 1;
+ begin = end;
}
_hadError = true; // HACK: This is for preventing test execution
Commit: 78b198cee9920e62ea19879959316b426fe1834c
https://github.com/scummvm/scummvm/commit/78b198cee9920e62ea19879959316b426fe1834c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Added support for parameter-less built-ins
Changed paths:
engines/director/lingo/lingo-builtins.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.h
engines/director/lingo/tests/factory.lingo
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 0555a13..ab6e3b0 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -47,6 +47,8 @@ static struct BuiltinProto {
{ "chars", Lingo::b_chars, 3},
{ "length", Lingo::b_length, 1},
{ "string", Lingo::b_string, 1},
+ // Misc
+ { "dontpassevent", Lingo::b_dontpassevent, -1 },
{ 0, 0, 0 }
};
@@ -207,5 +209,11 @@ void Lingo::b_string() {
g_lingo->push(d);
}
-
+///////////////////
+// Misc
+///////////////////
+void Lingo::b_dontpassevent() {
+ warning("STUB: b_dontpassevent");
}
+
+} // End of namespace Director
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 035302f..dbbc100 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -75,49 +75,50 @@
THEENTITYWITHID = 264,
FLOAT = 265,
BLTIN = 266,
- ID = 267,
- STRING = 268,
- HANDLER = 269,
- tDOWN = 270,
- tELSE = 271,
- tNLELSIF = 272,
- tEND = 273,
- tEXIT = 274,
- tFRAME = 275,
- tGLOBAL = 276,
- tGO = 277,
- tIF = 278,
- tINTO = 279,
- tLOOP = 280,
- tMACRO = 281,
- tMCI = 282,
- tMCIWAIT = 283,
- tMOVIE = 284,
- tNEXT = 285,
- tOF = 286,
- tPREVIOUS = 287,
- tPUT = 288,
- tREPEAT = 289,
- tSET = 290,
- tTHEN = 291,
- tTO = 292,
- tWITH = 293,
- tWHILE = 294,
- tNLELSE = 295,
- tFACTORY = 296,
- tMETHOD = 297,
- tGE = 298,
- tLE = 299,
- tGT = 300,
- tLT = 301,
- tEQ = 302,
- tNEQ = 303,
- tAND = 304,
- tOR = 305,
- tNOT = 306,
- tCONCAT = 307,
- tCONTAINS = 308,
- tSTARTS = 309
+ BLTINNOARGS = 267,
+ ID = 268,
+ STRING = 269,
+ HANDLER = 270,
+ tDOWN = 271,
+ tELSE = 272,
+ tNLELSIF = 273,
+ tEND = 274,
+ tEXIT = 275,
+ tFRAME = 276,
+ tGLOBAL = 277,
+ tGO = 278,
+ tIF = 279,
+ tINTO = 280,
+ tLOOP = 281,
+ tMACRO = 282,
+ tMCI = 283,
+ tMCIWAIT = 284,
+ tMOVIE = 285,
+ tNEXT = 286,
+ tOF = 287,
+ tPREVIOUS = 288,
+ tPUT = 289,
+ tREPEAT = 290,
+ tSET = 291,
+ tTHEN = 292,
+ tTO = 293,
+ tWITH = 294,
+ tWHILE = 295,
+ tNLELSE = 296,
+ tFACTORY = 297,
+ tMETHOD = 298,
+ tGE = 299,
+ tLE = 300,
+ tGT = 301,
+ tLT = 302,
+ tEQ = 303,
+ tNEQ = 304,
+ tAND = 305,
+ tOR = 306,
+ tNOT = 307,
+ tCONCAT = 308,
+ tCONTAINS = 309,
+ tSTARTS = 310
};
#endif
/* Tokens. */
@@ -130,49 +131,50 @@
#define THEENTITYWITHID 264
#define FLOAT 265
#define BLTIN 266
-#define ID 267
-#define STRING 268
-#define HANDLER 269
-#define tDOWN 270
-#define tELSE 271
-#define tNLELSIF 272
-#define tEND 273
-#define tEXIT 274
-#define tFRAME 275
-#define tGLOBAL 276
-#define tGO 277
-#define tIF 278
-#define tINTO 279
-#define tLOOP 280
-#define tMACRO 281
-#define tMCI 282
-#define tMCIWAIT 283
-#define tMOVIE 284
-#define tNEXT 285
-#define tOF 286
-#define tPREVIOUS 287
-#define tPUT 288
-#define tREPEAT 289
-#define tSET 290
-#define tTHEN 291
-#define tTO 292
-#define tWITH 293
-#define tWHILE 294
-#define tNLELSE 295
-#define tFACTORY 296
-#define tMETHOD 297
-#define tGE 298
-#define tLE 299
-#define tGT 300
-#define tLT 301
-#define tEQ 302
-#define tNEQ 303
-#define tAND 304
-#define tOR 305
-#define tNOT 306
-#define tCONCAT 307
-#define tCONTAINS 308
-#define tSTARTS 309
+#define BLTINNOARGS 267
+#define ID 268
+#define STRING 269
+#define HANDLER 270
+#define tDOWN 271
+#define tELSE 272
+#define tNLELSIF 273
+#define tEND 274
+#define tEXIT 275
+#define tFRAME 276
+#define tGLOBAL 277
+#define tGO 278
+#define tIF 279
+#define tINTO 280
+#define tLOOP 281
+#define tMACRO 282
+#define tMCI 283
+#define tMCIWAIT 284
+#define tMOVIE 285
+#define tNEXT 286
+#define tOF 287
+#define tPREVIOUS 288
+#define tPUT 289
+#define tREPEAT 290
+#define tSET 291
+#define tTHEN 292
+#define tTO 293
+#define tWITH 294
+#define tWHILE 295
+#define tNLELSE 296
+#define tFACTORY 297
+#define tMETHOD 298
+#define tGE 299
+#define tLE 300
+#define tGT 301
+#define tLT 302
+#define tEQ 303
+#define tNEQ 304
+#define tAND 305
+#define tOR 306
+#define tNOT 307
+#define tCONCAT 308
+#define tCONTAINS 309
+#define tSTARTS 310
@@ -193,7 +195,7 @@ extern int yyparse();
using namespace Director;
void yyerror(char *s) {
g_lingo->_hadError = true;
- warning("%s at line %d col %d", s, g_lingo->_linenumber, g_lingo->_colnumber);
+ error("%s at line %d col %d", s, g_lingo->_linenumber, g_lingo->_colnumber);
}
@@ -229,7 +231,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 233 "engines/director/lingo/lingo-gr.cpp"
+#line 235 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -242,7 +244,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 246 "engines/director/lingo/lingo-gr.cpp"
+#line 248 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -455,22 +457,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 74
+#define YYFINAL 75
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 626
+#define YYLAST 641
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 68
+#define YYNTOKENS 69
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 34
/* YYNRULES -- Number of rules. */
-#define YYNRULES 115
+#define YYNRULES 116
/* YYNRULES -- Number of states. */
-#define YYNSTATES 247
+#define YYNSTATES 248
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 309
+#define YYMAXUTOK 310
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -479,12 +481,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 61, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 62, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 60, 66, 2,
- 62, 63, 58, 56, 67, 57, 2, 59, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 61, 67, 2,
+ 63, 64, 59, 57, 68, 58, 2, 60, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 65, 55, 64, 2, 2, 2, 2, 2, 2, 2,
+ 66, 56, 65, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -508,7 +510,8 @@ static const yytype_uint8 yytranslate[] =
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55
};
#if YYDEBUG
@@ -521,62 +524,62 @@ static const yytype_uint16 yyprhs[] =
64, 66, 68, 70, 79, 91, 104, 113, 125, 137,
144, 155, 166, 167, 171, 174, 176, 179, 181, 188,
190, 196, 198, 202, 206, 209, 213, 215, 217, 218,
- 219, 220, 223, 226, 228, 230, 232, 237, 242, 244,
- 246, 249, 251, 255, 259, 263, 267, 271, 275, 279,
- 283, 287, 291, 295, 298, 302, 306, 310, 314, 317,
- 320, 324, 327, 330, 333, 335, 337, 340, 342, 346,
- 349, 352, 355, 358, 362, 365, 369, 372, 375, 377,
- 381, 384, 388, 389, 398, 401, 402, 411, 412, 414,
- 418, 423, 424, 428, 429, 431
+ 219, 220, 223, 226, 228, 230, 232, 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, 329, 332, 335, 337, 339, 342, 344,
+ 348, 351, 354, 357, 360, 364, 367, 371, 374, 377,
+ 379, 383, 386, 390, 391, 400, 403, 404, 413, 414,
+ 416, 420, 425, 426, 430, 431, 433
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 69, 0, -1, 69, 70, 71, -1, 71, -1, 1,
- 61, -1, 61, -1, -1, 95, -1, 90, -1, 100,
- -1, 72, -1, 74, -1, 33, 89, 24, 12, -1,
- 35, 12, 55, 89, -1, 35, 8, 55, 89, -1,
- 35, 9, 89, 55, 89, -1, 35, 12, 37, 89,
- -1, 35, 8, 37, 89, -1, 35, 9, 89, 37,
- 89, -1, 89, -1, 90, -1, 73, -1, 75, -1,
- 82, 62, 81, 63, 88, 87, 18, 34, -1, 83,
- 55, 89, 87, 37, 89, 87, 88, 87, 18, 34,
- -1, 83, 55, 89, 87, 15, 37, 89, 87, 88,
- 87, 18, 34, -1, 84, 81, 36, 70, 88, 87,
- 18, 23, -1, 84, 81, 36, 70, 88, 87, 40,
- 88, 87, 18, 23, -1, 84, 81, 36, 70, 88,
- 87, 86, 77, 87, 18, 23, -1, 84, 81, 36,
- 86, 73, 87, -1, 84, 81, 36, 86, 73, 87,
- 40, 86, 73, 87, -1, 84, 81, 36, 86, 73,
- 87, 78, 87, 76, 87, -1, -1, 40, 86, 73,
- -1, 77, 80, -1, 80, -1, 78, 79, -1, 79,
- -1, 85, 81, 36, 86, 74, 87, -1, 78, -1,
- 85, 81, 36, 88, 87, -1, 89, -1, 89, 55,
- 89, -1, 62, 81, 63, -1, 34, 39, -1, 34,
- 38, 12, -1, 23, -1, 17, -1, -1, -1, -1,
- 88, 70, -1, 88, 74, -1, 7, -1, 10, -1,
- 13, -1, 11, 62, 101, 63, -1, 12, 62, 101,
- 63, -1, 12, -1, 8, -1, 9, 89, -1, 72,
- -1, 89, 56, 89, -1, 89, 57, 89, -1, 89,
- 58, 89, -1, 89, 59, 89, -1, 89, 64, 89,
- -1, 89, 65, 89, -1, 89, 48, 89, -1, 89,
- 43, 89, -1, 89, 44, 89, -1, 89, 49, 89,
- -1, 89, 50, 89, -1, 51, 89, -1, 89, 66,
- 89, -1, 89, 52, 89, -1, 89, 53, 89, -1,
- 89, 54, 89, -1, 56, 89, -1, 57, 89, -1,
- 62, 89, 63, -1, 27, 13, -1, 28, 12, -1,
- 33, 89, -1, 92, -1, 19, -1, 21, 91, -1,
- 12, -1, 91, 67, 12, -1, 22, 25, -1, 22,
- 30, -1, 22, 32, -1, 22, 93, -1, 22, 93,
- 94, -1, 22, 94, -1, 37, 20, 13, -1, 20,
- 13, -1, 37, 13, -1, 13, -1, 31, 29, 13,
- -1, 29, 13, -1, 37, 29, 13, -1, -1, 26,
- 12, 96, 86, 98, 70, 99, 88, -1, 41, 12,
- -1, -1, 42, 12, 97, 86, 98, 70, 99, 88,
- -1, -1, 12, -1, 98, 67, 12, -1, 98, 70,
- 67, 12, -1, -1, 12, 86, 101, -1, -1, 89,
- -1, 101, 67, 89, -1
+ 70, 0, -1, 70, 71, 72, -1, 72, -1, 1,
+ 62, -1, 62, -1, -1, 96, -1, 91, -1, 101,
+ -1, 73, -1, 75, -1, 34, 90, 25, 13, -1,
+ 36, 13, 56, 90, -1, 36, 8, 56, 90, -1,
+ 36, 9, 90, 56, 90, -1, 36, 13, 38, 90,
+ -1, 36, 8, 38, 90, -1, 36, 9, 90, 38,
+ 90, -1, 90, -1, 91, -1, 74, -1, 76, -1,
+ 83, 63, 82, 64, 89, 88, 19, 35, -1, 84,
+ 56, 90, 88, 38, 90, 88, 89, 88, 19, 35,
+ -1, 84, 56, 90, 88, 16, 38, 90, 88, 89,
+ 88, 19, 35, -1, 85, 82, 37, 71, 89, 88,
+ 19, 24, -1, 85, 82, 37, 71, 89, 88, 41,
+ 89, 88, 19, 24, -1, 85, 82, 37, 71, 89,
+ 88, 87, 78, 88, 19, 24, -1, 85, 82, 37,
+ 87, 74, 88, -1, 85, 82, 37, 87, 74, 88,
+ 41, 87, 74, 88, -1, 85, 82, 37, 87, 74,
+ 88, 79, 88, 77, 88, -1, -1, 41, 87, 74,
+ -1, 78, 81, -1, 81, -1, 79, 80, -1, 80,
+ -1, 86, 82, 37, 87, 75, 88, -1, 79, -1,
+ 86, 82, 37, 89, 88, -1, 90, -1, 90, 56,
+ 90, -1, 63, 82, 64, -1, 35, 40, -1, 35,
+ 39, 13, -1, 24, -1, 18, -1, -1, -1, -1,
+ 89, 71, -1, 89, 75, -1, 7, -1, 10, -1,
+ 14, -1, 11, 63, 102, 64, -1, 12, -1, 13,
+ 63, 102, 64, -1, 13, -1, 8, -1, 9, 90,
+ -1, 73, -1, 90, 57, 90, -1, 90, 58, 90,
+ -1, 90, 59, 90, -1, 90, 60, 90, -1, 90,
+ 65, 90, -1, 90, 66, 90, -1, 90, 49, 90,
+ -1, 90, 44, 90, -1, 90, 45, 90, -1, 90,
+ 50, 90, -1, 90, 51, 90, -1, 52, 90, -1,
+ 90, 67, 90, -1, 90, 53, 90, -1, 90, 54,
+ 90, -1, 90, 55, 90, -1, 57, 90, -1, 58,
+ 90, -1, 63, 90, 64, -1, 28, 14, -1, 29,
+ 13, -1, 34, 90, -1, 93, -1, 20, -1, 22,
+ 92, -1, 13, -1, 92, 68, 13, -1, 23, 26,
+ -1, 23, 31, -1, 23, 33, -1, 23, 94, -1,
+ 23, 94, 95, -1, 23, 95, -1, 38, 21, 14,
+ -1, 21, 14, -1, 38, 14, -1, 14, -1, 32,
+ 30, 14, -1, 30, 14, -1, 38, 30, 14, -1,
+ -1, 27, 13, 97, 87, 99, 71, 100, 89, -1,
+ 42, 13, -1, -1, 43, 13, 98, 87, 99, 71,
+ 100, 89, -1, -1, 13, -1, 99, 68, 13, -1,
+ 99, 71, 68, 13, -1, -1, 13, 87, 102, -1,
+ -1, 90, -1, 102, 68, 90, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -587,13 +590,13 @@ static const yytype_uint16 yyrline[] =
170, 172, 173, 178, 189, 205, 219, 226, 235, 244,
254, 264, 275, 276, 279, 280, 283, 284, 287, 295,
296, 304, 305, 306, 308, 310, 316, 322, 329, 331,
- 333, 334, 335, 338, 343, 346, 349, 355, 363, 366,
- 373, 379, 380, 381, 382, 383, 384, 385, 386, 387,
- 388, 389, 390, 391, 392, 393, 394, 395, 396, 397,
- 398, 401, 402, 403, 404, 405, 407, 410, 411, 422,
- 423, 424, 425, 430, 436, 443, 444, 445, 446, 449,
- 450, 451, 479, 479, 485, 488, 488, 494, 495, 496,
- 497, 499, 503, 511, 512, 513
+ 333, 334, 335, 338, 343, 346, 349, 355, 358, 366,
+ 369, 376, 382, 383, 384, 385, 386, 387, 388, 389,
+ 390, 391, 392, 393, 394, 395, 396, 397, 398, 399,
+ 400, 401, 404, 405, 406, 407, 408, 410, 413, 414,
+ 425, 426, 427, 428, 433, 439, 446, 447, 448, 449,
+ 452, 453, 454, 482, 482, 488, 491, 491, 497, 498,
+ 499, 500, 502, 506, 514, 515, 516
};
#endif
@@ -603,16 +606,16 @@ static const yytype_uint16 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "CASTREF", "UNARY", "VOID", "VAR", "INT",
- "THEENTITY", "THEENTITYWITHID", "FLOAT", "BLTIN", "ID", "STRING",
- "HANDLER", "tDOWN", "tELSE", "tNLELSIF", "tEND", "tEXIT", "tFRAME",
- "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT",
- "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT", "tSET",
- "tTHEN", "tTO", "tWITH", "tWHILE", "tNLELSE", "tFACTORY", "tMETHOD",
- "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "tAND", "tOR", "tNOT",
- "tCONCAT", "tCONTAINS", "tSTARTS", "'='", "'+'", "'-'", "'*'", "'/'",
- "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','", "$accept",
- "program", "nl", "programline", "asgn", "stmtoneliner", "stmt", "ifstmt",
- "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
+ "THEENTITY", "THEENTITYWITHID", "FLOAT", "BLTIN", "BLTINNOARGS", "ID",
+ "STRING", "HANDLER", "tDOWN", "tELSE", "tNLELSIF", "tEND", "tEXIT",
+ "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI",
+ "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT",
+ "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tNLELSE", "tFACTORY",
+ "tMETHOD", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "tAND", "tOR",
+ "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS", "'='", "'+'", "'-'", "'*'",
+ "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','",
+ "$accept", "program", "nl", "programline", "asgn", "stmtoneliner",
+ "stmt", "ifstmt", "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
"elseifstmtoneliner1", "elseifstmt1", "cond", "repeatwhile",
"repeatwith", "if", "elseif", "begin", "end", "stmtlist", "expr", "func",
"globallist", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "@2",
@@ -630,26 +633,26 @@ static const yytype_uint16 yytoknum[] =
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 308, 309, 61, 43, 45, 42, 47,
- 37, 10, 40, 41, 62, 60, 38, 44
+ 305, 306, 307, 308, 309, 310, 61, 43, 45, 42,
+ 47, 37, 10, 40, 41, 62, 60, 38, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 68, 69, 69, 69, 70, 71, 71, 71, 71,
- 71, 71, 72, 72, 72, 72, 72, 72, 72, 73,
- 73, 74, 74, 74, 74, 74, 75, 75, 75, 75,
- 75, 75, 76, 76, 77, 77, 78, 78, 79, 80,
- 80, 81, 81, 81, 82, 83, 84, 85, 86, 87,
- 88, 88, 88, 89, 89, 89, 89, 89, 89, 89,
- 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
- 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
- 89, 90, 90, 90, 90, 90, 90, 91, 91, 92,
- 92, 92, 92, 92, 92, 93, 93, 93, 93, 94,
- 94, 94, 96, 95, 95, 97, 95, 98, 98, 98,
- 98, 99, 100, 101, 101, 101
+ 0, 69, 70, 70, 70, 71, 72, 72, 72, 72,
+ 72, 72, 73, 73, 73, 73, 73, 73, 73, 74,
+ 74, 75, 75, 75, 75, 75, 76, 76, 76, 76,
+ 76, 76, 77, 77, 78, 78, 79, 79, 80, 81,
+ 81, 82, 82, 82, 83, 84, 85, 86, 87, 88,
+ 89, 89, 89, 90, 90, 90, 90, 90, 90, 90,
+ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
+ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
+ 90, 90, 91, 91, 91, 91, 91, 91, 92, 92,
+ 93, 93, 93, 93, 93, 93, 94, 94, 94, 94,
+ 95, 95, 95, 97, 96, 96, 98, 96, 99, 99,
+ 99, 99, 100, 101, 102, 102, 102
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -660,13 +663,13 @@ static const yytype_uint8 yyr2[] =
1, 1, 1, 8, 11, 12, 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, 4, 1, 1,
- 2, 1, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 2, 3, 3, 3, 3, 2, 2,
- 3, 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, 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, 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
@@ -674,251 +677,255 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 0, 53, 59, 0, 54, 0, 48, 55, 85,
- 0, 0, 46, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 3, 61, 21, 11,
- 22, 0, 0, 0, 19, 8, 84, 7, 9, 4,
- 58, 0, 61, 60, 113, 113, 113, 87, 86, 98,
- 0, 89, 0, 90, 0, 91, 0, 92, 94, 102,
- 81, 82, 83, 0, 44, 0, 0, 0, 104, 105,
- 73, 78, 79, 0, 1, 5, 6, 0, 0, 0,
- 0, 41, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 114, 0,
- 0, 112, 0, 96, 100, 0, 97, 0, 0, 0,
- 93, 48, 0, 45, 0, 0, 0, 0, 0, 48,
- 80, 2, 0, 49, 0, 0, 48, 0, 69, 70,
- 68, 71, 72, 75, 76, 77, 62, 63, 64, 65,
- 66, 67, 74, 56, 0, 57, 88, 99, 95, 101,
- 107, 12, 17, 14, 0, 0, 16, 13, 107, 50,
- 0, 43, 50, 0, 42, 115, 108, 0, 18, 15,
- 0, 49, 0, 0, 49, 49, 20, 0, 111, 111,
- 51, 52, 0, 0, 49, 48, 29, 109, 0, 50,
- 50, 0, 49, 50, 0, 50, 0, 47, 48, 49,
- 37, 0, 110, 103, 106, 23, 50, 49, 26, 49,
- 49, 39, 35, 0, 0, 36, 32, 0, 49, 0,
- 0, 34, 0, 0, 49, 48, 49, 48, 0, 0,
- 0, 0, 48, 30, 0, 31, 0, 0, 24, 27,
- 28, 49, 33, 49, 25, 40, 38
+ 0, 0, 53, 60, 0, 54, 0, 57, 48, 55,
+ 86, 0, 0, 46, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 3, 62, 21,
+ 11, 22, 0, 0, 0, 19, 8, 85, 7, 9,
+ 4, 59, 0, 62, 61, 114, 114, 114, 88, 87,
+ 99, 0, 90, 0, 91, 0, 92, 0, 93, 95,
+ 103, 82, 83, 84, 0, 44, 0, 0, 0, 105,
+ 106, 74, 79, 80, 0, 1, 5, 6, 0, 0,
+ 0, 0, 41, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 115,
+ 0, 0, 113, 0, 97, 101, 0, 98, 0, 0,
+ 0, 94, 48, 0, 45, 0, 0, 0, 0, 0,
+ 48, 81, 2, 0, 49, 0, 0, 48, 0, 70,
+ 71, 69, 72, 73, 76, 77, 78, 63, 64, 65,
+ 66, 67, 68, 75, 56, 0, 58, 89, 100, 96,
+ 102, 108, 12, 17, 14, 0, 0, 16, 13, 108,
+ 50, 0, 43, 50, 0, 42, 116, 109, 0, 18,
+ 15, 0, 49, 0, 0, 49, 49, 20, 0, 112,
+ 112, 51, 52, 0, 0, 49, 48, 29, 110, 0,
+ 50, 50, 0, 49, 50, 0, 50, 0, 47, 48,
+ 49, 37, 0, 111, 104, 107, 23, 50, 49, 26,
+ 49, 49, 39, 35, 0, 0, 36, 32, 0, 49,
+ 0, 0, 34, 0, 0, 49, 48, 49, 48, 0,
+ 0, 0, 0, 48, 30, 0, 31, 0, 0, 24,
+ 27, 28, 49, 33, 49, 25, 40, 38
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 25, 180, 26, 42, 28, 181, 30, 226, 210,
- 211, 200, 212, 80, 31, 32, 33, 201, 236, 160,
- 171, 34, 176, 48, 36, 57, 58, 37, 111, 119,
- 167, 189, 38, 99
+ -1, 26, 181, 27, 43, 29, 182, 31, 227, 211,
+ 212, 201, 213, 81, 32, 33, 34, 202, 237, 161,
+ 172, 35, 177, 49, 37, 58, 59, 38, 112, 120,
+ 168, 190, 39, 100
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -178
+#define YYPACT_NINF -176
static const yytype_int16 yypact[] =
{
- 199, -40, -178, -178, 2, -178, -21, 517, -178, -178,
- 32, 128, -178, 38, 42, 49, 2, 43, 98, 58,
- 86, 2, 2, 2, 2, 4, -178, 7, -178, -178,
- -178, 47, 56, 236, 498, -178, -178, -178, -178, -178,
- 52, 2, -178, 498, 2, 2, 2, -178, 57, -178,
- 109, -178, 110, -178, 96, -178, 23, 40, -178, -178,
- -178, -178, 388, 114, -178, -17, 2, -7, -178, -178,
- 560, 560, 560, 455, -178, -178, 255, 236, 2, 236,
- 91, 479, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 388, 498, 45,
- 54, 62, 119, -178, -178, 121, -178, 122, 125, 103,
- -178, -178, 127, -178, 2, 2, 412, 2, 2, -178,
- -178, -178, 77, 498, 80, 431, 88, 2, 498, 498,
- 498, 498, 498, 498, 498, 498, 541, 541, 560, 560,
- 498, 498, 498, -178, 2, -178, -178, -178, -178, -178,
- 138, -178, 498, 498, 2, 2, 498, 498, 138, -178,
- 3, -178, -178, 373, 498, 498, -178, 5, 498, 498,
- 5, 311, 115, 2, 311, -178, -178, 139, 95, 95,
- -178, -178, 145, 2, 498, 9, -1, -178, 152, -178,
- -178, 132, 498, -178, 144, -178, 151, -178, -178, 151,
- -178, 236, -178, 311, 311, -178, -178, 311, -178, 311,
- 151, 151, -178, 236, 373, -178, 130, 137, 311, 157,
- 158, -178, 159, 142, -178, -178, -178, -178, 163, 148,
- 160, 162, 14, -178, 373, -178, 342, 153, -178, -178,
- -178, 311, -178, -178, -178, -178, -178
+ 200, -43, -176, -176, 4, -176, -19, -176, 550, -176,
+ -176, 26, 119, -176, 41, 43, 56, 4, 76, 98,
+ 61, 96, 4, 4, 4, 4, 6, -176, 9, -176,
+ -176, -176, -16, 67, 406, 531, -176, -176, -176, -176,
+ -176, 49, 4, -176, 531, 4, 4, 4, -176, 58,
+ -176, 103, -176, 110, -176, 100, -176, 21, 34, -176,
+ -176, -176, -176, 421, 121, -176, -15, 4, -4, -176,
+ -176, 574, 574, 574, 488, -176, -176, 257, 406, 4,
+ 406, 95, 512, 4, 4, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 421, 531,
+ 40, 46, 68, 122, -176, -176, 123, -176, 127, 128,
+ 113, -176, -176, 141, -176, 4, 4, 445, 4, 4,
+ -176, -176, -176, 91, 531, 92, 464, 104, 4, 531,
+ 531, 531, 531, 531, 531, 531, 531, 252, 252, 574,
+ 574, 531, 531, 531, -176, 4, -176, -176, -176, -176,
+ -176, 147, -176, 531, 531, 4, 4, 531, 531, 147,
+ -176, 5, -176, -176, 376, 531, 531, -176, 16, 531,
+ 531, 16, 314, 124, 4, 314, -176, -176, 152, 99,
+ 99, -176, -176, 149, 4, 531, 12, -8, -176, 156,
+ -176, -176, 135, 531, -176, 150, -176, 153, -176, -176,
+ 153, -176, 406, -176, 314, 314, -176, -176, 314, -176,
+ 314, 153, 153, -176, 406, 376, -176, 132, 138, 314,
+ 157, 162, -176, 163, 146, -176, -176, -176, -176, 165,
+ 151, 161, 164, 11, -176, 376, -176, 345, 154, -176,
+ -176, -176, 314, -176, -176, -176, -176, -176
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -178, -178, -23, 113, 26, -160, 0, -178, -178, -178,
- 8, -148, -20, -71, -178, -178, -178, -177, -6, -38,
- -133, 1, 28, -178, -178, -178, 134, -178, -178, -178,
- 35, 16, -178, 55
+ -176, -176, -24, 114, 8, -160, 0, -176, -176, -176,
+ 7, -154, -21, -75, -176, -176, -176, -175, -7, -47,
+ -131, 3, 24, -176, -176, -176, 140, -176, -176, -176,
+ 37, 13, -176, 33
};
/* 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 -59
+#define YYTABLE_NINF -60
static const yytype_int16 yytable[] =
{
- 29, 46, 76, 175, 74, 43, 122, -10, 124, 2,
- 3, 4, 5, 6, 40, 8, 197, 62, 172, 213,
- 114, 39, 70, 71, 72, 73, 27, 194, 35, 174,
- 117, -50, -50, 213, 81, 41, 106, 18, 115, 198,
- 173, 44, 97, 107, 47, 98, 98, 98, 118, 195,
- 59, 215, 108, 21, 224, 60, 203, 204, 22, 23,
- 207, 61, 209, 215, 24, 75, 75, 116, -10, 52,
- 68, 54, 177, 218, 242, -50, 29, 109, 81, 123,
- 125, 63, 64, 128, 129, 130, 131, 132, 133, 134,
- 135, 136, 137, 138, 139, 140, 141, 142, 69, 241,
- 100, 101, 27, 162, 35, 150, 65, 66, 143, 77,
- 67, 78, 144, 158, 45, 152, 153, 145, 156, 157,
- 163, 144, 103, 104, 102, 105, 113, 126, 164, 144,
- 217, 146, 108, 182, 147, 148, 185, 186, 149, 151,
- 159, 49, 223, 161, 178, 165, 193, 179, 50, 75,
- 166, 187, 183, 51, 206, 168, 169, 52, 53, 54,
- 55, 216, 188, 191, 202, 56, 205, 208, 197, 219,
- 225, 220, 222, 227, 184, 229, 230, 231, 232, 196,
- 228, 237, 238, 239, 192, 240, 233, 244, 235, 121,
- 221, 110, 214, 170, 199, 190, 0, 0, 0, -6,
- 1, 0, 81, 245, 0, 246, 2, 3, 4, 5,
- 6, 7, 8, 0, 81, 0, 0, 0, 9, 234,
- 10, 11, 12, 0, 0, 13, 14, 15, 0, 0,
- 0, 0, 16, 17, 18, 0, 243, 0, 0, 0,
- 19, 20, 0, 2, 3, 4, 5, 6, 40, 8,
- 21, 0, 0, 0, 0, 22, 23, 0, 0, 0,
- -6, 24, 2, 3, 4, 5, 6, 7, 8, 41,
- 0, 18, 0, 0, 9, 0, 10, 11, 12, 0,
- 0, 13, 14, 15, 0, 0, 0, 21, 16, 17,
- 18, 0, 22, 23, 0, 0, 19, 20, 79, 0,
- 0, 0, 0, 0, 0, 0, 21, 0, 0, 0,
- 0, 22, 23, 0, 0, 0, 0, 24, 2, 3,
- 4, 5, 6, 40, 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, 2,
- 3, 4, 5, 6, 40, 8, 0, 0, 0, 0,
- 0, 9, 21, 10, 11, 12, 0, 22, 23, 14,
- 15, 0, 75, 24, 0, 16, 17, 18, 0, 0,
- 2, 3, 4, 5, 6, 40, 8, 0, 0, 0,
- 0, 0, 9, 21, 10, 11, 0, 0, 22, 23,
- 14, 15, 0, 0, 24, 0, 16, 0, 18, 0,
- 0, 0, 112, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 21, 0, 0, 0, 0, 22,
- 23, 82, 83, 0, 0, 24, 84, 85, 86, 0,
- 87, 88, 89, 0, 90, 91, 92, 93, 0, 154,
- 0, 0, 94, 95, 96, 82, 83, 0, 0, 0,
- 84, 85, 86, 0, 87, 88, 89, 155, 90, 91,
- 92, 93, 0, 0, 82, 83, 94, 95, 96, 84,
- 85, 86, 0, 87, 88, 89, 127, 90, 91, 92,
- 93, 0, 0, 0, 120, 94, 95, 96, 82, 83,
- 0, 0, 0, 84, 85, 86, 0, 87, 88, 89,
- 0, 90, 91, 92, 93, 0, 0, 0, 120, 94,
- 95, 96, 82, 83, 0, 0, 0, 84, 85, 86,
- 0, 87, 88, 89, 127, 90, 91, 92, 93, 0,
- 0, 82, 83, 94, 95, 96, 84, 85, 86, 0,
- 87, 88, 89, 0, 90, 91, 92, 93, 0, 0,
- -58, -58, 94, 95, 96, -58, -58, -58, 0, -58,
- -58, -58, 0, 0, 0, -58, -58, 0, 0, 45,
- 0, -58, -58, -58, 82, 83, 0, 0, 0, 84,
- 85, 86, 0, 87, 88, 89, 0, 0, 0, 92,
- 93, 0, 0, 82, 83, 94, 95, 96, 84, 85,
- 86, 0, 87, 88, 89, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 94, 95, 96
+ 30, 47, 77, 123, 176, 125, 75, 44, 28, -10,
+ 198, 2, 3, 4, 5, 6, 7, 41, 9, 40,
+ 63, 173, 214, 115, 36, 71, 72, 73, 74, -50,
+ -50, 195, 175, 199, 118, 107, 214, 82, 42, 48,
+ 19, 116, 108, 174, 45, 98, 216, 78, 99, 99,
+ 99, 109, 119, 196, 60, 225, 22, 61, 216, 204,
+ 205, 23, 24, 208, 53, 210, 55, 25, 76, 62,
+ 117, -10, 110, -50, 69, 243, 219, 30, 76, 101,
+ 102, 82, 124, 126, 178, 28, 129, 130, 131, 132,
+ 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
+ 143, 36, 242, 163, 144, 151, 66, 67, 145, 70,
+ 146, 68, 46, 159, 145, 64, 65, 104, 153, 154,
+ 164, 157, 158, 79, 105, 183, 103, 218, 186, 187,
+ 106, 165, 127, 50, 114, 147, 145, 148, 194, 224,
+ 51, 149, 150, 109, 179, 52, 207, 180, 166, 53,
+ 54, 55, 56, 217, 152, 160, 162, 57, 169, 170,
+ 167, 220, 184, 221, 223, 188, 76, 189, 192, 203,
+ 206, 198, 229, 226, 209, 228, 230, 185, 234, 197,
+ 236, 231, 232, 233, 238, 240, 239, 193, 241, 245,
+ 222, 122, 215, 191, 200, 246, 171, 247, 111, 0,
+ -6, 1, 0, 0, 0, 82, 0, 2, 3, 4,
+ 5, 6, 7, 8, 9, 0, 0, 82, 0, 235,
+ 10, 0, 11, 12, 13, 0, 0, 14, 15, 16,
+ 0, 0, 0, 0, 17, 18, 19, 244, 0, 0,
+ 0, 0, 20, 21, 0, 0, 0, 0, 0, 0,
+ 0, 0, 22, 0, 0, 0, 0, 23, 24, 0,
+ 0, 0, -6, 25, 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, 83, 84, 0, 20,
+ 21, 85, 86, 87, 0, 88, 89, 90, 0, 22,
+ 0, 93, 94, 0, 23, 24, 0, 95, 96, 97,
+ 25, 2, 3, 4, 5, 6, 7, 41, 9, 0,
+ 0, 0, 0, 0, 10, 0, 11, 12, 13, 0,
+ 0, 0, 15, 16, 0, 0, 0, 0, 17, 18,
+ 19, 0, 2, 3, 4, 5, 6, 7, 41, 9,
+ 0, 0, 0, 0, 0, 10, 22, 11, 12, 13,
+ 0, 23, 24, 15, 16, 0, 76, 25, 0, 17,
+ 18, 19, 0, 2, 3, 4, 5, 6, 7, 41,
+ 9, 0, 0, 0, 0, 0, 10, 22, 11, 12,
+ 0, 0, 23, 24, 15, 16, 0, 0, 25, 0,
+ 17, 0, 19, 2, 3, 4, 5, 6, 7, 41,
+ 9, 0, 0, 0, 0, 0, 0, 0, 22, 0,
+ 0, 0, 0, 23, 24, 0, 0, 0, 0, 25,
+ 42, 0, 19, 0, 0, 0, 113, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 22, 0,
+ 0, 0, 0, 23, 24, 83, 84, 0, 0, 80,
+ 85, 86, 87, 0, 88, 89, 90, 0, 91, 92,
+ 93, 94, 0, 155, 0, 0, 95, 96, 97, 83,
+ 84, 0, 0, 0, 85, 86, 87, 0, 88, 89,
+ 90, 156, 91, 92, 93, 94, 0, 0, 83, 84,
+ 95, 96, 97, 85, 86, 87, 0, 88, 89, 90,
+ 128, 91, 92, 93, 94, 0, 0, 0, 121, 95,
+ 96, 97, 83, 84, 0, 0, 0, 85, 86, 87,
+ 0, 88, 89, 90, 0, 91, 92, 93, 94, 0,
+ 0, 0, 121, 95, 96, 97, 83, 84, 0, 0,
+ 0, 85, 86, 87, 0, 88, 89, 90, 128, 91,
+ 92, 93, 94, 0, 0, 83, 84, 95, 96, 97,
+ 85, 86, 87, 0, 88, 89, 90, 0, 91, 92,
+ 93, 94, 0, 0, -59, -59, 95, 96, 97, -59,
+ -59, -59, 0, -59, -59, -59, 0, 0, 0, -59,
+ -59, 0, 0, 46, 0, -59, -59, -59, 83, 84,
+ 0, 0, 0, 85, 86, 87, 0, 88, 89, 90,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 95,
+ 96, 97
};
static const yytype_int16 yycheck[] =
{
- 0, 7, 25, 163, 0, 4, 77, 0, 79, 7,
- 8, 9, 10, 11, 12, 13, 17, 16, 15, 196,
- 37, 61, 21, 22, 23, 24, 0, 18, 0, 162,
- 37, 17, 18, 210, 33, 33, 13, 35, 55, 40,
- 37, 62, 41, 20, 12, 44, 45, 46, 55, 40,
- 12, 199, 29, 51, 214, 13, 189, 190, 56, 57,
- 193, 12, 195, 211, 62, 61, 61, 66, 61, 29,
- 12, 31, 67, 206, 234, 61, 76, 37, 77, 78,
- 79, 38, 39, 82, 83, 84, 85, 86, 87, 88,
- 89, 90, 91, 92, 93, 94, 95, 96, 12, 232,
- 45, 46, 76, 126, 76, 111, 8, 9, 63, 62,
- 12, 55, 67, 119, 62, 114, 115, 63, 117, 118,
- 126, 67, 13, 13, 67, 29, 12, 36, 127, 67,
- 201, 12, 29, 171, 13, 13, 174, 175, 13, 12,
- 63, 13, 213, 63, 167, 144, 184, 170, 20, 61,
- 12, 12, 37, 25, 192, 154, 155, 29, 30, 31,
- 32, 199, 67, 18, 12, 37, 34, 23, 17, 207,
- 40, 209, 210, 36, 173, 18, 18, 18, 36, 185,
- 218, 18, 34, 23, 183, 23, 224, 34, 226, 76,
- 210, 57, 198, 158, 186, 179, -1, -1, -1, 0,
- 1, -1, 201, 241, -1, 243, 7, 8, 9, 10,
- 11, 12, 13, -1, 213, -1, -1, -1, 19, 225,
- 21, 22, 23, -1, -1, 26, 27, 28, -1, -1,
- -1, -1, 33, 34, 35, -1, 236, -1, -1, -1,
- 41, 42, -1, 7, 8, 9, 10, 11, 12, 13,
- 51, -1, -1, -1, -1, 56, 57, -1, -1, -1,
- 61, 62, 7, 8, 9, 10, 11, 12, 13, 33,
- -1, 35, -1, -1, 19, -1, 21, 22, 23, -1,
- -1, 26, 27, 28, -1, -1, -1, 51, 33, 34,
- 35, -1, 56, 57, -1, -1, 41, 42, 62, -1,
- -1, -1, -1, -1, -1, -1, 51, -1, -1, -1,
- -1, 56, 57, -1, -1, -1, -1, 62, 7, 8,
- 9, 10, 11, 12, 13, -1, -1, -1, -1, -1,
- 19, -1, 21, 22, 23, -1, -1, -1, 27, 28,
- -1, -1, -1, -1, 33, 34, 35, -1, -1, 7,
- 8, 9, 10, 11, 12, 13, -1, -1, -1, -1,
- -1, 19, 51, 21, 22, 23, -1, 56, 57, 27,
- 28, -1, 61, 62, -1, 33, 34, 35, -1, -1,
- 7, 8, 9, 10, 11, 12, 13, -1, -1, -1,
- -1, -1, 19, 51, 21, 22, -1, -1, 56, 57,
- 27, 28, -1, -1, 62, -1, 33, -1, 35, -1,
- -1, -1, 24, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 51, -1, -1, -1, -1, 56,
- 57, 43, 44, -1, -1, 62, 48, 49, 50, -1,
- 52, 53, 54, -1, 56, 57, 58, 59, -1, 37,
- -1, -1, 64, 65, 66, 43, 44, -1, -1, -1,
- 48, 49, 50, -1, 52, 53, 54, 55, 56, 57,
- 58, 59, -1, -1, 43, 44, 64, 65, 66, 48,
- 49, 50, -1, 52, 53, 54, 55, 56, 57, 58,
- 59, -1, -1, -1, 63, 64, 65, 66, 43, 44,
- -1, -1, -1, 48, 49, 50, -1, 52, 53, 54,
- -1, 56, 57, 58, 59, -1, -1, -1, 63, 64,
- 65, 66, 43, 44, -1, -1, -1, 48, 49, 50,
- -1, 52, 53, 54, 55, 56, 57, 58, 59, -1,
- -1, 43, 44, 64, 65, 66, 48, 49, 50, -1,
- 52, 53, 54, -1, 56, 57, 58, 59, -1, -1,
- 43, 44, 64, 65, 66, 48, 49, 50, -1, 52,
- 53, 54, -1, -1, -1, 58, 59, -1, -1, 62,
- -1, 64, 65, 66, 43, 44, -1, -1, -1, 48,
- 49, 50, -1, 52, 53, 54, -1, -1, -1, 58,
- 59, -1, -1, 43, 44, 64, 65, 66, 48, 49,
- 50, -1, 52, 53, 54, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 64, 65, 66
+ 0, 8, 26, 78, 164, 80, 0, 4, 0, 0,
+ 18, 7, 8, 9, 10, 11, 12, 13, 14, 62,
+ 17, 16, 197, 38, 0, 22, 23, 24, 25, 18,
+ 19, 19, 163, 41, 38, 14, 211, 34, 34, 13,
+ 36, 56, 21, 38, 63, 42, 200, 63, 45, 46,
+ 47, 30, 56, 41, 13, 215, 52, 14, 212, 190,
+ 191, 57, 58, 194, 30, 196, 32, 63, 62, 13,
+ 67, 62, 38, 62, 13, 235, 207, 77, 62, 46,
+ 47, 78, 79, 80, 68, 77, 83, 84, 85, 86,
+ 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
+ 97, 77, 233, 127, 64, 112, 8, 9, 68, 13,
+ 64, 13, 63, 120, 68, 39, 40, 14, 115, 116,
+ 127, 118, 119, 56, 14, 172, 68, 202, 175, 176,
+ 30, 128, 37, 14, 13, 13, 68, 14, 185, 214,
+ 21, 14, 14, 30, 168, 26, 193, 171, 145, 30,
+ 31, 32, 33, 200, 13, 64, 64, 38, 155, 156,
+ 13, 208, 38, 210, 211, 13, 62, 68, 19, 13,
+ 35, 18, 219, 41, 24, 37, 19, 174, 225, 186,
+ 227, 19, 19, 37, 19, 24, 35, 184, 24, 35,
+ 211, 77, 199, 180, 187, 242, 159, 244, 58, -1,
+ 0, 1, -1, -1, -1, 202, -1, 7, 8, 9,
+ 10, 11, 12, 13, 14, -1, -1, 214, -1, 226,
+ 20, -1, 22, 23, 24, -1, -1, 27, 28, 29,
+ -1, -1, -1, -1, 34, 35, 36, 237, -1, -1,
+ -1, -1, 42, 43, -1, -1, -1, -1, -1, -1,
+ -1, -1, 52, -1, -1, -1, -1, 57, 58, -1,
+ -1, -1, 62, 63, 7, 8, 9, 10, 11, 12,
+ 13, 14, -1, -1, -1, -1, -1, 20, -1, 22,
+ 23, 24, -1, -1, 27, 28, 29, -1, -1, -1,
+ -1, 34, 35, 36, -1, -1, 44, 45, -1, 42,
+ 43, 49, 50, 51, -1, 53, 54, 55, -1, 52,
+ -1, 59, 60, -1, 57, 58, -1, 65, 66, 67,
+ 63, 7, 8, 9, 10, 11, 12, 13, 14, -1,
+ -1, -1, -1, -1, 20, -1, 22, 23, 24, -1,
+ -1, -1, 28, 29, -1, -1, -1, -1, 34, 35,
+ 36, -1, 7, 8, 9, 10, 11, 12, 13, 14,
+ -1, -1, -1, -1, -1, 20, 52, 22, 23, 24,
+ -1, 57, 58, 28, 29, -1, 62, 63, -1, 34,
+ 35, 36, -1, 7, 8, 9, 10, 11, 12, 13,
+ 14, -1, -1, -1, -1, -1, 20, 52, 22, 23,
+ -1, -1, 57, 58, 28, 29, -1, -1, 63, -1,
+ 34, -1, 36, 7, 8, 9, 10, 11, 12, 13,
+ 14, -1, -1, -1, -1, -1, -1, -1, 52, -1,
+ -1, -1, -1, 57, 58, -1, -1, -1, -1, 63,
+ 34, -1, 36, -1, -1, -1, 25, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 52, -1,
+ -1, -1, -1, 57, 58, 44, 45, -1, -1, 63,
+ 49, 50, 51, -1, 53, 54, 55, -1, 57, 58,
+ 59, 60, -1, 38, -1, -1, 65, 66, 67, 44,
+ 45, -1, -1, -1, 49, 50, 51, -1, 53, 54,
+ 55, 56, 57, 58, 59, 60, -1, -1, 44, 45,
+ 65, 66, 67, 49, 50, 51, -1, 53, 54, 55,
+ 56, 57, 58, 59, 60, -1, -1, -1, 64, 65,
+ 66, 67, 44, 45, -1, -1, -1, 49, 50, 51,
+ -1, 53, 54, 55, -1, 57, 58, 59, 60, -1,
+ -1, -1, 64, 65, 66, 67, 44, 45, -1, -1,
+ -1, 49, 50, 51, -1, 53, 54, 55, 56, 57,
+ 58, 59, 60, -1, -1, 44, 45, 65, 66, 67,
+ 49, 50, 51, -1, 53, 54, 55, -1, 57, 58,
+ 59, 60, -1, -1, 44, 45, 65, 66, 67, 49,
+ 50, 51, -1, 53, 54, 55, -1, -1, -1, 59,
+ 60, -1, -1, 63, -1, 65, 66, 67, 44, 45,
+ -1, -1, -1, 49, 50, 51, -1, 53, 54, 55,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 65,
+ 66, 67
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 7, 8, 9, 10, 11, 12, 13, 19,
- 21, 22, 23, 26, 27, 28, 33, 34, 35, 41,
- 42, 51, 56, 57, 62, 69, 71, 72, 73, 74,
- 75, 82, 83, 84, 89, 90, 92, 95, 100, 61,
- 12, 33, 72, 89, 62, 62, 86, 12, 91, 13,
- 20, 25, 29, 30, 31, 32, 37, 93, 94, 12,
- 13, 12, 89, 38, 39, 8, 9, 12, 12, 12,
- 89, 89, 89, 89, 0, 61, 70, 62, 55, 62,
- 81, 89, 43, 44, 48, 49, 50, 52, 53, 54,
- 56, 57, 58, 59, 64, 65, 66, 89, 89, 101,
- 101, 101, 67, 13, 13, 29, 13, 20, 29, 37,
- 94, 96, 24, 12, 37, 55, 89, 37, 55, 97,
- 63, 71, 81, 89, 81, 89, 36, 55, 89, 89,
- 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
- 89, 89, 89, 63, 67, 63, 12, 13, 13, 13,
- 86, 12, 89, 89, 37, 55, 89, 89, 86, 63,
- 87, 63, 70, 86, 89, 89, 12, 98, 89, 89,
- 98, 88, 15, 37, 88, 73, 90, 67, 70, 70,
- 70, 74, 87, 37, 89, 87, 87, 12, 67, 99,
- 99, 18, 89, 87, 18, 40, 86, 17, 40, 78,
- 79, 85, 12, 88, 88, 34, 87, 88, 23, 88,
- 77, 78, 80, 85, 86, 79, 87, 81, 88, 87,
- 87, 80, 87, 81, 73, 40, 76, 36, 87, 18,
- 18, 18, 36, 87, 86, 87, 86, 18, 34, 23,
- 23, 88, 73, 74, 34, 87, 87
+ 0, 1, 7, 8, 9, 10, 11, 12, 13, 14,
+ 20, 22, 23, 24, 27, 28, 29, 34, 35, 36,
+ 42, 43, 52, 57, 58, 63, 70, 72, 73, 74,
+ 75, 76, 83, 84, 85, 90, 91, 93, 96, 101,
+ 62, 13, 34, 73, 90, 63, 63, 87, 13, 92,
+ 14, 21, 26, 30, 31, 32, 33, 38, 94, 95,
+ 13, 14, 13, 90, 39, 40, 8, 9, 13, 13,
+ 13, 90, 90, 90, 90, 0, 62, 71, 63, 56,
+ 63, 82, 90, 44, 45, 49, 50, 51, 53, 54,
+ 55, 57, 58, 59, 60, 65, 66, 67, 90, 90,
+ 102, 102, 102, 68, 14, 14, 30, 14, 21, 30,
+ 38, 95, 97, 25, 13, 38, 56, 90, 38, 56,
+ 98, 64, 72, 82, 90, 82, 90, 37, 56, 90,
+ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
+ 90, 90, 90, 90, 64, 68, 64, 13, 14, 14,
+ 14, 87, 13, 90, 90, 38, 56, 90, 90, 87,
+ 64, 88, 64, 71, 87, 90, 90, 13, 99, 90,
+ 90, 99, 89, 16, 38, 89, 74, 91, 68, 71,
+ 71, 71, 75, 88, 38, 90, 88, 88, 13, 68,
+ 100, 100, 19, 90, 88, 19, 41, 87, 18, 41,
+ 79, 80, 86, 13, 89, 89, 35, 88, 89, 24,
+ 89, 78, 79, 81, 86, 87, 80, 88, 82, 89,
+ 88, 88, 81, 88, 82, 74, 41, 77, 37, 88,
+ 19, 19, 19, 37, 88, 87, 88, 87, 19, 35,
+ 24, 24, 89, 74, 75, 35, 88, 88
};
#define yyerrok (yyerrstatus = 0)
@@ -2078,6 +2085,13 @@ yyreduce:
case 57:
#line 355 "engines/director/lingo/lingo-gr.y"
{
+ (yyval.code) = g_lingo->code1(g_lingo->_builtins[*(yyvsp[(1) - (1)].s)]->func);
+ delete (yyvsp[(1) - (1)].s); ;}
+ break;
+
+ 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());
@@ -2087,15 +2101,15 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 58:
-#line 363 "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 59:
-#line 366 "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);
@@ -2105,8 +2119,8 @@ yyreduce:
g_lingo->code2(e, f); ;}
break;
- case 60:
-#line 373 "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;
@@ -2115,149 +2129,149 @@ yyreduce:
g_lingo->code2(e, f); ;}
break;
- case 62:
-#line 380 "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 63:
-#line 381 "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 64:
-#line 382 "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 65:
-#line 383 "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 66:
-#line 384 "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 67:
-#line 385 "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 68:
-#line 386 "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 69:
-#line 387 "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 70:
-#line 388 "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 71:
-#line 389 "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 72:
-#line 390 "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 73:
-#line 391 "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 74:
-#line 392 "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 75:
-#line 393 "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 76:
-#line 394 "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 77:
-#line 395 "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 78:
-#line 396 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 399 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 79:
-#line 397 "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 80:
-#line 398 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 401 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 81:
-#line 401 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 404 "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 82:
-#line 402 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 405 "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 83:
-#line 403 "engines/director/lingo/lingo-gr.y"
+ case 84:
+#line 406 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 85:
-#line 405 "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); ;}
+ case 86:
+#line 408 "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 87:
-#line 410 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 413 "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 88:
-#line 411 "engines/director/lingo/lingo-gr.y"
+ case 89:
+#line 414 "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 89:
-#line 422 "engines/director/lingo/lingo-gr.y"
+ case 90:
+#line 425 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 90:
-#line 423 "engines/director/lingo/lingo-gr.y"
+ case 91:
+#line 426 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 91:
-#line 424 "engines/director/lingo/lingo-gr.y"
+ case 92:
+#line 427 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 92:
-#line 425 "engines/director/lingo/lingo-gr.y"
+ case 93:
+#line 428 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2265,8 +2279,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 93:
-#line 430 "engines/director/lingo/lingo-gr.y"
+ case 94:
+#line 433 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2275,8 +2289,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 94:
-#line 436 "engines/director/lingo/lingo-gr.y"
+ case 95:
+#line 439 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2284,48 +2298,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 95:
-#line 443 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
- break;
-
case 96:
-#line 444 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+#line 446 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 97:
-#line 445 "engines/director/lingo/lingo-gr.y"
+#line 447 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 98:
-#line 446 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+#line 448 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 99:
#line 449 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 100:
-#line 450 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+#line 452 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 101:
-#line 451 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 453 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 102:
-#line 479 "engines/director/lingo/lingo-gr.y"
- { g_lingo->_indef = true; ;}
+#line 454 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 103:
-#line 480 "engines/director/lingo/lingo-gr.y"
+#line 482 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->_indef = true; ;}
+ break;
+
+ case 104:
+#line 483 "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);
@@ -2333,20 +2347,20 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 104:
-#line 485 "engines/director/lingo/lingo-gr.y"
+ case 105:
+#line 488 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeFactory(*(yyvsp[(2) - (2)].s));
;}
break;
- case 105:
-#line 488 "engines/director/lingo/lingo-gr.y"
+ case 106:
+#line 491 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 106:
-#line 489 "engines/director/lingo/lingo-gr.y"
+ case 107:
+#line 492 "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);
@@ -2354,33 +2368,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 107:
-#line 494 "engines/director/lingo/lingo-gr.y"
+ case 108:
+#line 497 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 108:
-#line 495 "engines/director/lingo/lingo-gr.y"
+ case 109:
+#line 498 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 109:
-#line 496 "engines/director/lingo/lingo-gr.y"
+ case 110:
+#line 499 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 110:
-#line 497 "engines/director/lingo/lingo-gr.y"
+ case 111:
+#line 500 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 111:
-#line 499 "engines/director/lingo/lingo-gr.y"
+ case 112:
+#line 502 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 112:
-#line 503 "engines/director/lingo/lingo-gr.y"
+ case 113:
+#line 506 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2389,24 +2403,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 113:
-#line 511 "engines/director/lingo/lingo-gr.y"
+ case 114:
+#line 514 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 114:
-#line 512 "engines/director/lingo/lingo-gr.y"
+ case 115:
+#line 515 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 115:
-#line 513 "engines/director/lingo/lingo-gr.y"
+ case 116:
+#line 516 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2410 "engines/director/lingo/lingo-gr.cpp"
+#line 2424 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2620,6 +2634,6 @@ yyreturn:
}
-#line 516 "engines/director/lingo/lingo-gr.y"
+#line 519 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 9ef3b17..e55340e 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -48,49 +48,50 @@
THEENTITYWITHID = 264,
FLOAT = 265,
BLTIN = 266,
- ID = 267,
- STRING = 268,
- HANDLER = 269,
- tDOWN = 270,
- tELSE = 271,
- tNLELSIF = 272,
- tEND = 273,
- tEXIT = 274,
- tFRAME = 275,
- tGLOBAL = 276,
- tGO = 277,
- tIF = 278,
- tINTO = 279,
- tLOOP = 280,
- tMACRO = 281,
- tMCI = 282,
- tMCIWAIT = 283,
- tMOVIE = 284,
- tNEXT = 285,
- tOF = 286,
- tPREVIOUS = 287,
- tPUT = 288,
- tREPEAT = 289,
- tSET = 290,
- tTHEN = 291,
- tTO = 292,
- tWITH = 293,
- tWHILE = 294,
- tNLELSE = 295,
- tFACTORY = 296,
- tMETHOD = 297,
- tGE = 298,
- tLE = 299,
- tGT = 300,
- tLT = 301,
- tEQ = 302,
- tNEQ = 303,
- tAND = 304,
- tOR = 305,
- tNOT = 306,
- tCONCAT = 307,
- tCONTAINS = 308,
- tSTARTS = 309
+ BLTINNOARGS = 267,
+ ID = 268,
+ STRING = 269,
+ HANDLER = 270,
+ tDOWN = 271,
+ tELSE = 272,
+ tNLELSIF = 273,
+ tEND = 274,
+ tEXIT = 275,
+ tFRAME = 276,
+ tGLOBAL = 277,
+ tGO = 278,
+ tIF = 279,
+ tINTO = 280,
+ tLOOP = 281,
+ tMACRO = 282,
+ tMCI = 283,
+ tMCIWAIT = 284,
+ tMOVIE = 285,
+ tNEXT = 286,
+ tOF = 287,
+ tPREVIOUS = 288,
+ tPUT = 289,
+ tREPEAT = 290,
+ tSET = 291,
+ tTHEN = 292,
+ tTO = 293,
+ tWITH = 294,
+ tWHILE = 295,
+ tNLELSE = 296,
+ tFACTORY = 297,
+ tMETHOD = 298,
+ tGE = 299,
+ tLE = 300,
+ tGT = 301,
+ tLT = 302,
+ tEQ = 303,
+ tNEQ = 304,
+ tAND = 305,
+ tOR = 306,
+ tNOT = 307,
+ tCONCAT = 308,
+ tCONTAINS = 309,
+ tSTARTS = 310
};
#endif
/* Tokens. */
@@ -103,49 +104,50 @@
#define THEENTITYWITHID 264
#define FLOAT 265
#define BLTIN 266
-#define ID 267
-#define STRING 268
-#define HANDLER 269
-#define tDOWN 270
-#define tELSE 271
-#define tNLELSIF 272
-#define tEND 273
-#define tEXIT 274
-#define tFRAME 275
-#define tGLOBAL 276
-#define tGO 277
-#define tIF 278
-#define tINTO 279
-#define tLOOP 280
-#define tMACRO 281
-#define tMCI 282
-#define tMCIWAIT 283
-#define tMOVIE 284
-#define tNEXT 285
-#define tOF 286
-#define tPREVIOUS 287
-#define tPUT 288
-#define tREPEAT 289
-#define tSET 290
-#define tTHEN 291
-#define tTO 292
-#define tWITH 293
-#define tWHILE 294
-#define tNLELSE 295
-#define tFACTORY 296
-#define tMETHOD 297
-#define tGE 298
-#define tLE 299
-#define tGT 300
-#define tLT 301
-#define tEQ 302
-#define tNEQ 303
-#define tAND 304
-#define tOR 305
-#define tNOT 306
-#define tCONCAT 307
-#define tCONTAINS 308
-#define tSTARTS 309
+#define BLTINNOARGS 267
+#define ID 268
+#define STRING 269
+#define HANDLER 270
+#define tDOWN 271
+#define tELSE 272
+#define tNLELSIF 273
+#define tEND 274
+#define tEXIT 275
+#define tFRAME 276
+#define tGLOBAL 277
+#define tGO 278
+#define tIF 279
+#define tINTO 280
+#define tLOOP 281
+#define tMACRO 282
+#define tMCI 283
+#define tMCIWAIT 284
+#define tMOVIE 285
+#define tNEXT 286
+#define tOF 287
+#define tPREVIOUS 288
+#define tPUT 289
+#define tREPEAT 290
+#define tSET 291
+#define tTHEN 292
+#define tTO 293
+#define tWITH 294
+#define tWHILE 295
+#define tNLELSE 296
+#define tFACTORY 297
+#define tMETHOD 298
+#define tGE 299
+#define tLE 300
+#define tGT 301
+#define tLT 302
+#define tEQ 303
+#define tNEQ 304
+#define tAND 305
+#define tOR 306
+#define tNOT 307
+#define tCONCAT 308
+#define tCONTAINS 309
+#define tSTARTS 310
@@ -162,7 +164,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 166 "engines/director/lingo/lingo-gr.hpp"
+#line 168 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 9bdb29e..15c6c68 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -60,7 +60,7 @@ extern int yyparse();
using namespace Director;
void yyerror(char *s) {
g_lingo->_hadError = true;
- warning("%s at line %d col %d", s, g_lingo->_linenumber, g_lingo->_colnumber);
+ error("%s at line %d col %d", s, g_lingo->_linenumber, g_lingo->_colnumber);
}
@@ -79,7 +79,7 @@ void yyerror(char *s) {
%token<i> INT
%token<e> THEENTITY THEENTITYWITHID
%token<f> FLOAT
-%token<s> BLTIN ID STRING HANDLER
+%token<s> BLTIN BLTINNOARGS ID STRING HANDLER
%token tDOWN tELSE tNLELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
%token tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO
%token tWITH tWHILE tNLELSE tFACTORY tMETHOD
@@ -352,6 +352,9 @@ expr: INT {
$$ = g_lingo->code1(g_lingo->_builtins[*$1]->func);
delete $1; }
+ | BLTINNOARGS {
+ $$ = g_lingo->code1(g_lingo->_builtins[*$1]->func);
+ delete $1; }
| ID '(' arglist ')' {
$$ = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString($1->c_str());
@@ -402,8 +405,8 @@ func: tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_
| tMCIWAIT ID { g_lingo->code1(g_lingo->c_mciwait); g_lingo->codeString($2->c_str()); delete $2; }
| tPUT expr { g_lingo->code1(g_lingo->c_printtop); }
| gotofunc
- | tEXIT { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
- g_lingo->code1(g_lingo->c_procret); }
+ | tEXIT { g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
+ g_lingo->code1(g_lingo->c_procret); }
| tGLOBAL globallist
;
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 111574c..f630dfd 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -1205,49 +1205,53 @@ YY_RULE_SETUP
count();
yylval.s = new Common::String(yytext);
- if (g_lingo->_builtins.contains(yytext))
- return BLTIN;
+ if (g_lingo->_builtins.contains(yytext)) {
+ if (g_lingo->_builtins[yytext]->nargs == -1)
+ return BLTINNOARGS;
+ else
+ return BLTIN;
+ }
return ID;
}
YY_BREAK
case 44:
YY_RULE_SETUP
-#line 173 "engines/director/lingo/lingo-lex.l"
+#line 177 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 174 "engines/director/lingo/lingo-lex.l"
+#line 178 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 175 "engines/director/lingo/lingo-lex.l"
+#line 179 "engines/director/lingo/lingo-lex.l"
{ count(); return *yytext; }
YY_BREAK
case 47:
/* rule 47 can match eol */
YY_RULE_SETUP
-#line 176 "engines/director/lingo/lingo-lex.l"
+#line 180 "engines/director/lingo/lingo-lex.l"
{ return '\n'; }
YY_BREAK
case 48:
YY_RULE_SETUP
-#line 177 "engines/director/lingo/lingo-lex.l"
+#line 181 "engines/director/lingo/lingo-lex.l"
{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
case 49:
YY_RULE_SETUP
-#line 178 "engines/director/lingo/lingo-lex.l"
+#line 182 "engines/director/lingo/lingo-lex.l"
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 180 "engines/director/lingo/lingo-lex.l"
+#line 184 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1251 "engines/director/lingo/lingo-lex.cpp"
+#line 1255 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -2247,7 +2251,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 180 "engines/director/lingo/lingo-lex.l"
+#line 184 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index dd1fbac..21110ce 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -165,8 +165,12 @@ whitespace [\t ]
count();
yylval.s = new Common::String(yytext);
- if (g_lingo->_builtins.contains(yytext))
- return BLTIN;
+ if (g_lingo->_builtins.contains(yytext)) {
+ if (g_lingo->_builtins[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 953e90b..0afef2f 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -253,6 +253,8 @@ public:
static void b_string();
static void b_tan();
+ static void b_dontpassevent();
+
void func_mci(Common::String &s);
void func_mciwait(Common::String &s);
void func_goto(Common::String &frame, Common::String &movie);
diff --git a/engines/director/lingo/tests/factory.lingo b/engines/director/lingo/tests/factory.lingo
index d458ba4..048bb60 100644
--- a/engines/director/lingo/tests/factory.lingo
+++ b/engines/director/lingo/tests/factory.lingo
@@ -37,11 +37,11 @@ method mAtFrame
dontpassevent
set the castnum of sprite 14 to bcast
set the LocV of sprite 14 to (startV-stepV)
- if sprite 14 intersects 10 and (startV-6) <= targetV then
+-- if sprite 14 intersects 10 and (startV-6) <= targetV then
set the castnum of sprite 14 to f16
set the perframehook to false
me(hit)
- exit
+-- exit
end if
if startV < targetV or bcast>g17 then
set the perframehook to false
Commit: 2e0078ef0640dc237b0681e03f06824bffd9be10
https://github.com/scummvm/scummvm/commit/2e0078ef0640dc237b0681e03f06824bffd9be10
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix line counting in code chunks
Changed paths:
engines/director/lingo/lingo.cpp
engines/director/lingo/tests/factory.lingo
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 8302c59..2c25836 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -163,7 +163,7 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
begin = code;
first = false;
}
- Common::String chunk(begin, end - 1);
+ Common::String chunk(begin, end);
if (chunk.hasPrefix("factory") || chunk.hasPrefix("method"))
_inFactory = true;
@@ -182,6 +182,8 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
}
_hadError = true; // HACK: This is for preventing test execution
+
+ debug(2, "Code chunk:\n#####\n%s#####", begin);
parse(begin);
} else {
parse(code);
diff --git a/engines/director/lingo/tests/factory.lingo b/engines/director/lingo/tests/factory.lingo
index 048bb60..cf1e142 100644
--- a/engines/director/lingo/tests/factory.lingo
+++ b/engines/director/lingo/tests/factory.lingo
@@ -26,7 +26,7 @@ method mExit
method mDispose
global aim1
set aim1 = 1
- when keydown then nothing
+-- when keydown then nothing
--
factory fire2
method mNew
@@ -41,8 +41,8 @@ method mAtFrame
set the castnum of sprite 14 to f16
set the perframehook to false
me(hit)
--- exit
- end if
+ exit
+-- end if
if startV < targetV or bcast>g17 then
set the perframehook to false
set the locV of sprite 14 to 340
Commit: 29b6f3edbb9e87bb39ac0635678f1c5a9897c62c
https://github.com/scummvm/scummvm/commit/29b6f3edbb9e87bb39ac0635678f1c5a9897c62c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Stub for when/then statement
Changed paths:
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/tests/factory.lingo
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 553213c..b54953e 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -124,13 +124,13 @@ void Lingo::cleanLocalVars() {
}
void Lingo::define(Common::String &name, int start, int nargs, Common::String *prefix) {
- debug(3, "define(\"%s\", %d, %d, %d)", name.c_str(), start, _currentScript->size() - 1, nargs);
-
Symbol *sym;
if (prefix)
name = *prefix + "-" + name;
+ debug(3, "define(\"%s\", %d, %d, %d)", name.c_str(), start, _currentScript->size() - 1, nargs);
+
if (!_handlers.contains(name)) { // Create variable if it was not defined
sym = new Symbol;
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index dbbc100..1a4ac2d 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -102,23 +102,24 @@
tSET = 291,
tTHEN = 292,
tTO = 293,
- tWITH = 294,
- tWHILE = 295,
- tNLELSE = 296,
- tFACTORY = 297,
- tMETHOD = 298,
- tGE = 299,
- tLE = 300,
- tGT = 301,
- tLT = 302,
- tEQ = 303,
- tNEQ = 304,
- tAND = 305,
- tOR = 306,
- tNOT = 307,
- tCONCAT = 308,
- tCONTAINS = 309,
- tSTARTS = 310
+ tWHEN = 294,
+ tWITH = 295,
+ tWHILE = 296,
+ tNLELSE = 297,
+ tFACTORY = 298,
+ tMETHOD = 299,
+ tGE = 300,
+ tLE = 301,
+ tGT = 302,
+ tLT = 303,
+ tEQ = 304,
+ tNEQ = 305,
+ tAND = 306,
+ tOR = 307,
+ tNOT = 308,
+ tCONCAT = 309,
+ tCONTAINS = 310,
+ tSTARTS = 311
};
#endif
/* Tokens. */
@@ -158,23 +159,24 @@
#define tSET 291
#define tTHEN 292
#define tTO 293
-#define tWITH 294
-#define tWHILE 295
-#define tNLELSE 296
-#define tFACTORY 297
-#define tMETHOD 298
-#define tGE 299
-#define tLE 300
-#define tGT 301
-#define tLT 302
-#define tEQ 303
-#define tNEQ 304
-#define tAND 305
-#define tOR 306
-#define tNOT 307
-#define tCONCAT 308
-#define tCONTAINS 309
-#define tSTARTS 310
+#define tWHEN 294
+#define tWITH 295
+#define tWHILE 296
+#define tNLELSE 297
+#define tFACTORY 298
+#define tMETHOD 299
+#define tGE 300
+#define tLE 301
+#define tGT 302
+#define tLT 303
+#define tEQ 304
+#define tNEQ 305
+#define tAND 306
+#define tOR 307
+#define tNOT 308
+#define tCONCAT 309
+#define tCONTAINS 310
+#define tSTARTS 311
@@ -231,7 +233,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 235 "engines/director/lingo/lingo-gr.cpp"
+#line 237 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -244,7 +246,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 248 "engines/director/lingo/lingo-gr.cpp"
+#line 250 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -457,22 +459,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 75
+#define YYFINAL 77
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 641
+#define YYLAST 682
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 69
+#define YYNTOKENS 70
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 34
/* YYNRULES -- Number of rules. */
-#define YYNRULES 116
+#define YYNRULES 117
/* YYNRULES -- Number of states. */
-#define YYNSTATES 248
+#define YYNSTATES 252
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 310
+#define YYMAXUTOK 311
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -481,12 +483,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 62, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 63, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 61, 67, 2,
- 63, 64, 59, 57, 68, 58, 2, 60, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 62, 68, 2,
+ 64, 65, 60, 58, 69, 59, 2, 61, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 66, 56, 65, 2, 2, 2, 2, 2, 2, 2,
+ 67, 57, 66, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -511,7 +513,7 @@ static const yytype_uint8 yytranslate[] =
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55
+ 55, 56
};
#if YYDEBUG
@@ -521,65 +523,66 @@ static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 7, 9, 12, 14, 15, 17, 19,
21, 23, 25, 30, 35, 40, 46, 51, 56, 62,
- 64, 66, 68, 70, 79, 91, 104, 113, 125, 137,
- 144, 155, 166, 167, 171, 174, 176, 179, 181, 188,
- 190, 196, 198, 202, 206, 209, 213, 215, 217, 218,
- 219, 220, 223, 226, 228, 230, 232, 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, 329, 332, 335, 337, 339, 342, 344,
- 348, 351, 354, 357, 360, 364, 367, 371, 374, 377,
- 379, 383, 386, 390, 391, 400, 403, 404, 413, 414,
- 416, 420, 425, 426, 430, 431, 433
+ 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, 334, 337, 340, 342, 344, 347,
+ 349, 353, 356, 359, 362, 365, 369, 372, 376, 379,
+ 382, 384, 388, 391, 395, 396, 405, 408, 409, 418,
+ 419, 421, 425, 430, 431, 435, 436, 438
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 70, 0, -1, 70, 71, 72, -1, 72, -1, 1,
- 62, -1, 62, -1, -1, 96, -1, 91, -1, 101,
- -1, 73, -1, 75, -1, 34, 90, 25, 13, -1,
- 36, 13, 56, 90, -1, 36, 8, 56, 90, -1,
- 36, 9, 90, 56, 90, -1, 36, 13, 38, 90,
- -1, 36, 8, 38, 90, -1, 36, 9, 90, 38,
- 90, -1, 90, -1, 91, -1, 74, -1, 76, -1,
- 83, 63, 82, 64, 89, 88, 19, 35, -1, 84,
- 56, 90, 88, 38, 90, 88, 89, 88, 19, 35,
- -1, 84, 56, 90, 88, 16, 38, 90, 88, 89,
- 88, 19, 35, -1, 85, 82, 37, 71, 89, 88,
- 19, 24, -1, 85, 82, 37, 71, 89, 88, 41,
- 89, 88, 19, 24, -1, 85, 82, 37, 71, 89,
- 88, 87, 78, 88, 19, 24, -1, 85, 82, 37,
- 87, 74, 88, -1, 85, 82, 37, 87, 74, 88,
- 41, 87, 74, 88, -1, 85, 82, 37, 87, 74,
- 88, 79, 88, 77, 88, -1, -1, 41, 87, 74,
- -1, 78, 81, -1, 81, -1, 79, 80, -1, 80,
- -1, 86, 82, 37, 87, 75, 88, -1, 79, -1,
- 86, 82, 37, 89, 88, -1, 90, -1, 90, 56,
- 90, -1, 63, 82, 64, -1, 35, 40, -1, 35,
- 39, 13, -1, 24, -1, 18, -1, -1, -1, -1,
- 89, 71, -1, 89, 75, -1, 7, -1, 10, -1,
- 14, -1, 11, 63, 102, 64, -1, 12, -1, 13,
- 63, 102, 64, -1, 13, -1, 8, -1, 9, 90,
- -1, 73, -1, 90, 57, 90, -1, 90, 58, 90,
- -1, 90, 59, 90, -1, 90, 60, 90, -1, 90,
- 65, 90, -1, 90, 66, 90, -1, 90, 49, 90,
- -1, 90, 44, 90, -1, 90, 45, 90, -1, 90,
- 50, 90, -1, 90, 51, 90, -1, 52, 90, -1,
- 90, 67, 90, -1, 90, 53, 90, -1, 90, 54,
- 90, -1, 90, 55, 90, -1, 57, 90, -1, 58,
- 90, -1, 63, 90, 64, -1, 28, 14, -1, 29,
- 13, -1, 34, 90, -1, 93, -1, 20, -1, 22,
- 92, -1, 13, -1, 92, 68, 13, -1, 23, 26,
- -1, 23, 31, -1, 23, 33, -1, 23, 94, -1,
- 23, 94, 95, -1, 23, 95, -1, 38, 21, 14,
- -1, 21, 14, -1, 38, 14, -1, 14, -1, 32,
- 30, 14, -1, 30, 14, -1, 38, 30, 14, -1,
- -1, 27, 13, 97, 87, 99, 71, 100, 89, -1,
- 42, 13, -1, -1, 43, 13, 98, 87, 99, 71,
- 100, 89, -1, -1, 13, -1, 99, 68, 13, -1,
- 99, 71, 68, 13, -1, -1, 13, 87, 102, -1,
- -1, 90, -1, 102, 68, 90, -1
+ 71, 0, -1, 71, 72, 73, -1, 73, -1, 1,
+ 63, -1, 63, -1, -1, 97, -1, 92, -1, 102,
+ -1, 74, -1, 76, -1, 34, 91, 25, 13, -1,
+ 36, 13, 57, 91, -1, 36, 8, 57, 91, -1,
+ 36, 9, 91, 57, 91, -1, 36, 13, 38, 91,
+ -1, 36, 8, 38, 91, -1, 36, 9, 91, 38,
+ 91, -1, 91, -1, 92, -1, 75, -1, 77, -1,
+ 84, 64, 83, 65, 90, 89, 19, 35, -1, 85,
+ 57, 91, 89, 38, 91, 89, 90, 89, 19, 35,
+ -1, 85, 57, 91, 89, 16, 38, 91, 89, 90,
+ 89, 19, 35, -1, 39, 13, 37, 91, -1, 86,
+ 83, 37, 72, 90, 89, 19, 24, -1, 86, 83,
+ 37, 72, 90, 89, 42, 90, 89, 19, 24, -1,
+ 86, 83, 37, 72, 90, 89, 88, 79, 89, 19,
+ 24, -1, 86, 83, 37, 88, 75, 89, -1, 86,
+ 83, 37, 88, 75, 89, 42, 88, 75, 89, -1,
+ 86, 83, 37, 88, 75, 89, 80, 89, 78, 89,
+ -1, -1, 42, 88, 75, -1, 79, 82, -1, 82,
+ -1, 80, 81, -1, 81, -1, 87, 83, 37, 88,
+ 76, 89, -1, 80, -1, 87, 83, 37, 90, 89,
+ -1, 91, -1, 91, 57, 91, -1, 64, 83, 65,
+ -1, 35, 41, -1, 35, 40, 13, -1, 24, -1,
+ 18, -1, -1, -1, -1, 90, 72, -1, 90, 76,
+ -1, 7, -1, 10, -1, 14, -1, 11, 64, 103,
+ 65, -1, 12, -1, 13, 64, 103, 65, -1, 13,
+ -1, 8, -1, 9, 91, -1, 74, -1, 91, 58,
+ 91, -1, 91, 59, 91, -1, 91, 60, 91, -1,
+ 91, 61, 91, -1, 91, 66, 91, -1, 91, 67,
+ 91, -1, 91, 50, 91, -1, 91, 45, 91, -1,
+ 91, 46, 91, -1, 91, 51, 91, -1, 91, 52,
+ 91, -1, 53, 91, -1, 91, 68, 91, -1, 91,
+ 54, 91, -1, 91, 55, 91, -1, 91, 56, 91,
+ -1, 58, 91, -1, 59, 91, -1, 64, 91, 65,
+ -1, 28, 14, -1, 29, 13, -1, 34, 91, -1,
+ 94, -1, 20, -1, 22, 93, -1, 13, -1, 93,
+ 69, 13, -1, 23, 26, -1, 23, 31, -1, 23,
+ 33, -1, 23, 95, -1, 23, 95, 96, -1, 23,
+ 96, -1, 38, 21, 14, -1, 21, 14, -1, 38,
+ 14, -1, 14, -1, 32, 30, 14, -1, 30, 14,
+ -1, 38, 30, 14, -1, -1, 27, 13, 98, 88,
+ 100, 72, 101, 90, -1, 43, 13, -1, -1, 44,
+ 13, 99, 88, 100, 72, 101, 90, -1, -1, 13,
+ -1, 100, 69, 13, -1, 100, 72, 69, 13, -1,
+ -1, 13, 88, 103, -1, -1, 91, -1, 103, 69,
+ 91, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -587,16 +590,16 @@ static const yytype_uint16 yyrline[] =
{
0, 100, 100, 101, 102, 105, 110, 111, 112, 113,
114, 115, 118, 124, 130, 138, 146, 152, 160, 169,
- 170, 172, 173, 178, 189, 205, 219, 226, 235, 244,
- 254, 264, 275, 276, 279, 280, 283, 284, 287, 295,
- 296, 304, 305, 306, 308, 310, 316, 322, 329, 331,
- 333, 334, 335, 338, 343, 346, 349, 355, 358, 366,
- 369, 376, 382, 383, 384, 385, 386, 387, 388, 389,
- 390, 391, 392, 393, 394, 395, 396, 397, 398, 399,
- 400, 401, 404, 405, 406, 407, 408, 410, 413, 414,
- 425, 426, 427, 428, 433, 439, 446, 447, 448, 449,
- 452, 453, 454, 482, 482, 488, 491, 491, 497, 498,
- 499, 500, 502, 506, 514, 515, 516
+ 170, 172, 173, 178, 189, 205, 217, 222, 229, 238,
+ 247, 257, 267, 278, 279, 282, 283, 286, 287, 290,
+ 298, 299, 307, 308, 309, 311, 313, 319, 325, 332,
+ 334, 336, 337, 338, 341, 346, 349, 352, 358, 361,
+ 369, 372, 379, 385, 386, 387, 388, 389, 390, 391,
+ 392, 393, 394, 395, 396, 397, 398, 399, 400, 401,
+ 402, 403, 404, 407, 408, 409, 410, 411, 413, 416,
+ 417, 428, 429, 430, 431, 436, 442, 449, 450, 451,
+ 452, 455, 456, 457, 485, 485, 491, 494, 494, 500,
+ 501, 502, 503, 505, 509, 517, 518, 519
};
#endif
@@ -610,10 +613,10 @@ static const char *const yytname[] =
"STRING", "HANDLER", "tDOWN", "tELSE", "tNLELSIF", "tEND", "tEXIT",
"tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI",
"tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT",
- "tSET", "tTHEN", "tTO", "tWITH", "tWHILE", "tNLELSE", "tFACTORY",
- "tMETHOD", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "tAND", "tOR",
- "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS", "'='", "'+'", "'-'", "'*'",
- "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','",
+ "tSET", "tTHEN", "tTO", "tWHEN", "tWITH", "tWHILE", "tNLELSE",
+ "tFACTORY", "tMETHOD", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "tAND",
+ "tOR", "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS", "'='", "'+'", "'-'",
+ "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','",
"$accept", "program", "nl", "programline", "asgn", "stmtoneliner",
"stmt", "ifstmt", "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
"elseifstmtoneliner1", "elseifstmt1", "cond", "repeatwhile",
@@ -633,26 +636,26 @@ static const yytype_uint16 yytoknum[] =
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 308, 309, 310, 61, 43, 45, 42,
- 47, 37, 10, 40, 41, 62, 60, 38, 44
+ 305, 306, 307, 308, 309, 310, 311, 61, 43, 45,
+ 42, 47, 37, 10, 40, 41, 62, 60, 38, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 69, 70, 70, 70, 71, 72, 72, 72, 72,
- 72, 72, 73, 73, 73, 73, 73, 73, 73, 74,
- 74, 75, 75, 75, 75, 75, 76, 76, 76, 76,
- 76, 76, 77, 77, 78, 78, 79, 79, 80, 81,
- 81, 82, 82, 82, 83, 84, 85, 86, 87, 88,
- 89, 89, 89, 90, 90, 90, 90, 90, 90, 90,
- 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
- 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
- 90, 90, 91, 91, 91, 91, 91, 91, 92, 92,
- 93, 93, 93, 93, 93, 93, 94, 94, 94, 94,
- 95, 95, 95, 97, 96, 96, 98, 96, 99, 99,
- 99, 99, 100, 101, 102, 102, 102
+ 0, 70, 71, 71, 71, 72, 73, 73, 73, 73,
+ 73, 73, 74, 74, 74, 74, 74, 74, 74, 75,
+ 75, 76, 76, 76, 76, 76, 76, 77, 77, 77,
+ 77, 77, 77, 78, 78, 79, 79, 80, 80, 81,
+ 82, 82, 83, 83, 83, 84, 85, 86, 87, 88,
+ 89, 90, 90, 90, 91, 91, 91, 91, 91, 91,
+ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91,
+ 91, 91, 91, 91, 91, 91, 91, 91, 91, 91,
+ 91, 91, 91, 92, 92, 92, 92, 92, 92, 93,
+ 93, 94, 94, 94, 94, 94, 94, 95, 95, 95,
+ 95, 96, 96, 96, 98, 97, 97, 99, 97, 100,
+ 100, 100, 100, 101, 102, 103, 103, 103
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -660,16 +663,16 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 3, 1, 2, 1, 0, 1, 1, 1,
1, 1, 4, 4, 4, 5, 4, 4, 5, 1,
- 1, 1, 1, 8, 11, 12, 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, 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
+ 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, 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
@@ -677,224 +680,234 @@ static const yytype_uint8 yyr2[] =
means the default is an error. */
static const yytype_uint8 yydefact[] =
{
- 0, 0, 53, 60, 0, 54, 0, 57, 48, 55,
- 86, 0, 0, 46, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 3, 62, 21,
- 11, 22, 0, 0, 0, 19, 8, 85, 7, 9,
- 4, 59, 0, 62, 61, 114, 114, 114, 88, 87,
- 99, 0, 90, 0, 91, 0, 92, 0, 93, 95,
- 103, 82, 83, 84, 0, 44, 0, 0, 0, 105,
- 106, 74, 79, 80, 0, 1, 5, 6, 0, 0,
- 0, 0, 41, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 115,
- 0, 0, 113, 0, 97, 101, 0, 98, 0, 0,
- 0, 94, 48, 0, 45, 0, 0, 0, 0, 0,
- 48, 81, 2, 0, 49, 0, 0, 48, 0, 70,
- 71, 69, 72, 73, 76, 77, 78, 63, 64, 65,
- 66, 67, 68, 75, 56, 0, 58, 89, 100, 96,
- 102, 108, 12, 17, 14, 0, 0, 16, 13, 108,
- 50, 0, 43, 50, 0, 42, 116, 109, 0, 18,
- 15, 0, 49, 0, 0, 49, 49, 20, 0, 112,
- 112, 51, 52, 0, 0, 49, 48, 29, 110, 0,
- 50, 50, 0, 49, 50, 0, 50, 0, 47, 48,
- 49, 37, 0, 111, 104, 107, 23, 50, 49, 26,
- 49, 49, 39, 35, 0, 0, 36, 32, 0, 49,
- 0, 0, 34, 0, 0, 49, 48, 49, 48, 0,
- 0, 0, 0, 48, 30, 0, 31, 0, 0, 24,
- 27, 28, 49, 33, 49, 25, 40, 38
+ 0, 0, 54, 61, 0, 55, 0, 58, 49, 56,
+ 87, 0, 0, 47, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 3, 63,
+ 21, 11, 22, 0, 0, 0, 19, 8, 86, 7,
+ 9, 4, 60, 0, 63, 62, 115, 115, 115, 89,
+ 88, 100, 0, 91, 0, 92, 0, 93, 0, 94,
+ 96, 104, 83, 84, 85, 0, 45, 0, 0, 0,
+ 0, 106, 107, 75, 80, 81, 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, 116, 0, 0, 114, 0, 98, 102, 0, 99,
+ 0, 0, 0, 95, 49, 0, 46, 0, 0, 0,
+ 0, 0, 0, 49, 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,
+ 90, 101, 97, 103, 109, 12, 17, 14, 0, 0,
+ 16, 13, 26, 109, 51, 0, 44, 51, 0, 43,
+ 117, 110, 0, 18, 15, 0, 50, 0, 0, 50,
+ 50, 20, 0, 113, 113, 52, 53, 0, 0, 50,
+ 49, 30, 111, 0, 51, 51, 0, 50, 51, 0,
+ 51, 0, 48, 49, 50, 38, 0, 112, 105, 108,
+ 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, 26, 181, 27, 43, 29, 182, 31, 227, 211,
- 212, 201, 213, 81, 32, 33, 34, 202, 237, 161,
- 172, 35, 177, 49, 37, 58, 59, 38, 112, 120,
- 168, 190, 39, 100
+ -1, 27, 185, 28, 44, 30, 186, 32, 231, 215,
+ 216, 205, 217, 83, 33, 34, 35, 206, 241, 165,
+ 176, 36, 181, 50, 38, 59, 60, 39, 114, 123,
+ 172, 194, 40, 102
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -176
+#define YYPACT_NINF -185
static const yytype_int16 yypact[] =
{
- 200, -43, -176, -176, 4, -176, -19, -176, 550, -176,
- -176, 26, 119, -176, 41, 43, 56, 4, 76, 98,
- 61, 96, 4, 4, 4, 4, 6, -176, 9, -176,
- -176, -176, -16, 67, 406, 531, -176, -176, -176, -176,
- -176, 49, 4, -176, 531, 4, 4, 4, -176, 58,
- -176, 103, -176, 110, -176, 100, -176, 21, 34, -176,
- -176, -176, -176, 421, 121, -176, -15, 4, -4, -176,
- -176, 574, 574, 574, 488, -176, -176, 257, 406, 4,
- 406, 95, 512, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 421, 531,
- 40, 46, 68, 122, -176, -176, 123, -176, 127, 128,
- 113, -176, -176, 141, -176, 4, 4, 445, 4, 4,
- -176, -176, -176, 91, 531, 92, 464, 104, 4, 531,
- 531, 531, 531, 531, 531, 531, 531, 252, 252, 574,
- 574, 531, 531, 531, -176, 4, -176, -176, -176, -176,
- -176, 147, -176, 531, 531, 4, 4, 531, 531, 147,
- -176, 5, -176, -176, 376, 531, 531, -176, 16, 531,
- 531, 16, 314, 124, 4, 314, -176, -176, 152, 99,
- 99, -176, -176, 149, 4, 531, 12, -8, -176, 156,
- -176, -176, 135, 531, -176, 150, -176, 153, -176, -176,
- 153, -176, 406, -176, 314, 314, -176, -176, 314, -176,
- 314, 153, 153, -176, 406, 376, -176, 132, 138, 314,
- 157, 162, -176, 163, 146, -176, -176, -176, -176, 165,
- 151, 161, 164, 11, -176, 376, -176, 345, 154, -176,
- -176, -176, 314, -176, -176, -176, -176, -176
+ 204, -39, -185, -185, 443, -185, -29, -185, 590, -185,
+ -185, 29, 128, -185, 32, 52, 68, 443, 19, 101,
+ 70, 93, 98, 443, 443, 443, 443, 6, -185, 15,
+ -185, -185, -185, 51, 60, 474, 571, -185, -185, -185,
+ -185, -185, 54, 443, -185, 571, 443, 443, 443, -185,
+ 50, -185, 106, -185, 113, -185, 100, -185, 23, 24,
+ -185, -185, -185, -185, 119, 115, -185, -31, 443, -16,
+ 94, -185, -185, 614, 614, 614, 528, -185, -185, 262,
+ 474, 443, 474, 95, 552, 443, 443, 443, 443, 443,
+ 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
+ 119, 571, 8, 43, 64, 121, -185, -185, 122, -185,
+ 123, 124, 109, -185, -185, 127, -185, 443, 443, 485,
+ 443, 443, 443, -185, -185, -185, 78, 571, 80, 504,
+ 83, 443, 571, 571, 571, 571, 571, 571, 571, 571,
+ 257, 257, 614, 614, 571, 571, 571, -185, 443, -185,
+ -185, -185, -185, -185, 135, -185, 571, 571, 443, 443,
+ 571, 571, 571, 135, -185, 2, -185, -185, 412, 571,
+ 571, -185, -5, 571, 571, -5, 320, 117, 443, 320,
+ -185, -185, 138, 84, 84, -185, -185, 137, 443, 571,
+ -8, -6, -185, 144, -185, -185, 132, 571, -185, 148,
+ -185, 150, -185, -185, 150, -185, 474, -185, 320, 320,
+ -185, -185, 320, -185, 320, 150, 150, -185, 474, 412,
+ -185, 134, 147, 320, 162, 169, -185, 170, 153, -185,
+ -185, -185, -185, 172, 158, 171, 173, -2, -185, 412,
+ -185, 378, 159, -185, -185, -185, 320, -185, -185, -185,
+ -185, -185
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -176, -176, -24, 114, 8, -160, 0, -176, -176, -176,
- 7, -154, -21, -75, -176, -176, -176, -175, -7, -47,
- -131, 3, 24, -176, -176, -176, 140, -176, -176, -176,
- 37, 13, -176, 33
+ -185, -185, -25, 120, 9, -164, 0, -185, -185, -185,
+ 7, -184, -15, -77, -185, -185, -185, -182, -7, -166,
+ -124, 4, 25, -185, -185, -185, 142, -185, -185, -185,
+ 39, 22, -185, 20
};
/* 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 -60
+#define YYTABLE_NINF -61
static const yytype_int16 yytable[] =
{
- 30, 47, 77, 123, 176, 125, 75, 44, 28, -10,
- 198, 2, 3, 4, 5, 6, 7, 41, 9, 40,
- 63, 173, 214, 115, 36, 71, 72, 73, 74, -50,
- -50, 195, 175, 199, 118, 107, 214, 82, 42, 48,
- 19, 116, 108, 174, 45, 98, 216, 78, 99, 99,
- 99, 109, 119, 196, 60, 225, 22, 61, 216, 204,
- 205, 23, 24, 208, 53, 210, 55, 25, 76, 62,
- 117, -10, 110, -50, 69, 243, 219, 30, 76, 101,
- 102, 82, 124, 126, 178, 28, 129, 130, 131, 132,
+ 31, 48, 79, 126, 180, 128, 77, 117, 45, 29,
+ 187, 199, 202, 190, 191, -10, -51, -51, 177, 218,
+ 220, 64, 120, 198, 41, 37, 118, 73, 74, 75,
+ 76, 211, 220, 218, 200, 46, 203, 109, 221, 84,
+ 178, 121, 49, 179, 110, 61, 224, 100, 225, 227,
+ 101, 101, 101, 111, 54, 229, 56, 233, 78, 65,
+ 66, -51, 112, 238, 182, 240, 62, 103, 104, 78,
+ 208, 209, 119, 147, 212, 247, 214, 148, -10, 31,
+ 250, 63, 251, 70, 84, 127, 129, 223, 29, 132,
133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
- 143, 36, 242, 163, 144, 151, 66, 67, 145, 70,
- 146, 68, 46, 159, 145, 64, 65, 104, 153, 154,
- 164, 157, 158, 79, 105, 183, 103, 218, 186, 187,
- 106, 165, 127, 50, 114, 147, 145, 148, 194, 224,
- 51, 149, 150, 109, 179, 52, 207, 180, 166, 53,
- 54, 55, 56, 217, 152, 160, 162, 57, 169, 170,
- 167, 220, 184, 221, 223, 188, 76, 189, 192, 203,
- 206, 198, 229, 226, 209, 228, 230, 185, 234, 197,
- 236, 231, 232, 233, 238, 240, 239, 193, 241, 245,
- 222, 122, 215, 191, 200, 246, 171, 247, 111, 0,
- -6, 1, 0, 0, 0, 82, 0, 2, 3, 4,
- 5, 6, 7, 8, 9, 0, 0, 82, 0, 235,
- 10, 0, 11, 12, 13, 0, 0, 14, 15, 16,
- 0, 0, 0, 0, 17, 18, 19, 244, 0, 0,
- 0, 0, 20, 21, 0, 0, 0, 0, 0, 0,
- 0, 0, 22, 0, 0, 0, 0, 23, 24, 0,
- 0, 0, -6, 25, 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, 83, 84, 0, 20,
- 21, 85, 86, 87, 0, 88, 89, 90, 0, 22,
- 0, 93, 94, 0, 23, 24, 0, 95, 96, 97,
- 25, 2, 3, 4, 5, 6, 7, 41, 9, 0,
- 0, 0, 0, 0, 10, 0, 11, 12, 13, 0,
- 0, 0, 15, 16, 0, 0, 0, 0, 17, 18,
- 19, 0, 2, 3, 4, 5, 6, 7, 41, 9,
- 0, 0, 0, 0, 0, 10, 22, 11, 12, 13,
- 0, 23, 24, 15, 16, 0, 76, 25, 0, 17,
- 18, 19, 0, 2, 3, 4, 5, 6, 7, 41,
- 9, 0, 0, 0, 0, 0, 10, 22, 11, 12,
- 0, 0, 23, 24, 15, 16, 0, 0, 25, 0,
- 17, 0, 19, 2, 3, 4, 5, 6, 7, 41,
- 9, 0, 0, 0, 0, 0, 0, 0, 22, 0,
- 0, 0, 0, 23, 24, 0, 0, 0, 0, 25,
- 42, 0, 19, 0, 0, 0, 113, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 22, 0,
- 0, 0, 0, 23, 24, 83, 84, 0, 0, 80,
- 85, 86, 87, 0, 88, 89, 90, 0, 91, 92,
- 93, 94, 0, 155, 0, 0, 95, 96, 97, 83,
- 84, 0, 0, 0, 85, 86, 87, 0, 88, 89,
- 90, 156, 91, 92, 93, 94, 0, 0, 83, 84,
- 95, 96, 97, 85, 86, 87, 0, 88, 89, 90,
- 128, 91, 92, 93, 94, 0, 0, 0, 121, 95,
- 96, 97, 83, 84, 0, 0, 0, 85, 86, 87,
- 0, 88, 89, 90, 0, 91, 92, 93, 94, 0,
- 0, 0, 121, 95, 96, 97, 83, 84, 0, 0,
- 0, 85, 86, 87, 0, 88, 89, 90, 128, 91,
- 92, 93, 94, 0, 0, 83, 84, 95, 96, 97,
- 85, 86, 87, 0, 88, 89, 90, 0, 91, 92,
- 93, 94, 0, 0, -59, -59, 95, 96, 97, -59,
- -59, -59, 0, -59, -59, -59, 0, 0, 0, -59,
- -59, 0, 0, 46, 0, -59, -59, -59, 83, 84,
- 0, 0, 0, 85, 86, 87, 0, 88, 89, 90,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 95,
- 96, 97
+ 143, 144, 145, 146, 37, 167, 71, 154, 149, 67,
+ 68, 72, 148, 246, 69, 80, 163, 81, 47, 105,
+ 106, 156, 157, 168, 160, 161, 162, 107, 116, 222,
+ 108, 122, 130, 148, 150, 169, 151, 152, 153, 111,
+ 155, 228, 51, 164, 115, 166, 78, 183, 171, 52,
+ 184, 192, 170, 193, 53, 188, 196, 207, 54, 55,
+ 56, 57, 173, 174, 85, 86, 58, 210, 202, 87,
+ 88, 89, 213, 90, 91, 92, 230, 93, 94, 95,
+ 96, 234, 189, 201, 232, 97, 98, 99, 235, 236,
+ 237, 242, 197, 243, 249, 244, 219, 245, 204, 125,
+ 226, 113, 175, 0, -6, 1, 195, 0, 0, 0,
+ 84, 2, 3, 4, 5, 6, 7, 8, 9, 0,
+ 0, 0, 84, 239, 10, 0, 11, 12, 13, 0,
+ 0, 14, 15, 16, 0, 0, 0, 0, 17, 18,
+ 19, 248, 0, 20, 0, 0, 0, 21, 22, 0,
+ 0, 0, 0, 0, 0, 0, 0, 23, 0, 0,
+ 0, 0, 24, 25, 0, 0, 0, -6, 26, 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, 85, 86, 0, 21, 22, 87, 88, 89,
+ 0, 90, 91, 92, 0, 23, 0, 95, 96, 0,
+ 24, 25, 0, 97, 98, 99, 26, 2, 3, 4,
+ 5, 6, 7, 42, 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, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 23, 0, 0, 0, 0, 24, 25,
+ 0, 0, 0, 78, 26, 2, 3, 4, 5, 6,
+ 7, 42, 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, 2,
+ 3, 4, 5, 6, 7, 42, 9, 0, 0, 0,
+ 0, 23, 10, 0, 11, 12, 24, 25, 0, 0,
+ 15, 16, 26, 0, 0, 0, 17, 0, 19, 0,
+ 2, 3, 4, 5, 6, 7, 42, 9, 0, 0,
+ 0, 0, 0, 0, 0, 23, 0, 0, 0, 0,
+ 24, 25, 0, 0, 0, 0, 26, 43, 0, 19,
+ 0, 2, 3, 4, 5, 6, 7, 42, 9, 0,
+ 0, 0, 0, 0, 0, 0, 23, 0, 0, 0,
+ 0, 24, 25, 0, 0, 0, 0, 26, 43, 0,
+ 19, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 158, 0, 0, 0, 23, 0, 0,
+ 85, 86, 24, 25, 0, 87, 88, 89, 82, 90,
+ 91, 92, 159, 93, 94, 95, 96, 0, 0, 85,
+ 86, 97, 98, 99, 87, 88, 89, 0, 90, 91,
+ 92, 131, 93, 94, 95, 96, 0, 0, 0, 124,
+ 97, 98, 99, 85, 86, 0, 0, 0, 87, 88,
+ 89, 0, 90, 91, 92, 0, 93, 94, 95, 96,
+ 0, 0, 0, 124, 97, 98, 99, 85, 86, 0,
+ 0, 0, 87, 88, 89, 0, 90, 91, 92, 131,
+ 93, 94, 95, 96, 0, 0, 85, 86, 97, 98,
+ 99, 87, 88, 89, 0, 90, 91, 92, 0, 93,
+ 94, 95, 96, 0, 0, -60, -60, 97, 98, 99,
+ -60, -60, -60, 0, -60, -60, -60, 0, 0, 0,
+ -60, -60, 0, 0, 47, 0, -60, -60, -60, 85,
+ 86, 0, 0, 0, 87, 88, 89, 0, 90, 91,
+ 92, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 97, 98, 99
};
static const yytype_int16 yycheck[] =
{
- 0, 8, 26, 78, 164, 80, 0, 4, 0, 0,
- 18, 7, 8, 9, 10, 11, 12, 13, 14, 62,
- 17, 16, 197, 38, 0, 22, 23, 24, 25, 18,
- 19, 19, 163, 41, 38, 14, 211, 34, 34, 13,
- 36, 56, 21, 38, 63, 42, 200, 63, 45, 46,
- 47, 30, 56, 41, 13, 215, 52, 14, 212, 190,
- 191, 57, 58, 194, 30, 196, 32, 63, 62, 13,
- 67, 62, 38, 62, 13, 235, 207, 77, 62, 46,
- 47, 78, 79, 80, 68, 77, 83, 84, 85, 86,
- 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
- 97, 77, 233, 127, 64, 112, 8, 9, 68, 13,
- 64, 13, 63, 120, 68, 39, 40, 14, 115, 116,
- 127, 118, 119, 56, 14, 172, 68, 202, 175, 176,
- 30, 128, 37, 14, 13, 13, 68, 14, 185, 214,
- 21, 14, 14, 30, 168, 26, 193, 171, 145, 30,
- 31, 32, 33, 200, 13, 64, 64, 38, 155, 156,
- 13, 208, 38, 210, 211, 13, 62, 68, 19, 13,
- 35, 18, 219, 41, 24, 37, 19, 174, 225, 186,
- 227, 19, 19, 37, 19, 24, 35, 184, 24, 35,
- 211, 77, 199, 180, 187, 242, 159, 244, 58, -1,
- 0, 1, -1, -1, -1, 202, -1, 7, 8, 9,
- 10, 11, 12, 13, 14, -1, -1, 214, -1, 226,
- 20, -1, 22, 23, 24, -1, -1, 27, 28, 29,
- -1, -1, -1, -1, 34, 35, 36, 237, -1, -1,
- -1, -1, 42, 43, -1, -1, -1, -1, -1, -1,
- -1, -1, 52, -1, -1, -1, -1, 57, 58, -1,
- -1, -1, 62, 63, 7, 8, 9, 10, 11, 12,
- 13, 14, -1, -1, -1, -1, -1, 20, -1, 22,
- 23, 24, -1, -1, 27, 28, 29, -1, -1, -1,
- -1, 34, 35, 36, -1, -1, 44, 45, -1, 42,
- 43, 49, 50, 51, -1, 53, 54, 55, -1, 52,
- -1, 59, 60, -1, 57, 58, -1, 65, 66, 67,
- 63, 7, 8, 9, 10, 11, 12, 13, 14, -1,
- -1, -1, -1, -1, 20, -1, 22, 23, 24, -1,
- -1, -1, 28, 29, -1, -1, -1, -1, 34, 35,
- 36, -1, 7, 8, 9, 10, 11, 12, 13, 14,
- -1, -1, -1, -1, -1, 20, 52, 22, 23, 24,
- -1, 57, 58, 28, 29, -1, 62, 63, -1, 34,
- 35, 36, -1, 7, 8, 9, 10, 11, 12, 13,
- 14, -1, -1, -1, -1, -1, 20, 52, 22, 23,
- -1, -1, 57, 58, 28, 29, -1, -1, 63, -1,
- 34, -1, 36, 7, 8, 9, 10, 11, 12, 13,
- 14, -1, -1, -1, -1, -1, -1, -1, 52, -1,
- -1, -1, -1, 57, 58, -1, -1, -1, -1, 63,
- 34, -1, 36, -1, -1, -1, 25, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 52, -1,
- -1, -1, -1, 57, 58, 44, 45, -1, -1, 63,
- 49, 50, 51, -1, 53, 54, 55, -1, 57, 58,
- 59, 60, -1, 38, -1, -1, 65, 66, 67, 44,
- 45, -1, -1, -1, 49, 50, 51, -1, 53, 54,
- 55, 56, 57, 58, 59, 60, -1, -1, 44, 45,
- 65, 66, 67, 49, 50, 51, -1, 53, 54, 55,
- 56, 57, 58, 59, 60, -1, -1, -1, 64, 65,
- 66, 67, 44, 45, -1, -1, -1, 49, 50, 51,
- -1, 53, 54, 55, -1, 57, 58, 59, 60, -1,
- -1, -1, 64, 65, 66, 67, 44, 45, -1, -1,
- -1, 49, 50, 51, -1, 53, 54, 55, 56, 57,
- 58, 59, 60, -1, -1, 44, 45, 65, 66, 67,
- 49, 50, 51, -1, 53, 54, 55, -1, 57, 58,
- 59, 60, -1, -1, 44, 45, 65, 66, 67, 49,
- 50, 51, -1, 53, 54, 55, -1, -1, -1, 59,
- 60, -1, -1, 63, -1, 65, 66, 67, 44, 45,
- -1, -1, -1, 49, 50, 51, -1, 53, 54, 55,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 65,
- 66, 67
+ 0, 8, 27, 80, 168, 82, 0, 38, 4, 0,
+ 176, 19, 18, 179, 180, 0, 18, 19, 16, 201,
+ 204, 17, 38, 189, 63, 0, 57, 23, 24, 25,
+ 26, 197, 216, 215, 42, 64, 42, 14, 204, 35,
+ 38, 57, 13, 167, 21, 13, 212, 43, 214, 215,
+ 46, 47, 48, 30, 30, 219, 32, 223, 63, 40,
+ 41, 63, 38, 229, 69, 231, 14, 47, 48, 63,
+ 194, 195, 68, 65, 198, 239, 200, 69, 63, 79,
+ 246, 13, 248, 13, 80, 81, 82, 211, 79, 85,
+ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ 96, 97, 98, 99, 79, 130, 13, 114, 65, 8,
+ 9, 13, 69, 237, 13, 64, 123, 57, 64, 69,
+ 14, 117, 118, 130, 120, 121, 122, 14, 13, 206,
+ 30, 37, 37, 69, 13, 131, 14, 14, 14, 30,
+ 13, 218, 14, 65, 25, 65, 63, 172, 13, 21,
+ 175, 13, 148, 69, 26, 38, 19, 13, 30, 31,
+ 32, 33, 158, 159, 45, 46, 38, 35, 18, 50,
+ 51, 52, 24, 54, 55, 56, 42, 58, 59, 60,
+ 61, 19, 178, 190, 37, 66, 67, 68, 19, 19,
+ 37, 19, 188, 35, 35, 24, 203, 24, 191, 79,
+ 215, 59, 163, -1, 0, 1, 184, -1, -1, -1,
+ 206, 7, 8, 9, 10, 11, 12, 13, 14, -1,
+ -1, -1, 218, 230, 20, -1, 22, 23, 24, -1,
+ -1, 27, 28, 29, -1, -1, -1, -1, 34, 35,
+ 36, 241, -1, 39, -1, -1, -1, 43, 44, -1,
+ -1, -1, -1, -1, -1, -1, -1, 53, -1, -1,
+ -1, -1, 58, 59, -1, -1, -1, 63, 64, 7,
+ 8, 9, 10, 11, 12, 13, 14, -1, -1, -1,
+ -1, -1, 20, -1, 22, 23, 24, -1, -1, 27,
+ 28, 29, -1, -1, -1, -1, 34, 35, 36, -1,
+ -1, 39, 45, 46, -1, 43, 44, 50, 51, 52,
+ -1, 54, 55, 56, -1, 53, -1, 60, 61, -1,
+ 58, 59, -1, 66, 67, 68, 64, 7, 8, 9,
+ 10, 11, 12, 13, 14, -1, -1, -1, -1, -1,
+ 20, -1, 22, 23, 24, -1, -1, -1, 28, 29,
+ -1, -1, -1, -1, 34, 35, 36, -1, -1, 39,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 53, -1, -1, -1, -1, 58, 59,
+ -1, -1, -1, 63, 64, 7, 8, 9, 10, 11,
+ 12, 13, 14, -1, -1, -1, -1, -1, 20, -1,
+ 22, 23, 24, -1, -1, -1, 28, 29, -1, -1,
+ -1, -1, 34, 35, 36, -1, -1, 39, -1, 7,
+ 8, 9, 10, 11, 12, 13, 14, -1, -1, -1,
+ -1, 53, 20, -1, 22, 23, 58, 59, -1, -1,
+ 28, 29, 64, -1, -1, -1, 34, -1, 36, -1,
+ 7, 8, 9, 10, 11, 12, 13, 14, -1, -1,
+ -1, -1, -1, -1, -1, 53, -1, -1, -1, -1,
+ 58, 59, -1, -1, -1, -1, 64, 34, -1, 36,
+ -1, 7, 8, 9, 10, 11, 12, 13, 14, -1,
+ -1, -1, -1, -1, -1, -1, 53, -1, -1, -1,
+ -1, 58, 59, -1, -1, -1, -1, 64, 34, -1,
+ 36, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 38, -1, -1, -1, 53, -1, -1,
+ 45, 46, 58, 59, -1, 50, 51, 52, 64, 54,
+ 55, 56, 57, 58, 59, 60, 61, -1, -1, 45,
+ 46, 66, 67, 68, 50, 51, 52, -1, 54, 55,
+ 56, 57, 58, 59, 60, 61, -1, -1, -1, 65,
+ 66, 67, 68, 45, 46, -1, -1, -1, 50, 51,
+ 52, -1, 54, 55, 56, -1, 58, 59, 60, 61,
+ -1, -1, -1, 65, 66, 67, 68, 45, 46, -1,
+ -1, -1, 50, 51, 52, -1, 54, 55, 56, 57,
+ 58, 59, 60, 61, -1, -1, 45, 46, 66, 67,
+ 68, 50, 51, 52, -1, 54, 55, 56, -1, 58,
+ 59, 60, 61, -1, -1, 45, 46, 66, 67, 68,
+ 50, 51, 52, -1, 54, 55, 56, -1, -1, -1,
+ 60, 61, -1, -1, 64, -1, 66, 67, 68, 45,
+ 46, -1, -1, -1, 50, 51, 52, -1, 54, 55,
+ 56, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 66, 67, 68
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -903,29 +916,30 @@ static const yytype_uint8 yystos[] =
{
0, 1, 7, 8, 9, 10, 11, 12, 13, 14,
20, 22, 23, 24, 27, 28, 29, 34, 35, 36,
- 42, 43, 52, 57, 58, 63, 70, 72, 73, 74,
- 75, 76, 83, 84, 85, 90, 91, 93, 96, 101,
- 62, 13, 34, 73, 90, 63, 63, 87, 13, 92,
- 14, 21, 26, 30, 31, 32, 33, 38, 94, 95,
- 13, 14, 13, 90, 39, 40, 8, 9, 13, 13,
- 13, 90, 90, 90, 90, 0, 62, 71, 63, 56,
- 63, 82, 90, 44, 45, 49, 50, 51, 53, 54,
- 55, 57, 58, 59, 60, 65, 66, 67, 90, 90,
- 102, 102, 102, 68, 14, 14, 30, 14, 21, 30,
- 38, 95, 97, 25, 13, 38, 56, 90, 38, 56,
- 98, 64, 72, 82, 90, 82, 90, 37, 56, 90,
- 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
- 90, 90, 90, 90, 64, 68, 64, 13, 14, 14,
- 14, 87, 13, 90, 90, 38, 56, 90, 90, 87,
- 64, 88, 64, 71, 87, 90, 90, 13, 99, 90,
- 90, 99, 89, 16, 38, 89, 74, 91, 68, 71,
- 71, 71, 75, 88, 38, 90, 88, 88, 13, 68,
- 100, 100, 19, 90, 88, 19, 41, 87, 18, 41,
- 79, 80, 86, 13, 89, 89, 35, 88, 89, 24,
- 89, 78, 79, 81, 86, 87, 80, 88, 82, 89,
- 88, 88, 81, 88, 82, 74, 41, 77, 37, 88,
- 19, 19, 19, 37, 88, 87, 88, 87, 19, 35,
- 24, 24, 89, 74, 75, 35, 88, 88
+ 39, 43, 44, 53, 58, 59, 64, 71, 73, 74,
+ 75, 76, 77, 84, 85, 86, 91, 92, 94, 97,
+ 102, 63, 13, 34, 74, 91, 64, 64, 88, 13,
+ 93, 14, 21, 26, 30, 31, 32, 33, 38, 95,
+ 96, 13, 14, 13, 91, 40, 41, 8, 9, 13,
+ 13, 13, 13, 91, 91, 91, 91, 0, 63, 72,
+ 64, 57, 64, 83, 91, 45, 46, 50, 51, 52,
+ 54, 55, 56, 58, 59, 60, 61, 66, 67, 68,
+ 91, 91, 103, 103, 103, 69, 14, 14, 30, 14,
+ 21, 30, 38, 96, 98, 25, 13, 38, 57, 91,
+ 38, 57, 37, 99, 65, 73, 83, 91, 83, 91,
+ 37, 57, 91, 91, 91, 91, 91, 91, 91, 91,
+ 91, 91, 91, 91, 91, 91, 91, 65, 69, 65,
+ 13, 14, 14, 14, 88, 13, 91, 91, 38, 57,
+ 91, 91, 91, 88, 65, 89, 65, 72, 88, 91,
+ 91, 13, 100, 91, 91, 100, 90, 16, 38, 90,
+ 75, 92, 69, 72, 72, 72, 76, 89, 38, 91,
+ 89, 89, 13, 69, 101, 101, 19, 91, 89, 19,
+ 42, 88, 18, 42, 80, 81, 87, 13, 90, 90,
+ 35, 89, 90, 24, 90, 79, 80, 82, 87, 88,
+ 81, 89, 83, 90, 89, 89, 82, 89, 83, 75,
+ 42, 78, 37, 89, 19, 19, 19, 37, 89, 88,
+ 89, 88, 19, 35, 24, 24, 90, 75, 76, 35,
+ 89, 89
};
#define yyerrok (yyerrstatus = 0)
@@ -1883,7 +1897,14 @@ yyreduce:
break;
case 26:
-#line 219 "engines/director/lingo/lingo-gr.y"
+#line 217 "engines/director/lingo/lingo-gr.y"
+ {
+ g_lingo->code1(g_lingo->c_ifcode);
+ ;}
+ break;
+
+ case 27:
+#line 222 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (8)].code));
@@ -1893,8 +1914,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 27:
-#line 226 "engines/director/lingo/lingo-gr.y"
+ case 28:
+#line 229 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1906,8 +1927,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 28:
-#line 235 "engines/director/lingo/lingo-gr.y"
+ case 29:
+#line 238 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1919,8 +1940,8 @@ yyreduce:
g_lingo->processIf(0, (yyvsp[(9) - (11)].code)); ;}
break;
- case 29:
-#line 244 "engines/director/lingo/lingo-gr.y"
+ case 30:
+#line 247 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1933,8 +1954,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 30:
-#line 254 "engines/director/lingo/lingo-gr.y"
+ case 31:
+#line 257 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1947,8 +1968,8 @@ yyreduce:
g_lingo->processIf(0, 0); ;}
break;
- case 31:
-#line 264 "engines/director/lingo/lingo-gr.y"
+ case 32:
+#line 267 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1961,18 +1982,18 @@ yyreduce:
g_lingo->processIf(0, (yyvsp[(10) - (10)].code)); ;}
break;
- case 32:
-#line 275 "engines/director/lingo/lingo-gr.y"
+ case 33:
+#line 278 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = 0; ;}
break;
- case 33:
-#line 276 "engines/director/lingo/lingo-gr.y"
+ case 34:
+#line 279 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 38:
-#line 287 "engines/director/lingo/lingo-gr.y"
+ case 39:
+#line 290 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1981,8 +2002,8 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (6)].code)); ;}
break;
- case 40:
-#line 296 "engines/director/lingo/lingo-gr.y"
+ case 41:
+#line 299 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
@@ -1991,23 +2012,23 @@ yyreduce:
g_lingo->codeLabel((yyvsp[(1) - (5)].code)); ;}
break;
- case 41:
-#line 304 "engines/director/lingo/lingo-gr.y"
+ case 42:
+#line 307 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
- case 42:
-#line 305 "engines/director/lingo/lingo-gr.y"
+ case 43:
+#line 308 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
- case 44:
-#line 308 "engines/director/lingo/lingo-gr.y"
+ case 45:
+#line 311 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
- case 45:
-#line 310 "engines/director/lingo/lingo-gr.y"
+ case 46:
+#line 313 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -2015,8 +2036,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 46:
-#line 316 "engines/director/lingo/lingo-gr.y"
+ case 47:
+#line 319 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -2024,8 +2045,8 @@ yyreduce:
g_lingo->codeLabel(0); ;}
break;
- case 47:
-#line 322 "engines/director/lingo/lingo-gr.y"
+ case 48:
+#line 325 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -2034,23 +2055,23 @@ yyreduce:
g_lingo->code1(skipEnd); ;}
break;
- case 48:
-#line 329 "engines/director/lingo/lingo-gr.y"
+ case 49:
+#line 332 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 49:
-#line 331 "engines/director/lingo/lingo-gr.y"
+ case 50:
+#line 334 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 50:
-#line 333 "engines/director/lingo/lingo-gr.y"
+ case 51:
+#line 336 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
- case 53:
-#line 338 "engines/director/lingo/lingo-gr.y"
+ case 54:
+#line 341 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -2058,22 +2079,22 @@ yyreduce:
g_lingo->code1(i); ;}
break;
- case 54:
-#line 343 "engines/director/lingo/lingo-gr.y"
+ case 55:
+#line 346 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
- case 55:
-#line 346 "engines/director/lingo/lingo-gr.y"
+ case 56:
+#line 349 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_stringpush);
g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;}
break;
- case 56:
-#line 349 "engines/director/lingo/lingo-gr.y"
+ case 57:
+#line 352 "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));
@@ -2082,15 +2103,15 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 57:
-#line 355 "engines/director/lingo/lingo-gr.y"
+ case 58:
+#line 358 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->_builtins[*(yyvsp[(1) - (1)].s)]->func);
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 58:
-#line 358 "engines/director/lingo/lingo-gr.y"
+ case 59:
+#line 361 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -2101,15 +2122,15 @@ yyreduce:
delete (yyvsp[(1) - (4)].s); ;}
break;
- case 59:
-#line 366 "engines/director/lingo/lingo-gr.y"
+ case 60:
+#line 369 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
- case 60:
-#line 369 "engines/director/lingo/lingo-gr.y"
+ case 61:
+#line 372 "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);
@@ -2119,8 +2140,8 @@ yyreduce:
g_lingo->code2(e, f); ;}
break;
- case 61:
-#line 376 "engines/director/lingo/lingo-gr.y"
+ case 62:
+#line 379 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_theentitypush);
inst e = 0, f = 0;
@@ -2129,149 +2150,149 @@ yyreduce:
g_lingo->code2(e, f); ;}
break;
- case 63:
-#line 383 "engines/director/lingo/lingo-gr.y"
+ case 64:
+#line 386 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
- case 64:
-#line 384 "engines/director/lingo/lingo-gr.y"
+ case 65:
+#line 387 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
- case 65:
-#line 385 "engines/director/lingo/lingo-gr.y"
+ case 66:
+#line 388 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
- case 66:
-#line 386 "engines/director/lingo/lingo-gr.y"
+ case 67:
+#line 389 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
- case 67:
-#line 387 "engines/director/lingo/lingo-gr.y"
+ case 68:
+#line 390 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
- case 68:
-#line 388 "engines/director/lingo/lingo-gr.y"
+ case 69:
+#line 391 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
- case 69:
-#line 389 "engines/director/lingo/lingo-gr.y"
+ case 70:
+#line 392 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
- case 70:
-#line 390 "engines/director/lingo/lingo-gr.y"
+ case 71:
+#line 393 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
- case 71:
-#line 391 "engines/director/lingo/lingo-gr.y"
+ case 72:
+#line 394 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
- case 72:
-#line 392 "engines/director/lingo/lingo-gr.y"
+ case 73:
+#line 395 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_and); ;}
break;
- case 73:
-#line 393 "engines/director/lingo/lingo-gr.y"
+ case 74:
+#line 396 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_or); ;}
break;
- case 74:
-#line 394 "engines/director/lingo/lingo-gr.y"
+ case 75:
+#line 397 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_not); ;}
break;
- case 75:
-#line 395 "engines/director/lingo/lingo-gr.y"
+ case 76:
+#line 398 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ampersand); ;}
break;
- case 76:
-#line 396 "engines/director/lingo/lingo-gr.y"
+ case 77:
+#line 399 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_concat); ;}
break;
- case 77:
-#line 397 "engines/director/lingo/lingo-gr.y"
+ case 78:
+#line 400 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_contains); ;}
break;
- case 78:
-#line 398 "engines/director/lingo/lingo-gr.y"
+ case 79:
+#line 401 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_starts); ;}
break;
- case 79:
-#line 399 "engines/director/lingo/lingo-gr.y"
+ case 80:
+#line 402 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
- case 80:
-#line 400 "engines/director/lingo/lingo-gr.y"
+ case 81:
+#line 403 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
- case 81:
-#line 401 "engines/director/lingo/lingo-gr.y"
+ case 82:
+#line 404 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
- case 82:
-#line 404 "engines/director/lingo/lingo-gr.y"
+ case 83:
+#line 407 "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 83:
-#line 405 "engines/director/lingo/lingo-gr.y"
+ case 84:
+#line 408 "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 84:
-#line 406 "engines/director/lingo/lingo-gr.y"
+ case 85:
+#line 409 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 86:
-#line 408 "engines/director/lingo/lingo-gr.y"
+ case 87:
+#line 411 "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 88:
-#line 413 "engines/director/lingo/lingo-gr.y"
+ case 89:
+#line 416 "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 89:
-#line 414 "engines/director/lingo/lingo-gr.y"
+ case 90:
+#line 417 "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 90:
-#line 425 "engines/director/lingo/lingo-gr.y"
+ case 91:
+#line 428 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 91:
-#line 426 "engines/director/lingo/lingo-gr.y"
+ case 92:
+#line 429 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 92:
-#line 427 "engines/director/lingo/lingo-gr.y"
+ case 93:
+#line 430 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 93:
-#line 428 "engines/director/lingo/lingo-gr.y"
+ case 94:
+#line 431 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2279,8 +2300,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 94:
-#line 433 "engines/director/lingo/lingo-gr.y"
+ case 95:
+#line 436 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2289,8 +2310,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 95:
-#line 439 "engines/director/lingo/lingo-gr.y"
+ case 96:
+#line 442 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2298,48 +2319,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 96:
-#line 446 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
- break;
-
case 97:
-#line 447 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+#line 449 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 98:
-#line 448 "engines/director/lingo/lingo-gr.y"
+#line 450 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 99:
-#line 449 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+#line 451 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 100:
#line 452 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 101:
-#line 453 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+#line 455 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 102:
-#line 454 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 456 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 103:
-#line 482 "engines/director/lingo/lingo-gr.y"
- { g_lingo->_indef = true; ;}
+#line 457 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 104:
-#line 483 "engines/director/lingo/lingo-gr.y"
+#line 485 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->_indef = true; ;}
+ break;
+
+ case 105:
+#line 486 "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);
@@ -2347,20 +2368,20 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 105:
-#line 488 "engines/director/lingo/lingo-gr.y"
+ case 106:
+#line 491 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeFactory(*(yyvsp[(2) - (2)].s));
;}
break;
- case 106:
-#line 491 "engines/director/lingo/lingo-gr.y"
+ case 107:
+#line 494 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 107:
-#line 492 "engines/director/lingo/lingo-gr.y"
+ case 108:
+#line 495 "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);
@@ -2368,33 +2389,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 108:
-#line 497 "engines/director/lingo/lingo-gr.y"
+ case 109:
+#line 500 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 109:
-#line 498 "engines/director/lingo/lingo-gr.y"
+ case 110:
+#line 501 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 110:
-#line 499 "engines/director/lingo/lingo-gr.y"
+ case 111:
+#line 502 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 111:
-#line 500 "engines/director/lingo/lingo-gr.y"
+ case 112:
+#line 503 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 112:
-#line 502 "engines/director/lingo/lingo-gr.y"
+ case 113:
+#line 505 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 113:
-#line 506 "engines/director/lingo/lingo-gr.y"
+ case 114:
+#line 509 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2403,24 +2424,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 114:
-#line 514 "engines/director/lingo/lingo-gr.y"
+ case 115:
+#line 517 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 115:
-#line 515 "engines/director/lingo/lingo-gr.y"
+ case 116:
+#line 518 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 116:
-#line 516 "engines/director/lingo/lingo-gr.y"
+ case 117:
+#line 519 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2424 "engines/director/lingo/lingo-gr.cpp"
+#line 2445 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2634,6 +2655,6 @@ yyreturn:
}
-#line 519 "engines/director/lingo/lingo-gr.y"
+#line 522 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index e55340e..a459ac9 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -75,23 +75,24 @@
tSET = 291,
tTHEN = 292,
tTO = 293,
- tWITH = 294,
- tWHILE = 295,
- tNLELSE = 296,
- tFACTORY = 297,
- tMETHOD = 298,
- tGE = 299,
- tLE = 300,
- tGT = 301,
- tLT = 302,
- tEQ = 303,
- tNEQ = 304,
- tAND = 305,
- tOR = 306,
- tNOT = 307,
- tCONCAT = 308,
- tCONTAINS = 309,
- tSTARTS = 310
+ tWHEN = 294,
+ tWITH = 295,
+ tWHILE = 296,
+ tNLELSE = 297,
+ tFACTORY = 298,
+ tMETHOD = 299,
+ tGE = 300,
+ tLE = 301,
+ tGT = 302,
+ tLT = 303,
+ tEQ = 304,
+ tNEQ = 305,
+ tAND = 306,
+ tOR = 307,
+ tNOT = 308,
+ tCONCAT = 309,
+ tCONTAINS = 310,
+ tSTARTS = 311
};
#endif
/* Tokens. */
@@ -131,23 +132,24 @@
#define tSET 291
#define tTHEN 292
#define tTO 293
-#define tWITH 294
-#define tWHILE 295
-#define tNLELSE 296
-#define tFACTORY 297
-#define tMETHOD 298
-#define tGE 299
-#define tLE 300
-#define tGT 301
-#define tLT 302
-#define tEQ 303
-#define tNEQ 304
-#define tAND 305
-#define tOR 306
-#define tNOT 307
-#define tCONCAT 308
-#define tCONTAINS 309
-#define tSTARTS 310
+#define tWHEN 294
+#define tWITH 295
+#define tWHILE 296
+#define tNLELSE 297
+#define tFACTORY 298
+#define tMETHOD 299
+#define tGE 300
+#define tLE 301
+#define tGT 302
+#define tLT 303
+#define tEQ 304
+#define tNEQ 305
+#define tAND 306
+#define tOR 307
+#define tNOT 308
+#define tCONCAT 309
+#define tCONTAINS 310
+#define tSTARTS 311
@@ -164,7 +166,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 168 "engines/director/lingo/lingo-gr.hpp"
+#line 170 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 15c6c68..ed3fb11 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -81,7 +81,7 @@ void yyerror(char *s) {
%token<f> FLOAT
%token<s> BLTIN BLTINNOARGS ID STRING HANDLER
%token tDOWN tELSE tNLELSIF tEND tEXIT tFRAME tGLOBAL tGO tIF tINTO tLOOP tMACRO
-%token tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO
+%token tMCI tMCIWAIT tMOVIE tNEXT tOF tPREVIOUS tPUT tREPEAT tSET tTHEN tTO tWHEN
%token tWITH tWHILE tNLELSE tFACTORY tMETHOD
%token tGE tLE tGT tLT tEQ tNEQ tAND tOR tNOT
%token tCONCAT tCONTAINS tSTARTS
@@ -214,6 +214,9 @@ stmt: stmtoneliner
(*g_lingo->_currentScript)[$1 + 3] = body; /* body of loop */
(*g_lingo->_currentScript)[$1 + 4] = inc; /* increment */
(*g_lingo->_currentScript)[$1 + 5] = end; } /* end, if cond fails */
+ | tWHEN ID tTHEN expr {
+ g_lingo->code1(g_lingo->c_ifcode);
+ }
;
ifstmt: if cond tTHEN nl stmtlist end tEND tIF {
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index f630dfd..0284905 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 50
-#define YY_END_OF_BUFFER 51
+#define YY_NUM_RULES 51
+#define YY_END_OF_BUFFER 52
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,26 +373,27 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[170] =
+static yyconst flex_int16_t yy_accept[172] =
{ 0,
- 0, 0, 51, 49, 3, 47, 47, 49, 49, 46,
- 46, 46, 45, 46, 46, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
- 43, 43, 2, 2, 3, 47, 0, 0, 47, 0,
- 0, 48, 42, 1, 44, 45, 41, 39, 40, 43,
- 43, 43, 43, 43, 43, 43, 43, 43, 43, 16,
- 7, 43, 43, 43, 43, 43, 43, 43, 43, 26,
- 27, 43, 43, 43, 43, 43, 43, 36, 43, 43,
- 2, 2, 0, 1, 44, 4, 43, 43, 43, 11,
- 43, 43, 43, 43, 43, 43, 43, 20, 43, 43,
-
- 43, 25, 43, 29, 43, 31, 43, 43, 43, 43,
- 0, 43, 6, 10, 13, 43, 43, 43, 17, 18,
- 43, 43, 43, 43, 24, 43, 43, 43, 0, 35,
- 43, 37, 9, 43, 43, 14, 43, 19, 43, 43,
- 23, 43, 43, 43, 34, 38, 0, 43, 43, 15,
- 43, 22, 43, 30, 32, 0, 0, 43, 12, 21,
- 43, 0, 8, 5, 28, 0, 0, 33, 0
+ 0, 0, 52, 50, 3, 48, 48, 50, 50, 47,
+ 47, 47, 46, 47, 47, 44, 44, 44, 44, 44,
+ 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+ 44, 44, 2, 2, 3, 48, 0, 0, 48, 0,
+ 0, 49, 43, 1, 45, 46, 42, 40, 41, 44,
+ 44, 44, 44, 44, 44, 44, 44, 44, 44, 16,
+ 7, 44, 44, 44, 44, 44, 44, 44, 44, 26,
+ 27, 44, 44, 44, 44, 44, 44, 36, 44, 44,
+ 2, 2, 0, 1, 45, 4, 44, 44, 44, 11,
+ 44, 44, 44, 44, 44, 44, 44, 20, 44, 44,
+
+ 44, 25, 44, 29, 44, 31, 44, 44, 44, 44,
+ 44, 0, 44, 6, 10, 13, 44, 44, 44, 17,
+ 18, 44, 44, 44, 44, 24, 44, 44, 44, 0,
+ 35, 38, 44, 37, 9, 44, 44, 14, 44, 19,
+ 44, 44, 23, 44, 44, 44, 34, 39, 0, 44,
+ 44, 15, 44, 22, 44, 30, 32, 0, 0, 44,
+ 12, 21, 44, 0, 8, 5, 28, 0, 0, 33,
+ 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -437,53 +438,53 @@ static yyconst flex_int32_t yy_meta[61] =
6, 6, 6, 6, 6, 6, 6, 6, 6, 6
} ;
-static yyconst flex_int16_t yy_base[175] =
+static yyconst flex_int16_t yy_base[177] =
{ 0,
- 0, 59, 356, 417, 63, 67, 71, 75, 346, 417,
- 343, 181, 52, 68, 132, 56, 0, 56, 57, 67,
+ 0, 59, 359, 419, 63, 67, 71, 75, 351, 419,
+ 224, 181, 52, 68, 132, 56, 0, 56, 57, 67,
72, 68, 68, 69, 112, 70, 79, 103, 81, 103,
106, 115, 139, 145, 162, 101, 166, 170, 174, 135,
- 133, 417, 417, 0, 90, 163, 417, 417, 417, 0,
+ 133, 419, 419, 0, 90, 163, 419, 419, 419, 0,
112, 153, 146, 151, 166, 162, 169, 172, 163, 0,
0, 160, 167, 171, 173, 166, 165, 164, 169, 0,
- 0, 183, 174, 178, 184, 204, 206, 0, 204, 199,
- 230, 242, 205, 0, 80, 0, 205, 211, 209, 0,
- 208, 209, 216, 232, 222, 224, 225, 221, 235, 235,
-
- 230, 0, 232, 0, 248, 0, 239, 266, 249, 248,
- 256, 262, 0, 0, 0, 252, 264, 269, 0, 0,
- 258, 272, 262, 269, 0, 272, 281, 266, 192, 0,
- 281, 0, 300, 281, 276, 0, 285, 0, 291, 297,
- 0, 289, 286, 291, 321, 0, 325, 304, 295, 0,
- 302, 0, 302, 0, 0, 341, 305, 305, 0, 0,
- 306, 322, 417, 0, 0, 342, 348, 359, 417, 392,
- 394, 400, 405, 410
+ 0, 183, 174, 178, 184, 204, 206, 0, 208, 201,
+ 232, 242, 207, 0, 80, 0, 208, 214, 209, 0,
+ 210, 216, 224, 237, 229, 229, 229, 225, 232, 239,
+
+ 234, 0, 233, 0, 249, 0, 240, 267, 247, 250,
+ 254, 260, 269, 0, 0, 0, 259, 266, 273, 0,
+ 0, 263, 280, 271, 277, 0, 278, 287, 272, 192,
+ 0, 0, 286, 0, 311, 283, 281, 0, 290, 0,
+ 284, 300, 0, 293, 291, 293, 330, 0, 331, 301,
+ 300, 0, 307, 0, 307, 0, 0, 343, 321, 312,
+ 0, 0, 318, 330, 419, 0, 0, 350, 351, 356,
+ 419, 394, 396, 402, 407, 412
} ;
-static yyconst flex_int16_t yy_def[175] =
+static yyconst flex_int16_t yy_def[177] =
{ 0,
- 169, 1, 169, 169, 169, 169, 169, 169, 170, 169,
- 169, 169, 169, 169, 169, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 169, 169, 169, 169, 169, 169, 169, 169,
- 170, 169, 169, 172, 169, 169, 169, 169, 169, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 169, 169, 169, 172, 169, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
-
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 169, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 173, 171,
- 171, 171, 169, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 173, 171, 169, 171, 171, 171,
- 171, 171, 171, 171, 171, 169, 169, 171, 171, 171,
- 171, 169, 169, 171, 171, 169, 174, 174, 0, 169,
- 169, 169, 169, 169
+ 171, 1, 171, 171, 171, 171, 171, 171, 172, 171,
+ 171, 171, 171, 171, 171, 173, 173, 173, 173, 173,
+ 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
+ 173, 173, 171, 171, 171, 171, 171, 171, 171, 171,
+ 172, 171, 171, 174, 171, 171, 171, 171, 171, 173,
+ 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
+ 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
+ 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
+ 171, 171, 171, 174, 171, 173, 173, 173, 173, 173,
+ 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
+
+ 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
+ 173, 171, 173, 173, 173, 173, 173, 173, 173, 173,
+ 173, 173, 173, 173, 173, 173, 173, 173, 173, 175,
+ 173, 173, 173, 173, 171, 173, 173, 173, 173, 173,
+ 173, 173, 173, 173, 173, 173, 175, 173, 171, 173,
+ 173, 173, 173, 173, 173, 173, 173, 171, 171, 173,
+ 173, 173, 173, 171, 171, 173, 173, 171, 176, 176,
+ 0, 171, 171, 171, 171, 171
} ;
-static yyconst flex_int16_t yy_nxt[478] =
+static yyconst flex_int16_t yy_nxt[480] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
13, 14, 10, 15, 16, 17, 18, 19, 20, 21,
@@ -505,41 +506,41 @@ static yyconst flex_int16_t yy_nxt[478] =
79, 80, 67, 35, 36, 36, 37, 37, 36, 36,
37, 38, 45, 46, 38, 38, 39, 39, 38, 87,
88, 89, 83, 90, 91, 92, 93, 97, 40, 44,
- 94, 95, 40, 129, 96, 98, 129, 99, 100, 101,
+ 94, 95, 40, 130, 96, 98, 130, 99, 100, 101,
102, 103, 87, 88, 89, 104, 105, 90, 91, 92,
93, 97, 40, 94, 95, 106, 40, 96, 107, 98,
- 99, 100, 101, 102, 108, 103, 109, 114, 104, 105,
- 110, 81, 36, 36, 82, 111, 112, 113, 106, 115,
- 116, 117, 107, 82, 36, 36, 82, 118, 108, 119,
- 109, 114, 120, 110, 121, 122, 123, 124, 111, 112,
- 113, 125, 115, 116, 117, 126, 127, 129, 128, 132,
- 129, 118, 119, 131, 133, 120, 134, 121, 122, 135,
- 123, 124, 136, 137, 125, 138, 139, 141, 126, 140,
- 127, 128, 130, 132, 142, 143, 131, 144, 133, 146,
-
- 134, 147, 135, 148, 147, 149, 136, 137, 138, 150,
- 139, 141, 140, 151, 152, 130, 153, 154, 142, 143,
- 144, 155, 156, 146, 163, 156, 147, 148, 149, 147,
- 158, 159, 150, 160, 161, 164, 165, 151, 152, 153,
- 154, 166, 156, 167, 155, 156, 167, 157, 163, 167,
- 43, 42, 167, 158, 159, 169, 160, 161, 164, 165,
- 169, 169, 169, 169, 169, 166, 169, 169, 162, 169,
- 169, 157, 169, 169, 169, 169, 169, 169, 169, 169,
- 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
- 169, 162, 41, 41, 169, 41, 41, 41, 50, 50,
-
- 84, 84, 169, 169, 84, 84, 145, 169, 169, 169,
- 145, 168, 169, 169, 169, 168, 3, 169, 169, 169,
- 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
- 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
- 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
- 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
- 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
- 169, 169, 169, 169, 169, 169, 169
+ 99, 100, 101, 102, 108, 103, 109, 115, 104, 105,
+ 110, 43, 111, 81, 36, 36, 82, 112, 106, 113,
+ 114, 116, 107, 82, 36, 36, 82, 117, 108, 118,
+ 109, 115, 119, 124, 110, 111, 120, 121, 122, 123,
+ 112, 125, 113, 114, 116, 126, 127, 128, 130, 129,
+ 117, 130, 118, 132, 133, 134, 119, 124, 135, 120,
+ 121, 122, 123, 136, 138, 125, 137, 139, 126, 127,
+ 140, 128, 129, 131, 141, 143, 132, 133, 142, 134,
+
+ 144, 145, 135, 146, 148, 150, 153, 136, 138, 137,
+ 151, 139, 149, 140, 152, 149, 131, 154, 141, 143,
+ 155, 142, 156, 157, 144, 145, 146, 160, 148, 150,
+ 153, 158, 149, 151, 158, 149, 161, 152, 162, 163,
+ 165, 154, 166, 155, 158, 156, 157, 158, 167, 168,
+ 160, 169, 169, 159, 169, 169, 42, 171, 171, 161,
+ 171, 162, 163, 171, 165, 166, 171, 171, 171, 171,
+ 164, 167, 171, 168, 171, 171, 171, 159, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 171, 164, 41, 41, 171, 41, 41, 41,
+
+ 50, 50, 84, 84, 171, 171, 84, 84, 147, 171,
+ 171, 171, 147, 170, 171, 171, 171, 170, 3, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171
} ;
-static yyconst flex_int16_t yy_chk[478] =
+static yyconst flex_int16_t yy_chk[480] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -561,38 +562,38 @@ static yyconst flex_int16_t yy_chk[478] =
32, 32, 25, 35, 35, 35, 35, 37, 37, 37,
37, 38, 46, 46, 38, 39, 39, 39, 39, 52,
53, 54, 40, 55, 56, 57, 58, 64, 38, 12,
- 59, 62, 39, 129, 63, 65, 129, 66, 67, 68,
+ 59, 62, 39, 130, 63, 65, 130, 66, 67, 68,
69, 72, 52, 53, 54, 73, 74, 55, 56, 57,
58, 64, 38, 59, 62, 75, 39, 63, 76, 65,
66, 67, 68, 69, 77, 72, 79, 89, 73, 74,
- 80, 81, 81, 81, 81, 83, 87, 88, 75, 91,
- 92, 93, 76, 82, 82, 82, 82, 94, 77, 95,
- 79, 89, 96, 80, 97, 98, 99, 100, 83, 87,
- 88, 101, 91, 92, 93, 103, 105, 108, 107, 110,
- 108, 94, 95, 109, 111, 96, 112, 97, 98, 116,
- 99, 100, 117, 118, 101, 121, 122, 124, 103, 123,
- 105, 107, 108, 110, 126, 127, 109, 128, 111, 131,
-
- 112, 133, 116, 134, 133, 135, 117, 118, 121, 137,
- 122, 124, 123, 139, 140, 108, 142, 143, 126, 127,
- 128, 144, 145, 131, 157, 145, 147, 134, 135, 147,
- 148, 149, 137, 151, 153, 158, 161, 139, 140, 142,
- 143, 162, 156, 166, 144, 156, 166, 147, 157, 167,
- 11, 9, 167, 148, 149, 3, 151, 153, 158, 161,
- 168, 0, 0, 168, 0, 162, 0, 0, 156, 0,
- 0, 147, 0, 0, 0, 0, 0, 0, 0, 0,
+ 79, 11, 80, 81, 81, 81, 81, 83, 75, 87,
+ 88, 91, 76, 82, 82, 82, 82, 92, 77, 93,
+ 79, 89, 94, 99, 79, 80, 95, 96, 97, 98,
+ 83, 100, 87, 88, 91, 101, 103, 105, 108, 107,
+ 92, 108, 93, 109, 110, 111, 94, 99, 112, 95,
+ 96, 97, 98, 113, 118, 100, 117, 119, 101, 103,
+ 122, 105, 107, 108, 123, 125, 109, 110, 124, 111,
+
+ 127, 128, 112, 129, 133, 136, 141, 113, 118, 117,
+ 137, 119, 135, 122, 139, 135, 108, 142, 123, 125,
+ 144, 124, 145, 146, 127, 128, 129, 150, 133, 136,
+ 141, 147, 149, 137, 147, 149, 151, 139, 153, 155,
+ 159, 142, 160, 144, 158, 145, 146, 158, 163, 164,
+ 150, 168, 169, 149, 168, 169, 9, 170, 3, 151,
+ 170, 153, 155, 0, 159, 160, 0, 0, 0, 0,
+ 158, 163, 0, 164, 0, 0, 0, 149, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 156, 170, 170, 0, 170, 170, 170, 171, 171,
-
- 172, 172, 0, 0, 172, 172, 173, 0, 0, 0,
- 173, 174, 0, 0, 0, 174, 169, 169, 169, 169,
- 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
- 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
- 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
- 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
- 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
- 169, 169, 169, 169, 169, 169, 169
+ 0, 0, 0, 158, 172, 172, 0, 172, 172, 172,
+
+ 173, 173, 174, 174, 0, 0, 174, 174, 175, 0,
+ 0, 0, 175, 176, 0, 0, 0, 176, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ 171, 171, 171, 171, 171, 171, 171, 171, 171
} ;
static yy_state_type yy_last_accepting_state;
@@ -657,7 +658,7 @@ static void countnl() {
g_lingo->_colnumber = strlen(p);
}
-#line 661 "engines/director/lingo/lingo-lex.cpp"
+#line 662 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -845,7 +846,7 @@ YY_DECL
#line 60 "engines/director/lingo/lingo-lex.l"
-#line 849 "engines/director/lingo/lingo-lex.cpp"
+#line 850 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -899,13 +900,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 >= 170 )
+ if ( yy_current_state >= 172 )
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] != 417 );
+ while ( yy_base[yy_current_state] != 419 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -1176,31 +1177,36 @@ YY_RULE_SETUP
case 38:
YY_RULE_SETUP
#line 157 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWHILE; }
+{ count(); return tWHEN; }
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 159 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNEQ; }
+#line 158 "engines/director/lingo/lingo-lex.l"
+{ count(); return tWHILE; }
YY_BREAK
case 40:
YY_RULE_SETUP
#line 160 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGE; }
+{ count(); return tNEQ; }
YY_BREAK
case 41:
YY_RULE_SETUP
#line 161 "engines/director/lingo/lingo-lex.l"
-{ count(); return tLE; }
+{ count(); return tGE; }
YY_BREAK
case 42:
YY_RULE_SETUP
#line 162 "engines/director/lingo/lingo-lex.l"
-{ count(); return tCONCAT; }
+{ count(); return tLE; }
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 164 "engines/director/lingo/lingo-lex.l"
+#line 163 "engines/director/lingo/lingo-lex.l"
+{ count(); return tCONCAT; }
+ YY_BREAK
+case 44:
+YY_RULE_SETUP
+#line 165 "engines/director/lingo/lingo-lex.l"
{
count();
yylval.s = new Common::String(yytext);
@@ -1215,43 +1221,43 @@ YY_RULE_SETUP
return ID;
}
YY_BREAK
-case 44:
-YY_RULE_SETUP
-#line 177 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.f = atof(yytext); return FLOAT; }
- YY_BREAK
case 45:
YY_RULE_SETUP
#line 178 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ count(); yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 46:
YY_RULE_SETUP
#line 179 "engines/director/lingo/lingo-lex.l"
-{ count(); return *yytext; }
+{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 47:
-/* rule 47 can match eol */
YY_RULE_SETUP
#line 180 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ count(); return *yytext; }
YY_BREAK
case 48:
+/* rule 48 can match eol */
YY_RULE_SETUP
#line 181 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return '\n'; }
YY_BREAK
case 49:
YY_RULE_SETUP
#line 182 "engines/director/lingo/lingo-lex.l"
-
+{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 184 "engines/director/lingo/lingo-lex.l"
+#line 183 "engines/director/lingo/lingo-lex.l"
+
+ YY_BREAK
+case 51:
+YY_RULE_SETUP
+#line 185 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1255 "engines/director/lingo/lingo-lex.cpp"
+#line 1261 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1544,7 +1550,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 >= 170 )
+ if ( yy_current_state >= 172 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1572,11 +1578,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 >= 170 )
+ if ( yy_current_state >= 172 )
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 == 169);
+ yy_is_jam = (yy_current_state == 171);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2251,7 +2257,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 184 "engines/director/lingo/lingo-lex.l"
+#line 185 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 21110ce..f125a01 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -154,6 +154,7 @@ whitespace [\t ]
(?i:then) { count(); return tTHEN; }
(?i:to) { count(); return tTO; }
(?i:with) { count(); return tWITH; }
+(?i:when) { count(); return tWHEN; }
(?i:while) { count(); return tWHILE; }
[<][>] { count(); return tNEQ; }
diff --git a/engines/director/lingo/tests/factory.lingo b/engines/director/lingo/tests/factory.lingo
index cf1e142..5349b34 100644
--- a/engines/director/lingo/tests/factory.lingo
+++ b/engines/director/lingo/tests/factory.lingo
@@ -26,7 +26,7 @@ method mExit
method mDispose
global aim1
set aim1 = 1
--- when keydown then nothing
+ when keydown then nothing
--
factory fire2
method mNew
Commit: d53ff7b18018d70f5633da4552164bf5a78f5d5a
https://github.com/scummvm/scummvm/commit/d53ff7b18018d70f5633da4552164bf5a78f5d5a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Initial stub for 'intersects' operator
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 9dd8021..629b100 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -390,6 +390,15 @@ void Lingo::c_starts() {
g_lingo->push(d1);
}
+void Lingo::c_intersects() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ warning("STUB: c_intersects");
+
+ g_lingo->push(d1);
+}
+
void Lingo::c_and() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 1a4ac2d..e0d661f 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -119,7 +119,8 @@
tNOT = 308,
tCONCAT = 309,
tCONTAINS = 310,
- tSTARTS = 311
+ tSTARTS = 311,
+ tINTERSECTS = 312
};
#endif
/* Tokens. */
@@ -177,6 +178,7 @@
#define tCONCAT 309
#define tCONTAINS 310
#define tSTARTS 311
+#define tINTERSECTS 312
@@ -233,7 +235,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 237 "engines/director/lingo/lingo-gr.cpp"
+#line 239 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -246,7 +248,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 250 "engines/director/lingo/lingo-gr.cpp"
+#line 252 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -461,20 +463,20 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 77
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 682
+#define YYLAST 645
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 70
+#define YYNTOKENS 71
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 34
/* YYNRULES -- Number of rules. */
-#define YYNRULES 117
+#define YYNRULES 118
/* YYNRULES -- Number of states. */
-#define YYNSTATES 252
+#define YYNSTATES 254
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 311
+#define YYMAXUTOK 312
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -483,12 +485,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 63, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 64, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 62, 68, 2,
- 64, 65, 60, 58, 69, 59, 2, 61, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 63, 69, 2,
+ 65, 66, 61, 59, 70, 60, 2, 62, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 67, 57, 66, 2, 2, 2, 2, 2, 2, 2,
+ 68, 58, 67, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -513,7 +515,7 @@ static const yytype_uint8 yytranslate[] =
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56
+ 55, 56, 57
};
#if YYDEBUG
@@ -529,77 +531,77 @@ static const yytype_uint16 yyprhs[] =
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, 334, 337, 340, 342, 344, 347,
- 349, 353, 356, 359, 362, 365, 369, 372, 376, 379,
- 382, 384, 388, 391, 395, 396, 405, 408, 409, 418,
- 419, 421, 425, 430, 431, 435, 436, 438
+ 321, 325, 328, 331, 335, 338, 341, 344, 346, 348,
+ 351, 353, 357, 360, 363, 366, 369, 373, 376, 380,
+ 383, 386, 388, 392, 395, 399, 400, 409, 412, 413,
+ 422, 423, 425, 429, 434, 435, 439, 440, 442
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 71, 0, -1, 71, 72, 73, -1, 73, -1, 1,
- 63, -1, 63, -1, -1, 97, -1, 92, -1, 102,
- -1, 74, -1, 76, -1, 34, 91, 25, 13, -1,
- 36, 13, 57, 91, -1, 36, 8, 57, 91, -1,
- 36, 9, 91, 57, 91, -1, 36, 13, 38, 91,
- -1, 36, 8, 38, 91, -1, 36, 9, 91, 38,
- 91, -1, 91, -1, 92, -1, 75, -1, 77, -1,
- 84, 64, 83, 65, 90, 89, 19, 35, -1, 85,
- 57, 91, 89, 38, 91, 89, 90, 89, 19, 35,
- -1, 85, 57, 91, 89, 16, 38, 91, 89, 90,
- 89, 19, 35, -1, 39, 13, 37, 91, -1, 86,
- 83, 37, 72, 90, 89, 19, 24, -1, 86, 83,
- 37, 72, 90, 89, 42, 90, 89, 19, 24, -1,
- 86, 83, 37, 72, 90, 89, 88, 79, 89, 19,
- 24, -1, 86, 83, 37, 88, 75, 89, -1, 86,
- 83, 37, 88, 75, 89, 42, 88, 75, 89, -1,
- 86, 83, 37, 88, 75, 89, 80, 89, 78, 89,
- -1, -1, 42, 88, 75, -1, 79, 82, -1, 82,
- -1, 80, 81, -1, 81, -1, 87, 83, 37, 88,
- 76, 89, -1, 80, -1, 87, 83, 37, 90, 89,
- -1, 91, -1, 91, 57, 91, -1, 64, 83, 65,
+ 72, 0, -1, 72, 73, 74, -1, 74, -1, 1,
+ 64, -1, 64, -1, -1, 98, -1, 93, -1, 103,
+ -1, 75, -1, 77, -1, 34, 92, 25, 13, -1,
+ 36, 13, 58, 92, -1, 36, 8, 58, 92, -1,
+ 36, 9, 92, 58, 92, -1, 36, 13, 38, 92,
+ -1, 36, 8, 38, 92, -1, 36, 9, 92, 38,
+ 92, -1, 92, -1, 93, -1, 76, -1, 78, -1,
+ 85, 65, 84, 66, 91, 90, 19, 35, -1, 86,
+ 58, 92, 90, 38, 92, 90, 91, 90, 19, 35,
+ -1, 86, 58, 92, 90, 16, 38, 92, 90, 91,
+ 90, 19, 35, -1, 39, 13, 37, 92, -1, 87,
+ 84, 37, 73, 91, 90, 19, 24, -1, 87, 84,
+ 37, 73, 91, 90, 42, 91, 90, 19, 24, -1,
+ 87, 84, 37, 73, 91, 90, 89, 80, 90, 19,
+ 24, -1, 87, 84, 37, 89, 76, 90, -1, 87,
+ 84, 37, 89, 76, 90, 42, 89, 76, 90, -1,
+ 87, 84, 37, 89, 76, 90, 81, 90, 79, 90,
+ -1, -1, 42, 89, 76, -1, 80, 83, -1, 83,
+ -1, 81, 82, -1, 82, -1, 88, 84, 37, 89,
+ 77, 90, -1, 81, -1, 88, 84, 37, 91, 90,
+ -1, 92, -1, 92, 58, 92, -1, 65, 84, 66,
-1, 35, 41, -1, 35, 40, 13, -1, 24, -1,
- 18, -1, -1, -1, -1, 90, 72, -1, 90, 76,
- -1, 7, -1, 10, -1, 14, -1, 11, 64, 103,
- 65, -1, 12, -1, 13, 64, 103, 65, -1, 13,
- -1, 8, -1, 9, 91, -1, 74, -1, 91, 58,
- 91, -1, 91, 59, 91, -1, 91, 60, 91, -1,
- 91, 61, 91, -1, 91, 66, 91, -1, 91, 67,
- 91, -1, 91, 50, 91, -1, 91, 45, 91, -1,
- 91, 46, 91, -1, 91, 51, 91, -1, 91, 52,
- 91, -1, 53, 91, -1, 91, 68, 91, -1, 91,
- 54, 91, -1, 91, 55, 91, -1, 91, 56, 91,
- -1, 58, 91, -1, 59, 91, -1, 64, 91, 65,
- -1, 28, 14, -1, 29, 13, -1, 34, 91, -1,
- 94, -1, 20, -1, 22, 93, -1, 13, -1, 93,
- 69, 13, -1, 23, 26, -1, 23, 31, -1, 23,
- 33, -1, 23, 95, -1, 23, 95, 96, -1, 23,
- 96, -1, 38, 21, 14, -1, 21, 14, -1, 38,
- 14, -1, 14, -1, 32, 30, 14, -1, 30, 14,
- -1, 38, 30, 14, -1, -1, 27, 13, 98, 88,
- 100, 72, 101, 90, -1, 43, 13, -1, -1, 44,
- 13, 99, 88, 100, 72, 101, 90, -1, -1, 13,
- -1, 100, 69, 13, -1, 100, 72, 69, 13, -1,
- -1, 13, 88, 103, -1, -1, 91, -1, 103, 69,
- 91, -1
+ 18, -1, -1, -1, -1, 91, 73, -1, 91, 77,
+ -1, 7, -1, 10, -1, 14, -1, 11, 65, 104,
+ 66, -1, 12, -1, 13, 65, 104, 66, -1, 13,
+ -1, 8, -1, 9, 92, -1, 75, -1, 92, 59,
+ 92, -1, 92, 60, 92, -1, 92, 61, 92, -1,
+ 92, 62, 92, -1, 92, 67, 92, -1, 92, 68,
+ 92, -1, 92, 50, 92, -1, 92, 45, 92, -1,
+ 92, 46, 92, -1, 92, 51, 92, -1, 92, 52,
+ 92, -1, 53, 92, -1, 92, 69, 92, -1, 92,
+ 54, 92, -1, 92, 55, 92, -1, 92, 56, 92,
+ -1, 92, 57, 92, -1, 59, 92, -1, 60, 92,
+ -1, 65, 92, 66, -1, 28, 14, -1, 29, 13,
+ -1, 34, 92, -1, 95, -1, 20, -1, 22, 94,
+ -1, 13, -1, 94, 70, 13, -1, 23, 26, -1,
+ 23, 31, -1, 23, 33, -1, 23, 96, -1, 23,
+ 96, 97, -1, 23, 97, -1, 38, 21, 14, -1,
+ 21, 14, -1, 38, 14, -1, 14, -1, 32, 30,
+ 14, -1, 30, 14, -1, 38, 30, 14, -1, -1,
+ 27, 13, 99, 89, 101, 73, 102, 91, -1, 43,
+ 13, -1, -1, 44, 13, 100, 89, 101, 73, 102,
+ 91, -1, -1, 13, -1, 101, 70, 13, -1, 101,
+ 73, 70, 13, -1, -1, 13, 89, 104, -1, -1,
+ 92, -1, 104, 70, 92, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 100, 100, 101, 102, 105, 110, 111, 112, 113,
- 114, 115, 118, 124, 130, 138, 146, 152, 160, 169,
- 170, 172, 173, 178, 189, 205, 217, 222, 229, 238,
- 247, 257, 267, 278, 279, 282, 283, 286, 287, 290,
- 298, 299, 307, 308, 309, 311, 313, 319, 325, 332,
- 334, 336, 337, 338, 341, 346, 349, 352, 358, 361,
- 369, 372, 379, 385, 386, 387, 388, 389, 390, 391,
- 392, 393, 394, 395, 396, 397, 398, 399, 400, 401,
- 402, 403, 404, 407, 408, 409, 410, 411, 413, 416,
- 417, 428, 429, 430, 431, 436, 442, 449, 450, 451,
- 452, 455, 456, 457, 485, 485, 491, 494, 494, 500,
- 501, 502, 503, 505, 509, 517, 518, 519
+ 0, 102, 102, 103, 104, 107, 112, 113, 114, 115,
+ 116, 117, 120, 126, 132, 140, 148, 154, 162, 171,
+ 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, 410, 411, 412, 413, 414, 416,
+ 419, 420, 431, 432, 433, 434, 439, 445, 452, 453,
+ 454, 455, 458, 459, 460, 488, 488, 494, 497, 497,
+ 503, 504, 505, 506, 508, 512, 520, 521, 522
};
#endif
@@ -615,14 +617,14 @@ static const char *const yytname[] =
"tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT",
"tSET", "tTHEN", "tTO", "tWHEN", "tWITH", "tWHILE", "tNLELSE",
"tFACTORY", "tMETHOD", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "tAND",
- "tOR", "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS", "'='", "'+'", "'-'",
- "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','",
- "$accept", "program", "nl", "programline", "asgn", "stmtoneliner",
- "stmt", "ifstmt", "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
- "elseifstmtoneliner1", "elseifstmt1", "cond", "repeatwhile",
- "repeatwith", "if", "elseif", "begin", "end", "stmtlist", "expr", "func",
- "globallist", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "@2",
- "argdef", "argstore", "macro", "arglist", 0
+ "tOR", "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS", "tINTERSECTS", "'='",
+ "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'",
+ "'&'", "','", "$accept", "program", "nl", "programline", "asgn",
+ "stmtoneliner", "stmt", "ifstmt", "elsestmtoneliner", "elseifstmt",
+ "elseifstmtoneliner", "elseifstmtoneliner1", "elseifstmt1", "cond",
+ "repeatwhile", "repeatwith", "if", "elseif", "begin", "end", "stmtlist",
+ "expr", "func", "globallist", "gotofunc", "gotoframe", "gotomovie",
+ "defn", "@1", "@2", "argdef", "argstore", "macro", "arglist", 0
};
#endif
@@ -636,26 +638,27 @@ static const yytype_uint16 yytoknum[] =
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 308, 309, 310, 311, 61, 43, 45,
- 42, 47, 37, 10, 40, 41, 62, 60, 38, 44
+ 305, 306, 307, 308, 309, 310, 311, 312, 61, 43,
+ 45, 42, 47, 37, 10, 40, 41, 62, 60, 38,
+ 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 70, 71, 71, 71, 72, 73, 73, 73, 73,
- 73, 73, 74, 74, 74, 74, 74, 74, 74, 75,
- 75, 76, 76, 76, 76, 76, 76, 77, 77, 77,
- 77, 77, 77, 78, 78, 79, 79, 80, 80, 81,
- 82, 82, 83, 83, 83, 84, 85, 86, 87, 88,
- 89, 90, 90, 90, 91, 91, 91, 91, 91, 91,
- 91, 91, 91, 91, 91, 91, 91, 91, 91, 91,
- 91, 91, 91, 91, 91, 91, 91, 91, 91, 91,
- 91, 91, 91, 92, 92, 92, 92, 92, 92, 93,
- 93, 94, 94, 94, 94, 94, 94, 95, 95, 95,
- 95, 96, 96, 96, 98, 97, 97, 99, 97, 100,
- 100, 100, 100, 101, 102, 103, 103, 103
+ 0, 71, 72, 72, 72, 73, 74, 74, 74, 74,
+ 74, 74, 75, 75, 75, 75, 75, 75, 75, 76,
+ 76, 77, 77, 77, 77, 77, 77, 78, 78, 78,
+ 78, 78, 78, 79, 79, 80, 80, 81, 81, 82,
+ 83, 83, 84, 84, 84, 85, 86, 87, 88, 89,
+ 90, 91, 91, 91, 92, 92, 92, 92, 92, 92,
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
+ 92, 92, 92, 92, 93, 93, 93, 93, 93, 93,
+ 94, 94, 95, 95, 95, 95, 95, 95, 96, 96,
+ 96, 96, 97, 97, 97, 99, 98, 98, 100, 98,
+ 101, 101, 101, 101, 102, 103, 104, 104, 104
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -669,10 +672,10 @@ static const yytype_uint8 yyr2[] =
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, 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
+ 3, 2, 2, 3, 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
@@ -681,82 +684,82 @@ static const yytype_uint8 yyr2[] =
static const yytype_uint8 yydefact[] =
{
0, 0, 54, 61, 0, 55, 0, 58, 49, 56,
- 87, 0, 0, 47, 0, 0, 0, 0, 0, 0,
+ 88, 0, 0, 47, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 3, 63,
- 21, 11, 22, 0, 0, 0, 19, 8, 86, 7,
- 9, 4, 60, 0, 63, 62, 115, 115, 115, 89,
- 88, 100, 0, 91, 0, 92, 0, 93, 0, 94,
- 96, 104, 83, 84, 85, 0, 45, 0, 0, 0,
- 0, 106, 107, 75, 80, 81, 0, 1, 5, 6,
+ 21, 11, 22, 0, 0, 0, 19, 8, 87, 7,
+ 9, 4, 60, 0, 63, 62, 116, 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, 75, 81, 82, 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, 116, 0, 0, 114, 0, 98, 102, 0, 99,
- 0, 0, 0, 95, 49, 0, 46, 0, 0, 0,
- 0, 0, 0, 49, 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,
- 90, 101, 97, 103, 109, 12, 17, 14, 0, 0,
- 16, 13, 26, 109, 51, 0, 44, 51, 0, 43,
- 117, 110, 0, 18, 15, 0, 50, 0, 0, 50,
- 50, 20, 0, 113, 113, 52, 53, 0, 0, 50,
- 49, 30, 111, 0, 51, 51, 0, 50, 51, 0,
- 51, 0, 48, 49, 50, 38, 0, 112, 105, 108,
- 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, 0, 117, 0, 0, 115, 0, 99, 103, 0,
+ 100, 0, 0, 0, 96, 49, 0, 46, 0, 0,
+ 0, 0, 0, 0, 49, 83, 2, 0, 50, 0,
+ 0, 49, 0, 71, 72, 70, 73, 74, 77, 78,
+ 79, 80, 64, 65, 66, 67, 68, 69, 76, 57,
+ 0, 59, 91, 102, 98, 104, 110, 12, 17, 14,
+ 0, 0, 16, 13, 26, 110, 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, 27, 185, 28, 44, 30, 186, 32, 231, 215,
- 216, 205, 217, 83, 33, 34, 35, 206, 241, 165,
- 176, 36, 181, 50, 38, 59, 60, 39, 114, 123,
- 172, 194, 40, 102
+ -1, 27, 187, 28, 44, 30, 188, 32, 233, 217,
+ 218, 207, 219, 83, 33, 34, 35, 208, 243, 167,
+ 178, 36, 183, 50, 38, 59, 60, 39, 115, 124,
+ 174, 196, 40, 103
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -185
+#define YYPACT_NINF -198
static const yytype_int16 yypact[] =
{
- 204, -39, -185, -185, 443, -185, -29, -185, 590, -185,
- -185, 29, 128, -185, 32, 52, 68, 443, 19, 101,
- 70, 93, 98, 443, 443, 443, 443, 6, -185, 15,
- -185, -185, -185, 51, 60, 474, 571, -185, -185, -185,
- -185, -185, 54, 443, -185, 571, 443, 443, 443, -185,
- 50, -185, 106, -185, 113, -185, 100, -185, 23, 24,
- -185, -185, -185, -185, 119, 115, -185, -31, 443, -16,
- 94, -185, -185, 614, 614, 614, 528, -185, -185, 262,
- 474, 443, 474, 95, 552, 443, 443, 443, 443, 443,
- 443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
- 119, 571, 8, 43, 64, 121, -185, -185, 122, -185,
- 123, 124, 109, -185, -185, 127, -185, 443, 443, 485,
- 443, 443, 443, -185, -185, -185, 78, 571, 80, 504,
- 83, 443, 571, 571, 571, 571, 571, 571, 571, 571,
- 257, 257, 614, 614, 571, 571, 571, -185, 443, -185,
- -185, -185, -185, -185, 135, -185, 571, 571, 443, 443,
- 571, 571, 571, 135, -185, 2, -185, -185, 412, 571,
- 571, -185, -5, 571, 571, -5, 320, 117, 443, 320,
- -185, -185, 138, 84, 84, -185, -185, 137, 443, 571,
- -8, -6, -185, 144, -185, -185, 132, 571, -185, 148,
- -185, 150, -185, -185, 150, -185, 474, -185, 320, 320,
- -185, -185, 320, -185, 320, 150, 150, -185, 474, 412,
- -185, 134, 147, 320, 162, 169, -185, 170, 153, -185,
- -185, -185, -185, 172, 158, 171, 173, -2, -185, 412,
- -185, 378, 159, -185, -185, -185, 320, -185, -185, -185,
- -185, -185
+ 206, -57, -198, -198, 422, -198, -30, -198, 531, -198,
+ -198, 45, 107, -198, 47, 23, 51, 422, 37, 60,
+ 53, 54, 96, 422, 422, 422, 422, 17, -198, 19,
+ -198, -198, -198, 55, 61, 430, 511, -198, -198, -198,
+ -198, -198, 64, 422, -198, 511, 422, 422, 422, -198,
+ 42, -198, 104, -198, 116, -198, 102, -198, 11, 24,
+ -198, -198, -198, -198, 121, 122, -198, -16, 422, -14,
+ 97, -198, -198, 576, 576, 576, 260, -198, -198, 265,
+ 430, 422, 430, 105, 491, 422, 422, 422, 422, 422,
+ 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
+ 422, 121, 511, 41, 44, 71, 131, -198, -198, 133,
+ -198, 134, 136, 123, -198, -198, 138, -198, 422, 422,
+ 446, 422, 422, 422, -198, -198, -198, 89, 511, 90,
+ 466, 93, 422, 511, 511, 511, 511, 511, 511, 511,
+ 511, 141, 556, 556, 576, 576, 511, 511, 511, -198,
+ 422, -198, -198, -198, -198, -198, 145, -198, 511, 511,
+ 422, 422, 511, 511, 511, 145, -198, 2, -198, -198,
+ 392, 511, 511, -198, -11, 511, 511, -11, 324, 124,
+ 422, 324, -198, -198, 146, 91, 91, -198, -198, 144,
+ 422, 511, -8, -6, -198, 147, -198, -198, 135, 511,
+ -198, 150, -198, 151, -198, -198, 151, -198, 430, -198,
+ 324, 324, -198, -198, 324, -198, 324, 151, 151, -198,
+ 430, 392, -198, 126, 142, 324, 180, 185, -198, 186,
+ 174, -198, -198, -198, -198, 202, 187, 199, 203, -3,
+ -198, 392, -198, 358, 196, -198, -198, -198, 324, -198,
+ -198, -198, -198, -198
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -185, -185, -25, 120, 9, -164, 0, -185, -185, -185,
- 7, -184, -15, -77, -185, -185, -185, -182, -7, -166,
- -124, 4, 25, -185, -185, -185, 142, -185, -185, -185,
- 39, 22, -185, 20
+ -198, -198, -25, 153, 9, -166, 0, -198, -198, -198,
+ 43, -173, 20, -77, -198, -198, -198, -197, -7, -168,
+ -126, 4, 26, -198, -198, -198, 179, -198, -198, -198,
+ 74, 58, -198, 68
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -766,148 +769,140 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -61
static const yytype_int16 yytable[] =
{
- 31, 48, 79, 126, 180, 128, 77, 117, 45, 29,
- 187, 199, 202, 190, 191, -10, -51, -51, 177, 218,
- 220, 64, 120, 198, 41, 37, 118, 73, 74, 75,
- 76, 211, 220, 218, 200, 46, 203, 109, 221, 84,
- 178, 121, 49, 179, 110, 61, 224, 100, 225, 227,
- 101, 101, 101, 111, 54, 229, 56, 233, 78, 65,
- 66, -51, 112, 238, 182, 240, 62, 103, 104, 78,
- 208, 209, 119, 147, 212, 247, 214, 148, -10, 31,
- 250, 63, 251, 70, 84, 127, 129, 223, 29, 132,
- 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
- 143, 144, 145, 146, 37, 167, 71, 154, 149, 67,
- 68, 72, 148, 246, 69, 80, 163, 81, 47, 105,
- 106, 156, 157, 168, 160, 161, 162, 107, 116, 222,
- 108, 122, 130, 148, 150, 169, 151, 152, 153, 111,
- 155, 228, 51, 164, 115, 166, 78, 183, 171, 52,
- 184, 192, 170, 193, 53, 188, 196, 207, 54, 55,
- 56, 57, 173, 174, 85, 86, 58, 210, 202, 87,
- 88, 89, 213, 90, 91, 92, 230, 93, 94, 95,
- 96, 234, 189, 201, 232, 97, 98, 99, 235, 236,
- 237, 242, 197, 243, 249, 244, 219, 245, 204, 125,
- 226, 113, 175, 0, -6, 1, 195, 0, 0, 0,
- 84, 2, 3, 4, 5, 6, 7, 8, 9, 0,
- 0, 0, 84, 239, 10, 0, 11, 12, 13, 0,
- 0, 14, 15, 16, 0, 0, 0, 0, 17, 18,
- 19, 248, 0, 20, 0, 0, 0, 21, 22, 0,
- 0, 0, 0, 0, 0, 0, 0, 23, 0, 0,
- 0, 0, 24, 25, 0, 0, 0, -6, 26, 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, 85, 86, 0, 21, 22, 87, 88, 89,
- 0, 90, 91, 92, 0, 23, 0, 95, 96, 0,
- 24, 25, 0, 97, 98, 99, 26, 2, 3, 4,
- 5, 6, 7, 42, 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, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 23, 0, 0, 0, 0, 24, 25,
- 0, 0, 0, 78, 26, 2, 3, 4, 5, 6,
- 7, 42, 9, 0, 0, 0, 0, 0, 10, 0,
- 11, 12, 13, 0, 0, 0, 15, 16, 0, 0,
+ 31, 48, 79, 127, 182, 129, 220, 41, 45, 29,
+ 189, 201, 204, 192, 193, -51, -51, 77, 179, -10,
+ 220, 64, 118, 200, 121, 110, 37, 73, 74, 75,
+ 76, 213, 111, 222, 202, 46, 205, 62, 223, 84,
+ 180, 112, 119, 181, 122, 222, 226, 101, 227, 229,
+ 102, 102, 102, 78, 54, 231, 56, 235, 49, 184,
+ 61, -51, 113, 240, 63, 242, 70, 71, 67, 68,
+ 210, 211, 120, 69, 214, 249, 216, 65, 66, 31,
+ 252, 78, 253, -10, 84, 128, 130, 225, 29, 133,
+ 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
+ 144, 145, 146, 147, 148, 37, 169, 149, 156, 72,
+ 151, 150, 106, 248, 150, 104, 105, 165, 107, 81,
+ 80, 51, 158, 159, 170, 162, 163, 164, 52, 47,
+ 108, 224, 109, 53, 123, 117, 171, 54, 55, 56,
+ 57, 150, 131, 230, 152, 58, 116, 153, 154, 185,
+ 155, 157, 186, 112, 172, 166, 168, 78, 173, 194,
+ 209, 195, 190, 198, 175, 176, 85, 86, 232, 204,
+ 212, 87, 88, 89, 215, 90, 91, 92, 93, 234,
+ 94, 95, 96, 97, 191, 203, 85, 86, 98, 99,
+ 100, 87, 88, 89, 199, 90, 91, 92, 221, 236,
+ 94, 95, 96, 97, 237, 238, -6, 1, 98, 99,
+ 100, 239, 84, 2, 3, 4, 5, 6, 7, 8,
+ 9, 244, 245, 246, 84, 241, 10, 247, 11, 12,
+ 13, 251, 126, 14, 15, 16, 206, 228, 114, 177,
+ 17, 18, 19, 250, 197, 20, 0, 0, 0, 21,
+ 22, 0, 0, 0, 0, 0, 0, 0, 0, 23,
+ 0, 0, 0, 0, 0, 24, 25, 0, 0, 0,
+ -6, 26, 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, 85, 86, 0, 21, 22,
+ 87, 88, 89, 0, 90, 91, 92, 93, 23, 94,
+ 95, 96, 97, 0, 24, 25, 125, 98, 99, 100,
+ 26, 2, 3, 4, 5, 6, 7, 42, 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, 2, 3, 4, 5, 6,
+ 7, 42, 9, 0, 0, 0, 0, 23, 10, 0,
+ 11, 12, 13, 24, 25, 0, 15, 16, 78, 26,
0, 0, 17, 18, 19, 0, 0, 20, 0, 2,
3, 4, 5, 6, 7, 42, 9, 0, 0, 0,
- 0, 23, 10, 0, 11, 12, 24, 25, 0, 0,
- 15, 16, 26, 0, 0, 0, 17, 0, 19, 0,
- 2, 3, 4, 5, 6, 7, 42, 9, 0, 0,
+ 0, 23, 10, 0, 11, 12, 0, 24, 25, 0,
+ 15, 16, 0, 26, 0, 0, 17, 0, 19, 2,
+ 3, 4, 5, 6, 7, 42, 9, 2, 3, 4,
+ 5, 6, 7, 42, 9, 23, 0, 0, 0, 0,
+ 0, 24, 25, 0, 0, 0, 43, 26, 19, 0,
+ 0, 0, 0, 0, 43, 0, 19, 0, 0, 0,
0, 0, 0, 0, 0, 23, 0, 0, 0, 0,
- 24, 25, 0, 0, 0, 0, 26, 43, 0, 19,
- 0, 2, 3, 4, 5, 6, 7, 42, 9, 0,
- 0, 0, 0, 0, 0, 0, 23, 0, 0, 0,
- 0, 24, 25, 0, 0, 0, 0, 26, 43, 0,
- 19, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 158, 0, 0, 0, 23, 0, 0,
- 85, 86, 24, 25, 0, 87, 88, 89, 82, 90,
- 91, 92, 159, 93, 94, 95, 96, 0, 0, 85,
- 86, 97, 98, 99, 87, 88, 89, 0, 90, 91,
- 92, 131, 93, 94, 95, 96, 0, 0, 0, 124,
- 97, 98, 99, 85, 86, 0, 0, 0, 87, 88,
- 89, 0, 90, 91, 92, 0, 93, 94, 95, 96,
- 0, 0, 0, 124, 97, 98, 99, 85, 86, 0,
- 0, 0, 87, 88, 89, 0, 90, 91, 92, 131,
- 93, 94, 95, 96, 0, 0, 85, 86, 97, 98,
- 99, 87, 88, 89, 0, 90, 91, 92, 0, 93,
- 94, 95, 96, 0, 0, -60, -60, 97, 98, 99,
- -60, -60, -60, 0, -60, -60, -60, 0, 0, 0,
- -60, -60, 0, 0, 47, 0, -60, -60, -60, 85,
- 86, 0, 0, 0, 87, 88, 89, 0, 90, 91,
- 92, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 97, 98, 99
+ 0, 24, 25, 23, 160, 0, 0, 26, 0, 24,
+ 25, 85, 86, 0, 0, 82, 87, 88, 89, 0,
+ 90, 91, 92, 93, 161, 94, 95, 96, 97, 0,
+ 0, 85, 86, 98, 99, 100, 87, 88, 89, 0,
+ 90, 91, 92, 93, 132, 94, 95, 96, 97, 0,
+ 0, 0, 125, 98, 99, 100, 85, 86, 0, 0,
+ 0, 87, 88, 89, 0, 90, 91, 92, 93, 132,
+ 94, 95, 96, 97, 0, 0, 85, 86, 98, 99,
+ 100, 87, 88, 89, 0, 90, 91, 92, 93, 0,
+ 94, 95, 96, 97, 0, 0, -60, -60, 98, 99,
+ 100, -60, -60, -60, 0, -60, -60, -60, -60, 0,
+ 0, 0, -60, -60, 0, 0, 47, 0, -60, -60,
+ -60, 85, 86, 0, 0, 0, 87, 88, 89, 0,
+ 90, 91, 92, 0, 0, 0, 0, 96, 97, 0,
+ 0, 85, 86, 98, 99, 100, 87, 88, 89, 0,
+ 90, 91, 92, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 98, 99, 100
};
static const yytype_int16 yycheck[] =
{
- 0, 8, 27, 80, 168, 82, 0, 38, 4, 0,
- 176, 19, 18, 179, 180, 0, 18, 19, 16, 201,
- 204, 17, 38, 189, 63, 0, 57, 23, 24, 25,
- 26, 197, 216, 215, 42, 64, 42, 14, 204, 35,
- 38, 57, 13, 167, 21, 13, 212, 43, 214, 215,
- 46, 47, 48, 30, 30, 219, 32, 223, 63, 40,
- 41, 63, 38, 229, 69, 231, 14, 47, 48, 63,
- 194, 195, 68, 65, 198, 239, 200, 69, 63, 79,
- 246, 13, 248, 13, 80, 81, 82, 211, 79, 85,
+ 0, 8, 27, 80, 170, 82, 203, 64, 4, 0,
+ 178, 19, 18, 181, 182, 18, 19, 0, 16, 0,
+ 217, 17, 38, 191, 38, 14, 0, 23, 24, 25,
+ 26, 199, 21, 206, 42, 65, 42, 14, 206, 35,
+ 38, 30, 58, 169, 58, 218, 214, 43, 216, 217,
+ 46, 47, 48, 64, 30, 221, 32, 225, 13, 70,
+ 13, 64, 38, 231, 13, 233, 13, 13, 8, 9,
+ 196, 197, 68, 13, 200, 241, 202, 40, 41, 79,
+ 248, 64, 250, 64, 80, 81, 82, 213, 79, 85,
86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 79, 130, 13, 114, 65, 8,
- 9, 13, 69, 237, 13, 64, 123, 57, 64, 69,
- 14, 117, 118, 130, 120, 121, 122, 14, 13, 206,
- 30, 37, 37, 69, 13, 131, 14, 14, 14, 30,
- 13, 218, 14, 65, 25, 65, 63, 172, 13, 21,
- 175, 13, 148, 69, 26, 38, 19, 13, 30, 31,
- 32, 33, 158, 159, 45, 46, 38, 35, 18, 50,
- 51, 52, 24, 54, 55, 56, 42, 58, 59, 60,
- 61, 19, 178, 190, 37, 66, 67, 68, 19, 19,
- 37, 19, 188, 35, 35, 24, 203, 24, 191, 79,
- 215, 59, 163, -1, 0, 1, 184, -1, -1, -1,
- 206, 7, 8, 9, 10, 11, 12, 13, 14, -1,
- -1, -1, 218, 230, 20, -1, 22, 23, 24, -1,
- -1, 27, 28, 29, -1, -1, -1, -1, 34, 35,
- 36, 241, -1, 39, -1, -1, -1, 43, 44, -1,
- -1, -1, -1, -1, -1, -1, -1, 53, -1, -1,
- -1, -1, 58, 59, -1, -1, -1, 63, 64, 7,
- 8, 9, 10, 11, 12, 13, 14, -1, -1, -1,
- -1, -1, 20, -1, 22, 23, 24, -1, -1, 27,
- 28, 29, -1, -1, -1, -1, 34, 35, 36, -1,
- -1, 39, 45, 46, -1, 43, 44, 50, 51, 52,
- -1, 54, 55, 56, -1, 53, -1, 60, 61, -1,
- 58, 59, -1, 66, 67, 68, 64, 7, 8, 9,
- 10, 11, 12, 13, 14, -1, -1, -1, -1, -1,
- 20, -1, 22, 23, 24, -1, -1, -1, 28, 29,
- -1, -1, -1, -1, 34, 35, 36, -1, -1, 39,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 53, -1, -1, -1, -1, 58, 59,
- -1, -1, -1, 63, 64, 7, 8, 9, 10, 11,
- 12, 13, 14, -1, -1, -1, -1, -1, 20, -1,
- 22, 23, 24, -1, -1, -1, 28, 29, -1, -1,
+ 96, 97, 98, 99, 100, 79, 131, 66, 115, 13,
+ 66, 70, 70, 239, 70, 47, 48, 124, 14, 58,
+ 65, 14, 118, 119, 131, 121, 122, 123, 21, 65,
+ 14, 208, 30, 26, 37, 13, 132, 30, 31, 32,
+ 33, 70, 37, 220, 13, 38, 25, 14, 14, 174,
+ 14, 13, 177, 30, 150, 66, 66, 64, 13, 13,
+ 13, 70, 38, 19, 160, 161, 45, 46, 42, 18,
+ 35, 50, 51, 52, 24, 54, 55, 56, 57, 37,
+ 59, 60, 61, 62, 180, 192, 45, 46, 67, 68,
+ 69, 50, 51, 52, 190, 54, 55, 56, 205, 19,
+ 59, 60, 61, 62, 19, 19, 0, 1, 67, 68,
+ 69, 37, 208, 7, 8, 9, 10, 11, 12, 13,
+ 14, 19, 35, 24, 220, 232, 20, 24, 22, 23,
+ 24, 35, 79, 27, 28, 29, 193, 217, 59, 165,
+ 34, 35, 36, 243, 186, 39, -1, -1, -1, 43,
+ 44, -1, -1, -1, -1, -1, -1, -1, -1, 53,
+ -1, -1, -1, -1, -1, 59, 60, -1, -1, -1,
+ 64, 65, 7, 8, 9, 10, 11, 12, 13, 14,
+ -1, -1, -1, -1, -1, 20, -1, 22, 23, 24,
+ -1, -1, 27, 28, 29, -1, -1, -1, -1, 34,
+ 35, 36, -1, -1, 39, 45, 46, -1, 43, 44,
+ 50, 51, 52, -1, 54, 55, 56, 57, 53, 59,
+ 60, 61, 62, -1, 59, 60, 66, 67, 68, 69,
+ 65, 7, 8, 9, 10, 11, 12, 13, 14, -1,
+ -1, -1, -1, -1, 20, -1, 22, 23, 24, -1,
+ -1, -1, 28, 29, -1, -1, -1, -1, 34, 35,
+ 36, -1, -1, 39, -1, 7, 8, 9, 10, 11,
+ 12, 13, 14, -1, -1, -1, -1, 53, 20, -1,
+ 22, 23, 24, 59, 60, -1, 28, 29, 64, 65,
-1, -1, 34, 35, 36, -1, -1, 39, -1, 7,
8, 9, 10, 11, 12, 13, 14, -1, -1, -1,
- -1, 53, 20, -1, 22, 23, 58, 59, -1, -1,
- 28, 29, 64, -1, -1, -1, 34, -1, 36, -1,
- 7, 8, 9, 10, 11, 12, 13, 14, -1, -1,
+ -1, 53, 20, -1, 22, 23, -1, 59, 60, -1,
+ 28, 29, -1, 65, -1, -1, 34, -1, 36, 7,
+ 8, 9, 10, 11, 12, 13, 14, 7, 8, 9,
+ 10, 11, 12, 13, 14, 53, -1, -1, -1, -1,
+ -1, 59, 60, -1, -1, -1, 34, 65, 36, -1,
+ -1, -1, -1, -1, 34, -1, 36, -1, -1, -1,
-1, -1, -1, -1, -1, 53, -1, -1, -1, -1,
- 58, 59, -1, -1, -1, -1, 64, 34, -1, 36,
- -1, 7, 8, 9, 10, 11, 12, 13, 14, -1,
- -1, -1, -1, -1, -1, -1, 53, -1, -1, -1,
- -1, 58, 59, -1, -1, -1, -1, 64, 34, -1,
- 36, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 38, -1, -1, -1, 53, -1, -1,
- 45, 46, 58, 59, -1, 50, 51, 52, 64, 54,
- 55, 56, 57, 58, 59, 60, 61, -1, -1, 45,
- 46, 66, 67, 68, 50, 51, 52, -1, 54, 55,
- 56, 57, 58, 59, 60, 61, -1, -1, -1, 65,
- 66, 67, 68, 45, 46, -1, -1, -1, 50, 51,
- 52, -1, 54, 55, 56, -1, 58, 59, 60, 61,
- -1, -1, -1, 65, 66, 67, 68, 45, 46, -1,
- -1, -1, 50, 51, 52, -1, 54, 55, 56, 57,
- 58, 59, 60, 61, -1, -1, 45, 46, 66, 67,
- 68, 50, 51, 52, -1, 54, 55, 56, -1, 58,
- 59, 60, 61, -1, -1, 45, 46, 66, 67, 68,
- 50, 51, 52, -1, 54, 55, 56, -1, -1, -1,
- 60, 61, -1, -1, 64, -1, 66, 67, 68, 45,
- 46, -1, -1, -1, 50, 51, 52, -1, 54, 55,
- 56, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 66, 67, 68
+ -1, 59, 60, 53, 38, -1, -1, 65, -1, 59,
+ 60, 45, 46, -1, -1, 65, 50, 51, 52, -1,
+ 54, 55, 56, 57, 58, 59, 60, 61, 62, -1,
+ -1, 45, 46, 67, 68, 69, 50, 51, 52, -1,
+ 54, 55, 56, 57, 58, 59, 60, 61, 62, -1,
+ -1, -1, 66, 67, 68, 69, 45, 46, -1, -1,
+ -1, 50, 51, 52, -1, 54, 55, 56, 57, 58,
+ 59, 60, 61, 62, -1, -1, 45, 46, 67, 68,
+ 69, 50, 51, 52, -1, 54, 55, 56, 57, -1,
+ 59, 60, 61, 62, -1, -1, 45, 46, 67, 68,
+ 69, 50, 51, 52, -1, 54, 55, 56, 57, -1,
+ -1, -1, 61, 62, -1, -1, 65, -1, 67, 68,
+ 69, 45, 46, -1, -1, -1, 50, 51, 52, -1,
+ 54, 55, 56, -1, -1, -1, -1, 61, 62, -1,
+ -1, 45, 46, 67, 68, 69, 50, 51, 52, -1,
+ 54, 55, 56, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 67, 68, 69
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -916,30 +911,30 @@ static const yytype_uint8 yystos[] =
{
0, 1, 7, 8, 9, 10, 11, 12, 13, 14,
20, 22, 23, 24, 27, 28, 29, 34, 35, 36,
- 39, 43, 44, 53, 58, 59, 64, 71, 73, 74,
- 75, 76, 77, 84, 85, 86, 91, 92, 94, 97,
- 102, 63, 13, 34, 74, 91, 64, 64, 88, 13,
- 93, 14, 21, 26, 30, 31, 32, 33, 38, 95,
- 96, 13, 14, 13, 91, 40, 41, 8, 9, 13,
- 13, 13, 13, 91, 91, 91, 91, 0, 63, 72,
- 64, 57, 64, 83, 91, 45, 46, 50, 51, 52,
- 54, 55, 56, 58, 59, 60, 61, 66, 67, 68,
- 91, 91, 103, 103, 103, 69, 14, 14, 30, 14,
- 21, 30, 38, 96, 98, 25, 13, 38, 57, 91,
- 38, 57, 37, 99, 65, 73, 83, 91, 83, 91,
- 37, 57, 91, 91, 91, 91, 91, 91, 91, 91,
- 91, 91, 91, 91, 91, 91, 91, 65, 69, 65,
- 13, 14, 14, 14, 88, 13, 91, 91, 38, 57,
- 91, 91, 91, 88, 65, 89, 65, 72, 88, 91,
- 91, 13, 100, 91, 91, 100, 90, 16, 38, 90,
- 75, 92, 69, 72, 72, 72, 76, 89, 38, 91,
- 89, 89, 13, 69, 101, 101, 19, 91, 89, 19,
- 42, 88, 18, 42, 80, 81, 87, 13, 90, 90,
- 35, 89, 90, 24, 90, 79, 80, 82, 87, 88,
- 81, 89, 83, 90, 89, 89, 82, 89, 83, 75,
- 42, 78, 37, 89, 19, 19, 19, 37, 89, 88,
- 89, 88, 19, 35, 24, 24, 90, 75, 76, 35,
- 89, 89
+ 39, 43, 44, 53, 59, 60, 65, 72, 74, 75,
+ 76, 77, 78, 85, 86, 87, 92, 93, 95, 98,
+ 103, 64, 13, 34, 75, 92, 65, 65, 89, 13,
+ 94, 14, 21, 26, 30, 31, 32, 33, 38, 96,
+ 97, 13, 14, 13, 92, 40, 41, 8, 9, 13,
+ 13, 13, 13, 92, 92, 92, 92, 0, 64, 73,
+ 65, 58, 65, 84, 92, 45, 46, 50, 51, 52,
+ 54, 55, 56, 57, 59, 60, 61, 62, 67, 68,
+ 69, 92, 92, 104, 104, 104, 70, 14, 14, 30,
+ 14, 21, 30, 38, 97, 99, 25, 13, 38, 58,
+ 92, 38, 58, 37, 100, 66, 74, 84, 92, 84,
+ 92, 37, 58, 92, 92, 92, 92, 92, 92, 92,
+ 92, 92, 92, 92, 92, 92, 92, 92, 92, 66,
+ 70, 66, 13, 14, 14, 14, 89, 13, 92, 92,
+ 38, 58, 92, 92, 92, 89, 66, 90, 66, 73,
+ 89, 92, 92, 13, 101, 92, 92, 101, 91, 16,
+ 38, 91, 76, 93, 70, 73, 73, 73, 77, 90,
+ 38, 92, 90, 90, 13, 70, 102, 102, 19, 92,
+ 90, 19, 42, 89, 18, 42, 81, 82, 88, 13,
+ 91, 91, 35, 90, 91, 24, 91, 80, 81, 83,
+ 88, 89, 82, 90, 84, 91, 90, 90, 83, 90,
+ 84, 76, 42, 79, 37, 90, 19, 19, 19, 37,
+ 90, 89, 90, 89, 19, 35, 24, 24, 91, 76,
+ 77, 35, 90, 90
};
#define yyerrok (yyerrstatus = 0)
@@ -1754,12 +1749,12 @@ yyreduce:
switch (yyn)
{
case 4:
-#line 102 "engines/director/lingo/lingo-gr.y"
+#line 104 "engines/director/lingo/lingo-gr.y"
{ yyerrok; ;}
break;
case 5:
-#line 105 "engines/director/lingo/lingo-gr.y"
+#line 107 "engines/director/lingo/lingo-gr.y"
{
g_lingo->_linenumber++;
g_lingo->_colnumber = 1;
@@ -1767,12 +1762,12 @@ yyreduce:
break;
case 10:
-#line 114 "engines/director/lingo/lingo-gr.y"
+#line 116 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 12:
-#line 118 "engines/director/lingo/lingo-gr.y"
+#line 120 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str());
@@ -1782,7 +1777,7 @@ yyreduce:
break;
case 13:
-#line 124 "engines/director/lingo/lingo-gr.y"
+#line 126 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1792,7 +1787,7 @@ yyreduce:
break;
case 14:
-#line 130 "engines/director/lingo/lingo-gr.y"
+#line 132 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id
g_lingo->code1(g_lingo->c_theentityassign);
@@ -1804,7 +1799,7 @@ yyreduce:
break;
case 15:
-#line 138 "engines/director/lingo/lingo-gr.y"
+#line 140 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_swap);
g_lingo->code1(g_lingo->c_theentityassign);
@@ -1816,7 +1811,7 @@ yyreduce:
break;
case 16:
-#line 146 "engines/director/lingo/lingo-gr.y"
+#line 148 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1826,7 +1821,7 @@ yyreduce:
break;
case 17:
-#line 152 "engines/director/lingo/lingo-gr.y"
+#line 154 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id
g_lingo->code1(g_lingo->c_theentityassign);
@@ -1838,7 +1833,7 @@ yyreduce:
break;
case 18:
-#line 160 "engines/director/lingo/lingo-gr.y"
+#line 162 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_swap);
g_lingo->code1(g_lingo->c_theentityassign);
@@ -1850,12 +1845,12 @@ yyreduce:
break;
case 19:
-#line 169 "engines/director/lingo/lingo-gr.y"
+#line 171 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 23:
-#line 178 "engines/director/lingo/lingo-gr.y"
+#line 180 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1865,7 +1860,7 @@ yyreduce:
break;
case 24:
-#line 189 "engines/director/lingo/lingo-gr.y"
+#line 191 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1881,7 +1876,7 @@ yyreduce:
break;
case 25:
-#line 205 "engines/director/lingo/lingo-gr.y"
+#line 207 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1897,14 +1892,14 @@ yyreduce:
break;
case 26:
-#line 217 "engines/director/lingo/lingo-gr.y"
+#line 219 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_ifcode);
;}
break;
case 27:
-#line 222 "engines/director/lingo/lingo-gr.y"
+#line 224 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (8)].code));
@@ -1915,7 +1910,7 @@ yyreduce:
break;
case 28:
-#line 229 "engines/director/lingo/lingo-gr.y"
+#line 231 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1928,7 +1923,7 @@ yyreduce:
break;
case 29:
-#line 238 "engines/director/lingo/lingo-gr.y"
+#line 240 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1941,7 +1936,7 @@ yyreduce:
break;
case 30:
-#line 247 "engines/director/lingo/lingo-gr.y"
+#line 249 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1955,7 +1950,7 @@ yyreduce:
break;
case 31:
-#line 257 "engines/director/lingo/lingo-gr.y"
+#line 259 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1969,7 +1964,7 @@ yyreduce:
break;
case 32:
-#line 267 "engines/director/lingo/lingo-gr.y"
+#line 269 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1983,17 +1978,17 @@ yyreduce:
break;
case 33:
-#line 278 "engines/director/lingo/lingo-gr.y"
+#line 280 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = 0; ;}
break;
case 34:
-#line 279 "engines/director/lingo/lingo-gr.y"
+#line 281 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 39:
-#line 290 "engines/director/lingo/lingo-gr.y"
+#line 292 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -2003,7 +1998,7 @@ yyreduce:
break;
case 41:
-#line 299 "engines/director/lingo/lingo-gr.y"
+#line 301 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
@@ -2013,22 +2008,22 @@ yyreduce:
break;
case 42:
-#line 307 "engines/director/lingo/lingo-gr.y"
+#line 309 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
case 43:
-#line 308 "engines/director/lingo/lingo-gr.y"
+#line 310 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
case 45:
-#line 311 "engines/director/lingo/lingo-gr.y"
+#line 313 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
case 46:
-#line 313 "engines/director/lingo/lingo-gr.y"
+#line 315 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -2037,7 +2032,7 @@ yyreduce:
break;
case 47:
-#line 319 "engines/director/lingo/lingo-gr.y"
+#line 321 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -2046,7 +2041,7 @@ yyreduce:
break;
case 48:
-#line 325 "engines/director/lingo/lingo-gr.y"
+#line 327 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -2056,22 +2051,22 @@ yyreduce:
break;
case 49:
-#line 332 "engines/director/lingo/lingo-gr.y"
+#line 334 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 50:
-#line 334 "engines/director/lingo/lingo-gr.y"
+#line 336 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 51:
-#line 336 "engines/director/lingo/lingo-gr.y"
+#line 338 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 54:
-#line 341 "engines/director/lingo/lingo-gr.y"
+#line 343 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -2080,21 +2075,21 @@ yyreduce:
break;
case 55:
-#line 346 "engines/director/lingo/lingo-gr.y"
+#line 348 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
case 56:
-#line 349 "engines/director/lingo/lingo-gr.y"
+#line 351 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_stringpush);
g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;}
break;
case 57:
-#line 352 "engines/director/lingo/lingo-gr.y"
+#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));
@@ -2104,14 +2099,14 @@ yyreduce:
break;
case 58:
-#line 358 "engines/director/lingo/lingo-gr.y"
+#line 360 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->_builtins[*(yyvsp[(1) - (1)].s)]->func);
delete (yyvsp[(1) - (1)].s); ;}
break;
case 59:
-#line 361 "engines/director/lingo/lingo-gr.y"
+#line 363 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -2123,14 +2118,14 @@ yyreduce:
break;
case 60:
-#line 369 "engines/director/lingo/lingo-gr.y"
+#line 371 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
case 61:
-#line 372 "engines/director/lingo/lingo-gr.y"
+#line 374 "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);
@@ -2141,7 +2136,7 @@ yyreduce:
break;
case 62:
-#line 379 "engines/director/lingo/lingo-gr.y"
+#line 381 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_theentitypush);
inst e = 0, f = 0;
@@ -2151,148 +2146,153 @@ yyreduce:
break;
case 64:
-#line 386 "engines/director/lingo/lingo-gr.y"
+#line 388 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
case 65:
-#line 387 "engines/director/lingo/lingo-gr.y"
+#line 389 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
case 66:
-#line 388 "engines/director/lingo/lingo-gr.y"
+#line 390 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
case 67:
-#line 389 "engines/director/lingo/lingo-gr.y"
+#line 391 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
case 68:
-#line 390 "engines/director/lingo/lingo-gr.y"
+#line 392 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
case 69:
-#line 391 "engines/director/lingo/lingo-gr.y"
+#line 393 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
case 70:
-#line 392 "engines/director/lingo/lingo-gr.y"
+#line 394 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
case 71:
-#line 393 "engines/director/lingo/lingo-gr.y"
+#line 395 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
case 72:
-#line 394 "engines/director/lingo/lingo-gr.y"
+#line 396 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
case 73:
-#line 395 "engines/director/lingo/lingo-gr.y"
+#line 397 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_and); ;}
break;
case 74:
-#line 396 "engines/director/lingo/lingo-gr.y"
+#line 398 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_or); ;}
break;
case 75:
-#line 397 "engines/director/lingo/lingo-gr.y"
+#line 399 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_not); ;}
break;
case 76:
-#line 398 "engines/director/lingo/lingo-gr.y"
+#line 400 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ampersand); ;}
break;
case 77:
-#line 399 "engines/director/lingo/lingo-gr.y"
+#line 401 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_concat); ;}
break;
case 78:
-#line 400 "engines/director/lingo/lingo-gr.y"
+#line 402 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_contains); ;}
break;
case 79:
-#line 401 "engines/director/lingo/lingo-gr.y"
+#line 403 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_starts); ;}
break;
case 80:
-#line 402 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+#line 404 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_intersects); ;}
break;
case 81:
-#line 403 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
+#line 405 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 82:
-#line 404 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+#line 406 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 83:
#line 407 "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); ;}
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 84:
-#line 408 "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); ;}
+#line 410 "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 85:
-#line 409 "engines/director/lingo/lingo-gr.y"
+#line 411 "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 86:
+#line 412 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 87:
-#line 411 "engines/director/lingo/lingo-gr.y"
+ case 88:
+#line 414 "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 89:
-#line 416 "engines/director/lingo/lingo-gr.y"
+ case 90:
+#line 419 "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 90:
-#line 417 "engines/director/lingo/lingo-gr.y"
+ case 91:
+#line 420 "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 91:
-#line 428 "engines/director/lingo/lingo-gr.y"
+ case 92:
+#line 431 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 92:
-#line 429 "engines/director/lingo/lingo-gr.y"
+ case 93:
+#line 432 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 93:
-#line 430 "engines/director/lingo/lingo-gr.y"
+ case 94:
+#line 433 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 94:
-#line 431 "engines/director/lingo/lingo-gr.y"
+ case 95:
+#line 434 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2300,8 +2300,8 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 95:
-#line 436 "engines/director/lingo/lingo-gr.y"
+ case 96:
+#line 439 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2310,8 +2310,8 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 96:
-#line 442 "engines/director/lingo/lingo-gr.y"
+ case 97:
+#line 445 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2319,48 +2319,48 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 97:
-#line 449 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
- break;
-
case 98:
-#line 450 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+#line 452 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 99:
-#line 451 "engines/director/lingo/lingo-gr.y"
+#line 453 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 100:
-#line 452 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
+#line 454 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 101:
#line 455 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+ { (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 102:
-#line 456 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
+#line 458 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 103:
-#line 457 "engines/director/lingo/lingo-gr.y"
- { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
+#line 459 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 104:
-#line 485 "engines/director/lingo/lingo-gr.y"
- { g_lingo->_indef = true; ;}
+#line 460 "engines/director/lingo/lingo-gr.y"
+ { (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 105:
-#line 486 "engines/director/lingo/lingo-gr.y"
+#line 488 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->_indef = true; ;}
+ break;
+
+ case 106:
+#line 489 "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);
@@ -2368,20 +2368,20 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 106:
-#line 491 "engines/director/lingo/lingo-gr.y"
+ case 107:
+#line 494 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeFactory(*(yyvsp[(2) - (2)].s));
;}
break;
- case 107:
-#line 494 "engines/director/lingo/lingo-gr.y"
+ case 108:
+#line 497 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 108:
-#line 495 "engines/director/lingo/lingo-gr.y"
+ case 109:
+#line 498 "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);
@@ -2389,33 +2389,33 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 109:
-#line 500 "engines/director/lingo/lingo-gr.y"
+ case 110:
+#line 503 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 110:
-#line 501 "engines/director/lingo/lingo-gr.y"
+ case 111:
+#line 504 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 111:
-#line 502 "engines/director/lingo/lingo-gr.y"
+ case 112:
+#line 505 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 112:
-#line 503 "engines/director/lingo/lingo-gr.y"
+ case 113:
+#line 506 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 113:
-#line 505 "engines/director/lingo/lingo-gr.y"
+ case 114:
+#line 508 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 114:
-#line 509 "engines/director/lingo/lingo-gr.y"
+ case 115:
+#line 512 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2424,18 +2424,18 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 115:
-#line 517 "engines/director/lingo/lingo-gr.y"
+ case 116:
+#line 520 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 116:
-#line 518 "engines/director/lingo/lingo-gr.y"
+ case 117:
+#line 521 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 117:
-#line 519 "engines/director/lingo/lingo-gr.y"
+ case 118:
+#line 522 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
@@ -2655,6 +2655,6 @@ yyreturn:
}
-#line 522 "engines/director/lingo/lingo-gr.y"
+#line 525 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index a459ac9..425c574 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -92,7 +92,8 @@
tNOT = 308,
tCONCAT = 309,
tCONTAINS = 310,
- tSTARTS = 311
+ tSTARTS = 311,
+ tINTERSECTS = 312
};
#endif
/* Tokens. */
@@ -150,6 +151,7 @@
#define tCONCAT 309
#define tCONTAINS 310
#define tSTARTS 311
+#define tINTERSECTS 312
@@ -166,7 +168,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 170 "engines/director/lingo/lingo-gr.hpp"
+#line 172 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index ed3fb11..f949544 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -85,12 +85,14 @@ void yyerror(char *s) {
%token tWITH tWHILE tNLELSE tFACTORY tMETHOD
%token tGE tLE tGT tLT tEQ tNEQ tAND tOR tNOT
%token tCONCAT tCONTAINS tSTARTS
+%token tINTERSECTS
%type<code> asgn begin elseif elsestmtoneliner end expr if repeatwhile repeatwith stmtlist
%type<s> gotoframe gotomovie
%type<narg> argdef arglist
%right '='
+%left tINTERSECTS
%left '+' '-'
%left '*' '/' '%'
%right UNARY
@@ -399,6 +401,7 @@ expr: INT {
| expr tCONCAT expr { g_lingo->code1(g_lingo->c_concat); }
| expr tCONTAINS expr { g_lingo->code1(g_lingo->c_contains); }
| expr tSTARTS expr { g_lingo->code1(g_lingo->c_starts); }
+ | expr tINTERSECTS expr { g_lingo->code1(g_lingo->c_intersects); }
| '+' expr %prec UNARY { $$ = $2; }
| '-' expr %prec UNARY { $$ = $2; g_lingo->code1(g_lingo->c_negate); }
| '(' expr ')' { $$ = $2; }
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 0284905..2089bf1 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 51
-#define YY_END_OF_BUFFER 52
+#define YY_NUM_RULES 52
+#define YY_END_OF_BUFFER 53
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,27 +373,27 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[172] =
+static yyconst flex_int16_t yy_accept[179] =
{ 0,
- 0, 0, 52, 50, 3, 48, 48, 50, 50, 47,
- 47, 47, 46, 47, 47, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
- 44, 44, 2, 2, 3, 48, 0, 0, 48, 0,
- 0, 49, 43, 1, 45, 46, 42, 40, 41, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 16,
- 7, 44, 44, 44, 44, 44, 44, 44, 44, 26,
- 27, 44, 44, 44, 44, 44, 44, 36, 44, 44,
- 2, 2, 0, 1, 45, 4, 44, 44, 44, 11,
- 44, 44, 44, 44, 44, 44, 44, 20, 44, 44,
-
- 44, 25, 44, 29, 44, 31, 44, 44, 44, 44,
- 44, 0, 44, 6, 10, 13, 44, 44, 44, 17,
- 18, 44, 44, 44, 44, 24, 44, 44, 44, 0,
- 35, 38, 44, 37, 9, 44, 44, 14, 44, 19,
- 44, 44, 23, 44, 44, 44, 34, 39, 0, 44,
- 44, 15, 44, 22, 44, 30, 32, 0, 0, 44,
- 12, 21, 44, 0, 8, 5, 28, 0, 0, 33,
- 0
+ 0, 0, 53, 51, 3, 49, 49, 51, 51, 48,
+ 48, 48, 47, 48, 48, 45, 45, 45, 45, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+ 45, 45, 2, 2, 3, 49, 0, 0, 49, 0,
+ 0, 50, 44, 1, 46, 47, 43, 41, 42, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 16,
+ 7, 45, 45, 45, 45, 45, 45, 45, 45, 27,
+ 28, 45, 45, 45, 45, 45, 45, 37, 45, 45,
+ 2, 2, 0, 1, 46, 4, 45, 45, 45, 11,
+ 45, 45, 45, 45, 45, 45, 45, 21, 45, 45,
+
+ 45, 26, 45, 30, 45, 32, 45, 45, 45, 45,
+ 45, 0, 45, 6, 10, 13, 45, 45, 45, 45,
+ 18, 19, 45, 45, 45, 45, 25, 45, 45, 45,
+ 0, 36, 39, 45, 38, 9, 45, 45, 14, 45,
+ 45, 20, 45, 45, 24, 45, 45, 45, 35, 40,
+ 0, 45, 45, 15, 45, 45, 23, 45, 31, 33,
+ 0, 0, 45, 12, 45, 22, 45, 0, 8, 5,
+ 45, 29, 0, 45, 0, 17, 34, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -438,53 +438,55 @@ static yyconst flex_int32_t yy_meta[61] =
6, 6, 6, 6, 6, 6, 6, 6, 6, 6
} ;
-static yyconst flex_int16_t yy_base[177] =
+static yyconst flex_int16_t yy_base[184] =
{ 0,
- 0, 59, 359, 419, 63, 67, 71, 75, 351, 419,
+ 0, 59, 268, 426, 63, 67, 71, 75, 252, 426,
224, 181, 52, 68, 132, 56, 0, 56, 57, 67,
72, 68, 68, 69, 112, 70, 79, 103, 81, 103,
106, 115, 139, 145, 162, 101, 166, 170, 174, 135,
- 133, 419, 419, 0, 90, 163, 419, 419, 419, 0,
+ 133, 426, 426, 0, 90, 163, 426, 426, 426, 0,
112, 153, 146, 151, 166, 162, 169, 172, 163, 0,
0, 160, 167, 171, 173, 166, 165, 164, 169, 0,
0, 183, 174, 178, 184, 204, 206, 0, 208, 201,
232, 242, 207, 0, 80, 0, 208, 214, 209, 0,
- 210, 216, 224, 237, 229, 229, 229, 225, 232, 239,
-
- 234, 0, 233, 0, 249, 0, 240, 267, 247, 250,
- 254, 260, 269, 0, 0, 0, 259, 266, 273, 0,
- 0, 263, 280, 271, 277, 0, 278, 287, 272, 192,
- 0, 0, 286, 0, 311, 283, 281, 0, 290, 0,
- 284, 300, 0, 293, 291, 293, 330, 0, 331, 301,
- 300, 0, 307, 0, 307, 0, 0, 343, 321, 312,
- 0, 0, 318, 330, 419, 0, 0, 350, 351, 356,
- 419, 394, 396, 402, 407, 412
+ 210, 216, 224, 237, 238, 230, 230, 227, 232, 244,
+
+ 237, 0, 236, 0, 253, 0, 244, 274, 248, 255,
+ 262, 267, 272, 0, 0, 0, 262, 269, 279, 269,
+ 0, 0, 272, 280, 274, 285, 0, 282, 291, 277,
+ 192, 0, 0, 288, 0, 312, 292, 290, 0, 296,
+ 295, 0, 293, 309, 0, 305, 302, 304, 336, 0,
+ 340, 309, 300, 0, 327, 316, 0, 317, 0, 0,
+ 350, 333, 330, 0, 345, 0, 334, 346, 426, 0,
+ 336, 0, 362, 338, 370, 0, 374, 426, 401, 403,
+ 409, 414, 419
} ;
-static yyconst flex_int16_t yy_def[177] =
+static yyconst flex_int16_t yy_def[184] =
{ 0,
- 171, 1, 171, 171, 171, 171, 171, 171, 172, 171,
- 171, 171, 171, 171, 171, 173, 173, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
- 173, 173, 171, 171, 171, 171, 171, 171, 171, 171,
- 172, 171, 171, 174, 171, 171, 171, 171, 171, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
- 171, 171, 171, 174, 171, 173, 173, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
-
- 173, 173, 173, 173, 173, 173, 173, 173, 173, 173,
- 173, 171, 173, 173, 173, 173, 173, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 173, 175,
- 173, 173, 173, 173, 171, 173, 173, 173, 173, 173,
- 173, 173, 173, 173, 173, 173, 175, 173, 171, 173,
- 173, 173, 173, 173, 173, 173, 173, 171, 171, 173,
- 173, 173, 173, 171, 171, 173, 173, 171, 176, 176,
- 0, 171, 171, 171, 171, 171
+ 178, 1, 178, 178, 178, 178, 178, 178, 179, 178,
+ 178, 178, 178, 178, 178, 180, 180, 180, 180, 180,
+ 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
+ 180, 180, 178, 178, 178, 178, 178, 178, 178, 178,
+ 179, 178, 178, 181, 178, 178, 178, 178, 178, 180,
+ 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
+ 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
+ 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
+ 178, 178, 178, 181, 178, 180, 180, 180, 180, 180,
+ 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
+
+ 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
+ 180, 178, 180, 180, 180, 180, 180, 180, 180, 180,
+ 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
+ 182, 180, 180, 180, 180, 178, 180, 180, 180, 180,
+ 180, 180, 180, 180, 180, 180, 180, 180, 182, 180,
+ 178, 180, 180, 180, 180, 180, 180, 180, 180, 180,
+ 178, 178, 180, 180, 180, 180, 180, 178, 178, 180,
+ 180, 180, 178, 180, 183, 180, 183, 0, 178, 178,
+ 178, 178, 178
} ;
-static yyconst flex_int16_t yy_nxt[480] =
+static yyconst flex_int16_t yy_nxt[487] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
13, 14, 10, 15, 16, 17, 18, 19, 20, 21,
@@ -506,41 +508,42 @@ static yyconst flex_int16_t yy_nxt[480] =
79, 80, 67, 35, 36, 36, 37, 37, 36, 36,
37, 38, 45, 46, 38, 38, 39, 39, 38, 87,
88, 89, 83, 90, 91, 92, 93, 97, 40, 44,
- 94, 95, 40, 130, 96, 98, 130, 99, 100, 101,
+ 94, 95, 40, 131, 96, 98, 131, 99, 100, 101,
102, 103, 87, 88, 89, 104, 105, 90, 91, 92,
93, 97, 40, 94, 95, 106, 40, 96, 107, 98,
99, 100, 101, 102, 108, 103, 109, 115, 104, 105,
110, 43, 111, 81, 36, 36, 82, 112, 106, 113,
114, 116, 107, 82, 36, 36, 82, 117, 108, 118,
- 109, 115, 119, 124, 110, 111, 120, 121, 122, 123,
- 112, 125, 113, 114, 116, 126, 127, 128, 130, 129,
- 117, 130, 118, 132, 133, 134, 119, 124, 135, 120,
- 121, 122, 123, 136, 138, 125, 137, 139, 126, 127,
- 140, 128, 129, 131, 141, 143, 132, 133, 142, 134,
-
- 144, 145, 135, 146, 148, 150, 153, 136, 138, 137,
- 151, 139, 149, 140, 152, 149, 131, 154, 141, 143,
- 155, 142, 156, 157, 144, 145, 146, 160, 148, 150,
- 153, 158, 149, 151, 158, 149, 161, 152, 162, 163,
- 165, 154, 166, 155, 158, 156, 157, 158, 167, 168,
- 160, 169, 169, 159, 169, 169, 42, 171, 171, 161,
- 171, 162, 163, 171, 165, 166, 171, 171, 171, 171,
- 164, 167, 171, 168, 171, 171, 171, 159, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 164, 41, 41, 171, 41, 41, 41,
-
- 50, 50, 84, 84, 171, 171, 84, 84, 147, 171,
- 171, 171, 147, 170, 171, 171, 171, 170, 3, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171
+ 109, 115, 119, 125, 110, 111, 120, 42, 122, 123,
+ 112, 124, 113, 114, 116, 121, 126, 178, 127, 128,
+ 117, 129, 118, 130, 133, 131, 119, 125, 131, 134,
+ 120, 122, 123, 135, 124, 136, 137, 139, 121, 138,
+ 126, 127, 128, 140, 143, 129, 130, 133, 141, 142,
+
+ 132, 144, 134, 145, 146, 147, 150, 135, 148, 136,
+ 137, 139, 138, 151, 152, 156, 151, 140, 143, 153,
+ 154, 141, 142, 132, 144, 155, 157, 145, 146, 147,
+ 150, 148, 158, 159, 160, 163, 164, 161, 152, 156,
+ 161, 151, 153, 154, 151, 165, 178, 166, 155, 167,
+ 157, 161, 169, 178, 161, 158, 159, 160, 163, 164,
+ 170, 171, 162, 175, 172, 173, 175, 174, 176, 165,
+ 166, 175, 167, 178, 175, 178, 169, 168, 178, 178,
+ 178, 178, 178, 170, 178, 171, 162, 172, 178, 173,
+ 174, 176, 178, 178, 178, 178, 178, 178, 178, 178,
+
+ 168, 41, 41, 178, 41, 41, 41, 50, 50, 84,
+ 84, 178, 178, 84, 84, 149, 178, 178, 178, 149,
+ 177, 178, 178, 178, 177, 3, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178
} ;
-static yyconst flex_int16_t yy_chk[480] =
+static yyconst flex_int16_t yy_chk[487] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -562,38 +565,39 @@ static yyconst flex_int16_t yy_chk[480] =
32, 32, 25, 35, 35, 35, 35, 37, 37, 37,
37, 38, 46, 46, 38, 39, 39, 39, 39, 52,
53, 54, 40, 55, 56, 57, 58, 64, 38, 12,
- 59, 62, 39, 130, 63, 65, 130, 66, 67, 68,
+ 59, 62, 39, 131, 63, 65, 131, 66, 67, 68,
69, 72, 52, 53, 54, 73, 74, 55, 56, 57,
58, 64, 38, 59, 62, 75, 39, 63, 76, 65,
66, 67, 68, 69, 77, 72, 79, 89, 73, 74,
79, 11, 80, 81, 81, 81, 81, 83, 75, 87,
88, 91, 76, 82, 82, 82, 82, 92, 77, 93,
- 79, 89, 94, 99, 79, 80, 95, 96, 97, 98,
- 83, 100, 87, 88, 91, 101, 103, 105, 108, 107,
- 92, 108, 93, 109, 110, 111, 94, 99, 112, 95,
- 96, 97, 98, 113, 118, 100, 117, 119, 101, 103,
- 122, 105, 107, 108, 123, 125, 109, 110, 124, 111,
-
- 127, 128, 112, 129, 133, 136, 141, 113, 118, 117,
- 137, 119, 135, 122, 139, 135, 108, 142, 123, 125,
- 144, 124, 145, 146, 127, 128, 129, 150, 133, 136,
- 141, 147, 149, 137, 147, 149, 151, 139, 153, 155,
- 159, 142, 160, 144, 158, 145, 146, 158, 163, 164,
- 150, 168, 169, 149, 168, 169, 9, 170, 3, 151,
- 170, 153, 155, 0, 159, 160, 0, 0, 0, 0,
- 158, 163, 0, 164, 0, 0, 0, 149, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 158, 172, 172, 0, 172, 172, 172,
-
- 173, 173, 174, 174, 0, 0, 174, 174, 175, 0,
- 0, 0, 175, 176, 0, 0, 0, 176, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
- 171, 171, 171, 171, 171, 171, 171, 171, 171
+ 79, 89, 94, 99, 79, 80, 95, 9, 96, 97,
+ 83, 98, 87, 88, 91, 95, 100, 3, 101, 103,
+ 92, 105, 93, 107, 109, 108, 94, 99, 108, 110,
+ 95, 96, 97, 111, 98, 112, 113, 118, 95, 117,
+ 100, 101, 103, 119, 124, 105, 107, 109, 120, 123,
+
+ 108, 125, 110, 126, 128, 129, 134, 111, 130, 112,
+ 113, 118, 117, 136, 137, 143, 136, 119, 124, 138,
+ 140, 120, 123, 108, 125, 141, 144, 126, 128, 129,
+ 134, 130, 146, 147, 148, 152, 153, 149, 137, 143,
+ 149, 151, 138, 140, 151, 155, 0, 156, 141, 158,
+ 144, 161, 162, 0, 161, 146, 147, 148, 152, 153,
+ 163, 165, 151, 173, 167, 168, 173, 171, 174, 155,
+ 156, 175, 158, 0, 175, 177, 162, 161, 177, 0,
+ 0, 0, 0, 163, 0, 165, 151, 167, 0, 168,
+ 171, 174, 0, 0, 0, 0, 0, 0, 0, 0,
+
+ 161, 179, 179, 0, 179, 179, 179, 180, 180, 181,
+ 181, 0, 0, 181, 181, 182, 0, 0, 0, 182,
+ 183, 0, 0, 0, 183, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178
} ;
static yy_state_type yy_last_accepting_state;
@@ -658,7 +662,7 @@ static void countnl() {
g_lingo->_colnumber = strlen(p);
}
-#line 662 "engines/director/lingo/lingo-lex.cpp"
+#line 666 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -846,7 +850,7 @@ YY_DECL
#line 60 "engines/director/lingo/lingo-lex.l"
-#line 850 "engines/director/lingo/lingo-lex.cpp"
+#line 854 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -900,13 +904,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 >= 172 )
+ if ( yy_current_state >= 179 )
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] != 419 );
+ while ( yy_base[yy_current_state] != 426 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -1015,86 +1019,91 @@ YY_RULE_SETUP
case 17:
YY_RULE_SETUP
#line 79 "engines/director/lingo/lingo-lex.l"
-{ count(); return tINTO; }
+{ count(); return tINTERSECTS; }
YY_BREAK
case 18:
YY_RULE_SETUP
#line 80 "engines/director/lingo/lingo-lex.l"
-{ count(); return tLOOP; }
+{ count(); return tINTO; }
YY_BREAK
case 19:
YY_RULE_SETUP
#line 81 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMACRO; }
+{ count(); return tLOOP; }
YY_BREAK
case 20:
YY_RULE_SETUP
#line 82 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMCI; }
+{ count(); return tMACRO; }
YY_BREAK
case 21:
YY_RULE_SETUP
#line 83 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMCIWAIT; }
+{ count(); return tMCI; }
YY_BREAK
case 22:
YY_RULE_SETUP
#line 84 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMETHOD; }
+{ count(); return tMCIWAIT; }
YY_BREAK
case 23:
YY_RULE_SETUP
#line 85 "engines/director/lingo/lingo-lex.l"
-{ count(); return tMOVIE; }
+{ count(); return tMETHOD; }
YY_BREAK
case 24:
YY_RULE_SETUP
#line 86 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNEXT; }
+{ count(); return tMOVIE; }
YY_BREAK
case 25:
YY_RULE_SETUP
#line 87 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNOT; }
+{ count(); return tNEXT; }
YY_BREAK
case 26:
YY_RULE_SETUP
#line 88 "engines/director/lingo/lingo-lex.l"
-{ count(); return tOF; }
+{ count(); return tNOT; }
YY_BREAK
case 27:
YY_RULE_SETUP
#line 89 "engines/director/lingo/lingo-lex.l"
-{ count(); return tOR; }
+{ count(); return tOF; }
YY_BREAK
case 28:
YY_RULE_SETUP
#line 90 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPREVIOUS; }
+{ count(); return tOR; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 91 "engines/director/lingo/lingo-lex.l"
-{ count(); return tPUT; }
+{ count(); return tPREVIOUS; }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 92 "engines/director/lingo/lingo-lex.l"
-{ count(); return tREPEAT; }
+{ count(); return tPUT; }
YY_BREAK
case 31:
YY_RULE_SETUP
#line 93 "engines/director/lingo/lingo-lex.l"
-{ count(); return tSET; }
+{ count(); return tREPEAT; }
YY_BREAK
case 32:
YY_RULE_SETUP
#line 94 "engines/director/lingo/lingo-lex.l"
-{ count(); return tSTARTS; }
+{ count(); return tSET; }
YY_BREAK
case 33:
YY_RULE_SETUP
#line 95 "engines/director/lingo/lingo-lex.l"
+{ count(); return tSTARTS; }
+ YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 96 "engines/director/lingo/lingo-lex.l"
{
count();
@@ -1136,9 +1145,9 @@ YY_RULE_SETUP
error("Unhandled the entity %s", ptr);
}
YY_BREAK
-case 34:
+case 35:
YY_RULE_SETUP
-#line 135 "engines/director/lingo/lingo-lex.l"
+#line 136 "engines/director/lingo/lingo-lex.l"
{
count();
@@ -1159,54 +1168,54 @@ YY_RULE_SETUP
error("Unhandled the entity %s", ptr);
}
YY_BREAK
-case 35:
-YY_RULE_SETUP
-#line 154 "engines/director/lingo/lingo-lex.l"
-{ count(); return tTHEN; }
- YY_BREAK
case 36:
YY_RULE_SETUP
#line 155 "engines/director/lingo/lingo-lex.l"
-{ count(); return tTO; }
+{ count(); return tTHEN; }
YY_BREAK
case 37:
YY_RULE_SETUP
#line 156 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWITH; }
+{ count(); return tTO; }
YY_BREAK
case 38:
YY_RULE_SETUP
#line 157 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWHEN; }
+{ count(); return tWITH; }
YY_BREAK
case 39:
YY_RULE_SETUP
#line 158 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWHILE; }
+{ count(); return tWHEN; }
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 160 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNEQ; }
+#line 159 "engines/director/lingo/lingo-lex.l"
+{ count(); return tWHILE; }
YY_BREAK
case 41:
YY_RULE_SETUP
#line 161 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGE; }
+{ count(); return tNEQ; }
YY_BREAK
case 42:
YY_RULE_SETUP
#line 162 "engines/director/lingo/lingo-lex.l"
-{ count(); return tLE; }
+{ count(); return tGE; }
YY_BREAK
case 43:
YY_RULE_SETUP
#line 163 "engines/director/lingo/lingo-lex.l"
-{ count(); return tCONCAT; }
+{ count(); return tLE; }
YY_BREAK
case 44:
YY_RULE_SETUP
-#line 165 "engines/director/lingo/lingo-lex.l"
+#line 164 "engines/director/lingo/lingo-lex.l"
+{ count(); return tCONCAT; }
+ YY_BREAK
+case 45:
+YY_RULE_SETUP
+#line 166 "engines/director/lingo/lingo-lex.l"
{
count();
yylval.s = new Common::String(yytext);
@@ -1221,43 +1230,43 @@ YY_RULE_SETUP
return ID;
}
YY_BREAK
-case 45:
-YY_RULE_SETUP
-#line 178 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.f = atof(yytext); return FLOAT; }
- YY_BREAK
case 46:
YY_RULE_SETUP
#line 179 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
+{ count(); yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 47:
YY_RULE_SETUP
#line 180 "engines/director/lingo/lingo-lex.l"
-{ count(); return *yytext; }
+{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 48:
-/* rule 48 can match eol */
YY_RULE_SETUP
#line 181 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ count(); return *yytext; }
YY_BREAK
case 49:
+/* rule 49 can match eol */
YY_RULE_SETUP
#line 182 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ return '\n'; }
YY_BREAK
case 50:
YY_RULE_SETUP
#line 183 "engines/director/lingo/lingo-lex.l"
-
+{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
YY_BREAK
case 51:
YY_RULE_SETUP
-#line 185 "engines/director/lingo/lingo-lex.l"
+#line 184 "engines/director/lingo/lingo-lex.l"
+
+ YY_BREAK
+case 52:
+YY_RULE_SETUP
+#line 186 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1261 "engines/director/lingo/lingo-lex.cpp"
+#line 1270 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1550,7 +1559,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 >= 172 )
+ if ( yy_current_state >= 179 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1578,11 +1587,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 >= 172 )
+ if ( yy_current_state >= 179 )
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 == 171);
+ yy_is_jam = (yy_current_state == 178);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2257,7 +2266,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 185 "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 f125a01..5e4deec 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -76,6 +76,7 @@ whitespace [\t ]
(?i:frame) { count(); return tFRAME; }
(?i:global) { count(); return tGLOBAL; }
(?i:go) { count(); return tGO; }
+(?i:intersects) { count(); return tINTERSECTS; }
(?i:into) { count(); return tINTO; }
(?i:loop) { count(); return tLOOP; }
(?i:macro) { count(); return tMACRO; }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 0afef2f..f1fa45d 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -203,6 +203,8 @@ public:
static void c_contains();
static void c_starts();
+ static void c_intersects();
+
static void c_constpush();
static void c_fconstpush();
static void c_stringpush();
Commit: 9172820158e9ac069a1bb9bf4472dc1e64e2a6e3
https://github.com/scummvm/scummvm/commit/9172820158e9ac069a1bb9bf4472dc1e64e2a6e3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix 'intersects' operator parsing and added 'within' operator
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.h
engines/director/lingo/tests/factory.lingo
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 629b100..c8ae4b9 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -399,6 +399,15 @@ void Lingo::c_intersects() {
g_lingo->push(d1);
}
+void Lingo::c_within() {
+ Datum d2 = g_lingo->pop();
+ Datum d1 = g_lingo->pop();
+
+ warning("STUB: c_within");
+
+ g_lingo->push(d1);
+}
+
void Lingo::c_and() {
Datum d2 = g_lingo->pop();
Datum d1 = g_lingo->pop();
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index e0d661f..bb343ff 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -120,7 +120,9 @@
tCONCAT = 309,
tCONTAINS = 310,
tSTARTS = 311,
- tINTERSECTS = 312
+ tSPRITE = 312,
+ tINTERSECTS = 313,
+ tWITHIN = 314
};
#endif
/* Tokens. */
@@ -178,7 +180,9 @@
#define tCONCAT 309
#define tCONTAINS 310
#define tSTARTS 311
-#define tINTERSECTS 312
+#define tSPRITE 312
+#define tINTERSECTS 313
+#define tWITHIN 314
@@ -235,7 +239,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 193 of yacc.c. */
-#line 239 "engines/director/lingo/lingo-gr.cpp"
+#line 243 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -248,7 +252,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 252 "engines/director/lingo/lingo-gr.cpp"
+#line 256 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -461,22 +465,22 @@ union yyalloc
#endif
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 77
+#define YYFINAL 79
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 645
+#define YYLAST 715
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 71
+#define YYNTOKENS 73
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 34
/* YYNRULES -- Number of rules. */
-#define YYNRULES 118
+#define YYNRULES 119
/* YYNRULES -- Number of states. */
-#define YYNSTATES 254
+#define YYNSTATES 258
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 312
+#define YYMAXUTOK 314
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -485,12 +489,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 64, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 66, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 63, 69, 2,
- 65, 66, 61, 59, 70, 60, 2, 62, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 65, 71, 2,
+ 67, 68, 63, 61, 72, 62, 2, 64, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 68, 58, 67, 2, 2, 2, 2, 2, 2, 2,
+ 70, 60, 69, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -515,7 +519,7 @@ static const yytype_uint8 yytranslate[] =
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57
+ 55, 56, 57, 58, 59
};
#if YYDEBUG
@@ -531,77 +535,78 @@ static const yytype_uint16 yyprhs[] =
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, 325, 328, 331, 335, 338, 341, 344, 346, 348,
- 351, 353, 357, 360, 363, 366, 369, 373, 376, 380,
- 383, 386, 388, 392, 395, 399, 400, 409, 412, 413,
- 422, 423, 425, 429, 434, 435, 439, 440, 442
+ 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
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 72, 0, -1, 72, 73, 74, -1, 74, -1, 1,
- 64, -1, 64, -1, -1, 98, -1, 93, -1, 103,
- -1, 75, -1, 77, -1, 34, 92, 25, 13, -1,
- 36, 13, 58, 92, -1, 36, 8, 58, 92, -1,
- 36, 9, 92, 58, 92, -1, 36, 13, 38, 92,
- -1, 36, 8, 38, 92, -1, 36, 9, 92, 38,
- 92, -1, 92, -1, 93, -1, 76, -1, 78, -1,
- 85, 65, 84, 66, 91, 90, 19, 35, -1, 86,
- 58, 92, 90, 38, 92, 90, 91, 90, 19, 35,
- -1, 86, 58, 92, 90, 16, 38, 92, 90, 91,
- 90, 19, 35, -1, 39, 13, 37, 92, -1, 87,
- 84, 37, 73, 91, 90, 19, 24, -1, 87, 84,
- 37, 73, 91, 90, 42, 91, 90, 19, 24, -1,
- 87, 84, 37, 73, 91, 90, 89, 80, 90, 19,
- 24, -1, 87, 84, 37, 89, 76, 90, -1, 87,
- 84, 37, 89, 76, 90, 42, 89, 76, 90, -1,
- 87, 84, 37, 89, 76, 90, 81, 90, 79, 90,
- -1, -1, 42, 89, 76, -1, 80, 83, -1, 83,
- -1, 81, 82, -1, 82, -1, 88, 84, 37, 89,
- 77, 90, -1, 81, -1, 88, 84, 37, 91, 90,
- -1, 92, -1, 92, 58, 92, -1, 65, 84, 66,
+ 74, 0, -1, 74, 75, 76, -1, 76, -1, 1,
+ 66, -1, 66, -1, -1, 100, -1, 95, -1, 105,
+ -1, 77, -1, 79, -1, 34, 94, 25, 13, -1,
+ 36, 13, 60, 94, -1, 36, 8, 60, 94, -1,
+ 36, 9, 94, 60, 94, -1, 36, 13, 38, 94,
+ -1, 36, 8, 38, 94, -1, 36, 9, 94, 38,
+ 94, -1, 94, -1, 95, -1, 78, -1, 80, -1,
+ 87, 67, 86, 68, 93, 92, 19, 35, -1, 88,
+ 60, 94, 92, 38, 94, 92, 93, 92, 19, 35,
+ -1, 88, 60, 94, 92, 16, 38, 94, 92, 93,
+ 92, 19, 35, -1, 39, 13, 37, 94, -1, 89,
+ 86, 37, 75, 93, 92, 19, 24, -1, 89, 86,
+ 37, 75, 93, 92, 42, 93, 92, 19, 24, -1,
+ 89, 86, 37, 75, 93, 92, 91, 82, 92, 19,
+ 24, -1, 89, 86, 37, 91, 78, 92, -1, 89,
+ 86, 37, 91, 78, 92, 42, 91, 78, 92, -1,
+ 89, 86, 37, 91, 78, 92, 83, 92, 81, 92,
+ -1, -1, 42, 91, 78, -1, 82, 85, -1, 85,
+ -1, 83, 84, -1, 84, -1, 90, 86, 37, 91,
+ 79, 92, -1, 83, -1, 90, 86, 37, 93, 92,
+ -1, 94, -1, 94, 60, 94, -1, 67, 86, 68,
-1, 35, 41, -1, 35, 40, 13, -1, 24, -1,
- 18, -1, -1, -1, -1, 91, 73, -1, 91, 77,
- -1, 7, -1, 10, -1, 14, -1, 11, 65, 104,
- 66, -1, 12, -1, 13, 65, 104, 66, -1, 13,
- -1, 8, -1, 9, 92, -1, 75, -1, 92, 59,
- 92, -1, 92, 60, 92, -1, 92, 61, 92, -1,
- 92, 62, 92, -1, 92, 67, 92, -1, 92, 68,
- 92, -1, 92, 50, 92, -1, 92, 45, 92, -1,
- 92, 46, 92, -1, 92, 51, 92, -1, 92, 52,
- 92, -1, 53, 92, -1, 92, 69, 92, -1, 92,
- 54, 92, -1, 92, 55, 92, -1, 92, 56, 92,
- -1, 92, 57, 92, -1, 59, 92, -1, 60, 92,
- -1, 65, 92, 66, -1, 28, 14, -1, 29, 13,
- -1, 34, 92, -1, 95, -1, 20, -1, 22, 94,
- -1, 13, -1, 94, 70, 13, -1, 23, 26, -1,
- 23, 31, -1, 23, 33, -1, 23, 96, -1, 23,
- 96, 97, -1, 23, 97, -1, 38, 21, 14, -1,
- 21, 14, -1, 38, 14, -1, 14, -1, 32, 30,
- 14, -1, 30, 14, -1, 38, 30, 14, -1, -1,
- 27, 13, 99, 89, 101, 73, 102, 91, -1, 43,
- 13, -1, -1, 44, 13, 100, 89, 101, 73, 102,
- 91, -1, -1, 13, -1, 101, 70, 13, -1, 101,
- 73, 70, 13, -1, -1, 13, 89, 104, -1, -1,
- 92, -1, 104, 70, 92, -1
+ 18, -1, -1, -1, -1, 93, 75, -1, 93, 79,
+ -1, 7, -1, 10, -1, 14, -1, 11, 67, 106,
+ 68, -1, 12, -1, 13, 67, 106, 68, -1, 13,
+ -1, 8, -1, 9, 94, -1, 77, -1, 94, 61,
+ 94, -1, 94, 62, 94, -1, 94, 63, 94, -1,
+ 94, 64, 94, -1, 94, 69, 94, -1, 94, 70,
+ 94, -1, 94, 50, 94, -1, 94, 45, 94, -1,
+ 94, 46, 94, -1, 94, 51, 94, -1, 94, 52,
+ 94, -1, 53, 94, -1, 94, 71, 94, -1, 94,
+ 54, 94, -1, 94, 55, 94, -1, 94, 56, 94,
+ -1, 61, 94, -1, 62, 94, -1, 67, 94, 68,
+ -1, 57, 94, 58, 94, -1, 57, 94, 59, 94,
+ -1, 28, 14, -1, 29, 13, -1, 34, 94, -1,
+ 97, -1, 20, -1, 22, 96, -1, 13, -1, 96,
+ 72, 13, -1, 23, 26, -1, 23, 31, -1, 23,
+ 33, -1, 23, 98, -1, 23, 98, 99, -1, 23,
+ 99, -1, 38, 21, 14, -1, 21, 14, -1, 38,
+ 14, -1, 14, -1, 32, 30, 14, -1, 30, 14,
+ -1, 38, 30, 14, -1, -1, 27, 13, 101, 91,
+ 103, 75, 104, 93, -1, 43, 13, -1, -1, 44,
+ 13, 102, 91, 103, 75, 104, 93, -1, -1, 13,
+ -1, 103, 72, 13, -1, 103, 75, 72, 13, -1,
+ -1, 13, 91, 106, -1, -1, 94, -1, 106, 72,
+ 94, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 102, 102, 103, 104, 107, 112, 113, 114, 115,
- 116, 117, 120, 126, 132, 140, 148, 154, 162, 171,
- 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, 410, 411, 412, 413, 414, 416,
- 419, 420, 431, 432, 433, 434, 439, 445, 452, 453,
- 454, 455, 458, 459, 460, 488, 488, 494, 497, 497,
- 503, 504, 505, 506, 508, 512, 520, 521, 522
+ 0, 101, 101, 102, 103, 106, 111, 112, 113, 114,
+ 115, 116, 119, 125, 131, 139, 147, 153, 161, 170,
+ 171, 173, 174, 179, 190, 206, 218, 223, 230, 239,
+ 248, 258, 268, 279, 280, 283, 284, 287, 288, 291,
+ 299, 300, 308, 309, 310, 312, 314, 320, 326, 333,
+ 335, 337, 338, 339, 342, 347, 350, 353, 359, 362,
+ 370, 373, 380, 386, 387, 388, 389, 390, 391, 392,
+ 393, 394, 395, 396, 397, 398, 399, 400, 401, 402,
+ 403, 404, 405, 406, 407, 410, 411, 412, 413, 414,
+ 416, 419, 420, 431, 432, 433, 434, 439, 445, 452,
+ 453, 454, 455, 458, 459, 460, 488, 488, 494, 497,
+ 497, 503, 504, 505, 506, 508, 512, 520, 521, 522
};
#endif
@@ -617,14 +622,15 @@ static const char *const yytname[] =
"tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT",
"tSET", "tTHEN", "tTO", "tWHEN", "tWITH", "tWHILE", "tNLELSE",
"tFACTORY", "tMETHOD", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "tAND",
- "tOR", "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS", "tINTERSECTS", "'='",
- "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('", "')'", "'>'", "'<'",
- "'&'", "','", "$accept", "program", "nl", "programline", "asgn",
- "stmtoneliner", "stmt", "ifstmt", "elsestmtoneliner", "elseifstmt",
- "elseifstmtoneliner", "elseifstmtoneliner1", "elseifstmt1", "cond",
- "repeatwhile", "repeatwith", "if", "elseif", "begin", "end", "stmtlist",
- "expr", "func", "globallist", "gotofunc", "gotoframe", "gotomovie",
- "defn", "@1", "@2", "argdef", "argstore", "macro", "arglist", 0
+ "tOR", "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS", "tSPRITE",
+ "tINTERSECTS", "tWITHIN", "'='", "'+'", "'-'", "'*'", "'/'", "'%'",
+ "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','", "$accept", "program",
+ "nl", "programline", "asgn", "stmtoneliner", "stmt", "ifstmt",
+ "elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
+ "elseifstmtoneliner1", "elseifstmt1", "cond", "repeatwhile",
+ "repeatwith", "if", "elseif", "begin", "end", "stmtlist", "expr", "func",
+ "globallist", "gotofunc", "gotoframe", "gotomovie", "defn", "@1", "@2",
+ "argdef", "argstore", "macro", "arglist", 0
};
#endif
@@ -638,27 +644,27 @@ static const yytype_uint16 yytoknum[] =
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 308, 309, 310, 311, 312, 61, 43,
- 45, 42, 47, 37, 10, 40, 41, 62, 60, 38,
- 44
+ 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
+ 61, 43, 45, 42, 47, 37, 10, 40, 41, 62,
+ 60, 38, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 71, 72, 72, 72, 73, 74, 74, 74, 74,
- 74, 74, 75, 75, 75, 75, 75, 75, 75, 76,
- 76, 77, 77, 77, 77, 77, 77, 78, 78, 78,
- 78, 78, 78, 79, 79, 80, 80, 81, 81, 82,
- 83, 83, 84, 84, 84, 85, 86, 87, 88, 89,
- 90, 91, 91, 91, 92, 92, 92, 92, 92, 92,
- 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
- 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
- 92, 92, 92, 92, 93, 93, 93, 93, 93, 93,
- 94, 94, 95, 95, 95, 95, 95, 95, 96, 96,
- 96, 96, 97, 97, 97, 99, 98, 98, 100, 98,
- 101, 101, 101, 101, 102, 103, 104, 104, 104
+ 0, 73, 74, 74, 74, 75, 76, 76, 76, 76,
+ 76, 76, 77, 77, 77, 77, 77, 77, 77, 78,
+ 78, 79, 79, 79, 79, 79, 79, 80, 80, 80,
+ 80, 80, 80, 81, 81, 82, 82, 83, 83, 84,
+ 85, 85, 86, 86, 86, 87, 88, 89, 90, 91,
+ 92, 93, 93, 93, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 95, 95, 95, 95, 95,
+ 95, 96, 96, 97, 97, 97, 97, 97, 97, 98,
+ 98, 98, 98, 99, 99, 99, 101, 100, 100, 102,
+ 100, 103, 103, 103, 103, 104, 105, 106, 106, 106
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -672,10 +678,10 @@ static const yytype_uint8 yyr2[] =
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,
- 3, 2, 2, 3, 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
+ 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
@@ -684,82 +690,82 @@ static const yytype_uint8 yyr2[] =
static const yytype_uint8 yydefact[] =
{
0, 0, 54, 61, 0, 55, 0, 58, 49, 56,
- 88, 0, 0, 47, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 3, 63,
- 21, 11, 22, 0, 0, 0, 19, 8, 87, 7,
- 9, 4, 60, 0, 63, 62, 116, 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, 75, 81, 82, 0, 1, 5, 6,
- 0, 0, 0, 0, 42, 0, 0, 0, 0, 0,
+ 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, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 117, 0, 0, 115, 0, 99, 103, 0,
- 100, 0, 0, 0, 96, 49, 0, 46, 0, 0,
- 0, 0, 0, 0, 49, 83, 2, 0, 50, 0,
- 0, 49, 0, 71, 72, 70, 73, 74, 77, 78,
- 79, 80, 64, 65, 66, 67, 68, 69, 76, 57,
- 0, 59, 91, 102, 98, 104, 110, 12, 17, 14,
- 0, 0, 16, 13, 26, 110, 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
+ 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
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 27, 187, 28, 44, 30, 188, 32, 233, 217,
- 218, 207, 219, 83, 33, 34, 35, 208, 243, 167,
- 178, 36, 183, 50, 38, 59, 60, 39, 115, 124,
- 174, 196, 40, 103
+ -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
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -198
+#define YYPACT_NINF -192
static const yytype_int16 yypact[] =
{
- 206, -57, -198, -198, 422, -198, -30, -198, 531, -198,
- -198, 45, 107, -198, 47, 23, 51, 422, 37, 60,
- 53, 54, 96, 422, 422, 422, 422, 17, -198, 19,
- -198, -198, -198, 55, 61, 430, 511, -198, -198, -198,
- -198, -198, 64, 422, -198, 511, 422, 422, 422, -198,
- 42, -198, 104, -198, 116, -198, 102, -198, 11, 24,
- -198, -198, -198, -198, 121, 122, -198, -16, 422, -14,
- 97, -198, -198, 576, 576, 576, 260, -198, -198, 265,
- 430, 422, 430, 105, 491, 422, 422, 422, 422, 422,
- 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
- 422, 121, 511, 41, 44, 71, 131, -198, -198, 133,
- -198, 134, 136, 123, -198, -198, 138, -198, 422, 422,
- 446, 422, 422, 422, -198, -198, -198, 89, 511, 90,
- 466, 93, 422, 511, 511, 511, 511, 511, 511, 511,
- 511, 141, 556, 556, 576, 576, 511, 511, 511, -198,
- 422, -198, -198, -198, -198, -198, 145, -198, 511, 511,
- 422, 422, 511, 511, 511, 145, -198, 2, -198, -198,
- 392, 511, 511, -198, -11, 511, 511, -11, 324, 124,
- 422, 324, -198, -198, 146, 91, 91, -198, -198, 144,
- 422, 511, -8, -6, -198, 147, -198, -198, 135, 511,
- -198, 150, -198, 151, -198, -198, 151, -198, 430, -198,
- 324, 324, -198, -198, 324, -198, 324, 151, 151, -198,
- 430, 392, -198, 126, 142, 324, 180, 185, -198, 186,
- 174, -198, -198, -198, -198, 202, 187, 199, 203, -3,
- -198, 392, -198, 358, 196, -198, -198, -198, 324, -198,
- -198, -198, -198, -198
+ 210, -49, -192, -192, 434, -192, -43, -192, 644, -192,
+ -192, 35, 146, -192, 41, 20, 54, 434, 25, 50,
+ 59, 60, 66, 434, 434, 434, 434, 434, 10, -192,
+ 11, -192, -192, -192, 13, 14, 466, 622, -192, -192,
+ -192, -192, -192, 16, 434, -192, 622, 434, 434, 434,
+ -192, 33, -192, 68, -192, 73, -192, 80, -192, 1,
+ 15, -192, -192, -192, -192, 480, 101, -192, -20, 434,
+ -18, 82, -192, -192, 61, 524, 61, 61, 573, -192,
+ -192, 271, 466, 434, 466, 83, 600, 434, 434, 434,
+ 434, 434, 434, 434, 434, 434, 434, 434, 434, 434,
+ 434, 434, 480, 622, -11, -4, 51, 121, -192, -192,
+ 122, -192, 126, 127, 112, -192, -192, 130, -192, 434,
+ 434, 502, 434, 434, 434, -192, 434, 434, -192, -192,
+ 76, 622, 78, 546, 81, 434, 622, 622, 622, 622,
+ 622, 622, 622, 622, 266, 266, 61, 61, 622, 622,
+ 622, -192, 434, -192, -192, -192, -192, -192, 136, -192,
+ 622, 622, 434, 434, 622, 622, 622, 136, 622, 622,
+ -192, 5, -192, -192, 404, 622, 622, -192, -10, 622,
+ 622, -10, 332, 113, 434, 332, -192, -192, 137, 85,
+ 85, -192, -192, 134, 434, 622, -5, -9, -192, 145,
+ -192, -192, 124, 622, -192, 138, -192, 143, -192, -192,
+ 143, -192, 466, -192, 332, 332, -192, -192, 332, -192,
+ 332, 143, 143, -192, 466, 404, -192, 128, 129, 332,
+ 149, 150, -192, 156, 144, -192, -192, -192, -192, 161,
+ 148, 163, 167, -6, -192, 404, -192, 368, 157, -192,
+ -192, -192, 332, -192, -192, -192, -192, -192
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -198, -198, -25, 153, 9, -166, 0, -198, -198, -198,
- 43, -173, 20, -77, -198, -198, -198, -197, -7, -168,
- -126, 4, 26, -198, -198, -198, 179, -198, -198, -198,
- 74, 58, -198, 68
+ -192, -192, -26, 104, 7, -170, 0, -192, -192, -192,
+ -3, -178, -28, -79, -192, -192, -192, -191, -7, -47,
+ -165, 2, 23, -192, -192, -192, 135, -192, -192, -192,
+ 30, 8, -192, 21
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -769,140 +775,154 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -61
static const yytype_int16 yytable[] =
{
- 31, 48, 79, 127, 182, 129, 220, 41, 45, 29,
- 189, 201, 204, 192, 193, -51, -51, 77, 179, -10,
- 220, 64, 118, 200, 121, 110, 37, 73, 74, 75,
- 76, 213, 111, 222, 202, 46, 205, 62, 223, 84,
- 180, 112, 119, 181, 122, 222, 226, 101, 227, 229,
- 102, 102, 102, 78, 54, 231, 56, 235, 49, 184,
- 61, -51, 113, 240, 63, 242, 70, 71, 67, 68,
- 210, 211, 120, 69, 214, 249, 216, 65, 66, 31,
- 252, 78, 253, -10, 84, 128, 130, 225, 29, 133,
- 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
- 144, 145, 146, 147, 148, 37, 169, 149, 156, 72,
- 151, 150, 106, 248, 150, 104, 105, 165, 107, 81,
- 80, 51, 158, 159, 170, 162, 163, 164, 52, 47,
- 108, 224, 109, 53, 123, 117, 171, 54, 55, 56,
- 57, 150, 131, 230, 152, 58, 116, 153, 154, 185,
- 155, 157, 186, 112, 172, 166, 168, 78, 173, 194,
- 209, 195, 190, 198, 175, 176, 85, 86, 232, 204,
- 212, 87, 88, 89, 215, 90, 91, 92, 93, 234,
- 94, 95, 96, 97, 191, 203, 85, 86, 98, 99,
- 100, 87, 88, 89, 199, 90, 91, 92, 221, 236,
- 94, 95, 96, 97, 237, 238, -6, 1, 98, 99,
- 100, 239, 84, 2, 3, 4, 5, 6, 7, 8,
- 9, 244, 245, 246, 84, 241, 10, 247, 11, 12,
- 13, 251, 126, 14, 15, 16, 206, 228, 114, 177,
- 17, 18, 19, 250, 197, 20, 0, 0, 0, 21,
- 22, 0, 0, 0, 0, 0, 0, 0, 0, 23,
- 0, 0, 0, 0, 0, 24, 25, 0, 0, 0,
- -6, 26, 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, 85, 86, 0, 21, 22,
- 87, 88, 89, 0, 90, 91, 92, 93, 23, 94,
- 95, 96, 97, 0, 24, 25, 125, 98, 99, 100,
- 26, 2, 3, 4, 5, 6, 7, 42, 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, 2, 3, 4, 5, 6,
- 7, 42, 9, 0, 0, 0, 0, 23, 10, 0,
- 11, 12, 13, 24, 25, 0, 15, 16, 78, 26,
- 0, 0, 17, 18, 19, 0, 0, 20, 0, 2,
- 3, 4, 5, 6, 7, 42, 9, 0, 0, 0,
- 0, 23, 10, 0, 11, 12, 0, 24, 25, 0,
- 15, 16, 0, 26, 0, 0, 17, 0, 19, 2,
- 3, 4, 5, 6, 7, 42, 9, 2, 3, 4,
- 5, 6, 7, 42, 9, 23, 0, 0, 0, 0,
- 0, 24, 25, 0, 0, 0, 43, 26, 19, 0,
- 0, 0, 0, 0, 43, 0, 19, 0, 0, 0,
- 0, 0, 0, 0, 0, 23, 0, 0, 0, 0,
- 0, 24, 25, 23, 160, 0, 0, 26, 0, 24,
- 25, 85, 86, 0, 0, 82, 87, 88, 89, 0,
- 90, 91, 92, 93, 161, 94, 95, 96, 97, 0,
- 0, 85, 86, 98, 99, 100, 87, 88, 89, 0,
- 90, 91, 92, 93, 132, 94, 95, 96, 97, 0,
- 0, 0, 125, 98, 99, 100, 85, 86, 0, 0,
- 0, 87, 88, 89, 0, 90, 91, 92, 93, 132,
- 94, 95, 96, 97, 0, 0, 85, 86, 98, 99,
- 100, 87, 88, 89, 0, 90, 91, 92, 93, 0,
- 94, 95, 96, 97, 0, 0, -60, -60, 98, 99,
- 100, -60, -60, -60, 0, -60, -60, -60, -60, 0,
- 0, 0, -60, -60, 0, 0, 47, 0, -60, -60,
- -60, 85, 86, 0, 0, 0, 87, 88, 89, 0,
- 90, 91, 92, 0, 0, 0, 0, 96, 97, 0,
- 0, 85, 86, 98, 99, 100, 87, 88, 89, 0,
- 90, 91, 92, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 98, 99, 100
+ 32, 49, 81, 130, 186, 132, 46, 30, 185, 208,
+ 79, -10, -51, -51, 205, 111, 224, 42, 119, 65,
+ 122, 183, 112, 38, 47, 74, 75, 76, 77, 78,
+ 224, 113, 226, 209, 63, 214, 215, 206, 86, 218,
+ 120, 220, 123, 184, 226, 55, 102, 57, 50, 103,
+ 103, 103, 229, 114, 62, 235, 80, 151, 68, 69,
+ -51, 152, 188, 70, 153, 66, 67, 64, 152, 105,
+ 106, 121, 71, 72, 83, 253, 80, -10, 252, 73,
+ 82, 32, 108, 48, 86, 131, 133, 109, 30, 136,
+ 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
+ 147, 148, 149, 150, 38, 107, 87, 88, 173, 158,
+ 110, 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, 232, 210, 115, 203, 181, 201, 0,
+ 0, 0, 225, 0, 0, 256, 0, 257, 0, 0,
+ -6, 1, 0, 0, 86, 0, 0, 2, 3, 4,
+ 5, 6, 7, 8, 9, 0, 86, 0, 0, 245,
+ 10, 0, 11, 12, 13, 0, 0, 14, 15, 16,
+ 0, 0, 0, 0, 17, 18, 19, 254, 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
};
static const yytype_int16 yycheck[] =
{
- 0, 8, 27, 80, 170, 82, 203, 64, 4, 0,
- 178, 19, 18, 181, 182, 18, 19, 0, 16, 0,
- 217, 17, 38, 191, 38, 14, 0, 23, 24, 25,
- 26, 199, 21, 206, 42, 65, 42, 14, 206, 35,
- 38, 30, 58, 169, 58, 218, 214, 43, 216, 217,
- 46, 47, 48, 64, 30, 221, 32, 225, 13, 70,
- 13, 64, 38, 231, 13, 233, 13, 13, 8, 9,
- 196, 197, 68, 13, 200, 241, 202, 40, 41, 79,
- 248, 64, 250, 64, 80, 81, 82, 213, 79, 85,
- 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 79, 131, 66, 115, 13,
- 66, 70, 70, 239, 70, 47, 48, 124, 14, 58,
- 65, 14, 118, 119, 131, 121, 122, 123, 21, 65,
- 14, 208, 30, 26, 37, 13, 132, 30, 31, 32,
- 33, 70, 37, 220, 13, 38, 25, 14, 14, 174,
- 14, 13, 177, 30, 150, 66, 66, 64, 13, 13,
- 13, 70, 38, 19, 160, 161, 45, 46, 42, 18,
- 35, 50, 51, 52, 24, 54, 55, 56, 57, 37,
- 59, 60, 61, 62, 180, 192, 45, 46, 67, 68,
- 69, 50, 51, 52, 190, 54, 55, 56, 205, 19,
- 59, 60, 61, 62, 19, 19, 0, 1, 67, 68,
- 69, 37, 208, 7, 8, 9, 10, 11, 12, 13,
- 14, 19, 35, 24, 220, 232, 20, 24, 22, 23,
- 24, 35, 79, 27, 28, 29, 193, 217, 59, 165,
- 34, 35, 36, 243, 186, 39, -1, -1, -1, 43,
- 44, -1, -1, -1, -1, -1, -1, -1, -1, 53,
- -1, -1, -1, -1, -1, 59, 60, -1, -1, -1,
- 64, 65, 7, 8, 9, 10, 11, 12, 13, 14,
- -1, -1, -1, -1, -1, 20, -1, 22, 23, 24,
- -1, -1, 27, 28, 29, -1, -1, -1, -1, 34,
- 35, 36, -1, -1, 39, 45, 46, -1, 43, 44,
- 50, 51, 52, -1, 54, 55, 56, 57, 53, 59,
- 60, 61, 62, -1, 59, 60, 66, 67, 68, 69,
- 65, 7, 8, 9, 10, 11, 12, 13, 14, -1,
- -1, -1, -1, -1, 20, -1, 22, 23, 24, -1,
- -1, -1, 28, 29, -1, -1, -1, -1, 34, 35,
- 36, -1, -1, 39, -1, 7, 8, 9, 10, 11,
- 12, 13, 14, -1, -1, -1, -1, 53, 20, -1,
- 22, 23, 24, 59, 60, -1, 28, 29, 64, 65,
- -1, -1, 34, 35, 36, -1, -1, 39, -1, 7,
+ 0, 8, 28, 82, 174, 84, 4, 0, 173, 18,
+ 0, 0, 18, 19, 19, 14, 207, 66, 38, 17,
+ 38, 16, 21, 0, 67, 23, 24, 25, 26, 27,
+ 221, 30, 210, 42, 14, 200, 201, 42, 36, 204,
+ 60, 206, 60, 38, 222, 30, 44, 32, 13, 47,
+ 48, 49, 217, 38, 13, 225, 66, 68, 8, 9,
+ 66, 72, 72, 13, 68, 40, 41, 13, 72, 48,
+ 49, 69, 13, 13, 60, 245, 66, 66, 243, 13,
+ 67, 81, 14, 67, 82, 83, 84, 14, 81, 87,
+ 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
+ 98, 99, 100, 101, 81, 72, 45, 46, 134, 116,
+ 30, 50, 51, 52, 13, 54, 55, 56, 125, 37,
+ 37, 119, 120, 72, 122, 123, 124, 134, 126, 127,
+ 69, 70, 71, 212, 13, 182, 14, 135, 185, 186,
+ 14, 14, 30, 13, 68, 224, 68, 66, 195, 13,
+ 13, 38, 178, 19, 152, 181, 203, 72, 13, 35,
+ 14, 18, 24, 210, 162, 163, 37, 21, 19, 19,
+ 42, 218, 26, 220, 221, 19, 30, 31, 32, 33,
+ 19, 37, 229, 35, 38, 81, 184, 24, 235, 196,
+ 237, 24, 35, 221, 197, 60, 194, 167, 190, -1,
+ -1, -1, 209, -1, -1, 252, -1, 254, -1, -1,
+ 0, 1, -1, -1, 212, -1, -1, 7, 8, 9,
+ 10, 11, 12, 13, 14, -1, 224, -1, -1, 236,
+ 20, -1, 22, 23, 24, -1, -1, 27, 28, 29,
+ -1, -1, -1, -1, 34, 35, 36, 247, -1, 39,
+ -1, -1, -1, 43, 44, -1, -1, -1, -1, -1,
+ -1, -1, -1, 53, -1, -1, -1, 57, -1, -1,
+ -1, 61, 62, -1, -1, -1, 66, 67, 7, 8,
+ 9, 10, 11, 12, 13, 14, -1, -1, -1, -1,
+ -1, 20, -1, 22, 23, 24, -1, -1, 27, 28,
+ 29, -1, -1, -1, -1, 34, 35, 36, -1, -1,
+ 39, 45, 46, -1, 43, 44, 50, 51, 52, -1,
+ 54, 55, 56, -1, 53, -1, -1, -1, 57, 63,
+ 64, -1, 61, 62, -1, 69, 70, 71, 67, 7,
8, 9, 10, 11, 12, 13, 14, -1, -1, -1,
- -1, 53, 20, -1, 22, 23, -1, 59, 60, -1,
- 28, 29, -1, 65, -1, -1, 34, -1, 36, 7,
- 8, 9, 10, 11, 12, 13, 14, 7, 8, 9,
- 10, 11, 12, 13, 14, 53, -1, -1, -1, -1,
- -1, 59, 60, -1, -1, -1, 34, 65, 36, -1,
- -1, -1, -1, -1, 34, -1, 36, -1, -1, -1,
- -1, -1, -1, -1, -1, 53, -1, -1, -1, -1,
- -1, 59, 60, 53, 38, -1, -1, 65, -1, 59,
- 60, 45, 46, -1, -1, 65, 50, 51, 52, -1,
- 54, 55, 56, 57, 58, 59, 60, 61, 62, -1,
- -1, 45, 46, 67, 68, 69, 50, 51, 52, -1,
- 54, 55, 56, 57, 58, 59, 60, 61, 62, -1,
- -1, -1, 66, 67, 68, 69, 45, 46, -1, -1,
- -1, 50, 51, 52, -1, 54, 55, 56, 57, 58,
- 59, 60, 61, 62, -1, -1, 45, 46, 67, 68,
- 69, 50, 51, 52, -1, 54, 55, 56, 57, -1,
- 59, 60, 61, 62, -1, -1, 45, 46, 67, 68,
- 69, 50, 51, 52, -1, 54, 55, 56, 57, -1,
- -1, -1, 61, 62, -1, -1, 65, -1, 67, 68,
- 69, 45, 46, -1, -1, -1, 50, 51, 52, -1,
- 54, 55, 56, -1, -1, -1, -1, 61, 62, -1,
- -1, 45, 46, 67, 68, 69, 50, 51, 52, -1,
- 54, 55, 56, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 67, 68, 69
+ -1, -1, 20, -1, 22, 23, 24, -1, -1, -1,
+ 28, 29, -1, -1, -1, -1, 34, 35, 36, -1,
+ -1, 39, -1, -1, -1, 7, 8, 9, 10, 11,
+ 12, 13, 14, -1, -1, 53, -1, -1, 20, 57,
+ 22, 23, 24, 61, 62, -1, 28, 29, 66, 67,
+ -1, -1, 34, 35, 36, -1, -1, 39, -1, -1,
+ -1, 7, 8, 9, 10, 11, 12, 13, 14, -1,
+ -1, 53, -1, -1, 20, 57, 22, 23, -1, 61,
+ 62, -1, 28, 29, -1, 67, -1, -1, 34, -1,
+ 36, 7, 8, 9, 10, 11, 12, 13, 14, -1,
+ -1, -1, -1, -1, -1, -1, -1, 53, -1, -1,
+ -1, 57, -1, -1, -1, 61, 62, -1, 34, -1,
+ 36, 67, -1, 7, 8, 9, 10, 11, 12, 13,
+ 14, -1, -1, -1, -1, -1, -1, 53, -1, -1,
+ -1, 57, -1, -1, -1, 61, 62, -1, -1, -1,
+ 34, 67, 36, -1, -1, 25, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 53,
+ -1, -1, -1, 57, -1, 45, 46, 61, 62, -1,
+ 50, 51, 52, 67, 54, 55, 56, -1, -1, -1,
+ 38, 61, 62, 63, 64, -1, -1, 45, 46, 69,
+ 70, 71, 50, 51, 52, -1, 54, 55, 56, -1,
+ -1, -1, 60, 61, 62, 63, 64, -1, -1, 45,
+ 46, 69, 70, 71, 50, 51, 52, -1, 54, 55,
+ 56, -1, 58, 59, -1, 61, 62, 63, 64, -1,
+ -1, 45, 46, 69, 70, 71, 50, 51, 52, -1,
+ 54, 55, 56, -1, -1, -1, 60, 61, 62, 63,
+ 64, -1, -1, -1, 68, 69, 70, 71, 45, 46,
+ -1, -1, -1, 50, 51, 52, -1, 54, 55, 56,
+ -1, -1, -1, -1, 61, 62, 63, 64, -1, -1,
+ -1, 68, 69, 70, 71, 45, 46, -1, -1, -1,
+ 50, 51, 52, -1, 54, 55, 56, -1, -1, -1,
+ 60, 61, 62, 63, 64, -1, -1, 45, 46, 69,
+ 70, 71, 50, 51, 52, -1, 54, 55, 56, -1,
+ -1, -1, -1, 61, 62, 63, 64, -1, -1, 45,
+ 46, 69, 70, 71, 50, 51, 52, -1, 54, 55,
+ 56, -1, -1, -1, -1, -1, -1, 63, 64, -1,
+ -1, 67, -1, 69, 70, 71
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -911,30 +931,30 @@ static const yytype_uint8 yystos[] =
{
0, 1, 7, 8, 9, 10, 11, 12, 13, 14,
20, 22, 23, 24, 27, 28, 29, 34, 35, 36,
- 39, 43, 44, 53, 59, 60, 65, 72, 74, 75,
- 76, 77, 78, 85, 86, 87, 92, 93, 95, 98,
- 103, 64, 13, 34, 75, 92, 65, 65, 89, 13,
- 94, 14, 21, 26, 30, 31, 32, 33, 38, 96,
- 97, 13, 14, 13, 92, 40, 41, 8, 9, 13,
- 13, 13, 13, 92, 92, 92, 92, 0, 64, 73,
- 65, 58, 65, 84, 92, 45, 46, 50, 51, 52,
- 54, 55, 56, 57, 59, 60, 61, 62, 67, 68,
- 69, 92, 92, 104, 104, 104, 70, 14, 14, 30,
- 14, 21, 30, 38, 97, 99, 25, 13, 38, 58,
- 92, 38, 58, 37, 100, 66, 74, 84, 92, 84,
- 92, 37, 58, 92, 92, 92, 92, 92, 92, 92,
- 92, 92, 92, 92, 92, 92, 92, 92, 92, 66,
- 70, 66, 13, 14, 14, 14, 89, 13, 92, 92,
- 38, 58, 92, 92, 92, 89, 66, 90, 66, 73,
- 89, 92, 92, 13, 101, 92, 92, 101, 91, 16,
- 38, 91, 76, 93, 70, 73, 73, 73, 77, 90,
- 38, 92, 90, 90, 13, 70, 102, 102, 19, 92,
- 90, 19, 42, 89, 18, 42, 81, 82, 88, 13,
- 91, 91, 35, 90, 91, 24, 91, 80, 81, 83,
- 88, 89, 82, 90, 84, 91, 90, 90, 83, 90,
- 84, 76, 42, 79, 37, 90, 19, 19, 19, 37,
- 90, 89, 90, 89, 19, 35, 24, 24, 91, 76,
- 77, 35, 90, 90
+ 39, 43, 44, 53, 57, 61, 62, 67, 74, 76,
+ 77, 78, 79, 80, 87, 88, 89, 94, 95, 97,
+ 100, 105, 66, 13, 34, 77, 94, 67, 67, 91,
+ 13, 96, 14, 21, 26, 30, 31, 32, 33, 38,
+ 98, 99, 13, 14, 13, 94, 40, 41, 8, 9,
+ 13, 13, 13, 13, 94, 94, 94, 94, 94, 0,
+ 66, 75, 67, 60, 67, 86, 94, 45, 46, 50,
+ 51, 52, 54, 55, 56, 61, 62, 63, 64, 69,
+ 70, 71, 94, 94, 106, 106, 106, 72, 14, 14,
+ 30, 14, 21, 30, 38, 99, 101, 25, 13, 38,
+ 60, 94, 38, 60, 37, 102, 58, 59, 68, 76,
+ 86, 94, 86, 94, 37, 60, 94, 94, 94, 94,
+ 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+ 94, 68, 72, 68, 13, 14, 14, 14, 91, 13,
+ 94, 94, 38, 60, 94, 94, 94, 91, 94, 94,
+ 68, 92, 68, 75, 91, 94, 94, 13, 103, 94,
+ 94, 103, 93, 16, 38, 93, 78, 95, 72, 75,
+ 75, 75, 79, 92, 38, 94, 92, 92, 13, 72,
+ 104, 104, 19, 94, 92, 19, 42, 91, 18, 42,
+ 83, 84, 90, 13, 93, 93, 35, 92, 93, 24,
+ 93, 82, 83, 85, 90, 91, 84, 92, 86, 93,
+ 92, 92, 85, 92, 86, 78, 42, 81, 37, 92,
+ 19, 19, 19, 37, 92, 91, 92, 91, 19, 35,
+ 24, 24, 93, 78, 79, 35, 92, 92
};
#define yyerrok (yyerrstatus = 0)
@@ -1749,12 +1769,12 @@ yyreduce:
switch (yyn)
{
case 4:
-#line 104 "engines/director/lingo/lingo-gr.y"
+#line 103 "engines/director/lingo/lingo-gr.y"
{ yyerrok; ;}
break;
case 5:
-#line 107 "engines/director/lingo/lingo-gr.y"
+#line 106 "engines/director/lingo/lingo-gr.y"
{
g_lingo->_linenumber++;
g_lingo->_colnumber = 1;
@@ -1762,12 +1782,12 @@ yyreduce:
break;
case 10:
-#line 116 "engines/director/lingo/lingo-gr.y"
+#line 115 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 12:
-#line 120 "engines/director/lingo/lingo-gr.y"
+#line 119 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str());
@@ -1777,7 +1797,7 @@ yyreduce:
break;
case 13:
-#line 126 "engines/director/lingo/lingo-gr.y"
+#line 125 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1787,7 +1807,7 @@ yyreduce:
break;
case 14:
-#line 132 "engines/director/lingo/lingo-gr.y"
+#line 131 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id
g_lingo->code1(g_lingo->c_theentityassign);
@@ -1799,7 +1819,7 @@ yyreduce:
break;
case 15:
-#line 140 "engines/director/lingo/lingo-gr.y"
+#line 139 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_swap);
g_lingo->code1(g_lingo->c_theentityassign);
@@ -1811,7 +1831,7 @@ yyreduce:
break;
case 16:
-#line 148 "engines/director/lingo/lingo-gr.y"
+#line 147 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1821,7 +1841,7 @@ yyreduce:
break;
case 17:
-#line 154 "engines/director/lingo/lingo-gr.y"
+#line 153 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id
g_lingo->code1(g_lingo->c_theentityassign);
@@ -1833,7 +1853,7 @@ yyreduce:
break;
case 18:
-#line 162 "engines/director/lingo/lingo-gr.y"
+#line 161 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_swap);
g_lingo->code1(g_lingo->c_theentityassign);
@@ -1845,12 +1865,12 @@ yyreduce:
break;
case 19:
-#line 171 "engines/director/lingo/lingo-gr.y"
+#line 170 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 23:
-#line 180 "engines/director/lingo/lingo-gr.y"
+#line 179 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1860,7 +1880,7 @@ yyreduce:
break;
case 24:
-#line 191 "engines/director/lingo/lingo-gr.y"
+#line 190 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1876,7 +1896,7 @@ yyreduce:
break;
case 25:
-#line 207 "engines/director/lingo/lingo-gr.y"
+#line 206 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1892,14 +1912,14 @@ yyreduce:
break;
case 26:
-#line 219 "engines/director/lingo/lingo-gr.y"
+#line 218 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_ifcode);
;}
break;
case 27:
-#line 224 "engines/director/lingo/lingo-gr.y"
+#line 223 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (8)].code));
@@ -1910,7 +1930,7 @@ yyreduce:
break;
case 28:
-#line 231 "engines/director/lingo/lingo-gr.y"
+#line 230 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1923,7 +1943,7 @@ yyreduce:
break;
case 29:
-#line 240 "engines/director/lingo/lingo-gr.y"
+#line 239 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1936,7 +1956,7 @@ yyreduce:
break;
case 30:
-#line 249 "engines/director/lingo/lingo-gr.y"
+#line 248 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1950,7 +1970,7 @@ yyreduce:
break;
case 31:
-#line 259 "engines/director/lingo/lingo-gr.y"
+#line 258 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1964,7 +1984,7 @@ yyreduce:
break;
case 32:
-#line 269 "engines/director/lingo/lingo-gr.y"
+#line 268 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1978,17 +1998,17 @@ yyreduce:
break;
case 33:
-#line 280 "engines/director/lingo/lingo-gr.y"
+#line 279 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = 0; ;}
break;
case 34:
-#line 281 "engines/director/lingo/lingo-gr.y"
+#line 280 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 39:
-#line 292 "engines/director/lingo/lingo-gr.y"
+#line 291 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1998,7 +2018,7 @@ yyreduce:
break;
case 41:
-#line 301 "engines/director/lingo/lingo-gr.y"
+#line 300 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
@@ -2008,22 +2028,22 @@ yyreduce:
break;
case 42:
-#line 309 "engines/director/lingo/lingo-gr.y"
+#line 308 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
case 43:
-#line 310 "engines/director/lingo/lingo-gr.y"
+#line 309 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
case 45:
-#line 313 "engines/director/lingo/lingo-gr.y"
+#line 312 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
case 46:
-#line 315 "engines/director/lingo/lingo-gr.y"
+#line 314 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -2032,7 +2052,7 @@ yyreduce:
break;
case 47:
-#line 321 "engines/director/lingo/lingo-gr.y"
+#line 320 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -2041,7 +2061,7 @@ yyreduce:
break;
case 48:
-#line 327 "engines/director/lingo/lingo-gr.y"
+#line 326 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -2051,22 +2071,22 @@ yyreduce:
break;
case 49:
-#line 334 "engines/director/lingo/lingo-gr.y"
+#line 333 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 50:
-#line 336 "engines/director/lingo/lingo-gr.y"
+#line 335 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 51:
-#line 338 "engines/director/lingo/lingo-gr.y"
+#line 337 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 54:
-#line 343 "engines/director/lingo/lingo-gr.y"
+#line 342 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -2075,21 +2095,21 @@ yyreduce:
break;
case 55:
-#line 348 "engines/director/lingo/lingo-gr.y"
+#line 347 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
case 56:
-#line 351 "engines/director/lingo/lingo-gr.y"
+#line 350 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_stringpush);
g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;}
break;
case 57:
-#line 354 "engines/director/lingo/lingo-gr.y"
+#line 353 "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));
@@ -2099,14 +2119,14 @@ yyreduce:
break;
case 58:
-#line 360 "engines/director/lingo/lingo-gr.y"
+#line 359 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->_builtins[*(yyvsp[(1) - (1)].s)]->func);
delete (yyvsp[(1) - (1)].s); ;}
break;
case 59:
-#line 363 "engines/director/lingo/lingo-gr.y"
+#line 362 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -2118,14 +2138,14 @@ yyreduce:
break;
case 60:
-#line 371 "engines/director/lingo/lingo-gr.y"
+#line 370 "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"
+#line 373 "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);
@@ -2136,7 +2156,7 @@ yyreduce:
break;
case 62:
-#line 381 "engines/director/lingo/lingo-gr.y"
+#line 380 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_theentitypush);
inst e = 0, f = 0;
@@ -2146,152 +2166,157 @@ yyreduce:
break;
case 64:
-#line 388 "engines/director/lingo/lingo-gr.y"
+#line 387 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
case 65:
-#line 389 "engines/director/lingo/lingo-gr.y"
+#line 388 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
case 66:
-#line 390 "engines/director/lingo/lingo-gr.y"
+#line 389 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
case 67:
-#line 391 "engines/director/lingo/lingo-gr.y"
+#line 390 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
case 68:
-#line 392 "engines/director/lingo/lingo-gr.y"
+#line 391 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
case 69:
-#line 393 "engines/director/lingo/lingo-gr.y"
+#line 392 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
case 70:
-#line 394 "engines/director/lingo/lingo-gr.y"
+#line 393 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
case 71:
-#line 395 "engines/director/lingo/lingo-gr.y"
+#line 394 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
case 72:
-#line 396 "engines/director/lingo/lingo-gr.y"
+#line 395 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
case 73:
-#line 397 "engines/director/lingo/lingo-gr.y"
+#line 396 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_and); ;}
break;
case 74:
-#line 398 "engines/director/lingo/lingo-gr.y"
+#line 397 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_or); ;}
break;
case 75:
-#line 399 "engines/director/lingo/lingo-gr.y"
+#line 398 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_not); ;}
break;
case 76:
-#line 400 "engines/director/lingo/lingo-gr.y"
+#line 399 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ampersand); ;}
break;
case 77:
-#line 401 "engines/director/lingo/lingo-gr.y"
+#line 400 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_concat); ;}
break;
case 78:
-#line 402 "engines/director/lingo/lingo-gr.y"
+#line 401 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_contains); ;}
break;
case 79:
-#line 403 "engines/director/lingo/lingo-gr.y"
+#line 402 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_starts); ;}
break;
case 80:
-#line 404 "engines/director/lingo/lingo-gr.y"
- { g_lingo->code1(g_lingo->c_intersects); ;}
+#line 403 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 81:
-#line 405 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (2)].code); ;}
+#line 404 "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"
- { (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
+#line 405 "engines/director/lingo/lingo-gr.y"
+ { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 83:
-#line 407 "engines/director/lingo/lingo-gr.y"
- { (yyval.code) = (yyvsp[(2) - (3)].code); ;}
+#line 406 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_intersects); ;}
break;
case 84:
+#line 407 "engines/director/lingo/lingo-gr.y"
+ { g_lingo->code1(g_lingo->c_within); ;}
+ break;
+
+ case 85:
#line 410 "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 85:
+ case 86:
#line 411 "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 86:
+ case 87:
#line 412 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
- case 88:
+ case 89:
#line 414 "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 90:
+ case 91:
#line 419 "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 91:
+ case 92:
#line 420 "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 92:
+ case 93:
#line 431 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
- case 93:
+ case 94:
#line 432 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
- case 94:
+ case 95:
#line 433 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
- case 95:
+ case 96:
#line 434 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
@@ -2300,7 +2325,7 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 96:
+ case 97:
#line 439 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
@@ -2310,7 +2335,7 @@ yyreduce:
delete (yyvsp[(3) - (3)].s); ;}
break;
- case 97:
+ case 98:
#line 445 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
@@ -2319,47 +2344,47 @@ yyreduce:
delete (yyvsp[(2) - (2)].s); ;}
break;
- case 98:
+ case 99:
#line 452 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 99:
+ case 100:
#line 453 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 100:
+ case 101:
#line 454 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 101:
+ case 102:
#line 455 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
- case 102:
+ case 103:
#line 458 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 103:
+ case 104:
#line 459 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
- case 104:
+ case 105:
#line 460 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
- case 105:
+ case 106:
#line 488 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 106:
+ case 107:
#line 489 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
@@ -2368,19 +2393,19 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 107:
+ case 108:
#line 494 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeFactory(*(yyvsp[(2) - (2)].s));
;}
break;
- case 108:
+ case 109:
#line 497 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
- case 109:
+ case 110:
#line 498 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
@@ -2389,32 +2414,32 @@ yyreduce:
g_lingo->_indef = false; ;}
break;
- case 110:
+ case 111:
#line 503 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 111:
+ case 112:
#line 504 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
- case 112:
+ case 113:
#line 505 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
- case 113:
+ case 114:
#line 506 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
- case 114:
+ case 115:
#line 508 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
- case 115:
+ case 116:
#line 512 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
@@ -2424,24 +2449,24 @@ yyreduce:
g_lingo->code1(numpar); ;}
break;
- case 116:
+ case 117:
#line 520 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
- case 117:
+ case 118:
#line 521 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
- case 118:
+ case 119:
#line 522 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2445 "engines/director/lingo/lingo-gr.cpp"
+#line 2470 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 425c574..5044eac 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -93,7 +93,9 @@
tCONCAT = 309,
tCONTAINS = 310,
tSTARTS = 311,
- tINTERSECTS = 312
+ tSPRITE = 312,
+ tINTERSECTS = 313,
+ tWITHIN = 314
};
#endif
/* Tokens. */
@@ -151,7 +153,9 @@
#define tCONCAT 309
#define tCONTAINS 310
#define tSTARTS 311
-#define tINTERSECTS 312
+#define tSPRITE 312
+#define tINTERSECTS 313
+#define tWITHIN 314
@@ -168,7 +172,7 @@ typedef union YYSTYPE
int narg; /* number of arguments */
}
/* Line 1529 of yacc.c. */
-#line 172 "engines/director/lingo/lingo-gr.hpp"
+#line 176 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index f949544..033b7dd 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -85,14 +85,13 @@ void yyerror(char *s) {
%token tWITH tWHILE tNLELSE tFACTORY tMETHOD
%token tGE tLE tGT tLT tEQ tNEQ tAND tOR tNOT
%token tCONCAT tCONTAINS tSTARTS
-%token tINTERSECTS
+%token tSPRITE tINTERSECTS tWITHIN
%type<code> asgn begin elseif elsestmtoneliner end expr if repeatwhile repeatwith stmtlist
%type<s> gotoframe gotomovie
%type<narg> argdef arglist
%right '='
-%left tINTERSECTS
%left '+' '-'
%left '*' '/' '%'
%right UNARY
@@ -401,10 +400,11 @@ expr: INT {
| expr tCONCAT expr { g_lingo->code1(g_lingo->c_concat); }
| expr tCONTAINS expr { g_lingo->code1(g_lingo->c_contains); }
| expr tSTARTS expr { g_lingo->code1(g_lingo->c_starts); }
- | expr tINTERSECTS expr { g_lingo->code1(g_lingo->c_intersects); }
| '+' expr %prec UNARY { $$ = $2; }
| '-' expr %prec UNARY { $$ = $2; g_lingo->code1(g_lingo->c_negate); }
| '(' expr ')' { $$ = $2; }
+ | tSPRITE expr tINTERSECTS expr { g_lingo->code1(g_lingo->c_intersects); }
+ | tSPRITE expr tWITHIN expr { g_lingo->code1(g_lingo->c_within); }
;
func: tMCI STRING { g_lingo->code1(g_lingo->c_mci); g_lingo->codeString($2->c_str()); delete $2; }
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index 2089bf1..4ffa450 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 52
-#define YY_END_OF_BUFFER 53
+#define YY_NUM_RULES 54
+#define YY_END_OF_BUFFER 55
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -373,27 +373,28 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[179] =
+static yyconst flex_int16_t yy_accept[186] =
{ 0,
- 0, 0, 53, 51, 3, 49, 49, 51, 51, 48,
- 48, 48, 47, 48, 48, 45, 45, 45, 45, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
- 45, 45, 2, 2, 3, 49, 0, 0, 49, 0,
- 0, 50, 44, 1, 46, 47, 43, 41, 42, 45,
- 45, 45, 45, 45, 45, 45, 45, 45, 45, 16,
- 7, 45, 45, 45, 45, 45, 45, 45, 45, 27,
- 28, 45, 45, 45, 45, 45, 45, 37, 45, 45,
- 2, 2, 0, 1, 46, 4, 45, 45, 45, 11,
- 45, 45, 45, 45, 45, 45, 45, 21, 45, 45,
-
- 45, 26, 45, 30, 45, 32, 45, 45, 45, 45,
- 45, 0, 45, 6, 10, 13, 45, 45, 45, 45,
- 18, 19, 45, 45, 45, 45, 25, 45, 45, 45,
- 0, 36, 39, 45, 38, 9, 45, 45, 14, 45,
- 45, 20, 45, 45, 24, 45, 45, 45, 35, 40,
- 0, 45, 45, 15, 45, 45, 23, 45, 31, 33,
- 0, 0, 45, 12, 45, 22, 45, 0, 8, 5,
- 45, 29, 0, 45, 0, 17, 34, 0
+ 0, 0, 55, 53, 3, 51, 51, 53, 53, 50,
+ 50, 50, 49, 50, 50, 47, 47, 47, 47, 47,
+ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
+ 47, 47, 2, 2, 3, 51, 0, 0, 51, 0,
+ 0, 52, 46, 1, 48, 49, 45, 43, 44, 47,
+ 47, 47, 47, 47, 47, 47, 47, 47, 47, 16,
+ 7, 47, 47, 47, 47, 47, 47, 47, 47, 27,
+ 28, 47, 47, 47, 47, 47, 47, 47, 37, 47,
+ 47, 2, 2, 0, 1, 48, 4, 47, 47, 47,
+ 11, 47, 47, 47, 47, 47, 47, 47, 21, 47,
+
+ 47, 47, 26, 47, 30, 47, 32, 47, 47, 47,
+ 47, 47, 47, 0, 47, 6, 10, 13, 47, 47,
+ 47, 47, 18, 19, 47, 47, 47, 47, 25, 47,
+ 47, 47, 47, 0, 36, 41, 47, 39, 9, 47,
+ 47, 14, 47, 47, 20, 47, 47, 24, 47, 47,
+ 47, 47, 35, 42, 47, 0, 47, 47, 15, 47,
+ 47, 23, 47, 31, 38, 33, 0, 40, 0, 47,
+ 12, 47, 22, 47, 0, 8, 5, 47, 29, 0,
+ 47, 0, 17, 34, 0
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -438,55 +439,55 @@ static yyconst flex_int32_t yy_meta[61] =
6, 6, 6, 6, 6, 6, 6, 6, 6, 6
} ;
-static yyconst flex_int16_t yy_base[184] =
+static yyconst flex_int16_t yy_base[191] =
{ 0,
- 0, 59, 268, 426, 63, 67, 71, 75, 252, 426,
- 224, 181, 52, 68, 132, 56, 0, 56, 57, 67,
- 72, 68, 68, 69, 112, 70, 79, 103, 81, 103,
- 106, 115, 139, 145, 162, 101, 166, 170, 174, 135,
- 133, 426, 426, 0, 90, 163, 426, 426, 426, 0,
- 112, 153, 146, 151, 166, 162, 169, 172, 163, 0,
- 0, 160, 167, 171, 173, 166, 165, 164, 169, 0,
- 0, 183, 174, 178, 184, 204, 206, 0, 208, 201,
- 232, 242, 207, 0, 80, 0, 208, 214, 209, 0,
- 210, 216, 224, 237, 238, 230, 230, 227, 232, 244,
-
- 237, 0, 236, 0, 253, 0, 244, 274, 248, 255,
- 262, 267, 272, 0, 0, 0, 262, 269, 279, 269,
- 0, 0, 272, 280, 274, 285, 0, 282, 291, 277,
- 192, 0, 0, 288, 0, 312, 292, 290, 0, 296,
- 295, 0, 293, 309, 0, 305, 302, 304, 336, 0,
- 340, 309, 300, 0, 327, 316, 0, 317, 0, 0,
- 350, 333, 330, 0, 345, 0, 334, 346, 426, 0,
- 336, 0, 362, 338, 370, 0, 374, 426, 401, 403,
- 409, 414, 419
+ 0, 59, 210, 446, 63, 67, 71, 75, 192, 446,
+ 150, 148, 52, 68, 137, 56, 0, 56, 57, 67,
+ 72, 68, 68, 69, 112, 70, 79, 103, 81, 109,
+ 120, 121, 170, 174, 178, 101, 182, 186, 190, 97,
+ 143, 446, 446, 0, 90, 124, 446, 446, 446, 0,
+ 112, 110, 104, 115, 147, 167, 179, 182, 119, 0,
+ 0, 167, 172, 184, 179, 172, 173, 172, 179, 0,
+ 0, 193, 183, 187, 185, 188, 198, 200, 0, 205,
+ 200, 242, 254, 211, 0, 80, 0, 217, 223, 232,
+ 0, 221, 222, 234, 245, 243, 235, 236, 232, 246,
+
+ 246, 242, 0, 244, 0, 260, 0, 257, 252, 279,
+ 261, 266, 273, 277, 283, 0, 0, 0, 272, 283,
+ 292, 279, 0, 0, 282, 297, 287, 294, 0, 293,
+ 302, 289, 292, 201, 0, 0, 299, 302, 325, 305,
+ 304, 0, 310, 308, 0, 320, 327, 0, 320, 318,
+ 327, 320, 351, 0, 327, 358, 328, 322, 0, 342,
+ 332, 0, 332, 0, 0, 0, 370, 0, 346, 337,
+ 0, 359, 0, 348, 360, 446, 0, 351, 0, 384,
+ 353, 390, 0, 391, 446, 421, 423, 429, 434, 439
} ;
-static yyconst flex_int16_t yy_def[184] =
+static yyconst flex_int16_t yy_def[191] =
{ 0,
- 178, 1, 178, 178, 178, 178, 178, 178, 179, 178,
- 178, 178, 178, 178, 178, 180, 180, 180, 180, 180,
- 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
- 180, 180, 178, 178, 178, 178, 178, 178, 178, 178,
- 179, 178, 178, 181, 178, 178, 178, 178, 178, 180,
- 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
- 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
- 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
- 178, 178, 178, 181, 178, 180, 180, 180, 180, 180,
- 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
-
- 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
- 180, 178, 180, 180, 180, 180, 180, 180, 180, 180,
- 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
- 182, 180, 180, 180, 180, 178, 180, 180, 180, 180,
- 180, 180, 180, 180, 180, 180, 180, 180, 182, 180,
- 178, 180, 180, 180, 180, 180, 180, 180, 180, 180,
- 178, 178, 180, 180, 180, 180, 180, 178, 178, 180,
- 180, 180, 178, 180, 183, 180, 183, 0, 178, 178,
- 178, 178, 178
+ 185, 1, 185, 185, 185, 185, 185, 185, 186, 185,
+ 185, 185, 185, 185, 185, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 185, 185, 185, 185, 185, 185, 185, 185,
+ 186, 185, 185, 188, 185, 185, 185, 185, 185, 187,
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 185, 185, 185, 188, 185, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 185, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 187, 189, 187, 187, 187, 187, 185, 187,
+ 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
+ 187, 187, 189, 187, 187, 185, 187, 187, 187, 187,
+ 187, 187, 187, 187, 187, 187, 185, 187, 185, 187,
+ 187, 187, 187, 187, 185, 185, 187, 187, 187, 185,
+ 187, 190, 187, 190, 0, 185, 185, 185, 185, 185
} ;
-static yyconst flex_int16_t yy_nxt[487] =
+static yyconst flex_int16_t yy_nxt[507] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
13, 14, 10, 15, 16, 17, 18, 19, 20, 21,
@@ -497,53 +498,56 @@ static yyconst flex_int16_t yy_nxt[487] =
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, 68, 40,
- 85, 54, 59, 55, 62, 60, 63, 69, 70, 74,
+ 86, 54, 59, 55, 62, 60, 63, 69, 70, 74,
- 85, 58, 56, 36, 36, 51, 52, 53, 71, 40,
+ 86, 58, 56, 36, 36, 51, 52, 53, 71, 40,
57, 61, 68, 40, 54, 59, 55, 62, 60, 63,
- 69, 75, 70, 74, 58, 56, 64, 77, 65, 86,
- 66, 71, 72, 78, 76, 73, 79, 80, 42, 67,
- 81, 36, 36, 82, 49, 75, 82, 36, 36, 82,
- 64, 77, 65, 86, 66, 72, 78, 76, 73, 83,
- 79, 80, 67, 35, 36, 36, 37, 37, 36, 36,
- 37, 38, 45, 46, 38, 38, 39, 39, 38, 87,
- 88, 89, 83, 90, 91, 92, 93, 97, 40, 44,
- 94, 95, 40, 131, 96, 98, 131, 99, 100, 101,
-
- 102, 103, 87, 88, 89, 104, 105, 90, 91, 92,
- 93, 97, 40, 94, 95, 106, 40, 96, 107, 98,
- 99, 100, 101, 102, 108, 103, 109, 115, 104, 105,
- 110, 43, 111, 81, 36, 36, 82, 112, 106, 113,
- 114, 116, 107, 82, 36, 36, 82, 117, 108, 118,
- 109, 115, 119, 125, 110, 111, 120, 42, 122, 123,
- 112, 124, 113, 114, 116, 121, 126, 178, 127, 128,
- 117, 129, 118, 130, 133, 131, 119, 125, 131, 134,
- 120, 122, 123, 135, 124, 136, 137, 139, 121, 138,
- 126, 127, 128, 140, 143, 129, 130, 133, 141, 142,
-
- 132, 144, 134, 145, 146, 147, 150, 135, 148, 136,
- 137, 139, 138, 151, 152, 156, 151, 140, 143, 153,
- 154, 141, 142, 132, 144, 155, 157, 145, 146, 147,
- 150, 148, 158, 159, 160, 163, 164, 161, 152, 156,
- 161, 151, 153, 154, 151, 165, 178, 166, 155, 167,
- 157, 161, 169, 178, 161, 158, 159, 160, 163, 164,
- 170, 171, 162, 175, 172, 173, 175, 174, 176, 165,
- 166, 175, 167, 178, 175, 178, 169, 168, 178, 178,
- 178, 178, 178, 170, 178, 171, 162, 172, 178, 173,
- 174, 176, 178, 178, 178, 178, 178, 178, 178, 178,
-
- 168, 41, 41, 178, 41, 41, 41, 50, 50, 84,
- 84, 178, 178, 84, 84, 149, 178, 178, 178, 149,
- 177, 178, 178, 178, 177, 3, 178, 178, 178, 178,
- 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
- 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
- 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
- 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
- 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
- 178, 178, 178, 178, 178, 178
+ 69, 84, 70, 74, 58, 56, 64, 75, 65, 87,
+ 66, 71, 72, 45, 46, 73, 88, 76, 89, 67,
+ 77, 78, 80, 81, 84, 90, 95, 79, 42, 49,
+ 64, 75, 65, 87, 66, 72, 44, 43, 73, 88,
+ 76, 89, 67, 77, 91, 78, 80, 81, 90, 95,
+ 79, 82, 36, 36, 83, 83, 36, 36, 83, 35,
+ 36, 36, 37, 37, 36, 36, 37, 38, 91, 92,
+ 38, 38, 39, 39, 38, 93, 94, 42, 96, 97,
+
+ 98, 99, 134, 100, 40, 134, 101, 102, 40, 185,
+ 103, 104, 109, 92, 105, 106, 107, 108, 110, 93,
+ 94, 96, 97, 111, 98, 99, 100, 112, 40, 101,
+ 102, 113, 40, 103, 185, 104, 109, 105, 106, 107,
+ 108, 114, 110, 82, 36, 36, 83, 111, 115, 116,
+ 117, 112, 118, 119, 113, 83, 36, 36, 83, 120,
+ 121, 122, 185, 124, 114, 125, 126, 127, 128, 185,
+ 123, 115, 116, 129, 117, 118, 119, 130, 131, 132,
+ 134, 133, 120, 134, 121, 122, 124, 136, 125, 126,
+ 137, 127, 128, 123, 138, 139, 129, 140, 185, 141,
+
+ 130, 142, 131, 132, 133, 135, 143, 185, 144, 145,
+ 136, 146, 148, 137, 147, 149, 150, 154, 138, 139,
+ 151, 140, 141, 152, 155, 142, 156, 157, 135, 156,
+ 143, 144, 145, 158, 159, 146, 148, 147, 160, 149,
+ 150, 154, 161, 151, 162, 165, 152, 163, 155, 164,
+ 166, 157, 167, 168, 170, 167, 158, 159, 171, 156,
+ 172, 160, 156, 173, 174, 176, 161, 177, 162, 165,
+ 163, 167, 164, 166, 167, 178, 168, 170, 179, 180,
+ 169, 171, 181, 183, 172, 182, 173, 174, 182, 176,
+ 177, 182, 185, 185, 182, 185, 185, 175, 185, 178,
+
+ 185, 179, 185, 180, 169, 181, 183, 185, 185, 185,
+ 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
+ 175, 41, 41, 185, 41, 41, 41, 50, 50, 85,
+ 85, 185, 185, 85, 85, 153, 185, 185, 185, 153,
+ 184, 185, 185, 185, 184, 3, 185, 185, 185, 185,
+ 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
+ 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
+ 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
+ 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
+ 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
+
+ 185, 185, 185, 185, 185, 185
} ;
-static yyconst flex_int16_t yy_chk[487] =
+static yyconst flex_int16_t yy_chk[507] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -554,50 +558,53 @@ static yyconst flex_int16_t yy_chk[487] =
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, 26, 7,
- 85, 20, 22, 20, 23, 22, 24, 26, 27, 29,
+ 86, 20, 22, 20, 23, 22, 24, 26, 27, 29,
45, 21, 20, 36, 36, 16, 18, 19, 27, 6,
21, 23, 26, 7, 20, 22, 20, 23, 22, 24,
- 26, 30, 27, 29, 21, 20, 25, 31, 25, 51,
- 25, 27, 28, 31, 30, 28, 32, 32, 41, 25,
- 33, 33, 33, 33, 15, 30, 34, 34, 34, 34,
- 25, 31, 25, 51, 25, 28, 31, 30, 28, 40,
- 32, 32, 25, 35, 35, 35, 35, 37, 37, 37,
- 37, 38, 46, 46, 38, 39, 39, 39, 39, 52,
- 53, 54, 40, 55, 56, 57, 58, 64, 38, 12,
- 59, 62, 39, 131, 63, 65, 131, 66, 67, 68,
-
- 69, 72, 52, 53, 54, 73, 74, 55, 56, 57,
- 58, 64, 38, 59, 62, 75, 39, 63, 76, 65,
- 66, 67, 68, 69, 77, 72, 79, 89, 73, 74,
- 79, 11, 80, 81, 81, 81, 81, 83, 75, 87,
- 88, 91, 76, 82, 82, 82, 82, 92, 77, 93,
- 79, 89, 94, 99, 79, 80, 95, 9, 96, 97,
- 83, 98, 87, 88, 91, 95, 100, 3, 101, 103,
- 92, 105, 93, 107, 109, 108, 94, 99, 108, 110,
- 95, 96, 97, 111, 98, 112, 113, 118, 95, 117,
- 100, 101, 103, 119, 124, 105, 107, 109, 120, 123,
-
- 108, 125, 110, 126, 128, 129, 134, 111, 130, 112,
- 113, 118, 117, 136, 137, 143, 136, 119, 124, 138,
- 140, 120, 123, 108, 125, 141, 144, 126, 128, 129,
- 134, 130, 146, 147, 148, 152, 153, 149, 137, 143,
- 149, 151, 138, 140, 151, 155, 0, 156, 141, 158,
- 144, 161, 162, 0, 161, 146, 147, 148, 152, 153,
- 163, 165, 151, 173, 167, 168, 173, 171, 174, 155,
- 156, 175, 158, 0, 175, 177, 162, 161, 177, 0,
- 0, 0, 0, 163, 0, 165, 151, 167, 0, 168,
- 171, 174, 0, 0, 0, 0, 0, 0, 0, 0,
-
- 161, 179, 179, 0, 179, 179, 179, 180, 180, 181,
- 181, 0, 0, 181, 181, 182, 0, 0, 0, 182,
- 183, 0, 0, 0, 183, 178, 178, 178, 178, 178,
- 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
- 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
- 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
- 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
- 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
- 178, 178, 178, 178, 178, 178
+ 26, 40, 27, 29, 21, 20, 25, 30, 25, 51,
+ 25, 27, 28, 46, 46, 28, 52, 30, 53, 25,
+ 30, 31, 32, 32, 40, 54, 59, 31, 41, 15,
+ 25, 30, 25, 51, 25, 28, 12, 11, 28, 52,
+ 30, 53, 25, 30, 55, 31, 32, 32, 54, 59,
+ 31, 33, 33, 33, 33, 34, 34, 34, 34, 35,
+ 35, 35, 35, 37, 37, 37, 37, 38, 55, 56,
+ 38, 39, 39, 39, 39, 57, 58, 9, 62, 63,
+
+ 64, 65, 134, 66, 38, 134, 67, 68, 39, 3,
+ 69, 72, 77, 56, 73, 74, 75, 76, 78, 57,
+ 58, 62, 63, 80, 64, 65, 66, 80, 38, 67,
+ 68, 81, 39, 69, 0, 72, 77, 73, 74, 75,
+ 76, 84, 78, 82, 82, 82, 82, 80, 88, 89,
+ 90, 80, 92, 93, 81, 83, 83, 83, 83, 94,
+ 95, 96, 0, 97, 84, 98, 99, 100, 101, 0,
+ 96, 88, 89, 102, 90, 92, 93, 104, 106, 108,
+ 110, 109, 94, 110, 95, 96, 97, 111, 98, 99,
+ 112, 100, 101, 96, 113, 114, 102, 115, 0, 119,
+
+ 104, 120, 106, 108, 109, 110, 121, 0, 122, 125,
+ 111, 126, 128, 112, 127, 130, 131, 137, 113, 114,
+ 132, 115, 119, 133, 138, 120, 139, 140, 110, 139,
+ 121, 122, 125, 141, 143, 126, 128, 127, 144, 130,
+ 131, 137, 146, 132, 147, 151, 133, 149, 138, 150,
+ 152, 140, 153, 155, 157, 153, 141, 143, 158, 156,
+ 160, 144, 156, 161, 163, 169, 146, 170, 147, 151,
+ 149, 167, 150, 152, 167, 172, 155, 157, 174, 175,
+ 156, 158, 178, 181, 160, 180, 161, 163, 180, 169,
+ 170, 182, 184, 0, 182, 184, 0, 167, 0, 172,
+
+ 0, 174, 0, 175, 156, 178, 181, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 167, 186, 186, 0, 186, 186, 186, 187, 187, 188,
+ 188, 0, 0, 188, 188, 189, 0, 0, 0, 189,
+ 190, 0, 0, 0, 190, 185, 185, 185, 185, 185,
+ 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
+ 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
+ 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
+ 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
+ 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
+
+ 185, 185, 185, 185, 185, 185
} ;
static yy_state_type yy_last_accepting_state;
@@ -662,7 +669,7 @@ static void countnl() {
g_lingo->_colnumber = strlen(p);
}
-#line 666 "engines/director/lingo/lingo-lex.cpp"
+#line 673 "engines/director/lingo/lingo-lex.cpp"
#define INITIAL 0
@@ -850,7 +857,7 @@ YY_DECL
#line 60 "engines/director/lingo/lingo-lex.l"
-#line 854 "engines/director/lingo/lingo-lex.cpp"
+#line 861 "engines/director/lingo/lingo-lex.cpp"
if ( !(yy_init) )
{
@@ -904,13 +911,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 >= 179 )
+ if ( yy_current_state >= 186 )
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] != 426 );
+ while ( yy_base[yy_current_state] != 446 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -1181,41 +1188,51 @@ YY_RULE_SETUP
case 38:
YY_RULE_SETUP
#line 157 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWITH; }
+{ count(); return tSPRITE; }
YY_BREAK
case 39:
YY_RULE_SETUP
#line 158 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWHEN; }
+{ count(); return tWITH; }
YY_BREAK
case 40:
YY_RULE_SETUP
#line 159 "engines/director/lingo/lingo-lex.l"
-{ count(); return tWHILE; }
+{ count(); return tWITHIN; }
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 161 "engines/director/lingo/lingo-lex.l"
-{ count(); return tNEQ; }
+#line 160 "engines/director/lingo/lingo-lex.l"
+{ count(); return tWHEN; }
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 162 "engines/director/lingo/lingo-lex.l"
-{ count(); return tGE; }
+#line 161 "engines/director/lingo/lingo-lex.l"
+{ count(); return tWHILE; }
YY_BREAK
case 43:
YY_RULE_SETUP
#line 163 "engines/director/lingo/lingo-lex.l"
-{ count(); return tLE; }
+{ count(); return tNEQ; }
YY_BREAK
case 44:
YY_RULE_SETUP
#line 164 "engines/director/lingo/lingo-lex.l"
-{ count(); return tCONCAT; }
+{ count(); return tGE; }
YY_BREAK
case 45:
YY_RULE_SETUP
+#line 165 "engines/director/lingo/lingo-lex.l"
+{ count(); return tLE; }
+ YY_BREAK
+case 46:
+YY_RULE_SETUP
#line 166 "engines/director/lingo/lingo-lex.l"
+{ count(); return tCONCAT; }
+ YY_BREAK
+case 47:
+YY_RULE_SETUP
+#line 168 "engines/director/lingo/lingo-lex.l"
{
count();
yylval.s = new Common::String(yytext);
@@ -1230,43 +1247,43 @@ YY_RULE_SETUP
return ID;
}
YY_BREAK
-case 46:
-YY_RULE_SETUP
-#line 179 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.f = atof(yytext); return FLOAT; }
- YY_BREAK
-case 47:
-YY_RULE_SETUP
-#line 180 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
- YY_BREAK
case 48:
YY_RULE_SETUP
#line 181 "engines/director/lingo/lingo-lex.l"
-{ count(); return *yytext; }
+{ count(); yylval.f = atof(yytext); return FLOAT; }
YY_BREAK
case 49:
-/* rule 49 can match eol */
YY_RULE_SETUP
#line 182 "engines/director/lingo/lingo-lex.l"
-{ return '\n'; }
+{ count(); yylval.i = strtol(yytext, NULL, 10); return INT; }
YY_BREAK
case 50:
YY_RULE_SETUP
#line 183 "engines/director/lingo/lingo-lex.l"
-{ count(); yylval.s = new Common::String(&yytext[1]); yylval.s->deleteLastChar(); return STRING; }
+{ count(); return *yytext; }
YY_BREAK
case 51:
+/* rule 51 can match eol */
YY_RULE_SETUP
#line 184 "engines/director/lingo/lingo-lex.l"
-
+{ return '\n'; }
YY_BREAK
case 52:
YY_RULE_SETUP
+#line 185 "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"
+
+ YY_BREAK
+case 54:
+YY_RULE_SETUP
+#line 188 "engines/director/lingo/lingo-lex.l"
ECHO;
YY_BREAK
-#line 1270 "engines/director/lingo/lingo-lex.cpp"
+#line 1287 "engines/director/lingo/lingo-lex.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1559,7 +1576,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 >= 179 )
+ if ( yy_current_state >= 186 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1587,11 +1604,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 >= 179 )
+ if ( yy_current_state >= 186 )
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 == 178);
+ yy_is_jam = (yy_current_state == 185);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -2266,7 +2283,7 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 186 "engines/director/lingo/lingo-lex.l"
+#line 188 "engines/director/lingo/lingo-lex.l"
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 5e4deec..5670316 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -154,7 +154,9 @@ whitespace [\t ]
}
(?i:then) { count(); return tTHEN; }
(?i:to) { count(); return tTO; }
+(?i:sprite) { count(); return tSPRITE; }
(?i:with) { count(); return tWITH; }
+(?i:within) { count(); return tWITHIN; }
(?i:when) { count(); return tWHEN; }
(?i:while) { count(); return tWHILE; }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index f1fa45d..1859c31 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -204,6 +204,7 @@ public:
static void c_starts();
static void c_intersects();
+ static void c_within();
static void c_constpush();
static void c_fconstpush();
diff --git a/engines/director/lingo/tests/factory.lingo b/engines/director/lingo/tests/factory.lingo
index 5349b34..d458ba4 100644
--- a/engines/director/lingo/tests/factory.lingo
+++ b/engines/director/lingo/tests/factory.lingo
@@ -37,12 +37,12 @@ method mAtFrame
dontpassevent
set the castnum of sprite 14 to bcast
set the LocV of sprite 14 to (startV-stepV)
--- if sprite 14 intersects 10 and (startV-6) <= targetV then
+ if sprite 14 intersects 10 and (startV-6) <= targetV then
set the castnum of sprite 14 to f16
set the perframehook to false
me(hit)
exit
--- end if
+ end if
if startV < targetV or bcast>g17 then
set the perframehook to false
set the locV of sprite 14 to 340
Commit: 21730e9d7e4a7fbaa1bb437f3699e3a9e27a6e7d
https://github.com/scummvm/scummvm/commit/21730e9d7e4a7fbaa1bb437f3699e3a9e27a6e7d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Cast references could be lowercase too
Changed paths:
engines/director/lingo/lingo-codegen.cpp
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index b54953e..21501bf 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -70,14 +70,14 @@ Symbol *Lingo::lookupVar(const char *name, bool create, bool putInGlobalList) {
// Looking for the cast member constants
if (_vm->getVersion() < 4) { // TODO: There could be a flag 'Allow Outdated Lingo' in Movie Info in D4
if (strlen(name) == 3) {
- if (name[0] >= 'A' && name[0] <= 'H' &&
+ if (tolower(name[0]) >= 'a' && tolower(name[0]) <= 'h' &&
name[1] >= '1' && name[1] <= '8' &&
name[2] >= '1' && name[2] <= '8') {
if (!create)
error("Cast reference used in wrong context: %s", name);
- int val = (name[0] - 'A') * 64 + (name[1] - '1') * 8 + (name[2] - '1') + 1;
+ int val = (tolower(name[0]) - 'a') * 64 + (name[1] - '1') * 8 + (name[2] - '1') + 1;
sym = new Symbol;
sym->type = CASTREF;
Commit: e56295df638ff63b91ba37f174b78995798ddb18
https://github.com/scummvm/scummvm/commit/e56295df638ff63b91ba37f174b78995798ddb18
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Use M_PI constant instead of hardcode
Changed paths:
engines/director/lingo/lingo-builtins.cpp
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index ab6e3b0..e9c173b 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -116,7 +116,7 @@ void Lingo::b_log() {
void Lingo::b_pi() {
Datum d;
d.toFloat();
- d.u.f = 3.14159265358979;
+ d.u.f = M_PI;
g_lingo->push(d);
}
Commit: 7fd25e98f1a689733b6bad449618ebe8f3c91546
https://github.com/scummvm/scummvm/commit/7fd25e98f1a689733b6bad449618ebe8f3c91546
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Added basic support for points
Changed paths:
A engines/director/lingo/tests/point.lingo
engines/director/lingo/lingo-builtins.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index e9c173b..78c7516 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -49,6 +49,8 @@ static struct BuiltinProto {
{ "string", Lingo::b_string, 1},
// Misc
{ "dontpassevent", Lingo::b_dontpassevent, -1 },
+ // point
+ { "point", Lingo::b_point, 2},
{ 0, 0, 0 }
};
@@ -216,4 +218,25 @@ void Lingo::b_dontpassevent() {
warning("STUB: b_dontpassevent");
}
+///////////////////
+// Point
+///////////////////
+void Lingo::b_point() {
+ Datum y = g_lingo->pop();
+ Datum x = g_lingo->pop();
+ Datum d;
+
+ x.toFloat();
+ y.toFloat();
+
+ d.u.arr = new FloatArray;
+
+ d.u.arr->push_back(x.u.f);
+ d.u.arr->push_back(y.u.f);
+ d.type = POINT;
+
+ g_lingo->push(d);
+}
+
+
} // End of namespace Director
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index c8ae4b9..eb28dcf 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -95,6 +95,9 @@ void Lingo::c_printtop(void) {
case STRING:
warning("%s", d.u.s->c_str());
break;
+ case POINT:
+ warning("point (%d, %d)", (int)((*d.u.arr)[0]), (int)((*d.u.arr)[1]));
+ break;
default:
warning("--unknown--");
}
@@ -175,6 +178,10 @@ void Lingo::c_assign() {
d1.u.sym->u.f = d2.u.f;
else if (d2.type == STRING)
d1.u.sym->u.s = new Common::String(*d2.u.s);
+ else if (d2.type == POINT)
+ d1.u.sym->u.arr = d2.u.arr;
+ else
+ error("c_assign: unhandled type: %s", d2.type2str());
d1.u.sym->type = d2.type;
@@ -182,7 +189,7 @@ void Lingo::c_assign() {
}
bool Lingo::verify(Symbol *s) {
- if (s->type != INT && s->type != VOID && s->type != FLOAT && s->type != STRING) {
+ if (s->type != INT && s->type != VOID && s->type != FLOAT && s->type != STRING && s->type != POINT) {
warning("attempt to evaluate non-variable '%s'", s->name);
return false;
@@ -214,6 +221,10 @@ void Lingo::c_eval() {
d.u.f = d.u.sym->u.f;
else if (d.u.sym->type == STRING)
d.u.s = new Common::String(*d.u.sym->u.s);
+ else if (d.u.sym->type == POINT)
+ d.u.arr = d.u.sym->u.arr;
+ else
+ error("c_eval: unhandled type: %s", d.type2str());
g_lingo->push(d);
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index bb343ff..6276ee4 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -70,59 +70,62 @@
UNARY = 259,
VOID = 260,
VAR = 261,
- INT = 262,
- THEENTITY = 263,
- THEENTITYWITHID = 264,
- FLOAT = 265,
- BLTIN = 266,
- BLTINNOARGS = 267,
- ID = 268,
- STRING = 269,
- HANDLER = 270,
- tDOWN = 271,
- tELSE = 272,
- tNLELSIF = 273,
- tEND = 274,
- tEXIT = 275,
- tFRAME = 276,
- tGLOBAL = 277,
- tGO = 278,
- tIF = 279,
- tINTO = 280,
- tLOOP = 281,
- tMACRO = 282,
- tMCI = 283,
- tMCIWAIT = 284,
- tMOVIE = 285,
- tNEXT = 286,
- tOF = 287,
- tPREVIOUS = 288,
- tPUT = 289,
- tREPEAT = 290,
- tSET = 291,
- tTHEN = 292,
- tTO = 293,
- tWHEN = 294,
- tWITH = 295,
- tWHILE = 296,
- tNLELSE = 297,
- tFACTORY = 298,
- tMETHOD = 299,
- tGE = 300,
- tLE = 301,
- tGT = 302,
- tLT = 303,
- tEQ = 304,
- tNEQ = 305,
- tAND = 306,
- tOR = 307,
- tNOT = 308,
- tCONCAT = 309,
- tCONTAINS = 310,
- tSTARTS = 311,
- tSPRITE = 312,
- tINTERSECTS = 313,
- tWITHIN = 314
+ POINT = 262,
+ RECT = 263,
+ ARRAY = 264,
+ INT = 265,
+ THEENTITY = 266,
+ THEENTITYWITHID = 267,
+ FLOAT = 268,
+ BLTIN = 269,
+ BLTINNOARGS = 270,
+ ID = 271,
+ STRING = 272,
+ HANDLER = 273,
+ tDOWN = 274,
+ tELSE = 275,
+ tNLELSIF = 276,
+ tEND = 277,
+ tEXIT = 278,
+ tFRAME = 279,
+ tGLOBAL = 280,
+ tGO = 281,
+ tIF = 282,
+ tINTO = 283,
+ tLOOP = 284,
+ tMACRO = 285,
+ tMCI = 286,
+ tMCIWAIT = 287,
+ tMOVIE = 288,
+ tNEXT = 289,
+ tOF = 290,
+ tPREVIOUS = 291,
+ tPUT = 292,
+ tREPEAT = 293,
+ tSET = 294,
+ tTHEN = 295,
+ tTO = 296,
+ tWHEN = 297,
+ tWITH = 298,
+ tWHILE = 299,
+ tNLELSE = 300,
+ tFACTORY = 301,
+ tMETHOD = 302,
+ tGE = 303,
+ tLE = 304,
+ tGT = 305,
+ tLT = 306,
+ tEQ = 307,
+ tNEQ = 308,
+ tAND = 309,
+ tOR = 310,
+ tNOT = 311,
+ tCONCAT = 312,
+ tCONTAINS = 313,
+ tSTARTS = 314,
+ tSPRITE = 315,
+ tINTERSECTS = 316,
+ tWITHIN = 317
};
#endif
/* Tokens. */
@@ -130,59 +133,62 @@
#define UNARY 259
#define VOID 260
#define VAR 261
-#define INT 262
-#define THEENTITY 263
-#define THEENTITYWITHID 264
-#define FLOAT 265
-#define BLTIN 266
-#define BLTINNOARGS 267
-#define ID 268
-#define STRING 269
-#define HANDLER 270
-#define tDOWN 271
-#define tELSE 272
-#define tNLELSIF 273
-#define tEND 274
-#define tEXIT 275
-#define tFRAME 276
-#define tGLOBAL 277
-#define tGO 278
-#define tIF 279
-#define tINTO 280
-#define tLOOP 281
-#define tMACRO 282
-#define tMCI 283
-#define tMCIWAIT 284
-#define tMOVIE 285
-#define tNEXT 286
-#define tOF 287
-#define tPREVIOUS 288
-#define tPUT 289
-#define tREPEAT 290
-#define tSET 291
-#define tTHEN 292
-#define tTO 293
-#define tWHEN 294
-#define tWITH 295
-#define tWHILE 296
-#define tNLELSE 297
-#define tFACTORY 298
-#define tMETHOD 299
-#define tGE 300
-#define tLE 301
-#define tGT 302
-#define tLT 303
-#define tEQ 304
-#define tNEQ 305
-#define tAND 306
-#define tOR 307
-#define tNOT 308
-#define tCONCAT 309
-#define tCONTAINS 310
-#define tSTARTS 311
-#define tSPRITE 312
-#define tINTERSECTS 313
-#define tWITHIN 314
+#define POINT 262
+#define RECT 263
+#define ARRAY 264
+#define INT 265
+#define THEENTITY 266
+#define THEENTITYWITHID 267
+#define FLOAT 268
+#define BLTIN 269
+#define BLTINNOARGS 270
+#define ID 271
+#define STRING 272
+#define HANDLER 273
+#define tDOWN 274
+#define tELSE 275
+#define tNLELSIF 276
+#define tEND 277
+#define tEXIT 278
+#define tFRAME 279
+#define tGLOBAL 280
+#define tGO 281
+#define tIF 282
+#define tINTO 283
+#define tLOOP 284
+#define tMACRO 285
+#define tMCI 286
+#define tMCIWAIT 287
+#define tMOVIE 288
+#define tNEXT 289
+#define tOF 290
+#define tPREVIOUS 291
+#define tPUT 292
+#define tREPEAT 293
+#define tSET 294
+#define tTHEN 295
+#define tTO 296
+#define tWHEN 297
+#define tWITH 298
+#define tWHILE 299
+#define tNLELSE 300
+#define tFACTORY 301
+#define tMETHOD 302
+#define tGE 303
+#define tLE 304
+#define tGT 305
+#define tLT 306
+#define tEQ 307
+#define tNEQ 308
+#define tAND 309
+#define tOR 310
+#define tNOT 311
+#define tCONCAT 312
+#define tCONTAINS 313
+#define tSTARTS 314
+#define tSPRITE 315
+#define tINTERSECTS 316
+#define tWITHIN 317
@@ -232,14 +238,15 @@ typedef union YYSTYPE
#line 69 "engines/director/lingo/lingo-gr.y"
{
Common::String *s;
- int i;
+ int i;
double f;
int e[2]; // Entity + field
int code;
- int narg; /* number of arguments */
+ int narg; /* number of arguments */
+ Common::Array<double> *arr;
}
/* Line 193 of yacc.c. */
-#line 243 "engines/director/lingo/lingo-gr.cpp"
+#line 250 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -252,7 +259,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 256 "engines/director/lingo/lingo-gr.cpp"
+#line 263 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -467,10 +474,10 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 79
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 715
+#define YYLAST 731
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 73
+#define YYNTOKENS 76
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 34
/* YYNRULES -- Number of rules. */
@@ -480,7 +487,7 @@ union yyalloc
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 314
+#define YYMAXUTOK 317
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -489,12 +496,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 66, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 69, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 65, 71, 2,
- 67, 68, 63, 61, 72, 62, 2, 64, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 68, 74, 2,
+ 70, 71, 66, 64, 75, 65, 2, 67, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 70, 60, 69, 2, 2, 2, 2, 2, 2, 2,
+ 73, 63, 72, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -519,7 +526,7 @@ static const yytype_uint8 yytranslate[] =
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59
+ 55, 56, 57, 58, 59, 60, 61, 62
};
#if YYDEBUG
@@ -544,69 +551,69 @@ static const yytype_uint16 yyprhs[] =
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 74, 0, -1, 74, 75, 76, -1, 76, -1, 1,
- 66, -1, 66, -1, -1, 100, -1, 95, -1, 105,
- -1, 77, -1, 79, -1, 34, 94, 25, 13, -1,
- 36, 13, 60, 94, -1, 36, 8, 60, 94, -1,
- 36, 9, 94, 60, 94, -1, 36, 13, 38, 94,
- -1, 36, 8, 38, 94, -1, 36, 9, 94, 38,
- 94, -1, 94, -1, 95, -1, 78, -1, 80, -1,
- 87, 67, 86, 68, 93, 92, 19, 35, -1, 88,
- 60, 94, 92, 38, 94, 92, 93, 92, 19, 35,
- -1, 88, 60, 94, 92, 16, 38, 94, 92, 93,
- 92, 19, 35, -1, 39, 13, 37, 94, -1, 89,
- 86, 37, 75, 93, 92, 19, 24, -1, 89, 86,
- 37, 75, 93, 92, 42, 93, 92, 19, 24, -1,
- 89, 86, 37, 75, 93, 92, 91, 82, 92, 19,
- 24, -1, 89, 86, 37, 91, 78, 92, -1, 89,
- 86, 37, 91, 78, 92, 42, 91, 78, 92, -1,
- 89, 86, 37, 91, 78, 92, 83, 92, 81, 92,
- -1, -1, 42, 91, 78, -1, 82, 85, -1, 85,
- -1, 83, 84, -1, 84, -1, 90, 86, 37, 91,
- 79, 92, -1, 83, -1, 90, 86, 37, 93, 92,
- -1, 94, -1, 94, 60, 94, -1, 67, 86, 68,
- -1, 35, 41, -1, 35, 40, 13, -1, 24, -1,
- 18, -1, -1, -1, -1, 93, 75, -1, 93, 79,
- -1, 7, -1, 10, -1, 14, -1, 11, 67, 106,
- 68, -1, 12, -1, 13, 67, 106, 68, -1, 13,
- -1, 8, -1, 9, 94, -1, 77, -1, 94, 61,
- 94, -1, 94, 62, 94, -1, 94, 63, 94, -1,
- 94, 64, 94, -1, 94, 69, 94, -1, 94, 70,
- 94, -1, 94, 50, 94, -1, 94, 45, 94, -1,
- 94, 46, 94, -1, 94, 51, 94, -1, 94, 52,
- 94, -1, 53, 94, -1, 94, 71, 94, -1, 94,
- 54, 94, -1, 94, 55, 94, -1, 94, 56, 94,
- -1, 61, 94, -1, 62, 94, -1, 67, 94, 68,
- -1, 57, 94, 58, 94, -1, 57, 94, 59, 94,
- -1, 28, 14, -1, 29, 13, -1, 34, 94, -1,
- 97, -1, 20, -1, 22, 96, -1, 13, -1, 96,
- 72, 13, -1, 23, 26, -1, 23, 31, -1, 23,
- 33, -1, 23, 98, -1, 23, 98, 99, -1, 23,
- 99, -1, 38, 21, 14, -1, 21, 14, -1, 38,
- 14, -1, 14, -1, 32, 30, 14, -1, 30, 14,
- -1, 38, 30, 14, -1, -1, 27, 13, 101, 91,
- 103, 75, 104, 93, -1, 43, 13, -1, -1, 44,
- 13, 102, 91, 103, 75, 104, 93, -1, -1, 13,
- -1, 103, 72, 13, -1, 103, 75, 72, 13, -1,
- -1, 13, 91, 106, -1, -1, 94, -1, 106, 72,
- 94, -1
+ 77, 0, -1, 77, 78, 79, -1, 79, -1, 1,
+ 69, -1, 69, -1, -1, 103, -1, 98, -1, 108,
+ -1, 80, -1, 82, -1, 37, 97, 28, 16, -1,
+ 39, 16, 63, 97, -1, 39, 11, 63, 97, -1,
+ 39, 12, 97, 63, 97, -1, 39, 16, 41, 97,
+ -1, 39, 11, 41, 97, -1, 39, 12, 97, 41,
+ 97, -1, 97, -1, 98, -1, 81, -1, 83, -1,
+ 90, 70, 89, 71, 96, 95, 22, 38, -1, 91,
+ 63, 97, 95, 41, 97, 95, 96, 95, 22, 38,
+ -1, 91, 63, 97, 95, 19, 41, 97, 95, 96,
+ 95, 22, 38, -1, 42, 16, 40, 97, -1, 92,
+ 89, 40, 78, 96, 95, 22, 27, -1, 92, 89,
+ 40, 78, 96, 95, 45, 96, 95, 22, 27, -1,
+ 92, 89, 40, 78, 96, 95, 94, 85, 95, 22,
+ 27, -1, 92, 89, 40, 94, 81, 95, -1, 92,
+ 89, 40, 94, 81, 95, 45, 94, 81, 95, -1,
+ 92, 89, 40, 94, 81, 95, 86, 95, 84, 95,
+ -1, -1, 45, 94, 81, -1, 85, 88, -1, 88,
+ -1, 86, 87, -1, 87, -1, 93, 89, 40, 94,
+ 82, 95, -1, 86, -1, 93, 89, 40, 96, 95,
+ -1, 97, -1, 97, 63, 97, -1, 70, 89, 71,
+ -1, 38, 44, -1, 38, 43, 16, -1, 27, -1,
+ 21, -1, -1, -1, -1, 96, 78, -1, 96, 82,
+ -1, 10, -1, 13, -1, 17, -1, 14, 70, 109,
+ 71, -1, 15, -1, 16, 70, 109, 71, -1, 16,
+ -1, 11, -1, 12, 97, -1, 80, -1, 97, 64,
+ 97, -1, 97, 65, 97, -1, 97, 66, 97, -1,
+ 97, 67, 97, -1, 97, 72, 97, -1, 97, 73,
+ 97, -1, 97, 53, 97, -1, 97, 48, 97, -1,
+ 97, 49, 97, -1, 97, 54, 97, -1, 97, 55,
+ 97, -1, 56, 97, -1, 97, 74, 97, -1, 97,
+ 57, 97, -1, 97, 58, 97, -1, 97, 59, 97,
+ -1, 64, 97, -1, 65, 97, -1, 70, 97, 71,
+ -1, 60, 97, 61, 97, -1, 60, 97, 62, 97,
+ -1, 31, 17, -1, 32, 16, -1, 37, 97, -1,
+ 100, -1, 23, -1, 25, 99, -1, 16, -1, 99,
+ 75, 16, -1, 26, 29, -1, 26, 34, -1, 26,
+ 36, -1, 26, 101, -1, 26, 101, 102, -1, 26,
+ 102, -1, 41, 24, 17, -1, 24, 17, -1, 41,
+ 17, -1, 17, -1, 35, 33, 17, -1, 33, 17,
+ -1, 41, 33, 17, -1, -1, 30, 16, 104, 94,
+ 106, 78, 107, 96, -1, 46, 16, -1, -1, 47,
+ 16, 105, 94, 106, 78, 107, 96, -1, -1, 16,
+ -1, 106, 75, 16, -1, 106, 78, 75, 16, -1,
+ -1, 16, 94, 109, -1, -1, 97, -1, 109, 75,
+ 97, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 101, 101, 102, 103, 106, 111, 112, 113, 114,
- 115, 116, 119, 125, 131, 139, 147, 153, 161, 170,
- 171, 173, 174, 179, 190, 206, 218, 223, 230, 239,
- 248, 258, 268, 279, 280, 283, 284, 287, 288, 291,
- 299, 300, 308, 309, 310, 312, 314, 320, 326, 333,
- 335, 337, 338, 339, 342, 347, 350, 353, 359, 362,
- 370, 373, 380, 386, 387, 388, 389, 390, 391, 392,
- 393, 394, 395, 396, 397, 398, 399, 400, 401, 402,
- 403, 404, 405, 406, 407, 410, 411, 412, 413, 414,
- 416, 419, 420, 431, 432, 433, 434, 439, 445, 452,
- 453, 454, 455, 458, 459, 460, 488, 488, 494, 497,
- 497, 503, 504, 505, 506, 508, 512, 520, 521, 522
+ 0, 102, 102, 103, 104, 107, 112, 113, 114, 115,
+ 116, 117, 120, 126, 132, 140, 148, 154, 162, 171,
+ 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
};
#endif
@@ -615,17 +622,17 @@ static const yytype_uint16 yyrline[] =
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "CASTREF", "UNARY", "VOID", "VAR", "INT",
- "THEENTITY", "THEENTITYWITHID", "FLOAT", "BLTIN", "BLTINNOARGS", "ID",
- "STRING", "HANDLER", "tDOWN", "tELSE", "tNLELSIF", "tEND", "tEXIT",
- "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI",
- "tMCIWAIT", "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT",
- "tSET", "tTHEN", "tTO", "tWHEN", "tWITH", "tWHILE", "tNLELSE",
- "tFACTORY", "tMETHOD", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "tAND",
- "tOR", "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS", "tSPRITE",
- "tINTERSECTS", "tWITHIN", "'='", "'+'", "'-'", "'*'", "'/'", "'%'",
- "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','", "$accept", "program",
- "nl", "programline", "asgn", "stmtoneliner", "stmt", "ifstmt",
+ "$end", "error", "$undefined", "CASTREF", "UNARY", "VOID", "VAR",
+ "POINT", "RECT", "ARRAY", "INT", "THEENTITY", "THEENTITYWITHID", "FLOAT",
+ "BLTIN", "BLTINNOARGS", "ID", "STRING", "HANDLER", "tDOWN", "tELSE",
+ "tNLELSIF", "tEND", "tEXIT", "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO",
+ "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF",
+ "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWHEN", "tWITH",
+ "tWHILE", "tNLELSE", "tFACTORY", "tMETHOD", "tGE", "tLE", "tGT", "tLT",
+ "tEQ", "tNEQ", "tAND", "tOR", "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS",
+ "tSPRITE", "tINTERSECTS", "tWITHIN", "'='", "'+'", "'-'", "'*'", "'/'",
+ "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','", "$accept",
+ "program", "nl", "programline", "asgn", "stmtoneliner", "stmt", "ifstmt",
"elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
"elseifstmtoneliner1", "elseifstmt1", "cond", "repeatwhile",
"repeatwith", "if", "elseif", "begin", "end", "stmtlist", "expr", "func",
@@ -645,26 +652,26 @@ static const yytype_uint16 yytoknum[] =
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
- 61, 43, 45, 42, 47, 37, 10, 40, 41, 62,
- 60, 38, 44
+ 315, 316, 317, 61, 43, 45, 42, 47, 37, 10,
+ 40, 41, 62, 60, 38, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 73, 74, 74, 74, 75, 76, 76, 76, 76,
- 76, 76, 77, 77, 77, 77, 77, 77, 77, 78,
- 78, 79, 79, 79, 79, 79, 79, 80, 80, 80,
- 80, 80, 80, 81, 81, 82, 82, 83, 83, 84,
- 85, 85, 86, 86, 86, 87, 88, 89, 90, 91,
- 92, 93, 93, 93, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 95, 95, 95, 95, 95,
- 95, 96, 96, 97, 97, 97, 97, 97, 97, 98,
- 98, 98, 98, 99, 99, 99, 101, 100, 100, 102,
- 100, 103, 103, 103, 103, 104, 105, 106, 106, 106
+ 0, 76, 77, 77, 77, 78, 79, 79, 79, 79,
+ 79, 79, 80, 80, 80, 80, 80, 80, 80, 81,
+ 81, 82, 82, 82, 82, 82, 82, 83, 83, 83,
+ 83, 83, 83, 84, 84, 85, 85, 86, 86, 87,
+ 88, 88, 89, 89, 89, 90, 91, 92, 93, 94,
+ 95, 96, 96, 96, 97, 97, 97, 97, 97, 97,
+ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
+ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
+ 97, 97, 97, 97, 97, 98, 98, 98, 98, 98,
+ 98, 99, 99, 100, 100, 100, 100, 100, 100, 101,
+ 101, 101, 101, 102, 102, 102, 104, 103, 103, 105,
+ 103, 106, 106, 106, 106, 107, 108, 109, 109, 109
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -731,41 +738,41 @@ static const yytype_int16 yydefgoto[] =
#define YYPACT_NINF -192
static const yytype_int16 yypact[] =
{
- 210, -49, -192, -192, 434, -192, -43, -192, 644, -192,
- -192, 35, 146, -192, 41, 20, 54, 434, 25, 50,
- 59, 60, 66, 434, 434, 434, 434, 434, 10, -192,
- 11, -192, -192, -192, 13, 14, 466, 622, -192, -192,
- -192, -192, -192, 16, 434, -192, 622, 434, 434, 434,
- -192, 33, -192, 68, -192, 73, -192, 80, -192, 1,
- 15, -192, -192, -192, -192, 480, 101, -192, -20, 434,
- -18, 82, -192, -192, 61, 524, 61, 61, 573, -192,
- -192, 271, 466, 434, 466, 83, 600, 434, 434, 434,
- 434, 434, 434, 434, 434, 434, 434, 434, 434, 434,
- 434, 434, 480, 622, -11, -4, 51, 121, -192, -192,
- 122, -192, 126, 127, 112, -192, -192, 130, -192, 434,
- 434, 502, 434, 434, 434, -192, 434, 434, -192, -192,
- 76, 622, 78, 546, 81, 434, 622, 622, 622, 622,
- 622, 622, 622, 622, 266, 266, 61, 61, 622, 622,
- 622, -192, 434, -192, -192, -192, -192, -192, 136, -192,
- 622, 622, 434, 434, 622, 622, 622, 136, 622, 622,
- -192, 5, -192, -192, 404, 622, 622, -192, -10, 622,
- 622, -10, 332, 113, 434, 332, -192, -192, 137, 85,
- 85, -192, -192, 134, 434, 622, -5, -9, -192, 145,
- -192, -192, 124, 622, -192, 138, -192, 143, -192, -192,
- 143, -192, 466, -192, 332, 332, -192, -192, 332, -192,
- 332, 143, 143, -192, 466, 404, -192, 128, 129, 332,
- 149, 150, -192, 156, 144, -192, -192, -192, -192, 161,
- 148, 163, 167, -6, -192, 404, -192, 368, 157, -192,
- -192, -192, 332, -192, -192, -192, -192, -192
+ 223, -52, -192, -192, 447, -192, -46, -192, 657, -192,
+ -192, 16, 143, -192, 18, 28, 32, 447, 33, 50,
+ 37, 40, 42, 447, 447, 447, 447, 447, 10, -192,
+ 11, -192, -192, -192, -6, 4, 479, 635, -192, -192,
+ -192, -192, -192, 17, 447, -192, 635, 447, 447, 447,
+ -192, -5, -192, 57, -192, 88, -192, 77, -192, 30,
+ 24, -192, -192, -192, -192, 493, 98, -192, -23, 447,
+ -21, 79, -192, -192, 58, 537, 58, 58, 586, -192,
+ -192, 284, 479, 447, 479, 80, 613, 447, 447, 447,
+ 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
+ 447, 447, 493, 635, -3, -2, 48, 118, -192, -192,
+ 119, -192, 123, 124, 109, -192, -192, 127, -192, 447,
+ 447, 515, 447, 447, 447, -192, 447, 447, -192, -192,
+ 73, 635, 75, 559, 78, 447, 635, 635, 635, 635,
+ 635, 635, 635, 635, 279, 279, 58, 58, 635, 635,
+ 635, -192, 447, -192, -192, -192, -192, -192, 133, -192,
+ 635, 635, 447, 447, 635, 635, 635, 133, 635, 635,
+ -192, 3, -192, -192, 417, 635, 635, -192, -54, 635,
+ 635, -54, 345, 110, 447, 345, -192, -192, 134, 82,
+ 82, -192, -192, 131, 447, 635, -8, -12, -192, 142,
+ -192, -192, 121, 635, -192, 135, -192, 140, -192, -192,
+ 140, -192, 479, -192, 345, 345, -192, -192, 345, -192,
+ 345, 140, 140, -192, 479, 417, -192, 125, 126, 345,
+ 146, 147, -192, 153, 141, -192, -192, -192, -192, 158,
+ 145, 160, 164, -9, -192, 417, -192, 381, 154, -192,
+ -192, -192, 345, -192, -192, -192, -192, -192
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
-192, -192, -26, 104, 7, -170, 0, -192, -192, -192,
- -3, -178, -28, -79, -192, -192, -192, -191, -7, -47,
- -165, 2, 23, -192, -192, -192, 135, -192, -192, -192,
- 30, 8, -192, 21
+ -4, -179, -27, -79, -192, -192, -192, -191, -7, -47,
+ -165, 2, 23, -192, -192, -192, 137, -192, -192, -192,
+ 31, 5, -192, 34
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -776,16 +783,16 @@ static const yytype_int16 yypgoto[] =
static const yytype_int16 yytable[] =
{
32, 49, 81, 130, 186, 132, 46, 30, 185, 208,
- 79, -10, -51, -51, 205, 111, 224, 42, 119, 65,
- 122, 183, 112, 38, 47, 74, 75, 76, 77, 78,
- 224, 113, 226, 209, 63, 214, 215, 206, 86, 218,
- 120, 220, 123, 184, 226, 55, 102, 57, 50, 103,
- 103, 103, 229, 114, 62, 235, 80, 151, 68, 69,
- -51, 152, 188, 70, 153, 66, 67, 64, 152, 105,
- 106, 121, 71, 72, 83, 253, 80, -10, 252, 73,
- 82, 32, 108, 48, 86, 131, 133, 109, 30, 136,
+ 79, -10, -51, -51, 205, 80, 224, 42, 119, 65,
+ 122, 188, 183, 38, 47, 74, 75, 76, 77, 78,
+ 224, 226, 50, 209, 62, 214, 215, 206, 86, 218,
+ 120, 220, 123, 226, 184, 63, 102, 111, 64, 103,
+ 103, 103, 229, 71, 112, 235, 72, 55, 73, 57,
+ -51, 68, 69, 113, 82, 114, 70, 83, 151, 153,
+ 107, 121, 152, 152, 108, 253, 66, 67, 252, 80,
+ -10, 32, 105, 106, 86, 131, 133, 48, 30, 136,
137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
- 147, 148, 149, 150, 38, 107, 87, 88, 173, 158,
+ 147, 148, 149, 150, 38, 109, 87, 88, 173, 158,
110, 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,
@@ -794,167 +801,171 @@ static const yytype_int16 yytable[] =
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, 232, 210, 115, 203, 181, 201, 0,
+ 246, 251, 255, 210, 232, 201, 203, 115, 181, 0,
0, 0, 225, 0, 0, 256, 0, 257, 0, 0,
- -6, 1, 0, 0, 86, 0, 0, 2, 3, 4,
- 5, 6, 7, 8, 9, 0, 86, 0, 0, 245,
- 10, 0, 11, 12, 13, 0, 0, 14, 15, 16,
- 0, 0, 0, 0, 17, 18, 19, 254, 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, 0, 0, 86, 0, 0, 0, 0, 0,
+ 0, 0, 0, -6, 1, 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, 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,
+ 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, 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,
+ 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, 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
+ 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
};
static const yytype_int16 yycheck[] =
{
- 0, 8, 28, 82, 174, 84, 4, 0, 173, 18,
- 0, 0, 18, 19, 19, 14, 207, 66, 38, 17,
- 38, 16, 21, 0, 67, 23, 24, 25, 26, 27,
- 221, 30, 210, 42, 14, 200, 201, 42, 36, 204,
- 60, 206, 60, 38, 222, 30, 44, 32, 13, 47,
- 48, 49, 217, 38, 13, 225, 66, 68, 8, 9,
- 66, 72, 72, 13, 68, 40, 41, 13, 72, 48,
- 49, 69, 13, 13, 60, 245, 66, 66, 243, 13,
- 67, 81, 14, 67, 82, 83, 84, 14, 81, 87,
+ 0, 8, 28, 82, 174, 84, 4, 0, 173, 21,
+ 0, 0, 21, 22, 22, 69, 207, 69, 41, 17,
+ 41, 75, 19, 0, 70, 23, 24, 25, 26, 27,
+ 221, 210, 16, 45, 16, 200, 201, 45, 36, 204,
+ 63, 206, 63, 222, 41, 17, 44, 17, 16, 47,
+ 48, 49, 217, 16, 24, 225, 16, 33, 16, 35,
+ 69, 11, 12, 33, 70, 41, 16, 63, 71, 71,
+ 75, 69, 75, 75, 17, 245, 43, 44, 243, 69,
+ 69, 81, 48, 49, 82, 83, 84, 70, 81, 87,
88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
- 98, 99, 100, 101, 81, 72, 45, 46, 134, 116,
- 30, 50, 51, 52, 13, 54, 55, 56, 125, 37,
- 37, 119, 120, 72, 122, 123, 124, 134, 126, 127,
- 69, 70, 71, 212, 13, 182, 14, 135, 185, 186,
- 14, 14, 30, 13, 68, 224, 68, 66, 195, 13,
- 13, 38, 178, 19, 152, 181, 203, 72, 13, 35,
- 14, 18, 24, 210, 162, 163, 37, 21, 19, 19,
- 42, 218, 26, 220, 221, 19, 30, 31, 32, 33,
- 19, 37, 229, 35, 38, 81, 184, 24, 235, 196,
- 237, 24, 35, 221, 197, 60, 194, 167, 190, -1,
+ 98, 99, 100, 101, 81, 17, 48, 49, 134, 116,
+ 33, 53, 54, 55, 16, 57, 58, 59, 125, 40,
+ 40, 119, 120, 75, 122, 123, 124, 134, 126, 127,
+ 72, 73, 74, 212, 16, 182, 17, 135, 185, 186,
+ 17, 17, 33, 16, 71, 224, 71, 69, 195, 16,
+ 16, 41, 178, 22, 152, 181, 203, 75, 16, 38,
+ 17, 21, 27, 210, 162, 163, 40, 24, 22, 22,
+ 45, 218, 29, 220, 221, 22, 33, 34, 35, 36,
+ 22, 40, 229, 38, 41, 81, 184, 27, 235, 196,
+ 237, 27, 38, 197, 221, 190, 194, 60, 167, -1,
-1, -1, 209, -1, -1, 252, -1, 254, -1, -1,
- 0, 1, -1, -1, 212, -1, -1, 7, 8, 9,
- 10, 11, 12, 13, 14, -1, 224, -1, -1, 236,
- 20, -1, 22, 23, 24, -1, -1, 27, 28, 29,
- -1, -1, -1, -1, 34, 35, 36, 247, -1, 39,
- -1, -1, -1, 43, 44, -1, -1, -1, -1, -1,
- -1, -1, -1, 53, -1, -1, -1, 57, -1, -1,
- -1, 61, 62, -1, -1, -1, 66, 67, 7, 8,
- 9, 10, 11, 12, 13, 14, -1, -1, -1, -1,
- -1, 20, -1, 22, 23, 24, -1, -1, 27, 28,
- 29, -1, -1, -1, -1, 34, 35, 36, -1, -1,
- 39, 45, 46, -1, 43, 44, 50, 51, 52, -1,
- 54, 55, 56, -1, 53, -1, -1, -1, 57, 63,
- 64, -1, 61, 62, -1, 69, 70, 71, 67, 7,
- 8, 9, 10, 11, 12, 13, 14, -1, -1, -1,
- -1, -1, 20, -1, 22, 23, 24, -1, -1, -1,
- 28, 29, -1, -1, -1, -1, 34, 35, 36, -1,
- -1, 39, -1, -1, -1, 7, 8, 9, 10, 11,
- 12, 13, 14, -1, -1, 53, -1, -1, 20, 57,
- 22, 23, 24, 61, 62, -1, 28, 29, 66, 67,
- -1, -1, 34, 35, 36, -1, -1, 39, -1, -1,
- -1, 7, 8, 9, 10, 11, 12, 13, 14, -1,
- -1, 53, -1, -1, 20, 57, 22, 23, -1, 61,
- 62, -1, 28, 29, -1, 67, -1, -1, 34, -1,
- 36, 7, 8, 9, 10, 11, 12, 13, 14, -1,
- -1, -1, -1, -1, -1, -1, -1, 53, -1, -1,
- -1, 57, -1, -1, -1, 61, 62, -1, 34, -1,
- 36, 67, -1, 7, 8, 9, 10, 11, 12, 13,
- 14, -1, -1, -1, -1, -1, -1, 53, -1, -1,
- -1, 57, -1, -1, -1, 61, 62, -1, -1, -1,
- 34, 67, 36, -1, -1, 25, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 53,
- -1, -1, -1, 57, -1, 45, 46, 61, 62, -1,
- 50, 51, 52, 67, 54, 55, 56, -1, -1, -1,
- 38, 61, 62, 63, 64, -1, -1, 45, 46, 69,
- 70, 71, 50, 51, 52, -1, 54, 55, 56, -1,
- -1, -1, 60, 61, 62, 63, 64, -1, -1, 45,
- 46, 69, 70, 71, 50, 51, 52, -1, 54, 55,
- 56, -1, 58, 59, -1, 61, 62, 63, 64, -1,
- -1, 45, 46, 69, 70, 71, 50, 51, 52, -1,
- 54, 55, 56, -1, -1, -1, 60, 61, 62, 63,
- 64, -1, -1, -1, 68, 69, 70, 71, 45, 46,
- -1, -1, -1, 50, 51, 52, -1, 54, 55, 56,
- -1, -1, -1, -1, 61, 62, 63, 64, -1, -1,
- -1, 68, 69, 70, 71, 45, 46, -1, -1, -1,
- 50, 51, 52, -1, 54, 55, 56, -1, -1, -1,
- 60, 61, 62, 63, 64, -1, -1, 45, 46, 69,
- 70, 71, 50, 51, 52, -1, 54, 55, 56, -1,
- -1, -1, -1, 61, 62, 63, 64, -1, -1, 45,
- 46, 69, 70, 71, 50, 51, 52, -1, 54, 55,
- 56, -1, -1, -1, -1, -1, -1, 63, 64, -1,
- -1, 67, -1, 69, 70, 71
+ -1, -1, -1, -1, 212, -1, -1, -1, -1, -1,
+ -1, -1, -1, 0, 1, -1, 224, -1, -1, 236,
+ -1, -1, -1, 10, 11, 12, 13, 14, 15, 16,
+ 17, -1, -1, -1, -1, -1, 23, 247, 25, 26,
+ 27, -1, -1, 30, 31, 32, -1, -1, -1, -1,
+ 37, 38, 39, -1, -1, 42, -1, -1, -1, 46,
+ 47, -1, -1, -1, -1, -1, -1, -1, -1, 56,
+ -1, -1, -1, 60, -1, -1, -1, 64, 65, -1,
+ -1, -1, 69, 70, 10, 11, 12, 13, 14, 15,
+ 16, 17, -1, -1, -1, -1, -1, 23, -1, 25,
+ 26, 27, -1, -1, 30, 31, 32, -1, -1, -1,
+ -1, 37, 38, 39, -1, -1, 42, 48, 49, -1,
+ 46, 47, 53, 54, 55, -1, 57, 58, 59, -1,
+ 56, -1, -1, -1, 60, 66, 67, -1, 64, 65,
+ -1, 72, 73, 74, 70, 10, 11, 12, 13, 14,
+ 15, 16, 17, -1, -1, -1, -1, -1, 23, -1,
+ 25, 26, 27, -1, -1, -1, 31, 32, -1, -1,
+ -1, -1, 37, 38, 39, -1, -1, 42, -1, -1,
+ -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
+ -1, 56, -1, -1, 23, 60, 25, 26, 27, 64,
+ 65, -1, 31, 32, 69, 70, -1, -1, 37, 38,
+ 39, -1, -1, 42, -1, -1, -1, 10, 11, 12,
+ 13, 14, 15, 16, 17, -1, -1, 56, -1, -1,
+ 23, 60, 25, 26, -1, 64, 65, -1, 31, 32,
+ -1, 70, -1, -1, 37, -1, 39, 10, 11, 12,
+ 13, 14, 15, 16, 17, -1, -1, -1, -1, -1,
+ -1, -1, -1, 56, -1, -1, -1, 60, -1, -1,
+ -1, 64, 65, -1, 37, -1, 39, 70, -1, 10,
+ 11, 12, 13, 14, 15, 16, 17, -1, -1, -1,
+ -1, -1, -1, 56, -1, -1, -1, 60, -1, -1,
+ -1, 64, 65, -1, -1, -1, 37, 70, 39, -1,
+ -1, 28, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 56, -1, -1, -1, 60,
+ -1, 48, 49, 64, 65, -1, 53, 54, 55, 70,
+ 57, 58, 59, -1, -1, -1, 41, 64, 65, 66,
+ 67, -1, -1, 48, 49, 72, 73, 74, 53, 54,
+ 55, -1, 57, 58, 59, -1, -1, -1, 63, 64,
+ 65, 66, 67, -1, -1, 48, 49, 72, 73, 74,
+ 53, 54, 55, -1, 57, 58, 59, -1, 61, 62,
+ -1, 64, 65, 66, 67, -1, -1, 48, 49, 72,
+ 73, 74, 53, 54, 55, -1, 57, 58, 59, -1,
+ -1, -1, 63, 64, 65, 66, 67, -1, -1, -1,
+ 71, 72, 73, 74, 48, 49, -1, -1, -1, 53,
+ 54, 55, -1, 57, 58, 59, -1, -1, -1, -1,
+ 64, 65, 66, 67, -1, -1, -1, 71, 72, 73,
+ 74, 48, 49, -1, -1, -1, 53, 54, 55, -1,
+ 57, 58, 59, -1, -1, -1, 63, 64, 65, 66,
+ 67, -1, -1, 48, 49, 72, 73, 74, 53, 54,
+ 55, -1, 57, 58, 59, -1, -1, -1, -1, 64,
+ 65, 66, 67, -1, -1, 48, 49, 72, 73, 74,
+ 53, 54, 55, -1, 57, 58, 59, -1, -1, -1,
+ -1, -1, -1, 66, 67, -1, -1, 70, -1, 72,
+ 73, 74
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 1, 7, 8, 9, 10, 11, 12, 13, 14,
- 20, 22, 23, 24, 27, 28, 29, 34, 35, 36,
- 39, 43, 44, 53, 57, 61, 62, 67, 74, 76,
- 77, 78, 79, 80, 87, 88, 89, 94, 95, 97,
- 100, 105, 66, 13, 34, 77, 94, 67, 67, 91,
- 13, 96, 14, 21, 26, 30, 31, 32, 33, 38,
- 98, 99, 13, 14, 13, 94, 40, 41, 8, 9,
- 13, 13, 13, 13, 94, 94, 94, 94, 94, 0,
- 66, 75, 67, 60, 67, 86, 94, 45, 46, 50,
- 51, 52, 54, 55, 56, 61, 62, 63, 64, 69,
- 70, 71, 94, 94, 106, 106, 106, 72, 14, 14,
- 30, 14, 21, 30, 38, 99, 101, 25, 13, 38,
- 60, 94, 38, 60, 37, 102, 58, 59, 68, 76,
- 86, 94, 86, 94, 37, 60, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 68, 72, 68, 13, 14, 14, 14, 91, 13,
- 94, 94, 38, 60, 94, 94, 94, 91, 94, 94,
- 68, 92, 68, 75, 91, 94, 94, 13, 103, 94,
- 94, 103, 93, 16, 38, 93, 78, 95, 72, 75,
- 75, 75, 79, 92, 38, 94, 92, 92, 13, 72,
- 104, 104, 19, 94, 92, 19, 42, 91, 18, 42,
- 83, 84, 90, 13, 93, 93, 35, 92, 93, 24,
- 93, 82, 83, 85, 90, 91, 84, 92, 86, 93,
- 92, 92, 85, 92, 86, 78, 42, 81, 37, 92,
- 19, 19, 19, 37, 92, 91, 92, 91, 19, 35,
- 24, 24, 93, 78, 79, 35, 92, 92
+ 0, 1, 10, 11, 12, 13, 14, 15, 16, 17,
+ 23, 25, 26, 27, 30, 31, 32, 37, 38, 39,
+ 42, 46, 47, 56, 60, 64, 65, 70, 77, 79,
+ 80, 81, 82, 83, 90, 91, 92, 97, 98, 100,
+ 103, 108, 69, 16, 37, 80, 97, 70, 70, 94,
+ 16, 99, 17, 24, 29, 33, 34, 35, 36, 41,
+ 101, 102, 16, 17, 16, 97, 43, 44, 11, 12,
+ 16, 16, 16, 16, 97, 97, 97, 97, 97, 0,
+ 69, 78, 70, 63, 70, 89, 97, 48, 49, 53,
+ 54, 55, 57, 58, 59, 64, 65, 66, 67, 72,
+ 73, 74, 97, 97, 109, 109, 109, 75, 17, 17,
+ 33, 17, 24, 33, 41, 102, 104, 28, 16, 41,
+ 63, 97, 41, 63, 40, 105, 61, 62, 71, 79,
+ 89, 97, 89, 97, 40, 63, 97, 97, 97, 97,
+ 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
+ 97, 71, 75, 71, 16, 17, 17, 17, 94, 16,
+ 97, 97, 41, 63, 97, 97, 97, 94, 97, 97,
+ 71, 95, 71, 78, 94, 97, 97, 16, 106, 97,
+ 97, 106, 96, 19, 41, 96, 81, 98, 75, 78,
+ 78, 78, 82, 95, 41, 97, 95, 95, 16, 75,
+ 107, 107, 22, 97, 95, 22, 45, 94, 21, 45,
+ 86, 87, 93, 16, 96, 96, 38, 95, 96, 27,
+ 96, 85, 86, 88, 93, 94, 87, 95, 89, 96,
+ 95, 95, 88, 95, 89, 81, 45, 84, 40, 95,
+ 22, 22, 22, 40, 95, 94, 95, 94, 22, 38,
+ 27, 27, 96, 81, 82, 38, 95, 95
};
#define yyerrok (yyerrstatus = 0)
@@ -1769,12 +1780,12 @@ yyreduce:
switch (yyn)
{
case 4:
-#line 103 "engines/director/lingo/lingo-gr.y"
+#line 104 "engines/director/lingo/lingo-gr.y"
{ yyerrok; ;}
break;
case 5:
-#line 106 "engines/director/lingo/lingo-gr.y"
+#line 107 "engines/director/lingo/lingo-gr.y"
{
g_lingo->_linenumber++;
g_lingo->_colnumber = 1;
@@ -1782,12 +1793,12 @@ yyreduce:
break;
case 10:
-#line 115 "engines/director/lingo/lingo-gr.y"
+#line 116 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 12:
-#line 119 "engines/director/lingo/lingo-gr.y"
+#line 120 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(4) - (4)].s)->c_str());
@@ -1797,7 +1808,7 @@ yyreduce:
break;
case 13:
-#line 125 "engines/director/lingo/lingo-gr.y"
+#line 126 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1807,7 +1818,7 @@ yyreduce:
break;
case 14:
-#line 131 "engines/director/lingo/lingo-gr.y"
+#line 132 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id
g_lingo->code1(g_lingo->c_theentityassign);
@@ -1819,7 +1830,7 @@ yyreduce:
break;
case 15:
-#line 139 "engines/director/lingo/lingo-gr.y"
+#line 140 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_swap);
g_lingo->code1(g_lingo->c_theentityassign);
@@ -1831,7 +1842,7 @@ yyreduce:
break;
case 16:
-#line 147 "engines/director/lingo/lingo-gr.y"
+#line 148 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_varpush);
g_lingo->codeString((yyvsp[(2) - (4)].s)->c_str());
@@ -1841,7 +1852,7 @@ yyreduce:
break;
case 17:
-#line 153 "engines/director/lingo/lingo-gr.y"
+#line 154 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id
g_lingo->code1(g_lingo->c_theentityassign);
@@ -1853,7 +1864,7 @@ yyreduce:
break;
case 18:
-#line 161 "engines/director/lingo/lingo-gr.y"
+#line 162 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_swap);
g_lingo->code1(g_lingo->c_theentityassign);
@@ -1865,12 +1876,12 @@ yyreduce:
break;
case 19:
-#line 170 "engines/director/lingo/lingo-gr.y"
+#line 171 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_xpop); ;}
break;
case 23:
-#line 179 "engines/director/lingo/lingo-gr.y"
+#line 180 "engines/director/lingo/lingo-gr.y"
{
inst body = 0, end = 0;
WRITE_UINT32(&body, (yyvsp[(5) - (8)].code));
@@ -1880,7 +1891,7 @@ yyreduce:
break;
case 24:
-#line 190 "engines/director/lingo/lingo-gr.y"
+#line 191 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (11)].code));
@@ -1896,7 +1907,7 @@ yyreduce:
break;
case 25:
-#line 206 "engines/director/lingo/lingo-gr.y"
+#line 207 "engines/director/lingo/lingo-gr.y"
{
inst init = 0, finish = 0, body = 0, end = 0, inc = 0;
WRITE_UINT32(&init, (yyvsp[(3) - (12)].code));
@@ -1912,14 +1923,14 @@ yyreduce:
break;
case 26:
-#line 218 "engines/director/lingo/lingo-gr.y"
+#line 219 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_ifcode);
;}
break;
case 27:
-#line 223 "engines/director/lingo/lingo-gr.y"
+#line 224 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (8)].code));
@@ -1930,7 +1941,7 @@ yyreduce:
break;
case 28:
-#line 230 "engines/director/lingo/lingo-gr.y"
+#line 231 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1943,7 +1954,7 @@ yyreduce:
break;
case 29:
-#line 239 "engines/director/lingo/lingo-gr.y"
+#line 240 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(5) - (11)].code));
@@ -1956,7 +1967,7 @@ yyreduce:
break;
case 30:
-#line 248 "engines/director/lingo/lingo-gr.y"
+#line 249 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -1970,7 +1981,7 @@ yyreduce:
break;
case 31:
-#line 258 "engines/director/lingo/lingo-gr.y"
+#line 259 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1984,7 +1995,7 @@ yyreduce:
break;
case 32:
-#line 268 "engines/director/lingo/lingo-gr.y"
+#line 269 "engines/director/lingo/lingo-gr.y"
{
inst then = 0, else1 = 0, end = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (10)].code));
@@ -1998,17 +2009,17 @@ yyreduce:
break;
case 33:
-#line 279 "engines/director/lingo/lingo-gr.y"
+#line 280 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = 0; ;}
break;
case 34:
-#line 280 "engines/director/lingo/lingo-gr.y"
+#line 281 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 39:
-#line 291 "engines/director/lingo/lingo-gr.y"
+#line 292 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (6)].code));
@@ -2018,7 +2029,7 @@ yyreduce:
break;
case 41:
-#line 300 "engines/director/lingo/lingo-gr.y"
+#line 301 "engines/director/lingo/lingo-gr.y"
{
inst then = 0;
WRITE_UINT32(&then, (yyvsp[(4) - (5)].code));
@@ -2028,22 +2039,22 @@ yyreduce:
break;
case 42:
-#line 308 "engines/director/lingo/lingo-gr.y"
+#line 309 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); ;}
break;
case 43:
-#line 309 "engines/director/lingo/lingo-gr.y"
+#line 310 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code2(g_lingo->c_eq, STOP); ;}
break;
case 45:
-#line 312 "engines/director/lingo/lingo-gr.y"
+#line 313 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->code3(g_lingo->c_repeatwhilecode, STOP, STOP); ;}
break;
case 46:
-#line 314 "engines/director/lingo/lingo-gr.y"
+#line 315 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code3(g_lingo->c_repeatwithcode, STOP, STOP);
g_lingo->code3(STOP, STOP, STOP);
@@ -2052,7 +2063,7 @@ yyreduce:
break;
case 47:
-#line 320 "engines/director/lingo/lingo-gr.y"
+#line 321 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_ifcode);
g_lingo->code3(STOP, STOP, STOP);
@@ -2061,7 +2072,7 @@ yyreduce:
break;
case 48:
-#line 326 "engines/director/lingo/lingo-gr.y"
+#line 327 "engines/director/lingo/lingo-gr.y"
{
inst skipEnd;
WRITE_UINT32(&skipEnd, 1); // We have to skip end to avoid multiple executions
@@ -2071,22 +2082,22 @@ yyreduce:
break;
case 49:
-#line 333 "engines/director/lingo/lingo-gr.y"
+#line 334 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 50:
-#line 335 "engines/director/lingo/lingo-gr.y"
+#line 336 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(STOP); (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 51:
-#line 337 "engines/director/lingo/lingo-gr.y"
+#line 338 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = g_lingo->_currentScript->size(); ;}
break;
case 54:
-#line 342 "engines/director/lingo/lingo-gr.y"
+#line 343 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_constpush);
inst i = 0;
@@ -2095,21 +2106,21 @@ yyreduce:
break;
case 55:
-#line 347 "engines/director/lingo/lingo-gr.y"
+#line 348 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_fconstpush);
g_lingo->codeFloat((yyvsp[(1) - (1)].f)); ;}
break;
case 56:
-#line 350 "engines/director/lingo/lingo-gr.y"
+#line 351 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_stringpush);
g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str()); ;}
break;
case 57:
-#line 353 "engines/director/lingo/lingo-gr.y"
+#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));
@@ -2119,14 +2130,14 @@ yyreduce:
break;
case 58:
-#line 359 "engines/director/lingo/lingo-gr.y"
+#line 360 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->_builtins[*(yyvsp[(1) - (1)].s)]->func);
delete (yyvsp[(1) - (1)].s); ;}
break;
case 59:
-#line 362 "engines/director/lingo/lingo-gr.y"
+#line 363 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (4)].s)->c_str());
@@ -2138,14 +2149,14 @@ yyreduce:
break;
case 60:
-#line 370 "engines/director/lingo/lingo-gr.y"
+#line 371 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
delete (yyvsp[(1) - (1)].s); ;}
break;
case 61:
-#line 373 "engines/director/lingo/lingo-gr.y"
+#line 374 "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);
@@ -2156,7 +2167,7 @@ yyreduce:
break;
case 62:
-#line 380 "engines/director/lingo/lingo-gr.y"
+#line 381 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_theentitypush);
inst e = 0, f = 0;
@@ -2166,158 +2177,158 @@ yyreduce:
break;
case 64:
-#line 387 "engines/director/lingo/lingo-gr.y"
+#line 388 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
case 65:
-#line 388 "engines/director/lingo/lingo-gr.y"
+#line 389 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
case 66:
-#line 389 "engines/director/lingo/lingo-gr.y"
+#line 390 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
case 67:
-#line 390 "engines/director/lingo/lingo-gr.y"
+#line 391 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
case 68:
-#line 391 "engines/director/lingo/lingo-gr.y"
+#line 392 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
case 69:
-#line 392 "engines/director/lingo/lingo-gr.y"
+#line 393 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
case 70:
-#line 393 "engines/director/lingo/lingo-gr.y"
+#line 394 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
case 71:
-#line 394 "engines/director/lingo/lingo-gr.y"
+#line 395 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
case 72:
-#line 395 "engines/director/lingo/lingo-gr.y"
+#line 396 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
case 73:
-#line 396 "engines/director/lingo/lingo-gr.y"
+#line 397 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_and); ;}
break;
case 74:
-#line 397 "engines/director/lingo/lingo-gr.y"
+#line 398 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_or); ;}
break;
case 75:
-#line 398 "engines/director/lingo/lingo-gr.y"
+#line 399 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_not); ;}
break;
case 76:
-#line 399 "engines/director/lingo/lingo-gr.y"
+#line 400 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ampersand); ;}
break;
case 77:
-#line 400 "engines/director/lingo/lingo-gr.y"
+#line 401 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_concat); ;}
break;
case 78:
-#line 401 "engines/director/lingo/lingo-gr.y"
+#line 402 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_contains); ;}
break;
case 79:
-#line 402 "engines/director/lingo/lingo-gr.y"
+#line 403 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_starts); ;}
break;
case 80:
-#line 403 "engines/director/lingo/lingo-gr.y"
+#line 404 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 81:
-#line 404 "engines/director/lingo/lingo-gr.y"
+#line 405 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 82:
-#line 405 "engines/director/lingo/lingo-gr.y"
+#line 406 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 83:
-#line 406 "engines/director/lingo/lingo-gr.y"
+#line 407 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_intersects); ;}
break;
case 84:
-#line 407 "engines/director/lingo/lingo-gr.y"
+#line 408 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_within); ;}
break;
case 85:
-#line 410 "engines/director/lingo/lingo-gr.y"
+#line 411 "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 411 "engines/director/lingo/lingo-gr.y"
+#line 412 "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 412 "engines/director/lingo/lingo-gr.y"
+#line 413 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 89:
-#line 414 "engines/director/lingo/lingo-gr.y"
+#line 415 "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 419 "engines/director/lingo/lingo-gr.y"
+#line 420 "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 420 "engines/director/lingo/lingo-gr.y"
+#line 421 "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 431 "engines/director/lingo/lingo-gr.y"
+#line 432 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 94:
-#line 432 "engines/director/lingo/lingo-gr.y"
+#line 433 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 95:
-#line 433 "engines/director/lingo/lingo-gr.y"
+#line 434 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 96:
-#line 434 "engines/director/lingo/lingo-gr.y"
+#line 435 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2326,7 +2337,7 @@ yyreduce:
break;
case 97:
-#line 439 "engines/director/lingo/lingo-gr.y"
+#line 440 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2336,7 +2347,7 @@ yyreduce:
break;
case 98:
-#line 445 "engines/director/lingo/lingo-gr.y"
+#line 446 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2345,47 +2356,47 @@ yyreduce:
break;
case 99:
-#line 452 "engines/director/lingo/lingo-gr.y"
+#line 453 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 100:
-#line 453 "engines/director/lingo/lingo-gr.y"
+#line 454 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 101:
-#line 454 "engines/director/lingo/lingo-gr.y"
+#line 455 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 102:
-#line 455 "engines/director/lingo/lingo-gr.y"
+#line 456 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 103:
-#line 458 "engines/director/lingo/lingo-gr.y"
+#line 459 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 104:
-#line 459 "engines/director/lingo/lingo-gr.y"
+#line 460 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 105:
-#line 460 "engines/director/lingo/lingo-gr.y"
+#line 461 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 106:
-#line 488 "engines/director/lingo/lingo-gr.y"
+#line 489 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 107:
-#line 489 "engines/director/lingo/lingo-gr.y"
+#line 490 "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);
@@ -2394,19 +2405,19 @@ yyreduce:
break;
case 108:
-#line 494 "engines/director/lingo/lingo-gr.y"
+#line 495 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeFactory(*(yyvsp[(2) - (2)].s));
;}
break;
case 109:
-#line 497 "engines/director/lingo/lingo-gr.y"
+#line 498 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 110:
-#line 498 "engines/director/lingo/lingo-gr.y"
+#line 499 "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);
@@ -2415,32 +2426,32 @@ yyreduce:
break;
case 111:
-#line 503 "engines/director/lingo/lingo-gr.y"
+#line 504 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 112:
-#line 504 "engines/director/lingo/lingo-gr.y"
+#line 505 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 113:
-#line 505 "engines/director/lingo/lingo-gr.y"
+#line 506 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 114:
-#line 506 "engines/director/lingo/lingo-gr.y"
+#line 507 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 115:
-#line 508 "engines/director/lingo/lingo-gr.y"
+#line 509 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
case 116:
-#line 512 "engines/director/lingo/lingo-gr.y"
+#line 513 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2450,23 +2461,23 @@ yyreduce:
break;
case 117:
-#line 520 "engines/director/lingo/lingo-gr.y"
+#line 521 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 118:
-#line 521 "engines/director/lingo/lingo-gr.y"
+#line 522 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
case 119:
-#line 522 "engines/director/lingo/lingo-gr.y"
+#line 523 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2470 "engines/director/lingo/lingo-gr.cpp"
+#line 2481 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2680,6 +2691,6 @@ yyreturn:
}
-#line 525 "engines/director/lingo/lingo-gr.y"
+#line 526 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 5044eac..6c093d5 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -43,59 +43,62 @@
UNARY = 259,
VOID = 260,
VAR = 261,
- INT = 262,
- THEENTITY = 263,
- THEENTITYWITHID = 264,
- FLOAT = 265,
- BLTIN = 266,
- BLTINNOARGS = 267,
- ID = 268,
- STRING = 269,
- HANDLER = 270,
- tDOWN = 271,
- tELSE = 272,
- tNLELSIF = 273,
- tEND = 274,
- tEXIT = 275,
- tFRAME = 276,
- tGLOBAL = 277,
- tGO = 278,
- tIF = 279,
- tINTO = 280,
- tLOOP = 281,
- tMACRO = 282,
- tMCI = 283,
- tMCIWAIT = 284,
- tMOVIE = 285,
- tNEXT = 286,
- tOF = 287,
- tPREVIOUS = 288,
- tPUT = 289,
- tREPEAT = 290,
- tSET = 291,
- tTHEN = 292,
- tTO = 293,
- tWHEN = 294,
- tWITH = 295,
- tWHILE = 296,
- tNLELSE = 297,
- tFACTORY = 298,
- tMETHOD = 299,
- tGE = 300,
- tLE = 301,
- tGT = 302,
- tLT = 303,
- tEQ = 304,
- tNEQ = 305,
- tAND = 306,
- tOR = 307,
- tNOT = 308,
- tCONCAT = 309,
- tCONTAINS = 310,
- tSTARTS = 311,
- tSPRITE = 312,
- tINTERSECTS = 313,
- tWITHIN = 314
+ POINT = 262,
+ RECT = 263,
+ ARRAY = 264,
+ INT = 265,
+ THEENTITY = 266,
+ THEENTITYWITHID = 267,
+ FLOAT = 268,
+ BLTIN = 269,
+ BLTINNOARGS = 270,
+ ID = 271,
+ STRING = 272,
+ HANDLER = 273,
+ tDOWN = 274,
+ tELSE = 275,
+ tNLELSIF = 276,
+ tEND = 277,
+ tEXIT = 278,
+ tFRAME = 279,
+ tGLOBAL = 280,
+ tGO = 281,
+ tIF = 282,
+ tINTO = 283,
+ tLOOP = 284,
+ tMACRO = 285,
+ tMCI = 286,
+ tMCIWAIT = 287,
+ tMOVIE = 288,
+ tNEXT = 289,
+ tOF = 290,
+ tPREVIOUS = 291,
+ tPUT = 292,
+ tREPEAT = 293,
+ tSET = 294,
+ tTHEN = 295,
+ tTO = 296,
+ tWHEN = 297,
+ tWITH = 298,
+ tWHILE = 299,
+ tNLELSE = 300,
+ tFACTORY = 301,
+ tMETHOD = 302,
+ tGE = 303,
+ tLE = 304,
+ tGT = 305,
+ tLT = 306,
+ tEQ = 307,
+ tNEQ = 308,
+ tAND = 309,
+ tOR = 310,
+ tNOT = 311,
+ tCONCAT = 312,
+ tCONTAINS = 313,
+ tSTARTS = 314,
+ tSPRITE = 315,
+ tINTERSECTS = 316,
+ tWITHIN = 317
};
#endif
/* Tokens. */
@@ -103,59 +106,62 @@
#define UNARY 259
#define VOID 260
#define VAR 261
-#define INT 262
-#define THEENTITY 263
-#define THEENTITYWITHID 264
-#define FLOAT 265
-#define BLTIN 266
-#define BLTINNOARGS 267
-#define ID 268
-#define STRING 269
-#define HANDLER 270
-#define tDOWN 271
-#define tELSE 272
-#define tNLELSIF 273
-#define tEND 274
-#define tEXIT 275
-#define tFRAME 276
-#define tGLOBAL 277
-#define tGO 278
-#define tIF 279
-#define tINTO 280
-#define tLOOP 281
-#define tMACRO 282
-#define tMCI 283
-#define tMCIWAIT 284
-#define tMOVIE 285
-#define tNEXT 286
-#define tOF 287
-#define tPREVIOUS 288
-#define tPUT 289
-#define tREPEAT 290
-#define tSET 291
-#define tTHEN 292
-#define tTO 293
-#define tWHEN 294
-#define tWITH 295
-#define tWHILE 296
-#define tNLELSE 297
-#define tFACTORY 298
-#define tMETHOD 299
-#define tGE 300
-#define tLE 301
-#define tGT 302
-#define tLT 303
-#define tEQ 304
-#define tNEQ 305
-#define tAND 306
-#define tOR 307
-#define tNOT 308
-#define tCONCAT 309
-#define tCONTAINS 310
-#define tSTARTS 311
-#define tSPRITE 312
-#define tINTERSECTS 313
-#define tWITHIN 314
+#define POINT 262
+#define RECT 263
+#define ARRAY 264
+#define INT 265
+#define THEENTITY 266
+#define THEENTITYWITHID 267
+#define FLOAT 268
+#define BLTIN 269
+#define BLTINNOARGS 270
+#define ID 271
+#define STRING 272
+#define HANDLER 273
+#define tDOWN 274
+#define tELSE 275
+#define tNLELSIF 276
+#define tEND 277
+#define tEXIT 278
+#define tFRAME 279
+#define tGLOBAL 280
+#define tGO 281
+#define tIF 282
+#define tINTO 283
+#define tLOOP 284
+#define tMACRO 285
+#define tMCI 286
+#define tMCIWAIT 287
+#define tMOVIE 288
+#define tNEXT 289
+#define tOF 290
+#define tPREVIOUS 291
+#define tPUT 292
+#define tREPEAT 293
+#define tSET 294
+#define tTHEN 295
+#define tTO 296
+#define tWHEN 297
+#define tWITH 298
+#define tWHILE 299
+#define tNLELSE 300
+#define tFACTORY 301
+#define tMETHOD 302
+#define tGE 303
+#define tLE 304
+#define tGT 305
+#define tLT 306
+#define tEQ 307
+#define tNEQ 308
+#define tAND 309
+#define tOR 310
+#define tNOT 311
+#define tCONCAT 312
+#define tCONTAINS 313
+#define tSTARTS 314
+#define tSPRITE 315
+#define tINTERSECTS 316
+#define tWITHIN 317
@@ -165,14 +171,15 @@ typedef union YYSTYPE
#line 69 "engines/director/lingo/lingo-gr.y"
{
Common::String *s;
- int i;
+ int i;
double f;
int e[2]; // Entity + field
int code;
- int narg; /* number of arguments */
+ int narg; /* number of arguments */
+ Common::Array<double> *arr;
}
/* Line 1529 of yacc.c. */
-#line 176 "engines/director/lingo/lingo-gr.hpp"
+#line 183 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 033b7dd..9ad2f75 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -68,14 +68,15 @@ void yyerror(char *s) {
%union {
Common::String *s;
- int i;
+ int i;
double f;
int e[2]; // Entity + field
int code;
- int narg; /* number of arguments */
+ int narg; /* number of arguments */
+ Common::Array<double> *arr;
}
-%token CASTREF UNARY VOID VAR
+%token CASTREF UNARY VOID VAR POINT RECT ARRAY
%token<i> INT
%token<e> THEENTITY THEENTITYWITHID
%token<f> FLOAT
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 2c25836..441cd27 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -304,6 +304,8 @@ const char *Datum::type2str() {
return "CASTREF";
case VOID:
return "VOID";
+ case POINT:
+ return "POINT";
default:
snprintf(res, 20, "-- (%d) --", type);
return res;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 1859c31..fe9d4a5 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -76,6 +76,7 @@ typedef void (*inst)(void);
#define STOP (inst)0
typedef Common::Array<inst> ScriptData;
+typedef Common::Array<double> FloatArray;
struct Symbol { /* symbol table entry */
char *name;
@@ -85,6 +86,7 @@ struct Symbol { /* symbol table entry */
double f; /* FLOAT */
ScriptData *defn; /* FUNCTION, PROCEDURE */
Common::String *s; /* STRING */
+ FloatArray *arr; /* ARRAY, POINT, RECT */
} u;
int nargs;
bool global;
@@ -100,6 +102,7 @@ struct Datum { /* interpreter stack type */
double f;
Common::String *s;
Symbol *sym;
+ FloatArray *arr; /* ARRAY, POINT, RECT */
} u;
Datum() { u.sym = NULL; type = VOID; }
@@ -258,6 +261,8 @@ public:
static void b_dontpassevent();
+ static void b_point();
+
void func_mci(Common::String &s);
void func_mciwait(Common::String &s);
void func_goto(Common::String &frame, Common::String &movie);
diff --git a/engines/director/lingo/tests/point.lingo b/engines/director/lingo/tests/point.lingo
new file mode 100644
index 0000000..4e90ddb
--- /dev/null
+++ b/engines/director/lingo/tests/point.lingo
@@ -0,0 +1,3 @@
+put point(10, 20)
+set x = point(20,30)
+put x
Commit: ba3cf6181c06ddcd543db277d1fe5a6d4506cad7
https://github.com/scummvm/scummvm/commit/ba3cf6181c06ddcd543db277d1fe5a6d4506cad7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implemented ilk() function
Changed paths:
A engines/director/lingo/tests/ilk.lingo
engines/director/lingo/lingo-builtins.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.h
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 78c7516..b23a3ce 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -49,6 +49,7 @@ static struct BuiltinProto {
{ "string", Lingo::b_string, 1},
// Misc
{ "dontpassevent", Lingo::b_dontpassevent, -1 },
+ { "ilk", Lingo::b_ilk, 1 },
// point
{ "point", Lingo::b_point, 2},
{ 0, 0, 0 }
@@ -218,6 +219,13 @@ void Lingo::b_dontpassevent() {
warning("STUB: b_dontpassevent");
}
+void Lingo::b_ilk() {
+ Datum d = g_lingo->pop();
+ d.u.i = d.type;
+ d.type = SYMBOL;
+ g_lingo->push(d);
+}
+
///////////////////
// Point
///////////////////
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index eb28dcf..fa76426 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -96,7 +96,10 @@ void Lingo::c_printtop(void) {
warning("%s", d.u.s->c_str());
break;
case POINT:
- warning("point (%d, %d)", (int)((*d.u.arr)[0]), (int)((*d.u.arr)[1]));
+ warning("point(%d, %d)", (int)((*d.u.arr)[0]), (int)((*d.u.arr)[1]));
+ break;
+ case SYMBOL:
+ warning("%s", d.type2str(true));
break;
default:
warning("--unknown--");
@@ -180,6 +183,8 @@ void Lingo::c_assign() {
d1.u.sym->u.s = new Common::String(*d2.u.s);
else if (d2.type == POINT)
d1.u.sym->u.arr = d2.u.arr;
+ else if (d2.type == SYMBOL)
+ d1.u.sym->u.i = d2.u.i;
else
error("c_assign: unhandled type: %s", d2.type2str());
@@ -223,6 +228,8 @@ void Lingo::c_eval() {
d.u.s = new Common::String(*d.u.sym->u.s);
else if (d.u.sym->type == POINT)
d.u.arr = d.u.sym->u.arr;
+ else if (d.u.sym->type == SYMBOL)
+ d.u.i = d.u.sym->u.i;
else
error("c_eval: unhandled type: %s", d.type2str());
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index 6276ee4..ed4f5a4 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -73,59 +73,60 @@
POINT = 262,
RECT = 263,
ARRAY = 264,
- INT = 265,
- THEENTITY = 266,
- THEENTITYWITHID = 267,
- FLOAT = 268,
- BLTIN = 269,
- BLTINNOARGS = 270,
- ID = 271,
- STRING = 272,
- HANDLER = 273,
- tDOWN = 274,
- tELSE = 275,
- tNLELSIF = 276,
- tEND = 277,
- tEXIT = 278,
- tFRAME = 279,
- tGLOBAL = 280,
- tGO = 281,
- tIF = 282,
- tINTO = 283,
- tLOOP = 284,
- tMACRO = 285,
- tMCI = 286,
- tMCIWAIT = 287,
- tMOVIE = 288,
- tNEXT = 289,
- tOF = 290,
- tPREVIOUS = 291,
- tPUT = 292,
- tREPEAT = 293,
- tSET = 294,
- tTHEN = 295,
- tTO = 296,
- tWHEN = 297,
- tWITH = 298,
- tWHILE = 299,
- tNLELSE = 300,
- tFACTORY = 301,
- tMETHOD = 302,
- tGE = 303,
- tLE = 304,
- tGT = 305,
- tLT = 306,
- tEQ = 307,
- tNEQ = 308,
- tAND = 309,
- tOR = 310,
- tNOT = 311,
- tCONCAT = 312,
- tCONTAINS = 313,
- tSTARTS = 314,
- tSPRITE = 315,
- tINTERSECTS = 316,
- tWITHIN = 317
+ SYMBOL = 265,
+ INT = 266,
+ THEENTITY = 267,
+ THEENTITYWITHID = 268,
+ FLOAT = 269,
+ BLTIN = 270,
+ BLTINNOARGS = 271,
+ ID = 272,
+ STRING = 273,
+ HANDLER = 274,
+ tDOWN = 275,
+ tELSE = 276,
+ tNLELSIF = 277,
+ tEND = 278,
+ tEXIT = 279,
+ tFRAME = 280,
+ tGLOBAL = 281,
+ tGO = 282,
+ tIF = 283,
+ tINTO = 284,
+ tLOOP = 285,
+ tMACRO = 286,
+ tMCI = 287,
+ tMCIWAIT = 288,
+ tMOVIE = 289,
+ tNEXT = 290,
+ tOF = 291,
+ tPREVIOUS = 292,
+ tPUT = 293,
+ tREPEAT = 294,
+ tSET = 295,
+ tTHEN = 296,
+ tTO = 297,
+ tWHEN = 298,
+ tWITH = 299,
+ tWHILE = 300,
+ tNLELSE = 301,
+ tFACTORY = 302,
+ tMETHOD = 303,
+ tGE = 304,
+ tLE = 305,
+ tGT = 306,
+ tLT = 307,
+ tEQ = 308,
+ tNEQ = 309,
+ tAND = 310,
+ tOR = 311,
+ tNOT = 312,
+ tCONCAT = 313,
+ tCONTAINS = 314,
+ tSTARTS = 315,
+ tSPRITE = 316,
+ tINTERSECTS = 317,
+ tWITHIN = 318
};
#endif
/* Tokens. */
@@ -136,59 +137,60 @@
#define POINT 262
#define RECT 263
#define ARRAY 264
-#define INT 265
-#define THEENTITY 266
-#define THEENTITYWITHID 267
-#define FLOAT 268
-#define BLTIN 269
-#define BLTINNOARGS 270
-#define ID 271
-#define STRING 272
-#define HANDLER 273
-#define tDOWN 274
-#define tELSE 275
-#define tNLELSIF 276
-#define tEND 277
-#define tEXIT 278
-#define tFRAME 279
-#define tGLOBAL 280
-#define tGO 281
-#define tIF 282
-#define tINTO 283
-#define tLOOP 284
-#define tMACRO 285
-#define tMCI 286
-#define tMCIWAIT 287
-#define tMOVIE 288
-#define tNEXT 289
-#define tOF 290
-#define tPREVIOUS 291
-#define tPUT 292
-#define tREPEAT 293
-#define tSET 294
-#define tTHEN 295
-#define tTO 296
-#define tWHEN 297
-#define tWITH 298
-#define tWHILE 299
-#define tNLELSE 300
-#define tFACTORY 301
-#define tMETHOD 302
-#define tGE 303
-#define tLE 304
-#define tGT 305
-#define tLT 306
-#define tEQ 307
-#define tNEQ 308
-#define tAND 309
-#define tOR 310
-#define tNOT 311
-#define tCONCAT 312
-#define tCONTAINS 313
-#define tSTARTS 314
-#define tSPRITE 315
-#define tINTERSECTS 316
-#define tWITHIN 317
+#define SYMBOL 265
+#define INT 266
+#define THEENTITY 267
+#define THEENTITYWITHID 268
+#define FLOAT 269
+#define BLTIN 270
+#define BLTINNOARGS 271
+#define ID 272
+#define STRING 273
+#define HANDLER 274
+#define tDOWN 275
+#define tELSE 276
+#define tNLELSIF 277
+#define tEND 278
+#define tEXIT 279
+#define tFRAME 280
+#define tGLOBAL 281
+#define tGO 282
+#define tIF 283
+#define tINTO 284
+#define tLOOP 285
+#define tMACRO 286
+#define tMCI 287
+#define tMCIWAIT 288
+#define tMOVIE 289
+#define tNEXT 290
+#define tOF 291
+#define tPREVIOUS 292
+#define tPUT 293
+#define tREPEAT 294
+#define tSET 295
+#define tTHEN 296
+#define tTO 297
+#define tWHEN 298
+#define tWITH 299
+#define tWHILE 300
+#define tNLELSE 301
+#define tFACTORY 302
+#define tMETHOD 303
+#define tGE 304
+#define tLE 305
+#define tGT 306
+#define tLT 307
+#define tEQ 308
+#define tNEQ 309
+#define tAND 310
+#define tOR 311
+#define tNOT 312
+#define tCONCAT 313
+#define tCONTAINS 314
+#define tSTARTS 315
+#define tSPRITE 316
+#define tINTERSECTS 317
+#define tWITHIN 318
@@ -246,7 +248,7 @@ typedef union YYSTYPE
Common::Array<double> *arr;
}
/* Line 193 of yacc.c. */
-#line 250 "engines/director/lingo/lingo-gr.cpp"
+#line 252 "engines/director/lingo/lingo-gr.cpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
@@ -259,7 +261,7 @@ typedef union YYSTYPE
/* Line 216 of yacc.c. */
-#line 263 "engines/director/lingo/lingo-gr.cpp"
+#line 265 "engines/director/lingo/lingo-gr.cpp"
#ifdef short
# undef short
@@ -477,7 +479,7 @@ union yyalloc
#define YYLAST 731
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 76
+#define YYNTOKENS 77
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 34
/* YYNRULES -- Number of rules. */
@@ -487,7 +489,7 @@ union yyalloc
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 317
+#define YYMAXUTOK 318
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -496,12 +498,12 @@ union yyalloc
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 69, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 70, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 68, 74, 2,
- 70, 71, 66, 64, 75, 65, 2, 67, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 69, 75, 2,
+ 71, 72, 67, 65, 76, 66, 2, 68, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 73, 63, 72, 2, 2, 2, 2, 2, 2, 2,
+ 74, 64, 73, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -526,7 +528,7 @@ static const yytype_uint8 yytranslate[] =
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59, 60, 61, 62
+ 55, 56, 57, 58, 59, 60, 61, 62, 63
};
#if YYDEBUG
@@ -551,52 +553,52 @@ static const yytype_uint16 yyprhs[] =
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 77, 0, -1, 77, 78, 79, -1, 79, -1, 1,
- 69, -1, 69, -1, -1, 103, -1, 98, -1, 108,
- -1, 80, -1, 82, -1, 37, 97, 28, 16, -1,
- 39, 16, 63, 97, -1, 39, 11, 63, 97, -1,
- 39, 12, 97, 63, 97, -1, 39, 16, 41, 97,
- -1, 39, 11, 41, 97, -1, 39, 12, 97, 41,
- 97, -1, 97, -1, 98, -1, 81, -1, 83, -1,
- 90, 70, 89, 71, 96, 95, 22, 38, -1, 91,
- 63, 97, 95, 41, 97, 95, 96, 95, 22, 38,
- -1, 91, 63, 97, 95, 19, 41, 97, 95, 96,
- 95, 22, 38, -1, 42, 16, 40, 97, -1, 92,
- 89, 40, 78, 96, 95, 22, 27, -1, 92, 89,
- 40, 78, 96, 95, 45, 96, 95, 22, 27, -1,
- 92, 89, 40, 78, 96, 95, 94, 85, 95, 22,
- 27, -1, 92, 89, 40, 94, 81, 95, -1, 92,
- 89, 40, 94, 81, 95, 45, 94, 81, 95, -1,
- 92, 89, 40, 94, 81, 95, 86, 95, 84, 95,
- -1, -1, 45, 94, 81, -1, 85, 88, -1, 88,
- -1, 86, 87, -1, 87, -1, 93, 89, 40, 94,
- 82, 95, -1, 86, -1, 93, 89, 40, 96, 95,
- -1, 97, -1, 97, 63, 97, -1, 70, 89, 71,
- -1, 38, 44, -1, 38, 43, 16, -1, 27, -1,
- 21, -1, -1, -1, -1, 96, 78, -1, 96, 82,
- -1, 10, -1, 13, -1, 17, -1, 14, 70, 109,
- 71, -1, 15, -1, 16, 70, 109, 71, -1, 16,
- -1, 11, -1, 12, 97, -1, 80, -1, 97, 64,
- 97, -1, 97, 65, 97, -1, 97, 66, 97, -1,
- 97, 67, 97, -1, 97, 72, 97, -1, 97, 73,
- 97, -1, 97, 53, 97, -1, 97, 48, 97, -1,
- 97, 49, 97, -1, 97, 54, 97, -1, 97, 55,
- 97, -1, 56, 97, -1, 97, 74, 97, -1, 97,
- 57, 97, -1, 97, 58, 97, -1, 97, 59, 97,
- -1, 64, 97, -1, 65, 97, -1, 70, 97, 71,
- -1, 60, 97, 61, 97, -1, 60, 97, 62, 97,
- -1, 31, 17, -1, 32, 16, -1, 37, 97, -1,
- 100, -1, 23, -1, 25, 99, -1, 16, -1, 99,
- 75, 16, -1, 26, 29, -1, 26, 34, -1, 26,
- 36, -1, 26, 101, -1, 26, 101, 102, -1, 26,
- 102, -1, 41, 24, 17, -1, 24, 17, -1, 41,
- 17, -1, 17, -1, 35, 33, 17, -1, 33, 17,
- -1, 41, 33, 17, -1, -1, 30, 16, 104, 94,
- 106, 78, 107, 96, -1, 46, 16, -1, -1, 47,
- 16, 105, 94, 106, 78, 107, 96, -1, -1, 16,
- -1, 106, 75, 16, -1, 106, 78, 75, 16, -1,
- -1, 16, 94, 109, -1, -1, 97, -1, 109, 75,
- 97, -1
+ 78, 0, -1, 78, 79, 80, -1, 80, -1, 1,
+ 70, -1, 70, -1, -1, 104, -1, 99, -1, 109,
+ -1, 81, -1, 83, -1, 38, 98, 29, 17, -1,
+ 40, 17, 64, 98, -1, 40, 12, 64, 98, -1,
+ 40, 13, 98, 64, 98, -1, 40, 17, 42, 98,
+ -1, 40, 12, 42, 98, -1, 40, 13, 98, 42,
+ 98, -1, 98, -1, 99, -1, 82, -1, 84, -1,
+ 91, 71, 90, 72, 97, 96, 23, 39, -1, 92,
+ 64, 98, 96, 42, 98, 96, 97, 96, 23, 39,
+ -1, 92, 64, 98, 96, 20, 42, 98, 96, 97,
+ 96, 23, 39, -1, 43, 17, 41, 98, -1, 93,
+ 90, 41, 79, 97, 96, 23, 28, -1, 93, 90,
+ 41, 79, 97, 96, 46, 97, 96, 23, 28, -1,
+ 93, 90, 41, 79, 97, 96, 95, 86, 96, 23,
+ 28, -1, 93, 90, 41, 95, 82, 96, -1, 93,
+ 90, 41, 95, 82, 96, 46, 95, 82, 96, -1,
+ 93, 90, 41, 95, 82, 96, 87, 96, 85, 96,
+ -1, -1, 46, 95, 82, -1, 86, 89, -1, 89,
+ -1, 87, 88, -1, 88, -1, 94, 90, 41, 95,
+ 83, 96, -1, 87, -1, 94, 90, 41, 97, 96,
+ -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
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -623,16 +625,17 @@ static const yytype_uint16 yyrline[] =
static const char *const yytname[] =
{
"$end", "error", "$undefined", "CASTREF", "UNARY", "VOID", "VAR",
- "POINT", "RECT", "ARRAY", "INT", "THEENTITY", "THEENTITYWITHID", "FLOAT",
- "BLTIN", "BLTINNOARGS", "ID", "STRING", "HANDLER", "tDOWN", "tELSE",
- "tNLELSIF", "tEND", "tEXIT", "tFRAME", "tGLOBAL", "tGO", "tIF", "tINTO",
- "tLOOP", "tMACRO", "tMCI", "tMCIWAIT", "tMOVIE", "tNEXT", "tOF",
- "tPREVIOUS", "tPUT", "tREPEAT", "tSET", "tTHEN", "tTO", "tWHEN", "tWITH",
- "tWHILE", "tNLELSE", "tFACTORY", "tMETHOD", "tGE", "tLE", "tGT", "tLT",
- "tEQ", "tNEQ", "tAND", "tOR", "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS",
- "tSPRITE", "tINTERSECTS", "tWITHIN", "'='", "'+'", "'-'", "'*'", "'/'",
- "'%'", "'\\n'", "'('", "')'", "'>'", "'<'", "'&'", "','", "$accept",
- "program", "nl", "programline", "asgn", "stmtoneliner", "stmt", "ifstmt",
+ "POINT", "RECT", "ARRAY", "SYMBOL", "INT", "THEENTITY",
+ "THEENTITYWITHID", "FLOAT", "BLTIN", "BLTINNOARGS", "ID", "STRING",
+ "HANDLER", "tDOWN", "tELSE", "tNLELSIF", "tEND", "tEXIT", "tFRAME",
+ "tGLOBAL", "tGO", "tIF", "tINTO", "tLOOP", "tMACRO", "tMCI", "tMCIWAIT",
+ "tMOVIE", "tNEXT", "tOF", "tPREVIOUS", "tPUT", "tREPEAT", "tSET",
+ "tTHEN", "tTO", "tWHEN", "tWITH", "tWHILE", "tNLELSE", "tFACTORY",
+ "tMETHOD", "tGE", "tLE", "tGT", "tLT", "tEQ", "tNEQ", "tAND", "tOR",
+ "tNOT", "tCONCAT", "tCONTAINS", "tSTARTS", "tSPRITE", "tINTERSECTS",
+ "tWITHIN", "'='", "'+'", "'-'", "'*'", "'/'", "'%'", "'\\n'", "'('",
+ "')'", "'>'", "'<'", "'&'", "','", "$accept", "program", "nl",
+ "programline", "asgn", "stmtoneliner", "stmt", "ifstmt",
"elsestmtoneliner", "elseifstmt", "elseifstmtoneliner",
"elseifstmtoneliner1", "elseifstmt1", "cond", "repeatwhile",
"repeatwith", "if", "elseif", "begin", "end", "stmtlist", "expr", "func",
@@ -652,26 +655,26 @@ static const yytype_uint16 yytoknum[] =
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
- 315, 316, 317, 61, 43, 45, 42, 47, 37, 10,
- 40, 41, 62, 60, 38, 44
+ 315, 316, 317, 318, 61, 43, 45, 42, 47, 37,
+ 10, 40, 41, 62, 60, 38, 44
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 76, 77, 77, 77, 78, 79, 79, 79, 79,
- 79, 79, 80, 80, 80, 80, 80, 80, 80, 81,
- 81, 82, 82, 82, 82, 82, 82, 83, 83, 83,
- 83, 83, 83, 84, 84, 85, 85, 86, 86, 87,
- 88, 88, 89, 89, 89, 90, 91, 92, 93, 94,
- 95, 96, 96, 96, 97, 97, 97, 97, 97, 97,
- 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
- 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
- 97, 97, 97, 97, 97, 98, 98, 98, 98, 98,
- 98, 99, 99, 100, 100, 100, 100, 100, 100, 101,
- 101, 101, 101, 102, 102, 102, 104, 103, 103, 105,
- 103, 106, 106, 106, 106, 107, 108, 109, 109, 109
+ 0, 77, 78, 78, 78, 79, 80, 80, 80, 80,
+ 80, 80, 81, 81, 81, 81, 81, 81, 81, 82,
+ 82, 83, 83, 83, 83, 83, 83, 84, 84, 84,
+ 84, 84, 84, 85, 85, 86, 86, 87, 87, 88,
+ 89, 89, 90, 90, 90, 91, 92, 93, 94, 95,
+ 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
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -738,41 +741,41 @@ static const yytype_int16 yydefgoto[] =
#define YYPACT_NINF -192
static const yytype_int16 yypact[] =
{
- 223, -52, -192, -192, 447, -192, -46, -192, 657, -192,
- -192, 16, 143, -192, 18, 28, 32, 447, 33, 50,
- 37, 40, 42, 447, 447, 447, 447, 447, 10, -192,
- 11, -192, -192, -192, -6, 4, 479, 635, -192, -192,
- -192, -192, -192, 17, 447, -192, 635, 447, 447, 447,
- -192, -5, -192, 57, -192, 88, -192, 77, -192, 30,
- 24, -192, -192, -192, -192, 493, 98, -192, -23, 447,
- -21, 79, -192, -192, 58, 537, 58, 58, 586, -192,
- -192, 284, 479, 447, 479, 80, 613, 447, 447, 447,
- 447, 447, 447, 447, 447, 447, 447, 447, 447, 447,
- 447, 447, 493, 635, -3, -2, 48, 118, -192, -192,
- 119, -192, 123, 124, 109, -192, -192, 127, -192, 447,
- 447, 515, 447, 447, 447, -192, 447, 447, -192, -192,
- 73, 635, 75, 559, 78, 447, 635, 635, 635, 635,
- 635, 635, 635, 635, 279, 279, 58, 58, 635, 635,
- 635, -192, 447, -192, -192, -192, -192, -192, 133, -192,
- 635, 635, 447, 447, 635, 635, 635, 133, 635, 635,
- -192, 3, -192, -192, 417, 635, 635, -192, -54, 635,
- 635, -54, 345, 110, 447, 345, -192, -192, 134, 82,
- 82, -192, -192, 131, 447, 635, -8, -12, -192, 142,
- -192, -192, 121, 635, -192, 135, -192, 140, -192, -192,
- 140, -192, 479, -192, 345, 345, -192, -192, 345, -192,
- 345, 140, 140, -192, 479, 417, -192, 125, 126, 345,
- 146, 147, -192, 153, 141, -192, -192, -192, -192, 158,
- 145, 160, 164, -9, -192, 417, -192, 381, 154, -192,
- -192, -192, 345, -192, -192, -192, -192, -192
+ 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
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
-192, -192, -26, 104, 7, -170, 0, -192, -192, -192,
- -4, -179, -27, -79, -192, -192, -192, -191, -7, -47,
- -165, 2, 23, -192, -192, -192, 137, -192, -192, -192,
- 31, 5, -192, 34
+ -4, -188, -27, -79, -192, -192, -192, -191, -7, -47,
+ -165, 2, 23, -192, -192, -192, 135, -192, -192, -192,
+ 30, 8, -192, -16
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -782,18 +785,18 @@ static const yytype_int16 yypgoto[] =
#define YYTABLE_NINF -61
static const yytype_int16 yytable[] =
{
- 32, 49, 81, 130, 186, 132, 46, 30, 185, 208,
- 79, -10, -51, -51, 205, 80, 224, 42, 119, 65,
- 122, 188, 183, 38, 47, 74, 75, 76, 77, 78,
- 224, 226, 50, 209, 62, 214, 215, 206, 86, 218,
- 120, 220, 123, 226, 184, 63, 102, 111, 64, 103,
- 103, 103, 229, 71, 112, 235, 72, 55, 73, 57,
- -51, 68, 69, 113, 82, 114, 70, 83, 151, 153,
- 107, 121, 152, 152, 108, 253, 66, 67, 252, 80,
- -10, 32, 105, 106, 86, 131, 133, 48, 30, 136,
+ 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, 109, 87, 88, 173, 158,
- 110, 89, 90, 91, 118, 92, 93, 94, 167, 124,
+ 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,
@@ -801,10 +804,10 @@ static const yytype_int16 yytable[] =
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, 201, 203, 115, 181, 0,
+ 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, 0, -6, 1, 0, 86, 0, 0, 245,
+ 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,
@@ -860,112 +863,112 @@ static const yytype_int16 yytable[] =
static const yytype_int16 yycheck[] =
{
- 0, 8, 28, 82, 174, 84, 4, 0, 173, 21,
- 0, 0, 21, 22, 22, 69, 207, 69, 41, 17,
- 41, 75, 19, 0, 70, 23, 24, 25, 26, 27,
- 221, 210, 16, 45, 16, 200, 201, 45, 36, 204,
- 63, 206, 63, 222, 41, 17, 44, 17, 16, 47,
- 48, 49, 217, 16, 24, 225, 16, 33, 16, 35,
- 69, 11, 12, 33, 70, 41, 16, 63, 71, 71,
- 75, 69, 75, 75, 17, 245, 43, 44, 243, 69,
- 69, 81, 48, 49, 82, 83, 84, 70, 81, 87,
+ 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, 17, 48, 49, 134, 116,
- 33, 53, 54, 55, 16, 57, 58, 59, 125, 40,
- 40, 119, 120, 75, 122, 123, 124, 134, 126, 127,
- 72, 73, 74, 212, 16, 182, 17, 135, 185, 186,
- 17, 17, 33, 16, 71, 224, 71, 69, 195, 16,
- 16, 41, 178, 22, 152, 181, 203, 75, 16, 38,
- 17, 21, 27, 210, 162, 163, 40, 24, 22, 22,
- 45, 218, 29, 220, 221, 22, 33, 34, 35, 36,
- 22, 40, 229, 38, 41, 81, 184, 27, 235, 196,
- 237, 27, 38, 197, 221, 190, 194, 60, 167, -1,
+ 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, -1, 0, 1, -1, 224, -1, -1, 236,
- -1, -1, -1, 10, 11, 12, 13, 14, 15, 16,
- 17, -1, -1, -1, -1, -1, 23, 247, 25, 26,
- 27, -1, -1, 30, 31, 32, -1, -1, -1, -1,
- 37, 38, 39, -1, -1, 42, -1, -1, -1, 46,
- 47, -1, -1, -1, -1, -1, -1, -1, -1, 56,
- -1, -1, -1, 60, -1, -1, -1, 64, 65, -1,
- -1, -1, 69, 70, 10, 11, 12, 13, 14, 15,
- 16, 17, -1, -1, -1, -1, -1, 23, -1, 25,
- 26, 27, -1, -1, 30, 31, 32, -1, -1, -1,
- -1, 37, 38, 39, -1, -1, 42, 48, 49, -1,
- 46, 47, 53, 54, 55, -1, 57, 58, 59, -1,
- 56, -1, -1, -1, 60, 66, 67, -1, 64, 65,
- -1, 72, 73, 74, 70, 10, 11, 12, 13, 14,
- 15, 16, 17, -1, -1, -1, -1, -1, 23, -1,
- 25, 26, 27, -1, -1, -1, 31, 32, -1, -1,
- -1, -1, 37, 38, 39, -1, -1, 42, -1, -1,
- -1, 10, 11, 12, 13, 14, 15, 16, 17, -1,
- -1, 56, -1, -1, 23, 60, 25, 26, 27, 64,
- 65, -1, 31, 32, 69, 70, -1, -1, 37, 38,
- 39, -1, -1, 42, -1, -1, -1, 10, 11, 12,
- 13, 14, 15, 16, 17, -1, -1, 56, -1, -1,
- 23, 60, 25, 26, -1, 64, 65, -1, 31, 32,
- -1, 70, -1, -1, 37, -1, 39, 10, 11, 12,
- 13, 14, 15, 16, 17, -1, -1, -1, -1, -1,
- -1, -1, -1, 56, -1, -1, -1, 60, -1, -1,
- -1, 64, 65, -1, 37, -1, 39, 70, -1, 10,
- 11, 12, 13, 14, 15, 16, 17, -1, -1, -1,
- -1, -1, -1, 56, -1, -1, -1, 60, -1, -1,
- -1, 64, 65, -1, -1, -1, 37, 70, 39, -1,
- -1, 28, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 56, -1, -1, -1, 60,
- -1, 48, 49, 64, 65, -1, 53, 54, 55, 70,
- 57, 58, 59, -1, -1, -1, 41, 64, 65, 66,
- 67, -1, -1, 48, 49, 72, 73, 74, 53, 54,
- 55, -1, 57, 58, 59, -1, -1, -1, 63, 64,
- 65, 66, 67, -1, -1, 48, 49, 72, 73, 74,
- 53, 54, 55, -1, 57, 58, 59, -1, 61, 62,
- -1, 64, 65, 66, 67, -1, -1, 48, 49, 72,
- 73, 74, 53, 54, 55, -1, 57, 58, 59, -1,
- -1, -1, 63, 64, 65, 66, 67, -1, -1, -1,
- 71, 72, 73, 74, 48, 49, -1, -1, -1, 53,
- 54, 55, -1, 57, 58, 59, -1, -1, -1, -1,
- 64, 65, 66, 67, -1, -1, -1, 71, 72, 73,
- 74, 48, 49, -1, -1, -1, 53, 54, 55, -1,
- 57, 58, 59, -1, -1, -1, 63, 64, 65, 66,
- 67, -1, -1, 48, 49, 72, 73, 74, 53, 54,
- 55, -1, 57, 58, 59, -1, -1, -1, -1, 64,
- 65, 66, 67, -1, -1, 48, 49, 72, 73, 74,
- 53, 54, 55, -1, 57, 58, 59, -1, -1, -1,
- -1, -1, -1, 66, 67, -1, -1, 70, -1, 72,
- 73, 74
+ -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,
+ 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, 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,
+ 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,
+ 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,
+ 54, 55, 56, -1, 58, 59, 60, -1, -1, -1,
+ -1, -1, -1, 67, 68, -1, -1, 71, -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, 10, 11, 12, 13, 14, 15, 16, 17,
- 23, 25, 26, 27, 30, 31, 32, 37, 38, 39,
- 42, 46, 47, 56, 60, 64, 65, 70, 77, 79,
- 80, 81, 82, 83, 90, 91, 92, 97, 98, 100,
- 103, 108, 69, 16, 37, 80, 97, 70, 70, 94,
- 16, 99, 17, 24, 29, 33, 34, 35, 36, 41,
- 101, 102, 16, 17, 16, 97, 43, 44, 11, 12,
- 16, 16, 16, 16, 97, 97, 97, 97, 97, 0,
- 69, 78, 70, 63, 70, 89, 97, 48, 49, 53,
- 54, 55, 57, 58, 59, 64, 65, 66, 67, 72,
- 73, 74, 97, 97, 109, 109, 109, 75, 17, 17,
- 33, 17, 24, 33, 41, 102, 104, 28, 16, 41,
- 63, 97, 41, 63, 40, 105, 61, 62, 71, 79,
- 89, 97, 89, 97, 40, 63, 97, 97, 97, 97,
- 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
- 97, 71, 75, 71, 16, 17, 17, 17, 94, 16,
- 97, 97, 41, 63, 97, 97, 97, 94, 97, 97,
- 71, 95, 71, 78, 94, 97, 97, 16, 106, 97,
- 97, 106, 96, 19, 41, 96, 81, 98, 75, 78,
- 78, 78, 82, 95, 41, 97, 95, 95, 16, 75,
- 107, 107, 22, 97, 95, 22, 45, 94, 21, 45,
- 86, 87, 93, 16, 96, 96, 38, 95, 96, 27,
- 96, 85, 86, 88, 93, 94, 87, 95, 89, 96,
- 95, 95, 88, 95, 89, 81, 45, 84, 40, 95,
- 22, 22, 22, 40, 95, 94, 95, 94, 22, 38,
- 27, 27, 96, 81, 82, 38, 95, 95
+ 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
};
#define yyerrok (yyerrstatus = 0)
@@ -2477,7 +2480,7 @@ yyreduce:
/* Line 1267 of yacc.c. */
-#line 2481 "engines/director/lingo/lingo-gr.cpp"
+#line 2484 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
diff --git a/engines/director/lingo/lingo-gr.h b/engines/director/lingo/lingo-gr.h
index 6c093d5..a806533 100644
--- a/engines/director/lingo/lingo-gr.h
+++ b/engines/director/lingo/lingo-gr.h
@@ -46,59 +46,60 @@
POINT = 262,
RECT = 263,
ARRAY = 264,
- INT = 265,
- THEENTITY = 266,
- THEENTITYWITHID = 267,
- FLOAT = 268,
- BLTIN = 269,
- BLTINNOARGS = 270,
- ID = 271,
- STRING = 272,
- HANDLER = 273,
- tDOWN = 274,
- tELSE = 275,
- tNLELSIF = 276,
- tEND = 277,
- tEXIT = 278,
- tFRAME = 279,
- tGLOBAL = 280,
- tGO = 281,
- tIF = 282,
- tINTO = 283,
- tLOOP = 284,
- tMACRO = 285,
- tMCI = 286,
- tMCIWAIT = 287,
- tMOVIE = 288,
- tNEXT = 289,
- tOF = 290,
- tPREVIOUS = 291,
- tPUT = 292,
- tREPEAT = 293,
- tSET = 294,
- tTHEN = 295,
- tTO = 296,
- tWHEN = 297,
- tWITH = 298,
- tWHILE = 299,
- tNLELSE = 300,
- tFACTORY = 301,
- tMETHOD = 302,
- tGE = 303,
- tLE = 304,
- tGT = 305,
- tLT = 306,
- tEQ = 307,
- tNEQ = 308,
- tAND = 309,
- tOR = 310,
- tNOT = 311,
- tCONCAT = 312,
- tCONTAINS = 313,
- tSTARTS = 314,
- tSPRITE = 315,
- tINTERSECTS = 316,
- tWITHIN = 317
+ SYMBOL = 265,
+ INT = 266,
+ THEENTITY = 267,
+ THEENTITYWITHID = 268,
+ FLOAT = 269,
+ BLTIN = 270,
+ BLTINNOARGS = 271,
+ ID = 272,
+ STRING = 273,
+ HANDLER = 274,
+ tDOWN = 275,
+ tELSE = 276,
+ tNLELSIF = 277,
+ tEND = 278,
+ tEXIT = 279,
+ tFRAME = 280,
+ tGLOBAL = 281,
+ tGO = 282,
+ tIF = 283,
+ tINTO = 284,
+ tLOOP = 285,
+ tMACRO = 286,
+ tMCI = 287,
+ tMCIWAIT = 288,
+ tMOVIE = 289,
+ tNEXT = 290,
+ tOF = 291,
+ tPREVIOUS = 292,
+ tPUT = 293,
+ tREPEAT = 294,
+ tSET = 295,
+ tTHEN = 296,
+ tTO = 297,
+ tWHEN = 298,
+ tWITH = 299,
+ tWHILE = 300,
+ tNLELSE = 301,
+ tFACTORY = 302,
+ tMETHOD = 303,
+ tGE = 304,
+ tLE = 305,
+ tGT = 306,
+ tLT = 307,
+ tEQ = 308,
+ tNEQ = 309,
+ tAND = 310,
+ tOR = 311,
+ tNOT = 312,
+ tCONCAT = 313,
+ tCONTAINS = 314,
+ tSTARTS = 315,
+ tSPRITE = 316,
+ tINTERSECTS = 317,
+ tWITHIN = 318
};
#endif
/* Tokens. */
@@ -109,59 +110,60 @@
#define POINT 262
#define RECT 263
#define ARRAY 264
-#define INT 265
-#define THEENTITY 266
-#define THEENTITYWITHID 267
-#define FLOAT 268
-#define BLTIN 269
-#define BLTINNOARGS 270
-#define ID 271
-#define STRING 272
-#define HANDLER 273
-#define tDOWN 274
-#define tELSE 275
-#define tNLELSIF 276
-#define tEND 277
-#define tEXIT 278
-#define tFRAME 279
-#define tGLOBAL 280
-#define tGO 281
-#define tIF 282
-#define tINTO 283
-#define tLOOP 284
-#define tMACRO 285
-#define tMCI 286
-#define tMCIWAIT 287
-#define tMOVIE 288
-#define tNEXT 289
-#define tOF 290
-#define tPREVIOUS 291
-#define tPUT 292
-#define tREPEAT 293
-#define tSET 294
-#define tTHEN 295
-#define tTO 296
-#define tWHEN 297
-#define tWITH 298
-#define tWHILE 299
-#define tNLELSE 300
-#define tFACTORY 301
-#define tMETHOD 302
-#define tGE 303
-#define tLE 304
-#define tGT 305
-#define tLT 306
-#define tEQ 307
-#define tNEQ 308
-#define tAND 309
-#define tOR 310
-#define tNOT 311
-#define tCONCAT 312
-#define tCONTAINS 313
-#define tSTARTS 314
-#define tSPRITE 315
-#define tINTERSECTS 316
-#define tWITHIN 317
+#define SYMBOL 265
+#define INT 266
+#define THEENTITY 267
+#define THEENTITYWITHID 268
+#define FLOAT 269
+#define BLTIN 270
+#define BLTINNOARGS 271
+#define ID 272
+#define STRING 273
+#define HANDLER 274
+#define tDOWN 275
+#define tELSE 276
+#define tNLELSIF 277
+#define tEND 278
+#define tEXIT 279
+#define tFRAME 280
+#define tGLOBAL 281
+#define tGO 282
+#define tIF 283
+#define tINTO 284
+#define tLOOP 285
+#define tMACRO 286
+#define tMCI 287
+#define tMCIWAIT 288
+#define tMOVIE 289
+#define tNEXT 290
+#define tOF 291
+#define tPREVIOUS 292
+#define tPUT 293
+#define tREPEAT 294
+#define tSET 295
+#define tTHEN 296
+#define tTO 297
+#define tWHEN 298
+#define tWITH 299
+#define tWHILE 300
+#define tNLELSE 301
+#define tFACTORY 302
+#define tMETHOD 303
+#define tGE 304
+#define tLE 305
+#define tGT 306
+#define tLT 307
+#define tEQ 308
+#define tNEQ 309
+#define tAND 310
+#define tOR 311
+#define tNOT 312
+#define tCONCAT 313
+#define tCONTAINS 314
+#define tSTARTS 315
+#define tSPRITE 316
+#define tINTERSECTS 317
+#define tWITHIN 318
@@ -179,7 +181,7 @@ typedef union YYSTYPE
Common::Array<double> *arr;
}
/* Line 1529 of yacc.c. */
-#line 183 "engines/director/lingo/lingo-gr.hpp"
+#line 185 "engines/director/lingo/lingo-gr.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 9ad2f75..6df71f9 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -76,7 +76,7 @@ void yyerror(char *s) {
Common::Array<double> *arr;
}
-%token CASTREF UNARY VOID VAR POINT RECT ARRAY
+%token CASTREF UNARY VOID VAR POINT RECT ARRAY SYMBOL
%token<i> INT
%token<e> THEENTITY THEENTITYWITHID
%token<f> FLOAT
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 441cd27..0bb4309 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -290,22 +290,24 @@ Common::String *Datum::toString() {
return u.s;
}
-const char *Datum::type2str() {
+const char *Datum::type2str(bool isk) {
static char res[20];
- switch (type) {
+ switch (isk ? u.i : type) {
case INT:
- return "INT";
+ return isk ? "#integer" : "INT";
case FLOAT:
- return "FLOAT";
+ return isk ? "#float" : "FLOAT";
case STRING:
- return "STRING";
+ return isk ? "#string" : "STRING";
case CASTREF:
return "CASTREF";
case VOID:
- return "VOID";
+ return isk ? "#void" : "VOID";
case POINT:
- return "POINT";
+ return isk ? "#point" : "POINT";
+ case SYMBOL:
+ return isk ? "#symbol" : "SYMBOL";
default:
snprintf(res, 20, "-- (%d) --", type);
return res;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index fe9d4a5..85db22c 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -111,7 +111,7 @@ struct Datum { /* interpreter stack type */
int toInt();
Common::String *toString();
- const char *type2str();
+ const char *type2str(bool isk = false);
};
struct Builtin {
@@ -260,6 +260,7 @@ public:
static void b_tan();
static void b_dontpassevent();
+ static void b_ilk();
static void b_point();
diff --git a/engines/director/lingo/tests/ilk.lingo b/engines/director/lingo/tests/ilk.lingo
new file mode 100644
index 0000000..686d9a5
--- /dev/null
+++ b/engines/director/lingo/tests/ilk.lingo
@@ -0,0 +1,7 @@
+put ilk(10)
+put ilk(20.0)
+put ilk("Macromedia")
+put ilk(point(10, 20))
+put ilk(ilk(10))
+set x = point(10, 20)
+put ilk(x)
Commit: 3fb7f5ac7bf02ae88026be59daed02475af4149f
https://github.com/scummvm/scummvm/commit/3fb7f5ac7bf02ae88026be59daed02475af4149f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Plug memory leak at assignment
Changed paths:
engines/director/lingo/lingo-code.cpp
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index fa76426..ab42c0d 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -175,15 +175,20 @@ void Lingo::c_assign() {
if (d1.u.sym->type == STRING) // Free memory if needed
delete d1.u.sym->u.s;
- if (d2.type == INT)
+ if (d1.u.sym->type == POINT || d1.u.sym->type == RECT || d1.u.sym->type == ARRAY)
+ delete d1.u.sym->u.arr;
+
+ if (d2.type == INT) {
d1.u.sym->u.i = d2.u.i;
- else if (d2.type == FLOAT)
+ } else if (d2.type == FLOAT) {
d1.u.sym->u.f = d2.u.f;
- else if (d2.type == STRING)
+ } else if (d2.type == STRING) {
d1.u.sym->u.s = new Common::String(*d2.u.s);
- else if (d2.type == POINT)
- d1.u.sym->u.arr = d2.u.arr;
- else if (d2.type == SYMBOL)
+ delete d2.u.s;
+ } else if (d2.type == POINT) {
+ d1.u.sym->u.arr = new FloatArray(*d2.u.arr);
+ delete d2.u.arr;
+ } else if (d2.type == SYMBOL) {
d1.u.sym->u.i = d2.u.i;
else
error("c_assign: unhandled type: %s", d2.type2str());
Commit: 06dd3651c7f86478deedabf6b530d11b78858c6b
https://github.com/scummvm/scummvm/commit/06dd3651c7f86478deedabf6b530d11b78858c6b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Issue warning instead of error at unhandled types
Changed paths:
engines/director/lingo/lingo-code.cpp
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index ab42c0d..0bc6c9d 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -190,8 +190,9 @@ void Lingo::c_assign() {
delete d2.u.arr;
} else if (d2.type == SYMBOL) {
d1.u.sym->u.i = d2.u.i;
- else
- error("c_assign: unhandled type: %s", d2.type2str());
+ } else {
+ warning("c_assign: unhandled type: %s", d2.type2str());
+ }
d1.u.sym->type = d2.type;
@@ -236,7 +237,7 @@ void Lingo::c_eval() {
else if (d.u.sym->type == SYMBOL)
d.u.i = d.u.sym->u.i;
else
- error("c_eval: unhandled type: %s", d.type2str());
+ warning("c_eval: unhandled type: %s", d.type2str());
g_lingo->push(d);
}
Commit: 3882a54ade751c8ca6ff25ba5087f626fb13f153
https://github.com/scummvm/scummvm/commit/3882a54ade751c8ca6ff25ba5087f626fb13f153
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Added updateStage stub
Changed paths:
engines/director/lingo/lingo-builtins.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index b23a3ce..312ff66 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -49,6 +49,7 @@ static struct BuiltinProto {
{ "string", Lingo::b_string, 1},
// Misc
{ "dontpassevent", Lingo::b_dontpassevent, -1 },
+ { "updatestage", Lingo::b_updatestage, -1 },
{ "ilk", Lingo::b_ilk, 1 },
// point
{ "point", Lingo::b_point, 2},
@@ -219,6 +220,10 @@ void Lingo::b_dontpassevent() {
warning("STUB: b_dontpassevent");
}
+void Lingo::b_updatestage() {
+ warning("STUB: b_updatestage");
+}
+
void Lingo::b_ilk() {
Datum d = g_lingo->pop();
d.u.i = d.type;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 85db22c..c61f38a 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -260,6 +260,7 @@ public:
static void b_tan();
static void b_dontpassevent();
+ static void b_updatestage();
static void b_ilk();
static void b_point();
Commit: f7009628cca1ad8461c353f44ae5c167afcd7612
https://github.com/scummvm/scummvm/commit/f7009628cca1ad8461c353f44ae5c167afcd7612
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Added tests for type conversion
Changed paths:
engines/director/lingo/tests/math.lingo
diff --git a/engines/director/lingo/tests/math.lingo b/engines/director/lingo/tests/math.lingo
index d4b3d96..e1a877a 100644
--- a/engines/director/lingo/tests/math.lingo
+++ b/engines/director/lingo/tests/math.lingo
@@ -10,3 +10,8 @@ put cos(z2)
set x = 2 + 3 * (4 / 2)
put x
+
+-- Type conversion
+put (1024/4096)*100 -- 0
+put (1024/4096)*100.0 -- 0.0
+put ((1024*1.0)/4096)*100.0 -- 25.0
Commit: 991e58b17774239b9b951d0789943ef796eedeac
https://github.com/scummvm/scummvm/commit/991e58b17774239b9b951d0789943ef796eedeac
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
BUILD: Added *.output to git ignore list
Changed paths:
.gitignore
diff --git a/.gitignore b/.gitignore
index 2ad1042..270fb56 100644
--- a/.gitignore
+++ b/.gitignore
@@ -196,3 +196,6 @@ ScummVM.includes
#Ignore MS Visual C++ temporary files/subdirectories (except create_project.bat)
dists/msvc*/**
!dists/msvc*/create_project.bat
+
+#Ignore bison debug output
+*.output
Commit: 36fa951f6026ccb7ec25a29fffdd4130d4c84668
https://github.com/scummvm/scummvm/commit/36fa951f6026ccb7ec25a29fffdd4130d4c84668
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Remove leftover .gitignore
Changed paths:
R engines/director/.gitignore
diff --git a/engines/director/.gitignore b/engines/director/.gitignore
deleted file mode 100644
index ba6aed1..0000000
--- a/engines/director/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*~
-*.o
-lib*.a
-.deps
\ No newline at end of file
Commit: f0990e7221f256e819a080e3a6fada29415f6356
https://github.com/scummvm/scummvm/commit/f0990e7221f256e819a080e3a6fada29415f6356
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add extra fields for sprites
The presence of these fields depends on the type of sprite
Changed paths:
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 15b197c..becf035 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1604,6 +1604,20 @@ Sprite::Sprite() {
_constraint = 0;
_moveable = 0;
_castId = 0;
+ _backColor = 0;
+ _foreColor = 0;
+ _left = 0;
+ _right = 0;
+ _top = 0;
+ _bottom = 0;
+ _visible = false;
+ _movieRate = 0;
+ _movieTime = 0;
+ _startTime = 0;
+ _stopTime = 0;
+ _volume = 0;
+ _stretch = 0;
+ _type = 0;
}
Sprite::Sprite(const Sprite &sprite) {
@@ -1616,6 +1630,19 @@ Sprite::Sprite(const Sprite &sprite) {
_height = sprite._height;
_startPoint.x = sprite._startPoint.x;
_startPoint.y = sprite._startPoint.y;
+ _backColor = sprite._backColor;
+ _foreColor = sprite._foreColor;
+ _left = sprite._left;
+ _right = sprite._right;
+ _top = sprite._top;
+ _bottom = sprite._bottom;
+ _visible = sprite._visible;
+ _movieRate = sprite._movieRate;
+ _movieTime = sprite._movieTime;
+ _stopTime = sprite._stopTime;
+ _volume = sprite._volume;
+ _stretch = sprite._stretch;
+ _type = sprite._type;
}
Sprite::~Sprite() {
diff --git a/engines/director/score.h b/engines/director/score.h
index 005e6f8..3477610 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -291,6 +291,26 @@ public:
//As i know, constrainted != 0 only if sprite moveable
byte _constraint;
byte _moveable;
+ byte _backColor;
+ byte _foreColor;
+ uint16 _left;
+ uint16 _right;
+ uint16 _top;
+ uint16 _bottom;
+ byte _blend;
+ bool _visible;
+ byte _type;
+ //Using in digital movie sprites
+ byte _movieRate;
+ uint16 _movieTime;
+ uint16 _startTime;
+ uint16 _stopTime;
+ byte _volume;
+ byte _stretch;
+ //Using in shape sprites
+ byte _lineSize;
+ //Using in text sprites
+ Common::String _editableText;
};
class Frame {
Commit: 240988fad4150c4bfea33ae3a65ca512e3cb452a
https://github.com/scummvm/scummvm/commit/240988fad4150c4bfea33ae3a65ca512e3cb452a
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Add enum for sprite types
According to the Director 4 helper
Changed paths:
engines/director/score.h
diff --git a/engines/director/score.h b/engines/director/score.h
index 3477610..b4abeb6 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -55,6 +55,22 @@ enum CastType {
kCastScript
};
+//Director v4
+enum SpriteType {
+ kInactiveSprite, //turns the sprite off
+ kBitmapSprite,
+ kRectangleSprite,
+ kRoundedRectangleSprite,
+ kOvalSprite,
+ kLineTopBottomSprite, //line from top left to bottom right
+ kLineBottomTopSprite, //line from bottom left to top right
+ kTextSprite,
+ kButtonSprite,
+ kCheckboxSprite,
+ kRadioButtonSprite,
+ kUndeterminedSprite = 16 //use castType property to examine the type of cast member associated with sprite
+};
+
enum SpritePosition {
kSpritePositionUnk1 = 0,
kSpritePositionEnabled,
Commit: d9db9863ceb1b59ded3388a1e2ad616ababa4735
https://github.com/scummvm/scummvm/commit/d9db9863ceb1b59ded3388a1e2ad616ababa4735
Author: Dmitry Iskrich (zebster26 at mail.ru)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Add extra sprite and string fields to "the entities"
Changed paths:
engines/director/lingo/lingo-the.cpp
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index b2e412f..f2d01fe 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -242,7 +242,60 @@ void Lingo::setTheSprite(Datum &id1, int field, Datum &d) {
case kTheConstraint:
sprite->_constraint = d.u.i;
break;
-
+ case kTheMoveable:
+ sprite->_moveable = d.u.i;
+ break;
+ case kTheBackColor:
+ sprite->_backColor = d.u.i;
+ break;
+ case kTheForeColor:
+ sprite->_foreColor = d.u.i;
+ break;
+ case kTheLeft:
+ sprite->_left = d.u.i;
+ break;
+ case kTheRight:
+ sprite->_right = d.u.i;
+ break;
+ case kTheTop:
+ sprite->_top = d.u.i;
+ break;
+ case kTheBottom:
+ sprite->_bottom = d.u.i;
+ break;
+ case kTheBlend:
+ sprite->_blend = d.u.i;
+ break;
+ case kTheVisible:
+ sprite->_visible = (d.u.i == 0 ? false : true);
+ break;
+ case kTheType:
+ sprite->_type = d.u.i;
+ break;
+ case kTheMovieRate:
+ sprite->_movieRate = d.u.i;
+ break;
+ case kTheMovieTime:
+ sprite->_movieTime = d.u.i;
+ break;
+ case kTheStopTime:
+ sprite->_stopTime = d.u.i;
+ break;
+ case kTheStartTime:
+ sprite->_startTime = d.u.i;
+ break;
+ case kTheStretch:
+ sprite->_stretch = d.u.i;
+ break;
+ case kTheVolume:
+ sprite->_volume = d.u.i;
+ break;
+ case kTheLineSize:
+ sprite->_lineSize = d.u.i;
+ break;
+ case kTheEditableText:
+ sprite->_editableText = *d.toString();
+ break;
default:
warning("Unprocessed setting field %d of sprite", field);
}
@@ -320,6 +373,61 @@ Datum Lingo::getTheSprite(Datum &id1, int field) {
case kTheConstraint:
d.u.i = sprite->_constraint;
break;
+ case kTheMoveable:
+ d.u.i = sprite->_moveable;
+ break;
+ case kTheBackColor:
+ d.u.i = sprite->_backColor;
+ break;
+ case kTheForeColor:
+ d.u.i = sprite->_foreColor;
+ break;
+ case kTheLeft:
+ d.u.i = sprite->_left;
+ break;
+ case kTheRight:
+ d.u.i = sprite->_right;
+ break;
+ case kTheBottom:
+ d.u.i = sprite->_bottom;
+ break;
+ case kTheTop:
+ d.u.i = sprite->_top;
+ break;
+ case kTheBlend:
+ d.u.i = sprite->_blend;
+ break;
+ case kTheVisible:
+ d.u.i = (sprite->_visible ? 1 : 0);
+ break;
+ case kTheType:
+ d.u.i = sprite->_type;
+ break;
+ case kTheMovieRate:
+ d.u.i = sprite->_movieRate;
+ break;
+ case kTheMovieTime:
+ d.u.i = sprite->_movieTime;
+ break;
+ case kTheStopTime:
+ d.u.i = sprite->_stopTime;
+ break;
+ case kTheStartTime:
+ d.u.i = sprite->_startTime;
+ break;
+ case kTheVolume:
+ d.u.i = sprite->_volume;
+ break;
+ case kTheStretch:
+ d.u.i = sprite->_stretch;
+ break;
+ case kTheLineSize:
+ d.u.i = sprite->_lineSize;
+ break;
+ case kTheEditableText:
+ d.toString();
+ d.u.s = &sprite->_editableText;
+ break;
default:
warning("Unprocessed getting field %d of sprite", field);
d.type = VOID;
@@ -345,6 +453,7 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
}
Cast *cast;
+ CastInfo *castInfo;
if (!_vm->_currentScore->_casts.contains(id)) {
if (field == kTheLoaded) {
d.type = INT;
@@ -357,6 +466,7 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
return d;
}
cast = _vm->_currentScore->_casts[id];
+ castInfo = _vm->_currentScore->_castsInfo[id];
d.type = INT;
@@ -364,6 +474,18 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
case kTheCastType:
d.u.i = cast->type;
break;
+ case kTheFilename:
+ d.toString();
+ d.u.s = &castInfo->fileName;
+ break;
+ case kTheName:
+ d.toString();
+ d.u.s = &castInfo->name;
+ break;
+ case kTheScriptText:
+ d.toString();
+ d.u.s = &castInfo->script;
+ break;
case kTheWidth:
d.u.i = cast->initialRect.width();
break;
@@ -422,6 +544,7 @@ void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
}
Cast *cast = _vm->_currentScore->_casts[id];
+ CastInfo *castInfo = _vm->_currentScore->_castsInfo[id];
if (!cast) {
warning("The cast %d found", id);
@@ -433,6 +556,15 @@ void Lingo::setTheCast(Datum &id1, int field, Datum &d) {
cast->type = static_cast<CastType>(d.u.i);
cast->modified = 1;
break;
+ case kTheFilename:
+ castInfo->fileName = *d.u.s;
+ break;
+ case kTheName:
+ castInfo->name = *d.u.s;
+ break;
+ case kTheScriptText:
+ castInfo->script = *d.u.s;
+ break;
case kTheWidth:
cast->initialRect.setWidth(d.u.i);
cast->modified = 1;
Commit: c8f0b74a635d24be2b7f802290ee6a47ce64e935
https://github.com/scummvm/scummvm/commit/c8f0b74a635d24be2b7f802290ee6a47ce64e935
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
JANITORIAL: Whitespace fixes
Changed paths:
engines/director/lingo/lingo-builtins.cpp
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 312ff66..0c10337 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -30,29 +30,29 @@ static struct BuiltinProto {
int nparams;
} builtins[] = {
// Math
- { "abs", Lingo::b_abs, 1},
- { "atan", Lingo::b_atan, 1},
- { "cos", Lingo::b_cos, 1},
- { "exp", Lingo::b_exp, 1},
- { "float", Lingo::b_float, 1},
- { "integer",Lingo::b_integer, 1},
- { "log", Lingo::b_log, 1},
- { "pi", Lingo::b_pi, 0},
- { "power", Lingo::b_power, 2},
- { "random", Lingo::b_random, 1},
- { "sin", Lingo::b_sin, 1},
- { "sqrt", Lingo::b_sqrt, 1},
- { "tan", Lingo::b_tan, 1},
+ { "abs", Lingo::b_abs, 1 },
+ { "atan", Lingo::b_atan, 1 },
+ { "cos", Lingo::b_cos, 1 },
+ { "exp", Lingo::b_exp, 1 },
+ { "float", Lingo::b_float, 1 },
+ { "integer",Lingo::b_integer, 1 },
+ { "log", Lingo::b_log, 1 },
+ { "pi", Lingo::b_pi, 0 },
+ { "power", Lingo::b_power, 2 },
+ { "random", Lingo::b_random, 1 },
+ { "sin", Lingo::b_sin, 1 },
+ { "sqrt", Lingo::b_sqrt, 1 },
+ { "tan", Lingo::b_tan, 1 },
// String
- { "chars", Lingo::b_chars, 3},
- { "length", Lingo::b_length, 1},
- { "string", Lingo::b_string, 1},
+ { "chars", Lingo::b_chars, 3 },
+ { "length", Lingo::b_length, 1 },
+ { "string", Lingo::b_string, 1 },
// Misc
{ "dontpassevent", Lingo::b_dontpassevent, -1 },
{ "updatestage", Lingo::b_updatestage, -1 },
{ "ilk", Lingo::b_ilk, 1 },
// point
- { "point", Lingo::b_point, 2},
+ { "point", Lingo::b_point, 2 },
{ 0, 0, 0 }
};
Commit: 783ff8f8f259684c841af3d99a0df7542e16058e
https://github.com/scummvm/scummvm/commit/783ff8f8f259684c841af3d99a0df7542e16058e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Turn builtins into normal symbols
Changed paths:
engines/director/lingo/lingo-builtins.cpp
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
engines/director/lingo/lingo.h
engines/director/lingo/tests/math.lingo
diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 0c10337..e44fc69 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 0bc6c9d..7b367d9 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 ed4f5a4..a26ecfd 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 6df71f9..cfed29a 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 4ffa450..f4e3541 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 5670316..9532da4 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 c61f38a..e15e979 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 e1a877a..9c0b2d5 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
Commit: dc498881ef721b9443f64914e9a42bcf5afc967f
https://github.com/scummvm/scummvm/commit/dc498881ef721b9443f64914e9a42bcf5afc967f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Process extra or too few arguments for built-ins
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/tests/math.lingo
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 7b367d9..344fbc2 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -702,7 +702,20 @@ void Lingo::c_call() {
Symbol *sym = g_lingo->_handlers[name];
+ if (sym->nargs < nargs) {
+ warning("Incorrect number of arguments for function %s. Dropping extra %d", name.c_str(), nargs - sym->nargs);
+ for (int i = 0; i < nargs - sym->nargs; i++)
+ g_lingo->pop();
+ }
+
if (sym->type == BLTIN) {
+ if (sym->nargs > 0 && nargs < sym->nargs) {
+ warning("Too few arguments for function %s. Expecting %d but got %d", name.c_str(), sym->nargs, nargs);
+ for (int i = 0; i < nargs; i++)
+ g_lingo->pop();
+
+ return;
+ }
(*sym->u.func)();
return;
diff --git a/engines/director/lingo/tests/math.lingo b/engines/director/lingo/tests/math.lingo
index 9c0b2d5..6f8ecc3 100644
--- a/engines/director/lingo/tests/math.lingo
+++ b/engines/director/lingo/tests/math.lingo
@@ -12,6 +12,8 @@ set x = 2 + 3 * (4 / 2)
put x
put power(2, 8)
+put power(2, 8, 0)
+put power(2)
updatestage
-- Type conversion
Commit: fa7725a5f554bf31c848fccb3d2f8da83dd6f393
https://github.com/scummvm/scummvm/commit/fa7725a5f554bf31c848fccb3d2f8da83dd6f393
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Fix stack underflow on not enough parameters
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index 344fbc2..fb1ad93 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -55,6 +55,13 @@ void Lingo::push(Datum d) {
_stack.push_back(d);
}
+void Lingo::pushVoid() {
+ Datum d;
+ d.u.i = 0;
+ d.type = VOID;
+ push(d);
+}
+
Datum Lingo::pop(void) {
if (_stack.size() == 0)
error("stack underflow");
@@ -692,10 +699,7 @@ void Lingo::c_call() {
g_lingo->pop();
// Push dummy value
- Datum d;
- d.u.i = 0;
- d.type = VOID;
- g_lingo->push(d);
+ g_lingo->pushVoid();
return;
}
@@ -714,8 +718,10 @@ void Lingo::c_call() {
for (int i = 0; i < nargs; i++)
g_lingo->pop();
- return;
- }
+ g_lingo->pushVoid();
+
+ return;
+ }
(*sym->u.func)();
return;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index e15e979..ec2c018 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -189,6 +189,8 @@ public:
int codeFloat(double f);
void codeFactory(Common::String &s);
+ void pushVoid();
+
static void c_xpop();
static void c_printtop();
Commit: f67bcdc141146cdf096bdcc14ad24320118a00a0
https://github.com/scummvm/scummvm/commit/f67bcdc141146cdf096bdcc14ad24320118a00a0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Simplify CodeId
Changed paths:
engines/director/lingo/lingo-code.cpp
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp
index fb1ad93..4c88e5d 100644
--- a/engines/director/lingo/lingo-code.cpp
+++ b/engines/director/lingo/lingo-code.cpp
@@ -220,6 +220,8 @@ bool Lingo::verify(Symbol *s) {
}
void Lingo::c_eval() {
+ g_lingo->c_varpush();
+
Datum d;
d = g_lingo->pop();
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 21501bf..00875de 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -206,21 +206,6 @@ void Lingo::codeArgStore() {
}
}
-int Lingo::codeId(Common::String &s) {
- return codeId_(s);
-}
-
-int Lingo::codeId_(Common::String &name) {
- int ret;
-
- ret = code1(c_varpush);
-
- codeString(name.c_str());
- code1(c_eval);
-
- return ret;
-}
-
void Lingo::codeLabel(int label) {
_labelstack.push_back(label);
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index a26ecfd..ccbf355 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -609,12 +609,12 @@ static const yytype_uint16 yyrline[] =
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, 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
+ 370, 377, 383, 384, 385, 386, 387, 388, 389, 390,
+ 391, 392, 393, 394, 395, 396, 397, 398, 399, 400,
+ 401, 402, 403, 404, 407, 408, 409, 410, 411, 413,
+ 416, 417, 428, 429, 430, 431, 436, 442, 449, 450,
+ 451, 452, 455, 456, 457, 485, 485, 491, 494, 494,
+ 500, 501, 502, 503, 505, 509, 517, 518, 519
};
#endif
@@ -2140,12 +2140,13 @@ yyreduce:
case 59:
#line 366 "engines/director/lingo/lingo-gr.y"
{
- (yyval.code) = g_lingo->codeId(*(yyvsp[(1) - (1)].s));
+ (yyval.code) = g_lingo->code1(g_lingo->c_eval);
+ g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str());
delete (yyvsp[(1) - (1)].s); ;}
break;
case 60:
-#line 369 "engines/director/lingo/lingo-gr.y"
+#line 370 "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);
@@ -2156,7 +2157,7 @@ yyreduce:
break;
case 61:
-#line 376 "engines/director/lingo/lingo-gr.y"
+#line 377 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_theentitypush);
inst e = 0, f = 0;
@@ -2166,158 +2167,158 @@ yyreduce:
break;
case 63:
-#line 383 "engines/director/lingo/lingo-gr.y"
+#line 384 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
case 64:
-#line 384 "engines/director/lingo/lingo-gr.y"
+#line 385 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
case 65:
-#line 385 "engines/director/lingo/lingo-gr.y"
+#line 386 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
case 66:
-#line 386 "engines/director/lingo/lingo-gr.y"
+#line 387 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
case 67:
-#line 387 "engines/director/lingo/lingo-gr.y"
+#line 388 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
case 68:
-#line 388 "engines/director/lingo/lingo-gr.y"
+#line 389 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
case 69:
-#line 389 "engines/director/lingo/lingo-gr.y"
+#line 390 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
case 70:
-#line 390 "engines/director/lingo/lingo-gr.y"
+#line 391 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
case 71:
-#line 391 "engines/director/lingo/lingo-gr.y"
+#line 392 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
case 72:
-#line 392 "engines/director/lingo/lingo-gr.y"
+#line 393 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_and); ;}
break;
case 73:
-#line 393 "engines/director/lingo/lingo-gr.y"
+#line 394 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_or); ;}
break;
case 74:
-#line 394 "engines/director/lingo/lingo-gr.y"
+#line 395 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_not); ;}
break;
case 75:
-#line 395 "engines/director/lingo/lingo-gr.y"
+#line 396 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ampersand); ;}
break;
case 76:
-#line 396 "engines/director/lingo/lingo-gr.y"
+#line 397 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_concat); ;}
break;
case 77:
-#line 397 "engines/director/lingo/lingo-gr.y"
+#line 398 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_contains); ;}
break;
case 78:
-#line 398 "engines/director/lingo/lingo-gr.y"
+#line 399 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_starts); ;}
break;
case 79:
-#line 399 "engines/director/lingo/lingo-gr.y"
+#line 400 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 80:
-#line 400 "engines/director/lingo/lingo-gr.y"
+#line 401 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 81:
-#line 401 "engines/director/lingo/lingo-gr.y"
+#line 402 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 82:
-#line 402 "engines/director/lingo/lingo-gr.y"
+#line 403 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_intersects); ;}
break;
case 83:
-#line 403 "engines/director/lingo/lingo-gr.y"
+#line 404 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_within); ;}
break;
case 84:
-#line 406 "engines/director/lingo/lingo-gr.y"
+#line 407 "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 85:
-#line 407 "engines/director/lingo/lingo-gr.y"
+#line 408 "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 86:
-#line 408 "engines/director/lingo/lingo-gr.y"
+#line 409 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 88:
-#line 410 "engines/director/lingo/lingo-gr.y"
+#line 411 "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 90:
-#line 415 "engines/director/lingo/lingo-gr.y"
+#line 416 "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 91:
-#line 416 "engines/director/lingo/lingo-gr.y"
+#line 417 "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 92:
-#line 427 "engines/director/lingo/lingo-gr.y"
+#line 428 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 93:
-#line 428 "engines/director/lingo/lingo-gr.y"
+#line 429 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 94:
-#line 429 "engines/director/lingo/lingo-gr.y"
+#line 430 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 95:
-#line 430 "engines/director/lingo/lingo-gr.y"
+#line 431 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2326,7 +2327,7 @@ yyreduce:
break;
case 96:
-#line 435 "engines/director/lingo/lingo-gr.y"
+#line 436 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2336,7 +2337,7 @@ yyreduce:
break;
case 97:
-#line 441 "engines/director/lingo/lingo-gr.y"
+#line 442 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2345,47 +2346,47 @@ yyreduce:
break;
case 98:
-#line 448 "engines/director/lingo/lingo-gr.y"
+#line 449 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 99:
-#line 449 "engines/director/lingo/lingo-gr.y"
+#line 450 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 100:
-#line 450 "engines/director/lingo/lingo-gr.y"
+#line 451 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 101:
-#line 451 "engines/director/lingo/lingo-gr.y"
+#line 452 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 102:
-#line 454 "engines/director/lingo/lingo-gr.y"
+#line 455 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 103:
-#line 455 "engines/director/lingo/lingo-gr.y"
+#line 456 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 104:
-#line 456 "engines/director/lingo/lingo-gr.y"
+#line 457 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 105:
-#line 484 "engines/director/lingo/lingo-gr.y"
+#line 485 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 106:
-#line 485 "engines/director/lingo/lingo-gr.y"
+#line 486 "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);
@@ -2394,19 +2395,19 @@ yyreduce:
break;
case 107:
-#line 490 "engines/director/lingo/lingo-gr.y"
+#line 491 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeFactory(*(yyvsp[(2) - (2)].s));
;}
break;
case 108:
-#line 493 "engines/director/lingo/lingo-gr.y"
+#line 494 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 109:
-#line 494 "engines/director/lingo/lingo-gr.y"
+#line 495 "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);
@@ -2415,32 +2416,32 @@ yyreduce:
break;
case 110:
-#line 499 "engines/director/lingo/lingo-gr.y"
+#line 500 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 111:
-#line 500 "engines/director/lingo/lingo-gr.y"
+#line 501 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 112:
-#line 501 "engines/director/lingo/lingo-gr.y"
+#line 502 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 113:
-#line 502 "engines/director/lingo/lingo-gr.y"
+#line 503 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 114:
-#line 504 "engines/director/lingo/lingo-gr.y"
+#line 505 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
case 115:
-#line 508 "engines/director/lingo/lingo-gr.y"
+#line 509 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2450,23 +2451,23 @@ yyreduce:
break;
case 116:
-#line 516 "engines/director/lingo/lingo-gr.y"
+#line 517 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 117:
-#line 517 "engines/director/lingo/lingo-gr.y"
+#line 518 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
case 118:
-#line 518 "engines/director/lingo/lingo-gr.y"
+#line 519 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2470 "engines/director/lingo/lingo-gr.cpp"
+#line 2471 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2680,6 +2681,6 @@ yyreturn:
}
-#line 521 "engines/director/lingo/lingo-gr.y"
+#line 522 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index cfed29a..e718d48 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -364,7 +364,8 @@ expr: INT {
g_lingo->code1(numpar);
delete $1; }
| ID {
- $$ = g_lingo->codeId(*$1);
+ $$ = g_lingo->code1(g_lingo->c_eval);
+ g_lingo->codeString($1->c_str());
delete $1; }
| THEENTITY {
$$ = g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy id
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index ec2c018..c80d6ee 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -184,8 +184,6 @@ public:
void codeArg(Common::String *s);
void codeArgStore();
- int codeId(Common::String &s);
- int codeId_(Common::String &s);
int codeFloat(double f);
void codeFactory(Common::String &s);
Commit: 62c0700588d1414446a02222fcd9a14fb387f837
https://github.com/scummvm/scummvm/commit/62c0700588d1414446a02222fcd9a14fb387f837
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Extended factory test to one from Warlock D5.safe-movie-1
Changed paths:
engines/director/lingo/tests/factory.lingo
diff --git a/engines/director/lingo/tests/factory.lingo b/engines/director/lingo/tests/factory.lingo
index d458ba4..388d2c3 100644
--- a/engines/director/lingo/tests/factory.lingo
+++ b/engines/director/lingo/tests/factory.lingo
@@ -7,6 +7,8 @@ factory aim2
method mNew
dontpassevent
global aim1
+ when mousedown then aim1(fire)
+ when keydown then aim1(mExit)
set the locv of sprite 24 to 540
method mMove x, y
set the locH of sprite 15 to x
@@ -31,6 +33,7 @@ method mDispose
factory fire2
method mNew
dontpassevent
+ when mousedown then nothing
set the castnum of sprite 14 to f15
method mAtFrame
Global StartH, StartV, targetv, stepH, stepV, bcast
Commit: 8a29870a8a15912c6238635fc260eb873e8aa5dc
https://github.com/scummvm/scummvm/commit/8a29870a8a15912c6238635fc260eb873e8aa5dc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Put codeFunc into separate function
Changed paths:
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
engines/director/lingo/lingo.h
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 00875de..e59f57a 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -206,6 +206,15 @@ void Lingo::codeArgStore() {
}
}
+int Lingo::codeFunc(Common::String *s, int numpar) {
+ g_lingo->code1(g_lingo->c_call);
+ g_lingo->codeString(s->c_str());
+
+ inst num = 0;
+ WRITE_UINT32(&num, numpar);
+ g_lingo->code1(num);
+}
+
void Lingo::codeLabel(int label) {
_labelstack.push_back(label);
}
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index ccbf355..c38e774 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -608,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, 358, 366,
- 370, 377, 383, 384, 385, 386, 387, 388, 389, 390,
- 391, 392, 393, 394, 395, 396, 397, 398, 399, 400,
- 401, 402, 403, 404, 407, 408, 409, 410, 411, 413,
- 416, 417, 428, 429, 430, 431, 436, 442, 449, 450,
- 451, 452, 455, 456, 457, 485, 485, 491, 494, 494,
- 500, 501, 502, 503, 505, 509, 517, 518, 519
+ 336, 338, 339, 340, 343, 348, 351, 354, 358, 361,
+ 365, 372, 378, 379, 380, 381, 382, 383, 384, 385,
+ 386, 387, 388, 389, 390, 391, 392, 393, 394, 395,
+ 396, 397, 398, 399, 402, 403, 404, 405, 406, 408,
+ 411, 412, 423, 424, 425, 426, 431, 437, 444, 445,
+ 446, 447, 450, 451, 452, 480, 480, 486, 489, 489,
+ 495, 496, 497, 498, 500, 504, 512, 513, 514
};
#endif
@@ -2128,17 +2128,12 @@ yyreduce:
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());
-
- inst numpar = 0;
- WRITE_UINT32(&numpar, (yyvsp[(3) - (4)].narg));
- g_lingo->code1(numpar);
+ (yyval.code) = g_lingo->codeFunc((yyvsp[(1) - (4)].s), (yyvsp[(3) - (4)].narg));
delete (yyvsp[(1) - (4)].s); ;}
break;
case 59:
-#line 366 "engines/director/lingo/lingo-gr.y"
+#line 361 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_eval);
g_lingo->codeString((yyvsp[(1) - (1)].s)->c_str());
@@ -2146,7 +2141,7 @@ yyreduce:
break;
case 60:
-#line 370 "engines/director/lingo/lingo-gr.y"
+#line 365 "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);
@@ -2157,7 +2152,7 @@ yyreduce:
break;
case 61:
-#line 377 "engines/director/lingo/lingo-gr.y"
+#line 372 "engines/director/lingo/lingo-gr.y"
{
(yyval.code) = g_lingo->code1(g_lingo->c_theentitypush);
inst e = 0, f = 0;
@@ -2167,158 +2162,158 @@ yyreduce:
break;
case 63:
-#line 384 "engines/director/lingo/lingo-gr.y"
+#line 379 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_add); ;}
break;
case 64:
-#line 385 "engines/director/lingo/lingo-gr.y"
+#line 380 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_sub); ;}
break;
case 65:
-#line 386 "engines/director/lingo/lingo-gr.y"
+#line 381 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_mul); ;}
break;
case 66:
-#line 387 "engines/director/lingo/lingo-gr.y"
+#line 382 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_div); ;}
break;
case 67:
-#line 388 "engines/director/lingo/lingo-gr.y"
+#line 383 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gt); ;}
break;
case 68:
-#line 389 "engines/director/lingo/lingo-gr.y"
+#line 384 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_lt); ;}
break;
case 69:
-#line 390 "engines/director/lingo/lingo-gr.y"
+#line 385 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_neq); ;}
break;
case 70:
-#line 391 "engines/director/lingo/lingo-gr.y"
+#line 386 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ge); ;}
break;
case 71:
-#line 392 "engines/director/lingo/lingo-gr.y"
+#line 387 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_le); ;}
break;
case 72:
-#line 393 "engines/director/lingo/lingo-gr.y"
+#line 388 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_and); ;}
break;
case 73:
-#line 394 "engines/director/lingo/lingo-gr.y"
+#line 389 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_or); ;}
break;
case 74:
-#line 395 "engines/director/lingo/lingo-gr.y"
+#line 390 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_not); ;}
break;
case 75:
-#line 396 "engines/director/lingo/lingo-gr.y"
+#line 391 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_ampersand); ;}
break;
case 76:
-#line 397 "engines/director/lingo/lingo-gr.y"
+#line 392 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_concat); ;}
break;
case 77:
-#line 398 "engines/director/lingo/lingo-gr.y"
+#line 393 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_contains); ;}
break;
case 78:
-#line 399 "engines/director/lingo/lingo-gr.y"
+#line 394 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_starts); ;}
break;
case 79:
-#line 400 "engines/director/lingo/lingo-gr.y"
+#line 395 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); ;}
break;
case 80:
-#line 401 "engines/director/lingo/lingo-gr.y"
+#line 396 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (2)].code); g_lingo->code1(g_lingo->c_negate); ;}
break;
case 81:
-#line 402 "engines/director/lingo/lingo-gr.y"
+#line 397 "engines/director/lingo/lingo-gr.y"
{ (yyval.code) = (yyvsp[(2) - (3)].code); ;}
break;
case 82:
-#line 403 "engines/director/lingo/lingo-gr.y"
+#line 398 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_intersects); ;}
break;
case 83:
-#line 404 "engines/director/lingo/lingo-gr.y"
+#line 399 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_within); ;}
break;
case 84:
-#line 407 "engines/director/lingo/lingo-gr.y"
+#line 402 "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 85:
-#line 408 "engines/director/lingo/lingo-gr.y"
+#line 403 "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 86:
-#line 409 "engines/director/lingo/lingo-gr.y"
+#line 404 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_printtop); ;}
break;
case 88:
-#line 411 "engines/director/lingo/lingo-gr.y"
+#line 406 "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 90:
-#line 416 "engines/director/lingo/lingo-gr.y"
+#line 411 "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 91:
-#line 417 "engines/director/lingo/lingo-gr.y"
+#line 412 "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 92:
-#line 428 "engines/director/lingo/lingo-gr.y"
+#line 423 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoloop); ;}
break;
case 93:
-#line 429 "engines/director/lingo/lingo-gr.y"
+#line 424 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotonext); ;}
break;
case 94:
-#line 430 "engines/director/lingo/lingo-gr.y"
+#line 425 "engines/director/lingo/lingo-gr.y"
{ g_lingo->code1(g_lingo->c_gotoprevious); ;}
break;
case 95:
-#line 431 "engines/director/lingo/lingo-gr.y"
+#line 426 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (2)].s)->c_str());
@@ -2327,7 +2322,7 @@ yyreduce:
break;
case 96:
-#line 436 "engines/director/lingo/lingo-gr.y"
+#line 431 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString((yyvsp[(2) - (3)].s)->c_str());
@@ -2337,7 +2332,7 @@ yyreduce:
break;
case 97:
-#line 442 "engines/director/lingo/lingo-gr.y"
+#line 437 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_goto);
g_lingo->codeString("");
@@ -2346,47 +2341,47 @@ yyreduce:
break;
case 98:
-#line 449 "engines/director/lingo/lingo-gr.y"
+#line 444 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 99:
-#line 450 "engines/director/lingo/lingo-gr.y"
+#line 445 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 100:
-#line 451 "engines/director/lingo/lingo-gr.y"
+#line 446 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 101:
-#line 452 "engines/director/lingo/lingo-gr.y"
+#line 447 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(1) - (1)].s); ;}
break;
case 102:
-#line 455 "engines/director/lingo/lingo-gr.y"
+#line 450 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 103:
-#line 456 "engines/director/lingo/lingo-gr.y"
+#line 451 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(2) - (2)].s); ;}
break;
case 104:
-#line 457 "engines/director/lingo/lingo-gr.y"
+#line 452 "engines/director/lingo/lingo-gr.y"
{ (yyval.s) = (yyvsp[(3) - (3)].s); ;}
break;
case 105:
-#line 485 "engines/director/lingo/lingo-gr.y"
+#line 480 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 106:
-#line 486 "engines/director/lingo/lingo-gr.y"
+#line 481 "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);
@@ -2395,19 +2390,19 @@ yyreduce:
break;
case 107:
-#line 491 "engines/director/lingo/lingo-gr.y"
+#line 486 "engines/director/lingo/lingo-gr.y"
{
g_lingo->codeFactory(*(yyvsp[(2) - (2)].s));
;}
break;
case 108:
-#line 494 "engines/director/lingo/lingo-gr.y"
+#line 489 "engines/director/lingo/lingo-gr.y"
{ g_lingo->_indef = true; ;}
break;
case 109:
-#line 495 "engines/director/lingo/lingo-gr.y"
+#line 490 "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);
@@ -2416,32 +2411,32 @@ yyreduce:
break;
case 110:
-#line 500 "engines/director/lingo/lingo-gr.y"
+#line 495 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 111:
-#line 501 "engines/director/lingo/lingo-gr.y"
+#line 496 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(1) - (1)].s)); (yyval.narg) = 1; ;}
break;
case 112:
-#line 502 "engines/director/lingo/lingo-gr.y"
+#line 497 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(3) - (3)].s)); (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
case 113:
-#line 503 "engines/director/lingo/lingo-gr.y"
+#line 498 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArg((yyvsp[(4) - (4)].s)); (yyval.narg) = (yyvsp[(1) - (4)].narg) + 1; ;}
break;
case 114:
-#line 505 "engines/director/lingo/lingo-gr.y"
+#line 500 "engines/director/lingo/lingo-gr.y"
{ g_lingo->codeArgStore(); ;}
break;
case 115:
-#line 509 "engines/director/lingo/lingo-gr.y"
+#line 504 "engines/director/lingo/lingo-gr.y"
{
g_lingo->code1(g_lingo->c_call);
g_lingo->codeString((yyvsp[(1) - (3)].s)->c_str());
@@ -2451,23 +2446,23 @@ yyreduce:
break;
case 116:
-#line 517 "engines/director/lingo/lingo-gr.y"
+#line 512 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 0; ;}
break;
case 117:
-#line 518 "engines/director/lingo/lingo-gr.y"
+#line 513 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = 1; ;}
break;
case 118:
-#line 519 "engines/director/lingo/lingo-gr.y"
+#line 514 "engines/director/lingo/lingo-gr.y"
{ (yyval.narg) = (yyvsp[(1) - (3)].narg) + 1; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2471 "engines/director/lingo/lingo-gr.cpp"
+#line 2466 "engines/director/lingo/lingo-gr.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2681,6 +2676,6 @@ yyreturn:
}
-#line 522 "engines/director/lingo/lingo-gr.y"
+#line 517 "engines/director/lingo/lingo-gr.y"
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index e718d48..2726d52 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -356,12 +356,7 @@ expr: INT {
$$ = g_lingo->code2(g_lingo->c_constpush, 0); // Put dummy value
delete $1; }
| ID '(' arglist ')' {
- $$ = g_lingo->code1(g_lingo->c_call);
- g_lingo->codeString($1->c_str());
-
- inst numpar = 0;
- WRITE_UINT32(&numpar, $3);
- g_lingo->code1(numpar);
+ $$ = g_lingo->codeFunc($1, $3);
delete $1; }
| ID {
$$ = g_lingo->code1(g_lingo->c_eval);
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index c80d6ee..3bec298 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -184,6 +184,7 @@ public:
void codeArg(Common::String *s);
void codeArgStore();
+ int codeFunc(Common::String *s, int numpar);
int codeFloat(double f);
void codeFactory(Common::String &s);
Commit: 0bda62233740a121b52faf90ef01f5cd9cf92a06
https://github.com/scummvm/scummvm/commit/0bda62233740a121b52faf90ef01f5cd9cf92a06
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Implemented 'me' function support for factories
Changed paths:
engines/director/lingo/lingo-codegen.cpp
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index e59f57a..07fb522 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -207,12 +207,25 @@ void Lingo::codeArgStore() {
}
int Lingo::codeFunc(Common::String *s, int numpar) {
- g_lingo->code1(g_lingo->c_call);
- g_lingo->codeString(s->c_str());
+ int ret = g_lingo->code1(g_lingo->c_call);
+
+ if (s->equalsIgnoreCase("me")) {
+ if (!g_lingo->_currentFactory.empty()) {
+ g_lingo->codeString(g_lingo->_currentFactory.c_str());
+ debug(2, "Repaced 'me' with %s", g_lingo->_currentFactory.c_str());
+ } else {
+ warning("'me' out of factory method");
+ g_lingo->codeString(s->c_str());
+ }
+ } else {
+ g_lingo->codeString(s->c_str());
+ }
inst num = 0;
WRITE_UINT32(&num, numpar);
g_lingo->code1(num);
+
+ return ret;
}
void Lingo::codeLabel(int label) {
@@ -239,7 +252,7 @@ void Lingo::processIf(int elselabel, int endlabel) {
break;
WRITE_UINT32(&ielse1, else1);
- (*_currentScript)[label + 2] = ielse1; /* elsepart */
+ (*_currentScript)[label + 2] = ielse1; /* elsepart */
(*_currentScript)[label + 3] = iend; /* end, if cond fails */
else1 = label;
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index c38e774..aa296ed 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -2377,7 +2377,7 @@ yyreduce:
case 105:
#line 480 "engines/director/lingo/lingo-gr.y"
- { g_lingo->_indef = true; ;}
+ { g_lingo->_indef = true; g_lingo->_currentFactory.clear(); ;}
break;
case 106:
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 2726d52..4ab7ed3 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -477,7 +477,7 @@ gotomovie: tOF tMOVIE STRING { $$ = $3; }
//
// See also:
// on keyword
-defn: tMACRO ID { g_lingo->_indef = true; }
+defn: tMACRO ID { g_lingo->_indef = true; g_lingo->_currentFactory.clear(); }
begin argdef nl argstore stmtlist {
g_lingo->code2(g_lingo->c_constpush, (inst)0); // Push fake value on stack
g_lingo->code1(g_lingo->c_procret);
Commit: 503ff47b0b9cfeacdf5df05829327ada52d35530
https://github.com/scummvm/scummvm/commit/503ff47b0b9cfeacdf5df05829327ada52d35530
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Added detection for 'The Apartment'
Changed paths:
engines/director/detection.cpp
engines/director/detection_tables.h
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index b0fea29..1f2e970 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -68,6 +68,7 @@ bool DirectorEngine::hasFeature(EngineFeature f) const {
static const PlainGameDescriptor directorGames[] = {
{ "director", "Macromedia Director Game" },
{ "directortest", "Macromedia Director Test Target" },
+ { "theapartment", "The Apartment, D3 interactive demo" },
{ "gundam0079", "Gundam 0079: The War for Earth" },
{ "jewels", "Jewels of the Oracle" },
{ "jman", "The Journeyman Project" },
diff --git a/engines/director/detection_tables.h b/engines/director/detection_tables.h
index 8c9c9f1..65eff50 100644
--- a/engines/director/detection_tables.h
+++ b/engines/director/detection_tables.h
@@ -42,6 +42,20 @@ static const DirectorGameDescription gameDescriptions[] = {
{
{
+ "theapartment",
+ "",
+ AD_ENTRY1s("Main Menu", "9e838fe1a6af7992d656ca325e38dee5", 47911),
+ Common::EN_ANY,
+ Common::kPlatformMacintosh,
+ ADGF_MACRESFORK,
+ GUIO1(GUIO_NOASPECT)
+ },
+ GID_GENERIC,
+ 3
+ },
+
+ {
+ {
"gundam0079",
"",
AD_ENTRY1("Gundam0079.exe", "1a7acbba10a7246ba58c1d53fc7203f5"),
Commit: 9067257cf05f9d37d440c5a87100ca4ce829b3c8
https://github.com/scummvm/scummvm/commit/9067257cf05f9d37d440c5a87100ca4ce829b3c8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix Mac archive reading.
Changed paths:
engines/director/resource.cpp
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 5a2033a..5a2c4bc 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -215,7 +215,7 @@ bool MacArchive::openStream(Common::SeekableReadStream *stream, uint32 startOffs
Common::SeekableSubReadStreamEndian *MacArchive::getResource(uint32 tag, uint16 id) {
assert(_resFork);
Common::SeekableReadStream *stream = _resFork->getResource(tag, id);
- return new Common::SeekableSubReadStreamEndian(stream, 0, stream->size(), DisposeAfterUse::NO);
+ return new Common::SeekableSubReadStreamEndian(stream, 0, stream->size(), true, DisposeAfterUse::NO);
}
// RIFF Archive code
Commit: af3ca5ba0d327c26d1298657d54f5f9dd59715f9
https://github.com/scummvm/scummvm/commit/af3ca5ba0d327c26d1298657d54f5f9dd59715f9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Correct startup sequence
Changed paths:
engines/director/director.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 58a5459..1c7fec1 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -114,19 +114,20 @@ Common::Error DirectorEngine::run() {
}
//FIXME
- _mainArchive = new RIFFArchive();
- _mainArchive->openFile("bookshelf_example.mmm");
- _currentScore = new Score(this);
- debug(0, "Score name %s", _currentScore->getMacName().c_str());
-
- _currentScore->loadArchive();
- _currentScore->startLoop();
+ //_mainArchive = new RIFFArchive();
+ //_mainArchive->openFile("bookshelf_example.mmm");
if (getPlatform() == Common::kPlatformWindows)
loadEXE();
else
loadMac();
+ _currentScore = new Score(this);
+ debug(0, "Score name %s", _currentScore->getMacName().c_str());
+
+ _currentScore->loadArchive();
+ _currentScore->startLoop();
+
return Common::kNoError;
}
Commit: b2d5c25e2fb35dfd46702af79faf526d4ffe38b0
https://github.com/scummvm/scummvm/commit/b2d5c25e2fb35dfd46702af79faf526d4ffe38b0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Do not error() on syntax errors
Changed paths:
engines/director/lingo/lingo-gr.cpp
engines/director/lingo/lingo-gr.y
diff --git a/engines/director/lingo/lingo-gr.cpp b/engines/director/lingo/lingo-gr.cpp
index aa296ed..3791239 100644
--- a/engines/director/lingo/lingo-gr.cpp
+++ b/engines/director/lingo/lingo-gr.cpp
@@ -211,7 +211,7 @@ extern int yyparse();
using namespace Director;
void yyerror(char *s) {
g_lingo->_hadError = true;
- error("%s at line %d col %d", s, g_lingo->_linenumber, g_lingo->_colnumber);
+ warning("%s at line %d col %d", s, g_lingo->_linenumber, g_lingo->_colnumber);
}
diff --git a/engines/director/lingo/lingo-gr.y b/engines/director/lingo/lingo-gr.y
index 4ab7ed3..9a10916 100644
--- a/engines/director/lingo/lingo-gr.y
+++ b/engines/director/lingo/lingo-gr.y
@@ -60,7 +60,7 @@ extern int yyparse();
using namespace Director;
void yyerror(char *s) {
g_lingo->_hadError = true;
- error("%s at line %d col %d", s, g_lingo->_linenumber, g_lingo->_colnumber);
+ warning("%s at line %d col %d", s, g_lingo->_linenumber, g_lingo->_colnumber);
}
Commit: 5414a0ec2cfbdc1572501af5de8e055a06bd6b31
https://github.com/scummvm/scummvm/commit/5414a0ec2cfbdc1572501af5de8e055a06bd6b31
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Added stub fot 'the keycode' entity
Changed paths:
engines/director/lingo/lingo-the.cpp
engines/director/lingo/lingo-the.h
diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index f2d01fe..2aedf32 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -39,6 +39,7 @@ TheEntity entities[] = {
{ kTheFrame, "frame", false },
{ kTheItemDelimiter, "itemDelimiter", false },
{ kTheKey, "key", false },
+ { kTheKeyCode, "keycode", false },
{ kTheLastClick, "lastClick", false },
{ kTheLastEvent, "lastEvent", false },
{ kTheLastFrame, "lastFrame", false },
diff --git a/engines/director/lingo/lingo-the.h b/engines/director/lingo/lingo-the.h
index 806c295..5fea4ba 100644
--- a/engines/director/lingo/lingo-the.h
+++ b/engines/director/lingo/lingo-the.h
@@ -58,6 +58,7 @@ enum TheEntityType {
kTheRightMouseDown,
kTheStillDown,
kTheKey,
+ kTheKeyCode,
kTheControlDown,
kTheCommandDown,
kTheShiftDown,
Commit: d9cf5af9f0c66a582ca9efba744df8fc34310c67
https://github.com/scummvm/scummvm/commit/d9cf5af9f0c66a582ca9efba744df8fc34310c67
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Lingo: Do not error out on unknown entities
Changed paths:
engines/director/lingo/lingo-lex.cpp
engines/director/lingo/lingo-lex.l
diff --git a/engines/director/lingo/lingo-lex.cpp b/engines/director/lingo/lingo-lex.cpp
index f4e3541..a7f672d 100644
--- a/engines/director/lingo/lingo-lex.cpp
+++ b/engines/director/lingo/lingo-lex.cpp
@@ -1149,7 +1149,7 @@ YY_RULE_SETUP
return THEENTITY;
}
- error("Unhandled the entity %s", ptr);
+ warning("Unhandled the entity %s", ptr);
}
YY_BREAK
case 35:
@@ -1172,7 +1172,7 @@ YY_RULE_SETUP
return THEENTITY;
}
- error("Unhandled the entity %s", ptr);
+ warning("Unhandled the entity %s", ptr);
}
YY_BREAK
case 36:
diff --git a/engines/director/lingo/lingo-lex.l b/engines/director/lingo/lingo-lex.l
index 9532da4..50ad8fa 100644
--- a/engines/director/lingo/lingo-lex.l
+++ b/engines/director/lingo/lingo-lex.l
@@ -131,7 +131,7 @@ whitespace [\t ]
return THEENTITY;
}
- error("Unhandled the entity %s", ptr);
+ warning("Unhandled the entity %s", ptr);
}
(?i:the[ \t]+[[:alpha:]]+) {
count();
@@ -150,7 +150,7 @@ whitespace [\t ]
return THEENTITY;
}
- error("Unhandled the entity %s", ptr);
+ warning("Unhandled the entity %s", ptr);
}
(?i:then) { count(); return tTHEN; }
(?i:to) { count(); return tTO; }
Commit: 0aba35e2662d15e635d495a33a217ac21113afdb
https://github.com/scummvm/scummvm/commit/0aba35e2662d15e635d495a33a217ac21113afdb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: More debug output
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index becf035..51c70ab 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -657,7 +657,7 @@ void Score::loadFontMap(Common::SeekableSubReadStreamEndian &stream) {
}
_fontMap[id] = font;
- debug(3, "ID %d Font %s", id, font.c_str());
+ debug(3, "Fontmap. ID %d Font %s", id, font.c_str());
currentRawPosition = stream.pos();
stream.seek(positionInfo);
}
@@ -1435,7 +1435,7 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID) {
const Graphics::Font *font = FontMan.getFontByName(_vm->_currentScore->_fontMap[textCast->fontId]);
if (!font) {
- error("Cannot load font %s", _vm->_currentScore->_fontMap[textCast->fontId].c_str());
+ error("Cannot load font '%s', id %d", _vm->_currentScore->_fontMap[textCast->fontId].c_str(), textCast->fontId);
}
font->drawString(&surface, text, x, y, width, 0);
Commit: 8618cbb6cbf63849e03f8b9f042cb555a952322a
https://github.com/scummvm/scummvm/commit/8618cbb6cbf63849e03f8b9f042cb555a952322a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Fix engine initialization
Changed paths:
engines/director/director.cpp
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 1c7fec1..c6806e8 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -53,17 +53,17 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
// Setup mixer
syncSoundSettings();
- _sharedCasts = new Common::HashMap<int, Cast *>;
- _sharedDIB = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>;
- _sharedBMP = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>;
- _sharedSTXT = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>;
- _sharedSound = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>;
-
- _mainArchive = 0;
- _macBinary = 0;
- //FIXME
- _sharedMMM = "SHARDCST.MMM";
- _movies = new Common::HashMap<Common::String, Score *>;
+
+ _sharedCasts = nullptr;
+ _sharedSound = nullptr;
+ _sharedBMP = nullptr;
+ _sharedSTXT = nullptr;
+ _sharedDIB = nullptr;
+
+ _mainArchive = nullptr;
+ _macBinary = nullptr;
+
+ _movies = nullptr;
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "data");
@@ -89,13 +89,9 @@ DirectorEngine::~DirectorEngine() {
Common::Error DirectorEngine::run() {
debug("Starting v%d Director game", getVersion());
- _sharedCasts = nullptr;
- _sharedSound = nullptr;
- _sharedBMP = nullptr;
- _sharedSTXT = nullptr;
- _sharedDIB = nullptr;
+ //FIXME
+ _sharedMMM = "SHARDCST.MMM";
- _movies = nullptr;
_currentPalette = nullptr;
_macBinary = nullptr;
Commit: 59ebb0c68f9ea0f0a6862698365d6f9b7a7f9b7c
https://github.com/scummvm/scummvm/commit/59ebb0c68f9ea0f0a6862698365d6f9b7a7f9b7c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:40:36+02:00
Commit Message:
DIRECTOR: Switch Mac font loading to the common code
Changed paths:
engines/director/director.cpp
engines/director/director.h
engines/director/score.cpp
engines/director/score.h
diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index c6806e8..469aeb8 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -36,6 +36,7 @@
#include "engines/util.h"
#include "graphics/surface.h"
+#include "graphics/macgui/macwindowmanager.h"
#include "director/director.h"
#include "director/dib.h"
@@ -65,6 +66,8 @@ DirectorEngine::DirectorEngine(OSystem *syst, const DirectorGameDescription *gam
_movies = nullptr;
+ _wm = nullptr;
+
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "data");
SearchMan.addSubDirectoryMatching(gameDataDir, "install");
@@ -97,6 +100,8 @@ Common::Error DirectorEngine::run() {
_macBinary = nullptr;
_soundManager = nullptr;
+ _wm = new Graphics::MacWindowManager;
+
_lingo = new Lingo(this);
_soundManager = new DirectorSound();
diff --git a/engines/director/director.h b/engines/director/director.h
index 0d4ffa7..6208df2 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -36,6 +36,10 @@ namespace Common {
class MacResManager;
}
+namespace Graphics {
+class MacWindowManager;
+}
+
namespace Director {
enum DirectorGameID {
@@ -79,6 +83,7 @@ public:
Score *_currentScore;
Common::RandomSource _rnd;
+ Graphics::MacWindowManager *_wm;
protected:
virtual Common::Error run();
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 51c70ab..5fdf315 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -38,6 +38,7 @@
#include "common/events.h"
#include "engines/util.h"
#include "graphics/managed_surface.h"
+#include "graphics/macgui/macwindowmanager.h"
#include "image/bmp.h"
#include "graphics/fontman.h"
#include "graphics/fonts/bdf.h"
@@ -111,7 +112,6 @@ static byte defaultPalette[768] = {
255, 255, 102, 255, 255, 153, 255, 255, 204, 255, 255, 255 };
Score::Score(DirectorEngine *vm) {
- loadMacFonts();
_vm = vm;
_surface = new Graphics::ManagedSurface;
_trailSurface = new Graphics::ManagedSurface;
@@ -663,47 +663,6 @@ void Score::loadFontMap(Common::SeekableSubReadStreamEndian &stream) {
}
}
-void Score::loadMacFonts() {
- //Copy from Wage
- Common::Archive *dat;
-
- dat = Common::makeZipArchive("classicmacfonts.dat");
-
- if (!dat) {
- warning("Could not find classicmacfonts.dat. Falling back to built-in fonts");
- return;
- }
-
- Common::ArchiveMemberList list;
- dat->listMembers(list);
-
- for (Common::ArchiveMemberList::iterator it = list.begin(); it != list.end(); ++it) {
- Common::SeekableReadStream *stream = dat->createReadStreamForMember((*it)->getName());
-
- Graphics::BdfFont *font = Graphics::BdfFont::loadFont(*stream);
-
- delete stream;
-
- Common::String fontName = (*it)->getName();
-
- // Trim the .bdf extension
- for (int i = fontName.size() - 1; i >= 0; --i) {
- if (fontName[i] == '.') {
- while ((uint)i < fontName.size()) {
- fontName.deleteLastChar();
- }
- break;
- }
- }
-
- FontMan.assignFontToName(fontName, font);
-
- debug(" %s", fontName.c_str());
- }
-
- delete dat;
-}
-
BitmapCast::BitmapCast(Common::SeekableSubReadStreamEndian &stream) {
/*byte flags = */ stream.readByte();
uint16 someFlaggyThing = stream.readUint16();
@@ -1432,12 +1391,17 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID) {
int height = _sprites[spriteID]->_height;
int width = _sprites[spriteID]->_width;
- const Graphics::Font *font = FontMan.getFontByName(_vm->_currentScore->_fontMap[textCast->fontId]);
+ const char *fontName;
- if (!font) {
- error("Cannot load font '%s', id %d", _vm->_currentScore->_fontMap[textCast->fontId].c_str(), textCast->fontId);
+ if (_vm->_currentScore->_fontMap.contains(textCast->fontId)) {
+ fontName = _vm->_currentScore->_fontMap[textCast->fontId].c_str();
+ } else if ((fontName = _vm->_wm->getFontName(textCast->fontId)) == NULL) {
+ warning("Unknown font id %d, falling back to default", textCast->fontId);
+ fontName = _vm->_wm->getFontName(0);
}
+ const Graphics::Font *font = _vm->_wm->getFont(fontName, Graphics::FontManager::kBigGUIFont);
+
font->drawString(&surface, text, x, y, width, 0);
if (textCast->borderSize != kSizeNone) {
diff --git a/engines/director/score.h b/engines/director/score.h
index b4abeb6..d483afa 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -402,7 +402,6 @@ private:
void update();
void readVersion(uint32 rid);
void loadConfig(Common::SeekableSubReadStreamEndian &stream);
- void loadMacFonts();
void loadPalette(Common::SeekableSubReadStreamEndian &stream);
void loadFrames(Common::SeekableSubReadStreamEndian &stream);
void loadLabels(Common::SeekableSubReadStreamEndian &stream);
Commit: 96e288c4c91bca55b89e0730bad76d69f6a05a94
https://github.com/scummvm/scummvm/commit/96e288c4c91bca55b89e0730bad76d69f6a05a94
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-03T23:43:01+02:00
Commit Message:
DIRECTOR: Update font generation
Changed paths:
engines/director/score.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 5fdf315..4bb4dda 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -1395,9 +1395,9 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID) {
if (_vm->_currentScore->_fontMap.contains(textCast->fontId)) {
fontName = _vm->_currentScore->_fontMap[textCast->fontId].c_str();
- } else if ((fontName = _vm->_wm->getFontName(textCast->fontId)) == NULL) {
+ } else if ((fontName = _vm->_wm->getFontName(textCast->fontId, textCast->fontSize)) == NULL) {
warning("Unknown font id %d, falling back to default", textCast->fontId);
- fontName = _vm->_wm->getFontName(0);
+ fontName = _vm->_wm->getFontName(0, 12);
}
const Graphics::Font *font = _vm->_wm->getFont(fontName, Graphics::FontManager::kBigGUIFont);
Commit: 902d49ce099df7ce8bb5eb1b6ea4c00f63d69c86
https://github.com/scummvm/scummvm/commit/902d49ce099df7ce8bb5eb1b6ea4c00f63d69c86
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-04T13:23:04+02:00
Commit Message:
Merge pull request #787 from sev-/director
DIRECTOR: New engine
Changed paths:
A engines/director/configure.engine
A engines/director/detection.cpp
A engines/director/detection_tables.h
A engines/director/dib.cpp
A engines/director/dib.h
A engines/director/director.cpp
A engines/director/director.h
A engines/director/lingo/lingo-builtins.cpp
A engines/director/lingo/lingo-code.cpp
A engines/director/lingo/lingo-codegen.cpp
A engines/director/lingo/lingo-funcs.cpp
A engines/director/lingo/lingo-gr.cpp
A engines/director/lingo/lingo-gr.h
A engines/director/lingo/lingo-gr.y
A engines/director/lingo/lingo-lex.cpp
A engines/director/lingo/lingo-lex.l
A engines/director/lingo/lingo-the.cpp
A engines/director/lingo/lingo-the.h
A engines/director/lingo/lingo.cpp
A engines/director/lingo/lingo.h
A engines/director/lingo/tests/Lingo bytecode.html
A engines/director/lingo/tests/factory.lingo
A engines/director/lingo/tests/goto.lingo
A engines/director/lingo/tests/if.lingo
A engines/director/lingo/tests/ilk.lingo
A engines/director/lingo/tests/lingotests.lingo
A engines/director/lingo/tests/loops.lingo
A engines/director/lingo/tests/macros.lingo
A engines/director/lingo/tests/macros2.lingo
A engines/director/lingo/tests/math.lingo
A engines/director/lingo/tests/mci.lingo
A engines/director/lingo/tests/point.lingo
A engines/director/lingo/tests/strings.lingo
A engines/director/lingo/tests/the.lingo
A engines/director/module.mk
A engines/director/movie.cpp
A engines/director/movie.h
A engines/director/resource.cpp
A engines/director/resource.h
A engines/director/score.cpp
A engines/director/score.h
A engines/director/sound.cpp
A engines/director/sound.h
.gitignore
More information about the Scummvm-git-logs
mailing list