[Scummvm-git-logs] scummvm master -> 5b85ca03b7d673f8177a740404f8389d385c8f59

sev- sev at scummvm.org
Thu Mar 4 01:08:30 UTC 2021


This automated email contains information about 147 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c813fd25cb PRIVATE: private-eye skeleton engine
c6c9c05b6a PRIVATE: some code to decode videos
9e2ebc5e8a PRIVATE: fixed palette
33de9528fd PRIVATE: fixes
84f7edd834 PRIVATE: improved detection
bbd8d54209 PRIVATE: added flex/bison grammar
7e2daba32d PRIVATE: grammar fixes
2ace923718 PRIVATE: removed old grammar code
f1262c242d PRIVATE: new prototype for code generation using hoc
f8b16861fc PRIVATE: more code
7e1e52e5ee PRIVATE: moved more files to c++
16a642cba8 PRIVATE: fixed linking
939bf92266 PRIVATE: use Private namespace
6a8adece27 PRIVATE: allocate a new stack for every setting
b95e920fbc PRIVATE: code to compare expr
fcddf8aae1 PRIVATE: reorganized lexer and grammar code
638cf52ee6 PRIVATE: handled all defines
2ce4159f16 PRIVATE: more code
cae1b214a8 PRIVATE: fixes + more functiions
ccef0fb704 PRIVATE: some more functions implemented
baf7a442fc PRIVATE: fixed pallete colors with a hack
68ad8f1ad0 PRIVATE: simplified grammar and added some code for conditional handling
fc71730e17 PRIVATE: more functions and fixes
980ef278a7 PRIVATE: improved data structures
695eae1421 PRIVATE: grammar fixes
2a04c04c35 PRIVATE: some fixes and added debug functions
40b7bc29e9 PRIVATE: added some data structure to hold exit information
5c48056948 PRIVATE: clean-up
536fcd5605 PRIVATE: used astyle to improve code formatting
f5c4e7e6cb PRIVATE: more code
f2cb789918 PRIVATE: more code
c333492c8f PRIVATE: remove stuff from the event loop
03ed1ac933 PRIVATE: astyled the code again
6fa9b8474c PRIVATE: clean-up
92a892008d PRIVATE: implemented original cursors
0c3a74fdd8 PRIVATE: more stuff
c912eed42a PRIVATE: more functions
78febfbd00 PRIVATE: fixed detection from assets without installing
a1b27d43e4 PRIVATE: added lex/bison generated files
756efded43 PRIVATE: astyled the code again
211c767685 PRIVATE: clean up and reorganization
dca4b7aa2c PRIVATE: basic save game support
4ae90af4ab PRIVTE: more fixes
f0108e6e1a PRIVATE: more fixes
005c8fe481 PRIVATE: more fixes
942addd3a1 PRIVATE: adjusted origin point
89f95256e7 PRIVATE: more code
9115a5f143 PRIVATE: phone calls + fixes
d0c4f950f4 PRIVATE: improved save/load
ab08b58e49 PRIVATE: fixes + astyle
f602fa6d56 PRIVATE: more astyle
fd0facc23d PRIVATE: better detection tables + fixes
e8994fd70c PRIVATE: fixed frame memory leak
b3d314e68d PRIVATE: more fixes
0f8c18d779 PRIVATE: started to implement police bust
27ddb34804 PRIVATE: police bust changes
4e5f3c549c PRIVATE: partial dossier browsing implementation
476cbb3106 PRIVATE: new features
f6d7fa4e48 PRIVATE: fixes in sounds and memory management
e92e29bc02 PRIVATE: fixes and new stuff
760e06f443 PRIVATE: implemented NoStopSounds
b230e4d67c PRIVATE: astyle
1f3d8a52f8 PRIVATE: fixes and new stuff
93617ca8fe PRIVATE: fixes
3b9ff10be3 PRIVATE: more fixes
28040b2a61 PRIVATE: astyle
d65b334586 PRIVATE: fixes
cbc8ca60f4 PRIVATE: missing snprinft
75e019b199 PRIVATE: added copyright headers
ccd4c9a831 PRIVATE: fixes and renamed installer_archive
9618650bb1 PRIVATE: optimized use of screen
386c07149e PRIVATE: fixes
8d9ed3d8d6 PRIVATE: fixes
08fcf88a19 PRIVATE: removed tabs
9304bb0e58 PRIVATE: fixed code convetions
70256d38eb PRIVATE: added proper debug channels and fixed type assertions
b40e1e2467 PRIVATE: removed old debug code
23fe6b9b73 PRIVATE: explicit conversion to bool
dbf7085a79 PRIVATE: clean up grammar.l to remove unused code and imports
17d3d6e241 PRIVATE: reorganized bison and yacc files and removed tabs from them
87ac850982 PRIVATE: change detection tables to use PVTEYE.Z
31cc84514f PRIVATE: avoid name collisions using a prefix in the lexer and grammar
f1fe50ee66 PRIVATE: code convention on type casting
a238290c33 PRIVATE: code convention on type casting
216258ed21 PRIVATE: avoid global constructors in initCursors
4d7a70d508 PRIVATE: code convention on type casting
e89616a177 PRIVATE: fixed in formating of module.mk
09a2d52447 PRIVATE: avoid confusion in nested if
e459ad6777 PRIVATE: code convention on type casting
c331703e4b PRIVATE: code convention on function names
7ed834dd8f PRIVATE: removed useless empty lines
2ef6c7a94c PRIVATE: removed useless empty lines
5ba173383a PRIVATE: arithmetic code refactor
96a1f8efe5 PRIVATE: removed unused variables and refactor
b7e55e5c6f PRIVATE: optimize screen drawing
54d2f034f1 PRIVATE: refactor to avoid global constructors
087b2f7fd6 PRIVATE: code convention fixes
a106e8c1cc PRIVATE: missing line at the end
fe4ae42996 PRIVATE: removed old file
27b498b890 PRIVATE: code convention fixes
c57939f3fd PRIVATE: fixed load game code to avoid leaking memory
f63c30f4a1 PRIVATE: refactor sound handling to avoid leaking memory
92fbf819ae PRIVATE: refactor sound handling to avoid leaking memory
5c89526daa PRIVATE: refactor sound handling to avoid leaking memory
79e3987459 PRIVATE: removed console
f99d4c0161 PRIVATE: simplified code
692ab5c22b PRIVATE: use const string in getRandomPhoneClip
c14cecfe48 PRIVATE: refactor _diaryLocPrefix
b26c6d0dce PRIVATE: refactoring to avoid global constructors
77abcaafaa PRIVATE: refactor string cmp handling to avoid leaking memory
e14b415f48 PRIVATE: refactor string cmp handling to avoid leaking memory
491b422354 PRIVATE: missing new line
6c4f52d07a PRIVATE: refactor mask handling to avoid leaking memory
86f75d18b1 PRIVATE: refactor headers
f283e0339b PRIVATE: refactor headers
b652a71bab PRIVATE: added makefile rule to build lexer/grammar
8e78365cfb PRIVATE: correct detection thanks to @sev
ad0f44114e PRIVATE: code convention fixes
9067ecec7c PRIVATE: added hoc copyright
07ef9a9cd5 PRIVATE: removed policeVideoIndex
49b6e11f86 PRIVATE: refactored more strings code
bc1c212c92 PRIVATE: documented some code
0ba260cac1 PRIVATE: first step to use classes and avoid external
21b9c93fab PRIVATE: second step to use classes and avoid external
570a38ab04 PRIVATE: removed more extern
d0e43c93b5 PRIVATE: use more classes and avoid external
a65366edea PRIVATE: fix memory leaks
799343a931 PRIVATE: fix memory leaks
1924abc1a4 PRIVATE: stop all sounds when a game is loaded
4d8144f32d PRIVATE: code convention fixes
020aa0a867 PRIVATE: fix memory leaks and added more stuff into the main class
90b07f5f81 PRIVATE: remove pointers
0f9c86fe42 PRIVATE: remove pointers
6b7f690d07 PRIVATE: remove pointers
b089f42329 PRIVATE: remove pointers
82b331decf PRIVATE: remove more pointers
f1f9a1c7c1 PRIVATE: fixes
f29dc85614 PRIVATE: remove more pointers
817fc1ba0c COMMON: moved include guard to the top
750eeeb85f PRIVATE: removed screen locking
de9309bb04 PRIVATE: code convention fixes
fbbee9b31a PRIVATE: remove more pointers
fb798eaa0b PRIVATE: class re-organization
c46c9dedd6 PRIVATE: class re-organization
03d9efa5d0 COMMON: renamed include guard in installshieldv3
f62f889344 PRIVATE: fixes
5b85ca03b7 PRIVATE: added more detection rules


Commit: c813fd25cb052da3367180ede8da03baef97e7ce
    https://github.com/scummvm/scummvm/commit/c813fd25cb052da3367180ede8da03baef97e7ce
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: private-eye skeleton engine

Changed paths:
  A engines/private/configure.engine
  A engines/private/detection.cpp
  A engines/private/metaengine.cpp
  A engines/private/module.mk
  A engines/private/private.cpp
  A engines/private/private.h


diff --git a/engines/private/configure.engine b/engines/private/configure.engine
new file mode 100644
index 0000000000..92af010f05
--- /dev/null
+++ b/engines/private/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 private "Private Eye" no
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
new file mode 100644
index 0000000000..ff82729796
--- /dev/null
+++ b/engines/private/detection.cpp
@@ -0,0 +1,43 @@
+#include "base/plugins.h"
+#include "engines/advancedDetector.h"
+
+namespace Private {
+static const PlainGameDescriptor privateGames[] = {
+	{ "private-eye", "Private Eye" },
+	{ 0, 0 }
+};
+
+
+static const ADGameDescription gameDescriptions[] = {
+	{
+		"private-eye",
+		0,
+		AD_ENTRY1s("game.dat", "7a3eb7d9dedf40680ac3d088524f976e", 190735),
+		Common::EN_ANY,
+		Common::kPlatformWindows,
+		ADGF_NO_FLAGS,
+		GUIO1(GUIO_NOMIDI)
+	},
+	AD_TABLE_END_MARKER
+};
+} // End of namespace Private
+
+class PrivateMetaEngineDetection : public AdvancedMetaEngineDetection {
+public:
+	PrivateMetaEngineDetection() : AdvancedMetaEngineDetection(Private::gameDescriptions, sizeof(ADGameDescription), Private::privateGames) {
+	}	
+
+	const char *getEngineId() const override {
+		return "private";
+	}
+
+	const char *getName() const override {
+		return "Private Eye";
+	}
+
+	const char *getOriginalCopyright() const override {
+		return "Copyright (C) Brooklyn Multimedia";
+	}
+};
+
+REGISTER_PLUGIN_STATIC(PRIVATE_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, PrivateMetaEngineDetection);
diff --git a/engines/private/metaengine.cpp b/engines/private/metaengine.cpp
new file mode 100644
index 0000000000..bb6777bb7f
--- /dev/null
+++ b/engines/private/metaengine.cpp
@@ -0,0 +1,22 @@
+#include "private/private.h"
+#include "engines/advancedDetector.h"
+
+class PrivateMetaEngine : public AdvancedMetaEngine {
+public:
+	const char *getName() const override {
+		return "private";
+	}
+
+	Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
+};
+
+Common::Error PrivateMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+	*engine = new Private::PrivateEngine(syst);
+	return Common::kNoError;
+}
+
+#if PLUGIN_ENABLED_DYNAMIC(PRIVATE)
+REGISTER_PLUGIN_DYNAMIC(PRIVATE, PLUGIN_TYPE_ENGINE, PrivateMetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(PRIVATE, PLUGIN_TYPE_ENGINE, PrivateMetaEngine);
+#endif
diff --git a/engines/private/module.mk b/engines/private/module.mk
new file mode 100644
index 0000000000..14db34da13
--- /dev/null
+++ b/engines/private/module.mk
@@ -0,0 +1,19 @@
+MODULE := engines/private
+ 
+MODULE_OBJS := \
+	metaengine.o \
+	private.o
+ 
+MODULE_DIRS += \
+	engines/private
+ 
+# This module can be built as a plugin
+ifeq ($(ENABLE_QUUX), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+ 
+# Include common rules 
+include $(srcdir)/rules.mk
+
+# Detection objects
+DETECT_OBJS += $(MODULE)/detection.o
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
new file mode 100644
index 0000000000..935aedd616
--- /dev/null
+++ b/engines/private/private.cpp
@@ -0,0 +1,121 @@
+#include "common/scummsys.h"
+
+#include "common/config-manager.h"
+#include "common/debug.h"
+#include "common/debug-channels.h"
+#include "common/error.h"
+#include "common/events.h"
+#include "common/file.h"
+#include "common/fs.h"
+#include "common/system.h"
+
+#include "engines/util.h"
+
+#include "private/private.h"
+
+namespace Private {
+
+PrivateEngine::PrivateEngine(OSystem *syst)
+	: Engine(syst) {
+	// Put your engine in a sane state, but do nothing big yet;
+	// in particular, do not load data from files; rather, if you
+	// need to do such things, do them from run().
+
+	// Do not initialize graphics here
+	// Do not initialize audio devices here
+
+	// However this is the place to specify all default directories
+	const Common::FSNode gameDataDir(ConfMan.get("path"));
+	SearchMan.addSubDirectoryMatching(gameDataDir, "sound");
+
+	// Here is the right place to set up the engine specific debug channels
+	DebugMan.addDebugChannel(kPrivateDebugExample, "example", "this is just an example for a engine specific debug channel");
+	DebugMan.addDebugChannel(kPrivateDebugExample2, "example2", "also an example");
+
+	// Don't forget to register your random source
+	_rnd = new Common::RandomSource("private");
+
+	debug("PrivateEngine::PrivateEngine");
+}
+
+PrivateEngine::~PrivateEngine() {
+	debug("PrivateEngine::~PrivateEngine");
+
+	// Dispose your resources here
+	delete _rnd;
+
+	// Remove all of our debug levels here
+	DebugMan.clearAllDebugChannels();
+}
+
+Common::Error PrivateEngine::run() {
+	// Initialize graphics using following:
+	initGraphics(320, 200);
+
+	// You could use backend transactions directly as an alternative,
+	// but it isn't recommended, until you want to handle the error values
+	// from OSystem::endGFXTransaction yourself.
+	// This is just an example template:
+	//_system->beginGFXTransaction();
+	//	// This setup the graphics mode according to users seetings
+	//	initCommonGFX(false);
+	//
+	//	// Specify dimensions of game graphics window.
+	//	// In this example: 320x200
+	//	_system->initSize(320, 200);
+	//FIXME: You really want to handle
+	//OSystem::kTransactionSizeChangeFailed here
+	//_system->endGFXTransaction();
+
+	// Create debugger console. It requires GFX to be initialized
+	Console *console = new Console(this);
+	setDebugger(console);
+
+	// Additional setup.
+	debug("PrivateEngine::init");
+
+	// Your main even loop should be (invoked from) here.
+	debug("PrivateEngine::go: Hello, World!");
+
+	// This test will show up if -d1 and --debugflags=example are specified on the commandline
+	debugC(1, kPrivateDebugExample, "Example debug call");
+
+	// This test will show up if --debugflags=example or --debugflags=example2 or both of them and -d3 are specified on the commandline
+	debugC(3, kPrivateDebugExample | kPrivateDebugExample2, "Example debug call two");
+
+	// Simple main event loop
+	Common::Event evt;
+	while (!shouldQuit()) {
+		g_system->getEventManager()->pollEvent(evt);
+		g_system->delayMillis(10);
+	}
+
+	return Common::kNoError;
+}
+
+bool PrivateEngine::hasFeature(EngineFeature f) const {
+	return
+		(f == kSupportsReturnToLauncher) ||
+		(f == kSupportsLoadingDuringRuntime) ||
+		(f == kSupportsSavingDuringRuntime);
+}
+
+Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
+	Common::Serializer s(stream, nullptr);
+	syncGameStream(s);
+	return Common::kNoError;
+}
+
+Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool isAutosave) {
+	Common::Serializer s(nullptr, stream);
+	syncGameStream(s);
+	return Common::kNoError;
+}
+
+void PrivateEngine::syncGameStream(Common::Serializer &s) {
+	// Use methods of Serializer to save/load fields
+	int dummy = 0;
+	s.syncAsUint16LE(dummy);
+}
+
+} // End of namespace Private
diff --git a/engines/private/private.h b/engines/private/private.h
new file mode 100644
index 0000000000..c841c834c5
--- /dev/null
+++ b/engines/private/private.h
@@ -0,0 +1,49 @@
+#ifndef PRIVATE_H
+#define PRIVATE_H
+
+#include "common/random.h"
+#include "common/serializer.h"
+#include "engines/engine.h"
+#include "gui/debugger.h"
+
+namespace Private {
+
+class Console;
+
+// our engine debug channels
+enum {
+	kPrivateDebugExample = 1 << 0,
+	kPrivateDebugExample2 = 1 << 1
+	// next new channel must be 1 << 2 (4)
+	// the current limitation is 32 debug channels (1 << 31 is the last one)
+};
+
+class PrivateEngine : public Engine {
+private:
+	// We need random numbers
+	Common::RandomSource *_rnd;
+public:
+	PrivateEngine(OSystem *syst);
+	~PrivateEngine();
+
+	Common::Error run() override;
+	bool hasFeature(EngineFeature f) const override;
+	bool canLoadGameStateCurrently() override { return true; }
+	bool canSaveGameStateCurrently() override { return true; }
+	Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
+	Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
+	void syncGameStream(Common::Serializer &s);
+};
+
+// Example console class
+class Console : public GUI::Debugger {
+public:
+	Console(PrivateEngine *vm) {
+	}
+	virtual ~Console(void) {
+	}
+};
+
+} // End of namespace Quux
+
+#endif


Commit: c6c9c05b6aabb3b63678b4d15c5a243885cd7218
    https://github.com/scummvm/scummvm/commit/c6c9c05b6aabb3b63678b4d15c5a243885cd7218
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: some code to decode videos

Changed paths:
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 935aedd616..5758d99b1c 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -1,5 +1,8 @@
 #include "common/scummsys.h"
 
+#include "audio/decoders/wave.h"
+#include "audio/audiostream.h"
+
 #include "common/config-manager.h"
 #include "common/debug.h"
 #include "common/debug-channels.h"
@@ -25,8 +28,8 @@ PrivateEngine::PrivateEngine(OSystem *syst)
 	// Do not initialize audio devices here
 
 	// However this is the place to specify all default directories
-	const Common::FSNode gameDataDir(ConfMan.get("path"));
-	SearchMan.addSubDirectoryMatching(gameDataDir, "sound");
+	//const Common::FSNode gameDataDir(ConfMan.get("path"));
+        //SearchMan.addSubDirectoryMatching(gameDataDir, "/run/media/g/PVTEYE");
 
 	// Here is the right place to set up the engine specific debug channels
 	DebugMan.addDebugChannel(kPrivateDebugExample, "example", "this is just an example for a engine specific debug channel");
@@ -50,7 +53,9 @@ PrivateEngine::~PrivateEngine() {
 
 Common::Error PrivateEngine::run() {
 	// Initialize graphics using following:
-	initGraphics(320, 200);
+	_screenW = 640;
+	_screenH = 480;
+	initGraphics(_screenW, _screenH);
 
 	// You could use backend transactions directly as an alternative,
 	// but it isn't recommended, until you want to handle the error values
@@ -85,9 +90,22 @@ Common::Error PrivateEngine::run() {
 
 	// Simple main event loop
 	Common::Event evt;
+        _videoDecoder = new Video::SmackerDecoder();
+  	playVideo("intro/intro.smk");
 	while (!shouldQuit()) {
 		g_system->getEventManager()->pollEvent(evt);
 		g_system->delayMillis(10);
+
+		if (_videoDecoder) {
+			if (_videoDecoder->endOfVideo()) {
+				_videoDecoder->close();
+				delete _videoDecoder;
+				_videoDecoder = nullptr;
+			} else if (_videoDecoder->needsUpdate()) {
+				drawScreen();
+			}
+		}
+
 	}
 
 	return Common::kNoError;
@@ -118,4 +136,58 @@ void PrivateEngine::syncGameStream(Common::Serializer &s) {
 	s.syncAsUint16LE(dummy);
 }
 
+void PrivateEngine::playSound(const Common::String &name) {
+	debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
+	Common::File *file = new Common::File();
+	if (!file->open(name))
+		error("unable to find sound file %s", name.c_str());
+
+	Audio::AudioStream *stream;
+	stream = Audio::makeWAVStream(file, DisposeAfterUse::YES);
+	stopSound();
+	_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream, -1, Audio::Mixer::kMaxChannelVolume);
+}
+
+void PrivateEngine::playVideo(const Common::String &name) {
+	debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
+	Common::File *file = new Common::File();
+	if (!file->open(name))
+		error("unable to find video file %s", name.c_str());
+
+	if (!_videoDecoder->loadStream(file))
+	        error("unable to load video %s", name.c_str());
+	_videoDecoder->start();
+
+}
+
+void PrivateEngine::stopSound() {
+	debugC(3, kPrivateDebugExample, "%s", __FUNCTION__);
+	if (_mixer->isSoundHandleActive(_soundHandle))
+		_mixer->stopHandle(_soundHandle);
+}
+
+void PrivateEngine::drawScreen() {
+	if (_videoDecoder && _videoDecoder->needsUpdate()) {
+		Graphics::Surface *screen = g_system->lockScreen();
+		screen->fillRect(Common::Rect(0, 0, g_system->getWidth(), g_system->getHeight()), 0);
+
+		const Graphics::Surface *surface;
+		surface = _videoDecoder->decodeNextFrame();
+
+		int w = surface->w; //CLIP<int>(surface->w, 0, _screenW);
+		int h = surface->h; //CLIP<int>(surface->h, 0, _screenH);
+
+		//int x = (_screenW - w) / 2;
+		//int y = (_screenH - h) / 2;
+     	        //debug("%d %d %d %d", w, h, x, y);
+
+		screen->copyRectToSurface(*surface, 0, 0, Common::Rect(0, 0, w, h));
+
+		g_system->unlockScreen();
+		g_system->updateScreen();
+	}
+}
+
+
+
 } // End of namespace Private
diff --git a/engines/private/private.h b/engines/private/private.h
index c841c834c5..5d66cd8806 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -6,6 +6,9 @@
 #include "engines/engine.h"
 #include "gui/debugger.h"
 
+#include "audio/mixer.h"
+#include "video/smk_decoder.h"
+
 namespace Private {
 
 class Console;
@@ -22,10 +25,15 @@ class PrivateEngine : public Engine {
 private:
 	// We need random numbers
 	Common::RandomSource *_rnd;
+	int _screenW, _screenH;
+
 public:
 	PrivateEngine(OSystem *syst);
 	~PrivateEngine();
 
+	Audio::SoundHandle _soundHandle;
+	Video::SmackerDecoder *_videoDecoder;
+
 	Common::Error run() override;
 	bool hasFeature(EngineFeature f) const override;
 	bool canLoadGameStateCurrently() override { return true; }
@@ -33,6 +41,14 @@ public:
 	Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
 	Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
 	void syncGameStream(Common::Serializer &s);
+
+	void playSound(const Common::String &name);
+	void playVideo(const Common::String &name);
+	
+	void stopSound();
+	void drawScreen();
+
+
 };
 
 // Example console class


Commit: 9e2ebc5e8a159945089835e87ec3a9a2671ec1ee
    https://github.com/scummvm/scummvm/commit/9e2ebc5e8a159945089835e87ec3a9a2671ec1ee
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixed palette

Changed paths:
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 5758d99b1c..3b30d0eb38 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -157,6 +157,7 @@ void PrivateEngine::playVideo(const Common::String &name) {
 	if (!_videoDecoder->loadStream(file))
 	        error("unable to load video %s", name.c_str());
 	_videoDecoder->start();
+	g_system->getPaletteManager()->setPalette(_videoDecoder->getPalette(), 0, 256);	
 
 }
 
@@ -184,6 +185,7 @@ void PrivateEngine::drawScreen() {
 		screen->copyRectToSurface(*surface, 0, 0, Common::Rect(0, 0, w, h));
 
 		g_system->unlockScreen();
+		//if (_image->getPalette() != nullptr)
 		g_system->updateScreen();
 	}
 }
diff --git a/engines/private/private.h b/engines/private/private.h
index 5d66cd8806..b11e98eabc 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -8,6 +8,7 @@
 
 #include "audio/mixer.h"
 #include "video/smk_decoder.h"
+#include "graphics/palette.h"
 
 namespace Private {
 


Commit: 33de9528fdc8b32c7c92740a61ee1ff5727b0216
    https://github.com/scummvm/scummvm/commit/33de9528fdc8b32c7c92740a61ee1ff5727b0216
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixes

Changed paths:
    engines/private/module.mk
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/module.mk b/engines/private/module.mk
index 14db34da13..07cfd5cc90 100644
--- a/engines/private/module.mk
+++ b/engines/private/module.mk
@@ -8,7 +8,7 @@ MODULE_DIRS += \
 	engines/private
  
 # This module can be built as a plugin
-ifeq ($(ENABLE_QUUX), DYNAMIC_PLUGIN)
+ifeq ($(ENABLE_PRIVATE), DYNAMIC_PLUGIN)
 PLUGIN := 1
 endif
  
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 3b30d0eb38..a6c4fbb26e 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -29,7 +29,7 @@ PrivateEngine::PrivateEngine(OSystem *syst)
 
 	// However this is the place to specify all default directories
 	//const Common::FSNode gameDataDir(ConfMan.get("path"));
-        //SearchMan.addSubDirectoryMatching(gameDataDir, "/run/media/g/PVTEYE");
+        //SearchMan.addSubDirectoryMatching(gameDataDir, "..");
 
 	// Here is the right place to set up the engine specific debug channels
 	DebugMan.addDebugChannel(kPrivateDebugExample, "example", "this is just an example for a engine specific debug channel");
@@ -157,7 +157,6 @@ void PrivateEngine::playVideo(const Common::String &name) {
 	if (!_videoDecoder->loadStream(file))
 	        error("unable to load video %s", name.c_str());
 	_videoDecoder->start();
-	g_system->getPaletteManager()->setPalette(_videoDecoder->getPalette(), 0, 256);	
 
 }
 
@@ -185,7 +184,7 @@ void PrivateEngine::drawScreen() {
 		screen->copyRectToSurface(*surface, 0, 0, Common::Rect(0, 0, w, h));
 
 		g_system->unlockScreen();
-		//if (_image->getPalette() != nullptr)
+ 	        g_system->getPaletteManager()->setPalette(_videoDecoder->getPalette(), 0, 256);	
 		g_system->updateScreen();
 	}
 }
diff --git a/engines/private/private.h b/engines/private/private.h
index b11e98eabc..7cb986dbcf 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -6,6 +6,8 @@
 #include "engines/engine.h"
 #include "gui/debugger.h"
 
+//#include "engines/mohawk/installer_archive.h"
+
 #include "audio/mixer.h"
 #include "video/smk_decoder.h"
 #include "graphics/palette.h"
@@ -34,6 +36,7 @@ public:
 
 	Audio::SoundHandle _soundHandle;
 	Video::SmackerDecoder *_videoDecoder;
+	//Mohawk::InstallerArchive _installerArchive;
 
 	Common::Error run() override;
 	bool hasFeature(EngineFeature f) const override;


Commit: 84f7edd834733847f9fafd603235346793d97bb6
    https://github.com/scummvm/scummvm/commit/84f7edd834733847f9fafd603235346793d97bb6
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: improved detection

Changed paths:
    engines/private/detection.cpp


diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index ff82729796..ddffddcca9 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -12,7 +12,7 @@ static const ADGameDescription gameDescriptions[] = {
 	{
 		"private-eye",
 		0,
-		AD_ENTRY1s("game.dat", "7a3eb7d9dedf40680ac3d088524f976e", 190735),
+		AD_ENTRY1s("GAME.DAT", "7a3eb7d9dedf40680ac3d088524f976e", 190735),
 		Common::EN_ANY,
 		Common::kPlatformWindows,
 		ADGF_NO_FLAGS,
@@ -22,9 +22,16 @@ static const ADGameDescription gameDescriptions[] = {
 };
 } // End of namespace Private
 
+static const char *const directoryGlobs[] = {
+        "support", // english CD
+        0
+};
+
 class PrivateMetaEngineDetection : public AdvancedMetaEngineDetection {
 public:
 	PrivateMetaEngineDetection() : AdvancedMetaEngineDetection(Private::gameDescriptions, sizeof(ADGameDescription), Private::privateGames) {
+		_maxScanDepth = 2;
+		_directoryGlobs = directoryGlobs;
 	}	
 
 	const char *getEngineId() const override {


Commit: bbd8d542097fc15836a89178d188100b40b35f21
    https://github.com/scummvm/scummvm/commit/bbd8d542097fc15836a89178d188100b40b35f21
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: added flex/bison grammar

Changed paths:
  A engines/private/private.l
  A engines/private/private.y


diff --git a/engines/private/private.l b/engines/private/private.l
new file mode 100644
index 0000000000..178d123c0e
--- /dev/null
+++ b/engines/private/private.l
@@ -0,0 +1,26 @@
+%{
+#include <stdio.h>
+#include <string.h>
+#include "private.tab.h"
+%}
+
+%%
+\/\/.*                  /* ignoring the comment */
+\<=                     return LTE;
+\>=                     return GTE;
+!=                      return NEQ;
+==                      return EQ;
+debug                   return DEBUGTOK;
+define                  return DEFINETOK;
+setting                 return SETTINGTOK;
+if                      return IFTOK;
+else                    return ELSETOK;
+goto                    return GOTOTOK;
+Random                  return RANDOMTOK;
+[A-Za-z_][A-Za-z_0-9]*  yylval.s=strdup(yytext); return NAME;
+[\-]?[0-9]+             yylval.i=atoi(yytext); return NUM;
+\"[^\"\r\n]*\"          yylval.s=strdup(yytext); return STRING;
+[\r|\n]                 /* ignore EOL */;
+[ \t]+                  /* ignore whitespace */;
+.                       return *yytext;
+%%
diff --git a/engines/private/private.y b/engines/private/private.y
new file mode 100644
index 0000000000..d42144fcd0
--- /dev/null
+++ b/engines/private/private.y
@@ -0,0 +1,99 @@
+%{
+#include <stdio.h>
+#include <string.h>
+
+int yydebug=1;
+
+void yyerror(const char *str)
+{
+	fprintf(stderr,"error: %s\n",str);
+}
+
+int yywrap()
+{
+	return 1;
+}
+
+int main()
+{
+	yyparse();
+        return 0;
+}
+
+%}
+
+%union {
+   char *s;
+   int i;
+}
+
+%token<s> NAME
+%token<s> STRING
+%token<i> NUM
+%token LTE GTE NEQ EQ IFTOK ELSETOK GOTOTOK DEBUGTOK DEFINETOK SETTINGTOK RANDOMTOK 
+
+%%
+
+lines:   lines '\r' line
+       | line
+       ;
+
+line:     /* nothing */
+        | line DEBUGTOK '{' debug '}'             { printf("debug\n"); }
+        | line DEFINETOK NAME '{' define '}'      { printf("define %s\n", $NAME); }
+        | line SETTINGTOK NAME '{' statements '}' { printf("setting %s\n", $NAME); }
+        ;
+
+debug: /* nothing */
+        | NAME ',' debug
+        ;
+
+statements:  /* nothing */
+        | statements statement
+
+
+statement: GOTOTOK expr ';' statements 
+        | fcall ';' statements
+        | IFTOK '(' expr ')' statement statements
+        | IFTOK '(' expr ')' '{' statements '}' ELSETOK '{' statements '}' statements  
+        | IFTOK '(' expr ')' '{' statements '}' statements
+        | IFTOK '(' expr ')' '{' statements '}' ELSETOK statement statements
+        | IFTOK '(' expr ')' statement ELSETOK statement statements
+        | IFTOK '(' expr ')' statement ELSETOK '{' statements '}'
+        ;
+
+define:  /* nothing */
+        | NAME ',' fcall ',' define
+        | NAME ',' fcall 
+        | NAME ',' define
+        | NAME
+        ;
+
+fcall:    GOTOTOK '(' params ')'
+        | NAME '(' params ')'
+        ;
+
+params:  /* nothing */ 
+        | params ',' fcall
+        | params ',' expr
+        | expr
+        | fcall 
+        ;
+
+value:    NUM { printf("%d", $NUM); }
+        | STRING  { printf("%s", $STRING); }
+        | NAME { printf("%s", $NAME); }
+        ;
+
+expr:     value  
+        | '!' value
+        | value EQ value
+        | value NEQ value
+        | value '+' value
+        | value '<' value
+        | value '>' value
+        | value LTE value
+        | value GTE value 
+        | value '+'
+        | RANDOMTOK '(' NUM '%' ')'
+        ;


Commit: 7e2daba32d08aa6f39442b583b4925c0ad80f9d2
    https://github.com/scummvm/scummvm/commit/7e2daba32d08aa6f39442b583b4925c0ad80f9d2
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: grammar fixes

Changed paths:
    engines/private/private.l
    engines/private/private.y


diff --git a/engines/private/private.l b/engines/private/private.l
index 178d123c0e..82ddaf2db2 100644
--- a/engines/private/private.l
+++ b/engines/private/private.l
@@ -20,7 +20,7 @@ Random                  return RANDOMTOK;
 [A-Za-z_][A-Za-z_0-9]*  yylval.s=strdup(yytext); return NAME;
 [\-]?[0-9]+             yylval.i=atoi(yytext); return NUM;
 \"[^\"\r\n]*\"          yylval.s=strdup(yytext); return STRING;
-[\r|\n]                 /* ignore EOL */;
+[\r|\n]+                /* ignore return */;
 [ \t]+                  /* ignore whitespace */;
 .                       return *yytext;
 %%
diff --git a/engines/private/private.y b/engines/private/private.y
index d42144fcd0..ce66fd17e3 100644
--- a/engines/private/private.y
+++ b/engines/private/private.y
@@ -27,21 +27,19 @@ int main()
    int i;
 }
 
-%token<s> NAME
-%token<s> STRING
+%token<s> NAME STRING
 %token<i> NUM
 %token LTE GTE NEQ EQ IFTOK ELSETOK GOTOTOK DEBUGTOK DEFINETOK SETTINGTOK RANDOMTOK 
 
 %%
 
-lines:   lines '\r' line
+lines:   line lines
        | line
        ;
 
-line:     /* nothing */
-        | line DEBUGTOK '{' debug '}'             { printf("debug\n"); }
-        | line DEFINETOK NAME '{' define '}'      { printf("define %s\n", $NAME); }
-        | line SETTINGTOK NAME '{' statements '}' { printf("setting %s\n", $NAME); }
+line:     DEBUGTOK '{' debug '}'             { printf("debug\n"); }
+        | DEFINETOK NAME '{' define '}'      { printf("define %s\n", $NAME); }
+        | SETTINGTOK NAME '{' statements '}' { printf("setting %s\n", $NAME); }
         ;
 
 debug: /* nothing */


Commit: 2ace923718b6cacb351536dfcc66b73ee992da73
    https://github.com/scummvm/scummvm/commit/2ace923718b6cacb351536dfcc66b73ee992da73
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: removed old grammar code

Changed paths:
  R engines/private/private.l
  R engines/private/private.y


diff --git a/engines/private/private.l b/engines/private/private.l
deleted file mode 100644
index 82ddaf2db2..0000000000
--- a/engines/private/private.l
+++ /dev/null
@@ -1,26 +0,0 @@
-%{
-#include <stdio.h>
-#include <string.h>
-#include "private.tab.h"
-%}
-
-%%
-\/\/.*                  /* ignoring the comment */
-\<=                     return LTE;
-\>=                     return GTE;
-!=                      return NEQ;
-==                      return EQ;
-debug                   return DEBUGTOK;
-define                  return DEFINETOK;
-setting                 return SETTINGTOK;
-if                      return IFTOK;
-else                    return ELSETOK;
-goto                    return GOTOTOK;
-Random                  return RANDOMTOK;
-[A-Za-z_][A-Za-z_0-9]*  yylval.s=strdup(yytext); return NAME;
-[\-]?[0-9]+             yylval.i=atoi(yytext); return NUM;
-\"[^\"\r\n]*\"          yylval.s=strdup(yytext); return STRING;
-[\r|\n]+                /* ignore return */;
-[ \t]+                  /* ignore whitespace */;
-.                       return *yytext;
-%%
diff --git a/engines/private/private.y b/engines/private/private.y
deleted file mode 100644
index ce66fd17e3..0000000000
--- a/engines/private/private.y
+++ /dev/null
@@ -1,97 +0,0 @@
-%{
-#include <stdio.h>
-#include <string.h>
-
-int yydebug=1;
-
-void yyerror(const char *str)
-{
-	fprintf(stderr,"error: %s\n",str);
-}
-
-int yywrap()
-{
-	return 1;
-}
-
-int main()
-{
-	yyparse();
-        return 0;
-}
-
-%}
-
-%union {
-   char *s;
-   int i;
-}
-
-%token<s> NAME STRING
-%token<i> NUM
-%token LTE GTE NEQ EQ IFTOK ELSETOK GOTOTOK DEBUGTOK DEFINETOK SETTINGTOK RANDOMTOK 
-
-%%
-
-lines:   line lines
-       | line
-       ;
-
-line:     DEBUGTOK '{' debug '}'             { printf("debug\n"); }
-        | DEFINETOK NAME '{' define '}'      { printf("define %s\n", $NAME); }
-        | SETTINGTOK NAME '{' statements '}' { printf("setting %s\n", $NAME); }
-        ;
-
-debug: /* nothing */
-        | NAME ',' debug
-        ;
-
-statements:  /* nothing */
-        | statements statement
-
-
-statement: GOTOTOK expr ';' statements 
-        | fcall ';' statements
-        | IFTOK '(' expr ')' statement statements
-        | IFTOK '(' expr ')' '{' statements '}' ELSETOK '{' statements '}' statements  
-        | IFTOK '(' expr ')' '{' statements '}' statements
-        | IFTOK '(' expr ')' '{' statements '}' ELSETOK statement statements
-        | IFTOK '(' expr ')' statement ELSETOK statement statements
-        | IFTOK '(' expr ')' statement ELSETOK '{' statements '}'
-        ;
-
-define:  /* nothing */
-        | NAME ',' fcall ',' define
-        | NAME ',' fcall 
-        | NAME ',' define
-        | NAME
-        ;
-
-fcall:    GOTOTOK '(' params ')'
-        | NAME '(' params ')'
-        ;
-
-params:  /* nothing */ 
-        | params ',' fcall
-        | params ',' expr
-        | expr
-        | fcall 
-        ;
-
-value:    NUM { printf("%d", $NUM); }
-        | STRING  { printf("%s", $STRING); }
-        | NAME { printf("%s", $NAME); }
-        ;
-
-expr:     value  
-        | '!' value
-        | value EQ value
-        | value NEQ value
-        | value '+' value
-        | value '<' value
-        | value '>' value
-        | value LTE value
-        | value GTE value 
-        | value '+'
-        | RANDOMTOK '(' NUM '%' ')'
-        ;


Commit: f1262c242d89b4fdb6ffce0696ee0202b5afd678
    https://github.com/scummvm/scummvm/commit/f1262c242d89b4fdb6ffce0696ee0202b5afd678
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: new prototype for code generation using hoc

Changed paths:
  A engines/private/code.c
  A engines/private/grammar.h
  A engines/private/grammar.l
  A engines/private/grammar.y
  A engines/private/symbol.c


diff --git a/engines/private/code.c b/engines/private/code.c
new file mode 100644
index 0000000000..4821a3c744
--- /dev/null
+++ b/engines/private/code.c
@@ -0,0 +1,132 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "grammar.h"
+#include "grammar.tab.h"
+
+#define	NSTACK	256
+static	Datum	stack[NSTACK];	/* the stack */
+static	Datum	*stackp;	/* next free spot on stack */
+
+#define	NPROG	2000
+Inst	prog[NPROG];	/* the machine */
+Inst	*progp;		/* next free spot for code generation */
+Inst	*pc;		/* program counter during execution */
+
+void initcode()	/* initialize for code generation */
+{
+	stackp = stack;
+	progp = prog;
+}
+
+int push(Datum d)		/* push d onto stack */
+{
+	if (stackp >= &stack[NSTACK])
+		abort();
+ 	//	execerror("stack overflow", (char *) 0);
+	*stackp++ = d;
+	return 0;
+}
+
+Datum pop()	/* pop and return top elem from stack */
+{
+	if (stackp <= stack)
+	       abort();
+	//	execerror("stack underflow", (char *) 0);
+	return *--stackp;
+}
+
+int constpush()	/* push constant onto stack */
+{
+	Datum d;
+	d.val = ((Symbol *)*pc++)->u.val;
+	printf("pushing %d\n", d.val);
+	push(d);
+	return 0;
+}
+
+int varpush()	/* push variable onto stack */
+{
+	Datum d;
+	d.sym = (Symbol *)(*pc++);
+	printf("var pushing %s", d.sym->name);
+	push(d);
+	return 0;
+}
+
+int bltin()		/* evaluate built-in on top of stack */
+{
+	Datum d;
+	d = pop();
+	d.val = (*(double (*)())(*pc++))(d.val);
+	push(d);
+	return 0;
+}
+
+int eval()		/* evaluate variable on stack */
+{
+	Datum d;
+	d = pop();
+	//if (d.sym->type == UNDEF)
+	//	execerror("undefined variable", d.sym->name);
+	d.val = d.sym->u.val;
+	push(d);
+	return 0;
+}
+
+int add()		/* add top two elems on stack */
+{
+	Datum d1, d2;
+	d2 = pop();
+	d1 = pop();
+	printf("adding %d %d\n",d1.val, d2.val);
+	d1.val += d2.val;
+	push(d1);
+	return 0;
+}
+
+int negate()
+{
+	Datum d;
+	d = pop();
+	d.val = !d.val;
+	push(d);
+	return 0;
+}
+
+int assign()	/* assign top value to next value */
+{
+	Datum d1, d2;
+	d1 = pop();
+	d2 = pop();
+	/*if (d1.sym->type != VAR && d1.sym->type != UNDEF)
+		execerror("assignment to non-variable",
+			d1.sym->name);*/
+	d1.sym->u.val = d2.val;
+	d1.sym->type = NAME;
+	push(d2);
+	return 0;
+}
+
+int print()		/* pop top value from stack, print it */
+{
+	Datum d;
+	d = pop();
+	printf("\t%.8g\n", d.val);
+	return 0;
+}
+
+Inst *code(Inst f)	/* install one instruction or operand */
+{
+	Inst *oprogp = progp;
+	if (progp >= &prog[NPROG])
+		abort();
+	*progp++ = f;
+	return oprogp;
+}
+
+void execute(Inst *p)	/* run the machine */
+{
+	for (pc = p; *pc != STOP; )
+		(*(*pc++))();
+}
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
new file mode 100644
index 0000000000..e5d9bced6d
--- /dev/null
+++ b/engines/private/grammar.h
@@ -0,0 +1,34 @@
+typedef struct Symbol {	/* symbol table entry */
+	char	*name;
+	short	type;	/* NAME, NUM or STRING  */
+	union {
+		int	val;	/* if NAME or NUM */
+		char	*str;	/* if STRING */
+	} u;
+	struct Symbol	*next;	/* to link to another */
+} Symbol;
+Symbol	*install(), *lookup();
+
+typedef union Datum {	/* interpreter stack type */
+	int	val;
+	Symbol	*sym;
+} Datum;
+extern	Datum pop();
+
+typedef int (*Inst)();	/* machine instruction */
+#define	STOP	(Inst) 0
+
+extern  Inst *code(Inst);
+extern	Inst prog[];
+extern	int eval();
+extern  int add();
+extern  int negate(); 
+extern  int power();
+extern	int assign();
+extern  int bltin();
+extern  int varpush(); 
+extern  int constpush();
+extern  int print();
+
+extern void initcode();
+extern void execute();
diff --git a/engines/private/grammar.l b/engines/private/grammar.l
new file mode 100644
index 0000000000..8515197f7f
--- /dev/null
+++ b/engines/private/grammar.l
@@ -0,0 +1,27 @@
+%{
+#include <stdio.h>
+#include <string.h>
+#include "grammar.h"
+#include "grammar.tab.h"
+%}
+
+%%
+\/\/.*                  /* ignoring the comment */
+\<=                     return LTE;
+\>=                     return GTE;
+!=                      return NEQ;
+==                      return EQ;
+debug                   return DEBUGTOK;
+define                  return DEFINETOK;
+setting                 return SETTINGTOK;
+if                      return IFTOK;
+else                    return ELSETOK;
+goto                    return GOTOTOK;
+Random                  return RANDOMTOK;
+[A-Za-z_][A-Za-z_0-9]*  yylval.s=strdup(yytext); return NAME;
+[\-]?[0-9]+             yylval.sym = install("", NUM, atoi(yytext)); return NUM;
+\"[^\"\r\n]*\"          yylval.s=strdup(yytext); return STRING;
+[\r|\n]+                /* ignore return */;
+[ \t]+                  /* ignore whitespace */;
+.                       return *yytext;
+%%
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
new file mode 100644
index 0000000000..7509cebb76
--- /dev/null
+++ b/engines/private/grammar.y
@@ -0,0 +1,115 @@
+%{
+
+#include "grammar.h"
+#define	code2(c1,c2)	code(c1); code(c2)
+#define	code3(c1,c2,c3)	code(c1); code(c2); code(c3)
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+int yydebug=1;
+extern FILE *yyin;
+extern int yyparse();
+
+void yyerror(const char *str)
+{
+	fprintf(stderr,"error: %s\n",str);
+}
+
+int yywrap()
+{
+	return 1;
+}
+
+int parse(char *filename)
+{
+        yyin = fopen(filename, "r");
+        yyparse();
+        return 0;
+}
+
+int main() {
+	initcode();
+        yyparse();
+        execute(prog);
+        return 0;
+}
+
+%}
+
+%union {
+	Symbol	*sym;	/* symbol table pointer */
+	Inst	*inst;	/* machine instruction */
+        char *s;
+        int *i;
+}
+
+%token<s> NAME STRING
+%token<sym> NUM
+%token LTE GTE NEQ EQ IFTOK ELSETOK GOTOTOK DEBUGTOK DEFINETOK SETTINGTOK RANDOMTOK 
+
+%%
+
+lines:   line lines
+       | line
+       ;
+
+line:     DEBUGTOK '{' debug '}'             { printf("debug\n"); }
+        | DEFINETOK NAME '{' define '}'      { printf("define %s\n", $NAME); }
+        | SETTINGTOK NAME '{' statements '}' { printf("setting %s\n", $NAME); }
+        ;
+
+debug: /* nothing */
+        | NAME ',' debug
+        ;
+
+statements:  /* nothing */
+        | statements statement
+
+
+statement: GOTOTOK expr ';' statements 
+        | fcall ';' statements
+        | IFTOK '(' expr ')' statement statements
+        | IFTOK '(' expr ')' '{' statements '}' ELSETOK '{' statements '}' statements  
+        | IFTOK '(' expr ')' '{' statements '}' statements
+        | IFTOK '(' expr ')' '{' statements '}' ELSETOK statement statements
+        | IFTOK '(' expr ')' statement ELSETOK statement statements
+        | IFTOK '(' expr ')' statement ELSETOK '{' statements '}'
+        ;
+
+define:  /* nothing */
+        | NAME ',' fcall ',' define  { }
+        | NAME ',' fcall             { }
+        | NAME ',' define            { install($NAME, NAME, 0); }
+        | NAME                       { install($NAME, NAME, 0); }  
+        ;
+
+fcall:    GOTOTOK '(' params ')'
+        | NAME '(' params ')'
+        ;
+
+params:  /* nothing */ 
+        | params ',' fcall
+        | params ',' expr
+        | expr
+        | fcall 
+        ;
+
+value:    NUM    { code2(constpush, (Inst)$NUM); }
+        | STRING { }
+        | NAME   { code3(varpush, (Inst)lookup($1), eval); }
+        ;
+
+expr:     value          
+        | '!' value       { code(negate); }
+        | value EQ value
+        | value NEQ value
+        | value '+' value { code(add); }
+        | value '<' value
+        | value '>' value
+        | value LTE value
+        | value GTE value 
+        | value '+'
+        | RANDOMTOK '(' NUM '%' ')'
+        ;
diff --git a/engines/private/symbol.c b/engines/private/symbol.c
new file mode 100644
index 0000000000..b3625eda8a
--- /dev/null
+++ b/engines/private/symbol.c
@@ -0,0 +1,42 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "grammar.h"
+#include "grammar.tab.h"
+
+static Symbol *symlist = 0;  /* symbol table: linked list */
+
+Symbol *lookup(char *s)	/* find s in symbol table */
+{
+	Symbol *sp;
+
+	for (sp = symlist; sp != (Symbol *) 0; sp = sp->next)
+		if (strcmp(sp->name, s) == 0)
+			return sp;
+	return 0;	/* 0 ==> not found */	
+}
+
+Symbol *install(char *s, int t, int d)  /* install s in symbol table */
+{
+	Symbol *sp;
+	char *emalloc();
+
+	sp = (Symbol *) emalloc(sizeof(Symbol));
+	sp->name = emalloc(strlen(s)+1); /* +1 for '\0' */
+	strcpy(sp->name, s);
+	sp->type = t;
+	sp->u.val = d;
+	sp->next = symlist; /* put at front of list */
+	symlist = sp;
+	return sp;
+}
+
+char *emalloc(unsigned n)	/* check return from malloc */
+{
+	char *p;
+
+	p = (char*) malloc(n);
+	if (p == 0)
+		abort(); //execerror("out of memory", (char *) 0);
+	return p;
+}


Commit: f8b16861fc17e4d7ebf6e806716a3dcaeb1b70d4
    https://github.com/scummvm/scummvm/commit/f8b16861fc17e4d7ebf6e806716a3dcaeb1b70d4
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: more code

Changed paths:
    engines/private/code.c
    engines/private/grammar.h
    engines/private/grammar.l
    engines/private/grammar.y
    engines/private/module.mk
    engines/private/private.cpp
    engines/private/symbol.c


diff --git a/engines/private/code.c b/engines/private/code.c
index 4821a3c744..195c5b55f6 100644
--- a/engines/private/code.c
+++ b/engines/private/code.c
@@ -45,6 +45,16 @@ int constpush()	/* push constant onto stack */
 	return 0;
 }
 
+int strpush()	/* push constant onto stack */
+{
+	Datum d;
+	d.str = ((Symbol *)*pc++)->u.str;
+	printf("pushing %s\n", d.str);
+	push(d);
+	return 0;
+}
+
+
 int varpush()	/* push variable onto stack */
 {
 	Datum d;
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index e5d9bced6d..3cc72342b8 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -7,10 +7,11 @@ typedef struct Symbol {	/* symbol table entry */
 	} u;
 	struct Symbol	*next;	/* to link to another */
 } Symbol;
-Symbol	*install(), *lookup();
+Symbol	*install(char *, int, int, char *), *lookup(char *);
 
 typedef union Datum {	/* interpreter stack type */
-	int	val;
+	int	 val;
+	char    *str;
 	Symbol	*sym;
 } Datum;
 extern	Datum pop();
@@ -28,7 +29,10 @@ extern	int assign();
 extern  int bltin();
 extern  int varpush(); 
 extern  int constpush();
+extern  int strpush();
 extern  int print();
 
 extern void initcode();
-extern void execute();
+extern void execute(Inst *);
+
+extern int parse(char*);
diff --git a/engines/private/grammar.l b/engines/private/grammar.l
index 8515197f7f..7a152592ab 100644
--- a/engines/private/grammar.l
+++ b/engines/private/grammar.l
@@ -1,8 +1,15 @@
+%option noyywrap
+%option noinput
+%option never-interactive
+
+%option outfile="engines/private/lex.yy.cpp"
+
 %{
 #include <stdio.h>
 #include <string.h>
 #include "grammar.h"
 #include "grammar.tab.h"
+
 %}
 
 %%
@@ -19,9 +26,38 @@ else                    return ELSETOK;
 goto                    return GOTOTOK;
 Random                  return RANDOMTOK;
 [A-Za-z_][A-Za-z_0-9]*  yylval.s=strdup(yytext); return NAME;
-[\-]?[0-9]+             yylval.sym = install("", NUM, atoi(yytext)); return NUM;
-\"[^\"\r\n]*\"          yylval.s=strdup(yytext); return STRING;
+[\-]?[0-9]+             yylval.sym = install("", NUM, atoi(yytext), NULL); return NUM;
+\"[^\"\r\n]*\"          yylval.sym = install("", STRING, 0, strdup(yytext)); return STRING;
 [\r|\n]+                /* ignore return */;
 [ \t]+                  /* ignore whitespace */;
 .                       return *yytext;
 %%
+
+extern int yydebug;
+
+namespace Private {
+
+int parse_assets(const char *code) {
+	//inputbuffer = code;
+	//inputlen = strlen(code);
+
+	//_lines[0] = _lines[1] = _lines[2] = code;
+
+	YY_BUFFER_STATE bp;
+
+	//if (debugChannelSet(-1, kDebugParse))
+	yydebug = 1;
+	//else
+	//	yydebug = 0;
+
+	yy_delete_buffer(YY_CURRENT_BUFFER);
+
+	bp = yy_scan_string(code);
+	yy_switch_to_buffer(bp);
+	yyparse();
+	yy_delete_buffer(bp);
+
+	return 0;
+}
+
+} // End of namespace Private
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 7509cebb76..46b0fa402e 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -1,6 +1,11 @@
+%require "3.6"
+%defines "engines/private/grammar.tab.h"
+%output "engines/private/grammar.tab.cpp"
+
 %{
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
 
-#include "grammar.h"
+#include "private/grammar.h"
 #define	code2(c1,c2)	code(c1); code(c2)
 #define	code3(c1,c2,c3)	code(c1); code(c2); code(c3)
 
@@ -9,7 +14,9 @@
 #include <stdlib.h>
 
 int yydebug=1;
+
 extern FILE *yyin;
+extern int yylex();
 extern int yyparse();
 
 void yyerror(const char *str)
@@ -22,6 +29,7 @@ int yywrap()
 	return 1;
 }
 
+/*
 int parse(char *filename)
 {
         yyin = fopen(filename, "r");
@@ -34,19 +42,20 @@ int main() {
         yyparse();
         execute(prog);
         return 0;
-}
+}*/
+
+typedef int (*Inst)();
 
 %}
 
 %union {
-	Symbol	*sym;	/* symbol table pointer */
-	Inst	*inst;	/* machine instruction */
+	struct Symbol	*sym;	/* symbol table pointer */
         char *s;
         int *i;
 }
 
-%token<s> NAME STRING
-%token<sym> NUM
+%token<s> NAME
+%token<sym> STRING NUM
 %token LTE GTE NEQ EQ IFTOK ELSETOK GOTOTOK DEBUGTOK DEFINETOK SETTINGTOK RANDOMTOK 
 
 %%
@@ -81,8 +90,8 @@ statement: GOTOTOK expr ';' statements
 define:  /* nothing */
         | NAME ',' fcall ',' define  { }
         | NAME ',' fcall             { }
-        | NAME ',' define            { install($NAME, NAME, 0); }
-        | NAME                       { install($NAME, NAME, 0); }  
+        | NAME ',' define            { install($NAME, NAME, 0, NULL); }
+        | NAME                       { install($NAME, NAME, 0, NULL); }  
         ;
 
 fcall:    GOTOTOK '(' params ')'
@@ -97,7 +106,7 @@ params:  /* nothing */
         ;
 
 value:    NUM    { code2(constpush, (Inst)$NUM); }
-        | STRING { }
+        | STRING { code2(strpush, (Inst)$STRING); }
         | NAME   { code3(varpush, (Inst)lookup($1), eval); }
         ;
 
diff --git a/engines/private/module.mk b/engines/private/module.mk
index 07cfd5cc90..e761a0540c 100644
--- a/engines/private/module.mk
+++ b/engines/private/module.mk
@@ -1,8 +1,12 @@
 MODULE := engines/private
  
 MODULE_OBJS := \
+	private.o \
 	metaengine.o \
-	private.o
+        code.o \
+	symbol.o \
+        grammar.tab.o \
+	lex.yy.o
  
 MODULE_DIRS += \
 	engines/private
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index a6c4fbb26e..ce244bb411 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -15,6 +15,10 @@
 #include "engines/util.h"
 
 #include "private/private.h"
+#include "private/grammar.tab.h"
+#include "private/grammar.h"
+
+extern int yyparse();
 
 namespace Private {
 
@@ -52,6 +56,9 @@ PrivateEngine::~PrivateEngine() {
 }
 
 Common::Error PrivateEngine::run() {
+        //parse("support/GAME.DAT");
+	yyparse();
+
 	// Initialize graphics using following:
 	_screenW = 640;
 	_screenH = 480;
diff --git a/engines/private/symbol.c b/engines/private/symbol.c
index b3625eda8a..16818263aa 100644
--- a/engines/private/symbol.c
+++ b/engines/private/symbol.c
@@ -16,16 +16,22 @@ Symbol *lookup(char *s)	/* find s in symbol table */
 	return 0;	/* 0 ==> not found */	
 }
 
-Symbol *install(char *s, int t, int d)  /* install s in symbol table */
+Symbol *install(char *n, int t, int d, char *s)  /* install s in symbol table */
 {
 	Symbol *sp;
 	char *emalloc();
 
 	sp = (Symbol *) emalloc(sizeof(Symbol));
-	sp->name = emalloc(strlen(s)+1); /* +1 for '\0' */
-	strcpy(sp->name, s);
+	sp->name = emalloc(strlen(n)+1); /* +1 for '\0' */
+	strcpy(sp->name, n);
 	sp->type = t;
-	sp->u.val = d;
+	if (t == NUM || t == NAME)
+	   sp->u.val = d;
+	else if (t == STRING)
+	   sp->u.str = s;
+        else
+	   abort();
+
 	sp->next = symlist; /* put at front of list */
 	symlist = sp;
 	return sp;


Commit: 7e1e52e5eeca94a98e67a5a8e1f001ccc324a154
    https://github.com/scummvm/scummvm/commit/7e1e52e5eeca94a98e67a5a8e1f001ccc324a154
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: moved more files to c++

Changed paths:
  A engines/private/code.cpp
  A engines/private/symbol.cpp
  R engines/private/code.c
  R engines/private/symbol.c
    engines/private/grammar.h
    engines/private/grammar.l
    engines/private/module.mk
    engines/private/private.cpp


diff --git a/engines/private/code.c b/engines/private/code.cpp
similarity index 93%
rename from engines/private/code.c
rename to engines/private/code.cpp
index 195c5b55f6..e144bf7753 100644
--- a/engines/private/code.c
+++ b/engines/private/code.cpp
@@ -64,14 +64,6 @@ int varpush()	/* push variable onto stack */
 	return 0;
 }
 
-int bltin()		/* evaluate built-in on top of stack */
-{
-	Datum d;
-	d = pop();
-	d.val = (*(double (*)())(*pc++))(d.val);
-	push(d);
-	return 0;
-}
 
 int eval()		/* evaluate variable on stack */
 {
@@ -122,7 +114,7 @@ int print()		/* pop top value from stack, print it */
 {
 	Datum d;
 	d = pop();
-	printf("\t%.8g\n", d.val);
+	printf("\t%d\n", d.val);
 	return 0;
 }
 
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 3cc72342b8..e5613ecfab 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -34,5 +34,3 @@ extern  int print();
 
 extern void initcode();
 extern void execute(Inst *);
-
-extern int parse(char*);
diff --git a/engines/private/grammar.l b/engines/private/grammar.l
index 7a152592ab..821bcb3a58 100644
--- a/engines/private/grammar.l
+++ b/engines/private/grammar.l
@@ -35,9 +35,9 @@ Random                  return RANDOMTOK;
 
 extern int yydebug;
 
-namespace Private {
+//namespace Private {
 
-int parse_assets(const char *code) {
+int parse(const char *code) {
 	//inputbuffer = code;
 	//inputlen = strlen(code);
 
@@ -60,4 +60,4 @@ int parse_assets(const char *code) {
 	return 0;
 }
 
-} // End of namespace Private
+//} // End of namespace Private
diff --git a/engines/private/module.mk b/engines/private/module.mk
index e761a0540c..0e2b965b19 100644
--- a/engines/private/module.mk
+++ b/engines/private/module.mk
@@ -1,12 +1,12 @@
 MODULE := engines/private
  
 MODULE_OBJS := \
-	private.o \
 	metaengine.o \
         code.o \
 	symbol.o \
         grammar.tab.o \
-	lex.yy.o
+	lex.yy.o \
+	private.o
  
 MODULE_DIRS += \
 	engines/private
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index ce244bb411..358dd46c3f 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -19,6 +19,7 @@
 #include "private/grammar.h"
 
 extern int yyparse();
+extern int parse(char*);
 
 namespace Private {
 
@@ -56,8 +57,11 @@ PrivateEngine::~PrivateEngine() {
 }
 
 Common::Error PrivateEngine::run() {
-        //parse("support/GAME.DAT");
-	yyparse();
+	Common::File *file = new Common::File();
+	assert(!file->open("support/GAME.DAT"));
+	void *buf = malloc(1024); 
+	file->read(buf, 1024);
+	parse((char *) buf);
 
 	// Initialize graphics using following:
 	_screenW = 640;
diff --git a/engines/private/symbol.c b/engines/private/symbol.cpp
similarity index 98%
rename from engines/private/symbol.c
rename to engines/private/symbol.cpp
index 16818263aa..ac63cb1fae 100644
--- a/engines/private/symbol.c
+++ b/engines/private/symbol.cpp
@@ -6,6 +6,16 @@
 
 static Symbol *symlist = 0;  /* symbol table: linked list */
 
+char *emalloc(unsigned n)	/* check return from malloc */
+{
+	char *p;
+
+	p = (char*) malloc(n);
+	if (p == 0)
+		abort(); //execerror("out of memory", (char *) 0);
+	return p;
+}
+
 Symbol *lookup(char *s)	/* find s in symbol table */
 {
 	Symbol *sp;
@@ -19,7 +29,6 @@ Symbol *lookup(char *s)	/* find s in symbol table */
 Symbol *install(char *n, int t, int d, char *s)  /* install s in symbol table */
 {
 	Symbol *sp;
-	char *emalloc();
 
 	sp = (Symbol *) emalloc(sizeof(Symbol));
 	sp->name = emalloc(strlen(n)+1); /* +1 for '\0' */
@@ -36,13 +45,3 @@ Symbol *install(char *n, int t, int d, char *s)  /* install s in symbol table */
 	symlist = sp;
 	return sp;
 }
-
-char *emalloc(unsigned n)	/* check return from malloc */
-{
-	char *p;
-
-	p = (char*) malloc(n);
-	if (p == 0)
-		abort(); //execerror("out of memory", (char *) 0);
-	return p;
-}


Commit: 16a642cba815aeb5944991972126853acdde998e
    https://github.com/scummvm/scummvm/commit/16a642cba815aeb5944991972126853acdde998e
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixed linking

Changed paths:
    engines/private/grammar.l
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/grammar.l b/engines/private/grammar.l
index 821bcb3a58..00d84960a2 100644
--- a/engines/private/grammar.l
+++ b/engines/private/grammar.l
@@ -35,12 +35,11 @@ Random                  return RANDOMTOK;
 
 extern int yydebug;
 
-//namespace Private {
-
-int parse(const char *code) {
-	//inputbuffer = code;
-	//inputlen = strlen(code);
+namespace Private {
 
+int parse(char *code) {
+	
+	initcode();
 	//_lines[0] = _lines[1] = _lines[2] = code;
 
 	YY_BUFFER_STATE bp;
@@ -55,9 +54,10 @@ int parse(const char *code) {
 	bp = yy_scan_string(code);
 	yy_switch_to_buffer(bp);
 	yyparse();
+        execute(prog);
 	yy_delete_buffer(bp);
 
 	return 0;
 }
 
-//} // End of namespace Private
+} // End of namespace Private
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 358dd46c3f..72aa4f88e2 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -19,10 +19,11 @@
 #include "private/grammar.h"
 
 extern int yyparse();
-extern int parse(char*);
 
 namespace Private {
 
+extern int parse(char*);
+
 PrivateEngine::PrivateEngine(OSystem *syst)
 	: Engine(syst) {
 	// Put your engine in a sane state, but do nothing big yet;
@@ -58,9 +59,9 @@ PrivateEngine::~PrivateEngine() {
 
 Common::Error PrivateEngine::run() {
 	Common::File *file = new Common::File();
-	assert(!file->open("support/GAME.DAT"));
-	void *buf = malloc(1024); 
-	file->read(buf, 1024);
+	assert(file->open("GAME.DAT"));
+	void *buf = malloc(191000); 
+	file->read(buf, 191000);
 	parse((char *) buf);
 
 	// Initialize graphics using following:
diff --git a/engines/private/private.h b/engines/private/private.h
index 7cb986dbcf..915cb2c106 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -52,7 +52,6 @@ public:
 	void stopSound();
 	void drawScreen();
 
-
 };
 
 // Example console class


Commit: 939bf9226624e4216445a408ad04e0326f4f3719
    https://github.com/scummvm/scummvm/commit/939bf9226624e4216445a408ad04e0326f4f3719
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: use Private namespace

Changed paths:
    engines/private/code.cpp
    engines/private/grammar.h
    engines/private/grammar.l
    engines/private/grammar.y
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index e144bf7753..724082eaea 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -4,6 +4,8 @@
 #include "grammar.h"
 #include "grammar.tab.h"
 
+namespace Private {
+
 #define	NSTACK	256
 static	Datum	stack[NSTACK];	/* the stack */
 static	Datum	*stackp;	/* next free spot on stack */
@@ -132,3 +134,5 @@ void execute(Inst *p)	/* run the machine */
 	for (pc = p; *pc != STOP; )
 		(*(*pc++))();
 }
+
+}
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index e5613ecfab..89b450ec1b 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -7,13 +7,17 @@ typedef struct Symbol {	/* symbol table entry */
 	} u;
 	struct Symbol	*next;	/* to link to another */
 } Symbol;
-Symbol	*install(char *, int, int, char *), *lookup(char *);
 
 typedef union Datum {	/* interpreter stack type */
 	int	 val;
 	char    *str;
 	Symbol	*sym;
 } Datum;
+
+
+namespace Private {
+
+Symbol	*install(char *, int, int, char *), *lookup(char *);
 extern	Datum pop();
 
 typedef int (*Inst)();	/* machine instruction */
@@ -34,3 +38,5 @@ extern  int print();
 
 extern void initcode();
 extern void execute(Inst *);
+
+}
diff --git a/engines/private/grammar.l b/engines/private/grammar.l
index 00d84960a2..93a634e16e 100644
--- a/engines/private/grammar.l
+++ b/engines/private/grammar.l
@@ -25,9 +25,9 @@ if                      return IFTOK;
 else                    return ELSETOK;
 goto                    return GOTOTOK;
 Random                  return RANDOMTOK;
-[A-Za-z_][A-Za-z_0-9]*  yylval.s=strdup(yytext); return NAME;
-[\-]?[0-9]+             yylval.sym = install("", NUM, atoi(yytext), NULL); return NUM;
-\"[^\"\r\n]*\"          yylval.sym = install("", STRING, 0, strdup(yytext)); return STRING;
+[A-Za-z_][A-Za-z_0-9]*  yylval.s = strdup(yytext); return NAME;
+[\-]?[0-9]+             yylval.sym = Private::install("", NUM, atoi(yytext), NULL); return NUM;
+\"[^\"\r\n]*\"          yylval.sym = Private::install("", STRING, 0, strdup(yytext)); return STRING;
 [\r|\n]+                /* ignore return */;
 [ \t]+                  /* ignore whitespace */;
 .                       return *yytext;
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 46b0fa402e..48c64b410d 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -6,8 +6,9 @@
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
 
 #include "private/grammar.h"
-#define	code2(c1,c2)	code(c1); code(c2)
-#define	code3(c1,c2,c3)	code(c1); code(c2); code(c3)
+#define	code1(c1)	Private::code(c1);
+#define	code2(c1,c2)	Private::code(c1); Private::code(c2)
+#define	code3(c1,c2,c3)	Private::code(c1); Private::code(c2); Private::code(c3)
 
 #include <stdio.h>
 #include <string.h>
@@ -15,6 +16,8 @@
 
 int yydebug=1;
 
+using namespace Private;
+
 extern FILE *yyin;
 extern int yylex();
 extern int yyparse();
@@ -29,23 +32,6 @@ int yywrap()
 	return 1;
 }
 
-/*
-int parse(char *filename)
-{
-        yyin = fopen(filename, "r");
-        yyparse();
-        return 0;
-}
-
-int main() {
-	initcode();
-        yyparse();
-        execute(prog);
-        return 0;
-}*/
-
-typedef int (*Inst)();
-
 %}
 
 %union {
@@ -90,11 +76,11 @@ statement: GOTOTOK expr ';' statements
 define:  /* nothing */
         | NAME ',' fcall ',' define  { }
         | NAME ',' fcall             { }
-        | NAME ',' define            { install($NAME, NAME, 0, NULL); }
-        | NAME                       { install($NAME, NAME, 0, NULL); }  
+        | NAME ',' define            { Private::install($NAME, NAME, 0, NULL); }
+        | NAME                       { Private::install($NAME, NAME, 0, NULL); }  
         ;
 
-fcall:    GOTOTOK '(' params ')'
+fcall:    GOTOTOK '(' NAME ')'
         | NAME '(' params ')'
         ;
 
@@ -105,16 +91,16 @@ params:  /* nothing */
         | fcall 
         ;
 
-value:    NUM    { code2(constpush, (Inst)$NUM); }
-        | STRING { code2(strpush, (Inst)$STRING); }
-        | NAME   { code3(varpush, (Inst)lookup($1), eval); }
+value:    NUM    { code2(Private::constpush, (Private::Inst)$NUM); }
+        | STRING { code2(Private::strpush, (Private::Inst)$STRING); }
+        | NAME   { code3(Private::varpush, (Private::Inst)Private::lookup($1), Private::eval); }
         ;
 
 expr:     value          
-        | '!' value       { code(negate); }
+        | '!' value       { code1(Private::negate); }
         | value EQ value
         | value NEQ value
-        | value '+' value { code(add); }
+        | value '+' value { code1(Private::add); }
         | value '<' value
         | value '>' value
         | value LTE value
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index ac63cb1fae..f540fcbc8c 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -4,6 +4,8 @@
 #include "grammar.h"
 #include "grammar.tab.h"
 
+namespace Private {
+
 static Symbol *symlist = 0;  /* symbol table: linked list */
 
 char *emalloc(unsigned n)	/* check return from malloc */
@@ -45,3 +47,5 @@ Symbol *install(char *n, int t, int d, char *s)  /* install s in symbol table */
 	symlist = sp;
 	return sp;
 }
+
+} 


Commit: 6a8adece277d6ba7d8106e35d5199beac766d574
    https://github.com/scummvm/scummvm/commit/6a8adece277d6ba7d8106e35d5199beac766d574
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: allocate a new stack for every setting

Changed paths:
    engines/private/code.cpp
    engines/private/grammar.h
    engines/private/grammar.l
    engines/private/grammar.y


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 724082eaea..264d15b3ab 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -1,22 +1,42 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <cstring>
 
 #include "grammar.h"
 #include "grammar.tab.h"
 
+#define	NSTACK	256
+#define	NPROG	2000
+
 namespace Private {
 
-#define	NSTACK	256
-static	Datum	stack[NSTACK];	/* the stack */
-static	Datum	*stackp;	/* next free spot on stack */
+typedef struct Setting {
 
-#define	NPROG	2000
-Inst	prog[NPROG];	/* the machine */
-Inst	*progp;		/* next free spot for code generation */
-Inst	*pc;		/* program counter during execution */
+    Datum	stack[NSTACK];	/* the stack */
+    Datum	*stackp;	/* next free spot on stack */
+
+    Inst	prog[NPROG];	/* the machine */
+    Inst	*progp;		/* next free spot for code generation */
+    Inst	*pc;		/* program counter during execution */
 
-void initcode()	/* initialize for code generation */
+} Setting;
+
+Datum	*stack       = NULL;	/* the stack */
+Datum	*stackp      = NULL;	/* next free spot on stack */
+
+Inst	*prog        = NULL;	/* the machine */
+Inst	*progp       = NULL;	/* next free spot for code generation */
+Inst	*pc          = NULL;	/* program counter during execution */
+
+void initcode(char *name)	/* initialize for code generation */
 {
+        printf("setting %s\n", name);
+        Setting *s = (Setting*) malloc(sizeof(Setting));
+        memset((void *) s, 0, sizeof(Setting));
+
+        prog = (Inst *) &s->prog;
+        stack = (Datum *) &s->stack;
+
 	stackp = stack;
 	progp = prog;
 }
@@ -122,7 +142,7 @@ int print()		/* pop top value from stack, print it */
 
 Inst *code(Inst f)	/* install one instruction or operand */
 {
-	Inst *oprogp = progp;
+ 	Inst *oprogp = progp;
 	if (progp >= &prog[NPROG])
 		abort();
 	*progp++ = f;
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 89b450ec1b..0ced635934 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -24,7 +24,7 @@ typedef int (*Inst)();	/* machine instruction */
 #define	STOP	(Inst) 0
 
 extern  Inst *code(Inst);
-extern	Inst prog[];
+extern	Inst *prog;
 extern	int eval();
 extern  int add();
 extern  int negate(); 
@@ -36,7 +36,7 @@ extern  int constpush();
 extern  int strpush();
 extern  int print();
 
-extern void initcode();
+extern void initcode(char *);
 extern void execute(Inst *);
 
 }
diff --git a/engines/private/grammar.l b/engines/private/grammar.l
index 93a634e16e..b0509b1f4f 100644
--- a/engines/private/grammar.l
+++ b/engines/private/grammar.l
@@ -39,7 +39,7 @@ namespace Private {
 
 int parse(char *code) {
 	
-	initcode();
+	initcode("init");
 	//_lines[0] = _lines[1] = _lines[2] = code;
 
 	YY_BUFFER_STATE bp;
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 48c64b410d..4fbacf1478 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -52,7 +52,7 @@ lines:   line lines
 
 line:     DEBUGTOK '{' debug '}'             { printf("debug\n"); }
         | DEFINETOK NAME '{' define '}'      { printf("define %s\n", $NAME); }
-        | SETTINGTOK NAME '{' statements '}' { printf("setting %s\n", $NAME); }
+        | SETTINGTOK NAME '{' statements '}' { initcode($NAME); }
         ;
 
 debug: /* nothing */


Commit: b95e920fbc866cd2b885d8d7436d3f8a4afbbd3c
    https://github.com/scummvm/scummvm/commit/b95e920fbc866cd2b885d8d7436d3f8a4afbbd3c
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: code to compare expr

Changed paths:
    engines/private/code.cpp
    engines/private/grammar.h
    engines/private/grammar.y


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 264d15b3ab..370772bdac 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -132,6 +132,66 @@ int assign()	/* assign top value to next value */
 	return 0;
 }
 
+int gt()
+{
+	Datum d1, d2;
+	d2 = pop();
+	d1 = pop();
+	d1.val = (int)(d1.val > d2.val);
+	push(d1);
+	return 0;
+}
+
+int lt()
+{
+	Datum d1, d2;
+	d2 = pop();
+	d1 = pop();
+	d1.val = (int)(d1.val < d2.val);
+	push(d1);
+	return 0;
+}
+
+int ge()
+{
+	Datum d1, d2;
+	d2 = pop();
+	d1 = pop();
+	d1.val = (int)(d1.val >= d2.val);
+	push(d1);
+	return 0;
+}
+
+int le()
+{
+	Datum d1, d2;
+	d2 = pop();
+	d1 = pop();
+	d1.val = (int)(d1.val <= d2.val);
+	push(d1);
+	return 0;
+}
+
+int eq()
+{
+	Datum d1, d2;
+	d2 = pop();
+	d1 = pop();
+	d1.val = (int)(d1.val == d2.val);
+	push(d1);
+	return 0;
+}
+
+int ne()
+{
+	Datum d1, d2;
+	d2 = pop();
+	d1 = pop();
+	d1.val = (int)(d1.val  !=  d2.val);
+	push(d1);
+	return 0;
+}
+
 int print()		/* pop top value from stack, print it */
 {
 	Datum d;
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 0ced635934..98692c3cb8 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -36,6 +36,10 @@ extern  int constpush();
 extern  int strpush();
 extern  int print();
 
+extern  int lt();
+extern  int gt();
+
+
 extern void initcode(char *);
 extern void execute(Inst *);
 
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 4fbacf1478..c443f32af3 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -101,8 +101,8 @@ expr:     value
         | value EQ value
         | value NEQ value
         | value '+' value { code1(Private::add); }
-        | value '<' value
-        | value '>' value
+        | value '<' value { code1(Private::lt); }
+        | value '>' value { code1(Private::gt); }
         | value LTE value
         | value GTE value 
         | value '+'


Commit: fcddf8aae10a2fad913fc30fc321ea20a45e177c
    https://github.com/scummvm/scummvm/commit/fcddf8aae10a2fad913fc30fc321ea20a45e177c
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: reorganized lexer and grammar code

Changed paths:
    engines/private/code.cpp
    engines/private/grammar.h
    engines/private/grammar.l
    engines/private/grammar.y
    engines/private/private.cpp
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 370772bdac..5e33996271 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -1,25 +1,12 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <cstring>
+#include "common/str.h"
 
 #include "grammar.h"
 #include "grammar.tab.h"
 
-#define	NSTACK	256
-#define	NPROG	2000
-
 namespace Private {
 
-typedef struct Setting {
-
-    Datum	stack[NSTACK];	/* the stack */
-    Datum	*stackp;	/* next free spot on stack */
-
-    Inst	prog[NPROG];	/* the machine */
-    Inst	*progp;		/* next free spot for code generation */
-    Inst	*pc;		/* program counter during execution */
-
-} Setting;
+Setting *psetting;
+SettingMap settings;
 
 Datum	*stack       = NULL;	/* the stack */
 Datum	*stackp      = NULL;	/* next free spot on stack */
@@ -28,33 +15,35 @@ Inst	*prog        = NULL;	/* the machine */
 Inst	*progp       = NULL;	/* next free spot for code generation */
 Inst	*pc          = NULL;	/* program counter during execution */
 
-void initcode(char *name)	/* initialize for code generation */
+void initsetting()	/* initialize for code generation */
 {
-        printf("setting %s\n", name);
-        Setting *s = (Setting*) malloc(sizeof(Setting));
-        memset((void *) s, 0, sizeof(Setting));
+	psetting = (Setting*) malloc(sizeof(Setting));
+        memset((void *) psetting, 0, sizeof(Setting));
 
-        prog = (Inst *) &s->prog;
-        stack = (Datum *) &s->stack;
+        prog = (Inst *) &psetting->prog;
+        stack = (Datum *) &psetting->stack;
 
 	stackp = stack;
 	progp = prog;
 }
 
+void savesetting(char *name)
+{
+        //printf("saving setting %s\n", name);
+	Common::String s(name);
+	settings.setVal(s, psetting);
+}
+
 int push(Datum d)		/* push d onto stack */
 {
-	if (stackp >= &stack[NSTACK])
-		abort();
- 	//	execerror("stack overflow", (char *) 0);
+	assert (!(stackp >= &stack[NSTACK]));
 	*stackp++ = d;
 	return 0;
 }
 
 Datum pop()	/* pop and return top elem from stack */
 {
-	if (stackp <= stack)
-	       abort();
-	//	execerror("stack underflow", (char *) 0);
+	assert (!(stackp <= stack));
 	return *--stackp;
 }
 
@@ -62,7 +51,7 @@ int constpush()	/* push constant onto stack */
 {
 	Datum d;
 	d.val = ((Symbol *)*pc++)->u.val;
-	printf("pushing %d\n", d.val);
+	//printf("pushing %d\n", d.val);
 	push(d);
 	return 0;
 }
@@ -71,7 +60,7 @@ int strpush()	/* push constant onto stack */
 {
 	Datum d;
 	d.str = ((Symbol *)*pc++)->u.str;
-	printf("pushing %s\n", d.str);
+	//printf("pushing %s\n", d.str);
 	push(d);
 	return 0;
 }
@@ -81,7 +70,7 @@ int varpush()	/* push variable onto stack */
 {
 	Datum d;
 	d.sym = (Symbol *)(*pc++);
-	printf("var pushing %s", d.sym->name);
+	//printf("var pushing %s", d.sym->name);
 	push(d);
 	return 0;
 }
@@ -103,7 +92,7 @@ int add()		/* add top two elems on stack */
 	Datum d1, d2;
 	d2 = pop();
 	d1 = pop();
-	printf("adding %d %d\n",d1.val, d2.val);
+	//printf("adding %d %d\n",d1.val, d2.val);
 	d1.val += d2.val;
 	push(d1);
 	return 0;
@@ -196,15 +185,14 @@ int print()		/* pop top value from stack, print it */
 {
 	Datum d;
 	d = pop();
-	printf("\t%d\n", d.val);
+	//printf("\t%d\n", d.val);
 	return 0;
 }
 
 Inst *code(Inst f)	/* install one instruction or operand */
 {
  	Inst *oprogp = progp;
-	if (progp >= &prog[NPROG])
-		abort();
+	assert (!(progp >= &prog[NPROG]));
 	*progp++ = f;
 	return oprogp;
 }
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 98692c3cb8..bf75c22837 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -1,3 +1,12 @@
+#include "common/str.h"
+#include "common/hash-str.h"
+
+#define	NSTACK	256
+#define	NPROG	2000
+
+#ifndef PRIVATE_GRAMMAR_H
+#define PRIVATE_GRAMMAR_H
+
 typedef struct Symbol {	/* symbol table entry */
 	char	*name;
 	short	type;	/* NAME, NUM or STRING  */
@@ -14,15 +23,33 @@ typedef union Datum {	/* interpreter stack type */
 	Symbol	*sym;
 } Datum;
 
-
 namespace Private {
 
-Symbol	*install(char *, int, int, char *), *lookup(char *);
-extern	Datum pop();
-
 typedef int (*Inst)();	/* machine instruction */
 #define	STOP	(Inst) 0
 
+typedef struct Setting {
+
+    Datum	stack[NSTACK];	/* the stack */
+    Datum	*stackp;	/* next free spot on stack */
+
+    Inst	prog[NPROG];	/* the machine */
+    Inst	*progp;		/* next free spot for code generation */
+    Inst	*pc;		/* program counter during execution */
+
+} Setting;
+
+extern Setting *psetting;
+
+typedef Common::HashMap<Common::String, Setting*> SettingMap;
+
+extern SettingMap settings;
+
+Symbol	*install(char *, int, int, char *), *lookup(char *);
+extern Symbol  *symlist;
+
+extern	Datum pop();
+
 extern  Inst *code(Inst);
 extern	Inst *prog;
 extern	int eval();
@@ -40,7 +67,11 @@ extern  int lt();
 extern  int gt();
 
 
-extern void initcode(char *);
+extern void initsetting();
+extern void savesetting(char *);
+
 extern void execute(Inst *);
 
 }
+
+#endif
diff --git a/engines/private/grammar.l b/engines/private/grammar.l
index b0509b1f4f..05ea076ad1 100644
--- a/engines/private/grammar.l
+++ b/engines/private/grammar.l
@@ -5,6 +5,8 @@
 %option outfile="engines/private/lex.yy.cpp"
 
 %{
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
 #include <stdio.h>
 #include <string.h>
 #include "grammar.h"
@@ -39,7 +41,7 @@ namespace Private {
 
 int parse(char *code) {
 	
-	initcode("init");
+	initsetting();
 	//_lines[0] = _lines[1] = _lines[2] = code;
 
 	YY_BUFFER_STATE bp;
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index c443f32af3..357accdbe9 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -3,9 +3,11 @@
 %output "engines/private/grammar.tab.cpp"
 
 %{
+
+#include "grammar.h"
+
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
 
-#include "private/grammar.h"
 #define	code1(c1)	Private::code(c1);
 #define	code2(c1,c2)	Private::code(c1); Private::code(c2)
 #define	code3(c1,c2,c3)	Private::code(c1); Private::code(c2); Private::code(c3)
@@ -18,13 +20,12 @@ int yydebug=1;
 
 using namespace Private;
 
-extern FILE *yyin;
 extern int yylex();
 extern int yyparse();
 
 void yyerror(const char *str)
 {
-	fprintf(stderr,"error: %s\n",str);
+	//fprintf(stderr,"error: %s\n",str);
 }
 
 int yywrap()
@@ -38,11 +39,13 @@ int yywrap()
 	struct Symbol	*sym;	/* symbol table pointer */
         char *s;
         int *i;
+        int narg;
 }
 
 %token<s> NAME
 %token<sym> STRING NUM
 %token LTE GTE NEQ EQ IFTOK ELSETOK GOTOTOK DEBUGTOK DEFINETOK SETTINGTOK RANDOMTOK 
+%type<narg> params
 
 %%
 
@@ -50,9 +53,9 @@ lines:   line lines
        | line
        ;
 
-line:     DEBUGTOK '{' debug '}'             { printf("debug\n"); }
-        | DEFINETOK NAME '{' define '}'      { printf("define %s\n", $NAME); }
-        | SETTINGTOK NAME '{' statements '}' { initcode($NAME); }
+line:     DEBUGTOK '{' debug '}'             { /*printf("debug\n");*/ }
+        | DEFINETOK NAME '{' define '}'      { /*printf("define %s\n", $NAME);*/ }
+        | SETTINGTOK NAME '{' statements '}' { savesetting($NAME); initsetting(); }
         ;
 
 debug: /* nothing */
@@ -74,21 +77,21 @@ statement: GOTOTOK expr ';' statements
         ;
 
 define:  /* nothing */
-        | NAME ',' fcall ',' define  { }
-        | NAME ',' fcall             { }
+        | NAME ',' fcall ',' define  { Private::install($NAME, NAME, 0, NULL);  }
+        | NAME ',' fcall             { Private::install($NAME, NAME, 0, NULL);   }
         | NAME ',' define            { Private::install($NAME, NAME, 0, NULL); }
         | NAME                       { Private::install($NAME, NAME, 0, NULL); }  
         ;
 
-fcall:    GOTOTOK '(' NAME ')'
-        | NAME '(' params ')'
+fcall:    GOTOTOK '(' params ')'
+        | NAME '(' params ')'  { /*printf("%s( .. %d)\n", $NAME, $params);*/ }
         ;
 
-params:  /* nothing */ 
-        | params ',' fcall
-        | params ',' expr
-        | expr
-        | fcall 
+params:  /* nothing */      { $$ = 0; }
+        | fcall ',' params  { $$ = $3 + 1; }
+        | expr ',' params   { $$ = $3 + 1; }
+        | expr              { $$ = 1; }
+        | fcall             { $$ = 1; }
         ;
 
 value:    NUM    { code2(Private::constpush, (Private::Inst)$NUM); }
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 72aa4f88e2..2ce2ee717c 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -64,6 +64,22 @@ Common::Error PrivateEngine::run() {
 	file->read(buf, 191000);
 	parse((char *) buf);
 
+	for (Symbol *s = symlist; s != NULL; s = s->next) {
+                if (s->type == 260) { 
+		    //debug("int");
+	            //debug("%d", s->u.val);
+		}
+
+		if (s->type == 259) { 
+		    //debug("str");
+	            //debug("%s", s->u.str);
+		}
+                if (s->type == 258) { 
+		    //debug(s->name);
+	            //debug("%d", s->u.val);
+		}
+        }
+	       
 	// Initialize graphics using following:
 	_screenW = 640;
 	_screenH = 480;
@@ -103,7 +119,7 @@ Common::Error PrivateEngine::run() {
 	// Simple main event loop
 	Common::Event evt;
         _videoDecoder = new Video::SmackerDecoder();
-  	playVideo("intro/intro.smk");
+  	//playVideo("intro/intro.smk");
 	while (!shouldQuit()) {
 		g_system->getEventManager()->pollEvent(evt);
 		g_system->delayMillis(10);
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index f540fcbc8c..6edfe27202 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -6,15 +6,15 @@
 
 namespace Private {
 
-static Symbol *symlist = 0;  /* symbol table: linked list */
+Symbol *symlist;  /* symbol table: linked list */
 
 char *emalloc(unsigned n)	/* check return from malloc */
 {
 	char *p;
 
 	p = (char*) malloc(n);
-	if (p == 0)
-		abort(); //execerror("out of memory", (char *) 0);
+	assert(p != NULL);
+	//	abort(); //execerror("out of memory", (char *) 0);
 	return p;
 }
 
@@ -41,7 +41,7 @@ Symbol *install(char *n, int t, int d, char *s)  /* install s in symbol table */
 	else if (t == STRING)
 	   sp->u.str = s;
         else
-	   abort();
+	   assert(0); //abort();
 
 	sp->next = symlist; /* put at front of list */
 	symlist = sp;


Commit: 638cf52ee678da3b579b6e6ec359728ddc258a98
    https://github.com/scummvm/scummvm/commit/638cf52ee678da3b579b6e6ec359728ddc258a98
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: handled all defines

Changed paths:
    engines/private/code.cpp
    engines/private/grammar.h
    engines/private/grammar.l
    engines/private/grammar.y
    engines/private/private.cpp
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 5e33996271..4aa4e6f2c9 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -6,7 +6,7 @@
 namespace Private {
 
 Setting *psetting;
-SettingMap settings;
+SettingMap settingcode;
 
 Datum	*stack       = NULL;	/* the stack */
 Datum	*stackp      = NULL;	/* next free spot on stack */
@@ -29,9 +29,8 @@ void initsetting()	/* initialize for code generation */
 
 void savesetting(char *name)
 {
-        //printf("saving setting %s\n", name);
 	Common::String s(name);
-	settings.setVal(s, psetting);
+	settingcode.setVal(s, psetting);
 }
 
 int push(Datum d)		/* push d onto stack */
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index bf75c22837..f8fde5275a 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -1,14 +1,16 @@
 #include "common/str.h"
 #include "common/hash-str.h"
-
-#define	NSTACK	256
-#define	NPROG	2000
+#include "common/queue.h"
+#include "common/list.h"
 
 #ifndef PRIVATE_GRAMMAR_H
 #define PRIVATE_GRAMMAR_H
 
+#define	NSTACK	256
+#define	NPROG	2000
+
 typedef struct Symbol {	/* symbol table entry */
-	char	*name;
+	Common::String *name;
 	short	type;	/* NAME, NUM or STRING  */
 	union {
 		int	val;	/* if NAME or NUM */
@@ -42,11 +44,26 @@ typedef struct Setting {
 extern Setting *psetting;
 
 typedef Common::HashMap<Common::String, Setting*> SettingMap;
+typedef Common::Queue<Common::String> StringQueue;
+
+extern StringQueue todefine;
+extern SettingMap settingcode;
+
+// Symbols
+
+typedef Common::HashMap<Common::String, Symbol*> SymbolMap;
+typedef Common::List<Symbol*> ConstantList;
+
+extern SymbolMap settings, variables, cursors, locations, rects;
+extern ConstantList constants;
 
-extern SettingMap settings;
+extern void define(char *n); 
+extern Symbol  *install(Common::String *, int, int, char *, SymbolMap*);
+extern Symbol *addconstant(int, int, char *);
+extern void     installall(char *);
+extern Symbol  *lookup(Common::String, SymbolMap);
 
-Symbol	*install(char *, int, int, char *), *lookup(char *);
-extern Symbol  *symlist;
+// Code
 
 extern	Datum pop();
 
diff --git a/engines/private/grammar.l b/engines/private/grammar.l
index 05ea076ad1..3db9485bfa 100644
--- a/engines/private/grammar.l
+++ b/engines/private/grammar.l
@@ -28,8 +28,8 @@ else                    return ELSETOK;
 goto                    return GOTOTOK;
 Random                  return RANDOMTOK;
 [A-Za-z_][A-Za-z_0-9]*  yylval.s = strdup(yytext); return NAME;
-[\-]?[0-9]+             yylval.sym = Private::install("", NUM, atoi(yytext), NULL); return NUM;
-\"[^\"\r\n]*\"          yylval.sym = Private::install("", STRING, 0, strdup(yytext)); return STRING;
+[\-]?[0-9]+             yylval.sym = Private::addconstant(NUM, atoi(yytext), NULL); return NUM;
+\"[^\"\r\n]*\"          yylval.sym = Private::addconstant(STRING, 0, strdup(yytext)); return STRING;
 [\r|\n]+                /* ignore return */;
 [ \t]+                  /* ignore whitespace */;
 .                       return *yytext;
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 357accdbe9..b88e9b10fc 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -54,7 +54,7 @@ lines:   line lines
        ;
 
 line:     DEBUGTOK '{' debug '}'             { /*printf("debug\n");*/ }
-        | DEFINETOK NAME '{' define '}'      { /*printf("define %s\n", $NAME);*/ }
+        | DEFINETOK NAME '{' define '}'      { installall($NAME); }
         | SETTINGTOK NAME '{' statements '}' { savesetting($NAME); initsetting(); }
         ;
 
@@ -77,10 +77,10 @@ statement: GOTOTOK expr ';' statements
         ;
 
 define:  /* nothing */
-        | NAME ',' fcall ',' define  { Private::install($NAME, NAME, 0, NULL);  }
-        | NAME ',' fcall             { Private::install($NAME, NAME, 0, NULL);   }
-        | NAME ',' define            { Private::install($NAME, NAME, 0, NULL); }
-        | NAME                       { Private::install($NAME, NAME, 0, NULL); }  
+        | NAME ',' fcall ',' define  { define($NAME); }
+        | NAME ',' fcall             { define($NAME); }
+        | NAME ',' define            { define($NAME); }
+        | NAME                       { define($NAME); }  
         ;
 
 fcall:    GOTOTOK '(' params ')'
@@ -96,7 +96,7 @@ params:  /* nothing */      { $$ = 0; }
 
 value:    NUM    { code2(Private::constpush, (Private::Inst)$NUM); }
         | STRING { code2(Private::strpush, (Private::Inst)$STRING); }
-        | NAME   { code3(Private::varpush, (Private::Inst)Private::lookup($1), Private::eval); }
+        | NAME   { code3(Private::varpush, (Private::Inst)Private::lookup($1, Private::variables), Private::eval); }
         ;
 
 expr:     value          
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 2ce2ee717c..f4f9139cf3 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -63,21 +63,11 @@ Common::Error PrivateEngine::run() {
 	void *buf = malloc(191000); 
 	file->read(buf, 191000);
 	parse((char *) buf);
+	assert(constants.size() > 0);
 
-	for (Symbol *s = symlist; s != NULL; s = s->next) {
-                if (s->type == 260) { 
-		    //debug("int");
-	            //debug("%d", s->u.val);
-		}
-
-		if (s->type == 259) { 
-		    //debug("str");
-	            //debug("%s", s->u.str);
-		}
-                if (s->type == 258) { 
-		    //debug(s->name);
-	            //debug("%d", s->u.val);
-		}
+	for (SymbolMap::const_iterator it = settings.begin(); it != settings.end(); ++it) {
+		Symbol *s = it->_value;
+		debug(s->name->c_str());
         }
 	       
 	// Initialize graphics using following:
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 6edfe27202..663b801b46 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -1,12 +1,18 @@
-#include <stdlib.h>
-#include <string.h>
+#include "common/debug.h"
 
 #include "grammar.h"
 #include "grammar.tab.h"
 
 namespace Private {
 
-Symbol *symlist;  /* symbol table: linked list */
+SymbolMap settings, variables, cursors, locations, rects;
+ConstantList constants;
+StringQueue todefine;
+
+void define(char *n) {
+        Common::String *s = new Common::String(n);
+        todefine.push(*s);
+}
 
 char *emalloc(unsigned n)	/* check return from malloc */
 {
@@ -14,37 +20,89 @@ char *emalloc(unsigned n)	/* check return from malloc */
 
 	p = (char*) malloc(n);
 	assert(p != NULL);
-	//	abort(); //execerror("out of memory", (char *) 0);
 	return p;
 }
 
-Symbol *lookup(char *s)	/* find s in symbol table */
+Symbol *lookup(Common::String s, SymbolMap symlist)	/* find s in symbol table symlist */
+{
+	Symbol *sp = NULL;
+ 
+	if (symlist.tryGetVal(s,sp))
+	    return sp;
+	else
+	    return 0;
+
+}
+
+void installall(char *n) {
+        Common::String *s;
+	assert(todefine.size() > 0);
+	while (!todefine.empty()) {
+	       s = new Common::String(todefine.pop());
+
+ 	       //debug("name %s", s->c_str());
+	       if (strcmp(n, "settings") == 0) {
+	           install(s, NAME, 0, NULL, &settings);
+               }
+
+	       else if (strcmp(n, "variables") == 0) {
+	           install(s, NAME, 0, NULL, &variables);
+               }
+
+	       else if (strcmp(n, "cursors") == 0) {
+	           install(s, NAME, 0, NULL, &cursors);
+               }
+
+	       else if (strcmp(n, "locations") == 0) {
+	           install(s, NAME, 0, NULL, &variables);
+               }
+
+	       else if (strcmp(n, "rects") == 0) {
+	           install(s, NAME, 0, NULL, &rects);
+               }
+
+	}	   
+
+}
+
+Symbol *addconstant(int t, int d, char *s) 
 {
 	Symbol *sp;
+        Common::String *n = new Common::String("");
+
+	sp = (Symbol *) emalloc(sizeof(Symbol));
+	sp->name = n; 
+	sp->type = t;
+	if (t == NUM || t == NAME)
+	   sp->u.val = d;
+	else if (t == STRING)
+	   sp->u.str = s;
+        else
+	   assert(0);
 
-	for (sp = symlist; sp != (Symbol *) 0; sp = sp->next)
-		if (strcmp(sp->name, s) == 0)
-			return sp;
-	return 0;	/* 0 ==> not found */	
+	constants.push_front(sp);
+	return sp;
 }
 
-Symbol *install(char *n, int t, int d, char *s)  /* install s in symbol table */
+
+Symbol *install(Common::String *n, int t, int d, char *s, SymbolMap *symlist)  /* install s in symbol table */
 {
+        //Common::String *str = new Common::String(n);
+ 
 	Symbol *sp;
 
 	sp = (Symbol *) emalloc(sizeof(Symbol));
-	sp->name = emalloc(strlen(n)+1); /* +1 for '\0' */
-	strcpy(sp->name, n);
+        sp->name = n; //str;
 	sp->type = t;
 	if (t == NUM || t == NAME)
 	   sp->u.val = d;
 	else if (t == STRING)
 	   sp->u.str = s;
         else
-	   assert(0); //abort();
+	   assert(0);
 
-	sp->next = symlist; /* put at front of list */
-	symlist = sp;
+        symlist->setVal(*n, sp);
+	assert(symlist->size() > 0);
 	return sp;
 }
 


Commit: 2ce4159f1680468f29e51a57510b69bde2ede741
    https://github.com/scummvm/scummvm/commit/2ce4159f1680468f29e51a57510b69bde2ede741
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: more code

Changed paths:
  A engines/private/funcs.cpp
    engines/private/code.cpp
    engines/private/grammar.h
    engines/private/grammar.l
    engines/private/grammar.y
    engines/private/module.mk
    engines/private/private.cpp
    engines/private/private.h
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 4aa4e6f2c9..a429ba3ac5 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -1,4 +1,5 @@
 #include "common/str.h"
+#include "common/debug.h"
 
 #include "grammar.h"
 #include "grammar.tab.h"
@@ -15,7 +16,7 @@ Inst	*prog        = NULL;	/* the machine */
 Inst	*progp       = NULL;	/* next free spot for code generation */
 Inst	*pc          = NULL;	/* program counter during execution */
 
-void initsetting()	/* initialize for code generation */
+void initSetting()	/* initialize for code generation */
 {
 	psetting = (Setting*) malloc(sizeof(Setting));
         memset((void *) psetting, 0, sizeof(Setting));
@@ -27,12 +28,29 @@ void initsetting()	/* initialize for code generation */
 	progp = prog;
 }
 
-void savesetting(char *name)
+void saveSetting(char *name)
 {
 	Common::String s(name);
 	settingcode.setVal(s, psetting);
+        debug("setting %s %x, %x, %x", name, psetting, psetting->prog, psetting->stack);
+
+}
+
+void loadSetting(Common::String *name) 
+{
+        assert(settingcode.contains(*name));
+	psetting = settingcode.getVal(*name);
+
+	debug("loading setting %s %x, %x, %x", name->c_str(), psetting, psetting->prog, psetting->stack);
+
+        prog = (Inst *) &psetting->prog;
+        stack = (Datum *) &psetting->stack;
+
+	stackp = stack;
+	progp = prog;
 }
 
+
 int push(Datum d)		/* push d onto stack */
 {
 	assert (!(stackp >= &stack[NSTACK]));
@@ -49,8 +67,10 @@ Datum pop()	/* pop and return top elem from stack */
 int constpush()	/* push constant onto stack */
 {
 	Datum d;
-	d.val = ((Symbol *)*pc++)->u.val;
-	//printf("pushing %d\n", d.val);
+	Symbol *s = (Symbol *)*pc++; 
+	d.val = s->u.val;
+	
+	debug("pushing const %d with name %s\n", d.val, s->name->c_str());
 	push(d);
 	return 0;
 }
@@ -69,19 +89,56 @@ int varpush()	/* push variable onto stack */
 {
 	Datum d;
 	d.sym = (Symbol *)(*pc++);
-	//printf("var pushing %s", d.sym->name);
+	debug("var pushing %s", d.sym->name->c_str());
 	push(d);
 	return 0;
 }
 
+int funcpush() //(char *name, int nargs)	
+{
+	Datum s, n, arg;
+	s = pop();
+	n = pop();
+        ArgArray args;
+
+	debug("executing %s with %d params", s.str, n.val);
+	for (int i = 0; i < n.val; i++) {
+		arg = pop();
+		//if (arg.sym != NULL)
+		//	debug("arg name", arg->sym->name.c_str());
+	        debug("%d", arg.val);
+		args.insert(args.begin(), arg) ;
+        }
+
+        execFunction(s.str, args);
+	pc++;
+        //d.sym = (Symbol *)(*pc++);
+	//printf("var pushing %s", d.sym->name);
+	//push(d);
+	return 0;
+}
+
+
 
 int eval()		/* evaluate variable on stack */
 {
 	Datum d;
 	d = pop();
+	debug("eval %s", d.sym->name->c_str());
 	//if (d.sym->type == UNDEF)
 	//	execerror("undefined variable", d.sym->name);
-	d.val = d.sym->u.val;
+	if (d.sym->type == NUM)
+	    d.val = d.sym->u.val;
+	else if (d.sym->type == STRING)
+	    d.str = d.sym->u.str;
+	else if (d.sym->type == NAME) {
+            debug("NAME");
+	    d.sym = d.sym;
+	}
+	else
+	    assert(0);
+	
+ 
 	push(d);
 	return 0;
 }
@@ -198,8 +255,9 @@ Inst *code(Inst f)	/* install one instruction or operand */
 
 void execute(Inst *p)	/* run the machine */
 {
-	for (pc = p; *pc != STOP; )
+	for (pc = p; *pc != STOP; ) {
 		(*(*pc++))();
+	}
 }
 
 }
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
new file mode 100644
index 0000000000..f44e5ddf0e
--- /dev/null
+++ b/engines/private/funcs.cpp
@@ -0,0 +1,29 @@
+#include "common/str.h"
+#include "common/debug.h"
+
+#include "grammar.h"
+#include "private.h"
+
+namespace Private {
+
+void execFunction(char *name, ArgArray args) {
+    if (strcmp(name, "ChgMode") == 0) {
+	debug("ChgMode(%d, %s)", args[0].val, args[1].str);  
+	_mode = args[0].val;
+        Common::String *s = new Common::String(args[1].str);
+        _nextSetting = s;
+    }
+    else if (strcmp(name, "SetFlag") == 0) {
+	debug("SetFlag(%s, %d)", args[0].sym->name->c_str(), args[1].val);
+        args[0].sym->u.val = args[1].val;
+	//_mode = args[0].val;
+        //Common::String *s = new Common::String(args[1].str);
+        //_nextSetting = s;
+    }
+
+    else 
+        assert(0);
+
+}
+
+}
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index f8fde5275a..915a722df5 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -2,6 +2,7 @@
 #include "common/hash-str.h"
 #include "common/queue.h"
 #include "common/list.h"
+#include "common/array.h"
 
 #ifndef PRIVATE_GRAMMAR_H
 #define PRIVATE_GRAMMAR_H
@@ -16,7 +17,6 @@ typedef struct Symbol {	/* symbol table entry */
 		int	val;	/* if NAME or NUM */
 		char	*str;	/* if STRING */
 	} u;
-	struct Symbol	*next;	/* to link to another */
 } Symbol;
 
 typedef union Datum {	/* interpreter stack type */
@@ -41,6 +41,8 @@ typedef struct Setting {
 
 } Setting;
 
+// Settings
+
 extern Setting *psetting;
 
 typedef Common::HashMap<Common::String, Setting*> SettingMap;
@@ -59,13 +61,21 @@ extern ConstantList constants;
 
 extern void define(char *n); 
 extern Symbol  *install(Common::String *, int, int, char *, SymbolMap*);
+extern Symbol  *lookupName(char *);
 extern Symbol *addconstant(int, int, char *);
 extern void     installall(char *);
 extern Symbol  *lookup(Common::String, SymbolMap);
 
-// Code
+// Funtions
+
+typedef Common::Array<Datum> ArgArray;
+extern void execFunction(char *, ArgArray);
+
+// Code Generation
 
 extern	Datum pop();
+extern  int pushString(char *);
+extern  int pushInt(int);
 
 extern  Inst *code(Inst);
 extern	Inst *prog;
@@ -78,14 +88,17 @@ extern  int bltin();
 extern  int varpush(); 
 extern  int constpush();
 extern  int strpush();
+extern  int funcpush();
 extern  int print();
 
 extern  int lt();
 extern  int gt();
 
+// Code Execution
 
-extern void initsetting();
-extern void savesetting(char *);
+extern void initSetting();
+extern void saveSetting(char *);
+extern void loadSetting(Common::String *);
 
 extern void execute(Inst *);
 
diff --git a/engines/private/grammar.l b/engines/private/grammar.l
index 3db9485bfa..2b6375dc79 100644
--- a/engines/private/grammar.l
+++ b/engines/private/grammar.l
@@ -26,6 +26,9 @@ setting                 return SETTINGTOK;
 if                      return IFTOK;
 else                    return ELSETOK;
 goto                    return GOTOTOK;
+RECT                    return RECTTOK;
+FALSE                   return FALSETOK;
+TRUE                    return TRUETOK;
 Random                  return RANDOMTOK;
 [A-Za-z_][A-Za-z_0-9]*  yylval.s = strdup(yytext); return NAME;
 [\-]?[0-9]+             yylval.sym = Private::addconstant(NUM, atoi(yytext), NULL); return NUM;
@@ -41,7 +44,7 @@ namespace Private {
 
 int parse(char *code) {
 	
-	initsetting();
+	initSetting();
 	//_lines[0] = _lines[1] = _lines[2] = code;
 
 	YY_BUFFER_STATE bp;
@@ -56,7 +59,7 @@ int parse(char *code) {
 	bp = yy_scan_string(code);
 	yy_switch_to_buffer(bp);
 	yyparse();
-        execute(prog);
+        //execute(prog);
 	yy_delete_buffer(bp);
 
 	return 0;
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index b88e9b10fc..ae709f8d5d 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -37,6 +37,7 @@ int yywrap()
 
 %union {
 	struct Symbol	*sym;	/* symbol table pointer */
+        int (*inst)();	/* machine instruction */
         char *s;
         int *i;
         int narg;
@@ -44,7 +45,7 @@ int yywrap()
 
 %token<s> NAME
 %token<sym> STRING NUM
-%token LTE GTE NEQ EQ IFTOK ELSETOK GOTOTOK DEBUGTOK DEFINETOK SETTINGTOK RANDOMTOK 
+%token LTE GTE NEQ EQ FALSETOK TRUETOK IFTOK ELSETOK RECTTOK GOTOTOK DEBUGTOK DEFINETOK SETTINGTOK RANDOMTOK 
 %type<narg> params
 
 %%
@@ -53,9 +54,9 @@ lines:   line lines
        | line
        ;
 
-line:     DEBUGTOK '{' debug '}'             { /*printf("debug\n");*/ }
+line:     DEBUGTOK '{' debug '}'             { /* Not used in the game */ }
         | DEFINETOK NAME '{' define '}'      { installall($NAME); }
-        | SETTINGTOK NAME '{' statements '}' { savesetting($NAME); initsetting(); }
+        | SETTINGTOK NAME '{' statements '}' { saveSetting($NAME); initSetting(); }
         ;
 
 debug: /* nothing */
@@ -83,8 +84,19 @@ define:  /* nothing */
         | NAME                       { define($NAME); }  
         ;
 
-fcall:    GOTOTOK '(' params ')'
-        | NAME '(' params ')'  { /*printf("%s( .. %d)\n", $NAME, $params);*/ }
+fcall:    GOTOTOK '(' NAME ')' {
+                               code2(Private::strpush, (Private::Inst) Private::addconstant(STRING, 0, $NAME));
+                               code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
+                               code2(Private::strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto")); 
+                               code1(Private::funcpush); 
+                               }
+
+        | RECTTOK '(' NUM ',' NUM ',' NUM ',' NUM ')'
+        | NAME '(' params ')'  {
+                               code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, $params, NULL));
+                               code2(Private::strpush, (Private::Inst) Private::addconstant(STRING, 0, $NAME)); 
+                               code1(Private::funcpush); 
+                               }
         ;
 
 params:  /* nothing */      { $$ = 0; }
@@ -94,9 +106,11 @@ params:  /* nothing */      { $$ = 0; }
         | fcall             { $$ = 1; }
         ;
 
-value:    NUM    { code2(Private::constpush, (Private::Inst)$NUM); }
-        | STRING { code2(Private::strpush, (Private::Inst)$STRING); }
-        | NAME   { code3(Private::varpush, (Private::Inst)Private::lookup($1, Private::variables), Private::eval); }
+value:    FALSETOK { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL)); }
+        | TRUETOK  { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL)); }
+        |  NUM     { code2(Private::constpush, (Private::Inst)$NUM); }
+        | STRING   { code2(Private::strpush, (Private::Inst)$STRING); }
+        | NAME     { code1(Private::varpush); code1((Private::Inst) lookupName($NAME)); code1(Private::eval); }
         ;
 
 expr:     value          
diff --git a/engines/private/module.mk b/engines/private/module.mk
index 0e2b965b19..4259259beb 100644
--- a/engines/private/module.mk
+++ b/engines/private/module.mk
@@ -4,6 +4,7 @@ MODULE_OBJS := \
 	metaengine.o \
         code.o \
 	symbol.o \
+	funcs.o \
         grammar.tab.o \
 	lex.yy.o \
 	private.o
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index f4f9139cf3..bca3665b44 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -22,6 +22,9 @@ extern int yyparse();
 
 namespace Private {
 
+Common::String *_nextSetting = NULL;
+int _mode = -1;
+
 extern int parse(char*);
 
 PrivateEngine::PrivateEngine(OSystem *syst)
@@ -67,7 +70,7 @@ Common::Error PrivateEngine::run() {
 
 	for (SymbolMap::const_iterator it = settings.begin(); it != settings.end(); ++it) {
 		Symbol *s = it->_value;
-		debug(s->name->c_str());
+		//debug(s->name->c_str());
         }
 	       
 	// Initialize graphics using following:
@@ -109,6 +112,9 @@ Common::Error PrivateEngine::run() {
 	// Simple main event loop
 	Common::Event evt;
         _videoDecoder = new Video::SmackerDecoder();
+
+	_nextSetting = new Common::String("kGoIntro");
+
   	//playVideo("intro/intro.smk");
 	while (!shouldQuit()) {
 		g_system->getEventManager()->pollEvent(evt);
@@ -124,6 +130,14 @@ Common::Error PrivateEngine::run() {
 			}
 		}
 
+		if (_nextSetting != NULL) {
+			debug("Executing %s", _nextSetting->c_str());
+                        loadSetting(_nextSetting);
+			_nextSetting = NULL;
+			execute(prog);
+		}
+
+
 	}
 
 	return Common::kNoError;
diff --git a/engines/private/private.h b/engines/private/private.h
index 915cb2c106..c0ce589b5f 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -24,6 +24,10 @@ enum {
 	// the current limitation is 32 debug channels (1 << 31 is the last one)
 };
 
+// global state
+extern Common::String *_nextSetting;
+extern int _mode;
+
 class PrivateEngine : public Engine {
 private:
 	// We need random numbers
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 663b801b46..c2e2613768 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -25,15 +25,40 @@ char *emalloc(unsigned n)	/* check return from malloc */
 
 Symbol *lookup(Common::String s, SymbolMap symlist)	/* find s in symbol table symlist */
 {
-	Symbol *sp = NULL;
+        debug("looking up %s", s.c_str());	
+	return symlist.getVal(s);
+}
+
+Symbol *lookupName(char *n)  /* install s in some symbol table */
+{
+	//debug("looking up %s", n);
+        Common::String *s = new Common::String(n);
  
-	if (symlist.tryGetVal(s,sp))
-	    return sp;
-	else
-	    return 0;
+        if (settings.contains(*s))
+	    return lookup(*s, settings);
+
+	else if (variables.contains(*s))
+	    return lookup(*s, variables);
+
+	else if (cursors.contains(*s))
+	    return lookup(*s, cursors);
+
+	else if (locations.contains(*s))
+	    return lookup(*s, locations);
+
+	else if (rects.contains(*s))
+	    return lookup(*s, rects);
+
+	else {
+	    debug("WARNING: %s not defined", n);
+	    return addconstant(NAME, 0, n);
+	}
 
 }
 
+
+
+
 void installall(char *n) {
         Common::String *s;
 	assert(todefine.size() > 0);
@@ -42,7 +67,7 @@ void installall(char *n) {
 
  	       //debug("name %s", s->c_str());
 	       if (strcmp(n, "settings") == 0) {
-	           install(s, NAME, 0, NULL, &settings);
+	           install(s, STRING, 0, (char*) s->c_str(), &settings);
                }
 
 	       else if (strcmp(n, "variables") == 0) {
@@ -54,12 +79,14 @@ void installall(char *n) {
                }
 
 	       else if (strcmp(n, "locations") == 0) {
-	           install(s, NAME, 0, NULL, &variables);
+	           install(s, NAME, 0, NULL, &locations);
                }
 
 	       else if (strcmp(n, "rects") == 0) {
 	           install(s, NAME, 0, NULL, &rects);
                }
+	       else
+		   assert(0);
 
 	}	   
 
@@ -68,7 +95,7 @@ void installall(char *n) {
 Symbol *addconstant(int t, int d, char *s) 
 {
 	Symbol *sp;
-        Common::String *n = new Common::String("");
+        Common::String *n = new Common::String("<constant>");
 
 	sp = (Symbol *) emalloc(sizeof(Symbol));
 	sp->name = n; 
@@ -87,12 +114,12 @@ Symbol *addconstant(int t, int d, char *s)
 
 Symbol *install(Common::String *n, int t, int d, char *s, SymbolMap *symlist)  /* install s in symbol table */
 {
-        //Common::String *str = new Common::String(n);
+        Common::String *name = new Common::String(*n);
  
 	Symbol *sp;
 
 	sp = (Symbol *) emalloc(sizeof(Symbol));
-        sp->name = n; //str;
+        sp->name = name;
 	sp->type = t;
 	if (t == NUM || t == NAME)
 	   sp->u.val = d;


Commit: cae1b214a8fd24d637eab63fa70cc1267718e65c
    https://github.com/scummvm/scummvm/commit/cae1b214a8fd24d637eab63fa70cc1267718e65c
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixes + more functiions

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index a429ba3ac5..29a695cc18 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -70,7 +70,7 @@ int constpush()	/* push constant onto stack */
 	Symbol *s = (Symbol *)*pc++; 
 	d.val = s->u.val;
 	
-	debug("pushing const %d with name %s\n", d.val, s->name->c_str());
+	debug("pushing const %d with name %s", d.val, s->name->c_str());
 	push(d);
 	return 0;
 }
@@ -111,7 +111,7 @@ int funcpush() //(char *name, int nargs)
         }
 
         execFunction(s.str, args);
-	pc++;
+	//pc++;
         //d.sym = (Symbol *)(*pc++);
 	//printf("var pushing %s", d.sym->name);
 	//push(d);
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index f44e5ddf0e..a527389f94 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -6,19 +6,49 @@
 
 namespace Private {
 
+void ChgMode(ArgArray args) {
+    debug("ChgMode(%d, %s)", args[0].val, args[1].str);  
+    _mode = args[0].val;
+    Common::String *s = new Common::String(args[1].str);
+    _nextSetting = s;
+}
+
+void Goto(ArgArray args) { // should be goto, but this is a reserved word
+    debug("goto(%s)", args[0].str);  
+    Common::String *s = new Common::String(args[0].str);
+    _nextSetting = s;
+}
+
+void SetFlag(ArgArray args) {
+    debug("SetFlag(%s, %d)", args[0].sym->name->c_str(), args[1].val);
+    args[0].sym->u.val = args[1].val;
+}
+
+void Sound(ArgArray args) {
+    debug("Sound(%s)", args[0].str);
+    if (strcmp("\"\"", args[0].str) != 0) {
+            Common::String *s = new Common::String(args[0].str);
+	    _private->playSound(*s);
+	    //assert(0);
+    } else {
+	    _private->stopSound();
+    }
+}
+
+
 void execFunction(char *name, ArgArray args) {
     if (strcmp(name, "ChgMode") == 0) {
-	debug("ChgMode(%d, %s)", args[0].val, args[1].str);  
-	_mode = args[0].val;
-        Common::String *s = new Common::String(args[1].str);
-        _nextSetting = s;
+	ChgMode(args);
     }
+    else if (strcmp(name, "goto") == 0) {
+	Goto(args);
+    }
+
     else if (strcmp(name, "SetFlag") == 0) {
-	debug("SetFlag(%s, %d)", args[0].sym->name->c_str(), args[1].val);
-        args[0].sym->u.val = args[1].val;
-	//_mode = args[0].val;
-        //Common::String *s = new Common::String(args[1].str);
-        //_nextSetting = s;
+	SetFlag(args);
+    }
+    else if (strcmp(name, "Sound") == 0) {
+	Sound(args);
     }
 
     else 
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index bca3665b44..0efdf36bcd 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -24,9 +24,18 @@ namespace Private {
 
 Common::String *_nextSetting = NULL;
 int _mode = -1;
+PrivateEngine *_private = NULL;
 
 extern int parse(char*);
 
+Common::String &lowercase(Common::String &val) {
+	Common::String::iterator i;
+	for (i = val.begin(); i != val.end(); i++)
+		*i = tolower(*i);
+	return val;
+}
+
+
 PrivateEngine::PrivateEngine(OSystem *syst)
 	: Engine(syst) {
 	// Put your engine in a sane state, but do nothing big yet;
@@ -48,6 +57,7 @@ PrivateEngine::PrivateEngine(OSystem *syst)
 	_rnd = new Common::RandomSource("private");
 
 	debug("PrivateEngine::PrivateEngine");
+	_private = this;
 }
 
 PrivateEngine::~PrivateEngine() {
@@ -170,9 +180,23 @@ void PrivateEngine::syncGameStream(Common::Serializer &s) {
 
 void PrivateEngine::playSound(const Common::String &name) {
 	debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
+
+	Common::String path(name);
+        Common::String s1("\\");
+        Common::String s2("/");
+
+        Common::replace(path, s1, s2);
+        s1 = Common::String("\"");
+        s2 = Common::String("");
+
+        Common::replace(path, s1, s2);
+        Common::replace(path, s1, s2);
+	
+	lowercase(path);
+
 	Common::File *file = new Common::File();
-	if (!file->open(name))
-		error("unable to find sound file %s", name.c_str());
+	if (!file->open(path))
+		error("unable to find sound file %s", path.c_str());
 
 	Audio::AudioStream *stream;
 	stream = Audio::makeWAVStream(file, DisposeAfterUse::YES);
diff --git a/engines/private/private.h b/engines/private/private.h
index c0ce589b5f..2288af272b 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -58,6 +58,8 @@ public:
 
 };
 
+extern PrivateEngine *_private;
+
 // Example console class
 class Console : public GUI::Debugger {
 public:
@@ -67,6 +69,6 @@ public:
 	}
 };
 
-} // End of namespace Quux
+} // End of namespace Private
 
 #endif


Commit: ccef0fb704c12c2de42ace3af7a337dbcd9503a4
    https://github.com/scummvm/scummvm/commit/ccef0fb704c12c2de42ace3af7a337dbcd9503a4
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: some more functions implemented

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 29a695cc18..e7b6f259c4 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -33,7 +33,6 @@ void saveSetting(char *name)
 	Common::String s(name);
 	settingcode.setVal(s, psetting);
         debug("setting %s %x, %x, %x", name, psetting, psetting->prog, psetting->stack);
-
 }
 
 void loadSetting(Common::String *name) 
@@ -104,17 +103,11 @@ int funcpush() //(char *name, int nargs)
 	debug("executing %s with %d params", s.str, n.val);
 	for (int i = 0; i < n.val; i++) {
 		arg = pop();
-		//if (arg.sym != NULL)
-		//	debug("arg name", arg->sym->name.c_str());
-	        debug("%d", arg.val);
+	        //debug("%d", arg.val);
 		args.insert(args.begin(), arg) ;
         }
 
         execFunction(s.str, args);
-	//pc++;
-        //d.sym = (Symbol *)(*pc++);
-	//printf("var pushing %s", d.sym->name);
-	//push(d);
 	return 0;
 }
 
@@ -237,14 +230,6 @@ int ne()
 	return 0;
 }
 
-int print()		/* pop top value from stack, print it */
-{
-	Datum d;
-	d = pop();
-	//printf("\t%d\n", d.val);
-	return 0;
-}
-
 Inst *code(Inst f)	/* install one instruction or operand */
 {
  	Inst *oprogp = progp;
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index a527389f94..696185e785 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -1,5 +1,6 @@
 #include "common/str.h"
 #include "common/debug.h"
+#include "common/system.h"
 
 #include "grammar.h"
 #include "private.h"
@@ -35,6 +36,30 @@ void Sound(ArgArray args) {
     }
 }
 
+void Bitmap(ArgArray args) {
+    assert(args.size() == 1 || args.size() == 3);
+
+    int x = 0;
+    int y = 0;
+
+    char *f = args[0].str;
+    if (args.size() == 3) {
+	x = args[1].val;
+	y = args[2].val;
+    }
+
+    debug("Bitmap(%s, %d, %d)", f, x, y);
+    Common::String *s = new Common::String(args[0].str);
+    _private->loadImage(*s, x, y);
+}
+
+void Timer(ArgArray args) {
+    debug("Timer(%d, %s, %s)", args[0].val, args[1].str, args[2].str);
+    g_system->delayMillis(1000 * args[0].val);
+    Common::String *s = new Common::String(args[1].str);
+    _nextSetting = s; 
+}
+
 
 void execFunction(char *name, ArgArray args) {
     if (strcmp(name, "ChgMode") == 0) {
@@ -50,7 +75,15 @@ void execFunction(char *name, ArgArray args) {
     else if (strcmp(name, "Sound") == 0) {
 	Sound(args);
     }
-
+    else if (strcmp(name, "Bitmap") == 0) {
+	Bitmap(args);
+    }
+    else if (strcmp(name, "Timer") == 0) {
+        Timer(args);	    
+    }
+    else if (strcmp(name, "Exit") == 0) {
+       ;	    
+    }
     else 
         assert(0);
 
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 0efdf36bcd..e92aaff843 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -11,9 +11,12 @@
 #include "common/file.h"
 #include "common/fs.h"
 #include "common/system.h"
+#include "common/str.h"
 
 #include "engines/util.h"
 
+#include "image/bmp.h"
+
 #include "private/private.h"
 #include "private/grammar.tab.h"
 #include "private/grammar.h"
@@ -28,13 +31,21 @@ PrivateEngine *_private = NULL;
 
 extern int parse(char*);
 
-Common::String &lowercase(Common::String &val) {
-	Common::String::iterator i;
-	for (i = val.begin(); i != val.end(); i++)
-		*i = tolower(*i);
-	return val;
-}
+Common::String convertPath(Common::String name) {
+	Common::String path(name);
+        Common::String s1("\\");
+        Common::String s2("/");
+
+        Common::replace(path, s1, s2);
+        s1 = Common::String("\"");
+        s2 = Common::String("");
 
+        Common::replace(path, s1, s2);
+        Common::replace(path, s1, s2);
+	
+	path.toLowercase();
+	return path;
+}
 
 PrivateEngine::PrivateEngine(OSystem *syst)
 	: Engine(syst) {
@@ -87,6 +98,8 @@ Common::Error PrivateEngine::run() {
 	_screenW = 640;
 	_screenH = 480;
 	initGraphics(_screenW, _screenH);
+        _image = new Image::BitmapDecoder();
+	_compositeSurface = nullptr;
 
 	// You could use backend transactions directly as an alternative,
 	// but it isn't recommended, until you want to handle the error values
@@ -121,7 +134,7 @@ Common::Error PrivateEngine::run() {
 
 	// Simple main event loop
 	Common::Event evt;
-        _videoDecoder = new Video::SmackerDecoder();
+        _videoDecoder = nullptr; //new Video::SmackerDecoder();
 
 	_nextSetting = new Common::String("kGoIntro");
 
@@ -140,6 +153,9 @@ Common::Error PrivateEngine::run() {
 			}
 		}
 
+		if (_compositeSurface)
+			drawScreen();
+
 		if (_nextSetting != NULL) {
 			debug("Executing %s", _nextSetting->c_str());
                         loadSetting(_nextSetting);
@@ -181,20 +197,9 @@ void PrivateEngine::syncGameStream(Common::Serializer &s) {
 void PrivateEngine::playSound(const Common::String &name) {
 	debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
 
-	Common::String path(name);
-        Common::String s1("\\");
-        Common::String s2("/");
-
-        Common::replace(path, s1, s2);
-        s1 = Common::String("\"");
-        s2 = Common::String("");
-
-        Common::replace(path, s1, s2);
-        Common::replace(path, s1, s2);
-	
-	lowercase(path);
-
 	Common::File *file = new Common::File();
+        Common::String path = convertPath(name);
+
 	if (!file->open(path))
 		error("unable to find sound file %s", path.c_str());
 
@@ -222,25 +227,58 @@ void PrivateEngine::stopSound() {
 		_mixer->stopHandle(_soundHandle);
 }
 
+void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
+	debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
+	Common::File file;
+	Common::String path = convertPath(name);
+	if (!file.open(path))
+		error("unable to load image %s", path.c_str());
+
+	_image->loadStream(file);
+        Graphics::Surface *surf; 
+	if (!_compositeSurface)
+	    _compositeSurface = new Graphics::Surface();
+  	    _compositeSurface->create(_screenW, _screenH, _image->getSurface()->format );
+
+        _compositeSurface->copyRectToSurface(*_image->getSurface(), x, y,
+					Common::Rect(0, 0, _image->getSurface()->w, _image->getSurface()->h));
+
+	//delete _compositeSurface;
+	/*if (_compositeSurface) {
+		delete _compositeSurface;
+		_compositeSurface = nullptr;
+	}*/
+	drawScreen();
+}
+
+
 void PrivateEngine::drawScreen() {
-	if (_videoDecoder && _videoDecoder->needsUpdate()) {
+	if (_videoDecoder ? _videoDecoder->needsUpdate() : false || _compositeSurface) {
 		Graphics::Surface *screen = g_system->lockScreen();
-		screen->fillRect(Common::Rect(0, 0, g_system->getWidth(), g_system->getHeight()), 0);
+		//screen->fillRect(Common::Rect(0, 0, g_system->getWidth(), g_system->getHeight()), 0);
 
 		const Graphics::Surface *surface;
-		surface = _videoDecoder->decodeNextFrame();
+                /*if (_videoDecoder)
+			surface = _videoDecoder->decodeNextFrame();
+		else*/ if (_compositeSurface)
+			surface = _compositeSurface;
+		else
+			assert(0);
+		//	surface = _image->getSurface();
 
 		int w = surface->w; //CLIP<int>(surface->w, 0, _screenW);
 		int h = surface->h; //CLIP<int>(surface->h, 0, _screenH);
 
 		//int x = (_screenW - w) / 2;
 		//int y = (_screenH - h) / 2;
-     	        //debug("%d %d %d %d", w, h, x, y);
+     	        //debug("%d %d", w, h);
 
 		screen->copyRectToSurface(*surface, 0, 0, Common::Rect(0, 0, w, h));
 
 		g_system->unlockScreen();
- 	        g_system->getPaletteManager()->setPalette(_videoDecoder->getPalette(), 0, 256);	
+		if (_image->getPalette() != nullptr)
+			g_system->getPaletteManager()->setPalette(_image->getPalette(), 0, 256);
+	        //g_system->getPaletteManager()->setPalette(_videoDecoder->getPalette(), 0, 256);	
 		g_system->updateScreen();
 	}
 }
diff --git a/engines/private/private.h b/engines/private/private.h
index 2288af272b..16f1593a36 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -12,6 +12,14 @@
 #include "video/smk_decoder.h"
 #include "graphics/palette.h"
 
+namespace Image {
+class ImageDecoder;
+}
+
+namespace Graphics {
+struct Surface;
+}
+
 namespace Private {
 
 class Console;
@@ -32,6 +40,9 @@ class PrivateEngine : public Engine {
 private:
 	// We need random numbers
 	Common::RandomSource *_rnd;
+	Image::ImageDecoder *_image;
+	Graphics::Surface *_compositeSurface;
+
 	int _screenW, _screenH;
 
 public:
@@ -51,9 +62,10 @@ public:
 	void syncGameStream(Common::Serializer &s);
 
 	void playSound(const Common::String &name);
-	void playVideo(const Common::String &name);
-	
+	void playVideo(const Common::String &name);	
 	void stopSound();
+
+	void loadImage(const Common::String &name, int x, int y);	
 	void drawScreen();
 
 };


Commit: baf7a442fc29f6e9851c3ccc9e1cd0449b3680bf
    https://github.com/scummvm/scummvm/commit/baf7a442fc29f6e9851c3ccc9e1cd0449b3680bf
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixed pallete colors with a hack

Changed paths:
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index e92aaff843..5ab6b8e5b7 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -97,9 +97,13 @@ Common::Error PrivateEngine::run() {
 	// Initialize graphics using following:
 	_screenW = 640;
 	_screenH = 480;
-	initGraphics(_screenW, _screenH);
+	//_pixelFormat = Graphics::PixelFormat::createFormatCLUT8();
+	_pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
+	initGraphics(_screenW, _screenH, &_pixelFormat);
         _image = new Image::BitmapDecoder();
-	_compositeSurface = nullptr;
+	_compositeSurface = new Graphics::ManagedSurface();
+  	_compositeSurface->create(_screenW, _screenH, _pixelFormat);
+	_compositeSurface->setTransparentColor(0);
 
 	// You could use backend transactions directly as an alternative,
 	// but it isn't recommended, until you want to handle the error values
@@ -153,8 +157,8 @@ Common::Error PrivateEngine::run() {
 			}
 		}
 
-		if (_compositeSurface)
-			drawScreen();
+		//if (_compositeSurface)
+		//	drawScreen();
 
 		if (_nextSetting != NULL) {
 			debug("Executing %s", _nextSetting->c_str());
@@ -235,19 +239,11 @@ void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
 		error("unable to load image %s", path.c_str());
 
 	_image->loadStream(file);
-        Graphics::Surface *surf; 
-	if (!_compositeSurface)
-	    _compositeSurface = new Graphics::Surface();
-  	    _compositeSurface->create(_screenW, _screenH, _image->getSurface()->format );
-
-        _compositeSurface->copyRectToSurface(*_image->getSurface(), x, y,
-					Common::Rect(0, 0, _image->getSurface()->w, _image->getSurface()->h));
-
-	//delete _compositeSurface;
-	/*if (_compositeSurface) {
-		delete _compositeSurface;
-		_compositeSurface = nullptr;
-	}*/
+	//debug("palette %d %d", _image->getPaletteStartIndex(), _image->getPaletteColorCount());
+        //for (int i = 0; i < 30; i=i+3) 
+	//    debug("%x %x %x", *(_image->getPalette()+i), *(_image->getPalette()+i+1), *(_image->getPalette()+i+2));
+
+	_compositeSurface->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), Common::Point(x,y)); 
 	drawScreen();
 }
 
@@ -257,7 +253,7 @@ void PrivateEngine::drawScreen() {
 		Graphics::Surface *screen = g_system->lockScreen();
 		//screen->fillRect(Common::Rect(0, 0, g_system->getWidth(), g_system->getHeight()), 0);
 
-		const Graphics::Surface *surface;
+		const Graphics::ManagedSurface *surface;
                 /*if (_videoDecoder)
 			surface = _videoDecoder->decodeNextFrame();
 		else*/ if (_compositeSurface)
@@ -268,16 +264,15 @@ void PrivateEngine::drawScreen() {
 
 		int w = surface->w; //CLIP<int>(surface->w, 0, _screenW);
 		int h = surface->h; //CLIP<int>(surface->h, 0, _screenH);
+                assert(w == _screenW && h == _screenH);
 
-		//int x = (_screenW - w) / 2;
-		//int y = (_screenH - h) / 2;
-     	        //debug("%d %d", w, h);
-
-		screen->copyRectToSurface(*surface, 0, 0, Common::Rect(0, 0, w, h));
+		screen->copyRectToSurface(*surface, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
 
 		g_system->unlockScreen();
-		if (_image->getPalette() != nullptr)
-			g_system->getPaletteManager()->setPalette(_image->getPalette(), 0, 256);
+                //if (_image->getPalette() != nullptr)
+	        //    g_system->getPaletteManager()->setPalette(_image->getPalette(), _image->getPaletteStartIndex(), _image->getPaletteColorCount());
+		//if (_image->getPalette() != nullptr)
+		//	g_system->getPaletteManager()->setPalette(_image->getPalette(), 0, 256);
 	        //g_system->getPaletteManager()->setPalette(_videoDecoder->getPalette(), 0, 256);	
 		g_system->updateScreen();
 	}
diff --git a/engines/private/private.h b/engines/private/private.h
index 16f1593a36..5e0af55078 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -11,13 +11,14 @@
 #include "audio/mixer.h"
 #include "video/smk_decoder.h"
 #include "graphics/palette.h"
+#include "graphics/managed_surface.h"
 
 namespace Image {
 class ImageDecoder;
 }
 
 namespace Graphics {
-struct Surface;
+struct ManagedSurface;
 }
 
 namespace Private {
@@ -40,8 +41,10 @@ class PrivateEngine : public Engine {
 private:
 	// We need random numbers
 	Common::RandomSource *_rnd;
+
+        Graphics::PixelFormat _pixelFormat;
 	Image::ImageDecoder *_image;
-	Graphics::Surface *_compositeSurface;
+	Graphics::ManagedSurface *_compositeSurface;
 
 	int _screenW, _screenH;
 


Commit: 68ad8f1ad0584a202e34752e042c7bc8817aa08e
    https://github.com/scummvm/scummvm/commit/68ad8f1ad0584a202e34752e042c7bc8817aa08e
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: simplified grammar and added some code for conditional handling

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/grammar.h
    engines/private/grammar.y


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index e7b6f259c4..4ba7d6cfda 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -32,7 +32,7 @@ void saveSetting(char *name)
 {
 	Common::String s(name);
 	settingcode.setVal(s, psetting);
-        debug("setting %s %x, %x, %x", name, psetting, psetting->prog, psetting->stack);
+        debug("setting %s", name);
 }
 
 void loadSetting(Common::String *name) 
@@ -40,7 +40,7 @@ void loadSetting(Common::String *name)
         assert(settingcode.contains(*name));
 	psetting = settingcode.getVal(*name);
 
-	debug("loading setting %s %x, %x, %x", name->c_str(), psetting, psetting->prog, psetting->stack);
+	debug("loading setting %s", name->c_str());
 
         prog = (Inst *) &psetting->prog;
         stack = (Datum *) &psetting->stack;
@@ -238,6 +238,31 @@ Inst *code(Inst f)	/* install one instruction or operand */
 	return oprogp;
 }
 
+int ifcode()
+{
+	Datum d;
+	Inst *savepc = pc;	/* then part */
+
+	execute(savepc+3);	/* condition */
+	d = pop();
+	debug("ifcode %s %d", d.sym->name->c_str(), d.sym->u.val);
+	d.val = d.sym->u.val;
+	debug("then: %x", *((Inst **)(savepc)));
+	//assert(0);
+	if (d.val)
+		execute(*((Inst **)(savepc)));
+	else if (*((Inst **)(savepc+1))) /* else part? */
+		execute(*((Inst **)(savepc+1)));
+	pc = *((Inst **)(savepc+2));	 /* next stmt */
+	return 0;
+}
+
+int fail() 
+{
+	assert(0);
+	return 0;
+}
+
 void execute(Inst *p)	/* run the machine */
 {
 	for (pc = p; *pc != STOP; ) {
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 696185e785..960d14e42b 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -55,7 +55,7 @@ void Bitmap(ArgArray args) {
 
 void Timer(ArgArray args) {
     debug("Timer(%d, %s, %s)", args[0].val, args[1].str, args[2].str);
-    g_system->delayMillis(1000 * args[0].val);
+    g_system->delayMillis(100 * args[0].val);
     Common::String *s = new Common::String(args[1].str);
     _nextSetting = s; 
 }
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 915a722df5..5bcf53ae0d 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -8,7 +8,7 @@
 #define PRIVATE_GRAMMAR_H
 
 #define	NSTACK	256
-#define	NPROG	2000
+#define	NPROG	10000
 
 typedef struct Symbol {	/* symbol table entry */
 	Common::String *name;
@@ -90,7 +90,8 @@ extern  int constpush();
 extern  int strpush();
 extern  int funcpush();
 extern  int print();
-
+extern  int ifcode();
+extern  int fail();
 extern  int lt();
 extern  int gt();
 
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index ae709f8d5d..687ae6400a 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -45,6 +45,7 @@ int yywrap()
 
 %token<s> NAME
 %token<sym> STRING NUM
+//%type <inst> value cond expr if
 %token LTE GTE NEQ EQ FALSETOK TRUETOK IFTOK ELSETOK RECTTOK GOTOTOK DEBUGTOK DEFINETOK SETTINGTOK RANDOMTOK 
 %type<narg> params
 
@@ -67,14 +68,26 @@ statements:  /* nothing */
         | statements statement
 
 
-statement: GOTOTOK expr ';' statements 
-        | fcall ';' statements
-        | IFTOK '(' expr ')' statement statements
-        | IFTOK '(' expr ')' '{' statements '}' ELSETOK '{' statements '}' statements  
-        | IFTOK '(' expr ')' '{' statements '}' statements
-        | IFTOK '(' expr ')' '{' statements '}' ELSETOK statement statements
-        | IFTOK '(' expr ')' statement ELSETOK statement statements
-        | IFTOK '(' expr ')' statement ELSETOK '{' statements '}'
+statement: GOTOTOK expr ';'
+        | fcall ';'        
+        | if cond statement end
+        | if cond body end ELSETOK body end
+        | if cond body end
+        | if cond body end ELSETOK statement end
+	| if cond statement end ELSETOK statement end
+        | if cond statement end ELSETOK body end
+        ;
+
+body: '{' statements '}'
+        ;
+
+end:	  /* nothing */		{ code(STOP);}
+	;
+
+if: IFTOK { code(ifcode); code3(STOP, STOP, STOP); /*code(fail);*/ }
+        ;
+
+cond: '(' expr ')'	{ code(STOP); }
         ;
 
 define:  /* nothing */
@@ -113,7 +126,7 @@ value:    FALSETOK { code2(Private::constpush, (Private::Inst) Private::addconst
         | NAME     { code1(Private::varpush); code1((Private::Inst) lookupName($NAME)); code1(Private::eval); }
         ;
 
-expr:     value          
+expr:     value           
         | '!' value       { code1(Private::negate); }
         | value EQ value
         | value NEQ value


Commit: fc71730e174cbe106f1cd3a9be3dd1c72c3c9864
    https://github.com/scummvm/scummvm/commit/fc71730e174cbe106f1cd3a9be3dd1c72c3c9864
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: more functions and fixes

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/grammar.h
    engines/private/grammar.y
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 4ba7d6cfda..2331b52bf4 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -125,8 +125,8 @@ int eval()		/* evaluate variable on stack */
 	else if (d.sym->type == STRING)
 	    d.str = d.sym->u.str;
 	else if (d.sym->type == NAME) {
-            debug("NAME");
-	    d.sym = d.sym;
+            //debug("NAME %s", d.sym->name->c_str());
+	    //d.sym = d.sym;
 	}
 	else
 	    assert(0);
@@ -151,7 +151,9 @@ int negate()
 {
 	Datum d;
 	d = pop();
-	d.val = !d.val;
+        debug("negating %s", d.sym->name->c_str());
+	int v = d.sym->u.val;
+	d.val = !v;
 	push(d);
 	return 0;
 }
@@ -232,6 +234,7 @@ int ne()
 
 Inst *code(Inst f)	/* install one instruction or operand */
 {
+	//debug("pushing code at %d", progp);
  	Inst *oprogp = progp;
 	assert (!(progp >= &prog[NPROG]));
 	*progp++ = f;
@@ -245,14 +248,18 @@ int ifcode()
 
 	execute(savepc+3);	/* condition */
 	d = pop();
-	debug("ifcode %s %d", d.sym->name->c_str(), d.sym->u.val);
+	debug("ifcode %s", d.sym->name->c_str()); //, d.sym->u.val);
 	d.val = d.sym->u.val;
-	debug("then: %x", *((Inst **)(savepc)));
+	//debug("ptr: %x", *((Inst **)(savepc+1)));
+	//debug("ptr: %x", *((Inst **)(savepc+2)));
+	//debug("ptr: %x", *((Inst **)(savepc+3)));
+	
 	//assert(0);
 	if (d.val)
 		execute(*((Inst **)(savepc)));
 	else if (*((Inst **)(savepc+1))) /* else part? */
 		execute(*((Inst **)(savepc+1)));
+	debug("finish if");
 	pc = *((Inst **)(savepc+2));	 /* next stmt */
 	return 0;
 }
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 960d14e42b..f304d006c6 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -25,6 +25,13 @@ void SetFlag(ArgArray args) {
     args[0].sym->u.val = args[1].val;
 }
 
+void SetModifiedFlag(ArgArray args) {
+    debug("SetModifiedFlag(%d)", args[0].val);
+    _modified = (bool) args[0].val;
+}
+
+
+
 void Sound(ArgArray args) {
     debug("Sound(%s)", args[0].str);
     if (strcmp("\"\"", args[0].str) != 0) {
@@ -36,6 +43,12 @@ void Sound(ArgArray args) {
     }
 }
 
+void Transition(ArgArray args) {
+    debug("Transition(%s, %s)", args[0].str, args[1].str);
+    _nextMovie = new Common::String(args[0].str);
+    _nextSetting = new Common::String(args[1].str);
+}
+
 void Bitmap(ArgArray args) {
     assert(args.size() == 1 || args.size() == 3);
 
@@ -81,11 +94,19 @@ void execFunction(char *name, ArgArray args) {
     else if (strcmp(name, "Timer") == 0) {
         Timer(args);	    
     }
+    else if (strcmp(name, "Transition") == 0) {
+        Transition(args);	    
+    }
+    else if (strcmp(name, "SetModifiedFlag") == 0) {
+        SetModifiedFlag(args);	    
+    }
     else if (strcmp(name, "Exit") == 0) {
        ;	    
     }
-    else 
+    else {
+        debug("I don't know how to exec %s", name);	    
         assert(0);
+    }
 
 }
 
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 5bcf53ae0d..393309f44c 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -74,8 +74,7 @@ extern void execFunction(char *, ArgArray);
 // Code Generation
 
 extern	Datum pop();
-extern  int pushString(char *);
-extern  int pushInt(int);
+extern  Inst	*progp;
 
 extern  Inst *code(Inst);
 extern	Inst *prog;
@@ -94,6 +93,8 @@ extern  int ifcode();
 extern  int fail();
 extern  int lt();
 extern  int gt();
+extern  int le();
+extern  int ge();
 
 // Code Execution
 
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 687ae6400a..eb4af45927 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -37,7 +37,7 @@ int yywrap()
 
 %union {
 	struct Symbol	*sym;	/* symbol table pointer */
-        int (*inst)();	/* machine instruction */
+        int (**inst)();	/* machine instruction */
         char *s;
         int *i;
         int narg;
@@ -45,7 +45,7 @@ int yywrap()
 
 %token<s> NAME
 %token<sym> STRING NUM
-//%type <inst> value cond expr if
+%type <inst> body if cond end expr statements statement fcall value
 %token LTE GTE NEQ EQ FALSETOK TRUETOK IFTOK ELSETOK RECTTOK GOTOTOK DEBUGTOK DEFINETOK SETTINGTOK RANDOMTOK 
 %type<narg> params
 
@@ -64,30 +64,40 @@ debug: /* nothing */
         | NAME ',' debug
         ;
 
-statements:  /* nothing */
-        | statements statement
-
-
-statement: GOTOTOK expr ';'
-        | fcall ';'        
-        | if cond statement end
-        | if cond body end ELSETOK body end
-        | if cond body end
-        | if cond body end ELSETOK statement end
-	| if cond statement end ELSETOK statement end
-        | if cond statement end ELSETOK body end
+statements:  /* nothing */     { $$ = progp; }
+        | statement statements
+
+
+statement: GOTOTOK expr ';'  { code(fail); }
+        | fcall ';'          { $$ = $1; } 
+        | if cond statement end {	/* else-less if */
+		($1)[1] = (Inst)$3;	/* thenpart */
+		($1)[3] = (Inst)$4; }	/* end, if cond fails */
+        | if cond body end ELSETOK body end { /* if with else */
+		($1)[1] = (Inst)$3;	/* thenpart */
+		($1)[2] = (Inst)$6;	/* elsepart */
+		($1)[3] = (Inst)$7; }	/* end, if cond fails */
+        | if cond body end {	/* else-less if */
+		($1)[1] = (Inst)$3;	/* thenpart */
+		($1)[3] = (Inst)$4; }	/* end, if cond fails */
+        | if cond body end ELSETOK statement end {  /* if with else */
+		($1)[1] = (Inst)$3;	/* thenpart */
+		($1)[2] = (Inst)$6;	/* elsepart */
+		($1)[3] = (Inst)$7; }	/* end, if cond fails */
+	| if cond statement end ELSETOK statement end { code(fail); }
+        | if cond statement end ELSETOK body end { code(fail); }
         ;
 
-body: '{' statements '}'
+body: '{' statements '}' { $$ = $2; }
         ;
 
-end:	  /* nothing */		{ code(STOP);}
+end:	  /* nothing */		{ code(STOP); $$ = progp; }
 	;
 
-if: IFTOK { code(ifcode); code3(STOP, STOP, STOP); /*code(fail);*/ }
+if: IFTOK { $$ = code(ifcode); code3(STOP, STOP, STOP); }
         ;
 
-cond: '(' expr ')'	{ code(STOP); }
+cond: '(' expr ')'	{ code(STOP); $$ = $2; }
         ;
 
 define:  /* nothing */
@@ -98,14 +108,16 @@ define:  /* nothing */
         ;
 
 fcall:    GOTOTOK '(' NAME ')' {
+                               $$ = progp;
                                code2(Private::strpush, (Private::Inst) Private::addconstant(STRING, 0, $NAME));
                                code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
                                code2(Private::strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto")); 
-                               code1(Private::funcpush); 
+                               code1(Private::funcpush);
                                }
 
         | RECTTOK '(' NUM ',' NUM ',' NUM ',' NUM ')'
         | NAME '(' params ')'  {
+                               $$ = progp;
                                code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, $params, NULL));
                                code2(Private::strpush, (Private::Inst) Private::addconstant(STRING, 0, $NAME)); 
                                code1(Private::funcpush); 
@@ -126,15 +138,15 @@ value:    FALSETOK { code2(Private::constpush, (Private::Inst) Private::addconst
         | NAME     { code1(Private::varpush); code1((Private::Inst) lookupName($NAME)); code1(Private::eval); }
         ;
 
-expr:     value           
-        | '!' value       { code1(Private::negate); }
+expr:     value           { $$ = $1; } 
+        | '!' value       { code1(Private::negate); $$ = $2; }
         | value EQ value
         | value NEQ value
         | value '+' value { code1(Private::add); }
         | value '<' value { code1(Private::lt); }
         | value '>' value { code1(Private::gt); }
-        | value LTE value
-        | value GTE value 
-        | value '+'
+        | value LTE value { code1(Private::le); }
+        | value GTE value { code1(Private::ge); }
+        | value '+' 
         | RANDOMTOK '(' NUM '%' ')'
         ;
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 5ab6b8e5b7..68358b6f0a 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -26,6 +26,8 @@ extern int yyparse();
 namespace Private {
 
 Common::String *_nextSetting = NULL;
+Common::String *_nextMovie = NULL;
+bool _modified = false;
 int _mode = -1;
 PrivateEngine *_private = NULL;
 
@@ -36,7 +38,9 @@ Common::String convertPath(Common::String name) {
         Common::String s1("\\");
         Common::String s2("/");
 
-        Common::replace(path, s1, s2);
+	while (path.contains(s1))
+            Common::replace(path, s1, s2);
+
         s1 = Common::String("\"");
         s2 = Common::String("");
 
@@ -103,7 +107,7 @@ Common::Error PrivateEngine::run() {
         _image = new Image::BitmapDecoder();
 	_compositeSurface = new Graphics::ManagedSurface();
   	_compositeSurface->create(_screenW, _screenH, _pixelFormat);
-	_compositeSurface->setTransparentColor(0);
+	_compositeSurface->setTransparentColor(0x00ff00);
 
 	// You could use backend transactions directly as an alternative,
 	// but it isn't recommended, until you want to handle the error values
@@ -147,7 +151,17 @@ Common::Error PrivateEngine::run() {
 		g_system->getEventManager()->pollEvent(evt);
 		g_system->delayMillis(10);
 
+
+		if (_nextMovie != NULL) {
+                    //_videoDecoder = new Video::SmackerDecoder();
+                    //playVideo(*_nextMovie);
+		    _nextMovie = NULL;
+		    continue;
+
+		}
+
 		if (_videoDecoder) {
+			stopSound();
 			if (_videoDecoder->endOfVideo()) {
 				_videoDecoder->close();
 				delete _videoDecoder;
@@ -155,6 +169,7 @@ Common::Error PrivateEngine::run() {
 			} else if (_videoDecoder->needsUpdate()) {
 				drawScreen();
 			}
+			continue;
 		}
 
 		//if (_compositeSurface)
@@ -216,11 +231,13 @@ void PrivateEngine::playSound(const Common::String &name) {
 void PrivateEngine::playVideo(const Common::String &name) {
 	debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
 	Common::File *file = new Common::File();
-	if (!file->open(name))
-		error("unable to find video file %s", name.c_str());
+        Common::String path = convertPath(name);
+
+	if (!file->open(path))
+		error("unable to find video file %s", path.c_str());
 
 	if (!_videoDecoder->loadStream(file))
-	        error("unable to load video %s", name.c_str());
+	        error("unable to load video %s", path.c_str());
 	_videoDecoder->start();
 
 }
@@ -243,7 +260,7 @@ void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
         //for (int i = 0; i < 30; i=i+3) 
 	//    debug("%x %x %x", *(_image->getPalette()+i), *(_image->getPalette()+i+1), *(_image->getPalette()+i+2));
 
-	_compositeSurface->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), Common::Point(x,y)); 
+	_compositeSurface->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), Common::Point(x,y), _pixelFormat.RGBToColor(0,255,0)); 
 	drawScreen();
 }
 
@@ -253,14 +270,14 @@ void PrivateEngine::drawScreen() {
 		Graphics::Surface *screen = g_system->lockScreen();
 		//screen->fillRect(Common::Rect(0, 0, g_system->getWidth(), g_system->getHeight()), 0);
 
-		const Graphics::ManagedSurface *surface;
-                /*if (_videoDecoder)
-			surface = _videoDecoder->decodeNextFrame();
-		else*/ if (_compositeSurface)
-			surface = _compositeSurface;
-		else
-			assert(0);
-		//	surface = _image->getSurface();
+		Graphics::ManagedSurface *surface = _compositeSurface;
+
+                if (_videoDecoder) {
+			Graphics::Surface *frame = new Graphics::Surface;
+			frame->create(_screenW, _screenH, _pixelFormat);
+			frame->copyFrom(*_videoDecoder->decodeNextFrame());
+                        surface->transBlitFrom(*frame->convertTo(_pixelFormat, _videoDecoder->getPalette())); 
+		}	
 
 		int w = surface->w; //CLIP<int>(surface->w, 0, _screenW);
 		int h = surface->h; //CLIP<int>(surface->h, 0, _screenH);
diff --git a/engines/private/private.h b/engines/private/private.h
index 5e0af55078..256e042f7f 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -36,6 +36,8 @@ enum {
 // global state
 extern Common::String *_nextSetting;
 extern int _mode;
+extern bool _modified;
+extern Common::String *_nextMovie;
 
 class PrivateEngine : public Engine {
 private:


Commit: 980ef278a7bad5bc555c23673785a0cd8740fca7
    https://github.com/scummvm/scummvm/commit/980ef278a7bad5bc555c23673785a0cd8740fca7
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: improved data structures

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/grammar.h
    engines/private/grammar.y
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 2331b52bf4..3d7c1cd04b 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -32,7 +32,7 @@ void saveSetting(char *name)
 {
 	Common::String s(name);
 	settingcode.setVal(s, psetting);
-        debug("setting %s", name);
+        //debug("setting %s", name);
 }
 
 void loadSetting(Common::String *name) 
@@ -66,10 +66,11 @@ Datum pop()	/* pop and return top elem from stack */
 int constpush()	/* push constant onto stack */
 {
 	Datum d;
-	Symbol *s = (Symbol *)*pc++; 
-	d.val = s->u.val;
+	Symbol *s = (Symbol *)*pc++;
+        d.type = NUM;	
+	d.u.val = s->u.val;
 	
-	debug("pushing const %d with name %s", d.val, s->name->c_str());
+	debug("pushing const %d with name %s", d.u.val, s->name->c_str());
 	push(d);
 	return 0;
 }
@@ -77,8 +78,10 @@ int constpush()	/* push constant onto stack */
 int strpush()	/* push constant onto stack */
 {
 	Datum d;
-	d.str = ((Symbol *)*pc++)->u.str;
-	//printf("pushing %s\n", d.str);
+	d.type = STRING;
+	Symbol *s = (Symbol *)*pc++;        
+	d.u.str = s->u.str;
+	debug("pushing const %s with name %s", d.u.str, s->name->c_str());
 	push(d);
 	return 0;
 }
@@ -87,8 +90,9 @@ int strpush()	/* push constant onto stack */
 int varpush()	/* push variable onto stack */
 {
 	Datum d;
-	d.sym = (Symbol *)(*pc++);
-	debug("var pushing %s", d.sym->name->c_str());
+	d.type = NAME; 
+	d.u.sym = (Symbol *)(*pc++);
+	debug("var pushing %s", d.u.sym->name->c_str());
 	push(d);
 	return 0;
 }
@@ -100,14 +104,14 @@ int funcpush() //(char *name, int nargs)
 	n = pop();
         ArgArray args;
 
-	debug("executing %s with %d params", s.str, n.val);
-	for (int i = 0; i < n.val; i++) {
+	debug("executing %s with %d params", s.u.str, n.u.val);
+	for (int i = 0; i < n.u.val; i++) {
 		arg = pop();
 	        //debug("%d", arg.val);
 		args.insert(args.begin(), arg) ;
         }
 
-        execFunction(s.str, args);
+        execFunction(s.u.str, args);
 	return 0;
 }
 
@@ -117,14 +121,16 @@ int eval()		/* evaluate variable on stack */
 {
 	Datum d;
 	d = pop();
-	debug("eval %s", d.sym->name->c_str());
+	debug("eval %s", d.u.sym->name->c_str());
 	//if (d.sym->type == UNDEF)
 	//	execerror("undefined variable", d.sym->name);
-	if (d.sym->type == NUM)
-	    d.val = d.sym->u.val;
-	else if (d.sym->type == STRING)
-	    d.str = d.sym->u.str;
-	else if (d.sym->type == NAME) {
+	if (d.u.sym->type == NUM) {
+	    d.type = NUM;
+	    d.u.val = d.u.sym->u.val;
+	} else if (d.u.sym->type == STRING) {
+            d.type = STRING;
+    	    d.u.str = d.u.sym->u.str;
+	} else if (d.u.sym->type == NAME) {
             //debug("NAME %s", d.sym->name->c_str());
 	    //d.sym = d.sym;
 	}
@@ -142,7 +148,7 @@ int add()		/* add top two elems on stack */
 	d2 = pop();
 	d1 = pop();
 	//printf("adding %d %d\n",d1.val, d2.val);
-	d1.val += d2.val;
+	d1.u.val += d2.u.val;
 	push(d1);
 	return 0;
 }
@@ -151,9 +157,19 @@ int negate()
 {
 	Datum d;
 	d = pop();
-        debug("negating %s", d.sym->name->c_str());
-	int v = d.sym->u.val;
-	d.val = !v;
+	int v;
+        if (d.type == NAME) {
+            debug("negating %s", d.u.sym->name->c_str());
+	    v = d.u.sym->u.val;
+	    d.type = NUM;
+	}
+	else if (d.type == NUM) {
+            v = d.u.val;
+	} 
+	else
+            assert(0);
+
+	d.u.val = !v;
 	push(d);
 	return 0;
 }
@@ -166,8 +182,8 @@ int assign()	/* assign top value to next value */
 	/*if (d1.sym->type != VAR && d1.sym->type != UNDEF)
 		execerror("assignment to non-variable",
 			d1.sym->name);*/
-	d1.sym->u.val = d2.val;
-	d1.sym->type = NAME;
+	d1.u.sym->u.val = d2.u.val;
+	d1.u.sym->type = NAME;
 	push(d2);
 	return 0;
 }
@@ -177,7 +193,7 @@ int gt()
 	Datum d1, d2;
 	d2 = pop();
 	d1 = pop();
-	d1.val = (int)(d1.val > d2.val);
+	d1.u.val = (int)(d1.u.val > d2.u.val);
 	push(d1);
 	return 0;
 }
@@ -187,7 +203,7 @@ int lt()
 	Datum d1, d2;
 	d2 = pop();
 	d1 = pop();
-	d1.val = (int)(d1.val < d2.val);
+	d1.u.val = (int)(d1.u.val < d2.u.val);
 	push(d1);
 	return 0;
 }
@@ -197,7 +213,7 @@ int ge()
 	Datum d1, d2;
 	d2 = pop();
 	d1 = pop();
-	d1.val = (int)(d1.val >= d2.val);
+	d1.u.val = (int)(d1.u.val >= d2.u.val);
 	push(d1);
 	return 0;
 }
@@ -207,7 +223,7 @@ int le()
 	Datum d1, d2;
 	d2 = pop();
 	d1 = pop();
-	d1.val = (int)(d1.val <= d2.val);
+	d1.u.val = (int)(d1.u.val <= d2.u.val);
 	push(d1);
 	return 0;
 }
@@ -217,7 +233,7 @@ int eq()
 	Datum d1, d2;
 	d2 = pop();
 	d1 = pop();
-	d1.val = (int)(d1.val == d2.val);
+	d1.u.val = (int)(d1.u.val == d2.u.val);
 	push(d1);
 	return 0;
 }
@@ -227,7 +243,7 @@ int ne()
 	Datum d1, d2;
 	d2 = pop();
 	d1 = pop();
-	d1.val = (int)(d1.val  !=  d2.val);
+	d1.u.val = (int)(d1.u.val  !=  d2.u.val);
 	push(d1);
 	return 0;
 }
@@ -245,21 +261,31 @@ int ifcode()
 {
 	Datum d;
 	Inst *savepc = pc;	/* then part */
+	debug("ifcode: evaluating condition");
 
 	execute(savepc+3);	/* condition */
 	d = pop();
-	debug("ifcode %s", d.sym->name->c_str()); //, d.sym->u.val);
-	d.val = d.sym->u.val;
+
+	debug("ifcode: selecting branch");
+
+	if (d.type == NAME) {
+	    debug("name %s", d.u.sym->name->c_str()); //, d.sym->u.val);
+	    d.u.val = d.u.sym->u.val;
+	}
 	//debug("ptr: %x", *((Inst **)(savepc+1)));
 	//debug("ptr: %x", *((Inst **)(savepc+2)));
 	//debug("ptr: %x", *((Inst **)(savepc+3)));
 	
 	//assert(0);
-	if (d.val)
+	if (d.u.val) {
+                debug("ifcode: true branch");
 		execute(*((Inst **)(savepc)));
-	else if (*((Inst **)(savepc+1))) /* else part? */
+	}
+	else if (*((Inst **)(savepc+1))) /* else part? */ {
+		debug("ifcode: false branch");
 		execute(*((Inst **)(savepc+1)));
-	debug("finish if");
+	}
+	debug("ifcode finished");
 	pc = *((Inst **)(savepc+2));	 /* next stmt */
 	return 0;
 }
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index f304d006c6..f8cfe6003b 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -3,39 +3,44 @@
 #include "common/system.h"
 
 #include "grammar.h"
+#include "grammar.tab.h"
 #include "private.h"
 
 namespace Private {
 
 void ChgMode(ArgArray args) {
-    debug("ChgMode(%d, %s)", args[0].val, args[1].str);  
-    _mode = args[0].val;
-    Common::String *s = new Common::String(args[1].str);
+    // assert types 
+    debug("ChgMode(%d, %s)", args[0].u.val, args[1].u.str);  
+    _mode = args[0].u.val;
+    Common::String *s = new Common::String(args[1].u.str);
     _nextSetting = s;
 }
 
 void Goto(ArgArray args) { // should be goto, but this is a reserved word
-    debug("goto(%s)", args[0].str);  
-    Common::String *s = new Common::String(args[0].str);
+    // assert types
+    debug("goto(%s)", args[0].u.str);  
+    Common::String *s = new Common::String(args[0].u.str);
     _nextSetting = s;
 }
 
 void SetFlag(ArgArray args) {
-    debug("SetFlag(%s, %d)", args[0].sym->name->c_str(), args[1].val);
-    args[0].sym->u.val = args[1].val;
+    // assert types
+    debug("SetFlag(%s, %d)", args[0].u.sym->name->c_str(), args[1].u.val);
+    args[0].u.sym->u.val = args[1].u.val;
 }
 
 void SetModifiedFlag(ArgArray args) {
-    debug("SetModifiedFlag(%d)", args[0].val);
-    _modified = (bool) args[0].val;
+    // assert types
+    debug("SetModifiedFlag(%d)", args[0].u.val);
+    _modified = (bool) args[0].u.val;
 }
 
 
-
 void Sound(ArgArray args) {
-    debug("Sound(%s)", args[0].str);
-    if (strcmp("\"\"", args[0].str) != 0) {
-            Common::String *s = new Common::String(args[0].str);
+    // assert types
+    debug("Sound(%s)", args[0].u.str);
+    if (strcmp("\"\"", args[0].u.str) != 0) {
+            Common::String *s = new Common::String(args[0].u.str);
 	    _private->playSound(*s);
 	    //assert(0);
     } else {
@@ -44,9 +49,33 @@ void Sound(ArgArray args) {
 }
 
 void Transition(ArgArray args) {
-    debug("Transition(%s, %s)", args[0].str, args[1].str);
-    _nextMovie = new Common::String(args[0].str);
-    _nextSetting = new Common::String(args[1].str);
+    // assert types
+    debug("Transition(%s, %s)", args[0].u.str, args[1].u.str);
+    _nextMovie = new Common::String(args[0].u.str);
+    _nextSetting = new Common::String(args[1].u.str);
+}
+
+
+void CRect(ArgArray args) {
+    // assert types
+    int x1, y1, x2, y2;
+
+    debug("CRect(%d, %d, %d, %d)", args[0].u.val, args[1].u.val, args[0].u.val, args[1].u.val);
+    //assert(0);
+    x1 = args[0].u.val;
+    y1 = args[1].u.val;
+
+    x2 = args[2].u.val;
+    y2 = args[3].u.val;
+
+    Datum *d = new Datum();
+    Common::Rect *rect = new Common::Rect(x1, y1, x2, y2);
+
+    d->type = RECTTOK;
+    d->u.rect = rect;
+    push(*d);
+    //_nextMovie = new Common::String(args[0].u.str);
+    //_nextSetting = new Common::String(args[1].u.str);
 }
 
 void Bitmap(ArgArray args) {
@@ -55,21 +84,21 @@ void Bitmap(ArgArray args) {
     int x = 0;
     int y = 0;
 
-    char *f = args[0].str;
+    char *f = args[0].u.str;
     if (args.size() == 3) {
-	x = args[1].val;
-	y = args[2].val;
+	x = args[1].u.val;
+	y = args[2].u.val;
     }
 
     debug("Bitmap(%s, %d, %d)", f, x, y);
-    Common::String *s = new Common::String(args[0].str);
+    Common::String *s = new Common::String(args[0].u.str);
     _private->loadImage(*s, x, y);
 }
 
 void Timer(ArgArray args) {
-    debug("Timer(%d, %s, %s)", args[0].val, args[1].str, args[2].str);
-    g_system->delayMillis(100 * args[0].val);
-    Common::String *s = new Common::String(args[1].str);
+    debug("Timer(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.str);
+    g_system->delayMillis(100 * args[0].u.val);
+    Common::String *s = new Common::String(args[1].u.str);
     _nextSetting = s; 
 }
 
@@ -103,6 +132,9 @@ void execFunction(char *name, ArgArray args) {
     else if (strcmp(name, "Exit") == 0) {
        ;	    
     }
+    else if (strcmp(name, "CRect") == 0) {
+        CRect(args);	    
+    } 
     else {
         debug("I don't know how to exec %s", name);	    
         assert(0);
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 393309f44c..f0bdf728b7 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -3,6 +3,7 @@
 #include "common/queue.h"
 #include "common/list.h"
 #include "common/array.h"
+#include "common/rect.h"
 
 #ifndef PRIVATE_GRAMMAR_H
 #define PRIVATE_GRAMMAR_H
@@ -19,10 +20,14 @@ typedef struct Symbol {	/* symbol table entry */
 	} u;
 } Symbol;
 
-typedef union Datum {	/* interpreter stack type */
-	int	 val;
-	char    *str;
-	Symbol	*sym;
+typedef struct Datum {	/* interpreter stack type */
+        short type;
+	union {	
+	        int	 val;
+	        char    *str;
+	        Symbol	*sym;
+		Common::Rect *rect;
+	} u;
 } Datum;
 
 namespace Private {
@@ -74,6 +79,7 @@ extern void execFunction(char *, ArgArray);
 // Code Generation
 
 extern	Datum pop();
+extern  int push(Datum);
 extern  Inst	*progp;
 
 extern  Inst *code(Inst);
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index eb4af45927..93650f96bc 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -45,7 +45,7 @@ int yywrap()
 
 %token<s> NAME
 %token<sym> STRING NUM
-%type <inst> body if cond end expr statements statement fcall value
+%type <inst> body body1 if cond end expr statements statement fcall value
 %token LTE GTE NEQ EQ FALSETOK TRUETOK IFTOK ELSETOK RECTTOK GOTOTOK DEBUGTOK DEFINETOK SETTINGTOK RANDOMTOK 
 %type<narg> params
 
@@ -68,9 +68,9 @@ statements:  /* nothing */     { $$ = progp; }
         | statement statements
 
 
-statement: GOTOTOK expr ';'  { code(fail); }
-        | fcall ';'          { $$ = $1; } 
-        | if cond statement end {	/* else-less if */
+statement: GOTOTOK expr ';' { }
+        | fcall ';'         { }   
+        | if cond body1 end {	/* else-less if */
 		($1)[1] = (Inst)$3;	/* thenpart */
 		($1)[3] = (Inst)$4; }	/* end, if cond fails */
         | if cond body end ELSETOK body end { /* if with else */
@@ -84,11 +84,20 @@ statement: GOTOTOK expr ';'  { code(fail); }
 		($1)[1] = (Inst)$3;	/* thenpart */
 		($1)[2] = (Inst)$6;	/* elsepart */
 		($1)[3] = (Inst)$7; }	/* end, if cond fails */
-	| if cond statement end ELSETOK statement end { code(fail); }
-        | if cond statement end ELSETOK body end { code(fail); }
+	| if cond body1 end ELSETOK statement end { /* if with else */
+		($1)[1] = (Inst)$3;	/* thenpart */
+		($1)[2] = (Inst)$6;	/* elsepart */
+		($1)[3] = (Inst)$7; }	/* end, if cond fails */
+        | if cond body1 end ELSETOK body end { /* if with else */
+		($1)[1] = (Inst)$3;	/* thenpart */
+		($1)[2] = (Inst)$6;	/* elsepart */
+		($1)[3] = (Inst)$7; }	/* end, if cond fails */
+        ;
+
+body: '{' statements '}' { $$ = progp; }
         ;
 
-body: '{' statements '}' { $$ = $2; }
+body1: statement { $$ = progp-8; } 
         ;
 
 end:	  /* nothing */		{ code(STOP); $$ = progp; }
@@ -115,12 +124,12 @@ fcall:    GOTOTOK '(' NAME ')' {
                                code1(Private::funcpush);
                                }
 
-        | RECTTOK '(' NUM ',' NUM ',' NUM ',' NUM ')'
+        | RECTTOK '(' NUM ',' NUM ',' NUM ',' NUM ')' { $$ = progp; }
         | NAME '(' params ')'  {
                                $$ = progp;
                                code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, $params, NULL));
                                code2(Private::strpush, (Private::Inst) Private::addconstant(STRING, 0, $NAME)); 
-                               code1(Private::funcpush); 
+                               code1(Private::funcpush);
                                }
         ;
 
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index c2e2613768..b67f95c67a 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -25,7 +25,7 @@ char *emalloc(unsigned n)	/* check return from malloc */
 
 Symbol *lookup(Common::String s, SymbolMap symlist)	/* find s in symbol table symlist */
 {
-        debug("looking up %s", s.c_str());	
+        //debug("looking up %s", s.c_str());	
 	return symlist.getVal(s);
 }
 


Commit: 695eae1421cab99e9db25dcae13f7988caad0aa4
    https://github.com/scummvm/scummvm/commit/695eae1421cab99e9db25dcae13f7988caad0aa4
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: grammar fixes

Changed paths:
    engines/private/grammar.y


diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 93650f96bc..86cfc478b4 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -68,27 +68,38 @@ statements:  /* nothing */     { $$ = progp; }
         | statement statements
 
 
-statement: GOTOTOK expr ';' { }
-        | fcall ';'         { }   
-        | if cond body1 end {	/* else-less if */
+statement: GOTOTOK expr ';' { /*TODO*/ }
+        | fcall ';'         { $$ = $1; }   
+        | if cond body1 end {
+                $$ = $1;
+         	/* else-less if */
 		($1)[1] = (Inst)$3;	/* thenpart */
 		($1)[3] = (Inst)$4; }	/* end, if cond fails */
-        | if cond body end ELSETOK body end { /* if with else */
+        | if cond body end ELSETOK body end { 
+                $$ = $1;
+                /* if with else */
 		($1)[1] = (Inst)$3;	/* thenpart */
 		($1)[2] = (Inst)$6;	/* elsepart */
 		($1)[3] = (Inst)$7; }	/* end, if cond fails */
-        | if cond body end {	/* else-less if */
+        | if cond body end {	
+                $$ = $1;
+                /* else-less if */
 		($1)[1] = (Inst)$3;	/* thenpart */
 		($1)[3] = (Inst)$4; }	/* end, if cond fails */
         | if cond body end ELSETOK statement end {  /* if with else */
+                $$ = $1;
 		($1)[1] = (Inst)$3;	/* thenpart */
 		($1)[2] = (Inst)$6;	/* elsepart */
 		($1)[3] = (Inst)$7; }	/* end, if cond fails */
-	| if cond body1 end ELSETOK statement end { /* if with else */
+	| if cond body1 end ELSETOK statement end { 
+                $$ = $1;
+                /* if with else */
 		($1)[1] = (Inst)$3;	/* thenpart */
 		($1)[2] = (Inst)$6;	/* elsepart */
 		($1)[3] = (Inst)$7; }	/* end, if cond fails */
-        | if cond body1 end ELSETOK body end { /* if with else */
+        | if cond body1 end ELSETOK body end { 
+                $$ = $1;
+                /* if with else */
 		($1)[1] = (Inst)$3;	/* thenpart */
 		($1)[2] = (Inst)$6;	/* elsepart */
 		($1)[3] = (Inst)$7; }	/* end, if cond fails */
@@ -97,7 +108,7 @@ statement: GOTOTOK expr ';' { }
 body: '{' statements '}' { $$ = progp; }
         ;
 
-body1: statement { $$ = progp-8; } 
+body1: statement { $$ = $1; } 
         ;
 
 end:	  /* nothing */		{ code(STOP); $$ = progp; }


Commit: 2a04c04c35e84b2e6ff06218fd381327f8f8fa12
    https://github.com/scummvm/scummvm/commit/2a04c04c35e84b2e6ff06218fd381327f8f8fa12
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: some fixes and added debug functions

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/grammar.h
    engines/private/grammar.y
    engines/private/private.cpp
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 3d7c1cd04b..f94302b3ea 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -1,5 +1,6 @@
 #include "common/str.h"
 #include "common/debug.h"
+#include "common/hash-ptr.h"
 
 #include "grammar.h"
 #include "grammar.tab.h"
@@ -16,6 +17,34 @@ Inst	*prog        = NULL;	/* the machine */
 Inst	*progp       = NULL;	/* next free spot for code generation */
 Inst	*pc          = NULL;	/* program counter during execution */
 
+
+static struct FuncDescr {
+	const Inst func;
+	const char *name;
+	const char *args;
+} funcDescr[] = {
+	{ 0,					"STOP",				""  },
+	{ constpush,	"constpush",	"" },
+        { strpush,	"strpush",	"" },
+	{ varpush,	"varpush",	"" },
+        { funcpush,	"funcpush",	"" },
+	{ eval,	"eval",	"" },
+        { ifcode,	"ifcode",	"" },
+        { add,	"add",	"" },
+        { negate,	"negate",	"" },
+        
+	{ 0, 0, 0 }
+};
+
+FuncHash _functions;
+
+void initFuncs() {
+	for (FuncDescr *fnc = funcDescr; fnc->name; fnc++) {
+		_functions[(void *)fnc->func] = new Common::String(fnc->name);
+	}
+}
+
+
 void initSetting()	/* initialize for code generation */
 {
 	psetting = (Setting*) malloc(sizeof(Setting));
@@ -47,6 +76,19 @@ void loadSetting(Common::String *name)
 
 	stackp = stack;
 	progp = prog;
+
+
+	for (Inst *pc_ = progp; pc_-progp < 100; pc_++) {
+	   if (_functions.contains((void *) *pc_))
+	       debug("%x: %s", pc_, _functions.getVal((void*) *pc_)->c_str());
+	   else if ( (Inst *) *pc_ >= progp && (Inst *) *pc_ <= (progp + NPROG))
+	       debug("%x: %x", pc_, (void*) *pc_);
+	   else {
+	       debugN("%x:", pc_);
+               showSymbol((Symbol *) *pc_);
+	   }  
+
+	}	   
 }
 
 
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index f8cfe6003b..cce2a809e8 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -74,8 +74,6 @@ void CRect(ArgArray args) {
     d->type = RECTTOK;
     d->u.rect = rect;
     push(*d);
-    //_nextMovie = new Common::String(args[0].u.str);
-    //_nextSetting = new Common::String(args[1].u.str);
 }
 
 void Bitmap(ArgArray args) {
@@ -132,6 +130,9 @@ void execFunction(char *name, ArgArray args) {
     else if (strcmp(name, "Exit") == 0) {
        ;	    
     }
+    else if (strcmp(name, "LoadGame") == 0) {
+       ;	    
+    }
     else if (strcmp(name, "CRect") == 0) {
         CRect(args);	    
     } 
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index f0bdf728b7..181cc88e05 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -1,5 +1,6 @@
 #include "common/str.h"
 #include "common/hash-str.h"
+#include "common/hash-ptr.h"
 #include "common/queue.h"
 #include "common/list.h"
 #include "common/array.h"
@@ -11,6 +12,11 @@
 #define	NSTACK	256
 #define	NPROG	10000
 
+typedef struct Arg {
+  int n;
+  int (**inst)();
+} Arg;
+
 typedef struct Symbol {	/* symbol table entry */
 	Common::String *name;
 	short	type;	/* NAME, NUM or STRING  */
@@ -35,6 +41,10 @@ namespace Private {
 typedef int (*Inst)();	/* machine instruction */
 #define	STOP	(Inst) 0
 
+typedef Common::HashMap<void *, Common::String *> FuncHash;
+
+extern void initFuncs();
+
 typedef struct Setting {
 
     Datum	stack[NSTACK];	/* the stack */
@@ -58,6 +68,8 @@ extern SettingMap settingcode;
 
 // Symbols
 
+extern void showSymbol(Symbol *);
+
 typedef Common::HashMap<Common::String, Symbol*> SymbolMap;
 typedef Common::List<Symbol*> ConstantList;
 
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 86cfc478b4..0c76ea5c58 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -45,7 +45,7 @@ int yywrap()
 
 %token<s> NAME
 %token<sym> STRING NUM
-%type <inst> body body1 if cond end expr statements statement fcall value
+%type <inst> body if startp cond end expr statements statement fcall value
 %token LTE GTE NEQ EQ FALSETOK TRUETOK IFTOK ELSETOK RECTTOK GOTOTOK DEBUGTOK DEFINETOK SETTINGTOK RANDOMTOK 
 %type<narg> params
 
@@ -69,52 +69,30 @@ statements:  /* nothing */     { $$ = progp; }
 
 
 statement: GOTOTOK expr ';' { /*TODO*/ }
-        | fcall ';'         { $$ = $1; }   
-        | if cond body1 end {
-                $$ = $1;
+        | fcall ';'         { }   
+        | if cond body end {
+                //$$ = $1;
          	/* else-less if */
 		($1)[1] = (Inst)$3;	/* thenpart */
-		($1)[3] = (Inst)$4; }	/* end, if cond fails */
+		($1)[3] = (Inst)$4; 
+                }	/* end, if cond fails */
         | if cond body end ELSETOK body end { 
-                $$ = $1;
+                //$$ = $1;
                 /* if with else */
 		($1)[1] = (Inst)$3;	/* thenpart */
 		($1)[2] = (Inst)$6;	/* elsepart */
-		($1)[3] = (Inst)$7; }	/* end, if cond fails */
-        | if cond body end {	
-                $$ = $1;
-                /* else-less if */
-		($1)[1] = (Inst)$3;	/* thenpart */
-		($1)[3] = (Inst)$4; }	/* end, if cond fails */
-        | if cond body end ELSETOK statement end {  /* if with else */
-                $$ = $1;
-		($1)[1] = (Inst)$3;	/* thenpart */
-		($1)[2] = (Inst)$6;	/* elsepart */
-		($1)[3] = (Inst)$7; }	/* end, if cond fails */
-	| if cond body1 end ELSETOK statement end { 
-                $$ = $1;
-                /* if with else */
-		($1)[1] = (Inst)$3;	/* thenpart */
-		($1)[2] = (Inst)$6;	/* elsepart */
-		($1)[3] = (Inst)$7; }	/* end, if cond fails */
-        | if cond body1 end ELSETOK body end { 
-                $$ = $1;
-                /* if with else */
-		($1)[1] = (Inst)$3;	/* thenpart */
-		($1)[2] = (Inst)$6;	/* elsepart */
-		($1)[3] = (Inst)$7; }	/* end, if cond fails */
-        ;
-
-body: '{' statements '}' { $$ = progp; }
+		($1)[3] = (Inst)$7; 
+                }	/* end, if cond fails */
         ;
 
-body1: statement { $$ = $1; } 
+body:         statement      { $$ = $1; }
+        | '{' statements '}' { $$ = $2; }
         ;
 
 end:	  /* nothing */		{ code(STOP); $$ = progp; }
 	;
 
-if: IFTOK { $$ = code(ifcode); code3(STOP, STOP, STOP); }
+if: IFTOK { $$ = code(ifcode); code1(STOP); code1(STOP); code1(STOP); } //code3(STOP, STOP, STOP); }
         ;
 
 cond: '(' expr ')'	{ code(STOP); $$ = $2; }
@@ -129,26 +107,29 @@ define:  /* nothing */
 
 fcall:    GOTOTOK '(' NAME ')' {
                                $$ = progp;
-                               code2(Private::strpush, (Private::Inst) Private::addconstant(STRING, 0, $NAME));
-                               code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
-                               code2(Private::strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto")); 
-                               code1(Private::funcpush);
+                               code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, $NAME));
+                               code2(constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
+                               code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto")); 
+                               code1(funcpush);
                                }
 
         | RECTTOK '(' NUM ',' NUM ',' NUM ',' NUM ')' { $$ = progp; }
-        | NAME '(' params ')'  {
-                               $$ = progp;
-                               code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, $params, NULL));
-                               code2(Private::strpush, (Private::Inst) Private::addconstant(STRING, 0, $NAME)); 
-                               code1(Private::funcpush);
+        | NAME '(' startp params ')'  {
+                               $$ = $startp;
+                               code2(constpush, (Private::Inst) addconstant(NUM, $params, NULL));
+                               code2(strpush, (Private::Inst) addconstant(STRING, 0, $NAME)); 
+                               code1(funcpush);
                                }
         ;
 
-params:  /* nothing */      { $$ = 0; }
+startp: /*nothing*/ { $$ = progp; }
+        ;
+
+params:   /* nothing */     { $$ = 0; }
         | fcall ',' params  { $$ = $3 + 1; }
         | expr ',' params   { $$ = $3 + 1; }
-        | expr              { $$ = 1; }
-        | fcall             { $$ = 1; }
+        | expr        { $$ = 1; }
+        | fcall       { $$ = 1; }
         ;
 
 value:    FALSETOK { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL)); }
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 68358b6f0a..00b6c15fbe 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -90,6 +90,7 @@ Common::Error PrivateEngine::run() {
 	assert(file->open("GAME.DAT"));
 	void *buf = malloc(191000); 
 	file->read(buf, 191000);
+	initFuncs();
 	parse((char *) buf);
 	assert(constants.size() > 0);
 
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index b67f95c67a..544d6c2ec9 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -23,6 +23,19 @@ char *emalloc(unsigned n)	/* check return from malloc */
 	return p;
 }
 
+void showSymbol(Symbol *s)
+{
+        if (s->type == NUM)
+		debug("%s %d",s->name->c_str(), s->u.val);
+	else if (s->type == STRING) 
+		debug("%s %s", s->name->c_str(), s->u.str);
+	else if (s->type == NAME)
+		debug("%s",s->name->c_str());
+	else
+	        debug("%s %d", s->name->c_str(), s->type);
+}
+
+
 Symbol *lookup(Common::String s, SymbolMap symlist)	/* find s in symbol table symlist */
 {
         //debug("looking up %s", s.c_str());	


Commit: 40b7bc29e92cfc45cb53d696dd110865f67f82d8
    https://github.com/scummvm/scummvm/commit/40b7bc29e92cfc45cb53d696dd110865f67f82d8
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: added some data structure to hold exit information

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/grammar.h
    engines/private/grammar.l
    engines/private/grammar.y
    engines/private/private.cpp
    engines/private/private.h
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index f94302b3ea..546573d2a6 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -175,7 +175,7 @@ int eval()		/* evaluate variable on stack */
 	} else if (d.u.sym->type == NAME) {
             //debug("NAME %s", d.sym->name->c_str());
 	    //d.sym = d.sym;
-	}
+	} 
 	else
 	    assert(0);
 	
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index cce2a809e8..bb5708468f 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -23,12 +23,32 @@ void Goto(ArgArray args) { // should be goto, but this is a reserved word
     _nextSetting = s;
 }
 
+void Quit(ArgArray args) { 
+    debug("quit()");
+    _private->quitGame(); 
+}
+
+
+
 void SetFlag(ArgArray args) {
     // assert types
     debug("SetFlag(%s, %d)", args[0].u.sym->name->c_str(), args[1].u.val);
     args[0].u.sym->u.val = args[1].u.val;
 }
 
+void Exit(ArgArray args) {
+    // assert types
+    assert(args[2].type == RECT || args[2].type == NAME);
+    debug("Exit(%s, %s, %s)", args[0].u.str, args[1].u.sym->name->c_str(), "RECT");
+    ExitInfo *e = (ExitInfo*) malloc(sizeof(ExitInfo));
+    e->nextSetting = new Common::String(args[0].u.str);
+    e->cursor = args[1].u.sym->name;
+    e->rect = args[2].u.rect;
+    _exits.push_front(*e);
+}
+
+
+
 void SetModifiedFlag(ArgArray args) {
     // assert types
     debug("SetModifiedFlag(%d)", args[0].u.val);
@@ -71,7 +91,7 @@ void CRect(ArgArray args) {
     Datum *d = new Datum();
     Common::Rect *rect = new Common::Rect(x1, y1, x2, y2);
 
-    d->type = RECTTOK;
+    d->type = RECT;
     d->u.rect = rect;
     push(*d);
 }
@@ -128,7 +148,10 @@ void execFunction(char *name, ArgArray args) {
         SetModifiedFlag(args);	    
     }
     else if (strcmp(name, "Exit") == 0) {
-       ;	    
+        Exit(args);	    
+    }
+    else if (strcmp(name, "Quit") == 0) {
+        Quit(args);	    
     }
     else if (strcmp(name, "LoadGame") == 0) {
        ;	    
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 181cc88e05..2986cfc5b9 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -19,10 +19,11 @@ typedef struct Arg {
 
 typedef struct Symbol {	/* symbol table entry */
 	Common::String *name;
-	short	type;	/* NAME, NUM or STRING  */
+	short	type;	/* NAME, NUM, STRING or RECT  */
 	union {
-		int	val;	/* if NAME or NUM */
-		char	*str;	/* if STRING */
+		int	val;	    /* NAME or NUM */
+		char	*str;	    /* STRING */
+		Common::Rect *rect; /* RECT */
 	} u;
 } Symbol;
 
@@ -62,6 +63,8 @@ extern Setting *psetting;
 
 typedef Common::HashMap<Common::String, Setting*> SettingMap;
 typedef Common::Queue<Common::String> StringQueue;
+typedef Common::Queue<Common::Rect*> RectQueue;
+
 
 extern StringQueue todefine;
 extern SettingMap settingcode;
@@ -76,8 +79,8 @@ typedef Common::List<Symbol*> ConstantList;
 extern SymbolMap settings, variables, cursors, locations, rects;
 extern ConstantList constants;
 
-extern void define(char *n); 
-extern Symbol  *install(Common::String *, int, int, char *, SymbolMap*);
+extern void define(char *, Common::Rect *); 
+extern Symbol  *install(Common::String *, int, int, char *, Common::Rect *, SymbolMap*);
 extern Symbol  *lookupName(char *);
 extern Symbol *addconstant(int, int, char *);
 extern void     installall(char *);
diff --git a/engines/private/grammar.l b/engines/private/grammar.l
index 2b6375dc79..0703a55e29 100644
--- a/engines/private/grammar.l
+++ b/engines/private/grammar.l
@@ -26,7 +26,7 @@ setting                 return SETTINGTOK;
 if                      return IFTOK;
 else                    return ELSETOK;
 goto                    return GOTOTOK;
-RECT                    return RECTTOK;
+RECT                    return RECT;
 FALSE                   return FALSETOK;
 TRUE                    return TRUETOK;
 Random                  return RANDOMTOK;
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 0c76ea5c58..0911c7d06b 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -46,7 +46,7 @@ int yywrap()
 %token<s> NAME
 %token<sym> STRING NUM
 %type <inst> body if startp cond end expr statements statement fcall value
-%token LTE GTE NEQ EQ FALSETOK TRUETOK IFTOK ELSETOK RECTTOK GOTOTOK DEBUGTOK DEFINETOK SETTINGTOK RANDOMTOK 
+%token LTE GTE NEQ EQ FALSETOK TRUETOK IFTOK ELSETOK RECT GOTOTOK DEBUGTOK DEFINETOK SETTINGTOK RANDOMTOK 
 %type<narg> params
 
 %%
@@ -71,13 +71,11 @@ statements:  /* nothing */     { $$ = progp; }
 statement: GOTOTOK expr ';' { /*TODO*/ }
         | fcall ';'         { }   
         | if cond body end {
-                //$$ = $1;
          	/* else-less if */
 		($1)[1] = (Inst)$3;	/* thenpart */
 		($1)[3] = (Inst)$4; 
                 }	/* end, if cond fails */
         | if cond body end ELSETOK body end { 
-                //$$ = $1;
                 /* if with else */
 		($1)[1] = (Inst)$3;	/* thenpart */
 		($1)[2] = (Inst)$6;	/* elsepart */
@@ -92,17 +90,23 @@ body:         statement      { $$ = $1; }
 end:	  /* nothing */		{ code(STOP); $$ = progp; }
 	;
 
-if: IFTOK { $$ = code(ifcode); code1(STOP); code1(STOP); code1(STOP); } //code3(STOP, STOP, STOP); }
+if: IFTOK { $$ = code(ifcode); code3(STOP, STOP, STOP); }
         ;
 
 cond: '(' expr ')'	{ code(STOP); $$ = $2; }
         ;
 
 define:  /* nothing */
-        | NAME ',' fcall ',' define  { define($NAME); }
-        | NAME ',' fcall             { define($NAME); }
-        | NAME ',' define            { define($NAME); }
-        | NAME                       { define($NAME); }  
+        | NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  { 
+          Common::Rect *r = new Common::Rect($5->u.val, $7->u.val, $9->u.val, $11->u.val); 
+          define($NAME, r); 
+          }
+        | NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' {
+          Common::Rect *r = new Common::Rect($5->u.val, $7->u.val, $9->u.val, $11->u.val);  
+          define($NAME, r); 
+          }
+        | NAME ',' define { define($NAME, NULL); }
+        | NAME            { define($NAME, NULL); }  
         ;
 
 fcall:    GOTOTOK '(' NAME ')' {
@@ -113,7 +117,7 @@ fcall:    GOTOTOK '(' NAME ')' {
                                code1(funcpush);
                                }
 
-        | RECTTOK '(' NUM ',' NUM ',' NUM ',' NUM ')' { $$ = progp; }
+        | RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' { $$ = progp; }
         | NAME '(' startp params ')'  {
                                $$ = $startp;
                                code2(constpush, (Private::Inst) addconstant(NUM, $params, NULL));
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 00b6c15fbe..1ff2592816 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -16,6 +16,7 @@
 #include "engines/util.h"
 
 #include "image/bmp.h"
+#include "graphics/cursorman.h"
 
 #include "private/private.h"
 #include "private/grammar.tab.h"
@@ -31,8 +32,35 @@ bool _modified = false;
 int _mode = -1;
 PrivateEngine *_private = NULL;
 
+Common::List<ExitInfo> _exits;
+
 extern int parse(char*);
 
+static const byte MOUSECURSOR_SCI[] = {
+	1,1,0,0,0,0,0,0,0,0,0,
+	1,2,1,0,0,0,0,0,0,0,0,
+	1,2,2,1,0,0,0,0,0,0,0,
+	1,2,2,2,1,0,0,0,0,0,0,
+	1,2,2,2,2,1,0,0,0,0,0,
+	1,2,2,2,2,2,1,0,0,0,0,
+	1,2,2,2,2,2,2,1,0,0,0,
+	1,2,2,2,2,2,2,2,1,0,0,
+	1,2,2,2,2,2,2,2,2,1,0,
+	1,2,2,2,2,2,2,2,2,2,1,
+	1,2,2,2,2,2,1,0,0,0,0,
+	1,2,1,0,1,2,2,1,0,0,0,
+	1,1,0,0,1,2,2,1,0,0,0,
+	0,0,0,0,0,1,2,2,1,0,0,
+	0,0,0,0,0,1,2,2,1,0,0,
+	0,0,0,0,0,0,1,2,2,1,0
+};
+
+static const byte cursorPalette[] = {
+	0, 0, 0,           // Black / Transparent
+	0x80, 0x80, 0x80,  // Gray
+	0xff, 0xff, 0xff   // White
+};
+
 Common::String convertPath(Common::String name) {
 	Common::String path(name);
         Common::String s1("\\");
@@ -105,7 +133,11 @@ Common::Error PrivateEngine::run() {
 	//_pixelFormat = Graphics::PixelFormat::createFormatCLUT8();
 	_pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
 	initGraphics(_screenW, _screenH, &_pixelFormat);
-        _image = new Image::BitmapDecoder();
+
+        CursorMan.replaceCursor(MOUSECURSOR_SCI, 11, 16, 0, 0, 0);
+	CursorMan.replaceCursorPalette(cursorPalette, 0, 3);
+
+	_image = new Image::BitmapDecoder();
 	_compositeSurface = new Graphics::ManagedSurface();
   	_compositeSurface->create(_screenW, _screenH, _pixelFormat);
 	_compositeSurface->setTransparentColor(0x00ff00);
@@ -142,17 +174,33 @@ Common::Error PrivateEngine::run() {
 	debugC(3, kPrivateDebugExample | kPrivateDebugExample2, "Example debug call two");
 
 	// Simple main event loop
-	Common::Event evt;
+	Common::Event event;
+        Common::Point mousePos;
         _videoDecoder = nullptr; //new Video::SmackerDecoder();
 
 	_nextSetting = new Common::String("kGoIntro");
 
-  	//playVideo("intro/intro.smk");
 	while (!shouldQuit()) {
-		g_system->getEventManager()->pollEvent(evt);
+		g_system->getEventManager()->pollEvent(event);
+	        mousePos = g_system->getEventManager()->getMousePos();
+	
 		g_system->delayMillis(10);
+		//debug("here");
+
 
+		// Events
+		switch (event.type) {
+			case Common::EVENT_QUIT:
+			case Common::EVENT_RETURN_TO_LAUNCHER:
+				break;
 
+			case Common::EVENT_LBUTTONDOWN:
+				selectExit(mousePos);
+
+		}
+
+
+		// Movies
 		if (_nextMovie != NULL) {
                     //_videoDecoder = new Video::SmackerDecoder();
                     //playVideo(*_nextMovie);
@@ -178,17 +226,45 @@ Common::Error PrivateEngine::run() {
 
 		if (_nextSetting != NULL) {
 			debug("Executing %s", _nextSetting->c_str());
+			_exits.clear();
                         loadSetting(_nextSetting);
 			_nextSetting = NULL;
+                 	CursorMan.showMouse(false);
 			execute(prog);
-		}
+	                CursorMan.showMouse(true);
 
 
+		}
+
+		g_system->updateScreen();
+	
 	}
 
 	return Common::kNoError;
 }
 
+void PrivateEngine::selectExit(Common::Point mousePos) {
+	Common::String *ns = NULL;
+	int rs = 1 << 31;
+	int cs = 0;
+
+	for (ExitList::const_iterator it = _exits.begin(); it != _exits.end(); ++it) {
+		const ExitInfo e = *it;
+		cs = e.rect->width()*e.rect->height(); 
+		if (e.rect->contains(mousePos)) {
+			debug("Exit %s %d", e.nextSetting->c_str(), cs);
+			if (cs < rs) {
+				rs = cs;
+				ns = e.nextSetting;
+			}
+
+		}
+        }
+	if (cs > 0)
+		_nextSetting = ns;
+}
+
+
 bool PrivateEngine::hasFeature(EngineFeature f) const {
 	return
 		(f == kSupportsReturnToLauncher) ||
@@ -226,7 +302,7 @@ void PrivateEngine::playSound(const Common::String &name) {
 	Audio::AudioStream *stream;
 	stream = Audio::makeWAVStream(file, DisposeAfterUse::YES);
 	stopSound();
-	_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream, -1, Audio::Mixer::kMaxChannelVolume);
+	//_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream, -1, Audio::Mixer::kMaxChannelVolume);
 }
 
 void PrivateEngine::playVideo(const Common::String &name) {
diff --git a/engines/private/private.h b/engines/private/private.h
index 256e042f7f..0185ac4847 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -39,6 +39,18 @@ extern int _mode;
 extern bool _modified;
 extern Common::String *_nextMovie;
 
+// exits
+
+typedef struct ExitInfo {
+    Common::String *nextSetting;
+    Common::Rect   *rect;
+    Common::String *cursor;    
+} ExitInfo;
+
+typedef Common::List<ExitInfo> ExitList;  
+
+extern ExitList _exits;
+
 class PrivateEngine : public Engine {
 private:
 	// We need random numbers
@@ -59,6 +71,7 @@ public:
 	//Mohawk::InstallerArchive _installerArchive;
 
 	Common::Error run() override;
+        void selectExit(Common::Point); 
 	bool hasFeature(EngineFeature f) const override;
 	bool canLoadGameStateCurrently() override { return true; }
 	bool canSaveGameStateCurrently() override { return true; }
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 544d6c2ec9..6728bdd12e 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -1,5 +1,4 @@
 #include "common/debug.h"
-
 #include "grammar.h"
 #include "grammar.tab.h"
 
@@ -7,11 +6,13 @@ namespace Private {
 
 SymbolMap settings, variables, cursors, locations, rects;
 ConstantList constants;
-StringQueue todefine;
+StringQueue stringToDefine;
+RectQueue rectToDefine;
 
-void define(char *n) {
+void define(char *n, Common::Rect *r) {
         Common::String *s = new Common::String(n);
-        todefine.push(*s);
+        stringToDefine.push(*s);
+        rectToDefine.push(r);
 }
 
 char *emalloc(unsigned n)	/* check return from malloc */
@@ -74,29 +75,38 @@ Symbol *lookupName(char *n)  /* install s in some symbol table */
 
 void installall(char *n) {
         Common::String *s;
-	assert(todefine.size() > 0);
-	while (!todefine.empty()) {
-	       s = new Common::String(todefine.pop());
+	Common::Rect *r;
+
+	assert(stringToDefine.size() > 0);
+
+	while (!stringToDefine.empty()) {
+	       s = new Common::String(stringToDefine.pop());
+	       r = rectToDefine.pop();
 
  	       //debug("name %s", s->c_str());
 	       if (strcmp(n, "settings") == 0) {
-	           install(s, STRING, 0, (char*) s->c_str(), &settings);
+		   assert(r == NULL);
+	           install(s, STRING, 0, (char*) s->c_str(), r, &settings);
                }
 
 	       else if (strcmp(n, "variables") == 0) {
-	           install(s, NAME, 0, NULL, &variables);
+                   assert(r == NULL);
+	           install(s, NAME, 0, NULL, r, &variables);
                }
 
 	       else if (strcmp(n, "cursors") == 0) {
-	           install(s, NAME, 0, NULL, &cursors);
+                   assert(r == NULL);
+	           install(s, NAME, 0, NULL, r, &cursors);
                }
 
 	       else if (strcmp(n, "locations") == 0) {
-	           install(s, NAME, 0, NULL, &locations);
+                   assert(r == NULL);
+	           install(s, NAME, 0, NULL, r, &locations);
                }
 
 	       else if (strcmp(n, "rects") == 0) {
-	           install(s, NAME, 0, NULL, &rects);
+                   assert(r != NULL);
+	           install(s, NAME, 0, NULL, r, &rects);
                }
 	       else
 		   assert(0);
@@ -125,7 +135,7 @@ Symbol *addconstant(int t, int d, char *s)
 }
 
 
-Symbol *install(Common::String *n, int t, int d, char *s, SymbolMap *symlist)  /* install s in symbol table */
+Symbol *install(Common::String *n, int t, int d, char *s, Common::Rect *r, SymbolMap *symlist)  /* install s in symbol table */
 {
         Common::String *name = new Common::String(*n);
  
@@ -138,6 +148,8 @@ Symbol *install(Common::String *n, int t, int d, char *s, SymbolMap *symlist)  /
 	   sp->u.val = d;
 	else if (t == STRING)
 	   sp->u.str = s;
+	else if (t == RECT)
+	   sp->u.rect = r;
         else
 	   assert(0);
 


Commit: 5c4805694807798141c3f67f3a0e4c95275377bc
    https://github.com/scummvm/scummvm/commit/5c4805694807798141c3f67f3a0e4c95275377bc
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: clean-up

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index bb5708468f..20393d883a 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -11,21 +11,21 @@ namespace Private {
 void ChgMode(ArgArray args) {
     // assert types 
     debug("ChgMode(%d, %s)", args[0].u.val, args[1].u.str);  
-    _mode = args[0].u.val;
+    g_private->_mode = args[0].u.val;
     Common::String *s = new Common::String(args[1].u.str);
-    _nextSetting = s;
+    g_private->_nextSetting = s;
 }
 
 void Goto(ArgArray args) { // should be goto, but this is a reserved word
     // assert types
     debug("goto(%s)", args[0].u.str);  
     Common::String *s = new Common::String(args[0].u.str);
-    _nextSetting = s;
+    g_private->_nextSetting = s;
 }
 
 void Quit(ArgArray args) { 
     debug("quit()");
-    _private->quitGame(); 
+    g_private->quitGame(); 
 }
 
 
@@ -44,7 +44,7 @@ void Exit(ArgArray args) {
     e->nextSetting = new Common::String(args[0].u.str);
     e->cursor = args[1].u.sym->name;
     e->rect = args[2].u.rect;
-    _exits.push_front(*e);
+    g_private->_exits.push_front(*e);
 }
 
 
@@ -52,7 +52,7 @@ void Exit(ArgArray args) {
 void SetModifiedFlag(ArgArray args) {
     // assert types
     debug("SetModifiedFlag(%d)", args[0].u.val);
-    _modified = (bool) args[0].u.val;
+    g_private->_modified = (bool) args[0].u.val;
 }
 
 
@@ -61,18 +61,18 @@ void Sound(ArgArray args) {
     debug("Sound(%s)", args[0].u.str);
     if (strcmp("\"\"", args[0].u.str) != 0) {
             Common::String *s = new Common::String(args[0].u.str);
-	    _private->playSound(*s);
+	    g_private->playSound(*s);
 	    //assert(0);
     } else {
-	    _private->stopSound();
+	    g_private->stopSound();
     }
 }
 
 void Transition(ArgArray args) {
     // assert types
     debug("Transition(%s, %s)", args[0].u.str, args[1].u.str);
-    _nextMovie = new Common::String(args[0].u.str);
-    _nextSetting = new Common::String(args[1].u.str);
+    g_private->_nextMovie = new Common::String(args[0].u.str);
+    g_private->_nextSetting = new Common::String(args[1].u.str);
 }
 
 
@@ -110,14 +110,14 @@ void Bitmap(ArgArray args) {
 
     debug("Bitmap(%s, %d, %d)", f, x, y);
     Common::String *s = new Common::String(args[0].u.str);
-    _private->loadImage(*s, x, y);
+    g_private->loadImage(*s, x, y);
 }
 
 void Timer(ArgArray args) {
     debug("Timer(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.str);
     g_system->delayMillis(100 * args[0].u.val);
     Common::String *s = new Common::String(args[1].u.str);
-    _nextSetting = s; 
+    g_private->_nextSetting = s; 
 }
 
 
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 1ff2592816..ac423a1282 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -22,17 +22,9 @@
 #include "private/grammar.tab.h"
 #include "private/grammar.h"
 
-extern int yyparse();
-
 namespace Private {
 
-Common::String *_nextSetting = NULL;
-Common::String *_nextMovie = NULL;
-bool _modified = false;
-int _mode = -1;
-PrivateEngine *_private = NULL;
-
-Common::List<ExitInfo> _exits;
+PrivateEngine *g_private = NULL;
 
 extern int parse(char*);
 
@@ -61,24 +53,6 @@ static const byte cursorPalette[] = {
 	0xff, 0xff, 0xff   // White
 };
 
-Common::String convertPath(Common::String name) {
-	Common::String path(name);
-        Common::String s1("\\");
-        Common::String s2("/");
-
-	while (path.contains(s1))
-            Common::replace(path, s1, s2);
-
-        s1 = Common::String("\"");
-        s2 = Common::String("");
-
-        Common::replace(path, s1, s2);
-        Common::replace(path, s1, s2);
-	
-	path.toLowercase();
-	return path;
-}
-
 PrivateEngine::PrivateEngine(OSystem *syst)
 	: Engine(syst) {
 	// Put your engine in a sane state, but do nothing big yet;
@@ -93,14 +67,19 @@ PrivateEngine::PrivateEngine(OSystem *syst)
         //SearchMan.addSubDirectoryMatching(gameDataDir, "..");
 
 	// Here is the right place to set up the engine specific debug channels
-	DebugMan.addDebugChannel(kPrivateDebugExample, "example", "this is just an example for a engine specific debug channel");
-	DebugMan.addDebugChannel(kPrivateDebugExample2, "example2", "also an example");
+	//DebugMan.addDebugChannel(kPrivateDebugExample, "example", "this is just an example for a engine specific debug channel");
+	//DebugMan.addDebugChannel(kPrivateDebugExample2, "example2", "also an example");
 
 	// Don't forget to register your random source
 	_rnd = new Common::RandomSource("private");
 
-	debug("PrivateEngine::PrivateEngine");
-	_private = this;
+	g_private = this;
+
+        _nextSetting = NULL;
+        _nextMovie = NULL;
+        _modified = false;
+        _mode = -1;
+
 }
 
 PrivateEngine::~PrivateEngine() {
@@ -121,11 +100,6 @@ Common::Error PrivateEngine::run() {
 	initFuncs();
 	parse((char *) buf);
 	assert(constants.size() > 0);
-
-	for (SymbolMap::const_iterator it = settings.begin(); it != settings.end(); ++it) {
-		Symbol *s = it->_value;
-		//debug(s->name->c_str());
-        }
 	       
 	// Initialize graphics using following:
 	_screenW = 640;
@@ -165,13 +139,13 @@ Common::Error PrivateEngine::run() {
 	debug("PrivateEngine::init");
 
 	// Your main even loop should be (invoked from) here.
-	debug("PrivateEngine::go: Hello, World!");
+	//debug("PrivateEngine::go: Hello, World!");
 
 	// This test will show up if -d1 and --debugflags=example are specified on the commandline
-	debugC(1, kPrivateDebugExample, "Example debug call");
+	//debugC(1, kPrivateDebugExample, "Example debug call");
 
 	// This test will show up if --debugflags=example or --debugflags=example2 or both of them and -d3 are specified on the commandline
-	debugC(3, kPrivateDebugExample | kPrivateDebugExample2, "Example debug call two");
+	//debugC(3, kPrivateDebugExample | kPrivateDebugExample2, "Example debug call two");
 
 	// Simple main event loop
 	Common::Event event;
@@ -185,8 +159,6 @@ Common::Error PrivateEngine::run() {
 	        mousePos = g_system->getEventManager()->getMousePos();
 	
 		g_system->delayMillis(10);
-		//debug("here");
-
 
 		// Events
 		switch (event.type) {
@@ -199,11 +171,10 @@ Common::Error PrivateEngine::run() {
 
 		}
 
-
 		// Movies
 		if (_nextMovie != NULL) {
-                    //_videoDecoder = new Video::SmackerDecoder();
-                    //playVideo(*_nextMovie);
+                    _videoDecoder = new Video::SmackerDecoder();
+                    playVideo(*_nextMovie);
 		    _nextMovie = NULL;
 		    continue;
 
@@ -290,6 +261,24 @@ void PrivateEngine::syncGameStream(Common::Serializer &s) {
 	s.syncAsUint16LE(dummy);
 }
 
+Common::String PrivateEngine::convertPath(Common::String name) {
+	Common::String path(name);
+        Common::String s1("\\");
+        Common::String s2("/");
+
+	while (path.contains(s1))
+            Common::replace(path, s1, s2);
+
+        s1 = Common::String("\"");
+        s2 = Common::String("");
+
+        Common::replace(path, s1, s2);
+        Common::replace(path, s1, s2);
+	
+	path.toLowercase();
+	return path;
+}
+
 void PrivateEngine::playSound(const Common::String &name) {
 	debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
 
@@ -302,7 +291,7 @@ void PrivateEngine::playSound(const Common::String &name) {
 	Audio::AudioStream *stream;
 	stream = Audio::makeWAVStream(file, DisposeAfterUse::YES);
 	stopSound();
-	//_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream, -1, Audio::Mixer::kMaxChannelVolume);
+	_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream, -1, Audio::Mixer::kMaxChannelVolume);
 }
 
 void PrivateEngine::playVideo(const Common::String &name) {
diff --git a/engines/private/private.h b/engines/private/private.h
index 0185ac4847..8288b4f7d4 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -33,12 +33,6 @@ enum {
 	// the current limitation is 32 debug channels (1 << 31 is the last one)
 };
 
-// global state
-extern Common::String *_nextSetting;
-extern int _mode;
-extern bool _modified;
-extern Common::String *_nextMovie;
-
 // exits
 
 typedef struct ExitInfo {
@@ -49,7 +43,6 @@ typedef struct ExitInfo {
 
 typedef Common::List<ExitInfo> ExitList;  
 
-extern ExitList _exits;
 
 class PrivateEngine : public Engine {
 private:
@@ -79,6 +72,7 @@ public:
 	Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
 	void syncGameStream(Common::Serializer &s);
 
+        Common::String convertPath(Common::String); 
 	void playSound(const Common::String &name);
 	void playVideo(const Common::String &name);	
 	void stopSound();
@@ -86,9 +80,15 @@ public:
 	void loadImage(const Common::String &name, int x, int y);	
 	void drawScreen();
 
+        // global state
+        Common::String *_nextSetting;
+        int _mode;
+        bool _modified;
+        Common::String *_nextMovie;
+        ExitList _exits;
 };
 
-extern PrivateEngine *_private;
+extern PrivateEngine *g_private;
 
 // Example console class
 class Console : public GUI::Debugger {


Commit: 536fcd560536287f8a38b5edcee9b9734e9dbf44
    https://github.com/scummvm/scummvm/commit/536fcd560536287f8a38b5edcee9b9734e9dbf44
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: used astyle to improve code formatting

Changed paths:
    engines/private/code.cpp
    engines/private/detection.cpp
    engines/private/funcs.cpp
    engines/private/metaengine.cpp
    engines/private/private.cpp
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 546573d2a6..ce08164a15 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -19,330 +19,330 @@ Inst	*pc          = NULL;	/* program counter during execution */
 
 
 static struct FuncDescr {
-	const Inst func;
-	const char *name;
-	const char *args;
+    const Inst func;
+    const char *name;
+    const char *args;
 } funcDescr[] = {
-	{ 0,					"STOP",				""  },
-	{ constpush,	"constpush",	"" },
-        { strpush,	"strpush",	"" },
-	{ varpush,	"varpush",	"" },
-        { funcpush,	"funcpush",	"" },
-	{ eval,	"eval",	"" },
-        { ifcode,	"ifcode",	"" },
-        { add,	"add",	"" },
-        { negate,	"negate",	"" },
-        
-	{ 0, 0, 0 }
+    { 0,					"STOP",				""  },
+    { constpush,	"constpush",	"" },
+    { strpush,	"strpush",	"" },
+    { varpush,	"varpush",	"" },
+    { funcpush,	"funcpush",	"" },
+    { eval,	"eval",	"" },
+    { ifcode,	"ifcode",	"" },
+    { add,	"add",	"" },
+    { negate,	"negate",	"" },
+
+    { 0, 0, 0 }
 };
 
 FuncHash _functions;
 
 void initFuncs() {
-	for (FuncDescr *fnc = funcDescr; fnc->name; fnc++) {
-		_functions[(void *)fnc->func] = new Common::String(fnc->name);
-	}
+    for (FuncDescr *fnc = funcDescr; fnc->name; fnc++) {
+        _functions[(void *)fnc->func] = new Common::String(fnc->name);
+    }
 }
 
 
 void initSetting()	/* initialize for code generation */
 {
-	psetting = (Setting*) malloc(sizeof(Setting));
-        memset((void *) psetting, 0, sizeof(Setting));
+    psetting = (Setting*) malloc(sizeof(Setting));
+    memset((void *) psetting, 0, sizeof(Setting));
 
-        prog = (Inst *) &psetting->prog;
-        stack = (Datum *) &psetting->stack;
+    prog = (Inst *) &psetting->prog;
+    stack = (Datum *) &psetting->stack;
 
-	stackp = stack;
-	progp = prog;
+    stackp = stack;
+    progp = prog;
 }
 
 void saveSetting(char *name)
 {
-	Common::String s(name);
-	settingcode.setVal(s, psetting);
-        //debug("setting %s", name);
+    Common::String s(name);
+    settingcode.setVal(s, psetting);
+    //debug("setting %s", name);
 }
 
-void loadSetting(Common::String *name) 
+void loadSetting(Common::String *name)
 {
-        assert(settingcode.contains(*name));
-	psetting = settingcode.getVal(*name);
+    assert(settingcode.contains(*name));
+    psetting = settingcode.getVal(*name);
 
-	debug("loading setting %s", name->c_str());
+    debug("loading setting %s", name->c_str());
 
-        prog = (Inst *) &psetting->prog;
-        stack = (Datum *) &psetting->stack;
+    prog = (Inst *) &psetting->prog;
+    stack = (Datum *) &psetting->stack;
 
-	stackp = stack;
-	progp = prog;
+    stackp = stack;
+    progp = prog;
 
 
-	for (Inst *pc_ = progp; pc_-progp < 100; pc_++) {
-	   if (_functions.contains((void *) *pc_))
-	       debug("%x: %s", pc_, _functions.getVal((void*) *pc_)->c_str());
-	   else if ( (Inst *) *pc_ >= progp && (Inst *) *pc_ <= (progp + NPROG))
-	       debug("%x: %x", pc_, (void*) *pc_);
-	   else {
-	       debugN("%x:", pc_);
-               showSymbol((Symbol *) *pc_);
-	   }  
+    for (Inst *pc_ = progp; pc_-progp < 100; pc_++) {
+        if (_functions.contains((void *) *pc_))
+            debug("%p: %s", (void*) pc_, _functions.getVal((void*) *pc_)->c_str());
+        else if ( (Inst *) *pc_ >= progp && (Inst *) *pc_ <= (progp + NPROG))
+            debug("%p: %p", (void*) pc_, (void*) *pc_);
+        else {
+            debugN("%p:", (void*) pc_);
+            showSymbol((Symbol *) *pc_);
+        }
 
-	}	   
+    }
 }
 
 
 int push(Datum d)		/* push d onto stack */
 {
-	assert (!(stackp >= &stack[NSTACK]));
-	*stackp++ = d;
-	return 0;
+    assert (!(stackp >= &stack[NSTACK]));
+    *stackp++ = d;
+    return 0;
 }
 
 Datum pop()	/* pop and return top elem from stack */
 {
-	assert (!(stackp <= stack));
-	return *--stackp;
+    assert (!(stackp <= stack));
+    return *--stackp;
 }
 
 int constpush()	/* push constant onto stack */
 {
-	Datum d;
-	Symbol *s = (Symbol *)*pc++;
-        d.type = NUM;	
-	d.u.val = s->u.val;
-	
-	debug("pushing const %d with name %s", d.u.val, s->name->c_str());
-	push(d);
-	return 0;
+    Datum d;
+    Symbol *s = (Symbol *)*pc++;
+    d.type = NUM;
+    d.u.val = s->u.val;
+
+    debug("pushing const %d with name %s", d.u.val, s->name->c_str());
+    push(d);
+    return 0;
 }
 
 int strpush()	/* push constant onto stack */
 {
-	Datum d;
-	d.type = STRING;
-	Symbol *s = (Symbol *)*pc++;        
-	d.u.str = s->u.str;
-	debug("pushing const %s with name %s", d.u.str, s->name->c_str());
-	push(d);
-	return 0;
+    Datum d;
+    d.type = STRING;
+    Symbol *s = (Symbol *)*pc++;
+    d.u.str = s->u.str;
+    debug("pushing const %s with name %s", d.u.str, s->name->c_str());
+    push(d);
+    return 0;
 }
 
 
 int varpush()	/* push variable onto stack */
 {
-	Datum d;
-	d.type = NAME; 
-	d.u.sym = (Symbol *)(*pc++);
-	debug("var pushing %s", d.u.sym->name->c_str());
-	push(d);
-	return 0;
+    Datum d;
+    d.type = NAME;
+    d.u.sym = (Symbol *)(*pc++);
+    debug("var pushing %s", d.u.sym->name->c_str());
+    push(d);
+    return 0;
 }
 
-int funcpush() //(char *name, int nargs)	
+int funcpush() //(char *name, int nargs)
 {
-	Datum s, n, arg;
-	s = pop();
-	n = pop();
-        ArgArray args;
-
-	debug("executing %s with %d params", s.u.str, n.u.val);
-	for (int i = 0; i < n.u.val; i++) {
-		arg = pop();
-	        //debug("%d", arg.val);
-		args.insert(args.begin(), arg) ;
-        }
-
-        execFunction(s.u.str, args);
-	return 0;
+    Datum s, n, arg;
+    s = pop();
+    n = pop();
+    ArgArray args;
+
+    debug("executing %s with %d params", s.u.str, n.u.val);
+    for (int i = 0; i < n.u.val; i++) {
+        arg = pop();
+        //debug("%d", arg.val);
+        args.insert(args.begin(), arg) ;
+    }
+
+    execFunction(s.u.str, args);
+    return 0;
 }
 
 
 
 int eval()		/* evaluate variable on stack */
 {
-	Datum d;
-	d = pop();
-	debug("eval %s", d.u.sym->name->c_str());
-	//if (d.sym->type == UNDEF)
-	//	execerror("undefined variable", d.sym->name);
-	if (d.u.sym->type == NUM) {
-	    d.type = NUM;
-	    d.u.val = d.u.sym->u.val;
-	} else if (d.u.sym->type == STRING) {
-            d.type = STRING;
-    	    d.u.str = d.u.sym->u.str;
-	} else if (d.u.sym->type == NAME) {
-            //debug("NAME %s", d.sym->name->c_str());
-	    //d.sym = d.sym;
-	} 
-	else
-	    assert(0);
-	
- 
-	push(d);
-	return 0;
+    Datum d;
+    d = pop();
+    debug("eval %s", d.u.sym->name->c_str());
+    //if (d.sym->type == UNDEF)
+    //	execerror("undefined variable", d.sym->name);
+    if (d.u.sym->type == NUM) {
+        d.type = NUM;
+        d.u.val = d.u.sym->u.val;
+    } else if (d.u.sym->type == STRING) {
+        d.type = STRING;
+        d.u.str = d.u.sym->u.str;
+    } else if (d.u.sym->type == NAME) {
+        //debug("NAME %s", d.sym->name->c_str());
+        //d.sym = d.sym;
+    }
+    else
+        assert(0);
+
+
+    push(d);
+    return 0;
 }
 
 int add()		/* add top two elems on stack */
 {
-	Datum d1, d2;
-	d2 = pop();
-	d1 = pop();
-	//printf("adding %d %d\n",d1.val, d2.val);
-	d1.u.val += d2.u.val;
-	push(d1);
-	return 0;
+    Datum d1, d2;
+    d2 = pop();
+    d1 = pop();
+    //printf("adding %d %d\n",d1.val, d2.val);
+    d1.u.val += d2.u.val;
+    push(d1);
+    return 0;
 }
 
 int negate()
 {
-	Datum d;
-	d = pop();
-	int v;
-        if (d.type == NAME) {
-            debug("negating %s", d.u.sym->name->c_str());
-	    v = d.u.sym->u.val;
-	    d.type = NUM;
-	}
-	else if (d.type == NUM) {
-            v = d.u.val;
-	} 
-	else
-            assert(0);
-
-	d.u.val = !v;
-	push(d);
-	return 0;
+    Datum d;
+    d = pop();
+    int v;
+    if (d.type == NAME) {
+        debug("negating %s", d.u.sym->name->c_str());
+        v = d.u.sym->u.val;
+        d.type = NUM;
+    }
+    else if (d.type == NUM) {
+        v = d.u.val;
+    }
+    else
+        assert(0);
+
+    d.u.val = !v;
+    push(d);
+    return 0;
 }
 
 int assign()	/* assign top value to next value */
 {
-	Datum d1, d2;
-	d1 = pop();
-	d2 = pop();
-	/*if (d1.sym->type != VAR && d1.sym->type != UNDEF)
-		execerror("assignment to non-variable",
-			d1.sym->name);*/
-	d1.u.sym->u.val = d2.u.val;
-	d1.u.sym->type = NAME;
-	push(d2);
-	return 0;
+    Datum d1, d2;
+    d1 = pop();
+    d2 = pop();
+    /*if (d1.sym->type != VAR && d1.sym->type != UNDEF)
+    	execerror("assignment to non-variable",
+    		d1.sym->name);*/
+    d1.u.sym->u.val = d2.u.val;
+    d1.u.sym->type = NAME;
+    push(d2);
+    return 0;
 }
 
 int gt()
 {
-	Datum d1, d2;
-	d2 = pop();
-	d1 = pop();
-	d1.u.val = (int)(d1.u.val > d2.u.val);
-	push(d1);
-	return 0;
+    Datum d1, d2;
+    d2 = pop();
+    d1 = pop();
+    d1.u.val = (int)(d1.u.val > d2.u.val);
+    push(d1);
+    return 0;
 }
 
 int lt()
 {
-	Datum d1, d2;
-	d2 = pop();
-	d1 = pop();
-	d1.u.val = (int)(d1.u.val < d2.u.val);
-	push(d1);
-	return 0;
+    Datum d1, d2;
+    d2 = pop();
+    d1 = pop();
+    d1.u.val = (int)(d1.u.val < d2.u.val);
+    push(d1);
+    return 0;
 }
 
 int ge()
 {
-	Datum d1, d2;
-	d2 = pop();
-	d1 = pop();
-	d1.u.val = (int)(d1.u.val >= d2.u.val);
-	push(d1);
-	return 0;
+    Datum d1, d2;
+    d2 = pop();
+    d1 = pop();
+    d1.u.val = (int)(d1.u.val >= d2.u.val);
+    push(d1);
+    return 0;
 }
 
 int le()
 {
-	Datum d1, d2;
-	d2 = pop();
-	d1 = pop();
-	d1.u.val = (int)(d1.u.val <= d2.u.val);
-	push(d1);
-	return 0;
+    Datum d1, d2;
+    d2 = pop();
+    d1 = pop();
+    d1.u.val = (int)(d1.u.val <= d2.u.val);
+    push(d1);
+    return 0;
 }
 
 int eq()
 {
-	Datum d1, d2;
-	d2 = pop();
-	d1 = pop();
-	d1.u.val = (int)(d1.u.val == d2.u.val);
-	push(d1);
-	return 0;
+    Datum d1, d2;
+    d2 = pop();
+    d1 = pop();
+    d1.u.val = (int)(d1.u.val == d2.u.val);
+    push(d1);
+    return 0;
 }
 
 int ne()
 {
-	Datum d1, d2;
-	d2 = pop();
-	d1 = pop();
-	d1.u.val = (int)(d1.u.val  !=  d2.u.val);
-	push(d1);
-	return 0;
+    Datum d1, d2;
+    d2 = pop();
+    d1 = pop();
+    d1.u.val = (int)(d1.u.val  !=  d2.u.val);
+    push(d1);
+    return 0;
 }
 
 Inst *code(Inst f)	/* install one instruction or operand */
 {
-	//debug("pushing code at %d", progp);
- 	Inst *oprogp = progp;
-	assert (!(progp >= &prog[NPROG]));
-	*progp++ = f;
-	return oprogp;
+    //debug("pushing code at %d", progp);
+    Inst *oprogp = progp;
+    assert (!(progp >= &prog[NPROG]));
+    *progp++ = f;
+    return oprogp;
 }
 
 int ifcode()
 {
-	Datum d;
-	Inst *savepc = pc;	/* then part */
-	debug("ifcode: evaluating condition");
-
-	execute(savepc+3);	/* condition */
-	d = pop();
-
-	debug("ifcode: selecting branch");
-
-	if (d.type == NAME) {
-	    debug("name %s", d.u.sym->name->c_str()); //, d.sym->u.val);
-	    d.u.val = d.u.sym->u.val;
-	}
-	//debug("ptr: %x", *((Inst **)(savepc+1)));
-	//debug("ptr: %x", *((Inst **)(savepc+2)));
-	//debug("ptr: %x", *((Inst **)(savepc+3)));
-	
-	//assert(0);
-	if (d.u.val) {
-                debug("ifcode: true branch");
-		execute(*((Inst **)(savepc)));
-	}
-	else if (*((Inst **)(savepc+1))) /* else part? */ {
-		debug("ifcode: false branch");
-		execute(*((Inst **)(savepc+1)));
-	}
-	debug("ifcode finished");
-	pc = *((Inst **)(savepc+2));	 /* next stmt */
-	return 0;
+    Datum d;
+    Inst *savepc = pc;	/* then part */
+    debug("ifcode: evaluating condition");
+
+    execute(savepc+3);	/* condition */
+    d = pop();
+
+    debug("ifcode: selecting branch");
+
+    if (d.type == NAME) {
+        debug("name %s", d.u.sym->name->c_str()); //, d.sym->u.val);
+        d.u.val = d.u.sym->u.val;
+    }
+    //debug("ptr: %x", *((Inst **)(savepc+1)));
+    //debug("ptr: %x", *((Inst **)(savepc+2)));
+    //debug("ptr: %x", *((Inst **)(savepc+3)));
+
+    //assert(0);
+    if (d.u.val) {
+        debug("ifcode: true branch");
+        execute(*((Inst **)(savepc)));
+    }
+    else if (*((Inst **)(savepc+1))) { /* else part? */
+        debug("ifcode: false branch");
+        execute(*((Inst **)(savepc+1)));
+    }
+    debug("ifcode finished");
+    pc = *((Inst **)(savepc+2));	 /* next stmt */
+    return 0;
 }
 
-int fail() 
+int fail()
 {
-	assert(0);
-	return 0;
+    assert(0);
+    return 0;
 }
 
 void execute(Inst *p)	/* run the machine */
 {
-	for (pc = p; *pc != STOP; ) {
-		(*(*pc++))();
-	}
+    for (pc = p; *pc != STOP; ) {
+        (*(*pc++))();
+    }
 }
 
 }
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index ddffddcca9..d8068c3e46 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -3,48 +3,48 @@
 
 namespace Private {
 static const PlainGameDescriptor privateGames[] = {
-	{ "private-eye", "Private Eye" },
-	{ 0, 0 }
+    { "private-eye", "Private Eye" },
+    { 0, 0 }
 };
 
 
 static const ADGameDescription gameDescriptions[] = {
-	{
-		"private-eye",
-		0,
-		AD_ENTRY1s("GAME.DAT", "7a3eb7d9dedf40680ac3d088524f976e", 190735),
-		Common::EN_ANY,
-		Common::kPlatformWindows,
-		ADGF_NO_FLAGS,
-		GUIO1(GUIO_NOMIDI)
-	},
-	AD_TABLE_END_MARKER
+    {
+        "private-eye",
+        0,
+        AD_ENTRY1s("GAME.DAT", "7a3eb7d9dedf40680ac3d088524f976e", 190735),
+        Common::EN_ANY,
+        Common::kPlatformWindows,
+        ADGF_NO_FLAGS,
+        GUIO1(GUIO_NOMIDI)
+    },
+    AD_TABLE_END_MARKER
 };
 } // End of namespace Private
 
 static const char *const directoryGlobs[] = {
-        "support", // english CD
-        0
+    "support", // english CD
+    0
 };
 
 class PrivateMetaEngineDetection : public AdvancedMetaEngineDetection {
 public:
-	PrivateMetaEngineDetection() : AdvancedMetaEngineDetection(Private::gameDescriptions, sizeof(ADGameDescription), Private::privateGames) {
-		_maxScanDepth = 2;
-		_directoryGlobs = directoryGlobs;
-	}	
-
-	const char *getEngineId() const override {
-		return "private";
-	}
-
-	const char *getName() const override {
-		return "Private Eye";
-	}
-
-	const char *getOriginalCopyright() const override {
-		return "Copyright (C) Brooklyn Multimedia";
-	}
+    PrivateMetaEngineDetection() : AdvancedMetaEngineDetection(Private::gameDescriptions, sizeof(ADGameDescription), Private::privateGames) {
+        _maxScanDepth = 2;
+        _directoryGlobs = directoryGlobs;
+    }
+
+    const char *getEngineId() const override {
+        return "private";
+    }
+
+    const char *getName() const override {
+        return "Private Eye";
+    }
+
+    const char *getOriginalCopyright() const override {
+        return "Copyright (C) Brooklyn Multimedia";
+    }
 };
 
 REGISTER_PLUGIN_STATIC(PRIVATE_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, PrivateMetaEngineDetection);
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 20393d883a..d9ad5c704e 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -9,8 +9,8 @@
 namespace Private {
 
 void ChgMode(ArgArray args) {
-    // assert types 
-    debug("ChgMode(%d, %s)", args[0].u.val, args[1].u.str);  
+    // assert types
+    debug("ChgMode(%d, %s)", args[0].u.val, args[1].u.str);
     g_private->_mode = args[0].u.val;
     Common::String *s = new Common::String(args[1].u.str);
     g_private->_nextSetting = s;
@@ -18,14 +18,14 @@ void ChgMode(ArgArray args) {
 
 void Goto(ArgArray args) { // should be goto, but this is a reserved word
     // assert types
-    debug("goto(%s)", args[0].u.str);  
+    debug("goto(%s)", args[0].u.str);
     Common::String *s = new Common::String(args[0].u.str);
     g_private->_nextSetting = s;
 }
 
-void Quit(ArgArray args) { 
+void Quit(ArgArray args) {
     debug("quit()");
-    g_private->quitGame(); 
+    g_private->quitGame();
 }
 
 
@@ -60,11 +60,11 @@ void Sound(ArgArray args) {
     // assert types
     debug("Sound(%s)", args[0].u.str);
     if (strcmp("\"\"", args[0].u.str) != 0) {
-            Common::String *s = new Common::String(args[0].u.str);
-	    g_private->playSound(*s);
-	    //assert(0);
+        Common::String *s = new Common::String(args[0].u.str);
+        g_private->playSound(*s);
+        //assert(0);
     } else {
-	    g_private->stopSound();
+        g_private->stopSound();
     }
 }
 
@@ -104,8 +104,8 @@ void Bitmap(ArgArray args) {
 
     char *f = args[0].u.str;
     if (args.size() == 3) {
-	x = args[1].u.val;
-	y = args[2].u.val;
+        x = args[1].u.val;
+        y = args[2].u.val;
     }
 
     debug("Bitmap(%s, %d, %d)", f, x, y);
@@ -117,50 +117,50 @@ void Timer(ArgArray args) {
     debug("Timer(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.str);
     g_system->delayMillis(100 * args[0].u.val);
     Common::String *s = new Common::String(args[1].u.str);
-    g_private->_nextSetting = s; 
+    g_private->_nextSetting = s;
 }
 
 
 void execFunction(char *name, ArgArray args) {
     if (strcmp(name, "ChgMode") == 0) {
-	ChgMode(args);
+        ChgMode(args);
     }
     else if (strcmp(name, "goto") == 0) {
-	Goto(args);
+        Goto(args);
     }
 
     else if (strcmp(name, "SetFlag") == 0) {
-	SetFlag(args);
+        SetFlag(args);
     }
     else if (strcmp(name, "Sound") == 0) {
-	Sound(args);
+        Sound(args);
     }
     else if (strcmp(name, "Bitmap") == 0) {
-	Bitmap(args);
+        Bitmap(args);
     }
     else if (strcmp(name, "Timer") == 0) {
-        Timer(args);	    
+        Timer(args);
     }
     else if (strcmp(name, "Transition") == 0) {
-        Transition(args);	    
+        Transition(args);
     }
     else if (strcmp(name, "SetModifiedFlag") == 0) {
-        SetModifiedFlag(args);	    
+        SetModifiedFlag(args);
     }
     else if (strcmp(name, "Exit") == 0) {
-        Exit(args);	    
+        Exit(args);
     }
     else if (strcmp(name, "Quit") == 0) {
-        Quit(args);	    
+        Quit(args);
     }
     else if (strcmp(name, "LoadGame") == 0) {
-       ;	    
+        ;
     }
     else if (strcmp(name, "CRect") == 0) {
-        CRect(args);	    
-    } 
+        CRect(args);
+    }
     else {
-        debug("I don't know how to exec %s", name);	    
+        debug("I don't know how to exec %s", name);
         assert(0);
     }
 
diff --git a/engines/private/metaengine.cpp b/engines/private/metaengine.cpp
index bb6777bb7f..6461f5cc18 100644
--- a/engines/private/metaengine.cpp
+++ b/engines/private/metaengine.cpp
@@ -3,16 +3,16 @@
 
 class PrivateMetaEngine : public AdvancedMetaEngine {
 public:
-	const char *getName() const override {
-		return "private";
-	}
+    const char *getName() const override {
+        return "private";
+    }
 
-	Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
+    Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
 };
 
 Common::Error PrivateMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
-	*engine = new Private::PrivateEngine(syst);
-	return Common::kNoError;
+    *engine = new Private::PrivateEngine(syst);
+    return Common::kNoError;
 }
 
 #if PLUGIN_ENABLED_DYNAMIC(PRIVATE)
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index ac423a1282..8024ede4a9 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -29,336 +29,336 @@ PrivateEngine *g_private = NULL;
 extern int parse(char*);
 
 static const byte MOUSECURSOR_SCI[] = {
-	1,1,0,0,0,0,0,0,0,0,0,
-	1,2,1,0,0,0,0,0,0,0,0,
-	1,2,2,1,0,0,0,0,0,0,0,
-	1,2,2,2,1,0,0,0,0,0,0,
-	1,2,2,2,2,1,0,0,0,0,0,
-	1,2,2,2,2,2,1,0,0,0,0,
-	1,2,2,2,2,2,2,1,0,0,0,
-	1,2,2,2,2,2,2,2,1,0,0,
-	1,2,2,2,2,2,2,2,2,1,0,
-	1,2,2,2,2,2,2,2,2,2,1,
-	1,2,2,2,2,2,1,0,0,0,0,
-	1,2,1,0,1,2,2,1,0,0,0,
-	1,1,0,0,1,2,2,1,0,0,0,
-	0,0,0,0,0,1,2,2,1,0,0,
-	0,0,0,0,0,1,2,2,1,0,0,
-	0,0,0,0,0,0,1,2,2,1,0
+    1,1,0,0,0,0,0,0,0,0,0,
+    1,2,1,0,0,0,0,0,0,0,0,
+    1,2,2,1,0,0,0,0,0,0,0,
+    1,2,2,2,1,0,0,0,0,0,0,
+    1,2,2,2,2,1,0,0,0,0,0,
+    1,2,2,2,2,2,1,0,0,0,0,
+    1,2,2,2,2,2,2,1,0,0,0,
+    1,2,2,2,2,2,2,2,1,0,0,
+    1,2,2,2,2,2,2,2,2,1,0,
+    1,2,2,2,2,2,2,2,2,2,1,
+    1,2,2,2,2,2,1,0,0,0,0,
+    1,2,1,0,1,2,2,1,0,0,0,
+    1,1,0,0,1,2,2,1,0,0,0,
+    0,0,0,0,0,1,2,2,1,0,0,
+    0,0,0,0,0,1,2,2,1,0,0,
+    0,0,0,0,0,0,1,2,2,1,0
 };
 
 static const byte cursorPalette[] = {
-	0, 0, 0,           // Black / Transparent
-	0x80, 0x80, 0x80,  // Gray
-	0xff, 0xff, 0xff   // White
+    0, 0, 0,           // Black / Transparent
+    0x80, 0x80, 0x80,  // Gray
+    0xff, 0xff, 0xff   // White
 };
 
 PrivateEngine::PrivateEngine(OSystem *syst)
-	: Engine(syst) {
-	// Put your engine in a sane state, but do nothing big yet;
-	// in particular, do not load data from files; rather, if you
-	// need to do such things, do them from run().
+    : Engine(syst) {
+    // Put your engine in a sane state, but do nothing big yet;
+    // in particular, do not load data from files; rather, if you
+    // need to do such things, do them from run().
 
-	// Do not initialize graphics here
-	// Do not initialize audio devices here
+    // Do not initialize graphics here
+    // Do not initialize audio devices here
 
-	// However this is the place to specify all default directories
-	//const Common::FSNode gameDataDir(ConfMan.get("path"));
-        //SearchMan.addSubDirectoryMatching(gameDataDir, "..");
+    // However this is the place to specify all default directories
+    //const Common::FSNode gameDataDir(ConfMan.get("path"));
+    //SearchMan.addSubDirectoryMatching(gameDataDir, "..");
 
-	// Here is the right place to set up the engine specific debug channels
-	//DebugMan.addDebugChannel(kPrivateDebugExample, "example", "this is just an example for a engine specific debug channel");
-	//DebugMan.addDebugChannel(kPrivateDebugExample2, "example2", "also an example");
+    // Here is the right place to set up the engine specific debug channels
+    //DebugMan.addDebugChannel(kPrivateDebugExample, "example", "this is just an example for a engine specific debug channel");
+    //DebugMan.addDebugChannel(kPrivateDebugExample2, "example2", "also an example");
 
-	// Don't forget to register your random source
-	_rnd = new Common::RandomSource("private");
+    // Don't forget to register your random source
+    _rnd = new Common::RandomSource("private");
 
-	g_private = this;
+    g_private = this;
 
-        _nextSetting = NULL;
-        _nextMovie = NULL;
-        _modified = false;
-        _mode = -1;
+    _nextSetting = NULL;
+    _nextMovie = NULL;
+    _modified = false;
+    _mode = -1;
 
 }
 
 PrivateEngine::~PrivateEngine() {
-	debug("PrivateEngine::~PrivateEngine");
+    debug("PrivateEngine::~PrivateEngine");
 
-	// Dispose your resources here
-	delete _rnd;
+    // Dispose your resources here
+    delete _rnd;
 
-	// Remove all of our debug levels here
-	DebugMan.clearAllDebugChannels();
+    // Remove all of our debug levels here
+    DebugMan.clearAllDebugChannels();
 }
 
 Common::Error PrivateEngine::run() {
-	Common::File *file = new Common::File();
-	assert(file->open("GAME.DAT"));
-	void *buf = malloc(191000); 
-	file->read(buf, 191000);
-	initFuncs();
-	parse((char *) buf);
-	assert(constants.size() > 0);
-	       
-	// Initialize graphics using following:
-	_screenW = 640;
-	_screenH = 480;
-	//_pixelFormat = Graphics::PixelFormat::createFormatCLUT8();
-	_pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
-	initGraphics(_screenW, _screenH, &_pixelFormat);
-
-        CursorMan.replaceCursor(MOUSECURSOR_SCI, 11, 16, 0, 0, 0);
-	CursorMan.replaceCursorPalette(cursorPalette, 0, 3);
-
-	_image = new Image::BitmapDecoder();
-	_compositeSurface = new Graphics::ManagedSurface();
-  	_compositeSurface->create(_screenW, _screenH, _pixelFormat);
-	_compositeSurface->setTransparentColor(0x00ff00);
-
-	// You could use backend transactions directly as an alternative,
-	// but it isn't recommended, until you want to handle the error values
-	// from OSystem::endGFXTransaction yourself.
-	// This is just an example template:
-	//_system->beginGFXTransaction();
-	//	// This setup the graphics mode according to users seetings
-	//	initCommonGFX(false);
-	//
-	//	// Specify dimensions of game graphics window.
-	//	// In this example: 320x200
-	//	_system->initSize(320, 200);
-	//FIXME: You really want to handle
-	//OSystem::kTransactionSizeChangeFailed here
-	//_system->endGFXTransaction();
-
-	// Create debugger console. It requires GFX to be initialized
-	Console *console = new Console(this);
-	setDebugger(console);
-
-	// Additional setup.
-	debug("PrivateEngine::init");
-
-	// Your main even loop should be (invoked from) here.
-	//debug("PrivateEngine::go: Hello, World!");
-
-	// This test will show up if -d1 and --debugflags=example are specified on the commandline
-	//debugC(1, kPrivateDebugExample, "Example debug call");
-
-	// This test will show up if --debugflags=example or --debugflags=example2 or both of them and -d3 are specified on the commandline
-	//debugC(3, kPrivateDebugExample | kPrivateDebugExample2, "Example debug call two");
-
-	// Simple main event loop
-	Common::Event event;
-        Common::Point mousePos;
-        _videoDecoder = nullptr; //new Video::SmackerDecoder();
-
-	_nextSetting = new Common::String("kGoIntro");
-
-	while (!shouldQuit()) {
-		g_system->getEventManager()->pollEvent(event);
-	        mousePos = g_system->getEventManager()->getMousePos();
-	
-		g_system->delayMillis(10);
-
-		// Events
-		switch (event.type) {
-			case Common::EVENT_QUIT:
-			case Common::EVENT_RETURN_TO_LAUNCHER:
-				break;
-
-			case Common::EVENT_LBUTTONDOWN:
-				selectExit(mousePos);
-
-		}
-
-		// Movies
-		if (_nextMovie != NULL) {
-                    _videoDecoder = new Video::SmackerDecoder();
-                    playVideo(*_nextMovie);
-		    _nextMovie = NULL;
-		    continue;
-
-		}
-
-		if (_videoDecoder) {
-			stopSound();
-			if (_videoDecoder->endOfVideo()) {
-				_videoDecoder->close();
-				delete _videoDecoder;
-				_videoDecoder = nullptr;
-			} else if (_videoDecoder->needsUpdate()) {
-				drawScreen();
-			}
-			continue;
-		}
-
-		//if (_compositeSurface)
-		//	drawScreen();
-
-		if (_nextSetting != NULL) {
-			debug("Executing %s", _nextSetting->c_str());
-			_exits.clear();
-                        loadSetting(_nextSetting);
-			_nextSetting = NULL;
-                 	CursorMan.showMouse(false);
-			execute(prog);
-	                CursorMan.showMouse(true);
-
-
-		}
-
-		g_system->updateScreen();
-	
-	}
-
-	return Common::kNoError;
+    Common::File *file = new Common::File();
+    assert(file->open("GAME.DAT"));
+    void *buf = malloc(191000);
+    file->read(buf, 191000);
+    initFuncs();
+    parse((char *) buf);
+    assert(constants.size() > 0);
+
+    // Initialize graphics using following:
+    _screenW = 640;
+    _screenH = 480;
+    //_pixelFormat = Graphics::PixelFormat::createFormatCLUT8();
+    _pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
+    initGraphics(_screenW, _screenH, &_pixelFormat);
+
+    CursorMan.replaceCursor(MOUSECURSOR_SCI, 11, 16, 0, 0, 0);
+    CursorMan.replaceCursorPalette(cursorPalette, 0, 3);
+
+    _image = new Image::BitmapDecoder();
+    _compositeSurface = new Graphics::ManagedSurface();
+    _compositeSurface->create(_screenW, _screenH, _pixelFormat);
+    _compositeSurface->setTransparentColor(0x00ff00);
+
+    // You could use backend transactions directly as an alternative,
+    // but it isn't recommended, until you want to handle the error values
+    // from OSystem::endGFXTransaction yourself.
+    // This is just an example template:
+    //_system->beginGFXTransaction();
+    //	// This setup the graphics mode according to users seetings
+    //	initCommonGFX(false);
+    //
+    //	// Specify dimensions of game graphics window.
+    //	// In this example: 320x200
+    //	_system->initSize(320, 200);
+    //FIXME: You really want to handle
+    //OSystem::kTransactionSizeChangeFailed here
+    //_system->endGFXTransaction();
+
+    // Create debugger console. It requires GFX to be initialized
+    Console *console = new Console(this);
+    setDebugger(console);
+
+    // Additional setup.
+    debug("PrivateEngine::init");
+
+    // Your main even loop should be (invoked from) here.
+    //debug("PrivateEngine::go: Hello, World!");
+
+    // This test will show up if -d1 and --debugflags=example are specified on the commandline
+    //debugC(1, kPrivateDebugExample, "Example debug call");
+
+    // This test will show up if --debugflags=example or --debugflags=example2 or both of them and -d3 are specified on the commandline
+    //debugC(3, kPrivateDebugExample | kPrivateDebugExample2, "Example debug call two");
+
+    // Simple main event loop
+    Common::Event event;
+    Common::Point mousePos;
+    _videoDecoder = nullptr; //new Video::SmackerDecoder();
+
+    _nextSetting = new Common::String("kGoIntro");
+
+    while (!shouldQuit()) {
+        g_system->getEventManager()->pollEvent(event);
+        mousePos = g_system->getEventManager()->getMousePos();
+
+        g_system->delayMillis(10);
+
+        // Events
+        switch (event.type) {
+        case Common::EVENT_QUIT:
+        case Common::EVENT_RETURN_TO_LAUNCHER:
+            break;
+
+        case Common::EVENT_LBUTTONDOWN:
+            selectExit(mousePos);
+
+        }
+
+        // Movies
+        if (_nextMovie != NULL) {
+            _videoDecoder = new Video::SmackerDecoder();
+            playVideo(*_nextMovie);
+            _nextMovie = NULL;
+            continue;
+
+        }
+
+        if (_videoDecoder) {
+            stopSound();
+            if (_videoDecoder->endOfVideo()) {
+                _videoDecoder->close();
+                delete _videoDecoder;
+                _videoDecoder = nullptr;
+            } else if (_videoDecoder->needsUpdate()) {
+                drawScreen();
+            }
+            continue;
+        }
+
+        //if (_compositeSurface)
+        //	drawScreen();
+
+        if (_nextSetting != NULL) {
+            debug("Executing %s", _nextSetting->c_str());
+            _exits.clear();
+            loadSetting(_nextSetting);
+            _nextSetting = NULL;
+            CursorMan.showMouse(false);
+            execute(prog);
+            CursorMan.showMouse(true);
+
+
+        }
+
+        g_system->updateScreen();
+
+    }
+
+    return Common::kNoError;
 }
 
 void PrivateEngine::selectExit(Common::Point mousePos) {
-	Common::String *ns = NULL;
-	int rs = 1 << 31;
-	int cs = 0;
-
-	for (ExitList::const_iterator it = _exits.begin(); it != _exits.end(); ++it) {
-		const ExitInfo e = *it;
-		cs = e.rect->width()*e.rect->height(); 
-		if (e.rect->contains(mousePos)) {
-			debug("Exit %s %d", e.nextSetting->c_str(), cs);
-			if (cs < rs) {
-				rs = cs;
-				ns = e.nextSetting;
-			}
-
-		}
+    Common::String *ns = NULL;
+    int rs = 1 << 31;
+    int cs = 0;
+
+    for (ExitList::const_iterator it = _exits.begin(); it != _exits.end(); ++it) {
+        const ExitInfo e = *it;
+        cs = e.rect->width()*e.rect->height();
+        if (e.rect->contains(mousePos)) {
+            debug("Exit %s %d", e.nextSetting->c_str(), cs);
+            if (cs < rs) {
+                rs = cs;
+                ns = e.nextSetting;
+            }
+
         }
-	if (cs > 0)
-		_nextSetting = ns;
+    }
+    if (cs > 0)
+        _nextSetting = ns;
 }
 
 
 bool PrivateEngine::hasFeature(EngineFeature f) const {
-	return
-		(f == kSupportsReturnToLauncher) ||
-		(f == kSupportsLoadingDuringRuntime) ||
-		(f == kSupportsSavingDuringRuntime);
+    return
+        (f == kSupportsReturnToLauncher) ||
+        (f == kSupportsLoadingDuringRuntime) ||
+        (f == kSupportsSavingDuringRuntime);
 }
 
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
-	Common::Serializer s(stream, nullptr);
-	syncGameStream(s);
-	return Common::kNoError;
+    Common::Serializer s(stream, nullptr);
+    syncGameStream(s);
+    return Common::kNoError;
 }
 
 Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool isAutosave) {
-	Common::Serializer s(nullptr, stream);
-	syncGameStream(s);
-	return Common::kNoError;
+    Common::Serializer s(nullptr, stream);
+    syncGameStream(s);
+    return Common::kNoError;
 }
 
 void PrivateEngine::syncGameStream(Common::Serializer &s) {
-	// Use methods of Serializer to save/load fields
-	int dummy = 0;
-	s.syncAsUint16LE(dummy);
+    // Use methods of Serializer to save/load fields
+    int dummy = 0;
+    s.syncAsUint16LE(dummy);
 }
 
 Common::String PrivateEngine::convertPath(Common::String name) {
-	Common::String path(name);
-        Common::String s1("\\");
-        Common::String s2("/");
+    Common::String path(name);
+    Common::String s1("\\");
+    Common::String s2("/");
 
-	while (path.contains(s1))
-            Common::replace(path, s1, s2);
+    while (path.contains(s1))
+        Common::replace(path, s1, s2);
 
-        s1 = Common::String("\"");
-        s2 = Common::String("");
+    s1 = Common::String("\"");
+    s2 = Common::String("");
 
-        Common::replace(path, s1, s2);
-        Common::replace(path, s1, s2);
-	
-	path.toLowercase();
-	return path;
+    Common::replace(path, s1, s2);
+    Common::replace(path, s1, s2);
+
+    path.toLowercase();
+    return path;
 }
 
 void PrivateEngine::playSound(const Common::String &name) {
-	debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
+    debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
 
-	Common::File *file = new Common::File();
-        Common::String path = convertPath(name);
+    Common::File *file = new Common::File();
+    Common::String path = convertPath(name);
 
-	if (!file->open(path))
-		error("unable to find sound file %s", path.c_str());
+    if (!file->open(path))
+        error("unable to find sound file %s", path.c_str());
 
-	Audio::AudioStream *stream;
-	stream = Audio::makeWAVStream(file, DisposeAfterUse::YES);
-	stopSound();
-	_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream, -1, Audio::Mixer::kMaxChannelVolume);
+    Audio::AudioStream *stream;
+    stream = Audio::makeWAVStream(file, DisposeAfterUse::YES);
+    stopSound();
+    _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream, -1, Audio::Mixer::kMaxChannelVolume);
 }
 
 void PrivateEngine::playVideo(const Common::String &name) {
-	debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
-	Common::File *file = new Common::File();
-        Common::String path = convertPath(name);
+    debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
+    Common::File *file = new Common::File();
+    Common::String path = convertPath(name);
 
-	if (!file->open(path))
-		error("unable to find video file %s", path.c_str());
+    if (!file->open(path))
+        error("unable to find video file %s", path.c_str());
 
-	if (!_videoDecoder->loadStream(file))
-	        error("unable to load video %s", path.c_str());
-	_videoDecoder->start();
+    if (!_videoDecoder->loadStream(file))
+        error("unable to load video %s", path.c_str());
+    _videoDecoder->start();
 
 }
 
 void PrivateEngine::stopSound() {
-	debugC(3, kPrivateDebugExample, "%s", __FUNCTION__);
-	if (_mixer->isSoundHandleActive(_soundHandle))
-		_mixer->stopHandle(_soundHandle);
+    debugC(3, kPrivateDebugExample, "%s", __FUNCTION__);
+    if (_mixer->isSoundHandleActive(_soundHandle))
+        _mixer->stopHandle(_soundHandle);
 }
 
 void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
-	debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
-	Common::File file;
-	Common::String path = convertPath(name);
-	if (!file.open(path))
-		error("unable to load image %s", path.c_str());
-
-	_image->loadStream(file);
-	//debug("palette %d %d", _image->getPaletteStartIndex(), _image->getPaletteColorCount());
-        //for (int i = 0; i < 30; i=i+3) 
-	//    debug("%x %x %x", *(_image->getPalette()+i), *(_image->getPalette()+i+1), *(_image->getPalette()+i+2));
-
-	_compositeSurface->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), Common::Point(x,y), _pixelFormat.RGBToColor(0,255,0)); 
-	drawScreen();
+    debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
+    Common::File file;
+    Common::String path = convertPath(name);
+    if (!file.open(path))
+        error("unable to load image %s", path.c_str());
+
+    _image->loadStream(file);
+    //debug("palette %d %d", _image->getPaletteStartIndex(), _image->getPaletteColorCount());
+    //for (int i = 0; i < 30; i=i+3)
+    //    debug("%x %x %x", *(_image->getPalette()+i), *(_image->getPalette()+i+1), *(_image->getPalette()+i+2));
+
+    _compositeSurface->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), Common::Point(x,y), _pixelFormat.RGBToColor(0,255,0));
+    drawScreen();
 }
 
 
 void PrivateEngine::drawScreen() {
-	if (_videoDecoder ? _videoDecoder->needsUpdate() : false || _compositeSurface) {
-		Graphics::Surface *screen = g_system->lockScreen();
-		//screen->fillRect(Common::Rect(0, 0, g_system->getWidth(), g_system->getHeight()), 0);
-
-		Graphics::ManagedSurface *surface = _compositeSurface;
-
-                if (_videoDecoder) {
-			Graphics::Surface *frame = new Graphics::Surface;
-			frame->create(_screenW, _screenH, _pixelFormat);
-			frame->copyFrom(*_videoDecoder->decodeNextFrame());
-                        surface->transBlitFrom(*frame->convertTo(_pixelFormat, _videoDecoder->getPalette())); 
-		}	
-
-		int w = surface->w; //CLIP<int>(surface->w, 0, _screenW);
-		int h = surface->h; //CLIP<int>(surface->h, 0, _screenH);
-                assert(w == _screenW && h == _screenH);
-
-		screen->copyRectToSurface(*surface, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
-
-		g_system->unlockScreen();
-                //if (_image->getPalette() != nullptr)
-	        //    g_system->getPaletteManager()->setPalette(_image->getPalette(), _image->getPaletteStartIndex(), _image->getPaletteColorCount());
-		//if (_image->getPalette() != nullptr)
-		//	g_system->getPaletteManager()->setPalette(_image->getPalette(), 0, 256);
-	        //g_system->getPaletteManager()->setPalette(_videoDecoder->getPalette(), 0, 256);	
-		g_system->updateScreen();
-	}
+    if (_videoDecoder ? _videoDecoder->needsUpdate() : false || _compositeSurface) {
+        Graphics::Surface *screen = g_system->lockScreen();
+        //screen->fillRect(Common::Rect(0, 0, g_system->getWidth(), g_system->getHeight()), 0);
+
+        Graphics::ManagedSurface *surface = _compositeSurface;
+
+        if (_videoDecoder) {
+            Graphics::Surface *frame = new Graphics::Surface;
+            frame->create(_screenW, _screenH, _pixelFormat);
+            frame->copyFrom(*_videoDecoder->decodeNextFrame());
+            surface->transBlitFrom(*frame->convertTo(_pixelFormat, _videoDecoder->getPalette()));
+        }
+
+        int w = surface->w; //CLIP<int>(surface->w, 0, _screenW);
+        int h = surface->h; //CLIP<int>(surface->h, 0, _screenH);
+        assert(w == _screenW && h == _screenH);
+
+        screen->copyRectToSurface(*surface, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
+
+        g_system->unlockScreen();
+        //if (_image->getPalette() != nullptr)
+        //    g_system->getPaletteManager()->setPalette(_image->getPalette(), _image->getPaletteStartIndex(), _image->getPaletteColorCount());
+        //if (_image->getPalette() != nullptr)
+        //	g_system->getPaletteManager()->setPalette(_image->getPalette(), 0, 256);
+        //g_system->getPaletteManager()->setPalette(_videoDecoder->getPalette(), 0, 256);
+        g_system->updateScreen();
+    }
 }
 
 
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 6728bdd12e..c0b9270a37 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -10,63 +10,63 @@ StringQueue stringToDefine;
 RectQueue rectToDefine;
 
 void define(char *n, Common::Rect *r) {
-        Common::String *s = new Common::String(n);
-        stringToDefine.push(*s);
-        rectToDefine.push(r);
+    Common::String *s = new Common::String(n);
+    stringToDefine.push(*s);
+    rectToDefine.push(r);
 }
 
 char *emalloc(unsigned n)	/* check return from malloc */
 {
-	char *p;
+    char *p;
 
-	p = (char*) malloc(n);
-	assert(p != NULL);
-	return p;
+    p = (char*) malloc(n);
+    assert(p != NULL);
+    return p;
 }
 
 void showSymbol(Symbol *s)
 {
-        if (s->type == NUM)
-		debug("%s %d",s->name->c_str(), s->u.val);
-	else if (s->type == STRING) 
-		debug("%s %s", s->name->c_str(), s->u.str);
-	else if (s->type == NAME)
-		debug("%s",s->name->c_str());
-	else
-	        debug("%s %d", s->name->c_str(), s->type);
+    if (s->type == NUM)
+        debug("%s %d",s->name->c_str(), s->u.val);
+    else if (s->type == STRING)
+        debug("%s %s", s->name->c_str(), s->u.str);
+    else if (s->type == NAME)
+        debug("%s",s->name->c_str());
+    else
+        debug("%s %d", s->name->c_str(), s->type);
 }
 
 
 Symbol *lookup(Common::String s, SymbolMap symlist)	/* find s in symbol table symlist */
 {
-        //debug("looking up %s", s.c_str());	
-	return symlist.getVal(s);
+    //debug("looking up %s", s.c_str());
+    return symlist.getVal(s);
 }
 
 Symbol *lookupName(char *n)  /* install s in some symbol table */
 {
-	//debug("looking up %s", n);
-        Common::String *s = new Common::String(n);
- 
-        if (settings.contains(*s))
-	    return lookup(*s, settings);
+    //debug("looking up %s", n);
+    Common::String *s = new Common::String(n);
 
-	else if (variables.contains(*s))
-	    return lookup(*s, variables);
+    if (settings.contains(*s))
+        return lookup(*s, settings);
 
-	else if (cursors.contains(*s))
-	    return lookup(*s, cursors);
+    else if (variables.contains(*s))
+        return lookup(*s, variables);
 
-	else if (locations.contains(*s))
-	    return lookup(*s, locations);
+    else if (cursors.contains(*s))
+        return lookup(*s, cursors);
 
-	else if (rects.contains(*s))
-	    return lookup(*s, rects);
+    else if (locations.contains(*s))
+        return lookup(*s, locations);
 
-	else {
-	    debug("WARNING: %s not defined", n);
-	    return addconstant(NAME, 0, n);
-	}
+    else if (rects.contains(*s))
+        return lookup(*s, rects);
+
+    else {
+        debug("WARNING: %s not defined", n);
+        return addconstant(NAME, 0, n);
+    }
 
 }
 
@@ -74,88 +74,88 @@ Symbol *lookupName(char *n)  /* install s in some symbol table */
 
 
 void installall(char *n) {
-        Common::String *s;
-	Common::Rect *r;
-
-	assert(stringToDefine.size() > 0);
-
-	while (!stringToDefine.empty()) {
-	       s = new Common::String(stringToDefine.pop());
-	       r = rectToDefine.pop();
-
- 	       //debug("name %s", s->c_str());
-	       if (strcmp(n, "settings") == 0) {
-		   assert(r == NULL);
-	           install(s, STRING, 0, (char*) s->c_str(), r, &settings);
-               }
-
-	       else if (strcmp(n, "variables") == 0) {
-                   assert(r == NULL);
-	           install(s, NAME, 0, NULL, r, &variables);
-               }
-
-	       else if (strcmp(n, "cursors") == 0) {
-                   assert(r == NULL);
-	           install(s, NAME, 0, NULL, r, &cursors);
-               }
-
-	       else if (strcmp(n, "locations") == 0) {
-                   assert(r == NULL);
-	           install(s, NAME, 0, NULL, r, &locations);
-               }
-
-	       else if (strcmp(n, "rects") == 0) {
-                   assert(r != NULL);
-	           install(s, NAME, 0, NULL, r, &rects);
-               }
-	       else
-		   assert(0);
+    Common::String *s;
+    Common::Rect *r;
+
+    assert(stringToDefine.size() > 0);
+
+    while (!stringToDefine.empty()) {
+        s = new Common::String(stringToDefine.pop());
+        r = rectToDefine.pop();
+
+        //debug("name %s", s->c_str());
+        if (strcmp(n, "settings") == 0) {
+            assert(r == NULL);
+            install(s, STRING, 0, (char*) s->c_str(), r, &settings);
+        }
+
+        else if (strcmp(n, "variables") == 0) {
+            assert(r == NULL);
+            install(s, NAME, 0, NULL, r, &variables);
+        }
+
+        else if (strcmp(n, "cursors") == 0) {
+            assert(r == NULL);
+            install(s, NAME, 0, NULL, r, &cursors);
+        }
+
+        else if (strcmp(n, "locations") == 0) {
+            assert(r == NULL);
+            install(s, NAME, 0, NULL, r, &locations);
+        }
+
+        else if (strcmp(n, "rects") == 0) {
+            assert(r != NULL);
+            install(s, NAME, 0, NULL, r, &rects);
+        }
+        else
+            assert(0);
 
-	}	   
+    }
 
 }
 
-Symbol *addconstant(int t, int d, char *s) 
+Symbol *addconstant(int t, int d, char *s)
 {
-	Symbol *sp;
-        Common::String *n = new Common::String("<constant>");
-
-	sp = (Symbol *) emalloc(sizeof(Symbol));
-	sp->name = n; 
-	sp->type = t;
-	if (t == NUM || t == NAME)
-	   sp->u.val = d;
-	else if (t == STRING)
-	   sp->u.str = s;
-        else
-	   assert(0);
-
-	constants.push_front(sp);
-	return sp;
+    Symbol *sp;
+    Common::String *n = new Common::String("<constant>");
+
+    sp = (Symbol *) emalloc(sizeof(Symbol));
+    sp->name = n;
+    sp->type = t;
+    if (t == NUM || t == NAME)
+        sp->u.val = d;
+    else if (t == STRING)
+        sp->u.str = s;
+    else
+        assert(0);
+
+    constants.push_front(sp);
+    return sp;
 }
 
 
 Symbol *install(Common::String *n, int t, int d, char *s, Common::Rect *r, SymbolMap *symlist)  /* install s in symbol table */
 {
-        Common::String *name = new Common::String(*n);
- 
-	Symbol *sp;
-
-	sp = (Symbol *) emalloc(sizeof(Symbol));
-        sp->name = name;
-	sp->type = t;
-	if (t == NUM || t == NAME)
-	   sp->u.val = d;
-	else if (t == STRING)
-	   sp->u.str = s;
-	else if (t == RECT)
-	   sp->u.rect = r;
-        else
-	   assert(0);
-
-        symlist->setVal(*n, sp);
-	assert(symlist->size() > 0);
-	return sp;
+    Common::String *name = new Common::String(*n);
+
+    Symbol *sp;
+
+    sp = (Symbol *) emalloc(sizeof(Symbol));
+    sp->name = name;
+    sp->type = t;
+    if (t == NUM || t == NAME)
+        sp->u.val = d;
+    else if (t == STRING)
+        sp->u.str = s;
+    else if (t == RECT)
+        sp->u.rect = r;
+    else
+        assert(0);
+
+    symlist->setVal(*n, sp);
+    assert(symlist->size() > 0);
+    return sp;
 }
 
-} 
+}


Commit: f5c4e7e6cb4ee0d8b929b54c23ef429fd994bb28
    https://github.com/scummvm/scummvm/commit/f5c4e7e6cb4ee0d8b929b54c23ef429fd994bb28
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: more code

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/grammar.l
    engines/private/grammar.y
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index ce08164a15..b587ea1b8a 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -78,7 +78,7 @@ void loadSetting(Common::String *name)
     progp = prog;
 
 
-    for (Inst *pc_ = progp; pc_-progp < 100; pc_++) {
+    /*for (Inst *pc_ = progp; pc_-progp < 100; pc_++) {
         if (_functions.contains((void *) *pc_))
             debug("%p: %s", (void*) pc_, _functions.getVal((void*) *pc_)->c_str());
         else if ( (Inst *) *pc_ >= progp && (Inst *) *pc_ <= (progp + NPROG))
@@ -87,8 +87,7 @@ void loadSetting(Common::String *name)
             debugN("%p:", (void*) pc_);
             showSymbol((Symbol *) *pc_);
         }
-
-    }
+    }*/
 }
 
 
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index d9ad5c704e..a4fc91671a 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -14,8 +14,26 @@ void ChgMode(ArgArray args) {
     g_private->_mode = args[0].u.val;
     Common::String *s = new Common::String(args[1].u.str);
     g_private->_nextSetting = s;
+
+    if (g_private->_mode == 0) {
+        g_private->_origin->x = 0;
+        g_private->_origin->y = 0;
+    } 
+    else if (g_private->_mode == 1) {
+        g_private->_origin->x = 63;
+        g_private->_origin->y = 48;
+    }
+    else
+        assert(0);
+}
+
+void VSPicture(ArgArray args) {
+    // assert types
+    debug("VSPicture(%s)", args[0].u.str);
+    g_private->_nextVS = new Common::String(args[0].u.str);
 }
 
+
 void Goto(ArgArray args) { // should be goto, but this is a reserved word
     // assert types
     debug("goto(%s)", args[0].u.str);
@@ -29,6 +47,15 @@ void Quit(ArgArray args) {
 }
 
 
+void RestartGame(ArgArray args) {
+    // assert types
+    debug("WARNING: RestartGame is not implemented");
+}
+
+void DossierAdd(ArgArray args) {
+    // assert types
+    debug("WARNING: DossierAdd is not implemented");
+}
 
 void SetFlag(ArgArray args) {
     // assert types
@@ -39,16 +66,23 @@ void SetFlag(ArgArray args) {
 void Exit(ArgArray args) {
     // assert types
     assert(args[2].type == RECT || args[2].type == NAME);
-    debug("Exit(%s, %s, %s)", args[0].u.str, args[1].u.sym->name->c_str(), "RECT");
+    debug("Exit(..)"); //, args[0].u.str, args[1].u.sym->name->c_str(), "RECT");
     ExitInfo *e = (ExitInfo*) malloc(sizeof(ExitInfo));
-    e->nextSetting = new Common::String(args[0].u.str);
-    e->cursor = args[1].u.sym->name;
+
+    if (args[0].type == NUM && args[0].u.val == 0)
+        e->nextSetting = NULL;
+    else
+        e->nextSetting = new Common::String(args[0].u.str);
+
+    if (args[1].type == NUM && args[1].u.val == 0)
+        e->cursor = NULL;
+    else
+        e->cursor = args[1].u.sym->name;
+
     e->rect = args[2].u.rect;
     g_private->_exits.push_front(*e);
 }
 
-
-
 void SetModifiedFlag(ArgArray args) {
     // assert types
     debug("SetModifiedFlag(%d)", args[0].u.val);
@@ -71,11 +105,20 @@ void Sound(ArgArray args) {
 void Transition(ArgArray args) {
     // assert types
     debug("Transition(%s, %s)", args[0].u.str, args[1].u.str);
-    g_private->_nextMovie = new Common::String(args[0].u.str);
+    //g_private->_nextMovie = new Common::String(args[0].u.str);
+    g_private->_nextSetting = new Common::String(args[1].u.str);
+}
+
+void Movie(ArgArray args) {
+    // assert types
+    debug("Movie(%s, %s)", args[0].u.str, args[1].u.str);
+    if (strcmp(args[0].u.str, "\"\"") != 0)
+        g_private->_nextMovie = new Common::String(args[0].u.str);
     g_private->_nextSetting = new Common::String(args[1].u.str);
 }
 
 
+
 void CRect(ArgArray args) {
     // assert types
     int x1, y1, x2, y2;
@@ -113,6 +156,36 @@ void Bitmap(ArgArray args) {
     g_private->loadImage(*s, x, y);
 }
 
+void Mask(ArgArray args, bool drawn) {
+    assert(args.size() == 3 || args.size() == 5);
+
+    int x = 0;
+    int y = 0;
+
+    char *f = args[0].u.str;
+    char *e = args[1].u.str;
+    Common::String *c = args[2].u.sym->name;
+    
+    if (args.size() == 5) {
+        x = args[3].u.val;
+        y = args[4].u.val;
+    }
+
+    debug("Mask(%s, %s, %s, %d, %d)", f, e, c->c_str(), x, y);
+    const Common::String *s = new Common::String(f);
+    //if (drawed)
+    //    g_private->loadImage(*s, x, y);
+
+    MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+    m->surf = g_private->loadMask(*s, x, y, drawn);
+    m->nextSetting = new Common::String(e);
+    m->cursor = c;
+    m->point = new Common::Point(x,y);
+    g_private->_masks.push_front(*m);
+
+}
+
+
 void Timer(ArgArray args) {
     debug("Timer(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.str);
     g_system->delayMillis(100 * args[0].u.val);
@@ -138,12 +211,22 @@ void execFunction(char *name, ArgArray args) {
     else if (strcmp(name, "Bitmap") == 0) {
         Bitmap(args);
     }
+    else if (strcmp(name, "Mask") == 0) {
+        Mask(args, false);
+    }
+    else if (strcmp(name, "MaskDrawn") == 0) {
+        Mask(args, true);
+    }
+ 
     else if (strcmp(name, "Timer") == 0) {
         Timer(args);
     }
     else if (strcmp(name, "Transition") == 0) {
         Transition(args);
     }
+    else if (strcmp(name, "Movie") == 0) {
+        Movie(args);
+    }
     else if (strcmp(name, "SetModifiedFlag") == 0) {
         SetModifiedFlag(args);
     }
@@ -156,9 +239,18 @@ void execFunction(char *name, ArgArray args) {
     else if (strcmp(name, "LoadGame") == 0) {
         ;
     }
+    else if (strcmp(name, "DossierAdd") == 0) {
+        DossierAdd(args);
+    }
+    else if (strcmp(name, "VSPicture") == 0) {
+        VSPicture(args);
+    }
     else if (strcmp(name, "CRect") == 0) {
         CRect(args);
     }
+    else if (strcmp(name, "RestartGame") == 0) {
+        RestartGame(args);
+    }
     else {
         debug("I don't know how to exec %s", name);
         assert(0);
diff --git a/engines/private/grammar.l b/engines/private/grammar.l
index 0703a55e29..462d9d5081 100644
--- a/engines/private/grammar.l
+++ b/engines/private/grammar.l
@@ -29,6 +29,7 @@ goto                    return GOTOTOK;
 RECT                    return RECT;
 FALSE                   return FALSETOK;
 TRUE                    return TRUETOK;
+NULL                    return NULLTOK;
 Random                  return RANDOMTOK;
 [A-Za-z_][A-Za-z_0-9]*  yylval.s = strdup(yytext); return NAME;
 [\-]?[0-9]+             yylval.sym = Private::addconstant(NUM, atoi(yytext), NULL); return NUM;
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 0911c7d06b..2a67f65d2c 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -46,7 +46,7 @@ int yywrap()
 %token<s> NAME
 %token<sym> STRING NUM
 %type <inst> body if startp cond end expr statements statement fcall value
-%token LTE GTE NEQ EQ FALSETOK TRUETOK IFTOK ELSETOK RECT GOTOTOK DEBUGTOK DEFINETOK SETTINGTOK RANDOMTOK 
+%token LTE GTE NEQ EQ FALSETOK TRUETOK NULLTOK IFTOK ELSETOK RECT GOTOTOK DEBUGTOK DEFINETOK SETTINGTOK RANDOMTOK 
 %type<narg> params
 
 %%
@@ -136,7 +136,8 @@ params:   /* nothing */     { $$ = 0; }
         | fcall       { $$ = 1; }
         ;
 
-value:    FALSETOK { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL)); }
+value:    NULLTOK  { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL)); }
+        | FALSETOK { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL)); }
         | TRUETOK  { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL)); }
         |  NUM     { code2(Private::constpush, (Private::Inst)$NUM); }
         | STRING   { code2(Private::strpush, (Private::Inst)$STRING); }
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 8024ede4a9..2b629f85ef 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -106,15 +106,17 @@ Common::Error PrivateEngine::run() {
     _screenH = 480;
     //_pixelFormat = Graphics::PixelFormat::createFormatCLUT8();
     _pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
+    _transparentColor = _pixelFormat.RGBToColor(0,255,0);
     initGraphics(_screenW, _screenH, &_pixelFormat);
 
     CursorMan.replaceCursor(MOUSECURSOR_SCI, 11, 16, 0, 0, 0);
     CursorMan.replaceCursorPalette(cursorPalette, 0, 3);
 
+    _origin = new Common::Point(0, 0);
     _image = new Image::BitmapDecoder();
     _compositeSurface = new Graphics::ManagedSurface();
     _compositeSurface->create(_screenW, _screenH, _pixelFormat);
-    _compositeSurface->setTransparentColor(0x00ff00);
+    _compositeSurface->setTransparentColor(_transparentColor);
 
     // You could use backend transactions directly as an alternative,
     // but it isn't recommended, until you want to handle the error values
@@ -162,12 +164,17 @@ Common::Error PrivateEngine::run() {
 
         // Events
         switch (event.type) {
-        case Common::EVENT_QUIT:
-        case Common::EVENT_RETURN_TO_LAUNCHER:
-            break;
+            case Common::EVENT_QUIT:
+            case Common::EVENT_RETURN_TO_LAUNCHER:
+                break;
 
-        case Common::EVENT_LBUTTONDOWN:
-            selectExit(mousePos);
+            case Common::EVENT_LBUTTONDOWN:
+                selectMask(mousePos);
+		selectExit(mousePos);
+	        break;
+
+	    default:
+	        {}
 
         }
 
@@ -198,6 +205,7 @@ Common::Error PrivateEngine::run() {
         if (_nextSetting != NULL) {
             debug("Executing %s", _nextSetting->c_str());
             _exits.clear();
+            _masks.clear();
             loadSetting(_nextSetting);
             _nextSetting = NULL;
             CursorMan.showMouse(false);
@@ -215,26 +223,54 @@ Common::Error PrivateEngine::run() {
 }
 
 void PrivateEngine::selectExit(Common::Point mousePos) {
+    //debug("Mousepos %d %d", mousePos.x, mousePos.y); 
     Common::String *ns = NULL;
-    int rs = 1 << 31;
+    int rs = 100000000;
     int cs = 0;
-
-    for (ExitList::const_iterator it = _exits.begin(); it != _exits.end(); ++it) {
-        const ExitInfo e = *it;
-        cs = e.rect->width()*e.rect->height();
+    ExitInfo e;
+    for (ExitList::iterator it = _exits.begin(); it != _exits.end(); ++it) {
+        e = *it;
+    	cs = e.rect->width()*e.rect->height();
+        //debug("Testing exit %s %d", e.nextSetting->c_str(), cs);
         if (e.rect->contains(mousePos)) {
-            debug("Exit %s %d", e.nextSetting->c_str(), cs);
-            if (cs < rs) {
+	    //debug("Inside! %d %d", cs, rs);
+            if (cs < rs && e.nextSetting != NULL) { // TODO: check this
+                debug("Found Exit %s %d", e.nextSetting->c_str(), cs);
                 rs = cs;
                 ns = e.nextSetting;
             }
 
         }
     }
-    if (cs > 0)
+    if (ns != NULL) {
+        debug("Exit selected %s", ns->c_str());
         _nextSetting = ns;
+    }
 }
 
+void PrivateEngine::selectMask(Common::Point mousePos) {
+    //debug("Mousepos %d %d", mousePos.x, mousePos.y); 
+    Common::String *ns = NULL;
+    MaskInfo m;
+    for (MaskList::iterator it = _masks.begin(); it != _masks.end(); ++it) {
+        m = *it;
+	
+        debug("Testing mask %s", m.nextSetting->c_str());
+        if ( *((uint32*) m.surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
+	    debug("Inside!");
+            if (m.nextSetting != NULL) { // TODO: check this
+                debug("Found Mask %s", m.nextSetting->c_str());
+                ns = m.nextSetting;
+		break;
+            }
+
+        }
+    }
+    if (ns != NULL) {
+        debug("Mask selected %s", ns->c_str());
+        _nextSetting = ns;
+    }
+}
 
 bool PrivateEngine::hasFeature(EngineFeature f) const {
     return
@@ -295,7 +331,7 @@ void PrivateEngine::playSound(const Common::String &name) {
 }
 
 void PrivateEngine::playVideo(const Common::String &name) {
-    debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
+    debug("%s : %s", __FUNCTION__, name.c_str());
     Common::File *file = new Common::File();
     Common::String path = convertPath(name);
 
@@ -326,10 +362,32 @@ void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
     //for (int i = 0; i < 30; i=i+3)
     //    debug("%x %x %x", *(_image->getPalette()+i), *(_image->getPalette()+i+1), *(_image->getPalette()+i+2));
 
-    _compositeSurface->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), Common::Point(x,y), _pixelFormat.RGBToColor(0,255,0));
+    _compositeSurface->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), Common::Point(x,y), _transparentColor);
     drawScreen();
 }
 
+Graphics::ManagedSurface *PrivateEngine::loadMask(const Common::String &name, int x, int y, bool drawn) {
+    debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
+    Common::File file;
+    Common::String path = convertPath(name);
+    if (!file.open(path))
+        error("unable to load mask %s", path.c_str());
+
+    _image->loadStream(file);
+    Graphics::ManagedSurface *surf = new Graphics::ManagedSurface();
+    surf->create(_screenW, _screenH, _pixelFormat);
+    surf->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), Common::Point(x,y));
+
+    if (drawn) {
+        _compositeSurface->transBlitFrom(surf->rawSurface(), Common::Point(x,y), _transparentColor);
+        drawScreen();
+    }
+
+    return surf; 
+}
+
+
+
 
 void PrivateEngine::drawScreen() {
     if (_videoDecoder ? _videoDecoder->needsUpdate() : false || _compositeSurface) {
@@ -342,7 +400,8 @@ void PrivateEngine::drawScreen() {
             Graphics::Surface *frame = new Graphics::Surface;
             frame->create(_screenW, _screenH, _pixelFormat);
             frame->copyFrom(*_videoDecoder->decodeNextFrame());
-            surface->transBlitFrom(*frame->convertTo(_pixelFormat, _videoDecoder->getPalette()));
+            const Common::Point o(_origin->x, _origin->y);
+            surface->transBlitFrom(*frame->convertTo(_pixelFormat, _videoDecoder->getPalette()), o);
         }
 
         int w = surface->w; //CLIP<int>(surface->w, 0, _screenW);
diff --git a/engines/private/private.h b/engines/private/private.h
index 8288b4f7d4..704fc02a3f 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -41,8 +41,15 @@ typedef struct ExitInfo {
     Common::String *cursor;    
 } ExitInfo;
 
-typedef Common::List<ExitInfo> ExitList;  
+typedef struct MaskInfo {
+    Graphics::ManagedSurface *surf;
+    Common::String *nextSetting;
+    Common::Point *point;
+    Common::String *cursor;    
+} MaskInfo;
 
+typedef Common::List<ExitInfo> ExitList;  
+typedef Common::List<MaskInfo> MaskList;  
 
 class PrivateEngine : public Engine {
 private:
@@ -64,6 +71,7 @@ public:
 	//Mohawk::InstallerArchive _installerArchive;
 
 	Common::Error run() override;
+	void selectMask(Common::Point);
         void selectExit(Common::Point); 
 	bool hasFeature(EngineFeature f) const override;
 	bool canLoadGameStateCurrently() override { return true; }
@@ -77,15 +85,23 @@ public:
 	void playVideo(const Common::String &name);	
 	void stopSound();
 
-	void loadImage(const Common::String &name, int x, int y);	
+	void loadImage(const Common::String &, int, int);
+        Graphics::ManagedSurface *loadMask(const Common::String &, int, int, bool);
+ 
+        uint32 _transparentColor;	
 	void drawScreen();
 
         // global state
+	Common::Point *_origin;
         Common::String *_nextSetting;
-        int _mode;
+        Common::String *_nextVS;
+
+	int _mode;
         bool _modified;
         Common::String *_nextMovie;
         ExitList _exits;
+        MaskList _masks;
+
 };
 
 extern PrivateEngine *g_private;


Commit: f2cb78991849f2a6a574dea656aa446e7a96430d
    https://github.com/scummvm/scummvm/commit/f2cb78991849f2a6a574dea656aa446e7a96430d
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: more code

Changed paths:
    engines/private/code.cpp
    engines/private/detection.cpp
    engines/private/funcs.cpp
    engines/private/grammar.h
    engines/private/grammar.y
    engines/private/private.cpp
    engines/private/private.h
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index b587ea1b8a..000f33c959 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -171,6 +171,9 @@ int eval()		/* evaluate variable on stack */
     } else if (d.u.sym->type == STRING) {
         d.type = STRING;
         d.u.str = d.u.sym->u.str;
+    } else if (d.u.sym->type == RECT) {
+        d.type = RECT;
+        d.u.rect = d.u.sym->u.rect;
     } else if (d.u.sym->type == NAME) {
         //debug("NAME %s", d.sym->name->c_str());
         //d.sym = d.sym;
@@ -188,6 +191,23 @@ int add()		/* add top two elems on stack */
     Datum d1, d2;
     d2 = pop();
     d1 = pop();
+    if (d1.type == NAME) {
+	//char *name =  d1.u.sym->name->c_str();     
+        //debug("eval %s to %d", 
+	d1.u.val = d1.u.sym->u.val;
+	d1.type = NUM;
+    }
+
+    if (d2.type == NAME) {
+	//char *name =  d1.u.sym->name->c_str();     
+        //debug("eval %s to %d", 
+	d2.u.val = d2.u.sym->u.val;
+	d2.type = NUM;
+    }
+
+    assert(d1.type == NUM);
+    assert(d2.type == NUM);
+
     //printf("adding %d %d\n",d1.val, d2.val);
     d1.u.val += d2.u.val;
     push(d1);
@@ -234,6 +254,21 @@ int gt()
     Datum d1, d2;
     d2 = pop();
     d1 = pop();
+    if (d1.type == NAME) {
+	//char *name =  d1.u.sym->name->c_str();     
+        //debug("eval %s to %d", 
+	d1.u.val = d1.u.sym->u.val;
+	d1.type = NUM;
+    }
+
+    if (d2.type == NAME) {
+	//char *name =  d1.u.sym->name->c_str();     
+        //debug("eval %s to %d", 
+	d2.u.val = d2.u.sym->u.val;
+	d2.type = NUM;
+    }
+
+
     d1.u.val = (int)(d1.u.val > d2.u.val);
     push(d1);
     return 0;
@@ -244,6 +279,21 @@ int lt()
     Datum d1, d2;
     d2 = pop();
     d1 = pop();
+    if (d1.type == NAME) {
+	//char *name =  d1.u.sym->name->c_str();     
+        //debug("eval %s to %d", 
+	d1.u.val = d1.u.sym->u.val;
+	d1.type = NUM;
+    }
+
+    if (d2.type == NAME) {
+	//char *name =  d1.u.sym->name->c_str();     
+        //debug("eval %s to %d", 
+	d2.u.val = d2.u.sym->u.val;
+	d2.type = NUM;
+    }
+
+
     d1.u.val = (int)(d1.u.val < d2.u.val);
     push(d1);
     return 0;
@@ -254,6 +304,21 @@ int ge()
     Datum d1, d2;
     d2 = pop();
     d1 = pop();
+    if (d1.type == NAME) {
+	//char *name =  d1.u.sym->name->c_str();     
+        //debug("eval %s to %d", 
+	d1.u.val = d1.u.sym->u.val;
+	d1.type = NUM;
+    }
+
+    if (d2.type == NAME) {
+	//char *name =  d1.u.sym->name->c_str();     
+        //debug("eval %s to %d", 
+	d2.u.val = d2.u.sym->u.val;
+	d2.type = NUM;
+    }
+
+
     d1.u.val = (int)(d1.u.val >= d2.u.val);
     push(d1);
     return 0;
@@ -264,6 +329,21 @@ int le()
     Datum d1, d2;
     d2 = pop();
     d1 = pop();
+    if (d1.type == NAME) {
+	//char *name =  d1.u.sym->name->c_str();     
+        //debug("eval %s to %d", 
+	d1.u.val = d1.u.sym->u.val;
+	d1.type = NUM;
+    }
+
+    if (d2.type == NAME) {
+	//char *name =  d1.u.sym->name->c_str();     
+        //debug("eval %s to %d", 
+	d2.u.val = d2.u.sym->u.val;
+	d2.type = NUM;
+    }
+
+
     d1.u.val = (int)(d1.u.val <= d2.u.val);
     push(d1);
     return 0;
@@ -274,6 +354,21 @@ int eq()
     Datum d1, d2;
     d2 = pop();
     d1 = pop();
+    if (d1.type == NAME) {
+	//char *name =  d1.u.sym->name->c_str();     
+        //debug("eval %s to %d", 
+	d1.u.val = d1.u.sym->u.val;
+	d1.type = NUM;
+    }
+
+    if (d2.type == NAME) {
+	//char *name =  d1.u.sym->name->c_str();     
+        //debug("eval %s to %d", 
+	d2.u.val = d2.u.sym->u.val;
+	d2.type = NUM;
+    }
+
+
     d1.u.val = (int)(d1.u.val == d2.u.val);
     push(d1);
     return 0;
@@ -284,7 +379,22 @@ int ne()
     Datum d1, d2;
     d2 = pop();
     d1 = pop();
-    d1.u.val = (int)(d1.u.val  !=  d2.u.val);
+    if (d1.type == NAME) {
+	//char *name =  d1.u.sym->name->c_str();     
+        //debug("eval %s to %d", 
+	d1.u.val = d1.u.sym->u.val;
+	d1.type = NUM;
+    }
+
+    if (d2.type == NAME) {
+	//char *name =  d1.u.sym->name->c_str();     
+        //debug("eval %s to %d", 
+	d2.u.val = d2.u.sym->u.val;
+	d2.type = NUM;
+    }
+
+
+    d1.u.val = (int)(d1.u.val != d2.u.val);
     push(d1);
     return 0;
 }
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index d8068c3e46..2ba708a916 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -18,12 +18,22 @@ static const ADGameDescription gameDescriptions[] = {
         ADGF_NO_FLAGS,
         GUIO1(GUIO_NOMIDI)
     },
+    {
+        "private-eye",
+        0,
+        AD_ENTRY1s("GAME.TXT", "28ee7295db2cf6d9358ad737e3a4c4c0", 19286),
+        Common::EN_ANY,
+        Common::kPlatformWindows,
+        ADGF_DEMO,
+        GUIO1(GUIO_NOMIDI)
+    },
+ 
     AD_TABLE_END_MARKER
 };
 } // End of namespace Private
 
 static const char *const directoryGlobs[] = {
-    "support", // english CD
+    "assets", // english CD
     0
 };
 
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index a4fc91671a..82d706ba2e 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -18,10 +18,12 @@ void ChgMode(ArgArray args) {
     if (g_private->_mode == 0) {
         g_private->_origin->x = 0;
         g_private->_origin->y = 0;
+	// TODO: should clear the screen?
     } 
     else if (g_private->_mode == 1) {
         g_private->_origin->x = 63;
         g_private->_origin->y = 48;
+        g_private->drawScreenFrame();
     }
     else
         assert(0);
@@ -57,6 +59,11 @@ void DossierAdd(ArgArray args) {
     debug("WARNING: DossierAdd is not implemented");
 }
 
+void Inventory(ArgArray args) {
+    // assert types
+    debug("WARNING: Inventory is not implemented");
+}
+
 void SetFlag(ArgArray args) {
     // assert types
     debug("SetFlag(%s, %d)", args[0].u.sym->name->c_str(), args[1].u.val);
@@ -66,7 +73,7 @@ void SetFlag(ArgArray args) {
 void Exit(ArgArray args) {
     // assert types
     assert(args[2].type == RECT || args[2].type == NAME);
-    debug("Exit(..)"); //, args[0].u.str, args[1].u.sym->name->c_str(), "RECT");
+    debug("Exit(%d %d %d)", args[0].type, args[1].type, args[2].type); //, args[0].u.str, args[1].u.sym->name->c_str(), "RECT");
     ExitInfo *e = (ExitInfo*) malloc(sizeof(ExitInfo));
 
     if (args[0].type == NUM && args[0].u.val == 0)
@@ -79,7 +86,13 @@ void Exit(ArgArray args) {
     else
         e->cursor = args[1].u.sym->name;
 
+    if (args[2].type == NAME) {
+	assert(args[2].u.sym->type == RECT);
+	args[2].u.rect = args[2].u.sym->u.rect;
+    }
+
     e->rect = args[2].u.rect;
+    debug("Rect %d %d %d %d", args[2].u.rect->top, args[2].u.rect->left, args[2].u.rect->bottom, args[2].u.rect->right);
     g_private->_exits.push_front(*e);
 }
 
@@ -102,10 +115,25 @@ void Sound(ArgArray args) {
     }
 }
 
+void LoopedSound(ArgArray args) {
+    // assert types
+    assert(args.size() == 1);
+    debug("LoopedSound(%s)", args[0].u.str);
+    if (strcmp("\"\"", args[0].u.str) != 0) {
+        Common::String *s = new Common::String(args[0].u.str);
+        g_private->playSound(*s);
+        //assert(0);
+    } else {
+        g_private->stopSound();
+    }
+}
+
+
+
 void Transition(ArgArray args) {
     // assert types
     debug("Transition(%s, %s)", args[0].u.str, args[1].u.str);
-    //g_private->_nextMovie = new Common::String(args[0].u.str);
+    g_private->_nextMovie = new Common::String(args[0].u.str);
     g_private->_nextSetting = new Common::String(args[1].u.str);
 }
 
@@ -187,7 +215,13 @@ void Mask(ArgArray args, bool drawn) {
 
 
 void Timer(ArgArray args) {
-    debug("Timer(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.str);
+    assert (args.size() == 2 || args.size() == 3);
+
+    if (args.size() == 3)
+        debug("Timer(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.str);
+    else 
+        debug("Timer(%d, %s)", args[0].u.val, args[1].u.str);
+ 
     g_system->delayMillis(100 * args[0].u.val);
     Common::String *s = new Common::String(args[1].u.str);
     g_private->_nextSetting = s;
@@ -208,6 +242,12 @@ void execFunction(char *name, ArgArray args) {
     else if (strcmp(name, "Sound") == 0) {
         Sound(args);
     }
+    else if (strcmp(name, "SoundEffect") == 0) {
+        Sound(args); // Unclear how this is different from Sound
+    }
+    else if (strcmp(name, "LoopedSound") == 0) {
+        LoopedSound(args);
+    }
     else if (strcmp(name, "Bitmap") == 0) {
         Bitmap(args);
     }
@@ -242,6 +282,9 @@ void execFunction(char *name, ArgArray args) {
     else if (strcmp(name, "DossierAdd") == 0) {
         DossierAdd(args);
     }
+    else if (strcmp(name, "Inventory") == 0) {
+        Inventory(args);
+    }
     else if (strcmp(name, "VSPicture") == 0) {
         VSPicture(args);
     }
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 2986cfc5b9..d5728058b8 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -116,6 +116,8 @@ extern  int lt();
 extern  int gt();
 extern  int le();
 extern  int ge();
+extern  int eq();
+extern  int ne();
 
 // Code Execution
 
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 2a67f65d2c..d5adc8eab1 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -68,7 +68,12 @@ statements:  /* nothing */     { $$ = progp; }
         | statement statements
 
 
-statement: GOTOTOK expr ';' { /*TODO*/ }
+statement: GOTOTOK NAME ';' {
+	code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, $NAME));
+        code2(constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
+        code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto")); 
+        code1(funcpush);
+        }
         | fcall ';'         { }   
         | if cond body end {
          	/* else-less if */
@@ -98,7 +103,8 @@ cond: '(' expr ')'	{ code(STOP); $$ = $2; }
 
 define:  /* nothing */
         | NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  { 
-          Common::Rect *r = new Common::Rect($5->u.val, $7->u.val, $9->u.val, $11->u.val); 
+          Common::Rect *r = new Common::Rect($5->u.val, $7->u.val, $9->u.val, $11->u.val);
+          assert(r->isValidRect()); 
           define($NAME, r); 
           }
         | NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' {
@@ -146,13 +152,13 @@ value:    NULLTOK  { code2(Private::constpush, (Private::Inst) Private::addconst
 
 expr:     value           { $$ = $1; } 
         | '!' value       { code1(Private::negate); $$ = $2; }
-        | value EQ value
-        | value NEQ value
+        | value EQ value  { code1(Private::eq); }
+        | value NEQ value { code1(Private::ne); }
         | value '+' value { code1(Private::add); }
         | value '<' value { code1(Private::lt); }
         | value '>' value { code1(Private::gt); }
         | value LTE value { code1(Private::le); }
         | value GTE value { code1(Private::ge); }
-        | value '+' 
-        | RANDOMTOK '(' NUM '%' ')'
+        | value '+'       { code1(fail); } 
+        | RANDOMTOK '(' NUM '%' ')' { code1(fail); }
         ;
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 2b629f85ef..90dc6212d5 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -79,6 +79,8 @@ PrivateEngine::PrivateEngine(OSystem *syst)
     _nextMovie = NULL;
     _modified = false;
     _mode = -1;
+    _frame = new Common::String("inface/general/inface2.bmp");
+
 
 }
 
@@ -94,7 +96,9 @@ PrivateEngine::~PrivateEngine() {
 
 Common::Error PrivateEngine::run() {
     Common::File *file = new Common::File();
-    assert(file->open("GAME.DAT"));
+    if (!file->open("GAME.DAT")) // if the full game is not used
+        assert(file->open("assets/GAME.TXT")); // open the demo file
+			
     void *buf = malloc(191000);
     file->read(buf, 191000);
     initFuncs();
@@ -118,21 +122,6 @@ Common::Error PrivateEngine::run() {
     _compositeSurface->create(_screenW, _screenH, _pixelFormat);
     _compositeSurface->setTransparentColor(_transparentColor);
 
-    // You could use backend transactions directly as an alternative,
-    // but it isn't recommended, until you want to handle the error values
-    // from OSystem::endGFXTransaction yourself.
-    // This is just an example template:
-    //_system->beginGFXTransaction();
-    //	// This setup the graphics mode according to users seetings
-    //	initCommonGFX(false);
-    //
-    //	// Specify dimensions of game graphics window.
-    //	// In this example: 320x200
-    //	_system->initSize(320, 200);
-    //FIXME: You really want to handle
-    //OSystem::kTransactionSizeChangeFailed here
-    //_system->endGFXTransaction();
-
     // Create debugger console. It requires GFX to be initialized
     Console *console = new Console(this);
     setDebugger(console);
@@ -164,13 +153,20 @@ Common::Error PrivateEngine::run() {
 
         // Events
         switch (event.type) {
+           case Common::EVENT_KEYDOWN:
+	    if (event.kbd.keycode == Common::KEYCODE_ESCAPE && _videoDecoder)
+		skipVideo();
+	        break;
+
             case Common::EVENT_QUIT:
             case Common::EVENT_RETURN_TO_LAUNCHER:
                 break;
 
             case Common::EVENT_LBUTTONDOWN:
                 selectMask(mousePos);
-		selectExit(mousePos);
+		if (!_nextSetting)
+		    selectExit(mousePos);
+                g_system->delayMillis(30);
 	        break;
 
 	    default:
@@ -199,10 +195,7 @@ Common::Error PrivateEngine::run() {
             continue;
         }
 
-        //if (_compositeSurface)
-        //	drawScreen();
-
-        if (_nextSetting != NULL) {
+	if (_nextSetting != NULL) {
             debug("Executing %s", _nextSetting->c_str());
             _exits.clear();
             _masks.clear();
@@ -211,8 +204,6 @@ Common::Error PrivateEngine::run() {
             CursorMan.showMouse(false);
             execute(prog);
             CursorMan.showMouse(true);
-
-
         }
 
         g_system->updateScreen();
@@ -223,7 +214,8 @@ Common::Error PrivateEngine::run() {
 }
 
 void PrivateEngine::selectExit(Common::Point mousePos) {
-    //debug("Mousepos %d %d", mousePos.x, mousePos.y); 
+    debug("Mousepos %d %d", mousePos.x, mousePos.y); 
+    mousePos = mousePos - *_origin; 
     Common::String *ns = NULL;
     int rs = 100000000;
     int cs = 0;
@@ -231,9 +223,9 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
     for (ExitList::iterator it = _exits.begin(); it != _exits.end(); ++it) {
         e = *it;
     	cs = e.rect->width()*e.rect->height();
-        //debug("Testing exit %s %d", e.nextSetting->c_str(), cs);
+        debug("Testing exit %s %d", e.nextSetting->c_str(), cs);
         if (e.rect->contains(mousePos)) {
-	    //debug("Inside! %d %d", cs, rs);
+	    debug("Inside! %d %d", cs, rs);
             if (cs < rs && e.nextSetting != NULL) { // TODO: check this
                 debug("Found Exit %s %d", e.nextSetting->c_str(), cs);
                 rs = cs;
@@ -249,7 +241,8 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
 }
 
 void PrivateEngine::selectMask(Common::Point mousePos) {
-    //debug("Mousepos %d %d", mousePos.x, mousePos.y); 
+    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
+    mousePos = mousePos - *_origin;
     Common::String *ns = NULL;
     MaskInfo m;
     for (MaskList::iterator it = _masks.begin(); it != _masks.end(); ++it) {
@@ -324,8 +317,8 @@ void PrivateEngine::playSound(const Common::String &name) {
     if (!file->open(path))
         error("unable to find sound file %s", path.c_str());
 
-    Audio::AudioStream *stream;
-    stream = Audio::makeWAVStream(file, DisposeAfterUse::YES);
+    Audio::LoopingAudioStream *stream;
+    stream = new Audio::LoopingAudioStream(Audio::makeWAVStream(file, DisposeAfterUse::YES), 1);
     stopSound();
     _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream, -1, Audio::Mixer::kMaxChannelVolume);
 }
@@ -344,13 +337,20 @@ void PrivateEngine::playVideo(const Common::String &name) {
 
 }
 
+void PrivateEngine::skipVideo() {
+    _videoDecoder->close();
+    delete _videoDecoder;
+    _videoDecoder = nullptr;
+}
+
+
 void PrivateEngine::stopSound() {
     debugC(3, kPrivateDebugExample, "%s", __FUNCTION__);
     if (_mixer->isSoundHandleActive(_soundHandle))
         _mixer->stopHandle(_soundHandle);
 }
 
-void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
+void PrivateEngine::loadImage(const Common::String &name, int x, int y, bool drawn) {
     debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
     Common::File file;
     Common::String path = convertPath(name);
@@ -362,10 +362,22 @@ void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
     //for (int i = 0; i < 30; i=i+3)
     //    debug("%x %x %x", *(_image->getPalette()+i), *(_image->getPalette()+i+1), *(_image->getPalette()+i+2));
 
-    _compositeSurface->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), Common::Point(x,y), _transparentColor);
+    _compositeSurface->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), *_origin + Common::Point(x,y), _transparentColor);
     drawScreen();
 }
 
+void PrivateEngine::drawScreenFrame() {
+    Common::File file;
+    Common::String path = convertPath(*_frame);
+    if (!file.open(path))
+        error("unable to load image %s", path.c_str());
+
+    _image->loadStream(file);
+    _compositeSurface->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), Common::Point(0,0));
+    //drawScreen();
+}
+
+
 Graphics::ManagedSurface *PrivateEngine::loadMask(const Common::String &name, int x, int y, bool drawn) {
     debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
     Common::File file;
@@ -393,6 +405,9 @@ void PrivateEngine::drawScreen() {
     if (_videoDecoder ? _videoDecoder->needsUpdate() : false || _compositeSurface) {
         Graphics::Surface *screen = g_system->lockScreen();
         //screen->fillRect(Common::Rect(0, 0, g_system->getWidth(), g_system->getHeight()), 0);
+	//
+	//if (_mode == 1)
+	//    drawScreenFrame();
 
         Graphics::ManagedSurface *surface = _compositeSurface;
 
diff --git a/engines/private/private.h b/engines/private/private.h
index 704fc02a3f..1f3ec553f6 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -82,11 +82,14 @@ public:
 
         Common::String convertPath(Common::String); 
 	void playSound(const Common::String &name);
-	void playVideo(const Common::String &name);	
+	void playVideo(const Common::String &name);
+        void skipVideo();
 	void stopSound();
 
-	void loadImage(const Common::String &, int, int);
-        Graphics::ManagedSurface *loadMask(const Common::String &, int, int, bool);
+	void loadImage(const Common::String &file, int x, int y, bool drawn = true);
+        void drawScreenFrame();
+        
+	Graphics::ManagedSurface *loadMask(const Common::String &, int, int, bool);
  
         uint32 _transparentColor;	
 	void drawScreen();
@@ -95,6 +98,7 @@ public:
 	Common::Point *_origin;
         Common::String *_nextSetting;
         Common::String *_nextVS;
+        Common::String *_frame;
 
 	int _mode;
         bool _modified;
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index c0b9270a37..9e3248a5ad 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -31,7 +31,7 @@ void showSymbol(Symbol *s)
     else if (s->type == STRING)
         debug("%s %s", s->name->c_str(), s->u.str);
     else if (s->type == NAME)
-        debug("%s",s->name->c_str());
+        debug("%s %d",s->name->c_str(), s->type);
     else
         debug("%s %d", s->name->c_str(), s->type);
 }
@@ -40,7 +40,13 @@ void showSymbol(Symbol *s)
 Symbol *lookup(Common::String s, SymbolMap symlist)	/* find s in symbol table symlist */
 {
     //debug("looking up %s", s.c_str());
-    return symlist.getVal(s);
+    Symbol *r = symlist.getVal(s);
+    /*if (strcmp(s.c_str(), "m_640x480") == 0) {
+        showSymbol(r);
+	assert(0);
+    }*/
+
+    return r;
 }
 
 Symbol *lookupName(char *n)  /* install s in some symbol table */
@@ -106,7 +112,7 @@ void installall(char *n) {
 
         else if (strcmp(n, "rects") == 0) {
             assert(r != NULL);
-            install(s, NAME, 0, NULL, r, &rects);
+            install(s, RECT, 0, NULL, r, &rects);
         }
         else
             assert(0);


Commit: c333492c8fd24df3aeef23d5a85eb1acec5f9150
    https://github.com/scummvm/scummvm/commit/c333492c8fd24df3aeef23d5a85eb1acec5f9150
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: remove stuff from the event loop

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 90dc6212d5..7ca35ce6b8 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -146,32 +146,29 @@ Common::Error PrivateEngine::run() {
     _nextSetting = new Common::String("kGoIntro");
 
     while (!shouldQuit()) {
-        g_system->getEventManager()->pollEvent(event);
-        mousePos = g_system->getEventManager()->getMousePos();
-
-        g_system->delayMillis(10);
-
-        // Events
-        switch (event.type) {
-           case Common::EVENT_KEYDOWN:
-	    if (event.kbd.keycode == Common::KEYCODE_ESCAPE && _videoDecoder)
-		skipVideo();
-	        break;
-
-            case Common::EVENT_QUIT:
-            case Common::EVENT_RETURN_TO_LAUNCHER:
-                break;
-
-            case Common::EVENT_LBUTTONDOWN:
-                selectMask(mousePos);
-		if (!_nextSetting)
-		    selectExit(mousePos);
-                g_system->delayMillis(30);
-	        break;
-
-	    default:
-	        {}
+        while (g_system->getEventManager()->pollEvent(event)) {
+            // Events
+            switch (event.type) {
+                case Common::EVENT_KEYDOWN:
+                    if (event.kbd.keycode == Common::KEYCODE_ESCAPE && _videoDecoder)
+                       skipVideo();
+	            break;
+
+                case Common::EVENT_QUIT:
+                case Common::EVENT_RETURN_TO_LAUNCHER:
+                    break;
+
+                case Common::EVENT_LBUTTONDOWN:
+                    mousePos = g_system->getEventManager()->getMousePos();
+                    selectMask(mousePos);
+		    if (!_nextSetting)
+                        selectExit(mousePos);
+	            break;
+
+	        default:
+	            {}
 
+            }
         }
 
         // Movies
@@ -207,7 +204,7 @@ Common::Error PrivateEngine::run() {
         }
 
         g_system->updateScreen();
-
+        g_system->delayMillis(10);
     }
 
     return Common::kNoError;


Commit: 03ed1ac933efc0f8c8892ec2965636632540e28f
    https://github.com/scummvm/scummvm/commit/03ed1ac933efc0f8c8892ec2965636632540e28f
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: astyled the code again

Changed paths:
    engines/private/code.cpp
    engines/private/detection.cpp
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 000f33c959..6716026825 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -192,17 +192,17 @@ int add()		/* add top two elems on stack */
     d2 = pop();
     d1 = pop();
     if (d1.type == NAME) {
-	//char *name =  d1.u.sym->name->c_str();     
-        //debug("eval %s to %d", 
-	d1.u.val = d1.u.sym->u.val;
-	d1.type = NUM;
+        //char *name =  d1.u.sym->name->c_str();
+        //debug("eval %s to %d",
+        d1.u.val = d1.u.sym->u.val;
+        d1.type = NUM;
     }
 
     if (d2.type == NAME) {
-	//char *name =  d1.u.sym->name->c_str();     
-        //debug("eval %s to %d", 
-	d2.u.val = d2.u.sym->u.val;
-	d2.type = NUM;
+        //char *name =  d1.u.sym->name->c_str();
+        //debug("eval %s to %d",
+        d2.u.val = d2.u.sym->u.val;
+        d2.type = NUM;
     }
 
     assert(d1.type == NUM);
@@ -255,17 +255,17 @@ int gt()
     d2 = pop();
     d1 = pop();
     if (d1.type == NAME) {
-	//char *name =  d1.u.sym->name->c_str();     
-        //debug("eval %s to %d", 
-	d1.u.val = d1.u.sym->u.val;
-	d1.type = NUM;
+        //char *name =  d1.u.sym->name->c_str();
+        //debug("eval %s to %d",
+        d1.u.val = d1.u.sym->u.val;
+        d1.type = NUM;
     }
 
     if (d2.type == NAME) {
-	//char *name =  d1.u.sym->name->c_str();     
-        //debug("eval %s to %d", 
-	d2.u.val = d2.u.sym->u.val;
-	d2.type = NUM;
+        //char *name =  d1.u.sym->name->c_str();
+        //debug("eval %s to %d",
+        d2.u.val = d2.u.sym->u.val;
+        d2.type = NUM;
     }
 
 
@@ -280,17 +280,17 @@ int lt()
     d2 = pop();
     d1 = pop();
     if (d1.type == NAME) {
-	//char *name =  d1.u.sym->name->c_str();     
-        //debug("eval %s to %d", 
-	d1.u.val = d1.u.sym->u.val;
-	d1.type = NUM;
+        //char *name =  d1.u.sym->name->c_str();
+        //debug("eval %s to %d",
+        d1.u.val = d1.u.sym->u.val;
+        d1.type = NUM;
     }
 
     if (d2.type == NAME) {
-	//char *name =  d1.u.sym->name->c_str();     
-        //debug("eval %s to %d", 
-	d2.u.val = d2.u.sym->u.val;
-	d2.type = NUM;
+        //char *name =  d1.u.sym->name->c_str();
+        //debug("eval %s to %d",
+        d2.u.val = d2.u.sym->u.val;
+        d2.type = NUM;
     }
 
 
@@ -305,17 +305,17 @@ int ge()
     d2 = pop();
     d1 = pop();
     if (d1.type == NAME) {
-	//char *name =  d1.u.sym->name->c_str();     
-        //debug("eval %s to %d", 
-	d1.u.val = d1.u.sym->u.val;
-	d1.type = NUM;
+        //char *name =  d1.u.sym->name->c_str();
+        //debug("eval %s to %d",
+        d1.u.val = d1.u.sym->u.val;
+        d1.type = NUM;
     }
 
     if (d2.type == NAME) {
-	//char *name =  d1.u.sym->name->c_str();     
-        //debug("eval %s to %d", 
-	d2.u.val = d2.u.sym->u.val;
-	d2.type = NUM;
+        //char *name =  d1.u.sym->name->c_str();
+        //debug("eval %s to %d",
+        d2.u.val = d2.u.sym->u.val;
+        d2.type = NUM;
     }
 
 
@@ -330,17 +330,17 @@ int le()
     d2 = pop();
     d1 = pop();
     if (d1.type == NAME) {
-	//char *name =  d1.u.sym->name->c_str();     
-        //debug("eval %s to %d", 
-	d1.u.val = d1.u.sym->u.val;
-	d1.type = NUM;
+        //char *name =  d1.u.sym->name->c_str();
+        //debug("eval %s to %d",
+        d1.u.val = d1.u.sym->u.val;
+        d1.type = NUM;
     }
 
     if (d2.type == NAME) {
-	//char *name =  d1.u.sym->name->c_str();     
-        //debug("eval %s to %d", 
-	d2.u.val = d2.u.sym->u.val;
-	d2.type = NUM;
+        //char *name =  d1.u.sym->name->c_str();
+        //debug("eval %s to %d",
+        d2.u.val = d2.u.sym->u.val;
+        d2.type = NUM;
     }
 
 
@@ -355,17 +355,17 @@ int eq()
     d2 = pop();
     d1 = pop();
     if (d1.type == NAME) {
-	//char *name =  d1.u.sym->name->c_str();     
-        //debug("eval %s to %d", 
-	d1.u.val = d1.u.sym->u.val;
-	d1.type = NUM;
+        //char *name =  d1.u.sym->name->c_str();
+        //debug("eval %s to %d",
+        d1.u.val = d1.u.sym->u.val;
+        d1.type = NUM;
     }
 
     if (d2.type == NAME) {
-	//char *name =  d1.u.sym->name->c_str();     
-        //debug("eval %s to %d", 
-	d2.u.val = d2.u.sym->u.val;
-	d2.type = NUM;
+        //char *name =  d1.u.sym->name->c_str();
+        //debug("eval %s to %d",
+        d2.u.val = d2.u.sym->u.val;
+        d2.type = NUM;
     }
 
 
@@ -380,17 +380,17 @@ int ne()
     d2 = pop();
     d1 = pop();
     if (d1.type == NAME) {
-	//char *name =  d1.u.sym->name->c_str();     
-        //debug("eval %s to %d", 
-	d1.u.val = d1.u.sym->u.val;
-	d1.type = NUM;
+        //char *name =  d1.u.sym->name->c_str();
+        //debug("eval %s to %d",
+        d1.u.val = d1.u.sym->u.val;
+        d1.type = NUM;
     }
 
     if (d2.type == NAME) {
-	//char *name =  d1.u.sym->name->c_str();     
-        //debug("eval %s to %d", 
-	d2.u.val = d2.u.sym->u.val;
-	d2.type = NUM;
+        //char *name =  d1.u.sym->name->c_str();
+        //debug("eval %s to %d",
+        d2.u.val = d2.u.sym->u.val;
+        d2.type = NUM;
     }
 
 
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index 2ba708a916..82cc79e90a 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -27,7 +27,7 @@ static const ADGameDescription gameDescriptions[] = {
         ADGF_DEMO,
         GUIO1(GUIO_NOMIDI)
     },
- 
+
     AD_TABLE_END_MARKER
 };
 } // End of namespace Private
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 82d706ba2e..9c64461045 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -18,8 +18,8 @@ void ChgMode(ArgArray args) {
     if (g_private->_mode == 0) {
         g_private->_origin->x = 0;
         g_private->_origin->y = 0;
-	// TODO: should clear the screen?
-    } 
+        // TODO: should clear the screen?
+    }
     else if (g_private->_mode == 1) {
         g_private->_origin->x = 63;
         g_private->_origin->y = 48;
@@ -87,8 +87,8 @@ void Exit(ArgArray args) {
         e->cursor = args[1].u.sym->name;
 
     if (args[2].type == NAME) {
-	assert(args[2].u.sym->type == RECT);
-	args[2].u.rect = args[2].u.sym->u.rect;
+        assert(args[2].u.sym->type == RECT);
+        args[2].u.rect = args[2].u.sym->u.rect;
     }
 
     e->rect = args[2].u.rect;
@@ -193,7 +193,7 @@ void Mask(ArgArray args, bool drawn) {
     char *f = args[0].u.str;
     char *e = args[1].u.str;
     Common::String *c = args[2].u.sym->name;
-    
+
     if (args.size() == 5) {
         x = args[3].u.val;
         y = args[4].u.val;
@@ -219,9 +219,9 @@ void Timer(ArgArray args) {
 
     if (args.size() == 3)
         debug("Timer(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.str);
-    else 
+    else
         debug("Timer(%d, %s)", args[0].u.val, args[1].u.str);
- 
+
     g_system->delayMillis(100 * args[0].u.val);
     Common::String *s = new Common::String(args[1].u.str);
     g_private->_nextSetting = s;
@@ -257,7 +257,7 @@ void execFunction(char *name, ArgArray args) {
     else if (strcmp(name, "MaskDrawn") == 0) {
         Mask(args, true);
     }
- 
+
     else if (strcmp(name, "Timer") == 0) {
         Timer(args);
     }
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 7ca35ce6b8..5f9389e8b4 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -98,7 +98,7 @@ Common::Error PrivateEngine::run() {
     Common::File *file = new Common::File();
     if (!file->open("GAME.DAT")) // if the full game is not used
         assert(file->open("assets/GAME.TXT")); // open the demo file
-			
+
     void *buf = malloc(191000);
     file->read(buf, 191000);
     initFuncs();
@@ -149,24 +149,24 @@ Common::Error PrivateEngine::run() {
         while (g_system->getEventManager()->pollEvent(event)) {
             // Events
             switch (event.type) {
-                case Common::EVENT_KEYDOWN:
-                    if (event.kbd.keycode == Common::KEYCODE_ESCAPE && _videoDecoder)
-                       skipVideo();
-	            break;
+            case Common::EVENT_KEYDOWN:
+                if (event.kbd.keycode == Common::KEYCODE_ESCAPE && _videoDecoder)
+                    skipVideo();
+                break;
 
-                case Common::EVENT_QUIT:
-                case Common::EVENT_RETURN_TO_LAUNCHER:
-                    break;
+            case Common::EVENT_QUIT:
+            case Common::EVENT_RETURN_TO_LAUNCHER:
+                break;
 
-                case Common::EVENT_LBUTTONDOWN:
-                    mousePos = g_system->getEventManager()->getMousePos();
-                    selectMask(mousePos);
-		    if (!_nextSetting)
-                        selectExit(mousePos);
-	            break;
+            case Common::EVENT_LBUTTONDOWN:
+                mousePos = g_system->getEventManager()->getMousePos();
+                selectMask(mousePos);
+                if (!_nextSetting)
+                    selectExit(mousePos);
+                break;
 
-	        default:
-	            {}
+            default:
+            {}
 
             }
         }
@@ -192,7 +192,7 @@ Common::Error PrivateEngine::run() {
             continue;
         }
 
-	if (_nextSetting != NULL) {
+        if (_nextSetting != NULL) {
             debug("Executing %s", _nextSetting->c_str());
             _exits.clear();
             _masks.clear();
@@ -211,18 +211,18 @@ Common::Error PrivateEngine::run() {
 }
 
 void PrivateEngine::selectExit(Common::Point mousePos) {
-    debug("Mousepos %d %d", mousePos.x, mousePos.y); 
-    mousePos = mousePos - *_origin; 
+    debug("Mousepos %d %d", mousePos.x, mousePos.y);
+    mousePos = mousePos - *_origin;
     Common::String *ns = NULL;
     int rs = 100000000;
     int cs = 0;
     ExitInfo e;
     for (ExitList::iterator it = _exits.begin(); it != _exits.end(); ++it) {
         e = *it;
-    	cs = e.rect->width()*e.rect->height();
+        cs = e.rect->width()*e.rect->height();
         debug("Testing exit %s %d", e.nextSetting->c_str(), cs);
         if (e.rect->contains(mousePos)) {
-	    debug("Inside! %d %d", cs, rs);
+            debug("Inside! %d %d", cs, rs);
             if (cs < rs && e.nextSetting != NULL) { // TODO: check this
                 debug("Found Exit %s %d", e.nextSetting->c_str(), cs);
                 rs = cs;
@@ -244,14 +244,14 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
     MaskInfo m;
     for (MaskList::iterator it = _masks.begin(); it != _masks.end(); ++it) {
         m = *it;
-	
+
         debug("Testing mask %s", m.nextSetting->c_str());
         if ( *((uint32*) m.surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
-	    debug("Inside!");
+            debug("Inside!");
             if (m.nextSetting != NULL) { // TODO: check this
                 debug("Found Mask %s", m.nextSetting->c_str());
                 ns = m.nextSetting;
-		break;
+                break;
             }
 
         }
@@ -392,7 +392,7 @@ Graphics::ManagedSurface *PrivateEngine::loadMask(const Common::String &name, in
         drawScreen();
     }
 
-    return surf; 
+    return surf;
 }
 
 
@@ -402,9 +402,9 @@ void PrivateEngine::drawScreen() {
     if (_videoDecoder ? _videoDecoder->needsUpdate() : false || _compositeSurface) {
         Graphics::Surface *screen = g_system->lockScreen();
         //screen->fillRect(Common::Rect(0, 0, g_system->getWidth(), g_system->getHeight()), 0);
-	//
-	//if (_mode == 1)
-	//    drawScreenFrame();
+        //
+        //if (_mode == 1)
+        //    drawScreenFrame();
 
         Graphics::ManagedSurface *surface = _compositeSurface;
 
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 9e3248a5ad..2498924167 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -43,7 +43,7 @@ Symbol *lookup(Common::String s, SymbolMap symlist)	/* find s in symbol table sy
     Symbol *r = symlist.getVal(s);
     /*if (strcmp(s.c_str(), "m_640x480") == 0) {
         showSymbol(r);
-	assert(0);
+    assert(0);
     }*/
 
     return r;


Commit: 6fa9b8474c5de8d06ebb7b2a0b1d54eb72ab8f72
    https://github.com/scummvm/scummvm/commit/6fa9b8474c5de8d06ebb7b2a0b1d54eb72ab8f72
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: clean-up

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/grammar.h
    engines/private/private.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 6716026825..3ae8ccb992 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -18,29 +18,28 @@ Inst	*progp       = NULL;	/* next free spot for code generation */
 Inst	*pc          = NULL;	/* program counter during execution */
 
 
-static struct FuncDescr {
+static struct InstDescr {
     const Inst func;
     const char *name;
-    const char *args;
-} funcDescr[] = {
-    { 0,					"STOP",				""  },
-    { constpush,	"constpush",	"" },
-    { strpush,	"strpush",	"" },
-    { varpush,	"varpush",	"" },
-    { funcpush,	"funcpush",	"" },
-    { eval,	"eval",	"" },
-    { ifcode,	"ifcode",	"" },
-    { add,	"add",	"" },
-    { negate,	"negate",	"" },
-
-    { 0, 0, 0 }
+} instDescr[] = {
+    { 0,        "STOP",     },
+    { constpush,"constpush" },
+    { strpush,  "strpush",	},
+    { varpush,  "varpush",	},
+    { funcpush, "funcpush",	},
+    { eval,	    "eval",     },
+    { ifcode,   "ifcode",	},
+    { add,      "add",      },
+    { negate,	"negate",	},
+
+    { 0, 0}
 };
 
-FuncHash _functions;
+PtrToName _insts;
 
-void initFuncs() {
-    for (FuncDescr *fnc = funcDescr; fnc->name; fnc++) {
-        _functions[(void *)fnc->func] = new Common::String(fnc->name);
+void initInsts() {
+    for (InstDescr *fnc = instDescr; fnc->name; fnc++) {
+        _insts[(void *)fnc->func] = new Common::String(fnc->name);
     }
 }
 
@@ -148,11 +147,10 @@ int funcpush() //(char *name, int nargs)
     debug("executing %s with %d params", s.u.str, n.u.val);
     for (int i = 0; i < n.u.val; i++) {
         arg = pop();
-        //debug("%d", arg.val);
         args.insert(args.begin(), arg) ;
     }
 
-    execFunction(s.u.str, args);
+    call(s.u.str, args);
     return 0;
 }
 
@@ -235,20 +233,6 @@ int negate()
     return 0;
 }
 
-int assign()	/* assign top value to next value */
-{
-    Datum d1, d2;
-    d1 = pop();
-    d2 = pop();
-    /*if (d1.sym->type != VAR && d1.sym->type != UNDEF)
-    	execerror("assignment to non-variable",
-    		d1.sym->name);*/
-    d1.u.sym->u.val = d2.u.val;
-    d1.u.sym->type = NAME;
-    push(d2);
-    return 0;
-}
-
 int gt()
 {
     Datum d1, d2;
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 9c64461045..a3bcc5372d 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -44,11 +44,16 @@ void Goto(ArgArray args) { // should be goto, but this is a reserved word
 }
 
 void Quit(ArgArray args) {
-    debug("quit()");
+    debug("Quit()");
     g_private->quitGame();
 }
 
 
+void LoadGame(ArgArray args) {
+    // assert types
+    debug("WARNING: RestartGame is not implemented");
+}
+
 void RestartGame(ArgArray args) {
     // assert types
     debug("WARNING: RestartGame is not implemented");
@@ -129,7 +134,6 @@ void LoopedSound(ArgArray args) {
 }
 
 
-
 void Transition(ArgArray args) {
     // assert types
     debug("Transition(%s, %s)", args[0].u.str, args[1].u.str);
@@ -145,8 +149,6 @@ void Movie(ArgArray args) {
     g_private->_nextSetting = new Common::String(args[1].u.str);
 }
 
-
-
 void CRect(ArgArray args) {
     // assert types
     int x1, y1, x2, y2;
@@ -184,7 +186,7 @@ void Bitmap(ArgArray args) {
     g_private->loadImage(*s, x, y);
 }
 
-void Mask(ArgArray args, bool drawn) {
+void _Mask(ArgArray args, bool drawn) {
     assert(args.size() == 3 || args.size() == 5);
 
     int x = 0;
@@ -213,6 +215,8 @@ void Mask(ArgArray args, bool drawn) {
 
 }
 
+void Mask(ArgArray args) { _Mask(args, false); }
+void MaskDrawn(ArgArray args) { _Mask(args, true); }
 
 void Timer(ArgArray args) {
     assert (args.size() == 2 || args.size() == 3);
@@ -227,77 +231,52 @@ void Timer(ArgArray args) {
     g_private->_nextSetting = s;
 }
 
-
-void execFunction(char *name, ArgArray args) {
-    if (strcmp(name, "ChgMode") == 0) {
-        ChgMode(args);
-    }
-    else if (strcmp(name, "goto") == 0) {
-        Goto(args);
-    }
-
-    else if (strcmp(name, "SetFlag") == 0) {
-        SetFlag(args);
-    }
-    else if (strcmp(name, "Sound") == 0) {
-        Sound(args);
-    }
-    else if (strcmp(name, "SoundEffect") == 0) {
-        Sound(args); // Unclear how this is different from Sound
-    }
-    else if (strcmp(name, "LoopedSound") == 0) {
-        LoopedSound(args);
-    }
-    else if (strcmp(name, "Bitmap") == 0) {
-        Bitmap(args);
-    }
-    else if (strcmp(name, "Mask") == 0) {
-        Mask(args, false);
-    }
-    else if (strcmp(name, "MaskDrawn") == 0) {
-        Mask(args, true);
+static struct FuncTable {
+    void (*func)(Private::ArgArray);
+    const char *name;
+} funcTable[] = {
+    { Bitmap,          "Bitmap"},
+    { ChgMode,         "ChgMode"},
+    { Goto,            "goto"},
+    { SetFlag,         "SetFlag"},
+    { Sound,           "Sound"},
+    { Sound,           "SoundEffect"},
+    { Sound,           "LoopedSound"},
+    { Mask,            "Mask"},
+    { MaskDrawn,       "MaskDrawn"},
+    { Timer,	       "Timer"},
+    { Transition,      "Transition"},
+    { Movie,           "Movie"},
+    { SetModifiedFlag, "SetModifiedFlag"},
+    { Exit,            "Exit"},
+    { Quit,            "Quit"},
+    { LoadGame,        "LoadGame"},
+    { DossierAdd,      "DossierAdd"},
+    { Inventory,       "Inventory"},
+    { VSPicture,       "VSPicture"},
+    { CRect,           "CRect"},
+    { RestartGame,     "RestartGame"},
+    { 0, 0}
+};
+
+NameToPtr _functions;
+
+void initFuncs() {
+    for (Private::FuncTable *fnc = funcTable; fnc->name; fnc++) {
+        Common::String *name = new Common::String(fnc->name);
+        _functions.setVal(*name, (void *)fnc->func);
     }
+}
 
-    else if (strcmp(name, "Timer") == 0) {
-        Timer(args);
-    }
-    else if (strcmp(name, "Transition") == 0) {
-        Transition(args);
-    }
-    else if (strcmp(name, "Movie") == 0) {
-        Movie(args);
-    }
-    else if (strcmp(name, "SetModifiedFlag") == 0) {
-        SetModifiedFlag(args);
-    }
-    else if (strcmp(name, "Exit") == 0) {
-        Exit(args);
-    }
-    else if (strcmp(name, "Quit") == 0) {
-        Quit(args);
-    }
-    else if (strcmp(name, "LoadGame") == 0) {
-        ;
-    }
-    else if (strcmp(name, "DossierAdd") == 0) {
-        DossierAdd(args);
-    }
-    else if (strcmp(name, "Inventory") == 0) {
-        Inventory(args);
-    }
-    else if (strcmp(name, "VSPicture") == 0) {
-        VSPicture(args);
-    }
-    else if (strcmp(name, "CRect") == 0) {
-        CRect(args);
-    }
-    else if (strcmp(name, "RestartGame") == 0) {
-        RestartGame(args);
-    }
-    else {
-        debug("I don't know how to exec %s", name);
+void call(char *name, ArgArray args) {
+    Common::String n(name);
+    if (!_functions.contains(n)) {
+        debug("I don't know how to execute %s", name);
         assert(0);
     }
+    
+    void (*func)(ArgArray) = (void (*)(ArgArray)) _functions.getVal(n);
+    func(args);
 
 }
 
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index d5728058b8..3095ca86bd 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -42,10 +42,13 @@ namespace Private {
 typedef int (*Inst)();	/* machine instruction */
 #define	STOP	(Inst) 0
 
-typedef Common::HashMap<void *, Common::String *> FuncHash;
+typedef Common::HashMap<void *, Common::String *> PtrToName;
+typedef Common::HashMap<Common::String, void *> NameToPtr;
 
+extern void initInsts();
 extern void initFuncs();
 
+
 typedef struct Setting {
 
     Datum	stack[NSTACK];	/* the stack */
@@ -89,7 +92,7 @@ extern Symbol  *lookup(Common::String, SymbolMap);
 // Funtions
 
 typedef Common::Array<Datum> ArgArray;
-extern void execFunction(char *, ArgArray);
+extern void call(char *, ArgArray);
 
 // Code Generation
 
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 5f9389e8b4..928c214f7b 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -101,6 +101,7 @@ Common::Error PrivateEngine::run() {
 
     void *buf = malloc(191000);
     file->read(buf, 191000);
+    initInsts();
     initFuncs();
     parse((char *) buf);
     assert(constants.size() > 0);


Commit: 92a892008d3047a3c720b2376bfdd98147e3b778
    https://github.com/scummvm/scummvm/commit/92a892008d3047a3c720b2376bfdd98147e3b778
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: implemented original cursors

Changed paths:
  A engines/private/cursors.cpp
    engines/private/funcs.cpp
    engines/private/module.mk
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
new file mode 100644
index 0000000000..3e86114114
--- /dev/null
+++ b/engines/private/cursors.cpp
@@ -0,0 +1,277 @@
+#include "common/scummsys.h"
+
+#include "private.h"
+
+namespace Private {
+
+const byte MOUSECURSOR_SCI[] = {
+    1,1,0,0,0,0,0,0,0,0,0,
+    1,2,1,0,0,0,0,0,0,0,0,
+    1,2,2,1,0,0,0,0,0,0,0,
+    1,2,2,2,1,0,0,0,0,0,0,
+    1,2,2,2,2,1,0,0,0,0,0,
+    1,2,2,2,2,2,1,0,0,0,0,
+    1,2,2,2,2,2,2,1,0,0,0,
+    1,2,2,2,2,2,2,2,1,0,0,
+    1,2,2,2,2,2,2,2,2,1,0,
+    1,2,2,2,2,2,2,2,2,2,1,
+    1,2,2,2,2,2,1,0,0,0,0,
+    1,2,1,0,1,2,2,1,0,0,0,
+    1,1,0,0,1,2,2,1,0,0,0,
+    0,0,0,0,0,1,2,2,1,0,0,
+    0,0,0,0,0,1,2,2,1,0,0,
+    0,0,0,0,0,0,1,2,2,1,0
+};
+
+const byte MOUSECURSOR_kExit[] = {
+0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,2,2,2,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,2,2,2,1,1,2,2,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,1,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,1,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,1,0,0,0,0,0,0,0,0,0,
+0,0,0,0,1,1,0,1,2,2,2,2,2,2,2,2,2,2,2,1,2,2,1,0,0,0,0,0,0,0,0,0,
+0,0,0,1,1,0,0,1,2,2,2,2,2,2,2,2,2,2,2,1,2,2,1,0,0,0,0,0,0,0,0,0,
+0,0,0,1,1,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,
+0,0,0,1,1,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,
+0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,
+0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,
+0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,
+0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+};
+
+const byte MOUSECURSOR_kZoomIn[] = {
+0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,1,1,2,2,2,2,1,1,1,1,1,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,1,2,2,2,2,2,2,2,2,2,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,1,1,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,1,1,2,2,1,1,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,1,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+};
+
+const byte MOUSECURSOR_kTurnRight[] = {
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,
+1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,
+1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,
+1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,
+1,1,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,1,0,0,0,0,
+1,1,2,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,1,0,0,0,
+1,1,2,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,1,0,0,0,
+1,1,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,1,0,0,0,0,
+1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,
+1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,
+1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+};
+
+const byte MOUSECURSOR_kTurnLeft[] = {
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,1,1,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,1,1,2,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,
+0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,
+0,0,1,1,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,0,0,0,
+0,1,1,2,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,0,0,0,
+1,1,2,2,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,0,0,0,
+1,2,2,2,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,0,0,0,
+1,2,2,2,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,0,0,0,
+1,1,2,2,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,0,0,0,
+0,1,1,2,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,0,0,0,
+0,0,1,1,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,0,0,0,
+0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,
+0,0,0,0,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,
+0,0,0,0,0,1,1,2,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,1,1,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,1,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+};
+
+const byte MOUSECURSOR_kInventory[] = {
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,1,1,2,2,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,1,1,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,1,2,2,2,1,2,2,2,1,2,2,2,1,1,1,1,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,1,2,2,1,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
+0,1,1,1,1,1,0,0,0,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
+1,1,2,2,2,1,1,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
+1,1,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
+0,1,1,1,2,2,2,2,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,
+0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,
+0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,
+0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,
+0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
+};
+
+const byte MOUSECURSOR_kZoomOut[] = {
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,
+1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,0,0,0,0,
+1,2,2,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,0,0,0,0,
+1,1,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,1,0,0,0,0,
+1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,0,0,0,0,
+0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,
+0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,
+0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,
+0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,
+0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,
+0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+};
+
+const byte MOUSECURSOR_kPhone[] {
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,
+0,0,0,0,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,0,0,0,0,
+0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,
+0,0,1,1,2,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,0,0,
+0,1,1,2,2,2,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,0,
+1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,
+0,1,2,2,2,2,2,2,2,2,1,2,2,1,1,1,1,1,1,1,2,2,1,2,2,2,2,2,2,2,2,1,
+1,1,2,2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,1,
+1,1,1,1,1,1,1,2,1,1,1,2,2,2,2,2,2,2,2,2,2,2,1,1,1,2,1,1,1,1,1,1,
+0,1,2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,2,2,2,2,2,2,1,
+1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,
+0,1,1,1,1,1,1,1,1,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,1,1,1,1,1,1,1,0,
+0,0,0,0,0,0,1,1,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,1,0,0,0,0,0,0,
+0,0,0,0,0,0,1,1,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,1,0,0,0,0,0,0,
+0,0,0,0,0,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,0,0,0,0,0,
+0,0,0,0,0,0,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,0,0,0,0,0,
+0,0,0,0,0,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,0,0,0,0,0,
+0,0,0,0,1,1,2,2,2,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2,2,2,1,0,0,0,0,
+0,0,0,0,1,1,2,2,2,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,2,2,2,1,0,0,0,0,
+0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,
+0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,
+0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,
+0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+};
+
+const byte cursorPalette[] = {
+    0, 0, 0,           // Black / Transparent
+    0x01, 0x01, 0x01,  // Gray
+    0xff, 0xff, 0xff   // White
+};
+
+}
\ No newline at end of file
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index a3bcc5372d..b96db8f49a 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -59,6 +59,11 @@ void RestartGame(ArgArray args) {
     debug("WARNING: RestartGame is not implemented");
 }
 
+void PoliceBust(ArgArray args) {
+    // assert types
+    debug("WARNING: PoliceBust is not implemented");
+}
+
 void DossierAdd(ArgArray args) {
     // assert types
     debug("WARNING: DossierAdd is not implemented");
@@ -256,6 +261,7 @@ static struct FuncTable {
     { VSPicture,       "VSPicture"},
     { CRect,           "CRect"},
     { RestartGame,     "RestartGame"},
+    { PoliceBust,      "PoliceBust"},
     { 0, 0}
 };
 
diff --git a/engines/private/module.mk b/engines/private/module.mk
index 4259259beb..5af360484d 100644
--- a/engines/private/module.mk
+++ b/engines/private/module.mk
@@ -2,10 +2,11 @@ MODULE := engines/private
  
 MODULE_OBJS := \
 	metaengine.o \
-        code.o \
+    code.o \
+	cursors.o \
 	symbol.o \
 	funcs.o \
-        grammar.tab.o \
+    grammar.tab.o \
 	lex.yy.o \
 	private.o
  
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 928c214f7b..f9fc613cef 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -28,31 +28,6 @@ PrivateEngine *g_private = NULL;
 
 extern int parse(char*);
 
-static const byte MOUSECURSOR_SCI[] = {
-    1,1,0,0,0,0,0,0,0,0,0,
-    1,2,1,0,0,0,0,0,0,0,0,
-    1,2,2,1,0,0,0,0,0,0,0,
-    1,2,2,2,1,0,0,0,0,0,0,
-    1,2,2,2,2,1,0,0,0,0,0,
-    1,2,2,2,2,2,1,0,0,0,0,
-    1,2,2,2,2,2,2,1,0,0,0,
-    1,2,2,2,2,2,2,2,1,0,0,
-    1,2,2,2,2,2,2,2,2,1,0,
-    1,2,2,2,2,2,2,2,2,2,1,
-    1,2,2,2,2,2,1,0,0,0,0,
-    1,2,1,0,1,2,2,1,0,0,0,
-    1,1,0,0,1,2,2,1,0,0,0,
-    0,0,0,0,0,1,2,2,1,0,0,
-    0,0,0,0,0,1,2,2,1,0,0,
-    0,0,0,0,0,0,1,2,2,1,0
-};
-
-static const byte cursorPalette[] = {
-    0, 0, 0,           // Black / Transparent
-    0x80, 0x80, 0x80,  // Gray
-    0xff, 0xff, 0xff   // White
-};
-
 PrivateEngine::PrivateEngine(OSystem *syst)
     : Engine(syst) {
     // Put your engine in a sane state, but do nothing big yet;
@@ -114,7 +89,7 @@ Common::Error PrivateEngine::run() {
     _transparentColor = _pixelFormat.RGBToColor(0,255,0);
     initGraphics(_screenW, _screenH, &_pixelFormat);
 
-    CursorMan.replaceCursor(MOUSECURSOR_SCI, 11, 16, 0, 0, 0);
+    CursorMan.replaceCursor(MOUSECURSOR_kExit, 32, 32, 0, 0, 0);
     CursorMan.replaceCursorPalette(cursorPalette, 0, 3);
 
     _origin = new Common::Point(0, 0);
diff --git a/engines/private/private.h b/engines/private/private.h
index 1f3ec553f6..4f8142f621 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -23,6 +23,10 @@ struct ManagedSurface;
 
 namespace Private {
 
+extern const byte MOUSECURSOR_SCI[];
+extern const byte MOUSECURSOR_kExit[];
+extern const byte cursorPalette[];
+
 class Console;
 
 // our engine debug channels


Commit: 0c3a74fdd801ab3deefafca594be74ae9d997e94
    https://github.com/scummvm/scummvm/commit/0c3a74fdd801ab3deefafca594be74ae9d997e94
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: more stuff

Changed paths:
  A engines/private/cursors.h
    engines/private/cursors.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index 3e86114114..84b93eaf9e 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -1,6 +1,4 @@
-#include "common/scummsys.h"
-
-#include "private.h"
+#include "private/cursors.h"
 
 namespace Private {
 
@@ -23,7 +21,7 @@ const byte MOUSECURSOR_SCI[] = {
     0,0,0,0,0,0,1,2,2,1,0
 };
 
-const byte MOUSECURSOR_kExit[] = {
+extern const byte MOUSECURSOR_kExit[] = {
 0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,0,0,0,0,0,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -268,10 +266,34 @@ const byte MOUSECURSOR_kPhone[] {
 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
-const byte cursorPalette[] = {
+extern const byte cursorPalette[] = {
     0, 0, 0,           // Black / Transparent
     0x01, 0x01, 0x01,  // Gray
     0xff, 0xff, 0xff   // White
 };
 
+static struct CursorTable {
+    const char *name;
+    const byte *cursor;
+} cursorTable[] = {
+    { "kExit",         MOUSECURSOR_kExit},
+    { "kInventory",    MOUSECURSOR_kInventory},
+    { "kTurnLeft",     MOUSECURSOR_kTurnLeft},
+    { "kTurnRight",    MOUSECURSOR_kTurnRight},
+    { "kZoomIn",       MOUSECURSOR_kZoomIn},
+    { "kZoomOut",      MOUSECURSOR_kZoomOut},
+    { "kPhone",        MOUSECURSOR_kPhone},
+    { "default",       MOUSECURSOR_SCI},
+    { 0, 0}
+};
+
+CursorMap _cursors;
+
+void initCursors() {
+    for (Private::CursorTable *cur = Private::cursorTable; cur->name; cur++) {
+        Common::String *name = new Common::String(cur->name);
+        _cursors.setVal(*name, cur->cursor);
+    }
+}
+
 }
\ No newline at end of file
diff --git a/engines/private/cursors.h b/engines/private/cursors.h
new file mode 100644
index 0000000000..28764ec5aa
--- /dev/null
+++ b/engines/private/cursors.h
@@ -0,0 +1,28 @@
+#include "common/scummsys.h"
+#include "common/str.h"
+#include "common/hash-str.h"
+
+#ifndef PRIVATE_CURSORS_H
+#define PRIVATE_CURSORS_H
+
+typedef Common::HashMap<Common::String, const byte*> CursorMap;
+
+namespace Private {
+
+extern const byte MOUSECURSOR_SCI[];
+extern const byte MOUSECURSOR_kExit[];
+extern const byte MOUSECURSOR_kZoomIn[];
+extern const byte MOUSECURSOR_kZoomOut[];
+extern const byte MOUSECURSOR_kInventory[];
+extern const byte MOUSECURSOR_kTurnLeft[];
+extern const byte MOUSECURSOR_kTurnRight[];
+extern const byte MOUSECURSOR_kPhone[];
+
+extern const byte cursorPalette[];
+extern void initCursors();
+
+extern CursorMap _cursors;
+
+}
+
+#endif
\ No newline at end of file
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index f9fc613cef..dfa3da1712 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -18,10 +18,12 @@
 #include "image/bmp.h"
 #include "graphics/cursorman.h"
 
+#include "private/cursors.h"
 #include "private/private.h"
 #include "private/grammar.tab.h"
 #include "private/grammar.h"
 
+
 namespace Private {
 
 PrivateEngine *g_private = NULL;
@@ -76,8 +78,12 @@ Common::Error PrivateEngine::run() {
 
     void *buf = malloc(191000);
     file->read(buf, 191000);
+
+    // Initialize stuff
     initInsts();
     initFuncs();
+    initCursors();
+
     parse((char *) buf);
     assert(constants.size() > 0);
 
@@ -89,7 +95,7 @@ Common::Error PrivateEngine::run() {
     _transparentColor = _pixelFormat.RGBToColor(0,255,0);
     initGraphics(_screenW, _screenH, &_pixelFormat);
 
-    CursorMan.replaceCursor(MOUSECURSOR_kExit, 32, 32, 0, 0, 0);
+    CursorMan.replaceCursor(_cursors.getVal("default"), 11, 16, 0, 0, 0, true);
     CursorMan.replaceCursorPalette(cursorPalette, 0, 3);
 
     _origin = new Common::Point(0, 0);
@@ -123,6 +129,7 @@ Common::Error PrivateEngine::run() {
 
     while (!shouldQuit()) {
         while (g_system->getEventManager()->pollEvent(event)) {
+            mousePos = g_system->getEventManager()->getMousePos();
             // Events
             switch (event.type) {
             case Common::EVENT_KEYDOWN:
@@ -135,12 +142,18 @@ Common::Error PrivateEngine::run() {
                 break;
 
             case Common::EVENT_LBUTTONDOWN:
-                mousePos = g_system->getEventManager()->getMousePos();
                 selectMask(mousePos);
                 if (!_nextSetting)
                     selectExit(mousePos);
                 break;
 
+            case Common::EVENT_MOUSEMOVE:
+                CursorMan.replaceCursor(_cursors.getVal("default"), 11, 16, 0, 0, 0, true);
+                cursorExit(mousePos);
+                cursorMask(mousePos);
+                //
+                break;
+
             default:
             {}
 
@@ -186,9 +199,64 @@ Common::Error PrivateEngine::run() {
     return Common::kNoError;
 }
 
+bool PrivateEngine::cursorExit(Common::Point mousePos) {
+    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
+    mousePos = mousePos - *_origin;
+    if (mousePos.x < 0 || mousePos.y < 0)
+        return false;
+
+    ExitInfo e;
+    bool inside = false;
+    for (ExitList::iterator it = _exits.begin(); it != _exits.end(); ++it) {
+        e = *it;
+        if (e.rect->contains(mousePos)) {
+            inside = true;
+            if (e.cursor != NULL)
+                CursorMan.replaceCursor(_cursors.getVal(*e.cursor), 32, 32, 0, 0, 0, true);
+        }
+    }
+    //if (!inside)
+    //    CursorMan.replaceCursor(_cursors.getVal("default"), 11, 16, 0, 0, 0, true);
+
+    return inside;
+}
+
+bool PrivateEngine::cursorMask(Common::Point mousePos) {
+    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
+    mousePos = mousePos - *_origin;
+    if (mousePos.x < 0 || mousePos.y < 0)
+        return false;
+
+    MaskInfo m;
+    bool inside = false;
+    for (MaskList::iterator it = _masks.begin(); it != _masks.end(); ++it) {
+        m = *it;
+
+        //debug("Testing mask %s", m.nextSetting->c_str());
+        if ( *((uint32*) m.surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
+            //debug("Inside!");
+            if (m.nextSetting != NULL) { // TODO: check this
+                inside = true;
+                debug("Rendering cursor mask %s", m.cursor->c_str());
+                assert(_cursors.contains(*m.cursor));
+                CursorMan.replaceCursor(_cursors.getVal(*m.cursor), 32, 32, 0, 0, 0, true);
+                break;
+            }
+
+        }
+    }
+    //if (!inside)
+    //    CursorMan.replaceCursor(_cursors.getVal("default"), 11, 16, 0, 0, 0, true);
+    return inside;
+}
+
+
 void PrivateEngine::selectExit(Common::Point mousePos) {
-    debug("Mousepos %d %d", mousePos.x, mousePos.y);
+    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
     mousePos = mousePos - *_origin;
+    if (mousePos.x < 0 || mousePos.y < 0)
+        return;
+
     Common::String *ns = NULL;
     int rs = 100000000;
     int cs = 0;
@@ -196,7 +264,7 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
     for (ExitList::iterator it = _exits.begin(); it != _exits.end(); ++it) {
         e = *it;
         cs = e.rect->width()*e.rect->height();
-        debug("Testing exit %s %d", e.nextSetting->c_str(), cs);
+        //debug("Testing exit %s %d", e.nextSetting->c_str(), cs);
         if (e.rect->contains(mousePos)) {
             debug("Inside! %d %d", cs, rs);
             if (cs < rs && e.nextSetting != NULL) { // TODO: check this
@@ -216,12 +284,15 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
 void PrivateEngine::selectMask(Common::Point mousePos) {
     //debug("Mousepos %d %d", mousePos.x, mousePos.y);
     mousePos = mousePos - *_origin;
+    if (mousePos.x < 0 || mousePos.y < 0)
+        return;
+
     Common::String *ns = NULL;
     MaskInfo m;
     for (MaskList::iterator it = _masks.begin(); it != _masks.end(); ++it) {
         m = *it;
 
-        debug("Testing mask %s", m.nextSetting->c_str());
+        //debug("Testing mask %s", m.nextSetting->c_str());
         if ( *((uint32*) m.surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
             debug("Inside!");
             if (m.nextSetting != NULL) { // TODO: check this
@@ -364,48 +435,38 @@ Graphics::ManagedSurface *PrivateEngine::loadMask(const Common::String &name, in
     surf->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), Common::Point(x,y));
 
     if (drawn) {
-        _compositeSurface->transBlitFrom(surf->rawSurface(), Common::Point(x,y), _transparentColor);
+        _compositeSurface->transBlitFrom(surf->rawSurface(), *_origin + Common::Point(x,y), _transparentColor);
         drawScreen();
     }
 
     return surf;
 }
 
+void PrivateEngine::drawScreen() {    
+    Graphics::Surface *screen = g_system->lockScreen();
+    Graphics::ManagedSurface *surface = _compositeSurface;
+    int w = surface->w;
+    int h = surface->h;
+
+    if (_videoDecoder) {
+        Graphics::Surface *frame = new Graphics::Surface;
+        frame->create(_screenW, _screenH, _pixelFormat);
+        frame->copyFrom(*_videoDecoder->decodeNextFrame());
+        const Common::Point o(_origin->x, _origin->y);
+        surface->transBlitFrom(*frame->convertTo(_pixelFormat, _videoDecoder->getPalette()), o);
+    }
 
+    assert(w == _screenW && h == _screenH);
 
+    screen->copyRectToSurface(*surface, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
+    g_system->unlockScreen();
+    //if (_image->getPalette() != nullptr)
+    //    g_system->getPaletteManager()->setPalette(_image->getPalette(), _image->getPaletteStartIndex(), _image->getPaletteColorCount());
+    //if (_image->getPalette() != nullptr)
+    //	g_system->getPaletteManager()->setPalette(_image->getPalette(), 0, 256);
+    //g_system->getPaletteManager()->setPalette(_videoDecoder->getPalette(), 0, 256);
+    g_system->updateScreen();
 
-void PrivateEngine::drawScreen() {
-    if (_videoDecoder ? _videoDecoder->needsUpdate() : false || _compositeSurface) {
-        Graphics::Surface *screen = g_system->lockScreen();
-        //screen->fillRect(Common::Rect(0, 0, g_system->getWidth(), g_system->getHeight()), 0);
-        //
-        //if (_mode == 1)
-        //    drawScreenFrame();
-
-        Graphics::ManagedSurface *surface = _compositeSurface;
-
-        if (_videoDecoder) {
-            Graphics::Surface *frame = new Graphics::Surface;
-            frame->create(_screenW, _screenH, _pixelFormat);
-            frame->copyFrom(*_videoDecoder->decodeNextFrame());
-            const Common::Point o(_origin->x, _origin->y);
-            surface->transBlitFrom(*frame->convertTo(_pixelFormat, _videoDecoder->getPalette()), o);
-        }
-
-        int w = surface->w; //CLIP<int>(surface->w, 0, _screenW);
-        int h = surface->h; //CLIP<int>(surface->h, 0, _screenH);
-        assert(w == _screenW && h == _screenH);
-
-        screen->copyRectToSurface(*surface, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
-
-        g_system->unlockScreen();
-        //if (_image->getPalette() != nullptr)
-        //    g_system->getPaletteManager()->setPalette(_image->getPalette(), _image->getPaletteStartIndex(), _image->getPaletteColorCount());
-        //if (_image->getPalette() != nullptr)
-        //	g_system->getPaletteManager()->setPalette(_image->getPalette(), 0, 256);
-        //g_system->getPaletteManager()->setPalette(_videoDecoder->getPalette(), 0, 256);
-        g_system->updateScreen();
-    }
 }
 
 
diff --git a/engines/private/private.h b/engines/private/private.h
index 4f8142f621..b3c8b6c120 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -23,10 +23,6 @@ struct ManagedSurface;
 
 namespace Private {
 
-extern const byte MOUSECURSOR_SCI[];
-extern const byte MOUSECURSOR_kExit[];
-extern const byte cursorPalette[];
-
 class Console;
 
 // our engine debug channels
@@ -76,7 +72,12 @@ public:
 
 	Common::Error run() override;
 	void selectMask(Common::Point);
-        void selectExit(Common::Point); 
+    void selectExit(Common::Point);
+
+	bool cursorExit(Common::Point);
+	bool cursorMask(Common::Point);
+	
+
 	bool hasFeature(EngineFeature f) const override;
 	bool canLoadGameStateCurrently() override { return true; }
 	bool canSaveGameStateCurrently() override { return true; }
@@ -84,31 +85,31 @@ public:
 	Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
 	void syncGameStream(Common::Serializer &s);
 
-        Common::String convertPath(Common::String); 
+    Common::String convertPath(Common::String); 
 	void playSound(const Common::String &name);
 	void playVideo(const Common::String &name);
-        void skipVideo();
+    void skipVideo();
 	void stopSound();
 
 	void loadImage(const Common::String &file, int x, int y, bool drawn = true);
-        void drawScreenFrame();
+    void drawScreenFrame();
         
 	Graphics::ManagedSurface *loadMask(const Common::String &, int, int, bool);
  
-        uint32 _transparentColor;	
+    uint32 _transparentColor;	
 	void drawScreen();
 
-        // global state
+    // global state
 	Common::Point *_origin;
-        Common::String *_nextSetting;
-        Common::String *_nextVS;
-        Common::String *_frame;
+    Common::String *_nextSetting;
+    Common::String *_nextVS;
+    Common::String *_frame;
 
 	int _mode;
-        bool _modified;
-        Common::String *_nextMovie;
-        ExitList _exits;
-        MaskList _masks;
+    bool _modified;
+    Common::String *_nextMovie;
+    ExitList _exits;
+    MaskList _masks;
 
 };
 


Commit: c912eed42a3ad901a391786ba731a3768dbcbc23
    https://github.com/scummvm/scummvm/commit/c912eed42a3ad901a391786ba731a3768dbcbc23
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: more functions

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/grammar.h
    engines/private/grammar.y
    engines/private/private.cpp
    engines/private/private.h
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 3ae8ccb992..959b04781c 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -4,6 +4,7 @@
 
 #include "grammar.h"
 #include "grammar.tab.h"
+#include "private.h"
 
 namespace Private {
 
@@ -425,6 +426,18 @@ int ifcode()
     return 0;
 }
 
+int randbool()
+{
+    Datum d;
+    d = pop();
+    
+    int v = g_private->getRandomBool(d.u.val);
+     
+    d.u.val = v;
+    push(d);
+    return 0;
+}
+
 int fail()
 {
     assert(0);
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index b96db8f49a..85123759f8 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -43,6 +43,14 @@ void Goto(ArgArray args) { // should be goto, but this is a reserved word
     g_private->_nextSetting = s;
 }
 
+
+void SyncSound(ArgArray args) { // should be goto, but this is a reserved word
+    // assert types
+    debug("SyncSound(%s, %s)", args[0].u.str, args[1].u.str);
+    Common::String *s = new Common::String(args[1].u.str);
+    g_private->_nextSetting = s;
+}
+
 void Quit(ArgArray args) {
     debug("Quit()");
     g_private->quitGame();
@@ -69,9 +77,62 @@ void DossierAdd(ArgArray args) {
     debug("WARNING: DossierAdd is not implemented");
 }
 
+void NoStopSounds(ArgArray args) {
+    // assert types
+    debug("WARNING: NoStopSounds is not implemented");
+}
+
 void Inventory(ArgArray args) {
+
     // assert types
-    debug("WARNING: Inventory is not implemented");
+    Datum b1 = args[0]; 
+    Datum v1 = args[1];
+    Datum v2 = args[2];
+    Datum e = args[3];
+
+    Datum snd = args[8];
+
+    assert(v1.type == STRING || v1.type == NAME);
+    assert(b1.type == STRING);
+    assert(e.type == STRING || e.type == NUM);
+    assert(snd.type == STRING);
+
+
+    if (v1.type == STRING)
+        assert(strcmp(v1.u.str, "\"\"") == 0);
+
+    debug("Inventory(...)");
+    
+    if (strcmp(b1.u.str, "\"\"") != 0) {
+        Common::String *s = new Common::String(b1.u.str);
+        MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+        m->surf = g_private->loadMask(*s, 0, 0, true);
+        
+        if (e.type == NUM)
+            m->nextSetting = NULL;
+        else
+            m->nextSetting = new Common::String(e.u.str);
+
+        m->cursor = new Common::String("kInventory");
+        m->point = new Common::Point(0,0);
+        if (v1.type == NAME)
+            m->flag = v2.u.sym;
+        else
+            m->flag = NULL;
+        
+        g_private->_masks.push_front(*m);
+
+    }
+
+    if (v1.type == NAME)
+        v1.u.sym->u.val = 1;
+    
+    if (strcmp(snd.u.str, "\"\"") != 0) {
+        Common::String *s = new Common::String(snd.u.str);
+        g_private->playSound(*s);
+    }
+ 
+    // TODO: Keep track of inventory is missing    
 }
 
 void SetFlag(ArgArray args) {
@@ -112,7 +173,6 @@ void SetModifiedFlag(ArgArray args) {
     g_private->_modified = (bool) args[0].u.val;
 }
 
-
 void Sound(ArgArray args) {
     // assert types
     debug("Sound(%s)", args[0].u.str);
@@ -139,6 +199,11 @@ void LoopedSound(ArgArray args) {
 }
 
 
+void ViewScreen(ArgArray args) {
+    // assert types
+    debug("WARNING: ViewScreen not implemented!");
+}
+
 void Transition(ArgArray args) {
     // assert types
     debug("Transition(%s, %s)", args[0].u.str, args[1].u.str);
@@ -215,6 +280,7 @@ void _Mask(ArgArray args, bool drawn) {
     m->surf = g_private->loadMask(*s, x, y, drawn);
     m->nextSetting = new Common::String(e);
     m->cursor = c;
+    m->flag = NULL;
     m->point = new Common::Point(x,y);
     g_private->_masks.push_front(*m);
 
@@ -247,6 +313,8 @@ static struct FuncTable {
     { Sound,           "Sound"},
     { Sound,           "SoundEffect"},
     { Sound,           "LoopedSound"},
+    { NoStopSounds,    "NoStopSounds"},
+    { SyncSound,       "SyncSound"},
     { Mask,            "Mask"},
     { MaskDrawn,       "MaskDrawn"},
     { Timer,	       "Timer"},
@@ -255,6 +323,7 @@ static struct FuncTable {
     { SetModifiedFlag, "SetModifiedFlag"},
     { Exit,            "Exit"},
     { Quit,            "Quit"},
+    { ViewScreen,      "ViewScreen"},
     { LoadGame,        "LoadGame"},
     { DossierAdd,      "DossierAdd"},
     { Inventory,       "Inventory"},
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 3095ca86bd..793a9fdd9d 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -75,6 +75,7 @@ extern SettingMap settingcode;
 // Symbols
 
 extern void showSymbol(Symbol *);
+extern void setSymbol(Symbol *, int);
 
 typedef Common::HashMap<Common::String, Symbol*> SymbolMap;
 typedef Common::List<Symbol*> ConstantList;
@@ -121,6 +122,7 @@ extern  int le();
 extern  int ge();
 extern  int eq();
 extern  int ne();
+extern  int randbool();
 
 // Code Execution
 
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index d5adc8eab1..75bbf525d7 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -160,5 +160,5 @@ expr:     value           { $$ = $1; }
         | value LTE value { code1(Private::le); }
         | value GTE value { code1(Private::ge); }
         | value '+'       { code1(fail); } 
-        | RANDOMTOK '(' NUM '%' ')' { code1(fail); }
+        | RANDOMTOK '(' NUM '%' ')' { code3(Private::constpush, (Private::Inst)$NUM, randbool); }
         ;
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index dfa3da1712..ee9660f330 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -97,7 +97,8 @@ Common::Error PrivateEngine::run() {
 
     CursorMan.replaceCursor(_cursors.getVal("default"), 11, 16, 0, 0, 0, true);
     CursorMan.replaceCursorPalette(cursorPalette, 0, 3);
-
+    CursorMan.showMouse(true);
+    
     _origin = new Common::Point(0, 0);
     _image = new Image::BitmapDecoder();
     _compositeSurface = new Graphics::ManagedSurface();
@@ -128,6 +129,9 @@ Common::Error PrivateEngine::run() {
     _nextSetting = new Common::String("kGoIntro");
 
     while (!shouldQuit()) {
+        if (_mode == 1)
+            drawScreenFrame();
+
         while (g_system->getEventManager()->pollEvent(event)) {
             mousePos = g_system->getEventManager()->getMousePos();
             // Events
@@ -187,9 +191,10 @@ Common::Error PrivateEngine::run() {
             _masks.clear();
             loadSetting(_nextSetting);
             _nextSetting = NULL;
-            CursorMan.showMouse(false);
+            //CursorMan.showMouse(false);
             execute(prog);
-            CursorMan.showMouse(true);
+            CursorMan.replaceCursor(_cursors.getVal("default"), 11, 16, 0, 0, 0, true);
+            //CursorMan.showMouse(true);
         }
 
         g_system->updateScreen();
@@ -298,9 +303,14 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
             if (m.nextSetting != NULL) { // TODO: check this
                 debug("Found Mask %s", m.nextSetting->c_str());
                 ns = m.nextSetting;
-                break;
             }
 
+            if (m.flag != NULL) { // TODO: check this
+                setSymbol(m.flag, 1);
+            }
+
+            break;
+
         }
     }
     if (ns != NULL) {
@@ -311,9 +321,7 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
 
 bool PrivateEngine::hasFeature(EngineFeature f) const {
     return
-        (f == kSupportsReturnToLauncher) ||
-        (f == kSupportsLoadingDuringRuntime) ||
-        (f == kSupportsSavingDuringRuntime);
+        (f == kSupportsReturnToLauncher);
 }
 
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
@@ -469,6 +477,10 @@ void PrivateEngine::drawScreen() {
 
 }
 
+bool PrivateEngine::getRandomBool(uint p) {
+    uint r = _rnd->getRandomNumber(100);
+    return (r <= p);   
+}
 
 
 } // End of namespace Private
diff --git a/engines/private/private.h b/engines/private/private.h
index b3c8b6c120..a2aa485c91 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -13,6 +13,8 @@
 #include "graphics/palette.h"
 #include "graphics/managed_surface.h"
 
+#include "private/grammar.h"
+
 namespace Image {
 class ImageDecoder;
 }
@@ -45,6 +47,7 @@ typedef struct MaskInfo {
     Graphics::ManagedSurface *surf;
     Common::String *nextSetting;
     Common::Point *point;
+	Symbol *flag;
     Common::String *cursor;    
 } MaskInfo;
 
@@ -56,7 +59,7 @@ private:
 	// We need random numbers
 	Common::RandomSource *_rnd;
 
-        Graphics::PixelFormat _pixelFormat;
+    Graphics::PixelFormat _pixelFormat;
 	Image::ImageDecoder *_image;
 	Graphics::ManagedSurface *_compositeSurface;
 
@@ -111,6 +114,8 @@ public:
     ExitList _exits;
     MaskList _masks;
 
+	bool getRandomBool(uint);
+
 };
 
 extern PrivateEngine *g_private;
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 2498924167..71069f956f 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -36,6 +36,10 @@ void showSymbol(Symbol *s)
         debug("%s %d", s->name->c_str(), s->type);
 }
 
+void setSymbol(Symbol *s, int v) {
+    //assert(s->type == STRING);
+    s->u.val = v;
+}
 
 Symbol *lookup(Common::String s, SymbolMap symlist)	/* find s in symbol table symlist */
 {


Commit: 78febfbd00661a78b21b71eb581b355a0ff1a38f
    https://github.com/scummvm/scummvm/commit/78febfbd00661a78b21b71eb581b355a0ff1a38f
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixed detection from assets without installing

Changed paths:
  A common/installer_archive.cpp
  A common/installer_archive.h
    common/module.mk
    engines/private/detection.cpp
    engines/private/funcs.cpp
    engines/private/grammar.y
    engines/private/private.cpp
    engines/private/private.h


diff --git a/common/installer_archive.cpp b/common/installer_archive.cpp
new file mode 100644
index 0000000000..cef3d4b9de
--- /dev/null
+++ b/common/installer_archive.cpp
@@ -0,0 +1,136 @@
+/* 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/installer_archive.h"
+
+#include "common/dcl.h"
+#include "common/debug.h"
+
+namespace Common {
+
+InstallerArchive::InstallerArchive() : Common::Archive() {
+	_stream = nullptr;
+}
+
+InstallerArchive::~InstallerArchive() {
+	close();
+}
+
+bool InstallerArchive::open(const Common::String &filename) {
+	close();
+
+	_stream = SearchMan.createReadStreamForMember(filename);
+
+	if (!_stream)
+		return false;
+
+	// Check for the magic uint32
+	// No idea what it means, but it's how "file" recognizes them
+	if (_stream->readUint32BE() != 0x135D658C) {
+		close();
+		return false;
+	}
+
+	// Let's pull some relevant data from the header
+	_stream->seek(41);
+	uint32 directoryTableOffset = _stream->readUint32LE();
+	/* uint32 directoryTableSize = */ _stream->readUint32LE();
+	uint16 directoryCount = _stream->readUint16LE();
+	uint32 fileTableOffset = _stream->readUint32LE();
+	/* uint32 fileTableSize = */ _stream->readUint32LE();
+
+	// We need to have at least one directory in order for the archive to be valid
+	if (directoryCount == 0) {
+		close();
+		return false;
+	}
+
+	// TODO: Currently, we only support getting files from the first directory
+	// To that end, get the number of files from that entry
+	_stream->seek(directoryTableOffset);
+	uint16 fileCount = _stream->readUint16LE();
+	debug(2, "File count = %d", fileCount);
+
+	// Following the directory table is the file table with files stored recursively
+	// by directory. Since we're only using the first directory, we can just go
+	// right to that one.
+	_stream->seek(fileTableOffset);
+
+	for (uint16 i = 0; i < fileCount; i++) {
+		FileEntry entry;
+
+		_stream->skip(3); // Unknown
+
+		entry.uncompressedSize = _stream->readUint32LE();
+		entry.compressedSize = _stream->readUint32LE();
+		entry.offset = _stream->readUint32LE();
+
+		_stream->skip(14); // Unknown
+
+		byte nameLength = _stream->readByte();
+		Common::String name;
+		while (nameLength--)
+			name += _stream->readByte();
+
+		_stream->skip(13); // Unknown
+
+		_map[name] = entry;
+
+		debug(3, "Found file '%s' at 0x%08x (Comp: 0x%08x, Uncomp: 0x%08x)", name.c_str(),
+				entry.offset, entry.compressedSize, entry.uncompressedSize);
+	}
+
+	return true;
+}
+
+void InstallerArchive::close() {
+	delete _stream; _stream = nullptr;
+	_map.clear();
+}
+
+bool InstallerArchive::hasFile(const Common::String &name) const {
+	return _map.contains(name);
+}
+
+int InstallerArchive::listMembers(Common::ArchiveMemberList &list) const {
+	for (FileMap::const_iterator it = _map.begin(); it != _map.end(); it++)
+		list.push_back(getMember(it->_key));
+
+	return _map.size();
+}
+
+const Common::ArchiveMemberPtr InstallerArchive::getMember(const Common::String &name) const {
+	return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
+}
+
+Common::SeekableReadStream *InstallerArchive::createReadStreamForMember(const Common::String &name) const {
+	if (!_stream || !_map.contains(name))
+		return nullptr;
+
+	const FileEntry &entry = _map[name];
+
+	// Seek to our offset and then send it off to the decompressor
+	_stream->seek(entry.offset);
+	return Common::decompressDCL(_stream, entry.compressedSize, entry.uncompressedSize);
+}
+
+} // End of namespace Common
diff --git a/common/installer_archive.h b/common/installer_archive.h
new file mode 100644
index 0000000000..ddb8c73aef
--- /dev/null
+++ b/common/installer_archive.h
@@ -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.
+ *
+ * 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/archive.h"
+#include "common/scummsys.h"
+#include "common/endian.h"
+#include "common/file.h"
+#include "common/hash-str.h"
+#include "common/hashmap.h"
+#include "common/str.h"
+
+#ifndef COMMON_INSTALLER_ARCHIVE_H
+#define COMMON_INSTALLER_ARCHIVE_H
+
+namespace Common {
+
+class InstallerArchive : public Common::Archive {
+public:
+	InstallerArchive();
+	~InstallerArchive() override;
+
+	bool open(const Common::String &filename);
+	void close();
+	bool isOpen() const { return _stream != nullptr; }
+
+	// Common::Archive API implementation
+	bool hasFile(const Common::String &name) const override;
+	int listMembers(Common::ArchiveMemberList &list) const override;
+	const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
+	Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
+
+private:
+	struct FileEntry {
+		uint32 uncompressedSize;
+		uint32 compressedSize;
+		uint32 offset;
+	};
+
+	Common::SeekableReadStream *_stream;
+
+	typedef Common::HashMap<Common::String, FileEntry, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> FileMap;
+	FileMap _map;
+};
+
+} // End of namespace Common
+
+#endif
diff --git a/common/module.mk b/common/module.mk
index edfa8aa9d3..9b30351343 100644
--- a/common/module.mk
+++ b/common/module.mk
@@ -17,6 +17,7 @@ MODULE_OBJS := \
 	iff_container.o \
 	ini-file.o \
 	installshield_cab.o \
+	installer_archive.o \
 	json.o \
 	language.o \
 	localization.o \
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index 82cc79e90a..1c65707139 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -12,7 +12,7 @@ static const ADGameDescription gameDescriptions[] = {
     {
         "private-eye",
         0,
-        AD_ENTRY1s("GAME.DAT", "7a3eb7d9dedf40680ac3d088524f976e", 190735),
+        AD_ENTRY1s("ASSETS.Z", "3a7532349cda8126e96dd5e49884af3a", 40232),
         Common::EN_ANY,
         Common::kPlatformWindows,
         ADGF_NO_FLAGS,
@@ -21,7 +21,7 @@ static const ADGameDescription gameDescriptions[] = {
     {
         "private-eye",
         0,
-        AD_ENTRY1s("GAME.TXT", "28ee7295db2cf6d9358ad737e3a4c4c0", 19286),
+        AD_ENTRY1s("ASSETS.Z", "854e141bb67535359620a1833fcc1566", 5955),
         Common::EN_ANY,
         Common::kPlatformWindows,
         ADGF_DEMO,
@@ -33,7 +33,7 @@ static const ADGameDescription gameDescriptions[] = {
 } // End of namespace Private
 
 static const char *const directoryGlobs[] = {
-    "assets", // english CD
+    "SUPPORT", 
     0
 };
 
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 85123759f8..e0d0c03444 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -289,6 +289,27 @@ void _Mask(ArgArray args, bool drawn) {
 void Mask(ArgArray args) { _Mask(args, false); }
 void MaskDrawn(ArgArray args) { _Mask(args, true); }
 
+void AddSound(char *s, char *t) {
+    Common::String str(t);
+    if (strcmp(t, "AMRadioClip") == 0)
+        g_private->_radio.push_front(str);
+    else if (strcmp(t, "PoliceClip") == 0)
+        g_private->_police.push_front(str);
+    else if (strcmp(t, "PhoneClip") == 0)
+        g_private->_phone.push_front(str);
+    else
+        debug("error: invalid sound type %s", t);
+}
+
+void AMRadioClip(ArgArray args) { AddSound(args[0].u.str, "AMRadioClip"); }
+void PoliceClip(ArgArray args) { AddSound(args[0].u.str, "PoliceClip"); }
+void PhoneClip(ArgArray args) { AddSound(args[0].u.str, "PhoneClip"); }
+
+void SoundArea(ArgArray args) {
+    // assert types
+    debug("WARNING: SoundArea not implemented!");
+}
+
 void Timer(ArgArray args) {
     assert (args.size() == 2 || args.size() == 3);
 
@@ -306,28 +327,40 @@ static struct FuncTable {
     void (*func)(Private::ArgArray);
     const char *name;
 } funcTable[] = {
-    { Bitmap,          "Bitmap"},
+
     { ChgMode,         "ChgMode"},
     { Goto,            "goto"},
     { SetFlag,         "SetFlag"},
+    { Timer,	       "Timer"},
+
+    // Sounds
     { Sound,           "Sound"},
     { Sound,           "SoundEffect"},
     { Sound,           "LoopedSound"},
     { NoStopSounds,    "NoStopSounds"},
     { SyncSound,       "SyncSound"},
+    { AMRadioClip,     "AMRadioClip"},
+    { PoliceClip,      "PoliceClip"},
+    { PhoneClip,       "PhoneClip"},
+    { SoundArea,       "SoundArea"},
+ 
+    // Images
+    { Bitmap,          "Bitmap"},
     { Mask,            "Mask"},
     { MaskDrawn,       "MaskDrawn"},
-    { Timer,	       "Timer"},
+    { VSPicture,       "VSPicture"},
+    { ViewScreen,      "ViewScreen"},
+ 
+    // Video
     { Transition,      "Transition"},
     { Movie,           "Movie"},
+
     { SetModifiedFlag, "SetModifiedFlag"},
     { Exit,            "Exit"},
     { Quit,            "Quit"},
-    { ViewScreen,      "ViewScreen"},
     { LoadGame,        "LoadGame"},
     { DossierAdd,      "DossierAdd"},
     { Inventory,       "Inventory"},
-    { VSPicture,       "VSPicture"},
     { CRect,           "CRect"},
     { RestartGame,     "RestartGame"},
     { PoliceBust,      "PoliceBust"},
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 75bbf525d7..ff3663ee6a 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -159,6 +159,6 @@ expr:     value           { $$ = $1; }
         | value '>' value { code1(Private::gt); }
         | value LTE value { code1(Private::le); }
         | value GTE value { code1(Private::ge); }
-        | value '+'       { code1(fail); } 
+        | value '+'       { $$ = $1; } // unclear what it should do 
         | RANDOMTOK '(' NUM '%' ')' { code3(Private::constpush, (Private::Inst)$NUM, randbool); }
         ;
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index ee9660f330..4d041efc31 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -72,10 +72,16 @@ PrivateEngine::~PrivateEngine() {
 }
 
 Common::Error PrivateEngine::run() {
-    Common::File *file = new Common::File();
-    if (!file->open("GAME.DAT")) // if the full game is not used
-        assert(file->open("assets/GAME.TXT")); // open the demo file
+    
+    assert(_installerArchive.open("SUPPORT/ASSETS.Z"));    
+    Common::SeekableReadStream *file = NULL; 
 
+    if (_installerArchive.hasFile("GAME.DAT")) // if the full game is used
+        file = _installerArchive.createReadStreamForMember("GAME.DAT"); 
+    else if (_installerArchive.hasFile("GAME.TXT")) // if the demo is used
+        file = _installerArchive.createReadStreamForMember("GAME.TXT"); 
+
+    assert(file != NULL);
     void *buf = malloc(191000);
     file->read(buf, 191000);
 
@@ -98,7 +104,7 @@ Common::Error PrivateEngine::run() {
     CursorMan.replaceCursor(_cursors.getVal("default"), 11, 16, 0, 0, 0, true);
     CursorMan.replaceCursorPalette(cursorPalette, 0, 3);
     CursorMan.showMouse(true);
-    
+
     _origin = new Common::Point(0, 0);
     _image = new Image::BitmapDecoder();
     _compositeSurface = new Graphics::ManagedSurface();
@@ -237,6 +243,9 @@ bool PrivateEngine::cursorMask(Common::Point mousePos) {
     for (MaskList::iterator it = _masks.begin(); it != _masks.end(); ++it) {
         m = *it;
 
+        if (mousePos.x > m.surf->h || mousePos.y > m.surf->w)
+            continue;
+
         //debug("Testing mask %s", m.nextSetting->c_str());
         if ( *((uint32*) m.surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
             //debug("Inside!");
diff --git a/engines/private/private.h b/engines/private/private.h
index a2aa485c91..c6e1a78916 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -6,7 +6,7 @@
 #include "engines/engine.h"
 #include "gui/debugger.h"
 
-//#include "engines/mohawk/installer_archive.h"
+#include "common/installer_archive.h"
 
 #include "audio/mixer.h"
 #include "video/smk_decoder.h"
@@ -52,7 +52,8 @@ typedef struct MaskInfo {
 } MaskInfo;
 
 typedef Common::List<ExitInfo> ExitList;  
-typedef Common::List<MaskInfo> MaskList;  
+typedef Common::List<MaskInfo> MaskList;
+typedef Common::List<Common::String> SoundList;   
 
 class PrivateEngine : public Engine {
 private:
@@ -71,7 +72,7 @@ public:
 
 	Audio::SoundHandle _soundHandle;
 	Video::SmackerDecoder *_videoDecoder;
-	//Mohawk::InstallerArchive _installerArchive;
+	Common::InstallerArchive _installerArchive;
 
 	Common::Error run() override;
 	void selectMask(Common::Point);
@@ -114,6 +115,11 @@ public:
     ExitList _exits;
     MaskList _masks;
 
+	// Radios
+	SoundList _radio;
+	SoundList _police;
+	SoundList _phone;
+
 	bool getRandomBool(uint);
 
 };


Commit: a1b27d43e41ce2618af9e16cc62e294c99c608f4
    https://github.com/scummvm/scummvm/commit/a1b27d43e41ce2618af9e16cc62e294c99c608f4
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: added lex/bison generated files

Changed paths:
  A engines/private/grammar.tab.cpp
  A engines/private/grammar.tab.h
  A engines/private/lex.yy.cpp


diff --git a/engines/private/grammar.tab.cpp b/engines/private/grammar.tab.cpp
new file mode 100644
index 0000000000..776e830345
--- /dev/null
+++ b/engines/private/grammar.tab.cpp
@@ -0,0 +1,1683 @@
+/* A Bison parser, made by GNU Bison 3.7.2.  */
+
+/* Bison implementation for Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 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 3 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, see <http://www.gnu.org/licenses/>.  */
+
+/* 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.  */
+
+/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+   especially those whose name start with YY_ or yy_.  They are
+   private implementation details that can be changed or removed.  */
+
+/* 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 "3.7.2"
+
+/* Skeleton name.  */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers.  */
+#define YYPURE 0
+
+/* Push parsers.  */
+#define YYPUSH 0
+
+/* Pull parsers.  */
+#define YYPULL 1
+
+
+
+
+/* First part of user prologue.  */
+#line 5 "engines/private/grammar.y"
+
+
+#include "grammar.h"
+
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#define	code1(c1)	Private::code(c1);
+#define	code2(c1,c2)	Private::code(c1); Private::code(c2)
+#define	code3(c1,c2,c3)	Private::code(c1); Private::code(c2); Private::code(c3)
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+int yydebug=1;
+
+using namespace Private;
+
+extern int yylex();
+extern int yyparse();
+
+void yyerror(const char *str)
+{
+	//fprintf(stderr,"error: %s\n",str);
+}
+
+int yywrap()
+{
+	return 1;
+}
+
+
+#line 104 "engines/private/grammar.tab.cpp"
+
+# ifndef YY_CAST
+#  ifdef __cplusplus
+#   define YY_CAST(Type, Val) static_cast<Type> (Val)
+#   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
+#  else
+#   define YY_CAST(Type, Val) ((Type) (Val))
+#   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
+#  endif
+# endif
+# ifndef YY_NULLPTR
+#  if defined __cplusplus
+#   if 201103L <= __cplusplus
+#    define YY_NULLPTR nullptr
+#   else
+#    define YY_NULLPTR 0
+#   endif
+#  else
+#   define YY_NULLPTR ((void*)0)
+#  endif
+# endif
+
+#include "grammar.tab.h"
+/* Symbol kind.  */
+enum yysymbol_kind_t
+{
+  YYSYMBOL_YYEMPTY = -2,
+  YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
+  YYSYMBOL_YYerror = 1,                    /* error  */
+  YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
+  YYSYMBOL_NAME = 3,                       /* NAME  */
+  YYSYMBOL_STRING = 4,                     /* STRING  */
+  YYSYMBOL_NUM = 5,                        /* NUM  */
+  YYSYMBOL_LTE = 6,                        /* LTE  */
+  YYSYMBOL_GTE = 7,                        /* GTE  */
+  YYSYMBOL_NEQ = 8,                        /* NEQ  */
+  YYSYMBOL_EQ = 9,                         /* EQ  */
+  YYSYMBOL_FALSETOK = 10,                  /* FALSETOK  */
+  YYSYMBOL_TRUETOK = 11,                   /* TRUETOK  */
+  YYSYMBOL_NULLTOK = 12,                   /* NULLTOK  */
+  YYSYMBOL_IFTOK = 13,                     /* IFTOK  */
+  YYSYMBOL_ELSETOK = 14,                   /* ELSETOK  */
+  YYSYMBOL_RECT = 15,                      /* RECT  */
+  YYSYMBOL_GOTOTOK = 16,                   /* GOTOTOK  */
+  YYSYMBOL_DEBUGTOK = 17,                  /* DEBUGTOK  */
+  YYSYMBOL_DEFINETOK = 18,                 /* DEFINETOK  */
+  YYSYMBOL_SETTINGTOK = 19,                /* SETTINGTOK  */
+  YYSYMBOL_RANDOMTOK = 20,                 /* RANDOMTOK  */
+  YYSYMBOL_21_ = 21,                       /* '{'  */
+  YYSYMBOL_22_ = 22,                       /* '}'  */
+  YYSYMBOL_23_ = 23,                       /* ','  */
+  YYSYMBOL_24_ = 24,                       /* ';'  */
+  YYSYMBOL_25_ = 25,                       /* '('  */
+  YYSYMBOL_26_ = 26,                       /* ')'  */
+  YYSYMBOL_27_ = 27,                       /* '!'  */
+  YYSYMBOL_28_ = 28,                       /* '+'  */
+  YYSYMBOL_29_ = 29,                       /* '<'  */
+  YYSYMBOL_30_ = 30,                       /* '>'  */
+  YYSYMBOL_31_ = 31,                       /* '%'  */
+  YYSYMBOL_YYACCEPT = 32,                  /* $accept  */
+  YYSYMBOL_lines = 33,                     /* lines  */
+  YYSYMBOL_line = 34,                      /* line  */
+  YYSYMBOL_debug = 35,                     /* debug  */
+  YYSYMBOL_statements = 36,                /* statements  */
+  YYSYMBOL_statement = 37,                 /* statement  */
+  YYSYMBOL_body = 38,                      /* body  */
+  YYSYMBOL_end = 39,                       /* end  */
+  YYSYMBOL_if = 40,                        /* if  */
+  YYSYMBOL_cond = 41,                      /* cond  */
+  YYSYMBOL_define = 42,                    /* define  */
+  YYSYMBOL_fcall = 43,                     /* fcall  */
+  YYSYMBOL_startp = 44,                    /* startp  */
+  YYSYMBOL_params = 45,                    /* params  */
+  YYSYMBOL_value = 46,                     /* value  */
+  YYSYMBOL_expr = 47                       /* expr  */
+};
+typedef enum yysymbol_kind_t yysymbol_kind_t;
+
+
+
+
+#ifdef short
+# undef short
+#endif
+
+/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
+   <limits.h> and (if available) <stdint.h> are included
+   so that the code can choose integer types of a good width.  */
+
+#ifndef __PTRDIFF_MAX__
+# include <limits.h> /* INFRINGES ON USER NAME SPACE */
+# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
+#  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
+#  define YY_STDINT_H
+# endif
+#endif
+
+/* Narrow types that promote to a signed type and that can represent a
+   signed or unsigned integer of at least N bits.  In tables they can
+   save space and decrease cache pressure.  Promoting to a signed type
+   helps avoid bugs in integer arithmetic.  */
+
+#ifdef __INT_LEAST8_MAX__
+typedef __INT_LEAST8_TYPE__ yytype_int8;
+#elif defined YY_STDINT_H
+typedef int_least8_t yytype_int8;
+#else
+typedef signed char yytype_int8;
+#endif
+
+#ifdef __INT_LEAST16_MAX__
+typedef __INT_LEAST16_TYPE__ yytype_int16;
+#elif defined YY_STDINT_H
+typedef int_least16_t yytype_int16;
+#else
+typedef short yytype_int16;
+#endif
+
+#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST8_TYPE__ yytype_uint8;
+#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
+       && UINT_LEAST8_MAX <= INT_MAX)
+typedef uint_least8_t yytype_uint8;
+#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
+typedef unsigned char yytype_uint8;
+#else
+typedef short yytype_uint8;
+#endif
+
+#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST16_TYPE__ yytype_uint16;
+#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
+       && UINT_LEAST16_MAX <= INT_MAX)
+typedef uint_least16_t yytype_uint16;
+#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
+typedef unsigned short yytype_uint16;
+#else
+typedef int yytype_uint16;
+#endif
+
+#ifndef YYPTRDIFF_T
+# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
+#  define YYPTRDIFF_T __PTRDIFF_TYPE__
+#  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
+# elif defined PTRDIFF_MAX
+#  ifndef ptrdiff_t
+#   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#  endif
+#  define YYPTRDIFF_T ptrdiff_t
+#  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
+# else
+#  define YYPTRDIFF_T long
+#  define YYPTRDIFF_MAXIMUM LONG_MAX
+# endif
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+#  define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+#  define YYSIZE_T size_t
+# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
+#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYSIZE_T size_t
+# else
+#  define YYSIZE_T unsigned
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM                                  \
+  YY_CAST (YYPTRDIFF_T,                                 \
+           (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
+            ? YYPTRDIFF_MAXIMUM                         \
+            : YY_CAST (YYSIZE_T, -1)))
+
+#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
+
+
+/* Stored state numbers (used for stacks). */
+typedef yytype_int8 yy_state_t;
+
+/* State numbers in computations.  */
+typedef int yy_state_fast_t;
+
+#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
+
+
+#ifndef YY_ATTRIBUTE_PURE
+# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
+#  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define YY_ATTRIBUTE_PURE
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
+#  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+# else
+#  define YY_ATTRIBUTE_UNUSED
+# 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
+
+#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                            \
+    _Pragma ("GCC diagnostic push")                                     \
+    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
+    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
+    _Pragma ("GCC diagnostic pop")
+#else
+# define YY_INITIAL_VALUE(Value) Value
+#endif
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
+#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
+# define YY_IGNORE_USELESS_CAST_BEGIN                          \
+    _Pragma ("GCC diagnostic push")                            \
+    _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
+# define YY_IGNORE_USELESS_CAST_END            \
+    _Pragma ("GCC diagnostic pop")
+#endif
+#ifndef YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_END
+#endif
+
+
+#define YY_ASSERT(E) ((void) (0 && (E)))
+
+#if !defined yyoverflow
+
+/* 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 EXIT_SUCCESS
+#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
+#     ifndef EXIT_SUCCESS
+#      define EXIT_SUCCESS 0
+#     endif
+#    endif
+#   endif
+#  endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+   /* Pacify GCC's 'empty if-body' warning.  */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (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 EXIT_SUCCESS \
+       && ! ((defined YYMALLOC || defined malloc) \
+             && (defined YYFREE || defined free)))
+#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#   ifndef EXIT_SUCCESS
+#    define EXIT_SUCCESS 0
+#   endif
+#  endif
+#  ifndef YYMALLOC
+#   define YYMALLOC malloc
+#   if ! defined malloc && ! defined EXIT_SUCCESS
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+#  ifndef YYFREE
+#   define YYFREE free
+#   if ! defined free && ! defined EXIT_SUCCESS
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+# endif
+#endif /* !defined yyoverflow */
+
+#if (! defined yyoverflow \
+     && (! defined __cplusplus \
+         || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member.  */
+union yyalloc
+{
+  yy_state_t yyss_alloc;
+  YYSTYPE yyvs_alloc;
+};
+
+/* The size of the maximum gap between one aligned stack and the next.  */
+# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+   N elements.  */
+# define YYSTACK_BYTES(N) \
+     ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
+      + YYSTACK_GAP_MAXIMUM)
+
+# define YYCOPY_NEEDED 1
+
+/* 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_alloc, Stack)                           \
+    do                                                                  \
+      {                                                                 \
+        YYPTRDIFF_T yynewbytes;                                         \
+        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
+        Stack = &yyptr->Stack_alloc;                                    \
+        yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
+        yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
+      }                                                                 \
+    while (0)
+
+#endif
+
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from SRC to DST.  The source and destination do
+   not overlap.  */
+# ifndef YYCOPY
+#  if defined __GNUC__ && 1 < __GNUC__
+#   define YYCOPY(Dst, Src, Count) \
+      __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
+#  else
+#   define YYCOPY(Dst, Src, Count)              \
+      do                                        \
+        {                                       \
+          YYPTRDIFF_T yyi;                      \
+          for (yyi = 0; yyi < (Count); yyi++)   \
+            (Dst)[yyi] = (Src)[yyi];            \
+        }                                       \
+      while (0)
+#  endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
+/* YYFINAL -- State number of the termination state.  */
+#define YYFINAL  9
+/* YYLAST -- Last index in YYTABLE.  */
+#define YYLAST   125
+
+/* YYNTOKENS -- Number of terminals.  */
+#define YYNTOKENS  32
+/* YYNNTS -- Number of nonterminals.  */
+#define YYNNTS  16
+/* YYNRULES -- Number of rules.  */
+#define YYNRULES  50
+/* YYNSTATES -- Number of states.  */
+#define YYNSTATES  113
+
+/* YYMAXUTOK -- Last valid token kind.  */
+#define YYMAXUTOK   275
+
+
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex, with out-of-bounds checking.  */
+#define YYTRANSLATE(YYX)                                \
+  (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
+   ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
+   : YYSYMBOL_YYUNDEF)
+
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex.  */
+static const yytype_int8 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,    27,     2,     2,     2,    31,     2,     2,
+      25,    26,     2,    28,    23,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,    24,
+      29,     2,    30,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,    21,     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,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     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,
+      15,    16,    17,    18,    19,    20
+};
+
+#if YYDEBUG
+  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
+static const yytype_uint8 yyrline[] =
+{
+       0,    54,    54,    55,    58,    59,    60,    63,    64,    67,
+      68,    71,    77,    78,    83,    91,    92,    95,    98,   101,
+     104,   105,   110,   114,   115,   118,   126,   127,   135,   138,
+     139,   140,   141,   142,   145,   146,   147,   148,   149,   150,
+     153,   154,   155,   156,   157,   158,   159,   160,   161,   162,
+     163
+};
+#endif
+
+/** Accessing symbol of state STATE.  */
+#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
+
+#if YYDEBUG || 0
+/* The user-facing name of the symbol whose (internal) number is
+   YYSYMBOL.  No bounds checking.  */
+static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
+
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
+static const char *const yytname[] =
+{
+  "\"end of file\"", "error", "\"invalid token\"", "NAME", "STRING",
+  "NUM", "LTE", "GTE", "NEQ", "EQ", "FALSETOK", "TRUETOK", "NULLTOK",
+  "IFTOK", "ELSETOK", "RECT", "GOTOTOK", "DEBUGTOK", "DEFINETOK",
+  "SETTINGTOK", "RANDOMTOK", "'{'", "'}'", "','", "';'", "'('", "')'",
+  "'!'", "'+'", "'<'", "'>'", "'%'", "$accept", "lines", "line", "debug",
+  "statements", "statement", "body", "end", "if", "cond", "define",
+  "fcall", "startp", "params", "value", "expr", YY_NULLPTR
+};
+
+static const char *
+yysymbol_name (yysymbol_kind_t yysymbol)
+{
+  return yytname[yysymbol];
+}
+#endif
+
+#ifdef YYPRINT
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+   (internal) symbol number NUM (which must be that of a token).  */
+static const yytype_int16 yytoknum[] =
+{
+       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
+     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
+     275,   123,   125,    44,    59,    40,    41,    33,    43,    60,
+      62,    37
+};
+#endif
+
+#define YYPACT_NINF (-73)
+
+#define yypact_value_is_default(Yyn) \
+  ((Yyn) == YYPACT_NINF)
+
+#define YYTABLE_NINF (-1)
+
+#define yytable_value_is_error(Yyn) \
+  0
+
+  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+     STATE-NUM.  */
+static const yytype_int8 yypact[] =
+{
+       8,   -11,    11,    12,    18,     8,    30,    22,    23,   -73,
+     -73,    24,    38,    42,    59,    30,   -73,    40,    39,    41,
+     -73,    54,    16,    58,    59,    56,    60,   -73,     5,   -73,
+     -73,    77,    61,    83,   -73,   -73,    19,    52,   -73,    62,
+     -73,     1,    65,   -73,    63,   -73,   -73,   -73,   -73,   -73,
+     -73,    67,    66,    29,    64,    59,   -73,   -73,    86,    41,
+      68,    71,    69,    73,    92,   -73,    93,   -73,    66,    66,
+      66,    66,    66,    66,    66,   -73,    78,    50,    76,     1,
+     -73,     1,    79,    70,   -73,   -73,   -73,   -73,   -73,   -73,
+     -73,   -73,    52,    98,   -73,   -73,    99,    80,   -73,    82,
+      84,   -73,   -73,   103,   104,    87,    85,   107,   -73,    88,
+      90,    42,   -73
+};
+
+  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+     Performed when YYTABLE does not specify something else to do.  Zero
+     means the default is an error.  */
+static const yytype_int8 yydefact[] =
+{
+       0,     0,     0,     0,     0,     3,     7,     0,     0,     1,
+       2,     0,     0,    20,     9,     7,     4,    24,     0,     0,
+      18,     0,     0,     0,     9,     0,     0,     8,    20,     5,
+      28,     0,     0,     0,     6,    10,     0,     0,    12,     0,
+      23,    29,     0,    11,     0,    39,    38,    37,    35,    36,
+      34,     0,     0,    40,     0,     9,    15,    17,     0,    39,
+       0,    33,     0,    32,     0,    25,     0,    41,     0,     0,
+       0,     0,    49,     0,     0,    19,     0,    13,     0,    29,
+      27,    29,     0,     0,    47,    48,    43,    42,    44,    45,
+      46,    16,     0,     0,    30,    31,     0,     0,    17,     0,
+       0,    50,    14,     0,     0,     0,     0,     0,    26,     0,
+      22,    20,    21
+};
+
+  /* YYPGOTO[NTERM-NUM].  */
+static const yytype_int8 yypgoto[] =
+{
+     -73,   110,   -73,   101,   -21,   -36,    25,    20,   -73,   -73,
+     -28,   -39,   -73,   -72,   -20,    89
+};
+
+  /* YYDEFGOTO[NTERM-NUM].  */
+static const yytype_int8 yydefgoto[] =
+{
+      -1,     4,     5,    12,    23,    24,    57,    77,    25,    37,
+      18,    26,    41,    62,    53,    63
+};
+
+  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
+     positive, shift that token.  If negative, reduce the rule whose
+     number is the opposite.  If YYTABLE_NINF, syntax error.  */
+static const yytype_int8 yytable[] =
+{
+      40,    56,    61,    35,    59,    46,    47,    94,    17,    95,
+       6,    48,    49,    50,     7,     8,    21,    60,     9,    32,
+      39,    51,    45,    46,    47,     1,     2,     3,    52,    48,
+      49,    50,    67,    11,    76,    68,    69,    70,    71,    51,
+      61,    33,    61,    13,    14,    17,    52,    15,    84,    85,
+      86,    87,    88,    89,    90,    19,    56,    72,    73,    74,
+      16,    29,    19,    28,    92,    20,    30,    21,    22,    45,
+      46,    47,    20,    55,    21,    22,    48,    49,    50,    31,
+      34,    36,    42,   112,    38,    43,    44,    58,    64,    65,
+      75,    78,    66,    33,    79,    80,    81,    82,    83,    93,
+      91,    97,    96,    99,   100,   103,   101,   104,   105,   106,
+     107,   108,   109,   111,   110,    10,    27,    98,   102,     0,
+       0,     0,     0,     0,     0,    54
+};
+
+static const yytype_int8 yycheck[] =
+{
+      28,    37,    41,    24,     3,     4,     5,    79,     3,    81,
+      21,    10,    11,    12,     3,     3,    15,    16,     0,     3,
+      15,    20,     3,     4,     5,    17,    18,    19,    27,    10,
+      11,    12,    52,     3,    55,     6,     7,     8,     9,    20,
+      79,    25,    81,    21,    21,     3,    27,    23,    68,    69,
+      70,    71,    72,    73,    74,     3,    92,    28,    29,    30,
+      22,    22,     3,    23,    14,    13,    25,    15,    16,     3,
+       4,     5,    13,    21,    15,    16,    10,    11,    12,    25,
+      22,    25,     5,   111,    24,    24,     3,    25,    23,    26,
+      26,     5,    25,    25,    23,    26,    23,     5,     5,    23,
+      22,    31,    23,     5,     5,    23,    26,    23,     5,     5,
+      23,    26,     5,    23,    26,     5,    15,    92,    98,    -1,
+      -1,    -1,    -1,    -1,    -1,    36
+};
+
+  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+     symbol of state STATE-NUM.  */
+static const yytype_int8 yystos[] =
+{
+       0,    17,    18,    19,    33,    34,    21,     3,     3,     0,
+      33,     3,    35,    21,    21,    23,    22,     3,    42,     3,
+      13,    15,    16,    36,    37,    40,    43,    35,    23,    22,
+      25,    25,     3,    25,    22,    36,    25,    41,    24,    15,
+      42,    44,     5,    24,     3,     3,     4,     5,    10,    11,
+      12,    20,    27,    46,    47,    21,    37,    38,    25,     3,
+      16,    43,    45,    47,    23,    26,    25,    46,     6,     7,
+       8,     9,    28,    29,    30,    26,    36,    39,     5,    23,
+      26,    23,     5,     5,    46,    46,    46,    46,    46,    46,
+      46,    22,    14,    23,    45,    45,    23,    31,    38,     5,
+       5,    26,    39,    23,    23,     5,     5,    23,    26,     5,
+      26,    23,    42
+};
+
+  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const yytype_int8 yyr1[] =
+{
+       0,    32,    33,    33,    34,    34,    34,    35,    35,    36,
+      36,    37,    37,    37,    37,    38,    38,    39,    40,    41,
+      42,    42,    42,    42,    42,    43,    43,    43,    44,    45,
+      45,    45,    45,    45,    46,    46,    46,    46,    46,    46,
+      47,    47,    47,    47,    47,    47,    47,    47,    47,    47,
+      47
+};
+
+  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
+static const yytype_int8 yyr2[] =
+{
+       0,     2,     2,     1,     4,     5,     5,     0,     3,     0,
+       2,     3,     2,     4,     7,     1,     3,     0,     1,     3,
+       0,    14,    12,     3,     1,     4,    10,     5,     0,     0,
+       3,     3,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     2,     3,     3,     3,     3,     3,     3,     3,     2,
+       5
+};
+
+
+enum { YYENOMEM = -2 };
+
+#define yyerrok         (yyerrstatus = 0)
+#define yyclearin       (yychar = YYEMPTY)
+
+#define YYACCEPT        goto yyacceptlab
+#define YYABORT         goto yyabortlab
+#define YYERROR         goto yyerrorlab
+
+
+#define YYRECOVERING()  (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value)                                    \
+  do                                                              \
+    if (yychar == YYEMPTY)                                        \
+      {                                                           \
+        yychar = (Token);                                         \
+        yylval = (Value);                                         \
+        YYPOPSTACK (yylen);                                       \
+        yystate = *yyssp;                                         \
+        goto yybackup;                                            \
+      }                                                           \
+    else                                                          \
+      {                                                           \
+        yyerror (YY_("syntax error: cannot back up")); \
+        YYERROR;                                                  \
+      }                                                           \
+  while (0)
+
+/* Backward compatibility with an undocumented macro.
+   Use YYerror or YYUNDEF. */
+#define YYERRCODE YYUNDEF
+
+
+/* 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 (0)
+
+/* This macro is provided for backward compatibility. */
+# ifndef YY_LOCATION_PRINT
+#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# endif
+
+
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
+do {                                                                      \
+  if (yydebug)                                                            \
+    {                                                                     \
+      YYFPRINTF (stderr, "%s ", Title);                                   \
+      yy_symbol_print (stderr,                                            \
+                  Kind, Value); \
+      YYFPRINTF (stderr, "\n");                                           \
+    }                                                                     \
+} while (0)
+
+
+/*-----------------------------------.
+| Print this symbol's value on YYO.  |
+`-----------------------------------*/
+
+static void
+yy_symbol_value_print (FILE *yyo,
+                       yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
+{
+  FILE *yyoutput = yyo;
+  YYUSE (yyoutput);
+  if (!yyvaluep)
+    return;
+# ifdef YYPRINT
+  if (yykind < YYNTOKENS)
+    YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
+# endif
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  YYUSE (yykind);
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+}
+
+
+/*---------------------------.
+| Print this symbol on YYO.  |
+`---------------------------*/
+
+static void
+yy_symbol_print (FILE *yyo,
+                 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
+{
+  YYFPRINTF (yyo, "%s %s (",
+             yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
+
+  yy_symbol_value_print (yyo, yykind, yyvaluep);
+  YYFPRINTF (yyo, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included).                                                   |
+`------------------------------------------------------------------*/
+
+static void
+yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
+{
+  YYFPRINTF (stderr, "Stack now");
+  for (; yybottom <= yytop; yybottom++)
+    {
+      int yybot = *yybottom;
+      YYFPRINTF (stderr, " %d", yybot);
+    }
+  YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top)                            \
+do {                                                            \
+  if (yydebug)                                                  \
+    yy_stack_print ((Bottom), (Top));                           \
+} while (0)
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced.  |
+`------------------------------------------------*/
+
+static void
+yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
+                 int yyrule)
+{
+  int yylno = yyrline[yyrule];
+  int yynrhs = yyr2[yyrule];
+  int yyi;
+  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
+             yyrule - 1, yylno);
+  /* The symbols being reduced.  */
+  for (yyi = 0; yyi < yynrhs; yyi++)
+    {
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
+      yy_symbol_print (stderr,
+                       YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
+                       &yyvsp[(yyi + 1) - (yynrhs)]);
+      YYFPRINTF (stderr, "\n");
+    }
+}
+
+# define YY_REDUCE_PRINT(Rule)          \
+do {                                    \
+  if (yydebug)                          \
+    yy_reduce_print (yyssp, yyvsp, Rule); \
+} while (0)
+
+/* Nonzero means print parse trace.  It is left uninitialized so that
+   multiple parsers can coexist.  */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args) ((void) 0)
+# define YY_SYMBOL_PRINT(Title, Kind, 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
+
+
+
+
+
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol.  |
+`-----------------------------------------------*/
+
+static void
+yydestruct (const char *yymsg,
+            yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
+{
+  YYUSE (yyvaluep);
+  if (!yymsg)
+    yymsg = "Deleting";
+  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
+
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  YYUSE (yykind);
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+}
+
+
+/* Lookahead token kind.  */
+int yychar;
+
+/* The semantic value of the lookahead symbol.  */
+YYSTYPE yylval;
+/* Number of syntax errors so far.  */
+int yynerrs;
+
+
+
+
+/*----------.
+| yyparse.  |
+`----------*/
+
+int
+yyparse (void)
+{
+    yy_state_fast_t yystate = 0;
+    /* Number of tokens to shift before error messages enabled.  */
+    int yyerrstatus = 0;
+
+    /* Refer to the stacks through separate pointers, to allow yyoverflow
+       to reallocate them elsewhere.  */
+
+    /* Their size.  */
+    YYPTRDIFF_T yystacksize = YYINITDEPTH;
+
+    /* The state stack: array, bottom, top.  */
+    yy_state_t yyssa[YYINITDEPTH];
+    yy_state_t *yyss = yyssa;
+    yy_state_t *yyssp = yyss;
+
+    /* The semantic value stack: array, bottom, top.  */
+    YYSTYPE yyvsa[YYINITDEPTH];
+    YYSTYPE *yyvs = yyvsa;
+    YYSTYPE *yyvsp = yyvs;
+
+  int yyn;
+  /* The return value of yyparse.  */
+  int yyresult;
+  /* Lookahead symbol kind.  */
+  yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE yyval;
+
+
+
+#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
+
+  /* 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"));
+
+  yychar = YYEMPTY; /* Cause a token to be read.  */
+  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 -- set current state (the top of the stack) to yystate.  |
+`--------------------------------------------------------------------*/
+yysetstate:
+  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
+  YY_IGNORE_USELESS_CAST_BEGIN
+  *yyssp = YY_CAST (yy_state_t, yystate);
+  YY_IGNORE_USELESS_CAST_END
+  YY_STACK_PRINT (yyss, yyssp);
+
+  if (yyss + yystacksize - 1 <= yyssp)
+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
+    goto yyexhaustedlab;
+#else
+    {
+      /* Get the current used size of the three stacks, in elements.  */
+      YYPTRDIFF_T yysize = yyssp - yyss + 1;
+
+# if defined 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.  */
+        yy_state_t *yyss1 = yyss;
+        YYSTYPE *yyvs1 = yyvs;
+
+        /* 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 * YYSIZEOF (*yyssp),
+                    &yyvs1, yysize * YYSIZEOF (*yyvsp),
+                    &yystacksize);
+        yyss = yyss1;
+        yyvs = yyvs1;
+      }
+# else /* defined YYSTACK_RELOCATE */
+      /* Extend the stack our own way.  */
+      if (YYMAXDEPTH <= yystacksize)
+        goto yyexhaustedlab;
+      yystacksize *= 2;
+      if (YYMAXDEPTH < yystacksize)
+        yystacksize = YYMAXDEPTH;
+
+      {
+        yy_state_t *yyss1 = yyss;
+        union yyalloc *yyptr =
+          YY_CAST (union yyalloc *,
+                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
+        if (! yyptr)
+          goto yyexhaustedlab;
+        YYSTACK_RELOCATE (yyss_alloc, yyss);
+        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+#  undef YYSTACK_RELOCATE
+        if (yyss1 != yyssa)
+          YYSTACK_FREE (yyss1);
+      }
+# endif
+
+      yyssp = yyss + yysize - 1;
+      yyvsp = yyvs + yysize - 1;
+
+      YY_IGNORE_USELESS_CAST_BEGIN
+      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
+                  YY_CAST (long, yystacksize)));
+      YY_IGNORE_USELESS_CAST_END
+
+      if (yyss + yystacksize - 1 <= yyssp)
+        YYABORT;
+    }
+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
+
+  if (yystate == YYFINAL)
+    YYACCEPT;
+
+  goto yybackup;
+
+
+/*-----------.
+| yybackup.  |
+`-----------*/
+yybackup:
+  /* Do appropriate processing given the current state.  Read a
+     lookahead token if we need one and don't already have one.  */
+
+  /* First try to decide what to do without reference to lookahead token.  */
+  yyn = yypact[yystate];
+  if (yypact_value_is_default (yyn))
+    goto yydefault;
+
+  /* Not known => get a lookahead token if don't already have one.  */
+
+  /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
+  if (yychar == YYEMPTY)
+    {
+      YYDPRINTF ((stderr, "Reading a token\n"));
+      yychar = yylex ();
+    }
+
+  if (yychar <= YYEOF)
+    {
+      yychar = YYEOF;
+      yytoken = YYSYMBOL_YYEOF;
+      YYDPRINTF ((stderr, "Now at end of input.\n"));
+    }
+  else if (yychar == YYerror)
+    {
+      /* The scanner already issued an error message, process directly
+         to error recovery.  But do not keep the error token as
+         lookahead, it is too special and may lead us to an endless
+         loop in error recovery. */
+      yychar = YYUNDEF;
+      yytoken = YYSYMBOL_YYerror;
+      goto yyerrlab1;
+    }
+  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 (yytable_value_is_error (yyn))
+        goto yyerrlab;
+      yyn = -yyn;
+      goto yyreduce;
+    }
+
+  /* Count tokens shifted since error; after three, turn off error
+     status.  */
+  if (yyerrstatus)
+    yyerrstatus--;
+
+  /* Shift the lookahead token.  */
+  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+  yystate = yyn;
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+  /* Discard the shifted token.  */
+  yychar = YYEMPTY;
+  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 4: /* line: DEBUGTOK '{' debug '}'  */
+#line 58 "engines/private/grammar.y"
+                                             { /* Not used in the game */ }
+#line 1203 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 5: /* line: DEFINETOK NAME '{' define '}'  */
+#line 59 "engines/private/grammar.y"
+                                             { installall((yyvsp[-3].s)); }
+#line 1209 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 6: /* line: SETTINGTOK NAME '{' statements '}'  */
+#line 60 "engines/private/grammar.y"
+                                             { saveSetting((yyvsp[-3].s)); initSetting(); }
+#line 1215 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 9: /* statements: %empty  */
+#line 67 "engines/private/grammar.y"
+                               { (yyval.inst) = progp; }
+#line 1221 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 11: /* statement: GOTOTOK NAME ';'  */
+#line 71 "engines/private/grammar.y"
+                            {
+	code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, (yyvsp[-1].s)));
+        code2(constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
+        code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto")); 
+        code1(funcpush);
+        }
+#line 1232 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 12: /* statement: fcall ';'  */
+#line 77 "engines/private/grammar.y"
+                            { }
+#line 1238 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 13: /* statement: if cond body end  */
+#line 78 "engines/private/grammar.y"
+                           {
+         	/* else-less if */
+		((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst);	/* thenpart */
+		((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst); 
+                }
+#line 1248 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 14: /* statement: if cond body end ELSETOK body end  */
+#line 83 "engines/private/grammar.y"
+                                            { 
+                /* if with else */
+		((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst);	/* thenpart */
+		((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst);	/* elsepart */
+		((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst); 
+                }
+#line 1259 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 15: /* body: statement  */
+#line 91 "engines/private/grammar.y"
+                             { (yyval.inst) = (yyvsp[0].inst); }
+#line 1265 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 16: /* body: '{' statements '}'  */
+#line 92 "engines/private/grammar.y"
+                             { (yyval.inst) = (yyvsp[-1].inst); }
+#line 1271 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 17: /* end: %empty  */
+#line 95 "engines/private/grammar.y"
+                                { code(STOP); (yyval.inst) = progp; }
+#line 1277 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 18: /* if: IFTOK  */
+#line 98 "engines/private/grammar.y"
+          { (yyval.inst) = code(ifcode); code3(STOP, STOP, STOP); }
+#line 1283 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 19: /* cond: '(' expr ')'  */
+#line 101 "engines/private/grammar.y"
+                        { code(STOP); (yyval.inst) = (yyvsp[-1].inst); }
+#line 1289 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  */
+#line 105 "engines/private/grammar.y"
+                                                                        { 
+          Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
+          assert(r->isValidRect()); 
+          define((yyvsp[-13].s), r); 
+          }
+#line 1299 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
+#line 110 "engines/private/grammar.y"
+                                                            {
+          Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);  
+          define((yyvsp[-11].s), r); 
+          }
+#line 1308 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 23: /* define: NAME ',' define  */
+#line 114 "engines/private/grammar.y"
+                          { define((yyvsp[-2].s), NULL); }
+#line 1314 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 24: /* define: NAME  */
+#line 115 "engines/private/grammar.y"
+                          { define((yyvsp[0].s), NULL); }
+#line 1320 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 25: /* fcall: GOTOTOK '(' NAME ')'  */
+#line 118 "engines/private/grammar.y"
+                               {
+                               (yyval.inst) = progp;
+                               code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, (yyvsp[-1].s)));
+                               code2(constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
+                               code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto")); 
+                               code1(funcpush);
+                               }
+#line 1332 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
+#line 126 "engines/private/grammar.y"
+                                                   { (yyval.inst) = progp; }
+#line 1338 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 27: /* fcall: NAME '(' startp params ')'  */
+#line 127 "engines/private/grammar.y"
+                                      {
+                               (yyval.inst) = (yyvsp[-2].inst);
+                               code2(constpush, (Private::Inst) addconstant(NUM, (yyvsp[-1].narg), NULL));
+                               code2(strpush, (Private::Inst) addconstant(STRING, 0, (yyvsp[-4].s))); 
+                               code1(funcpush);
+                               }
+#line 1349 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 28: /* startp: %empty  */
+#line 135 "engines/private/grammar.y"
+                    { (yyval.inst) = progp; }
+#line 1355 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 29: /* params: %empty  */
+#line 138 "engines/private/grammar.y"
+                            { (yyval.narg) = 0; }
+#line 1361 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 30: /* params: fcall ',' params  */
+#line 139 "engines/private/grammar.y"
+                            { (yyval.narg) = (yyvsp[0].narg) + 1; }
+#line 1367 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 31: /* params: expr ',' params  */
+#line 140 "engines/private/grammar.y"
+                            { (yyval.narg) = (yyvsp[0].narg) + 1; }
+#line 1373 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 32: /* params: expr  */
+#line 141 "engines/private/grammar.y"
+                      { (yyval.narg) = 1; }
+#line 1379 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 33: /* params: fcall  */
+#line 142 "engines/private/grammar.y"
+                      { (yyval.narg) = 1; }
+#line 1385 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 34: /* value: NULLTOK  */
+#line 145 "engines/private/grammar.y"
+                   { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL)); }
+#line 1391 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 35: /* value: FALSETOK  */
+#line 146 "engines/private/grammar.y"
+                   { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL)); }
+#line 1397 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 36: /* value: TRUETOK  */
+#line 147 "engines/private/grammar.y"
+                   { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL)); }
+#line 1403 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 37: /* value: NUM  */
+#line 148 "engines/private/grammar.y"
+                   { code2(Private::constpush, (Private::Inst)(yyvsp[0].sym)); }
+#line 1409 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 38: /* value: STRING  */
+#line 149 "engines/private/grammar.y"
+                   { code2(Private::strpush, (Private::Inst)(yyvsp[0].sym)); }
+#line 1415 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 39: /* value: NAME  */
+#line 150 "engines/private/grammar.y"
+                   { code1(Private::varpush); code1((Private::Inst) lookupName((yyvsp[0].s))); code1(Private::eval); }
+#line 1421 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 40: /* expr: value  */
+#line 153 "engines/private/grammar.y"
+                          { (yyval.inst) = (yyvsp[0].inst); }
+#line 1427 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 41: /* expr: '!' value  */
+#line 154 "engines/private/grammar.y"
+                          { code1(Private::negate); (yyval.inst) = (yyvsp[0].inst); }
+#line 1433 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 42: /* expr: value EQ value  */
+#line 155 "engines/private/grammar.y"
+                          { code1(Private::eq); }
+#line 1439 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 43: /* expr: value NEQ value  */
+#line 156 "engines/private/grammar.y"
+                          { code1(Private::ne); }
+#line 1445 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 44: /* expr: value '+' value  */
+#line 157 "engines/private/grammar.y"
+                          { code1(Private::add); }
+#line 1451 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 45: /* expr: value '<' value  */
+#line 158 "engines/private/grammar.y"
+                          { code1(Private::lt); }
+#line 1457 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 46: /* expr: value '>' value  */
+#line 159 "engines/private/grammar.y"
+                          { code1(Private::gt); }
+#line 1463 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 47: /* expr: value LTE value  */
+#line 160 "engines/private/grammar.y"
+                          { code1(Private::le); }
+#line 1469 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 48: /* expr: value GTE value  */
+#line 161 "engines/private/grammar.y"
+                          { code1(Private::ge); }
+#line 1475 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 49: /* expr: value '+'  */
+#line 162 "engines/private/grammar.y"
+                          { (yyval.inst) = (yyvsp[-1].inst); }
+#line 1481 "engines/private/grammar.tab.cpp"
+    break;
+
+  case 50: /* expr: RANDOMTOK '(' NUM '%' ')'  */
+#line 163 "engines/private/grammar.y"
+                                    { code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool); }
+#line 1487 "engines/private/grammar.tab.cpp"
+    break;
+
+
+#line 1491 "engines/private/grammar.tab.cpp"
+
+      default: break;
+    }
+  /* User semantic actions sometimes alter yychar, and that requires
+     that yytoken be updated with the new translation.  We take the
+     approach of translating immediately before every use of yytoken.
+     One alternative is translating here after every semantic action,
+     but that translation would be missed if the semantic action invokes
+     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
+     incorrect destructor might then be invoked immediately.  In the
+     case of YYERROR or YYBACKUP, subsequent parser actions might lead
+     to an incorrect destructor call or verbose syntax error message
+     before the lookahead is translated.  */
+  YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
+
+  YYPOPSTACK (yylen);
+  yylen = 0;
+
+  *++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.  */
+  {
+    const int yylhs = yyr1[yyn] - YYNTOKENS;
+    const int yyi = yypgoto[yylhs] + *yyssp;
+    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+               ? yytable[yyi]
+               : yydefgoto[yylhs]);
+  }
+
+  goto yynewstate;
+
+
+/*--------------------------------------.
+| yyerrlab -- here on detecting error.  |
+`--------------------------------------*/
+yyerrlab:
+  /* Make sure we have latest lookahead translation.  See comments at
+     user semantic actions for why this is necessary.  */
+  yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
+  /* If not already recovering from an error, report this error.  */
+  if (!yyerrstatus)
+    {
+      ++yynerrs;
+      yyerror (YY_("syntax error"));
+    }
+
+  if (yyerrstatus == 3)
+    {
+      /* If just tried and failed to reuse lookahead 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 lookahead token after shifting the error
+     token.  */
+  goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR.  |
+`---------------------------------------------------*/
+yyerrorlab:
+  /* Pacify compilers when the user code never invokes YYERROR and the
+     label yyerrorlab therefore never appears in user code.  */
+  if (0)
+    YYERROR;
+
+  /* Do not reclaim the symbols of the rule whose 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.  */
+
+  /* Pop stack until we find a state that shifts the error token.  */
+  for (;;)
+    {
+      yyn = yypact[yystate];
+      if (!yypact_value_is_default (yyn))
+        {
+          yyn += YYSYMBOL_YYerror;
+          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
+            {
+              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",
+                  YY_ACCESSING_SYMBOL (yystate), yyvsp);
+      YYPOPSTACK (1);
+      yystate = *yyssp;
+      YY_STACK_PRINT (yyss, yyssp);
+    }
+
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+
+  /* Shift the error token.  */
+  YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (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;
+
+
+#if !defined yyoverflow
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here.  |
+`-------------------------------------------------*/
+yyexhaustedlab:
+  yyerror (YY_("memory exhausted"));
+  yyresult = 2;
+  goto yyreturn;
+#endif
+
+
+/*-------------------------------------------------------.
+| yyreturn -- parsing is finished, clean up and return.  |
+`-------------------------------------------------------*/
+yyreturn:
+  if (yychar != YYEMPTY)
+    {
+      /* Make sure we have latest lookahead translation.  See comments at
+         user semantic actions for why this is necessary.  */
+      yytoken = YYTRANSLATE (yychar);
+      yydestruct ("Cleanup: discarding lookahead",
+                  yytoken, &yylval);
+    }
+  /* Do not reclaim the symbols of the rule whose action triggered
+     this YYABORT or YYACCEPT.  */
+  YYPOPSTACK (yylen);
+  YY_STACK_PRINT (yyss, yyssp);
+  while (yyssp != yyss)
+    {
+      yydestruct ("Cleanup: popping",
+                  YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
+      YYPOPSTACK (1);
+    }
+#ifndef yyoverflow
+  if (yyss != yyssa)
+    YYSTACK_FREE (yyss);
+#endif
+
+  return yyresult;
+}
+
diff --git a/engines/private/grammar.tab.h b/engines/private/grammar.tab.h
new file mode 100644
index 0000000000..6e82ff9616
--- /dev/null
+++ b/engines/private/grammar.tab.h
@@ -0,0 +1,104 @@
+/* A Bison parser, made by GNU Bison 3.7.2.  */
+
+/* Bison interface for Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 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 3 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, see <http://www.gnu.org/licenses/>.  */
+
+/* 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.  */
+
+/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+   especially those whose name start with YY_ or yy_.  They are
+   private implementation details that can be changed or removed.  */
+
+#ifndef YY_YY_ENGINES_PRIVATE_GRAMMAR_TAB_H_INCLUDED
+# define YY_YY_ENGINES_PRIVATE_GRAMMAR_TAB_H_INCLUDED
+/* Debug traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int yydebug;
+#endif
+
+/* Token kinds.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+  enum yytokentype
+  {
+    YYEMPTY = -2,
+    YYEOF = 0,                     /* "end of file"  */
+    YYerror = 256,                 /* error  */
+    YYUNDEF = 257,                 /* "invalid token"  */
+    NAME = 258,                    /* NAME  */
+    STRING = 259,                  /* STRING  */
+    NUM = 260,                     /* NUM  */
+    LTE = 261,                     /* LTE  */
+    GTE = 262,                     /* GTE  */
+    NEQ = 263,                     /* NEQ  */
+    EQ = 264,                      /* EQ  */
+    FALSETOK = 265,                /* FALSETOK  */
+    TRUETOK = 266,                 /* TRUETOK  */
+    NULLTOK = 267,                 /* NULLTOK  */
+    IFTOK = 268,                   /* IFTOK  */
+    ELSETOK = 269,                 /* ELSETOK  */
+    RECT = 270,                    /* RECT  */
+    GOTOTOK = 271,                 /* GOTOTOK  */
+    DEBUGTOK = 272,                /* DEBUGTOK  */
+    DEFINETOK = 273,               /* DEFINETOK  */
+    SETTINGTOK = 274,              /* SETTINGTOK  */
+    RANDOMTOK = 275                /* RANDOMTOK  */
+  };
+  typedef enum yytokentype yytoken_kind_t;
+#endif
+
+/* Value type.  */
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+union YYSTYPE
+{
+#line 38 "engines/private/grammar.y"
+
+	struct Symbol	*sym;	/* symbol table pointer */
+        int (**inst)();	/* machine instruction */
+        char *s;
+        int *i;
+        int narg;
+
+#line 92 "engines/private/grammar.tab.h"
+
+};
+typedef union YYSTYPE YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+
+extern YYSTYPE yylval;
+
+int yyparse (void);
+
+#endif /* !YY_YY_ENGINES_PRIVATE_GRAMMAR_TAB_H_INCLUDED  */
diff --git a/engines/private/lex.yy.cpp b/engines/private/lex.yy.cpp
new file mode 100644
index 0000000000..17177a89e2
--- /dev/null
+++ b/engines/private/lex.yy.cpp
@@ -0,0 +1,1933 @@
+#line 1 "engines/private/lex.yy.cpp"
+
+#line 3 "engines/private/lex.yy.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 6
+#define YY_FLEX_SUBMINOR_VERSION 4
+#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;
+#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;
+
+/* 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
+
+#ifndef SIZE_MAX
+#define SIZE_MAX               (~(size_t)0)
+#endif
+
+#endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */
+
+/* begin standard C++ headers. */
+
+/* TODO: this is always defined, so inline it */
+#define yyconst const
+
+#if defined(__GNUC__) && __GNUC__ >= 3
+#define yynoreturn __attribute__((__noreturn__))
+#else
+#define yynoreturn
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an
+ *   integer in range [0..255] for use as an array index.
+ */
+#define YY_SC_TO_UI(c) ((YY_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
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
+#define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
+#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 int 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)
+    #define YY_LINENO_REWIND_TO(ptr)
+    
+/* 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.
+	 */
+	int yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	int 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 = NULL; /**< 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 int yy_n_chars;		/* number of characters read into yy_ch_buf */
+int yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = NULL;
+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 ( const char *yy_str  );
+YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int 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() (/*CONSTCOND*/1)
+#define YY_SKIP_YYWRAP
+typedef flex_uint8_t YY_CHAR;
+
+FILE *yyin = NULL, *yyout = NULL;
+
+typedef int yy_state_type;
+
+extern int yylineno;
+int yylineno = 1;
+
+extern char *yytext;
+#ifdef yytext_ptr
+#undef yytext_ptr
+#endif
+#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 yynoreturn yy_fatal_error ( const 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 = (int) (yy_cp - yy_bp); \
+	(yy_hold_char) = *yy_cp; \
+	*yy_cp = '\0'; \
+	(yy_c_buf_p) = yy_cp;
+#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
+	{
+	flex_int32_t yy_verify;
+	flex_int32_t yy_nxt;
+	};
+static const flex_int16_t yy_accept[78] =
+    {   0,
+        0,    0,   24,   22,   21,   20,   20,   22,   22,   22,
+       22,   18,   22,   22,   22,   17,   17,   17,   17,   17,
+       17,   17,   17,   17,   17,   21,   20,    4,    0,   19,
+       18,    1,    2,    5,    3,   17,   17,   17,   17,   17,
+       17,   17,   17,   17,    9,   17,    1,   17,   17,   17,
+       17,   17,   17,   17,   17,   17,   17,   17,   15,   12,
+       17,   14,   17,   17,   10,   11,   17,   13,   17,    6,
+       17,   17,   16,    7,   17,    8,    0
+    } ;
+
+static const YY_CHAR yy_ec[256] =
+    {   0,
+        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,    2,    5,    6,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    7,    1,    8,    9,    9,    9,
+        9,    9,    9,    9,    9,    9,    9,    1,    1,   10,
+       11,   12,    1,    1,   13,   14,   15,   14,   16,   17,
+       14,   14,   14,   14,   14,   18,   14,   19,   14,   14,
+       14,   20,   21,   22,   23,   14,   14,   14,   14,   14,
+        1,    1,    1,    1,   14,    1,   24,   25,   14,   26,
+
+       27,   28,   29,   14,   30,   14,   14,   31,   32,   33,
+       34,   14,   14,   14,   35,   36,   37,   14,   14,   14,
+       14,   14,    1,   38,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    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 const YY_CHAR yy_meta[39] =
+    {   0,
+        1,    1,    2,    3,    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,    1
+    } ;
+
+static const flex_int16_t yy_base[81] =
+    {   0,
+        0,    0,  105,  106,  102,   36,   38,   92,   96,   92,
+       92,   90,   87,   86,   85,    0,   82,   71,   27,   73,
+       65,   60,   56,   61,   61,   83,   41,  106,   76,  106,
+       72,    0,  106,  106,  106,    0,   60,   59,   60,   40,
+       49,   21,   36,   34,    0,   33,    0,   47,   49,   44,
+       39,   48,   26,   32,   34,   26,   23,   42,    0,    0,
+       23,    0,   27,   22,    0,    0,   24,    0,   21,    0,
+       25,   17,    0,    0,   19,    0,  106,   79,   43,   83
+    } ;
+
+static const flex_int16_t yy_def[81] =
+    {   0,
+       77,    1,   77,   77,   77,   77,   77,   77,   78,   77,
+       77,   77,   77,   77,   77,   79,   79,   79,   79,   79,
+       79,   79,   79,   79,   79,   77,   77,   77,   78,   77,
+       77,   80,   77,   77,   77,   79,   79,   79,   79,   79,
+       79,   79,   79,   79,   79,   79,   80,   79,   79,   79,
+       79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
+       79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
+       79,   79,   79,   79,   79,   79,    0,   77,   77,   77
+    } ;
+
+static const flex_int16_t yy_nxt[145] =
+    {   0,
+        4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
+       14,   15,   16,   16,   16,   16,   17,   16,   18,   19,
+       16,   20,   16,   16,   16,   21,   22,   16,   23,   24,
+       16,   16,   16,   16,   25,   16,   16,    7,   27,   27,
+       27,   27,   39,   27,   27,   53,   36,   76,   54,   75,
+       40,   74,   73,   72,   71,   70,   69,   68,   67,   66,
+       65,   64,   63,   62,   61,   60,   59,   58,   57,   56,
+       55,   52,   51,   27,   50,   27,   49,   48,   27,   29,
+       31,   30,   29,   47,   26,   47,   47,   46,   45,   44,
+       43,   42,   41,   38,   37,   35,   34,   33,   31,   32,
+
+       31,   30,   28,   26,   77,    3,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77
+    } ;
+
+static const flex_int16_t yy_chk[145] =
+    {   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,    6,    6,
+        7,    7,   19,   27,   27,   42,   79,   75,   42,   72,
+       19,   71,   69,   67,   64,   63,   61,   58,   57,   56,
+       55,   54,   53,   52,   51,   50,   49,   48,   46,   44,
+       43,   41,   40,    6,   39,    7,   38,   37,   27,   78,
+       31,   29,   78,   80,   26,   80,   80,   25,   24,   23,
+       22,   21,   20,   18,   17,   15,   14,   13,   12,   11,
+
+       10,    9,    8,    5,    3,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77
+    } ;
+
+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/private/grammar.l"
+#define YY_NO_INPUT 1
+#line 8 "engines/private/grammar.l"
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#include <stdio.h>
+#include <string.h>
+#include "grammar.h"
+#include "grammar.tab.h"
+
+#line 507 "engines/private/lex.yy.cpp"
+#line 508 "engines/private/lex.yy.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  );
+
+			int 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
+
+#ifndef YY_NO_UNPUT
+    
+    static void yyunput ( int c, char *buf_ptr  );
+    
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy ( char *, const char *, int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen ( const 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
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
+#define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
+#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 do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
+#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 = '*'; \
+		int 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 = (int) fread(buf, 1, (yy_size_t) 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 /*LINTED*/break;
+#endif
+
+#define YY_RULE_SETUP \
+	YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+	yy_state_type yy_current_state;
+	char *yy_cp, *yy_bp;
+	int yy_act;
+    
+	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(  );
+		}
+
+	{
+#line 17 "engines/private/grammar.l"
+
+#line 727 "engines/private/lex.yy.cpp"
+
+	while ( /*CONSTCOND*/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
+			{
+			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 >= 78 )
+					yy_c = yy_meta[yy_c];
+				}
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+			++yy_cp;
+			}
+		while ( yy_current_state != 77 );
+		yy_cp = (yy_last_accepting_cpos);
+		yy_current_state = (yy_last_accepting_state);
+
+yy_find_action:
+		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 18 "engines/private/grammar.l"
+/* ignoring the comment */
+	YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 19 "engines/private/grammar.l"
+return LTE;
+	YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 20 "engines/private/grammar.l"
+return GTE;
+	YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 21 "engines/private/grammar.l"
+return NEQ;
+	YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 22 "engines/private/grammar.l"
+return EQ;
+	YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 23 "engines/private/grammar.l"
+return DEBUGTOK;
+	YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 24 "engines/private/grammar.l"
+return DEFINETOK;
+	YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 25 "engines/private/grammar.l"
+return SETTINGTOK;
+	YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 26 "engines/private/grammar.l"
+return IFTOK;
+	YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 27 "engines/private/grammar.l"
+return ELSETOK;
+	YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 28 "engines/private/grammar.l"
+return GOTOTOK;
+	YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 29 "engines/private/grammar.l"
+return RECT;
+	YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 30 "engines/private/grammar.l"
+return FALSETOK;
+	YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 31 "engines/private/grammar.l"
+return TRUETOK;
+	YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 32 "engines/private/grammar.l"
+return NULLTOK;
+	YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 33 "engines/private/grammar.l"
+return RANDOMTOK;
+	YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 34 "engines/private/grammar.l"
+yylval.s = strdup(yytext); return NAME;
+	YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 35 "engines/private/grammar.l"
+yylval.sym = Private::addconstant(NUM, atoi(yytext), NULL); return NUM;
+	YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 36 "engines/private/grammar.l"
+yylval.sym = Private::addconstant(STRING, 0, strdup(yytext)); return STRING;
+	YY_BREAK
+case 20:
+/* rule 20 can match eol */
+YY_RULE_SETUP
+#line 37 "engines/private/grammar.l"
+/* ignore return */;
+	YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 38 "engines/private/grammar.l"
+/* ignore whitespace */;
+	YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 39 "engines/private/grammar.l"
+return *yytext;
+	YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 40 "engines/private/grammar.l"
+ECHO;
+	YY_BREAK
+#line 896 "engines/private/lex.yy.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_last_accepting_cpos);
+				yy_current_state = (yy_last_accepting_state);
+				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 user's declarations */
+} /* 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)
+{
+    	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+	char *source = (yytext_ptr);
+	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
+		{
+			int 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_LVALUE;
+
+			int yy_c_buf_p_offset =
+				(int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+			if ( b->yy_is_our_buffer )
+				{
+				int 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,
+							 (yy_size_t) (b->yy_buf_size + 2)  );
+				}
+			else
+				/* Can't grow it, we don't own it. */
+				b->yy_ch_buf = NULL;
+
+			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_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+		/* Extend the array by 50%, plus the number we really need. */
+		int 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, (yy_size_t) new_size  );
+		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+		/* "- 2" to take care of EOB's */
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
+	}
+
+	(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)
+{
+	yy_state_type yy_current_state;
+	char *yy_cp;
+    
+	yy_current_state = (yy_start);
+
+	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+		{
+		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 >= 78 )
+				yy_c = yy_meta[yy_c];
+			}
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + 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 )
+{
+	int yy_is_jam;
+    	char *yy_cp = (yy_c_buf_p);
+
+	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 >= 78 )
+			yy_c = yy_meta[yy_c];
+		}
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+	yy_is_jam = (yy_current_state == 77);
+
+		return yy_is_jam ? 0 : yy_current_state;
+}
+
+#ifndef YY_NO_UNPUT
+
+    static void yyunput (int c, char * yy_bp )
+{
+	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. */
+		int number_to_move = (yy_n_chars) + 2;
+		char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+		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) = (int) 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;
+}
+
+#endif
+
+#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 */
+			int offset = (int) ((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( (yy_size_t) (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  );
+}
+
+/* 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 = 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; /* After all that talk, this was set to 1 anyways... */
+		(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. */
+		yy_size_t 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 NULL;
+
+	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 = (int) (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 = NULL;
+	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 (const char * yystr )
+{
+    
+	return yy_scan_bytes( yystr, (int) 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 yybytes the byte buffer to scan
+ * @param _yybytes_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  (const char * yybytes, int  _yybytes_len )
+{
+	YY_BUFFER_STATE b;
+	char *buf;
+	yy_size_t n;
+	int i;
+    
+	/* Get memory for full buffer, including space for trailing EOB's. */
+	n = (yy_size_t) (_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 yynoreturn yy_fatal_error (const char* msg )
+{
+			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.
+ * 
+ */
+int yyget_leng  (void)
+{
+        return yyleng;
+}
+
+/** Get the current token.
+ * 
+ */
+
+char *yyget_text  (void)
+{
+        return yytext;
+}
+
+/** Set the current line number.
+ * @param _line_number 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) = NULL;
+    (yy_buffer_stack_top) = 0;
+    (yy_buffer_stack_max) = 0;
+    (yy_c_buf_p) = NULL;
+    (yy_init) = 0;
+    (yy_start) = 0;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+    yyin = stdin;
+    yyout = stdout;
+#else
+    yyin = NULL;
+    yyout = NULL;
+#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, const char * s2, int n )
+{
+		
+	int i;
+	for ( i = 0; i < n; ++i )
+		s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (const char * s )
+{
+	int n;
+	for ( n = 0; s[n]; ++n )
+		;
+
+	return n;
+}
+#endif
+
+void *yyalloc (yy_size_t  size )
+{
+			return 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 realloc(ptr, size);
+}
+
+void yyfree (void * ptr )
+{
+			free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#line 40 "engines/private/grammar.l"
+
+
+extern int yydebug;
+
+namespace Private {
+
+int parse(char *code) {
+	
+	initSetting();
+	//_lines[0] = _lines[1] = _lines[2] = code;
+
+	YY_BUFFER_STATE bp;
+
+	//if (debugChannelSet(-1, kDebugParse))
+	yydebug = 1;
+	//else
+	//	yydebug = 0;
+
+	yy_delete_buffer(YY_CURRENT_BUFFER);
+
+	bp = yy_scan_string(code);
+	yy_switch_to_buffer(bp);
+	yyparse();
+        //execute(prog);
+	yy_delete_buffer(bp);
+
+	return 0;
+}
+
+} // End of namespace Private
+


Commit: 756efded43ece899815ba8b2785427a81d1d4860
    https://github.com/scummvm/scummvm/commit/756efded43ece899815ba8b2785427a81d1d4860
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: astyled the code again

Changed paths:
    engines/private/code.cpp
    engines/private/cursors.cpp
    engines/private/detection.cpp
    engines/private/funcs.cpp
    engines/private/grammar.tab.cpp
    engines/private/lex.yy.cpp
    engines/private/private.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 959b04781c..47ca6462d8 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -430,9 +430,9 @@ int randbool()
 {
     Datum d;
     d = pop();
-    
+
     int v = g_private->getRandomBool(d.u.val);
-     
+
     d.u.val = v;
     push(d);
     return 0;
diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index 84b93eaf9e..3bea2c05d4 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -22,248 +22,248 @@ const byte MOUSECURSOR_SCI[] = {
 };
 
 extern const byte MOUSECURSOR_kExit[] = {
-0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,2,2,2,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,2,2,2,1,1,2,2,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,1,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,1,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,1,0,0,0,0,0,0,0,0,0,
-0,0,0,0,1,1,0,1,2,2,2,2,2,2,2,2,2,2,2,1,2,2,1,0,0,0,0,0,0,0,0,0,
-0,0,0,1,1,0,0,1,2,2,2,2,2,2,2,2,2,2,2,1,2,2,1,0,0,0,0,0,0,0,0,0,
-0,0,0,1,1,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,
-0,0,0,1,1,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,
-0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,
-0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,
-0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,
-0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,2,2,2,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,2,2,2,1,1,2,2,1,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,1,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,1,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,1,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,1,1,0,1,2,2,2,2,2,2,2,2,2,2,2,1,2,2,1,0,0,0,0,0,0,0,0,0,
+    0,0,0,1,1,0,0,1,2,2,2,2,2,2,2,2,2,2,2,1,2,2,1,0,0,0,0,0,0,0,0,0,
+    0,0,0,1,1,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,
+    0,0,0,1,1,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,
+    0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,
+    0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,
+    0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,
+    0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
 const byte MOUSECURSOR_kZoomIn[] = {
-0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,1,1,2,2,2,2,1,1,1,1,1,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,1,2,2,2,2,2,2,2,2,2,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,1,1,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,1,1,2,2,1,1,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,1,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,1,1,2,2,2,2,1,1,1,1,1,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,1,2,2,2,2,2,2,2,2,2,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,1,1,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,1,1,2,2,1,1,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,1,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
 const byte MOUSECURSOR_kTurnRight[] = {
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,
-1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,
-1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,
-1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,
-1,1,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,1,0,0,0,0,
-1,1,2,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,1,0,0,0,
-1,1,2,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,1,0,0,0,
-1,1,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,1,0,0,0,0,
-1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,
-1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,
-1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,
-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,
+    1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,
+    1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,
+    1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,
+    1,1,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,1,0,0,0,0,
+    1,1,2,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,1,0,0,0,
+    1,1,2,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,1,0,0,0,
+    1,1,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,1,0,0,0,0,
+    1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,
+    1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,
+    1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
 const byte MOUSECURSOR_kTurnLeft[] = {
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,1,1,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,1,1,2,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,
-0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,
-0,0,1,1,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,0,0,0,
-0,1,1,2,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,0,0,0,
-1,1,2,2,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,0,0,0,
-1,2,2,2,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,0,0,0,
-1,2,2,2,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,0,0,0,
-1,1,2,2,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,0,0,0,
-0,1,1,2,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,0,0,0,
-0,0,1,1,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,0,0,0,
-0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,
-0,0,0,0,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,
-0,0,0,0,0,1,1,2,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,1,1,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,1,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,1,1,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,1,1,2,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,
+    0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,
+    0,0,1,1,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,0,0,0,
+    0,1,1,2,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,0,0,0,
+    1,1,2,2,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,0,0,0,
+    1,2,2,2,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,0,0,0,
+    1,2,2,2,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,0,0,0,
+    1,1,2,2,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,0,0,0,
+    0,1,1,2,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,0,0,0,
+    0,0,1,1,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,0,0,0,
+    0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,
+    0,0,0,0,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,
+    0,0,0,0,0,1,1,2,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,1,1,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
 const byte MOUSECURSOR_kInventory[] = {
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,1,1,2,2,1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,1,1,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,1,2,2,2,1,2,2,2,1,2,2,2,1,1,1,1,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,1,2,2,1,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
-0,1,1,1,1,1,0,0,0,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
-1,1,2,2,2,1,1,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
-1,1,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
-0,1,1,1,2,2,2,2,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,
-0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,
-0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,
-0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,
-0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,1,1,2,2,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,1,1,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,1,2,2,2,1,2,2,2,1,2,2,2,1,1,1,1,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,1,2,2,1,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
+    0,1,1,1,1,1,0,0,0,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
+    1,1,2,2,2,1,1,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
+    1,1,2,2,2,2,2,1,1,1,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,1,0,0,0,0,0,0,
+    0,1,1,1,2,2,2,2,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,
+    0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,
+    0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,
+    0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
 };
 
 const byte MOUSECURSOR_kZoomOut[] = {
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,
-1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,0,0,0,0,
-1,2,2,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,0,0,0,0,
-1,1,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,1,0,0,0,0,
-1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,0,0,0,0,
-0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,
-0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,
-0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,
-0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,
-0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,
-0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,
+    1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,0,0,0,0,
+    1,2,2,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,0,0,0,0,
+    1,1,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,1,0,0,0,0,
+    1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,0,0,0,0,
+    0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,
+    0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,
+    0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,
+    0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,
+    0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
 const byte MOUSECURSOR_kPhone[] {
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,
-0,0,0,0,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,0,0,0,0,
-0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,
-0,0,1,1,2,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,0,0,
-0,1,1,2,2,2,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,0,
-1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,
-0,1,2,2,2,2,2,2,2,2,1,2,2,1,1,1,1,1,1,1,2,2,1,2,2,2,2,2,2,2,2,1,
-1,1,2,2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,1,
-1,1,1,1,1,1,1,2,1,1,1,2,2,2,2,2,2,2,2,2,2,2,1,1,1,2,1,1,1,1,1,1,
-0,1,2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,2,2,2,2,2,2,1,
-1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,
-0,1,1,1,1,1,1,1,1,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,1,1,1,1,1,1,1,0,
-0,0,0,0,0,0,1,1,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,1,0,0,0,0,0,0,
-0,0,0,0,0,0,1,1,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,1,0,0,0,0,0,0,
-0,0,0,0,0,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,0,0,0,0,0,
-0,0,0,0,0,0,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,0,0,0,0,0,
-0,0,0,0,0,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,0,0,0,0,0,
-0,0,0,0,1,1,2,2,2,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2,2,2,1,0,0,0,0,
-0,0,0,0,1,1,2,2,2,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,2,2,2,1,0,0,0,0,
-0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,
-0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,
-0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,
-0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,0,0,0,0,
+    0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,
+    0,0,1,1,2,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,0,0,
+    0,1,1,2,2,2,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,0,
+    1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,
+    0,1,2,2,2,2,2,2,2,2,1,2,2,1,1,1,1,1,1,1,2,2,1,2,2,2,2,2,2,2,2,1,
+    1,1,2,2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,1,
+    1,1,1,1,1,1,1,2,1,1,1,2,2,2,2,2,2,2,2,2,2,2,1,1,1,2,1,1,1,1,1,1,
+    0,1,2,2,2,2,2,2,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,2,2,2,2,2,2,1,
+    1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,
+    0,1,1,1,1,1,1,1,1,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,1,1,1,1,1,1,1,0,
+    0,0,0,0,0,0,1,1,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,1,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,1,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,1,0,0,0,0,0,0,
+    0,0,0,0,0,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,0,0,0,0,0,
+    0,0,0,0,0,0,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,0,0,0,0,0,
+    0,0,0,0,0,1,1,2,2,2,2,2,1,1,1,1,1,1,1,1,1,2,2,2,2,2,1,0,0,0,0,0,
+    0,0,0,0,1,1,2,2,2,2,2,2,2,1,1,1,1,1,1,1,2,2,2,2,2,2,2,1,0,0,0,0,
+    0,0,0,0,1,1,2,2,2,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,2,2,2,1,0,0,0,0,
+    0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,
+    0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,
+    0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,
+    0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
 extern const byte cursorPalette[] = {
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index 1c65707139..bbfea2f8f7 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -33,7 +33,7 @@ static const ADGameDescription gameDescriptions[] = {
 } // End of namespace Private
 
 static const char *const directoryGlobs[] = {
-    "SUPPORT", 
+    "SUPPORT",
     0
 };
 
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index e0d0c03444..b3b4b46fb1 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -85,7 +85,7 @@ void NoStopSounds(ArgArray args) {
 void Inventory(ArgArray args) {
 
     // assert types
-    Datum b1 = args[0]; 
+    Datum b1 = args[0];
     Datum v1 = args[1];
     Datum v2 = args[2];
     Datum e = args[3];
@@ -102,12 +102,12 @@ void Inventory(ArgArray args) {
         assert(strcmp(v1.u.str, "\"\"") == 0);
 
     debug("Inventory(...)");
-    
+
     if (strcmp(b1.u.str, "\"\"") != 0) {
         Common::String *s = new Common::String(b1.u.str);
         MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
         m->surf = g_private->loadMask(*s, 0, 0, true);
-        
+
         if (e.type == NUM)
             m->nextSetting = NULL;
         else
@@ -119,20 +119,20 @@ void Inventory(ArgArray args) {
             m->flag = v2.u.sym;
         else
             m->flag = NULL;
-        
+
         g_private->_masks.push_front(*m);
 
     }
 
     if (v1.type == NAME)
         v1.u.sym->u.val = 1;
-    
+
     if (strcmp(snd.u.str, "\"\"") != 0) {
         Common::String *s = new Common::String(snd.u.str);
         g_private->playSound(*s);
     }
- 
-    // TODO: Keep track of inventory is missing    
+
+    // TODO: Keep track of inventory is missing
 }
 
 void SetFlag(ArgArray args) {
@@ -286,8 +286,12 @@ void _Mask(ArgArray args, bool drawn) {
 
 }
 
-void Mask(ArgArray args) { _Mask(args, false); }
-void MaskDrawn(ArgArray args) { _Mask(args, true); }
+void Mask(ArgArray args) {
+    _Mask(args, false);
+}
+void MaskDrawn(ArgArray args) {
+    _Mask(args, true);
+}
 
 void AddSound(char *s, char *t) {
     Common::String str(t);
@@ -301,9 +305,15 @@ void AddSound(char *s, char *t) {
         debug("error: invalid sound type %s", t);
 }
 
-void AMRadioClip(ArgArray args) { AddSound(args[0].u.str, "AMRadioClip"); }
-void PoliceClip(ArgArray args) { AddSound(args[0].u.str, "PoliceClip"); }
-void PhoneClip(ArgArray args) { AddSound(args[0].u.str, "PhoneClip"); }
+void AMRadioClip(ArgArray args) {
+    AddSound(args[0].u.str, "AMRadioClip");
+}
+void PoliceClip(ArgArray args) {
+    AddSound(args[0].u.str, "PoliceClip");
+}
+void PhoneClip(ArgArray args) {
+    AddSound(args[0].u.str, "PhoneClip");
+}
 
 void SoundArea(ArgArray args) {
     // assert types
@@ -343,14 +353,14 @@ static struct FuncTable {
     { PoliceClip,      "PoliceClip"},
     { PhoneClip,       "PhoneClip"},
     { SoundArea,       "SoundArea"},
- 
+
     // Images
     { Bitmap,          "Bitmap"},
     { Mask,            "Mask"},
     { MaskDrawn,       "MaskDrawn"},
     { VSPicture,       "VSPicture"},
     { ViewScreen,      "ViewScreen"},
- 
+
     // Video
     { Transition,      "Transition"},
     { Movie,           "Movie"},
@@ -382,7 +392,7 @@ void call(char *name, ArgArray args) {
         debug("I don't know how to execute %s", name);
         assert(0);
     }
-    
+
     void (*func)(ArgArray) = (void (*)(ArgArray)) _functions.getVal(n);
     func(args);
 
diff --git a/engines/private/grammar.tab.cpp b/engines/private/grammar.tab.cpp
index 776e830345..d93bf3b240 100644
--- a/engines/private/grammar.tab.cpp
+++ b/engines/private/grammar.tab.cpp
@@ -91,12 +91,12 @@ extern int yyparse();
 
 void yyerror(const char *str)
 {
-	//fprintf(stderr,"error: %s\n",str);
+    //fprintf(stderr,"error: %s\n",str);
 }
 
 int yywrap()
 {
-	return 1;
+    return 1;
 }
 
 
@@ -127,55 +127,55 @@ int yywrap()
 /* Symbol kind.  */
 enum yysymbol_kind_t
 {
-  YYSYMBOL_YYEMPTY = -2,
-  YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
-  YYSYMBOL_YYerror = 1,                    /* error  */
-  YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
-  YYSYMBOL_NAME = 3,                       /* NAME  */
-  YYSYMBOL_STRING = 4,                     /* STRING  */
-  YYSYMBOL_NUM = 5,                        /* NUM  */
-  YYSYMBOL_LTE = 6,                        /* LTE  */
-  YYSYMBOL_GTE = 7,                        /* GTE  */
-  YYSYMBOL_NEQ = 8,                        /* NEQ  */
-  YYSYMBOL_EQ = 9,                         /* EQ  */
-  YYSYMBOL_FALSETOK = 10,                  /* FALSETOK  */
-  YYSYMBOL_TRUETOK = 11,                   /* TRUETOK  */
-  YYSYMBOL_NULLTOK = 12,                   /* NULLTOK  */
-  YYSYMBOL_IFTOK = 13,                     /* IFTOK  */
-  YYSYMBOL_ELSETOK = 14,                   /* ELSETOK  */
-  YYSYMBOL_RECT = 15,                      /* RECT  */
-  YYSYMBOL_GOTOTOK = 16,                   /* GOTOTOK  */
-  YYSYMBOL_DEBUGTOK = 17,                  /* DEBUGTOK  */
-  YYSYMBOL_DEFINETOK = 18,                 /* DEFINETOK  */
-  YYSYMBOL_SETTINGTOK = 19,                /* SETTINGTOK  */
-  YYSYMBOL_RANDOMTOK = 20,                 /* RANDOMTOK  */
-  YYSYMBOL_21_ = 21,                       /* '{'  */
-  YYSYMBOL_22_ = 22,                       /* '}'  */
-  YYSYMBOL_23_ = 23,                       /* ','  */
-  YYSYMBOL_24_ = 24,                       /* ';'  */
-  YYSYMBOL_25_ = 25,                       /* '('  */
-  YYSYMBOL_26_ = 26,                       /* ')'  */
-  YYSYMBOL_27_ = 27,                       /* '!'  */
-  YYSYMBOL_28_ = 28,                       /* '+'  */
-  YYSYMBOL_29_ = 29,                       /* '<'  */
-  YYSYMBOL_30_ = 30,                       /* '>'  */
-  YYSYMBOL_31_ = 31,                       /* '%'  */
-  YYSYMBOL_YYACCEPT = 32,                  /* $accept  */
-  YYSYMBOL_lines = 33,                     /* lines  */
-  YYSYMBOL_line = 34,                      /* line  */
-  YYSYMBOL_debug = 35,                     /* debug  */
-  YYSYMBOL_statements = 36,                /* statements  */
-  YYSYMBOL_statement = 37,                 /* statement  */
-  YYSYMBOL_body = 38,                      /* body  */
-  YYSYMBOL_end = 39,                       /* end  */
-  YYSYMBOL_if = 40,                        /* if  */
-  YYSYMBOL_cond = 41,                      /* cond  */
-  YYSYMBOL_define = 42,                    /* define  */
-  YYSYMBOL_fcall = 43,                     /* fcall  */
-  YYSYMBOL_startp = 44,                    /* startp  */
-  YYSYMBOL_params = 45,                    /* params  */
-  YYSYMBOL_value = 46,                     /* value  */
-  YYSYMBOL_expr = 47                       /* expr  */
+    YYSYMBOL_YYEMPTY = -2,
+    YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
+    YYSYMBOL_YYerror = 1,                    /* error  */
+    YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
+    YYSYMBOL_NAME = 3,                       /* NAME  */
+    YYSYMBOL_STRING = 4,                     /* STRING  */
+    YYSYMBOL_NUM = 5,                        /* NUM  */
+    YYSYMBOL_LTE = 6,                        /* LTE  */
+    YYSYMBOL_GTE = 7,                        /* GTE  */
+    YYSYMBOL_NEQ = 8,                        /* NEQ  */
+    YYSYMBOL_EQ = 9,                         /* EQ  */
+    YYSYMBOL_FALSETOK = 10,                  /* FALSETOK  */
+    YYSYMBOL_TRUETOK = 11,                   /* TRUETOK  */
+    YYSYMBOL_NULLTOK = 12,                   /* NULLTOK  */
+    YYSYMBOL_IFTOK = 13,                     /* IFTOK  */
+    YYSYMBOL_ELSETOK = 14,                   /* ELSETOK  */
+    YYSYMBOL_RECT = 15,                      /* RECT  */
+    YYSYMBOL_GOTOTOK = 16,                   /* GOTOTOK  */
+    YYSYMBOL_DEBUGTOK = 17,                  /* DEBUGTOK  */
+    YYSYMBOL_DEFINETOK = 18,                 /* DEFINETOK  */
+    YYSYMBOL_SETTINGTOK = 19,                /* SETTINGTOK  */
+    YYSYMBOL_RANDOMTOK = 20,                 /* RANDOMTOK  */
+    YYSYMBOL_21_ = 21,                       /* '{'  */
+    YYSYMBOL_22_ = 22,                       /* '}'  */
+    YYSYMBOL_23_ = 23,                       /* ','  */
+    YYSYMBOL_24_ = 24,                       /* ';'  */
+    YYSYMBOL_25_ = 25,                       /* '('  */
+    YYSYMBOL_26_ = 26,                       /* ')'  */
+    YYSYMBOL_27_ = 27,                       /* '!'  */
+    YYSYMBOL_28_ = 28,                       /* '+'  */
+    YYSYMBOL_29_ = 29,                       /* '<'  */
+    YYSYMBOL_30_ = 30,                       /* '>'  */
+    YYSYMBOL_31_ = 31,                       /* '%'  */
+    YYSYMBOL_YYACCEPT = 32,                  /* $accept  */
+    YYSYMBOL_lines = 33,                     /* lines  */
+    YYSYMBOL_line = 34,                      /* line  */
+    YYSYMBOL_debug = 35,                     /* debug  */
+    YYSYMBOL_statements = 36,                /* statements  */
+    YYSYMBOL_statement = 37,                 /* statement  */
+    YYSYMBOL_body = 38,                      /* body  */
+    YYSYMBOL_end = 39,                       /* end  */
+    YYSYMBOL_if = 40,                        /* if  */
+    YYSYMBOL_cond = 41,                      /* cond  */
+    YYSYMBOL_define = 42,                    /* define  */
+    YYSYMBOL_fcall = 43,                     /* fcall  */
+    YYSYMBOL_startp = 44,                    /* startp  */
+    YYSYMBOL_params = 45,                    /* params  */
+    YYSYMBOL_value = 46,                     /* value  */
+    YYSYMBOL_expr = 47                       /* expr  */
 };
 typedef enum yysymbol_kind_t yysymbol_kind_t;
 
@@ -374,7 +374,7 @@ typedef int yy_state_fast_t;
 #    define YYSTACK_ALLOC alloca
 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
+/* Use EXIT_SUCCESS as a witness for stdlib.h.  */
 #     ifndef EXIT_SUCCESS
 #      define EXIT_SUCCESS 0
 #     endif
@@ -384,13 +384,13 @@ typedef int yy_state_fast_t;
 # endif
 
 # ifdef YYSTACK_ALLOC
-   /* Pacify GCC's 'empty if-body' warning.  */
+/* Pacify GCC's 'empty if-body' warning.  */
 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (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.  */
+/* 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
@@ -429,8 +429,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
 {
-  yy_state_t yyss_alloc;
-  YYSTYPE yyvs_alloc;
+    yy_state_t yyss_alloc;
+    YYSTYPE yyvs_alloc;
 };
 
 /* The size of the maximum gap between one aligned stack and the next.  */
@@ -511,46 +511,46 @@ union yyalloc
    as returned by yylex.  */
 static const yytype_int8 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,    27,     2,     2,     2,    31,     2,     2,
-      25,    26,     2,    28,    23,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,    24,
-      29,     2,    30,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,    21,     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,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     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,
-      15,    16,    17,    18,    19,    20
+    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,    27,     2,     2,     2,    31,     2,     2,
+    25,    26,     2,    28,    23,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,    24,
+    29,     2,    30,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,    21,     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,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     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,
+    15,    16,    17,    18,    19,    20
 };
 
 #if YYDEBUG
-  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
+/* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
-       0,    54,    54,    55,    58,    59,    60,    63,    64,    67,
-      68,    71,    77,    78,    83,    91,    92,    95,    98,   101,
-     104,   105,   110,   114,   115,   118,   126,   127,   135,   138,
-     139,   140,   141,   142,   145,   146,   147,   148,   149,   150,
-     153,   154,   155,   156,   157,   158,   159,   160,   161,   162,
-     163
+    0,    54,    54,    55,    58,    59,    60,    63,    64,    67,
+    68,    71,    77,    78,    83,    91,    92,    95,    98,   101,
+    104,   105,   110,   114,   115,   118,   126,   127,   135,   138,
+    139,   140,   141,   142,   145,   146,   147,   148,   149,   150,
+    153,   154,   155,   156,   157,   158,   159,   160,   161,   162,
+    163
 };
 #endif
 
@@ -566,19 +566,19 @@ static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
 static const char *const yytname[] =
 {
-  "\"end of file\"", "error", "\"invalid token\"", "NAME", "STRING",
-  "NUM", "LTE", "GTE", "NEQ", "EQ", "FALSETOK", "TRUETOK", "NULLTOK",
-  "IFTOK", "ELSETOK", "RECT", "GOTOTOK", "DEBUGTOK", "DEFINETOK",
-  "SETTINGTOK", "RANDOMTOK", "'{'", "'}'", "','", "';'", "'('", "')'",
-  "'!'", "'+'", "'<'", "'>'", "'%'", "$accept", "lines", "line", "debug",
-  "statements", "statement", "body", "end", "if", "cond", "define",
-  "fcall", "startp", "params", "value", "expr", YY_NULLPTR
+    "\"end of file\"", "error", "\"invalid token\"", "NAME", "STRING",
+    "NUM", "LTE", "GTE", "NEQ", "EQ", "FALSETOK", "TRUETOK", "NULLTOK",
+    "IFTOK", "ELSETOK", "RECT", "GOTOTOK", "DEBUGTOK", "DEFINETOK",
+    "SETTINGTOK", "RANDOMTOK", "'{'", "'}'", "','", "';'", "'('", "')'",
+    "'!'", "'+'", "'<'", "'>'", "'%'", "$accept", "lines", "line", "debug",
+    "statements", "statement", "body", "end", "if", "cond", "define",
+    "fcall", "startp", "params", "value", "expr", YY_NULLPTR
 };
 
 static const char *
 yysymbol_name (yysymbol_kind_t yysymbol)
 {
-  return yytname[yysymbol];
+    return yytname[yysymbol];
 }
 #endif
 
@@ -587,10 +587,10 @@ yysymbol_name (yysymbol_kind_t yysymbol)
    (internal) symbol number NUM (which must be that of a token).  */
 static const yytype_int16 yytoknum[] =
 {
-       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
-     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
-     275,   123,   125,    44,    59,    40,    41,    33,    43,    60,
-      62,    37
+    0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
+    265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
+    275,   123,   125,    44,    59,    40,    41,    33,    43,    60,
+    62,    37
 };
 #endif
 
@@ -604,132 +604,132 @@ static const yytype_int16 yytoknum[] =
 #define yytable_value_is_error(Yyn) \
   0
 
-  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-     STATE-NUM.  */
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+   STATE-NUM.  */
 static const yytype_int8 yypact[] =
 {
-       8,   -11,    11,    12,    18,     8,    30,    22,    23,   -73,
-     -73,    24,    38,    42,    59,    30,   -73,    40,    39,    41,
-     -73,    54,    16,    58,    59,    56,    60,   -73,     5,   -73,
-     -73,    77,    61,    83,   -73,   -73,    19,    52,   -73,    62,
-     -73,     1,    65,   -73,    63,   -73,   -73,   -73,   -73,   -73,
-     -73,    67,    66,    29,    64,    59,   -73,   -73,    86,    41,
-      68,    71,    69,    73,    92,   -73,    93,   -73,    66,    66,
-      66,    66,    66,    66,    66,   -73,    78,    50,    76,     1,
-     -73,     1,    79,    70,   -73,   -73,   -73,   -73,   -73,   -73,
-     -73,   -73,    52,    98,   -73,   -73,    99,    80,   -73,    82,
-      84,   -73,   -73,   103,   104,    87,    85,   107,   -73,    88,
-      90,    42,   -73
+    8,   -11,    11,    12,    18,     8,    30,    22,    23,   -73,
+    -73,    24,    38,    42,    59,    30,   -73,    40,    39,    41,
+    -73,    54,    16,    58,    59,    56,    60,   -73,     5,   -73,
+    -73,    77,    61,    83,   -73,   -73,    19,    52,   -73,    62,
+    -73,     1,    65,   -73,    63,   -73,   -73,   -73,   -73,   -73,
+    -73,    67,    66,    29,    64,    59,   -73,   -73,    86,    41,
+    68,    71,    69,    73,    92,   -73,    93,   -73,    66,    66,
+    66,    66,    66,    66,    66,   -73,    78,    50,    76,     1,
+    -73,     1,    79,    70,   -73,   -73,   -73,   -73,   -73,   -73,
+    -73,   -73,    52,    98,   -73,   -73,    99,    80,   -73,    82,
+    84,   -73,   -73,   103,   104,    87,    85,   107,   -73,    88,
+    90,    42,   -73
 };
 
-  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
-     Performed when YYTABLE does not specify something else to do.  Zero
-     means the default is an error.  */
+/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+   Performed when YYTABLE does not specify something else to do.  Zero
+   means the default is an error.  */
 static const yytype_int8 yydefact[] =
 {
-       0,     0,     0,     0,     0,     3,     7,     0,     0,     1,
-       2,     0,     0,    20,     9,     7,     4,    24,     0,     0,
-      18,     0,     0,     0,     9,     0,     0,     8,    20,     5,
-      28,     0,     0,     0,     6,    10,     0,     0,    12,     0,
-      23,    29,     0,    11,     0,    39,    38,    37,    35,    36,
-      34,     0,     0,    40,     0,     9,    15,    17,     0,    39,
-       0,    33,     0,    32,     0,    25,     0,    41,     0,     0,
-       0,     0,    49,     0,     0,    19,     0,    13,     0,    29,
-      27,    29,     0,     0,    47,    48,    43,    42,    44,    45,
-      46,    16,     0,     0,    30,    31,     0,     0,    17,     0,
-       0,    50,    14,     0,     0,     0,     0,     0,    26,     0,
-      22,    20,    21
+    0,     0,     0,     0,     0,     3,     7,     0,     0,     1,
+    2,     0,     0,    20,     9,     7,     4,    24,     0,     0,
+    18,     0,     0,     0,     9,     0,     0,     8,    20,     5,
+    28,     0,     0,     0,     6,    10,     0,     0,    12,     0,
+    23,    29,     0,    11,     0,    39,    38,    37,    35,    36,
+    34,     0,     0,    40,     0,     9,    15,    17,     0,    39,
+    0,    33,     0,    32,     0,    25,     0,    41,     0,     0,
+    0,     0,    49,     0,     0,    19,     0,    13,     0,    29,
+    27,    29,     0,     0,    47,    48,    43,    42,    44,    45,
+    46,    16,     0,     0,    30,    31,     0,     0,    17,     0,
+    0,    50,    14,     0,     0,     0,     0,     0,    26,     0,
+    22,    20,    21
 };
 
-  /* YYPGOTO[NTERM-NUM].  */
+/* YYPGOTO[NTERM-NUM].  */
 static const yytype_int8 yypgoto[] =
 {
-     -73,   110,   -73,   101,   -21,   -36,    25,    20,   -73,   -73,
-     -28,   -39,   -73,   -72,   -20,    89
-};
+    -73,   110,   -73,   101,   -21,   -36,    25,    20,   -73,   -73,
+        -28,   -39,   -73,   -72,   -20,    89
+    };
 
-  /* YYDEFGOTO[NTERM-NUM].  */
+/* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int8 yydefgoto[] =
 {
-      -1,     4,     5,    12,    23,    24,    57,    77,    25,    37,
-      18,    26,    41,    62,    53,    63
-};
+    -1,     4,     5,    12,    23,    24,    57,    77,    25,    37,
+        18,    26,    41,    62,    53,    63
+    };
 
-  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
-     positive, shift that token.  If negative, reduce the rule whose
-     number is the opposite.  If YYTABLE_NINF, syntax error.  */
+/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
+   positive, shift that token.  If negative, reduce the rule whose
+   number is the opposite.  If YYTABLE_NINF, syntax error.  */
 static const yytype_int8 yytable[] =
 {
-      40,    56,    61,    35,    59,    46,    47,    94,    17,    95,
-       6,    48,    49,    50,     7,     8,    21,    60,     9,    32,
-      39,    51,    45,    46,    47,     1,     2,     3,    52,    48,
-      49,    50,    67,    11,    76,    68,    69,    70,    71,    51,
-      61,    33,    61,    13,    14,    17,    52,    15,    84,    85,
-      86,    87,    88,    89,    90,    19,    56,    72,    73,    74,
-      16,    29,    19,    28,    92,    20,    30,    21,    22,    45,
-      46,    47,    20,    55,    21,    22,    48,    49,    50,    31,
-      34,    36,    42,   112,    38,    43,    44,    58,    64,    65,
-      75,    78,    66,    33,    79,    80,    81,    82,    83,    93,
-      91,    97,    96,    99,   100,   103,   101,   104,   105,   106,
-     107,   108,   109,   111,   110,    10,    27,    98,   102,     0,
-       0,     0,     0,     0,     0,    54
+    40,    56,    61,    35,    59,    46,    47,    94,    17,    95,
+    6,    48,    49,    50,     7,     8,    21,    60,     9,    32,
+    39,    51,    45,    46,    47,     1,     2,     3,    52,    48,
+    49,    50,    67,    11,    76,    68,    69,    70,    71,    51,
+    61,    33,    61,    13,    14,    17,    52,    15,    84,    85,
+    86,    87,    88,    89,    90,    19,    56,    72,    73,    74,
+    16,    29,    19,    28,    92,    20,    30,    21,    22,    45,
+    46,    47,    20,    55,    21,    22,    48,    49,    50,    31,
+    34,    36,    42,   112,    38,    43,    44,    58,    64,    65,
+    75,    78,    66,    33,    79,    80,    81,    82,    83,    93,
+    91,    97,    96,    99,   100,   103,   101,   104,   105,   106,
+    107,   108,   109,   111,   110,    10,    27,    98,   102,     0,
+    0,     0,     0,     0,     0,    54
 };
 
 static const yytype_int8 yycheck[] =
 {
-      28,    37,    41,    24,     3,     4,     5,    79,     3,    81,
-      21,    10,    11,    12,     3,     3,    15,    16,     0,     3,
-      15,    20,     3,     4,     5,    17,    18,    19,    27,    10,
-      11,    12,    52,     3,    55,     6,     7,     8,     9,    20,
-      79,    25,    81,    21,    21,     3,    27,    23,    68,    69,
-      70,    71,    72,    73,    74,     3,    92,    28,    29,    30,
-      22,    22,     3,    23,    14,    13,    25,    15,    16,     3,
-       4,     5,    13,    21,    15,    16,    10,    11,    12,    25,
-      22,    25,     5,   111,    24,    24,     3,    25,    23,    26,
-      26,     5,    25,    25,    23,    26,    23,     5,     5,    23,
-      22,    31,    23,     5,     5,    23,    26,    23,     5,     5,
-      23,    26,     5,    23,    26,     5,    15,    92,    98,    -1,
-      -1,    -1,    -1,    -1,    -1,    36
+    28,    37,    41,    24,     3,     4,     5,    79,     3,    81,
+    21,    10,    11,    12,     3,     3,    15,    16,     0,     3,
+    15,    20,     3,     4,     5,    17,    18,    19,    27,    10,
+    11,    12,    52,     3,    55,     6,     7,     8,     9,    20,
+    79,    25,    81,    21,    21,     3,    27,    23,    68,    69,
+    70,    71,    72,    73,    74,     3,    92,    28,    29,    30,
+    22,    22,     3,    23,    14,    13,    25,    15,    16,     3,
+    4,     5,    13,    21,    15,    16,    10,    11,    12,    25,
+    22,    25,     5,   111,    24,    24,     3,    25,    23,    26,
+    26,     5,    25,    25,    23,    26,    23,     5,     5,    23,
+    22,    31,    23,     5,     5,    23,    26,    23,     5,     5,
+    23,    26,     5,    23,    26,     5,    15,    92,    98,    -1,
+    -1,    -1,    -1,    -1,    -1,    36
 };
 
-  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-     symbol of state STATE-NUM.  */
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+   symbol of state STATE-NUM.  */
 static const yytype_int8 yystos[] =
 {
-       0,    17,    18,    19,    33,    34,    21,     3,     3,     0,
-      33,     3,    35,    21,    21,    23,    22,     3,    42,     3,
-      13,    15,    16,    36,    37,    40,    43,    35,    23,    22,
-      25,    25,     3,    25,    22,    36,    25,    41,    24,    15,
-      42,    44,     5,    24,     3,     3,     4,     5,    10,    11,
-      12,    20,    27,    46,    47,    21,    37,    38,    25,     3,
-      16,    43,    45,    47,    23,    26,    25,    46,     6,     7,
-       8,     9,    28,    29,    30,    26,    36,    39,     5,    23,
-      26,    23,     5,     5,    46,    46,    46,    46,    46,    46,
-      46,    22,    14,    23,    45,    45,    23,    31,    38,     5,
-       5,    26,    39,    23,    23,     5,     5,    23,    26,     5,
-      26,    23,    42
+    0,    17,    18,    19,    33,    34,    21,     3,     3,     0,
+    33,     3,    35,    21,    21,    23,    22,     3,    42,     3,
+    13,    15,    16,    36,    37,    40,    43,    35,    23,    22,
+    25,    25,     3,    25,    22,    36,    25,    41,    24,    15,
+    42,    44,     5,    24,     3,     3,     4,     5,    10,    11,
+    12,    20,    27,    46,    47,    21,    37,    38,    25,     3,
+    16,    43,    45,    47,    23,    26,    25,    46,     6,     7,
+    8,     9,    28,    29,    30,    26,    36,    39,     5,    23,
+    26,    23,     5,     5,    46,    46,    46,    46,    46,    46,
+    46,    22,    14,    23,    45,    45,    23,    31,    38,     5,
+    5,    26,    39,    23,    23,     5,     5,    23,    26,     5,
+    26,    23,    42
 };
 
-  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_int8 yyr1[] =
 {
-       0,    32,    33,    33,    34,    34,    34,    35,    35,    36,
-      36,    37,    37,    37,    37,    38,    38,    39,    40,    41,
-      42,    42,    42,    42,    42,    43,    43,    43,    44,    45,
-      45,    45,    45,    45,    46,    46,    46,    46,    46,    46,
-      47,    47,    47,    47,    47,    47,    47,    47,    47,    47,
-      47
+    0,    32,    33,    33,    34,    34,    34,    35,    35,    36,
+    36,    37,    37,    37,    37,    38,    38,    39,    40,    41,
+    42,    42,    42,    42,    42,    43,    43,    43,    44,    45,
+    45,    45,    45,    45,    46,    46,    46,    46,    46,    46,
+    47,    47,    47,    47,    47,    47,    47,    47,    47,    47,
+    47
 };
 
-  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
+/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
 static const yytype_int8 yyr2[] =
 {
-       0,     2,     2,     1,     4,     5,     5,     0,     3,     0,
-       2,     3,     2,     4,     7,     1,     3,     0,     1,     3,
-       0,    14,    12,     3,     1,     4,    10,     5,     0,     0,
-       3,     3,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     2,     3,     3,     3,     3,     3,     3,     3,     2,
-       5
+    0,     2,     2,     1,     4,     5,     5,     0,     3,     0,
+    2,     3,     2,     4,     7,     1,     3,     0,     1,     3,
+    0,    14,    12,     3,     1,     4,    10,     5,     0,     0,
+    3,     3,     1,     1,     1,     1,     1,     1,     1,     1,
+    1,     2,     3,     3,     3,     3,     3,     3,     3,     2,
+    5
 };
 
 
@@ -807,17 +807,17 @@ static void
 yy_symbol_value_print (FILE *yyo,
                        yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
 {
-  FILE *yyoutput = yyo;
-  YYUSE (yyoutput);
-  if (!yyvaluep)
-    return;
+    FILE *yyoutput = yyo;
+    YYUSE (yyoutput);
+    if (!yyvaluep)
+        return;
 # ifdef YYPRINT
-  if (yykind < YYNTOKENS)
-    YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
+    if (yykind < YYNTOKENS)
+        YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
 # endif
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  YYUSE (yykind);
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
+    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+    YYUSE (yykind);
+    YY_IGNORE_MAYBE_UNINITIALIZED_END
 }
 
 
@@ -829,11 +829,11 @@ static void
 yy_symbol_print (FILE *yyo,
                  yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
 {
-  YYFPRINTF (yyo, "%s %s (",
-             yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
+    YYFPRINTF (yyo, "%s %s (",
+               yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
 
-  yy_symbol_value_print (yyo, yykind, yyvaluep);
-  YYFPRINTF (yyo, ")");
+    yy_symbol_value_print (yyo, yykind, yyvaluep);
+    YYFPRINTF (yyo, ")");
 }
 
 /*------------------------------------------------------------------.
@@ -844,13 +844,13 @@ yy_symbol_print (FILE *yyo,
 static void
 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
 {
-  YYFPRINTF (stderr, "Stack now");
-  for (; yybottom <= yytop; yybottom++)
+    YYFPRINTF (stderr, "Stack now");
+    for (; yybottom <= yytop; yybottom++)
     {
-      int yybot = *yybottom;
-      YYFPRINTF (stderr, " %d", yybot);
+        int yybot = *yybottom;
+        YYFPRINTF (stderr, " %d", yybot);
     }
-  YYFPRINTF (stderr, "\n");
+    YYFPRINTF (stderr, "\n");
 }
 
 # define YY_STACK_PRINT(Bottom, Top)                            \
@@ -868,19 +868,19 @@ static void
 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
                  int yyrule)
 {
-  int yylno = yyrline[yyrule];
-  int yynrhs = yyr2[yyrule];
-  int yyi;
-  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
-             yyrule - 1, yylno);
-  /* The symbols being reduced.  */
-  for (yyi = 0; yyi < yynrhs; yyi++)
+    int yylno = yyrline[yyrule];
+    int yynrhs = yyr2[yyrule];
+    int yyi;
+    YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
+               yyrule - 1, yylno);
+    /* The symbols being reduced.  */
+    for (yyi = 0; yyi < yynrhs; yyi++)
     {
-      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
-      yy_symbol_print (stderr,
-                       YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
-                       &yyvsp[(yyi + 1) - (yynrhs)]);
-      YYFPRINTF (stderr, "\n");
+        YYFPRINTF (stderr, "   $%d = ", yyi + 1);
+        yy_symbol_print (stderr,
+                         YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
+                         &yyvsp[(yyi + 1) - (yynrhs)]);
+        YYFPRINTF (stderr, "\n");
     }
 }
 
@@ -930,14 +930,14 @@ static void
 yydestruct (const char *yymsg,
             yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
 {
-  YYUSE (yyvaluep);
-  if (!yymsg)
-    yymsg = "Deleting";
-  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
-
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  YYUSE (yykind);
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
+    YYUSE (yyvaluep);
+    if (!yymsg)
+        yymsg = "Deleting";
+    YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
+
+    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+    YYUSE (yykind);
+    YY_IGNORE_MAYBE_UNINITIALIZED_END
 }
 
 
@@ -979,705 +979,781 @@ yyparse (void)
     YYSTYPE *yyvs = yyvsa;
     YYSTYPE *yyvsp = yyvs;
 
-  int yyn;
-  /* The return value of yyparse.  */
-  int yyresult;
-  /* Lookahead symbol kind.  */
-  yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
-  /* The variables used to return semantic value and location from the
-     action routines.  */
-  YYSTYPE yyval;
+    int yyn;
+    /* The return value of yyparse.  */
+    int yyresult;
+    /* Lookahead symbol kind.  */
+    yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
+    /* The variables used to return semantic value and location from the
+       action routines.  */
+    YYSTYPE yyval;
 
 
 
 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 
-  /* The number of symbols on the RHS of the reduced rule.
-     Keep to zero when no symbol should be popped.  */
-  int yylen = 0;
+    /* 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"));
+    YYDPRINTF ((stderr, "Starting parse\n"));
 
-  yychar = YYEMPTY; /* Cause a token to be read.  */
-  goto yysetstate;
+    yychar = YYEMPTY; /* Cause a token to be read.  */
+    goto yysetstate;
 
 
-/*------------------------------------------------------------.
-| yynewstate -- push a new state, which is found in yystate.  |
-`------------------------------------------------------------*/
+    /*------------------------------------------------------------.
+    | 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++;
+    /* 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 -- set current state (the top of the stack) to yystate.  |
-`--------------------------------------------------------------------*/
+    /*--------------------------------------------------------------------.
+    | yysetstate -- set current state (the top of the stack) to yystate.  |
+    `--------------------------------------------------------------------*/
 yysetstate:
-  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
-  YY_IGNORE_USELESS_CAST_BEGIN
-  *yyssp = YY_CAST (yy_state_t, yystate);
-  YY_IGNORE_USELESS_CAST_END
-  YY_STACK_PRINT (yyss, yyssp);
-
-  if (yyss + yystacksize - 1 <= yyssp)
+    YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+    YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
+    YY_IGNORE_USELESS_CAST_BEGIN
+    *yyssp = YY_CAST (yy_state_t, yystate);
+    YY_IGNORE_USELESS_CAST_END
+    YY_STACK_PRINT (yyss, yyssp);
+
+    if (yyss + yystacksize - 1 <= yyssp)
 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
-    goto yyexhaustedlab;
+        goto yyexhaustedlab;
 #else
     {
-      /* Get the current used size of the three stacks, in elements.  */
-      YYPTRDIFF_T yysize = yyssp - yyss + 1;
+        /* Get the current used size of the three stacks, in elements.  */
+        YYPTRDIFF_T yysize = yyssp - yyss + 1;
 
 # if defined 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.  */
-        yy_state_t *yyss1 = yyss;
-        YYSTYPE *yyvs1 = yyvs;
-
-        /* 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 * YYSIZEOF (*yyssp),
-                    &yyvs1, yysize * YYSIZEOF (*yyvsp),
-                    &yystacksize);
-        yyss = yyss1;
-        yyvs = yyvs1;
-      }
+        {
+            /* Give user a chance to reallocate the stack.  Use copies of
+               these so that the &'s don't force the real ones into
+               memory.  */
+            yy_state_t *yyss1 = yyss;
+            YYSTYPE *yyvs1 = yyvs;
+
+            /* 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 * YYSIZEOF (*yyssp),
+                        &yyvs1, yysize * YYSIZEOF (*yyvsp),
+                        &yystacksize);
+            yyss = yyss1;
+            yyvs = yyvs1;
+        }
 # else /* defined YYSTACK_RELOCATE */
-      /* Extend the stack our own way.  */
-      if (YYMAXDEPTH <= yystacksize)
-        goto yyexhaustedlab;
-      yystacksize *= 2;
-      if (YYMAXDEPTH < yystacksize)
-        yystacksize = YYMAXDEPTH;
-
-      {
-        yy_state_t *yyss1 = yyss;
-        union yyalloc *yyptr =
-          YY_CAST (union yyalloc *,
-                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
-        if (! yyptr)
-          goto yyexhaustedlab;
-        YYSTACK_RELOCATE (yyss_alloc, yyss);
-        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+        /* Extend the stack our own way.  */
+        if (YYMAXDEPTH <= yystacksize)
+            goto yyexhaustedlab;
+        yystacksize *= 2;
+        if (YYMAXDEPTH < yystacksize)
+            yystacksize = YYMAXDEPTH;
+
+        {
+            yy_state_t *yyss1 = yyss;
+            union yyalloc *yyptr =
+                    YY_CAST (union yyalloc *,
+                             YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
+            if (! yyptr)
+                goto yyexhaustedlab;
+            YYSTACK_RELOCATE (yyss_alloc, yyss);
+            YYSTACK_RELOCATE (yyvs_alloc, yyvs);
 #  undef YYSTACK_RELOCATE
-        if (yyss1 != yyssa)
-          YYSTACK_FREE (yyss1);
-      }
+            if (yyss1 != yyssa)
+                YYSTACK_FREE (yyss1);
+        }
 # endif
 
-      yyssp = yyss + yysize - 1;
-      yyvsp = yyvs + yysize - 1;
+        yyssp = yyss + yysize - 1;
+        yyvsp = yyvs + yysize - 1;
 
-      YY_IGNORE_USELESS_CAST_BEGIN
-      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
-                  YY_CAST (long, yystacksize)));
-      YY_IGNORE_USELESS_CAST_END
+        YY_IGNORE_USELESS_CAST_BEGIN
+        YYDPRINTF ((stderr, "Stack size increased to %ld\n",
+                    YY_CAST (long, yystacksize)));
+        YY_IGNORE_USELESS_CAST_END
 
-      if (yyss + yystacksize - 1 <= yyssp)
-        YYABORT;
+        if (yyss + yystacksize - 1 <= yyssp)
+            YYABORT;
     }
 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
 
-  if (yystate == YYFINAL)
-    YYACCEPT;
+    if (yystate == YYFINAL)
+        YYACCEPT;
 
-  goto yybackup;
+    goto yybackup;
 
 
-/*-----------.
-| yybackup.  |
-`-----------*/
+    /*-----------.
+    | yybackup.  |
+    `-----------*/
 yybackup:
-  /* Do appropriate processing given the current state.  Read a
-     lookahead token if we need one and don't already have one.  */
+    /* Do appropriate processing given the current state.  Read a
+       lookahead token if we need one and don't already have one.  */
 
-  /* First try to decide what to do without reference to lookahead token.  */
-  yyn = yypact[yystate];
-  if (yypact_value_is_default (yyn))
-    goto yydefault;
+    /* First try to decide what to do without reference to lookahead token.  */
+    yyn = yypact[yystate];
+    if (yypact_value_is_default (yyn))
+        goto yydefault;
 
-  /* Not known => get a lookahead token if don't already have one.  */
+    /* Not known => get a lookahead token if don't already have one.  */
 
-  /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
-  if (yychar == YYEMPTY)
+    /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
+    if (yychar == YYEMPTY)
     {
-      YYDPRINTF ((stderr, "Reading a token\n"));
-      yychar = yylex ();
+        YYDPRINTF ((stderr, "Reading a token\n"));
+        yychar = yylex ();
     }
 
-  if (yychar <= YYEOF)
+    if (yychar <= YYEOF)
     {
-      yychar = YYEOF;
-      yytoken = YYSYMBOL_YYEOF;
-      YYDPRINTF ((stderr, "Now at end of input.\n"));
+        yychar = YYEOF;
+        yytoken = YYSYMBOL_YYEOF;
+        YYDPRINTF ((stderr, "Now at end of input.\n"));
     }
-  else if (yychar == YYerror)
+    else if (yychar == YYerror)
     {
-      /* The scanner already issued an error message, process directly
-         to error recovery.  But do not keep the error token as
-         lookahead, it is too special and may lead us to an endless
-         loop in error recovery. */
-      yychar = YYUNDEF;
-      yytoken = YYSYMBOL_YYerror;
-      goto yyerrlab1;
+        /* The scanner already issued an error message, process directly
+           to error recovery.  But do not keep the error token as
+           lookahead, it is too special and may lead us to an endless
+           loop in error recovery. */
+        yychar = YYUNDEF;
+        yytoken = YYSYMBOL_YYerror;
+        goto yyerrlab1;
     }
-  else
+    else
     {
-      yytoken = YYTRANSLATE (yychar);
-      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+        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 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 (yytable_value_is_error (yyn))
-        goto yyerrlab;
-      yyn = -yyn;
-      goto yyreduce;
+        if (yytable_value_is_error (yyn))
+            goto yyerrlab;
+        yyn = -yyn;
+        goto yyreduce;
     }
 
-  /* Count tokens shifted since error; after three, turn off error
-     status.  */
-  if (yyerrstatus)
-    yyerrstatus--;
+    /* Count tokens shifted since error; after three, turn off error
+       status.  */
+    if (yyerrstatus)
+        yyerrstatus--;
 
-  /* Shift the lookahead token.  */
-  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-  yystate = yyn;
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  *++yyvsp = yylval;
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
+    /* Shift the lookahead token.  */
+    YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+    yystate = yyn;
+    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+    *++yyvsp = yylval;
+    YY_IGNORE_MAYBE_UNINITIALIZED_END
 
-  /* Discard the shifted token.  */
-  yychar = YYEMPTY;
-  goto yynewstate;
+    /* Discard the shifted token.  */
+    yychar = YYEMPTY;
+    goto yynewstate;
 
 
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state.  |
-`-----------------------------------------------------------*/
+    /*-----------------------------------------------------------.
+    | yydefault -- do the default action for the current state.  |
+    `-----------------------------------------------------------*/
 yydefault:
-  yyn = yydefact[yystate];
-  if (yyn == 0)
-    goto yyerrlab;
-  goto yyreduce;
+    yyn = yydefact[yystate];
+    if (yyn == 0)
+        goto yyerrlab;
+    goto yyreduce;
 
 
-/*-----------------------------.
-| yyreduce -- do a reduction.  |
-`-----------------------------*/
+    /*-----------------------------.
+    | yyreduce -- do a reduction.  |
+    `-----------------------------*/
 yyreduce:
-  /* yyn is the number of a rule to reduce with.  */
-  yylen = yyr2[yyn];
+    /* 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'.
+    /* 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];
+       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)
+    YY_REDUCE_PRINT (yyn);
+    switch (yyn)
     {
-  case 4: /* line: DEBUGTOK '{' debug '}'  */
+    case 4: /* line: DEBUGTOK '{' debug '}'  */
 #line 58 "engines/private/grammar.y"
-                                             { /* Not used in the game */ }
+        { /* Not used in the game */ }
 #line 1203 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 5: /* line: DEFINETOK NAME '{' define '}'  */
+    case 5: /* line: DEFINETOK NAME '{' define '}'  */
 #line 59 "engines/private/grammar.y"
-                                             { installall((yyvsp[-3].s)); }
+        {
+            installall((yyvsp[-3].s));
+        }
 #line 1209 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 6: /* line: SETTINGTOK NAME '{' statements '}'  */
+    case 6: /* line: SETTINGTOK NAME '{' statements '}'  */
 #line 60 "engines/private/grammar.y"
-                                             { saveSetting((yyvsp[-3].s)); initSetting(); }
+        {
+            saveSetting((yyvsp[-3].s));
+            initSetting();
+        }
 #line 1215 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 9: /* statements: %empty  */
+    case 9: /* statements: %empty  */
 #line 67 "engines/private/grammar.y"
-                               { (yyval.inst) = progp; }
+        {
+            (yyval.inst) = progp;
+        }
 #line 1221 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 11: /* statement: GOTOTOK NAME ';'  */
+    case 11: /* statement: GOTOTOK NAME ';'  */
 #line 71 "engines/private/grammar.y"
-                            {
-	code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, (yyvsp[-1].s)));
-        code2(constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
-        code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto")); 
-        code1(funcpush);
+        {
+            code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, (yyvsp[-1].s)));
+            code2(constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
+            code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto"));
+            code1(funcpush);
         }
 #line 1232 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 12: /* statement: fcall ';'  */
+    case 12: /* statement: fcall ';'  */
 #line 77 "engines/private/grammar.y"
-                            { }
+        { }
 #line 1238 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 13: /* statement: if cond body end  */
+    case 13: /* statement: if cond body end  */
 #line 78 "engines/private/grammar.y"
-                           {
-         	/* else-less if */
-		((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst);	/* thenpart */
-		((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst); 
-                }
+        {
+            /* else-less if */
+            ((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst);	/* thenpart */
+            ((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst);
+        }
 #line 1248 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 14: /* statement: if cond body end ELSETOK body end  */
+    case 14: /* statement: if cond body end ELSETOK body end  */
 #line 83 "engines/private/grammar.y"
-                                            { 
-                /* if with else */
-		((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst);	/* thenpart */
-		((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst);	/* elsepart */
-		((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst); 
-                }
+        {
+            /* if with else */
+            ((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst);	/* thenpart */
+            ((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst);	/* elsepart */
+            ((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst);
+        }
 #line 1259 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 15: /* body: statement  */
+    case 15: /* body: statement  */
 #line 91 "engines/private/grammar.y"
-                             { (yyval.inst) = (yyvsp[0].inst); }
+        {
+            (yyval.inst) = (yyvsp[0].inst);
+        }
 #line 1265 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 16: /* body: '{' statements '}'  */
+    case 16: /* body: '{' statements '}'  */
 #line 92 "engines/private/grammar.y"
-                             { (yyval.inst) = (yyvsp[-1].inst); }
+        {
+            (yyval.inst) = (yyvsp[-1].inst);
+        }
 #line 1271 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 17: /* end: %empty  */
+    case 17: /* end: %empty  */
 #line 95 "engines/private/grammar.y"
-                                { code(STOP); (yyval.inst) = progp; }
+        {
+            code(STOP);
+            (yyval.inst) = progp;
+        }
 #line 1277 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 18: /* if: IFTOK  */
+    case 18: /* if: IFTOK  */
 #line 98 "engines/private/grammar.y"
-          { (yyval.inst) = code(ifcode); code3(STOP, STOP, STOP); }
+        {
+            (yyval.inst) = code(ifcode);
+            code3(STOP, STOP, STOP);
+        }
 #line 1283 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 19: /* cond: '(' expr ')'  */
+    case 19: /* cond: '(' expr ')'  */
 #line 101 "engines/private/grammar.y"
-                        { code(STOP); (yyval.inst) = (yyvsp[-1].inst); }
+        {
+            code(STOP);
+            (yyval.inst) = (yyvsp[-1].inst);
+        }
 #line 1289 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  */
+    case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  */
 #line 105 "engines/private/grammar.y"
-                                                                        { 
-          Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
-          assert(r->isValidRect()); 
-          define((yyvsp[-13].s), r); 
-          }
+        {
+            Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
+            assert(r->isValidRect());
+            define((yyvsp[-13].s), r);
+        }
 #line 1299 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
+    case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
 #line 110 "engines/private/grammar.y"
-                                                            {
-          Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);  
-          define((yyvsp[-11].s), r); 
-          }
+        {
+            Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);
+            define((yyvsp[-11].s), r);
+        }
 #line 1308 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 23: /* define: NAME ',' define  */
+    case 23: /* define: NAME ',' define  */
 #line 114 "engines/private/grammar.y"
-                          { define((yyvsp[-2].s), NULL); }
+        {
+            define((yyvsp[-2].s), NULL);
+        }
 #line 1314 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 24: /* define: NAME  */
+    case 24: /* define: NAME  */
 #line 115 "engines/private/grammar.y"
-                          { define((yyvsp[0].s), NULL); }
+        {
+            define((yyvsp[0].s), NULL);
+        }
 #line 1320 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 25: /* fcall: GOTOTOK '(' NAME ')'  */
+    case 25: /* fcall: GOTOTOK '(' NAME ')'  */
 #line 118 "engines/private/grammar.y"
-                               {
-                               (yyval.inst) = progp;
-                               code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, (yyvsp[-1].s)));
-                               code2(constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
-                               code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto")); 
-                               code1(funcpush);
-                               }
+        {
+            (yyval.inst) = progp;
+            code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, (yyvsp[-1].s)));
+            code2(constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
+            code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto"));
+            code1(funcpush);
+        }
 #line 1332 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
+    case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
 #line 126 "engines/private/grammar.y"
-                                                   { (yyval.inst) = progp; }
+        {
+            (yyval.inst) = progp;
+        }
 #line 1338 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 27: /* fcall: NAME '(' startp params ')'  */
+    case 27: /* fcall: NAME '(' startp params ')'  */
 #line 127 "engines/private/grammar.y"
-                                      {
-                               (yyval.inst) = (yyvsp[-2].inst);
-                               code2(constpush, (Private::Inst) addconstant(NUM, (yyvsp[-1].narg), NULL));
-                               code2(strpush, (Private::Inst) addconstant(STRING, 0, (yyvsp[-4].s))); 
-                               code1(funcpush);
-                               }
+        {
+            (yyval.inst) = (yyvsp[-2].inst);
+            code2(constpush, (Private::Inst) addconstant(NUM, (yyvsp[-1].narg), NULL));
+            code2(strpush, (Private::Inst) addconstant(STRING, 0, (yyvsp[-4].s)));
+            code1(funcpush);
+        }
 #line 1349 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 28: /* startp: %empty  */
+    case 28: /* startp: %empty  */
 #line 135 "engines/private/grammar.y"
-                    { (yyval.inst) = progp; }
+        {
+            (yyval.inst) = progp;
+        }
 #line 1355 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 29: /* params: %empty  */
+    case 29: /* params: %empty  */
 #line 138 "engines/private/grammar.y"
-                            { (yyval.narg) = 0; }
+        {
+            (yyval.narg) = 0;
+        }
 #line 1361 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 30: /* params: fcall ',' params  */
+    case 30: /* params: fcall ',' params  */
 #line 139 "engines/private/grammar.y"
-                            { (yyval.narg) = (yyvsp[0].narg) + 1; }
+        {
+            (yyval.narg) = (yyvsp[0].narg) + 1;
+        }
 #line 1367 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 31: /* params: expr ',' params  */
+    case 31: /* params: expr ',' params  */
 #line 140 "engines/private/grammar.y"
-                            { (yyval.narg) = (yyvsp[0].narg) + 1; }
+        {
+            (yyval.narg) = (yyvsp[0].narg) + 1;
+        }
 #line 1373 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 32: /* params: expr  */
+    case 32: /* params: expr  */
 #line 141 "engines/private/grammar.y"
-                      { (yyval.narg) = 1; }
+        {
+            (yyval.narg) = 1;
+        }
 #line 1379 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 33: /* params: fcall  */
+    case 33: /* params: fcall  */
 #line 142 "engines/private/grammar.y"
-                      { (yyval.narg) = 1; }
+        {
+            (yyval.narg) = 1;
+        }
 #line 1385 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 34: /* value: NULLTOK  */
+    case 34: /* value: NULLTOK  */
 #line 145 "engines/private/grammar.y"
-                   { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL)); }
+        {
+            code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL));
+        }
 #line 1391 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 35: /* value: FALSETOK  */
+    case 35: /* value: FALSETOK  */
 #line 146 "engines/private/grammar.y"
-                   { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL)); }
+        {
+            code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL));
+        }
 #line 1397 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 36: /* value: TRUETOK  */
+    case 36: /* value: TRUETOK  */
 #line 147 "engines/private/grammar.y"
-                   { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL)); }
+        {
+            code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
+        }
 #line 1403 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 37: /* value: NUM  */
+    case 37: /* value: NUM  */
 #line 148 "engines/private/grammar.y"
-                   { code2(Private::constpush, (Private::Inst)(yyvsp[0].sym)); }
+        {
+            code2(Private::constpush, (Private::Inst)(yyvsp[0].sym));
+        }
 #line 1409 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 38: /* value: STRING  */
+    case 38: /* value: STRING  */
 #line 149 "engines/private/grammar.y"
-                   { code2(Private::strpush, (Private::Inst)(yyvsp[0].sym)); }
+        {
+            code2(Private::strpush, (Private::Inst)(yyvsp[0].sym));
+        }
 #line 1415 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 39: /* value: NAME  */
+    case 39: /* value: NAME  */
 #line 150 "engines/private/grammar.y"
-                   { code1(Private::varpush); code1((Private::Inst) lookupName((yyvsp[0].s))); code1(Private::eval); }
+        {
+            code1(Private::varpush);
+            code1((Private::Inst) lookupName((yyvsp[0].s)));
+            code1(Private::eval);
+        }
 #line 1421 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 40: /* expr: value  */
+    case 40: /* expr: value  */
 #line 153 "engines/private/grammar.y"
-                          { (yyval.inst) = (yyvsp[0].inst); }
+        {
+            (yyval.inst) = (yyvsp[0].inst);
+        }
 #line 1427 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 41: /* expr: '!' value  */
+    case 41: /* expr: '!' value  */
 #line 154 "engines/private/grammar.y"
-                          { code1(Private::negate); (yyval.inst) = (yyvsp[0].inst); }
+        {
+            code1(Private::negate);
+            (yyval.inst) = (yyvsp[0].inst);
+        }
 #line 1433 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 42: /* expr: value EQ value  */
+    case 42: /* expr: value EQ value  */
 #line 155 "engines/private/grammar.y"
-                          { code1(Private::eq); }
+        {
+            code1(Private::eq);
+        }
 #line 1439 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 43: /* expr: value NEQ value  */
+    case 43: /* expr: value NEQ value  */
 #line 156 "engines/private/grammar.y"
-                          { code1(Private::ne); }
+        {
+            code1(Private::ne);
+        }
 #line 1445 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 44: /* expr: value '+' value  */
+    case 44: /* expr: value '+' value  */
 #line 157 "engines/private/grammar.y"
-                          { code1(Private::add); }
+        {
+            code1(Private::add);
+        }
 #line 1451 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 45: /* expr: value '<' value  */
+    case 45: /* expr: value '<' value  */
 #line 158 "engines/private/grammar.y"
-                          { code1(Private::lt); }
+        {
+            code1(Private::lt);
+        }
 #line 1457 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 46: /* expr: value '>' value  */
+    case 46: /* expr: value '>' value  */
 #line 159 "engines/private/grammar.y"
-                          { code1(Private::gt); }
+        {
+            code1(Private::gt);
+        }
 #line 1463 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 47: /* expr: value LTE value  */
+    case 47: /* expr: value LTE value  */
 #line 160 "engines/private/grammar.y"
-                          { code1(Private::le); }
+        {
+            code1(Private::le);
+        }
 #line 1469 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 48: /* expr: value GTE value  */
+    case 48: /* expr: value GTE value  */
 #line 161 "engines/private/grammar.y"
-                          { code1(Private::ge); }
+        {
+            code1(Private::ge);
+        }
 #line 1475 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 49: /* expr: value '+'  */
+    case 49: /* expr: value '+'  */
 #line 162 "engines/private/grammar.y"
-                          { (yyval.inst) = (yyvsp[-1].inst); }
+        {
+            (yyval.inst) = (yyvsp[-1].inst);
+        }
 #line 1481 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 50: /* expr: RANDOMTOK '(' NUM '%' ')'  */
+    case 50: /* expr: RANDOMTOK '(' NUM '%' ')'  */
 #line 163 "engines/private/grammar.y"
-                                    { code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool); }
+        {
+            code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool);
+        }
 #line 1487 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
 
 #line 1491 "engines/private/grammar.tab.cpp"
 
-      default: break;
+    default:
+        break;
     }
-  /* User semantic actions sometimes alter yychar, and that requires
-     that yytoken be updated with the new translation.  We take the
-     approach of translating immediately before every use of yytoken.
-     One alternative is translating here after every semantic action,
-     but that translation would be missed if the semantic action invokes
-     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
-     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
-     incorrect destructor might then be invoked immediately.  In the
-     case of YYERROR or YYBACKUP, subsequent parser actions might lead
-     to an incorrect destructor call or verbose syntax error message
-     before the lookahead is translated.  */
-  YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
-
-  YYPOPSTACK (yylen);
-  yylen = 0;
-
-  *++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.  */
-  {
-    const int yylhs = yyr1[yyn] - YYNTOKENS;
-    const int yyi = yypgoto[yylhs] + *yyssp;
-    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
-               ? yytable[yyi]
-               : yydefgoto[yylhs]);
-  }
-
-  goto yynewstate;
-
-
-/*--------------------------------------.
-| yyerrlab -- here on detecting error.  |
-`--------------------------------------*/
+    /* User semantic actions sometimes alter yychar, and that requires
+       that yytoken be updated with the new translation.  We take the
+       approach of translating immediately before every use of yytoken.
+       One alternative is translating here after every semantic action,
+       but that translation would be missed if the semantic action invokes
+       YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+       if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
+       incorrect destructor might then be invoked immediately.  In the
+       case of YYERROR or YYBACKUP, subsequent parser actions might lead
+       to an incorrect destructor call or verbose syntax error message
+       before the lookahead is translated.  */
+    YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
+
+    YYPOPSTACK (yylen);
+    yylen = 0;
+
+    *++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.  */
+    {
+        const int yylhs = yyr1[yyn] - YYNTOKENS;
+        const int yyi = yypgoto[yylhs] + *yyssp;
+        yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+                   ? yytable[yyi]
+                   : yydefgoto[yylhs]);
+    }
+
+    goto yynewstate;
+
+
+    /*--------------------------------------.
+    | yyerrlab -- here on detecting error.  |
+    `--------------------------------------*/
 yyerrlab:
-  /* Make sure we have latest lookahead translation.  See comments at
-     user semantic actions for why this is necessary.  */
-  yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
-  /* If not already recovering from an error, report this error.  */
-  if (!yyerrstatus)
+    /* Make sure we have latest lookahead translation.  See comments at
+       user semantic actions for why this is necessary.  */
+    yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
+    /* If not already recovering from an error, report this error.  */
+    if (!yyerrstatus)
     {
-      ++yynerrs;
-      yyerror (YY_("syntax error"));
+        ++yynerrs;
+        yyerror (YY_("syntax error"));
     }
 
-  if (yyerrstatus == 3)
+    if (yyerrstatus == 3)
     {
-      /* If just tried and failed to reuse lookahead token after an
-         error, discard it.  */
+        /* If just tried and failed to reuse lookahead token after an
+           error, discard it.  */
 
-      if (yychar <= YYEOF)
+        if (yychar <= YYEOF)
         {
-          /* Return failure if at end of input.  */
-          if (yychar == YYEOF)
-            YYABORT;
+            /* Return failure if at end of input.  */
+            if (yychar == YYEOF)
+                YYABORT;
         }
-      else
+        else
         {
-          yydestruct ("Error: discarding",
-                      yytoken, &yylval);
-          yychar = YYEMPTY;
+            yydestruct ("Error: discarding",
+                        yytoken, &yylval);
+            yychar = YYEMPTY;
         }
     }
 
-  /* Else will try to reuse lookahead token after shifting the error
-     token.  */
-  goto yyerrlab1;
+    /* Else will try to reuse lookahead token after shifting the error
+       token.  */
+    goto yyerrlab1;
 
 
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR.  |
-`---------------------------------------------------*/
+    /*---------------------------------------------------.
+    | yyerrorlab -- error raised explicitly by YYERROR.  |
+    `---------------------------------------------------*/
 yyerrorlab:
-  /* Pacify compilers when the user code never invokes YYERROR and the
-     label yyerrorlab therefore never appears in user code.  */
-  if (0)
-    YYERROR;
-
-  /* Do not reclaim the symbols of the rule whose 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.  |
-`-------------------------------------------------------------*/
+    /* Pacify compilers when the user code never invokes YYERROR and the
+       label yyerrorlab therefore never appears in user code.  */
+    if (0)
+        YYERROR;
+
+    /* Do not reclaim the symbols of the rule whose 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.  */
+    yyerrstatus = 3;      /* Each real token shifted decrements this.  */
 
-  /* Pop stack until we find a state that shifts the error token.  */
-  for (;;)
+    /* Pop stack until we find a state that shifts the error token.  */
+    for (;;)
     {
-      yyn = yypact[yystate];
-      if (!yypact_value_is_default (yyn))
+        yyn = yypact[yystate];
+        if (!yypact_value_is_default (yyn))
         {
-          yyn += YYSYMBOL_YYerror;
-          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
+            yyn += YYSYMBOL_YYerror;
+            if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
             {
-              yyn = yytable[yyn];
-              if (0 < yyn)
-                break;
+                yyn = yytable[yyn];
+                if (0 < yyn)
+                    break;
             }
         }
 
-      /* Pop the current state because it cannot handle the error token.  */
-      if (yyssp == yyss)
-        YYABORT;
+        /* Pop the current state because it cannot handle the error token.  */
+        if (yyssp == yyss)
+            YYABORT;
 
 
-      yydestruct ("Error: popping",
-                  YY_ACCESSING_SYMBOL (yystate), yyvsp);
-      YYPOPSTACK (1);
-      yystate = *yyssp;
-      YY_STACK_PRINT (yyss, yyssp);
+        yydestruct ("Error: popping",
+                    YY_ACCESSING_SYMBOL (yystate), yyvsp);
+        YYPOPSTACK (1);
+        yystate = *yyssp;
+        YY_STACK_PRINT (yyss, yyssp);
     }
 
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  *++yyvsp = yylval;
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
+    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+    *++yyvsp = yylval;
+    YY_IGNORE_MAYBE_UNINITIALIZED_END
 
 
-  /* Shift the error token.  */
-  YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
+    /* Shift the error token.  */
+    YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
 
-  yystate = yyn;
-  goto yynewstate;
+    yystate = yyn;
+    goto yynewstate;
 
 
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here.  |
-`-------------------------------------*/
+    /*-------------------------------------.
+    | yyacceptlab -- YYACCEPT comes here.  |
+    `-------------------------------------*/
 yyacceptlab:
-  yyresult = 0;
-  goto yyreturn;
+    yyresult = 0;
+    goto yyreturn;
 
 
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here.  |
-`-----------------------------------*/
+    /*-----------------------------------.
+    | yyabortlab -- YYABORT comes here.  |
+    `-----------------------------------*/
 yyabortlab:
-  yyresult = 1;
-  goto yyreturn;
+    yyresult = 1;
+    goto yyreturn;
 
 
 #if !defined yyoverflow
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here.  |
-`-------------------------------------------------*/
+    /*-------------------------------------------------.
+    | yyexhaustedlab -- memory exhaustion comes here.  |
+    `-------------------------------------------------*/
 yyexhaustedlab:
-  yyerror (YY_("memory exhausted"));
-  yyresult = 2;
-  goto yyreturn;
+    yyerror (YY_("memory exhausted"));
+    yyresult = 2;
+    goto yyreturn;
 #endif
 
 
-/*-------------------------------------------------------.
-| yyreturn -- parsing is finished, clean up and return.  |
-`-------------------------------------------------------*/
+    /*-------------------------------------------------------.
+    | yyreturn -- parsing is finished, clean up and return.  |
+    `-------------------------------------------------------*/
 yyreturn:
-  if (yychar != YYEMPTY)
+    if (yychar != YYEMPTY)
     {
-      /* Make sure we have latest lookahead translation.  See comments at
-         user semantic actions for why this is necessary.  */
-      yytoken = YYTRANSLATE (yychar);
-      yydestruct ("Cleanup: discarding lookahead",
-                  yytoken, &yylval);
+        /* Make sure we have latest lookahead translation.  See comments at
+           user semantic actions for why this is necessary.  */
+        yytoken = YYTRANSLATE (yychar);
+        yydestruct ("Cleanup: discarding lookahead",
+                    yytoken, &yylval);
     }
-  /* Do not reclaim the symbols of the rule whose action triggered
-     this YYABORT or YYACCEPT.  */
-  YYPOPSTACK (yylen);
-  YY_STACK_PRINT (yyss, yyssp);
-  while (yyssp != yyss)
+    /* Do not reclaim the symbols of the rule whose action triggered
+       this YYABORT or YYACCEPT.  */
+    YYPOPSTACK (yylen);
+    YY_STACK_PRINT (yyss, yyssp);
+    while (yyssp != yyss)
     {
-      yydestruct ("Cleanup: popping",
-                  YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
-      YYPOPSTACK (1);
+        yydestruct ("Cleanup: popping",
+                    YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
+        YYPOPSTACK (1);
     }
 #ifndef yyoverflow
-  if (yyss != yyssa)
-    YYSTACK_FREE (yyss);
+    if (yyss != yyssa)
+        YYSTACK_FREE (yyss);
 #endif
 
-  return yyresult;
+    return yyresult;
 }
 
diff --git a/engines/private/lex.yy.cpp b/engines/private/lex.yy.cpp
index 17177a89e2..98e2191c01 100644
--- a/engines/private/lex.yy.cpp
+++ b/engines/private/lex.yy.cpp
@@ -34,7 +34,7 @@
 #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. 
+ * if you want the limit (max/min) macros for int types.
  */
 #ifndef __STDC_LIMIT_MACROS
 #define __STDC_LIMIT_MACROS 1
@@ -51,7 +51,7 @@ typedef uint32_t flex_uint32_t;
 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 char flex_uint8_t;
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
 
@@ -162,10 +162,10 @@ 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)
-    #define YY_LINENO_REWIND_TO(ptr)
-    
+
+#define YY_LESS_LINENO(n)
+#define YY_LINENO_REWIND_TO(ptr)
+
 /* Return all but the first "n" matched characters back to the input stream. */
 #define yyless(n) \
 	do \
@@ -184,66 +184,66 @@ extern FILE *yyin, *yyout;
 #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.
-	 */
-	int yy_buf_size;
-
-	/* Number of characters read into yy_ch_buf, not including EOB
-	 * characters.
-	 */
-	int 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;
+{
+    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.
+     */
+    int yy_buf_size;
+
+    /* Number of characters read into yy_ch_buf, not including EOB
+     * characters.
+     */
+    int 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;
+    /* Whether to try to fill the input buffer when we reach the
+     * end of it.
+     */
+    int yy_fill_buffer;
 
-	int yy_buffer_status;
+    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.
-	 */
+    /* 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. */
@@ -360,125 +360,125 @@ static void yynoreturn yy_fatal_error ( const char* msg  );
 /* 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;
-	};
+{
+    flex_int32_t yy_verify;
+    flex_int32_t yy_nxt;
+};
 static const flex_int16_t yy_accept[78] =
-    {   0,
-        0,    0,   24,   22,   21,   20,   20,   22,   22,   22,
-       22,   18,   22,   22,   22,   17,   17,   17,   17,   17,
-       17,   17,   17,   17,   17,   21,   20,    4,    0,   19,
-       18,    1,    2,    5,    3,   17,   17,   17,   17,   17,
-       17,   17,   17,   17,    9,   17,    1,   17,   17,   17,
-       17,   17,   17,   17,   17,   17,   17,   17,   15,   12,
-       17,   14,   17,   17,   10,   11,   17,   13,   17,    6,
-       17,   17,   16,    7,   17,    8,    0
-    } ;
+{   0,
+    0,    0,   24,   22,   21,   20,   20,   22,   22,   22,
+    22,   18,   22,   22,   22,   17,   17,   17,   17,   17,
+    17,   17,   17,   17,   17,   21,   20,    4,    0,   19,
+    18,    1,    2,    5,    3,   17,   17,   17,   17,   17,
+    17,   17,   17,   17,    9,   17,    1,   17,   17,   17,
+    17,   17,   17,   17,   17,   17,   17,   17,   15,   12,
+    17,   14,   17,   17,   10,   11,   17,   13,   17,    6,
+    17,   17,   16,    7,   17,    8,    0
+} ;
 
 static const YY_CHAR yy_ec[256] =
-    {   0,
-        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,    2,    5,    6,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    7,    1,    8,    9,    9,    9,
-        9,    9,    9,    9,    9,    9,    9,    1,    1,   10,
-       11,   12,    1,    1,   13,   14,   15,   14,   16,   17,
-       14,   14,   14,   14,   14,   18,   14,   19,   14,   14,
-       14,   20,   21,   22,   23,   14,   14,   14,   14,   14,
-        1,    1,    1,    1,   14,    1,   24,   25,   14,   26,
-
-       27,   28,   29,   14,   30,   14,   14,   31,   32,   33,
-       34,   14,   14,   14,   35,   36,   37,   14,   14,   14,
-       14,   14,    1,   38,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1
-    } ;
+{   0,
+    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,    2,    5,    6,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    7,    1,    8,    9,    9,    9,
+    9,    9,    9,    9,    9,    9,    9,    1,    1,   10,
+    11,   12,    1,    1,   13,   14,   15,   14,   16,   17,
+    14,   14,   14,   14,   14,   18,   14,   19,   14,   14,
+    14,   20,   21,   22,   23,   14,   14,   14,   14,   14,
+    1,    1,    1,    1,   14,    1,   24,   25,   14,   26,
+
+    27,   28,   29,   14,   30,   14,   14,   31,   32,   33,
+    34,   14,   14,   14,   35,   36,   37,   14,   14,   14,
+    14,   14,    1,   38,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    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 const YY_CHAR yy_meta[39] =
-    {   0,
-        1,    1,    2,    3,    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,    1
-    } ;
+{   0,
+    1,    1,    2,    3,    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,    1
+} ;
 
 static const flex_int16_t yy_base[81] =
-    {   0,
-        0,    0,  105,  106,  102,   36,   38,   92,   96,   92,
-       92,   90,   87,   86,   85,    0,   82,   71,   27,   73,
-       65,   60,   56,   61,   61,   83,   41,  106,   76,  106,
-       72,    0,  106,  106,  106,    0,   60,   59,   60,   40,
-       49,   21,   36,   34,    0,   33,    0,   47,   49,   44,
-       39,   48,   26,   32,   34,   26,   23,   42,    0,    0,
-       23,    0,   27,   22,    0,    0,   24,    0,   21,    0,
-       25,   17,    0,    0,   19,    0,  106,   79,   43,   83
-    } ;
+{   0,
+    0,    0,  105,  106,  102,   36,   38,   92,   96,   92,
+    92,   90,   87,   86,   85,    0,   82,   71,   27,   73,
+    65,   60,   56,   61,   61,   83,   41,  106,   76,  106,
+    72,    0,  106,  106,  106,    0,   60,   59,   60,   40,
+    49,   21,   36,   34,    0,   33,    0,   47,   49,   44,
+    39,   48,   26,   32,   34,   26,   23,   42,    0,    0,
+    23,    0,   27,   22,    0,    0,   24,    0,   21,    0,
+    25,   17,    0,    0,   19,    0,  106,   79,   43,   83
+} ;
 
 static const flex_int16_t yy_def[81] =
-    {   0,
-       77,    1,   77,   77,   77,   77,   77,   77,   78,   77,
-       77,   77,   77,   77,   77,   79,   79,   79,   79,   79,
-       79,   79,   79,   79,   79,   77,   77,   77,   78,   77,
-       77,   80,   77,   77,   77,   79,   79,   79,   79,   79,
-       79,   79,   79,   79,   79,   79,   80,   79,   79,   79,
-       79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
-       79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
-       79,   79,   79,   79,   79,   79,    0,   77,   77,   77
-    } ;
+{   0,
+    77,    1,   77,   77,   77,   77,   77,   77,   78,   77,
+    77,   77,   77,   77,   77,   79,   79,   79,   79,   79,
+    79,   79,   79,   79,   79,   77,   77,   77,   78,   77,
+    77,   80,   77,   77,   77,   79,   79,   79,   79,   79,
+    79,   79,   79,   79,   79,   79,   80,   79,   79,   79,
+    79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
+    79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
+    79,   79,   79,   79,   79,   79,    0,   77,   77,   77
+} ;
 
 static const flex_int16_t yy_nxt[145] =
-    {   0,
-        4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
-       14,   15,   16,   16,   16,   16,   17,   16,   18,   19,
-       16,   20,   16,   16,   16,   21,   22,   16,   23,   24,
-       16,   16,   16,   16,   25,   16,   16,    7,   27,   27,
-       27,   27,   39,   27,   27,   53,   36,   76,   54,   75,
-       40,   74,   73,   72,   71,   70,   69,   68,   67,   66,
-       65,   64,   63,   62,   61,   60,   59,   58,   57,   56,
-       55,   52,   51,   27,   50,   27,   49,   48,   27,   29,
-       31,   30,   29,   47,   26,   47,   47,   46,   45,   44,
-       43,   42,   41,   38,   37,   35,   34,   33,   31,   32,
-
-       31,   30,   28,   26,   77,    3,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77
-    } ;
+{   0,
+    4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
+    14,   15,   16,   16,   16,   16,   17,   16,   18,   19,
+    16,   20,   16,   16,   16,   21,   22,   16,   23,   24,
+    16,   16,   16,   16,   25,   16,   16,    7,   27,   27,
+    27,   27,   39,   27,   27,   53,   36,   76,   54,   75,
+    40,   74,   73,   72,   71,   70,   69,   68,   67,   66,
+    65,   64,   63,   62,   61,   60,   59,   58,   57,   56,
+    55,   52,   51,   27,   50,   27,   49,   48,   27,   29,
+    31,   30,   29,   47,   26,   47,   47,   46,   45,   44,
+    43,   42,   41,   38,   37,   35,   34,   33,   31,   32,
+
+    31,   30,   28,   26,   77,    3,   77,   77,   77,   77,
+    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+    77,   77,   77,   77
+} ;
 
 static const flex_int16_t yy_chk[145] =
-    {   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,    6,    6,
-        7,    7,   19,   27,   27,   42,   79,   75,   42,   72,
-       19,   71,   69,   67,   64,   63,   61,   58,   57,   56,
-       55,   54,   53,   52,   51,   50,   49,   48,   46,   44,
-       43,   41,   40,    6,   39,    7,   38,   37,   27,   78,
-       31,   29,   78,   80,   26,   80,   80,   25,   24,   23,
-       22,   21,   20,   18,   17,   15,   14,   13,   12,   11,
-
-       10,    9,    8,    5,    3,   77,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77
-    } ;
+{   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,    6,    6,
+    7,    7,   19,   27,   27,   42,   79,   75,   42,   72,
+    19,   71,   69,   67,   64,   63,   61,   58,   57,   56,
+    55,   54,   53,   52,   51,   50,   49,   48,   46,   44,
+    43,   41,   40,    6,   39,    7,   38,   37,   27,   78,
+    31,   29,   78,   80,   26,   80,   80,   25,   24,   23,
+    22,   21,   20,   18,   17,   15,   14,   13,   12,   11,
+
+    10,    9,    8,    5,    3,   77,   77,   77,   77,   77,
+    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+    77,   77,   77,   77
+} ;
 
 static yy_state_type yy_last_accepting_state;
 static char *yy_last_accepting_cpos;
@@ -544,7 +544,7 @@ FILE *yyget_out ( void );
 
 void yyset_out  ( FILE * _out_str  );
 
-			int yyget_leng ( void );
+int yyget_leng ( void );
 
 char *yyget_text ( void );
 
@@ -565,9 +565,9 @@ extern int yywrap ( void );
 #endif
 
 #ifndef YY_NO_UNPUT
-    
-    static void yyunput ( int c, char *buf_ptr  );
-    
+
+static void yyunput ( int c, char *buf_ptr  );
+
 #endif
 
 #ifndef yytext_ptr
@@ -691,341 +691,344 @@ extern int yylex (void);
  */
 YY_DECL
 {
-	yy_state_type yy_current_state;
-	char *yy_cp, *yy_bp;
-	int yy_act;
-    
-	if ( !(yy_init) )
-		{
-		(yy_init) = 1;
+    yy_state_type yy_current_state;
+    char *yy_cp, *yy_bp;
+    int yy_act;
+
+    if ( !(yy_init) )
+    {
+        (yy_init) = 1;
 
 #ifdef YY_USER_INIT
-		YY_USER_INIT;
+        YY_USER_INIT;
 #endif
 
-		if ( ! (yy_start) )
-			(yy_start) = 1;	/* first start state */
+        if ( ! (yy_start) )
+            (yy_start) = 1;	/* first start state */
 
-		if ( ! yyin )
-			yyin = stdin;
+        if ( ! yyin )
+            yyin = stdin;
 
-		if ( ! yyout )
-			yyout = stdout;
+        if ( ! yyout )
+            yyout = stdout;
 
-		if ( ! YY_CURRENT_BUFFER ) {
-			yyensure_buffer_stack ();
-			YY_CURRENT_BUFFER_LVALUE =
-				yy_create_buffer( yyin, YY_BUF_SIZE );
-		}
+        if ( ! YY_CURRENT_BUFFER ) {
+            yyensure_buffer_stack ();
+            YY_CURRENT_BUFFER_LVALUE =
+            yy_create_buffer( yyin, YY_BUF_SIZE );
+        }
 
-		yy_load_buffer_state(  );
-		}
+        yy_load_buffer_state(  );
+    }
 
-	{
+    {
 #line 17 "engines/private/grammar.l"
 
 #line 727 "engines/private/lex.yy.cpp"
 
-	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
-		{
-		yy_cp = (yy_c_buf_p);
+        while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
+        {
+            yy_cp = (yy_c_buf_p);
 
-		/* Support of yytext. */
-		*yy_cp = (yy_hold_char);
+            /* 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_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_current_state = (yy_start);
 yy_match:
-		do
-			{
-			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 >= 78 )
-					yy_c = yy_meta[yy_c];
-				}
-			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-			++yy_cp;
-			}
-		while ( yy_current_state != 77 );
-		yy_cp = (yy_last_accepting_cpos);
-		yy_current_state = (yy_last_accepting_state);
+            do
+            {
+                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 >= 78 )
+                        yy_c = yy_meta[yy_c];
+                }
+                yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+                ++yy_cp;
+            }
+            while ( yy_current_state != 77 );
+            yy_cp = (yy_last_accepting_cpos);
+            yy_current_state = (yy_last_accepting_state);
 
 yy_find_action:
-		yy_act = yy_accept[yy_current_state];
+            yy_act = yy_accept[yy_current_state];
 
-		YY_DO_BEFORE_ACTION;
+            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
+            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 18 "engines/private/grammar.l"
-/* ignoring the comment */
-	YY_BREAK
-case 2:
-YY_RULE_SETUP
+                /* ignoring the comment */
+                YY_BREAK
+            case 2:
+                YY_RULE_SETUP
 #line 19 "engines/private/grammar.l"
-return LTE;
-	YY_BREAK
-case 3:
-YY_RULE_SETUP
+                return LTE;
+                YY_BREAK
+            case 3:
+                YY_RULE_SETUP
 #line 20 "engines/private/grammar.l"
-return GTE;
-	YY_BREAK
-case 4:
-YY_RULE_SETUP
+                return GTE;
+                YY_BREAK
+            case 4:
+                YY_RULE_SETUP
 #line 21 "engines/private/grammar.l"
-return NEQ;
-	YY_BREAK
-case 5:
-YY_RULE_SETUP
+                return NEQ;
+                YY_BREAK
+            case 5:
+                YY_RULE_SETUP
 #line 22 "engines/private/grammar.l"
-return EQ;
-	YY_BREAK
-case 6:
-YY_RULE_SETUP
+                return EQ;
+                YY_BREAK
+            case 6:
+                YY_RULE_SETUP
 #line 23 "engines/private/grammar.l"
-return DEBUGTOK;
-	YY_BREAK
-case 7:
-YY_RULE_SETUP
+                return DEBUGTOK;
+                YY_BREAK
+            case 7:
+                YY_RULE_SETUP
 #line 24 "engines/private/grammar.l"
-return DEFINETOK;
-	YY_BREAK
-case 8:
-YY_RULE_SETUP
+                return DEFINETOK;
+                YY_BREAK
+            case 8:
+                YY_RULE_SETUP
 #line 25 "engines/private/grammar.l"
-return SETTINGTOK;
-	YY_BREAK
-case 9:
-YY_RULE_SETUP
+                return SETTINGTOK;
+                YY_BREAK
+            case 9:
+                YY_RULE_SETUP
 #line 26 "engines/private/grammar.l"
-return IFTOK;
-	YY_BREAK
-case 10:
-YY_RULE_SETUP
+                return IFTOK;
+                YY_BREAK
+            case 10:
+                YY_RULE_SETUP
 #line 27 "engines/private/grammar.l"
-return ELSETOK;
-	YY_BREAK
-case 11:
-YY_RULE_SETUP
+                return ELSETOK;
+                YY_BREAK
+            case 11:
+                YY_RULE_SETUP
 #line 28 "engines/private/grammar.l"
-return GOTOTOK;
-	YY_BREAK
-case 12:
-YY_RULE_SETUP
+                return GOTOTOK;
+                YY_BREAK
+            case 12:
+                YY_RULE_SETUP
 #line 29 "engines/private/grammar.l"
-return RECT;
-	YY_BREAK
-case 13:
-YY_RULE_SETUP
+                return RECT;
+                YY_BREAK
+            case 13:
+                YY_RULE_SETUP
 #line 30 "engines/private/grammar.l"
-return FALSETOK;
-	YY_BREAK
-case 14:
-YY_RULE_SETUP
+                return FALSETOK;
+                YY_BREAK
+            case 14:
+                YY_RULE_SETUP
 #line 31 "engines/private/grammar.l"
-return TRUETOK;
-	YY_BREAK
-case 15:
-YY_RULE_SETUP
+                return TRUETOK;
+                YY_BREAK
+            case 15:
+                YY_RULE_SETUP
 #line 32 "engines/private/grammar.l"
-return NULLTOK;
-	YY_BREAK
-case 16:
-YY_RULE_SETUP
+                return NULLTOK;
+                YY_BREAK
+            case 16:
+                YY_RULE_SETUP
 #line 33 "engines/private/grammar.l"
-return RANDOMTOK;
-	YY_BREAK
-case 17:
-YY_RULE_SETUP
+                return RANDOMTOK;
+                YY_BREAK
+            case 17:
+                YY_RULE_SETUP
 #line 34 "engines/private/grammar.l"
-yylval.s = strdup(yytext); return NAME;
-	YY_BREAK
-case 18:
-YY_RULE_SETUP
+                yylval.s = strdup(yytext);
+                return NAME;
+                YY_BREAK
+            case 18:
+                YY_RULE_SETUP
 #line 35 "engines/private/grammar.l"
-yylval.sym = Private::addconstant(NUM, atoi(yytext), NULL); return NUM;
-	YY_BREAK
-case 19:
-YY_RULE_SETUP
+                yylval.sym = Private::addconstant(NUM, atoi(yytext), NULL);
+                return NUM;
+                YY_BREAK
+            case 19:
+                YY_RULE_SETUP
 #line 36 "engines/private/grammar.l"
-yylval.sym = Private::addconstant(STRING, 0, strdup(yytext)); return STRING;
-	YY_BREAK
-case 20:
-/* rule 20 can match eol */
-YY_RULE_SETUP
+                yylval.sym = Private::addconstant(STRING, 0, strdup(yytext));
+                return STRING;
+                YY_BREAK
+            case 20:
+                /* rule 20 can match eol */
+                YY_RULE_SETUP
 #line 37 "engines/private/grammar.l"
-/* ignore return */;
-	YY_BREAK
-case 21:
-YY_RULE_SETUP
+                /* ignore return */;
+                YY_BREAK
+            case 21:
+                YY_RULE_SETUP
 #line 38 "engines/private/grammar.l"
-/* ignore whitespace */;
-	YY_BREAK
-case 22:
-YY_RULE_SETUP
+                /* ignore whitespace */;
+                YY_BREAK
+            case 22:
+                YY_RULE_SETUP
 #line 39 "engines/private/grammar.l"
-return *yytext;
-	YY_BREAK
-case 23:
-YY_RULE_SETUP
+                return *yytext;
+                YY_BREAK
+            case 23:
+                YY_RULE_SETUP
 #line 40 "engines/private/grammar.l"
-ECHO;
-	YY_BREAK
+                ECHO;
+                YY_BREAK
 #line 896 "engines/private/lex.yy.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_last_accepting_cpos);
-				yy_current_state = (yy_last_accepting_state);
-				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 user's declarations */
+            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_last_accepting_cpos);
+                        yy_current_state = (yy_last_accepting_state);
+                        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 user's declarations */
 } /* end of yylex */
 
 /* yy_get_next_buffer - try to read in a new buffer
@@ -1037,167 +1040,167 @@ case YY_STATE_EOF(INITIAL):
  */
 static int yy_get_next_buffer (void)
 {
-    	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
-	char *source = (yytext_ptr);
-	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
-		{
-			int 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_LVALUE;
-
-			int yy_c_buf_p_offset =
-				(int) ((yy_c_buf_p) - b->yy_ch_buf);
-
-			if ( b->yy_is_our_buffer )
-				{
-				int 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,
-							 (yy_size_t) (b->yy_buf_size + 2)  );
-				}
-			else
-				/* Can't grow it, we don't own it. */
-				b->yy_ch_buf = NULL;
-
-			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_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
-		/* Extend the array by 50%, plus the number we really need. */
-		int 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, (yy_size_t) new_size  );
-		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
-		/* "- 2" to take care of EOB's */
-		YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
-	}
+    char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+    char *source = (yytext_ptr);
+    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
+    {
+        int 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. */
 
-	(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;
+            /* just a shorter name for the current buffer */
+            YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
 
-	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+            int yy_c_buf_p_offset =
+                (int) ((yy_c_buf_p) - b->yy_ch_buf);
 
-	return ret_val;
+            if ( b->yy_is_our_buffer )
+            {
+                int 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,
+                                          (yy_size_t) (b->yy_buf_size + 2)  );
+            }
+            else
+                /* Can't grow it, we don't own it. */
+                b->yy_ch_buf = NULL;
+
+            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_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+        /* Extend the array by 50%, plus the number we really need. */
+        int 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, (yy_size_t) new_size  );
+        if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+            YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+        /* "- 2" to take care of EOB's */
+        YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
+    }
+
+    (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)
+static yy_state_type yy_get_previous_state (void)
 {
-	yy_state_type yy_current_state;
-	char *yy_cp;
-    
-	yy_current_state = (yy_start);
-
-	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
-		{
-		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 >= 78 )
-				yy_c = yy_meta[yy_c];
-			}
-		yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-		}
-
-	return yy_current_state;
+    yy_state_type yy_current_state;
+    char *yy_cp;
+
+    yy_current_state = (yy_start);
+
+    for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+    {
+        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 >= 78 )
+                yy_c = yy_meta[yy_c];
+        }
+        yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+    }
+
+    return yy_current_state;
 }
 
 /* yy_try_NUL_trans - try to make a transition on the NUL character
@@ -1205,359 +1208,359 @@ static int yy_get_next_buffer (void)
  * synopsis
  *	next_state = yy_try_NUL_trans( current_state );
  */
-    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
+static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
 {
-	int yy_is_jam;
-    	char *yy_cp = (yy_c_buf_p);
-
-	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 >= 78 )
-			yy_c = yy_meta[yy_c];
-		}
-	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-	yy_is_jam = (yy_current_state == 77);
-
-		return yy_is_jam ? 0 : yy_current_state;
+    int yy_is_jam;
+    char *yy_cp = (yy_c_buf_p);
+
+    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 >= 78 )
+            yy_c = yy_meta[yy_c];
+    }
+    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+    yy_is_jam = (yy_current_state == 77);
+
+    return yy_is_jam ? 0 : yy_current_state;
 }
 
 #ifndef YY_NO_UNPUT
 
-    static void yyunput (int c, char * yy_bp )
+static void yyunput (int c, char * yy_bp )
 {
-	char *yy_cp;
-    
+    char *yy_cp;
+
     yy_cp = (yy_c_buf_p);
 
-	/* undo effects of setting up yytext */
-	*yy_cp = (yy_hold_char);
+    /* 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. */
-		int number_to_move = (yy_n_chars) + 2;
-		char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
-					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
-		char *source =
-				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+    if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+    {   /* need to shift things up to make room */
+        /* +2 for EOB chars. */
+        int number_to_move = (yy_n_chars) + 2;
+        char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+                  YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+        char *source =
+            &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
 
-		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-			*--dest = *--source;
+        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) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+        yy_cp += (int) (dest - source);
+        yy_bp += (int) (dest - source);
+        YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+            (yy_n_chars) = (int) 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" );
-		}
+        if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+            YY_FATAL_ERROR( "flex scanner push-back overflow" );
+    }
 
-	*--yy_cp = (char) c;
+    *--yy_cp = (char) c;
 
-	(yytext_ptr) = yy_bp;
-	(yy_hold_char) = *yy_cp;
-	(yy_c_buf_p) = yy_cp;
+    (yytext_ptr) = yy_bp;
+    (yy_hold_char) = *yy_cp;
+    (yy_c_buf_p) = yy_cp;
 }
 
 #endif
 
 #ifndef YY_NO_INPUT
 #ifdef __cplusplus
-    static int yyinput (void)
+static int yyinput (void)
 #else
-    static int input  (void)
+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 */
-			int offset = (int) ((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;
+    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 */
+            int offset = (int) ((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();
+                return yyinput();
 #else
-					return input();
+                return input();
 #endif
-					}
+            }
 
-				case EOB_ACT_CONTINUE_SCAN:
-					(yy_c_buf_p) = (yytext_ptr) + offset;
-					break;
-				}
-			}
-		}
+            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);
+    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;
+    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 )
+void yyrestart  (FILE * input_file )
 {
-    
-	if ( ! YY_CURRENT_BUFFER ){
+
+    if ( ! YY_CURRENT_BUFFER ) {
         yyensure_buffer_stack ();
-		YY_CURRENT_BUFFER_LVALUE =
+        YY_CURRENT_BUFFER_LVALUE =
             yy_create_buffer( yyin, YY_BUF_SIZE );
-	}
+    }
 
-	yy_init_buffer( YY_CURRENT_BUFFER, input_file );
-	yy_load_buffer_state(  );
+    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 )
+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);
+
+    /* 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;
+    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);
+    (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 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()" );
+    YY_BUFFER_STATE b;
 
-	b->yy_buf_size = size;
+    b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state )  );
+    if ( ! b )
+        YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
 
-	/* 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( (yy_size_t) (b->yy_buf_size + 2)  );
-	if ( ! b->yy_ch_buf )
-		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( (yy_size_t) (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;
+    b->yy_is_our_buffer = 1;
 
-	yy_init_buffer( b, file );
+    yy_init_buffer( b, file );
 
-	return b;
+    return b;
 }
 
 /** Destroy the buffer.
  * @param b a buffer created with yy_create_buffer()
- * 
+ *
  */
-    void yy_delete_buffer (YY_BUFFER_STATE  b )
+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 )
+        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  );
+    if ( b->yy_is_our_buffer )
+        yyfree( (void *) b->yy_ch_buf  );
 
-	yyfree( (void *) b  );
+    yyfree( (void *) b  );
 }
 
 /* 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 )
+static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
 
 {
-	int oerrno = errno;
-    
-	yy_flush_buffer( b );
+    int oerrno = errno;
+
+    yy_flush_buffer( b );
 
-	b->yy_input_file = file;
-	b->yy_fill_buffer = 1;
+    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){
+    if (b != YY_CURRENT_BUFFER) {
         b->yy_bs_lineno = 1;
         b->yy_bs_column = 0;
     }
 
-        b->yy_is_interactive = 0;
-    
-	errno = oerrno;
+    b->yy_is_interactive = 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 )
+void yy_flush_buffer (YY_BUFFER_STATE  b )
 {
-    	if ( ! b )
-		return;
+    if ( ! b )
+        return;
 
-	b->yy_n_chars = 0;
+    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;
+    /* 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_buf_pos = &b->yy_ch_buf[0];
 
-	b->yy_at_bol = 1;
-	b->yy_buffer_status = YY_BUFFER_NEW;
+    b->yy_at_bol = 1;
+    b->yy_buffer_status = YY_BUFFER_NEW;
 
-	if ( b == YY_CURRENT_BUFFER )
-		yy_load_buffer_state(  );
+    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;
+    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;
+    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);
+    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;
-	}
+    if (YY_CURRENT_BUFFER) {
+        yy_load_buffer_state(  );
+        (yy_did_buffer_switch_on_eof) = 1;
+    }
 }
 
 /* Allocates the stack if it does not exist.
@@ -1565,131 +1568,131 @@ void yypop_buffer_state (void)
  */
 static void yyensure_buffer_stack (void)
 {
-	yy_size_t num_to_alloc;
-    
-	if (!(yy_buffer_stack)) {
+    yy_size_t num_to_alloc;
 
-		/* 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.
+    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; /* After all that talk, this was set to 1 anyways... */
-		(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;
-	}
+        num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
+        (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){
+    if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1) {
 
-		/* Increase the buffer to prepare for a possible push. */
-		yy_size_t grow_size = 8 /* arbitrary grow size */;
+        /* Increase the buffer to prepare for a possible push. */
+        yy_size_t 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()" );
+        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;
-	}
+        /* 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 NULL;
-
-	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 = (int) (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 = NULL;
-	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;
+    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 NULL;
+
+    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 = (int) (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 = NULL;
+    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 (const char * yystr )
 {
-    
-	return yy_scan_bytes( yystr, (int) strlen(yystr) );
+
+    return yy_scan_bytes( yystr, (int) 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 yybytes the byte buffer to scan
  * @param _yybytes_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  (const char * yybytes, int  _yybytes_len )
 {
-	YY_BUFFER_STATE b;
-	char *buf;
-	yy_size_t n;
-	int i;
-    
-	/* Get memory for full buffer, including space for trailing EOB's. */
-	n = (yy_size_t) (_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;
+    YY_BUFFER_STATE b;
+    char *buf;
+    yy_size_t n;
+    int i;
+
+    /* Get memory for full buffer, including space for trailing EOB's. */
+    n = (yy_size_t) (_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
@@ -1698,8 +1701,8 @@ YY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len )
 
 static void yynoreturn yy_fatal_error (const char* msg )
 {
-			fprintf( stderr, "%s\n", msg );
-	exit( YY_EXIT_FAILURE );
+    fprintf( stderr, "%s\n", msg );
+    exit( YY_EXIT_FAILURE );
 }
 
 /* Redefine yyless() so it works in section 3 code. */
@@ -1722,88 +1725,88 @@ static void yynoreturn yy_fatal_error (const char* msg )
 /* 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;
+    return yyin;
 }
 
 /** Get the output stream.
- * 
+ *
  */
 FILE *yyget_out  (void)
 {
-        return yyout;
+    return yyout;
 }
 
 /** Get the length of the current token.
- * 
+ *
  */
 int yyget_leng  (void)
 {
-        return yyleng;
+    return yyleng;
 }
 
 /** Get the current token.
- * 
+ *
  */
 
 char *yyget_text  (void)
 {
-        return yytext;
+    return yytext;
 }
 
 /** Set the current line number.
  * @param _line_number 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 ;
+    yyin = _in_str ;
 }
 
 void yyset_out (FILE *  _out_str )
 {
-        yyout = _out_str ;
+    yyout = _out_str ;
 }
 
 int yyget_debug  (void)
 {
-        return yy_flex_debug;
+    return yy_flex_debug;
 }
 
 void yyset_debug (int  _bdebug )
 {
-        yy_flex_debug = _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.
-     */
+    /* 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) = NULL;
     (yy_buffer_stack_top) = 0;
@@ -1812,7 +1815,7 @@ static int yy_init_globals (void)
     (yy_init) = 0;
     (yy_start) = 0;
 
-/* Defined in main.c */
+    /* Defined in main.c */
 #ifdef YY_STDINIT
     yyin = stdin;
     yyout = stdout;
@@ -1830,17 +1833,17 @@ static int yy_init_globals (void)
 /* 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();
-	}
+    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;
+    /* 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. */
@@ -1856,45 +1859,45 @@ int yylex_destroy  (void)
 #ifndef yytext_ptr
 static void yy_flex_strncpy (char* s1, const char * s2, int n )
 {
-		
-	int i;
-	for ( i = 0; i < n; ++i )
-		s1[i] = s2[i];
+
+    int i;
+    for ( i = 0; i < n; ++i )
+        s1[i] = s2[i];
 }
 #endif
 
 #ifdef YY_NEED_STRLEN
 static int yy_flex_strlen (const char * s )
 {
-	int n;
-	for ( n = 0; s[n]; ++n )
-		;
+    int n;
+    for ( n = 0; s[n]; ++n )
+        ;
 
-	return n;
+    return n;
 }
 #endif
 
 void *yyalloc (yy_size_t  size )
 {
-			return malloc(size);
+    return 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 realloc(ptr, 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 realloc(ptr, size);
 }
 
 void yyfree (void * ptr )
 {
-			free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
+    free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
 }
 
 #define YYTABLES_NAME "yytables"
@@ -1907,26 +1910,26 @@ extern int yydebug;
 namespace Private {
 
 int parse(char *code) {
-	
-	initSetting();
-	//_lines[0] = _lines[1] = _lines[2] = code;
 
-	YY_BUFFER_STATE bp;
+    initSetting();
+    //_lines[0] = _lines[1] = _lines[2] = code;
+
+    YY_BUFFER_STATE bp;
 
-	//if (debugChannelSet(-1, kDebugParse))
-	yydebug = 1;
-	//else
-	//	yydebug = 0;
+    //if (debugChannelSet(-1, kDebugParse))
+    yydebug = 1;
+    //else
+    //	yydebug = 0;
 
-	yy_delete_buffer(YY_CURRENT_BUFFER);
+    yy_delete_buffer(YY_CURRENT_BUFFER);
 
-	bp = yy_scan_string(code);
-	yy_switch_to_buffer(bp);
-	yyparse();
-        //execute(prog);
-	yy_delete_buffer(bp);
+    bp = yy_scan_string(code);
+    yy_switch_to_buffer(bp);
+    yyparse();
+    //execute(prog);
+    yy_delete_buffer(bp);
 
-	return 0;
+    return 0;
 }
 
 } // End of namespace Private
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 4d041efc31..3357f3ba22 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -72,14 +72,14 @@ PrivateEngine::~PrivateEngine() {
 }
 
 Common::Error PrivateEngine::run() {
-    
-    assert(_installerArchive.open("SUPPORT/ASSETS.Z"));    
-    Common::SeekableReadStream *file = NULL; 
+
+    assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
+    Common::SeekableReadStream *file = NULL;
 
     if (_installerArchive.hasFile("GAME.DAT")) // if the full game is used
-        file = _installerArchive.createReadStreamForMember("GAME.DAT"); 
+        file = _installerArchive.createReadStreamForMember("GAME.DAT");
     else if (_installerArchive.hasFile("GAME.TXT")) // if the demo is used
-        file = _installerArchive.createReadStreamForMember("GAME.TXT"); 
+        file = _installerArchive.createReadStreamForMember("GAME.TXT");
 
     assert(file != NULL);
     void *buf = malloc(191000);
@@ -459,7 +459,7 @@ Graphics::ManagedSurface *PrivateEngine::loadMask(const Common::String &name, in
     return surf;
 }
 
-void PrivateEngine::drawScreen() {    
+void PrivateEngine::drawScreen() {
     Graphics::Surface *screen = g_system->lockScreen();
     Graphics::ManagedSurface *surface = _compositeSurface;
     int w = surface->w;
@@ -488,7 +488,7 @@ void PrivateEngine::drawScreen() {
 
 bool PrivateEngine::getRandomBool(uint p) {
     uint r = _rnd->getRandomNumber(100);
-    return (r <= p);   
+    return (r <= p);
 }
 
 


Commit: 211c767685ee28aa72a4cacb644a1a6962e9e045
    https://github.com/scummvm/scummvm/commit/211c767685ee28aa72a4cacb644a1a6962e9e045
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: clean up and reorganization

Changed paths:
  A engines/private/symbol.h
    engines/private/code.cpp
    engines/private/grammar.h
    engines/private/grammar.l
    engines/private/grammar.tab.cpp
    engines/private/grammar.tab.h
    engines/private/grammar.y
    engines/private/lex.yy.cpp
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 47ca6462d8..0fe5966c5b 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -8,8 +8,8 @@
 
 namespace Private {
 
-Setting *psetting;
-SettingMap settingcode;
+Setting *setting;
+SettingMap settingMap;
 
 Datum	*stack       = NULL;	/* the stack */
 Datum	*stackp      = NULL;	/* next free spot on stack */
@@ -47,11 +47,11 @@ void initInsts() {
 
 void initSetting()	/* initialize for code generation */
 {
-    psetting = (Setting*) malloc(sizeof(Setting));
-    memset((void *) psetting, 0, sizeof(Setting));
+    setting = (Setting*) malloc(sizeof(Setting));
+    memset((void *) setting, 0, sizeof(Setting));
 
-    prog = (Inst *) &psetting->prog;
-    stack = (Datum *) &psetting->stack;
+    prog = (Inst *) &setting->prog;
+    stack = (Datum *) &setting->stack;
 
     stackp = stack;
     progp = prog;
@@ -60,19 +60,19 @@ void initSetting()	/* initialize for code generation */
 void saveSetting(char *name)
 {
     Common::String s(name);
-    settingcode.setVal(s, psetting);
+    settingMap.setVal(s, setting);
     //debug("setting %s", name);
 }
 
 void loadSetting(Common::String *name)
 {
-    assert(settingcode.contains(*name));
-    psetting = settingcode.getVal(*name);
+    assert(settingMap.contains(*name));
+    setting = settingMap.getVal(*name);
 
     debug("loading setting %s", name->c_str());
 
-    prog = (Inst *) &psetting->prog;
-    stack = (Datum *) &psetting->stack;
+    prog = (Inst *) &setting->prog;
+    stack = (Datum *) &setting->stack;
 
     stackp = stack;
     progp = prog;
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 793a9fdd9d..3810559f3b 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -5,6 +5,7 @@
 #include "common/list.h"
 #include "common/array.h"
 #include "common/rect.h"
+#include "private/symbol.h"
 
 #ifndef PRIVATE_GRAMMAR_H
 #define PRIVATE_GRAMMAR_H
@@ -12,20 +13,8 @@
 #define	NSTACK	256
 #define	NPROG	10000
 
-typedef struct Arg {
-  int n;
-  int (**inst)();
-} Arg;
 
-typedef struct Symbol {	/* symbol table entry */
-	Common::String *name;
-	short	type;	/* NAME, NUM, STRING or RECT  */
-	union {
-		int	val;	    /* NAME or NUM */
-		char	*str;	    /* STRING */
-		Common::Rect *rect; /* RECT */
-	} u;
-} Symbol;
+namespace Private {
 
 typedef struct Datum {	/* interpreter stack type */
         short type;
@@ -37,7 +26,11 @@ typedef struct Datum {	/* interpreter stack type */
 	} u;
 } Datum;
 
-namespace Private {
+
+typedef struct Arg {
+  int n;
+  int (**inst)();
+} Arg;
 
 typedef int (*Inst)();	/* machine instruction */
 #define	STOP	(Inst) 0
@@ -68,28 +61,6 @@ typedef Common::HashMap<Common::String, Setting*> SettingMap;
 typedef Common::Queue<Common::String> StringQueue;
 typedef Common::Queue<Common::Rect*> RectQueue;
 
-
-extern StringQueue todefine;
-extern SettingMap settingcode;
-
-// Symbols
-
-extern void showSymbol(Symbol *);
-extern void setSymbol(Symbol *, int);
-
-typedef Common::HashMap<Common::String, Symbol*> SymbolMap;
-typedef Common::List<Symbol*> ConstantList;
-
-extern SymbolMap settings, variables, cursors, locations, rects;
-extern ConstantList constants;
-
-extern void define(char *, Common::Rect *); 
-extern Symbol  *install(Common::String *, int, int, char *, Common::Rect *, SymbolMap*);
-extern Symbol  *lookupName(char *);
-extern Symbol *addconstant(int, int, char *);
-extern void     installall(char *);
-extern Symbol  *lookup(Common::String, SymbolMap);
-
 // Funtions
 
 typedef Common::Array<Datum> ArgArray;
diff --git a/engines/private/grammar.l b/engines/private/grammar.l
index 462d9d5081..be6f411c9f 100644
--- a/engines/private/grammar.l
+++ b/engines/private/grammar.l
@@ -32,8 +32,8 @@ TRUE                    return TRUETOK;
 NULL                    return NULLTOK;
 Random                  return RANDOMTOK;
 [A-Za-z_][A-Za-z_0-9]*  yylval.s = strdup(yytext); return NAME;
-[\-]?[0-9]+             yylval.sym = Private::addconstant(NUM, atoi(yytext), NULL); return NUM;
-\"[^\"\r\n]*\"          yylval.sym = Private::addconstant(STRING, 0, strdup(yytext)); return STRING;
+[\-]?[0-9]+             yylval.sym = Private::constant(NUM, atoi(yytext), NULL); return NUM;
+\"[^\"\r\n]*\"          yylval.sym = Private::constant(STRING, 0, strdup(yytext)); return STRING;
 [\r|\n]+                /* ignore return */;
 [ \t]+                  /* ignore whitespace */;
 .                       return *yytext;
@@ -46,21 +46,15 @@ namespace Private {
 int parse(char *code) {
 	
 	initSetting();
-	//_lines[0] = _lines[1] = _lines[2] = code;
 
 	YY_BUFFER_STATE bp;
 
-	//if (debugChannelSet(-1, kDebugParse))
 	yydebug = 1;
-	//else
-	//	yydebug = 0;
-
 	yy_delete_buffer(YY_CURRENT_BUFFER);
 
 	bp = yy_scan_string(code);
 	yy_switch_to_buffer(bp);
 	yyparse();
-        //execute(prog);
 	yy_delete_buffer(bp);
 
 	return 0;
diff --git a/engines/private/grammar.tab.cpp b/engines/private/grammar.tab.cpp
index d93bf3b240..1fcf2987da 100644
--- a/engines/private/grammar.tab.cpp
+++ b/engines/private/grammar.tab.cpp
@@ -91,12 +91,12 @@ extern int yyparse();
 
 void yyerror(const char *str)
 {
-    //fprintf(stderr,"error: %s\n",str);
+	//fprintf(stderr,"error: %s\n",str);
 }
 
 int yywrap()
 {
-    return 1;
+	return 1;
 }
 
 
@@ -127,55 +127,55 @@ int yywrap()
 /* Symbol kind.  */
 enum yysymbol_kind_t
 {
-    YYSYMBOL_YYEMPTY = -2,
-    YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
-    YYSYMBOL_YYerror = 1,                    /* error  */
-    YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
-    YYSYMBOL_NAME = 3,                       /* NAME  */
-    YYSYMBOL_STRING = 4,                     /* STRING  */
-    YYSYMBOL_NUM = 5,                        /* NUM  */
-    YYSYMBOL_LTE = 6,                        /* LTE  */
-    YYSYMBOL_GTE = 7,                        /* GTE  */
-    YYSYMBOL_NEQ = 8,                        /* NEQ  */
-    YYSYMBOL_EQ = 9,                         /* EQ  */
-    YYSYMBOL_FALSETOK = 10,                  /* FALSETOK  */
-    YYSYMBOL_TRUETOK = 11,                   /* TRUETOK  */
-    YYSYMBOL_NULLTOK = 12,                   /* NULLTOK  */
-    YYSYMBOL_IFTOK = 13,                     /* IFTOK  */
-    YYSYMBOL_ELSETOK = 14,                   /* ELSETOK  */
-    YYSYMBOL_RECT = 15,                      /* RECT  */
-    YYSYMBOL_GOTOTOK = 16,                   /* GOTOTOK  */
-    YYSYMBOL_DEBUGTOK = 17,                  /* DEBUGTOK  */
-    YYSYMBOL_DEFINETOK = 18,                 /* DEFINETOK  */
-    YYSYMBOL_SETTINGTOK = 19,                /* SETTINGTOK  */
-    YYSYMBOL_RANDOMTOK = 20,                 /* RANDOMTOK  */
-    YYSYMBOL_21_ = 21,                       /* '{'  */
-    YYSYMBOL_22_ = 22,                       /* '}'  */
-    YYSYMBOL_23_ = 23,                       /* ','  */
-    YYSYMBOL_24_ = 24,                       /* ';'  */
-    YYSYMBOL_25_ = 25,                       /* '('  */
-    YYSYMBOL_26_ = 26,                       /* ')'  */
-    YYSYMBOL_27_ = 27,                       /* '!'  */
-    YYSYMBOL_28_ = 28,                       /* '+'  */
-    YYSYMBOL_29_ = 29,                       /* '<'  */
-    YYSYMBOL_30_ = 30,                       /* '>'  */
-    YYSYMBOL_31_ = 31,                       /* '%'  */
-    YYSYMBOL_YYACCEPT = 32,                  /* $accept  */
-    YYSYMBOL_lines = 33,                     /* lines  */
-    YYSYMBOL_line = 34,                      /* line  */
-    YYSYMBOL_debug = 35,                     /* debug  */
-    YYSYMBOL_statements = 36,                /* statements  */
-    YYSYMBOL_statement = 37,                 /* statement  */
-    YYSYMBOL_body = 38,                      /* body  */
-    YYSYMBOL_end = 39,                       /* end  */
-    YYSYMBOL_if = 40,                        /* if  */
-    YYSYMBOL_cond = 41,                      /* cond  */
-    YYSYMBOL_define = 42,                    /* define  */
-    YYSYMBOL_fcall = 43,                     /* fcall  */
-    YYSYMBOL_startp = 44,                    /* startp  */
-    YYSYMBOL_params = 45,                    /* params  */
-    YYSYMBOL_value = 46,                     /* value  */
-    YYSYMBOL_expr = 47                       /* expr  */
+  YYSYMBOL_YYEMPTY = -2,
+  YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
+  YYSYMBOL_YYerror = 1,                    /* error  */
+  YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
+  YYSYMBOL_NAME = 3,                       /* NAME  */
+  YYSYMBOL_STRING = 4,                     /* STRING  */
+  YYSYMBOL_NUM = 5,                        /* NUM  */
+  YYSYMBOL_LTE = 6,                        /* LTE  */
+  YYSYMBOL_GTE = 7,                        /* GTE  */
+  YYSYMBOL_NEQ = 8,                        /* NEQ  */
+  YYSYMBOL_EQ = 9,                         /* EQ  */
+  YYSYMBOL_FALSETOK = 10,                  /* FALSETOK  */
+  YYSYMBOL_TRUETOK = 11,                   /* TRUETOK  */
+  YYSYMBOL_NULLTOK = 12,                   /* NULLTOK  */
+  YYSYMBOL_IFTOK = 13,                     /* IFTOK  */
+  YYSYMBOL_ELSETOK = 14,                   /* ELSETOK  */
+  YYSYMBOL_RECT = 15,                      /* RECT  */
+  YYSYMBOL_GOTOTOK = 16,                   /* GOTOTOK  */
+  YYSYMBOL_DEBUGTOK = 17,                  /* DEBUGTOK  */
+  YYSYMBOL_DEFINETOK = 18,                 /* DEFINETOK  */
+  YYSYMBOL_SETTINGTOK = 19,                /* SETTINGTOK  */
+  YYSYMBOL_RANDOMTOK = 20,                 /* RANDOMTOK  */
+  YYSYMBOL_21_ = 21,                       /* '{'  */
+  YYSYMBOL_22_ = 22,                       /* '}'  */
+  YYSYMBOL_23_ = 23,                       /* ','  */
+  YYSYMBOL_24_ = 24,                       /* ';'  */
+  YYSYMBOL_25_ = 25,                       /* '('  */
+  YYSYMBOL_26_ = 26,                       /* ')'  */
+  YYSYMBOL_27_ = 27,                       /* '!'  */
+  YYSYMBOL_28_ = 28,                       /* '+'  */
+  YYSYMBOL_29_ = 29,                       /* '<'  */
+  YYSYMBOL_30_ = 30,                       /* '>'  */
+  YYSYMBOL_31_ = 31,                       /* '%'  */
+  YYSYMBOL_YYACCEPT = 32,                  /* $accept  */
+  YYSYMBOL_lines = 33,                     /* lines  */
+  YYSYMBOL_line = 34,                      /* line  */
+  YYSYMBOL_debug = 35,                     /* debug  */
+  YYSYMBOL_statements = 36,                /* statements  */
+  YYSYMBOL_statement = 37,                 /* statement  */
+  YYSYMBOL_body = 38,                      /* body  */
+  YYSYMBOL_end = 39,                       /* end  */
+  YYSYMBOL_if = 40,                        /* if  */
+  YYSYMBOL_cond = 41,                      /* cond  */
+  YYSYMBOL_define = 42,                    /* define  */
+  YYSYMBOL_fcall = 43,                     /* fcall  */
+  YYSYMBOL_startp = 44,                    /* startp  */
+  YYSYMBOL_params = 45,                    /* params  */
+  YYSYMBOL_value = 46,                     /* value  */
+  YYSYMBOL_expr = 47                       /* expr  */
 };
 typedef enum yysymbol_kind_t yysymbol_kind_t;
 
@@ -374,7 +374,7 @@ typedef int yy_state_fast_t;
 #    define YYSTACK_ALLOC alloca
 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-/* Use EXIT_SUCCESS as a witness for stdlib.h.  */
+      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
 #     ifndef EXIT_SUCCESS
 #      define EXIT_SUCCESS 0
 #     endif
@@ -384,13 +384,13 @@ typedef int yy_state_fast_t;
 # endif
 
 # ifdef YYSTACK_ALLOC
-/* Pacify GCC's 'empty if-body' warning.  */
+   /* Pacify GCC's 'empty if-body' warning.  */
 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (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.  */
+    /* 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
@@ -429,8 +429,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
 {
-    yy_state_t yyss_alloc;
-    YYSTYPE yyvs_alloc;
+  yy_state_t yyss_alloc;
+  YYSTYPE yyvs_alloc;
 };
 
 /* The size of the maximum gap between one aligned stack and the next.  */
@@ -511,46 +511,46 @@ union yyalloc
    as returned by yylex.  */
 static const yytype_int8 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,    27,     2,     2,     2,    31,     2,     2,
-    25,    26,     2,    28,    23,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,    24,
-    29,     2,    30,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,    21,     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,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     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,
-    15,    16,    17,    18,    19,    20
+       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,    27,     2,     2,     2,    31,     2,     2,
+      25,    26,     2,    28,    23,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,    24,
+      29,     2,    30,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,    21,     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,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     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,
+      15,    16,    17,    18,    19,    20
 };
 
 #if YYDEBUG
-/* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
+  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
-    0,    54,    54,    55,    58,    59,    60,    63,    64,    67,
-    68,    71,    77,    78,    83,    91,    92,    95,    98,   101,
-    104,   105,   110,   114,   115,   118,   126,   127,   135,   138,
-    139,   140,   141,   142,   145,   146,   147,   148,   149,   150,
-    153,   154,   155,   156,   157,   158,   159,   160,   161,   162,
-    163
+       0,    54,    54,    55,    58,    59,    60,    63,    64,    67,
+      68,    71,    77,    78,    83,    91,    92,    95,    98,   101,
+     104,   105,   110,   114,   115,   118,   126,   127,   135,   138,
+     139,   140,   141,   142,   145,   146,   147,   148,   149,   150,
+     153,   154,   155,   156,   157,   158,   159,   160,   161,   162,
+     163
 };
 #endif
 
@@ -566,19 +566,19 @@ static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
 static const char *const yytname[] =
 {
-    "\"end of file\"", "error", "\"invalid token\"", "NAME", "STRING",
-    "NUM", "LTE", "GTE", "NEQ", "EQ", "FALSETOK", "TRUETOK", "NULLTOK",
-    "IFTOK", "ELSETOK", "RECT", "GOTOTOK", "DEBUGTOK", "DEFINETOK",
-    "SETTINGTOK", "RANDOMTOK", "'{'", "'}'", "','", "';'", "'('", "')'",
-    "'!'", "'+'", "'<'", "'>'", "'%'", "$accept", "lines", "line", "debug",
-    "statements", "statement", "body", "end", "if", "cond", "define",
-    "fcall", "startp", "params", "value", "expr", YY_NULLPTR
+  "\"end of file\"", "error", "\"invalid token\"", "NAME", "STRING",
+  "NUM", "LTE", "GTE", "NEQ", "EQ", "FALSETOK", "TRUETOK", "NULLTOK",
+  "IFTOK", "ELSETOK", "RECT", "GOTOTOK", "DEBUGTOK", "DEFINETOK",
+  "SETTINGTOK", "RANDOMTOK", "'{'", "'}'", "','", "';'", "'('", "')'",
+  "'!'", "'+'", "'<'", "'>'", "'%'", "$accept", "lines", "line", "debug",
+  "statements", "statement", "body", "end", "if", "cond", "define",
+  "fcall", "startp", "params", "value", "expr", YY_NULLPTR
 };
 
 static const char *
 yysymbol_name (yysymbol_kind_t yysymbol)
 {
-    return yytname[yysymbol];
+  return yytname[yysymbol];
 }
 #endif
 
@@ -587,10 +587,10 @@ yysymbol_name (yysymbol_kind_t yysymbol)
    (internal) symbol number NUM (which must be that of a token).  */
 static const yytype_int16 yytoknum[] =
 {
-    0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
-    265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
-    275,   123,   125,    44,    59,    40,    41,    33,    43,    60,
-    62,    37
+       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
+     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
+     275,   123,   125,    44,    59,    40,    41,    33,    43,    60,
+      62,    37
 };
 #endif
 
@@ -604,132 +604,132 @@ static const yytype_int16 yytoknum[] =
 #define yytable_value_is_error(Yyn) \
   0
 
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-   STATE-NUM.  */
+  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+     STATE-NUM.  */
 static const yytype_int8 yypact[] =
 {
-    8,   -11,    11,    12,    18,     8,    30,    22,    23,   -73,
-    -73,    24,    38,    42,    59,    30,   -73,    40,    39,    41,
-    -73,    54,    16,    58,    59,    56,    60,   -73,     5,   -73,
-    -73,    77,    61,    83,   -73,   -73,    19,    52,   -73,    62,
-    -73,     1,    65,   -73,    63,   -73,   -73,   -73,   -73,   -73,
-    -73,    67,    66,    29,    64,    59,   -73,   -73,    86,    41,
-    68,    71,    69,    73,    92,   -73,    93,   -73,    66,    66,
-    66,    66,    66,    66,    66,   -73,    78,    50,    76,     1,
-    -73,     1,    79,    70,   -73,   -73,   -73,   -73,   -73,   -73,
-    -73,   -73,    52,    98,   -73,   -73,    99,    80,   -73,    82,
-    84,   -73,   -73,   103,   104,    87,    85,   107,   -73,    88,
-    90,    42,   -73
+       8,   -11,    11,    12,    18,     8,    30,    22,    23,   -73,
+     -73,    24,    38,    42,    59,    30,   -73,    40,    39,    41,
+     -73,    54,    16,    58,    59,    56,    60,   -73,     5,   -73,
+     -73,    77,    61,    83,   -73,   -73,    19,    52,   -73,    62,
+     -73,     1,    65,   -73,    63,   -73,   -73,   -73,   -73,   -73,
+     -73,    67,    66,    29,    64,    59,   -73,   -73,    86,    41,
+      68,    71,    69,    73,    92,   -73,    93,   -73,    66,    66,
+      66,    66,    66,    66,    66,   -73,    78,    50,    76,     1,
+     -73,     1,    79,    70,   -73,   -73,   -73,   -73,   -73,   -73,
+     -73,   -73,    52,    98,   -73,   -73,    99,    80,   -73,    82,
+      84,   -73,   -73,   103,   104,    87,    85,   107,   -73,    88,
+      90,    42,   -73
 };
 
-/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
-   Performed when YYTABLE does not specify something else to do.  Zero
-   means the default is an error.  */
+  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+     Performed when YYTABLE does not specify something else to do.  Zero
+     means the default is an error.  */
 static const yytype_int8 yydefact[] =
 {
-    0,     0,     0,     0,     0,     3,     7,     0,     0,     1,
-    2,     0,     0,    20,     9,     7,     4,    24,     0,     0,
-    18,     0,     0,     0,     9,     0,     0,     8,    20,     5,
-    28,     0,     0,     0,     6,    10,     0,     0,    12,     0,
-    23,    29,     0,    11,     0,    39,    38,    37,    35,    36,
-    34,     0,     0,    40,     0,     9,    15,    17,     0,    39,
-    0,    33,     0,    32,     0,    25,     0,    41,     0,     0,
-    0,     0,    49,     0,     0,    19,     0,    13,     0,    29,
-    27,    29,     0,     0,    47,    48,    43,    42,    44,    45,
-    46,    16,     0,     0,    30,    31,     0,     0,    17,     0,
-    0,    50,    14,     0,     0,     0,     0,     0,    26,     0,
-    22,    20,    21
+       0,     0,     0,     0,     0,     3,     7,     0,     0,     1,
+       2,     0,     0,    20,     9,     7,     4,    24,     0,     0,
+      18,     0,     0,     0,     9,     0,     0,     8,    20,     5,
+      28,     0,     0,     0,     6,    10,     0,     0,    12,     0,
+      23,    29,     0,    11,     0,    39,    38,    37,    35,    36,
+      34,     0,     0,    40,     0,     9,    15,    17,     0,    39,
+       0,    33,     0,    32,     0,    25,     0,    41,     0,     0,
+       0,     0,    49,     0,     0,    19,     0,    13,     0,    29,
+      27,    29,     0,     0,    47,    48,    43,    42,    44,    45,
+      46,    16,     0,     0,    30,    31,     0,     0,    17,     0,
+       0,    50,    14,     0,     0,     0,     0,     0,    26,     0,
+      22,    20,    21
 };
 
-/* YYPGOTO[NTERM-NUM].  */
+  /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int8 yypgoto[] =
 {
-    -73,   110,   -73,   101,   -21,   -36,    25,    20,   -73,   -73,
-        -28,   -39,   -73,   -72,   -20,    89
-    };
+     -73,   110,   -73,   101,   -21,   -36,    25,    20,   -73,   -73,
+     -28,   -39,   -73,   -72,   -20,    89
+};
 
-/* YYDEFGOTO[NTERM-NUM].  */
+  /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int8 yydefgoto[] =
 {
-    -1,     4,     5,    12,    23,    24,    57,    77,    25,    37,
-        18,    26,    41,    62,    53,    63
-    };
+      -1,     4,     5,    12,    23,    24,    57,    77,    25,    37,
+      18,    26,    41,    62,    53,    63
+};
 
-/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
-   positive, shift that token.  If negative, reduce the rule whose
-   number is the opposite.  If YYTABLE_NINF, syntax error.  */
+  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
+     positive, shift that token.  If negative, reduce the rule whose
+     number is the opposite.  If YYTABLE_NINF, syntax error.  */
 static const yytype_int8 yytable[] =
 {
-    40,    56,    61,    35,    59,    46,    47,    94,    17,    95,
-    6,    48,    49,    50,     7,     8,    21,    60,     9,    32,
-    39,    51,    45,    46,    47,     1,     2,     3,    52,    48,
-    49,    50,    67,    11,    76,    68,    69,    70,    71,    51,
-    61,    33,    61,    13,    14,    17,    52,    15,    84,    85,
-    86,    87,    88,    89,    90,    19,    56,    72,    73,    74,
-    16,    29,    19,    28,    92,    20,    30,    21,    22,    45,
-    46,    47,    20,    55,    21,    22,    48,    49,    50,    31,
-    34,    36,    42,   112,    38,    43,    44,    58,    64,    65,
-    75,    78,    66,    33,    79,    80,    81,    82,    83,    93,
-    91,    97,    96,    99,   100,   103,   101,   104,   105,   106,
-    107,   108,   109,   111,   110,    10,    27,    98,   102,     0,
-    0,     0,     0,     0,     0,    54
+      40,    56,    61,    35,    59,    46,    47,    94,    17,    95,
+       6,    48,    49,    50,     7,     8,    21,    60,     9,    32,
+      39,    51,    45,    46,    47,     1,     2,     3,    52,    48,
+      49,    50,    67,    11,    76,    68,    69,    70,    71,    51,
+      61,    33,    61,    13,    14,    17,    52,    15,    84,    85,
+      86,    87,    88,    89,    90,    19,    56,    72,    73,    74,
+      16,    29,    19,    28,    92,    20,    30,    21,    22,    45,
+      46,    47,    20,    55,    21,    22,    48,    49,    50,    31,
+      34,    36,    42,   112,    38,    43,    44,    58,    64,    65,
+      75,    78,    66,    33,    79,    80,    81,    82,    83,    93,
+      91,    97,    96,    99,   100,   103,   101,   104,   105,   106,
+     107,   108,   109,   111,   110,    10,    27,    98,   102,     0,
+       0,     0,     0,     0,     0,    54
 };
 
 static const yytype_int8 yycheck[] =
 {
-    28,    37,    41,    24,     3,     4,     5,    79,     3,    81,
-    21,    10,    11,    12,     3,     3,    15,    16,     0,     3,
-    15,    20,     3,     4,     5,    17,    18,    19,    27,    10,
-    11,    12,    52,     3,    55,     6,     7,     8,     9,    20,
-    79,    25,    81,    21,    21,     3,    27,    23,    68,    69,
-    70,    71,    72,    73,    74,     3,    92,    28,    29,    30,
-    22,    22,     3,    23,    14,    13,    25,    15,    16,     3,
-    4,     5,    13,    21,    15,    16,    10,    11,    12,    25,
-    22,    25,     5,   111,    24,    24,     3,    25,    23,    26,
-    26,     5,    25,    25,    23,    26,    23,     5,     5,    23,
-    22,    31,    23,     5,     5,    23,    26,    23,     5,     5,
-    23,    26,     5,    23,    26,     5,    15,    92,    98,    -1,
-    -1,    -1,    -1,    -1,    -1,    36
+      28,    37,    41,    24,     3,     4,     5,    79,     3,    81,
+      21,    10,    11,    12,     3,     3,    15,    16,     0,     3,
+      15,    20,     3,     4,     5,    17,    18,    19,    27,    10,
+      11,    12,    52,     3,    55,     6,     7,     8,     9,    20,
+      79,    25,    81,    21,    21,     3,    27,    23,    68,    69,
+      70,    71,    72,    73,    74,     3,    92,    28,    29,    30,
+      22,    22,     3,    23,    14,    13,    25,    15,    16,     3,
+       4,     5,    13,    21,    15,    16,    10,    11,    12,    25,
+      22,    25,     5,   111,    24,    24,     3,    25,    23,    26,
+      26,     5,    25,    25,    23,    26,    23,     5,     5,    23,
+      22,    31,    23,     5,     5,    23,    26,    23,     5,     5,
+      23,    26,     5,    23,    26,     5,    15,    92,    98,    -1,
+      -1,    -1,    -1,    -1,    -1,    36
 };
 
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-   symbol of state STATE-NUM.  */
+  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+     symbol of state STATE-NUM.  */
 static const yytype_int8 yystos[] =
 {
-    0,    17,    18,    19,    33,    34,    21,     3,     3,     0,
-    33,     3,    35,    21,    21,    23,    22,     3,    42,     3,
-    13,    15,    16,    36,    37,    40,    43,    35,    23,    22,
-    25,    25,     3,    25,    22,    36,    25,    41,    24,    15,
-    42,    44,     5,    24,     3,     3,     4,     5,    10,    11,
-    12,    20,    27,    46,    47,    21,    37,    38,    25,     3,
-    16,    43,    45,    47,    23,    26,    25,    46,     6,     7,
-    8,     9,    28,    29,    30,    26,    36,    39,     5,    23,
-    26,    23,     5,     5,    46,    46,    46,    46,    46,    46,
-    46,    22,    14,    23,    45,    45,    23,    31,    38,     5,
-    5,    26,    39,    23,    23,     5,     5,    23,    26,     5,
-    26,    23,    42
+       0,    17,    18,    19,    33,    34,    21,     3,     3,     0,
+      33,     3,    35,    21,    21,    23,    22,     3,    42,     3,
+      13,    15,    16,    36,    37,    40,    43,    35,    23,    22,
+      25,    25,     3,    25,    22,    36,    25,    41,    24,    15,
+      42,    44,     5,    24,     3,     3,     4,     5,    10,    11,
+      12,    20,    27,    46,    47,    21,    37,    38,    25,     3,
+      16,    43,    45,    47,    23,    26,    25,    46,     6,     7,
+       8,     9,    28,    29,    30,    26,    36,    39,     5,    23,
+      26,    23,     5,     5,    46,    46,    46,    46,    46,    46,
+      46,    22,    14,    23,    45,    45,    23,    31,    38,     5,
+       5,    26,    39,    23,    23,     5,     5,    23,    26,     5,
+      26,    23,    42
 };
 
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_int8 yyr1[] =
 {
-    0,    32,    33,    33,    34,    34,    34,    35,    35,    36,
-    36,    37,    37,    37,    37,    38,    38,    39,    40,    41,
-    42,    42,    42,    42,    42,    43,    43,    43,    44,    45,
-    45,    45,    45,    45,    46,    46,    46,    46,    46,    46,
-    47,    47,    47,    47,    47,    47,    47,    47,    47,    47,
-    47
+       0,    32,    33,    33,    34,    34,    34,    35,    35,    36,
+      36,    37,    37,    37,    37,    38,    38,    39,    40,    41,
+      42,    42,    42,    42,    42,    43,    43,    43,    44,    45,
+      45,    45,    45,    45,    46,    46,    46,    46,    46,    46,
+      47,    47,    47,    47,    47,    47,    47,    47,    47,    47,
+      47
 };
 
-/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
+  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
 static const yytype_int8 yyr2[] =
 {
-    0,     2,     2,     1,     4,     5,     5,     0,     3,     0,
-    2,     3,     2,     4,     7,     1,     3,     0,     1,     3,
-    0,    14,    12,     3,     1,     4,    10,     5,     0,     0,
-    3,     3,     1,     1,     1,     1,     1,     1,     1,     1,
-    1,     2,     3,     3,     3,     3,     3,     3,     3,     2,
-    5
+       0,     2,     2,     1,     4,     5,     5,     0,     3,     0,
+       2,     3,     2,     4,     7,     1,     3,     0,     1,     3,
+       0,    14,    12,     3,     1,     4,    10,     5,     0,     0,
+       3,     3,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     2,     3,     3,     3,     3,     3,     3,     3,     2,
+       5
 };
 
 
@@ -807,17 +807,17 @@ static void
 yy_symbol_value_print (FILE *yyo,
                        yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
 {
-    FILE *yyoutput = yyo;
-    YYUSE (yyoutput);
-    if (!yyvaluep)
-        return;
+  FILE *yyoutput = yyo;
+  YYUSE (yyoutput);
+  if (!yyvaluep)
+    return;
 # ifdef YYPRINT
-    if (yykind < YYNTOKENS)
-        YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
+  if (yykind < YYNTOKENS)
+    YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
 # endif
-    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-    YYUSE (yykind);
-    YY_IGNORE_MAYBE_UNINITIALIZED_END
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  YYUSE (yykind);
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 }
 
 
@@ -829,11 +829,11 @@ static void
 yy_symbol_print (FILE *yyo,
                  yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
 {
-    YYFPRINTF (yyo, "%s %s (",
-               yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
+  YYFPRINTF (yyo, "%s %s (",
+             yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
 
-    yy_symbol_value_print (yyo, yykind, yyvaluep);
-    YYFPRINTF (yyo, ")");
+  yy_symbol_value_print (yyo, yykind, yyvaluep);
+  YYFPRINTF (yyo, ")");
 }
 
 /*------------------------------------------------------------------.
@@ -844,13 +844,13 @@ yy_symbol_print (FILE *yyo,
 static void
 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
 {
-    YYFPRINTF (stderr, "Stack now");
-    for (; yybottom <= yytop; yybottom++)
+  YYFPRINTF (stderr, "Stack now");
+  for (; yybottom <= yytop; yybottom++)
     {
-        int yybot = *yybottom;
-        YYFPRINTF (stderr, " %d", yybot);
+      int yybot = *yybottom;
+      YYFPRINTF (stderr, " %d", yybot);
     }
-    YYFPRINTF (stderr, "\n");
+  YYFPRINTF (stderr, "\n");
 }
 
 # define YY_STACK_PRINT(Bottom, Top)                            \
@@ -868,19 +868,19 @@ static void
 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
                  int yyrule)
 {
-    int yylno = yyrline[yyrule];
-    int yynrhs = yyr2[yyrule];
-    int yyi;
-    YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
-               yyrule - 1, yylno);
-    /* The symbols being reduced.  */
-    for (yyi = 0; yyi < yynrhs; yyi++)
+  int yylno = yyrline[yyrule];
+  int yynrhs = yyr2[yyrule];
+  int yyi;
+  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
+             yyrule - 1, yylno);
+  /* The symbols being reduced.  */
+  for (yyi = 0; yyi < yynrhs; yyi++)
     {
-        YYFPRINTF (stderr, "   $%d = ", yyi + 1);
-        yy_symbol_print (stderr,
-                         YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
-                         &yyvsp[(yyi + 1) - (yynrhs)]);
-        YYFPRINTF (stderr, "\n");
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
+      yy_symbol_print (stderr,
+                       YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
+                       &yyvsp[(yyi + 1) - (yynrhs)]);
+      YYFPRINTF (stderr, "\n");
     }
 }
 
@@ -930,14 +930,14 @@ static void
 yydestruct (const char *yymsg,
             yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
 {
-    YYUSE (yyvaluep);
-    if (!yymsg)
-        yymsg = "Deleting";
-    YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
-
-    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-    YYUSE (yykind);
-    YY_IGNORE_MAYBE_UNINITIALIZED_END
+  YYUSE (yyvaluep);
+  if (!yymsg)
+    yymsg = "Deleting";
+  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
+
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  YYUSE (yykind);
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 }
 
 
@@ -979,781 +979,705 @@ yyparse (void)
     YYSTYPE *yyvs = yyvsa;
     YYSTYPE *yyvsp = yyvs;
 
-    int yyn;
-    /* The return value of yyparse.  */
-    int yyresult;
-    /* Lookahead symbol kind.  */
-    yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
-    /* The variables used to return semantic value and location from the
-       action routines.  */
-    YYSTYPE yyval;
+  int yyn;
+  /* The return value of yyparse.  */
+  int yyresult;
+  /* Lookahead symbol kind.  */
+  yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE yyval;
 
 
 
 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 
-    /* The number of symbols on the RHS of the reduced rule.
-       Keep to zero when no symbol should be popped.  */
-    int yylen = 0;
+  /* 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"));
+  YYDPRINTF ((stderr, "Starting parse\n"));
 
-    yychar = YYEMPTY; /* Cause a token to be read.  */
-    goto yysetstate;
+  yychar = YYEMPTY; /* Cause a token to be read.  */
+  goto yysetstate;
 
 
-    /*------------------------------------------------------------.
-    | yynewstate -- push a new state, which is found in yystate.  |
-    `------------------------------------------------------------*/
+/*------------------------------------------------------------.
+| 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++;
+  /* 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 -- set current state (the top of the stack) to yystate.  |
-    `--------------------------------------------------------------------*/
+/*--------------------------------------------------------------------.
+| yysetstate -- set current state (the top of the stack) to yystate.  |
+`--------------------------------------------------------------------*/
 yysetstate:
-    YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-    YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
-    YY_IGNORE_USELESS_CAST_BEGIN
-    *yyssp = YY_CAST (yy_state_t, yystate);
-    YY_IGNORE_USELESS_CAST_END
-    YY_STACK_PRINT (yyss, yyssp);
-
-    if (yyss + yystacksize - 1 <= yyssp)
+  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
+  YY_IGNORE_USELESS_CAST_BEGIN
+  *yyssp = YY_CAST (yy_state_t, yystate);
+  YY_IGNORE_USELESS_CAST_END
+  YY_STACK_PRINT (yyss, yyssp);
+
+  if (yyss + yystacksize - 1 <= yyssp)
 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
-        goto yyexhaustedlab;
+    goto yyexhaustedlab;
 #else
     {
-        /* Get the current used size of the three stacks, in elements.  */
-        YYPTRDIFF_T yysize = yyssp - yyss + 1;
+      /* Get the current used size of the three stacks, in elements.  */
+      YYPTRDIFF_T yysize = yyssp - yyss + 1;
 
 # if defined 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.  */
-            yy_state_t *yyss1 = yyss;
-            YYSTYPE *yyvs1 = yyvs;
-
-            /* 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 * YYSIZEOF (*yyssp),
-                        &yyvs1, yysize * YYSIZEOF (*yyvsp),
-                        &yystacksize);
-            yyss = yyss1;
-            yyvs = yyvs1;
-        }
+      {
+        /* Give user a chance to reallocate the stack.  Use copies of
+           these so that the &'s don't force the real ones into
+           memory.  */
+        yy_state_t *yyss1 = yyss;
+        YYSTYPE *yyvs1 = yyvs;
+
+        /* 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 * YYSIZEOF (*yyssp),
+                    &yyvs1, yysize * YYSIZEOF (*yyvsp),
+                    &yystacksize);
+        yyss = yyss1;
+        yyvs = yyvs1;
+      }
 # else /* defined YYSTACK_RELOCATE */
-        /* Extend the stack our own way.  */
-        if (YYMAXDEPTH <= yystacksize)
-            goto yyexhaustedlab;
-        yystacksize *= 2;
-        if (YYMAXDEPTH < yystacksize)
-            yystacksize = YYMAXDEPTH;
-
-        {
-            yy_state_t *yyss1 = yyss;
-            union yyalloc *yyptr =
-                    YY_CAST (union yyalloc *,
-                             YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
-            if (! yyptr)
-                goto yyexhaustedlab;
-            YYSTACK_RELOCATE (yyss_alloc, yyss);
-            YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+      /* Extend the stack our own way.  */
+      if (YYMAXDEPTH <= yystacksize)
+        goto yyexhaustedlab;
+      yystacksize *= 2;
+      if (YYMAXDEPTH < yystacksize)
+        yystacksize = YYMAXDEPTH;
+
+      {
+        yy_state_t *yyss1 = yyss;
+        union yyalloc *yyptr =
+          YY_CAST (union yyalloc *,
+                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
+        if (! yyptr)
+          goto yyexhaustedlab;
+        YYSTACK_RELOCATE (yyss_alloc, yyss);
+        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
 #  undef YYSTACK_RELOCATE
-            if (yyss1 != yyssa)
-                YYSTACK_FREE (yyss1);
-        }
+        if (yyss1 != yyssa)
+          YYSTACK_FREE (yyss1);
+      }
 # endif
 
-        yyssp = yyss + yysize - 1;
-        yyvsp = yyvs + yysize - 1;
+      yyssp = yyss + yysize - 1;
+      yyvsp = yyvs + yysize - 1;
 
-        YY_IGNORE_USELESS_CAST_BEGIN
-        YYDPRINTF ((stderr, "Stack size increased to %ld\n",
-                    YY_CAST (long, yystacksize)));
-        YY_IGNORE_USELESS_CAST_END
+      YY_IGNORE_USELESS_CAST_BEGIN
+      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
+                  YY_CAST (long, yystacksize)));
+      YY_IGNORE_USELESS_CAST_END
 
-        if (yyss + yystacksize - 1 <= yyssp)
-            YYABORT;
+      if (yyss + yystacksize - 1 <= yyssp)
+        YYABORT;
     }
 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
 
-    if (yystate == YYFINAL)
-        YYACCEPT;
+  if (yystate == YYFINAL)
+    YYACCEPT;
 
-    goto yybackup;
+  goto yybackup;
 
 
-    /*-----------.
-    | yybackup.  |
-    `-----------*/
+/*-----------.
+| yybackup.  |
+`-----------*/
 yybackup:
-    /* Do appropriate processing given the current state.  Read a
-       lookahead token if we need one and don't already have one.  */
+  /* Do appropriate processing given the current state.  Read a
+     lookahead token if we need one and don't already have one.  */
 
-    /* First try to decide what to do without reference to lookahead token.  */
-    yyn = yypact[yystate];
-    if (yypact_value_is_default (yyn))
-        goto yydefault;
+  /* First try to decide what to do without reference to lookahead token.  */
+  yyn = yypact[yystate];
+  if (yypact_value_is_default (yyn))
+    goto yydefault;
 
-    /* Not known => get a lookahead token if don't already have one.  */
+  /* Not known => get a lookahead token if don't already have one.  */
 
-    /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
-    if (yychar == YYEMPTY)
+  /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
+  if (yychar == YYEMPTY)
     {
-        YYDPRINTF ((stderr, "Reading a token\n"));
-        yychar = yylex ();
+      YYDPRINTF ((stderr, "Reading a token\n"));
+      yychar = yylex ();
     }
 
-    if (yychar <= YYEOF)
+  if (yychar <= YYEOF)
     {
-        yychar = YYEOF;
-        yytoken = YYSYMBOL_YYEOF;
-        YYDPRINTF ((stderr, "Now at end of input.\n"));
+      yychar = YYEOF;
+      yytoken = YYSYMBOL_YYEOF;
+      YYDPRINTF ((stderr, "Now at end of input.\n"));
     }
-    else if (yychar == YYerror)
+  else if (yychar == YYerror)
     {
-        /* The scanner already issued an error message, process directly
-           to error recovery.  But do not keep the error token as
-           lookahead, it is too special and may lead us to an endless
-           loop in error recovery. */
-        yychar = YYUNDEF;
-        yytoken = YYSYMBOL_YYerror;
-        goto yyerrlab1;
+      /* The scanner already issued an error message, process directly
+         to error recovery.  But do not keep the error token as
+         lookahead, it is too special and may lead us to an endless
+         loop in error recovery. */
+      yychar = YYUNDEF;
+      yytoken = YYSYMBOL_YYerror;
+      goto yyerrlab1;
     }
-    else
+  else
     {
-        yytoken = YYTRANSLATE (yychar);
-        YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+      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 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 (yytable_value_is_error (yyn))
-            goto yyerrlab;
-        yyn = -yyn;
-        goto yyreduce;
+      if (yytable_value_is_error (yyn))
+        goto yyerrlab;
+      yyn = -yyn;
+      goto yyreduce;
     }
 
-    /* Count tokens shifted since error; after three, turn off error
-       status.  */
-    if (yyerrstatus)
-        yyerrstatus--;
+  /* Count tokens shifted since error; after three, turn off error
+     status.  */
+  if (yyerrstatus)
+    yyerrstatus--;
 
-    /* Shift the lookahead token.  */
-    YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-    yystate = yyn;
-    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-    *++yyvsp = yylval;
-    YY_IGNORE_MAYBE_UNINITIALIZED_END
+  /* Shift the lookahead token.  */
+  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+  yystate = yyn;
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 
-    /* Discard the shifted token.  */
-    yychar = YYEMPTY;
-    goto yynewstate;
+  /* Discard the shifted token.  */
+  yychar = YYEMPTY;
+  goto yynewstate;
 
 
-    /*-----------------------------------------------------------.
-    | yydefault -- do the default action for the current state.  |
-    `-----------------------------------------------------------*/
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state.  |
+`-----------------------------------------------------------*/
 yydefault:
-    yyn = yydefact[yystate];
-    if (yyn == 0)
-        goto yyerrlab;
-    goto yyreduce;
+  yyn = yydefact[yystate];
+  if (yyn == 0)
+    goto yyerrlab;
+  goto yyreduce;
 
 
-    /*-----------------------------.
-    | yyreduce -- do a reduction.  |
-    `-----------------------------*/
+/*-----------------------------.
+| yyreduce -- do a reduction.  |
+`-----------------------------*/
 yyreduce:
-    /* yyn is the number of a rule to reduce with.  */
-    yylen = yyr2[yyn];
+  /* 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'.
+  /* 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];
+     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)
+  YY_REDUCE_PRINT (yyn);
+  switch (yyn)
     {
-    case 4: /* line: DEBUGTOK '{' debug '}'  */
+  case 4: /* line: DEBUGTOK '{' debug '}'  */
 #line 58 "engines/private/grammar.y"
-        { /* Not used in the game */ }
+                                             { /* Not used in the game */ }
 #line 1203 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 5: /* line: DEFINETOK NAME '{' define '}'  */
+  case 5: /* line: DEFINETOK NAME '{' define '}'  */
 #line 59 "engines/private/grammar.y"
-        {
-            installall((yyvsp[-3].s));
-        }
+                                             { installAll((yyvsp[-3].s)); }
 #line 1209 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 6: /* line: SETTINGTOK NAME '{' statements '}'  */
+  case 6: /* line: SETTINGTOK NAME '{' statements '}'  */
 #line 60 "engines/private/grammar.y"
-        {
-            saveSetting((yyvsp[-3].s));
-            initSetting();
-        }
+                                             { saveSetting((yyvsp[-3].s)); initSetting(); }
 #line 1215 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 9: /* statements: %empty  */
+  case 9: /* statements: %empty  */
 #line 67 "engines/private/grammar.y"
-        {
-            (yyval.inst) = progp;
-        }
+                               { (yyval.inst) = progp; }
 #line 1221 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 11: /* statement: GOTOTOK NAME ';'  */
+  case 11: /* statement: GOTOTOK NAME ';'  */
 #line 71 "engines/private/grammar.y"
-        {
-            code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, (yyvsp[-1].s)));
-            code2(constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
-            code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto"));
-            code1(funcpush);
+                            {
+	code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s)));
+        code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
+        code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
+        code1(funcpush);
         }
 #line 1232 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 12: /* statement: fcall ';'  */
+  case 12: /* statement: fcall ';'  */
 #line 77 "engines/private/grammar.y"
-        { }
+                            { }
 #line 1238 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 13: /* statement: if cond body end  */
+  case 13: /* statement: if cond body end  */
 #line 78 "engines/private/grammar.y"
-        {
-            /* else-less if */
-            ((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst);	/* thenpart */
-            ((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst);
-        }
+                           {
+         	/* else-less if */
+		((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst);	/* thenpart */
+		((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst); 
+                }
 #line 1248 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 14: /* statement: if cond body end ELSETOK body end  */
+  case 14: /* statement: if cond body end ELSETOK body end  */
 #line 83 "engines/private/grammar.y"
-        {
-            /* if with else */
-            ((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst);	/* thenpart */
-            ((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst);	/* elsepart */
-            ((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst);
-        }
+                                            { 
+                /* if with else */
+		((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst);	/* thenpart */
+		((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst);	/* elsepart */
+		((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst); 
+                }
 #line 1259 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 15: /* body: statement  */
+  case 15: /* body: statement  */
 #line 91 "engines/private/grammar.y"
-        {
-            (yyval.inst) = (yyvsp[0].inst);
-        }
+                             { (yyval.inst) = (yyvsp[0].inst); }
 #line 1265 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 16: /* body: '{' statements '}'  */
+  case 16: /* body: '{' statements '}'  */
 #line 92 "engines/private/grammar.y"
-        {
-            (yyval.inst) = (yyvsp[-1].inst);
-        }
+                             { (yyval.inst) = (yyvsp[-1].inst); }
 #line 1271 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 17: /* end: %empty  */
+  case 17: /* end: %empty  */
 #line 95 "engines/private/grammar.y"
-        {
-            code(STOP);
-            (yyval.inst) = progp;
-        }
+                                { code(STOP); (yyval.inst) = progp; }
 #line 1277 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 18: /* if: IFTOK  */
+  case 18: /* if: IFTOK  */
 #line 98 "engines/private/grammar.y"
-        {
-            (yyval.inst) = code(ifcode);
-            code3(STOP, STOP, STOP);
-        }
+          { (yyval.inst) = code(ifcode); code3(STOP, STOP, STOP); }
 #line 1283 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 19: /* cond: '(' expr ')'  */
+  case 19: /* cond: '(' expr ')'  */
 #line 101 "engines/private/grammar.y"
-        {
-            code(STOP);
-            (yyval.inst) = (yyvsp[-1].inst);
-        }
+                        { code(STOP); (yyval.inst) = (yyvsp[-1].inst); }
 #line 1289 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  */
+  case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  */
 #line 105 "engines/private/grammar.y"
-        {
-            Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
-            assert(r->isValidRect());
-            define((yyvsp[-13].s), r);
-        }
+                                                                        { 
+          Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
+          assert(r->isValidRect()); 
+          defineSymbol((yyvsp[-13].s), r); 
+          }
 #line 1299 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
+  case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
 #line 110 "engines/private/grammar.y"
-        {
-            Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);
-            define((yyvsp[-11].s), r);
-        }
+                                                            {
+          Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);  
+          defineSymbol((yyvsp[-11].s), r); 
+          }
 #line 1308 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 23: /* define: NAME ',' define  */
+  case 23: /* define: NAME ',' define  */
 #line 114 "engines/private/grammar.y"
-        {
-            define((yyvsp[-2].s), NULL);
-        }
+                          { defineSymbol((yyvsp[-2].s), NULL); }
 #line 1314 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 24: /* define: NAME  */
+  case 24: /* define: NAME  */
 #line 115 "engines/private/grammar.y"
-        {
-            define((yyvsp[0].s), NULL);
-        }
+                          { defineSymbol((yyvsp[0].s), NULL); }
 #line 1320 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 25: /* fcall: GOTOTOK '(' NAME ')'  */
+  case 25: /* fcall: GOTOTOK '(' NAME ')'  */
 #line 118 "engines/private/grammar.y"
-        {
-            (yyval.inst) = progp;
-            code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, (yyvsp[-1].s)));
-            code2(constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
-            code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto"));
-            code1(funcpush);
-        }
+                               {
+                               (yyval.inst) = progp;
+                               code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s)));
+                               code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
+                               code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
+                               code1(funcpush);
+                               }
 #line 1332 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
+  case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
 #line 126 "engines/private/grammar.y"
-        {
-            (yyval.inst) = progp;
-        }
+                                                   { (yyval.inst) = progp; }
 #line 1338 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 27: /* fcall: NAME '(' startp params ')'  */
+  case 27: /* fcall: NAME '(' startp params ')'  */
 #line 127 "engines/private/grammar.y"
-        {
-            (yyval.inst) = (yyvsp[-2].inst);
-            code2(constpush, (Private::Inst) addconstant(NUM, (yyvsp[-1].narg), NULL));
-            code2(strpush, (Private::Inst) addconstant(STRING, 0, (yyvsp[-4].s)));
-            code1(funcpush);
-        }
+                                      {
+                               (yyval.inst) = (yyvsp[-2].inst);
+                               code2(constpush, (Private::Inst) constant(NUM, (yyvsp[-1].narg), NULL));
+                               code2(strpush, (Private::Inst) constant(STRING, 0, (yyvsp[-4].s))); 
+                               code1(funcpush);
+                               }
 #line 1349 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 28: /* startp: %empty  */
+  case 28: /* startp: %empty  */
 #line 135 "engines/private/grammar.y"
-        {
-            (yyval.inst) = progp;
-        }
+                    { (yyval.inst) = progp; }
 #line 1355 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 29: /* params: %empty  */
+  case 29: /* params: %empty  */
 #line 138 "engines/private/grammar.y"
-        {
-            (yyval.narg) = 0;
-        }
+                            { (yyval.narg) = 0; }
 #line 1361 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 30: /* params: fcall ',' params  */
+  case 30: /* params: fcall ',' params  */
 #line 139 "engines/private/grammar.y"
-        {
-            (yyval.narg) = (yyvsp[0].narg) + 1;
-        }
+                            { (yyval.narg) = (yyvsp[0].narg) + 1; }
 #line 1367 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 31: /* params: expr ',' params  */
+  case 31: /* params: expr ',' params  */
 #line 140 "engines/private/grammar.y"
-        {
-            (yyval.narg) = (yyvsp[0].narg) + 1;
-        }
+                            { (yyval.narg) = (yyvsp[0].narg) + 1; }
 #line 1373 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 32: /* params: expr  */
+  case 32: /* params: expr  */
 #line 141 "engines/private/grammar.y"
-        {
-            (yyval.narg) = 1;
-        }
+                      { (yyval.narg) = 1; }
 #line 1379 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 33: /* params: fcall  */
+  case 33: /* params: fcall  */
 #line 142 "engines/private/grammar.y"
-        {
-            (yyval.narg) = 1;
-        }
+                      { (yyval.narg) = 1; }
 #line 1385 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 34: /* value: NULLTOK  */
+  case 34: /* value: NULLTOK  */
 #line 145 "engines/private/grammar.y"
-        {
-            code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL));
-        }
+                   { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
 #line 1391 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 35: /* value: FALSETOK  */
+  case 35: /* value: FALSETOK  */
 #line 146 "engines/private/grammar.y"
-        {
-            code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL));
-        }
+                   { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
 #line 1397 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 36: /* value: TRUETOK  */
+  case 36: /* value: TRUETOK  */
 #line 147 "engines/private/grammar.y"
-        {
-            code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
-        }
+                   { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 1, NULL)); }
 #line 1403 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 37: /* value: NUM  */
+  case 37: /* value: NUM  */
 #line 148 "engines/private/grammar.y"
-        {
-            code2(Private::constpush, (Private::Inst)(yyvsp[0].sym));
-        }
+                   { code2(Private::constpush, (Private::Inst)(yyvsp[0].sym)); }
 #line 1409 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 38: /* value: STRING  */
+  case 38: /* value: STRING  */
 #line 149 "engines/private/grammar.y"
-        {
-            code2(Private::strpush, (Private::Inst)(yyvsp[0].sym));
-        }
+                   { code2(Private::strpush, (Private::Inst)(yyvsp[0].sym)); }
 #line 1415 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 39: /* value: NAME  */
+  case 39: /* value: NAME  */
 #line 150 "engines/private/grammar.y"
-        {
-            code1(Private::varpush);
-            code1((Private::Inst) lookupName((yyvsp[0].s)));
-            code1(Private::eval);
-        }
+                   { code1(Private::varpush); code1((Private::Inst) lookupName((yyvsp[0].s))); code1(Private::eval); }
 #line 1421 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 40: /* expr: value  */
+  case 40: /* expr: value  */
 #line 153 "engines/private/grammar.y"
-        {
-            (yyval.inst) = (yyvsp[0].inst);
-        }
+                          { (yyval.inst) = (yyvsp[0].inst); }
 #line 1427 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 41: /* expr: '!' value  */
+  case 41: /* expr: '!' value  */
 #line 154 "engines/private/grammar.y"
-        {
-            code1(Private::negate);
-            (yyval.inst) = (yyvsp[0].inst);
-        }
+                          { code1(Private::negate); (yyval.inst) = (yyvsp[0].inst); }
 #line 1433 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 42: /* expr: value EQ value  */
+  case 42: /* expr: value EQ value  */
 #line 155 "engines/private/grammar.y"
-        {
-            code1(Private::eq);
-        }
+                          { code1(Private::eq); }
 #line 1439 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 43: /* expr: value NEQ value  */
+  case 43: /* expr: value NEQ value  */
 #line 156 "engines/private/grammar.y"
-        {
-            code1(Private::ne);
-        }
+                          { code1(Private::ne); }
 #line 1445 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 44: /* expr: value '+' value  */
+  case 44: /* expr: value '+' value  */
 #line 157 "engines/private/grammar.y"
-        {
-            code1(Private::add);
-        }
+                          { code1(Private::add); }
 #line 1451 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 45: /* expr: value '<' value  */
+  case 45: /* expr: value '<' value  */
 #line 158 "engines/private/grammar.y"
-        {
-            code1(Private::lt);
-        }
+                          { code1(Private::lt); }
 #line 1457 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 46: /* expr: value '>' value  */
+  case 46: /* expr: value '>' value  */
 #line 159 "engines/private/grammar.y"
-        {
-            code1(Private::gt);
-        }
+                          { code1(Private::gt); }
 #line 1463 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 47: /* expr: value LTE value  */
+  case 47: /* expr: value LTE value  */
 #line 160 "engines/private/grammar.y"
-        {
-            code1(Private::le);
-        }
+                          { code1(Private::le); }
 #line 1469 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 48: /* expr: value GTE value  */
+  case 48: /* expr: value GTE value  */
 #line 161 "engines/private/grammar.y"
-        {
-            code1(Private::ge);
-        }
+                          { code1(Private::ge); }
 #line 1475 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 49: /* expr: value '+'  */
+  case 49: /* expr: value '+'  */
 #line 162 "engines/private/grammar.y"
-        {
-            (yyval.inst) = (yyvsp[-1].inst);
-        }
+                          { (yyval.inst) = (yyvsp[-1].inst); }
 #line 1481 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
-    case 50: /* expr: RANDOMTOK '(' NUM '%' ')'  */
+  case 50: /* expr: RANDOMTOK '(' NUM '%' ')'  */
 #line 163 "engines/private/grammar.y"
-        {
-            code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool);
-        }
+                                    { code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool); }
 #line 1487 "engines/private/grammar.tab.cpp"
-        break;
+    break;
 
 
 #line 1491 "engines/private/grammar.tab.cpp"
 
-    default:
-        break;
+      default: break;
     }
-    /* User semantic actions sometimes alter yychar, and that requires
-       that yytoken be updated with the new translation.  We take the
-       approach of translating immediately before every use of yytoken.
-       One alternative is translating here after every semantic action,
-       but that translation would be missed if the semantic action invokes
-       YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
-       if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
-       incorrect destructor might then be invoked immediately.  In the
-       case of YYERROR or YYBACKUP, subsequent parser actions might lead
-       to an incorrect destructor call or verbose syntax error message
-       before the lookahead is translated.  */
-    YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
-
-    YYPOPSTACK (yylen);
-    yylen = 0;
-
-    *++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.  */
-    {
-        const int yylhs = yyr1[yyn] - YYNTOKENS;
-        const int yyi = yypgoto[yylhs] + *yyssp;
-        yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
-                   ? yytable[yyi]
-                   : yydefgoto[yylhs]);
-    }
-
-    goto yynewstate;
-
-
-    /*--------------------------------------.
-    | yyerrlab -- here on detecting error.  |
-    `--------------------------------------*/
+  /* User semantic actions sometimes alter yychar, and that requires
+     that yytoken be updated with the new translation.  We take the
+     approach of translating immediately before every use of yytoken.
+     One alternative is translating here after every semantic action,
+     but that translation would be missed if the semantic action invokes
+     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
+     incorrect destructor might then be invoked immediately.  In the
+     case of YYERROR or YYBACKUP, subsequent parser actions might lead
+     to an incorrect destructor call or verbose syntax error message
+     before the lookahead is translated.  */
+  YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
+
+  YYPOPSTACK (yylen);
+  yylen = 0;
+
+  *++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.  */
+  {
+    const int yylhs = yyr1[yyn] - YYNTOKENS;
+    const int yyi = yypgoto[yylhs] + *yyssp;
+    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+               ? yytable[yyi]
+               : yydefgoto[yylhs]);
+  }
+
+  goto yynewstate;
+
+
+/*--------------------------------------.
+| yyerrlab -- here on detecting error.  |
+`--------------------------------------*/
 yyerrlab:
-    /* Make sure we have latest lookahead translation.  See comments at
-       user semantic actions for why this is necessary.  */
-    yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
-    /* If not already recovering from an error, report this error.  */
-    if (!yyerrstatus)
+  /* Make sure we have latest lookahead translation.  See comments at
+     user semantic actions for why this is necessary.  */
+  yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
+  /* If not already recovering from an error, report this error.  */
+  if (!yyerrstatus)
     {
-        ++yynerrs;
-        yyerror (YY_("syntax error"));
+      ++yynerrs;
+      yyerror (YY_("syntax error"));
     }
 
-    if (yyerrstatus == 3)
+  if (yyerrstatus == 3)
     {
-        /* If just tried and failed to reuse lookahead token after an
-           error, discard it.  */
+      /* If just tried and failed to reuse lookahead token after an
+         error, discard it.  */
 
-        if (yychar <= YYEOF)
+      if (yychar <= YYEOF)
         {
-            /* Return failure if at end of input.  */
-            if (yychar == YYEOF)
-                YYABORT;
+          /* Return failure if at end of input.  */
+          if (yychar == YYEOF)
+            YYABORT;
         }
-        else
+      else
         {
-            yydestruct ("Error: discarding",
-                        yytoken, &yylval);
-            yychar = YYEMPTY;
+          yydestruct ("Error: discarding",
+                      yytoken, &yylval);
+          yychar = YYEMPTY;
         }
     }
 
-    /* Else will try to reuse lookahead token after shifting the error
-       token.  */
-    goto yyerrlab1;
+  /* Else will try to reuse lookahead token after shifting the error
+     token.  */
+  goto yyerrlab1;
 
 
-    /*---------------------------------------------------.
-    | yyerrorlab -- error raised explicitly by YYERROR.  |
-    `---------------------------------------------------*/
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR.  |
+`---------------------------------------------------*/
 yyerrorlab:
-    /* Pacify compilers when the user code never invokes YYERROR and the
-       label yyerrorlab therefore never appears in user code.  */
-    if (0)
-        YYERROR;
-
-    /* Do not reclaim the symbols of the rule whose 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.  |
-    `-------------------------------------------------------------*/
+  /* Pacify compilers when the user code never invokes YYERROR and the
+     label yyerrorlab therefore never appears in user code.  */
+  if (0)
+    YYERROR;
+
+  /* Do not reclaim the symbols of the rule whose 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.  */
+  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
 
-    /* Pop stack until we find a state that shifts the error token.  */
-    for (;;)
+  /* Pop stack until we find a state that shifts the error token.  */
+  for (;;)
     {
-        yyn = yypact[yystate];
-        if (!yypact_value_is_default (yyn))
+      yyn = yypact[yystate];
+      if (!yypact_value_is_default (yyn))
         {
-            yyn += YYSYMBOL_YYerror;
-            if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
+          yyn += YYSYMBOL_YYerror;
+          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
             {
-                yyn = yytable[yyn];
-                if (0 < yyn)
-                    break;
+              yyn = yytable[yyn];
+              if (0 < yyn)
+                break;
             }
         }
 
-        /* Pop the current state because it cannot handle the error token.  */
-        if (yyssp == yyss)
-            YYABORT;
+      /* Pop the current state because it cannot handle the error token.  */
+      if (yyssp == yyss)
+        YYABORT;
 
 
-        yydestruct ("Error: popping",
-                    YY_ACCESSING_SYMBOL (yystate), yyvsp);
-        YYPOPSTACK (1);
-        yystate = *yyssp;
-        YY_STACK_PRINT (yyss, yyssp);
+      yydestruct ("Error: popping",
+                  YY_ACCESSING_SYMBOL (yystate), yyvsp);
+      YYPOPSTACK (1);
+      yystate = *yyssp;
+      YY_STACK_PRINT (yyss, yyssp);
     }
 
-    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-    *++yyvsp = yylval;
-    YY_IGNORE_MAYBE_UNINITIALIZED_END
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 
 
-    /* Shift the error token.  */
-    YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
+  /* Shift the error token.  */
+  YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
 
-    yystate = yyn;
-    goto yynewstate;
+  yystate = yyn;
+  goto yynewstate;
 
 
-    /*-------------------------------------.
-    | yyacceptlab -- YYACCEPT comes here.  |
-    `-------------------------------------*/
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here.  |
+`-------------------------------------*/
 yyacceptlab:
-    yyresult = 0;
-    goto yyreturn;
+  yyresult = 0;
+  goto yyreturn;
 
 
-    /*-----------------------------------.
-    | yyabortlab -- YYABORT comes here.  |
-    `-----------------------------------*/
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here.  |
+`-----------------------------------*/
 yyabortlab:
-    yyresult = 1;
-    goto yyreturn;
+  yyresult = 1;
+  goto yyreturn;
 
 
 #if !defined yyoverflow
-    /*-------------------------------------------------.
-    | yyexhaustedlab -- memory exhaustion comes here.  |
-    `-------------------------------------------------*/
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here.  |
+`-------------------------------------------------*/
 yyexhaustedlab:
-    yyerror (YY_("memory exhausted"));
-    yyresult = 2;
-    goto yyreturn;
+  yyerror (YY_("memory exhausted"));
+  yyresult = 2;
+  goto yyreturn;
 #endif
 
 
-    /*-------------------------------------------------------.
-    | yyreturn -- parsing is finished, clean up and return.  |
-    `-------------------------------------------------------*/
+/*-------------------------------------------------------.
+| yyreturn -- parsing is finished, clean up and return.  |
+`-------------------------------------------------------*/
 yyreturn:
-    if (yychar != YYEMPTY)
+  if (yychar != YYEMPTY)
     {
-        /* Make sure we have latest lookahead translation.  See comments at
-           user semantic actions for why this is necessary.  */
-        yytoken = YYTRANSLATE (yychar);
-        yydestruct ("Cleanup: discarding lookahead",
-                    yytoken, &yylval);
+      /* Make sure we have latest lookahead translation.  See comments at
+         user semantic actions for why this is necessary.  */
+      yytoken = YYTRANSLATE (yychar);
+      yydestruct ("Cleanup: discarding lookahead",
+                  yytoken, &yylval);
     }
-    /* Do not reclaim the symbols of the rule whose action triggered
-       this YYABORT or YYACCEPT.  */
-    YYPOPSTACK (yylen);
-    YY_STACK_PRINT (yyss, yyssp);
-    while (yyssp != yyss)
+  /* Do not reclaim the symbols of the rule whose action triggered
+     this YYABORT or YYACCEPT.  */
+  YYPOPSTACK (yylen);
+  YY_STACK_PRINT (yyss, yyssp);
+  while (yyssp != yyss)
     {
-        yydestruct ("Cleanup: popping",
-                    YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
-        YYPOPSTACK (1);
+      yydestruct ("Cleanup: popping",
+                  YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
+      YYPOPSTACK (1);
     }
 #ifndef yyoverflow
-    if (yyss != yyssa)
-        YYSTACK_FREE (yyss);
+  if (yyss != yyssa)
+    YYSTACK_FREE (yyss);
 #endif
 
-    return yyresult;
+  return yyresult;
 }
 
diff --git a/engines/private/grammar.tab.h b/engines/private/grammar.tab.h
index 6e82ff9616..35e067aca6 100644
--- a/engines/private/grammar.tab.h
+++ b/engines/private/grammar.tab.h
@@ -82,7 +82,7 @@ union YYSTYPE
 {
 #line 38 "engines/private/grammar.y"
 
-	struct Symbol	*sym;	/* symbol table pointer */
+	Private::Symbol	*sym;	/* symbol table pointer */
         int (**inst)();	/* machine instruction */
         char *s;
         int *i;
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index ff3663ee6a..1df0cb0ef5 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -36,7 +36,7 @@ int yywrap()
 %}
 
 %union {
-	struct Symbol	*sym;	/* symbol table pointer */
+	Private::Symbol	*sym;	/* symbol table pointer */
         int (**inst)();	/* machine instruction */
         char *s;
         int *i;
@@ -56,7 +56,7 @@ lines:   line lines
        ;
 
 line:     DEBUGTOK '{' debug '}'             { /* Not used in the game */ }
-        | DEFINETOK NAME '{' define '}'      { installall($NAME); }
+        | DEFINETOK NAME '{' define '}'      { installAll($NAME); }
         | SETTINGTOK NAME '{' statements '}' { saveSetting($NAME); initSetting(); }
         ;
 
@@ -69,9 +69,9 @@ statements:  /* nothing */     { $$ = progp; }
 
 
 statement: GOTOTOK NAME ';' {
-	code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, $NAME));
-        code2(constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
-        code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto")); 
+	code2(strpush, (Private::Inst) Private::constant(STRING, 0, $NAME));
+        code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
+        code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
         code1(funcpush);
         }
         | fcall ';'         { }   
@@ -105,29 +105,29 @@ define:  /* nothing */
         | NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  { 
           Common::Rect *r = new Common::Rect($5->u.val, $7->u.val, $9->u.val, $11->u.val);
           assert(r->isValidRect()); 
-          define($NAME, r); 
+          defineSymbol($NAME, r); 
           }
         | NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' {
           Common::Rect *r = new Common::Rect($5->u.val, $7->u.val, $9->u.val, $11->u.val);  
-          define($NAME, r); 
+          defineSymbol($NAME, r); 
           }
-        | NAME ',' define { define($NAME, NULL); }
-        | NAME            { define($NAME, NULL); }  
+        | NAME ',' define { defineSymbol($NAME, NULL); }
+        | NAME            { defineSymbol($NAME, NULL); }  
         ;
 
 fcall:    GOTOTOK '(' NAME ')' {
                                $$ = progp;
-                               code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, $NAME));
-                               code2(constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL));
-                               code2(strpush, (Private::Inst) Private::addconstant(STRING, 0, "goto")); 
+                               code2(strpush, (Private::Inst) Private::constant(STRING, 0, $NAME));
+                               code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
+                               code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
                                code1(funcpush);
                                }
 
         | RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' { $$ = progp; }
         | NAME '(' startp params ')'  {
                                $$ = $startp;
-                               code2(constpush, (Private::Inst) addconstant(NUM, $params, NULL));
-                               code2(strpush, (Private::Inst) addconstant(STRING, 0, $NAME)); 
+                               code2(constpush, (Private::Inst) constant(NUM, $params, NULL));
+                               code2(strpush, (Private::Inst) constant(STRING, 0, $NAME)); 
                                code1(funcpush);
                                }
         ;
@@ -142,9 +142,9 @@ params:   /* nothing */     { $$ = 0; }
         | fcall       { $$ = 1; }
         ;
 
-value:    NULLTOK  { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL)); }
-        | FALSETOK { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 0, NULL)); }
-        | TRUETOK  { code2(Private::constpush, (Private::Inst) Private::addconstant(NUM, 1, NULL)); }
+value:    NULLTOK  { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
+        | FALSETOK { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
+        | TRUETOK  { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 1, NULL)); }
         |  NUM     { code2(Private::constpush, (Private::Inst)$NUM); }
         | STRING   { code2(Private::strpush, (Private::Inst)$STRING); }
         | NAME     { code1(Private::varpush); code1((Private::Inst) lookupName($NAME)); code1(Private::eval); }
diff --git a/engines/private/lex.yy.cpp b/engines/private/lex.yy.cpp
index 98e2191c01..72ccf70850 100644
--- a/engines/private/lex.yy.cpp
+++ b/engines/private/lex.yy.cpp
@@ -34,7 +34,7 @@
 #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.
+ * if you want the limit (max/min) macros for int types. 
  */
 #ifndef __STDC_LIMIT_MACROS
 #define __STDC_LIMIT_MACROS 1
@@ -51,7 +51,7 @@ typedef uint32_t flex_uint32_t;
 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 char flex_uint8_t; 
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
 
@@ -162,10 +162,10 @@ 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)
-#define YY_LINENO_REWIND_TO(ptr)
-
+    
+    #define YY_LESS_LINENO(n)
+    #define YY_LINENO_REWIND_TO(ptr)
+    
 /* Return all but the first "n" matched characters back to the input stream. */
 #define yyless(n) \
 	do \
@@ -184,66 +184,66 @@ extern FILE *yyin, *yyout;
 #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.
-     */
-    int yy_buf_size;
-
-    /* Number of characters read into yy_ch_buf, not including EOB
-     * characters.
-     */
-    int 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;
+	{
+	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.
+	 */
+	int yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	int 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;
+	/* Whether to try to fill the input buffer when we reach the
+	 * end of it.
+	 */
+	int yy_fill_buffer;
 
-    int yy_buffer_status;
+	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.
-     */
+	/* 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. */
@@ -360,125 +360,125 @@ static void yynoreturn yy_fatal_error ( const char* msg  );
 /* 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;
-};
+	{
+	flex_int32_t yy_verify;
+	flex_int32_t yy_nxt;
+	};
 static const flex_int16_t yy_accept[78] =
-{   0,
-    0,    0,   24,   22,   21,   20,   20,   22,   22,   22,
-    22,   18,   22,   22,   22,   17,   17,   17,   17,   17,
-    17,   17,   17,   17,   17,   21,   20,    4,    0,   19,
-    18,    1,    2,    5,    3,   17,   17,   17,   17,   17,
-    17,   17,   17,   17,    9,   17,    1,   17,   17,   17,
-    17,   17,   17,   17,   17,   17,   17,   17,   15,   12,
-    17,   14,   17,   17,   10,   11,   17,   13,   17,    6,
-    17,   17,   16,    7,   17,    8,    0
-} ;
+    {   0,
+        0,    0,   24,   22,   21,   20,   20,   22,   22,   22,
+       22,   18,   22,   22,   22,   17,   17,   17,   17,   17,
+       17,   17,   17,   17,   17,   21,   20,    4,    0,   19,
+       18,    1,    2,    5,    3,   17,   17,   17,   17,   17,
+       17,   17,   17,   17,    9,   17,    1,   17,   17,   17,
+       17,   17,   17,   17,   17,   17,   17,   17,   15,   12,
+       17,   14,   17,   17,   10,   11,   17,   13,   17,    6,
+       17,   17,   16,    7,   17,    8,    0
+    } ;
 
 static const YY_CHAR yy_ec[256] =
-{   0,
-    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,    2,    5,    6,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    7,    1,    8,    9,    9,    9,
-    9,    9,    9,    9,    9,    9,    9,    1,    1,   10,
-    11,   12,    1,    1,   13,   14,   15,   14,   16,   17,
-    14,   14,   14,   14,   14,   18,   14,   19,   14,   14,
-    14,   20,   21,   22,   23,   14,   14,   14,   14,   14,
-    1,    1,    1,    1,   14,    1,   24,   25,   14,   26,
-
-    27,   28,   29,   14,   30,   14,   14,   31,   32,   33,
-    34,   14,   14,   14,   35,   36,   37,   14,   14,   14,
-    14,   14,    1,   38,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1
-} ;
+    {   0,
+        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,    2,    5,    6,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    7,    1,    8,    9,    9,    9,
+        9,    9,    9,    9,    9,    9,    9,    1,    1,   10,
+       11,   12,    1,    1,   13,   14,   15,   14,   16,   17,
+       14,   14,   14,   14,   14,   18,   14,   19,   14,   14,
+       14,   20,   21,   22,   23,   14,   14,   14,   14,   14,
+        1,    1,    1,    1,   14,    1,   24,   25,   14,   26,
+
+       27,   28,   29,   14,   30,   14,   14,   31,   32,   33,
+       34,   14,   14,   14,   35,   36,   37,   14,   14,   14,
+       14,   14,    1,   38,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    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 const YY_CHAR yy_meta[39] =
-{   0,
-    1,    1,    2,    3,    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,    1
-} ;
+    {   0,
+        1,    1,    2,    3,    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,    1
+    } ;
 
 static const flex_int16_t yy_base[81] =
-{   0,
-    0,    0,  105,  106,  102,   36,   38,   92,   96,   92,
-    92,   90,   87,   86,   85,    0,   82,   71,   27,   73,
-    65,   60,   56,   61,   61,   83,   41,  106,   76,  106,
-    72,    0,  106,  106,  106,    0,   60,   59,   60,   40,
-    49,   21,   36,   34,    0,   33,    0,   47,   49,   44,
-    39,   48,   26,   32,   34,   26,   23,   42,    0,    0,
-    23,    0,   27,   22,    0,    0,   24,    0,   21,    0,
-    25,   17,    0,    0,   19,    0,  106,   79,   43,   83
-} ;
+    {   0,
+        0,    0,  105,  106,  102,   36,   38,   92,   96,   92,
+       92,   90,   87,   86,   85,    0,   82,   71,   27,   73,
+       65,   60,   56,   61,   61,   83,   41,  106,   76,  106,
+       72,    0,  106,  106,  106,    0,   60,   59,   60,   40,
+       49,   21,   36,   34,    0,   33,    0,   47,   49,   44,
+       39,   48,   26,   32,   34,   26,   23,   42,    0,    0,
+       23,    0,   27,   22,    0,    0,   24,    0,   21,    0,
+       25,   17,    0,    0,   19,    0,  106,   79,   43,   83
+    } ;
 
 static const flex_int16_t yy_def[81] =
-{   0,
-    77,    1,   77,   77,   77,   77,   77,   77,   78,   77,
-    77,   77,   77,   77,   77,   79,   79,   79,   79,   79,
-    79,   79,   79,   79,   79,   77,   77,   77,   78,   77,
-    77,   80,   77,   77,   77,   79,   79,   79,   79,   79,
-    79,   79,   79,   79,   79,   79,   80,   79,   79,   79,
-    79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
-    79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
-    79,   79,   79,   79,   79,   79,    0,   77,   77,   77
-} ;
+    {   0,
+       77,    1,   77,   77,   77,   77,   77,   77,   78,   77,
+       77,   77,   77,   77,   77,   79,   79,   79,   79,   79,
+       79,   79,   79,   79,   79,   77,   77,   77,   78,   77,
+       77,   80,   77,   77,   77,   79,   79,   79,   79,   79,
+       79,   79,   79,   79,   79,   79,   80,   79,   79,   79,
+       79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
+       79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
+       79,   79,   79,   79,   79,   79,    0,   77,   77,   77
+    } ;
 
 static const flex_int16_t yy_nxt[145] =
-{   0,
-    4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
-    14,   15,   16,   16,   16,   16,   17,   16,   18,   19,
-    16,   20,   16,   16,   16,   21,   22,   16,   23,   24,
-    16,   16,   16,   16,   25,   16,   16,    7,   27,   27,
-    27,   27,   39,   27,   27,   53,   36,   76,   54,   75,
-    40,   74,   73,   72,   71,   70,   69,   68,   67,   66,
-    65,   64,   63,   62,   61,   60,   59,   58,   57,   56,
-    55,   52,   51,   27,   50,   27,   49,   48,   27,   29,
-    31,   30,   29,   47,   26,   47,   47,   46,   45,   44,
-    43,   42,   41,   38,   37,   35,   34,   33,   31,   32,
-
-    31,   30,   28,   26,   77,    3,   77,   77,   77,   77,
-    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-    77,   77,   77,   77
-} ;
+    {   0,
+        4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
+       14,   15,   16,   16,   16,   16,   17,   16,   18,   19,
+       16,   20,   16,   16,   16,   21,   22,   16,   23,   24,
+       16,   16,   16,   16,   25,   16,   16,    7,   27,   27,
+       27,   27,   39,   27,   27,   53,   36,   76,   54,   75,
+       40,   74,   73,   72,   71,   70,   69,   68,   67,   66,
+       65,   64,   63,   62,   61,   60,   59,   58,   57,   56,
+       55,   52,   51,   27,   50,   27,   49,   48,   27,   29,
+       31,   30,   29,   47,   26,   47,   47,   46,   45,   44,
+       43,   42,   41,   38,   37,   35,   34,   33,   31,   32,
+
+       31,   30,   28,   26,   77,    3,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77
+    } ;
 
 static const flex_int16_t yy_chk[145] =
-{   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,    6,    6,
-    7,    7,   19,   27,   27,   42,   79,   75,   42,   72,
-    19,   71,   69,   67,   64,   63,   61,   58,   57,   56,
-    55,   54,   53,   52,   51,   50,   49,   48,   46,   44,
-    43,   41,   40,    6,   39,    7,   38,   37,   27,   78,
-    31,   29,   78,   80,   26,   80,   80,   25,   24,   23,
-    22,   21,   20,   18,   17,   15,   14,   13,   12,   11,
-
-    10,    9,    8,    5,    3,   77,   77,   77,   77,   77,
-    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-    77,   77,   77,   77
-} ;
+    {   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,    6,    6,
+        7,    7,   19,   27,   27,   42,   79,   75,   42,   72,
+       19,   71,   69,   67,   64,   63,   61,   58,   57,   56,
+       55,   54,   53,   52,   51,   50,   49,   48,   46,   44,
+       43,   41,   40,    6,   39,    7,   38,   37,   27,   78,
+       31,   29,   78,   80,   26,   80,   80,   25,   24,   23,
+       22,   21,   20,   18,   17,   15,   14,   13,   12,   11,
+
+       10,    9,    8,    5,    3,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77
+    } ;
 
 static yy_state_type yy_last_accepting_state;
 static char *yy_last_accepting_cpos;
@@ -544,7 +544,7 @@ FILE *yyget_out ( void );
 
 void yyset_out  ( FILE * _out_str  );
 
-int yyget_leng ( void );
+			int yyget_leng ( void );
 
 char *yyget_text ( void );
 
@@ -565,9 +565,9 @@ extern int yywrap ( void );
 #endif
 
 #ifndef YY_NO_UNPUT
-
-static void yyunput ( int c, char *buf_ptr  );
-
+    
+    static void yyunput ( int c, char *buf_ptr  );
+    
 #endif
 
 #ifndef yytext_ptr
@@ -691,344 +691,341 @@ extern int yylex (void);
  */
 YY_DECL
 {
-    yy_state_type yy_current_state;
-    char *yy_cp, *yy_bp;
-    int yy_act;
-
-    if ( !(yy_init) )
-    {
-        (yy_init) = 1;
+	yy_state_type yy_current_state;
+	char *yy_cp, *yy_bp;
+	int yy_act;
+    
+	if ( !(yy_init) )
+		{
+		(yy_init) = 1;
 
 #ifdef YY_USER_INIT
-        YY_USER_INIT;
+		YY_USER_INIT;
 #endif
 
-        if ( ! (yy_start) )
-            (yy_start) = 1;	/* first start state */
+		if ( ! (yy_start) )
+			(yy_start) = 1;	/* first start state */
 
-        if ( ! yyin )
-            yyin = stdin;
+		if ( ! yyin )
+			yyin = stdin;
 
-        if ( ! yyout )
-            yyout = stdout;
+		if ( ! yyout )
+			yyout = stdout;
 
-        if ( ! YY_CURRENT_BUFFER ) {
-            yyensure_buffer_stack ();
-            YY_CURRENT_BUFFER_LVALUE =
-            yy_create_buffer( yyin, YY_BUF_SIZE );
-        }
+		if ( ! YY_CURRENT_BUFFER ) {
+			yyensure_buffer_stack ();
+			YY_CURRENT_BUFFER_LVALUE =
+				yy_create_buffer( yyin, YY_BUF_SIZE );
+		}
 
-        yy_load_buffer_state(  );
-    }
+		yy_load_buffer_state(  );
+		}
 
-    {
+	{
 #line 17 "engines/private/grammar.l"
 
 #line 727 "engines/private/lex.yy.cpp"
 
-        while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
-        {
-            yy_cp = (yy_c_buf_p);
+	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
+		{
+		yy_cp = (yy_c_buf_p);
 
-            /* Support of yytext. */
-            *yy_cp = (yy_hold_char);
+		/* 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_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_current_state = (yy_start);
 yy_match:
-            do
-            {
-                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 >= 78 )
-                        yy_c = yy_meta[yy_c];
-                }
-                yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-                ++yy_cp;
-            }
-            while ( yy_current_state != 77 );
-            yy_cp = (yy_last_accepting_cpos);
-            yy_current_state = (yy_last_accepting_state);
+		do
+			{
+			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 >= 78 )
+					yy_c = yy_meta[yy_c];
+				}
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+			++yy_cp;
+			}
+		while ( yy_current_state != 77 );
+		yy_cp = (yy_last_accepting_cpos);
+		yy_current_state = (yy_last_accepting_state);
 
 yy_find_action:
-            yy_act = yy_accept[yy_current_state];
+		yy_act = yy_accept[yy_current_state];
 
-            YY_DO_BEFORE_ACTION;
+		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
+		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 18 "engines/private/grammar.l"
-                /* ignoring the comment */
-                YY_BREAK
-            case 2:
-                YY_RULE_SETUP
+/* ignoring the comment */
+	YY_BREAK
+case 2:
+YY_RULE_SETUP
 #line 19 "engines/private/grammar.l"
-                return LTE;
-                YY_BREAK
-            case 3:
-                YY_RULE_SETUP
+return LTE;
+	YY_BREAK
+case 3:
+YY_RULE_SETUP
 #line 20 "engines/private/grammar.l"
-                return GTE;
-                YY_BREAK
-            case 4:
-                YY_RULE_SETUP
+return GTE;
+	YY_BREAK
+case 4:
+YY_RULE_SETUP
 #line 21 "engines/private/grammar.l"
-                return NEQ;
-                YY_BREAK
-            case 5:
-                YY_RULE_SETUP
+return NEQ;
+	YY_BREAK
+case 5:
+YY_RULE_SETUP
 #line 22 "engines/private/grammar.l"
-                return EQ;
-                YY_BREAK
-            case 6:
-                YY_RULE_SETUP
+return EQ;
+	YY_BREAK
+case 6:
+YY_RULE_SETUP
 #line 23 "engines/private/grammar.l"
-                return DEBUGTOK;
-                YY_BREAK
-            case 7:
-                YY_RULE_SETUP
+return DEBUGTOK;
+	YY_BREAK
+case 7:
+YY_RULE_SETUP
 #line 24 "engines/private/grammar.l"
-                return DEFINETOK;
-                YY_BREAK
-            case 8:
-                YY_RULE_SETUP
+return DEFINETOK;
+	YY_BREAK
+case 8:
+YY_RULE_SETUP
 #line 25 "engines/private/grammar.l"
-                return SETTINGTOK;
-                YY_BREAK
-            case 9:
-                YY_RULE_SETUP
+return SETTINGTOK;
+	YY_BREAK
+case 9:
+YY_RULE_SETUP
 #line 26 "engines/private/grammar.l"
-                return IFTOK;
-                YY_BREAK
-            case 10:
-                YY_RULE_SETUP
+return IFTOK;
+	YY_BREAK
+case 10:
+YY_RULE_SETUP
 #line 27 "engines/private/grammar.l"
-                return ELSETOK;
-                YY_BREAK
-            case 11:
-                YY_RULE_SETUP
+return ELSETOK;
+	YY_BREAK
+case 11:
+YY_RULE_SETUP
 #line 28 "engines/private/grammar.l"
-                return GOTOTOK;
-                YY_BREAK
-            case 12:
-                YY_RULE_SETUP
+return GOTOTOK;
+	YY_BREAK
+case 12:
+YY_RULE_SETUP
 #line 29 "engines/private/grammar.l"
-                return RECT;
-                YY_BREAK
-            case 13:
-                YY_RULE_SETUP
+return RECT;
+	YY_BREAK
+case 13:
+YY_RULE_SETUP
 #line 30 "engines/private/grammar.l"
-                return FALSETOK;
-                YY_BREAK
-            case 14:
-                YY_RULE_SETUP
+return FALSETOK;
+	YY_BREAK
+case 14:
+YY_RULE_SETUP
 #line 31 "engines/private/grammar.l"
-                return TRUETOK;
-                YY_BREAK
-            case 15:
-                YY_RULE_SETUP
+return TRUETOK;
+	YY_BREAK
+case 15:
+YY_RULE_SETUP
 #line 32 "engines/private/grammar.l"
-                return NULLTOK;
-                YY_BREAK
-            case 16:
-                YY_RULE_SETUP
+return NULLTOK;
+	YY_BREAK
+case 16:
+YY_RULE_SETUP
 #line 33 "engines/private/grammar.l"
-                return RANDOMTOK;
-                YY_BREAK
-            case 17:
-                YY_RULE_SETUP
+return RANDOMTOK;
+	YY_BREAK
+case 17:
+YY_RULE_SETUP
 #line 34 "engines/private/grammar.l"
-                yylval.s = strdup(yytext);
-                return NAME;
-                YY_BREAK
-            case 18:
-                YY_RULE_SETUP
+yylval.s = strdup(yytext); return NAME;
+	YY_BREAK
+case 18:
+YY_RULE_SETUP
 #line 35 "engines/private/grammar.l"
-                yylval.sym = Private::addconstant(NUM, atoi(yytext), NULL);
-                return NUM;
-                YY_BREAK
-            case 19:
-                YY_RULE_SETUP
+yylval.sym = Private::constant(NUM, atoi(yytext), NULL); return NUM;
+	YY_BREAK
+case 19:
+YY_RULE_SETUP
 #line 36 "engines/private/grammar.l"
-                yylval.sym = Private::addconstant(STRING, 0, strdup(yytext));
-                return STRING;
-                YY_BREAK
-            case 20:
-                /* rule 20 can match eol */
-                YY_RULE_SETUP
+yylval.sym = Private::constant(STRING, 0, strdup(yytext)); return STRING;
+	YY_BREAK
+case 20:
+/* rule 20 can match eol */
+YY_RULE_SETUP
 #line 37 "engines/private/grammar.l"
-                /* ignore return */;
-                YY_BREAK
-            case 21:
-                YY_RULE_SETUP
+/* ignore return */;
+	YY_BREAK
+case 21:
+YY_RULE_SETUP
 #line 38 "engines/private/grammar.l"
-                /* ignore whitespace */;
-                YY_BREAK
-            case 22:
-                YY_RULE_SETUP
+/* ignore whitespace */;
+	YY_BREAK
+case 22:
+YY_RULE_SETUP
 #line 39 "engines/private/grammar.l"
-                return *yytext;
-                YY_BREAK
-            case 23:
-                YY_RULE_SETUP
+return *yytext;
+	YY_BREAK
+case 23:
+YY_RULE_SETUP
 #line 40 "engines/private/grammar.l"
-                ECHO;
-                YY_BREAK
+ECHO;
+	YY_BREAK
 #line 896 "engines/private/lex.yy.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_last_accepting_cpos);
-                        yy_current_state = (yy_last_accepting_state);
-                        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 user's declarations */
+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_last_accepting_cpos);
+				yy_current_state = (yy_last_accepting_state);
+				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 user's declarations */
 } /* end of yylex */
 
 /* yy_get_next_buffer - try to read in a new buffer
@@ -1040,167 +1037,167 @@ do_action:	/* This label is used only to access EOF actions. */
  */
 static int yy_get_next_buffer (void)
 {
-    char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
-    char *source = (yytext_ptr);
-    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
-    {
-        int 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_LVALUE;
-
-            int yy_c_buf_p_offset =
-                (int) ((yy_c_buf_p) - b->yy_ch_buf);
-
-            if ( b->yy_is_our_buffer )
-            {
-                int 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,
-                                          (yy_size_t) (b->yy_buf_size + 2)  );
-            }
-            else
-                /* Can't grow it, we don't own it. */
-                b->yy_ch_buf = NULL;
-
-            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_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
-        /* Extend the array by 50%, plus the number we really need. */
-        int 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, (yy_size_t) new_size  );
-        if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-            YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
-        /* "- 2" to take care of EOB's */
-        YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
-    }
+    	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+	char *source = (yytext_ptr);
+	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
+		{
+			int 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_LVALUE;
+
+			int yy_c_buf_p_offset =
+				(int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+			if ( b->yy_is_our_buffer )
+				{
+				int 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,
+							 (yy_size_t) (b->yy_buf_size + 2)  );
+				}
+			else
+				/* Can't grow it, we don't own it. */
+				b->yy_ch_buf = NULL;
+
+			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_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+		/* Extend the array by 50%, plus the number we really need. */
+		int 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, (yy_size_t) new_size  );
+		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+		/* "- 2" to take care of EOB's */
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
+	}
 
-    (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;
+	(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];
+	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
 
-    return ret_val;
+	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)
+    static yy_state_type yy_get_previous_state (void)
 {
-    yy_state_type yy_current_state;
-    char *yy_cp;
-
-    yy_current_state = (yy_start);
-
-    for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
-    {
-        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 >= 78 )
-                yy_c = yy_meta[yy_c];
-        }
-        yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-    }
-
-    return yy_current_state;
+	yy_state_type yy_current_state;
+	char *yy_cp;
+    
+	yy_current_state = (yy_start);
+
+	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+		{
+		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 >= 78 )
+				yy_c = yy_meta[yy_c];
+			}
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+		}
+
+	return yy_current_state;
 }
 
 /* yy_try_NUL_trans - try to make a transition on the NUL character
@@ -1208,359 +1205,359 @@ static yy_state_type yy_get_previous_state (void)
  * synopsis
  *	next_state = yy_try_NUL_trans( current_state );
  */
-static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
+    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
 {
-    int yy_is_jam;
-    char *yy_cp = (yy_c_buf_p);
-
-    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 >= 78 )
-            yy_c = yy_meta[yy_c];
-    }
-    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-    yy_is_jam = (yy_current_state == 77);
-
-    return yy_is_jam ? 0 : yy_current_state;
+	int yy_is_jam;
+    	char *yy_cp = (yy_c_buf_p);
+
+	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 >= 78 )
+			yy_c = yy_meta[yy_c];
+		}
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+	yy_is_jam = (yy_current_state == 77);
+
+		return yy_is_jam ? 0 : yy_current_state;
 }
 
 #ifndef YY_NO_UNPUT
 
-static void yyunput (int c, char * yy_bp )
+    static void yyunput (int c, char * yy_bp )
 {
-    char *yy_cp;
-
+	char *yy_cp;
+    
     yy_cp = (yy_c_buf_p);
 
-    /* undo effects of setting up yytext */
-    *yy_cp = (yy_hold_char);
+	/* 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. */
-        int number_to_move = (yy_n_chars) + 2;
-        char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
-                  YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
-        char *source =
-            &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+		{ /* need to shift things up to make room */
+		/* +2 for EOB chars. */
+		int number_to_move = (yy_n_chars) + 2;
+		char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+		char *source =
+				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
 
-        while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-            *--dest = *--source;
+		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) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+		yy_cp += (int) (dest - source);
+		yy_bp += (int) (dest - source);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+			(yy_n_chars) = (int) 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" );
-    }
+		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+			YY_FATAL_ERROR( "flex scanner push-back overflow" );
+		}
 
-    *--yy_cp = (char) c;
+	*--yy_cp = (char) c;
 
-    (yytext_ptr) = yy_bp;
-    (yy_hold_char) = *yy_cp;
-    (yy_c_buf_p) = yy_cp;
+	(yytext_ptr) = yy_bp;
+	(yy_hold_char) = *yy_cp;
+	(yy_c_buf_p) = yy_cp;
 }
 
 #endif
 
 #ifndef YY_NO_INPUT
 #ifdef __cplusplus
-static int yyinput (void)
+    static int yyinput (void)
 #else
-static int input  (void)
+    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 */
-            int offset = (int) ((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;
+	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 */
+			int offset = (int) ((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();
+					return yyinput();
 #else
-                return input();
+					return input();
 #endif
-            }
+					}
 
-            case EOB_ACT_CONTINUE_SCAN:
-                (yy_c_buf_p) = (yytext_ptr) + offset;
-                break;
-            }
-        }
-    }
+				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);
+	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;
+	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 )
+    void yyrestart  (FILE * input_file )
 {
-
-    if ( ! YY_CURRENT_BUFFER ) {
+    
+	if ( ! YY_CURRENT_BUFFER ){
         yyensure_buffer_stack ();
-        YY_CURRENT_BUFFER_LVALUE =
+		YY_CURRENT_BUFFER_LVALUE =
             yy_create_buffer( yyin, YY_BUF_SIZE );
-    }
+	}
 
-    yy_init_buffer( YY_CURRENT_BUFFER, input_file );
-    yy_load_buffer_state(  );
+	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 )
+    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.
+    
+	/* TODO. We should be able to replace this entire function body
+	 * with
+	 *		yypop_buffer_state();
+	 *		yypush_buffer_state(new_buffer);
      */
-    (yy_did_buffer_switch_on_eof) = 1;
+	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);
+    	(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 yy_create_buffer  (FILE * file, int  size )
 {
-    YY_BUFFER_STATE b;
+	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_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;
 
-    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( (yy_size_t) (b->yy_buf_size + 2)  );
-    if ( ! b->yy_ch_buf )
-        YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+	/* 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( (yy_size_t) (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;
+	b->yy_is_our_buffer = 1;
 
-    yy_init_buffer( b, file );
+	yy_init_buffer( b, file );
 
-    return b;
+	return b;
 }
 
 /** Destroy the buffer.
  * @param b a buffer created with yy_create_buffer()
- *
+ * 
  */
-void yy_delete_buffer (YY_BUFFER_STATE  b )
+    void yy_delete_buffer (YY_BUFFER_STATE  b )
 {
+    
+	if ( ! b )
+		return;
 
-    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_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  );
+	if ( b->yy_is_our_buffer )
+		yyfree( (void *) b->yy_ch_buf  );
 
-    yyfree( (void *) b  );
+	yyfree( (void *) b  );
 }
 
 /* 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 )
+    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
 
 {
-    int oerrno = errno;
+	int oerrno = errno;
+    
+	yy_flush_buffer( b );
 
-    yy_flush_buffer( b );
-
-    b->yy_input_file = file;
-    b->yy_fill_buffer = 1;
+	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) {
+    if (b != YY_CURRENT_BUFFER){
         b->yy_bs_lineno = 1;
         b->yy_bs_column = 0;
     }
 
-    b->yy_is_interactive = 0;
-
-    errno = oerrno;
+        b->yy_is_interactive = 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 )
+    void yy_flush_buffer (YY_BUFFER_STATE  b )
 {
-    if ( ! b )
-        return;
+    	if ( ! b )
+		return;
 
-    b->yy_n_chars = 0;
+	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;
+	/* 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_buf_pos = &b->yy_ch_buf[0];
 
-    b->yy_at_bol = 1;
-    b->yy_buffer_status = YY_BUFFER_NEW;
+	b->yy_at_bol = 1;
+	b->yy_buffer_status = YY_BUFFER_NEW;
 
-    if ( b == YY_CURRENT_BUFFER )
-        yy_load_buffer_state(  );
+	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;
+    	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;
+    	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);
+	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;
-    }
+	if (YY_CURRENT_BUFFER) {
+		yy_load_buffer_state(  );
+		(yy_did_buffer_switch_on_eof) = 1;
+	}
 }
 
 /* Allocates the stack if it does not exist.
@@ -1568,131 +1565,131 @@ void yypop_buffer_state (void)
  */
 static void yyensure_buffer_stack (void)
 {
-    yy_size_t num_to_alloc;
-
-    if (!(yy_buffer_stack)) {
+	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.
+		/* 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; /* After all that talk, this was set to 1 anyways... */
-        (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;
-    }
+      num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
+		(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) {
+	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
 
-        /* Increase the buffer to prepare for a possible push. */
-        yy_size_t grow_size = 8 /* arbitrary grow size */;
+		/* Increase the buffer to prepare for a possible push. */
+		yy_size_t 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()" );
+		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;
-    }
+		/* 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 NULL;
-
-    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 = (int) (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 = NULL;
-    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;
+	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 NULL;
+
+	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 = (int) (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 = NULL;
+	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 (const char * yystr )
 {
-
-    return yy_scan_bytes( yystr, (int) strlen(yystr) );
+    
+	return yy_scan_bytes( yystr, (int) 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 yybytes the byte buffer to scan
  * @param _yybytes_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  (const char * yybytes, int  _yybytes_len )
 {
-    YY_BUFFER_STATE b;
-    char *buf;
-    yy_size_t n;
-    int i;
-
-    /* Get memory for full buffer, including space for trailing EOB's. */
-    n = (yy_size_t) (_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;
+	YY_BUFFER_STATE b;
+	char *buf;
+	yy_size_t n;
+	int i;
+    
+	/* Get memory for full buffer, including space for trailing EOB's. */
+	n = (yy_size_t) (_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
@@ -1701,8 +1698,8 @@ YY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len )
 
 static void yynoreturn yy_fatal_error (const char* msg )
 {
-    fprintf( stderr, "%s\n", msg );
-    exit( YY_EXIT_FAILURE );
+			fprintf( stderr, "%s\n", msg );
+	exit( YY_EXIT_FAILURE );
 }
 
 /* Redefine yyless() so it works in section 3 code. */
@@ -1725,88 +1722,88 @@ static void yynoreturn yy_fatal_error (const char* msg )
 /* 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;
+        return yyin;
 }
 
 /** Get the output stream.
- *
+ * 
  */
 FILE *yyget_out  (void)
 {
-    return yyout;
+        return yyout;
 }
 
 /** Get the length of the current token.
- *
+ * 
  */
 int yyget_leng  (void)
 {
-    return yyleng;
+        return yyleng;
 }
 
 /** Get the current token.
- *
+ * 
  */
 
 char *yyget_text  (void)
 {
-    return yytext;
+        return yytext;
 }
 
 /** Set the current line number.
  * @param _line_number 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 ;
+        yyin = _in_str ;
 }
 
 void yyset_out (FILE *  _out_str )
 {
-    yyout = _out_str ;
+        yyout = _out_str ;
 }
 
 int yyget_debug  (void)
 {
-    return yy_flex_debug;
+        return yy_flex_debug;
 }
 
 void yyset_debug (int  _bdebug )
 {
-    yy_flex_debug = _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.
-    */
+        /* 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) = NULL;
     (yy_buffer_stack_top) = 0;
@@ -1815,7 +1812,7 @@ static int yy_init_globals (void)
     (yy_init) = 0;
     (yy_start) = 0;
 
-    /* Defined in main.c */
+/* Defined in main.c */
 #ifdef YY_STDINIT
     yyin = stdin;
     yyout = stdout;
@@ -1833,17 +1830,17 @@ static int yy_init_globals (void)
 /* 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();
-    }
+	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;
+	/* 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. */
@@ -1859,45 +1856,45 @@ int yylex_destroy  (void)
 #ifndef yytext_ptr
 static void yy_flex_strncpy (char* s1, const char * s2, int n )
 {
-
-    int i;
-    for ( i = 0; i < n; ++i )
-        s1[i] = s2[i];
+		
+	int i;
+	for ( i = 0; i < n; ++i )
+		s1[i] = s2[i];
 }
 #endif
 
 #ifdef YY_NEED_STRLEN
 static int yy_flex_strlen (const char * s )
 {
-    int n;
-    for ( n = 0; s[n]; ++n )
-        ;
+	int n;
+	for ( n = 0; s[n]; ++n )
+		;
 
-    return n;
+	return n;
 }
 #endif
 
 void *yyalloc (yy_size_t  size )
 {
-    return malloc(size);
+			return 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 realloc(ptr, 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 realloc(ptr, size);
 }
 
 void yyfree (void * ptr )
 {
-    free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
+			free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
 }
 
 #define YYTABLES_NAME "yytables"
@@ -1910,26 +1907,20 @@ extern int yydebug;
 namespace Private {
 
 int parse(char *code) {
+	
+	initSetting();
 
-    initSetting();
-    //_lines[0] = _lines[1] = _lines[2] = code;
+	YY_BUFFER_STATE bp;
 
-    YY_BUFFER_STATE bp;
+	yydebug = 1;
+	yy_delete_buffer(YY_CURRENT_BUFFER);
 
-    //if (debugChannelSet(-1, kDebugParse))
-    yydebug = 1;
-    //else
-    //	yydebug = 0;
+	bp = yy_scan_string(code);
+	yy_switch_to_buffer(bp);
+	yyparse();
+	yy_delete_buffer(bp);
 
-    yy_delete_buffer(YY_CURRENT_BUFFER);
-
-    bp = yy_scan_string(code);
-    yy_switch_to_buffer(bp);
-    yyparse();
-    //execute(prog);
-    yy_delete_buffer(bp);
-
-    return 0;
+	return 0;
 }
 
 } // End of namespace Private
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 71069f956f..ffc90d9124 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -9,14 +9,13 @@ ConstantList constants;
 StringQueue stringToDefine;
 RectQueue rectToDefine;
 
-void define(char *n, Common::Rect *r) {
+void defineSymbol(char *n, Common::Rect *r) {
     Common::String *s = new Common::String(n);
     stringToDefine.push(*s);
     rectToDefine.push(r);
 }
 
-char *emalloc(unsigned n)	/* check return from malloc */
-{
+char *emalloc(unsigned n) {
     char *p;
 
     p = (char*) malloc(n);
@@ -24,8 +23,7 @@ char *emalloc(unsigned n)	/* check return from malloc */
     return p;
 }
 
-void showSymbol(Symbol *s)
-{
+void showSymbol(Symbol *s) {
     if (s->type == NUM)
         debug("%s %d",s->name->c_str(), s->u.val);
     else if (s->type == STRING)
@@ -41,8 +39,8 @@ void setSymbol(Symbol *s, int v) {
     s->u.val = v;
 }
 
-Symbol *lookup(Common::String s, SymbolMap symlist)	/* find s in symbol table symlist */
-{
+/* find s in symbol table symlist */
+Symbol *lookup(Common::String s, SymbolMap symlist)	 {
     //debug("looking up %s", s.c_str());
     Symbol *r = symlist.getVal(s);
     /*if (strcmp(s.c_str(), "m_640x480") == 0) {
@@ -53,8 +51,8 @@ Symbol *lookup(Common::String s, SymbolMap symlist)	/* find s in symbol table sy
     return r;
 }
 
-Symbol *lookupName(char *n)  /* install s in some symbol table */
-{
+/* lookup some name in some symbol table */
+Symbol *lookupName(char *n) {
     //debug("looking up %s", n);
     Common::String *s = new Common::String(n);
 
@@ -75,15 +73,13 @@ Symbol *lookupName(char *n)  /* install s in some symbol table */
 
     else {
         debug("WARNING: %s not defined", n);
-        return addconstant(NAME, 0, n);
+        return constant(NAME, 0, n);
     }
 
 }
 
 
-
-
-void installall(char *n) {
+void installAll(char *n) {
     Common::String *s;
     Common::Rect *r;
 
@@ -125,8 +121,7 @@ void installall(char *n) {
 
 }
 
-Symbol *addconstant(int t, int d, char *s)
-{
+Symbol *constant(int t, int d, char *s) {
     Symbol *sp;
     Common::String *n = new Common::String("<constant>");
 
@@ -144,9 +139,8 @@ Symbol *addconstant(int t, int d, char *s)
     return sp;
 }
 
-
-Symbol *install(Common::String *n, int t, int d, char *s, Common::Rect *r, SymbolMap *symlist)  /* install s in symbol table */
-{
+/* install some symbol s in a symbol table */
+Symbol *install(Common::String *n, int t, int d, char *s, Common::Rect *r, SymbolMap *symlist) {
     Common::String *name = new Common::String(*n);
 
     Symbol *sp;
diff --git a/engines/private/symbol.h b/engines/private/symbol.h
new file mode 100644
index 0000000000..acac1c40fc
--- /dev/null
+++ b/engines/private/symbol.h
@@ -0,0 +1,44 @@
+#include "common/str.h"
+#include "common/hash-str.h"
+#include "common/hash-ptr.h"
+#include "common/queue.h"
+#include "common/list.h"
+#include "common/array.h"
+#include "common/rect.h"
+
+#ifndef PRIVATE_SYMBOL_H
+#define PRIVATE_SYMBOL_H
+
+namespace Private {
+
+typedef struct Symbol {	/* symbol table entry */
+	Common::String *name;
+	short	type;	/* NAME, NUM, STRING or RECT  */
+	union {
+		int	val;	    /* NAME or NUM */
+		char	*str;	    /* STRING */
+		Common::Rect *rect; /* RECT */
+	} u;
+} Symbol;
+
+// Symbols
+
+extern void showSymbol(Symbol *);
+extern void setSymbol(Symbol *, int);
+
+typedef Common::HashMap<Common::String, Symbol*> SymbolMap;
+typedef Common::List<Symbol*> ConstantList;
+
+extern SymbolMap settings, variables, cursors, locations, rects;
+extern ConstantList constants;
+
+extern void     defineSymbol(char *, Common::Rect *); 
+extern Symbol  *install(Common::String *, int, int, char *, Common::Rect *, SymbolMap*);
+extern Symbol  *lookupName(char *);
+extern Symbol  *constant(int, int, char *);
+extern void     installAll(char *);
+extern Symbol  *lookup(Common::String, SymbolMap);
+
+}
+
+#endif
\ No newline at end of file


Commit: dca4b7aa2c4107150ee257ac583cc9eb10fd6bb7
    https://github.com/scummvm/scummvm/commit/dca4b7aa2c4107150ee257ac583cc9eb10fd6bb7
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: basic save game support

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h
    engines/private/symbol.cpp
    engines/private/symbol.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 0fe5966c5b..40be03b159 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -44,9 +44,8 @@ void initInsts() {
     }
 }
 
-
-void initSetting()	/* initialize for code generation */
-{
+/* initialize for code generation */ 
+void initSetting() {
     setting = (Setting*) malloc(sizeof(Setting));
     memset((void *) setting, 0, sizeof(Setting));
 
@@ -57,15 +56,12 @@ void initSetting()	/* initialize for code generation */
     progp = prog;
 }
 
-void saveSetting(char *name)
-{
+void saveSetting(char *name) {
     Common::String s(name);
     settingMap.setVal(s, setting);
-    //debug("setting %s", name);
 }
 
-void loadSetting(Common::String *name)
-{
+void loadSetting(Common::String *name) {
     assert(settingMap.contains(*name));
     setting = settingMap.getVal(*name);
 
@@ -77,7 +73,6 @@ void loadSetting(Common::String *name)
     stackp = stack;
     progp = prog;
 
-
     /*for (Inst *pc_ = progp; pc_-progp < 100; pc_++) {
         if (_functions.contains((void *) *pc_))
             debug("%p: %s", (void*) pc_, _functions.getVal((void*) *pc_)->c_str());
@@ -90,22 +85,21 @@ void loadSetting(Common::String *name)
     }*/
 }
 
-
-int push(Datum d)		/* push d onto stack */
-{
+/* push d onto stack */ 
+int push(Datum d) {
     assert (!(stackp >= &stack[NSTACK]));
     *stackp++ = d;
     return 0;
 }
 
-Datum pop()	/* pop and return top elem from stack */
-{
+/* pop and return top elem from stack */
+Datum pop()	{
     assert (!(stackp <= stack));
     return *--stackp;
 }
 
-int constpush()	/* push constant onto stack */
-{
+/* push constant onto stack */ 
+int constpush()	{
     Datum d;
     Symbol *s = (Symbol *)*pc++;
     d.type = NUM;
@@ -155,10 +149,8 @@ int funcpush() //(char *name, int nargs)
     return 0;
 }
 
-
-
-int eval()		/* evaluate variable on stack */
-{
+/* evaluate variable on stack */ 
+int eval() {
     Datum d;
     d = pop();
     debug("eval %s", d.u.sym->name->c_str());
@@ -180,13 +172,12 @@ int eval()		/* evaluate variable on stack */
     else
         assert(0);
 
-
     push(d);
     return 0;
 }
 
-int add()		/* add top two elems on stack */
-{
+/* add top two elems on stack */ 
+int add() {
     Datum d1, d2;
     d2 = pop();
     d1 = pop();
@@ -213,8 +204,7 @@ int add()		/* add top two elems on stack */
     return 0;
 }
 
-int negate()
-{
+int negate() {
     Datum d;
     d = pop();
     int v;
@@ -234,8 +224,7 @@ int negate()
     return 0;
 }
 
-int gt()
-{
+int gt() {
     Datum d1, d2;
     d2 = pop();
     d1 = pop();
@@ -253,14 +242,12 @@ int gt()
         d2.type = NUM;
     }
 
-
     d1.u.val = (int)(d1.u.val > d2.u.val);
     push(d1);
     return 0;
 }
 
-int lt()
-{
+int lt() {
     Datum d1, d2;
     d2 = pop();
     d1 = pop();
@@ -284,8 +271,7 @@ int lt()
     return 0;
 }
 
-int ge()
-{
+int ge() {
     Datum d1, d2;
     d2 = pop();
     d1 = pop();
@@ -309,8 +295,7 @@ int ge()
     return 0;
 }
 
-int le()
-{
+int le() {
     Datum d1, d2;
     d2 = pop();
     d1 = pop();
@@ -334,8 +319,7 @@ int le()
     return 0;
 }
 
-int eq()
-{
+int eq() {
     Datum d1, d2;
     d2 = pop();
     d1 = pop();
@@ -359,8 +343,7 @@ int eq()
     return 0;
 }
 
-int ne()
-{
+int ne() {
     Datum d1, d2;
     d2 = pop();
     d1 = pop();
@@ -384,8 +367,8 @@ int ne()
     return 0;
 }
 
-Inst *code(Inst f)	/* install one instruction or operand */
-{
+/* install one instruction or operand */ 
+Inst *code(Inst f) {
     //debug("pushing code at %d", progp);
     Inst *oprogp = progp;
     assert (!(progp >= &prog[NPROG]));
@@ -393,8 +376,7 @@ Inst *code(Inst f)	/* install one instruction or operand */
     return oprogp;
 }
 
-int ifcode()
-{
+int ifcode() {
     Datum d;
     Inst *savepc = pc;	/* then part */
     debug("ifcode: evaluating condition");
@@ -408,11 +390,7 @@ int ifcode()
         debug("name %s", d.u.sym->name->c_str()); //, d.sym->u.val);
         d.u.val = d.u.sym->u.val;
     }
-    //debug("ptr: %x", *((Inst **)(savepc+1)));
-    //debug("ptr: %x", *((Inst **)(savepc+2)));
-    //debug("ptr: %x", *((Inst **)(savepc+3)));
 
-    //assert(0);
     if (d.u.val) {
         debug("ifcode: true branch");
         execute(*((Inst **)(savepc)));
@@ -426,8 +404,7 @@ int ifcode()
     return 0;
 }
 
-int randbool()
-{
+int randbool() {
     Datum d;
     d = pop();
 
@@ -438,14 +415,13 @@ int randbool()
     return 0;
 }
 
-int fail()
-{
+int fail() {
     assert(0);
     return 0;
 }
 
-void execute(Inst *p)	/* run the machine */
-{
+/* run the machine */ 
+void execute(Inst *p) {
     for (pc = p; *pc != STOP; ) {
         (*(*pc++))();
     }
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index b3b4b46fb1..b5c08f0d0b 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -56,10 +56,24 @@ void Quit(ArgArray args) {
     g_private->quitGame();
 }
 
-
 void LoadGame(ArgArray args) {
     // assert types
-    debug("WARNING: RestartGame is not implemented");
+    debug("LoadGame(%s, %s)", args[0].u.str, args[2].u.sym->name->c_str());
+    Common::String *s = new Common::String(args[0].u.str);
+    MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+    m->surf = g_private->loadMask(*s, 0, 0, true);
+    m->cursor = args[2].u.sym->name;
+    g_private->_loadGameMask = m;
+}
+
+void SaveGame(ArgArray args) {
+    // assert types
+    debug("SaveGame(%s, %s)", args[0].u.str, args[1].u.sym->name->c_str());
+    Common::String *s = new Common::String(args[0].u.str);
+    MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+    m->surf = g_private->loadMask(*s, 0, 0, true);
+    m->cursor = args[1].u.sym->name;
+    g_private->_saveGameMask = m;
 }
 
 void RestartGame(ArgArray args) {
@@ -320,6 +334,13 @@ void SoundArea(ArgArray args) {
     debug("WARNING: SoundArea not implemented!");
 }
 
+void AskSave(ArgArray args) {
+    // This is not needed, since scummvm will take care of this
+    debug("WARNING: AskSave is partially implemented");
+    Common::String *s = new Common::String(args[0].u.str);
+    g_private->_nextSetting = s;
+}
+
 void Timer(ArgArray args) {
     assert (args.size() == 2 || args.size() == 3);
 
@@ -369,6 +390,9 @@ static struct FuncTable {
     { Exit,            "Exit"},
     { Quit,            "Quit"},
     { LoadGame,        "LoadGame"},
+    { SaveGame,        "SaveGame"},
+    { AskSave,         "AskSave"},
+    
     { DossierAdd,      "DossierAdd"},
     { Inventory,       "Inventory"},
     { CRect,           "CRect"},
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 3357f3ba22..a04886fe2f 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -12,7 +12,7 @@
 #include "common/fs.h"
 #include "common/system.h"
 #include "common/str.h"
-
+#include "common/savefile.h"
 #include "engines/util.h"
 
 #include "image/bmp.h"
@@ -52,6 +52,9 @@ PrivateEngine::PrivateEngine(OSystem *syst)
 
     g_private = this;
 
+    _saveGameMask = NULL;
+    _loadGameMask = NULL;
+    
     _nextSetting = NULL;
     _nextMovie = NULL;
     _modified = false;
@@ -132,7 +135,12 @@ Common::Error PrivateEngine::run() {
     Common::Point mousePos;
     _videoDecoder = nullptr; //new Video::SmackerDecoder();
 
-    _nextSetting = new Common::String("kGoIntro");
+    int saveSlot = ConfMan.hasKey("save_slot");
+    if (saveSlot >= 0) { // load the savegame
+        loadGameState(saveSlot);
+    } else {
+        _nextSetting = new Common::String("kGoIntro");
+    }
 
     while (!shouldQuit()) {
         if (_mode == 1)
@@ -152,6 +160,8 @@ Common::Error PrivateEngine::run() {
                 break;
 
             case Common::EVENT_LBUTTONDOWN:
+                selectLoadGame(mousePos);
+                selectSaveGame(mousePos);
                 selectMask(mousePos);
                 if (!_nextSetting)
                     selectExit(mousePos);
@@ -161,6 +171,9 @@ Common::Error PrivateEngine::run() {
                 CursorMan.replaceCursor(_cursors.getVal("default"), 11, 16, 0, 0, 0, true);
                 cursorExit(mousePos);
                 cursorMask(mousePos);
+                cursorLoadGame(mousePos);
+                cursorSaveGame(mousePos);
+                
                 //
                 break;
 
@@ -195,6 +208,8 @@ Common::Error PrivateEngine::run() {
             debug("Executing %s", _nextSetting->c_str());
             _exits.clear();
             _masks.clear();
+            _loadGameMask = NULL;
+            _saveGameMask = NULL;
             loadSetting(_nextSetting);
             _nextSetting = NULL;
             //CursorMan.showMouse(false);
@@ -264,7 +279,6 @@ bool PrivateEngine::cursorMask(Common::Point mousePos) {
     return inside;
 }
 
-
 void PrivateEngine::selectExit(Common::Point mousePos) {
     //debug("Mousepos %d %d", mousePos.x, mousePos.y);
     mousePos = mousePos - *_origin;
@@ -328,6 +342,76 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
     }
 }
 
+void PrivateEngine::selectLoadGame(Common::Point mousePos) {
+    if (_loadGameMask == NULL)
+        return;
+    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
+    mousePos = mousePos - *_origin;
+    if (mousePos.x < 0 || mousePos.y < 0)
+        return;
+
+    //debug("Testing mask %s", m.nextSetting->c_str());
+    if ( *((uint32*) _loadGameMask->surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
+        //debug("loadGame!");
+        loadGameDialog();
+    }
+
+}
+
+bool PrivateEngine::cursorLoadGame(Common::Point mousePos) {
+    if (_loadGameMask == NULL)
+        return false;
+    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
+    mousePos = mousePos - *_origin;
+    if (mousePos.x < 0 || mousePos.y < 0)
+        return false;
+
+    if (mousePos.x > _loadGameMask->surf->h || mousePos.y > _loadGameMask->surf->w)
+        return false;
+
+    if ( *((uint32*) _loadGameMask->surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
+        assert(_cursors.contains(*_loadGameMask->cursor));
+        CursorMan.replaceCursor(_cursors.getVal(*_loadGameMask->cursor), 32, 32, 0, 0, 0, true);
+        return true;
+    }
+    return false;
+}
+
+void PrivateEngine::selectSaveGame(Common::Point mousePos) {
+    if (_saveGameMask == NULL)
+        return;
+    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
+    mousePos = mousePos - *_origin;
+    if (mousePos.x < 0 || mousePos.y < 0)
+        return;
+
+    //debug("Testing mask %s", m.nextSetting->c_str());
+    if ( *((uint32*) _saveGameMask->surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
+        saveGameDialog();
+    }
+
+}
+
+bool PrivateEngine::cursorSaveGame(Common::Point mousePos) {
+    if (_saveGameMask == NULL)
+        return false;
+    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
+    mousePos = mousePos - *_origin;
+    if (mousePos.x < 0 || mousePos.y < 0)
+        return false;
+
+    if (mousePos.x > _saveGameMask->surf->h || mousePos.y > _saveGameMask->surf->w)
+        return false;
+
+    if ( *((uint32*) _saveGameMask->surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
+        assert(_cursors.contains(*_saveGameMask->cursor));
+        CursorMan.replaceCursor(_cursors.getVal(*_saveGameMask->cursor), 32, 32, 0, 0, 0, true);
+        return true;
+    }
+    return false;
+}
+
+
 bool PrivateEngine::hasFeature(EngineFeature f) const {
     return
         (f == kSupportsReturnToLauncher);
@@ -335,20 +419,46 @@ bool PrivateEngine::hasFeature(EngineFeature f) const {
 
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
     Common::Serializer s(stream, nullptr);
-    syncGameStream(s);
+    debug("loadGameStream");
+    _nextSetting = new Common::String("kMainDesktop");
+    //for (SymbolMap::iterator it = variables.begin(); it != variables.end(); ++it)
+    //    debug("%s %s", it->_key.c_str(), it->_value->name->c_str());
+    Common::String *key = new Common::String();
+    int val;
+        
+    for (VariableList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
+        //Common::String key = *it;
+        //debug("key: %s", key.c_str());
+        s.syncAsUint32LE(val); 
+        Private::Symbol *sym = variables.getVal(*it);
+        sym->u.val = val;
+    }
+
+    //syncGameStream(s);
     return Common::kNoError;
 }
 
 Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool isAutosave) {
-    Common::Serializer s(nullptr, stream);
-    syncGameStream(s);
+    debug("saveGameStream %d", isAutosave);
+    if (isAutosave)
+        return Common::kNoError;
+    //Common::Serializer s(nullptr, stream);
+    //short type;
+    //assert(_nextSetting->matchString("kMainDesktop"));    
+    for (VariableList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
+        //Common::String key = *it;
+        //debug("key: %s", key.c_str());
+        Private::Symbol *sym = variables.getVal(*it);
+        stream->writeUint32LE(sym->u.val);
+    }
     return Common::kNoError;
 }
 
 void PrivateEngine::syncGameStream(Common::Serializer &s) {
+    debug("syncGameStream");
     // Use methods of Serializer to save/load fields
-    int dummy = 0;
-    s.syncAsUint16LE(dummy);
+    //int dummy = 0;
+    //s.syncString(*_currentSetting);
 }
 
 Common::String PrivateEngine::convertPath(Common::String name) {
diff --git a/engines/private/private.h b/engines/private/private.h
index c6e1a78916..f5b36954f4 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -81,10 +81,17 @@ public:
 	bool cursorExit(Common::Point);
 	bool cursorMask(Common::Point);
 	
-
 	bool hasFeature(EngineFeature f) const override;
 	bool canLoadGameStateCurrently() override { return true; }
+	bool canSaveAutosaveCurrently() override  { return false; }
 	bool canSaveGameStateCurrently() override { return true; }
+	
+	void selectLoadGame(Common::Point);
+	bool cursorLoadGame(Common::Point);
+
+	void selectSaveGame(Common::Point);
+	bool cursorSaveGame(Common::Point);
+
 	Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
 	Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
 	void syncGameStream(Common::Serializer &s);
@@ -106,9 +113,14 @@ public:
     // global state
 	Common::Point *_origin;
     Common::String *_nextSetting;
+	Common::String *_currentSetting;
     Common::String *_nextVS;
     Common::String *_frame;
 
+	// Save/Load games
+	MaskInfo *_saveGameMask;
+	MaskInfo *_loadGameMask;
+
 	int _mode;
     bool _modified;
     Common::String *_nextMovie;
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index ffc90d9124..78a943fe39 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -6,6 +6,8 @@ namespace Private {
 
 SymbolMap settings, variables, cursors, locations, rects;
 ConstantList constants;
+VariableList variableList;
+
 StringQueue stringToDefine;
 RectQueue rectToDefine;
 
@@ -98,6 +100,7 @@ void installAll(char *n) {
         else if (strcmp(n, "variables") == 0) {
             assert(r == NULL);
             install(s, NAME, 0, NULL, r, &variables);
+            variableList.push_front(*s);
         }
 
         else if (strcmp(n, "cursors") == 0) {
diff --git a/engines/private/symbol.h b/engines/private/symbol.h
index acac1c40fc..e1f1f6163c 100644
--- a/engines/private/symbol.h
+++ b/engines/private/symbol.h
@@ -27,10 +27,12 @@ extern void showSymbol(Symbol *);
 extern void setSymbol(Symbol *, int);
 
 typedef Common::HashMap<Common::String, Symbol*> SymbolMap;
+typedef Common::List<Common::String> VariableList;
 typedef Common::List<Symbol*> ConstantList;
 
 extern SymbolMap settings, variables, cursors, locations, rects;
 extern ConstantList constants;
+extern VariableList variableList;
 
 extern void     defineSymbol(char *, Common::Rect *); 
 extern Symbol  *install(Common::String *, int, int, char *, Common::Rect *, SymbolMap*);


Commit: 4ae90af4ab8099fdee0730dff53c36378a54305a
    https://github.com/scummvm/scummvm/commit/4ae90af4ab8099fdee0730dff53c36378a54305a
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVTE: more fixes

Changed paths:
    engines/private/grammar.tab.cpp
    engines/private/grammar.y
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/grammar.tab.cpp b/engines/private/grammar.tab.cpp
index 1fcf2987da..10d8cdee28 100644
--- a/engines/private/grammar.tab.cpp
+++ b/engines/private/grammar.tab.cpp
@@ -546,11 +546,11 @@ static const yytype_int8 yytranslate[] =
 static const yytype_uint8 yyrline[] =
 {
        0,    54,    54,    55,    58,    59,    60,    63,    64,    67,
-      68,    71,    77,    78,    83,    91,    92,    95,    98,   101,
-     104,   105,   110,   114,   115,   118,   126,   127,   135,   138,
-     139,   140,   141,   142,   145,   146,   147,   148,   149,   150,
-     153,   154,   155,   156,   157,   158,   159,   160,   161,   162,
-     163
+      68,    71,    78,    79,    84,    92,    93,    96,    99,   102,
+     105,   106,   111,   115,   116,   119,   127,   128,   136,   139,
+     140,   141,   142,   143,   146,   147,   148,   149,   150,   151,
+     154,   155,   156,   157,   158,   159,   160,   161,   162,   163,
+     164
 };
 #endif
 
@@ -1223,104 +1223,105 @@ yyreduce:
   case 11: /* statement: GOTOTOK NAME ';'  */
 #line 71 "engines/private/grammar.y"
                             {
+        (yyval.inst) = progp;
 	code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s)));
         code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
         code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
         code1(funcpush);
         }
-#line 1232 "engines/private/grammar.tab.cpp"
+#line 1233 "engines/private/grammar.tab.cpp"
     break;
 
   case 12: /* statement: fcall ';'  */
-#line 77 "engines/private/grammar.y"
-                            { }
-#line 1238 "engines/private/grammar.tab.cpp"
+#line 78 "engines/private/grammar.y"
+                            { (yyval.inst) = (yyvsp[-1].inst); }
+#line 1239 "engines/private/grammar.tab.cpp"
     break;
 
   case 13: /* statement: if cond body end  */
-#line 78 "engines/private/grammar.y"
+#line 79 "engines/private/grammar.y"
                            {
          	/* else-less if */
 		((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst);	/* thenpart */
 		((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst); 
                 }
-#line 1248 "engines/private/grammar.tab.cpp"
+#line 1249 "engines/private/grammar.tab.cpp"
     break;
 
   case 14: /* statement: if cond body end ELSETOK body end  */
-#line 83 "engines/private/grammar.y"
+#line 84 "engines/private/grammar.y"
                                             { 
                 /* if with else */
 		((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst);	/* thenpart */
 		((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst);	/* elsepart */
 		((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst); 
                 }
-#line 1259 "engines/private/grammar.tab.cpp"
+#line 1260 "engines/private/grammar.tab.cpp"
     break;
 
   case 15: /* body: statement  */
-#line 91 "engines/private/grammar.y"
+#line 92 "engines/private/grammar.y"
                              { (yyval.inst) = (yyvsp[0].inst); }
-#line 1265 "engines/private/grammar.tab.cpp"
+#line 1266 "engines/private/grammar.tab.cpp"
     break;
 
   case 16: /* body: '{' statements '}'  */
-#line 92 "engines/private/grammar.y"
+#line 93 "engines/private/grammar.y"
                              { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1271 "engines/private/grammar.tab.cpp"
+#line 1272 "engines/private/grammar.tab.cpp"
     break;
 
   case 17: /* end: %empty  */
-#line 95 "engines/private/grammar.y"
+#line 96 "engines/private/grammar.y"
                                 { code(STOP); (yyval.inst) = progp; }
-#line 1277 "engines/private/grammar.tab.cpp"
+#line 1278 "engines/private/grammar.tab.cpp"
     break;
 
   case 18: /* if: IFTOK  */
-#line 98 "engines/private/grammar.y"
+#line 99 "engines/private/grammar.y"
           { (yyval.inst) = code(ifcode); code3(STOP, STOP, STOP); }
-#line 1283 "engines/private/grammar.tab.cpp"
+#line 1284 "engines/private/grammar.tab.cpp"
     break;
 
   case 19: /* cond: '(' expr ')'  */
-#line 101 "engines/private/grammar.y"
+#line 102 "engines/private/grammar.y"
                         { code(STOP); (yyval.inst) = (yyvsp[-1].inst); }
-#line 1289 "engines/private/grammar.tab.cpp"
+#line 1290 "engines/private/grammar.tab.cpp"
     break;
 
   case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  */
-#line 105 "engines/private/grammar.y"
+#line 106 "engines/private/grammar.y"
                                                                         { 
           Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
           assert(r->isValidRect()); 
           defineSymbol((yyvsp[-13].s), r); 
           }
-#line 1299 "engines/private/grammar.tab.cpp"
+#line 1300 "engines/private/grammar.tab.cpp"
     break;
 
   case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
-#line 110 "engines/private/grammar.y"
+#line 111 "engines/private/grammar.y"
                                                             {
           Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);  
           defineSymbol((yyvsp[-11].s), r); 
           }
-#line 1308 "engines/private/grammar.tab.cpp"
+#line 1309 "engines/private/grammar.tab.cpp"
     break;
 
   case 23: /* define: NAME ',' define  */
-#line 114 "engines/private/grammar.y"
+#line 115 "engines/private/grammar.y"
                           { defineSymbol((yyvsp[-2].s), NULL); }
-#line 1314 "engines/private/grammar.tab.cpp"
+#line 1315 "engines/private/grammar.tab.cpp"
     break;
 
   case 24: /* define: NAME  */
-#line 115 "engines/private/grammar.y"
+#line 116 "engines/private/grammar.y"
                           { defineSymbol((yyvsp[0].s), NULL); }
-#line 1320 "engines/private/grammar.tab.cpp"
+#line 1321 "engines/private/grammar.tab.cpp"
     break;
 
   case 25: /* fcall: GOTOTOK '(' NAME ')'  */
-#line 118 "engines/private/grammar.y"
+#line 119 "engines/private/grammar.y"
                                {
                                (yyval.inst) = progp;
                                code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s)));
@@ -1328,166 +1329,166 @@ yyreduce:
                                code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
                                code1(funcpush);
                                }
-#line 1332 "engines/private/grammar.tab.cpp"
+#line 1333 "engines/private/grammar.tab.cpp"
     break;
 
   case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
-#line 126 "engines/private/grammar.y"
+#line 127 "engines/private/grammar.y"
                                                    { (yyval.inst) = progp; }
-#line 1338 "engines/private/grammar.tab.cpp"
+#line 1339 "engines/private/grammar.tab.cpp"
     break;
 
   case 27: /* fcall: NAME '(' startp params ')'  */
-#line 127 "engines/private/grammar.y"
+#line 128 "engines/private/grammar.y"
                                       {
                                (yyval.inst) = (yyvsp[-2].inst);
                                code2(constpush, (Private::Inst) constant(NUM, (yyvsp[-1].narg), NULL));
                                code2(strpush, (Private::Inst) constant(STRING, 0, (yyvsp[-4].s))); 
                                code1(funcpush);
                                }
-#line 1349 "engines/private/grammar.tab.cpp"
+#line 1350 "engines/private/grammar.tab.cpp"
     break;
 
   case 28: /* startp: %empty  */
-#line 135 "engines/private/grammar.y"
+#line 136 "engines/private/grammar.y"
                     { (yyval.inst) = progp; }
-#line 1355 "engines/private/grammar.tab.cpp"
+#line 1356 "engines/private/grammar.tab.cpp"
     break;
 
   case 29: /* params: %empty  */
-#line 138 "engines/private/grammar.y"
+#line 139 "engines/private/grammar.y"
                             { (yyval.narg) = 0; }
-#line 1361 "engines/private/grammar.tab.cpp"
+#line 1362 "engines/private/grammar.tab.cpp"
     break;
 
   case 30: /* params: fcall ',' params  */
-#line 139 "engines/private/grammar.y"
+#line 140 "engines/private/grammar.y"
                             { (yyval.narg) = (yyvsp[0].narg) + 1; }
-#line 1367 "engines/private/grammar.tab.cpp"
+#line 1368 "engines/private/grammar.tab.cpp"
     break;
 
   case 31: /* params: expr ',' params  */
-#line 140 "engines/private/grammar.y"
+#line 141 "engines/private/grammar.y"
                             { (yyval.narg) = (yyvsp[0].narg) + 1; }
-#line 1373 "engines/private/grammar.tab.cpp"
+#line 1374 "engines/private/grammar.tab.cpp"
     break;
 
   case 32: /* params: expr  */
-#line 141 "engines/private/grammar.y"
+#line 142 "engines/private/grammar.y"
                       { (yyval.narg) = 1; }
-#line 1379 "engines/private/grammar.tab.cpp"
+#line 1380 "engines/private/grammar.tab.cpp"
     break;
 
   case 33: /* params: fcall  */
-#line 142 "engines/private/grammar.y"
+#line 143 "engines/private/grammar.y"
                       { (yyval.narg) = 1; }
-#line 1385 "engines/private/grammar.tab.cpp"
+#line 1386 "engines/private/grammar.tab.cpp"
     break;
 
   case 34: /* value: NULLTOK  */
-#line 145 "engines/private/grammar.y"
+#line 146 "engines/private/grammar.y"
                    { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
-#line 1391 "engines/private/grammar.tab.cpp"
+#line 1392 "engines/private/grammar.tab.cpp"
     break;
 
   case 35: /* value: FALSETOK  */
-#line 146 "engines/private/grammar.y"
+#line 147 "engines/private/grammar.y"
                    { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
-#line 1397 "engines/private/grammar.tab.cpp"
+#line 1398 "engines/private/grammar.tab.cpp"
     break;
 
   case 36: /* value: TRUETOK  */
-#line 147 "engines/private/grammar.y"
+#line 148 "engines/private/grammar.y"
                    { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 1, NULL)); }
-#line 1403 "engines/private/grammar.tab.cpp"
+#line 1404 "engines/private/grammar.tab.cpp"
     break;
 
   case 37: /* value: NUM  */
-#line 148 "engines/private/grammar.y"
+#line 149 "engines/private/grammar.y"
                    { code2(Private::constpush, (Private::Inst)(yyvsp[0].sym)); }
-#line 1409 "engines/private/grammar.tab.cpp"
+#line 1410 "engines/private/grammar.tab.cpp"
     break;
 
   case 38: /* value: STRING  */
-#line 149 "engines/private/grammar.y"
+#line 150 "engines/private/grammar.y"
                    { code2(Private::strpush, (Private::Inst)(yyvsp[0].sym)); }
-#line 1415 "engines/private/grammar.tab.cpp"
+#line 1416 "engines/private/grammar.tab.cpp"
     break;
 
   case 39: /* value: NAME  */
-#line 150 "engines/private/grammar.y"
+#line 151 "engines/private/grammar.y"
                    { code1(Private::varpush); code1((Private::Inst) lookupName((yyvsp[0].s))); code1(Private::eval); }
-#line 1421 "engines/private/grammar.tab.cpp"
+#line 1422 "engines/private/grammar.tab.cpp"
     break;
 
   case 40: /* expr: value  */
-#line 153 "engines/private/grammar.y"
+#line 154 "engines/private/grammar.y"
                           { (yyval.inst) = (yyvsp[0].inst); }
-#line 1427 "engines/private/grammar.tab.cpp"
+#line 1428 "engines/private/grammar.tab.cpp"
     break;
 
   case 41: /* expr: '!' value  */
-#line 154 "engines/private/grammar.y"
+#line 155 "engines/private/grammar.y"
                           { code1(Private::negate); (yyval.inst) = (yyvsp[0].inst); }
-#line 1433 "engines/private/grammar.tab.cpp"
+#line 1434 "engines/private/grammar.tab.cpp"
     break;
 
   case 42: /* expr: value EQ value  */
-#line 155 "engines/private/grammar.y"
+#line 156 "engines/private/grammar.y"
                           { code1(Private::eq); }
-#line 1439 "engines/private/grammar.tab.cpp"
+#line 1440 "engines/private/grammar.tab.cpp"
     break;
 
   case 43: /* expr: value NEQ value  */
-#line 156 "engines/private/grammar.y"
+#line 157 "engines/private/grammar.y"
                           { code1(Private::ne); }
-#line 1445 "engines/private/grammar.tab.cpp"
+#line 1446 "engines/private/grammar.tab.cpp"
     break;
 
   case 44: /* expr: value '+' value  */
-#line 157 "engines/private/grammar.y"
+#line 158 "engines/private/grammar.y"
                           { code1(Private::add); }
-#line 1451 "engines/private/grammar.tab.cpp"
+#line 1452 "engines/private/grammar.tab.cpp"
     break;
 
   case 45: /* expr: value '<' value  */
-#line 158 "engines/private/grammar.y"
+#line 159 "engines/private/grammar.y"
                           { code1(Private::lt); }
-#line 1457 "engines/private/grammar.tab.cpp"
+#line 1458 "engines/private/grammar.tab.cpp"
     break;
 
   case 46: /* expr: value '>' value  */
-#line 159 "engines/private/grammar.y"
+#line 160 "engines/private/grammar.y"
                           { code1(Private::gt); }
-#line 1463 "engines/private/grammar.tab.cpp"
+#line 1464 "engines/private/grammar.tab.cpp"
     break;
 
   case 47: /* expr: value LTE value  */
-#line 160 "engines/private/grammar.y"
+#line 161 "engines/private/grammar.y"
                           { code1(Private::le); }
-#line 1469 "engines/private/grammar.tab.cpp"
+#line 1470 "engines/private/grammar.tab.cpp"
     break;
 
   case 48: /* expr: value GTE value  */
-#line 161 "engines/private/grammar.y"
+#line 162 "engines/private/grammar.y"
                           { code1(Private::ge); }
-#line 1475 "engines/private/grammar.tab.cpp"
+#line 1476 "engines/private/grammar.tab.cpp"
     break;
 
   case 49: /* expr: value '+'  */
-#line 162 "engines/private/grammar.y"
+#line 163 "engines/private/grammar.y"
                           { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1481 "engines/private/grammar.tab.cpp"
+#line 1482 "engines/private/grammar.tab.cpp"
     break;
 
   case 50: /* expr: RANDOMTOK '(' NUM '%' ')'  */
-#line 163 "engines/private/grammar.y"
+#line 164 "engines/private/grammar.y"
                                     { code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool); }
-#line 1487 "engines/private/grammar.tab.cpp"
+#line 1488 "engines/private/grammar.tab.cpp"
     break;
 
 
-#line 1491 "engines/private/grammar.tab.cpp"
+#line 1492 "engines/private/grammar.tab.cpp"
 
       default: break;
     }
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 1df0cb0ef5..3b69f97091 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -69,12 +69,13 @@ statements:  /* nothing */     { $$ = progp; }
 
 
 statement: GOTOTOK NAME ';' {
+        $$ = progp;
 	code2(strpush, (Private::Inst) Private::constant(STRING, 0, $NAME));
         code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
         code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
         code1(funcpush);
         }
-        | fcall ';'         { }   
+        | fcall ';'         { $$ = $1; }   
         | if cond body end {
          	/* else-less if */
 		($1)[1] = (Inst)$3;	/* thenpart */
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index a04886fe2f..759916e049 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -3,6 +3,7 @@
 #include "audio/decoders/wave.h"
 #include "audio/audiostream.h"
 
+#include "common/archive.h"
 #include "common/config-manager.h"
 #include "common/debug.h"
 #include "common/debug-channels.h"
@@ -40,8 +41,7 @@ PrivateEngine::PrivateEngine(OSystem *syst)
     // Do not initialize audio devices here
 
     // However this is the place to specify all default directories
-    //const Common::FSNode gameDataDir(ConfMan.get("path"));
-    //SearchMan.addSubDirectoryMatching(gameDataDir, "..");
+    //SearchMan.addSubDirectoryMatching(gameDataDir, "global", 0, 10, false);
 
     // Here is the right place to set up the engine specific debug channels
     //DebugMan.addDebugChannel(kPrivateDebugExample, "example", "this is just an example for a engine specific debug channel");
@@ -74,8 +74,22 @@ PrivateEngine::~PrivateEngine() {
     DebugMan.clearAllDebugChannels();
 }
 
+void PrivateEngine::initializePath(const Common::FSNode &gamePath) {
+    SearchMan.addDirectory(gamePath.getPath(), gamePath, 0, 10);
+}
+
 Common::Error PrivateEngine::run() {
 
+    const Common::FSNode gameDataDir(ConfMan.get("path"));
+    //SearchMan.addSubDirectoryMatching(Common::FSNode("/"), "global/transiti/animatio/driving");
+    //SearchMan.addSubDirectoryMatching(gameDataDir, "global", , 10, false);
+    
+    Common::ArchiveMemberList list;
+    SearchMan.listMembers(list);
+    for (Common::ArchiveMemberList::iterator it = list.begin(); it != list.end(); ++it) {
+        debug("%s", (*it)->getName().c_str());
+    }
+    
     assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
     Common::SeekableReadStream *file = NULL;
 
@@ -135,7 +149,7 @@ Common::Error PrivateEngine::run() {
     Common::Point mousePos;
     _videoDecoder = nullptr; //new Video::SmackerDecoder();
 
-    int saveSlot = ConfMan.hasKey("save_slot");
+    int saveSlot = ConfMan.getInt("save_slot");
     if (saveSlot >= 0) { // load the savegame
         loadGameState(saveSlot);
     } else {
diff --git a/engines/private/private.h b/engines/private/private.h
index f5b36954f4..7092c3d47f 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -75,6 +75,7 @@ public:
 	Common::InstallerArchive _installerArchive;
 
 	Common::Error run() override;
+	void initializePath(const Common::FSNode &gamePath) override;
 	void selectMask(Common::Point);
     void selectExit(Common::Point);
 


Commit: f0108e6e1a22af9798a2fdbf59bed6ef4417daad
    https://github.com/scummvm/scummvm/commit/f0108e6e1a22af9798a2fdbf59bed6ef4417daad
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: more fixes

Changed paths:
    engines/private/code.cpp
    engines/private/cursors.cpp
    engines/private/cursors.h
    engines/private/detection.cpp
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 40be03b159..340a10a989 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -139,7 +139,7 @@ int funcpush() //(char *name, int nargs)
     n = pop();
     ArgArray args;
 
-    debug("executing %s with %d params", s.u.str, n.u.val);
+    //debug("executing %s with %d params", s.u.str, n.u.val);
     for (int i = 0; i < n.u.val; i++) {
         arg = pop();
         args.insert(args.begin(), arg) ;
@@ -153,7 +153,7 @@ int funcpush() //(char *name, int nargs)
 int eval() {
     Datum d;
     d = pop();
-    debug("eval %s", d.u.sym->name->c_str());
+    //debug("eval %s", d.u.sym->name->c_str());
     //if (d.sym->type == UNDEF)
     //	execerror("undefined variable", d.sym->name);
     if (d.u.sym->type == NUM) {
@@ -166,8 +166,7 @@ int eval() {
         d.type = RECT;
         d.u.rect = d.u.sym->u.rect;
     } else if (d.u.sym->type == NAME) {
-        //debug("NAME %s", d.sym->name->c_str());
-        //d.sym = d.sym;
+    // No evaluation until is absolutely needed
     }
     else
         assert(0);
@@ -182,15 +181,11 @@ int add() {
     d2 = pop();
     d1 = pop();
     if (d1.type == NAME) {
-        //char *name =  d1.u.sym->name->c_str();
-        //debug("eval %s to %d",
         d1.u.val = d1.u.sym->u.val;
         d1.type = NUM;
     }
 
     if (d2.type == NAME) {
-        //char *name =  d1.u.sym->name->c_str();
-        //debug("eval %s to %d",
         d2.u.val = d2.u.sym->u.val;
         d2.type = NUM;
     }
@@ -209,7 +204,7 @@ int negate() {
     d = pop();
     int v;
     if (d.type == NAME) {
-        debug("negating %s", d.u.sym->name->c_str());
+        //debug("negating %s", d.u.sym->name->c_str());
         v = d.u.sym->u.val;
         d.type = NUM;
     }
diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index 3bea2c05d4..6a617c66b5 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -1,4 +1,7 @@
+#include "graphics/cursorman.h"
+
 #include "private/cursors.h"
+#include "private.h"
 
 namespace Private {
 
@@ -22,10 +25,10 @@ const byte MOUSECURSOR_SCI[] = {
 };
 
 extern const byte MOUSECURSOR_kExit[] = {
-    0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,3,3,3,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,3,3,3,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,1,3,3,3,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,1,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -63,11 +66,11 @@ const byte MOUSECURSOR_kZoomIn[] = {
     0,0,0,0,1,2,2,2,2,2,2,2,2,2,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,1,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,1,2,2,2,2,2,2,3,3,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,1,1,2,2,2,2,2,3,3,3,2,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,1,2,2,2,2,3,3,3,3,3,3,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,1,1,2,2,2,2,2,3,3,3,3,2,2,2,1,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,1,1,2,2,2,2,2,2,3,3,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -163,10 +166,10 @@ const byte MOUSECURSOR_kTurnLeft[] = {
 
 const byte MOUSECURSOR_kInventory[] = {
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,1,1,2,2,1,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,1,1,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,3,3,3,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,1,1,1,3,3,3,3,3,1,2,2,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,1,1,2,2,3,3,3,3,3,3,2,2,1,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,1,1,2,2,2,1,2,2,2,1,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,1,2,2,2,1,2,2,2,1,2,2,2,1,1,1,1,0,0,0,0,0,0,0,
@@ -223,12 +226,12 @@ const byte MOUSECURSOR_kZoomOut[] = {
     0,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,1,1,1,1,2,2,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,1,1,3,3,3,3,3,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
 const byte MOUSECURSOR_kPhone[] {
@@ -269,13 +272,14 @@ const byte MOUSECURSOR_kPhone[] {
 extern const byte cursorPalette[] = {
     0, 0, 0,           // Black / Transparent
     0x01, 0x01, 0x01,  // Gray
-    0xff, 0xff, 0xff   // White
+    0xff, 0xff, 0xff,  // White
+    0xff, 0x00, 0x00   // Red
 };
 
-static struct CursorTable {
+static struct CursorDataTable {
     const char *name;
     const byte *cursor;
-} cursorTable[] = {
+} cursorDataTable[] = {
     { "kExit",         MOUSECURSOR_kExit},
     { "kInventory",    MOUSECURSOR_kInventory},
     { "kTurnLeft",     MOUSECURSOR_kTurnLeft},
@@ -287,13 +291,50 @@ static struct CursorTable {
     { 0, 0}
 };
 
-CursorMap _cursors;
+static struct CursorPointTable {
+    const char *name;
+    const Common::Point *point;
+} cursorPointTable[] = {
+    { "kExit",         new Common::Point(9, 0)},
+    { "kInventory",    new Common::Point(15, 3)},
+    { "kTurnLeft",     new Common::Point(0, 0)},
+    { "kTurnRight",    new Common::Point(0, 0)},
+    { "kZoomIn",       new Common::Point(10, 8)},
+    { "kZoomOut",      new Common::Point(13, 31)},
+    { "kPhone",        new Common::Point(0, 0)},
+    { "default",       new Common::Point(0, 0)},
+    { 0, 0}
+};
 
-void initCursors() {
-    for (Private::CursorTable *cur = Private::cursorTable; cur->name; cur++) {
+CursorDataMap _cursorData;
+CursorPointMap _cursorPoints;
+
+void PrivateEngine::initCursors() {
+    for (Private::CursorDataTable *cur = Private::cursorDataTable; cur->name; cur++) {
+        Common::String *name = new Common::String(cur->name);
+        _cursorData.setVal(*name, cur->cursor);
+    }
+   
+    for (Private::CursorPointTable *cur = Private::cursorPointTable; cur->name; cur++) {
         Common::String *name = new Common::String(cur->name);
-        _cursors.setVal(*name, cur->cursor);
+        Common::Point *point = new Common::Point(*cur->point);
+        _cursorPoints.setVal(*name, point);
     }
+    CursorMan.replaceCursorPalette(cursorPalette, 0, 3);
+
+}
+
+void PrivateEngine::changeCursor(Common::String cursor) {
+    assert(_cursorData.contains(cursor));
+    Common::Point p = *_cursorPoints.getVal(cursor);
+    Common::Point s;
+    if (strcmp(cursor.c_str(), "default") == 0)
+        s = Common::Point(11, 16);
+    else 
+        s = Common::Point(32, 32);
+     
+    CursorMan.replaceCursor(_cursorData.getVal(cursor), s.x, s.y, p.x, p.y, 0, true);
+    CursorMan.showMouse(true);
 }
 
 }
\ No newline at end of file
diff --git a/engines/private/cursors.h b/engines/private/cursors.h
index 28764ec5aa..cff99d48ef 100644
--- a/engines/private/cursors.h
+++ b/engines/private/cursors.h
@@ -1,27 +1,16 @@
 #include "common/scummsys.h"
 #include "common/str.h"
 #include "common/hash-str.h"
+#include "common/rect.h"
 
 #ifndef PRIVATE_CURSORS_H
 #define PRIVATE_CURSORS_H
 
-typedef Common::HashMap<Common::String, const byte*> CursorMap;
 
 namespace Private {
 
-extern const byte MOUSECURSOR_SCI[];
-extern const byte MOUSECURSOR_kExit[];
-extern const byte MOUSECURSOR_kZoomIn[];
-extern const byte MOUSECURSOR_kZoomOut[];
-extern const byte MOUSECURSOR_kInventory[];
-extern const byte MOUSECURSOR_kTurnLeft[];
-extern const byte MOUSECURSOR_kTurnRight[];
-extern const byte MOUSECURSOR_kPhone[];
-
-extern const byte cursorPalette[];
-extern void initCursors();
-
-extern CursorMap _cursors;
+typedef Common::HashMap<Common::String, const byte*> CursorDataMap;
+typedef Common::HashMap<Common::String, Common::Point*> CursorPointMap;
 
 }
 
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index bbfea2f8f7..fe6ba19ae0 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -10,7 +10,7 @@ static const PlainGameDescriptor privateGames[] = {
 
 static const ADGameDescription gameDescriptions[] = {
     {
-        "private-eye",
+        "private-eye",  // Full game
         0,
         AD_ENTRY1s("ASSETS.Z", "3a7532349cda8126e96dd5e49884af3a", 40232),
         Common::EN_ANY,
@@ -19,10 +19,20 @@ static const ADGameDescription gameDescriptions[] = {
         GUIO1(GUIO_NOMIDI)
     },
     {
-        "private-eye",
-        0,
+        "private-eye", // Demo from archive.org
+        "Demo",
         AD_ENTRY1s("ASSETS.Z", "854e141bb67535359620a1833fcc1566", 5955),
-        Common::EN_ANY,
+        Common::EN_ANY, 
+        Common::kPlatformWindows,
+        ADGF_DEMO,
+        GUIO1(GUIO_NOMIDI)
+    },
+
+    {
+        "private-eye", // Demo from the full game CDROM
+        "Demo",
+        AD_ENTRY1s("ASSETS.Z", "045766e39f44d6ee3bf92f0d4521587c", 5961),
+        Common::EN_ANY, 
         Common::kPlatformWindows,
         ADGF_DEMO,
         GUIO1(GUIO_NOMIDI)
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index b5c08f0d0b..d3939884f1 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -23,7 +23,7 @@ void ChgMode(ArgArray args) {
     else if (g_private->_mode == 1) {
         g_private->_origin->x = 63;
         g_private->_origin->y = 48;
-        g_private->drawScreenFrame();
+        //g_private->drawScreenFrame();
     }
     else
         assert(0);
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 759916e049..89fae9840d 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -79,24 +79,16 @@ void PrivateEngine::initializePath(const Common::FSNode &gamePath) {
 }
 
 Common::Error PrivateEngine::run() {
-
-    const Common::FSNode gameDataDir(ConfMan.get("path"));
-    //SearchMan.addSubDirectoryMatching(Common::FSNode("/"), "global/transiti/animatio/driving");
-    //SearchMan.addSubDirectoryMatching(gameDataDir, "global", , 10, false);
-    
-    Common::ArchiveMemberList list;
-    SearchMan.listMembers(list);
-    for (Common::ArchiveMemberList::iterator it = list.begin(); it != list.end(); ++it) {
-        debug("%s", (*it)->getName().c_str());
-    }
     
     assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
     Common::SeekableReadStream *file = NULL;
 
     if (_installerArchive.hasFile("GAME.DAT")) // if the full game is used
         file = _installerArchive.createReadStreamForMember("GAME.DAT");
-    else if (_installerArchive.hasFile("GAME.TXT")) // if the demo is used
+    else if (_installerArchive.hasFile("GAME.TXT")) // if the archive.org demo is used
         file = _installerArchive.createReadStreamForMember("GAME.TXT");
+    else if (_installerArchive.hasFile("DEMOGAME.DAT")) // if full retail CDROM demo is used
+        file = _installerArchive.createReadStreamForMember("DEMOGAME.DAT");
 
     assert(file != NULL);
     void *buf = malloc(191000);
@@ -117,10 +109,7 @@ Common::Error PrivateEngine::run() {
     _pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
     _transparentColor = _pixelFormat.RGBToColor(0,255,0);
     initGraphics(_screenW, _screenH, &_pixelFormat);
-
-    CursorMan.replaceCursor(_cursors.getVal("default"), 11, 16, 0, 0, 0, true);
-    CursorMan.replaceCursorPalette(cursorPalette, 0, 3);
-    CursorMan.showMouse(true);
+    changeCursor("default");
 
     _origin = new Common::Point(0, 0);
     _image = new Image::BitmapDecoder();
@@ -157,9 +146,6 @@ Common::Error PrivateEngine::run() {
     }
 
     while (!shouldQuit()) {
-        if (_mode == 1)
-            drawScreenFrame();
-
         while (g_system->getEventManager()->pollEvent(event)) {
             mousePos = g_system->getEventManager()->getMousePos();
             // Events
@@ -182,7 +168,7 @@ Common::Error PrivateEngine::run() {
                 break;
 
             case Common::EVENT_MOUSEMOVE:
-                CursorMan.replaceCursor(_cursors.getVal("default"), 11, 16, 0, 0, 0, true);
+                changeCursor("default");
                 cursorExit(mousePos);
                 cursorMask(mousePos);
                 cursorLoadGame(mousePos);
@@ -207,6 +193,7 @@ Common::Error PrivateEngine::run() {
         }
 
         if (_videoDecoder) {
+
             stopSound();
             if (_videoDecoder->endOfVideo()) {
                 _videoDecoder->close();
@@ -226,10 +213,8 @@ Common::Error PrivateEngine::run() {
             _saveGameMask = NULL;
             loadSetting(_nextSetting);
             _nextSetting = NULL;
-            //CursorMan.showMouse(false);
             execute(prog);
-            CursorMan.replaceCursor(_cursors.getVal("default"), 11, 16, 0, 0, 0, true);
-            //CursorMan.showMouse(true);
+            changeCursor("default");
         }
 
         g_system->updateScreen();
@@ -252,11 +237,9 @@ bool PrivateEngine::cursorExit(Common::Point mousePos) {
         if (e.rect->contains(mousePos)) {
             inside = true;
             if (e.cursor != NULL)
-                CursorMan.replaceCursor(_cursors.getVal(*e.cursor), 32, 32, 0, 0, 0, true);
+                changeCursor(*e.cursor);
         }
     }
-    //if (!inside)
-    //    CursorMan.replaceCursor(_cursors.getVal("default"), 11, 16, 0, 0, 0, true);
 
     return inside;
 }
@@ -280,16 +263,13 @@ bool PrivateEngine::cursorMask(Common::Point mousePos) {
             //debug("Inside!");
             if (m.nextSetting != NULL) { // TODO: check this
                 inside = true;
-                debug("Rendering cursor mask %s", m.cursor->c_str());
-                assert(_cursors.contains(*m.cursor));
-                CursorMan.replaceCursor(_cursors.getVal(*m.cursor), 32, 32, 0, 0, 0, true);
+                //debug("Rendering cursor mask %s", m.cursor->c_str());
+                changeCursor(*m.cursor);
                 break;
             }
 
         }
     }
-    //if (!inside)
-    //    CursorMan.replaceCursor(_cursors.getVal("default"), 11, 16, 0, 0, 0, true);
     return inside;
 }
 
@@ -308,9 +288,9 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
         cs = e.rect->width()*e.rect->height();
         //debug("Testing exit %s %d", e.nextSetting->c_str(), cs);
         if (e.rect->contains(mousePos)) {
-            debug("Inside! %d %d", cs, rs);
+            //debug("Inside! %d %d", cs, rs);
             if (cs < rs && e.nextSetting != NULL) { // TODO: check this
-                debug("Found Exit %s %d", e.nextSetting->c_str(), cs);
+                //debug("Found Exit %s %d", e.nextSetting->c_str(), cs);
                 rs = cs;
                 ns = e.nextSetting;
             }
@@ -318,7 +298,7 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
         }
     }
     if (ns != NULL) {
-        debug("Exit selected %s", ns->c_str());
+        //debug("Exit selected %s", ns->c_str());
         _nextSetting = ns;
     }
 }
@@ -336,9 +316,9 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
 
         //debug("Testing mask %s", m.nextSetting->c_str());
         if ( *((uint32*) m.surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
-            debug("Inside!");
+            //debug("Inside!");
             if (m.nextSetting != NULL) { // TODO: check this
-                debug("Found Mask %s", m.nextSetting->c_str());
+                //debug("Found Mask %s", m.nextSetting->c_str());
                 ns = m.nextSetting;
             }
 
@@ -351,7 +331,7 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
         }
     }
     if (ns != NULL) {
-        debug("Mask selected %s", ns->c_str());
+        //debug("Mask selected %s", ns->c_str());
         _nextSetting = ns;
     }
 }
@@ -384,8 +364,7 @@ bool PrivateEngine::cursorLoadGame(Common::Point mousePos) {
         return false;
 
     if ( *((uint32*) _loadGameMask->surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
-        assert(_cursors.contains(*_loadGameMask->cursor));
-        CursorMan.replaceCursor(_cursors.getVal(*_loadGameMask->cursor), 32, 32, 0, 0, 0, true);
+        changeCursor(*_loadGameMask->cursor);
         return true;
     }
     return false;
@@ -418,8 +397,7 @@ bool PrivateEngine::cursorSaveGame(Common::Point mousePos) {
         return false;
 
     if ( *((uint32*) _saveGameMask->surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
-        assert(_cursors.contains(*_saveGameMask->cursor));
-        CursorMan.replaceCursor(_cursors.getVal(*_saveGameMask->cursor), 32, 32, 0, 0, 0, true);
+        changeCursor(*_saveGameMask->cursor);
         return true;
     }
     return false;
@@ -435,14 +413,9 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
     Common::Serializer s(stream, nullptr);
     debug("loadGameStream");
     _nextSetting = new Common::String("kMainDesktop");
-    //for (SymbolMap::iterator it = variables.begin(); it != variables.end(); ++it)
-    //    debug("%s %s", it->_key.c_str(), it->_value->name->c_str());
-    Common::String *key = new Common::String();
     int val;
         
     for (VariableList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
-        //Common::String key = *it;
-        //debug("key: %s", key.c_str());
         s.syncAsUint32LE(val); 
         Private::Symbol *sym = variables.getVal(*it);
         sym->u.val = val;
@@ -456,12 +429,8 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
     debug("saveGameStream %d", isAutosave);
     if (isAutosave)
         return Common::kNoError;
-    //Common::Serializer s(nullptr, stream);
-    //short type;
-    //assert(_nextSetting->matchString("kMainDesktop"));    
+
     for (VariableList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
-        //Common::String key = *it;
-        //debug("key: %s", key.c_str());
         Private::Symbol *sym = variables.getVal(*it);
         stream->writeUint32LE(sym->u.val);
     }
@@ -551,15 +520,12 @@ void PrivateEngine::loadImage(const Common::String &name, int x, int y, bool dra
     drawScreen();
 }
 
-void PrivateEngine::drawScreenFrame() {
-    Common::File file;
+void PrivateEngine::drawScreenFrame(Graphics::Surface *screen) {
     Common::String path = convertPath(*_frame);
-    if (!file.open(path))
-        error("unable to load image %s", path.c_str());
-
+    Common::File file;
+    assert(file.open(path));
     _image->loadStream(file);
-    _compositeSurface->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), Common::Point(0,0));
-    //drawScreen();
+    screen->copyRectToSurface(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), 0, 0, Common::Rect(0, 0, _screenW, _screenH));
 }
 
 
@@ -599,7 +565,11 @@ void PrivateEngine::drawScreen() {
 
     assert(w == _screenW && h == _screenH);
 
-    screen->copyRectToSurface(*surface, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
+    if (_mode == 1) {
+        drawScreenFrame(screen);
+    }
+    screen->copyRectToSurface(*surface, _origin->x, _origin->y, Common::Rect(_origin->x, _origin->y, _screenW - _origin->x, _screenH - _origin->y));
+    //screen->copyRectToSurface(*surface, _origin.x, _origin.y, Common::Rect(0, 0, _screenW, _screenH));
     g_system->unlockScreen();
     //if (_image->getPalette() != nullptr)
     //    g_system->getPaletteManager()->setPalette(_image->getPalette(), _image->getPaletteStartIndex(), _image->getPaletteColorCount());
diff --git a/engines/private/private.h b/engines/private/private.h
index 7092c3d47f..a632b6101e 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -104,8 +104,11 @@ public:
 	void stopSound();
 
 	void loadImage(const Common::String &file, int x, int y, bool drawn = true);
-    void drawScreenFrame();
-        
+    void drawScreenFrame(Graphics::Surface *);
+
+	void changeCursor(Common::String);
+    void initCursors();
+
 	Graphics::ManagedSurface *loadMask(const Common::String &, int, int, bool);
  
     uint32 _transparentColor;	


Commit: 005c8fe481be8515c1ee906c6f71f1fc20f3c7f5
    https://github.com/scummvm/scummvm/commit/005c8fe481be8515c1ee906c6f71f1fc20f3c7f5
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: more fixes

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index d3939884f1..a50383dff2 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -143,7 +143,7 @@ void Inventory(ArgArray args) {
 
     if (strcmp(snd.u.str, "\"\"") != 0) {
         Common::String *s = new Common::String(snd.u.str);
-        g_private->playSound(*s);
+        g_private->playSound(*s, 1);
     }
 
     // TODO: Keep track of inventory is missing
@@ -192,7 +192,7 @@ void Sound(ArgArray args) {
     debug("Sound(%s)", args[0].u.str);
     if (strcmp("\"\"", args[0].u.str) != 0) {
         Common::String *s = new Common::String(args[0].u.str);
-        g_private->playSound(*s);
+        g_private->playSound(*s, 1);
         //assert(0);
     } else {
         g_private->stopSound();
@@ -205,7 +205,7 @@ void LoopedSound(ArgArray args) {
     debug("LoopedSound(%s)", args[0].u.str);
     if (strcmp("\"\"", args[0].u.str) != 0) {
         Common::String *s = new Common::String(args[0].u.str);
-        g_private->playSound(*s);
+        g_private->playSound(*s, 0);
         //assert(0);
     } else {
         g_private->stopSound();
@@ -367,7 +367,7 @@ static struct FuncTable {
     // Sounds
     { Sound,           "Sound"},
     { Sound,           "SoundEffect"},
-    { Sound,           "LoopedSound"},
+    { LoopedSound,     "LoopedSound"},
     { NoStopSounds,    "NoStopSounds"},
     { SyncSound,       "SyncSound"},
     { AMRadioClip,     "AMRadioClip"},
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 89fae9840d..d71239c7ff 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -169,11 +169,11 @@ Common::Error PrivateEngine::run() {
 
             case Common::EVENT_MOUSEMOVE:
                 changeCursor("default");
-                cursorExit(mousePos);
-                cursorMask(mousePos);
-                cursorLoadGame(mousePos);
-                cursorSaveGame(mousePos);
                 
+                if      (cursorLoadGame(mousePos)) {}
+                else if (cursorSaveGame(mousePos)) {}
+                else if (cursorMask(mousePos))     {}
+                else if (cursorExit(mousePos))     {}
                 //
                 break;
 
@@ -229,19 +229,31 @@ bool PrivateEngine::cursorExit(Common::Point mousePos) {
     mousePos = mousePos - *_origin;
     if (mousePos.x < 0 || mousePos.y < 0)
         return false;
-
+    
+    int rs = 100000000;
+    int cs = 0;
     ExitInfo e;
-    bool inside = false;
+    Common::String *cursor = NULL;
+    
     for (ExitList::iterator it = _exits.begin(); it != _exits.end(); ++it) {
         e = *it;
-        if (e.rect->contains(mousePos)) {
-            inside = true;
-            if (e.cursor != NULL)
-                changeCursor(*e.cursor);
+        cs = e.rect->width()*e.rect->height();
+
+        if (e.rect->contains(mousePos)) {            
+            if (cs < rs && e.cursor != NULL) {
+                rs = cs;
+                cursor = e.cursor;
+            }
+            
         }
     }
 
-    return inside;
+    if (cursor != NULL) {
+        changeCursor(*cursor);
+        return true;
+    }
+
+    return false;
 }
 
 bool PrivateEngine::cursorMask(Common::Point mousePos) {
@@ -462,7 +474,7 @@ Common::String PrivateEngine::convertPath(Common::String name) {
     return path;
 }
 
-void PrivateEngine::playSound(const Common::String &name) {
+void PrivateEngine::playSound(const Common::String &name, uint loops) {
     debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
 
     Common::File *file = new Common::File();
@@ -472,7 +484,7 @@ void PrivateEngine::playSound(const Common::String &name) {
         error("unable to find sound file %s", path.c_str());
 
     Audio::LoopingAudioStream *stream;
-    stream = new Audio::LoopingAudioStream(Audio::makeWAVStream(file, DisposeAfterUse::YES), 1);
+    stream = new Audio::LoopingAudioStream(Audio::makeWAVStream(file, DisposeAfterUse::YES), loops);
     stopSound();
     _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream, -1, Audio::Mixer::kMaxChannelVolume);
 }
diff --git a/engines/private/private.h b/engines/private/private.h
index a632b6101e..faca0c57e9 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -98,8 +98,8 @@ public:
 	void syncGameStream(Common::Serializer &s);
 
     Common::String convertPath(Common::String); 
-	void playSound(const Common::String &name);
-	void playVideo(const Common::String &name);
+	void playSound(const Common::String &, uint);
+	void playVideo(const Common::String &);
     void skipVideo();
 	void stopSound();
 


Commit: 942addd3a1421e81e5bf99b5c3407da38552f6aa
    https://github.com/scummvm/scummvm/commit/942addd3a1421e81e5bf99b5c3407da38552f6aa
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: adjusted origin point

Changed paths:
    engines/private/funcs.cpp


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index a50383dff2..02ecc210cd 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -21,7 +21,7 @@ void ChgMode(ArgArray args) {
         // TODO: should clear the screen?
     }
     else if (g_private->_mode == 1) {
-        g_private->_origin->x = 63;
+        g_private->_origin->x = 64;
         g_private->_origin->y = 48;
         //g_private->drawScreenFrame();
     }


Commit: 89f95256e7b6b96f06741b2ef019e389443c085c
    https://github.com/scummvm/scummvm/commit/89f95256e7b6b96f06741b2ef019e389443c085c
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: more code

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 340a10a989..9d08681267 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -162,6 +162,7 @@ int eval() {
     } else if (d.u.sym->type == STRING) {
         d.type = STRING;
         d.u.str = d.u.sym->u.str;
+        debug("eval returned %s", d.u.str );
     } else if (d.u.sym->type == RECT) {
         d.type = RECT;
         d.u.rect = d.u.sym->u.rect;
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 02ecc210cd..996498f62d 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -15,15 +15,13 @@ void ChgMode(ArgArray args) {
     Common::String *s = new Common::String(args[1].u.str);
     g_private->_nextSetting = s;
 
-    if (g_private->_mode == 0) {
-        g_private->_origin->x = 0;
+    if (g_private->_mode == 0) { 
+        g_private->_origin->x = 0; // use a constant
         g_private->_origin->y = 0;
-        // TODO: should clear the screen?
     }
-    else if (g_private->_mode == 1) {
-        g_private->_origin->x = 64;
+    else if (g_private->_mode == 1) { 
+        g_private->_origin->x = 64;  // use a constant
         g_private->_origin->y = 48;
-        //g_private->drawScreenFrame();
     }
     else
         assert(0);
@@ -44,11 +42,19 @@ void Goto(ArgArray args) { // should be goto, but this is a reserved word
 }
 
 
-void SyncSound(ArgArray args) { // should be goto, but this is a reserved word
+void SyncSound(ArgArray args) {
     // assert types
     debug("SyncSound(%s, %s)", args[0].u.str, args[1].u.str);
     Common::String *s = new Common::String(args[1].u.str);
     g_private->_nextSetting = s;
+
+    if (strcmp("\"\"", args[0].u.str) != 0) {
+        Common::String *s = new Common::String(args[0].u.str);
+        g_private->playSound(*s, 1);
+        //assert(0);
+    } else {
+        g_private->stopSound();
+    }
 }
 
 void Quit(ArgArray args) {
@@ -63,7 +69,10 @@ void LoadGame(ArgArray args) {
     MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
     m->surf = g_private->loadMask(*s, 0, 0, true);
     m->cursor = args[2].u.sym->name;
+    m->nextSetting = NULL;
+    m->flag = NULL;
     g_private->_loadGameMask = m;
+    g_private->_masks.push_front(*m);
 }
 
 void SaveGame(ArgArray args) {
@@ -73,12 +82,16 @@ void SaveGame(ArgArray args) {
     MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
     m->surf = g_private->loadMask(*s, 0, 0, true);
     m->cursor = args[1].u.sym->name;
+    m->nextSetting = NULL;
+    m->flag = NULL;
     g_private->_saveGameMask = m;
+    g_private->_masks.push_front(*m);
 }
 
 void RestartGame(ArgArray args) {
     // assert types
-    debug("WARNING: RestartGame is not implemented");
+    g_private->restartGame();
+    //debug("WARNING: RestartGame is not implemented");
 }
 
 void PoliceBust(ArgArray args) {
@@ -307,14 +320,20 @@ void MaskDrawn(ArgArray args) {
     _Mask(args, true);
 }
 
-void AddSound(char *s, char *t) {
-    Common::String str(t);
+void AddSound(char *s, char *t, Symbol *flag = NULL, int val = 0) {
+    Common::String *sound = new Common::String(s);
     if (strcmp(t, "AMRadioClip") == 0)
-        g_private->_radio.push_front(str);
+        g_private->_AMRadio.push_front(*sound);
     else if (strcmp(t, "PoliceClip") == 0)
-        g_private->_police.push_front(str);
-    else if (strcmp(t, "PhoneClip") == 0)
-        g_private->_phone.push_front(str);
+        g_private->_policeRadio.push_front(*sound);
+    else if (strcmp(t, "PhoneClip") == 0) {
+        PhoneInfo *p = (PhoneInfo*) malloc(sizeof(PhoneInfo));
+        p->sound = sound;
+        p->flag = flag;
+        p->val = val;
+        g_private->_phone.push_front(*p);
+    }
+        
     else
         debug("error: invalid sound type %s", t);
 }
@@ -326,12 +345,45 @@ void PoliceClip(ArgArray args) {
     AddSound(args[0].u.str, "PoliceClip");
 }
 void PhoneClip(ArgArray args) {
-    AddSound(args[0].u.str, "PhoneClip");
+    if (args.size() == 2) {
+        debug("Unimplemented PhoneClip special case");
+        return;
+    }
+    AddSound(args[0].u.str, "PhoneClip", args[5].u.sym, args[6].u.val);
 }
 
 void SoundArea(ArgArray args) {
     // assert types
-    debug("WARNING: SoundArea not implemented!");
+    char *n;
+
+    if (args[1].type == NAME)
+        n = (char *) args[1].u.sym->name->c_str();
+    else if (args[1].type == STRING)
+        n = args[1].u.str;
+    else
+        assert(0);
+
+    debug("SoundArea(%s, %s)", args[0].u.str, n);
+    if (strcmp(n, "kAMRadio") == 0) {
+        Common::String *s = new Common::String(args[0].u.str);
+        MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+        m->surf = g_private->loadMask(*s, 0, 0, true);
+        m->cursor = args[2].u.sym->name;
+        m->nextSetting = NULL;
+        m->flag = NULL;
+        g_private->_AMRadioArea = m;
+        g_private->_masks.push_front(*m);
+    } else if (strcmp(n, "kPoliceRadio") == 0) {
+        Common::String *s = new Common::String(args[0].u.str);
+        MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+        m->surf = g_private->loadMask(*s, 0, 0, true);
+        debug("size %d %d", m->surf->h, m->surf->w);
+        m->cursor = args[2].u.sym->name;
+        m->nextSetting = NULL;
+        m->flag = NULL;
+        g_private->_policeRadioArea = m;
+        g_private->_masks.push_front(*m);
+    }
 }
 
 void AskSave(ArgArray args) {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index d71239c7ff..0efc27df3a 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -57,10 +57,19 @@ PrivateEngine::PrivateEngine(OSystem *syst)
     
     _nextSetting = NULL;
     _nextMovie = NULL;
+    _nextVS = NULL;
     _modified = false;
     _mode = -1;
     _frame = new Common::String("inface/general/inface2.bmp");
 
+    _policeRadioArea = NULL;
+    _AMRadioArea = NULL;
+    _phoneArea = NULL;
+
+    _AMRadioPrefix = new Common::String("inface/radio/comm_/");
+    _policeRadioPrefix = new Common::String("inface/radio/police/");
+    _phonePrefix = new Common::String("inface/telephon/");
+    _phoneCallSound = new Common::String("phone.wav");  
 
 }
 
@@ -83,11 +92,16 @@ Common::Error PrivateEngine::run() {
     assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
     Common::SeekableReadStream *file = NULL;
 
-    if (_installerArchive.hasFile("GAME.DAT")) // if the full game is used
+    // if the full game is used
+    if (_installerArchive.hasFile("GAME.DAT")) 
         file = _installerArchive.createReadStreamForMember("GAME.DAT");
-    else if (_installerArchive.hasFile("GAME.TXT")) // if the archive.org demo is used
+ 
+    // if the demo from archive.org is used
+    else if (_installerArchive.hasFile("GAME.TXT")) 
         file = _installerArchive.createReadStreamForMember("GAME.TXT");
-    else if (_installerArchive.hasFile("DEMOGAME.DAT")) // if full retail CDROM demo is used
+ 
+    // if the demo from the full retail CDROM is used
+    else if (_installerArchive.hasFile("DEMOGAME.DAT")) 
         file = _installerArchive.createReadStreamForMember("DEMOGAME.DAT");
 
     assert(file != NULL);
@@ -124,15 +138,6 @@ Common::Error PrivateEngine::run() {
     // Additional setup.
     debug("PrivateEngine::init");
 
-    // Your main even loop should be (invoked from) here.
-    //debug("PrivateEngine::go: Hello, World!");
-
-    // This test will show up if -d1 and --debugflags=example are specified on the commandline
-    //debugC(1, kPrivateDebugExample, "Example debug call");
-
-    // This test will show up if --debugflags=example or --debugflags=example2 or both of them and -d3 are specified on the commandline
-    //debugC(3, kPrivateDebugExample | kPrivateDebugExample2, "Example debug call two");
-
     // Simple main event loop
     Common::Event event;
     Common::Point mousePos;
@@ -160,6 +165,8 @@ Common::Error PrivateEngine::run() {
                 break;
 
             case Common::EVENT_LBUTTONDOWN:
+                selectPoliceRadioArea(mousePos);
+                selectAMRadioArea(mousePos);
                 selectLoadGame(mousePos);
                 selectSaveGame(mousePos);
                 selectMask(mousePos);
@@ -169,10 +176,7 @@ Common::Error PrivateEngine::run() {
 
             case Common::EVENT_MOUSEMOVE:
                 changeCursor("default");
-                
-                if      (cursorLoadGame(mousePos)) {}
-                else if (cursorSaveGame(mousePos)) {}
-                else if (cursorMask(mousePos))     {}
+                if (cursorMask(mousePos))      {}
                 else if (cursorExit(mousePos))     {}
                 //
                 break;
@@ -192,6 +196,11 @@ Common::Error PrivateEngine::run() {
 
         }
 
+        if (_nextVS != NULL) {
+            loadImage(*_nextVS, 160, 120, true);
+            _nextVS = NULL;
+        }
+
         if (_videoDecoder) {
 
             stopSound();
@@ -256,24 +265,31 @@ bool PrivateEngine::cursorExit(Common::Point mousePos) {
     return false;
 }
 
-bool PrivateEngine::cursorMask(Common::Point mousePos) {
-    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
+bool PrivateEngine::inMask(Graphics::ManagedSurface *surf, Common::Point mousePos) {
+    if (surf == NULL)
+        return false;
+
     mousePos = mousePos - *_origin;
     if (mousePos.x < 0 || mousePos.y < 0)
         return false;
 
+    if (mousePos.x > surf->w || mousePos.y > surf->h)
+        return false;
+
+    return ( *((uint32*) surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor);
+}
+
+
+bool PrivateEngine::cursorMask(Common::Point mousePos) {
+    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
     MaskInfo m;
     bool inside = false;
     for (MaskList::iterator it = _masks.begin(); it != _masks.end(); ++it) {
         m = *it;
 
-        if (mousePos.x > m.surf->h || mousePos.y > m.surf->w)
-            continue;
-
-        //debug("Testing mask %s", m.nextSetting->c_str());
-        if ( *((uint32*) m.surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
+        if (inMask(m.surf, mousePos)) {
             //debug("Inside!");
-            if (m.nextSetting != NULL) { // TODO: check this
+            if (m.cursor != NULL) { // TODO: check this
                 inside = true;
                 //debug("Rendering cursor mask %s", m.cursor->c_str());
                 changeCursor(*m.cursor);
@@ -316,18 +332,13 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
 }
 
 void PrivateEngine::selectMask(Common::Point mousePos) {
-    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
-    mousePos = mousePos - *_origin;
-    if (mousePos.x < 0 || mousePos.y < 0)
-        return;
-
     Common::String *ns = NULL;
     MaskInfo m;
     for (MaskList::iterator it = _masks.begin(); it != _masks.end(); ++it) {
         m = *it;
 
         //debug("Testing mask %s", m.nextSetting->c_str());
-        if ( *((uint32*) m.surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
+        if (inMask(m.surf, mousePos)) {
             //debug("Inside!");
             if (m.nextSetting != NULL) { // TODO: check this
                 //debug("Found Mask %s", m.nextSetting->c_str());
@@ -348,79 +359,72 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
     }
 }
 
-void PrivateEngine::selectLoadGame(Common::Point mousePos) {
-    if (_loadGameMask == NULL)
+void PrivateEngine::selectAMRadioArea(Common::Point mousePos) {
+    if (_AMRadioArea == NULL)
         return;
-    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
-    mousePos = mousePos - *_origin;
-    if (mousePos.x < 0 || mousePos.y < 0)
+
+    if (_AMRadio.empty())
         return;
 
-    //debug("Testing mask %s", m.nextSetting->c_str());
-    if ( *((uint32*) _loadGameMask->surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
-        //debug("loadGame!");
-        loadGameDialog();
+    debug("AMRadio");
+    if (inMask(_AMRadioArea->surf, mousePos)) { 
+        Common::String sound = *_AMRadioPrefix + _AMRadio.back() + ".wav";
+        playSound(sound.c_str(), 1);
+        _AMRadio.pop_back();
     }
 
 }
 
-bool PrivateEngine::cursorLoadGame(Common::Point mousePos) {
-    if (_loadGameMask == NULL)
-        return false;
-    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
-    mousePos = mousePos - *_origin;
-    if (mousePos.x < 0 || mousePos.y < 0)
-        return false;
+void PrivateEngine::selectPoliceRadioArea(Common::Point mousePos) {
+    if (_policeRadioArea == NULL)
+        return;
 
-    if (mousePos.x > _loadGameMask->surf->h || mousePos.y > _loadGameMask->surf->w)
-        return false;
+    if (_policeRadio.empty())
+        return;
 
-    if ( *((uint32*) _loadGameMask->surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
-        changeCursor(*_loadGameMask->cursor);
-        return true;
+    debug("PoliceRadio");
+    if (inMask(_policeRadioArea->surf, mousePos)) {
+        Common::String sound = *_policeRadioPrefix + _policeRadio.back() + ".wav";
+        playSound(sound.c_str(), 1);
+        _policeRadio.pop_back();
     }
-    return false;
+
 }
 
-void PrivateEngine::selectSaveGame(Common::Point mousePos) {
-    if (_saveGameMask == NULL)
-        return;
-    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
-    mousePos = mousePos - *_origin;
-    if (mousePos.x < 0 || mousePos.y < 0)
+void PrivateEngine::selectLoadGame(Common::Point mousePos) {
+    if (_loadGameMask == NULL)
         return;
 
-    //debug("Testing mask %s", m.nextSetting->c_str());
-    if ( *((uint32*) _saveGameMask->surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
-        saveGameDialog();
+    if (inMask(_loadGameMask->surf, mousePos)) {
+        loadGameDialog();
     }
-
 }
 
-bool PrivateEngine::cursorSaveGame(Common::Point mousePos) {
+void PrivateEngine::selectSaveGame(Common::Point mousePos) {
     if (_saveGameMask == NULL)
-        return false;
-    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
-    mousePos = mousePos - *_origin;
-    if (mousePos.x < 0 || mousePos.y < 0)
-        return false;
-
-    if (mousePos.x > _saveGameMask->surf->h || mousePos.y > _saveGameMask->surf->w)
-        return false;
-
-    if ( *((uint32*) _saveGameMask->surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor) {
-        changeCursor(*_saveGameMask->cursor);
-        return true;
+        return;
+ 
+    if (inMask(_saveGameMask->surf, mousePos)) {
+        saveGameDialog();
     }
-    return false;
-}
 
+}
 
 bool PrivateEngine::hasFeature(EngineFeature f) const {
     return
         (f == kSupportsReturnToLauncher);
 }
 
+void PrivateEngine::restartGame() {
+    debug("restartGame");
+        
+    for (VariableList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
+        Private::Symbol *sym = variables.getVal(*it);
+        if (strcmp("kAlternateGame", sym->name->c_str()) != 0)
+            sym->u.val = 0;
+    }
+}
+
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
     Common::Serializer s(stream, nullptr);
     debug("loadGameStream");
@@ -524,10 +528,6 @@ void PrivateEngine::loadImage(const Common::String &name, int x, int y, bool dra
         error("unable to load image %s", path.c_str());
 
     _image->loadStream(file);
-    //debug("palette %d %d", _image->getPaletteStartIndex(), _image->getPaletteColorCount());
-    //for (int i = 0; i < 30; i=i+3)
-    //    debug("%x %x %x", *(_image->getPalette()+i), *(_image->getPalette()+i+1), *(_image->getPalette()+i+2));
-
     _compositeSurface->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), *_origin + Common::Point(x,y), _transparentColor);
     drawScreen();
 }
diff --git a/engines/private/private.h b/engines/private/private.h
index faca0c57e9..2be9e987ec 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -35,7 +35,7 @@ enum {
 	// the current limitation is 32 debug channels (1 << 31 is the last one)
 };
 
-// exits
+// structs
 
 typedef struct ExitInfo {
     Common::String *nextSetting;
@@ -51,9 +51,20 @@ typedef struct MaskInfo {
     Common::String *cursor;    
 } MaskInfo;
 
+typedef struct PhoneInfo {
+    Common::String *sound;
+	Symbol *flag;
+	int val;
+} PhoneInfo;
+
+// lists
+
 typedef Common::List<ExitInfo> ExitList;  
 typedef Common::List<MaskInfo> MaskList;
 typedef Common::List<Common::String> SoundList;   
+typedef Common::List<PhoneInfo> PhoneList;
+
+// hash tables
 
 class PrivateEngine : public Engine {
 private:
@@ -75,6 +86,7 @@ public:
 	Common::InstallerArchive _installerArchive;
 
 	Common::Error run() override;
+	void restartGame();
 	void initializePath(const Common::FSNode &gamePath) override;
 	void selectMask(Common::Point);
     void selectExit(Common::Point);
@@ -88,10 +100,8 @@ public:
 	bool canSaveGameStateCurrently() override { return true; }
 	
 	void selectLoadGame(Common::Point);
-	bool cursorLoadGame(Common::Point);
-
 	void selectSaveGame(Common::Point);
-	bool cursorSaveGame(Common::Point);
+
 
 	Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
 	Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
@@ -110,7 +120,7 @@ public:
     void initCursors();
 
 	Graphics::ManagedSurface *loadMask(const Common::String &, int, int, bool);
- 
+    bool inMask(Graphics::ManagedSurface*, Common::Point);
     uint32 _transparentColor;	
 	void drawScreen();
 
@@ -132,9 +142,25 @@ public:
     MaskList _masks;
 
 	// Radios
-	SoundList _radio;
-	SoundList _police;
-	SoundList _phone;
+
+    MaskInfo *_AMRadioArea;
+	Common::String *_AMRadioPrefix;
+
+	MaskInfo *_policeRadioArea;
+	Common::String *_policeRadioPrefix;
+
+	MaskInfo *_phoneArea;
+	Common::String *_phonePrefix;
+	Common::String *_phoneCallSound;
+
+	SoundList _AMRadio;
+	SoundList _policeRadio;
+	PhoneList _phone;
+
+	void selectAMRadioArea(Common::Point);
+	void selectPoliceRadioArea(Common::Point);
+
+    // Random values
 
 	bool getRandomBool(uint);
 
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 78a943fe39..2a813d6470 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -74,8 +74,8 @@ Symbol *lookupName(char *n) {
         return lookup(*s, rects);
 
     else {
-        debug("WARNING: %s not defined", n);
-        return constant(NAME, 0, n);
+        debug("WARNING: %s not defined", s->c_str());
+        return constant(STRING, 0, (char*) s->c_str());
     }
 
 }


Commit: 9115a5f14319fba7f7c36056730f12fdd0ed90d8
    https://github.com/scummvm/scummvm/commit/9115a5f14319fba7f7c36056730f12fdd0ed90d8
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: phone calls + fixes

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 996498f62d..29dd11ec03 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -321,17 +321,27 @@ void MaskDrawn(ArgArray args) {
 }
 
 void AddSound(char *s, char *t, Symbol *flag = NULL, int val = 0) {
+    if (strcmp(s, "\"\"") == 0)
+        return;
+
     Common::String *sound = new Common::String(s);
     if (strcmp(t, "AMRadioClip") == 0)
-        g_private->_AMRadio.push_front(*sound);
+        g_private->_AMRadio.push_back(*sound);
     else if (strcmp(t, "PoliceClip") == 0)
-        g_private->_policeRadio.push_front(*sound);
+        g_private->_policeRadio.push_back(*sound);
     else if (strcmp(t, "PhoneClip") == 0) {
         PhoneInfo *p = (PhoneInfo*) malloc(sizeof(PhoneInfo));
         p->sound = sound;
         p->flag = flag;
         p->val = val;
-        g_private->_phone.push_front(*p);
+        // This condition will avoid adding the same phone call twice,
+        // it is unclear why this could be useful, but it looks like a bug
+        // in the original script
+        if (g_private->_phone.size() > 0 && 
+             strcmp(g_private->_phone.back().sound->c_str(), s) == 0)
+            return;
+
+        g_private->_phone.push_back(*p);
     }
         
     else
@@ -349,7 +359,7 @@ void PhoneClip(ArgArray args) {
         debug("Unimplemented PhoneClip special case");
         return;
     }
-    AddSound(args[0].u.str, "PhoneClip", args[5].u.sym, args[6].u.val);
+    AddSound(args[0].u.str, "PhoneClip", args[4].u.sym, args[5].u.val);
 }
 
 void SoundArea(ArgArray args) {
@@ -377,12 +387,20 @@ void SoundArea(ArgArray args) {
         Common::String *s = new Common::String(args[0].u.str);
         MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
         m->surf = g_private->loadMask(*s, 0, 0, true);
-        debug("size %d %d", m->surf->h, m->surf->w);
         m->cursor = args[2].u.sym->name;
         m->nextSetting = NULL;
         m->flag = NULL;
         g_private->_policeRadioArea = m;
         g_private->_masks.push_front(*m);
+    } else if (strcmp(n, "kPhone") == 0) {
+        Common::String *s = new Common::String(args[0].u.str);
+        MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+        m->surf = g_private->loadMask(*s, 0, 0, true);
+        m->cursor = args[2].u.sym->name;
+        m->nextSetting = NULL;
+        m->flag = NULL;
+        g_private->_phoneArea = m;
+        g_private->_masks.push_front(*m);
     }
 }
 
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 0efc27df3a..07d01bcc89 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -151,6 +151,8 @@ Common::Error PrivateEngine::run() {
     }
 
     while (!shouldQuit()) {
+        checkPhoneCall();
+
         while (g_system->getEventManager()->pollEvent(event)) {
             mousePos = g_system->getEventManager()->getMousePos();
             // Events
@@ -165,6 +167,7 @@ Common::Error PrivateEngine::run() {
                 break;
 
             case Common::EVENT_LBUTTONDOWN:
+                selectPhoneArea(mousePos);
                 selectPoliceRadioArea(mousePos);
                 selectAMRadioArea(mousePos);
                 selectLoadGame(mousePos);
@@ -220,6 +223,11 @@ Common::Error PrivateEngine::run() {
             _masks.clear();
             _loadGameMask = NULL;
             _saveGameMask = NULL;
+            _policeRadioArea = NULL;
+            _policeRadioArea = NULL;
+            _AMRadioArea = NULL;
+            _phoneArea = NULL;
+
             loadSetting(_nextSetting);
             _nextSetting = NULL;
             execute(prog);
@@ -391,6 +399,35 @@ void PrivateEngine::selectPoliceRadioArea(Common::Point mousePos) {
 
 }
 
+void PrivateEngine::checkPhoneCall() {
+    if (_phone.empty())
+        return;
+
+    if (!_mixer->isSoundHandleActive(_soundHandle))
+        playSound(*_phonePrefix + *_phoneCallSound, 1);
+
+}
+
+void PrivateEngine::selectPhoneArea(Common::Point mousePos) {
+    if (_phoneArea == NULL)
+        return;
+
+    if (_phone.empty())
+        return;
+
+    debug("Phone");
+    if (inMask(_phoneArea->surf, mousePos)) {
+        PhoneInfo i = _phone.back();
+        Common::String sound(*i.sound);
+        setSymbol(i.flag, i.val); 
+        sound = *_phonePrefix + sound + ".wav";
+        playSound(sound.c_str(), 1);
+        _phone.pop_back();
+    }
+
+}
+
+
 void PrivateEngine::selectLoadGame(Common::Point mousePos) {
     if (_loadGameMask == NULL)
         return;
@@ -423,6 +460,7 @@ void PrivateEngine::restartGame() {
         if (strcmp("kAlternateGame", sym->name->c_str()) != 0)
             sym->u.val = 0;
     }
+    // TODO: reset sound lists
 }
 
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
@@ -437,6 +475,38 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
         sym->u.val = val;
     }
 
+    uint32 size = 0;
+    Common::String *sound;
+    size = stream->readUint32LE();
+    debug("AMRadio size %d", size);
+    _AMRadio.clear();
+
+    for (uint32 i = 0; i < size; ++i) {
+        sound = new Common::String(stream->readString());
+        debug("sound: %s", sound->c_str());
+        _AMRadio.push_back(*sound);
+    }
+
+    size = stream->readUint32LE();
+    debug("policeRadio size %d", size);
+    _policeRadio.clear();
+
+    for (uint32 i = 0; i < size; ++i) {
+        sound = new Common::String(stream->readString());
+        debug("sound: %s", sound->c_str());
+        _policeRadio.push_back(*sound);
+    }
+
+    size = stream->readUint32LE();
+    for (uint32 j = 0; j < size; ++j) {
+        PhoneInfo *i = (PhoneInfo*) malloc(sizeof(PhoneInfo));
+
+        i->sound = new Common::String(stream->readString());
+        i->flag  = variables.getVal(stream->readString()); 
+        i->val   = stream->readUint32LE();
+        _phone.push_back(*i);
+    }
+
     //syncGameStream(s);
     return Common::kNoError;
 }
@@ -450,6 +520,29 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
         Private::Symbol *sym = variables.getVal(*it);
         stream->writeUint32LE(sym->u.val);
     }
+
+    stream->writeUint32LE(_AMRadio.size());
+    for (SoundList::iterator it = _AMRadio.begin(); it != _AMRadio.end(); ++it) {
+        stream->writeString(*it);
+        stream->writeByte(0);
+    }
+
+    stream->writeUint32LE(_policeRadio.size());
+    for (SoundList::iterator it = _policeRadio.begin(); it != _policeRadio.end(); ++it) {
+        stream->writeString(*it);
+        stream->writeByte(0);
+    }
+
+    stream->writeUint32LE(_phone.size());
+    for (PhoneList::iterator it = _phone.begin(); it != _phone.end(); ++it) {
+        //PhoneInfo *i = *it;
+        stream->writeString(*it->sound);
+        stream->writeByte(0);
+        stream->writeString(*it->flag->name);
+        stream->writeByte(0);
+        stream->writeUint32LE(it->val);
+    }
+
     return Common::kNoError;
 }
 
@@ -581,13 +674,9 @@ void PrivateEngine::drawScreen() {
         drawScreenFrame(screen);
     }
     screen->copyRectToSurface(*surface, _origin->x, _origin->y, Common::Rect(_origin->x, _origin->y, _screenW - _origin->x, _screenH - _origin->y));
-    //screen->copyRectToSurface(*surface, _origin.x, _origin.y, Common::Rect(0, 0, _screenW, _screenH));
     g_system->unlockScreen();
     //if (_image->getPalette() != nullptr)
     //    g_system->getPaletteManager()->setPalette(_image->getPalette(), _image->getPaletteStartIndex(), _image->getPaletteColorCount());
-    //if (_image->getPalette() != nullptr)
-    //	g_system->getPaletteManager()->setPalette(_image->getPalette(), 0, 256);
-    //g_system->getPaletteManager()->setPalette(_videoDecoder->getPalette(), 0, 256);
     g_system->updateScreen();
 
 }
diff --git a/engines/private/private.h b/engines/private/private.h
index 2be9e987ec..37e555cea5 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -159,6 +159,8 @@ public:
 
 	void selectAMRadioArea(Common::Point);
 	void selectPoliceRadioArea(Common::Point);
+	void selectPhoneArea(Common::Point);
+	void checkPhoneCall();
 
     // Random values
 


Commit: d0c4f950f4455279458a6bf963a709e2189bf8de
    https://github.com/scummvm/scummvm/commit/d0c4f950f4455279458a6bf963a709e2189bf8de
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: improved save/load

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 29dd11ec03..4145b84ef0 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -45,8 +45,8 @@ void Goto(ArgArray args) { // should be goto, but this is a reserved word
 void SyncSound(ArgArray args) {
     // assert types
     debug("SyncSound(%s, %s)", args[0].u.str, args[1].u.str);
-    Common::String *s = new Common::String(args[1].u.str);
-    g_private->_nextSetting = s;
+    Common::String *nextSetting = new Common::String(args[1].u.str);
+    g_private->_nextSetting = nextSetting;
 
     if (strcmp("\"\"", args[0].u.str) != 0) {
         Common::String *s = new Common::String(args[0].u.str);
@@ -200,6 +200,13 @@ void SetModifiedFlag(ArgArray args) {
     g_private->_modified = (bool) args[0].u.val;
 }
 
+void PaperShuffleSound(ArgArray args) {
+    // assert types
+    debug("PaperShuffleSound()");
+    Common::String *s = g_private->getPaperShuffleSound();
+    g_private->playSound(*s, 1); 
+}
+
 void Sound(ArgArray args) {
     // assert types
     debug("Sound(%s)", args[0].u.str);
@@ -241,9 +248,24 @@ void Transition(ArgArray args) {
 void Movie(ArgArray args) {
     // assert types
     debug("Movie(%s, %s)", args[0].u.str, args[1].u.str);
-    if (strcmp(args[0].u.str, "\"\"") != 0)
-        g_private->_nextMovie = new Common::String(args[0].u.str);
-    g_private->_nextSetting = new Common::String(args[1].u.str);
+    Common::String *movie = new Common::String(args[0].u.str);
+    Common::String *nextSetting = new Common::String(args[1].u.str);
+    bool isEmptyString = strcmp(args[0].u.str, "\"\"") == 0;
+
+    if (!g_private->_playedMovies.contains(*movie) && !isEmptyString) {
+        g_private->_nextMovie = movie;
+        g_private->_playedMovies.setVal(*movie, true);
+        g_private->_nextSetting = nextSetting;
+
+    } else if (isEmptyString) {
+        g_private->_repeatedMovieExit = nextSetting;
+        debug("repeated movie exit is %s", nextSetting->c_str());
+    } else {
+        debug("movie %s already played", movie->c_str());
+        g_private->_nextSetting = g_private->_repeatedMovieExit;
+    }
+
+    //g_private->_nextSetting = new Common::String(args[1].u.str);
 }
 
 void CRect(ArgArray args) {
@@ -349,9 +371,11 @@ void AddSound(char *s, char *t, Symbol *flag = NULL, int val = 0) {
 }
 
 void AMRadioClip(ArgArray args) {
+    assert(args.size() <= 4);
     AddSound(args[0].u.str, "AMRadioClip");
 }
 void PoliceClip(ArgArray args) {
+    assert(args.size() <= 4);
     AddSound(args[0].u.str, "PoliceClip");
 }
 void PhoneClip(ArgArray args) {
@@ -359,6 +383,7 @@ void PhoneClip(ArgArray args) {
         debug("Unimplemented PhoneClip special case");
         return;
     }
+    
     AddSound(args[0].u.str, "PhoneClip", args[4].u.sym, args[5].u.val);
 }
 
@@ -444,6 +469,7 @@ static struct FuncTable {
     { PoliceClip,      "PoliceClip"},
     { PhoneClip,       "PhoneClip"},
     { SoundArea,       "SoundArea"},
+    { PaperShuffleSound, "PaperShuffleSound"},
 
     // Images
     { Bitmap,          "Bitmap"},
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 07d01bcc89..4621514412 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -62,6 +62,7 @@ PrivateEngine::PrivateEngine(OSystem *syst)
     _mode = -1;
     _frame = new Common::String("inface/general/inface2.bmp");
 
+    _paperShuffleSound = new Common::String("global/audio/glsfx0");
     _policeRadioArea = NULL;
     _AMRadioArea = NULL;
     _phoneArea = NULL;
@@ -400,6 +401,9 @@ void PrivateEngine::selectPoliceRadioArea(Common::Point mousePos) {
 }
 
 void PrivateEngine::checkPhoneCall() {
+    if (_phoneArea == NULL)
+        return;
+
     if (_phone.empty())
         return;
 
@@ -498,6 +502,8 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
     }
 
     size = stream->readUint32LE();
+    _phone.clear();
+
     for (uint32 j = 0; j < size; ++j) {
         PhoneInfo *i = (PhoneInfo*) malloc(sizeof(PhoneInfo));
 
@@ -507,6 +513,17 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
         _phone.push_back(*i);
     }
 
+    *_repeatedMovieExit = stream->readString();
+
+    _playedMovies.clear();
+    size = stream->readUint32LE();
+    Common::String *movie;
+
+    for (uint32 i = 0; i < size; ++i) {
+        movie = new Common::String(stream->readString());
+        _playedMovies.setVal(movie, true);
+    }
+
     //syncGameStream(s);
     return Common::kNoError;
 }
@@ -543,6 +560,15 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
         stream->writeUint32LE(it->val);
     }
 
+    stream->writeString(*_repeatedMovieExit);
+    stream->writeByte(0);
+
+    stream->writeUint32LE(_playedMovies.size());
+    for (PlayedMovieTable::iterator it = _playedMovies.begin(); it != _playedMovies.end(); ++it) {
+        stream->writeString(it->_key);
+        stream->writeByte(0);
+    }
+
     return Common::kNoError;
 }
 
@@ -686,5 +712,17 @@ bool PrivateEngine::getRandomBool(uint p) {
     return (r <= p);
 }
 
+Common::String *PrivateEngine::getPaperShuffleSound() {
+    uint r = 32 + _rnd->getRandomNumber(8);
+
+    // there is no global/audio/glsfx038.wav, 
+    // so we should avoid that number
+    if ( r == 38)
+      r = 0;
+
+    char f[7];
+    sprintf(f, "%d.wav", r);
+    return (new Common::String(*_paperShuffleSound + f));
+}
 
 } // End of namespace Private
diff --git a/engines/private/private.h b/engines/private/private.h
index 37e555cea5..2de4b3d95c 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -66,6 +66,8 @@ typedef Common::List<PhoneInfo> PhoneList;
 
 // hash tables
 
+typedef Common::HashMap<Common::String, bool> PlayedMovieTable;
+
 class PrivateEngine : public Engine {
 private:
 	// We need random numbers
@@ -138,9 +140,16 @@ public:
 	int _mode;
     bool _modified;
     Common::String *_nextMovie;
+	PlayedMovieTable _playedMovies;
+	Common::String *_repeatedMovieExit;
     ExitList _exits;
     MaskList _masks;
 
+	// Sounds
+
+    Common::String *getPaperShuffleSound();
+	Common::String *_paperShuffleSound;
+
 	// Radios
 
     MaskInfo *_AMRadioArea;


Commit: ab08b58e491ab0ba4462e305340c83ecfb600d00
    https://github.com/scummvm/scummvm/commit/ab08b58e491ab0ba4462e305340c83ecfb600d00
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixes + astyle

Changed paths:
    engines/private/code.cpp
    engines/private/cursors.cpp
    engines/private/detection.cpp
    engines/private/funcs.cpp
    engines/private/grammar.tab.cpp
    engines/private/lex.yy.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 9d08681267..889de5453e 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -44,7 +44,7 @@ void initInsts() {
     }
 }
 
-/* initialize for code generation */ 
+/* initialize for code generation */
 void initSetting() {
     setting = (Setting*) malloc(sizeof(Setting));
     memset((void *) setting, 0, sizeof(Setting));
@@ -85,7 +85,7 @@ void loadSetting(Common::String *name) {
     }*/
 }
 
-/* push d onto stack */ 
+/* push d onto stack */
 int push(Datum d) {
     assert (!(stackp >= &stack[NSTACK]));
     *stackp++ = d;
@@ -98,7 +98,7 @@ Datum pop()	{
     return *--stackp;
 }
 
-/* push constant onto stack */ 
+/* push constant onto stack */
 int constpush()	{
     Datum d;
     Symbol *s = (Symbol *)*pc++;
@@ -149,7 +149,7 @@ int funcpush() //(char *name, int nargs)
     return 0;
 }
 
-/* evaluate variable on stack */ 
+/* evaluate variable on stack */
 int eval() {
     Datum d;
     d = pop();
@@ -167,7 +167,7 @@ int eval() {
         d.type = RECT;
         d.u.rect = d.u.sym->u.rect;
     } else if (d.u.sym->type == NAME) {
-    // No evaluation until is absolutely needed
+        // No evaluation until is absolutely needed
     }
     else
         assert(0);
@@ -176,7 +176,7 @@ int eval() {
     return 0;
 }
 
-/* add top two elems on stack */ 
+/* add top two elems on stack */
 int add() {
     Datum d1, d2;
     d2 = pop();
@@ -363,7 +363,7 @@ int ne() {
     return 0;
 }
 
-/* install one instruction or operand */ 
+/* install one instruction or operand */
 Inst *code(Inst f) {
     //debug("pushing code at %d", progp);
     Inst *oprogp = progp;
@@ -416,7 +416,7 @@ int fail() {
     return 0;
 }
 
-/* run the machine */ 
+/* run the machine */
 void execute(Inst *p) {
     for (pc = p; *pc != STOP; ) {
         (*(*pc++))();
diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index 6a617c66b5..ee839fc514 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -314,7 +314,7 @@ void PrivateEngine::initCursors() {
         Common::String *name = new Common::String(cur->name);
         _cursorData.setVal(*name, cur->cursor);
     }
-   
+
     for (Private::CursorPointTable *cur = Private::cursorPointTable; cur->name; cur++) {
         Common::String *name = new Common::String(cur->name);
         Common::Point *point = new Common::Point(*cur->point);
@@ -330,9 +330,9 @@ void PrivateEngine::changeCursor(Common::String cursor) {
     Common::Point s;
     if (strcmp(cursor.c_str(), "default") == 0)
         s = Common::Point(11, 16);
-    else 
+    else
         s = Common::Point(32, 32);
-     
+
     CursorMan.replaceCursor(_cursorData.getVal(cursor), s.x, s.y, p.x, p.y, 0, true);
     CursorMan.showMouse(true);
 }
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index fe6ba19ae0..b68a1d5fae 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -22,7 +22,7 @@ static const ADGameDescription gameDescriptions[] = {
         "private-eye", // Demo from archive.org
         "Demo",
         AD_ENTRY1s("ASSETS.Z", "854e141bb67535359620a1833fcc1566", 5955),
-        Common::EN_ANY, 
+        Common::EN_ANY,
         Common::kPlatformWindows,
         ADGF_DEMO,
         GUIO1(GUIO_NOMIDI)
@@ -32,7 +32,7 @@ static const ADGameDescription gameDescriptions[] = {
         "private-eye", // Demo from the full game CDROM
         "Demo",
         AD_ENTRY1s("ASSETS.Z", "045766e39f44d6ee3bf92f0d4521587c", 5961),
-        Common::EN_ANY, 
+        Common::EN_ANY,
         Common::kPlatformWindows,
         ADGF_DEMO,
         GUIO1(GUIO_NOMIDI)
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 4145b84ef0..2993d1202e 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -15,11 +15,11 @@ void ChgMode(ArgArray args) {
     Common::String *s = new Common::String(args[1].u.str);
     g_private->_nextSetting = s;
 
-    if (g_private->_mode == 0) { 
+    if (g_private->_mode == 0) {
         g_private->_origin->x = 0; // use a constant
         g_private->_origin->y = 0;
     }
-    else if (g_private->_mode == 1) { 
+    else if (g_private->_mode == 1) {
         g_private->_origin->x = 64;  // use a constant
         g_private->_origin->y = 48;
     }
@@ -142,13 +142,13 @@ void Inventory(ArgArray args) {
 
         m->cursor = new Common::String("kInventory");
         m->point = new Common::Point(0,0);
-        if (v1.type == NAME)
+        if (v2.type == NAME)
             m->flag = v2.u.sym;
         else
             m->flag = NULL;
 
         g_private->_masks.push_front(*m);
-
+        g_private->_toTake = true;
     }
 
     if (v1.type == NAME)
@@ -159,6 +159,8 @@ void Inventory(ArgArray args) {
         g_private->playSound(*s, 1);
     }
 
+
+
     // TODO: Keep track of inventory is missing
 }
 
@@ -204,7 +206,7 @@ void PaperShuffleSound(ArgArray args) {
     // assert types
     debug("PaperShuffleSound()");
     Common::String *s = g_private->getPaperShuffleSound();
-    g_private->playSound(*s, 1); 
+    g_private->playSound(*s, 1);
 }
 
 void Sound(ArgArray args) {
@@ -352,20 +354,20 @@ void AddSound(char *s, char *t, Symbol *flag = NULL, int val = 0) {
     else if (strcmp(t, "PoliceClip") == 0)
         g_private->_policeRadio.push_back(*sound);
     else if (strcmp(t, "PhoneClip") == 0) {
-        PhoneInfo *p = (PhoneInfo*) malloc(sizeof(PhoneInfo));
-        p->sound = sound;
-        p->flag = flag;
-        p->val = val;
         // This condition will avoid adding the same phone call twice,
         // it is unclear why this could be useful, but it looks like a bug
-        // in the original script
-        if (g_private->_phone.size() > 0 && 
-             strcmp(g_private->_phone.back().sound->c_str(), s) == 0)
+        // in the original scripts
+        if (g_private->_playedPhoneClips.contains(*sound))
             return;
 
+        g_private->_playedPhoneClips.setVal(*sound, true);
+        PhoneInfo *p = (PhoneInfo*) malloc(sizeof(PhoneInfo));
+        p->sound = sound;
+        p->flag = flag;
+        p->val = val;
         g_private->_phone.push_back(*p);
     }
-        
+
     else
         debug("error: invalid sound type %s", t);
 }
@@ -383,7 +385,7 @@ void PhoneClip(ArgArray args) {
         debug("Unimplemented PhoneClip special case");
         return;
     }
-    
+
     AddSound(args[0].u.str, "PhoneClip", args[4].u.sym, args[5].u.val);
 }
 
@@ -488,7 +490,7 @@ static struct FuncTable {
     { LoadGame,        "LoadGame"},
     { SaveGame,        "SaveGame"},
     { AskSave,         "AskSave"},
-    
+
     { DossierAdd,      "DossierAdd"},
     { Inventory,       "Inventory"},
     { CRect,           "CRect"},
diff --git a/engines/private/grammar.tab.cpp b/engines/private/grammar.tab.cpp
index 10d8cdee28..90b44daaa4 100644
--- a/engines/private/grammar.tab.cpp
+++ b/engines/private/grammar.tab.cpp
@@ -91,12 +91,12 @@ extern int yyparse();
 
 void yyerror(const char *str)
 {
-	//fprintf(stderr,"error: %s\n",str);
+    //fprintf(stderr,"error: %s\n",str);
 }
 
 int yywrap()
 {
-	return 1;
+    return 1;
 }
 
 
@@ -127,55 +127,55 @@ int yywrap()
 /* Symbol kind.  */
 enum yysymbol_kind_t
 {
-  YYSYMBOL_YYEMPTY = -2,
-  YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
-  YYSYMBOL_YYerror = 1,                    /* error  */
-  YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
-  YYSYMBOL_NAME = 3,                       /* NAME  */
-  YYSYMBOL_STRING = 4,                     /* STRING  */
-  YYSYMBOL_NUM = 5,                        /* NUM  */
-  YYSYMBOL_LTE = 6,                        /* LTE  */
-  YYSYMBOL_GTE = 7,                        /* GTE  */
-  YYSYMBOL_NEQ = 8,                        /* NEQ  */
-  YYSYMBOL_EQ = 9,                         /* EQ  */
-  YYSYMBOL_FALSETOK = 10,                  /* FALSETOK  */
-  YYSYMBOL_TRUETOK = 11,                   /* TRUETOK  */
-  YYSYMBOL_NULLTOK = 12,                   /* NULLTOK  */
-  YYSYMBOL_IFTOK = 13,                     /* IFTOK  */
-  YYSYMBOL_ELSETOK = 14,                   /* ELSETOK  */
-  YYSYMBOL_RECT = 15,                      /* RECT  */
-  YYSYMBOL_GOTOTOK = 16,                   /* GOTOTOK  */
-  YYSYMBOL_DEBUGTOK = 17,                  /* DEBUGTOK  */
-  YYSYMBOL_DEFINETOK = 18,                 /* DEFINETOK  */
-  YYSYMBOL_SETTINGTOK = 19,                /* SETTINGTOK  */
-  YYSYMBOL_RANDOMTOK = 20,                 /* RANDOMTOK  */
-  YYSYMBOL_21_ = 21,                       /* '{'  */
-  YYSYMBOL_22_ = 22,                       /* '}'  */
-  YYSYMBOL_23_ = 23,                       /* ','  */
-  YYSYMBOL_24_ = 24,                       /* ';'  */
-  YYSYMBOL_25_ = 25,                       /* '('  */
-  YYSYMBOL_26_ = 26,                       /* ')'  */
-  YYSYMBOL_27_ = 27,                       /* '!'  */
-  YYSYMBOL_28_ = 28,                       /* '+'  */
-  YYSYMBOL_29_ = 29,                       /* '<'  */
-  YYSYMBOL_30_ = 30,                       /* '>'  */
-  YYSYMBOL_31_ = 31,                       /* '%'  */
-  YYSYMBOL_YYACCEPT = 32,                  /* $accept  */
-  YYSYMBOL_lines = 33,                     /* lines  */
-  YYSYMBOL_line = 34,                      /* line  */
-  YYSYMBOL_debug = 35,                     /* debug  */
-  YYSYMBOL_statements = 36,                /* statements  */
-  YYSYMBOL_statement = 37,                 /* statement  */
-  YYSYMBOL_body = 38,                      /* body  */
-  YYSYMBOL_end = 39,                       /* end  */
-  YYSYMBOL_if = 40,                        /* if  */
-  YYSYMBOL_cond = 41,                      /* cond  */
-  YYSYMBOL_define = 42,                    /* define  */
-  YYSYMBOL_fcall = 43,                     /* fcall  */
-  YYSYMBOL_startp = 44,                    /* startp  */
-  YYSYMBOL_params = 45,                    /* params  */
-  YYSYMBOL_value = 46,                     /* value  */
-  YYSYMBOL_expr = 47                       /* expr  */
+    YYSYMBOL_YYEMPTY = -2,
+    YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
+    YYSYMBOL_YYerror = 1,                    /* error  */
+    YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
+    YYSYMBOL_NAME = 3,                       /* NAME  */
+    YYSYMBOL_STRING = 4,                     /* STRING  */
+    YYSYMBOL_NUM = 5,                        /* NUM  */
+    YYSYMBOL_LTE = 6,                        /* LTE  */
+    YYSYMBOL_GTE = 7,                        /* GTE  */
+    YYSYMBOL_NEQ = 8,                        /* NEQ  */
+    YYSYMBOL_EQ = 9,                         /* EQ  */
+    YYSYMBOL_FALSETOK = 10,                  /* FALSETOK  */
+    YYSYMBOL_TRUETOK = 11,                   /* TRUETOK  */
+    YYSYMBOL_NULLTOK = 12,                   /* NULLTOK  */
+    YYSYMBOL_IFTOK = 13,                     /* IFTOK  */
+    YYSYMBOL_ELSETOK = 14,                   /* ELSETOK  */
+    YYSYMBOL_RECT = 15,                      /* RECT  */
+    YYSYMBOL_GOTOTOK = 16,                   /* GOTOTOK  */
+    YYSYMBOL_DEBUGTOK = 17,                  /* DEBUGTOK  */
+    YYSYMBOL_DEFINETOK = 18,                 /* DEFINETOK  */
+    YYSYMBOL_SETTINGTOK = 19,                /* SETTINGTOK  */
+    YYSYMBOL_RANDOMTOK = 20,                 /* RANDOMTOK  */
+    YYSYMBOL_21_ = 21,                       /* '{'  */
+    YYSYMBOL_22_ = 22,                       /* '}'  */
+    YYSYMBOL_23_ = 23,                       /* ','  */
+    YYSYMBOL_24_ = 24,                       /* ';'  */
+    YYSYMBOL_25_ = 25,                       /* '('  */
+    YYSYMBOL_26_ = 26,                       /* ')'  */
+    YYSYMBOL_27_ = 27,                       /* '!'  */
+    YYSYMBOL_28_ = 28,                       /* '+'  */
+    YYSYMBOL_29_ = 29,                       /* '<'  */
+    YYSYMBOL_30_ = 30,                       /* '>'  */
+    YYSYMBOL_31_ = 31,                       /* '%'  */
+    YYSYMBOL_YYACCEPT = 32,                  /* $accept  */
+    YYSYMBOL_lines = 33,                     /* lines  */
+    YYSYMBOL_line = 34,                      /* line  */
+    YYSYMBOL_debug = 35,                     /* debug  */
+    YYSYMBOL_statements = 36,                /* statements  */
+    YYSYMBOL_statement = 37,                 /* statement  */
+    YYSYMBOL_body = 38,                      /* body  */
+    YYSYMBOL_end = 39,                       /* end  */
+    YYSYMBOL_if = 40,                        /* if  */
+    YYSYMBOL_cond = 41,                      /* cond  */
+    YYSYMBOL_define = 42,                    /* define  */
+    YYSYMBOL_fcall = 43,                     /* fcall  */
+    YYSYMBOL_startp = 44,                    /* startp  */
+    YYSYMBOL_params = 45,                    /* params  */
+    YYSYMBOL_value = 46,                     /* value  */
+    YYSYMBOL_expr = 47                       /* expr  */
 };
 typedef enum yysymbol_kind_t yysymbol_kind_t;
 
@@ -374,7 +374,7 @@ typedef int yy_state_fast_t;
 #    define YYSTACK_ALLOC alloca
 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
+/* Use EXIT_SUCCESS as a witness for stdlib.h.  */
 #     ifndef EXIT_SUCCESS
 #      define EXIT_SUCCESS 0
 #     endif
@@ -384,13 +384,13 @@ typedef int yy_state_fast_t;
 # endif
 
 # ifdef YYSTACK_ALLOC
-   /* Pacify GCC's 'empty if-body' warning.  */
+/* Pacify GCC's 'empty if-body' warning.  */
 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (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.  */
+/* 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
@@ -429,8 +429,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
 {
-  yy_state_t yyss_alloc;
-  YYSTYPE yyvs_alloc;
+    yy_state_t yyss_alloc;
+    YYSTYPE yyvs_alloc;
 };
 
 /* The size of the maximum gap between one aligned stack and the next.  */
@@ -511,46 +511,46 @@ union yyalloc
    as returned by yylex.  */
 static const yytype_int8 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,    27,     2,     2,     2,    31,     2,     2,
-      25,    26,     2,    28,    23,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,    24,
-      29,     2,    30,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,    21,     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,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     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,
-      15,    16,    17,    18,    19,    20
+    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,    27,     2,     2,     2,    31,     2,     2,
+    25,    26,     2,    28,    23,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,    24,
+    29,     2,    30,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,    21,     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,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+    2,     2,     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,
+    15,    16,    17,    18,    19,    20
 };
 
 #if YYDEBUG
-  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
+/* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
-       0,    54,    54,    55,    58,    59,    60,    63,    64,    67,
-      68,    71,    78,    79,    84,    92,    93,    96,    99,   102,
-     105,   106,   111,   115,   116,   119,   127,   128,   136,   139,
-     140,   141,   142,   143,   146,   147,   148,   149,   150,   151,
-     154,   155,   156,   157,   158,   159,   160,   161,   162,   163,
-     164
+    0,    54,    54,    55,    58,    59,    60,    63,    64,    67,
+    68,    71,    78,    79,    84,    92,    93,    96,    99,   102,
+    105,   106,   111,   115,   116,   119,   127,   128,   136,   139,
+    140,   141,   142,   143,   146,   147,   148,   149,   150,   151,
+    154,   155,   156,   157,   158,   159,   160,   161,   162,   163,
+    164
 };
 #endif
 
@@ -566,19 +566,19 @@ static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
 static const char *const yytname[] =
 {
-  "\"end of file\"", "error", "\"invalid token\"", "NAME", "STRING",
-  "NUM", "LTE", "GTE", "NEQ", "EQ", "FALSETOK", "TRUETOK", "NULLTOK",
-  "IFTOK", "ELSETOK", "RECT", "GOTOTOK", "DEBUGTOK", "DEFINETOK",
-  "SETTINGTOK", "RANDOMTOK", "'{'", "'}'", "','", "';'", "'('", "')'",
-  "'!'", "'+'", "'<'", "'>'", "'%'", "$accept", "lines", "line", "debug",
-  "statements", "statement", "body", "end", "if", "cond", "define",
-  "fcall", "startp", "params", "value", "expr", YY_NULLPTR
+    "\"end of file\"", "error", "\"invalid token\"", "NAME", "STRING",
+    "NUM", "LTE", "GTE", "NEQ", "EQ", "FALSETOK", "TRUETOK", "NULLTOK",
+    "IFTOK", "ELSETOK", "RECT", "GOTOTOK", "DEBUGTOK", "DEFINETOK",
+    "SETTINGTOK", "RANDOMTOK", "'{'", "'}'", "','", "';'", "'('", "')'",
+    "'!'", "'+'", "'<'", "'>'", "'%'", "$accept", "lines", "line", "debug",
+    "statements", "statement", "body", "end", "if", "cond", "define",
+    "fcall", "startp", "params", "value", "expr", YY_NULLPTR
 };
 
 static const char *
 yysymbol_name (yysymbol_kind_t yysymbol)
 {
-  return yytname[yysymbol];
+    return yytname[yysymbol];
 }
 #endif
 
@@ -587,10 +587,10 @@ yysymbol_name (yysymbol_kind_t yysymbol)
    (internal) symbol number NUM (which must be that of a token).  */
 static const yytype_int16 yytoknum[] =
 {
-       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
-     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
-     275,   123,   125,    44,    59,    40,    41,    33,    43,    60,
-      62,    37
+    0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
+    265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
+    275,   123,   125,    44,    59,    40,    41,    33,    43,    60,
+    62,    37
 };
 #endif
 
@@ -604,132 +604,132 @@ static const yytype_int16 yytoknum[] =
 #define yytable_value_is_error(Yyn) \
   0
 
-  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-     STATE-NUM.  */
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+   STATE-NUM.  */
 static const yytype_int8 yypact[] =
 {
-       8,   -11,    11,    12,    18,     8,    30,    22,    23,   -73,
-     -73,    24,    38,    42,    59,    30,   -73,    40,    39,    41,
-     -73,    54,    16,    58,    59,    56,    60,   -73,     5,   -73,
-     -73,    77,    61,    83,   -73,   -73,    19,    52,   -73,    62,
-     -73,     1,    65,   -73,    63,   -73,   -73,   -73,   -73,   -73,
-     -73,    67,    66,    29,    64,    59,   -73,   -73,    86,    41,
-      68,    71,    69,    73,    92,   -73,    93,   -73,    66,    66,
-      66,    66,    66,    66,    66,   -73,    78,    50,    76,     1,
-     -73,     1,    79,    70,   -73,   -73,   -73,   -73,   -73,   -73,
-     -73,   -73,    52,    98,   -73,   -73,    99,    80,   -73,    82,
-      84,   -73,   -73,   103,   104,    87,    85,   107,   -73,    88,
-      90,    42,   -73
+    8,   -11,    11,    12,    18,     8,    30,    22,    23,   -73,
+    -73,    24,    38,    42,    59,    30,   -73,    40,    39,    41,
+    -73,    54,    16,    58,    59,    56,    60,   -73,     5,   -73,
+    -73,    77,    61,    83,   -73,   -73,    19,    52,   -73,    62,
+    -73,     1,    65,   -73,    63,   -73,   -73,   -73,   -73,   -73,
+    -73,    67,    66,    29,    64,    59,   -73,   -73,    86,    41,
+    68,    71,    69,    73,    92,   -73,    93,   -73,    66,    66,
+    66,    66,    66,    66,    66,   -73,    78,    50,    76,     1,
+    -73,     1,    79,    70,   -73,   -73,   -73,   -73,   -73,   -73,
+    -73,   -73,    52,    98,   -73,   -73,    99,    80,   -73,    82,
+    84,   -73,   -73,   103,   104,    87,    85,   107,   -73,    88,
+    90,    42,   -73
 };
 
-  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
-     Performed when YYTABLE does not specify something else to do.  Zero
-     means the default is an error.  */
+/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+   Performed when YYTABLE does not specify something else to do.  Zero
+   means the default is an error.  */
 static const yytype_int8 yydefact[] =
 {
-       0,     0,     0,     0,     0,     3,     7,     0,     0,     1,
-       2,     0,     0,    20,     9,     7,     4,    24,     0,     0,
-      18,     0,     0,     0,     9,     0,     0,     8,    20,     5,
-      28,     0,     0,     0,     6,    10,     0,     0,    12,     0,
-      23,    29,     0,    11,     0,    39,    38,    37,    35,    36,
-      34,     0,     0,    40,     0,     9,    15,    17,     0,    39,
-       0,    33,     0,    32,     0,    25,     0,    41,     0,     0,
-       0,     0,    49,     0,     0,    19,     0,    13,     0,    29,
-      27,    29,     0,     0,    47,    48,    43,    42,    44,    45,
-      46,    16,     0,     0,    30,    31,     0,     0,    17,     0,
-       0,    50,    14,     0,     0,     0,     0,     0,    26,     0,
-      22,    20,    21
+    0,     0,     0,     0,     0,     3,     7,     0,     0,     1,
+    2,     0,     0,    20,     9,     7,     4,    24,     0,     0,
+    18,     0,     0,     0,     9,     0,     0,     8,    20,     5,
+    28,     0,     0,     0,     6,    10,     0,     0,    12,     0,
+    23,    29,     0,    11,     0,    39,    38,    37,    35,    36,
+    34,     0,     0,    40,     0,     9,    15,    17,     0,    39,
+    0,    33,     0,    32,     0,    25,     0,    41,     0,     0,
+    0,     0,    49,     0,     0,    19,     0,    13,     0,    29,
+    27,    29,     0,     0,    47,    48,    43,    42,    44,    45,
+    46,    16,     0,     0,    30,    31,     0,     0,    17,     0,
+    0,    50,    14,     0,     0,     0,     0,     0,    26,     0,
+    22,    20,    21
 };
 
-  /* YYPGOTO[NTERM-NUM].  */
+/* YYPGOTO[NTERM-NUM].  */
 static const yytype_int8 yypgoto[] =
 {
-     -73,   110,   -73,   101,   -21,   -36,    25,    20,   -73,   -73,
-     -28,   -39,   -73,   -72,   -20,    89
-};
+    -73,   110,   -73,   101,   -21,   -36,    25,    20,   -73,   -73,
+        -28,   -39,   -73,   -72,   -20,    89
+    };
 
-  /* YYDEFGOTO[NTERM-NUM].  */
+/* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int8 yydefgoto[] =
 {
-      -1,     4,     5,    12,    23,    24,    57,    77,    25,    37,
-      18,    26,    41,    62,    53,    63
-};
+    -1,     4,     5,    12,    23,    24,    57,    77,    25,    37,
+        18,    26,    41,    62,    53,    63
+    };
 
-  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
-     positive, shift that token.  If negative, reduce the rule whose
-     number is the opposite.  If YYTABLE_NINF, syntax error.  */
+/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
+   positive, shift that token.  If negative, reduce the rule whose
+   number is the opposite.  If YYTABLE_NINF, syntax error.  */
 static const yytype_int8 yytable[] =
 {
-      40,    56,    61,    35,    59,    46,    47,    94,    17,    95,
-       6,    48,    49,    50,     7,     8,    21,    60,     9,    32,
-      39,    51,    45,    46,    47,     1,     2,     3,    52,    48,
-      49,    50,    67,    11,    76,    68,    69,    70,    71,    51,
-      61,    33,    61,    13,    14,    17,    52,    15,    84,    85,
-      86,    87,    88,    89,    90,    19,    56,    72,    73,    74,
-      16,    29,    19,    28,    92,    20,    30,    21,    22,    45,
-      46,    47,    20,    55,    21,    22,    48,    49,    50,    31,
-      34,    36,    42,   112,    38,    43,    44,    58,    64,    65,
-      75,    78,    66,    33,    79,    80,    81,    82,    83,    93,
-      91,    97,    96,    99,   100,   103,   101,   104,   105,   106,
-     107,   108,   109,   111,   110,    10,    27,    98,   102,     0,
-       0,     0,     0,     0,     0,    54
+    40,    56,    61,    35,    59,    46,    47,    94,    17,    95,
+    6,    48,    49,    50,     7,     8,    21,    60,     9,    32,
+    39,    51,    45,    46,    47,     1,     2,     3,    52,    48,
+    49,    50,    67,    11,    76,    68,    69,    70,    71,    51,
+    61,    33,    61,    13,    14,    17,    52,    15,    84,    85,
+    86,    87,    88,    89,    90,    19,    56,    72,    73,    74,
+    16,    29,    19,    28,    92,    20,    30,    21,    22,    45,
+    46,    47,    20,    55,    21,    22,    48,    49,    50,    31,
+    34,    36,    42,   112,    38,    43,    44,    58,    64,    65,
+    75,    78,    66,    33,    79,    80,    81,    82,    83,    93,
+    91,    97,    96,    99,   100,   103,   101,   104,   105,   106,
+    107,   108,   109,   111,   110,    10,    27,    98,   102,     0,
+    0,     0,     0,     0,     0,    54
 };
 
 static const yytype_int8 yycheck[] =
 {
-      28,    37,    41,    24,     3,     4,     5,    79,     3,    81,
-      21,    10,    11,    12,     3,     3,    15,    16,     0,     3,
-      15,    20,     3,     4,     5,    17,    18,    19,    27,    10,
-      11,    12,    52,     3,    55,     6,     7,     8,     9,    20,
-      79,    25,    81,    21,    21,     3,    27,    23,    68,    69,
-      70,    71,    72,    73,    74,     3,    92,    28,    29,    30,
-      22,    22,     3,    23,    14,    13,    25,    15,    16,     3,
-       4,     5,    13,    21,    15,    16,    10,    11,    12,    25,
-      22,    25,     5,   111,    24,    24,     3,    25,    23,    26,
-      26,     5,    25,    25,    23,    26,    23,     5,     5,    23,
-      22,    31,    23,     5,     5,    23,    26,    23,     5,     5,
-      23,    26,     5,    23,    26,     5,    15,    92,    98,    -1,
-      -1,    -1,    -1,    -1,    -1,    36
+    28,    37,    41,    24,     3,     4,     5,    79,     3,    81,
+    21,    10,    11,    12,     3,     3,    15,    16,     0,     3,
+    15,    20,     3,     4,     5,    17,    18,    19,    27,    10,
+    11,    12,    52,     3,    55,     6,     7,     8,     9,    20,
+    79,    25,    81,    21,    21,     3,    27,    23,    68,    69,
+    70,    71,    72,    73,    74,     3,    92,    28,    29,    30,
+    22,    22,     3,    23,    14,    13,    25,    15,    16,     3,
+    4,     5,    13,    21,    15,    16,    10,    11,    12,    25,
+    22,    25,     5,   111,    24,    24,     3,    25,    23,    26,
+    26,     5,    25,    25,    23,    26,    23,     5,     5,    23,
+    22,    31,    23,     5,     5,    23,    26,    23,     5,     5,
+    23,    26,     5,    23,    26,     5,    15,    92,    98,    -1,
+    -1,    -1,    -1,    -1,    -1,    36
 };
 
-  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-     symbol of state STATE-NUM.  */
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+   symbol of state STATE-NUM.  */
 static const yytype_int8 yystos[] =
 {
-       0,    17,    18,    19,    33,    34,    21,     3,     3,     0,
-      33,     3,    35,    21,    21,    23,    22,     3,    42,     3,
-      13,    15,    16,    36,    37,    40,    43,    35,    23,    22,
-      25,    25,     3,    25,    22,    36,    25,    41,    24,    15,
-      42,    44,     5,    24,     3,     3,     4,     5,    10,    11,
-      12,    20,    27,    46,    47,    21,    37,    38,    25,     3,
-      16,    43,    45,    47,    23,    26,    25,    46,     6,     7,
-       8,     9,    28,    29,    30,    26,    36,    39,     5,    23,
-      26,    23,     5,     5,    46,    46,    46,    46,    46,    46,
-      46,    22,    14,    23,    45,    45,    23,    31,    38,     5,
-       5,    26,    39,    23,    23,     5,     5,    23,    26,     5,
-      26,    23,    42
+    0,    17,    18,    19,    33,    34,    21,     3,     3,     0,
+    33,     3,    35,    21,    21,    23,    22,     3,    42,     3,
+    13,    15,    16,    36,    37,    40,    43,    35,    23,    22,
+    25,    25,     3,    25,    22,    36,    25,    41,    24,    15,
+    42,    44,     5,    24,     3,     3,     4,     5,    10,    11,
+    12,    20,    27,    46,    47,    21,    37,    38,    25,     3,
+    16,    43,    45,    47,    23,    26,    25,    46,     6,     7,
+    8,     9,    28,    29,    30,    26,    36,    39,     5,    23,
+    26,    23,     5,     5,    46,    46,    46,    46,    46,    46,
+    46,    22,    14,    23,    45,    45,    23,    31,    38,     5,
+    5,    26,    39,    23,    23,     5,     5,    23,    26,     5,
+    26,    23,    42
 };
 
-  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_int8 yyr1[] =
 {
-       0,    32,    33,    33,    34,    34,    34,    35,    35,    36,
-      36,    37,    37,    37,    37,    38,    38,    39,    40,    41,
-      42,    42,    42,    42,    42,    43,    43,    43,    44,    45,
-      45,    45,    45,    45,    46,    46,    46,    46,    46,    46,
-      47,    47,    47,    47,    47,    47,    47,    47,    47,    47,
-      47
+    0,    32,    33,    33,    34,    34,    34,    35,    35,    36,
+    36,    37,    37,    37,    37,    38,    38,    39,    40,    41,
+    42,    42,    42,    42,    42,    43,    43,    43,    44,    45,
+    45,    45,    45,    45,    46,    46,    46,    46,    46,    46,
+    47,    47,    47,    47,    47,    47,    47,    47,    47,    47,
+    47
 };
 
-  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
+/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
 static const yytype_int8 yyr2[] =
 {
-       0,     2,     2,     1,     4,     5,     5,     0,     3,     0,
-       2,     3,     2,     4,     7,     1,     3,     0,     1,     3,
-       0,    14,    12,     3,     1,     4,    10,     5,     0,     0,
-       3,     3,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     2,     3,     3,     3,     3,     3,     3,     3,     2,
-       5
+    0,     2,     2,     1,     4,     5,     5,     0,     3,     0,
+    2,     3,     2,     4,     7,     1,     3,     0,     1,     3,
+    0,    14,    12,     3,     1,     4,    10,     5,     0,     0,
+    3,     3,     1,     1,     1,     1,     1,     1,     1,     1,
+    1,     2,     3,     3,     3,     3,     3,     3,     3,     2,
+    5
 };
 
 
@@ -807,17 +807,17 @@ static void
 yy_symbol_value_print (FILE *yyo,
                        yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
 {
-  FILE *yyoutput = yyo;
-  YYUSE (yyoutput);
-  if (!yyvaluep)
-    return;
+    FILE *yyoutput = yyo;
+    YYUSE (yyoutput);
+    if (!yyvaluep)
+        return;
 # ifdef YYPRINT
-  if (yykind < YYNTOKENS)
-    YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
+    if (yykind < YYNTOKENS)
+        YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
 # endif
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  YYUSE (yykind);
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
+    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+    YYUSE (yykind);
+    YY_IGNORE_MAYBE_UNINITIALIZED_END
 }
 
 
@@ -829,11 +829,11 @@ static void
 yy_symbol_print (FILE *yyo,
                  yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
 {
-  YYFPRINTF (yyo, "%s %s (",
-             yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
+    YYFPRINTF (yyo, "%s %s (",
+               yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
 
-  yy_symbol_value_print (yyo, yykind, yyvaluep);
-  YYFPRINTF (yyo, ")");
+    yy_symbol_value_print (yyo, yykind, yyvaluep);
+    YYFPRINTF (yyo, ")");
 }
 
 /*------------------------------------------------------------------.
@@ -844,13 +844,13 @@ yy_symbol_print (FILE *yyo,
 static void
 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
 {
-  YYFPRINTF (stderr, "Stack now");
-  for (; yybottom <= yytop; yybottom++)
+    YYFPRINTF (stderr, "Stack now");
+    for (; yybottom <= yytop; yybottom++)
     {
-      int yybot = *yybottom;
-      YYFPRINTF (stderr, " %d", yybot);
+        int yybot = *yybottom;
+        YYFPRINTF (stderr, " %d", yybot);
     }
-  YYFPRINTF (stderr, "\n");
+    YYFPRINTF (stderr, "\n");
 }
 
 # define YY_STACK_PRINT(Bottom, Top)                            \
@@ -868,19 +868,19 @@ static void
 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
                  int yyrule)
 {
-  int yylno = yyrline[yyrule];
-  int yynrhs = yyr2[yyrule];
-  int yyi;
-  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
-             yyrule - 1, yylno);
-  /* The symbols being reduced.  */
-  for (yyi = 0; yyi < yynrhs; yyi++)
+    int yylno = yyrline[yyrule];
+    int yynrhs = yyr2[yyrule];
+    int yyi;
+    YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
+               yyrule - 1, yylno);
+    /* The symbols being reduced.  */
+    for (yyi = 0; yyi < yynrhs; yyi++)
     {
-      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
-      yy_symbol_print (stderr,
-                       YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
-                       &yyvsp[(yyi + 1) - (yynrhs)]);
-      YYFPRINTF (stderr, "\n");
+        YYFPRINTF (stderr, "   $%d = ", yyi + 1);
+        yy_symbol_print (stderr,
+                         YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
+                         &yyvsp[(yyi + 1) - (yynrhs)]);
+        YYFPRINTF (stderr, "\n");
     }
 }
 
@@ -930,14 +930,14 @@ static void
 yydestruct (const char *yymsg,
             yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
 {
-  YYUSE (yyvaluep);
-  if (!yymsg)
-    yymsg = "Deleting";
-  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
-
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  YYUSE (yykind);
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
+    YYUSE (yyvaluep);
+    if (!yymsg)
+        yymsg = "Deleting";
+    YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
+
+    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+    YYUSE (yykind);
+    YY_IGNORE_MAYBE_UNINITIALIZED_END
 }
 
 
@@ -979,706 +979,784 @@ yyparse (void)
     YYSTYPE *yyvs = yyvsa;
     YYSTYPE *yyvsp = yyvs;
 
-  int yyn;
-  /* The return value of yyparse.  */
-  int yyresult;
-  /* Lookahead symbol kind.  */
-  yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
-  /* The variables used to return semantic value and location from the
-     action routines.  */
-  YYSTYPE yyval;
+    int yyn;
+    /* The return value of yyparse.  */
+    int yyresult;
+    /* Lookahead symbol kind.  */
+    yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
+    /* The variables used to return semantic value and location from the
+       action routines.  */
+    YYSTYPE yyval;
 
 
 
 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 
-  /* The number of symbols on the RHS of the reduced rule.
-     Keep to zero when no symbol should be popped.  */
-  int yylen = 0;
+    /* 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"));
+    YYDPRINTF ((stderr, "Starting parse\n"));
 
-  yychar = YYEMPTY; /* Cause a token to be read.  */
-  goto yysetstate;
+    yychar = YYEMPTY; /* Cause a token to be read.  */
+    goto yysetstate;
 
 
-/*------------------------------------------------------------.
-| yynewstate -- push a new state, which is found in yystate.  |
-`------------------------------------------------------------*/
+    /*------------------------------------------------------------.
+    | 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++;
+    /* 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 -- set current state (the top of the stack) to yystate.  |
-`--------------------------------------------------------------------*/
+    /*--------------------------------------------------------------------.
+    | yysetstate -- set current state (the top of the stack) to yystate.  |
+    `--------------------------------------------------------------------*/
 yysetstate:
-  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
-  YY_IGNORE_USELESS_CAST_BEGIN
-  *yyssp = YY_CAST (yy_state_t, yystate);
-  YY_IGNORE_USELESS_CAST_END
-  YY_STACK_PRINT (yyss, yyssp);
-
-  if (yyss + yystacksize - 1 <= yyssp)
+    YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+    YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
+    YY_IGNORE_USELESS_CAST_BEGIN
+    *yyssp = YY_CAST (yy_state_t, yystate);
+    YY_IGNORE_USELESS_CAST_END
+    YY_STACK_PRINT (yyss, yyssp);
+
+    if (yyss + yystacksize - 1 <= yyssp)
 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
-    goto yyexhaustedlab;
+        goto yyexhaustedlab;
 #else
     {
-      /* Get the current used size of the three stacks, in elements.  */
-      YYPTRDIFF_T yysize = yyssp - yyss + 1;
+        /* Get the current used size of the three stacks, in elements.  */
+        YYPTRDIFF_T yysize = yyssp - yyss + 1;
 
 # if defined 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.  */
-        yy_state_t *yyss1 = yyss;
-        YYSTYPE *yyvs1 = yyvs;
-
-        /* 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 * YYSIZEOF (*yyssp),
-                    &yyvs1, yysize * YYSIZEOF (*yyvsp),
-                    &yystacksize);
-        yyss = yyss1;
-        yyvs = yyvs1;
-      }
+        {
+            /* Give user a chance to reallocate the stack.  Use copies of
+               these so that the &'s don't force the real ones into
+               memory.  */
+            yy_state_t *yyss1 = yyss;
+            YYSTYPE *yyvs1 = yyvs;
+
+            /* 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 * YYSIZEOF (*yyssp),
+                        &yyvs1, yysize * YYSIZEOF (*yyvsp),
+                        &yystacksize);
+            yyss = yyss1;
+            yyvs = yyvs1;
+        }
 # else /* defined YYSTACK_RELOCATE */
-      /* Extend the stack our own way.  */
-      if (YYMAXDEPTH <= yystacksize)
-        goto yyexhaustedlab;
-      yystacksize *= 2;
-      if (YYMAXDEPTH < yystacksize)
-        yystacksize = YYMAXDEPTH;
-
-      {
-        yy_state_t *yyss1 = yyss;
-        union yyalloc *yyptr =
-          YY_CAST (union yyalloc *,
-                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
-        if (! yyptr)
-          goto yyexhaustedlab;
-        YYSTACK_RELOCATE (yyss_alloc, yyss);
-        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+        /* Extend the stack our own way.  */
+        if (YYMAXDEPTH <= yystacksize)
+            goto yyexhaustedlab;
+        yystacksize *= 2;
+        if (YYMAXDEPTH < yystacksize)
+            yystacksize = YYMAXDEPTH;
+
+        {
+            yy_state_t *yyss1 = yyss;
+            union yyalloc *yyptr =
+                    YY_CAST (union yyalloc *,
+                             YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
+            if (! yyptr)
+                goto yyexhaustedlab;
+            YYSTACK_RELOCATE (yyss_alloc, yyss);
+            YYSTACK_RELOCATE (yyvs_alloc, yyvs);
 #  undef YYSTACK_RELOCATE
-        if (yyss1 != yyssa)
-          YYSTACK_FREE (yyss1);
-      }
+            if (yyss1 != yyssa)
+                YYSTACK_FREE (yyss1);
+        }
 # endif
 
-      yyssp = yyss + yysize - 1;
-      yyvsp = yyvs + yysize - 1;
+        yyssp = yyss + yysize - 1;
+        yyvsp = yyvs + yysize - 1;
 
-      YY_IGNORE_USELESS_CAST_BEGIN
-      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
-                  YY_CAST (long, yystacksize)));
-      YY_IGNORE_USELESS_CAST_END
+        YY_IGNORE_USELESS_CAST_BEGIN
+        YYDPRINTF ((stderr, "Stack size increased to %ld\n",
+                    YY_CAST (long, yystacksize)));
+        YY_IGNORE_USELESS_CAST_END
 
-      if (yyss + yystacksize - 1 <= yyssp)
-        YYABORT;
+        if (yyss + yystacksize - 1 <= yyssp)
+            YYABORT;
     }
 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
 
-  if (yystate == YYFINAL)
-    YYACCEPT;
+    if (yystate == YYFINAL)
+        YYACCEPT;
 
-  goto yybackup;
+    goto yybackup;
 
 
-/*-----------.
-| yybackup.  |
-`-----------*/
+    /*-----------.
+    | yybackup.  |
+    `-----------*/
 yybackup:
-  /* Do appropriate processing given the current state.  Read a
-     lookahead token if we need one and don't already have one.  */
+    /* Do appropriate processing given the current state.  Read a
+       lookahead token if we need one and don't already have one.  */
 
-  /* First try to decide what to do without reference to lookahead token.  */
-  yyn = yypact[yystate];
-  if (yypact_value_is_default (yyn))
-    goto yydefault;
+    /* First try to decide what to do without reference to lookahead token.  */
+    yyn = yypact[yystate];
+    if (yypact_value_is_default (yyn))
+        goto yydefault;
 
-  /* Not known => get a lookahead token if don't already have one.  */
+    /* Not known => get a lookahead token if don't already have one.  */
 
-  /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
-  if (yychar == YYEMPTY)
+    /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
+    if (yychar == YYEMPTY)
     {
-      YYDPRINTF ((stderr, "Reading a token\n"));
-      yychar = yylex ();
+        YYDPRINTF ((stderr, "Reading a token\n"));
+        yychar = yylex ();
     }
 
-  if (yychar <= YYEOF)
+    if (yychar <= YYEOF)
     {
-      yychar = YYEOF;
-      yytoken = YYSYMBOL_YYEOF;
-      YYDPRINTF ((stderr, "Now at end of input.\n"));
+        yychar = YYEOF;
+        yytoken = YYSYMBOL_YYEOF;
+        YYDPRINTF ((stderr, "Now at end of input.\n"));
     }
-  else if (yychar == YYerror)
+    else if (yychar == YYerror)
     {
-      /* The scanner already issued an error message, process directly
-         to error recovery.  But do not keep the error token as
-         lookahead, it is too special and may lead us to an endless
-         loop in error recovery. */
-      yychar = YYUNDEF;
-      yytoken = YYSYMBOL_YYerror;
-      goto yyerrlab1;
+        /* The scanner already issued an error message, process directly
+           to error recovery.  But do not keep the error token as
+           lookahead, it is too special and may lead us to an endless
+           loop in error recovery. */
+        yychar = YYUNDEF;
+        yytoken = YYSYMBOL_YYerror;
+        goto yyerrlab1;
     }
-  else
+    else
     {
-      yytoken = YYTRANSLATE (yychar);
-      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+        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 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 (yytable_value_is_error (yyn))
-        goto yyerrlab;
-      yyn = -yyn;
-      goto yyreduce;
+        if (yytable_value_is_error (yyn))
+            goto yyerrlab;
+        yyn = -yyn;
+        goto yyreduce;
     }
 
-  /* Count tokens shifted since error; after three, turn off error
-     status.  */
-  if (yyerrstatus)
-    yyerrstatus--;
+    /* Count tokens shifted since error; after three, turn off error
+       status.  */
+    if (yyerrstatus)
+        yyerrstatus--;
 
-  /* Shift the lookahead token.  */
-  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-  yystate = yyn;
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  *++yyvsp = yylval;
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
+    /* Shift the lookahead token.  */
+    YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+    yystate = yyn;
+    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+    *++yyvsp = yylval;
+    YY_IGNORE_MAYBE_UNINITIALIZED_END
 
-  /* Discard the shifted token.  */
-  yychar = YYEMPTY;
-  goto yynewstate;
+    /* Discard the shifted token.  */
+    yychar = YYEMPTY;
+    goto yynewstate;
 
 
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state.  |
-`-----------------------------------------------------------*/
+    /*-----------------------------------------------------------.
+    | yydefault -- do the default action for the current state.  |
+    `-----------------------------------------------------------*/
 yydefault:
-  yyn = yydefact[yystate];
-  if (yyn == 0)
-    goto yyerrlab;
-  goto yyreduce;
+    yyn = yydefact[yystate];
+    if (yyn == 0)
+        goto yyerrlab;
+    goto yyreduce;
 
 
-/*-----------------------------.
-| yyreduce -- do a reduction.  |
-`-----------------------------*/
+    /*-----------------------------.
+    | yyreduce -- do a reduction.  |
+    `-----------------------------*/
 yyreduce:
-  /* yyn is the number of a rule to reduce with.  */
-  yylen = yyr2[yyn];
+    /* 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'.
+    /* 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];
+       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)
+    YY_REDUCE_PRINT (yyn);
+    switch (yyn)
     {
-  case 4: /* line: DEBUGTOK '{' debug '}'  */
+    case 4: /* line: DEBUGTOK '{' debug '}'  */
 #line 58 "engines/private/grammar.y"
-                                             { /* Not used in the game */ }
+        { /* Not used in the game */ }
 #line 1203 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 5: /* line: DEFINETOK NAME '{' define '}'  */
+    case 5: /* line: DEFINETOK NAME '{' define '}'  */
 #line 59 "engines/private/grammar.y"
-                                             { installAll((yyvsp[-3].s)); }
+        {
+            installAll((yyvsp[-3].s));
+        }
 #line 1209 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 6: /* line: SETTINGTOK NAME '{' statements '}'  */
+    case 6: /* line: SETTINGTOK NAME '{' statements '}'  */
 #line 60 "engines/private/grammar.y"
-                                             { saveSetting((yyvsp[-3].s)); initSetting(); }
+        {
+            saveSetting((yyvsp[-3].s));
+            initSetting();
+        }
 #line 1215 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 9: /* statements: %empty  */
+    case 9: /* statements: %empty  */
 #line 67 "engines/private/grammar.y"
-                               { (yyval.inst) = progp; }
+        {
+            (yyval.inst) = progp;
+        }
 #line 1221 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 11: /* statement: GOTOTOK NAME ';'  */
+    case 11: /* statement: GOTOTOK NAME ';'  */
 #line 71 "engines/private/grammar.y"
-                            {
-        (yyval.inst) = progp;
-	code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s)));
-        code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
-        code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
-        code1(funcpush);
+        {
+            (yyval.inst) = progp;
+            code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s)));
+            code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
+            code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto"));
+            code1(funcpush);
         }
 #line 1233 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 12: /* statement: fcall ';'  */
+    case 12: /* statement: fcall ';'  */
 #line 78 "engines/private/grammar.y"
-                            { (yyval.inst) = (yyvsp[-1].inst); }
+        {
+            (yyval.inst) = (yyvsp[-1].inst);
+        }
 #line 1239 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 13: /* statement: if cond body end  */
+    case 13: /* statement: if cond body end  */
 #line 79 "engines/private/grammar.y"
-                           {
-         	/* else-less if */
-		((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst);	/* thenpart */
-		((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst); 
-                }
+        {
+            /* else-less if */
+            ((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst);	/* thenpart */
+            ((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst);
+        }
 #line 1249 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 14: /* statement: if cond body end ELSETOK body end  */
+    case 14: /* statement: if cond body end ELSETOK body end  */
 #line 84 "engines/private/grammar.y"
-                                            { 
-                /* if with else */
-		((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst);	/* thenpart */
-		((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst);	/* elsepart */
-		((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst); 
-                }
+        {
+            /* if with else */
+            ((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst);	/* thenpart */
+            ((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst);	/* elsepart */
+            ((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst);
+        }
 #line 1260 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 15: /* body: statement  */
+    case 15: /* body: statement  */
 #line 92 "engines/private/grammar.y"
-                             { (yyval.inst) = (yyvsp[0].inst); }
+        {
+            (yyval.inst) = (yyvsp[0].inst);
+        }
 #line 1266 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 16: /* body: '{' statements '}'  */
+    case 16: /* body: '{' statements '}'  */
 #line 93 "engines/private/grammar.y"
-                             { (yyval.inst) = (yyvsp[-1].inst); }
+        {
+            (yyval.inst) = (yyvsp[-1].inst);
+        }
 #line 1272 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 17: /* end: %empty  */
+    case 17: /* end: %empty  */
 #line 96 "engines/private/grammar.y"
-                                { code(STOP); (yyval.inst) = progp; }
+        {
+            code(STOP);
+            (yyval.inst) = progp;
+        }
 #line 1278 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 18: /* if: IFTOK  */
+    case 18: /* if: IFTOK  */
 #line 99 "engines/private/grammar.y"
-          { (yyval.inst) = code(ifcode); code3(STOP, STOP, STOP); }
+        {
+            (yyval.inst) = code(ifcode);
+            code3(STOP, STOP, STOP);
+        }
 #line 1284 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 19: /* cond: '(' expr ')'  */
+    case 19: /* cond: '(' expr ')'  */
 #line 102 "engines/private/grammar.y"
-                        { code(STOP); (yyval.inst) = (yyvsp[-1].inst); }
+        {
+            code(STOP);
+            (yyval.inst) = (yyvsp[-1].inst);
+        }
 #line 1290 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  */
+    case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  */
 #line 106 "engines/private/grammar.y"
-                                                                        { 
-          Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
-          assert(r->isValidRect()); 
-          defineSymbol((yyvsp[-13].s), r); 
-          }
+        {
+            Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
+            assert(r->isValidRect());
+            defineSymbol((yyvsp[-13].s), r);
+        }
 #line 1300 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
+    case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
 #line 111 "engines/private/grammar.y"
-                                                            {
-          Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);  
-          defineSymbol((yyvsp[-11].s), r); 
-          }
+        {
+            Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);
+            defineSymbol((yyvsp[-11].s), r);
+        }
 #line 1309 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 23: /* define: NAME ',' define  */
+    case 23: /* define: NAME ',' define  */
 #line 115 "engines/private/grammar.y"
-                          { defineSymbol((yyvsp[-2].s), NULL); }
+        {
+            defineSymbol((yyvsp[-2].s), NULL);
+        }
 #line 1315 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 24: /* define: NAME  */
+    case 24: /* define: NAME  */
 #line 116 "engines/private/grammar.y"
-                          { defineSymbol((yyvsp[0].s), NULL); }
+        {
+            defineSymbol((yyvsp[0].s), NULL);
+        }
 #line 1321 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 25: /* fcall: GOTOTOK '(' NAME ')'  */
+    case 25: /* fcall: GOTOTOK '(' NAME ')'  */
 #line 119 "engines/private/grammar.y"
-                               {
-                               (yyval.inst) = progp;
-                               code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s)));
-                               code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
-                               code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
-                               code1(funcpush);
-                               }
+        {
+            (yyval.inst) = progp;
+            code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s)));
+            code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
+            code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto"));
+            code1(funcpush);
+        }
 #line 1333 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
+    case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
 #line 127 "engines/private/grammar.y"
-                                                   { (yyval.inst) = progp; }
+        {
+            (yyval.inst) = progp;
+        }
 #line 1339 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 27: /* fcall: NAME '(' startp params ')'  */
+    case 27: /* fcall: NAME '(' startp params ')'  */
 #line 128 "engines/private/grammar.y"
-                                      {
-                               (yyval.inst) = (yyvsp[-2].inst);
-                               code2(constpush, (Private::Inst) constant(NUM, (yyvsp[-1].narg), NULL));
-                               code2(strpush, (Private::Inst) constant(STRING, 0, (yyvsp[-4].s))); 
-                               code1(funcpush);
-                               }
+        {
+            (yyval.inst) = (yyvsp[-2].inst);
+            code2(constpush, (Private::Inst) constant(NUM, (yyvsp[-1].narg), NULL));
+            code2(strpush, (Private::Inst) constant(STRING, 0, (yyvsp[-4].s)));
+            code1(funcpush);
+        }
 #line 1350 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 28: /* startp: %empty  */
+    case 28: /* startp: %empty  */
 #line 136 "engines/private/grammar.y"
-                    { (yyval.inst) = progp; }
+        {
+            (yyval.inst) = progp;
+        }
 #line 1356 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 29: /* params: %empty  */
+    case 29: /* params: %empty  */
 #line 139 "engines/private/grammar.y"
-                            { (yyval.narg) = 0; }
+        {
+            (yyval.narg) = 0;
+        }
 #line 1362 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 30: /* params: fcall ',' params  */
+    case 30: /* params: fcall ',' params  */
 #line 140 "engines/private/grammar.y"
-                            { (yyval.narg) = (yyvsp[0].narg) + 1; }
+        {
+            (yyval.narg) = (yyvsp[0].narg) + 1;
+        }
 #line 1368 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 31: /* params: expr ',' params  */
+    case 31: /* params: expr ',' params  */
 #line 141 "engines/private/grammar.y"
-                            { (yyval.narg) = (yyvsp[0].narg) + 1; }
+        {
+            (yyval.narg) = (yyvsp[0].narg) + 1;
+        }
 #line 1374 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 32: /* params: expr  */
+    case 32: /* params: expr  */
 #line 142 "engines/private/grammar.y"
-                      { (yyval.narg) = 1; }
+        {
+            (yyval.narg) = 1;
+        }
 #line 1380 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 33: /* params: fcall  */
+    case 33: /* params: fcall  */
 #line 143 "engines/private/grammar.y"
-                      { (yyval.narg) = 1; }
+        {
+            (yyval.narg) = 1;
+        }
 #line 1386 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 34: /* value: NULLTOK  */
+    case 34: /* value: NULLTOK  */
 #line 146 "engines/private/grammar.y"
-                   { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
+        {
+            code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL));
+        }
 #line 1392 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 35: /* value: FALSETOK  */
+    case 35: /* value: FALSETOK  */
 #line 147 "engines/private/grammar.y"
-                   { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
+        {
+            code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL));
+        }
 #line 1398 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 36: /* value: TRUETOK  */
+    case 36: /* value: TRUETOK  */
 #line 148 "engines/private/grammar.y"
-                   { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 1, NULL)); }
+        {
+            code2(Private::constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
+        }
 #line 1404 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 37: /* value: NUM  */
+    case 37: /* value: NUM  */
 #line 149 "engines/private/grammar.y"
-                   { code2(Private::constpush, (Private::Inst)(yyvsp[0].sym)); }
+        {
+            code2(Private::constpush, (Private::Inst)(yyvsp[0].sym));
+        }
 #line 1410 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 38: /* value: STRING  */
+    case 38: /* value: STRING  */
 #line 150 "engines/private/grammar.y"
-                   { code2(Private::strpush, (Private::Inst)(yyvsp[0].sym)); }
+        {
+            code2(Private::strpush, (Private::Inst)(yyvsp[0].sym));
+        }
 #line 1416 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 39: /* value: NAME  */
+    case 39: /* value: NAME  */
 #line 151 "engines/private/grammar.y"
-                   { code1(Private::varpush); code1((Private::Inst) lookupName((yyvsp[0].s))); code1(Private::eval); }
+        {
+            code1(Private::varpush);
+            code1((Private::Inst) lookupName((yyvsp[0].s)));
+            code1(Private::eval);
+        }
 #line 1422 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 40: /* expr: value  */
+    case 40: /* expr: value  */
 #line 154 "engines/private/grammar.y"
-                          { (yyval.inst) = (yyvsp[0].inst); }
+        {
+            (yyval.inst) = (yyvsp[0].inst);
+        }
 #line 1428 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 41: /* expr: '!' value  */
+    case 41: /* expr: '!' value  */
 #line 155 "engines/private/grammar.y"
-                          { code1(Private::negate); (yyval.inst) = (yyvsp[0].inst); }
+        {
+            code1(Private::negate);
+            (yyval.inst) = (yyvsp[0].inst);
+        }
 #line 1434 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 42: /* expr: value EQ value  */
+    case 42: /* expr: value EQ value  */
 #line 156 "engines/private/grammar.y"
-                          { code1(Private::eq); }
+        {
+            code1(Private::eq);
+        }
 #line 1440 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 43: /* expr: value NEQ value  */
+    case 43: /* expr: value NEQ value  */
 #line 157 "engines/private/grammar.y"
-                          { code1(Private::ne); }
+        {
+            code1(Private::ne);
+        }
 #line 1446 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 44: /* expr: value '+' value  */
+    case 44: /* expr: value '+' value  */
 #line 158 "engines/private/grammar.y"
-                          { code1(Private::add); }
+        {
+            code1(Private::add);
+        }
 #line 1452 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 45: /* expr: value '<' value  */
+    case 45: /* expr: value '<' value  */
 #line 159 "engines/private/grammar.y"
-                          { code1(Private::lt); }
+        {
+            code1(Private::lt);
+        }
 #line 1458 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 46: /* expr: value '>' value  */
+    case 46: /* expr: value '>' value  */
 #line 160 "engines/private/grammar.y"
-                          { code1(Private::gt); }
+        {
+            code1(Private::gt);
+        }
 #line 1464 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 47: /* expr: value LTE value  */
+    case 47: /* expr: value LTE value  */
 #line 161 "engines/private/grammar.y"
-                          { code1(Private::le); }
+        {
+            code1(Private::le);
+        }
 #line 1470 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 48: /* expr: value GTE value  */
+    case 48: /* expr: value GTE value  */
 #line 162 "engines/private/grammar.y"
-                          { code1(Private::ge); }
+        {
+            code1(Private::ge);
+        }
 #line 1476 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 49: /* expr: value '+'  */
+    case 49: /* expr: value '+'  */
 #line 163 "engines/private/grammar.y"
-                          { (yyval.inst) = (yyvsp[-1].inst); }
+        {
+            (yyval.inst) = (yyvsp[-1].inst);
+        }
 #line 1482 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
-  case 50: /* expr: RANDOMTOK '(' NUM '%' ')'  */
+    case 50: /* expr: RANDOMTOK '(' NUM '%' ')'  */
 #line 164 "engines/private/grammar.y"
-                                    { code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool); }
+        {
+            code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool);
+        }
 #line 1488 "engines/private/grammar.tab.cpp"
-    break;
+        break;
 
 
 #line 1492 "engines/private/grammar.tab.cpp"
 
-      default: break;
+    default:
+        break;
     }
-  /* User semantic actions sometimes alter yychar, and that requires
-     that yytoken be updated with the new translation.  We take the
-     approach of translating immediately before every use of yytoken.
-     One alternative is translating here after every semantic action,
-     but that translation would be missed if the semantic action invokes
-     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
-     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
-     incorrect destructor might then be invoked immediately.  In the
-     case of YYERROR or YYBACKUP, subsequent parser actions might lead
-     to an incorrect destructor call or verbose syntax error message
-     before the lookahead is translated.  */
-  YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
-
-  YYPOPSTACK (yylen);
-  yylen = 0;
-
-  *++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.  */
-  {
-    const int yylhs = yyr1[yyn] - YYNTOKENS;
-    const int yyi = yypgoto[yylhs] + *yyssp;
-    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
-               ? yytable[yyi]
-               : yydefgoto[yylhs]);
-  }
-
-  goto yynewstate;
-
-
-/*--------------------------------------.
-| yyerrlab -- here on detecting error.  |
-`--------------------------------------*/
+    /* User semantic actions sometimes alter yychar, and that requires
+       that yytoken be updated with the new translation.  We take the
+       approach of translating immediately before every use of yytoken.
+       One alternative is translating here after every semantic action,
+       but that translation would be missed if the semantic action invokes
+       YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+       if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
+       incorrect destructor might then be invoked immediately.  In the
+       case of YYERROR or YYBACKUP, subsequent parser actions might lead
+       to an incorrect destructor call or verbose syntax error message
+       before the lookahead is translated.  */
+    YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
+
+    YYPOPSTACK (yylen);
+    yylen = 0;
+
+    *++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.  */
+    {
+        const int yylhs = yyr1[yyn] - YYNTOKENS;
+        const int yyi = yypgoto[yylhs] + *yyssp;
+        yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+                   ? yytable[yyi]
+                   : yydefgoto[yylhs]);
+    }
+
+    goto yynewstate;
+
+
+    /*--------------------------------------.
+    | yyerrlab -- here on detecting error.  |
+    `--------------------------------------*/
 yyerrlab:
-  /* Make sure we have latest lookahead translation.  See comments at
-     user semantic actions for why this is necessary.  */
-  yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
-  /* If not already recovering from an error, report this error.  */
-  if (!yyerrstatus)
+    /* Make sure we have latest lookahead translation.  See comments at
+       user semantic actions for why this is necessary.  */
+    yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
+    /* If not already recovering from an error, report this error.  */
+    if (!yyerrstatus)
     {
-      ++yynerrs;
-      yyerror (YY_("syntax error"));
+        ++yynerrs;
+        yyerror (YY_("syntax error"));
     }
 
-  if (yyerrstatus == 3)
+    if (yyerrstatus == 3)
     {
-      /* If just tried and failed to reuse lookahead token after an
-         error, discard it.  */
+        /* If just tried and failed to reuse lookahead token after an
+           error, discard it.  */
 
-      if (yychar <= YYEOF)
+        if (yychar <= YYEOF)
         {
-          /* Return failure if at end of input.  */
-          if (yychar == YYEOF)
-            YYABORT;
+            /* Return failure if at end of input.  */
+            if (yychar == YYEOF)
+                YYABORT;
         }
-      else
+        else
         {
-          yydestruct ("Error: discarding",
-                      yytoken, &yylval);
-          yychar = YYEMPTY;
+            yydestruct ("Error: discarding",
+                        yytoken, &yylval);
+            yychar = YYEMPTY;
         }
     }
 
-  /* Else will try to reuse lookahead token after shifting the error
-     token.  */
-  goto yyerrlab1;
+    /* Else will try to reuse lookahead token after shifting the error
+       token.  */
+    goto yyerrlab1;
 
 
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR.  |
-`---------------------------------------------------*/
+    /*---------------------------------------------------.
+    | yyerrorlab -- error raised explicitly by YYERROR.  |
+    `---------------------------------------------------*/
 yyerrorlab:
-  /* Pacify compilers when the user code never invokes YYERROR and the
-     label yyerrorlab therefore never appears in user code.  */
-  if (0)
-    YYERROR;
-
-  /* Do not reclaim the symbols of the rule whose 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.  |
-`-------------------------------------------------------------*/
+    /* Pacify compilers when the user code never invokes YYERROR and the
+       label yyerrorlab therefore never appears in user code.  */
+    if (0)
+        YYERROR;
+
+    /* Do not reclaim the symbols of the rule whose 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.  */
+    yyerrstatus = 3;      /* Each real token shifted decrements this.  */
 
-  /* Pop stack until we find a state that shifts the error token.  */
-  for (;;)
+    /* Pop stack until we find a state that shifts the error token.  */
+    for (;;)
     {
-      yyn = yypact[yystate];
-      if (!yypact_value_is_default (yyn))
+        yyn = yypact[yystate];
+        if (!yypact_value_is_default (yyn))
         {
-          yyn += YYSYMBOL_YYerror;
-          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
+            yyn += YYSYMBOL_YYerror;
+            if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
             {
-              yyn = yytable[yyn];
-              if (0 < yyn)
-                break;
+                yyn = yytable[yyn];
+                if (0 < yyn)
+                    break;
             }
         }
 
-      /* Pop the current state because it cannot handle the error token.  */
-      if (yyssp == yyss)
-        YYABORT;
+        /* Pop the current state because it cannot handle the error token.  */
+        if (yyssp == yyss)
+            YYABORT;
 
 
-      yydestruct ("Error: popping",
-                  YY_ACCESSING_SYMBOL (yystate), yyvsp);
-      YYPOPSTACK (1);
-      yystate = *yyssp;
-      YY_STACK_PRINT (yyss, yyssp);
+        yydestruct ("Error: popping",
+                    YY_ACCESSING_SYMBOL (yystate), yyvsp);
+        YYPOPSTACK (1);
+        yystate = *yyssp;
+        YY_STACK_PRINT (yyss, yyssp);
     }
 
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  *++yyvsp = yylval;
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
+    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+    *++yyvsp = yylval;
+    YY_IGNORE_MAYBE_UNINITIALIZED_END
 
 
-  /* Shift the error token.  */
-  YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
+    /* Shift the error token.  */
+    YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
 
-  yystate = yyn;
-  goto yynewstate;
+    yystate = yyn;
+    goto yynewstate;
 
 
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here.  |
-`-------------------------------------*/
+    /*-------------------------------------.
+    | yyacceptlab -- YYACCEPT comes here.  |
+    `-------------------------------------*/
 yyacceptlab:
-  yyresult = 0;
-  goto yyreturn;
+    yyresult = 0;
+    goto yyreturn;
 
 
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here.  |
-`-----------------------------------*/
+    /*-----------------------------------.
+    | yyabortlab -- YYABORT comes here.  |
+    `-----------------------------------*/
 yyabortlab:
-  yyresult = 1;
-  goto yyreturn;
+    yyresult = 1;
+    goto yyreturn;
 
 
 #if !defined yyoverflow
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here.  |
-`-------------------------------------------------*/
+    /*-------------------------------------------------.
+    | yyexhaustedlab -- memory exhaustion comes here.  |
+    `-------------------------------------------------*/
 yyexhaustedlab:
-  yyerror (YY_("memory exhausted"));
-  yyresult = 2;
-  goto yyreturn;
+    yyerror (YY_("memory exhausted"));
+    yyresult = 2;
+    goto yyreturn;
 #endif
 
 
-/*-------------------------------------------------------.
-| yyreturn -- parsing is finished, clean up and return.  |
-`-------------------------------------------------------*/
+    /*-------------------------------------------------------.
+    | yyreturn -- parsing is finished, clean up and return.  |
+    `-------------------------------------------------------*/
 yyreturn:
-  if (yychar != YYEMPTY)
+    if (yychar != YYEMPTY)
     {
-      /* Make sure we have latest lookahead translation.  See comments at
-         user semantic actions for why this is necessary.  */
-      yytoken = YYTRANSLATE (yychar);
-      yydestruct ("Cleanup: discarding lookahead",
-                  yytoken, &yylval);
+        /* Make sure we have latest lookahead translation.  See comments at
+           user semantic actions for why this is necessary.  */
+        yytoken = YYTRANSLATE (yychar);
+        yydestruct ("Cleanup: discarding lookahead",
+                    yytoken, &yylval);
     }
-  /* Do not reclaim the symbols of the rule whose action triggered
-     this YYABORT or YYACCEPT.  */
-  YYPOPSTACK (yylen);
-  YY_STACK_PRINT (yyss, yyssp);
-  while (yyssp != yyss)
+    /* Do not reclaim the symbols of the rule whose action triggered
+       this YYABORT or YYACCEPT.  */
+    YYPOPSTACK (yylen);
+    YY_STACK_PRINT (yyss, yyssp);
+    while (yyssp != yyss)
     {
-      yydestruct ("Cleanup: popping",
-                  YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
-      YYPOPSTACK (1);
+        yydestruct ("Cleanup: popping",
+                    YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
+        YYPOPSTACK (1);
     }
 #ifndef yyoverflow
-  if (yyss != yyssa)
-    YYSTACK_FREE (yyss);
+    if (yyss != yyssa)
+        YYSTACK_FREE (yyss);
 #endif
 
-  return yyresult;
+    return yyresult;
 }
 
diff --git a/engines/private/lex.yy.cpp b/engines/private/lex.yy.cpp
index 72ccf70850..65b57ff5f9 100644
--- a/engines/private/lex.yy.cpp
+++ b/engines/private/lex.yy.cpp
@@ -34,7 +34,7 @@
 #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. 
+ * if you want the limit (max/min) macros for int types.
  */
 #ifndef __STDC_LIMIT_MACROS
 #define __STDC_LIMIT_MACROS 1
@@ -51,7 +51,7 @@ typedef uint32_t flex_uint32_t;
 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 char flex_uint8_t;
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
 
@@ -162,10 +162,10 @@ 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)
-    #define YY_LINENO_REWIND_TO(ptr)
-    
+
+#define YY_LESS_LINENO(n)
+#define YY_LINENO_REWIND_TO(ptr)
+
 /* Return all but the first "n" matched characters back to the input stream. */
 #define yyless(n) \
 	do \
@@ -184,66 +184,66 @@ extern FILE *yyin, *yyout;
 #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.
-	 */
-	int yy_buf_size;
-
-	/* Number of characters read into yy_ch_buf, not including EOB
-	 * characters.
-	 */
-	int 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;
+{
+    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.
+     */
+    int yy_buf_size;
+
+    /* Number of characters read into yy_ch_buf, not including EOB
+     * characters.
+     */
+    int 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;
+    /* Whether to try to fill the input buffer when we reach the
+     * end of it.
+     */
+    int yy_fill_buffer;
 
-	int yy_buffer_status;
+    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.
-	 */
+    /* 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. */
@@ -360,125 +360,125 @@ static void yynoreturn yy_fatal_error ( const char* msg  );
 /* 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;
-	};
+{
+    flex_int32_t yy_verify;
+    flex_int32_t yy_nxt;
+};
 static const flex_int16_t yy_accept[78] =
-    {   0,
-        0,    0,   24,   22,   21,   20,   20,   22,   22,   22,
-       22,   18,   22,   22,   22,   17,   17,   17,   17,   17,
-       17,   17,   17,   17,   17,   21,   20,    4,    0,   19,
-       18,    1,    2,    5,    3,   17,   17,   17,   17,   17,
-       17,   17,   17,   17,    9,   17,    1,   17,   17,   17,
-       17,   17,   17,   17,   17,   17,   17,   17,   15,   12,
-       17,   14,   17,   17,   10,   11,   17,   13,   17,    6,
-       17,   17,   16,    7,   17,    8,    0
-    } ;
+{   0,
+    0,    0,   24,   22,   21,   20,   20,   22,   22,   22,
+    22,   18,   22,   22,   22,   17,   17,   17,   17,   17,
+    17,   17,   17,   17,   17,   21,   20,    4,    0,   19,
+    18,    1,    2,    5,    3,   17,   17,   17,   17,   17,
+    17,   17,   17,   17,    9,   17,    1,   17,   17,   17,
+    17,   17,   17,   17,   17,   17,   17,   17,   15,   12,
+    17,   14,   17,   17,   10,   11,   17,   13,   17,    6,
+    17,   17,   16,    7,   17,    8,    0
+} ;
 
 static const YY_CHAR yy_ec[256] =
-    {   0,
-        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,    2,    5,    6,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    7,    1,    8,    9,    9,    9,
-        9,    9,    9,    9,    9,    9,    9,    1,    1,   10,
-       11,   12,    1,    1,   13,   14,   15,   14,   16,   17,
-       14,   14,   14,   14,   14,   18,   14,   19,   14,   14,
-       14,   20,   21,   22,   23,   14,   14,   14,   14,   14,
-        1,    1,    1,    1,   14,    1,   24,   25,   14,   26,
-
-       27,   28,   29,   14,   30,   14,   14,   31,   32,   33,
-       34,   14,   14,   14,   35,   36,   37,   14,   14,   14,
-       14,   14,    1,   38,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1
-    } ;
+{   0,
+    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,    2,    5,    6,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    7,    1,    8,    9,    9,    9,
+    9,    9,    9,    9,    9,    9,    9,    1,    1,   10,
+    11,   12,    1,    1,   13,   14,   15,   14,   16,   17,
+    14,   14,   14,   14,   14,   18,   14,   19,   14,   14,
+    14,   20,   21,   22,   23,   14,   14,   14,   14,   14,
+    1,    1,    1,    1,   14,    1,   24,   25,   14,   26,
+
+    27,   28,   29,   14,   30,   14,   14,   31,   32,   33,
+    34,   14,   14,   14,   35,   36,   37,   14,   14,   14,
+    14,   14,    1,   38,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+    1,    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 const YY_CHAR yy_meta[39] =
-    {   0,
-        1,    1,    2,    3,    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,    1
-    } ;
+{   0,
+    1,    1,    2,    3,    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,    1
+} ;
 
 static const flex_int16_t yy_base[81] =
-    {   0,
-        0,    0,  105,  106,  102,   36,   38,   92,   96,   92,
-       92,   90,   87,   86,   85,    0,   82,   71,   27,   73,
-       65,   60,   56,   61,   61,   83,   41,  106,   76,  106,
-       72,    0,  106,  106,  106,    0,   60,   59,   60,   40,
-       49,   21,   36,   34,    0,   33,    0,   47,   49,   44,
-       39,   48,   26,   32,   34,   26,   23,   42,    0,    0,
-       23,    0,   27,   22,    0,    0,   24,    0,   21,    0,
-       25,   17,    0,    0,   19,    0,  106,   79,   43,   83
-    } ;
+{   0,
+    0,    0,  105,  106,  102,   36,   38,   92,   96,   92,
+    92,   90,   87,   86,   85,    0,   82,   71,   27,   73,
+    65,   60,   56,   61,   61,   83,   41,  106,   76,  106,
+    72,    0,  106,  106,  106,    0,   60,   59,   60,   40,
+    49,   21,   36,   34,    0,   33,    0,   47,   49,   44,
+    39,   48,   26,   32,   34,   26,   23,   42,    0,    0,
+    23,    0,   27,   22,    0,    0,   24,    0,   21,    0,
+    25,   17,    0,    0,   19,    0,  106,   79,   43,   83
+} ;
 
 static const flex_int16_t yy_def[81] =
-    {   0,
-       77,    1,   77,   77,   77,   77,   77,   77,   78,   77,
-       77,   77,   77,   77,   77,   79,   79,   79,   79,   79,
-       79,   79,   79,   79,   79,   77,   77,   77,   78,   77,
-       77,   80,   77,   77,   77,   79,   79,   79,   79,   79,
-       79,   79,   79,   79,   79,   79,   80,   79,   79,   79,
-       79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
-       79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
-       79,   79,   79,   79,   79,   79,    0,   77,   77,   77
-    } ;
+{   0,
+    77,    1,   77,   77,   77,   77,   77,   77,   78,   77,
+    77,   77,   77,   77,   77,   79,   79,   79,   79,   79,
+    79,   79,   79,   79,   79,   77,   77,   77,   78,   77,
+    77,   80,   77,   77,   77,   79,   79,   79,   79,   79,
+    79,   79,   79,   79,   79,   79,   80,   79,   79,   79,
+    79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
+    79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
+    79,   79,   79,   79,   79,   79,    0,   77,   77,   77
+} ;
 
 static const flex_int16_t yy_nxt[145] =
-    {   0,
-        4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
-       14,   15,   16,   16,   16,   16,   17,   16,   18,   19,
-       16,   20,   16,   16,   16,   21,   22,   16,   23,   24,
-       16,   16,   16,   16,   25,   16,   16,    7,   27,   27,
-       27,   27,   39,   27,   27,   53,   36,   76,   54,   75,
-       40,   74,   73,   72,   71,   70,   69,   68,   67,   66,
-       65,   64,   63,   62,   61,   60,   59,   58,   57,   56,
-       55,   52,   51,   27,   50,   27,   49,   48,   27,   29,
-       31,   30,   29,   47,   26,   47,   47,   46,   45,   44,
-       43,   42,   41,   38,   37,   35,   34,   33,   31,   32,
-
-       31,   30,   28,   26,   77,    3,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77
-    } ;
+{   0,
+    4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
+    14,   15,   16,   16,   16,   16,   17,   16,   18,   19,
+    16,   20,   16,   16,   16,   21,   22,   16,   23,   24,
+    16,   16,   16,   16,   25,   16,   16,    7,   27,   27,
+    27,   27,   39,   27,   27,   53,   36,   76,   54,   75,
+    40,   74,   73,   72,   71,   70,   69,   68,   67,   66,
+    65,   64,   63,   62,   61,   60,   59,   58,   57,   56,
+    55,   52,   51,   27,   50,   27,   49,   48,   27,   29,
+    31,   30,   29,   47,   26,   47,   47,   46,   45,   44,
+    43,   42,   41,   38,   37,   35,   34,   33,   31,   32,
+
+    31,   30,   28,   26,   77,    3,   77,   77,   77,   77,
+    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+    77,   77,   77,   77
+} ;
 
 static const flex_int16_t yy_chk[145] =
-    {   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,    6,    6,
-        7,    7,   19,   27,   27,   42,   79,   75,   42,   72,
-       19,   71,   69,   67,   64,   63,   61,   58,   57,   56,
-       55,   54,   53,   52,   51,   50,   49,   48,   46,   44,
-       43,   41,   40,    6,   39,    7,   38,   37,   27,   78,
-       31,   29,   78,   80,   26,   80,   80,   25,   24,   23,
-       22,   21,   20,   18,   17,   15,   14,   13,   12,   11,
-
-       10,    9,    8,    5,    3,   77,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77
-    } ;
+{   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,    6,    6,
+    7,    7,   19,   27,   27,   42,   79,   75,   42,   72,
+    19,   71,   69,   67,   64,   63,   61,   58,   57,   56,
+    55,   54,   53,   52,   51,   50,   49,   48,   46,   44,
+    43,   41,   40,    6,   39,    7,   38,   37,   27,   78,
+    31,   29,   78,   80,   26,   80,   80,   25,   24,   23,
+    22,   21,   20,   18,   17,   15,   14,   13,   12,   11,
+
+    10,    9,    8,    5,    3,   77,   77,   77,   77,   77,
+    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+    77,   77,   77,   77
+} ;
 
 static yy_state_type yy_last_accepting_state;
 static char *yy_last_accepting_cpos;
@@ -544,7 +544,7 @@ FILE *yyget_out ( void );
 
 void yyset_out  ( FILE * _out_str  );
 
-			int yyget_leng ( void );
+int yyget_leng ( void );
 
 char *yyget_text ( void );
 
@@ -565,9 +565,9 @@ extern int yywrap ( void );
 #endif
 
 #ifndef YY_NO_UNPUT
-    
-    static void yyunput ( int c, char *buf_ptr  );
-    
+
+static void yyunput ( int c, char *buf_ptr  );
+
 #endif
 
 #ifndef yytext_ptr
@@ -691,341 +691,344 @@ extern int yylex (void);
  */
 YY_DECL
 {
-	yy_state_type yy_current_state;
-	char *yy_cp, *yy_bp;
-	int yy_act;
-    
-	if ( !(yy_init) )
-		{
-		(yy_init) = 1;
+    yy_state_type yy_current_state;
+    char *yy_cp, *yy_bp;
+    int yy_act;
+
+    if ( !(yy_init) )
+    {
+        (yy_init) = 1;
 
 #ifdef YY_USER_INIT
-		YY_USER_INIT;
+        YY_USER_INIT;
 #endif
 
-		if ( ! (yy_start) )
-			(yy_start) = 1;	/* first start state */
+        if ( ! (yy_start) )
+            (yy_start) = 1;	/* first start state */
 
-		if ( ! yyin )
-			yyin = stdin;
+        if ( ! yyin )
+            yyin = stdin;
 
-		if ( ! yyout )
-			yyout = stdout;
+        if ( ! yyout )
+            yyout = stdout;
 
-		if ( ! YY_CURRENT_BUFFER ) {
-			yyensure_buffer_stack ();
-			YY_CURRENT_BUFFER_LVALUE =
-				yy_create_buffer( yyin, YY_BUF_SIZE );
-		}
+        if ( ! YY_CURRENT_BUFFER ) {
+            yyensure_buffer_stack ();
+            YY_CURRENT_BUFFER_LVALUE =
+            yy_create_buffer( yyin, YY_BUF_SIZE );
+        }
 
-		yy_load_buffer_state(  );
-		}
+        yy_load_buffer_state(  );
+    }
 
-	{
+    {
 #line 17 "engines/private/grammar.l"
 
 #line 727 "engines/private/lex.yy.cpp"
 
-	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
-		{
-		yy_cp = (yy_c_buf_p);
+        while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
+        {
+            yy_cp = (yy_c_buf_p);
 
-		/* Support of yytext. */
-		*yy_cp = (yy_hold_char);
+            /* 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_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_current_state = (yy_start);
 yy_match:
-		do
-			{
-			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 >= 78 )
-					yy_c = yy_meta[yy_c];
-				}
-			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-			++yy_cp;
-			}
-		while ( yy_current_state != 77 );
-		yy_cp = (yy_last_accepting_cpos);
-		yy_current_state = (yy_last_accepting_state);
+            do
+            {
+                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 >= 78 )
+                        yy_c = yy_meta[yy_c];
+                }
+                yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+                ++yy_cp;
+            }
+            while ( yy_current_state != 77 );
+            yy_cp = (yy_last_accepting_cpos);
+            yy_current_state = (yy_last_accepting_state);
 
 yy_find_action:
-		yy_act = yy_accept[yy_current_state];
+            yy_act = yy_accept[yy_current_state];
 
-		YY_DO_BEFORE_ACTION;
+            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
+            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 18 "engines/private/grammar.l"
-/* ignoring the comment */
-	YY_BREAK
-case 2:
-YY_RULE_SETUP
+                /* ignoring the comment */
+                YY_BREAK
+            case 2:
+                YY_RULE_SETUP
 #line 19 "engines/private/grammar.l"
-return LTE;
-	YY_BREAK
-case 3:
-YY_RULE_SETUP
+                return LTE;
+                YY_BREAK
+            case 3:
+                YY_RULE_SETUP
 #line 20 "engines/private/grammar.l"
-return GTE;
-	YY_BREAK
-case 4:
-YY_RULE_SETUP
+                return GTE;
+                YY_BREAK
+            case 4:
+                YY_RULE_SETUP
 #line 21 "engines/private/grammar.l"
-return NEQ;
-	YY_BREAK
-case 5:
-YY_RULE_SETUP
+                return NEQ;
+                YY_BREAK
+            case 5:
+                YY_RULE_SETUP
 #line 22 "engines/private/grammar.l"
-return EQ;
-	YY_BREAK
-case 6:
-YY_RULE_SETUP
+                return EQ;
+                YY_BREAK
+            case 6:
+                YY_RULE_SETUP
 #line 23 "engines/private/grammar.l"
-return DEBUGTOK;
-	YY_BREAK
-case 7:
-YY_RULE_SETUP
+                return DEBUGTOK;
+                YY_BREAK
+            case 7:
+                YY_RULE_SETUP
 #line 24 "engines/private/grammar.l"
-return DEFINETOK;
-	YY_BREAK
-case 8:
-YY_RULE_SETUP
+                return DEFINETOK;
+                YY_BREAK
+            case 8:
+                YY_RULE_SETUP
 #line 25 "engines/private/grammar.l"
-return SETTINGTOK;
-	YY_BREAK
-case 9:
-YY_RULE_SETUP
+                return SETTINGTOK;
+                YY_BREAK
+            case 9:
+                YY_RULE_SETUP
 #line 26 "engines/private/grammar.l"
-return IFTOK;
-	YY_BREAK
-case 10:
-YY_RULE_SETUP
+                return IFTOK;
+                YY_BREAK
+            case 10:
+                YY_RULE_SETUP
 #line 27 "engines/private/grammar.l"
-return ELSETOK;
-	YY_BREAK
-case 11:
-YY_RULE_SETUP
+                return ELSETOK;
+                YY_BREAK
+            case 11:
+                YY_RULE_SETUP
 #line 28 "engines/private/grammar.l"
-return GOTOTOK;
-	YY_BREAK
-case 12:
-YY_RULE_SETUP
+                return GOTOTOK;
+                YY_BREAK
+            case 12:
+                YY_RULE_SETUP
 #line 29 "engines/private/grammar.l"
-return RECT;
-	YY_BREAK
-case 13:
-YY_RULE_SETUP
+                return RECT;
+                YY_BREAK
+            case 13:
+                YY_RULE_SETUP
 #line 30 "engines/private/grammar.l"
-return FALSETOK;
-	YY_BREAK
-case 14:
-YY_RULE_SETUP
+                return FALSETOK;
+                YY_BREAK
+            case 14:
+                YY_RULE_SETUP
 #line 31 "engines/private/grammar.l"
-return TRUETOK;
-	YY_BREAK
-case 15:
-YY_RULE_SETUP
+                return TRUETOK;
+                YY_BREAK
+            case 15:
+                YY_RULE_SETUP
 #line 32 "engines/private/grammar.l"
-return NULLTOK;
-	YY_BREAK
-case 16:
-YY_RULE_SETUP
+                return NULLTOK;
+                YY_BREAK
+            case 16:
+                YY_RULE_SETUP
 #line 33 "engines/private/grammar.l"
-return RANDOMTOK;
-	YY_BREAK
-case 17:
-YY_RULE_SETUP
+                return RANDOMTOK;
+                YY_BREAK
+            case 17:
+                YY_RULE_SETUP
 #line 34 "engines/private/grammar.l"
-yylval.s = strdup(yytext); return NAME;
-	YY_BREAK
-case 18:
-YY_RULE_SETUP
+                yylval.s = strdup(yytext);
+                return NAME;
+                YY_BREAK
+            case 18:
+                YY_RULE_SETUP
 #line 35 "engines/private/grammar.l"
-yylval.sym = Private::constant(NUM, atoi(yytext), NULL); return NUM;
-	YY_BREAK
-case 19:
-YY_RULE_SETUP
+                yylval.sym = Private::constant(NUM, atoi(yytext), NULL);
+                return NUM;
+                YY_BREAK
+            case 19:
+                YY_RULE_SETUP
 #line 36 "engines/private/grammar.l"
-yylval.sym = Private::constant(STRING, 0, strdup(yytext)); return STRING;
-	YY_BREAK
-case 20:
-/* rule 20 can match eol */
-YY_RULE_SETUP
+                yylval.sym = Private::constant(STRING, 0, strdup(yytext));
+                return STRING;
+                YY_BREAK
+            case 20:
+                /* rule 20 can match eol */
+                YY_RULE_SETUP
 #line 37 "engines/private/grammar.l"
-/* ignore return */;
-	YY_BREAK
-case 21:
-YY_RULE_SETUP
+                /* ignore return */;
+                YY_BREAK
+            case 21:
+                YY_RULE_SETUP
 #line 38 "engines/private/grammar.l"
-/* ignore whitespace */;
-	YY_BREAK
-case 22:
-YY_RULE_SETUP
+                /* ignore whitespace */;
+                YY_BREAK
+            case 22:
+                YY_RULE_SETUP
 #line 39 "engines/private/grammar.l"
-return *yytext;
-	YY_BREAK
-case 23:
-YY_RULE_SETUP
+                return *yytext;
+                YY_BREAK
+            case 23:
+                YY_RULE_SETUP
 #line 40 "engines/private/grammar.l"
-ECHO;
-	YY_BREAK
+                ECHO;
+                YY_BREAK
 #line 896 "engines/private/lex.yy.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_last_accepting_cpos);
-				yy_current_state = (yy_last_accepting_state);
-				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 user's declarations */
+            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_last_accepting_cpos);
+                        yy_current_state = (yy_last_accepting_state);
+                        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 user's declarations */
 } /* end of yylex */
 
 /* yy_get_next_buffer - try to read in a new buffer
@@ -1037,167 +1040,167 @@ case YY_STATE_EOF(INITIAL):
  */
 static int yy_get_next_buffer (void)
 {
-    	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
-	char *source = (yytext_ptr);
-	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
-		{
-			int 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_LVALUE;
-
-			int yy_c_buf_p_offset =
-				(int) ((yy_c_buf_p) - b->yy_ch_buf);
-
-			if ( b->yy_is_our_buffer )
-				{
-				int 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,
-							 (yy_size_t) (b->yy_buf_size + 2)  );
-				}
-			else
-				/* Can't grow it, we don't own it. */
-				b->yy_ch_buf = NULL;
-
-			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_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
-		/* Extend the array by 50%, plus the number we really need. */
-		int 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, (yy_size_t) new_size  );
-		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
-		/* "- 2" to take care of EOB's */
-		YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
-	}
+    char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+    char *source = (yytext_ptr);
+    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
+    {
+        int 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. */
 
-	(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;
+            /* just a shorter name for the current buffer */
+            YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
 
-	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+            int yy_c_buf_p_offset =
+                (int) ((yy_c_buf_p) - b->yy_ch_buf);
 
-	return ret_val;
+            if ( b->yy_is_our_buffer )
+            {
+                int 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,
+                                          (yy_size_t) (b->yy_buf_size + 2)  );
+            }
+            else
+                /* Can't grow it, we don't own it. */
+                b->yy_ch_buf = NULL;
+
+            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_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+        /* Extend the array by 50%, plus the number we really need. */
+        int 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, (yy_size_t) new_size  );
+        if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+            YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+        /* "- 2" to take care of EOB's */
+        YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
+    }
+
+    (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)
+static yy_state_type yy_get_previous_state (void)
 {
-	yy_state_type yy_current_state;
-	char *yy_cp;
-    
-	yy_current_state = (yy_start);
-
-	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
-		{
-		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 >= 78 )
-				yy_c = yy_meta[yy_c];
-			}
-		yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-		}
-
-	return yy_current_state;
+    yy_state_type yy_current_state;
+    char *yy_cp;
+
+    yy_current_state = (yy_start);
+
+    for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+    {
+        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 >= 78 )
+                yy_c = yy_meta[yy_c];
+        }
+        yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+    }
+
+    return yy_current_state;
 }
 
 /* yy_try_NUL_trans - try to make a transition on the NUL character
@@ -1205,359 +1208,359 @@ static int yy_get_next_buffer (void)
  * synopsis
  *	next_state = yy_try_NUL_trans( current_state );
  */
-    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
+static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
 {
-	int yy_is_jam;
-    	char *yy_cp = (yy_c_buf_p);
-
-	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 >= 78 )
-			yy_c = yy_meta[yy_c];
-		}
-	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-	yy_is_jam = (yy_current_state == 77);
-
-		return yy_is_jam ? 0 : yy_current_state;
+    int yy_is_jam;
+    char *yy_cp = (yy_c_buf_p);
+
+    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 >= 78 )
+            yy_c = yy_meta[yy_c];
+    }
+    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+    yy_is_jam = (yy_current_state == 77);
+
+    return yy_is_jam ? 0 : yy_current_state;
 }
 
 #ifndef YY_NO_UNPUT
 
-    static void yyunput (int c, char * yy_bp )
+static void yyunput (int c, char * yy_bp )
 {
-	char *yy_cp;
-    
+    char *yy_cp;
+
     yy_cp = (yy_c_buf_p);
 
-	/* undo effects of setting up yytext */
-	*yy_cp = (yy_hold_char);
+    /* 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. */
-		int number_to_move = (yy_n_chars) + 2;
-		char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
-					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
-		char *source =
-				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+    if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+    {   /* need to shift things up to make room */
+        /* +2 for EOB chars. */
+        int number_to_move = (yy_n_chars) + 2;
+        char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+                  YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+        char *source =
+            &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
 
-		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-			*--dest = *--source;
+        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) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+        yy_cp += (int) (dest - source);
+        yy_bp += (int) (dest - source);
+        YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+            (yy_n_chars) = (int) 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" );
-		}
+        if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+            YY_FATAL_ERROR( "flex scanner push-back overflow" );
+    }
 
-	*--yy_cp = (char) c;
+    *--yy_cp = (char) c;
 
-	(yytext_ptr) = yy_bp;
-	(yy_hold_char) = *yy_cp;
-	(yy_c_buf_p) = yy_cp;
+    (yytext_ptr) = yy_bp;
+    (yy_hold_char) = *yy_cp;
+    (yy_c_buf_p) = yy_cp;
 }
 
 #endif
 
 #ifndef YY_NO_INPUT
 #ifdef __cplusplus
-    static int yyinput (void)
+static int yyinput (void)
 #else
-    static int input  (void)
+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 */
-			int offset = (int) ((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;
+    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 */
+            int offset = (int) ((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();
+                return yyinput();
 #else
-					return input();
+                return input();
 #endif
-					}
+            }
 
-				case EOB_ACT_CONTINUE_SCAN:
-					(yy_c_buf_p) = (yytext_ptr) + offset;
-					break;
-				}
-			}
-		}
+            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);
+    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;
+    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 )
+void yyrestart  (FILE * input_file )
 {
-    
-	if ( ! YY_CURRENT_BUFFER ){
+
+    if ( ! YY_CURRENT_BUFFER ) {
         yyensure_buffer_stack ();
-		YY_CURRENT_BUFFER_LVALUE =
+        YY_CURRENT_BUFFER_LVALUE =
             yy_create_buffer( yyin, YY_BUF_SIZE );
-	}
+    }
 
-	yy_init_buffer( YY_CURRENT_BUFFER, input_file );
-	yy_load_buffer_state(  );
+    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 )
+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);
+
+    /* 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;
+    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);
+    (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 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()" );
+    YY_BUFFER_STATE b;
 
-	b->yy_buf_size = size;
+    b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state )  );
+    if ( ! b )
+        YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
 
-	/* 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( (yy_size_t) (b->yy_buf_size + 2)  );
-	if ( ! b->yy_ch_buf )
-		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( (yy_size_t) (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;
+    b->yy_is_our_buffer = 1;
 
-	yy_init_buffer( b, file );
+    yy_init_buffer( b, file );
 
-	return b;
+    return b;
 }
 
 /** Destroy the buffer.
  * @param b a buffer created with yy_create_buffer()
- * 
+ *
  */
-    void yy_delete_buffer (YY_BUFFER_STATE  b )
+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 )
+        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  );
+    if ( b->yy_is_our_buffer )
+        yyfree( (void *) b->yy_ch_buf  );
 
-	yyfree( (void *) b  );
+    yyfree( (void *) b  );
 }
 
 /* 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 )
+static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
 
 {
-	int oerrno = errno;
-    
-	yy_flush_buffer( b );
+    int oerrno = errno;
+
+    yy_flush_buffer( b );
 
-	b->yy_input_file = file;
-	b->yy_fill_buffer = 1;
+    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){
+    if (b != YY_CURRENT_BUFFER) {
         b->yy_bs_lineno = 1;
         b->yy_bs_column = 0;
     }
 
-        b->yy_is_interactive = 0;
-    
-	errno = oerrno;
+    b->yy_is_interactive = 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 )
+void yy_flush_buffer (YY_BUFFER_STATE  b )
 {
-    	if ( ! b )
-		return;
+    if ( ! b )
+        return;
 
-	b->yy_n_chars = 0;
+    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;
+    /* 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_buf_pos = &b->yy_ch_buf[0];
 
-	b->yy_at_bol = 1;
-	b->yy_buffer_status = YY_BUFFER_NEW;
+    b->yy_at_bol = 1;
+    b->yy_buffer_status = YY_BUFFER_NEW;
 
-	if ( b == YY_CURRENT_BUFFER )
-		yy_load_buffer_state(  );
+    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;
+    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;
+    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);
+    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;
-	}
+    if (YY_CURRENT_BUFFER) {
+        yy_load_buffer_state(  );
+        (yy_did_buffer_switch_on_eof) = 1;
+    }
 }
 
 /* Allocates the stack if it does not exist.
@@ -1565,131 +1568,131 @@ void yypop_buffer_state (void)
  */
 static void yyensure_buffer_stack (void)
 {
-	yy_size_t num_to_alloc;
-    
-	if (!(yy_buffer_stack)) {
+    yy_size_t num_to_alloc;
 
-		/* 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.
+    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; /* After all that talk, this was set to 1 anyways... */
-		(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;
-	}
+        num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
+        (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){
+    if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1) {
 
-		/* Increase the buffer to prepare for a possible push. */
-		yy_size_t grow_size = 8 /* arbitrary grow size */;
+        /* Increase the buffer to prepare for a possible push. */
+        yy_size_t 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()" );
+        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;
-	}
+        /* 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 NULL;
-
-	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 = (int) (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 = NULL;
-	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;
+    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 NULL;
+
+    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 = (int) (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 = NULL;
+    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 (const char * yystr )
 {
-    
-	return yy_scan_bytes( yystr, (int) strlen(yystr) );
+
+    return yy_scan_bytes( yystr, (int) 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 yybytes the byte buffer to scan
  * @param _yybytes_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  (const char * yybytes, int  _yybytes_len )
 {
-	YY_BUFFER_STATE b;
-	char *buf;
-	yy_size_t n;
-	int i;
-    
-	/* Get memory for full buffer, including space for trailing EOB's. */
-	n = (yy_size_t) (_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;
+    YY_BUFFER_STATE b;
+    char *buf;
+    yy_size_t n;
+    int i;
+
+    /* Get memory for full buffer, including space for trailing EOB's. */
+    n = (yy_size_t) (_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
@@ -1698,8 +1701,8 @@ YY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len )
 
 static void yynoreturn yy_fatal_error (const char* msg )
 {
-			fprintf( stderr, "%s\n", msg );
-	exit( YY_EXIT_FAILURE );
+    fprintf( stderr, "%s\n", msg );
+    exit( YY_EXIT_FAILURE );
 }
 
 /* Redefine yyless() so it works in section 3 code. */
@@ -1722,88 +1725,88 @@ static void yynoreturn yy_fatal_error (const char* msg )
 /* 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;
+    return yyin;
 }
 
 /** Get the output stream.
- * 
+ *
  */
 FILE *yyget_out  (void)
 {
-        return yyout;
+    return yyout;
 }
 
 /** Get the length of the current token.
- * 
+ *
  */
 int yyget_leng  (void)
 {
-        return yyleng;
+    return yyleng;
 }
 
 /** Get the current token.
- * 
+ *
  */
 
 char *yyget_text  (void)
 {
-        return yytext;
+    return yytext;
 }
 
 /** Set the current line number.
  * @param _line_number 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 ;
+    yyin = _in_str ;
 }
 
 void yyset_out (FILE *  _out_str )
 {
-        yyout = _out_str ;
+    yyout = _out_str ;
 }
 
 int yyget_debug  (void)
 {
-        return yy_flex_debug;
+    return yy_flex_debug;
 }
 
 void yyset_debug (int  _bdebug )
 {
-        yy_flex_debug = _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.
-     */
+    /* 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) = NULL;
     (yy_buffer_stack_top) = 0;
@@ -1812,7 +1815,7 @@ static int yy_init_globals (void)
     (yy_init) = 0;
     (yy_start) = 0;
 
-/* Defined in main.c */
+    /* Defined in main.c */
 #ifdef YY_STDINIT
     yyin = stdin;
     yyout = stdout;
@@ -1830,17 +1833,17 @@ static int yy_init_globals (void)
 /* 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();
-	}
+    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;
+    /* 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. */
@@ -1856,45 +1859,45 @@ int yylex_destroy  (void)
 #ifndef yytext_ptr
 static void yy_flex_strncpy (char* s1, const char * s2, int n )
 {
-		
-	int i;
-	for ( i = 0; i < n; ++i )
-		s1[i] = s2[i];
+
+    int i;
+    for ( i = 0; i < n; ++i )
+        s1[i] = s2[i];
 }
 #endif
 
 #ifdef YY_NEED_STRLEN
 static int yy_flex_strlen (const char * s )
 {
-	int n;
-	for ( n = 0; s[n]; ++n )
-		;
+    int n;
+    for ( n = 0; s[n]; ++n )
+        ;
 
-	return n;
+    return n;
 }
 #endif
 
 void *yyalloc (yy_size_t  size )
 {
-			return malloc(size);
+    return 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 realloc(ptr, 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 realloc(ptr, size);
 }
 
 void yyfree (void * ptr )
 {
-			free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
+    free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
 }
 
 #define YYTABLES_NAME "yytables"
@@ -1907,20 +1910,20 @@ extern int yydebug;
 namespace Private {
 
 int parse(char *code) {
-	
-	initSetting();
 
-	YY_BUFFER_STATE bp;
+    initSetting();
+
+    YY_BUFFER_STATE bp;
 
-	yydebug = 1;
-	yy_delete_buffer(YY_CURRENT_BUFFER);
+    yydebug = 1;
+    yy_delete_buffer(YY_CURRENT_BUFFER);
 
-	bp = yy_scan_string(code);
-	yy_switch_to_buffer(bp);
-	yyparse();
-	yy_delete_buffer(bp);
+    bp = yy_scan_string(code);
+    yy_switch_to_buffer(bp);
+    yyparse();
+    yy_delete_buffer(bp);
 
-	return 0;
+    return 0;
 }
 
 } // End of namespace Private
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 4621514412..2c2ec86aed 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -54,15 +54,20 @@ PrivateEngine::PrivateEngine(OSystem *syst)
 
     _saveGameMask = NULL;
     _loadGameMask = NULL;
-    
+
     _nextSetting = NULL;
     _nextMovie = NULL;
     _nextVS = NULL;
     _modified = false;
     _mode = -1;
+    _toTake = false;
     _frame = new Common::String("inface/general/inface2.bmp");
+    _repeatedMovieExit = new Common::String("");
 
     _paperShuffleSound = new Common::String("global/audio/glsfx0");
+    _takeSound = new Common::String("global/audio/took");
+    _leaveSound = new Common::String("global/audio/left");
+
     _policeRadioArea = NULL;
     _AMRadioArea = NULL;
     _phoneArea = NULL;
@@ -70,7 +75,7 @@ PrivateEngine::PrivateEngine(OSystem *syst)
     _AMRadioPrefix = new Common::String("inface/radio/comm_/");
     _policeRadioPrefix = new Common::String("inface/radio/police/");
     _phonePrefix = new Common::String("inface/telephon/");
-    _phoneCallSound = new Common::String("phone.wav");  
+    _phoneCallSound = new Common::String("phone.wav");
 
 }
 
@@ -89,20 +94,20 @@ void PrivateEngine::initializePath(const Common::FSNode &gamePath) {
 }
 
 Common::Error PrivateEngine::run() {
-    
+
     assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
     Common::SeekableReadStream *file = NULL;
 
     // if the full game is used
-    if (_installerArchive.hasFile("GAME.DAT")) 
+    if (_installerArchive.hasFile("GAME.DAT"))
         file = _installerArchive.createReadStreamForMember("GAME.DAT");
- 
+
     // if the demo from archive.org is used
-    else if (_installerArchive.hasFile("GAME.TXT")) 
+    else if (_installerArchive.hasFile("GAME.TXT"))
         file = _installerArchive.createReadStreamForMember("GAME.TXT");
- 
+
     // if the demo from the full retail CDROM is used
-    else if (_installerArchive.hasFile("DEMOGAME.DAT")) 
+    else if (_installerArchive.hasFile("DEMOGAME.DAT"))
         file = _installerArchive.createReadStreamForMember("DEMOGAME.DAT");
 
     assert(file != NULL);
@@ -247,22 +252,22 @@ bool PrivateEngine::cursorExit(Common::Point mousePos) {
     mousePos = mousePos - *_origin;
     if (mousePos.x < 0 || mousePos.y < 0)
         return false;
-    
+
     int rs = 100000000;
     int cs = 0;
     ExitInfo e;
     Common::String *cursor = NULL;
-    
+
     for (ExitList::iterator it = _exits.begin(); it != _exits.end(); ++it) {
         e = *it;
         cs = e.rect->width()*e.rect->height();
 
-        if (e.rect->contains(mousePos)) {            
+        if (e.rect->contains(mousePos)) {
             if (cs < rs && e.cursor != NULL) {
                 rs = cs;
                 cursor = e.cursor;
             }
-            
+
         }
     }
 
@@ -327,6 +332,12 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
         if (e.rect->contains(mousePos)) {
             //debug("Inside! %d %d", cs, rs);
             if (cs < rs && e.nextSetting != NULL) { // TODO: check this
+                // an item was not taken
+                if (_toTake) {
+                    playSound(* getLeaveSound(), 1);
+                    _toTake = false;
+                }
+
                 //debug("Found Exit %s %d", e.nextSetting->c_str(), cs);
                 rs = cs;
                 ns = e.nextSetting;
@@ -356,6 +367,11 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
 
             if (m.flag != NULL) { // TODO: check this
                 setSymbol(m.flag, 1);
+                // an item was taken
+                if (_toTake) {
+                    playSound(*getTakeSound(), 1);
+                    _toTake = false;
+                }
             }
 
             break;
@@ -376,7 +392,7 @@ void PrivateEngine::selectAMRadioArea(Common::Point mousePos) {
         return;
 
     debug("AMRadio");
-    if (inMask(_AMRadioArea->surf, mousePos)) { 
+    if (inMask(_AMRadioArea->surf, mousePos)) {
         Common::String sound = *_AMRadioPrefix + _AMRadio.back() + ".wav";
         playSound(sound.c_str(), 1);
         _AMRadio.pop_back();
@@ -423,7 +439,7 @@ void PrivateEngine::selectPhoneArea(Common::Point mousePos) {
     if (inMask(_phoneArea->surf, mousePos)) {
         PhoneInfo i = _phone.back();
         Common::String sound(*i.sound);
-        setSymbol(i.flag, i.val); 
+        setSymbol(i.flag, i.val);
         sound = *_phonePrefix + sound + ".wav";
         playSound(sound.c_str(), 1);
         _phone.pop_back();
@@ -444,7 +460,7 @@ void PrivateEngine::selectLoadGame(Common::Point mousePos) {
 void PrivateEngine::selectSaveGame(Common::Point mousePos) {
     if (_saveGameMask == NULL)
         return;
- 
+
     if (inMask(_saveGameMask->surf, mousePos)) {
         saveGameDialog();
     }
@@ -458,7 +474,7 @@ bool PrivateEngine::hasFeature(EngineFeature f) const {
 
 void PrivateEngine::restartGame() {
     debug("restartGame");
-        
+
     for (VariableList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
         Private::Symbol *sym = variables.getVal(*it);
         if (strcmp("kAlternateGame", sym->name->c_str()) != 0)
@@ -472,9 +488,9 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
     debug("loadGameStream");
     _nextSetting = new Common::String("kMainDesktop");
     int val;
-        
+
     for (VariableList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
-        s.syncAsUint32LE(val); 
+        s.syncAsUint32LE(val);
         Private::Symbol *sym = variables.getVal(*it);
         sym->u.val = val;
     }
@@ -508,7 +524,7 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
         PhoneInfo *i = (PhoneInfo*) malloc(sizeof(PhoneInfo));
 
         i->sound = new Common::String(stream->readString());
-        i->flag  = variables.getVal(stream->readString()); 
+        i->flag  = variables.getVal(stream->readString());
         i->val   = stream->readUint32LE();
         _phone.push_back(*i);
     }
@@ -521,7 +537,16 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
 
     for (uint32 i = 0; i < size; ++i) {
         movie = new Common::String(stream->readString());
-        _playedMovies.setVal(movie, true);
+        _playedMovies.setVal(*movie, true);
+    }
+
+    _playedPhoneClips.clear();
+    size = stream->readUint32LE();
+    Common::String *phone;
+
+    for (uint32 i = 0; i < size; ++i) {
+        phone = new Common::String(stream->readString());
+        _playedPhoneClips.setVal(*phone, true);
     }
 
     //syncGameStream(s);
@@ -564,7 +589,13 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
     stream->writeByte(0);
 
     stream->writeUint32LE(_playedMovies.size());
-    for (PlayedMovieTable::iterator it = _playedMovies.begin(); it != _playedMovies.end(); ++it) {
+    for (PlayedMediaTable::iterator it = _playedMovies.begin(); it != _playedMovies.end(); ++it) {
+        stream->writeString(it->_key);
+        stream->writeByte(0);
+    }
+
+    stream->writeUint32LE(_playedPhoneClips.size());
+    for (PlayedMediaTable::iterator it = _playedPhoneClips.begin(); it != _playedPhoneClips.end(); ++it) {
         stream->writeString(it->_key);
         stream->writeByte(0);
     }
@@ -713,16 +744,32 @@ bool PrivateEngine::getRandomBool(uint p) {
 }
 
 Common::String *PrivateEngine::getPaperShuffleSound() {
-    uint r = 32 + _rnd->getRandomNumber(8);
+    uint r = 32 + _rnd->getRandomNumber(7);
 
-    // there is no global/audio/glsfx038.wav, 
+    // there is no global/audio/glsfx038.wav,
     // so we should avoid that number
     if ( r == 38)
-      r = 0;
+        r = 39;
 
     char f[7];
     sprintf(f, "%d.wav", r);
     return (new Common::String(*_paperShuffleSound + f));
 }
 
+Common::String *PrivateEngine::getTakeSound() {
+    uint r = 1 + _rnd->getRandomNumber(4);
+
+    char f[6];
+    sprintf(f, "%d.wav", r);
+    return (new Common::String(*_takeSound + f));
+}
+
+Common::String *PrivateEngine::getLeaveSound() {
+    uint r = 1 + _rnd->getRandomNumber(4);
+
+    char f[6];
+    sprintf(f, "%d.wav", r);
+    return (new Common::String(*_leaveSound + f));
+}
+
 } // End of namespace Private
diff --git a/engines/private/private.h b/engines/private/private.h
index 2de4b3d95c..e77c330e25 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -66,7 +66,7 @@ typedef Common::List<PhoneInfo> PhoneList;
 
 // hash tables
 
-typedef Common::HashMap<Common::String, bool> PlayedMovieTable;
+typedef Common::HashMap<Common::String, bool> PlayedMediaTable;
 
 class PrivateEngine : public Engine {
 private:
@@ -132,6 +132,7 @@ public:
 	Common::String *_currentSetting;
     Common::String *_nextVS;
     Common::String *_frame;
+	bool            _toTake;
 
 	// Save/Load games
 	MaskInfo *_saveGameMask;
@@ -140,16 +141,22 @@ public:
 	int _mode;
     bool _modified;
     Common::String *_nextMovie;
-	PlayedMovieTable _playedMovies;
+	PlayedMediaTable _playedMovies;
+	PlayedMediaTable _playedPhoneClips;
 	Common::String *_repeatedMovieExit;
     ExitList _exits;
     MaskList _masks;
 
 	// Sounds
 
-    Common::String *getPaperShuffleSound();
+	Common::String *getPaperShuffleSound();
 	Common::String *_paperShuffleSound;
 
+	Common::String *getTakeSound();
+	Common::String *getLeaveSound();
+	Common::String *_takeSound;
+	Common::String *_leaveSound;
+
 	// Radios
 
     MaskInfo *_AMRadioArea;


Commit: f602fa6d56f0ff57aa5856a5323c3f2e498d2967
    https://github.com/scummvm/scummvm/commit/f602fa6d56f0ff57aa5856a5323c3f2e498d2967
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: more astyle

Changed paths:
    engines/private/grammar.h
    engines/private/grammar.tab.h
    engines/private/private.h
    engines/private/symbol.h


diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 3810559f3b..e3b741045d 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -17,19 +17,19 @@
 namespace Private {
 
 typedef struct Datum {	/* interpreter stack type */
-        short type;
-	union {	
-	        int	 val;
-	        char    *str;
-	        Symbol	*sym;
-		Common::Rect *rect;
-	} u;
+    short type;
+    union {
+        int	 val;
+        char    *str;
+        Symbol	*sym;
+        Common::Rect *rect;
+    } u;
 } Datum;
 
 
 typedef struct Arg {
-  int n;
-  int (**inst)();
+    int n;
+    int (**inst)();
 } Arg;
 
 typedef int (*Inst)();	/* machine instruction */
@@ -76,11 +76,11 @@ extern  Inst *code(Inst);
 extern	Inst *prog;
 extern	int eval();
 extern  int add();
-extern  int negate(); 
+extern  int negate();
 extern  int power();
 extern	int assign();
 extern  int bltin();
-extern  int varpush(); 
+extern  int varpush();
 extern  int constpush();
 extern  int strpush();
 extern  int funcpush();
diff --git a/engines/private/grammar.tab.h b/engines/private/grammar.tab.h
index 35e067aca6..49d2bc0926 100644
--- a/engines/private/grammar.tab.h
+++ b/engines/private/grammar.tab.h
@@ -48,8 +48,8 @@ extern int yydebug;
 /* Token kinds.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
-  enum yytokentype
-  {
+enum yytokentype
+{
     YYEMPTY = -2,
     YYEOF = 0,                     /* "end of file"  */
     YYerror = 256,                 /* error  */
@@ -72,8 +72,8 @@ extern int yydebug;
     DEFINETOK = 273,               /* DEFINETOK  */
     SETTINGTOK = 274,              /* SETTINGTOK  */
     RANDOMTOK = 275                /* RANDOMTOK  */
-  };
-  typedef enum yytokentype yytoken_kind_t;
+};
+typedef enum yytokentype yytoken_kind_t;
 #endif
 
 /* Value type.  */
@@ -82,11 +82,11 @@ union YYSTYPE
 {
 #line 38 "engines/private/grammar.y"
 
-	Private::Symbol	*sym;	/* symbol table pointer */
-        int (**inst)();	/* machine instruction */
-        char *s;
-        int *i;
-        int narg;
+    Private::Symbol	*sym;	/* symbol table pointer */
+    int (**inst)();	/* machine instruction */
+    char *s;
+    int *i;
+    int narg;
 
 #line 92 "engines/private/grammar.tab.h"
 
diff --git a/engines/private/private.h b/engines/private/private.h
index e77c330e25..8ac8e40f13 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -29,10 +29,10 @@ class Console;
 
 // our engine debug channels
 enum {
-	kPrivateDebugExample = 1 << 0,
-	kPrivateDebugExample2 = 1 << 1
-	// next new channel must be 1 << 2 (4)
-	// the current limitation is 32 debug channels (1 << 31 is the last one)
+    kPrivateDebugExample = 1 << 0,
+    kPrivateDebugExample2 = 1 << 1
+                            // next new channel must be 1 << 2 (4)
+                            // the current limitation is 32 debug channels (1 << 31 is the last one)
 };
 
 // structs
@@ -40,28 +40,28 @@ enum {
 typedef struct ExitInfo {
     Common::String *nextSetting;
     Common::Rect   *rect;
-    Common::String *cursor;    
+    Common::String *cursor;
 } ExitInfo;
 
 typedef struct MaskInfo {
     Graphics::ManagedSurface *surf;
     Common::String *nextSetting;
     Common::Point *point;
-	Symbol *flag;
-    Common::String *cursor;    
+    Symbol *flag;
+    Common::String *cursor;
 } MaskInfo;
 
 typedef struct PhoneInfo {
     Common::String *sound;
-	Symbol *flag;
-	int val;
+    Symbol *flag;
+    int val;
 } PhoneInfo;
 
 // lists
 
-typedef Common::List<ExitInfo> ExitList;  
+typedef Common::List<ExitInfo> ExitList;
 typedef Common::List<MaskInfo> MaskList;
-typedef Common::List<Common::String> SoundList;   
+typedef Common::List<Common::String> SoundList;
 typedef Common::List<PhoneInfo> PhoneList;
 
 // hash tables
@@ -70,117 +70,123 @@ typedef Common::HashMap<Common::String, bool> PlayedMediaTable;
 
 class PrivateEngine : public Engine {
 private:
-	// We need random numbers
-	Common::RandomSource *_rnd;
+    // We need random numbers
+    Common::RandomSource *_rnd;
 
     Graphics::PixelFormat _pixelFormat;
-	Image::ImageDecoder *_image;
-	Graphics::ManagedSurface *_compositeSurface;
+    Image::ImageDecoder *_image;
+    Graphics::ManagedSurface *_compositeSurface;
 
-	int _screenW, _screenH;
+    int _screenW, _screenH;
 
 public:
-	PrivateEngine(OSystem *syst);
-	~PrivateEngine();
+    PrivateEngine(OSystem *syst);
+    ~PrivateEngine();
 
-	Audio::SoundHandle _soundHandle;
-	Video::SmackerDecoder *_videoDecoder;
-	Common::InstallerArchive _installerArchive;
+    Audio::SoundHandle _soundHandle;
+    Video::SmackerDecoder *_videoDecoder;
+    Common::InstallerArchive _installerArchive;
 
-	Common::Error run() override;
-	void restartGame();
-	void initializePath(const Common::FSNode &gamePath) override;
-	void selectMask(Common::Point);
+    Common::Error run() override;
+    void restartGame();
+    void initializePath(const Common::FSNode &gamePath) override;
+    void selectMask(Common::Point);
     void selectExit(Common::Point);
 
-	bool cursorExit(Common::Point);
-	bool cursorMask(Common::Point);
-	
-	bool hasFeature(EngineFeature f) const override;
-	bool canLoadGameStateCurrently() override { return true; }
-	bool canSaveAutosaveCurrently() override  { return false; }
-	bool canSaveGameStateCurrently() override { return true; }
-	
-	void selectLoadGame(Common::Point);
-	void selectSaveGame(Common::Point);
-
-
-	Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
-	Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
-	void syncGameStream(Common::Serializer &s);
-
-    Common::String convertPath(Common::String); 
-	void playSound(const Common::String &, uint);
-	void playVideo(const Common::String &);
+    bool cursorExit(Common::Point);
+    bool cursorMask(Common::Point);
+
+    bool hasFeature(EngineFeature f) const override;
+    bool canLoadGameStateCurrently() override {
+        return true;
+    }
+    bool canSaveAutosaveCurrently() override  {
+        return false;
+    }
+    bool canSaveGameStateCurrently() override {
+        return true;
+    }
+
+    void selectLoadGame(Common::Point);
+    void selectSaveGame(Common::Point);
+
+
+    Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
+    Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
+    void syncGameStream(Common::Serializer &s);
+
+    Common::String convertPath(Common::String);
+    void playSound(const Common::String &, uint);
+    void playVideo(const Common::String &);
     void skipVideo();
-	void stopSound();
+    void stopSound();
 
-	void loadImage(const Common::String &file, int x, int y, bool drawn = true);
+    void loadImage(const Common::String &file, int x, int y, bool drawn = true);
     void drawScreenFrame(Graphics::Surface *);
 
-	void changeCursor(Common::String);
+    void changeCursor(Common::String);
     void initCursors();
 
-	Graphics::ManagedSurface *loadMask(const Common::String &, int, int, bool);
+    Graphics::ManagedSurface *loadMask(const Common::String &, int, int, bool);
     bool inMask(Graphics::ManagedSurface*, Common::Point);
-    uint32 _transparentColor;	
-	void drawScreen();
+    uint32 _transparentColor;
+    void drawScreen();
 
     // global state
-	Common::Point *_origin;
+    Common::Point *_origin;
     Common::String *_nextSetting;
-	Common::String *_currentSetting;
+    Common::String *_currentSetting;
     Common::String *_nextVS;
     Common::String *_frame;
-	bool            _toTake;
+    bool            _toTake;
 
-	// Save/Load games
-	MaskInfo *_saveGameMask;
-	MaskInfo *_loadGameMask;
+    // Save/Load games
+    MaskInfo *_saveGameMask;
+    MaskInfo *_loadGameMask;
 
-	int _mode;
+    int _mode;
     bool _modified;
     Common::String *_nextMovie;
-	PlayedMediaTable _playedMovies;
-	PlayedMediaTable _playedPhoneClips;
-	Common::String *_repeatedMovieExit;
+    PlayedMediaTable _playedMovies;
+    PlayedMediaTable _playedPhoneClips;
+    Common::String *_repeatedMovieExit;
     ExitList _exits;
     MaskList _masks;
 
-	// Sounds
+    // Sounds
 
-	Common::String *getPaperShuffleSound();
-	Common::String *_paperShuffleSound;
+    Common::String *getPaperShuffleSound();
+    Common::String *_paperShuffleSound;
 
-	Common::String *getTakeSound();
-	Common::String *getLeaveSound();
-	Common::String *_takeSound;
-	Common::String *_leaveSound;
+    Common::String *getTakeSound();
+    Common::String *getLeaveSound();
+    Common::String *_takeSound;
+    Common::String *_leaveSound;
 
-	// Radios
+    // Radios
 
     MaskInfo *_AMRadioArea;
-	Common::String *_AMRadioPrefix;
+    Common::String *_AMRadioPrefix;
 
-	MaskInfo *_policeRadioArea;
-	Common::String *_policeRadioPrefix;
+    MaskInfo *_policeRadioArea;
+    Common::String *_policeRadioPrefix;
 
-	MaskInfo *_phoneArea;
-	Common::String *_phonePrefix;
-	Common::String *_phoneCallSound;
+    MaskInfo *_phoneArea;
+    Common::String *_phonePrefix;
+    Common::String *_phoneCallSound;
 
-	SoundList _AMRadio;
-	SoundList _policeRadio;
-	PhoneList _phone;
+    SoundList _AMRadio;
+    SoundList _policeRadio;
+    PhoneList _phone;
 
-	void selectAMRadioArea(Common::Point);
-	void selectPoliceRadioArea(Common::Point);
-	void selectPhoneArea(Common::Point);
-	void checkPhoneCall();
+    void selectAMRadioArea(Common::Point);
+    void selectPoliceRadioArea(Common::Point);
+    void selectPhoneArea(Common::Point);
+    void checkPhoneCall();
 
     // Random values
 
-	bool getRandomBool(uint);
+    bool getRandomBool(uint);
 
 };
 
@@ -189,10 +195,10 @@ extern PrivateEngine *g_private;
 // Example console class
 class Console : public GUI::Debugger {
 public:
-	Console(PrivateEngine *vm) {
-	}
-	virtual ~Console(void) {
-	}
+    Console(PrivateEngine *vm) {
+    }
+    virtual ~Console(void) {
+    }
 };
 
 } // End of namespace Private
diff --git a/engines/private/symbol.h b/engines/private/symbol.h
index e1f1f6163c..4275550b47 100644
--- a/engines/private/symbol.h
+++ b/engines/private/symbol.h
@@ -12,13 +12,13 @@
 namespace Private {
 
 typedef struct Symbol {	/* symbol table entry */
-	Common::String *name;
-	short	type;	/* NAME, NUM, STRING or RECT  */
-	union {
-		int	val;	    /* NAME or NUM */
-		char	*str;	    /* STRING */
-		Common::Rect *rect; /* RECT */
-	} u;
+    Common::String *name;
+    short	type;	/* NAME, NUM, STRING or RECT  */
+    union {
+        int	val;	    /* NAME or NUM */
+        char	*str;	    /* STRING */
+        Common::Rect *rect; /* RECT */
+    } u;
 } Symbol;
 
 // Symbols
@@ -34,7 +34,7 @@ extern SymbolMap settings, variables, cursors, locations, rects;
 extern ConstantList constants;
 extern VariableList variableList;
 
-extern void     defineSymbol(char *, Common::Rect *); 
+extern void     defineSymbol(char *, Common::Rect *);
 extern Symbol  *install(Common::String *, int, int, char *, Common::Rect *, SymbolMap*);
 extern Symbol  *lookupName(char *);
 extern Symbol  *constant(int, int, char *);


Commit: fd0facc23db5adf143cda59e44db19b5901d3589
    https://github.com/scummvm/scummvm/commit/fd0facc23db5adf143cda59e44db19b5901d3589
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: better detection tables + fixes

Changed paths:
    engines/private/detection.cpp
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index b68a1d5fae..25162c1def 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -10,34 +10,56 @@ static const PlainGameDescriptor privateGames[] = {
 
 static const ADGameDescription gameDescriptions[] = {
     {
-        "private-eye",  // Full game
+        "private-eye",  // US release
         0,
         AD_ENTRY1s("ASSETS.Z", "3a7532349cda8126e96dd5e49884af3a", 40232),
-        Common::EN_ANY,
+        Common::EN_USA,
         Common::kPlatformWindows,
         ADGF_NO_FLAGS,
         GUIO1(GUIO_NOMIDI)
     },
+
+    {
+        "private-eye",  // EU release
+        0,
+        AD_ENTRY1s("ASSETS.Z", "73874f969026d6fd21a4e9834ce4a1a7", 17695),
+        Common::EN_GRB,
+        Common::kPlatformWindows,
+        ADGF_UNSUPPORTED,
+        GUIO1(GUIO_NOMIDI)
+    },
+
     {
         "private-eye", // Demo from archive.org
         "Demo",
         AD_ENTRY1s("ASSETS.Z", "854e141bb67535359620a1833fcc1566", 5955),
-        Common::EN_ANY,
+        Common::EN_USA,
         Common::kPlatformWindows,
         ADGF_DEMO,
         GUIO1(GUIO_NOMIDI)
     },
 
     {
-        "private-eye", // Demo from the full game CDROM
+        "private-eye", // Demo from the US release
         "Demo",
         AD_ENTRY1s("ASSETS.Z", "045766e39f44d6ee3bf92f0d4521587c", 5961),
-        Common::EN_ANY,
+        Common::EN_USA,
         Common::kPlatformWindows,
         ADGF_DEMO,
         GUIO1(GUIO_NOMIDI)
     },
 
+    
+    {
+        "private-eye", // Demo from the EU release
+        "Demo",
+        AD_ENTRY1s("ASSETS.Z", "15e10e8fbb1e9aac4d32c5d8215e7c86", 2299),
+        Common::EN_GRB,
+        Common::kPlatformWindows,
+        ADGF_DEMO | ADGF_UNSUPPORTED,
+        GUIO1(GUIO_NOMIDI)
+    },
+
     AD_TABLE_END_MARKER
 };
 } // End of namespace Private
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 2993d1202e..ab115651c4 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -70,7 +70,8 @@ void LoadGame(ArgArray args) {
     m->surf = g_private->loadMask(*s, 0, 0, true);
     m->cursor = args[2].u.sym->name;
     m->nextSetting = NULL;
-    m->flag = NULL;
+    m->flag1 = NULL;
+    m->flag2 = NULL;
     g_private->_loadGameMask = m;
     g_private->_masks.push_front(*m);
 }
@@ -83,7 +84,8 @@ void SaveGame(ArgArray args) {
     m->surf = g_private->loadMask(*s, 0, 0, true);
     m->cursor = args[1].u.sym->name;
     m->nextSetting = NULL;
-    m->flag = NULL;
+    m->flag1 = NULL;
+    m->flag2 = NULL;
     g_private->_saveGameMask = m;
     g_private->_masks.push_front(*m);
 }
@@ -117,6 +119,8 @@ void Inventory(ArgArray args) {
     Datum v2 = args[2];
     Datum e = args[3];
 
+    Datum c = args[5];
+
     Datum snd = args[8];
 
     assert(v1.type == STRING || v1.type == NAME);
@@ -142,17 +146,30 @@ void Inventory(ArgArray args) {
 
         m->cursor = new Common::String("kInventory");
         m->point = new Common::Point(0,0);
+
+        if (v1.type == NAME)
+            m->flag1 = v1.u.sym;
+        else
+            m->flag1 = NULL;
+
+
         if (v2.type == NAME)
-            m->flag = v2.u.sym;
+            m->flag2 = v2.u.sym;
         else
-            m->flag = NULL;
+            m->flag2 = NULL;
 
         g_private->_masks.push_front(*m);
         g_private->_toTake = true;
-    }
+    } else { 
+        if (v1.type == NAME)
+            if (strcmp(c.u.str, "\"REMOVE\"") == 0)
+                v1.u.sym->u.val = 0;
+            else
+                v1.u.sym->u.val = 1;
 
-    if (v1.type == NAME)
-        v1.u.sym->u.val = 1;
+        if (v2.type == NAME)
+            v2.u.sym->u.val = 1;
+    }
 
     if (strcmp(snd.u.str, "\"\"") != 0) {
         Common::String *s = new Common::String(snd.u.str);
@@ -247,6 +264,17 @@ void Transition(ArgArray args) {
     g_private->_nextSetting = new Common::String(args[1].u.str);
 }
 
+void Resume(ArgArray args) {
+    // assert types
+    debug("Resume(%d)", args[0].u.val); // this value is always 1
+    g_private->_nextSetting = g_private->_pausedSetting;
+    g_private->_pausedSetting = NULL;
+    g_private->_mode = 1;
+    g_private->_origin->x = 64;  // use a constant
+    g_private->_origin->y = 48;
+
+}
+
 void Movie(ArgArray args) {
     // assert types
     debug("Movie(%s, %s)", args[0].u.str, args[1].u.str);
@@ -331,7 +359,8 @@ void _Mask(ArgArray args, bool drawn) {
     m->surf = g_private->loadMask(*s, x, y, drawn);
     m->nextSetting = new Common::String(e);
     m->cursor = c;
-    m->flag = NULL;
+    m->flag1 = NULL;
+    m->flag2 = NULL;
     m->point = new Common::Point(x,y);
     g_private->_masks.push_front(*m);
 
@@ -407,7 +436,8 @@ void SoundArea(ArgArray args) {
         m->surf = g_private->loadMask(*s, 0, 0, true);
         m->cursor = args[2].u.sym->name;
         m->nextSetting = NULL;
-        m->flag = NULL;
+        m->flag1 = NULL;
+        m->flag2 = NULL;
         g_private->_AMRadioArea = m;
         g_private->_masks.push_front(*m);
     } else if (strcmp(n, "kPoliceRadio") == 0) {
@@ -416,7 +446,8 @@ void SoundArea(ArgArray args) {
         m->surf = g_private->loadMask(*s, 0, 0, true);
         m->cursor = args[2].u.sym->name;
         m->nextSetting = NULL;
-        m->flag = NULL;
+        m->flag1 = NULL;
+        m->flag2 = NULL;
         g_private->_policeRadioArea = m;
         g_private->_masks.push_front(*m);
     } else if (strcmp(n, "kPhone") == 0) {
@@ -425,7 +456,8 @@ void SoundArea(ArgArray args) {
         m->surf = g_private->loadMask(*s, 0, 0, true);
         m->cursor = args[2].u.sym->name;
         m->nextSetting = NULL;
-        m->flag = NULL;
+        m->flag1 = NULL;
+        m->flag2 = NULL;
         g_private->_phoneArea = m;
         g_private->_masks.push_front(*m);
     }
@@ -457,6 +489,7 @@ static struct FuncTable {
 } funcTable[] = {
 
     { ChgMode,         "ChgMode"},
+    { Resume,          "Resume"},
     { Goto,            "goto"},
     { SetFlag,         "SetFlag"},
     { Timer,	       "Timer"},
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 2c2ec86aed..c79019176d 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -56,6 +56,7 @@ PrivateEngine::PrivateEngine(OSystem *syst)
     _loadGameMask = NULL;
 
     _nextSetting = NULL;
+    _currentSetting = NULL;
     _nextMovie = NULL;
     _nextVS = NULL;
     _modified = false;
@@ -63,6 +64,7 @@ PrivateEngine::PrivateEngine(OSystem *syst)
     _toTake = false;
     _frame = new Common::String("inface/general/inface2.bmp");
     _repeatedMovieExit = new Common::String("");
+    _pausedSetting = NULL;
 
     _paperShuffleSound = new Common::String("global/audio/glsfx0");
     _takeSound = new Common::String("global/audio/took");
@@ -166,6 +168,12 @@ Common::Error PrivateEngine::run() {
             case Common::EVENT_KEYDOWN:
                 if (event.kbd.keycode == Common::KEYCODE_ESCAPE && _videoDecoder)
                     skipVideo();
+                else if (event.kbd.keycode == Common::KEYCODE_m) {
+                    if ( _pausedSetting == NULL) {
+                        _pausedSetting = _currentSetting;
+                        _nextSetting = new Common::String("kPauseMovie");
+                    }
+                }
                 break;
 
             case Common::EVENT_QUIT:
@@ -233,7 +241,7 @@ Common::Error PrivateEngine::run() {
             _policeRadioArea = NULL;
             _AMRadioArea = NULL;
             _phoneArea = NULL;
-
+            _currentSetting = _nextSetting;
             loadSetting(_nextSetting);
             _nextSetting = NULL;
             execute(prog);
@@ -365,8 +373,9 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
                 ns = m.nextSetting;
             }
 
-            if (m.flag != NULL) { // TODO: check this
-                setSymbol(m.flag, 1);
+            if (m.flag1 != NULL) { // TODO: check this
+                setSymbol(m.flag1, 1);
+                debug("!!!!!!!!!!!!!! setting %s to 1 !!!!!!!!!!!!!!!!!!1", m.flag1->name->c_str());
                 // an item was taken
                 if (_toTake) {
                     playSound(*getTakeSound(), 1);
@@ -374,6 +383,10 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
                 }
             }
 
+            if (m.flag2 != NULL) {
+                setSymbol(m.flag2, 1);
+            }
+
             break;
 
         }
@@ -687,7 +700,8 @@ void PrivateEngine::drawScreenFrame(Graphics::Surface *screen) {
     Common::File file;
     assert(file.open(path));
     _image->loadStream(file);
-    screen->copyRectToSurface(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), 0, 0, Common::Rect(0, 0, _screenW, _screenH));
+    Graphics::Surface *frame = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
+    screen->copyRectToSurface(*frame, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
 }
 
 
@@ -722,7 +736,10 @@ void PrivateEngine::drawScreen() {
         frame->create(_screenW, _screenH, _pixelFormat);
         frame->copyFrom(*_videoDecoder->decodeNextFrame());
         const Common::Point o(_origin->x, _origin->y);
-        surface->transBlitFrom(*frame->convertTo(_pixelFormat, _videoDecoder->getPalette()), o);
+        Graphics::Surface *cframe = frame->convertTo(_pixelFormat, _videoDecoder->getPalette());
+        surface->transBlitFrom(*cframe, o);
+        delete frame;
+        delete cframe;
     }
 
     assert(w == _screenW && h == _screenH);
diff --git a/engines/private/private.h b/engines/private/private.h
index 8ac8e40f13..ff688b2911 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -47,7 +47,8 @@ typedef struct MaskInfo {
     Graphics::ManagedSurface *surf;
     Common::String *nextSetting;
     Common::Point *point;
-    Symbol *flag;
+    Symbol *flag1;
+    Symbol *flag2;
     Common::String *cursor;
 } MaskInfo;
 
@@ -150,6 +151,8 @@ public:
     PlayedMediaTable _playedMovies;
     PlayedMediaTable _playedPhoneClips;
     Common::String *_repeatedMovieExit;
+    Common::String *_pausedSetting;
+
     ExitList _exits;
     MaskList _masks;
 


Commit: e8994fd70ca36901506e9648cda03c2bcdc31597
    https://github.com/scummvm/scummvm/commit/e8994fd70ca36901506e9648cda03c2bcdc31597
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixed frame memory leak

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index c79019176d..2af83b10ca 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -702,6 +702,8 @@ void PrivateEngine::drawScreenFrame(Graphics::Surface *screen) {
     _image->loadStream(file);
     Graphics::Surface *frame = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
     screen->copyRectToSurface(*frame, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
+    frame->free();
+    delete frame;
 }
 
 
@@ -738,6 +740,8 @@ void PrivateEngine::drawScreen() {
         const Common::Point o(_origin->x, _origin->y);
         Graphics::Surface *cframe = frame->convertTo(_pixelFormat, _videoDecoder->getPalette());
         surface->transBlitFrom(*cframe, o);
+        frame->free();
+        cframe->free();
         delete frame;
         delete cframe;
     }


Commit: b3d314e68d17e42cf4255aa156f2ac3618bacd2b
    https://github.com/scummvm/scummvm/commit/b3d314e68d17e42cf4255aa156f2ac3618bacd2b
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: more fixes

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index ab115651c4..020e9e117e 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -16,12 +16,10 @@ void ChgMode(ArgArray args) {
     g_private->_nextSetting = s;
 
     if (g_private->_mode == 0) {
-        g_private->_origin->x = 0; // use a constant
-        g_private->_origin->y = 0;
+        g_private->_origin = &kPrivateOriginZero;
     }
     else if (g_private->_mode == 1) {
-        g_private->_origin->x = 64;  // use a constant
-        g_private->_origin->y = 48;
+        g_private->_origin = &kPrivateOriginOne;
     }
     else
         assert(0);
@@ -270,9 +268,7 @@ void Resume(ArgArray args) {
     g_private->_nextSetting = g_private->_pausedSetting;
     g_private->_pausedSetting = NULL;
     g_private->_mode = 1;
-    g_private->_origin->x = 64;  // use a constant
-    g_private->_origin->y = 48;
-
+    g_private->_origin = &kPrivateOriginOne;
 }
 
 void Movie(ArgArray args) {
@@ -414,8 +410,19 @@ void PhoneClip(ArgArray args) {
         debug("Unimplemented PhoneClip special case");
         return;
     }
+    int i = args[2].u.val;
+    int j = args[3].u.val;
+
+    if (i == j)
+        AddSound(args[0].u.str, "PhoneClip", args[4].u.sym, args[5].u.val);
+    else {
+
+        assert(i < j);
+        char *clip = g_private->getRandomPhoneClip(args[0].u.str, i, j);
+        AddSound(clip, "PhoneClip", args[4].u.sym, args[5].u.val);
+ 
+    }
 
-    AddSound(args[0].u.str, "PhoneClip", args[4].u.sym, args[5].u.val);
 }
 
 void SoundArea(ArgArray args) {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 2af83b10ca..a7a56396cc 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -737,9 +737,8 @@ void PrivateEngine::drawScreen() {
         Graphics::Surface *frame = new Graphics::Surface;
         frame->create(_screenW, _screenH, _pixelFormat);
         frame->copyFrom(*_videoDecoder->decodeNextFrame());
-        const Common::Point o(_origin->x, _origin->y);
         Graphics::Surface *cframe = frame->convertTo(_pixelFormat, _videoDecoder->getPalette());
-        surface->transBlitFrom(*cframe, o);
+        surface->transBlitFrom(*cframe, *_origin);
         frame->free();
         cframe->free();
         delete frame;
@@ -751,7 +750,8 @@ void PrivateEngine::drawScreen() {
     if (_mode == 1) {
         drawScreenFrame(screen);
     }
-    screen->copyRectToSurface(*surface, _origin->x, _origin->y, Common::Rect(_origin->x, _origin->y, _screenW - _origin->x, _screenH - _origin->y));
+    Common::Rect window(_origin->x, _origin->y, _screenW - _origin->x, _screenH - _origin->y);
+    screen->copyRectToSurface(*surface, _origin->x, _origin->y, window);
     g_system->unlockScreen();
     //if (_image->getPalette() != nullptr)
     //    g_system->getPaletteManager()->setPalette(_image->getPalette(), _image->getPaletteStartIndex(), _image->getPaletteColorCount());
@@ -793,4 +793,14 @@ Common::String *PrivateEngine::getLeaveSound() {
     return (new Common::String(*_leaveSound + f));
 }
 
+
+char *PrivateEngine::getRandomPhoneClip(char *clip, int i, int j) {
+    uint r = i + _rnd->getRandomNumber(j - i);
+
+    char *f = (char*) malloc((strlen(clip)+3)*sizeof(char));
+    sprintf(f, "%s%02d", clip, r);
+    return f;
+}
+
+
 } // End of namespace Private
diff --git a/engines/private/private.h b/engines/private/private.h
index ff688b2911..809e09df0a 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -35,6 +35,11 @@ enum {
                             // the current limitation is 32 debug channels (1 << 31 is the last one)
 };
 
+// points
+
+const Common::Point kPrivateOriginZero(0, 0); 
+const Common::Point kPrivateOriginOne(64, 48); 
+
 // structs
 
 typedef struct ExitInfo {
@@ -134,7 +139,7 @@ public:
     void drawScreen();
 
     // global state
-    Common::Point *_origin;
+    const Common::Point *_origin;
     Common::String *_nextSetting;
     Common::String *_currentSetting;
     Common::String *_nextVS;
@@ -182,6 +187,8 @@ public:
     SoundList _policeRadio;
     PhoneList _phone;
 
+    char *getRandomPhoneClip(char *, int, int);
+
     void selectAMRadioArea(Common::Point);
     void selectPoliceRadioArea(Common::Point);
     void selectPhoneArea(Common::Point);


Commit: 0f8c18d77980509a000a25fdd5c960725dd506c7
    https://github.com/scummvm/scummvm/commit/0f8c18d77980509a000a25fdd5c960725dd506c7
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: started to implement police bust

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 020e9e117e..66b6565bf6 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -96,7 +96,22 @@ void RestartGame(ArgArray args) {
 
 void PoliceBust(ArgArray args) {
     // assert types
-    debug("WARNING: PoliceBust is not implemented");
+    assert (args.size() == 1 || args.size() == 2);
+    g_private->_policeBustEnabled = args[0].u.val;
+
+    if (args.size() == 2) {
+        if (args[1].u.val == 2) {
+            Common::String *s = new Common::String("global/transiti/audio/spoc02VO.wav");
+            g_private->playSound(*s, 1);
+            assert(0);
+
+        }
+        else if (args[1].u.val == 2) {
+            g_private->_nextSetting = &kMainDesktop;
+        } else
+            assert(0);
+    }
+    debug("WARNING: PoliceBust partially implemented");
 }
 
 void DossierAdd(ArgArray args) {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index a7a56396cc..62d0e88f2f 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -66,6 +66,11 @@ PrivateEngine::PrivateEngine(OSystem *syst)
     _repeatedMovieExit = new Common::String("");
     _pausedSetting = NULL;
 
+
+    _policeBustEnabled = false;
+    _policeBustSetting = NULL;
+
+
     _paperShuffleSound = new Common::String("global/audio/glsfx0");
     _takeSound = new Common::String("global/audio/took");
     _leaveSound = new Common::String("global/audio/left");
@@ -155,7 +160,7 @@ Common::Error PrivateEngine::run() {
     if (saveSlot >= 0) { // load the savegame
         loadGameState(saveSlot);
     } else {
-        _nextSetting = new Common::String("kGoIntro");
+        _nextSetting = &kGoIntro;
     }
 
     while (!shouldQuit()) {
@@ -171,7 +176,15 @@ Common::Error PrivateEngine::run() {
                 else if (event.kbd.keycode == Common::KEYCODE_m) {
                     if ( _pausedSetting == NULL) {
                         _pausedSetting = _currentSetting;
-                        _nextSetting = new Common::String("kPauseMovie");
+                        _nextSetting = &kPauseMovie;
+                    }
+                }
+                else if (event.kbd.keycode == Common::KEYCODE_p) {
+                    if ( _policeBustEnabled) {
+                        Common::String *pv = new Common::String("po/animatio/spoc02xs.smk");
+                        _nextMovie = pv;
+                        _policeBustSetting = _currentSetting;
+                        _nextSetting = &kPoliceBustFromMO;
                     }
                 }
                 break;
@@ -499,7 +512,7 @@ void PrivateEngine::restartGame() {
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
     Common::Serializer s(stream, nullptr);
     debug("loadGameStream");
-    _nextSetting = new Common::String("kMainDesktop");
+    _nextSetting = &kMainDesktop;
     int val;
 
     for (VariableList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
diff --git a/engines/private/private.h b/engines/private/private.h
index 809e09df0a..cabdb498cd 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -38,7 +38,14 @@ enum {
 // points
 
 const Common::Point kPrivateOriginZero(0, 0); 
-const Common::Point kPrivateOriginOne(64, 48); 
+const Common::Point kPrivateOriginOne(64, 48);
+
+// settings
+
+static Common::String kPauseMovie("kPauseMovie");
+static Common::String kGoIntro("kGoIntro");
+static Common::String kPoliceBustFromMO("kPoliceBustFromMO");
+static Common::String kMainDesktop("kMainDesktop");
 
 // structs
 
@@ -146,6 +153,11 @@ public:
     Common::String *_frame;
     bool            _toTake;
 
+    // Police Bust
+
+    bool _policeBustEnabled;
+    Common::String *_policeBustSetting;
+
     // Save/Load games
     MaskInfo *_saveGameMask;
     MaskInfo *_loadGameMask;


Commit: 27ddb34804ea5a0c46be0ed1da0c096ce3dd17d2
    https://github.com/scummvm/scummvm/commit/27ddb34804ea5a0c46be0ed1da0c096ce3dd17d2
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: police bust changes

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h
    engines/private/symbol.cpp


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 66b6565bf6..1e345eede7 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -98,6 +98,10 @@ void PoliceBust(ArgArray args) {
     // assert types
     assert (args.size() == 1 || args.size() == 2);
     g_private->_policeBustEnabled = args[0].u.val;
+    //debug("Number of clicks %d", g_private->computePoliceIndex());
+
+    if (g_private->_policeBustEnabled)
+        g_private->startPoliceBust();
 
     if (args.size() == 2) {
         if (args[1].u.val == 2) {
@@ -106,8 +110,10 @@ void PoliceBust(ArgArray args) {
             assert(0);
 
         }
-        else if (args[1].u.val == 2) {
+        else if (args[1].u.val == 3) {
             g_private->_nextSetting = &kMainDesktop;
+            g_private->_mode = 0;
+            g_private->_origin = &kPrivateOriginZero;
         } else
             assert(0);
     }
@@ -173,6 +179,16 @@ void Inventory(ArgArray args) {
 
         g_private->_masks.push_front(*m);
         g_private->_toTake = true;
+
+        Common::String *f;
+
+        if (strcmp(snd.u.str, "\"\"") != 0) {
+            f = new Common::String(snd.u.str);
+        } else {
+            f = g_private->getTakeLeaveSound();
+        }
+        g_private->playSound(*f, 1);
+
     } else { 
         if (v1.type == NAME)
             if (strcmp(c.u.str, "\"REMOVE\"") == 0)
@@ -184,11 +200,6 @@ void Inventory(ArgArray args) {
             v2.u.sym->u.val = 1;
     }
 
-    if (strcmp(snd.u.str, "\"\"") != 0) {
-        Common::String *s = new Common::String(snd.u.str);
-        g_private->playSound(*s, 1);
-    }
-
 
 
     // TODO: Keep track of inventory is missing
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 62d0e88f2f..dc84514b12 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -69,16 +69,21 @@ PrivateEngine::PrivateEngine(OSystem *syst)
 
     _policeBustEnabled = false;
     _policeBustSetting = NULL;
-
+    _numberClicks = 0;
+    policeVideoIndex = 0;
 
     _paperShuffleSound = new Common::String("global/audio/glsfx0");
     _takeSound = new Common::String("global/audio/took");
     _leaveSound = new Common::String("global/audio/left");
+    _sirenSound = new Common::String("po/audio/posfx002.wav");
 
     _policeRadioArea = NULL;
     _AMRadioArea = NULL;
     _phoneArea = NULL;
 
+    // TODO: use this as a default sound for radio
+    _radioSound = new Common::String("inface/radio/radio.wav");
+
     _AMRadioPrefix = new Common::String("inface/radio/comm_/");
     _policeRadioPrefix = new Common::String("inface/radio/police/");
     _phonePrefix = new Common::String("inface/telephon/");
@@ -180,12 +185,8 @@ Common::Error PrivateEngine::run() {
                     }
                 }
                 else if (event.kbd.keycode == Common::KEYCODE_p) {
-                    if ( _policeBustEnabled) {
-                        Common::String *pv = new Common::String("po/animatio/spoc02xs.smk");
-                        _nextMovie = pv;
-                        _policeBustSetting = _currentSetting;
-                        _nextSetting = &kPoliceBustFromMO;
-                    }
+                    debug("Number of clicks %d", _numberClicks);
+
                 }
                 break;
 
@@ -194,6 +195,7 @@ Common::Error PrivateEngine::run() {
                 break;
 
             case Common::EVENT_LBUTTONDOWN:
+                _numberClicks++; 
                 selectPhoneArea(mousePos);
                 selectPoliceRadioArea(mousePos);
                 selectAMRadioArea(mousePos);
@@ -217,6 +219,8 @@ Common::Error PrivateEngine::run() {
             }
         }
 
+        checkPoliceBust();
+
         // Movies
         if (_nextMovie != NULL) {
             _videoDecoder = new Video::SmackerDecoder();
@@ -268,6 +272,55 @@ Common::Error PrivateEngine::run() {
     return Common::kNoError;
 }
 
+void PrivateEngine::startPoliceBust() {
+    Common::String k("kPoliceIndex");
+    int policeIndex = variables.getVal(k)->u.val;
+
+    int r = _rnd->getRandomNumber(0xc);
+    if (0x14 < policeIndex) {
+        policeIndex = 0x15;
+    }
+    _maxNumberClicks = r + 0x10 + (policeIndex * 0xe) / -0x15;
+    _sirenWarning = 3 + _rnd->getRandomNumber(0x7);
+    _numberClicks = 0;
+    assert(_sirenWarning < _maxNumberClicks);
+}
+
+void PrivateEngine::checkPoliceBust() {
+    if (!_policeBustEnabled)
+        return;
+
+    if (_numberClicks < _sirenWarning)
+        return;
+     
+    if (_numberClicks == _sirenWarning) {
+        stopSound(); 
+        playSound(*_sirenSound, 0);
+        _numberClicks++; // Won't execute again
+        return;
+    }
+
+    if (_numberClicks == _maxNumberClicks+1) {
+        Common::String k("kPoliceIndex");
+        uint kPoliceIndex = variables.getVal(k)->u.val;
+
+        if (kPoliceIndex <= 12) {
+            assert(policeVideoIndex/2 <= 5);
+            char f[30];
+            sprintf(f, "po/animatio/spoc%02dxs.smk", kPoliceBustVideos[policeVideoIndex/2]);
+            policeVideoIndex++;
+
+            Common::String *pv = new Common::String(f);
+            _nextMovie = pv;
+        }
+        _policeBustSetting = _currentSetting;
+        _nextSetting = &kPoliceBustFromMO;
+        _numberClicks++; // Won't execute again
+    }
+
+}
+
+
 bool PrivateEngine::cursorExit(Common::Point mousePos) {
     //debug("Mousepos %d %d", mousePos.x, mousePos.y);
     mousePos = mousePos - *_origin;
@@ -798,6 +851,15 @@ Common::String *PrivateEngine::getTakeSound() {
     return (new Common::String(*_takeSound + f));
 }
 
+Common::String *PrivateEngine::getTakeLeaveSound() {
+    uint r = _rnd->getRandomNumber(1);
+    if (r == 0) {
+        return (new Common::String("global/audio/mvo001.wav"));
+    } else {
+        return (new Common::String("global/audio/mvo006.wav"));
+    }
+}
+
 Common::String *PrivateEngine::getLeaveSound() {
     uint r = 1 + _rnd->getRandomNumber(4);
 
diff --git a/engines/private/private.h b/engines/private/private.h
index cabdb498cd..988703646a 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -35,6 +35,10 @@ enum {
                             // the current limitation is 32 debug channels (1 << 31 is the last one)
 };
 
+// police
+
+const int kPoliceBustVideos[6] = {1, 2, 4, 5, 7, 8};
+
 // points
 
 const Common::Point kPrivateOriginZero(0, 0); 
@@ -155,7 +159,14 @@ public:
 
     // Police Bust
 
+    int policeVideoIndex;
+    void policeBust();
     bool _policeBustEnabled;
+    void startPoliceBust();
+    void checkPoliceBust();
+    int _numberClicks;
+    int _maxNumberClicks;
+    int _sirenWarning;
     Common::String *_policeBustSetting;
 
     // Save/Load games
@@ -179,12 +190,17 @@ public:
     Common::String *_paperShuffleSound;
 
     Common::String *getTakeSound();
+    Common::String *getTakeLeaveSound();
     Common::String *getLeaveSound();
     Common::String *_takeSound;
     Common::String *_leaveSound;
+    Common::String *_sirenSound;
+
 
     // Radios
 
+    Common::String *_radioSound;
+
     MaskInfo *_AMRadioArea;
     Common::String *_AMRadioPrefix;
 
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 2a813d6470..2c1241b022 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -37,7 +37,6 @@ void showSymbol(Symbol *s) {
 }
 
 void setSymbol(Symbol *s, int v) {
-    //assert(s->type == STRING);
     s->u.val = v;
 }
 


Commit: 4e5f3c549c882e76d2dfe60fe476dd3163d8b0d2
    https://github.com/scummvm/scummvm/commit/4e5f3c549c882e76d2dfe60fe476dd3163d8b0d2
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: partial dossier browsing implementation

Changed paths:
    engines/private/cursors.cpp
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index ee839fc514..7b41db1c90 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -333,7 +333,7 @@ void PrivateEngine::changeCursor(Common::String cursor) {
     else
         s = Common::Point(32, 32);
 
-    CursorMan.replaceCursor(_cursorData.getVal(cursor), s.x, s.y, p.x, p.y, 0, true);
+    CursorMan.replaceCursor(_cursorData.getVal(cursor), s.x, s.y, p.x, p.y, 0, false);
     CursorMan.showMouse(true);
 }
 
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 1e345eede7..6cdf68f0d2 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -121,8 +121,75 @@ void PoliceBust(ArgArray args) {
 }
 
 void DossierAdd(ArgArray args) {
-    // assert types
-    debug("WARNING: DossierAdd is not implemented");
+
+    assert (args.size() == 2);
+    Common::String *s = new Common::String(args[0].u.str);
+    DossierInfo *m = (DossierInfo*) malloc(sizeof(DossierInfo));
+    m->page1 = s;
+
+    if (strcmp(args[1].u.str, "\"\"") != 0) {
+        Common::String *s = new Common::String(args[1].u.str);
+        m->page2 = s;
+
+    } else {
+        m->page2 = NULL;
+    }
+
+    g_private->_dossiers.push_back(*m);
+}
+
+void DossierBitmap(ArgArray args) {
+
+    assert (args.size() == 2);
+    
+    int x = args[0].u.val;
+    int y = args[1].u.val;
+
+    assert(x == 40 && y == 30);
+
+    g_private->loadDossier();
+
+}
+
+void DossierChgSheet(ArgArray args) {
+    debug("WARNING: DossierChgSheet is not implemented");
+}
+
+void DossierPrevSuspect(ArgArray args) {
+    assert (args.size() == 3);
+    Common::String *s = new Common::String(args[0].u.str);
+    MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+
+    int x = args[1].u.val;
+    int y = args[2].u.val;
+
+    m->surf = g_private->loadMask(*s, x, y, true);
+    m->cursor = new Common::String("kExit");
+    m->nextSetting = NULL;
+    m->flag1 = NULL;
+    m->flag2 = NULL;
+    g_private->_dossierPrevSuspectMask = m;
+    g_private->_masks.push_front(*m);
+    debug("origin: %d, %d, %d", g_private->_origin->x, g_private->_origin->y, g_private->_mode);
+    //debug("WARNING: DossierPrevSuspect is not implemented");
+}
+
+void DossierNextSuspect(ArgArray args) {
+    assert (args.size() == 3);
+    Common::String *s = new Common::String(args[0].u.str);
+    MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+
+    int x = args[1].u.val;
+    int y = args[2].u.val;
+
+    m->surf = g_private->loadMask(*s, x, y, true);
+    m->cursor = new Common::String("kExit");
+    m->nextSetting = NULL;
+    m->flag1 = NULL;
+    m->flag2 = NULL;
+    g_private->_dossierNextSuspectMask = m;
+    g_private->_masks.push_front(*m);
+    //debug("WARNING: DossierNextSuspect is not implemented");
 }
 
 void NoStopSounds(ArgArray args) {
@@ -190,11 +257,12 @@ void Inventory(ArgArray args) {
         g_private->playSound(*f, 1);
 
     } else { 
-        if (v1.type == NAME)
+        if (v1.type == NAME) {
             if (strcmp(c.u.str, "\"REMOVE\"") == 0)
                 v1.u.sym->u.val = 0;
             else
                 v1.u.sym->u.val = 1;
+        }
 
         if (v2.type == NAME)
             v2.u.sym->u.val = 1;
@@ -525,6 +593,7 @@ static struct FuncTable {
     { Resume,          "Resume"},
     { Goto,            "goto"},
     { SetFlag,         "SetFlag"},
+    { SetModifiedFlag, "SetModifiedFlag"},
     { Timer,	       "Timer"},
 
     // Sounds
@@ -550,14 +619,20 @@ static struct FuncTable {
     { Transition,      "Transition"},
     { Movie,           "Movie"},
 
-    { SetModifiedFlag, "SetModifiedFlag"},
+
     { Exit,            "Exit"},
     { Quit,            "Quit"},
     { LoadGame,        "LoadGame"},
     { SaveGame,        "SaveGame"},
     { AskSave,         "AskSave"},
 
+    // Dossiers
     { DossierAdd,      "DossierAdd"},
+    { DossierChgSheet, "DossierChgSheet"},
+    { DossierBitmap,   "DossierBitmap"},
+    { DossierPrevSuspect, "DossierPrevSuspect"},
+    { DossierNextSuspect, "DossierNextSuspect"},
+    
     { Inventory,       "Inventory"},
     { CRect,           "CRect"},
     { RestartGame,     "RestartGame"},
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index dc84514b12..0633c84860 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -55,6 +55,9 @@ PrivateEngine::PrivateEngine(OSystem *syst)
     _saveGameMask = NULL;
     _loadGameMask = NULL;
 
+    _dossierNextSuspectMask = NULL;
+    _dossierPrevSuspectMask = NULL;
+
     _nextSetting = NULL;
     _currentSetting = NULL;
     _nextMovie = NULL;
@@ -89,6 +92,9 @@ PrivateEngine::PrivateEngine(OSystem *syst)
     _phonePrefix = new Common::String("inface/telephon/");
     _phoneCallSound = new Common::String("phone.wav");
 
+    _dossierPage = 0;
+    _dossierSuspect = 0;
+
 }
 
 PrivateEngine::~PrivateEngine() {
@@ -178,16 +184,16 @@ Common::Error PrivateEngine::run() {
             case Common::EVENT_KEYDOWN:
                 if (event.kbd.keycode == Common::KEYCODE_ESCAPE && _videoDecoder)
                     skipVideo();
-                else if (event.kbd.keycode == Common::KEYCODE_m) {
-                    if ( _pausedSetting == NULL) {
-                        _pausedSetting = _currentSetting;
-                        _nextSetting = &kPauseMovie;
-                    }
-                }
-                else if (event.kbd.keycode == Common::KEYCODE_p) {
-                    debug("Number of clicks %d", _numberClicks);
-
-                }
+                //else if (event.kbd.keycode == Common::KEYCODE_m) {
+                //    if ( _pausedSetting == NULL) {
+                //        _pausedSetting = _currentSetting;
+                //        _nextSetting = &kPauseMovie;
+                //    }
+                //}
+                //else if (event.kbd.keycode == Common::KEYCODE_p) {
+                //    debug("Number of clicks %d", _numberClicks);
+
+                //}
                 break;
 
             case Common::EVENT_QUIT:
@@ -195,7 +201,13 @@ Common::Error PrivateEngine::run() {
                 break;
 
             case Common::EVENT_LBUTTONDOWN:
-                _numberClicks++; 
+                _numberClicks++;
+                if (selectDossierNextSuspect(mousePos))
+                  break;
+                else if (selectDossierPrevSuspect(mousePos))
+                  break;
+
+                selectPauseMovie(mousePos);
                 selectPhoneArea(mousePos);
                 selectPoliceRadioArea(mousePos);
                 selectAMRadioArea(mousePos);
@@ -250,14 +262,7 @@ Common::Error PrivateEngine::run() {
 
         if (_nextSetting != NULL) {
             debug("Executing %s", _nextSetting->c_str());
-            _exits.clear();
-            _masks.clear();
-            _loadGameMask = NULL;
-            _saveGameMask = NULL;
-            _policeRadioArea = NULL;
-            _policeRadioArea = NULL;
-            _AMRadioArea = NULL;
-            _phoneArea = NULL;
+            clearAreas();
             _currentSetting = _nextSetting;
             loadSetting(_nextSetting);
             _nextSetting = NULL;
@@ -272,6 +277,17 @@ Common::Error PrivateEngine::run() {
     return Common::kNoError;
 }
 
+void PrivateEngine::clearAreas() {
+    _exits.clear();
+    _masks.clear();
+    _loadGameMask = NULL;
+    _saveGameMask = NULL;
+    _policeRadioArea = NULL;
+    _policeRadioArea = NULL;
+    _AMRadioArea = NULL;
+    _phoneArea = NULL;
+}
+
 void PrivateEngine::startPoliceBust() {
     Common::String k("kPoliceIndex");
     int policeIndex = variables.getVal(k)->u.val;
@@ -313,14 +329,15 @@ void PrivateEngine::checkPoliceBust() {
             Common::String *pv = new Common::String(f);
             _nextMovie = pv;
         }
+
         _policeBustSetting = _currentSetting;
         _nextSetting = &kPoliceBustFromMO;
         _numberClicks++; // Won't execute again
+        clearAreas();
+        // FIXME: this should clear all the masks and exits
     }
-
 }
 
-
 bool PrivateEngine::cursorExit(Common::Point mousePos) {
     //debug("Mousepos %d %d", mousePos.x, mousePos.y);
     mousePos = mousePos - *_origin;
@@ -389,6 +406,19 @@ bool PrivateEngine::cursorMask(Common::Point mousePos) {
     return inside;
 }
 
+void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
+    if (_mode == 1) {
+        Common::Rect window(_origin->x, _origin->y, _screenW - _origin->x, _screenH - _origin->y);
+        if (!window.contains(mousePos)) {
+            if ( _pausedSetting == NULL) {
+                _pausedSetting = _currentSetting;
+                _nextSetting = &kPauseMovie;
+            }
+        }
+    }
+
+}
+
 void PrivateEngine::selectExit(Common::Point mousePos) {
     //debug("Mousepos %d %d", mousePos.x, mousePos.y);
     mousePos = mousePos - *_origin;
@@ -526,6 +556,57 @@ void PrivateEngine::selectPhoneArea(Common::Point mousePos) {
 
 }
 
+void PrivateEngine::loadDossier() {
+    int x = 40;
+    int y = 30;
+    int i = _dossierSuspect;
+    int j = _dossierPage;
+
+    DossierInfo m = _dossiers[i];
+
+    if (j == 0) {
+        loadImage(*m.page1, x, y);
+    } else if (j == 1) {
+        loadImage(*m.page2, x, y);
+    } else
+        assert(0);
+}
+
+
+bool PrivateEngine::selectDossierNextSuspect(Common::Point mousePos) {
+    if (_dossierNextSuspectMask == NULL)
+        return false;
+
+    if (inMask(_dossierNextSuspectMask->surf, mousePos)) {
+        if ((_dossierSuspect + 1) < _dossiers.size()) {
+            _dossierSuspect++;
+            _dossierPage = 0;
+            loadDossier();
+            drawMask(_dossierNextSuspectMask->surf);
+            drawMask(_dossierPrevSuspectMask->surf);
+        }
+        return true;
+    }
+    return false;
+}
+
+bool PrivateEngine::selectDossierPrevSuspect(Common::Point mousePos) {
+    if (_dossierPrevSuspectMask == NULL)
+        return false;
+
+    if (inMask(_dossierPrevSuspectMask->surf, mousePos)) {
+        if (_dossierSuspect > 0) {
+            _dossierSuspect--;
+            _dossierPage = 0;
+            loadDossier();
+            drawMask(_dossierNextSuspectMask->surf);
+            drawMask(_dossierPrevSuspectMask->surf);
+        }
+        return true;
+    }
+    return false;
+
+}
 
 void PrivateEngine::selectLoadGame(Common::Point mousePos) {
     if (_loadGameMask == NULL)
@@ -559,7 +640,7 @@ void PrivateEngine::restartGame() {
         if (strcmp("kAlternateGame", sym->name->c_str()) != 0)
             sym->u.val = 0;
     }
-    // TODO: reset sound lists
+    // FIXME: reset movies/sound lists
 }
 
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
@@ -782,17 +863,27 @@ Graphics::ManagedSurface *PrivateEngine::loadMask(const Common::String &name, in
 
     _image->loadStream(file);
     Graphics::ManagedSurface *surf = new Graphics::ManagedSurface();
+    Graphics::Surface *screen = g_system->lockScreen();
+
     surf->create(_screenW, _screenH, _pixelFormat);
+    surf->transBlitFrom(*screen);
+    g_system->unlockScreen();
+
     surf->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), Common::Point(x,y));
 
     if (drawn) {
-        _compositeSurface->transBlitFrom(surf->rawSurface(), *_origin + Common::Point(x,y), _transparentColor);
+        _compositeSurface->transBlitFrom(surf->rawSurface(), *_origin, _transparentColor);
         drawScreen();
     }
 
     return surf;
 }
 
+void PrivateEngine::drawMask(Graphics::ManagedSurface *surf) {
+    _compositeSurface->transBlitFrom(surf->rawSurface(), *_origin, _transparentColor);
+    drawScreen();
+}
+
 void PrivateEngine::drawScreen() {
     Graphics::Surface *screen = g_system->lockScreen();
     Graphics::ManagedSurface *surface = _compositeSurface;
diff --git a/engines/private/private.h b/engines/private/private.h
index 988703646a..4f6ef44ddd 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -74,6 +74,11 @@ typedef struct PhoneInfo {
     int val;
 } PhoneInfo;
 
+typedef struct DossierInfo {
+    Common::String *page1;
+    Common::String *page2;
+} DossierInfo;
+
 // lists
 
 typedef Common::List<ExitInfo> ExitList;
@@ -81,6 +86,10 @@ typedef Common::List<MaskInfo> MaskList;
 typedef Common::List<Common::String> SoundList;
 typedef Common::List<PhoneInfo> PhoneList;
 
+// arrays
+
+typedef Common::Array<DossierInfo> DossierArray;
+
 // hash tables
 
 typedef Common::HashMap<Common::String, bool> PlayedMediaTable;
@@ -106,7 +115,10 @@ public:
 
     Common::Error run() override;
     void restartGame();
+    void clearAreas();
     void initializePath(const Common::FSNode &gamePath) override;
+
+    void selectPauseMovie(Common::Point);
     void selectMask(Common::Point);
     void selectExit(Common::Point);
 
@@ -145,6 +157,7 @@ public:
     void initCursors();
 
     Graphics::ManagedSurface *loadMask(const Common::String &, int, int, bool);
+    void drawMask(Graphics::ManagedSurface *);
     bool inMask(Graphics::ManagedSurface*, Common::Point);
     uint32 _transparentColor;
     void drawScreen();
@@ -157,6 +170,17 @@ public:
     Common::String *_frame;
     bool            _toTake;
 
+    // Dossiers 
+
+    DossierArray _dossiers;
+    unsigned int _dossierSuspect;
+    unsigned int _dossierPage;
+    MaskInfo *_dossierNextSuspectMask;
+    MaskInfo *_dossierPrevSuspectMask;
+    bool selectDossierNextSuspect(Common::Point);
+    bool selectDossierPrevSuspect(Common::Point);
+    void loadDossier();
+
     // Police Bust
 
     int policeVideoIndex;
@@ -181,6 +205,8 @@ public:
     Common::String *_repeatedMovieExit;
     Common::String *_pausedSetting;
 
+    // Masks/Exits
+
     ExitList _exits;
     MaskList _masks;
 


Commit: 476cbb3106a936f506c9b9e294b1adc366837997
    https://github.com/scummvm/scummvm/commit/476cbb3106a936f506c9b9e294b1adc366837997
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: new features

Changed paths:
    engines/private/cursors.cpp
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index 7b41db1c90..f8995ffcd8 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -93,7 +93,7 @@ const byte MOUSECURSOR_kZoomIn[] = {
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
-
+ 
 const byte MOUSECURSOR_kTurnRight[] = {
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -297,11 +297,11 @@ static struct CursorPointTable {
 } cursorPointTable[] = {
     { "kExit",         new Common::Point(9, 0)},
     { "kInventory",    new Common::Point(15, 3)},
-    { "kTurnLeft",     new Common::Point(0, 0)},
-    { "kTurnRight",    new Common::Point(0, 0)},
+    { "kTurnLeft",     new Common::Point(29, 16)},
+    { "kTurnRight",    new Common::Point(1, 15)},
     { "kZoomIn",       new Common::Point(10, 8)},
     { "kZoomOut",      new Common::Point(13, 31)},
-    { "kPhone",        new Common::Point(0, 0)},
+    { "kPhone",        new Common::Point(17, 19)},
     { "default",       new Common::Point(0, 0)},
     { 0, 0}
 };
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 6cdf68f0d2..b33b49e4cf 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -1,4 +1,5 @@
 #include "common/str.h"
+#include "common/timer.h"
 #include "common/debug.h"
 #include "common/system.h"
 
@@ -141,7 +142,7 @@ void DossierAdd(ArgArray args) {
 void DossierBitmap(ArgArray args) {
 
     assert (args.size() == 2);
-    
+
     int x = args[0].u.val;
     int y = args[1].u.val;
 
@@ -579,9 +580,17 @@ void Timer(ArgArray args) {
     else
         debug("Timer(%d, %s)", args[0].u.val, args[1].u.str);
 
-    g_system->delayMillis(100 * args[0].u.val);
+    //g_system->delayMillis(1000 * args[0].u.val);
+    int32 delay = 1000000 * args[0].u.val;
     Common::String *s = new Common::String(args[1].u.str);
-    g_private->_nextSetting = s;
+    if (delay > 0) {
+        assert(g_private->installTimer(delay, s));
+    } else if (delay == 0) {
+        g_private->_nextSetting = s;
+    } else {
+        assert(0);
+    }
+
 }
 
 static struct FuncTable {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 0633c84860..dc009db9a7 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -14,6 +14,7 @@
 #include "common/system.h"
 #include "common/str.h"
 #include "common/savefile.h"
+#include "common/timer.h"
 #include "engines/util.h"
 
 #include "image/bmp.h"
@@ -184,16 +185,7 @@ Common::Error PrivateEngine::run() {
             case Common::EVENT_KEYDOWN:
                 if (event.kbd.keycode == Common::KEYCODE_ESCAPE && _videoDecoder)
                     skipVideo();
-                //else if (event.kbd.keycode == Common::KEYCODE_m) {
-                //    if ( _pausedSetting == NULL) {
-                //        _pausedSetting = _currentSetting;
-                //        _nextSetting = &kPauseMovie;
-                //    }
-                //}
-                //else if (event.kbd.keycode == Common::KEYCODE_p) {
-                //    debug("Number of clicks %d", _numberClicks);
-
-                //}
+
                 break;
 
             case Common::EVENT_QUIT:
@@ -213,15 +205,17 @@ Common::Error PrivateEngine::run() {
                 selectAMRadioArea(mousePos);
                 selectLoadGame(mousePos);
                 selectSaveGame(mousePos);
-                selectMask(mousePos);
+                if (!_nextSetting)
+                    selectMask(mousePos);
                 if (!_nextSetting)
                     selectExit(mousePos);
                 break;
 
             case Common::EVENT_MOUSEMOVE:
                 changeCursor("default");
-                if (cursorMask(mousePos))      {}
-                else if (cursorExit(mousePos))     {}
+                if      (cursorPauseMovie(mousePos)) {}
+                else if (cursorMask(mousePos))       {}
+                else if (cursorExit(mousePos))       {}
                 //
                 break;
 
@@ -235,6 +229,7 @@ Common::Error PrivateEngine::run() {
 
         // Movies
         if (_nextMovie != NULL) {
+            removeTimer();
             _videoDecoder = new Video::SmackerDecoder();
             playVideo(*_nextMovie);
             _nextMovie = NULL;
@@ -242,9 +237,8 @@ Common::Error PrivateEngine::run() {
 
         }
 
-        if (_nextVS != NULL) {
+        if (_nextVS != NULL && _currentSetting->c_str() == kMainDesktop) {
             loadImage(*_nextVS, 160, 120, true);
-            _nextVS = NULL;
         }
 
         if (_videoDecoder) {
@@ -261,6 +255,8 @@ Common::Error PrivateEngine::run() {
         }
 
         if (_nextSetting != NULL) {
+
+            removeTimer();
             debug("Executing %s", _nextSetting->c_str());
             clearAreas();
             _currentSetting = _nextSetting;
@@ -283,9 +279,11 @@ void PrivateEngine::clearAreas() {
     _loadGameMask = NULL;
     _saveGameMask = NULL;
     _policeRadioArea = NULL;
-    _policeRadioArea = NULL;
     _AMRadioArea = NULL;
     _phoneArea = NULL;
+    _dossierNextSuspectMask = NULL;
+    _dossierPrevSuspectMask = NULL;
+
 }
 
 void PrivateEngine::startPoliceBust() {
@@ -332,9 +330,8 @@ void PrivateEngine::checkPoliceBust() {
 
         _policeBustSetting = _currentSetting;
         _nextSetting = &kPoliceBustFromMO;
-        _numberClicks++; // Won't execute again
         clearAreas();
-        // FIXME: this should clear all the masks and exits
+        _policeBustEnabled = false;
     }
 }
 
@@ -406,9 +403,24 @@ bool PrivateEngine::cursorMask(Common::Point mousePos) {
     return inside;
 }
 
-void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
+bool PrivateEngine::cursorPauseMovie(Common::Point mousePos) {
     if (_mode == 1) {
         Common::Rect window(_origin->x, _origin->y, _screenW - _origin->x, _screenH - _origin->y);
+        if (!window.contains(mousePos)) {
+            return true;
+        }
+    }
+    return false;
+}
+
+void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
+    if (_mode == 1) {        
+        Common::Rect window(_origin->x, _origin->y, _screenW - _origin->x, _screenH - _origin->y);
+        //debug("%d, %d", mousePos.x, mousePos.y);
+        //debug("%d, %d", window.top, window.left);
+        //debug("%d, %d", window.bottom, window.right);
+
+        //debug("%d, %d", window.y2, window.y2);
         if (!window.contains(mousePos)) {
             if ( _pausedSetting == NULL) {
                 _pausedSetting = _currentSetting;
@@ -471,7 +483,6 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
 
             if (m.flag1 != NULL) { // TODO: check this
                 setSymbol(m.flag1, 1);
-                debug("!!!!!!!!!!!!!! setting %s to 1 !!!!!!!!!!!!!!!!!!1", m.flag1->name->c_str());
                 // an item was taken
                 if (_toTake) {
                     playSound(*getTakeSound(), 1);
@@ -823,7 +834,6 @@ void PrivateEngine::skipVideo() {
     _videoDecoder = nullptr;
 }
 
-
 void PrivateEngine::stopSound() {
     debugC(3, kPrivateDebugExample, "%s", __FUNCTION__);
     if (_mixer->isSoundHandleActive(_soundHandle))
@@ -892,10 +902,11 @@ void PrivateEngine::drawScreen() {
 
     if (_videoDecoder) {
         Graphics::Surface *frame = new Graphics::Surface;
-        frame->create(_screenW, _screenH, _pixelFormat);
+        frame->create(_videoDecoder->getWidth(), _videoDecoder->getHeight(), _pixelFormat);
         frame->copyFrom(*_videoDecoder->decodeNextFrame());
         Graphics::Surface *cframe = frame->convertTo(_pixelFormat, _videoDecoder->getPalette());
-        surface->transBlitFrom(*cframe, *_origin);
+        Common::Point center((_screenW - _videoDecoder->getWidth())/2, (_screenH - _videoDecoder->getHeight())/2);
+        surface->transBlitFrom(*cframe, center);
         frame->free();
         cframe->free();
         delete frame;
@@ -968,5 +979,19 @@ char *PrivateEngine::getRandomPhoneClip(char *clip, int i, int j) {
     return f;
 }
 
+// Timers
+
+void timerCallback(void *refCon) {
+    g_private->removeTimer();
+    g_private->_nextSetting = (Common::String*) refCon;
+}
+
+bool PrivateEngine::installTimer(uint32 delay, Common::String *ns) {
+    return g_system->getTimerManager()->installTimerProc(&timerCallback, delay, (void*) ns, "timerCallback");
+}
+
+void PrivateEngine::removeTimer() {
+    g_system->getTimerManager()->removeTimerProc(&timerCallback);
+}
 
 } // End of namespace Private
diff --git a/engines/private/private.h b/engines/private/private.h
index 4f6ef44ddd..cf3ddbea2a 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -118,10 +118,17 @@ public:
     void clearAreas();
     void initializePath(const Common::FSNode &gamePath) override;
 
+    // User input
+
     void selectPauseMovie(Common::Point);
     void selectMask(Common::Point);
     void selectExit(Common::Point);
+    void selectLoadGame(Common::Point);
+    void selectSaveGame(Common::Point);
+    
+    // Cursors
 
+    bool cursorPauseMovie(Common::Point);
     bool cursorExit(Common::Point);
     bool cursorMask(Common::Point);
 
@@ -136,8 +143,7 @@ public:
         return true;
     }
 
-    void selectLoadGame(Common::Point);
-    void selectSaveGame(Common::Point);
+
 
 
     Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
@@ -252,6 +258,12 @@ public:
 
     bool getRandomBool(uint);
 
+    // Timers
+
+    bool installTimer(uint32, Common::String *);
+    void removeTimer();
+    //static void timerCallback(void *);
+
 };
 
 extern PrivateEngine *g_private;


Commit: f6d7fa4e48d97f4016cfae46274da51b3455cc56
    https://github.com/scummvm/scummvm/commit/f6d7fa4e48d97f4016cfae46274da51b3455cc56
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixes in sounds and memory management

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index b33b49e4cf..d2bd68acba 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -24,6 +24,8 @@ void ChgMode(ArgArray args) {
     }
     else
         assert(0);
+
+    g_private->stopSound();
 }
 
 void VSPicture(ArgArray args) {
@@ -49,7 +51,7 @@ void SyncSound(ArgArray args) {
 
     if (strcmp("\"\"", args[0].u.str) != 0) {
         Common::String *s = new Common::String(args[0].u.str);
-        g_private->playSound(*s, 1);
+        g_private->playSound(*s, 1, true);
         //assert(0);
     } else {
         g_private->stopSound();
@@ -90,9 +92,8 @@ void SaveGame(ArgArray args) {
 }
 
 void RestartGame(ArgArray args) {
-    // assert types
+    assert(args.size() == 0);
     g_private->restartGame();
-    //debug("WARNING: RestartGame is not implemented");
 }
 
 void PoliceBust(ArgArray args) {
@@ -107,7 +108,7 @@ void PoliceBust(ArgArray args) {
     if (args.size() == 2) {
         if (args[1].u.val == 2) {
             Common::String *s = new Common::String("global/transiti/audio/spoc02VO.wav");
-            g_private->playSound(*s, 1);
+            g_private->playSound(*s, 1, false);
             assert(0);
 
         }
@@ -124,13 +125,13 @@ void PoliceBust(ArgArray args) {
 void DossierAdd(ArgArray args) {
 
     assert (args.size() == 2);
-    Common::String *s = new Common::String(args[0].u.str);
+    Common::String *s1 = new Common::String(args[0].u.str);
     DossierInfo *m = (DossierInfo*) malloc(sizeof(DossierInfo));
-    m->page1 = s;
+    m->page1 = s1;
 
     if (strcmp(args[1].u.str, "\"\"") != 0) {
-        Common::String *s = new Common::String(args[1].u.str);
-        m->page2 = s;
+        Common::String *s2 = new Common::String(args[1].u.str);
+        m->page2 = s2;
 
     } else {
         m->page2 = NULL;
@@ -255,7 +256,7 @@ void Inventory(ArgArray args) {
         } else {
             f = g_private->getTakeLeaveSound();
         }
-        g_private->playSound(*f, 1);
+        g_private->playSound(*f, 1, false);
 
     } else { 
         if (v1.type == NAME) {
@@ -316,7 +317,19 @@ void PaperShuffleSound(ArgArray args) {
     // assert types
     debug("PaperShuffleSound()");
     Common::String *s = g_private->getPaperShuffleSound();
-    g_private->playSound(*s, 1);
+    g_private->playSound(*s, 1, false);
+}
+
+void SoundEffect(ArgArray args) {
+    // assert types
+    debug("SoundEffect(%s)", args[0].u.str);
+    if (strcmp("\"\"", args[0].u.str) != 0) {
+        Common::String *s = new Common::String(args[0].u.str);
+        g_private->playSound(*s, 1, false);
+        //assert(0);
+    } else {
+        g_private->stopSound();
+    }
 }
 
 void Sound(ArgArray args) {
@@ -324,7 +337,7 @@ void Sound(ArgArray args) {
     debug("Sound(%s)", args[0].u.str);
     if (strcmp("\"\"", args[0].u.str) != 0) {
         Common::String *s = new Common::String(args[0].u.str);
-        g_private->playSound(*s, 1);
+        g_private->playSound(*s, 1, true);
         //assert(0);
     } else {
         g_private->stopSound();
@@ -337,7 +350,7 @@ void LoopedSound(ArgArray args) {
     debug("LoopedSound(%s)", args[0].u.str);
     if (strcmp("\"\"", args[0].u.str) != 0) {
         Common::String *s = new Common::String(args[0].u.str);
-        g_private->playSound(*s, 0);
+        g_private->playSound(*s, 0, true);
         //assert(0);
     } else {
         g_private->stopSound();
@@ -607,7 +620,7 @@ static struct FuncTable {
 
     // Sounds
     { Sound,           "Sound"},
-    { Sound,           "SoundEffect"},
+    { SoundEffect,     "SoundEffect"},
     { LoopedSound,     "LoopedSound"},
     { NoStopSounds,    "NoStopSounds"},
     { SyncSound,       "SyncSound"},
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index dc009db9a7..ee7a4228a6 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -309,7 +309,7 @@ void PrivateEngine::checkPoliceBust() {
      
     if (_numberClicks == _sirenWarning) {
         stopSound(); 
-        playSound(*_sirenSound, 0);
+        playSound(*_sirenSound, 0, false);
         _numberClicks++; // Won't execute again
         return;
     }
@@ -450,7 +450,7 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
             if (cs < rs && e.nextSetting != NULL) { // TODO: check this
                 // an item was not taken
                 if (_toTake) {
-                    playSound(* getLeaveSound(), 1);
+                    playSound(* getLeaveSound(), 1, false);
                     _toTake = false;
                 }
 
@@ -485,7 +485,7 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
                 setSymbol(m.flag1, 1);
                 // an item was taken
                 if (_toTake) {
-                    playSound(*getTakeSound(), 1);
+                    playSound(*getTakeSound(), 1, false);
                     _toTake = false;
                 }
             }
@@ -514,7 +514,7 @@ void PrivateEngine::selectAMRadioArea(Common::Point mousePos) {
     debug("AMRadio");
     if (inMask(_AMRadioArea->surf, mousePos)) {
         Common::String sound = *_AMRadioPrefix + _AMRadio.back() + ".wav";
-        playSound(sound.c_str(), 1);
+        playSound(sound.c_str(), 1, false);
         _AMRadio.pop_back();
     }
 
@@ -530,7 +530,7 @@ void PrivateEngine::selectPoliceRadioArea(Common::Point mousePos) {
     debug("PoliceRadio");
     if (inMask(_policeRadioArea->surf, mousePos)) {
         Common::String sound = *_policeRadioPrefix + _policeRadio.back() + ".wav";
-        playSound(sound.c_str(), 1);
+        playSound(sound.c_str(), 1, false);
         _policeRadio.pop_back();
     }
 
@@ -544,7 +544,7 @@ void PrivateEngine::checkPhoneCall() {
         return;
 
     if (!_mixer->isSoundHandleActive(_soundHandle))
-        playSound(*_phonePrefix + *_phoneCallSound, 1);
+        playSound(*_phonePrefix + *_phoneCallSound, 1, false);
 
 }
 
@@ -561,7 +561,7 @@ void PrivateEngine::selectPhoneArea(Common::Point mousePos) {
         Common::String sound(*i.sound);
         setSymbol(i.flag, i.val);
         sound = *_phonePrefix + sound + ".wav";
-        playSound(sound.c_str(), 1);
+        playSound(sound.c_str(), 1, true);
         _phone.pop_back();
     }
 
@@ -799,7 +799,7 @@ Common::String PrivateEngine::convertPath(Common::String name) {
     return path;
 }
 
-void PrivateEngine::playSound(const Common::String &name, uint loops) {
+void PrivateEngine::playSound(const Common::String &name, uint loops, bool stopOthers) {
     debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
 
     Common::File *file = new Common::File();
@@ -810,12 +810,15 @@ void PrivateEngine::playSound(const Common::String &name, uint loops) {
 
     Audio::LoopingAudioStream *stream;
     stream = new Audio::LoopingAudioStream(Audio::makeWAVStream(file, DisposeAfterUse::YES), loops);
-    stopSound();
+    if (stopOthers) {
+        stopSound();
+    }
     _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream, -1, Audio::Mixer::kMaxChannelVolume);
 }
 
 void PrivateEngine::playVideo(const Common::String &name) {
     debug("%s : %s", __FUNCTION__, name.c_str());
+    stopSound();
     Common::File *file = new Common::File();
     Common::String path = convertPath(name);
 
@@ -848,7 +851,11 @@ void PrivateEngine::loadImage(const Common::String &name, int x, int y, bool dra
         error("unable to load image %s", path.c_str());
 
     _image->loadStream(file);
-    _compositeSurface->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), *_origin + Common::Point(x,y), _transparentColor);
+    Graphics::Surface *surf = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
+    _compositeSurface->transBlitFrom(*surf, *_origin + Common::Point(x,y), _transparentColor);
+    surf->free();
+    delete surf;
+    _image->destroy();
     drawScreen();
 }
 
@@ -857,10 +864,11 @@ void PrivateEngine::drawScreenFrame(Graphics::Surface *screen) {
     Common::File file;
     assert(file.open(path));
     _image->loadStream(file);
-    Graphics::Surface *frame = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
-    screen->copyRectToSurface(*frame, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
-    frame->free();
-    delete frame;
+    Graphics::Surface *csurf = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
+    screen->copyRectToSurface(*csurf, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
+    csurf->free();
+    delete csurf;
+    _image->destroy();
 }
 
 
@@ -878,12 +886,14 @@ Graphics::ManagedSurface *PrivateEngine::loadMask(const Common::String &name, in
     surf->create(_screenW, _screenH, _pixelFormat);
     surf->transBlitFrom(*screen);
     g_system->unlockScreen();
-
-    surf->transBlitFrom(*_image->getSurface()->convertTo(_pixelFormat, _image->getPalette()), Common::Point(x,y));
+    Graphics::Surface *csurf = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
+    surf->transBlitFrom(*csurf, Common::Point(x,y));
+    csurf->free();
+    delete csurf;
+    _image->destroy();
 
     if (drawn) {
-        _compositeSurface->transBlitFrom(surf->rawSurface(), *_origin, _transparentColor);
-        drawScreen();
+        drawMask(surf);
     }
 
     return surf;
@@ -901,15 +911,15 @@ void PrivateEngine::drawScreen() {
     int h = surface->h;
 
     if (_videoDecoder) {
-        Graphics::Surface *frame = new Graphics::Surface;
-        frame->create(_videoDecoder->getWidth(), _videoDecoder->getHeight(), _pixelFormat);
-        frame->copyFrom(*_videoDecoder->decodeNextFrame());
+        const Graphics::Surface *frame = _videoDecoder->decodeNextFrame();
+        //frame->create(_videoDecoder->getWidth(), _videoDecoder->getHeight(), _pixelFormat);
+        //frame->copyFrom(*_videoDecoder->decodeNextFrame());
         Graphics::Surface *cframe = frame->convertTo(_pixelFormat, _videoDecoder->getPalette());
         Common::Point center((_screenW - _videoDecoder->getWidth())/2, (_screenH - _videoDecoder->getHeight())/2);
         surface->transBlitFrom(*cframe, center);
-        frame->free();
+        //frame->free();
         cframe->free();
-        delete frame;
+        //delete frame;
         delete cframe;
     }
 
diff --git a/engines/private/private.h b/engines/private/private.h
index cf3ddbea2a..4b4c2ad7fd 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -151,7 +151,7 @@ public:
     void syncGameStream(Common::Serializer &s);
 
     Common::String convertPath(Common::String);
-    void playSound(const Common::String &, uint);
+    void playSound(const Common::String &, uint, bool);
     void playVideo(const Common::String &);
     void skipVideo();
     void stopSound();


Commit: e92e29bc020e770f43ee7172cab8530a47110393
    https://github.com/scummvm/scummvm/commit/e92e29bc020e770f43ee7172cab8530a47110393
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixes and new stuff

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h
    engines/private/symbol.cpp
    engines/private/symbol.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index d2bd68acba..a971532bfe 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -11,7 +11,14 @@ namespace Private {
 
 void ChgMode(ArgArray args) {
     // assert types
-    debug("ChgMode(%d, %s)", args[0].u.val, args[1].u.str);
+    assert (args.size() == 2 || args.size() == 3);
+    if (args.size() == 2)
+        debug("ChgMode(%d, %s)", args[0].u.val, args[1].u.str);
+    else if (args.size() == 3)
+        debug("ChgMode(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.sym->name->c_str());
+    else 
+        assert(0);
+
     g_private->_mode = args[0].u.val;
     Common::String *s = new Common::String(args[1].u.str);
     g_private->_nextSetting = s;
@@ -25,7 +32,10 @@ void ChgMode(ArgArray args) {
     else
         assert(0);
 
-    g_private->stopSound();
+    if (args.size() == 3)
+        setSymbol(args[2].u.sym, true);
+
+    g_private->stopSound(true);
 }
 
 void VSPicture(ArgArray args) {
@@ -35,6 +45,41 @@ void VSPicture(ArgArray args) {
 }
 
 
+void DiaryLocList(ArgArray args) {
+    int x1, y1, x2, y2;
+
+    debug("DiaryLocList(%d, %d, %d, %d)", args[0].u.val, args[1].u.val, args[2].u.val, args[3].u.val);
+
+    x2 = args[0].u.val;
+    y2 = args[1].u.val;
+
+    x1 = args[2].u.val;
+    y1 = args[3].u.val;
+
+    Common::Rect *rect = new Common::Rect(x1, y1, x2, y2);
+    rect->debugPrint();
+    g_private->loadLocations(rect);
+
+}
+
+void DiaryGoLoc(ArgArray args) {
+    debug("WARNING: DiaryGoLoc not implemented");
+}
+
+void DiaryInvList(ArgArray args) {
+    Common::Rect *r1, *r2;
+
+    debug("DiaryInvList(%d, ..)", args[0].u.val);
+
+    r1 = args[1].u.rect;
+    r2 = args[2].u.rect;
+
+    r1->debugPrint();
+    r2->debugPrint();
+
+    g_private->loadInventory(args[0].u.val, r1, r2);
+}
+
 void Goto(ArgArray args) { // should be goto, but this is a reserved word
     // assert types
     debug("goto(%s)", args[0].u.str);
@@ -51,10 +96,10 @@ void SyncSound(ArgArray args) {
 
     if (strcmp("\"\"", args[0].u.str) != 0) {
         Common::String *s = new Common::String(args[0].u.str);
-        g_private->playSound(*s, 1, true);
+        g_private->playSound(*s, 1, true, false);
         //assert(0);
     } else {
-        g_private->stopSound();
+        g_private->stopSound(true);
     }
 }
 
@@ -108,7 +153,7 @@ void PoliceBust(ArgArray args) {
     if (args.size() == 2) {
         if (args[1].u.val == 2) {
             Common::String *s = new Common::String("global/transiti/audio/spoc02VO.wav");
-            g_private->playSound(*s, 1, false);
+            g_private->playSound(*s, 1, false, false);
             assert(0);
 
         }
@@ -206,7 +251,7 @@ void Inventory(ArgArray args) {
     Datum v1 = args[1];
     Datum v2 = args[2];
     Datum e = args[3];
-
+    Datum i = args[4];
     Datum c = args[5];
 
     Datum snd = args[8];
@@ -215,7 +260,11 @@ void Inventory(ArgArray args) {
     assert(b1.type == STRING);
     assert(e.type == STRING || e.type == NUM);
     assert(snd.type == STRING);
+    assert(i.type == STRING);
 
+    Common::String *bmp = new Common::String(i.u.str);
+    assert(strcmp(bmp->c_str(), "\"\"") != 0);
+    
 
     if (v1.type == STRING)
         assert(strcmp(v1.u.str, "\"\"") == 0);
@@ -256,23 +305,25 @@ void Inventory(ArgArray args) {
         } else {
             f = g_private->getTakeLeaveSound();
         }
-        g_private->playSound(*f, 1, false);
-
+        g_private->playSound(*f, 1, false, false);
+        g_private->inventory.push_back(*bmp);
     } else { 
         if (v1.type == NAME) {
-            if (strcmp(c.u.str, "\"REMOVE\"") == 0)
+            if (strcmp(c.u.str, "\"REMOVE\"") == 0) {
                 v1.u.sym->u.val = 0;
-            else
+                g_private->inventory.remove(*bmp);
+            } else {
                 v1.u.sym->u.val = 1;
+                g_private->inventory.push_back(*bmp);
+            }
+        } else  {
+            g_private->inventory.push_back(*bmp);
         }
 
         if (v2.type == NAME)
             v2.u.sym->u.val = 1;
     }
 
-
-
-    // TODO: Keep track of inventory is missing
 }
 
 void SetFlag(ArgArray args) {
@@ -317,7 +368,7 @@ void PaperShuffleSound(ArgArray args) {
     // assert types
     debug("PaperShuffleSound()");
     Common::String *s = g_private->getPaperShuffleSound();
-    g_private->playSound(*s, 1, false);
+    g_private->playSound(*s, 1, false, false);
 }
 
 void SoundEffect(ArgArray args) {
@@ -325,22 +376,35 @@ void SoundEffect(ArgArray args) {
     debug("SoundEffect(%s)", args[0].u.str);
     if (strcmp("\"\"", args[0].u.str) != 0) {
         Common::String *s = new Common::String(args[0].u.str);
-        g_private->playSound(*s, 1, false);
+        g_private->playSound(*s, 1, false, false);
         //assert(0);
     } else {
-        g_private->stopSound();
+        g_private->stopSound(true);
     }
 }
 
 void Sound(ArgArray args) {
     // assert types
     debug("Sound(%s)", args[0].u.str);
+    if (args.size() == 4) {
+        bool b1 = args[1].u.val;
+        bool b2 = args[2].u.val;
+        int c = args[3].u.val;
+
+        if (!b1 && !b2 && c == 1) {
+            g_private->stopSound(true);
+        } else if (!b1 && !b2 && c == 2) {
+            g_private->stopSound(false);
+        } else
+            assert(0);
+    }
+
     if (strcmp("\"\"", args[0].u.str) != 0) {
         Common::String *s = new Common::String(args[0].u.str);
-        g_private->playSound(*s, 1, true);
+        g_private->playSound(*s, 1, false, false);
         //assert(0);
     } else {
-        g_private->stopSound();
+        g_private->stopSound(true);
     }
 }
 
@@ -350,10 +414,10 @@ void LoopedSound(ArgArray args) {
     debug("LoopedSound(%s)", args[0].u.str);
     if (strcmp("\"\"", args[0].u.str) != 0) {
         Common::String *s = new Common::String(args[0].u.str);
-        g_private->playSound(*s, 0, true);
+        g_private->playSound(*s, 0, true, true);
         //assert(0);
     } else {
-        g_private->stopSound();
+        g_private->stopSound(true);
     }
 }
 
@@ -398,7 +462,6 @@ void Movie(ArgArray args) {
         debug("movie %s already played", movie->c_str());
         g_private->_nextSetting = g_private->_repeatedMovieExit;
     }
-
     //g_private->_nextSetting = new Common::String(args[1].u.str);
 }
 
@@ -406,8 +469,8 @@ void CRect(ArgArray args) {
     // assert types
     int x1, y1, x2, y2;
 
-    debug("CRect(%d, %d, %d, %d)", args[0].u.val, args[1].u.val, args[0].u.val, args[1].u.val);
-    //assert(0);
+    debug("CRect(%d, %d, %d, %d)", args[0].u.val, args[1].u.val, args[2].u.val, args[3].u.val);
+
     x1 = args[0].u.val;
     y1 = args[1].u.val;
 
@@ -641,6 +704,9 @@ static struct FuncTable {
     { Transition,      "Transition"},
     { Movie,           "Movie"},
 
+    // Diary
+    {DiaryLocList,     "DiaryLocList"},
+    {DiaryGoLoc,       "DiaryGoLoc"},
 
     { Exit,            "Exit"},
     { Quit,            "Quit"},
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index ee7a4228a6..3c6f129a6c 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -66,36 +66,45 @@ PrivateEngine::PrivateEngine(OSystem *syst)
     _modified = false;
     _mode = -1;
     _toTake = false;
-    _frame = new Common::String("inface/general/inface2.bmp");
     _repeatedMovieExit = new Common::String("");
     _pausedSetting = NULL;
 
 
+    // Interface
+    _frame = new Common::String("inface/general/inface2.bmp");
+
+    // Policebust
     _policeBustEnabled = false;
     _policeBustSetting = NULL;
     _numberClicks = 0;
     policeVideoIndex = 0;
+    _sirenSound = new Common::String("po/audio/posfx002.wav");
 
+
+    // Genral sounds
     _paperShuffleSound = new Common::String("global/audio/glsfx0");
     _takeSound = new Common::String("global/audio/took");
     _leaveSound = new Common::String("global/audio/left");
-    _sirenSound = new Common::String("po/audio/posfx002.wav");
 
+    // Radios and phone
     _policeRadioArea = NULL;
     _AMRadioArea = NULL;
     _phoneArea = NULL;
 
     // TODO: use this as a default sound for radio
     _radioSound = new Common::String("inface/radio/radio.wav");
-
     _AMRadioPrefix = new Common::String("inface/radio/comm_/");
     _policeRadioPrefix = new Common::String("inface/radio/police/");
     _phonePrefix = new Common::String("inface/telephon/");
     _phoneCallSound = new Common::String("phone.wav");
 
+    // Dossiers
     _dossierPage = 0;
     _dossierSuspect = 0;
 
+    // Diary
+    _diaryLocPrefix = new Common::String("inface/diary/loclist/");
+
 }
 
 PrivateEngine::~PrivateEngine() {
@@ -238,12 +247,12 @@ Common::Error PrivateEngine::run() {
         }
 
         if (_nextVS != NULL && _currentSetting->c_str() == kMainDesktop) {
-            loadImage(*_nextVS, 160, 120, true);
+            loadImage(*_nextVS, 160, 120);
         }
 
         if (_videoDecoder) {
 
-            stopSound();
+            stopSound(true);
             if (_videoDecoder->endOfVideo()) {
                 _videoDecoder->close();
                 delete _videoDecoder;
@@ -308,8 +317,8 @@ void PrivateEngine::checkPoliceBust() {
         return;
      
     if (_numberClicks == _sirenWarning) {
-        stopSound(); 
-        playSound(*_sirenSound, 0, false);
+        stopSound(true); 
+        playSound(*_sirenSound, 0, false, false);
         _numberClicks++; // Won't execute again
         return;
     }
@@ -450,7 +459,7 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
             if (cs < rs && e.nextSetting != NULL) { // TODO: check this
                 // an item was not taken
                 if (_toTake) {
-                    playSound(* getLeaveSound(), 1, false);
+                    playSound(* getLeaveSound(), 1, false, false);
                     _toTake = false;
                 }
 
@@ -485,7 +494,7 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
                 setSymbol(m.flag1, 1);
                 // an item was taken
                 if (_toTake) {
-                    playSound(*getTakeSound(), 1, false);
+                    playSound(*getTakeSound(), 1, false, false);
                     _toTake = false;
                 }
             }
@@ -514,7 +523,7 @@ void PrivateEngine::selectAMRadioArea(Common::Point mousePos) {
     debug("AMRadio");
     if (inMask(_AMRadioArea->surf, mousePos)) {
         Common::String sound = *_AMRadioPrefix + _AMRadio.back() + ".wav";
-        playSound(sound.c_str(), 1, false);
+        playSound(sound.c_str(), 1, false, false);
         _AMRadio.pop_back();
     }
 
@@ -530,7 +539,7 @@ void PrivateEngine::selectPoliceRadioArea(Common::Point mousePos) {
     debug("PoliceRadio");
     if (inMask(_policeRadioArea->surf, mousePos)) {
         Common::String sound = *_policeRadioPrefix + _policeRadio.back() + ".wav";
-        playSound(sound.c_str(), 1, false);
+        playSound(sound.c_str(), 1, false, false);
         _policeRadio.pop_back();
     }
 
@@ -543,8 +552,8 @@ void PrivateEngine::checkPhoneCall() {
     if (_phone.empty())
         return;
 
-    if (!_mixer->isSoundHandleActive(_soundHandle))
-        playSound(*_phonePrefix + *_phoneCallSound, 1, false);
+    if (!_mixer->isSoundHandleActive(_fgSoundHandle))
+        playSound(*_phonePrefix + *_phoneCallSound, 1, false, false);
 
 }
 
@@ -561,7 +570,7 @@ void PrivateEngine::selectPhoneArea(Common::Point mousePos) {
         Common::String sound(*i.sound);
         setSymbol(i.flag, i.val);
         sound = *_phonePrefix + sound + ".wav";
-        playSound(sound.c_str(), 1, true);
+        playSound(sound.c_str(), 1, true, false);
         _phone.pop_back();
     }
 
@@ -646,7 +655,7 @@ bool PrivateEngine::hasFeature(EngineFeature f) const {
 void PrivateEngine::restartGame() {
     debug("restartGame");
 
-    for (VariableList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
+    for (NameList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
         Private::Symbol *sym = variables.getVal(*it);
         if (strcmp("kAlternateGame", sym->name->c_str()) != 0)
             sym->u.val = 0;
@@ -660,13 +669,46 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
     _nextSetting = &kMainDesktop;
     int val;
 
-    for (VariableList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
+    for (NameList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
         s.syncAsUint32LE(val);
         Private::Symbol *sym = variables.getVal(*it);
         sym->u.val = val;
     }
 
+    // Diary
+
+    for (NameList::iterator it = locationList.begin(); it != locationList.end(); ++it) {
+        s.syncAsUint32LE(val);
+        Private::Symbol *sym = locations.getVal(*it);
+        sym->u.val = val;
+    }
+
     uint32 size = 0;
+    size = stream->readUint32LE();
+    Common::String *file = NULL;
+    for (uint32 i = 0; i < size; ++i) {
+        file = new Common::String(stream->readString());
+        inventory.push_back(*file);
+    }
+
+    // Dossiers
+    size = stream->readUint32LE();
+    for (uint32 i = 0; i < size; ++i) {
+        file = new Common::String(stream->readString());
+
+        DossierInfo *m = (DossierInfo*) malloc(sizeof(DossierInfo));
+        m->page1 = file;
+
+        file = new Common::String(stream->readString());        
+        if (file->size() == 0) {
+            m->page2 = NULL; 
+        } else {
+            m->page2 = file;
+        }
+    }
+
+    // Radios
+
     Common::String *sound;
     size = stream->readUint32LE();
     debug("AMRadio size %d", size);
@@ -729,11 +771,38 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
     if (isAutosave)
         return Common::kNoError;
 
-    for (VariableList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
+    // Variables
+    for (NameList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
         Private::Symbol *sym = variables.getVal(*it);
         stream->writeUint32LE(sym->u.val);
     }
 
+    // Diary
+
+    for (NameList::iterator it = locationList.begin(); it != locationList.end(); ++it) {
+        Private::Symbol *sym = locations.getVal(*it);
+        stream->writeUint32LE(sym->u.val);
+    }
+
+    stream->writeUint32LE(inventory.size());
+    for (NameList::iterator it = inventory.begin(); it != inventory.end(); ++it) {
+        stream->writeString(*it);
+        stream->writeByte(0);
+    }
+
+    // Dossiers
+
+    stream->writeUint32LE(_dossiers.size());
+    for (DossierArray::iterator it = _dossiers.begin(); it != _dossiers.end(); ++it) {
+        stream->writeString(it->page1->c_str());
+        stream->writeByte(0);
+        
+        if (it->page2 != NULL)
+            stream->writeString(it->page2->c_str());
+        stream->writeByte(0);
+    }
+
+    // Radios
     stream->writeUint32LE(_AMRadio.size());
     for (SoundList::iterator it = _AMRadio.begin(); it != _AMRadio.end(); ++it) {
         stream->writeString(*it);
@@ -756,6 +825,7 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
         stream->writeUint32LE(it->val);
     }
 
+    // Played media
     stream->writeString(*_repeatedMovieExit);
     stream->writeByte(0);
 
@@ -799,7 +869,7 @@ Common::String PrivateEngine::convertPath(Common::String name) {
     return path;
 }
 
-void PrivateEngine::playSound(const Common::String &name, uint loops, bool stopOthers) {
+void PrivateEngine::playSound(const Common::String &name, uint loops, bool stopOthers, bool background) {
     debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
 
     Common::File *file = new Common::File();
@@ -811,14 +881,24 @@ void PrivateEngine::playSound(const Common::String &name, uint loops, bool stopO
     Audio::LoopingAudioStream *stream;
     stream = new Audio::LoopingAudioStream(Audio::makeWAVStream(file, DisposeAfterUse::YES), loops);
     if (stopOthers) {
-        stopSound();
+        stopSound(true);
+    }
+    
+    Audio::SoundHandle *sh = NULL;
+    if (background) {
+        _mixer->stopHandle(_bgSoundHandle);
+        sh = &_bgSoundHandle;
+    } else {
+        _mixer->stopHandle(_fgSoundHandle);
+        sh = &_fgSoundHandle;
     }
-    _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, stream, -1, Audio::Mixer::kMaxChannelVolume);
+
+    _mixer->playStream(Audio::Mixer::kSFXSoundType, sh, stream, -1, Audio::Mixer::kMaxChannelVolume);
 }
 
 void PrivateEngine::playVideo(const Common::String &name) {
     debug("%s : %s", __FUNCTION__, name.c_str());
-    stopSound();
+    stopSound(true);
     Common::File *file = new Common::File();
     Common::String path = convertPath(name);
 
@@ -837,13 +917,19 @@ void PrivateEngine::skipVideo() {
     _videoDecoder = nullptr;
 }
 
-void PrivateEngine::stopSound() {
+void PrivateEngine::stopSound(bool all) {
     debugC(3, kPrivateDebugExample, "%s", __FUNCTION__);
-    if (_mixer->isSoundHandleActive(_soundHandle))
-        _mixer->stopHandle(_soundHandle);
+
+    if (all) {
+        _mixer->stopHandle(_fgSoundHandle);
+        _mixer->stopHandle(_bgSoundHandle);
+    }
+    else {
+        _mixer->stopHandle(_fgSoundHandle);
+    }
 }
 
-void PrivateEngine::loadImage(const Common::String &name, int x, int y, bool drawn) {
+void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
     debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
     Common::File file;
     Common::String path = convertPath(name);
@@ -956,6 +1042,7 @@ Common::String *PrivateEngine::getPaperShuffleSound() {
 }
 
 Common::String *PrivateEngine::getTakeSound() {
+    // TODO: refactor for demo support
     uint r = 1 + _rnd->getRandomNumber(4);
 
     char f[6];
@@ -964,6 +1051,7 @@ Common::String *PrivateEngine::getTakeSound() {
 }
 
 Common::String *PrivateEngine::getTakeLeaveSound() {
+    // TODO: refactor for demo support
     uint r = _rnd->getRandomNumber(1);
     if (r == 0) {
         return (new Common::String("global/audio/mvo001.wav"));
@@ -973,6 +1061,7 @@ Common::String *PrivateEngine::getTakeLeaveSound() {
 }
 
 Common::String *PrivateEngine::getLeaveSound() {
+    // TODO: refactor for demo support
     uint r = 1 + _rnd->getRandomNumber(4);
 
     char f[6];
@@ -1004,4 +1093,36 @@ void PrivateEngine::removeTimer() {
     g_system->getTimerManager()->removeTimerProc(&timerCallback);
 }
 
+// Diary
+
+void PrivateEngine::loadLocations(Common::Rect *rect) {
+    uint32 i = 0;
+    int16 offset = 44;
+    for (NameList::iterator it = locationList.begin(); it != locationList.end(); ++it) {
+        Private::Symbol *sym = locations.getVal(*it);
+        i++;
+        if (sym->u.val) {
+            offset = offset + 22;
+            char *f = (char*) malloc(12*sizeof(char));
+            sprintf(f, "dryloc%d.bmp", i);
+            debug("%s, %d, %d", f, i, offset);
+            Common::String s(*_diaryLocPrefix + f);
+            //debug("%hd %hd", rect->left, rect->top + offset);
+            loadMask(s, rect->left + 120, rect->top + offset, true);
+        }
+        
+    }
+
+}
+
+void PrivateEngine::loadInventory(uint32 x, Common::Rect *r1, Common::Rect *r2) {
+    int16 offset = 44;
+    for (NameList::iterator it = inventory.begin(); it != inventory.end(); ++it) {
+        offset = offset + 22;
+       //debug("%hd %hd", rect->left, rect->top + offset);
+        loadMask(*it, r1->left + 120, r1->top + offset, true);
+    }
+        
+}
+
 } // End of namespace Private
diff --git a/engines/private/private.h b/engines/private/private.h
index 4b4c2ad7fd..8e9c22cd7a 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -85,6 +85,7 @@ typedef Common::List<ExitInfo> ExitList;
 typedef Common::List<MaskInfo> MaskList;
 typedef Common::List<Common::String> SoundList;
 typedef Common::List<PhoneInfo> PhoneList;
+typedef Common::List<Common::String> InvList;
 
 // arrays
 
@@ -109,7 +110,8 @@ public:
     PrivateEngine(OSystem *syst);
     ~PrivateEngine();
 
-    Audio::SoundHandle _soundHandle;
+    Audio::SoundHandle _fgSoundHandle;
+    Audio::SoundHandle _bgSoundHandle;
     Video::SmackerDecoder *_videoDecoder;
     Common::InstallerArchive _installerArchive;
 
@@ -143,20 +145,17 @@ public:
         return true;
     }
 
-
-
-
     Common::Error loadGameStream(Common::SeekableReadStream *stream) override;
     Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
     void syncGameStream(Common::Serializer &s);
 
     Common::String convertPath(Common::String);
-    void playSound(const Common::String &, uint, bool);
+    void playSound(const Common::String &, uint, bool, bool);
     void playVideo(const Common::String &);
     void skipVideo();
-    void stopSound();
+    void stopSound(bool);
 
-    void loadImage(const Common::String &file, int x, int y, bool drawn = true);
+    void loadImage(const Common::String &file, int x, int y);
     void drawScreenFrame(Graphics::Surface *);
 
     void changeCursor(Common::String);
@@ -199,6 +198,13 @@ public:
     int _sirenWarning;
     Common::String *_policeBustSetting;
 
+    // Diary
+
+    InvList inventory;
+    Common::String *_diaryLocPrefix;
+    void loadLocations(Common::Rect *);
+    void loadInventory(uint32, Common::Rect *, Common::Rect *);
+
     // Save/Load games
     MaskInfo *_saveGameMask;
     MaskInfo *_loadGameMask;
@@ -228,7 +234,6 @@ public:
     Common::String *_leaveSound;
     Common::String *_sirenSound;
 
-
     // Radios
 
     Common::String *_radioSound;
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 2c1241b022..74540d1f69 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -6,7 +6,8 @@ namespace Private {
 
 SymbolMap settings, variables, cursors, locations, rects;
 ConstantList constants;
-VariableList variableList;
+NameList variableList;
+NameList locationList;
 
 StringQueue stringToDefine;
 RectQueue rectToDefine;
@@ -110,6 +111,7 @@ void installAll(char *n) {
         else if (strcmp(n, "locations") == 0) {
             assert(r == NULL);
             install(s, NAME, 0, NULL, r, &locations);
+            locationList.push_front(*s);
         }
 
         else if (strcmp(n, "rects") == 0) {
diff --git a/engines/private/symbol.h b/engines/private/symbol.h
index 4275550b47..67c34bc861 100644
--- a/engines/private/symbol.h
+++ b/engines/private/symbol.h
@@ -27,12 +27,13 @@ extern void showSymbol(Symbol *);
 extern void setSymbol(Symbol *, int);
 
 typedef Common::HashMap<Common::String, Symbol*> SymbolMap;
-typedef Common::List<Common::String> VariableList;
+typedef Common::List<Common::String> NameList;
 typedef Common::List<Symbol*> ConstantList;
 
 extern SymbolMap settings, variables, cursors, locations, rects;
 extern ConstantList constants;
-extern VariableList variableList;
+extern NameList variableList;
+extern NameList locationList;
 
 extern void     defineSymbol(char *, Common::Rect *);
 extern Symbol  *install(Common::String *, int, int, char *, Common::Rect *, SymbolMap*);


Commit: 760e06f44304b2b84adeaa471ff259511289fbd5
    https://github.com/scummvm/scummvm/commit/760e06f44304b2b84adeaa471ff259511289fbd5
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: implemented NoStopSounds

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index a971532bfe..55d7f4f2dc 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -35,7 +35,11 @@ void ChgMode(ArgArray args) {
     if (args.size() == 3)
         setSymbol(args[2].u.sym, true);
 
-    g_private->stopSound(true);
+    if (!g_private->_noStopSounds) {
+        // This is the only place where this should be used
+        g_private->stopSound(true);
+        g_private->_noStopSounds = false;
+    }
 }
 
 void VSPicture(ArgArray args) {
@@ -241,7 +245,9 @@ void DossierNextSuspect(ArgArray args) {
 
 void NoStopSounds(ArgArray args) {
     // assert types
-    debug("WARNING: NoStopSounds is not implemented");
+    assert(args.size() == 0);
+    debug("NoStopSounds()");
+    g_private->_noStopSounds = true;
 }
 
 void Inventory(ArgArray args) {
@@ -706,6 +712,7 @@ static struct FuncTable {
 
     // Diary
     {DiaryLocList,     "DiaryLocList"},
+    {DiaryInvList,     "DiaryInvList"},
     {DiaryGoLoc,       "DiaryGoLoc"},
 
     { Exit,            "Exit"},
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 3c6f129a6c..1269fc4efc 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -85,6 +85,7 @@ PrivateEngine::PrivateEngine(OSystem *syst)
     _paperShuffleSound = new Common::String("global/audio/glsfx0");
     _takeSound = new Common::String("global/audio/took");
     _leaveSound = new Common::String("global/audio/left");
+    _noStopSounds = false;
 
     // Radios and phone
     _policeRadioArea = NULL;
@@ -1103,7 +1104,7 @@ void PrivateEngine::loadLocations(Common::Rect *rect) {
         i++;
         if (sym->u.val) {
             offset = offset + 22;
-            char *f = (char*) malloc(12*sizeof(char));
+            char *f = (char*) malloc(13*sizeof(char));
             sprintf(f, "dryloc%d.bmp", i);
             debug("%s, %d, %d", f, i, offset);
             Common::String s(*_diaryLocPrefix + f);
@@ -1116,11 +1117,11 @@ void PrivateEngine::loadLocations(Common::Rect *rect) {
 }
 
 void PrivateEngine::loadInventory(uint32 x, Common::Rect *r1, Common::Rect *r2) {
-    int16 offset = 44;
+    int16 offset = 0;
     for (NameList::iterator it = inventory.begin(); it != inventory.end(); ++it) {
         offset = offset + 22;
-       //debug("%hd %hd", rect->left, rect->top + offset);
-        loadMask(*it, r1->left + 120, r1->top + offset, true);
+        //debug("%hd %hd", rect->left, rect->top + offset);
+        loadMask(*it, r1->left, r1->top + offset, true);
     }
         
 }
diff --git a/engines/private/private.h b/engines/private/private.h
index 8e9c22cd7a..6531063425 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -150,10 +150,8 @@ public:
     void syncGameStream(Common::Serializer &s);
 
     Common::String convertPath(Common::String);
-    void playSound(const Common::String &, uint, bool, bool);
     void playVideo(const Common::String &);
     void skipVideo();
-    void stopSound(bool);
 
     void loadImage(const Common::String &file, int x, int y);
     void drawScreenFrame(Graphics::Surface *);
@@ -224,6 +222,10 @@ public:
 
     // Sounds
 
+    void playSound(const Common::String &, uint, bool, bool);
+    void stopSound(bool);
+    bool _noStopSounds;
+
     Common::String *getPaperShuffleSound();
     Common::String *_paperShuffleSound;
 


Commit: b230e4d67c329c6ca076cc4e79466349615ba842
    https://github.com/scummvm/scummvm/commit/b230e4d67c329c6ca076cc4e79466349615ba842
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: astyle

Changed paths:
    engines/private/cursors.cpp
    engines/private/detection.cpp
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index f8995ffcd8..d10fd6b94c 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -93,7 +93,7 @@ const byte MOUSECURSOR_kZoomIn[] = {
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
- 
+
 const byte MOUSECURSOR_kTurnRight[] = {
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index 25162c1def..a97b0d13c6 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -49,7 +49,7 @@ static const ADGameDescription gameDescriptions[] = {
         GUIO1(GUIO_NOMIDI)
     },
 
-    
+
     {
         "private-eye", // Demo from the EU release
         "Demo",
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 55d7f4f2dc..867da406f4 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -16,7 +16,7 @@ void ChgMode(ArgArray args) {
         debug("ChgMode(%d, %s)", args[0].u.val, args[1].u.str);
     else if (args.size() == 3)
         debug("ChgMode(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.sym->name->c_str());
-    else 
+    else
         assert(0);
 
     g_private->_mode = args[0].u.val;
@@ -270,7 +270,7 @@ void Inventory(ArgArray args) {
 
     Common::String *bmp = new Common::String(i.u.str);
     assert(strcmp(bmp->c_str(), "\"\"") != 0);
-    
+
 
     if (v1.type == STRING)
         assert(strcmp(v1.u.str, "\"\"") == 0);
@@ -313,7 +313,7 @@ void Inventory(ArgArray args) {
         }
         g_private->playSound(*f, 1, false, false);
         g_private->inventory.push_back(*bmp);
-    } else { 
+    } else {
         if (v1.type == NAME) {
             if (strcmp(c.u.str, "\"REMOVE\"") == 0) {
                 v1.u.sym->u.val = 0;
@@ -597,7 +597,7 @@ void PhoneClip(ArgArray args) {
         assert(i < j);
         char *clip = g_private->getRandomPhoneClip(args[0].u.str, i, j);
         AddSound(clip, "PhoneClip", args[4].u.sym, args[5].u.val);
- 
+
     }
 
 }
@@ -727,7 +727,7 @@ static struct FuncTable {
     { DossierBitmap,   "DossierBitmap"},
     { DossierPrevSuspect, "DossierPrevSuspect"},
     { DossierNextSuspect, "DossierNextSuspect"},
-    
+
     { Inventory,       "Inventory"},
     { CRect,           "CRect"},
     { RestartGame,     "RestartGame"},
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 1269fc4efc..317657d0ad 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -205,9 +205,9 @@ Common::Error PrivateEngine::run() {
             case Common::EVENT_LBUTTONDOWN:
                 _numberClicks++;
                 if (selectDossierNextSuspect(mousePos))
-                  break;
+                    break;
                 else if (selectDossierPrevSuspect(mousePos))
-                  break;
+                    break;
 
                 selectPauseMovie(mousePos);
                 selectPhoneArea(mousePos);
@@ -316,9 +316,9 @@ void PrivateEngine::checkPoliceBust() {
 
     if (_numberClicks < _sirenWarning)
         return;
-     
+
     if (_numberClicks == _sirenWarning) {
-        stopSound(true); 
+        stopSound(true);
         playSound(*_sirenSound, 0, false, false);
         _numberClicks++; // Won't execute again
         return;
@@ -424,7 +424,7 @@ bool PrivateEngine::cursorPauseMovie(Common::Point mousePos) {
 }
 
 void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
-    if (_mode == 1) {        
+    if (_mode == 1) {
         Common::Rect window(_origin->x, _origin->y, _screenW - _origin->x, _screenH - _origin->y);
         //debug("%d, %d", mousePos.x, mousePos.y);
         //debug("%d, %d", window.top, window.left);
@@ -700,9 +700,9 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
         DossierInfo *m = (DossierInfo*) malloc(sizeof(DossierInfo));
         m->page1 = file;
 
-        file = new Common::String(stream->readString());        
+        file = new Common::String(stream->readString());
         if (file->size() == 0) {
-            m->page2 = NULL; 
+            m->page2 = NULL;
         } else {
             m->page2 = file;
         }
@@ -797,7 +797,7 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
     for (DossierArray::iterator it = _dossiers.begin(); it != _dossiers.end(); ++it) {
         stream->writeString(it->page1->c_str());
         stream->writeByte(0);
-        
+
         if (it->page2 != NULL)
             stream->writeString(it->page2->c_str());
         stream->writeByte(0);
@@ -884,7 +884,7 @@ void PrivateEngine::playSound(const Common::String &name, uint loops, bool stopO
     if (stopOthers) {
         stopSound(true);
     }
-    
+
     Audio::SoundHandle *sh = NULL;
     if (background) {
         _mixer->stopHandle(_bgSoundHandle);
@@ -1111,7 +1111,7 @@ void PrivateEngine::loadLocations(Common::Rect *rect) {
             //debug("%hd %hd", rect->left, rect->top + offset);
             loadMask(s, rect->left + 120, rect->top + offset, true);
         }
-        
+
     }
 
 }
@@ -1123,7 +1123,7 @@ void PrivateEngine::loadInventory(uint32 x, Common::Rect *r1, Common::Rect *r2)
         //debug("%hd %hd", rect->left, rect->top + offset);
         loadMask(*it, r1->left, r1->top + offset, true);
     }
-        
+
 }
 
 } // End of namespace Private
diff --git a/engines/private/private.h b/engines/private/private.h
index 6531063425..d11af53d76 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -41,7 +41,7 @@ const int kPoliceBustVideos[6] = {1, 2, 4, 5, 7, 8};
 
 // points
 
-const Common::Point kPrivateOriginZero(0, 0); 
+const Common::Point kPrivateOriginZero(0, 0);
 const Common::Point kPrivateOriginOne(64, 48);
 
 // settings
@@ -127,7 +127,7 @@ public:
     void selectExit(Common::Point);
     void selectLoadGame(Common::Point);
     void selectSaveGame(Common::Point);
-    
+
     // Cursors
 
     bool cursorPauseMovie(Common::Point);
@@ -173,7 +173,7 @@ public:
     Common::String *_frame;
     bool            _toTake;
 
-    // Dossiers 
+    // Dossiers
 
     DossierArray _dossiers;
     unsigned int _dossierSuspect;


Commit: 1f3d8a52f88c40793dec727b32d24d801f75a776
    https://github.com/scummvm/scummvm/commit/1f3d8a52f88c40793dec727b32d24d801f75a776
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixes and new stuff

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 867da406f4..f8b986ecaa 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -171,6 +171,24 @@ void PoliceBust(ArgArray args) {
     debug("WARNING: PoliceBust partially implemented");
 }
 
+void BustMovie(ArgArray args) {
+    // assert types
+    assert (args.size() == 1);
+    debug("BustMovie(%s)", args[0].u.str);
+    uint policeIndex = variables.getVal(kPoliceIndex)->u.val;
+    //assert(policeIndex <= 5);
+    char f[30];
+    sprintf(f, "po/animatio/spoc%02dxs.smk", kPoliceBustVideos[policeIndex/2]);
+
+    Common::String *pv = new Common::String(f);
+    g_private->_nextMovie = pv;
+    g_private->_nextSetting = new Common::String(args[0].u.str);
+
+
+}
+
+
+
 void DossierAdd(ArgArray args) {
 
     assert (args.size() == 2);
@@ -731,7 +749,11 @@ static struct FuncTable {
     { Inventory,       "Inventory"},
     { CRect,           "CRect"},
     { RestartGame,     "RestartGame"},
+
+    // PoliceBust
     { PoliceBust,      "PoliceBust"},
+    { BustMovie,       "BustMovie"},
+
     { 0, 0}
 };
 
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 317657d0ad..39948afc7f 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -297,8 +297,7 @@ void PrivateEngine::clearAreas() {
 }
 
 void PrivateEngine::startPoliceBust() {
-    Common::String k("kPoliceIndex");
-    int policeIndex = variables.getVal(k)->u.val;
+    int policeIndex = variables.getVal(kPoliceIndex)->u.val;
 
     int r = _rnd->getRandomNumber(0xc);
     if (0x14 < policeIndex) {
@@ -325,21 +324,22 @@ void PrivateEngine::checkPoliceBust() {
     }
 
     if (_numberClicks == _maxNumberClicks+1) {
-        Common::String k("kPoliceIndex");
-        uint kPoliceIndex = variables.getVal(k)->u.val;
+        uint policeIndex = variables.getVal(kPoliceIndex)->u.val;
+        _policeBustSetting = _currentSetting;
 
-        if (kPoliceIndex <= 12) {
-            assert(policeVideoIndex/2 <= 5);
+        if (policeIndex <= 12) {
+            /*assert(policeVideoIndex/2 <= 5);
             char f[30];
             sprintf(f, "po/animatio/spoc%02dxs.smk", kPoliceBustVideos[policeVideoIndex/2]);
             policeVideoIndex++;
 
             Common::String *pv = new Common::String(f);
             _nextMovie = pv;
+            */
+            _nextSetting = &kPOGoBustMovie;
+        } else {
+            _nextSetting = &kPoliceBustFromMO;
         }
-
-        _policeBustSetting = _currentSetting;
-        _nextSetting = &kPoliceBustFromMO;
         clearAreas();
         _policeBustEnabled = false;
     }
@@ -667,7 +667,7 @@ void PrivateEngine::restartGame() {
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
     Common::Serializer s(stream, nullptr);
     debug("loadGameStream");
-    _nextSetting = &kMainDesktop;
+    _nextSetting = &kStartGame;
     int val;
 
     for (NameList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
@@ -706,6 +706,7 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
         } else {
             m->page2 = file;
         }
+        _dossiers.push_back(*m);
     }
 
     // Radios
diff --git a/engines/private/private.h b/engines/private/private.h
index d11af53d76..97f71b3038 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -50,6 +50,9 @@ static Common::String kPauseMovie("kPauseMovie");
 static Common::String kGoIntro("kGoIntro");
 static Common::String kPoliceBustFromMO("kPoliceBustFromMO");
 static Common::String kMainDesktop("kMainDesktop");
+static Common::String kPoliceIndex("kPoliceIndex");
+static Common::String kPOGoBustMovie("kPOGoBustMovie");
+static Common::String kStartGame("kStartGame");
 
 // structs
 


Commit: 93617ca8feca6ea5efad9d8323ec98024b9b0746
    https://github.com/scummvm/scummvm/commit/93617ca8feca6ea5efad9d8323ec98024b9b0746
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixes

Changed paths:
    engines/private/funcs.cpp
    engines/private/metaengine.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index f8b986ecaa..50ae20d528 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -287,7 +287,7 @@ void Inventory(ArgArray args) {
     assert(i.type == STRING);
 
     Common::String *bmp = new Common::String(i.u.str);
-    assert(strcmp(bmp->c_str(), "\"\"") != 0);
+    assert(g_private->isDemo() || strcmp(bmp->c_str(), "\"\"") != 0);
 
 
     if (v1.type == STRING)
diff --git a/engines/private/metaengine.cpp b/engines/private/metaengine.cpp
index 6461f5cc18..652429f28c 100644
--- a/engines/private/metaengine.cpp
+++ b/engines/private/metaengine.cpp
@@ -10,8 +10,8 @@ public:
     Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
 };
 
-Common::Error PrivateMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
-    *engine = new Private::PrivateEngine(syst);
+Common::Error PrivateMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const {
+    *engine = new Private::PrivateEngine(syst, gd);
     return Common::kNoError;
 }
 
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 39948afc7f..c018339639 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -32,8 +32,8 @@ PrivateEngine *g_private = NULL;
 
 extern int parse(char*);
 
-PrivateEngine::PrivateEngine(OSystem *syst)
-    : Engine(syst) {
+PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
+    : Engine(syst), _gameDescription(gd) {
     // Put your engine in a sane state, but do nothing big yet;
     // in particular, do not load data from files; rather, if you
     // need to do such things, do them from run().
@@ -81,10 +81,11 @@ PrivateEngine::PrivateEngine(OSystem *syst)
     _sirenSound = new Common::String("po/audio/posfx002.wav");
 
 
-    // Genral sounds
-    _paperShuffleSound = new Common::String("global/audio/glsfx0");
-    _takeSound = new Common::String("global/audio/took");
-    _leaveSound = new Common::String("global/audio/left");
+    // General sounds
+    _globalAudioPath = new Common::String("global/audio/");
+    //_paperShuffleSound = new Common::String("global/audio/glsfx0");
+    //_takeSound = new Common::String("global/audio/took");
+    //_leaveSound = new Common::String("global/audio/left");
     _noStopSounds = false;
 
     // Radios and phone
@@ -128,20 +129,22 @@ Common::Error PrivateEngine::run() {
     Common::SeekableReadStream *file = NULL;
 
     // if the full game is used
-    if (_installerArchive.hasFile("GAME.DAT"))
+    if (!isDemo()) {
+        assert(_installerArchive.hasFile("GAME.DAT"));
         file = _installerArchive.createReadStreamForMember("GAME.DAT");
+    } else {
+        // if the demo from archive.org is used
+        if (_installerArchive.hasFile("GAME.TXT"))
+            file = _installerArchive.createReadStreamForMember("GAME.TXT");
 
-    // if the demo from archive.org is used
-    else if (_installerArchive.hasFile("GAME.TXT"))
-        file = _installerArchive.createReadStreamForMember("GAME.TXT");
-
-    // if the demo from the full retail CDROM is used
-    else if (_installerArchive.hasFile("DEMOGAME.DAT"))
-        file = _installerArchive.createReadStreamForMember("DEMOGAME.DAT");
+        // if the demo from the full retail CDROM is used
+        else if (_installerArchive.hasFile("DEMOGAME.DAT"))
+            file = _installerArchive.createReadStreamForMember("DEMOGAME.DAT");
+    }
 
     assert(file != NULL);
-    void *buf = malloc(191000);
-    file->read(buf, 191000);
+    void *buf = malloc(file->size()+1);
+    file->read(buf, file->size()+1);
 
     // Initialize stuff
     initInsts();
@@ -149,6 +152,7 @@ Common::Error PrivateEngine::run() {
     initCursors();
 
     parse((char *) buf);
+    free(buf);
     assert(constants.size() > 0);
 
     // Initialize graphics using following:
@@ -426,11 +430,6 @@ bool PrivateEngine::cursorPauseMovie(Common::Point mousePos) {
 void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
     if (_mode == 1) {
         Common::Rect window(_origin->x, _origin->y, _screenW - _origin->x, _screenH - _origin->y);
-        //debug("%d, %d", mousePos.x, mousePos.y);
-        //debug("%d, %d", window.top, window.left);
-        //debug("%d, %d", window.bottom, window.right);
-
-        //debug("%d, %d", window.y2, window.y2);
         if (!window.contains(mousePos)) {
             if ( _pausedSetting == NULL) {
                 _pausedSetting = _currentSetting;
@@ -846,13 +845,6 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
     return Common::kNoError;
 }
 
-void PrivateEngine::syncGameStream(Common::Serializer &s) {
-    debug("syncGameStream");
-    // Use methods of Serializer to save/load fields
-    //int dummy = 0;
-    //s.syncString(*_currentSetting);
-}
-
 Common::String PrivateEngine::convertPath(Common::String name) {
     Common::String path(name);
     Common::String s1("\\");
@@ -1031,44 +1023,43 @@ bool PrivateEngine::getRandomBool(uint p) {
 }
 
 Common::String *PrivateEngine::getPaperShuffleSound() {
-    uint r = 32 + _rnd->getRandomNumber(7);
 
-    // there is no global/audio/glsfx038.wav,
-    // so we should avoid that number
-    if ( r == 38)
-        r = 39;
-
-    char f[7];
-    sprintf(f, "%d.wav", r);
-    return (new Common::String(*_paperShuffleSound + f));
+    uint r = 1 + _rnd->getRandomNumber(6);
+    char f[32];
+    sprintf(f, "glsfx0%d.wav", kPaperShuffleSound[r]);
+    return (new Common::String(*_globalAudioPath + f));
 }
 
 Common::String *PrivateEngine::getTakeSound() {
-    // TODO: refactor for demo support
+    if (isDemo())
+        return (new Common::String(*_globalAudioPath + "mvo007.wav"));    
+
     uint r = 1 + _rnd->getRandomNumber(4);
 
-    char f[6];
-    sprintf(f, "%d.wav", r);
-    return (new Common::String(*_takeSound + f));
+    char f[32];
+    sprintf(f, "left%d.wav", r);
+    return (new Common::String(*_globalAudioPath + f));
 }
 
 Common::String *PrivateEngine::getTakeLeaveSound() {
-    // TODO: refactor for demo support
     uint r = _rnd->getRandomNumber(1);
     if (r == 0) {
-        return (new Common::String("global/audio/mvo001.wav"));
+        return (new Common::String(*_globalAudioPath + "mvo001.wav"));
     } else {
-        return (new Common::String("global/audio/mvo006.wav"));
+        return (new Common::String(*_globalAudioPath + "mvo006.wav"));
     }
 }
 
 Common::String *PrivateEngine::getLeaveSound() {
     // TODO: refactor for demo support
+    if (isDemo())
+        return (new Common::String(*_globalAudioPath + "mvo008.wav"));
+
     uint r = 1 + _rnd->getRandomNumber(4);
 
-    char f[6];
-    sprintf(f, "%d.wav", r);
-    return (new Common::String(*_leaveSound + f));
+    char f[32];
+    sprintf(f, "took%d.wav", r);
+    return (new Common::String(*_globalAudioPath + f));
 }
 
 
diff --git a/engines/private/private.h b/engines/private/private.h
index 97f71b3038..31a7524c74 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -3,6 +3,7 @@
 
 #include "common/random.h"
 #include "common/serializer.h"
+#include "engines/advancedDetector.h"
 #include "engines/engine.h"
 #include "gui/debugger.h"
 
@@ -23,6 +24,8 @@ namespace Graphics {
 struct ManagedSurface;
 }
 
+struct ADGameDescription;
+
 namespace Private {
 
 class Console;
@@ -35,6 +38,10 @@ enum {
                             // the current limitation is 32 debug channels (1 << 31 is the last one)
 };
 
+// sounds
+
+const int kPaperShuffleSound[6] = {33, 34, 35, 36, 37, 39};
+
 // police
 
 const int kPoliceBustVideos[6] = {1, 2, 4, 5, 7, 8};
@@ -110,9 +117,16 @@ private:
     int _screenW, _screenH;
 
 public:
-    PrivateEngine(OSystem *syst);
+    PrivateEngine(OSystem *syst, const ADGameDescription *gd);
     ~PrivateEngine();
 
+    const ADGameDescription *_gameDescription;
+
+    bool isDemo() const {
+        return (bool)(_gameDescription->flags & ADGF_DEMO);
+    }
+
+
     Audio::SoundHandle _fgSoundHandle;
     Audio::SoundHandle _bgSoundHandle;
     Video::SmackerDecoder *_videoDecoder;
@@ -230,13 +244,14 @@ public:
     bool _noStopSounds;
 
     Common::String *getPaperShuffleSound();
-    Common::String *_paperShuffleSound;
+    Common::String *_globalAudioPath;
+    //Common::String *_paperShuffleSound;
 
     Common::String *getTakeSound();
     Common::String *getTakeLeaveSound();
     Common::String *getLeaveSound();
-    Common::String *_takeSound;
-    Common::String *_leaveSound;
+    //Common::String *_takeSound;
+    //Common::String *_leaveSound;
     Common::String *_sirenSound;
 
     // Radios


Commit: 3b9ff10be3224096ce48381176f77bada337e65f
    https://github.com/scummvm/scummvm/commit/3b9ff10be3224096ce48381176f77bada337e65f
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: more fixes

Changed paths:
    engines/private/funcs.cpp
    engines/private/metaengine.cpp
    engines/private/private.cpp
    engines/private/private.h
    engines/private/symbol.cpp


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 50ae20d528..c479ac8080 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -35,10 +35,11 @@ void ChgMode(ArgArray args) {
     if (args.size() == 3)
         setSymbol(args[2].u.sym, true);
 
-    if (!g_private->_noStopSounds) {
-        // This is the only place where this should be used
-        g_private->stopSound(true);
+    // This is the only place where this should be used
+    if (g_private->_noStopSounds) { 
         g_private->_noStopSounds = false;
+    } else {
+        g_private->stopSound(true);
     }
 }
 
@@ -102,9 +103,9 @@ void SyncSound(ArgArray args) {
         Common::String *s = new Common::String(args[0].u.str);
         g_private->playSound(*s, 1, true, false);
         //assert(0);
-    } else {
-        g_private->stopSound(true);
-    }
+    } //else {
+      //  g_private->stopSound(true);
+      //}
 }
 
 void Quit(ArgArray args) {
@@ -156,10 +157,7 @@ void PoliceBust(ArgArray args) {
 
     if (args.size() == 2) {
         if (args[1].u.val == 2) {
-            Common::String *s = new Common::String("global/transiti/audio/spoc02VO.wav");
-            g_private->playSound(*s, 1, false, false);
-            assert(0);
-
+            // ????
         }
         else if (args[1].u.val == 3) {
             g_private->_nextSetting = &kMainDesktop;
@@ -176,9 +174,18 @@ void BustMovie(ArgArray args) {
     assert (args.size() == 1);
     debug("BustMovie(%s)", args[0].u.str);
     uint policeIndex = variables.getVal(kPoliceIndex)->u.val;
-    //assert(policeIndex <= 5);
-    char f[30];
-    sprintf(f, "po/animatio/spoc%02dxs.smk", kPoliceBustVideos[policeIndex/2]);
+    int videoIndex = policeIndex/2 - 1;
+    if (videoIndex < 0)
+        videoIndex = 0;
+    assert(videoIndex <= 5);
+
+    char f[32];
+    sprintf(f, "po/animatio/spoc%02dxs.smk", kPoliceBustVideos[videoIndex]);
+
+    if (kPoliceBustVideos[videoIndex] == 2) {
+        Common::String *s = new Common::String("global/transiti/audio/spoc02VO.wav");
+        g_private->playSound(*s, 1, false, false);
+    }
 
     Common::String *pv = new Common::String(f);
     g_private->_nextMovie = pv;
@@ -262,12 +269,16 @@ void DossierNextSuspect(ArgArray args) {
 }
 
 void NoStopSounds(ArgArray args) {
-    // assert types
     assert(args.size() == 0);
     debug("NoStopSounds()");
     g_private->_noStopSounds = true;
 }
 
+void LoseInventory(ArgArray args) {
+    assert(args.size() == 0);
+    g_private->inventory.clear();
+}
+
 void Inventory(ArgArray args) {
 
     // assert types
@@ -665,6 +676,11 @@ void SoundArea(ArgArray args) {
     }
 }
 
+void SafeDigit(ArgArray args) {
+    // This is not needed, since scummvm will take care of this
+    debug("WARNING: SafeDigit is partially implemented");
+}
+
 void AskSave(ArgArray args) {
     // This is not needed, since scummvm will take care of this
     debug("WARNING: AskSave is partially implemented");
@@ -746,6 +762,7 @@ static struct FuncTable {
     { DossierPrevSuspect, "DossierPrevSuspect"},
     { DossierNextSuspect, "DossierNextSuspect"},
 
+    { LoseInventory,   "LoseInventory"},
     { Inventory,       "Inventory"},
     { CRect,           "CRect"},
     { RestartGame,     "RestartGame"},
@@ -754,6 +771,10 @@ static struct FuncTable {
     { PoliceBust,      "PoliceBust"},
     { BustMovie,       "BustMovie"},
 
+    // Others
+
+    { SafeDigit,       "SafeDigit"},
+
     { 0, 0}
 };
 
diff --git a/engines/private/metaengine.cpp b/engines/private/metaengine.cpp
index 652429f28c..b662942055 100644
--- a/engines/private/metaengine.cpp
+++ b/engines/private/metaengine.cpp
@@ -15,6 +15,14 @@ Common::Error PrivateMetaEngine::createInstance(OSystem *syst, Engine **engine,
     return Common::kNoError;
 }
 
+namespace Private {
+
+bool PrivateEngine::isDemo() const {
+        return (bool)(_gameDescription->flags & ADGF_DEMO);
+}
+
+}
+
 #if PLUGIN_ENABLED_DYNAMIC(PRIVATE)
 REGISTER_PLUGIN_DYNAMIC(PRIVATE, PLUGIN_TYPE_ENGINE, PrivateMetaEngine);
 #else
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index c018339639..be29ce1588 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -34,21 +34,6 @@ extern int parse(char*);
 
 PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     : Engine(syst), _gameDescription(gd) {
-    // Put your engine in a sane state, but do nothing big yet;
-    // in particular, do not load data from files; rather, if you
-    // need to do such things, do them from run().
-
-    // Do not initialize graphics here
-    // Do not initialize audio devices here
-
-    // However this is the place to specify all default directories
-    //SearchMan.addSubDirectoryMatching(gameDataDir, "global", 0, 10, false);
-
-    // Here is the right place to set up the engine specific debug channels
-    //DebugMan.addDebugChannel(kPrivateDebugExample, "example", "this is just an example for a engine specific debug channel");
-    //DebugMan.addDebugChannel(kPrivateDebugExample2, "example2", "also an example");
-
-    // Don't forget to register your random source
     _rnd = new Common::RandomSource("private");
 
     g_private = this;
@@ -83,9 +68,6 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
 
     // General sounds
     _globalAudioPath = new Common::String("global/audio/");
-    //_paperShuffleSound = new Common::String("global/audio/glsfx0");
-    //_takeSound = new Common::String("global/audio/took");
-    //_leaveSound = new Common::String("global/audio/left");
     _noStopSounds = false;
 
     // Radios and phone
@@ -94,9 +76,10 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     _phoneArea = NULL;
 
     // TODO: use this as a default sound for radio
-    _radioSound = new Common::String("inface/radio/radio.wav");
-    _AMRadioPrefix = new Common::String("inface/radio/comm_/");
-    _policeRadioPrefix = new Common::String("inface/radio/police/");
+    _infaceRadioPath = new Common::String("inface/radio/");
+    //_radioSound = new Common::String("inface/radio/radio.wav");
+    //_AMRadioPrefix = new Common::String("inface/radio/comm_/");
+    //_policeRadioPrefix = new Common::String("inface/radio/police/");
     _phonePrefix = new Common::String("inface/telephon/");
     _phoneCallSound = new Common::String("phone.wav");
 
@@ -153,6 +136,7 @@ Common::Error PrivateEngine::run() {
 
     parse((char *) buf);
     free(buf);
+    delete file;
     assert(constants.size() > 0);
 
     // Initialize graphics using following:
@@ -310,7 +294,8 @@ void PrivateEngine::startPoliceBust() {
     _maxNumberClicks = r + 0x10 + (policeIndex * 0xe) / -0x15;
     _sirenWarning = 3 + _rnd->getRandomNumber(0x7);
     _numberClicks = 0;
-    assert(_sirenWarning < _maxNumberClicks);
+    if(_sirenWarning >= _maxNumberClicks);
+        _sirenWarning = _maxNumberClicks - 1;
 }
 
 void PrivateEngine::checkPoliceBust() {
@@ -331,15 +316,7 @@ void PrivateEngine::checkPoliceBust() {
         uint policeIndex = variables.getVal(kPoliceIndex)->u.val;
         _policeBustSetting = _currentSetting;
 
-        if (policeIndex <= 12) {
-            /*assert(policeVideoIndex/2 <= 5);
-            char f[30];
-            sprintf(f, "po/animatio/spoc%02dxs.smk", kPoliceBustVideos[policeVideoIndex/2]);
-            policeVideoIndex++;
-
-            Common::String *pv = new Common::String(f);
-            _nextMovie = pv;
-            */
+        if (policeIndex <= 13) {
             _nextSetting = &kPOGoBustMovie;
         } else {
             _nextSetting = &kPoliceBustFromMO;
@@ -522,7 +499,7 @@ void PrivateEngine::selectAMRadioArea(Common::Point mousePos) {
 
     debug("AMRadio");
     if (inMask(_AMRadioArea->surf, mousePos)) {
-        Common::String sound = *_AMRadioPrefix + _AMRadio.back() + ".wav";
+        Common::String sound = *_infaceRadioPath + "comm_/" + _AMRadio.back() + ".wav";
         playSound(sound.c_str(), 1, false, false);
         _AMRadio.pop_back();
     }
@@ -538,7 +515,7 @@ void PrivateEngine::selectPoliceRadioArea(Common::Point mousePos) {
 
     debug("PoliceRadio");
     if (inMask(_policeRadioArea->surf, mousePos)) {
-        Common::String sound = *_policeRadioPrefix + _policeRadio.back() + ".wav";
+        Common::String sound = *_infaceRadioPath + "police/" + _policeRadio.back() + ".wav";
         playSound(sound.c_str(), 1, false, false);
         _policeRadio.pop_back();
     }
@@ -660,7 +637,29 @@ void PrivateEngine::restartGame() {
         if (strcmp("kAlternateGame", sym->name->c_str()) != 0)
             sym->u.val = 0;
     }
-    // FIXME: reset movies/sound lists
+
+    // Diary
+
+    for (NameList::iterator it = locationList.begin(); it != locationList.end(); ++it) {
+        Private::Symbol *sym = locations.getVal(*it);
+        sym->u.val = 0;
+    }
+
+    inventory.clear();
+    _dossiers.clear();
+
+    // Sounds
+
+    _AMRadio.clear();
+    _policeRadio.clear();
+    _phone.clear();
+    _playedPhoneClips.clear();
+
+    // Movies
+
+    _repeatedMovieExit = NULL;
+    _playedMovies.clear();
+
 }
 
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
@@ -1024,7 +1023,7 @@ bool PrivateEngine::getRandomBool(uint p) {
 
 Common::String *PrivateEngine::getPaperShuffleSound() {
 
-    uint r = 1 + _rnd->getRandomNumber(6);
+    uint r = _rnd->getRandomNumber(6);
     char f[32];
     sprintf(f, "glsfx0%d.wav", kPaperShuffleSound[r]);
     return (new Common::String(*_globalAudioPath + f));
diff --git a/engines/private/private.h b/engines/private/private.h
index 31a7524c74..e88563176a 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -40,7 +40,7 @@ enum {
 
 // sounds
 
-const int kPaperShuffleSound[6] = {33, 34, 35, 36, 37, 39};
+const int kPaperShuffleSound[7] = {32, 33, 34, 35, 36, 37, 39};
 
 // police
 
@@ -122,10 +122,7 @@ public:
 
     const ADGameDescription *_gameDescription;
 
-    bool isDemo() const {
-        return (bool)(_gameDescription->flags & ADGF_DEMO);
-    }
-
+    bool isDemo() const;
 
     Audio::SoundHandle _fgSoundHandle;
     Audio::SoundHandle _bgSoundHandle;
@@ -245,24 +242,22 @@ public:
 
     Common::String *getPaperShuffleSound();
     Common::String *_globalAudioPath;
-    //Common::String *_paperShuffleSound;
 
     Common::String *getTakeSound();
     Common::String *getTakeLeaveSound();
     Common::String *getLeaveSound();
-    //Common::String *_takeSound;
-    //Common::String *_leaveSound;
     Common::String *_sirenSound;
 
     // Radios
 
-    Common::String *_radioSound;
+    //Common::String *_radioSound;
+    Common::String *_infaceRadioPath;
 
     MaskInfo *_AMRadioArea;
-    Common::String *_AMRadioPrefix;
+    //Common::String *_AMRadioPrefix;
 
     MaskInfo *_policeRadioArea;
-    Common::String *_policeRadioPrefix;
+    //Common::String *_policeRadioPrefix;
 
     MaskInfo *_phoneArea;
     Common::String *_phonePrefix;
@@ -287,13 +282,11 @@ public:
 
     bool installTimer(uint32, Common::String *);
     void removeTimer();
-    //static void timerCallback(void *);
 
 };
 
 extern PrivateEngine *g_private;
 
-// Example console class
 class Console : public GUI::Debugger {
 public:
     Console(PrivateEngine *vm) {
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 74540d1f69..697d754798 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -43,13 +43,7 @@ void setSymbol(Symbol *s, int v) {
 
 /* find s in symbol table symlist */
 Symbol *lookup(Common::String s, SymbolMap symlist)	 {
-    //debug("looking up %s", s.c_str());
     Symbol *r = symlist.getVal(s);
-    /*if (strcmp(s.c_str(), "m_640x480") == 0) {
-        showSymbol(r);
-    assert(0);
-    }*/
-
     return r;
 }
 


Commit: 28040b2a615f58671b6dc9b1e1f03855d855eac8
    https://github.com/scummvm/scummvm/commit/28040b2a615f58671b6dc9b1e1f03855d855eac8
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: astyle

Changed paths:
    engines/private/funcs.cpp
    engines/private/metaengine.cpp
    engines/private/private.cpp


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index c479ac8080..4f6b03f3ab 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -36,7 +36,7 @@ void ChgMode(ArgArray args) {
         setSymbol(args[2].u.sym, true);
 
     // This is the only place where this should be used
-    if (g_private->_noStopSounds) { 
+    if (g_private->_noStopSounds) {
         g_private->_noStopSounds = false;
     } else {
         g_private->stopSound(true);
@@ -104,8 +104,8 @@ void SyncSound(ArgArray args) {
         g_private->playSound(*s, 1, true, false);
         //assert(0);
     } //else {
-      //  g_private->stopSound(true);
-      //}
+    //  g_private->stopSound(true);
+    //}
 }
 
 void Quit(ArgArray args) {
diff --git a/engines/private/metaengine.cpp b/engines/private/metaengine.cpp
index b662942055..25c5c8a1ae 100644
--- a/engines/private/metaengine.cpp
+++ b/engines/private/metaengine.cpp
@@ -18,7 +18,7 @@ Common::Error PrivateMetaEngine::createInstance(OSystem *syst, Engine **engine,
 namespace Private {
 
 bool PrivateEngine::isDemo() const {
-        return (bool)(_gameDescription->flags & ADGF_DEMO);
+    return (bool)(_gameDescription->flags & ADGF_DEMO);
 }
 
 }
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index be29ce1588..21cb38242e 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -295,7 +295,7 @@ void PrivateEngine::startPoliceBust() {
     _sirenWarning = 3 + _rnd->getRandomNumber(0x7);
     _numberClicks = 0;
     if(_sirenWarning >= _maxNumberClicks);
-        _sirenWarning = _maxNumberClicks - 1;
+    _sirenWarning = _maxNumberClicks - 1;
 }
 
 void PrivateEngine::checkPoliceBust() {
@@ -1031,7 +1031,7 @@ Common::String *PrivateEngine::getPaperShuffleSound() {
 
 Common::String *PrivateEngine::getTakeSound() {
     if (isDemo())
-        return (new Common::String(*_globalAudioPath + "mvo007.wav"));    
+        return (new Common::String(*_globalAudioPath + "mvo007.wav"));
 
     uint r = 1 + _rnd->getRandomNumber(4);
 


Commit: d65b3345863fccf39de08344e6348cbd899ac70b
    https://github.com/scummvm/scummvm/commit/d65b3345863fccf39de08344e6348cbd899ac70b
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixes

Changed paths:
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 21cb38242e..a50bea16a6 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -77,9 +77,6 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
 
     // TODO: use this as a default sound for radio
     _infaceRadioPath = new Common::String("inface/radio/");
-    //_radioSound = new Common::String("inface/radio/radio.wav");
-    //_AMRadioPrefix = new Common::String("inface/radio/comm_/");
-    //_policeRadioPrefix = new Common::String("inface/radio/police/");
     _phonePrefix = new Common::String("inface/telephon/");
     _phoneCallSound = new Common::String("phone.wav");
 
@@ -863,7 +860,7 @@ Common::String PrivateEngine::convertPath(Common::String name) {
 }
 
 void PrivateEngine::playSound(const Common::String &name, uint loops, bool stopOthers, bool background) {
-    debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
+    debugC(1, kPrivateDebug, "%s : %s", __FUNCTION__, name.c_str());
 
     Common::File *file = new Common::File();
     Common::String path = convertPath(name);
@@ -911,7 +908,7 @@ void PrivateEngine::skipVideo() {
 }
 
 void PrivateEngine::stopSound(bool all) {
-    debugC(3, kPrivateDebugExample, "%s", __FUNCTION__);
+    debugC(3, kPrivateDebug, "%s", __FUNCTION__);
 
     if (all) {
         _mixer->stopHandle(_fgSoundHandle);
@@ -923,7 +920,7 @@ void PrivateEngine::stopSound(bool all) {
 }
 
 void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
-    debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
+    debugC(1, kPrivateDebug, "%s : %s", __FUNCTION__, name.c_str());
     Common::File file;
     Common::String path = convertPath(name);
     if (!file.open(path))
@@ -952,7 +949,7 @@ void PrivateEngine::drawScreenFrame(Graphics::Surface *screen) {
 
 
 Graphics::ManagedSurface *PrivateEngine::loadMask(const Common::String &name, int x, int y, bool drawn) {
-    debugC(1, kPrivateDebugExample, "%s : %s", __FUNCTION__, name.c_str());
+    debugC(1, kPrivateDebug, "%s : %s", __FUNCTION__, name.c_str());
     Common::File file;
     Common::String path = convertPath(name);
     if (!file.open(path))
@@ -1025,7 +1022,7 @@ Common::String *PrivateEngine::getPaperShuffleSound() {
 
     uint r = _rnd->getRandomNumber(6);
     char f[32];
-    sprintf(f, "glsfx0%d.wav", kPaperShuffleSound[r]);
+    snprintf(f, 32, "glsfx0%d.wav", kPaperShuffleSound[r]);
     return (new Common::String(*_globalAudioPath + f));
 }
 
@@ -1036,7 +1033,7 @@ Common::String *PrivateEngine::getTakeSound() {
     uint r = 1 + _rnd->getRandomNumber(4);
 
     char f[32];
-    sprintf(f, "left%d.wav", r);
+    snprintf(f, 32, "took%d.wav", r);
     return (new Common::String(*_globalAudioPath + f));
 }
 
@@ -1050,14 +1047,13 @@ Common::String *PrivateEngine::getTakeLeaveSound() {
 }
 
 Common::String *PrivateEngine::getLeaveSound() {
-    // TODO: refactor for demo support
     if (isDemo())
         return (new Common::String(*_globalAudioPath + "mvo008.wav"));
 
     uint r = 1 + _rnd->getRandomNumber(4);
 
     char f[32];
-    sprintf(f, "took%d.wav", r);
+    snprintf(f, 32, "left%d.wav", r);
     return (new Common::String(*_globalAudioPath + f));
 }
 
@@ -1066,7 +1062,7 @@ char *PrivateEngine::getRandomPhoneClip(char *clip, int i, int j) {
     uint r = i + _rnd->getRandomNumber(j - i);
 
     char *f = (char*) malloc((strlen(clip)+3)*sizeof(char));
-    sprintf(f, "%s%02d", clip, r);
+    snprintf(f, 32, "%s%02d", clip, r);
     return f;
 }
 
@@ -1095,8 +1091,8 @@ void PrivateEngine::loadLocations(Common::Rect *rect) {
         i++;
         if (sym->u.val) {
             offset = offset + 22;
-            char *f = (char*) malloc(13*sizeof(char));
-            sprintf(f, "dryloc%d.bmp", i);
+            char *f = (char*) malloc(32*sizeof(char));
+            snprintf(f, 32, "dryloc%d.bmp", i);
             debug("%s, %d, %d", f, i, offset);
             Common::String s(*_diaryLocPrefix + f);
             //debug("%hd %hd", rect->left, rect->top + offset);
diff --git a/engines/private/private.h b/engines/private/private.h
index e88563176a..cefcb67248 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -30,13 +30,7 @@ namespace Private {
 
 class Console;
 
-// our engine debug channels
-enum {
-    kPrivateDebugExample = 1 << 0,
-    kPrivateDebugExample2 = 1 << 1
-                            // next new channel must be 1 << 2 (4)
-                            // the current limitation is 32 debug channels (1 << 31 is the last one)
-};
+const uint kPrivateDebug = 1;
 
 // sounds
 
@@ -107,7 +101,6 @@ typedef Common::HashMap<Common::String, bool> PlayedMediaTable;
 
 class PrivateEngine : public Engine {
 private:
-    // We need random numbers
     Common::RandomSource *_rnd;
 
     Graphics::PixelFormat _pixelFormat;


Commit: cbc8ca60f44333fb7ea0f78bb764c9b1bc110e77
    https://github.com/scummvm/scummvm/commit/cbc8ca60f44333fb7ea0f78bb764c9b1bc110e77
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: missing snprinft

Changed paths:
    engines/private/funcs.cpp


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 4f6b03f3ab..03f24435d2 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -180,7 +180,7 @@ void BustMovie(ArgArray args) {
     assert(videoIndex <= 5);
 
     char f[32];
-    sprintf(f, "po/animatio/spoc%02dxs.smk", kPoliceBustVideos[videoIndex]);
+    snprintf(f, 32, "po/animatio/spoc%02dxs.smk", kPoliceBustVideos[videoIndex]);
 
     if (kPoliceBustVideos[videoIndex] == 2) {
         Common::String *s = new Common::String("global/transiti/audio/spoc02VO.wav");


Commit: 75e019b199779efa083f9b9998a86d19daa9ec20
    https://github.com/scummvm/scummvm/commit/75e019b199779efa083f9b9998a86d19daa9ec20
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: added copyright headers

Changed paths:
    engines/private/code.cpp
    engines/private/cursors.cpp
    engines/private/cursors.h
    engines/private/detection.cpp
    engines/private/funcs.cpp
    engines/private/grammar.h
    engines/private/metaengine.cpp
    engines/private/private.cpp
    engines/private/private.h
    engines/private/symbol.cpp
    engines/private/symbol.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 889de5453e..0d37b5ef64 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -1,3 +1,25 @@
+/* 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/str.h"
 #include "common/debug.h"
 #include "common/hash-ptr.h"
diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index d10fd6b94c..a3e4ba27cb 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -1,3 +1,25 @@
+/* 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 "graphics/cursorman.h"
 
 #include "private/cursors.h"
diff --git a/engines/private/cursors.h b/engines/private/cursors.h
index cff99d48ef..895f126e37 100644
--- a/engines/private/cursors.h
+++ b/engines/private/cursors.h
@@ -1,3 +1,25 @@
+/* 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/str.h"
 #include "common/hash-str.h"
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index a97b0d13c6..3f01d0ef86 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -1,3 +1,25 @@
+/* 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"
 
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 03f24435d2..281428b16f 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -1,3 +1,25 @@
+/* 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/str.h"
 #include "common/timer.h"
 #include "common/debug.h"
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index e3b741045d..689cd6c357 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -1,3 +1,25 @@
+/* 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/str.h"
 #include "common/hash-str.h"
 #include "common/hash-ptr.h"
diff --git a/engines/private/metaengine.cpp b/engines/private/metaengine.cpp
index 25c5c8a1ae..5f5c07cb2a 100644
--- a/engines/private/metaengine.cpp
+++ b/engines/private/metaengine.cpp
@@ -1,3 +1,25 @@
+/* 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 "private/private.h"
 #include "engines/advancedDetector.h"
 
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index a50bea16a6..59e85341cf 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -1,3 +1,25 @@
+/* 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 "audio/decoders/wave.h"
diff --git a/engines/private/private.h b/engines/private/private.h
index cefcb67248..f7f524b745 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -1,3 +1,25 @@
+/* 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 PRIVATE_H
 #define PRIVATE_H
 
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 697d754798..4f68570b9b 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -1,3 +1,25 @@
+/* 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/debug.h"
 #include "grammar.h"
 #include "grammar.tab.h"
diff --git a/engines/private/symbol.h b/engines/private/symbol.h
index 67c34bc861..f88afcfd18 100644
--- a/engines/private/symbol.h
+++ b/engines/private/symbol.h
@@ -1,3 +1,25 @@
+/* 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/str.h"
 #include "common/hash-str.h"
 #include "common/hash-ptr.h"


Commit: ccd4c9a831db6f17a0b5f866ec46903c934131d3
    https://github.com/scummvm/scummvm/commit/ccd4c9a831db6f17a0b5f866ec46903c934131d3
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixes and renamed installer_archive

Changed paths:
  A common/installshieldv3_archive.cpp
  A common/installshieldv3_archive.h
  R common/installer_archive.cpp
  R common/installer_archive.h
    common/module.mk
    engines/private/code.cpp
    engines/private/cursors.cpp
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h
    engines/private/symbol.cpp


diff --git a/common/installer_archive.cpp b/common/installshieldv3_archive.cpp
similarity index 85%
rename from common/installer_archive.cpp
rename to common/installshieldv3_archive.cpp
index cef3d4b9de..b7fbd9004b 100644
--- a/common/installer_archive.cpp
+++ b/common/installshieldv3_archive.cpp
@@ -20,22 +20,22 @@
  *
  */
 
-#include "common/installer_archive.h"
+#include "common/installshieldv3_archive.h"
 
 #include "common/dcl.h"
 #include "common/debug.h"
 
 namespace Common {
 
-InstallerArchive::InstallerArchive() : Common::Archive() {
+InstallShieldV3::InstallShieldV3() : Common::Archive() {
 	_stream = nullptr;
 }
 
-InstallerArchive::~InstallerArchive() {
+InstallShieldV3::~InstallShieldV3() {
 	close();
 }
 
-bool InstallerArchive::open(const Common::String &filename) {
+bool InstallShieldV3::open(const Common::String &filename) {
 	close();
 
 	_stream = SearchMan.createReadStreamForMember(filename);
@@ -102,27 +102,27 @@ bool InstallerArchive::open(const Common::String &filename) {
 	return true;
 }
 
-void InstallerArchive::close() {
+void InstallShieldV3::close() {
 	delete _stream; _stream = nullptr;
 	_map.clear();
 }
 
-bool InstallerArchive::hasFile(const Common::String &name) const {
+bool InstallShieldV3::hasFile(const Common::String &name) const {
 	return _map.contains(name);
 }
 
-int InstallerArchive::listMembers(Common::ArchiveMemberList &list) const {
+int InstallShieldV3::listMembers(Common::ArchiveMemberList &list) const {
 	for (FileMap::const_iterator it = _map.begin(); it != _map.end(); it++)
 		list.push_back(getMember(it->_key));
 
 	return _map.size();
 }
 
-const Common::ArchiveMemberPtr InstallerArchive::getMember(const Common::String &name) const {
+const Common::ArchiveMemberPtr InstallShieldV3::getMember(const Common::String &name) const {
 	return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
 }
 
-Common::SeekableReadStream *InstallerArchive::createReadStreamForMember(const Common::String &name) const {
+Common::SeekableReadStream *InstallShieldV3::createReadStreamForMember(const Common::String &name) const {
 	if (!_stream || !_map.contains(name))
 		return nullptr;
 
diff --git a/common/installer_archive.h b/common/installshieldv3_archive.h
similarity index 95%
rename from common/installer_archive.h
rename to common/installshieldv3_archive.h
index ddb8c73aef..6506613c8f 100644
--- a/common/installer_archive.h
+++ b/common/installshieldv3_archive.h
@@ -33,10 +33,10 @@
 
 namespace Common {
 
-class InstallerArchive : public Common::Archive {
+class InstallShieldV3 : public Common::Archive {
 public:
-	InstallerArchive();
-	~InstallerArchive() override;
+	InstallShieldV3();
+	~InstallShieldV3() override;
 
 	bool open(const Common::String &filename);
 	void close();
diff --git a/common/module.mk b/common/module.mk
index 9b30351343..1726928dd2 100644
--- a/common/module.mk
+++ b/common/module.mk
@@ -17,7 +17,7 @@ MODULE_OBJS := \
 	iff_container.o \
 	ini-file.o \
 	installshield_cab.o \
-	installer_archive.o \
+	installshieldv3_archive.o \
 	json.o \
 	language.o \
 	localization.o \
diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 0d37b5ef64..b1505dab8a 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -24,9 +24,9 @@
 #include "common/debug.h"
 #include "common/hash-ptr.h"
 
-#include "grammar.h"
-#include "grammar.tab.h"
-#include "private.h"
+#include "private/grammar.h"
+#include "private/grammar.tab.h"
+#include "private/private.h"
 
 namespace Private {
 
@@ -68,19 +68,19 @@ void initInsts() {
 
 /* initialize for code generation */
 void initSetting() {
-    setting = (Setting*) malloc(sizeof(Setting));
-    memset((void *) setting, 0, sizeof(Setting));
+    setting = (Setting*)malloc(sizeof(Setting));
+    memset((void *)setting, 0, sizeof(Setting));
 
-    prog = (Inst *) &setting->prog;
-    stack = (Datum *) &setting->stack;
+    prog = (Inst *)&setting->prog;
+    stack = (Datum *)&setting->stack;
 
     stackp = stack;
     progp = prog;
 }
 
 void saveSetting(char *name) {
-    Common::String s(name);
-    settingMap.setVal(s, setting);
+    //Common::String s(name);
+    settingMap.setVal(name, setting);
 }
 
 void loadSetting(Common::String *name) {
@@ -89,8 +89,8 @@ void loadSetting(Common::String *name) {
 
     debug("loading setting %s", name->c_str());
 
-    prog = (Inst *) &setting->prog;
-    stack = (Datum *) &setting->stack;
+    prog = (Inst *)&setting->prog;
+    stack = (Datum *)&setting->stack;
 
     stackp = stack;
     progp = prog;
diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index a3e4ba27cb..f3c88c5b44 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -23,7 +23,7 @@
 #include "graphics/cursorman.h"
 
 #include "private/cursors.h"
-#include "private.h"
+#include "private/private.h"
 
 namespace Private {
 
@@ -78,7 +78,7 @@ extern const byte MOUSECURSOR_kExit[] = {
     0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 };
 
 const byte MOUSECURSOR_kZoomIn[] = {
@@ -113,7 +113,7 @@ const byte MOUSECURSOR_kZoomIn[] = {
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 };
 
 const byte MOUSECURSOR_kTurnRight[] = {
@@ -148,7 +148,7 @@ const byte MOUSECURSOR_kTurnRight[] = {
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 };
 
 const byte MOUSECURSOR_kTurnLeft[] = {
@@ -183,7 +183,7 @@ const byte MOUSECURSOR_kTurnLeft[] = {
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 };
 
 const byte MOUSECURSOR_kInventory[] = {
@@ -218,7 +218,7 @@ const byte MOUSECURSOR_kInventory[] = {
     0,0,0,0,0,0,0,0,0,0,0,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,1,1,2,2,2,2,2,2,2,2,2,1,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0
 };
 
 const byte MOUSECURSOR_kZoomOut[] = {
@@ -253,7 +253,7 @@ const byte MOUSECURSOR_kZoomOut[] = {
     0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 };
 
 const byte MOUSECURSOR_kPhone[] {
@@ -288,7 +288,7 @@ const byte MOUSECURSOR_kPhone[] {
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
 };
 
 extern const byte cursorPalette[] = {
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 281428b16f..e128a99880 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -25,9 +25,9 @@
 #include "common/debug.h"
 #include "common/system.h"
 
-#include "grammar.h"
-#include "grammar.tab.h"
-#include "private.h"
+#include "private/grammar.h"
+#include "private/grammar.tab.h"
+#include "private/private.h"
 
 namespace Private {
 
@@ -139,7 +139,7 @@ void LoadGame(ArgArray args) {
     // assert types
     debug("LoadGame(%s, %s)", args[0].u.str, args[2].u.sym->name->c_str());
     Common::String *s = new Common::String(args[0].u.str);
-    MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+    MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
     m->surf = g_private->loadMask(*s, 0, 0, true);
     m->cursor = args[2].u.sym->name;
     m->nextSetting = NULL;
@@ -153,7 +153,7 @@ void SaveGame(ArgArray args) {
     // assert types
     debug("SaveGame(%s, %s)", args[0].u.str, args[1].u.sym->name->c_str());
     Common::String *s = new Common::String(args[0].u.str);
-    MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+    MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
     m->surf = g_private->loadMask(*s, 0, 0, true);
     m->cursor = args[1].u.sym->name;
     m->nextSetting = NULL;
@@ -222,7 +222,7 @@ void DossierAdd(ArgArray args) {
 
     assert (args.size() == 2);
     Common::String *s1 = new Common::String(args[0].u.str);
-    DossierInfo *m = (DossierInfo*) malloc(sizeof(DossierInfo));
+    DossierInfo *m = (DossierInfo*)malloc(sizeof(DossierInfo));
     m->page1 = s1;
 
     if (strcmp(args[1].u.str, "\"\"") != 0) {
@@ -256,7 +256,7 @@ void DossierChgSheet(ArgArray args) {
 void DossierPrevSuspect(ArgArray args) {
     assert (args.size() == 3);
     Common::String *s = new Common::String(args[0].u.str);
-    MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+    MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
 
     int x = args[1].u.val;
     int y = args[2].u.val;
@@ -275,7 +275,7 @@ void DossierPrevSuspect(ArgArray args) {
 void DossierNextSuspect(ArgArray args) {
     assert (args.size() == 3);
     Common::String *s = new Common::String(args[0].u.str);
-    MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+    MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
 
     int x = args[1].u.val;
     int y = args[2].u.val;
@@ -330,7 +330,7 @@ void Inventory(ArgArray args) {
 
     if (strcmp(b1.u.str, "\"\"") != 0) {
         Common::String *s = new Common::String(b1.u.str);
-        MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+        MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
         m->surf = g_private->loadMask(*s, 0, 0, true);
 
         if (e.type == NUM)
@@ -393,7 +393,7 @@ void Exit(ArgArray args) {
     // assert types
     assert(args[2].type == RECT || args[2].type == NAME);
     debug("Exit(%d %d %d)", args[0].type, args[1].type, args[2].type); //, args[0].u.str, args[1].u.sym->name->c_str(), "RECT");
-    ExitInfo *e = (ExitInfo*) malloc(sizeof(ExitInfo));
+    ExitInfo *e = (ExitInfo*)malloc(sizeof(ExitInfo));
 
     if (args[0].type == NUM && args[0].u.val == 0)
         e->nextSetting = NULL;
@@ -579,7 +579,7 @@ void _Mask(ArgArray args, bool drawn) {
     //if (drawed)
     //    g_private->loadImage(*s, x, y);
 
-    MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+    MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
     m->surf = g_private->loadMask(*s, x, y, drawn);
     m->nextSetting = new Common::String(e);
     m->cursor = c;
@@ -614,7 +614,7 @@ void AddSound(char *s, char *t, Symbol *flag = NULL, int val = 0) {
             return;
 
         g_private->_playedPhoneClips.setVal(*sound, true);
-        PhoneInfo *p = (PhoneInfo*) malloc(sizeof(PhoneInfo));
+        PhoneInfo *p = (PhoneInfo*)malloc(sizeof(PhoneInfo));
         p->sound = sound;
         p->flag = flag;
         p->val = val;
@@ -667,7 +667,7 @@ void SoundArea(ArgArray args) {
     debug("SoundArea(%s, %s)", args[0].u.str, n);
     if (strcmp(n, "kAMRadio") == 0) {
         Common::String *s = new Common::String(args[0].u.str);
-        MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+        MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
         m->surf = g_private->loadMask(*s, 0, 0, true);
         m->cursor = args[2].u.sym->name;
         m->nextSetting = NULL;
@@ -677,7 +677,7 @@ void SoundArea(ArgArray args) {
         g_private->_masks.push_front(*m);
     } else if (strcmp(n, "kPoliceRadio") == 0) {
         Common::String *s = new Common::String(args[0].u.str);
-        MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+        MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
         m->surf = g_private->loadMask(*s, 0, 0, true);
         m->cursor = args[2].u.sym->name;
         m->nextSetting = NULL;
@@ -687,7 +687,7 @@ void SoundArea(ArgArray args) {
         g_private->_masks.push_front(*m);
     } else if (strcmp(n, "kPhone") == 0) {
         Common::String *s = new Common::String(args[0].u.str);
-        MaskInfo *m = (MaskInfo*) malloc(sizeof(MaskInfo));
+        MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
         m->surf = g_private->loadMask(*s, 0, 0, true);
         m->cursor = args[2].u.sym->name;
         m->nextSetting = NULL;
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 59e85341cf..fa394c6823 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -47,7 +47,6 @@
 #include "private/grammar.tab.h"
 #include "private/grammar.h"
 
-
 namespace Private {
 
 PrivateEngine *g_private = NULL;
@@ -714,7 +713,7 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
     for (uint32 i = 0; i < size; ++i) {
         file = new Common::String(stream->readString());
 
-        DossierInfo *m = (DossierInfo*) malloc(sizeof(DossierInfo));
+        DossierInfo *m = (DossierInfo*)malloc(sizeof(DossierInfo));
         m->page1 = file;
 
         file = new Common::String(stream->readString());
@@ -753,7 +752,7 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
     _phone.clear();
 
     for (uint32 j = 0; j < size; ++j) {
-        PhoneInfo *i = (PhoneInfo*) malloc(sizeof(PhoneInfo));
+        PhoneInfo *i = (PhoneInfo*)malloc(sizeof(PhoneInfo));
 
         i->sound = new Common::String(stream->readString());
         i->flag  = variables.getVal(stream->readString());
@@ -1083,7 +1082,7 @@ Common::String *PrivateEngine::getLeaveSound() {
 char *PrivateEngine::getRandomPhoneClip(char *clip, int i, int j) {
     uint r = i + _rnd->getRandomNumber(j - i);
 
-    char *f = (char*) malloc((strlen(clip)+3)*sizeof(char));
+    char *f = (char*)malloc((strlen(clip)+3)*sizeof(char));
     snprintf(f, 32, "%s%02d", clip, r);
     return f;
 }
@@ -1113,7 +1112,7 @@ void PrivateEngine::loadLocations(Common::Rect *rect) {
         i++;
         if (sym->u.val) {
             offset = offset + 22;
-            char *f = (char*) malloc(32*sizeof(char));
+            char *f = (char*)malloc(32*sizeof(char));
             snprintf(f, 32, "dryloc%d.bmp", i);
             debug("%s, %d, %d", f, i, offset);
             Common::String s(*_diaryLocPrefix + f);
diff --git a/engines/private/private.h b/engines/private/private.h
index f7f524b745..d4cc424233 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -29,7 +29,7 @@
 #include "engines/engine.h"
 #include "gui/debugger.h"
 
-#include "common/installer_archive.h"
+#include "common/installshieldv3_archive.h"
 
 #include "audio/mixer.h"
 #include "video/smk_decoder.h"
@@ -142,7 +142,7 @@ public:
     Audio::SoundHandle _fgSoundHandle;
     Audio::SoundHandle _bgSoundHandle;
     Video::SmackerDecoder *_videoDecoder;
-    Common::InstallerArchive _installerArchive;
+    Common::InstallShieldV3 _installerArchive;
 
     Common::Error run() override;
     void restartGame();
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 4f68570b9b..6a7f2bab13 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -21,8 +21,8 @@
  */
 
 #include "common/debug.h"
-#include "grammar.h"
-#include "grammar.tab.h"
+#include "private/grammar.h"
+#include "private/grammar.tab.h"
 
 namespace Private {
 
@@ -43,7 +43,7 @@ void defineSymbol(char *n, Common::Rect *r) {
 char *emalloc(unsigned n) {
     char *p;
 
-    p = (char*) malloc(n);
+    p = (char*)malloc(n);
     assert(p != NULL);
     return p;
 }
@@ -145,7 +145,7 @@ Symbol *constant(int t, int d, char *s) {
     Symbol *sp;
     Common::String *n = new Common::String("<constant>");
 
-    sp = (Symbol *) emalloc(sizeof(Symbol));
+    sp = (Symbol *)emalloc(sizeof(Symbol));
     sp->name = n;
     sp->type = t;
     if (t == NUM || t == NAME)
@@ -165,7 +165,7 @@ Symbol *install(Common::String *n, int t, int d, char *s, Common::Rect *r, Symbo
 
     Symbol *sp;
 
-    sp = (Symbol *) emalloc(sizeof(Symbol));
+    sp = (Symbol *)emalloc(sizeof(Symbol));
     sp->name = name;
     sp->type = t;
     if (t == NUM || t == NAME)


Commit: 9618650bb170a5d569ccce0772a67b574539b947
    https://github.com/scummvm/scummvm/commit/9618650bb170a5d569ccce0772a67b574539b947
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: optimized use of screen

Changed paths:
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index fa394c6823..b7f567dbbe 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -164,6 +164,7 @@ Common::Error PrivateEngine::run() {
     _pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
     _transparentColor = _pixelFormat.RGBToColor(0,255,0);
     initGraphics(_screenW, _screenH, &_pixelFormat);
+    screenRect = new Common::Rect(0, 0, _screenW, _screenH);
     changeCursor("default");
 
     _origin = new Common::Point(0, 0);
@@ -978,11 +979,8 @@ Graphics::ManagedSurface *PrivateEngine::loadMask(const Common::String &name, in
 
     _image->loadStream(file);
     Graphics::ManagedSurface *surf = new Graphics::ManagedSurface();
-    Graphics::Surface *screen = g_system->lockScreen();
-
     surf->create(_screenW, _screenH, _pixelFormat);
-    surf->transBlitFrom(*screen);
-    g_system->unlockScreen();
+    surf->fillRect(*screenRect, _transparentColor);
     Graphics::Surface *csurf = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
     surf->transBlitFrom(*csurf, Common::Point(x,y));
     csurf->free();
diff --git a/engines/private/private.h b/engines/private/private.h
index d4cc424233..9807a68e0e 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -192,6 +192,7 @@ public:
     void drawMask(Graphics::ManagedSurface *);
     bool inMask(Graphics::ManagedSurface*, Common::Point);
     uint32 _transparentColor;
+    Common::Rect *screenRect;
     void drawScreen();
 
     // global state


Commit: 386c07149e5d832f7b2de92bc7d002efdf682ac2
    https://github.com/scummvm/scummvm/commit/386c07149e5d832f7b2de92bc7d002efdf682ac2
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixes

Changed paths:
    engines/private/code.cpp
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index b1505dab8a..fcef7a41b0 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -132,8 +132,7 @@ int constpush()	{
     return 0;
 }
 
-int strpush()	/* push constant onto stack */
-{
+int strpush() { /* push constant onto stack */
     Datum d;
     d.type = STRING;
     Symbol *s = (Symbol *)*pc++;
@@ -144,8 +143,7 @@ int strpush()	/* push constant onto stack */
 }
 
 
-int varpush()	/* push variable onto stack */
-{
+int varpush() {	/* push variable onto stack */
     Datum d;
     d.type = NAME;
     d.u.sym = (Symbol *)(*pc++);
@@ -154,8 +152,7 @@ int varpush()	/* push variable onto stack */
     return 0;
 }
 
-int funcpush() //(char *name, int nargs)
-{
+int funcpush() {
     Datum s, n, arg;
     s = pop();
     n = pop();
@@ -366,15 +363,11 @@ int ne() {
     d2 = pop();
     d1 = pop();
     if (d1.type == NAME) {
-        //char *name =  d1.u.sym->name->c_str();
-        //debug("eval %s to %d",
         d1.u.val = d1.u.sym->u.val;
         d1.type = NUM;
     }
 
     if (d2.type == NAME) {
-        //char *name =  d1.u.sym->name->c_str();
-        //debug("eval %s to %d",
         d2.u.val = d2.u.sym->u.val;
         d2.type = NUM;
     }
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 6a7f2bab13..83533df93e 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -40,14 +40,6 @@ void defineSymbol(char *n, Common::Rect *r) {
     rectToDefine.push(r);
 }
 
-char *emalloc(unsigned n) {
-    char *p;
-
-    p = (char*)malloc(n);
-    assert(p != NULL);
-    return p;
-}
-
 void showSymbol(Symbol *s) {
     if (s->type == NUM)
         debug("%s %d",s->name->c_str(), s->u.val);
@@ -145,7 +137,7 @@ Symbol *constant(int t, int d, char *s) {
     Symbol *sp;
     Common::String *n = new Common::String("<constant>");
 
-    sp = (Symbol *)emalloc(sizeof(Symbol));
+    sp = (Symbol *)malloc(sizeof(Symbol));
     sp->name = n;
     sp->type = t;
     if (t == NUM || t == NAME)
@@ -165,7 +157,7 @@ Symbol *install(Common::String *n, int t, int d, char *s, Common::Rect *r, Symbo
 
     Symbol *sp;
 
-    sp = (Symbol *)emalloc(sizeof(Symbol));
+    sp = (Symbol *)malloc(sizeof(Symbol));
     sp->name = name;
     sp->type = t;
     if (t == NUM || t == NAME)


Commit: 8d9ed3d8d656eb9a3394d5ccc86eb772b0af436f
    https://github.com/scummvm/scummvm/commit/8d9ed3d8d656eb9a3394d5ccc86eb772b0af436f
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixes

Changed paths:
    engines/private/code.cpp
    engines/private/cursors.cpp
    engines/private/cursors.h
    engines/private/funcs.cpp
    engines/private/grammar.h
    engines/private/metaengine.cpp
    engines/private/symbol.cpp
    engines/private/symbol.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index fcef7a41b0..cbec27be3e 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -438,4 +438,4 @@ void execute(Inst *p) {
     }
 }
 
-}
+} // End of namespace Private
diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index f3c88c5b44..0bd1a3e087 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -349,14 +349,19 @@ void PrivateEngine::initCursors() {
 void PrivateEngine::changeCursor(Common::String cursor) {
     assert(_cursorData.contains(cursor));
     Common::Point p = *_cursorPoints.getVal(cursor);
-    Common::Point s;
-    if (strcmp(cursor.c_str(), "default") == 0)
-        s = Common::Point(11, 16);
-    else
-        s = Common::Point(32, 32);
 
-    CursorMan.replaceCursor(_cursorData.getVal(cursor), s.x, s.y, p.x, p.y, 0, false);
+    int x, y;
+    if (strcmp(cursor.c_str(), "default") == 0) {
+        x = 11;
+        y = 16;
+    }
+    else {
+        x = 32;
+        y = 32;
+    }
+
+    CursorMan.replaceCursor(_cursorData.getVal(cursor), x, y, p.x, p.y, 0, false);
     CursorMan.showMouse(true);
 }
 
-}
\ No newline at end of file
+} // End of namespace Private
diff --git a/engines/private/cursors.h b/engines/private/cursors.h
index 895f126e37..8aad12a605 100644
--- a/engines/private/cursors.h
+++ b/engines/private/cursors.h
@@ -34,6 +34,6 @@ namespace Private {
 typedef Common::HashMap<Common::String, const byte*> CursorDataMap;
 typedef Common::HashMap<Common::String, Common::Point*> CursorPointMap;
 
-}
+} // End of namespace Private
 
 #endif
\ No newline at end of file
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index e128a99880..e58c699205 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -821,4 +821,4 @@ void call(char *name, ArgArray args) {
 
 }
 
-}
+} // End of namespace Private
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 689cd6c357..448153ce4b 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -125,6 +125,6 @@ extern void loadSetting(Common::String *);
 
 extern void execute(Inst *);
 
-}
+} // End of namespace Private
 
 #endif
diff --git a/engines/private/metaengine.cpp b/engines/private/metaengine.cpp
index 5f5c07cb2a..618d5b790e 100644
--- a/engines/private/metaengine.cpp
+++ b/engines/private/metaengine.cpp
@@ -43,7 +43,7 @@ bool PrivateEngine::isDemo() const {
     return (bool)(_gameDescription->flags & ADGF_DEMO);
 }
 
-}
+} // End of namespace Private
 
 #if PLUGIN_ENABLED_DYNAMIC(PRIVATE)
 REGISTER_PLUGIN_DYNAMIC(PRIVATE, PLUGIN_TYPE_ENGINE, PrivateMetaEngine);
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 83533df93e..f0b6dcf451 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -174,4 +174,4 @@ Symbol *install(Common::String *n, int t, int d, char *s, Common::Rect *r, Symbo
     return sp;
 }
 
-}
+} // End of namespace Private
diff --git a/engines/private/symbol.h b/engines/private/symbol.h
index f88afcfd18..83d96441b9 100644
--- a/engines/private/symbol.h
+++ b/engines/private/symbol.h
@@ -64,6 +64,6 @@ extern Symbol  *constant(int, int, char *);
 extern void     installAll(char *);
 extern Symbol  *lookup(Common::String, SymbolMap);
 
-}
+} // End of namespace Private
 
 #endif
\ No newline at end of file


Commit: 08fcf88a19732df7ddb9c85e1a73406efa7af3f3
    https://github.com/scummvm/scummvm/commit/08fcf88a19732df7ddb9c85e1a73406efa7af3f3
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: removed tabs

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/grammar.h
    engines/private/symbol.cpp
    engines/private/symbol.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index cbec27be3e..15f96da0e0 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -33,12 +33,12 @@ namespace Private {
 Setting *setting;
 SettingMap settingMap;
 
-Datum	*stack       = NULL;	/* the stack */
-Datum	*stackp      = NULL;	/* next free spot on stack */
+Datum *stack  = NULL; /* the stack */
+Datum *stackp = NULL; /* next free spot on stack */
 
-Inst	*prog        = NULL;	/* the machine */
-Inst	*progp       = NULL;	/* next free spot for code generation */
-Inst	*pc          = NULL;	/* program counter during execution */
+Inst *prog    = NULL; /* the machine */
+Inst *progp   = NULL; /* next free spot for code generation */
+Inst *pc      = NULL; /* program counter during execution */
 
 
 static struct InstDescr {
@@ -47,13 +47,13 @@ static struct InstDescr {
 } instDescr[] = {
     { 0,        "STOP",     },
     { constpush,"constpush" },
-    { strpush,  "strpush",	},
-    { varpush,  "varpush",	},
-    { funcpush, "funcpush",	},
-    { eval,	    "eval",     },
-    { ifcode,   "ifcode",	},
+    { strpush,  "strpush",  },
+    { varpush,  "varpush",  },
+    { funcpush, "funcpush", },
+    { eval,     "eval",     },
+    { ifcode,   "ifcode",   },
     { add,      "add",      },
-    { negate,	"negate",	},
+    { negate,   "negate",   },
 
     { 0, 0}
 };
@@ -115,13 +115,13 @@ int push(Datum d) {
 }
 
 /* pop and return top elem from stack */
-Datum pop()	{
+Datum pop() {
     assert (!(stackp <= stack));
     return *--stackp;
 }
 
 /* push constant onto stack */
-int constpush()	{
+int constpush() {
     Datum d;
     Symbol *s = (Symbol *)*pc++;
     d.type = NUM;
@@ -143,7 +143,7 @@ int strpush() { /* push constant onto stack */
 }
 
 
-int varpush() {	/* push variable onto stack */
+int varpush() { /* push variable onto stack */
     Datum d;
     d.type = NAME;
     d.u.sym = (Symbol *)(*pc++);
@@ -172,9 +172,6 @@ int funcpush() {
 int eval() {
     Datum d;
     d = pop();
-    //debug("eval %s", d.u.sym->name->c_str());
-    //if (d.sym->type == UNDEF)
-    //	execerror("undefined variable", d.sym->name);
     if (d.u.sym->type == NUM) {
         d.type = NUM;
         d.u.val = d.u.sym->u.val;
@@ -389,10 +386,10 @@ Inst *code(Inst f) {
 
 int ifcode() {
     Datum d;
-    Inst *savepc = pc;	/* then part */
+    Inst *savepc = pc;  /* then part */
     debug("ifcode: evaluating condition");
 
-    execute(savepc+3);	/* condition */
+    execute(savepc+3);  /* condition */
     d = pop();
 
     debug("ifcode: selecting branch");
@@ -411,7 +408,7 @@ int ifcode() {
         execute(*((Inst **)(savepc+1)));
     }
     debug("ifcode finished");
-    pc = *((Inst **)(savepc+2));	 /* next stmt */
+    pc = *((Inst **)(savepc+2)); /* next stmt */
     return 0;
 }
 
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index e58c699205..e65d0f372b 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -741,7 +741,7 @@ static struct FuncTable {
     { Goto,            "goto"},
     { SetFlag,         "SetFlag"},
     { SetModifiedFlag, "SetModifiedFlag"},
-    { Timer,	       "Timer"},
+    { Timer,           "Timer"},
 
     // Sounds
     { Sound,           "Sound"},
@@ -767,9 +767,9 @@ static struct FuncTable {
     { Movie,           "Movie"},
 
     // Diary
-    {DiaryLocList,     "DiaryLocList"},
-    {DiaryInvList,     "DiaryInvList"},
-    {DiaryGoLoc,       "DiaryGoLoc"},
+    { DiaryLocList,    "DiaryLocList"},
+    { DiaryInvList,    "DiaryInvList"},
+    { DiaryGoLoc,      "DiaryGoLoc"},
 
     { Exit,            "Exit"},
     { Quit,            "Quit"},
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 448153ce4b..989896b21c 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -32,18 +32,18 @@
 #ifndef PRIVATE_GRAMMAR_H
 #define PRIVATE_GRAMMAR_H
 
-#define	NSTACK	256
-#define	NPROG	10000
+#define NSTACK 256
+#define NPROG  10000
 
 
 namespace Private {
 
-typedef struct Datum {	/* interpreter stack type */
+typedef struct Datum {  /* interpreter stack type */
     short type;
     union {
-        int	 val;
+        int  val;
         char    *str;
-        Symbol	*sym;
+        Symbol  *sym;
         Common::Rect *rect;
     } u;
 } Datum;
@@ -54,8 +54,8 @@ typedef struct Arg {
     int (**inst)();
 } Arg;
 
-typedef int (*Inst)();	/* machine instruction */
-#define	STOP	(Inst) 0
+typedef int (*Inst)();  /* machine instruction */
+#define STOP    (Inst) 0
 
 typedef Common::HashMap<void *, Common::String *> PtrToName;
 typedef Common::HashMap<Common::String, void *> NameToPtr;
@@ -66,12 +66,12 @@ extern void initFuncs();
 
 typedef struct Setting {
 
-    Datum	stack[NSTACK];	/* the stack */
-    Datum	*stackp;	/* next free spot on stack */
+    Datum stack[NSTACK]; /* the stack */
+    Datum *stackp;       /* next free spot on stack */
 
-    Inst	prog[NPROG];	/* the machine */
-    Inst	*progp;		/* next free spot for code generation */
-    Inst	*pc;		/* program counter during execution */
+    Inst  prog[NPROG];   /* the machine */
+    Inst  *progp;        /* next free spot for code generation */
+    Inst  *pc;           /* program counter during execution */
 
 } Setting;
 
@@ -90,17 +90,17 @@ extern void call(char *, ArgArray);
 
 // Code Generation
 
-extern	Datum pop();
+extern  Datum pop();
 extern  int push(Datum);
-extern  Inst	*progp;
+extern  Inst *progp;
 
 extern  Inst *code(Inst);
-extern	Inst *prog;
-extern	int eval();
+extern  Inst *prog;
+extern  int eval();
 extern  int add();
 extern  int negate();
 extern  int power();
-extern	int assign();
+extern  int assign();
 extern  int bltin();
 extern  int varpush();
 extern  int constpush();
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index f0b6dcf451..9384bad614 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -56,7 +56,7 @@ void setSymbol(Symbol *s, int v) {
 }
 
 /* find s in symbol table symlist */
-Symbol *lookup(Common::String s, SymbolMap symlist)	 {
+Symbol *lookup(Common::String s, SymbolMap symlist) {
     Symbol *r = symlist.getVal(s);
     return r;
 }
diff --git a/engines/private/symbol.h b/engines/private/symbol.h
index 83d96441b9..101ceb42c6 100644
--- a/engines/private/symbol.h
+++ b/engines/private/symbol.h
@@ -33,12 +33,12 @@
 
 namespace Private {
 
-typedef struct Symbol {	/* symbol table entry */
+typedef struct Symbol {     /* symbol table entry */
     Common::String *name;
-    short	type;	/* NAME, NUM, STRING or RECT  */
+    short  type;            /* NAME, NUM, STRING or RECT  */
     union {
-        int	val;	    /* NAME or NUM */
-        char	*str;	    /* STRING */
+        int val;            /* NAME or NUM */
+        char *str;          /* STRING */
         Common::Rect *rect; /* RECT */
     } u;
 } Symbol;


Commit: 9304bb0e5810f7c7df3719d53ace56dd4fe3a2cf
    https://github.com/scummvm/scummvm/commit/9304bb0e5810f7c7df3719d53ace56dd4fe3a2cf
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixed code convetions

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/private.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 15f96da0e0..bef7430e4b 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -184,8 +184,7 @@ int eval() {
         d.u.rect = d.u.sym->u.rect;
     } else if (d.u.sym->type == NAME) {
         // No evaluation until is absolutely needed
-    }
-    else
+    } else
         assert(0);
 
     push(d);
@@ -224,11 +223,9 @@ int negate() {
         //debug("negating %s", d.u.sym->name->c_str());
         v = d.u.sym->u.val;
         d.type = NUM;
-    }
-    else if (d.type == NUM) {
+    } else if (d.type == NUM) {
         v = d.u.val;
-    }
-    else
+    } else
         assert(0);
 
     d.u.val = !v;
@@ -402,8 +399,7 @@ int ifcode() {
     if (d.u.val) {
         debug("ifcode: true branch");
         execute(*((Inst **)(savepc)));
-    }
-    else if (*((Inst **)(savepc+1))) { /* else part? */
+    } else if (*((Inst **)(savepc+1))) { /* else part? */
         debug("ifcode: false branch");
         execute(*((Inst **)(savepc+1)));
     }
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index e65d0f372b..01aab5de4a 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -47,11 +47,9 @@ void ChgMode(ArgArray args) {
 
     if (g_private->_mode == 0) {
         g_private->_origin = &kPrivateOriginZero;
-    }
-    else if (g_private->_mode == 1) {
+    } else if (g_private->_mode == 1) {
         g_private->_origin = &kPrivateOriginOne;
-    }
-    else
+    } else
         assert(0);
 
     if (args.size() == 3)
@@ -125,9 +123,7 @@ void SyncSound(ArgArray args) {
         Common::String *s = new Common::String(args[0].u.str);
         g_private->playSound(*s, 1, true, false);
         //assert(0);
-    } //else {
-    //  g_private->stopSound(true);
-    //}
+    }
 }
 
 void Quit(ArgArray args) {
@@ -179,9 +175,8 @@ void PoliceBust(ArgArray args) {
 
     if (args.size() == 2) {
         if (args[1].u.val == 2) {
-            // ????
-        }
-        else if (args[1].u.val == 3) {
+            // Unclear what it means
+        } else if (args[1].u.val == 3) {
             g_private->_nextSetting = &kMainDesktop;
             g_private->_mode = 0;
             g_private->_origin = &kPrivateOriginZero;
@@ -373,7 +368,7 @@ void Inventory(ArgArray args) {
                 v1.u.sym->u.val = 1;
                 g_private->inventory.push_back(*bmp);
             }
-        } else  {
+        } else {
             g_private->inventory.push_back(*bmp);
         }
 
@@ -644,11 +639,9 @@ void PhoneClip(ArgArray args) {
     if (i == j)
         AddSound(args[0].u.str, "PhoneClip", args[4].u.sym, args[5].u.val);
     else {
-
         assert(i < j);
         char *clip = g_private->getRandomPhoneClip(args[0].u.str, i, j);
         AddSound(clip, "PhoneClip", args[4].u.sym, args[5].u.val);
-
     }
 
 }
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index b7f567dbbe..9c5ac19349 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -935,8 +935,7 @@ void PrivateEngine::stopSound(bool all) {
     if (all) {
         _mixer->stopHandle(_fgSoundHandle);
         _mixer->stopHandle(_bgSoundHandle);
-    }
-    else {
+    } else {
         _mixer->stopHandle(_fgSoundHandle);
     }
 }


Commit: 70256d38ebbc390604d1e5020217a18101f9d028
    https://github.com/scummvm/scummvm/commit/70256d38ebbc390604d1e5020217a18101f9d028
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: added proper debug channels and fixed type assertions

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index bef7430e4b..7f589bbbb2 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -87,7 +87,7 @@ void loadSetting(Common::String *name) {
     assert(settingMap.contains(*name));
     setting = settingMap.getVal(*name);
 
-    debug("loading setting %s", name->c_str());
+    debugC(1, kPrivateDebugCode, "loading setting %s", name->c_str());
 
     prog = (Inst *)&setting->prog;
     stack = (Datum *)&setting->stack;
@@ -127,7 +127,7 @@ int constpush() {
     d.type = NUM;
     d.u.val = s->u.val;
 
-    debug("pushing const %d with name %s", d.u.val, s->name->c_str());
+    debugC(1, kPrivateDebugCode, "pushing const %d with name %s", d.u.val, s->name->c_str());
     push(d);
     return 0;
 }
@@ -137,7 +137,8 @@ int strpush() { /* push constant onto stack */
     d.type = STRING;
     Symbol *s = (Symbol *)*pc++;
     d.u.str = s->u.str;
-    debug("pushing const %s with name %s", d.u.str, s->name->c_str());
+    debugC(1, kPrivateDebugCode, "pushing const %s with name %s", d.u.str, s->name->c_str());
+
     push(d);
     return 0;
 }
@@ -147,7 +148,7 @@ int varpush() { /* push variable onto stack */
     Datum d;
     d.type = NAME;
     d.u.sym = (Symbol *)(*pc++);
-    debug("var pushing %s", d.u.sym->name->c_str());
+    debugC(1, kPrivateDebugCode, "var pushing %s", d.u.sym->name->c_str());
     push(d);
     return 0;
 }
@@ -158,7 +159,7 @@ int funcpush() {
     n = pop();
     ArgArray args;
 
-    //debug("executing %s with %d params", s.u.str, n.u.val);
+    debugC(1, kPrivateDebugCode, "executing %s with %d params", s.u.str, n.u.val);
     for (int i = 0; i < n.u.val; i++) {
         arg = pop();
         args.insert(args.begin(), arg) ;
@@ -178,7 +179,7 @@ int eval() {
     } else if (d.u.sym->type == STRING) {
         d.type = STRING;
         d.u.str = d.u.sym->u.str;
-        debug("eval returned %s", d.u.str );
+        debugC(1, kPrivateDebugCode, "eval returned %s", d.u.str );
     } else if (d.u.sym->type == RECT) {
         d.type = RECT;
         d.u.rect = d.u.sym->u.rect;
@@ -209,7 +210,7 @@ int add() {
     assert(d1.type == NUM);
     assert(d2.type == NUM);
 
-    //printf("adding %d %d\n",d1.val, d2.val);
+    debugC(1, kPrivateDebugCode, "adding %d %d\n", d1.u.val, d2.u.val);
     d1.u.val += d2.u.val;
     push(d1);
     return 0;
@@ -374,7 +375,7 @@ int ne() {
 
 /* install one instruction or operand */
 Inst *code(Inst f) {
-    //debug("pushing code at %d", progp);
+    debugC(1, kPrivateDebugCode, "pushing code at %x", progp);
     Inst *oprogp = progp;
     assert (!(progp >= &prog[NPROG]));
     *progp++ = f;
@@ -384,26 +385,26 @@ Inst *code(Inst f) {
 int ifcode() {
     Datum d;
     Inst *savepc = pc;  /* then part */
-    debug("ifcode: evaluating condition");
+    debugC(1, kPrivateDebugCode, "ifcode: evaluating condition");
 
     execute(savepc+3);  /* condition */
     d = pop();
 
-    debug("ifcode: selecting branch");
+    debugC(1, kPrivateDebugCode, "ifcode: selecting branch");
 
     if (d.type == NAME) {
-        debug("name %s", d.u.sym->name->c_str()); //, d.sym->u.val);
+        debugC(1, kPrivateDebugCode, "name %s", d.u.sym->name->c_str());
         d.u.val = d.u.sym->u.val;
     }
 
     if (d.u.val) {
-        debug("ifcode: true branch");
+        debugC(1, kPrivateDebugCode, "ifcode: true branch");
         execute(*((Inst **)(savepc)));
     } else if (*((Inst **)(savepc+1))) { /* else part? */
-        debug("ifcode: false branch");
+        debugC(1, kPrivateDebugCode, "ifcode: false branch");
         execute(*((Inst **)(savepc+1)));
     }
-    debug("ifcode finished");
+    debugC(1, kPrivateDebugCode, "ifcode finished");
     pc = *((Inst **)(savepc+2)); /* next stmt */
     return 0;
 }
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 01aab5de4a..401af3c9c6 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -35,9 +35,9 @@ void ChgMode(ArgArray args) {
     // assert types
     assert (args.size() == 2 || args.size() == 3);
     if (args.size() == 2)
-        debug("ChgMode(%d, %s)", args[0].u.val, args[1].u.str);
+        debugC(1, kPrivateDebugScript, "ChgMode(%d, %s)", args[0].u.val, args[1].u.str);
     else if (args.size() == 3)
-        debug("ChgMode(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.sym->name->c_str());
+        debugC(1, kPrivateDebugScript, "ChgMode(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.sym->name->c_str());
     else
         assert(0);
 
@@ -65,7 +65,7 @@ void ChgMode(ArgArray args) {
 
 void VSPicture(ArgArray args) {
     // assert types
-    debug("VSPicture(%s)", args[0].u.str);
+    debugC(1, kPrivateDebugScript, "VSPicture(%s)", args[0].u.str);
     g_private->_nextVS = new Common::String(args[0].u.str);
 }
 
@@ -73,7 +73,7 @@ void VSPicture(ArgArray args) {
 void DiaryLocList(ArgArray args) {
     int x1, y1, x2, y2;
 
-    debug("DiaryLocList(%d, %d, %d, %d)", args[0].u.val, args[1].u.val, args[2].u.val, args[3].u.val);
+    debugC(1, kPrivateDebugScript, "DiaryLocList(%d, %d, %d, %d)", args[0].u.val, args[1].u.val, args[2].u.val, args[3].u.val);
 
     x2 = args[0].u.val;
     y2 = args[1].u.val;
@@ -82,32 +82,28 @@ void DiaryLocList(ArgArray args) {
     y1 = args[3].u.val;
 
     Common::Rect *rect = new Common::Rect(x1, y1, x2, y2);
-    rect->debugPrint();
     g_private->loadLocations(rect);
 
 }
 
 void DiaryGoLoc(ArgArray args) {
-    debug("WARNING: DiaryGoLoc not implemented");
+    debugC(1, kPrivateDebugScript, "WARNING: DiaryGoLoc not implemented");
 }
 
 void DiaryInvList(ArgArray args) {
     Common::Rect *r1, *r2;
 
-    debug("DiaryInvList(%d, ..)", args[0].u.val);
+    debugC(1, kPrivateDebugScript, "DiaryInvList(%d, ..)", args[0].u.val);
 
     r1 = args[1].u.rect;
     r2 = args[2].u.rect;
 
-    r1->debugPrint();
-    r2->debugPrint();
-
     g_private->loadInventory(args[0].u.val, r1, r2);
 }
 
 void Goto(ArgArray args) { // should be goto, but this is a reserved word
     // assert types
-    debug("goto(%s)", args[0].u.str);
+    debugC(1, kPrivateDebugScript, "goto(%s)", args[0].u.str);
     Common::String *s = new Common::String(args[0].u.str);
     g_private->_nextSetting = s;
 }
@@ -115,7 +111,7 @@ void Goto(ArgArray args) { // should be goto, but this is a reserved word
 
 void SyncSound(ArgArray args) {
     // assert types
-    debug("SyncSound(%s, %s)", args[0].u.str, args[1].u.str);
+    debugC(1, kPrivateDebugScript, "SyncSound(%s, %s)", args[0].u.str, args[1].u.str);
     Common::String *nextSetting = new Common::String(args[1].u.str);
     g_private->_nextSetting = nextSetting;
 
@@ -127,13 +123,13 @@ void SyncSound(ArgArray args) {
 }
 
 void Quit(ArgArray args) {
-    debug("Quit()");
+    debugC(1, kPrivateDebugScript, "Quit()");
     g_private->quitGame();
 }
 
 void LoadGame(ArgArray args) {
     // assert types
-    debug("LoadGame(%s, %s)", args[0].u.str, args[2].u.sym->name->c_str());
+    debugC(1, kPrivateDebugScript, "LoadGame(%s, %s)", args[0].u.str, args[2].u.sym->name->c_str());
     Common::String *s = new Common::String(args[0].u.str);
     MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
     m->surf = g_private->loadMask(*s, 0, 0, true);
@@ -147,7 +143,7 @@ void LoadGame(ArgArray args) {
 
 void SaveGame(ArgArray args) {
     // assert types
-    debug("SaveGame(%s, %s)", args[0].u.str, args[1].u.sym->name->c_str());
+    debugC(1, kPrivateDebugScript, "SaveGame(%s, %s)", args[0].u.str, args[1].u.sym->name->c_str());
     Common::String *s = new Common::String(args[0].u.str);
     MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
     m->surf = g_private->loadMask(*s, 0, 0, true);
@@ -183,13 +179,14 @@ void PoliceBust(ArgArray args) {
         } else
             assert(0);
     }
-    debug("WARNING: PoliceBust partially implemented");
+    debugC(1, kPrivateDebugScript, "PoliceBust(%d, ..)", args[0].u.val);
+    debugC(1, kPrivateDebugScript, "WARNING: PoliceBust partially implemented");
 }
 
 void BustMovie(ArgArray args) {
     // assert types
     assert (args.size() == 1);
-    debug("BustMovie(%s)", args[0].u.str);
+    debugC(1, kPrivateDebugScript, "BustMovie(%s)", args[0].u.str);
     uint policeIndex = variables.getVal(kPoliceIndex)->u.val;
     int videoIndex = policeIndex/2 - 1;
     if (videoIndex < 0)
@@ -207,12 +204,8 @@ void BustMovie(ArgArray args) {
     Common::String *pv = new Common::String(f);
     g_private->_nextMovie = pv;
     g_private->_nextSetting = new Common::String(args[0].u.str);
-
-
 }
 
-
-
 void DossierAdd(ArgArray args) {
 
     assert (args.size() == 2);
@@ -245,7 +238,7 @@ void DossierBitmap(ArgArray args) {
 }
 
 void DossierChgSheet(ArgArray args) {
-    debug("WARNING: DossierChgSheet is not implemented");
+    debugC(1, kPrivateDebugScript, "WARNING: DossierChgSheet is not implemented");
 }
 
 void DossierPrevSuspect(ArgArray args) {
@@ -263,8 +256,6 @@ void DossierPrevSuspect(ArgArray args) {
     m->flag2 = NULL;
     g_private->_dossierPrevSuspectMask = m;
     g_private->_masks.push_front(*m);
-    debug("origin: %d, %d, %d", g_private->_origin->x, g_private->_origin->y, g_private->_mode);
-    //debug("WARNING: DossierPrevSuspect is not implemented");
 }
 
 void DossierNextSuspect(ArgArray args) {
@@ -282,17 +273,17 @@ void DossierNextSuspect(ArgArray args) {
     m->flag2 = NULL;
     g_private->_dossierNextSuspectMask = m;
     g_private->_masks.push_front(*m);
-    //debug("WARNING: DossierNextSuspect is not implemented");
 }
 
 void NoStopSounds(ArgArray args) {
     assert(args.size() == 0);
-    debug("NoStopSounds()");
+    debugC(1, kPrivateDebugScript, "NoStopSounds()");
     g_private->_noStopSounds = true;
 }
 
 void LoseInventory(ArgArray args) {
     assert(args.size() == 0);
+    debugC(1, kPrivateDebugScript, "LoveInventory()");
     g_private->inventory.clear();
 }
 
@@ -321,7 +312,7 @@ void Inventory(ArgArray args) {
     if (v1.type == STRING)
         assert(strcmp(v1.u.str, "\"\"") == 0);
 
-    debug("Inventory(...)");
+    debugC(1, kPrivateDebugScript, "Inventory(...)");
 
     if (strcmp(b1.u.str, "\"\"") != 0) {
         Common::String *s = new Common::String(b1.u.str);
@@ -379,15 +370,16 @@ void Inventory(ArgArray args) {
 }
 
 void SetFlag(ArgArray args) {
-    // assert types
-    debug("SetFlag(%s, %d)", args[0].u.sym->name->c_str(), args[1].u.val);
+    assert(args.size() == 2);
+    assert(args[0].type == NAME && args[1].type == NUM);
+    debugC(1, kPrivateDebugScript, "SetFlag(%s, %d)", args[0].u.sym->name->c_str(), args[1].u.val);
     args[0].u.sym->u.val = args[1].u.val;
 }
 
 void Exit(ArgArray args) {
     // assert types
     assert(args[2].type == RECT || args[2].type == NAME);
-    debug("Exit(%d %d %d)", args[0].type, args[1].type, args[2].type); //, args[0].u.str, args[1].u.sym->name->c_str(), "RECT");
+    debugC(1, kPrivateDebugScript, "Exit(%d %d %d)", args[0].type, args[1].type, args[2].type); //, args[0].u.str, args[1].u.sym->name->c_str(), "RECT");
     ExitInfo *e = (ExitInfo*)malloc(sizeof(ExitInfo));
 
     if (args[0].type == NUM && args[0].u.val == 0)
@@ -406,26 +398,26 @@ void Exit(ArgArray args) {
     }
 
     e->rect = args[2].u.rect;
-    debug("Rect %d %d %d %d", args[2].u.rect->top, args[2].u.rect->left, args[2].u.rect->bottom, args[2].u.rect->right);
+    //debug("Rect %d %d %d %d", args[2].u.rect->top, args[2].u.rect->left, args[2].u.rect->bottom, args[2].u.rect->right);
     g_private->_exits.push_front(*e);
 }
 
 void SetModifiedFlag(ArgArray args) {
     // assert types
-    debug("SetModifiedFlag(%d)", args[0].u.val);
+    debugC(1, kPrivateDebugScript, "SetModifiedFlag(%d)", args[0].u.val);
     g_private->_modified = (bool) args[0].u.val;
 }
 
 void PaperShuffleSound(ArgArray args) {
-    // assert types
-    debug("PaperShuffleSound()");
+    assert(args.size() == 0);
+    debugC(1, kPrivateDebugScript, "PaperShuffleSound()");
     Common::String *s = g_private->getPaperShuffleSound();
     g_private->playSound(*s, 1, false, false);
 }
 
 void SoundEffect(ArgArray args) {
     // assert types
-    debug("SoundEffect(%s)", args[0].u.str);
+    debugC(1, kPrivateDebugScript, "SoundEffect(%s)", args[0].u.str);
     if (strcmp("\"\"", args[0].u.str) != 0) {
         Common::String *s = new Common::String(args[0].u.str);
         g_private->playSound(*s, 1, false, false);
@@ -437,7 +429,7 @@ void SoundEffect(ArgArray args) {
 
 void Sound(ArgArray args) {
     // assert types
-    debug("Sound(%s)", args[0].u.str);
+    debugC(1, kPrivateDebugScript, "Sound(%s)", args[0].u.str);
     if (args.size() == 4) {
         bool b1 = args[1].u.val;
         bool b2 = args[2].u.val;
@@ -463,7 +455,7 @@ void Sound(ArgArray args) {
 void LoopedSound(ArgArray args) {
     // assert types
     assert(args.size() == 1);
-    debug("LoopedSound(%s)", args[0].u.str);
+    debugC(1, kPrivateDebugScript, "LoopedSound(%s)", args[0].u.str);
     if (strcmp("\"\"", args[0].u.str) != 0) {
         Common::String *s = new Common::String(args[0].u.str);
         g_private->playSound(*s, 0, true, true);
@@ -476,19 +468,19 @@ void LoopedSound(ArgArray args) {
 
 void ViewScreen(ArgArray args) {
     // assert types
-    debug("WARNING: ViewScreen not implemented!");
+    debugC(1, kPrivateDebugScript, "WARNING: ViewScreen not implemented!");
 }
 
 void Transition(ArgArray args) {
     // assert types
-    debug("Transition(%s, %s)", args[0].u.str, args[1].u.str);
+    debugC(1, kPrivateDebugScript, "Transition(%s, %s)", args[0].u.str, args[1].u.str);
     g_private->_nextMovie = new Common::String(args[0].u.str);
     g_private->_nextSetting = new Common::String(args[1].u.str);
 }
 
 void Resume(ArgArray args) {
     // assert types
-    debug("Resume(%d)", args[0].u.val); // this value is always 1
+    debugC(1, kPrivateDebugScript, "Resume(%d)", args[0].u.val); // this value is always 1
     g_private->_nextSetting = g_private->_pausedSetting;
     g_private->_pausedSetting = NULL;
     g_private->_mode = 1;
@@ -497,7 +489,7 @@ void Resume(ArgArray args) {
 
 void Movie(ArgArray args) {
     // assert types
-    debug("Movie(%s, %s)", args[0].u.str, args[1].u.str);
+    debugC(1, kPrivateDebugScript, "Movie(%s, %s)", args[0].u.str, args[1].u.str);
     Common::String *movie = new Common::String(args[0].u.str);
     Common::String *nextSetting = new Common::String(args[1].u.str);
     bool isEmptyString = strcmp(args[0].u.str, "\"\"") == 0;
@@ -509,9 +501,9 @@ void Movie(ArgArray args) {
 
     } else if (isEmptyString) {
         g_private->_repeatedMovieExit = nextSetting;
-        debug("repeated movie exit is %s", nextSetting->c_str());
+        debugC(1, kPrivateDebugScript, "repeated movie exit is %s", nextSetting->c_str());
     } else {
-        debug("movie %s already played", movie->c_str());
+        debugC(1, kPrivateDebugScript, "movie %s already played", movie->c_str());
         g_private->_nextSetting = g_private->_repeatedMovieExit;
     }
     //g_private->_nextSetting = new Common::String(args[1].u.str);
@@ -521,7 +513,7 @@ void CRect(ArgArray args) {
     // assert types
     int x1, y1, x2, y2;
 
-    debug("CRect(%d, %d, %d, %d)", args[0].u.val, args[1].u.val, args[2].u.val, args[3].u.val);
+    debugC(1, kPrivateDebugScript, "CRect(%d, %d, %d, %d)", args[0].u.val, args[1].u.val, args[2].u.val, args[3].u.val);
 
     x1 = args[0].u.val;
     y1 = args[1].u.val;
@@ -549,7 +541,7 @@ void Bitmap(ArgArray args) {
         y = args[2].u.val;
     }
 
-    debug("Bitmap(%s, %d, %d)", f, x, y);
+    debugC(1, kPrivateDebugScript, "Bitmap(%s, %d, %d)", f, x, y);
     Common::String *s = new Common::String(args[0].u.str);
     g_private->loadImage(*s, x, y);
 }
@@ -569,7 +561,7 @@ void _Mask(ArgArray args, bool drawn) {
         y = args[4].u.val;
     }
 
-    debug("Mask(%s, %s, %s, %d, %d)", f, e, c->c_str(), x, y);
+    debugC(1, kPrivateDebugScript, "Mask(%s, %s, %s, %d, %d)", f, e, c->c_str(), x, y);
     const Common::String *s = new Common::String(f);
     //if (drawed)
     //    g_private->loadImage(*s, x, y);
@@ -617,7 +609,7 @@ void AddSound(char *s, char *t, Symbol *flag = NULL, int val = 0) {
     }
 
     else
-        debug("error: invalid sound type %s", t);
+        error("error: invalid sound type %s", t);
 }
 
 void AMRadioClip(ArgArray args) {
@@ -630,7 +622,7 @@ void PoliceClip(ArgArray args) {
 }
 void PhoneClip(ArgArray args) {
     if (args.size() == 2) {
-        debug("Unimplemented PhoneClip special case");
+        debugC(1, kPrivateDebugScript, "Unimplemented PhoneClip special case");
         return;
     }
     int i = args[2].u.val;
@@ -657,7 +649,7 @@ void SoundArea(ArgArray args) {
     else
         assert(0);
 
-    debug("SoundArea(%s, %s)", args[0].u.str, n);
+    debugC(1, kPrivateDebugScript, "SoundArea(%s, %s)", args[0].u.str, n);
     if (strcmp(n, "kAMRadio") == 0) {
         Common::String *s = new Common::String(args[0].u.str);
         MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
@@ -693,12 +685,12 @@ void SoundArea(ArgArray args) {
 
 void SafeDigit(ArgArray args) {
     // This is not needed, since scummvm will take care of this
-    debug("WARNING: SafeDigit is partially implemented");
+    debugC(1, kPrivateDebugScript, "WARNING: SafeDigit is not implemented");
 }
 
 void AskSave(ArgArray args) {
     // This is not needed, since scummvm will take care of this
-    debug("WARNING: AskSave is partially implemented");
+    debugC(1, kPrivateDebugScript, "WARNING: AskSave is partially implemented");
     Common::String *s = new Common::String(args[0].u.str);
     g_private->_nextSetting = s;
 }
@@ -707,9 +699,9 @@ void Timer(ArgArray args) {
     assert (args.size() == 2 || args.size() == 3);
 
     if (args.size() == 3)
-        debug("Timer(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.str);
+        debugC(1, kPrivateDebugScript, "Timer(%d, %s, %s)", args[0].u.val, args[1].u.str, args[2].u.str);
     else
-        debug("Timer(%d, %s)", args[0].u.val, args[1].u.str);
+        debugC(1, kPrivateDebugScript, "Timer(%d, %s)", args[0].u.val, args[1].u.str);
 
     //g_system->delayMillis(1000 * args[0].u.val);
     int32 delay = 1000000 * args[0].u.val;
@@ -805,8 +797,7 @@ void initFuncs() {
 void call(char *name, ArgArray args) {
     Common::String n(name);
     if (!_functions.contains(n)) {
-        debug("I don't know how to execute %s", name);
-        assert(0);
+        error("I don't know how to execute %s", name);
     }
 
     void (*func)(ArgArray) = (void (*)(ArgArray)) _functions.getVal(n);
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 9c5ac19349..513e1cb53a 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -57,6 +57,10 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     : Engine(syst), _gameDescription(gd) {
     _rnd = new Common::RandomSource("private");
 
+    DebugMan.addDebugChannel(kPrivateDebugFunction, "functions", "Function execution debug channel");
+    DebugMan.addDebugChannel(kPrivateDebugCode, "code", "Code execution debug channel");
+    DebugMan.addDebugChannel(kPrivateDebugScript, "script", "Script execution debug channel");
+
     g_private = this;
 
     _saveGameMask = NULL;
@@ -111,8 +115,6 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
 }
 
 PrivateEngine::~PrivateEngine() {
-    debug("PrivateEngine::~PrivateEngine");
-
     // Dispose your resources here
     delete _rnd;
 
@@ -144,7 +146,7 @@ Common::Error PrivateEngine::run() {
     }
 
     assert(file != NULL);
-    void *buf = malloc(file->size()+1);
+    char *buf = (char *)malloc(file->size()+1);
     file->read(buf, file->size()+1);
 
     // Initialize stuff
@@ -152,7 +154,7 @@ Common::Error PrivateEngine::run() {
     initFuncs();
     initCursors();
 
-    parse((char *) buf);
+    parse(buf);
     free(buf);
     delete file;
     assert(constants.size() > 0);
@@ -173,14 +175,11 @@ Common::Error PrivateEngine::run() {
     _compositeSurface->create(_screenW, _screenH, _pixelFormat);
     _compositeSurface->setTransparentColor(_transparentColor);
 
-    // Create debugger console. It requires GFX to be initialized
+    // Debugger console
     Console *console = new Console(this);
     setDebugger(console);
 
-    // Additional setup.
-    debug("PrivateEngine::init");
-
-    // Simple main event loop
+    // Main event loop
     Common::Event event;
     Common::Point mousePos;
     _videoDecoder = nullptr; //new Video::SmackerDecoder();
@@ -260,7 +259,8 @@ Common::Error PrivateEngine::run() {
 
         if (_videoDecoder) {
 
-            stopSound(true);
+            if (_videoDecoder->getCurFrame() == 0)
+                stopSound(true);
             if (_videoDecoder->endOfVideo()) {
                 _videoDecoder->close();
                 delete _videoDecoder;
@@ -274,7 +274,7 @@ Common::Error PrivateEngine::run() {
         if (_nextSetting != NULL) {
 
             removeTimer();
-            debug("Executing %s", _nextSetting->c_str());
+            debugC(1, kPrivateDebugFunction, "Executing %s", _nextSetting->c_str());
             clearAreas();
             _currentSetting = _nextSetting;
             loadSetting(_nextSetting);
@@ -346,7 +346,6 @@ void PrivateEngine::checkPoliceBust() {
 }
 
 bool PrivateEngine::cursorExit(Common::Point mousePos) {
-    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
     mousePos = mousePos - *_origin;
     if (mousePos.x < 0 || mousePos.y < 0)
         return false;
@@ -393,17 +392,14 @@ bool PrivateEngine::inMask(Graphics::ManagedSurface *surf, Common::Point mousePo
 
 
 bool PrivateEngine::cursorMask(Common::Point mousePos) {
-    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
     MaskInfo m;
     bool inside = false;
     for (MaskList::iterator it = _masks.begin(); it != _masks.end(); ++it) {
         m = *it;
 
         if (inMask(m.surf, mousePos)) {
-            //debug("Inside!");
             if (m.cursor != NULL) { // TODO: check this
                 inside = true;
-                //debug("Rendering cursor mask %s", m.cursor->c_str());
                 changeCursor(*m.cursor);
                 break;
             }
@@ -437,7 +433,6 @@ void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
 }
 
 void PrivateEngine::selectExit(Common::Point mousePos) {
-    //debug("Mousepos %d %d", mousePos.x, mousePos.y);
     mousePos = mousePos - *_origin;
     if (mousePos.x < 0 || mousePos.y < 0)
         return;
@@ -516,7 +511,6 @@ void PrivateEngine::selectAMRadioArea(Common::Point mousePos) {
     if (_AMRadio.empty())
         return;
 
-    debug("AMRadio");
     if (inMask(_AMRadioArea->surf, mousePos)) {
         Common::String sound = *_infaceRadioPath + "comm_/" + _AMRadio.back() + ".wav";
         playSound(sound.c_str(), 1, false, false);
@@ -532,7 +526,6 @@ void PrivateEngine::selectPoliceRadioArea(Common::Point mousePos) {
     if (_policeRadio.empty())
         return;
 
-    debug("PoliceRadio");
     if (inMask(_policeRadioArea->surf, mousePos)) {
         Common::String sound = *_infaceRadioPath + "police/" + _policeRadio.back() + ".wav";
         playSound(sound.c_str(), 1, false, false);
@@ -560,7 +553,6 @@ void PrivateEngine::selectPhoneArea(Common::Point mousePos) {
     if (_phone.empty())
         return;
 
-    debug("Phone");
     if (inMask(_phoneArea->surf, mousePos)) {
         PhoneInfo i = _phone.back();
         Common::String sound(*i.sound);
@@ -649,7 +641,7 @@ bool PrivateEngine::hasFeature(EngineFeature f) const {
 }
 
 void PrivateEngine::restartGame() {
-    debug("restartGame");
+    debugC(1, kPrivateDebugFunction, "restartGame");
 
     for (NameList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
         Private::Symbol *sym = variables.getVal(*it);
@@ -683,7 +675,7 @@ void PrivateEngine::restartGame() {
 
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
     Common::Serializer s(stream, nullptr);
-    debug("loadGameStream");
+    debugC(1, kPrivateDebugFunction, "loadGameStream");
     _nextSetting = &kStartGame;
     int val;
 
@@ -730,22 +722,18 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
 
     Common::String *sound;
     size = stream->readUint32LE();
-    debug("AMRadio size %d", size);
     _AMRadio.clear();
 
     for (uint32 i = 0; i < size; ++i) {
         sound = new Common::String(stream->readString());
-        debug("sound: %s", sound->c_str());
         _AMRadio.push_back(*sound);
     }
 
     size = stream->readUint32LE();
-    debug("policeRadio size %d", size);
     _policeRadio.clear();
 
     for (uint32 i = 0; i < size; ++i) {
         sound = new Common::String(stream->readString());
-        debug("sound: %s", sound->c_str());
         _policeRadio.push_back(*sound);
     }
 
@@ -781,12 +769,11 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
         _playedPhoneClips.setVal(*phone, true);
     }
 
-    //syncGameStream(s);
     return Common::kNoError;
 }
 
 Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool isAutosave) {
-    debug("saveGameStream %d", isAutosave);
+    debugC(1, kPrivateDebugFunction, "saveGameStream(%d)", isAutosave);
     if (isAutosave)
         return Common::kNoError;
 
@@ -882,7 +869,7 @@ Common::String PrivateEngine::convertPath(Common::String name) {
 }
 
 void PrivateEngine::playSound(const Common::String &name, uint loops, bool stopOthers, bool background) {
-    debugC(1, kPrivateDebug, "%s : %s", __FUNCTION__, name.c_str());
+    debugC(1, kPrivateDebugFunction, "%s(%s,%d,%d,%d)", __FUNCTION__, name.c_str(), loops, stopOthers, background);
 
     Common::File *file = new Common::File();
     Common::String path = convertPath(name);
@@ -909,8 +896,8 @@ void PrivateEngine::playSound(const Common::String &name, uint loops, bool stopO
 }
 
 void PrivateEngine::playVideo(const Common::String &name) {
-    debug("%s : %s", __FUNCTION__, name.c_str());
-    stopSound(true);
+    debugC(1, kPrivateDebugFunction, "%s(%s)", __FUNCTION__, name.c_str());
+    //stopSound(true);
     Common::File *file = new Common::File();
     Common::String path = convertPath(name);
 
@@ -930,7 +917,7 @@ void PrivateEngine::skipVideo() {
 }
 
 void PrivateEngine::stopSound(bool all) {
-    debugC(3, kPrivateDebug, "%s", __FUNCTION__);
+    debugC(1, kPrivateDebugFunction, "%s(%d)", __FUNCTION__, all);
 
     if (all) {
         _mixer->stopHandle(_fgSoundHandle);
@@ -941,7 +928,7 @@ void PrivateEngine::stopSound(bool all) {
 }
 
 void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
-    debugC(1, kPrivateDebug, "%s : %s", __FUNCTION__, name.c_str());
+    debugC(1, kPrivateDebugFunction, "%s(%s,%d,%d)", __FUNCTION__, name.c_str(), x, y);
     Common::File file;
     Common::String path = convertPath(name);
     if (!file.open(path))
@@ -970,7 +957,7 @@ void PrivateEngine::drawScreenFrame(Graphics::Surface *screen) {
 
 
 Graphics::ManagedSurface *PrivateEngine::loadMask(const Common::String &name, int x, int y, bool drawn) {
-    debugC(1, kPrivateDebug, "%s : %s", __FUNCTION__, name.c_str());
+    debugC(1, kPrivateDebugFunction, "%s(%s,%d,%d,%d)", __FUNCTION__, name.c_str(), x, y, drawn);
     Common::File file;
     Common::String path = convertPath(name);
     if (!file.open(path))
@@ -1111,7 +1098,7 @@ void PrivateEngine::loadLocations(Common::Rect *rect) {
             offset = offset + 22;
             char *f = (char*)malloc(32*sizeof(char));
             snprintf(f, 32, "dryloc%d.bmp", i);
-            debug("%s, %d, %d", f, i, offset);
+            //debug("%s, %d, %d", f, i, offset);
             Common::String s(*_diaryLocPrefix + f);
             //debug("%hd %hd", rect->left, rect->top + offset);
             loadMask(s, rect->left + 120, rect->top + offset, true);
diff --git a/engines/private/private.h b/engines/private/private.h
index 9807a68e0e..8d48349905 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -52,7 +52,12 @@ namespace Private {
 
 class Console;
 
-const uint kPrivateDebug = 1;
+// debug channels
+enum {
+    kPrivateDebugFunction = 1 << 0,
+    kPrivateDebugCode = 1 << 1,
+    kPrivateDebugScript = 1 << 2
+};
 
 // sounds
 


Commit: b40e1e2467425a6a7ed1538965a1eb318cfdbb38
    https://github.com/scummvm/scummvm/commit/b40e1e2467425a6a7ed1538965a1eb318cfdbb38
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: removed old debug code

Changed paths:
    engines/private/code.cpp
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 7f589bbbb2..c7029de5ca 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -94,17 +94,6 @@ void loadSetting(Common::String *name) {
 
     stackp = stack;
     progp = prog;
-
-    /*for (Inst *pc_ = progp; pc_-progp < 100; pc_++) {
-        if (_functions.contains((void *) *pc_))
-            debug("%p: %s", (void*) pc_, _functions.getVal((void*) *pc_)->c_str());
-        else if ( (Inst *) *pc_ >= progp && (Inst *) *pc_ <= (progp + NPROG))
-            debug("%p: %p", (void*) pc_, (void*) *pc_);
-        else {
-            debugN("%p:", (void*) pc_);
-            showSymbol((Symbol *) *pc_);
-        }
-    }*/
 }
 
 /* push d onto stack */
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 9384bad614..c487126adf 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "common/debug.h"
+#include "private/private.h"
 #include "private/grammar.h"
 #include "private/grammar.tab.h"
 
@@ -42,13 +43,13 @@ void defineSymbol(char *n, Common::Rect *r) {
 
 void showSymbol(Symbol *s) {
     if (s->type == NUM)
-        debug("%s %d",s->name->c_str(), s->u.val);
+        debugC(1, kPrivateDebugCode, "%s %d",s->name->c_str(), s->u.val);
     else if (s->type == STRING)
-        debug("%s %s", s->name->c_str(), s->u.str);
+        debugC(1, kPrivateDebugCode, "%s %s", s->name->c_str(), s->u.str);
     else if (s->type == NAME)
-        debug("%s %d",s->name->c_str(), s->type);
+        debugC(1, kPrivateDebugCode, "%s %d",s->name->c_str(), s->type);
     else
-        debug("%s %d", s->name->c_str(), s->type);
+        debugC(1, kPrivateDebugCode, "%s %d", s->name->c_str(), s->type);
 }
 
 void setSymbol(Symbol *s, int v) {
@@ -82,7 +83,7 @@ Symbol *lookupName(char *n) {
         return lookup(*s, rects);
 
     else {
-        debug("WARNING: %s not defined", s->c_str());
+        debugC(1, kPrivateDebugCode, "WARNING: %s not defined", s->c_str());
         return constant(STRING, 0, (char*) s->c_str());
     }
 


Commit: 23fe6b9b733971cb970c33068f0119075f2c4070
    https://github.com/scummvm/scummvm/commit/23fe6b9b733971cb970c33068f0119075f2c4070
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: explicit conversion to bool

Changed paths:
    engines/private/funcs.cpp


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 401af3c9c6..8d18406d91 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -405,7 +405,7 @@ void Exit(ArgArray args) {
 void SetModifiedFlag(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "SetModifiedFlag(%d)", args[0].u.val);
-    g_private->_modified = (bool) args[0].u.val;
+    g_private->_modified = args[0].u.val != 0;
 }
 
 void PaperShuffleSound(ArgArray args) {
@@ -431,8 +431,8 @@ void Sound(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "Sound(%s)", args[0].u.str);
     if (args.size() == 4) {
-        bool b1 = args[1].u.val;
-        bool b2 = args[2].u.val;
+        bool b1 = args[1].u.val != 0;
+        bool b2 = args[2].u.val != 0;
         int c = args[3].u.val;
 
         if (!b1 && !b2 && c == 1) {


Commit: dbf7085a79380d1c72d9d5d5b7370bf1110acf9f
    https://github.com/scummvm/scummvm/commit/dbf7085a79380d1c72d9d5d5b7370bf1110acf9f
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: clean up grammar.l to remove unused code and imports

Changed paths:
    engines/private/grammar.l
    engines/private/lex.yy.cpp


diff --git a/engines/private/grammar.l b/engines/private/grammar.l
index be6f411c9f..16d399a439 100644
--- a/engines/private/grammar.l
+++ b/engines/private/grammar.l
@@ -1,3 +1,25 @@
+/* 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
 %option noinput
 %option never-interactive
@@ -7,10 +29,8 @@
 %{
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
 
-#include <stdio.h>
-#include <string.h>
-#include "grammar.h"
-#include "grammar.tab.h"
+#include "private/grammar.h"
+#include "private/grammar.tab.h"
 
 %}
 
@@ -33,31 +53,23 @@ NULL                    return NULLTOK;
 Random                  return RANDOMTOK;
 [A-Za-z_][A-Za-z_0-9]*  yylval.s = strdup(yytext); return NAME;
 [\-]?[0-9]+             yylval.sym = Private::constant(NUM, atoi(yytext), NULL); return NUM;
-\"[^\"\r\n]*\"          yylval.sym = Private::constant(STRING, 0, strdup(yytext)); return STRING;
+\"[^\"\r\n]*\"          yylval.sym = Private::constant(STRING, 0, scumm_strdup(yytext)); return STRING;
 [\r|\n]+                /* ignore return */;
 [ \t]+                  /* ignore whitespace */;
 .                       return *yytext;
 %%
 
-extern int yydebug;
-
 namespace Private {
 
 int parse(char *code) {
-	
-	initSetting();
-
-	YY_BUFFER_STATE bp;
-
-	yydebug = 1;
-	yy_delete_buffer(YY_CURRENT_BUFFER);
-
-	bp = yy_scan_string(code);
-	yy_switch_to_buffer(bp);
-	yyparse();
-	yy_delete_buffer(bp);
-
-	return 0;
+    initSetting();
+    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;
 }
 
 } // End of namespace Private
diff --git a/engines/private/lex.yy.cpp b/engines/private/lex.yy.cpp
index 65b57ff5f9..89d79d95ee 100644
--- a/engines/private/lex.yy.cpp
+++ b/engines/private/lex.yy.cpp
@@ -34,7 +34,7 @@
 #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.
+ * if you want the limit (max/min) macros for int types. 
  */
 #ifndef __STDC_LIMIT_MACROS
 #define __STDC_LIMIT_MACROS 1
@@ -51,7 +51,7 @@ typedef uint32_t flex_uint32_t;
 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 char flex_uint8_t; 
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
 
@@ -162,10 +162,10 @@ 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)
-#define YY_LINENO_REWIND_TO(ptr)
-
+    
+    #define YY_LESS_LINENO(n)
+    #define YY_LINENO_REWIND_TO(ptr)
+    
 /* Return all but the first "n" matched characters back to the input stream. */
 #define yyless(n) \
 	do \
@@ -184,66 +184,66 @@ extern FILE *yyin, *yyout;
 #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.
-     */
-    int yy_buf_size;
-
-    /* Number of characters read into yy_ch_buf, not including EOB
-     * characters.
-     */
-    int 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;
+	{
+	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.
+	 */
+	int yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	int 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;
+	/* Whether to try to fill the input buffer when we reach the
+	 * end of it.
+	 */
+	int yy_fill_buffer;
 
-    int yy_buffer_status;
+	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.
-     */
+	/* 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. */
@@ -360,125 +360,125 @@ static void yynoreturn yy_fatal_error ( const char* msg  );
 /* 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;
-};
+	{
+	flex_int32_t yy_verify;
+	flex_int32_t yy_nxt;
+	};
 static const flex_int16_t yy_accept[78] =
-{   0,
-    0,    0,   24,   22,   21,   20,   20,   22,   22,   22,
-    22,   18,   22,   22,   22,   17,   17,   17,   17,   17,
-    17,   17,   17,   17,   17,   21,   20,    4,    0,   19,
-    18,    1,    2,    5,    3,   17,   17,   17,   17,   17,
-    17,   17,   17,   17,    9,   17,    1,   17,   17,   17,
-    17,   17,   17,   17,   17,   17,   17,   17,   15,   12,
-    17,   14,   17,   17,   10,   11,   17,   13,   17,    6,
-    17,   17,   16,    7,   17,    8,    0
-} ;
+    {   0,
+        0,    0,   24,   22,   21,   20,   20,   22,   22,   22,
+       22,   18,   22,   22,   22,   17,   17,   17,   17,   17,
+       17,   17,   17,   17,   17,   21,   20,    4,    0,   19,
+       18,    1,    2,    5,    3,   17,   17,   17,   17,   17,
+       17,   17,   17,   17,    9,   17,    1,   17,   17,   17,
+       17,   17,   17,   17,   17,   17,   17,   17,   15,   12,
+       17,   14,   17,   17,   10,   11,   17,   13,   17,    6,
+       17,   17,   16,    7,   17,    8,    0
+    } ;
 
 static const YY_CHAR yy_ec[256] =
-{   0,
-    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,    2,    5,    6,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    7,    1,    8,    9,    9,    9,
-    9,    9,    9,    9,    9,    9,    9,    1,    1,   10,
-    11,   12,    1,    1,   13,   14,   15,   14,   16,   17,
-    14,   14,   14,   14,   14,   18,   14,   19,   14,   14,
-    14,   20,   21,   22,   23,   14,   14,   14,   14,   14,
-    1,    1,    1,    1,   14,    1,   24,   25,   14,   26,
-
-    27,   28,   29,   14,   30,   14,   14,   31,   32,   33,
-    34,   14,   14,   14,   35,   36,   37,   14,   14,   14,
-    14,   14,    1,   38,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-    1,    1,    1,    1,    1
-} ;
+    {   0,
+        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,    2,    5,    6,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    7,    1,    8,    9,    9,    9,
+        9,    9,    9,    9,    9,    9,    9,    1,    1,   10,
+       11,   12,    1,    1,   13,   14,   15,   14,   16,   17,
+       14,   14,   14,   14,   14,   18,   14,   19,   14,   14,
+       14,   20,   21,   22,   23,   14,   14,   14,   14,   14,
+        1,    1,    1,    1,   14,    1,   24,   25,   14,   26,
+
+       27,   28,   29,   14,   30,   14,   14,   31,   32,   33,
+       34,   14,   14,   14,   35,   36,   37,   14,   14,   14,
+       14,   14,    1,   38,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    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 const YY_CHAR yy_meta[39] =
-{   0,
-    1,    1,    2,    3,    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,    1
-} ;
+    {   0,
+        1,    1,    2,    3,    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,    1
+    } ;
 
 static const flex_int16_t yy_base[81] =
-{   0,
-    0,    0,  105,  106,  102,   36,   38,   92,   96,   92,
-    92,   90,   87,   86,   85,    0,   82,   71,   27,   73,
-    65,   60,   56,   61,   61,   83,   41,  106,   76,  106,
-    72,    0,  106,  106,  106,    0,   60,   59,   60,   40,
-    49,   21,   36,   34,    0,   33,    0,   47,   49,   44,
-    39,   48,   26,   32,   34,   26,   23,   42,    0,    0,
-    23,    0,   27,   22,    0,    0,   24,    0,   21,    0,
-    25,   17,    0,    0,   19,    0,  106,   79,   43,   83
-} ;
+    {   0,
+        0,    0,  105,  106,  102,   36,   38,   92,   96,   92,
+       92,   90,   87,   86,   85,    0,   82,   71,   27,   73,
+       65,   60,   56,   61,   61,   83,   41,  106,   76,  106,
+       72,    0,  106,  106,  106,    0,   60,   59,   60,   40,
+       49,   21,   36,   34,    0,   33,    0,   47,   49,   44,
+       39,   48,   26,   32,   34,   26,   23,   42,    0,    0,
+       23,    0,   27,   22,    0,    0,   24,    0,   21,    0,
+       25,   17,    0,    0,   19,    0,  106,   79,   43,   83
+    } ;
 
 static const flex_int16_t yy_def[81] =
-{   0,
-    77,    1,   77,   77,   77,   77,   77,   77,   78,   77,
-    77,   77,   77,   77,   77,   79,   79,   79,   79,   79,
-    79,   79,   79,   79,   79,   77,   77,   77,   78,   77,
-    77,   80,   77,   77,   77,   79,   79,   79,   79,   79,
-    79,   79,   79,   79,   79,   79,   80,   79,   79,   79,
-    79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
-    79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
-    79,   79,   79,   79,   79,   79,    0,   77,   77,   77
-} ;
+    {   0,
+       77,    1,   77,   77,   77,   77,   77,   77,   78,   77,
+       77,   77,   77,   77,   77,   79,   79,   79,   79,   79,
+       79,   79,   79,   79,   79,   77,   77,   77,   78,   77,
+       77,   80,   77,   77,   77,   79,   79,   79,   79,   79,
+       79,   79,   79,   79,   79,   79,   80,   79,   79,   79,
+       79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
+       79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
+       79,   79,   79,   79,   79,   79,    0,   77,   77,   77
+    } ;
 
 static const flex_int16_t yy_nxt[145] =
-{   0,
-    4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
-    14,   15,   16,   16,   16,   16,   17,   16,   18,   19,
-    16,   20,   16,   16,   16,   21,   22,   16,   23,   24,
-    16,   16,   16,   16,   25,   16,   16,    7,   27,   27,
-    27,   27,   39,   27,   27,   53,   36,   76,   54,   75,
-    40,   74,   73,   72,   71,   70,   69,   68,   67,   66,
-    65,   64,   63,   62,   61,   60,   59,   58,   57,   56,
-    55,   52,   51,   27,   50,   27,   49,   48,   27,   29,
-    31,   30,   29,   47,   26,   47,   47,   46,   45,   44,
-    43,   42,   41,   38,   37,   35,   34,   33,   31,   32,
-
-    31,   30,   28,   26,   77,    3,   77,   77,   77,   77,
-    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-    77,   77,   77,   77
-} ;
+    {   0,
+        4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
+       14,   15,   16,   16,   16,   16,   17,   16,   18,   19,
+       16,   20,   16,   16,   16,   21,   22,   16,   23,   24,
+       16,   16,   16,   16,   25,   16,   16,    7,   27,   27,
+       27,   27,   39,   27,   27,   53,   36,   76,   54,   75,
+       40,   74,   73,   72,   71,   70,   69,   68,   67,   66,
+       65,   64,   63,   62,   61,   60,   59,   58,   57,   56,
+       55,   52,   51,   27,   50,   27,   49,   48,   27,   29,
+       31,   30,   29,   47,   26,   47,   47,   46,   45,   44,
+       43,   42,   41,   38,   37,   35,   34,   33,   31,   32,
+
+       31,   30,   28,   26,   77,    3,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77
+    } ;
 
 static const flex_int16_t yy_chk[145] =
-{   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,    6,    6,
-    7,    7,   19,   27,   27,   42,   79,   75,   42,   72,
-    19,   71,   69,   67,   64,   63,   61,   58,   57,   56,
-    55,   54,   53,   52,   51,   50,   49,   48,   46,   44,
-    43,   41,   40,    6,   39,    7,   38,   37,   27,   78,
-    31,   29,   78,   80,   26,   80,   80,   25,   24,   23,
-    22,   21,   20,   18,   17,   15,   14,   13,   12,   11,
-
-    10,    9,    8,    5,    3,   77,   77,   77,   77,   77,
-    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-    77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-    77,   77,   77,   77
-} ;
+    {   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,    6,    6,
+        7,    7,   19,   27,   27,   42,   79,   75,   42,   72,
+       19,   71,   69,   67,   64,   63,   61,   58,   57,   56,
+       55,   54,   53,   52,   51,   50,   49,   48,   46,   44,
+       43,   41,   40,    6,   39,    7,   38,   37,   27,   78,
+       31,   29,   78,   80,   26,   80,   80,   25,   24,   23,
+       22,   21,   20,   18,   17,   15,   14,   13,   12,   11,
+
+       10,    9,    8,    5,    3,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77
+    } ;
 
 static yy_state_type yy_last_accepting_state;
 static char *yy_last_accepting_cpos;
@@ -495,17 +495,36 @@ int yy_flex_debug = 0;
 #define YY_RESTORE_YY_MORE_OFFSET
 char *yytext;
 #line 1 "engines/private/grammar.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.
+ *
+ */
 #define YY_NO_INPUT 1
-#line 8 "engines/private/grammar.l"
+#line 30 "engines/private/grammar.l"
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
 
-#include <stdio.h>
-#include <string.h>
-#include "grammar.h"
-#include "grammar.tab.h"
+#include "private/grammar.h"
+#include "private/grammar.tab.h"
 
-#line 507 "engines/private/lex.yy.cpp"
-#line 508 "engines/private/lex.yy.cpp"
+#line 526 "engines/private/lex.yy.cpp"
+#line 527 "engines/private/lex.yy.cpp"
 
 #define INITIAL 0
 
@@ -544,7 +563,7 @@ FILE *yyget_out ( void );
 
 void yyset_out  ( FILE * _out_str  );
 
-int yyget_leng ( void );
+			int yyget_leng ( void );
 
 char *yyget_text ( void );
 
@@ -565,9 +584,9 @@ extern int yywrap ( void );
 #endif
 
 #ifndef YY_NO_UNPUT
-
-static void yyunput ( int c, char *buf_ptr  );
-
+    
+    static void yyunput ( int c, char *buf_ptr  );
+    
 #endif
 
 #ifndef yytext_ptr
@@ -691,344 +710,341 @@ extern int yylex (void);
  */
 YY_DECL
 {
-    yy_state_type yy_current_state;
-    char *yy_cp, *yy_bp;
-    int yy_act;
-
-    if ( !(yy_init) )
-    {
-        (yy_init) = 1;
+	yy_state_type yy_current_state;
+	char *yy_cp, *yy_bp;
+	int yy_act;
+    
+	if ( !(yy_init) )
+		{
+		(yy_init) = 1;
 
 #ifdef YY_USER_INIT
-        YY_USER_INIT;
+		YY_USER_INIT;
 #endif
 
-        if ( ! (yy_start) )
-            (yy_start) = 1;	/* first start state */
+		if ( ! (yy_start) )
+			(yy_start) = 1;	/* first start state */
 
-        if ( ! yyin )
-            yyin = stdin;
+		if ( ! yyin )
+			yyin = stdin;
 
-        if ( ! yyout )
-            yyout = stdout;
+		if ( ! yyout )
+			yyout = stdout;
 
-        if ( ! YY_CURRENT_BUFFER ) {
-            yyensure_buffer_stack ();
-            YY_CURRENT_BUFFER_LVALUE =
-            yy_create_buffer( yyin, YY_BUF_SIZE );
-        }
+		if ( ! YY_CURRENT_BUFFER ) {
+			yyensure_buffer_stack ();
+			YY_CURRENT_BUFFER_LVALUE =
+				yy_create_buffer( yyin, YY_BUF_SIZE );
+		}
 
-        yy_load_buffer_state(  );
-    }
+		yy_load_buffer_state(  );
+		}
 
-    {
-#line 17 "engines/private/grammar.l"
+	{
+#line 37 "engines/private/grammar.l"
 
-#line 727 "engines/private/lex.yy.cpp"
+#line 746 "engines/private/lex.yy.cpp"
 
-        while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
-        {
-            yy_cp = (yy_c_buf_p);
+	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
+		{
+		yy_cp = (yy_c_buf_p);
 
-            /* Support of yytext. */
-            *yy_cp = (yy_hold_char);
+		/* 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_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_current_state = (yy_start);
 yy_match:
-            do
-            {
-                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 >= 78 )
-                        yy_c = yy_meta[yy_c];
-                }
-                yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-                ++yy_cp;
-            }
-            while ( yy_current_state != 77 );
-            yy_cp = (yy_last_accepting_cpos);
-            yy_current_state = (yy_last_accepting_state);
+		do
+			{
+			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 >= 78 )
+					yy_c = yy_meta[yy_c];
+				}
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+			++yy_cp;
+			}
+		while ( yy_current_state != 77 );
+		yy_cp = (yy_last_accepting_cpos);
+		yy_current_state = (yy_last_accepting_state);
 
 yy_find_action:
-            yy_act = yy_accept[yy_current_state];
+		yy_act = yy_accept[yy_current_state];
 
-            YY_DO_BEFORE_ACTION;
+		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 18 "engines/private/grammar.l"
-                /* ignoring the comment */
-                YY_BREAK
-            case 2:
-                YY_RULE_SETUP
-#line 19 "engines/private/grammar.l"
-                return LTE;
-                YY_BREAK
-            case 3:
-                YY_RULE_SETUP
-#line 20 "engines/private/grammar.l"
-                return GTE;
-                YY_BREAK
-            case 4:
-                YY_RULE_SETUP
-#line 21 "engines/private/grammar.l"
-                return NEQ;
-                YY_BREAK
-            case 5:
-                YY_RULE_SETUP
-#line 22 "engines/private/grammar.l"
-                return EQ;
-                YY_BREAK
-            case 6:
-                YY_RULE_SETUP
-#line 23 "engines/private/grammar.l"
-                return DEBUGTOK;
-                YY_BREAK
-            case 7:
-                YY_RULE_SETUP
-#line 24 "engines/private/grammar.l"
-                return DEFINETOK;
-                YY_BREAK
-            case 8:
-                YY_RULE_SETUP
-#line 25 "engines/private/grammar.l"
-                return SETTINGTOK;
-                YY_BREAK
-            case 9:
-                YY_RULE_SETUP
-#line 26 "engines/private/grammar.l"
-                return IFTOK;
-                YY_BREAK
-            case 10:
-                YY_RULE_SETUP
-#line 27 "engines/private/grammar.l"
-                return ELSETOK;
-                YY_BREAK
-            case 11:
-                YY_RULE_SETUP
-#line 28 "engines/private/grammar.l"
-                return GOTOTOK;
-                YY_BREAK
-            case 12:
-                YY_RULE_SETUP
-#line 29 "engines/private/grammar.l"
-                return RECT;
-                YY_BREAK
-            case 13:
-                YY_RULE_SETUP
-#line 30 "engines/private/grammar.l"
-                return FALSETOK;
-                YY_BREAK
-            case 14:
-                YY_RULE_SETUP
-#line 31 "engines/private/grammar.l"
-                return TRUETOK;
-                YY_BREAK
-            case 15:
-                YY_RULE_SETUP
-#line 32 "engines/private/grammar.l"
-                return NULLTOK;
-                YY_BREAK
-            case 16:
-                YY_RULE_SETUP
-#line 33 "engines/private/grammar.l"
-                return RANDOMTOK;
-                YY_BREAK
-            case 17:
-                YY_RULE_SETUP
-#line 34 "engines/private/grammar.l"
-                yylval.s = strdup(yytext);
-                return NAME;
-                YY_BREAK
-            case 18:
-                YY_RULE_SETUP
-#line 35 "engines/private/grammar.l"
-                yylval.sym = Private::constant(NUM, atoi(yytext), NULL);
-                return NUM;
-                YY_BREAK
-            case 19:
-                YY_RULE_SETUP
-#line 36 "engines/private/grammar.l"
-                yylval.sym = Private::constant(STRING, 0, strdup(yytext));
-                return STRING;
-                YY_BREAK
-            case 20:
-                /* rule 20 can match eol */
-                YY_RULE_SETUP
-#line 37 "engines/private/grammar.l"
-                /* ignore return */;
-                YY_BREAK
-            case 21:
-                YY_RULE_SETUP
+		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 38 "engines/private/grammar.l"
-                /* ignore whitespace */;
-                YY_BREAK
-            case 22:
-                YY_RULE_SETUP
+/* ignoring the comment */
+	YY_BREAK
+case 2:
+YY_RULE_SETUP
 #line 39 "engines/private/grammar.l"
-                return *yytext;
-                YY_BREAK
-            case 23:
-                YY_RULE_SETUP
+return LTE;
+	YY_BREAK
+case 3:
+YY_RULE_SETUP
 #line 40 "engines/private/grammar.l"
-                ECHO;
-                YY_BREAK
-#line 896 "engines/private/lex.yy.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_last_accepting_cpos);
-                        yy_current_state = (yy_last_accepting_state);
-                        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 user's declarations */
+return GTE;
+	YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 41 "engines/private/grammar.l"
+return NEQ;
+	YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 42 "engines/private/grammar.l"
+return EQ;
+	YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 43 "engines/private/grammar.l"
+return DEBUGTOK;
+	YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 44 "engines/private/grammar.l"
+return DEFINETOK;
+	YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 45 "engines/private/grammar.l"
+return SETTINGTOK;
+	YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 46 "engines/private/grammar.l"
+return IFTOK;
+	YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 47 "engines/private/grammar.l"
+return ELSETOK;
+	YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 48 "engines/private/grammar.l"
+return GOTOTOK;
+	YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 49 "engines/private/grammar.l"
+return RECT;
+	YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 50 "engines/private/grammar.l"
+return FALSETOK;
+	YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 51 "engines/private/grammar.l"
+return TRUETOK;
+	YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 52 "engines/private/grammar.l"
+return NULLTOK;
+	YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 53 "engines/private/grammar.l"
+return RANDOMTOK;
+	YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 54 "engines/private/grammar.l"
+yylval.s = strdup(yytext); return NAME;
+	YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 55 "engines/private/grammar.l"
+yylval.sym = Private::constant(NUM, atoi(yytext), NULL); return NUM;
+	YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 56 "engines/private/grammar.l"
+yylval.sym = Private::constant(STRING, 0, scumm_strdup(yytext)); return STRING;
+	YY_BREAK
+case 20:
+/* rule 20 can match eol */
+YY_RULE_SETUP
+#line 57 "engines/private/grammar.l"
+/* ignore return */;
+	YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 58 "engines/private/grammar.l"
+/* ignore whitespace */;
+	YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 59 "engines/private/grammar.l"
+return *yytext;
+	YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 60 "engines/private/grammar.l"
+ECHO;
+	YY_BREAK
+#line 915 "engines/private/lex.yy.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_last_accepting_cpos);
+				yy_current_state = (yy_last_accepting_state);
+				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 user's declarations */
 } /* end of yylex */
 
 /* yy_get_next_buffer - try to read in a new buffer
@@ -1040,167 +1056,167 @@ do_action:	/* This label is used only to access EOF actions. */
  */
 static int yy_get_next_buffer (void)
 {
-    char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
-    char *source = (yytext_ptr);
-    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
-    {
-        int 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_LVALUE;
-
-            int yy_c_buf_p_offset =
-                (int) ((yy_c_buf_p) - b->yy_ch_buf);
-
-            if ( b->yy_is_our_buffer )
-            {
-                int 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,
-                                          (yy_size_t) (b->yy_buf_size + 2)  );
-            }
-            else
-                /* Can't grow it, we don't own it. */
-                b->yy_ch_buf = NULL;
-
-            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_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
-        /* Extend the array by 50%, plus the number we really need. */
-        int 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, (yy_size_t) new_size  );
-        if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-            YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
-        /* "- 2" to take care of EOB's */
-        YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
-    }
+    	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+	char *source = (yytext_ptr);
+	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
+		{
+			int 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_LVALUE;
+
+			int yy_c_buf_p_offset =
+				(int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+			if ( b->yy_is_our_buffer )
+				{
+				int 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,
+							 (yy_size_t) (b->yy_buf_size + 2)  );
+				}
+			else
+				/* Can't grow it, we don't own it. */
+				b->yy_ch_buf = NULL;
+
+			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_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+		/* Extend the array by 50%, plus the number we really need. */
+		int 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, (yy_size_t) new_size  );
+		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+		/* "- 2" to take care of EOB's */
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
+	}
 
-    (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;
+	(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];
+	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
 
-    return ret_val;
+	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)
+    static yy_state_type yy_get_previous_state (void)
 {
-    yy_state_type yy_current_state;
-    char *yy_cp;
-
-    yy_current_state = (yy_start);
-
-    for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
-    {
-        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 >= 78 )
-                yy_c = yy_meta[yy_c];
-        }
-        yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-    }
-
-    return yy_current_state;
+	yy_state_type yy_current_state;
+	char *yy_cp;
+    
+	yy_current_state = (yy_start);
+
+	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+		{
+		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 >= 78 )
+				yy_c = yy_meta[yy_c];
+			}
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+		}
+
+	return yy_current_state;
 }
 
 /* yy_try_NUL_trans - try to make a transition on the NUL character
@@ -1208,359 +1224,359 @@ static yy_state_type yy_get_previous_state (void)
  * synopsis
  *	next_state = yy_try_NUL_trans( current_state );
  */
-static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
+    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
 {
-    int yy_is_jam;
-    char *yy_cp = (yy_c_buf_p);
-
-    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 >= 78 )
-            yy_c = yy_meta[yy_c];
-    }
-    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-    yy_is_jam = (yy_current_state == 77);
-
-    return yy_is_jam ? 0 : yy_current_state;
+	int yy_is_jam;
+    	char *yy_cp = (yy_c_buf_p);
+
+	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 >= 78 )
+			yy_c = yy_meta[yy_c];
+		}
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+	yy_is_jam = (yy_current_state == 77);
+
+		return yy_is_jam ? 0 : yy_current_state;
 }
 
 #ifndef YY_NO_UNPUT
 
-static void yyunput (int c, char * yy_bp )
+    static void yyunput (int c, char * yy_bp )
 {
-    char *yy_cp;
-
+	char *yy_cp;
+    
     yy_cp = (yy_c_buf_p);
 
-    /* undo effects of setting up yytext */
-    *yy_cp = (yy_hold_char);
+	/* 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. */
-        int number_to_move = (yy_n_chars) + 2;
-        char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
-                  YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
-        char *source =
-            &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+		{ /* need to shift things up to make room */
+		/* +2 for EOB chars. */
+		int number_to_move = (yy_n_chars) + 2;
+		char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+		char *source =
+				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
 
-        while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-            *--dest = *--source;
+		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) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+		yy_cp += (int) (dest - source);
+		yy_bp += (int) (dest - source);
+		YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
+			(yy_n_chars) = (int) 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" );
-    }
+		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+			YY_FATAL_ERROR( "flex scanner push-back overflow" );
+		}
 
-    *--yy_cp = (char) c;
+	*--yy_cp = (char) c;
 
-    (yytext_ptr) = yy_bp;
-    (yy_hold_char) = *yy_cp;
-    (yy_c_buf_p) = yy_cp;
+	(yytext_ptr) = yy_bp;
+	(yy_hold_char) = *yy_cp;
+	(yy_c_buf_p) = yy_cp;
 }
 
 #endif
 
 #ifndef YY_NO_INPUT
 #ifdef __cplusplus
-static int yyinput (void)
+    static int yyinput (void)
 #else
-static int input  (void)
+    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 */
-            int offset = (int) ((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;
+	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 */
+			int offset = (int) ((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();
+					return yyinput();
 #else
-                return input();
+					return input();
 #endif
-            }
+					}
 
-            case EOB_ACT_CONTINUE_SCAN:
-                (yy_c_buf_p) = (yytext_ptr) + offset;
-                break;
-            }
-        }
-    }
+				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);
+	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;
+	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 )
+    void yyrestart  (FILE * input_file )
 {
-
-    if ( ! YY_CURRENT_BUFFER ) {
+    
+	if ( ! YY_CURRENT_BUFFER ){
         yyensure_buffer_stack ();
-        YY_CURRENT_BUFFER_LVALUE =
+		YY_CURRENT_BUFFER_LVALUE =
             yy_create_buffer( yyin, YY_BUF_SIZE );
-    }
+	}
 
-    yy_init_buffer( YY_CURRENT_BUFFER, input_file );
-    yy_load_buffer_state(  );
+	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 )
+    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);
+    
+	/* 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;
+	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);
+    	(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 yy_create_buffer  (FILE * file, int  size )
 {
-    YY_BUFFER_STATE b;
+	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_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;
 
-    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( (yy_size_t) (b->yy_buf_size + 2)  );
+	if ( ! b->yy_ch_buf )
+		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
 
-    /* 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( (yy_size_t) (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;
+	b->yy_is_our_buffer = 1;
 
-    yy_init_buffer( b, file );
+	yy_init_buffer( b, file );
 
-    return b;
+	return b;
 }
 
 /** Destroy the buffer.
  * @param b a buffer created with yy_create_buffer()
- *
+ * 
  */
-void yy_delete_buffer (YY_BUFFER_STATE  b )
+    void yy_delete_buffer (YY_BUFFER_STATE  b )
 {
+    
+	if ( ! b )
+		return;
 
-    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_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  );
+	if ( b->yy_is_our_buffer )
+		yyfree( (void *) b->yy_ch_buf  );
 
-    yyfree( (void *) b  );
+	yyfree( (void *) b  );
 }
 
 /* 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 )
+    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
 
 {
-    int oerrno = errno;
+	int oerrno = errno;
+    
+	yy_flush_buffer( b );
 
-    yy_flush_buffer( b );
-
-    b->yy_input_file = file;
-    b->yy_fill_buffer = 1;
+	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) {
+    if (b != YY_CURRENT_BUFFER){
         b->yy_bs_lineno = 1;
         b->yy_bs_column = 0;
     }
 
-    b->yy_is_interactive = 0;
-
-    errno = oerrno;
+        b->yy_is_interactive = 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 )
+    void yy_flush_buffer (YY_BUFFER_STATE  b )
 {
-    if ( ! b )
-        return;
+    	if ( ! b )
+		return;
 
-    b->yy_n_chars = 0;
+	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;
+	/* 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_buf_pos = &b->yy_ch_buf[0];
 
-    b->yy_at_bol = 1;
-    b->yy_buffer_status = YY_BUFFER_NEW;
+	b->yy_at_bol = 1;
+	b->yy_buffer_status = YY_BUFFER_NEW;
 
-    if ( b == YY_CURRENT_BUFFER )
-        yy_load_buffer_state(  );
+	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;
+    	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;
+    	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);
+	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;
-    }
+	if (YY_CURRENT_BUFFER) {
+		yy_load_buffer_state(  );
+		(yy_did_buffer_switch_on_eof) = 1;
+	}
 }
 
 /* Allocates the stack if it does not exist.
@@ -1568,131 +1584,131 @@ void yypop_buffer_state (void)
  */
 static void yyensure_buffer_stack (void)
 {
-    yy_size_t num_to_alloc;
+	yy_size_t num_to_alloc;
+    
+	if (!(yy_buffer_stack)) {
 
-    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.
+		/* 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; /* After all that talk, this was set to 1 anyways... */
-        (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;
-    }
+      num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
+		(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) {
+	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
 
-        /* Increase the buffer to prepare for a possible push. */
-        yy_size_t grow_size = 8 /* arbitrary grow size */;
+		/* Increase the buffer to prepare for a possible push. */
+		yy_size_t 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()" );
+		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;
-    }
+		/* 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 NULL;
-
-    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 = (int) (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 = NULL;
-    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;
+	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 NULL;
+
+	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 = (int) (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 = NULL;
+	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 (const char * yystr )
 {
-
-    return yy_scan_bytes( yystr, (int) strlen(yystr) );
+    
+	return yy_scan_bytes( yystr, (int) 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 yybytes the byte buffer to scan
  * @param _yybytes_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  (const char * yybytes, int  _yybytes_len )
 {
-    YY_BUFFER_STATE b;
-    char *buf;
-    yy_size_t n;
-    int i;
-
-    /* Get memory for full buffer, including space for trailing EOB's. */
-    n = (yy_size_t) (_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;
+	YY_BUFFER_STATE b;
+	char *buf;
+	yy_size_t n;
+	int i;
+    
+	/* Get memory for full buffer, including space for trailing EOB's. */
+	n = (yy_size_t) (_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
@@ -1701,8 +1717,8 @@ YY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len )
 
 static void yynoreturn yy_fatal_error (const char* msg )
 {
-    fprintf( stderr, "%s\n", msg );
-    exit( YY_EXIT_FAILURE );
+			fprintf( stderr, "%s\n", msg );
+	exit( YY_EXIT_FAILURE );
 }
 
 /* Redefine yyless() so it works in section 3 code. */
@@ -1725,88 +1741,88 @@ static void yynoreturn yy_fatal_error (const char* msg )
 /* 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;
+        return yyin;
 }
 
 /** Get the output stream.
- *
+ * 
  */
 FILE *yyget_out  (void)
 {
-    return yyout;
+        return yyout;
 }
 
 /** Get the length of the current token.
- *
+ * 
  */
 int yyget_leng  (void)
 {
-    return yyleng;
+        return yyleng;
 }
 
 /** Get the current token.
- *
+ * 
  */
 
 char *yyget_text  (void)
 {
-    return yytext;
+        return yytext;
 }
 
 /** Set the current line number.
  * @param _line_number 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 ;
+        yyin = _in_str ;
 }
 
 void yyset_out (FILE *  _out_str )
 {
-    yyout = _out_str ;
+        yyout = _out_str ;
 }
 
 int yyget_debug  (void)
 {
-    return yy_flex_debug;
+        return yy_flex_debug;
 }
 
 void yyset_debug (int  _bdebug )
 {
-    yy_flex_debug = _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.
-    */
+        /* 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) = NULL;
     (yy_buffer_stack_top) = 0;
@@ -1815,7 +1831,7 @@ static int yy_init_globals (void)
     (yy_init) = 0;
     (yy_start) = 0;
 
-    /* Defined in main.c */
+/* Defined in main.c */
 #ifdef YY_STDINIT
     yyin = stdin;
     yyout = stdout;
@@ -1833,17 +1849,17 @@ static int yy_init_globals (void)
 /* 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();
-    }
+	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;
+	/* 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. */
@@ -1859,70 +1875,62 @@ int yylex_destroy  (void)
 #ifndef yytext_ptr
 static void yy_flex_strncpy (char* s1, const char * s2, int n )
 {
-
-    int i;
-    for ( i = 0; i < n; ++i )
-        s1[i] = s2[i];
+		
+	int i;
+	for ( i = 0; i < n; ++i )
+		s1[i] = s2[i];
 }
 #endif
 
 #ifdef YY_NEED_STRLEN
 static int yy_flex_strlen (const char * s )
 {
-    int n;
-    for ( n = 0; s[n]; ++n )
-        ;
+	int n;
+	for ( n = 0; s[n]; ++n )
+		;
 
-    return n;
+	return n;
 }
 #endif
 
 void *yyalloc (yy_size_t  size )
 {
-    return malloc(size);
+			return 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 realloc(ptr, 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 realloc(ptr, size);
 }
 
 void yyfree (void * ptr )
 {
-    free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
+			free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
 }
 
 #define YYTABLES_NAME "yytables"
 
-#line 40 "engines/private/grammar.l"
-
+#line 60 "engines/private/grammar.l"
 
-extern int yydebug;
 
 namespace Private {
 
 int parse(char *code) {
-
     initSetting();
-
     YY_BUFFER_STATE bp;
-
-    yydebug = 1;
     yy_delete_buffer(YY_CURRENT_BUFFER);
-
     bp = yy_scan_string(code);
     yy_switch_to_buffer(bp);
     yyparse();
     yy_delete_buffer(bp);
-
     return 0;
 }
 


Commit: 17d3d6e2413cfca04e3b356b94bed300401beaf8
    https://github.com/scummvm/scummvm/commit/17d3d6e2413cfca04e3b356b94bed300401beaf8
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: reorganized bison and yacc files and removed tabs from them

Changed paths:
  A engines/private/grammar.cpp
  A engines/private/lexer.cpp
  A engines/private/lexer.l
  A engines/private/tokens.h
  R engines/private/grammar.l
  R engines/private/grammar.tab.cpp
  R engines/private/grammar.tab.h
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/grammar.y
    engines/private/module.mk
    engines/private/private.cpp
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index c7029de5ca..eb63a4b52c 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -25,7 +25,7 @@
 #include "common/hash-ptr.h"
 
 #include "private/grammar.h"
-#include "private/grammar.tab.h"
+#include "private/tokens.h"
 #include "private/private.h"
 
 namespace Private {
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 8d18406d91..e05ae90c52 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -26,7 +26,7 @@
 #include "common/system.h"
 
 #include "private/grammar.h"
-#include "private/grammar.tab.h"
+#include "private/tokens.h"
 #include "private/private.h"
 
 namespace Private {
diff --git a/engines/private/grammar.cpp b/engines/private/grammar.cpp
new file mode 100644
index 0000000000..c9166bc785
--- /dev/null
+++ b/engines/private/grammar.cpp
@@ -0,0 +1,1675 @@
+/* A Bison parser, made by GNU Bison 3.7.2.  */
+
+/* Bison implementation for Yacc-like parsers in C
+
+   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 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 3 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, see <http://www.gnu.org/licenses/>.  */
+
+/* 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.  */
+
+/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+   especially those whose name start with YY_ or yy_.  They are
+   private implementation details that can be changed or removed.  */
+
+/* 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 "3.7.2"
+
+/* Skeleton name.  */
+#define YYSKELETON_NAME "yacc.c"
+
+/* Pure parsers.  */
+#define YYPURE 0
+
+/* Push parsers.  */
+#define YYPUSH 0
+
+/* Pull parsers.  */
+#define YYPULL 1
+
+
+
+
+/* First part of user prologue.  */
+#line 27 "engines/private/grammar.y"
+
+
+#include "grammar.h"
+
+#define code1(c1)       Private::code(c1);
+#define code2(c1,c2)    Private::code(c1); Private::code(c2)
+#define code3(c1,c2,c3) Private::code(c1); Private::code(c2); Private::code(c3)
+
+using namespace Private;
+
+extern int yylex();
+extern int yyparse();
+
+void yyerror(const char *str) {
+}
+
+
+int yywrap() {
+    return 1;
+}
+
+
+
+#line 95 "engines/private/grammar.cpp"
+
+# ifndef YY_CAST
+#  ifdef __cplusplus
+#   define YY_CAST(Type, Val) static_cast<Type> (Val)
+#   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
+#  else
+#   define YY_CAST(Type, Val) ((Type) (Val))
+#   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
+#  endif
+# endif
+# ifndef YY_NULLPTR
+#  if defined __cplusplus
+#   if 201103L <= __cplusplus
+#    define YY_NULLPTR nullptr
+#   else
+#    define YY_NULLPTR 0
+#   endif
+#  else
+#   define YY_NULLPTR ((void*)0)
+#  endif
+# endif
+
+#include "tokens.h"
+/* Symbol kind.  */
+enum yysymbol_kind_t
+{
+  YYSYMBOL_YYEMPTY = -2,
+  YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
+  YYSYMBOL_YYerror = 1,                    /* error  */
+  YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
+  YYSYMBOL_NAME = 3,                       /* NAME  */
+  YYSYMBOL_STRING = 4,                     /* STRING  */
+  YYSYMBOL_NUM = 5,                        /* NUM  */
+  YYSYMBOL_LTE = 6,                        /* LTE  */
+  YYSYMBOL_GTE = 7,                        /* GTE  */
+  YYSYMBOL_NEQ = 8,                        /* NEQ  */
+  YYSYMBOL_EQ = 9,                         /* EQ  */
+  YYSYMBOL_FALSETOK = 10,                  /* FALSETOK  */
+  YYSYMBOL_TRUETOK = 11,                   /* TRUETOK  */
+  YYSYMBOL_NULLTOK = 12,                   /* NULLTOK  */
+  YYSYMBOL_IFTOK = 13,                     /* IFTOK  */
+  YYSYMBOL_ELSETOK = 14,                   /* ELSETOK  */
+  YYSYMBOL_RECT = 15,                      /* RECT  */
+  YYSYMBOL_GOTOTOK = 16,                   /* GOTOTOK  */
+  YYSYMBOL_DEBUGTOK = 17,                  /* DEBUGTOK  */
+  YYSYMBOL_DEFINETOK = 18,                 /* DEFINETOK  */
+  YYSYMBOL_SETTINGTOK = 19,                /* SETTINGTOK  */
+  YYSYMBOL_RANDOMTOK = 20,                 /* RANDOMTOK  */
+  YYSYMBOL_21_ = 21,                       /* '{'  */
+  YYSYMBOL_22_ = 22,                       /* '}'  */
+  YYSYMBOL_23_ = 23,                       /* ','  */
+  YYSYMBOL_24_ = 24,                       /* ';'  */
+  YYSYMBOL_25_ = 25,                       /* '('  */
+  YYSYMBOL_26_ = 26,                       /* ')'  */
+  YYSYMBOL_27_ = 27,                       /* '!'  */
+  YYSYMBOL_28_ = 28,                       /* '+'  */
+  YYSYMBOL_29_ = 29,                       /* '<'  */
+  YYSYMBOL_30_ = 30,                       /* '>'  */
+  YYSYMBOL_31_ = 31,                       /* '%'  */
+  YYSYMBOL_YYACCEPT = 32,                  /* $accept  */
+  YYSYMBOL_lines = 33,                     /* lines  */
+  YYSYMBOL_line = 34,                      /* line  */
+  YYSYMBOL_debug = 35,                     /* debug  */
+  YYSYMBOL_statements = 36,                /* statements  */
+  YYSYMBOL_statement = 37,                 /* statement  */
+  YYSYMBOL_body = 38,                      /* body  */
+  YYSYMBOL_end = 39,                       /* end  */
+  YYSYMBOL_if = 40,                        /* if  */
+  YYSYMBOL_cond = 41,                      /* cond  */
+  YYSYMBOL_define = 42,                    /* define  */
+  YYSYMBOL_fcall = 43,                     /* fcall  */
+  YYSYMBOL_startp = 44,                    /* startp  */
+  YYSYMBOL_params = 45,                    /* params  */
+  YYSYMBOL_value = 46,                     /* value  */
+  YYSYMBOL_expr = 47                       /* expr  */
+};
+typedef enum yysymbol_kind_t yysymbol_kind_t;
+
+
+
+
+#ifdef short
+# undef short
+#endif
+
+/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
+   <limits.h> and (if available) <stdint.h> are included
+   so that the code can choose integer types of a good width.  */
+
+#ifndef __PTRDIFF_MAX__
+# include <limits.h> /* INFRINGES ON USER NAME SPACE */
+# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
+#  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
+#  define YY_STDINT_H
+# endif
+#endif
+
+/* Narrow types that promote to a signed type and that can represent a
+   signed or unsigned integer of at least N bits.  In tables they can
+   save space and decrease cache pressure.  Promoting to a signed type
+   helps avoid bugs in integer arithmetic.  */
+
+#ifdef __INT_LEAST8_MAX__
+typedef __INT_LEAST8_TYPE__ yytype_int8;
+#elif defined YY_STDINT_H
+typedef int_least8_t yytype_int8;
+#else
+typedef signed char yytype_int8;
+#endif
+
+#ifdef __INT_LEAST16_MAX__
+typedef __INT_LEAST16_TYPE__ yytype_int16;
+#elif defined YY_STDINT_H
+typedef int_least16_t yytype_int16;
+#else
+typedef short yytype_int16;
+#endif
+
+#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST8_TYPE__ yytype_uint8;
+#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
+       && UINT_LEAST8_MAX <= INT_MAX)
+typedef uint_least8_t yytype_uint8;
+#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
+typedef unsigned char yytype_uint8;
+#else
+typedef short yytype_uint8;
+#endif
+
+#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST16_TYPE__ yytype_uint16;
+#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
+       && UINT_LEAST16_MAX <= INT_MAX)
+typedef uint_least16_t yytype_uint16;
+#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
+typedef unsigned short yytype_uint16;
+#else
+typedef int yytype_uint16;
+#endif
+
+#ifndef YYPTRDIFF_T
+# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
+#  define YYPTRDIFF_T __PTRDIFF_TYPE__
+#  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
+# elif defined PTRDIFF_MAX
+#  ifndef ptrdiff_t
+#   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#  endif
+#  define YYPTRDIFF_T ptrdiff_t
+#  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
+# else
+#  define YYPTRDIFF_T long
+#  define YYPTRDIFF_MAXIMUM LONG_MAX
+# endif
+#endif
+
+#ifndef YYSIZE_T
+# ifdef __SIZE_TYPE__
+#  define YYSIZE_T __SIZE_TYPE__
+# elif defined size_t
+#  define YYSIZE_T size_t
+# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
+#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+#  define YYSIZE_T size_t
+# else
+#  define YYSIZE_T unsigned
+# endif
+#endif
+
+#define YYSIZE_MAXIMUM                                  \
+  YY_CAST (YYPTRDIFF_T,                                 \
+           (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
+            ? YYPTRDIFF_MAXIMUM                         \
+            : YY_CAST (YYSIZE_T, -1)))
+
+#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
+
+
+/* Stored state numbers (used for stacks). */
+typedef yytype_int8 yy_state_t;
+
+/* State numbers in computations.  */
+typedef int yy_state_fast_t;
+
+#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
+
+
+#ifndef YY_ATTRIBUTE_PURE
+# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
+#  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+#  define YY_ATTRIBUTE_PURE
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
+#  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+# else
+#  define YY_ATTRIBUTE_UNUSED
+# 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
+
+#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                            \
+    _Pragma ("GCC diagnostic push")                                     \
+    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
+    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
+    _Pragma ("GCC diagnostic pop")
+#else
+# define YY_INITIAL_VALUE(Value) Value
+#endif
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
+#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
+# define YY_IGNORE_USELESS_CAST_BEGIN                          \
+    _Pragma ("GCC diagnostic push")                            \
+    _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
+# define YY_IGNORE_USELESS_CAST_END            \
+    _Pragma ("GCC diagnostic pop")
+#endif
+#ifndef YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_END
+#endif
+
+
+#define YY_ASSERT(E) ((void) (0 && (E)))
+
+#if !defined yyoverflow
+
+/* 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 EXIT_SUCCESS
+#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
+#     ifndef EXIT_SUCCESS
+#      define EXIT_SUCCESS 0
+#     endif
+#    endif
+#   endif
+#  endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+   /* Pacify GCC's 'empty if-body' warning.  */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (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 EXIT_SUCCESS \
+       && ! ((defined YYMALLOC || defined malloc) \
+             && (defined YYFREE || defined free)))
+#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+#   ifndef EXIT_SUCCESS
+#    define EXIT_SUCCESS 0
+#   endif
+#  endif
+#  ifndef YYMALLOC
+#   define YYMALLOC malloc
+#   if ! defined malloc && ! defined EXIT_SUCCESS
+void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+#  ifndef YYFREE
+#   define YYFREE free
+#   if ! defined free && ! defined EXIT_SUCCESS
+void free (void *); /* INFRINGES ON USER NAME SPACE */
+#   endif
+#  endif
+# endif
+#endif /* !defined yyoverflow */
+
+#if (! defined yyoverflow \
+     && (! defined __cplusplus \
+         || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+
+/* A type that is properly aligned for any stack member.  */
+union yyalloc
+{
+  yy_state_t yyss_alloc;
+  YYSTYPE yyvs_alloc;
+};
+
+/* The size of the maximum gap between one aligned stack and the next.  */
+# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+   N elements.  */
+# define YYSTACK_BYTES(N) \
+     ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
+      + YYSTACK_GAP_MAXIMUM)
+
+# define YYCOPY_NEEDED 1
+
+/* 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_alloc, Stack)                           \
+    do                                                                  \
+      {                                                                 \
+        YYPTRDIFF_T yynewbytes;                                         \
+        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
+        Stack = &yyptr->Stack_alloc;                                    \
+        yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
+        yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
+      }                                                                 \
+    while (0)
+
+#endif
+
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from SRC to DST.  The source and destination do
+   not overlap.  */
+# ifndef YYCOPY
+#  if defined __GNUC__ && 1 < __GNUC__
+#   define YYCOPY(Dst, Src, Count) \
+      __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
+#  else
+#   define YYCOPY(Dst, Src, Count)              \
+      do                                        \
+        {                                       \
+          YYPTRDIFF_T yyi;                      \
+          for (yyi = 0; yyi < (Count); yyi++)   \
+            (Dst)[yyi] = (Src)[yyi];            \
+        }                                       \
+      while (0)
+#  endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
+/* YYFINAL -- State number of the termination state.  */
+#define YYFINAL  9
+/* YYLAST -- Last index in YYTABLE.  */
+#define YYLAST   125
+
+/* YYNTOKENS -- Number of terminals.  */
+#define YYNTOKENS  32
+/* YYNNTS -- Number of nonterminals.  */
+#define YYNNTS  16
+/* YYNRULES -- Number of rules.  */
+#define YYNRULES  50
+/* YYNSTATES -- Number of states.  */
+#define YYNSTATES  113
+
+/* YYMAXUTOK -- Last valid token kind.  */
+#define YYMAXUTOK   275
+
+
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex, with out-of-bounds checking.  */
+#define YYTRANSLATE(YYX)                                \
+  (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
+   ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
+   : YYSYMBOL_YYUNDEF)
+
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex.  */
+static const yytype_int8 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,    27,     2,     2,     2,    31,     2,     2,
+      25,    26,     2,    28,    23,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,    24,
+      29,     2,    30,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,    21,     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,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+       2,     2,     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,
+      15,    16,    17,    18,    19,    20
+};
+
+#if YYDEBUG
+  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
+static const yytype_uint8 yyrline[] =
+{
+       0,    67,    67,    68,    71,    72,    73,    76,    77,    80,
+      81,    84,    91,    92,    97,   105,   106,   109,   112,   115,
+     118,   119,   124,   128,   129,   132,   140,   141,   149,   152,
+     153,   154,   155,   156,   159,   160,   161,   162,   163,   164,
+     167,   168,   169,   170,   171,   172,   173,   174,   175,   176,
+     177
+};
+#endif
+
+/** Accessing symbol of state STATE.  */
+#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
+
+#if YYDEBUG || 0
+/* The user-facing name of the symbol whose (internal) number is
+   YYSYMBOL.  No bounds checking.  */
+static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
+
+/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
+static const char *const yytname[] =
+{
+  "\"end of file\"", "error", "\"invalid token\"", "NAME", "STRING",
+  "NUM", "LTE", "GTE", "NEQ", "EQ", "FALSETOK", "TRUETOK", "NULLTOK",
+  "IFTOK", "ELSETOK", "RECT", "GOTOTOK", "DEBUGTOK", "DEFINETOK",
+  "SETTINGTOK", "RANDOMTOK", "'{'", "'}'", "','", "';'", "'('", "')'",
+  "'!'", "'+'", "'<'", "'>'", "'%'", "$accept", "lines", "line", "debug",
+  "statements", "statement", "body", "end", "if", "cond", "define",
+  "fcall", "startp", "params", "value", "expr", YY_NULLPTR
+};
+
+static const char *
+yysymbol_name (yysymbol_kind_t yysymbol)
+{
+  return yytname[yysymbol];
+}
+#endif
+
+#ifdef YYPRINT
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+   (internal) symbol number NUM (which must be that of a token).  */
+static const yytype_int16 yytoknum[] =
+{
+       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
+     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
+     275,   123,   125,    44,    59,    40,    41,    33,    43,    60,
+      62,    37
+};
+#endif
+
+#define YYPACT_NINF (-73)
+
+#define yypact_value_is_default(Yyn) \
+  ((Yyn) == YYPACT_NINF)
+
+#define YYTABLE_NINF (-1)
+
+#define yytable_value_is_error(Yyn) \
+  0
+
+  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+     STATE-NUM.  */
+static const yytype_int8 yypact[] =
+{
+       8,   -11,    11,    12,    18,     8,    30,    22,    23,   -73,
+     -73,    24,    38,    42,    59,    30,   -73,    40,    39,    41,
+     -73,    54,    16,    58,    59,    56,    60,   -73,     5,   -73,
+     -73,    77,    61,    83,   -73,   -73,    19,    52,   -73,    62,
+     -73,     1,    65,   -73,    63,   -73,   -73,   -73,   -73,   -73,
+     -73,    67,    66,    29,    64,    59,   -73,   -73,    86,    41,
+      68,    71,    69,    73,    92,   -73,    93,   -73,    66,    66,
+      66,    66,    66,    66,    66,   -73,    78,    50,    76,     1,
+     -73,     1,    79,    70,   -73,   -73,   -73,   -73,   -73,   -73,
+     -73,   -73,    52,    98,   -73,   -73,    99,    80,   -73,    82,
+      84,   -73,   -73,   103,   104,    87,    85,   107,   -73,    88,
+      90,    42,   -73
+};
+
+  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+     Performed when YYTABLE does not specify something else to do.  Zero
+     means the default is an error.  */
+static const yytype_int8 yydefact[] =
+{
+       0,     0,     0,     0,     0,     3,     7,     0,     0,     1,
+       2,     0,     0,    20,     9,     7,     4,    24,     0,     0,
+      18,     0,     0,     0,     9,     0,     0,     8,    20,     5,
+      28,     0,     0,     0,     6,    10,     0,     0,    12,     0,
+      23,    29,     0,    11,     0,    39,    38,    37,    35,    36,
+      34,     0,     0,    40,     0,     9,    15,    17,     0,    39,
+       0,    33,     0,    32,     0,    25,     0,    41,     0,     0,
+       0,     0,    49,     0,     0,    19,     0,    13,     0,    29,
+      27,    29,     0,     0,    47,    48,    43,    42,    44,    45,
+      46,    16,     0,     0,    30,    31,     0,     0,    17,     0,
+       0,    50,    14,     0,     0,     0,     0,     0,    26,     0,
+      22,    20,    21
+};
+
+  /* YYPGOTO[NTERM-NUM].  */
+static const yytype_int8 yypgoto[] =
+{
+     -73,   110,   -73,   101,   -21,   -36,    25,    20,   -73,   -73,
+     -28,   -39,   -73,   -72,   -20,    89
+};
+
+  /* YYDEFGOTO[NTERM-NUM].  */
+static const yytype_int8 yydefgoto[] =
+{
+      -1,     4,     5,    12,    23,    24,    57,    77,    25,    37,
+      18,    26,    41,    62,    53,    63
+};
+
+  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
+     positive, shift that token.  If negative, reduce the rule whose
+     number is the opposite.  If YYTABLE_NINF, syntax error.  */
+static const yytype_int8 yytable[] =
+{
+      40,    56,    61,    35,    59,    46,    47,    94,    17,    95,
+       6,    48,    49,    50,     7,     8,    21,    60,     9,    32,
+      39,    51,    45,    46,    47,     1,     2,     3,    52,    48,
+      49,    50,    67,    11,    76,    68,    69,    70,    71,    51,
+      61,    33,    61,    13,    14,    17,    52,    15,    84,    85,
+      86,    87,    88,    89,    90,    19,    56,    72,    73,    74,
+      16,    29,    19,    28,    92,    20,    30,    21,    22,    45,
+      46,    47,    20,    55,    21,    22,    48,    49,    50,    31,
+      34,    36,    42,   112,    38,    43,    44,    58,    64,    65,
+      75,    78,    66,    33,    79,    80,    81,    82,    83,    93,
+      91,    97,    96,    99,   100,   103,   101,   104,   105,   106,
+     107,   108,   109,   111,   110,    10,    27,    98,   102,     0,
+       0,     0,     0,     0,     0,    54
+};
+
+static const yytype_int8 yycheck[] =
+{
+      28,    37,    41,    24,     3,     4,     5,    79,     3,    81,
+      21,    10,    11,    12,     3,     3,    15,    16,     0,     3,
+      15,    20,     3,     4,     5,    17,    18,    19,    27,    10,
+      11,    12,    52,     3,    55,     6,     7,     8,     9,    20,
+      79,    25,    81,    21,    21,     3,    27,    23,    68,    69,
+      70,    71,    72,    73,    74,     3,    92,    28,    29,    30,
+      22,    22,     3,    23,    14,    13,    25,    15,    16,     3,
+       4,     5,    13,    21,    15,    16,    10,    11,    12,    25,
+      22,    25,     5,   111,    24,    24,     3,    25,    23,    26,
+      26,     5,    25,    25,    23,    26,    23,     5,     5,    23,
+      22,    31,    23,     5,     5,    23,    26,    23,     5,     5,
+      23,    26,     5,    23,    26,     5,    15,    92,    98,    -1,
+      -1,    -1,    -1,    -1,    -1,    36
+};
+
+  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+     symbol of state STATE-NUM.  */
+static const yytype_int8 yystos[] =
+{
+       0,    17,    18,    19,    33,    34,    21,     3,     3,     0,
+      33,     3,    35,    21,    21,    23,    22,     3,    42,     3,
+      13,    15,    16,    36,    37,    40,    43,    35,    23,    22,
+      25,    25,     3,    25,    22,    36,    25,    41,    24,    15,
+      42,    44,     5,    24,     3,     3,     4,     5,    10,    11,
+      12,    20,    27,    46,    47,    21,    37,    38,    25,     3,
+      16,    43,    45,    47,    23,    26,    25,    46,     6,     7,
+       8,     9,    28,    29,    30,    26,    36,    39,     5,    23,
+      26,    23,     5,     5,    46,    46,    46,    46,    46,    46,
+      46,    22,    14,    23,    45,    45,    23,    31,    38,     5,
+       5,    26,    39,    23,    23,     5,     5,    23,    26,     5,
+      26,    23,    42
+};
+
+  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const yytype_int8 yyr1[] =
+{
+       0,    32,    33,    33,    34,    34,    34,    35,    35,    36,
+      36,    37,    37,    37,    37,    38,    38,    39,    40,    41,
+      42,    42,    42,    42,    42,    43,    43,    43,    44,    45,
+      45,    45,    45,    45,    46,    46,    46,    46,    46,    46,
+      47,    47,    47,    47,    47,    47,    47,    47,    47,    47,
+      47
+};
+
+  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
+static const yytype_int8 yyr2[] =
+{
+       0,     2,     2,     1,     4,     5,     5,     0,     3,     0,
+       2,     3,     2,     4,     7,     1,     3,     0,     1,     3,
+       0,    14,    12,     3,     1,     4,    10,     5,     0,     0,
+       3,     3,     1,     1,     1,     1,     1,     1,     1,     1,
+       1,     2,     3,     3,     3,     3,     3,     3,     3,     2,
+       5
+};
+
+
+enum { YYENOMEM = -2 };
+
+#define yyerrok         (yyerrstatus = 0)
+#define yyclearin       (yychar = YYEMPTY)
+
+#define YYACCEPT        goto yyacceptlab
+#define YYABORT         goto yyabortlab
+#define YYERROR         goto yyerrorlab
+
+
+#define YYRECOVERING()  (!!yyerrstatus)
+
+#define YYBACKUP(Token, Value)                                    \
+  do                                                              \
+    if (yychar == YYEMPTY)                                        \
+      {                                                           \
+        yychar = (Token);                                         \
+        yylval = (Value);                                         \
+        YYPOPSTACK (yylen);                                       \
+        yystate = *yyssp;                                         \
+        goto yybackup;                                            \
+      }                                                           \
+    else                                                          \
+      {                                                           \
+        yyerror (YY_("syntax error: cannot back up")); \
+        YYERROR;                                                  \
+      }                                                           \
+  while (0)
+
+/* Backward compatibility with an undocumented macro.
+   Use YYerror or YYUNDEF. */
+#define YYERRCODE YYUNDEF
+
+
+/* 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 (0)
+
+/* This macro is provided for backward compatibility. */
+# ifndef YY_LOCATION_PRINT
+#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# endif
+
+
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
+do {                                                                      \
+  if (yydebug)                                                            \
+    {                                                                     \
+      YYFPRINTF (stderr, "%s ", Title);                                   \
+      yy_symbol_print (stderr,                                            \
+                  Kind, Value); \
+      YYFPRINTF (stderr, "\n");                                           \
+    }                                                                     \
+} while (0)
+
+
+/*-----------------------------------.
+| Print this symbol's value on YYO.  |
+`-----------------------------------*/
+
+static void
+yy_symbol_value_print (FILE *yyo,
+                       yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
+{
+  FILE *yyoutput = yyo;
+  YYUSE (yyoutput);
+  if (!yyvaluep)
+    return;
+# ifdef YYPRINT
+  if (yykind < YYNTOKENS)
+    YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
+# endif
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  YYUSE (yykind);
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+}
+
+
+/*---------------------------.
+| Print this symbol on YYO.  |
+`---------------------------*/
+
+static void
+yy_symbol_print (FILE *yyo,
+                 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
+{
+  YYFPRINTF (yyo, "%s %s (",
+             yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
+
+  yy_symbol_value_print (yyo, yykind, yyvaluep);
+  YYFPRINTF (yyo, ")");
+}
+
+/*------------------------------------------------------------------.
+| yy_stack_print -- Print the state stack from its BOTTOM up to its |
+| TOP (included).                                                   |
+`------------------------------------------------------------------*/
+
+static void
+yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
+{
+  YYFPRINTF (stderr, "Stack now");
+  for (; yybottom <= yytop; yybottom++)
+    {
+      int yybot = *yybottom;
+      YYFPRINTF (stderr, " %d", yybot);
+    }
+  YYFPRINTF (stderr, "\n");
+}
+
+# define YY_STACK_PRINT(Bottom, Top)                            \
+do {                                                            \
+  if (yydebug)                                                  \
+    yy_stack_print ((Bottom), (Top));                           \
+} while (0)
+
+
+/*------------------------------------------------.
+| Report that the YYRULE is going to be reduced.  |
+`------------------------------------------------*/
+
+static void
+yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
+                 int yyrule)
+{
+  int yylno = yyrline[yyrule];
+  int yynrhs = yyr2[yyrule];
+  int yyi;
+  YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
+             yyrule - 1, yylno);
+  /* The symbols being reduced.  */
+  for (yyi = 0; yyi < yynrhs; yyi++)
+    {
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
+      yy_symbol_print (stderr,
+                       YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
+                       &yyvsp[(yyi + 1) - (yynrhs)]);
+      YYFPRINTF (stderr, "\n");
+    }
+}
+
+# define YY_REDUCE_PRINT(Rule)          \
+do {                                    \
+  if (yydebug)                          \
+    yy_reduce_print (yyssp, yyvsp, Rule); \
+} while (0)
+
+/* Nonzero means print parse trace.  It is left uninitialized so that
+   multiple parsers can coexist.  */
+int yydebug;
+#else /* !YYDEBUG */
+# define YYDPRINTF(Args) ((void) 0)
+# define YY_SYMBOL_PRINT(Title, Kind, 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
+
+
+
+
+
+
+/*-----------------------------------------------.
+| Release the memory associated to this symbol.  |
+`-----------------------------------------------*/
+
+static void
+yydestruct (const char *yymsg,
+            yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
+{
+  YYUSE (yyvaluep);
+  if (!yymsg)
+    yymsg = "Deleting";
+  YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
+
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  YYUSE (yykind);
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+}
+
+
+/* Lookahead token kind.  */
+int yychar;
+
+/* The semantic value of the lookahead symbol.  */
+YYSTYPE yylval;
+/* Number of syntax errors so far.  */
+int yynerrs;
+
+
+
+
+/*----------.
+| yyparse.  |
+`----------*/
+
+int
+yyparse (void)
+{
+    yy_state_fast_t yystate = 0;
+    /* Number of tokens to shift before error messages enabled.  */
+    int yyerrstatus = 0;
+
+    /* Refer to the stacks through separate pointers, to allow yyoverflow
+       to reallocate them elsewhere.  */
+
+    /* Their size.  */
+    YYPTRDIFF_T yystacksize = YYINITDEPTH;
+
+    /* The state stack: array, bottom, top.  */
+    yy_state_t yyssa[YYINITDEPTH];
+    yy_state_t *yyss = yyssa;
+    yy_state_t *yyssp = yyss;
+
+    /* The semantic value stack: array, bottom, top.  */
+    YYSTYPE yyvsa[YYINITDEPTH];
+    YYSTYPE *yyvs = yyvsa;
+    YYSTYPE *yyvsp = yyvs;
+
+  int yyn;
+  /* The return value of yyparse.  */
+  int yyresult;
+  /* Lookahead symbol kind.  */
+  yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
+  /* The variables used to return semantic value and location from the
+     action routines.  */
+  YYSTYPE yyval;
+
+
+
+#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
+
+  /* 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"));
+
+  yychar = YYEMPTY; /* Cause a token to be read.  */
+  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 -- set current state (the top of the stack) to yystate.  |
+`--------------------------------------------------------------------*/
+yysetstate:
+  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
+  YY_IGNORE_USELESS_CAST_BEGIN
+  *yyssp = YY_CAST (yy_state_t, yystate);
+  YY_IGNORE_USELESS_CAST_END
+  YY_STACK_PRINT (yyss, yyssp);
+
+  if (yyss + yystacksize - 1 <= yyssp)
+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
+    goto yyexhaustedlab;
+#else
+    {
+      /* Get the current used size of the three stacks, in elements.  */
+      YYPTRDIFF_T yysize = yyssp - yyss + 1;
+
+# if defined 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.  */
+        yy_state_t *yyss1 = yyss;
+        YYSTYPE *yyvs1 = yyvs;
+
+        /* 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 * YYSIZEOF (*yyssp),
+                    &yyvs1, yysize * YYSIZEOF (*yyvsp),
+                    &yystacksize);
+        yyss = yyss1;
+        yyvs = yyvs1;
+      }
+# else /* defined YYSTACK_RELOCATE */
+      /* Extend the stack our own way.  */
+      if (YYMAXDEPTH <= yystacksize)
+        goto yyexhaustedlab;
+      yystacksize *= 2;
+      if (YYMAXDEPTH < yystacksize)
+        yystacksize = YYMAXDEPTH;
+
+      {
+        yy_state_t *yyss1 = yyss;
+        union yyalloc *yyptr =
+          YY_CAST (union yyalloc *,
+                   YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
+        if (! yyptr)
+          goto yyexhaustedlab;
+        YYSTACK_RELOCATE (yyss_alloc, yyss);
+        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+#  undef YYSTACK_RELOCATE
+        if (yyss1 != yyssa)
+          YYSTACK_FREE (yyss1);
+      }
+# endif
+
+      yyssp = yyss + yysize - 1;
+      yyvsp = yyvs + yysize - 1;
+
+      YY_IGNORE_USELESS_CAST_BEGIN
+      YYDPRINTF ((stderr, "Stack size increased to %ld\n",
+                  YY_CAST (long, yystacksize)));
+      YY_IGNORE_USELESS_CAST_END
+
+      if (yyss + yystacksize - 1 <= yyssp)
+        YYABORT;
+    }
+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
+
+  if (yystate == YYFINAL)
+    YYACCEPT;
+
+  goto yybackup;
+
+
+/*-----------.
+| yybackup.  |
+`-----------*/
+yybackup:
+  /* Do appropriate processing given the current state.  Read a
+     lookahead token if we need one and don't already have one.  */
+
+  /* First try to decide what to do without reference to lookahead token.  */
+  yyn = yypact[yystate];
+  if (yypact_value_is_default (yyn))
+    goto yydefault;
+
+  /* Not known => get a lookahead token if don't already have one.  */
+
+  /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
+  if (yychar == YYEMPTY)
+    {
+      YYDPRINTF ((stderr, "Reading a token\n"));
+      yychar = yylex ();
+    }
+
+  if (yychar <= YYEOF)
+    {
+      yychar = YYEOF;
+      yytoken = YYSYMBOL_YYEOF;
+      YYDPRINTF ((stderr, "Now at end of input.\n"));
+    }
+  else if (yychar == YYerror)
+    {
+      /* The scanner already issued an error message, process directly
+         to error recovery.  But do not keep the error token as
+         lookahead, it is too special and may lead us to an endless
+         loop in error recovery. */
+      yychar = YYUNDEF;
+      yytoken = YYSYMBOL_YYerror;
+      goto yyerrlab1;
+    }
+  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 (yytable_value_is_error (yyn))
+        goto yyerrlab;
+      yyn = -yyn;
+      goto yyreduce;
+    }
+
+  /* Count tokens shifted since error; after three, turn off error
+     status.  */
+  if (yyerrstatus)
+    yyerrstatus--;
+
+  /* Shift the lookahead token.  */
+  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+  yystate = yyn;
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+  /* Discard the shifted token.  */
+  yychar = YYEMPTY;
+  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 4: /* line: DEBUGTOK '{' debug '}'  */
+#line 71 "engines/private/grammar.y"
+                                             { /* Not used in the game */ }
+#line 1194 "engines/private/grammar.cpp"
+    break;
+
+  case 5: /* line: DEFINETOK NAME '{' define '}'  */
+#line 72 "engines/private/grammar.y"
+                                             { installAll((yyvsp[-3].s)); }
+#line 1200 "engines/private/grammar.cpp"
+    break;
+
+  case 6: /* line: SETTINGTOK NAME '{' statements '}'  */
+#line 73 "engines/private/grammar.y"
+                                             { saveSetting((yyvsp[-3].s)); initSetting(); }
+#line 1206 "engines/private/grammar.cpp"
+    break;
+
+  case 9: /* statements: %empty  */
+#line 80 "engines/private/grammar.y"
+                               { (yyval.inst) = progp; }
+#line 1212 "engines/private/grammar.cpp"
+    break;
+
+  case 11: /* statement: GOTOTOK NAME ';'  */
+#line 84 "engines/private/grammar.y"
+                            {
+        (yyval.inst) = progp;
+        code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s)));
+        code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
+        code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
+        code1(funcpush);
+        }
+#line 1224 "engines/private/grammar.cpp"
+    break;
+
+  case 12: /* statement: fcall ';'  */
+#line 91 "engines/private/grammar.y"
+                            { (yyval.inst) = (yyvsp[-1].inst); }
+#line 1230 "engines/private/grammar.cpp"
+    break;
+
+  case 13: /* statement: if cond body end  */
+#line 92 "engines/private/grammar.y"
+                           {
+                /* else-less if */
+                ((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst);     /* thenpart */
+                ((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst); 
+                }
+#line 1240 "engines/private/grammar.cpp"
+    break;
+
+  case 14: /* statement: if cond body end ELSETOK body end  */
+#line 97 "engines/private/grammar.y"
+                                            { 
+                /* if with else */
+                ((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst);     /* thenpart */
+                ((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst);     /* elsepart */
+                ((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst); 
+                }
+#line 1251 "engines/private/grammar.cpp"
+    break;
+
+  case 15: /* body: statement  */
+#line 105 "engines/private/grammar.y"
+                             { (yyval.inst) = (yyvsp[0].inst); }
+#line 1257 "engines/private/grammar.cpp"
+    break;
+
+  case 16: /* body: '{' statements '}'  */
+#line 106 "engines/private/grammar.y"
+                             { (yyval.inst) = (yyvsp[-1].inst); }
+#line 1263 "engines/private/grammar.cpp"
+    break;
+
+  case 17: /* end: %empty  */
+#line 109 "engines/private/grammar.y"
+                             { code(STOP); (yyval.inst) = progp; }
+#line 1269 "engines/private/grammar.cpp"
+    break;
+
+  case 18: /* if: IFTOK  */
+#line 112 "engines/private/grammar.y"
+          { (yyval.inst) = code(ifcode); code3(STOP, STOP, STOP); }
+#line 1275 "engines/private/grammar.cpp"
+    break;
+
+  case 19: /* cond: '(' expr ')'  */
+#line 115 "engines/private/grammar.y"
+                        { code(STOP); (yyval.inst) = (yyvsp[-1].inst); }
+#line 1281 "engines/private/grammar.cpp"
+    break;
+
+  case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  */
+#line 119 "engines/private/grammar.y"
+                                                                        { 
+          Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
+          assert(r->isValidRect()); 
+          defineSymbol((yyvsp[-13].s), r); 
+          }
+#line 1291 "engines/private/grammar.cpp"
+    break;
+
+  case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
+#line 124 "engines/private/grammar.y"
+                                                            {
+          Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);  
+          defineSymbol((yyvsp[-11].s), r); 
+          }
+#line 1300 "engines/private/grammar.cpp"
+    break;
+
+  case 23: /* define: NAME ',' define  */
+#line 128 "engines/private/grammar.y"
+                          { defineSymbol((yyvsp[-2].s), NULL); }
+#line 1306 "engines/private/grammar.cpp"
+    break;
+
+  case 24: /* define: NAME  */
+#line 129 "engines/private/grammar.y"
+                          { defineSymbol((yyvsp[0].s), NULL); }
+#line 1312 "engines/private/grammar.cpp"
+    break;
+
+  case 25: /* fcall: GOTOTOK '(' NAME ')'  */
+#line 132 "engines/private/grammar.y"
+                               {
+                               (yyval.inst) = progp;
+                               code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s)));
+                               code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
+                               code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
+                               code1(funcpush);
+                               }
+#line 1324 "engines/private/grammar.cpp"
+    break;
+
+  case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
+#line 140 "engines/private/grammar.y"
+                                                   { (yyval.inst) = progp; }
+#line 1330 "engines/private/grammar.cpp"
+    break;
+
+  case 27: /* fcall: NAME '(' startp params ')'  */
+#line 141 "engines/private/grammar.y"
+                                      {
+                               (yyval.inst) = (yyvsp[-2].inst);
+                               code2(constpush, (Private::Inst) constant(NUM, (yyvsp[-1].narg), NULL));
+                               code2(strpush, (Private::Inst) constant(STRING, 0, (yyvsp[-4].s))); 
+                               code1(funcpush);
+                               }
+#line 1341 "engines/private/grammar.cpp"
+    break;
+
+  case 28: /* startp: %empty  */
+#line 149 "engines/private/grammar.y"
+                    { (yyval.inst) = progp; }
+#line 1347 "engines/private/grammar.cpp"
+    break;
+
+  case 29: /* params: %empty  */
+#line 152 "engines/private/grammar.y"
+                            { (yyval.narg) = 0; }
+#line 1353 "engines/private/grammar.cpp"
+    break;
+
+  case 30: /* params: fcall ',' params  */
+#line 153 "engines/private/grammar.y"
+                            { (yyval.narg) = (yyvsp[0].narg) + 1; }
+#line 1359 "engines/private/grammar.cpp"
+    break;
+
+  case 31: /* params: expr ',' params  */
+#line 154 "engines/private/grammar.y"
+                            { (yyval.narg) = (yyvsp[0].narg) + 1; }
+#line 1365 "engines/private/grammar.cpp"
+    break;
+
+  case 32: /* params: expr  */
+#line 155 "engines/private/grammar.y"
+                      { (yyval.narg) = 1; }
+#line 1371 "engines/private/grammar.cpp"
+    break;
+
+  case 33: /* params: fcall  */
+#line 156 "engines/private/grammar.y"
+                      { (yyval.narg) = 1; }
+#line 1377 "engines/private/grammar.cpp"
+    break;
+
+  case 34: /* value: NULLTOK  */
+#line 159 "engines/private/grammar.y"
+                   { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
+#line 1383 "engines/private/grammar.cpp"
+    break;
+
+  case 35: /* value: FALSETOK  */
+#line 160 "engines/private/grammar.y"
+                   { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
+#line 1389 "engines/private/grammar.cpp"
+    break;
+
+  case 36: /* value: TRUETOK  */
+#line 161 "engines/private/grammar.y"
+                   { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 1, NULL)); }
+#line 1395 "engines/private/grammar.cpp"
+    break;
+
+  case 37: /* value: NUM  */
+#line 162 "engines/private/grammar.y"
+                   { code2(Private::constpush, (Private::Inst)(yyvsp[0].sym)); }
+#line 1401 "engines/private/grammar.cpp"
+    break;
+
+  case 38: /* value: STRING  */
+#line 163 "engines/private/grammar.y"
+                   { code2(Private::strpush, (Private::Inst)(yyvsp[0].sym)); }
+#line 1407 "engines/private/grammar.cpp"
+    break;
+
+  case 39: /* value: NAME  */
+#line 164 "engines/private/grammar.y"
+                   { code1(Private::varpush); code1((Private::Inst) lookupName((yyvsp[0].s))); code1(Private::eval); }
+#line 1413 "engines/private/grammar.cpp"
+    break;
+
+  case 40: /* expr: value  */
+#line 167 "engines/private/grammar.y"
+                          { (yyval.inst) = (yyvsp[0].inst); }
+#line 1419 "engines/private/grammar.cpp"
+    break;
+
+  case 41: /* expr: '!' value  */
+#line 168 "engines/private/grammar.y"
+                          { code1(Private::negate); (yyval.inst) = (yyvsp[0].inst); }
+#line 1425 "engines/private/grammar.cpp"
+    break;
+
+  case 42: /* expr: value EQ value  */
+#line 169 "engines/private/grammar.y"
+                          { code1(Private::eq); }
+#line 1431 "engines/private/grammar.cpp"
+    break;
+
+  case 43: /* expr: value NEQ value  */
+#line 170 "engines/private/grammar.y"
+                          { code1(Private::ne); }
+#line 1437 "engines/private/grammar.cpp"
+    break;
+
+  case 44: /* expr: value '+' value  */
+#line 171 "engines/private/grammar.y"
+                          { code1(Private::add); }
+#line 1443 "engines/private/grammar.cpp"
+    break;
+
+  case 45: /* expr: value '<' value  */
+#line 172 "engines/private/grammar.y"
+                          { code1(Private::lt); }
+#line 1449 "engines/private/grammar.cpp"
+    break;
+
+  case 46: /* expr: value '>' value  */
+#line 173 "engines/private/grammar.y"
+                          { code1(Private::gt); }
+#line 1455 "engines/private/grammar.cpp"
+    break;
+
+  case 47: /* expr: value LTE value  */
+#line 174 "engines/private/grammar.y"
+                          { code1(Private::le); }
+#line 1461 "engines/private/grammar.cpp"
+    break;
+
+  case 48: /* expr: value GTE value  */
+#line 175 "engines/private/grammar.y"
+                          { code1(Private::ge); }
+#line 1467 "engines/private/grammar.cpp"
+    break;
+
+  case 49: /* expr: value '+'  */
+#line 176 "engines/private/grammar.y"
+                          { (yyval.inst) = (yyvsp[-1].inst); }
+#line 1473 "engines/private/grammar.cpp"
+    break;
+
+  case 50: /* expr: RANDOMTOK '(' NUM '%' ')'  */
+#line 177 "engines/private/grammar.y"
+                                    { code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool); }
+#line 1479 "engines/private/grammar.cpp"
+    break;
+
+
+#line 1483 "engines/private/grammar.cpp"
+
+      default: break;
+    }
+  /* User semantic actions sometimes alter yychar, and that requires
+     that yytoken be updated with the new translation.  We take the
+     approach of translating immediately before every use of yytoken.
+     One alternative is translating here after every semantic action,
+     but that translation would be missed if the semantic action invokes
+     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
+     incorrect destructor might then be invoked immediately.  In the
+     case of YYERROR or YYBACKUP, subsequent parser actions might lead
+     to an incorrect destructor call or verbose syntax error message
+     before the lookahead is translated.  */
+  YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
+
+  YYPOPSTACK (yylen);
+  yylen = 0;
+
+  *++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.  */
+  {
+    const int yylhs = yyr1[yyn] - YYNTOKENS;
+    const int yyi = yypgoto[yylhs] + *yyssp;
+    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+               ? yytable[yyi]
+               : yydefgoto[yylhs]);
+  }
+
+  goto yynewstate;
+
+
+/*--------------------------------------.
+| yyerrlab -- here on detecting error.  |
+`--------------------------------------*/
+yyerrlab:
+  /* Make sure we have latest lookahead translation.  See comments at
+     user semantic actions for why this is necessary.  */
+  yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
+  /* If not already recovering from an error, report this error.  */
+  if (!yyerrstatus)
+    {
+      ++yynerrs;
+      yyerror (YY_("syntax error"));
+    }
+
+  if (yyerrstatus == 3)
+    {
+      /* If just tried and failed to reuse lookahead 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 lookahead token after shifting the error
+     token.  */
+  goto yyerrlab1;
+
+
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR.  |
+`---------------------------------------------------*/
+yyerrorlab:
+  /* Pacify compilers when the user code never invokes YYERROR and the
+     label yyerrorlab therefore never appears in user code.  */
+  if (0)
+    YYERROR;
+
+  /* Do not reclaim the symbols of the rule whose 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.  */
+
+  /* Pop stack until we find a state that shifts the error token.  */
+  for (;;)
+    {
+      yyn = yypact[yystate];
+      if (!yypact_value_is_default (yyn))
+        {
+          yyn += YYSYMBOL_YYerror;
+          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
+            {
+              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",
+                  YY_ACCESSING_SYMBOL (yystate), yyvsp);
+      YYPOPSTACK (1);
+      yystate = *yyssp;
+      YY_STACK_PRINT (yyss, yyssp);
+    }
+
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+  *++yyvsp = yylval;
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+
+  /* Shift the error token.  */
+  YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (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;
+
+
+#if !defined yyoverflow
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here.  |
+`-------------------------------------------------*/
+yyexhaustedlab:
+  yyerror (YY_("memory exhausted"));
+  yyresult = 2;
+  goto yyreturn;
+#endif
+
+
+/*-------------------------------------------------------.
+| yyreturn -- parsing is finished, clean up and return.  |
+`-------------------------------------------------------*/
+yyreturn:
+  if (yychar != YYEMPTY)
+    {
+      /* Make sure we have latest lookahead translation.  See comments at
+         user semantic actions for why this is necessary.  */
+      yytoken = YYTRANSLATE (yychar);
+      yydestruct ("Cleanup: discarding lookahead",
+                  yytoken, &yylval);
+    }
+  /* Do not reclaim the symbols of the rule whose action triggered
+     this YYABORT or YYACCEPT.  */
+  YYPOPSTACK (yylen);
+  YY_STACK_PRINT (yyss, yyssp);
+  while (yyssp != yyss)
+    {
+      yydestruct ("Cleanup: popping",
+                  YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
+      YYPOPSTACK (1);
+    }
+#ifndef yyoverflow
+  if (yyss != yyssa)
+    YYSTACK_FREE (yyss);
+#endif
+
+  return yyresult;
+}
+
diff --git a/engines/private/grammar.tab.cpp b/engines/private/grammar.tab.cpp
deleted file mode 100644
index 90b44daaa4..0000000000
--- a/engines/private/grammar.tab.cpp
+++ /dev/null
@@ -1,1762 +0,0 @@
-/* A Bison parser, made by GNU Bison 3.7.2.  */
-
-/* Bison implementation for Yacc-like parsers in C
-
-   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 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 3 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, see <http://www.gnu.org/licenses/>.  */
-
-/* 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.  */
-
-/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
-   especially those whose name start with YY_ or yy_.  They are
-   private implementation details that can be changed or removed.  */
-
-/* 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 "3.7.2"
-
-/* Skeleton name.  */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers.  */
-#define YYPURE 0
-
-/* Push parsers.  */
-#define YYPUSH 0
-
-/* Pull parsers.  */
-#define YYPULL 1
-
-
-
-
-/* First part of user prologue.  */
-#line 5 "engines/private/grammar.y"
-
-
-#include "grammar.h"
-
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#define	code1(c1)	Private::code(c1);
-#define	code2(c1,c2)	Private::code(c1); Private::code(c2)
-#define	code3(c1,c2,c3)	Private::code(c1); Private::code(c2); Private::code(c3)
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-int yydebug=1;
-
-using namespace Private;
-
-extern int yylex();
-extern int yyparse();
-
-void yyerror(const char *str)
-{
-    //fprintf(stderr,"error: %s\n",str);
-}
-
-int yywrap()
-{
-    return 1;
-}
-
-
-#line 104 "engines/private/grammar.tab.cpp"
-
-# ifndef YY_CAST
-#  ifdef __cplusplus
-#   define YY_CAST(Type, Val) static_cast<Type> (Val)
-#   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
-#  else
-#   define YY_CAST(Type, Val) ((Type) (Val))
-#   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
-#  endif
-# endif
-# ifndef YY_NULLPTR
-#  if defined __cplusplus
-#   if 201103L <= __cplusplus
-#    define YY_NULLPTR nullptr
-#   else
-#    define YY_NULLPTR 0
-#   endif
-#  else
-#   define YY_NULLPTR ((void*)0)
-#  endif
-# endif
-
-#include "grammar.tab.h"
-/* Symbol kind.  */
-enum yysymbol_kind_t
-{
-    YYSYMBOL_YYEMPTY = -2,
-    YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
-    YYSYMBOL_YYerror = 1,                    /* error  */
-    YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
-    YYSYMBOL_NAME = 3,                       /* NAME  */
-    YYSYMBOL_STRING = 4,                     /* STRING  */
-    YYSYMBOL_NUM = 5,                        /* NUM  */
-    YYSYMBOL_LTE = 6,                        /* LTE  */
-    YYSYMBOL_GTE = 7,                        /* GTE  */
-    YYSYMBOL_NEQ = 8,                        /* NEQ  */
-    YYSYMBOL_EQ = 9,                         /* EQ  */
-    YYSYMBOL_FALSETOK = 10,                  /* FALSETOK  */
-    YYSYMBOL_TRUETOK = 11,                   /* TRUETOK  */
-    YYSYMBOL_NULLTOK = 12,                   /* NULLTOK  */
-    YYSYMBOL_IFTOK = 13,                     /* IFTOK  */
-    YYSYMBOL_ELSETOK = 14,                   /* ELSETOK  */
-    YYSYMBOL_RECT = 15,                      /* RECT  */
-    YYSYMBOL_GOTOTOK = 16,                   /* GOTOTOK  */
-    YYSYMBOL_DEBUGTOK = 17,                  /* DEBUGTOK  */
-    YYSYMBOL_DEFINETOK = 18,                 /* DEFINETOK  */
-    YYSYMBOL_SETTINGTOK = 19,                /* SETTINGTOK  */
-    YYSYMBOL_RANDOMTOK = 20,                 /* RANDOMTOK  */
-    YYSYMBOL_21_ = 21,                       /* '{'  */
-    YYSYMBOL_22_ = 22,                       /* '}'  */
-    YYSYMBOL_23_ = 23,                       /* ','  */
-    YYSYMBOL_24_ = 24,                       /* ';'  */
-    YYSYMBOL_25_ = 25,                       /* '('  */
-    YYSYMBOL_26_ = 26,                       /* ')'  */
-    YYSYMBOL_27_ = 27,                       /* '!'  */
-    YYSYMBOL_28_ = 28,                       /* '+'  */
-    YYSYMBOL_29_ = 29,                       /* '<'  */
-    YYSYMBOL_30_ = 30,                       /* '>'  */
-    YYSYMBOL_31_ = 31,                       /* '%'  */
-    YYSYMBOL_YYACCEPT = 32,                  /* $accept  */
-    YYSYMBOL_lines = 33,                     /* lines  */
-    YYSYMBOL_line = 34,                      /* line  */
-    YYSYMBOL_debug = 35,                     /* debug  */
-    YYSYMBOL_statements = 36,                /* statements  */
-    YYSYMBOL_statement = 37,                 /* statement  */
-    YYSYMBOL_body = 38,                      /* body  */
-    YYSYMBOL_end = 39,                       /* end  */
-    YYSYMBOL_if = 40,                        /* if  */
-    YYSYMBOL_cond = 41,                      /* cond  */
-    YYSYMBOL_define = 42,                    /* define  */
-    YYSYMBOL_fcall = 43,                     /* fcall  */
-    YYSYMBOL_startp = 44,                    /* startp  */
-    YYSYMBOL_params = 45,                    /* params  */
-    YYSYMBOL_value = 46,                     /* value  */
-    YYSYMBOL_expr = 47                       /* expr  */
-};
-typedef enum yysymbol_kind_t yysymbol_kind_t;
-
-
-
-
-#ifdef short
-# undef short
-#endif
-
-/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
-   <limits.h> and (if available) <stdint.h> are included
-   so that the code can choose integer types of a good width.  */
-
-#ifndef __PTRDIFF_MAX__
-# include <limits.h> /* INFRINGES ON USER NAME SPACE */
-# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
-#  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
-#  define YY_STDINT_H
-# endif
-#endif
-
-/* Narrow types that promote to a signed type and that can represent a
-   signed or unsigned integer of at least N bits.  In tables they can
-   save space and decrease cache pressure.  Promoting to a signed type
-   helps avoid bugs in integer arithmetic.  */
-
-#ifdef __INT_LEAST8_MAX__
-typedef __INT_LEAST8_TYPE__ yytype_int8;
-#elif defined YY_STDINT_H
-typedef int_least8_t yytype_int8;
-#else
-typedef signed char yytype_int8;
-#endif
-
-#ifdef __INT_LEAST16_MAX__
-typedef __INT_LEAST16_TYPE__ yytype_int16;
-#elif defined YY_STDINT_H
-typedef int_least16_t yytype_int16;
-#else
-typedef short yytype_int16;
-#endif
-
-#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
-typedef __UINT_LEAST8_TYPE__ yytype_uint8;
-#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
-       && UINT_LEAST8_MAX <= INT_MAX)
-typedef uint_least8_t yytype_uint8;
-#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
-typedef unsigned char yytype_uint8;
-#else
-typedef short yytype_uint8;
-#endif
-
-#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
-typedef __UINT_LEAST16_TYPE__ yytype_uint16;
-#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
-       && UINT_LEAST16_MAX <= INT_MAX)
-typedef uint_least16_t yytype_uint16;
-#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
-typedef unsigned short yytype_uint16;
-#else
-typedef int yytype_uint16;
-#endif
-
-#ifndef YYPTRDIFF_T
-# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
-#  define YYPTRDIFF_T __PTRDIFF_TYPE__
-#  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
-# elif defined PTRDIFF_MAX
-#  ifndef ptrdiff_t
-#   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-#  endif
-#  define YYPTRDIFF_T ptrdiff_t
-#  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
-# else
-#  define YYPTRDIFF_T long
-#  define YYPTRDIFF_MAXIMUM LONG_MAX
-# endif
-#endif
-
-#ifndef YYSIZE_T
-# ifdef __SIZE_TYPE__
-#  define YYSIZE_T __SIZE_TYPE__
-# elif defined size_t
-#  define YYSIZE_T size_t
-# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
-#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-#  define YYSIZE_T size_t
-# else
-#  define YYSIZE_T unsigned
-# endif
-#endif
-
-#define YYSIZE_MAXIMUM                                  \
-  YY_CAST (YYPTRDIFF_T,                                 \
-           (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
-            ? YYPTRDIFF_MAXIMUM                         \
-            : YY_CAST (YYSIZE_T, -1)))
-
-#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
-
-
-/* Stored state numbers (used for stacks). */
-typedef yytype_int8 yy_state_t;
-
-/* State numbers in computations.  */
-typedef int yy_state_fast_t;
-
-#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
-
-
-#ifndef YY_ATTRIBUTE_PURE
-# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
-#  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
-# else
-#  define YY_ATTRIBUTE_PURE
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE_UNUSED
-# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
-#  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
-# else
-#  define YY_ATTRIBUTE_UNUSED
-# 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
-
-#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                            \
-    _Pragma ("GCC diagnostic push")                                     \
-    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
-    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
-    _Pragma ("GCC diagnostic pop")
-#else
-# define YY_INITIAL_VALUE(Value) Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
-#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
-#endif
-
-#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
-# define YY_IGNORE_USELESS_CAST_BEGIN                          \
-    _Pragma ("GCC diagnostic push")                            \
-    _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
-# define YY_IGNORE_USELESS_CAST_END            \
-    _Pragma ("GCC diagnostic pop")
-#endif
-#ifndef YY_IGNORE_USELESS_CAST_BEGIN
-# define YY_IGNORE_USELESS_CAST_BEGIN
-# define YY_IGNORE_USELESS_CAST_END
-#endif
-
-
-#define YY_ASSERT(E) ((void) (0 && (E)))
-
-#if !defined yyoverflow
-
-/* 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 EXIT_SUCCESS
-#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-/* Use EXIT_SUCCESS as a witness for stdlib.h.  */
-#     ifndef EXIT_SUCCESS
-#      define EXIT_SUCCESS 0
-#     endif
-#    endif
-#   endif
-#  endif
-# endif
-
-# ifdef YYSTACK_ALLOC
-/* Pacify GCC's 'empty if-body' warning.  */
-#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (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 EXIT_SUCCESS \
-       && ! ((defined YYMALLOC || defined malloc) \
-             && (defined YYFREE || defined free)))
-#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#   ifndef EXIT_SUCCESS
-#    define EXIT_SUCCESS 0
-#   endif
-#  endif
-#  ifndef YYMALLOC
-#   define YYMALLOC malloc
-#   if ! defined malloc && ! defined EXIT_SUCCESS
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
-#   endif
-#  endif
-#  ifndef YYFREE
-#   define YYFREE free
-#   if ! defined free && ! defined EXIT_SUCCESS
-void free (void *); /* INFRINGES ON USER NAME SPACE */
-#   endif
-#  endif
-# endif
-#endif /* !defined yyoverflow */
-
-#if (! defined yyoverflow \
-     && (! defined __cplusplus \
-         || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member.  */
-union yyalloc
-{
-    yy_state_t yyss_alloc;
-    YYSTYPE yyvs_alloc;
-};
-
-/* The size of the maximum gap between one aligned stack and the next.  */
-# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
-   N elements.  */
-# define YYSTACK_BYTES(N) \
-     ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
-      + YYSTACK_GAP_MAXIMUM)
-
-# define YYCOPY_NEEDED 1
-
-/* 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_alloc, Stack)                           \
-    do                                                                  \
-      {                                                                 \
-        YYPTRDIFF_T yynewbytes;                                         \
-        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
-        Stack = &yyptr->Stack_alloc;                                    \
-        yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
-        yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
-      }                                                                 \
-    while (0)
-
-#endif
-
-#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from SRC to DST.  The source and destination do
-   not overlap.  */
-# ifndef YYCOPY
-#  if defined __GNUC__ && 1 < __GNUC__
-#   define YYCOPY(Dst, Src, Count) \
-      __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
-#  else
-#   define YYCOPY(Dst, Src, Count)              \
-      do                                        \
-        {                                       \
-          YYPTRDIFF_T yyi;                      \
-          for (yyi = 0; yyi < (Count); yyi++)   \
-            (Dst)[yyi] = (Src)[yyi];            \
-        }                                       \
-      while (0)
-#  endif
-# endif
-#endif /* !YYCOPY_NEEDED */
-
-/* YYFINAL -- State number of the termination state.  */
-#define YYFINAL  9
-/* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   125
-
-/* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  32
-/* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  16
-/* YYNRULES -- Number of rules.  */
-#define YYNRULES  50
-/* YYNSTATES -- Number of states.  */
-#define YYNSTATES  113
-
-/* YYMAXUTOK -- Last valid token kind.  */
-#define YYMAXUTOK   275
-
-
-/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
-   as returned by yylex, with out-of-bounds checking.  */
-#define YYTRANSLATE(YYX)                                \
-  (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
-   ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
-   : YYSYMBOL_YYUNDEF)
-
-/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
-   as returned by yylex.  */
-static const yytype_int8 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,    27,     2,     2,     2,    31,     2,     2,
-    25,    26,     2,    28,    23,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,    24,
-    29,     2,    30,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,    21,     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,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-    2,     2,     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,
-    15,    16,    17,    18,    19,    20
-};
-
-#if YYDEBUG
-/* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
-static const yytype_uint8 yyrline[] =
-{
-    0,    54,    54,    55,    58,    59,    60,    63,    64,    67,
-    68,    71,    78,    79,    84,    92,    93,    96,    99,   102,
-    105,   106,   111,   115,   116,   119,   127,   128,   136,   139,
-    140,   141,   142,   143,   146,   147,   148,   149,   150,   151,
-    154,   155,   156,   157,   158,   159,   160,   161,   162,   163,
-    164
-};
-#endif
-
-/** Accessing symbol of state STATE.  */
-#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
-
-#if YYDEBUG || 0
-/* The user-facing name of the symbol whose (internal) number is
-   YYSYMBOL.  No bounds checking.  */
-static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
-
-/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
-   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
-static const char *const yytname[] =
-{
-    "\"end of file\"", "error", "\"invalid token\"", "NAME", "STRING",
-    "NUM", "LTE", "GTE", "NEQ", "EQ", "FALSETOK", "TRUETOK", "NULLTOK",
-    "IFTOK", "ELSETOK", "RECT", "GOTOTOK", "DEBUGTOK", "DEFINETOK",
-    "SETTINGTOK", "RANDOMTOK", "'{'", "'}'", "','", "';'", "'('", "')'",
-    "'!'", "'+'", "'<'", "'>'", "'%'", "$accept", "lines", "line", "debug",
-    "statements", "statement", "body", "end", "if", "cond", "define",
-    "fcall", "startp", "params", "value", "expr", YY_NULLPTR
-};
-
-static const char *
-yysymbol_name (yysymbol_kind_t yysymbol)
-{
-    return yytname[yysymbol];
-}
-#endif
-
-#ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
-   (internal) symbol number NUM (which must be that of a token).  */
-static const yytype_int16 yytoknum[] =
-{
-    0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
-    265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
-    275,   123,   125,    44,    59,    40,    41,    33,    43,    60,
-    62,    37
-};
-#endif
-
-#define YYPACT_NINF (-73)
-
-#define yypact_value_is_default(Yyn) \
-  ((Yyn) == YYPACT_NINF)
-
-#define YYTABLE_NINF (-1)
-
-#define yytable_value_is_error(Yyn) \
-  0
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-   STATE-NUM.  */
-static const yytype_int8 yypact[] =
-{
-    8,   -11,    11,    12,    18,     8,    30,    22,    23,   -73,
-    -73,    24,    38,    42,    59,    30,   -73,    40,    39,    41,
-    -73,    54,    16,    58,    59,    56,    60,   -73,     5,   -73,
-    -73,    77,    61,    83,   -73,   -73,    19,    52,   -73,    62,
-    -73,     1,    65,   -73,    63,   -73,   -73,   -73,   -73,   -73,
-    -73,    67,    66,    29,    64,    59,   -73,   -73,    86,    41,
-    68,    71,    69,    73,    92,   -73,    93,   -73,    66,    66,
-    66,    66,    66,    66,    66,   -73,    78,    50,    76,     1,
-    -73,     1,    79,    70,   -73,   -73,   -73,   -73,   -73,   -73,
-    -73,   -73,    52,    98,   -73,   -73,    99,    80,   -73,    82,
-    84,   -73,   -73,   103,   104,    87,    85,   107,   -73,    88,
-    90,    42,   -73
-};
-
-/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
-   Performed when YYTABLE does not specify something else to do.  Zero
-   means the default is an error.  */
-static const yytype_int8 yydefact[] =
-{
-    0,     0,     0,     0,     0,     3,     7,     0,     0,     1,
-    2,     0,     0,    20,     9,     7,     4,    24,     0,     0,
-    18,     0,     0,     0,     9,     0,     0,     8,    20,     5,
-    28,     0,     0,     0,     6,    10,     0,     0,    12,     0,
-    23,    29,     0,    11,     0,    39,    38,    37,    35,    36,
-    34,     0,     0,    40,     0,     9,    15,    17,     0,    39,
-    0,    33,     0,    32,     0,    25,     0,    41,     0,     0,
-    0,     0,    49,     0,     0,    19,     0,    13,     0,    29,
-    27,    29,     0,     0,    47,    48,    43,    42,    44,    45,
-    46,    16,     0,     0,    30,    31,     0,     0,    17,     0,
-    0,    50,    14,     0,     0,     0,     0,     0,    26,     0,
-    22,    20,    21
-};
-
-/* YYPGOTO[NTERM-NUM].  */
-static const yytype_int8 yypgoto[] =
-{
-    -73,   110,   -73,   101,   -21,   -36,    25,    20,   -73,   -73,
-        -28,   -39,   -73,   -72,   -20,    89
-    };
-
-/* YYDEFGOTO[NTERM-NUM].  */
-static const yytype_int8 yydefgoto[] =
-{
-    -1,     4,     5,    12,    23,    24,    57,    77,    25,    37,
-        18,    26,    41,    62,    53,    63
-    };
-
-/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
-   positive, shift that token.  If negative, reduce the rule whose
-   number is the opposite.  If YYTABLE_NINF, syntax error.  */
-static const yytype_int8 yytable[] =
-{
-    40,    56,    61,    35,    59,    46,    47,    94,    17,    95,
-    6,    48,    49,    50,     7,     8,    21,    60,     9,    32,
-    39,    51,    45,    46,    47,     1,     2,     3,    52,    48,
-    49,    50,    67,    11,    76,    68,    69,    70,    71,    51,
-    61,    33,    61,    13,    14,    17,    52,    15,    84,    85,
-    86,    87,    88,    89,    90,    19,    56,    72,    73,    74,
-    16,    29,    19,    28,    92,    20,    30,    21,    22,    45,
-    46,    47,    20,    55,    21,    22,    48,    49,    50,    31,
-    34,    36,    42,   112,    38,    43,    44,    58,    64,    65,
-    75,    78,    66,    33,    79,    80,    81,    82,    83,    93,
-    91,    97,    96,    99,   100,   103,   101,   104,   105,   106,
-    107,   108,   109,   111,   110,    10,    27,    98,   102,     0,
-    0,     0,     0,     0,     0,    54
-};
-
-static const yytype_int8 yycheck[] =
-{
-    28,    37,    41,    24,     3,     4,     5,    79,     3,    81,
-    21,    10,    11,    12,     3,     3,    15,    16,     0,     3,
-    15,    20,     3,     4,     5,    17,    18,    19,    27,    10,
-    11,    12,    52,     3,    55,     6,     7,     8,     9,    20,
-    79,    25,    81,    21,    21,     3,    27,    23,    68,    69,
-    70,    71,    72,    73,    74,     3,    92,    28,    29,    30,
-    22,    22,     3,    23,    14,    13,    25,    15,    16,     3,
-    4,     5,    13,    21,    15,    16,    10,    11,    12,    25,
-    22,    25,     5,   111,    24,    24,     3,    25,    23,    26,
-    26,     5,    25,    25,    23,    26,    23,     5,     5,    23,
-    22,    31,    23,     5,     5,    23,    26,    23,     5,     5,
-    23,    26,     5,    23,    26,     5,    15,    92,    98,    -1,
-    -1,    -1,    -1,    -1,    -1,    36
-};
-
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-   symbol of state STATE-NUM.  */
-static const yytype_int8 yystos[] =
-{
-    0,    17,    18,    19,    33,    34,    21,     3,     3,     0,
-    33,     3,    35,    21,    21,    23,    22,     3,    42,     3,
-    13,    15,    16,    36,    37,    40,    43,    35,    23,    22,
-    25,    25,     3,    25,    22,    36,    25,    41,    24,    15,
-    42,    44,     5,    24,     3,     3,     4,     5,    10,    11,
-    12,    20,    27,    46,    47,    21,    37,    38,    25,     3,
-    16,    43,    45,    47,    23,    26,    25,    46,     6,     7,
-    8,     9,    28,    29,    30,    26,    36,    39,     5,    23,
-    26,    23,     5,     5,    46,    46,    46,    46,    46,    46,
-    46,    22,    14,    23,    45,    45,    23,    31,    38,     5,
-    5,    26,    39,    23,    23,     5,     5,    23,    26,     5,
-    26,    23,    42
-};
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
-static const yytype_int8 yyr1[] =
-{
-    0,    32,    33,    33,    34,    34,    34,    35,    35,    36,
-    36,    37,    37,    37,    37,    38,    38,    39,    40,    41,
-    42,    42,    42,    42,    42,    43,    43,    43,    44,    45,
-    45,    45,    45,    45,    46,    46,    46,    46,    46,    46,
-    47,    47,    47,    47,    47,    47,    47,    47,    47,    47,
-    47
-};
-
-/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
-static const yytype_int8 yyr2[] =
-{
-    0,     2,     2,     1,     4,     5,     5,     0,     3,     0,
-    2,     3,     2,     4,     7,     1,     3,     0,     1,     3,
-    0,    14,    12,     3,     1,     4,    10,     5,     0,     0,
-    3,     3,     1,     1,     1,     1,     1,     1,     1,     1,
-    1,     2,     3,     3,     3,     3,     3,     3,     3,     2,
-    5
-};
-
-
-enum { YYENOMEM = -2 };
-
-#define yyerrok         (yyerrstatus = 0)
-#define yyclearin       (yychar = YYEMPTY)
-
-#define YYACCEPT        goto yyacceptlab
-#define YYABORT         goto yyabortlab
-#define YYERROR         goto yyerrorlab
-
-
-#define YYRECOVERING()  (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value)                                    \
-  do                                                              \
-    if (yychar == YYEMPTY)                                        \
-      {                                                           \
-        yychar = (Token);                                         \
-        yylval = (Value);                                         \
-        YYPOPSTACK (yylen);                                       \
-        yystate = *yyssp;                                         \
-        goto yybackup;                                            \
-      }                                                           \
-    else                                                          \
-      {                                                           \
-        yyerror (YY_("syntax error: cannot back up")); \
-        YYERROR;                                                  \
-      }                                                           \
-  while (0)
-
-/* Backward compatibility with an undocumented macro.
-   Use YYerror or YYUNDEF. */
-#define YYERRCODE YYUNDEF
-
-
-/* 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 (0)
-
-/* This macro is provided for backward compatibility. */
-# ifndef YY_LOCATION_PRINT
-#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
-
-
-# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
-do {                                                                      \
-  if (yydebug)                                                            \
-    {                                                                     \
-      YYFPRINTF (stderr, "%s ", Title);                                   \
-      yy_symbol_print (stderr,                                            \
-                  Kind, Value); \
-      YYFPRINTF (stderr, "\n");                                           \
-    }                                                                     \
-} while (0)
-
-
-/*-----------------------------------.
-| Print this symbol's value on YYO.  |
-`-----------------------------------*/
-
-static void
-yy_symbol_value_print (FILE *yyo,
-                       yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
-{
-    FILE *yyoutput = yyo;
-    YYUSE (yyoutput);
-    if (!yyvaluep)
-        return;
-# ifdef YYPRINT
-    if (yykind < YYNTOKENS)
-        YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
-# endif
-    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-    YYUSE (yykind);
-    YY_IGNORE_MAYBE_UNINITIALIZED_END
-}
-
-
-/*---------------------------.
-| Print this symbol on YYO.  |
-`---------------------------*/
-
-static void
-yy_symbol_print (FILE *yyo,
-                 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
-{
-    YYFPRINTF (yyo, "%s %s (",
-               yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
-
-    yy_symbol_value_print (yyo, yykind, yyvaluep);
-    YYFPRINTF (yyo, ")");
-}
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included).                                                   |
-`------------------------------------------------------------------*/
-
-static void
-yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
-{
-    YYFPRINTF (stderr, "Stack now");
-    for (; yybottom <= yytop; yybottom++)
-    {
-        int yybot = *yybottom;
-        YYFPRINTF (stderr, " %d", yybot);
-    }
-    YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top)                            \
-do {                                                            \
-  if (yydebug)                                                  \
-    yy_stack_print ((Bottom), (Top));                           \
-} while (0)
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced.  |
-`------------------------------------------------*/
-
-static void
-yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
-                 int yyrule)
-{
-    int yylno = yyrline[yyrule];
-    int yynrhs = yyr2[yyrule];
-    int yyi;
-    YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
-               yyrule - 1, yylno);
-    /* The symbols being reduced.  */
-    for (yyi = 0; yyi < yynrhs; yyi++)
-    {
-        YYFPRINTF (stderr, "   $%d = ", yyi + 1);
-        yy_symbol_print (stderr,
-                         YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
-                         &yyvsp[(yyi + 1) - (yynrhs)]);
-        YYFPRINTF (stderr, "\n");
-    }
-}
-
-# define YY_REDUCE_PRINT(Rule)          \
-do {                                    \
-  if (yydebug)                          \
-    yy_reduce_print (yyssp, yyvsp, Rule); \
-} while (0)
-
-/* Nonzero means print parse trace.  It is left uninitialized so that
-   multiple parsers can coexist.  */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args) ((void) 0)
-# define YY_SYMBOL_PRINT(Title, Kind, 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
-
-
-
-
-
-
-/*-----------------------------------------------.
-| Release the memory associated to this symbol.  |
-`-----------------------------------------------*/
-
-static void
-yydestruct (const char *yymsg,
-            yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
-{
-    YYUSE (yyvaluep);
-    if (!yymsg)
-        yymsg = "Deleting";
-    YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
-
-    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-    YYUSE (yykind);
-    YY_IGNORE_MAYBE_UNINITIALIZED_END
-}
-
-
-/* Lookahead token kind.  */
-int yychar;
-
-/* The semantic value of the lookahead symbol.  */
-YYSTYPE yylval;
-/* Number of syntax errors so far.  */
-int yynerrs;
-
-
-
-
-/*----------.
-| yyparse.  |
-`----------*/
-
-int
-yyparse (void)
-{
-    yy_state_fast_t yystate = 0;
-    /* Number of tokens to shift before error messages enabled.  */
-    int yyerrstatus = 0;
-
-    /* Refer to the stacks through separate pointers, to allow yyoverflow
-       to reallocate them elsewhere.  */
-
-    /* Their size.  */
-    YYPTRDIFF_T yystacksize = YYINITDEPTH;
-
-    /* The state stack: array, bottom, top.  */
-    yy_state_t yyssa[YYINITDEPTH];
-    yy_state_t *yyss = yyssa;
-    yy_state_t *yyssp = yyss;
-
-    /* The semantic value stack: array, bottom, top.  */
-    YYSTYPE yyvsa[YYINITDEPTH];
-    YYSTYPE *yyvs = yyvsa;
-    YYSTYPE *yyvsp = yyvs;
-
-    int yyn;
-    /* The return value of yyparse.  */
-    int yyresult;
-    /* Lookahead symbol kind.  */
-    yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
-    /* The variables used to return semantic value and location from the
-       action routines.  */
-    YYSTYPE yyval;
-
-
-
-#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
-
-    /* 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"));
-
-    yychar = YYEMPTY; /* Cause a token to be read.  */
-    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 -- set current state (the top of the stack) to yystate.  |
-    `--------------------------------------------------------------------*/
-yysetstate:
-    YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-    YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
-    YY_IGNORE_USELESS_CAST_BEGIN
-    *yyssp = YY_CAST (yy_state_t, yystate);
-    YY_IGNORE_USELESS_CAST_END
-    YY_STACK_PRINT (yyss, yyssp);
-
-    if (yyss + yystacksize - 1 <= yyssp)
-#if !defined yyoverflow && !defined YYSTACK_RELOCATE
-        goto yyexhaustedlab;
-#else
-    {
-        /* Get the current used size of the three stacks, in elements.  */
-        YYPTRDIFF_T yysize = yyssp - yyss + 1;
-
-# if defined 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.  */
-            yy_state_t *yyss1 = yyss;
-            YYSTYPE *yyvs1 = yyvs;
-
-            /* 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 * YYSIZEOF (*yyssp),
-                        &yyvs1, yysize * YYSIZEOF (*yyvsp),
-                        &yystacksize);
-            yyss = yyss1;
-            yyvs = yyvs1;
-        }
-# else /* defined YYSTACK_RELOCATE */
-        /* Extend the stack our own way.  */
-        if (YYMAXDEPTH <= yystacksize)
-            goto yyexhaustedlab;
-        yystacksize *= 2;
-        if (YYMAXDEPTH < yystacksize)
-            yystacksize = YYMAXDEPTH;
-
-        {
-            yy_state_t *yyss1 = yyss;
-            union yyalloc *yyptr =
-                    YY_CAST (union yyalloc *,
-                             YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
-            if (! yyptr)
-                goto yyexhaustedlab;
-            YYSTACK_RELOCATE (yyss_alloc, yyss);
-            YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-#  undef YYSTACK_RELOCATE
-            if (yyss1 != yyssa)
-                YYSTACK_FREE (yyss1);
-        }
-# endif
-
-        yyssp = yyss + yysize - 1;
-        yyvsp = yyvs + yysize - 1;
-
-        YY_IGNORE_USELESS_CAST_BEGIN
-        YYDPRINTF ((stderr, "Stack size increased to %ld\n",
-                    YY_CAST (long, yystacksize)));
-        YY_IGNORE_USELESS_CAST_END
-
-        if (yyss + yystacksize - 1 <= yyssp)
-            YYABORT;
-    }
-#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
-
-    if (yystate == YYFINAL)
-        YYACCEPT;
-
-    goto yybackup;
-
-
-    /*-----------.
-    | yybackup.  |
-    `-----------*/
-yybackup:
-    /* Do appropriate processing given the current state.  Read a
-       lookahead token if we need one and don't already have one.  */
-
-    /* First try to decide what to do without reference to lookahead token.  */
-    yyn = yypact[yystate];
-    if (yypact_value_is_default (yyn))
-        goto yydefault;
-
-    /* Not known => get a lookahead token if don't already have one.  */
-
-    /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
-    if (yychar == YYEMPTY)
-    {
-        YYDPRINTF ((stderr, "Reading a token\n"));
-        yychar = yylex ();
-    }
-
-    if (yychar <= YYEOF)
-    {
-        yychar = YYEOF;
-        yytoken = YYSYMBOL_YYEOF;
-        YYDPRINTF ((stderr, "Now at end of input.\n"));
-    }
-    else if (yychar == YYerror)
-    {
-        /* The scanner already issued an error message, process directly
-           to error recovery.  But do not keep the error token as
-           lookahead, it is too special and may lead us to an endless
-           loop in error recovery. */
-        yychar = YYUNDEF;
-        yytoken = YYSYMBOL_YYerror;
-        goto yyerrlab1;
-    }
-    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 (yytable_value_is_error (yyn))
-            goto yyerrlab;
-        yyn = -yyn;
-        goto yyreduce;
-    }
-
-    /* Count tokens shifted since error; after three, turn off error
-       status.  */
-    if (yyerrstatus)
-        yyerrstatus--;
-
-    /* Shift the lookahead token.  */
-    YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-    yystate = yyn;
-    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-    *++yyvsp = yylval;
-    YY_IGNORE_MAYBE_UNINITIALIZED_END
-
-    /* Discard the shifted token.  */
-    yychar = YYEMPTY;
-    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 4: /* line: DEBUGTOK '{' debug '}'  */
-#line 58 "engines/private/grammar.y"
-        { /* Not used in the game */ }
-#line 1203 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 5: /* line: DEFINETOK NAME '{' define '}'  */
-#line 59 "engines/private/grammar.y"
-        {
-            installAll((yyvsp[-3].s));
-        }
-#line 1209 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 6: /* line: SETTINGTOK NAME '{' statements '}'  */
-#line 60 "engines/private/grammar.y"
-        {
-            saveSetting((yyvsp[-3].s));
-            initSetting();
-        }
-#line 1215 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 9: /* statements: %empty  */
-#line 67 "engines/private/grammar.y"
-        {
-            (yyval.inst) = progp;
-        }
-#line 1221 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 11: /* statement: GOTOTOK NAME ';'  */
-#line 71 "engines/private/grammar.y"
-        {
-            (yyval.inst) = progp;
-            code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s)));
-            code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
-            code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto"));
-            code1(funcpush);
-        }
-#line 1233 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 12: /* statement: fcall ';'  */
-#line 78 "engines/private/grammar.y"
-        {
-            (yyval.inst) = (yyvsp[-1].inst);
-        }
-#line 1239 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 13: /* statement: if cond body end  */
-#line 79 "engines/private/grammar.y"
-        {
-            /* else-less if */
-            ((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst);	/* thenpart */
-            ((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst);
-        }
-#line 1249 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 14: /* statement: if cond body end ELSETOK body end  */
-#line 84 "engines/private/grammar.y"
-        {
-            /* if with else */
-            ((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst);	/* thenpart */
-            ((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst);	/* elsepart */
-            ((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst);
-        }
-#line 1260 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 15: /* body: statement  */
-#line 92 "engines/private/grammar.y"
-        {
-            (yyval.inst) = (yyvsp[0].inst);
-        }
-#line 1266 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 16: /* body: '{' statements '}'  */
-#line 93 "engines/private/grammar.y"
-        {
-            (yyval.inst) = (yyvsp[-1].inst);
-        }
-#line 1272 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 17: /* end: %empty  */
-#line 96 "engines/private/grammar.y"
-        {
-            code(STOP);
-            (yyval.inst) = progp;
-        }
-#line 1278 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 18: /* if: IFTOK  */
-#line 99 "engines/private/grammar.y"
-        {
-            (yyval.inst) = code(ifcode);
-            code3(STOP, STOP, STOP);
-        }
-#line 1284 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 19: /* cond: '(' expr ')'  */
-#line 102 "engines/private/grammar.y"
-        {
-            code(STOP);
-            (yyval.inst) = (yyvsp[-1].inst);
-        }
-#line 1290 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  */
-#line 106 "engines/private/grammar.y"
-        {
-            Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
-            assert(r->isValidRect());
-            defineSymbol((yyvsp[-13].s), r);
-        }
-#line 1300 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
-#line 111 "engines/private/grammar.y"
-        {
-            Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);
-            defineSymbol((yyvsp[-11].s), r);
-        }
-#line 1309 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 23: /* define: NAME ',' define  */
-#line 115 "engines/private/grammar.y"
-        {
-            defineSymbol((yyvsp[-2].s), NULL);
-        }
-#line 1315 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 24: /* define: NAME  */
-#line 116 "engines/private/grammar.y"
-        {
-            defineSymbol((yyvsp[0].s), NULL);
-        }
-#line 1321 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 25: /* fcall: GOTOTOK '(' NAME ')'  */
-#line 119 "engines/private/grammar.y"
-        {
-            (yyval.inst) = progp;
-            code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s)));
-            code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
-            code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto"));
-            code1(funcpush);
-        }
-#line 1333 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
-#line 127 "engines/private/grammar.y"
-        {
-            (yyval.inst) = progp;
-        }
-#line 1339 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 27: /* fcall: NAME '(' startp params ')'  */
-#line 128 "engines/private/grammar.y"
-        {
-            (yyval.inst) = (yyvsp[-2].inst);
-            code2(constpush, (Private::Inst) constant(NUM, (yyvsp[-1].narg), NULL));
-            code2(strpush, (Private::Inst) constant(STRING, 0, (yyvsp[-4].s)));
-            code1(funcpush);
-        }
-#line 1350 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 28: /* startp: %empty  */
-#line 136 "engines/private/grammar.y"
-        {
-            (yyval.inst) = progp;
-        }
-#line 1356 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 29: /* params: %empty  */
-#line 139 "engines/private/grammar.y"
-        {
-            (yyval.narg) = 0;
-        }
-#line 1362 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 30: /* params: fcall ',' params  */
-#line 140 "engines/private/grammar.y"
-        {
-            (yyval.narg) = (yyvsp[0].narg) + 1;
-        }
-#line 1368 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 31: /* params: expr ',' params  */
-#line 141 "engines/private/grammar.y"
-        {
-            (yyval.narg) = (yyvsp[0].narg) + 1;
-        }
-#line 1374 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 32: /* params: expr  */
-#line 142 "engines/private/grammar.y"
-        {
-            (yyval.narg) = 1;
-        }
-#line 1380 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 33: /* params: fcall  */
-#line 143 "engines/private/grammar.y"
-        {
-            (yyval.narg) = 1;
-        }
-#line 1386 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 34: /* value: NULLTOK  */
-#line 146 "engines/private/grammar.y"
-        {
-            code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL));
-        }
-#line 1392 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 35: /* value: FALSETOK  */
-#line 147 "engines/private/grammar.y"
-        {
-            code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL));
-        }
-#line 1398 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 36: /* value: TRUETOK  */
-#line 148 "engines/private/grammar.y"
-        {
-            code2(Private::constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
-        }
-#line 1404 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 37: /* value: NUM  */
-#line 149 "engines/private/grammar.y"
-        {
-            code2(Private::constpush, (Private::Inst)(yyvsp[0].sym));
-        }
-#line 1410 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 38: /* value: STRING  */
-#line 150 "engines/private/grammar.y"
-        {
-            code2(Private::strpush, (Private::Inst)(yyvsp[0].sym));
-        }
-#line 1416 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 39: /* value: NAME  */
-#line 151 "engines/private/grammar.y"
-        {
-            code1(Private::varpush);
-            code1((Private::Inst) lookupName((yyvsp[0].s)));
-            code1(Private::eval);
-        }
-#line 1422 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 40: /* expr: value  */
-#line 154 "engines/private/grammar.y"
-        {
-            (yyval.inst) = (yyvsp[0].inst);
-        }
-#line 1428 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 41: /* expr: '!' value  */
-#line 155 "engines/private/grammar.y"
-        {
-            code1(Private::negate);
-            (yyval.inst) = (yyvsp[0].inst);
-        }
-#line 1434 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 42: /* expr: value EQ value  */
-#line 156 "engines/private/grammar.y"
-        {
-            code1(Private::eq);
-        }
-#line 1440 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 43: /* expr: value NEQ value  */
-#line 157 "engines/private/grammar.y"
-        {
-            code1(Private::ne);
-        }
-#line 1446 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 44: /* expr: value '+' value  */
-#line 158 "engines/private/grammar.y"
-        {
-            code1(Private::add);
-        }
-#line 1452 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 45: /* expr: value '<' value  */
-#line 159 "engines/private/grammar.y"
-        {
-            code1(Private::lt);
-        }
-#line 1458 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 46: /* expr: value '>' value  */
-#line 160 "engines/private/grammar.y"
-        {
-            code1(Private::gt);
-        }
-#line 1464 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 47: /* expr: value LTE value  */
-#line 161 "engines/private/grammar.y"
-        {
-            code1(Private::le);
-        }
-#line 1470 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 48: /* expr: value GTE value  */
-#line 162 "engines/private/grammar.y"
-        {
-            code1(Private::ge);
-        }
-#line 1476 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 49: /* expr: value '+'  */
-#line 163 "engines/private/grammar.y"
-        {
-            (yyval.inst) = (yyvsp[-1].inst);
-        }
-#line 1482 "engines/private/grammar.tab.cpp"
-        break;
-
-    case 50: /* expr: RANDOMTOK '(' NUM '%' ')'  */
-#line 164 "engines/private/grammar.y"
-        {
-            code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool);
-        }
-#line 1488 "engines/private/grammar.tab.cpp"
-        break;
-
-
-#line 1492 "engines/private/grammar.tab.cpp"
-
-    default:
-        break;
-    }
-    /* User semantic actions sometimes alter yychar, and that requires
-       that yytoken be updated with the new translation.  We take the
-       approach of translating immediately before every use of yytoken.
-       One alternative is translating here after every semantic action,
-       but that translation would be missed if the semantic action invokes
-       YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
-       if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
-       incorrect destructor might then be invoked immediately.  In the
-       case of YYERROR or YYBACKUP, subsequent parser actions might lead
-       to an incorrect destructor call or verbose syntax error message
-       before the lookahead is translated.  */
-    YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
-
-    YYPOPSTACK (yylen);
-    yylen = 0;
-
-    *++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.  */
-    {
-        const int yylhs = yyr1[yyn] - YYNTOKENS;
-        const int yyi = yypgoto[yylhs] + *yyssp;
-        yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
-                   ? yytable[yyi]
-                   : yydefgoto[yylhs]);
-    }
-
-    goto yynewstate;
-
-
-    /*--------------------------------------.
-    | yyerrlab -- here on detecting error.  |
-    `--------------------------------------*/
-yyerrlab:
-    /* Make sure we have latest lookahead translation.  See comments at
-       user semantic actions for why this is necessary.  */
-    yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
-    /* If not already recovering from an error, report this error.  */
-    if (!yyerrstatus)
-    {
-        ++yynerrs;
-        yyerror (YY_("syntax error"));
-    }
-
-    if (yyerrstatus == 3)
-    {
-        /* If just tried and failed to reuse lookahead 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 lookahead token after shifting the error
-       token.  */
-    goto yyerrlab1;
-
-
-    /*---------------------------------------------------.
-    | yyerrorlab -- error raised explicitly by YYERROR.  |
-    `---------------------------------------------------*/
-yyerrorlab:
-    /* Pacify compilers when the user code never invokes YYERROR and the
-       label yyerrorlab therefore never appears in user code.  */
-    if (0)
-        YYERROR;
-
-    /* Do not reclaim the symbols of the rule whose 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.  */
-
-    /* Pop stack until we find a state that shifts the error token.  */
-    for (;;)
-    {
-        yyn = yypact[yystate];
-        if (!yypact_value_is_default (yyn))
-        {
-            yyn += YYSYMBOL_YYerror;
-            if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
-            {
-                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",
-                    YY_ACCESSING_SYMBOL (yystate), yyvsp);
-        YYPOPSTACK (1);
-        yystate = *yyssp;
-        YY_STACK_PRINT (yyss, yyssp);
-    }
-
-    YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-    *++yyvsp = yylval;
-    YY_IGNORE_MAYBE_UNINITIALIZED_END
-
-
-    /* Shift the error token.  */
-    YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (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;
-
-
-#if !defined yyoverflow
-    /*-------------------------------------------------.
-    | yyexhaustedlab -- memory exhaustion comes here.  |
-    `-------------------------------------------------*/
-yyexhaustedlab:
-    yyerror (YY_("memory exhausted"));
-    yyresult = 2;
-    goto yyreturn;
-#endif
-
-
-    /*-------------------------------------------------------.
-    | yyreturn -- parsing is finished, clean up and return.  |
-    `-------------------------------------------------------*/
-yyreturn:
-    if (yychar != YYEMPTY)
-    {
-        /* Make sure we have latest lookahead translation.  See comments at
-           user semantic actions for why this is necessary.  */
-        yytoken = YYTRANSLATE (yychar);
-        yydestruct ("Cleanup: discarding lookahead",
-                    yytoken, &yylval);
-    }
-    /* Do not reclaim the symbols of the rule whose action triggered
-       this YYABORT or YYACCEPT.  */
-    YYPOPSTACK (yylen);
-    YY_STACK_PRINT (yyss, yyssp);
-    while (yyssp != yyss)
-    {
-        yydestruct ("Cleanup: popping",
-                    YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
-        YYPOPSTACK (1);
-    }
-#ifndef yyoverflow
-    if (yyss != yyssa)
-        YYSTACK_FREE (yyss);
-#endif
-
-    return yyresult;
-}
-
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 3b69f97091..aa42f1439c 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -1,46 +1,59 @@
+/* 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.
+ *
+ */
+
 %require "3.6"
-%defines "engines/private/grammar.tab.h"
-%output "engines/private/grammar.tab.cpp"
+%defines "engines/private/tokens.h"
+%output "engines/private/grammar.cpp"
 
 %{
 
 #include "grammar.h"
 
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#define	code1(c1)	Private::code(c1);
-#define	code2(c1,c2)	Private::code(c1); Private::code(c2)
-#define	code3(c1,c2,c3)	Private::code(c1); Private::code(c2); Private::code(c3)
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-int yydebug=1;
+#define code1(c1)       Private::code(c1);
+#define code2(c1,c2)    Private::code(c1); Private::code(c2)
+#define code3(c1,c2,c3) Private::code(c1); Private::code(c2); Private::code(c3)
 
 using namespace Private;
 
 extern int yylex();
 extern int yyparse();
 
-void yyerror(const char *str)
-{
-	//fprintf(stderr,"error: %s\n",str);
+void yyerror(const char *str) {
 }
 
-int yywrap()
-{
-	return 1;
+
+int yywrap() {
+    return 1;
 }
 
+
 %}
 
 %union {
-	Private::Symbol	*sym;	/* symbol table pointer */
-        int (**inst)();	/* machine instruction */
-        char *s;
-        int *i;
-        int narg;
+        Private::Symbol *sym; /* symbol table pointer */
+        int (**inst)();       /* machine instruction */
+        char *s;              /* string value */
+        int *i;               /* integer value */
+        int narg;             /* auxiliary value to count function arguments */
 }
 
 %token<s> NAME
@@ -70,36 +83,36 @@ statements:  /* nothing */     { $$ = progp; }
 
 statement: GOTOTOK NAME ';' {
         $$ = progp;
-	code2(strpush, (Private::Inst) Private::constant(STRING, 0, $NAME));
+        code2(strpush, (Private::Inst) Private::constant(STRING, 0, $NAME));
         code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
         code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
         code1(funcpush);
         }
         | fcall ';'         { $$ = $1; }   
         | if cond body end {
-         	/* else-less if */
-		($1)[1] = (Inst)$3;	/* thenpart */
-		($1)[3] = (Inst)$4; 
-                }	/* end, if cond fails */
+                /* else-less if */
+                ($1)[1] = (Inst)$3;     /* thenpart */
+                ($1)[3] = (Inst)$4; 
+                }                       /* end, if cond fails */
         | if cond body end ELSETOK body end { 
                 /* if with else */
-		($1)[1] = (Inst)$3;	/* thenpart */
-		($1)[2] = (Inst)$6;	/* elsepart */
-		($1)[3] = (Inst)$7; 
-                }	/* end, if cond fails */
+                ($1)[1] = (Inst)$3;     /* thenpart */
+                ($1)[2] = (Inst)$6;     /* elsepart */
+                ($1)[3] = (Inst)$7; 
+                }                       /* end, if cond fails */
         ;
 
 body:         statement      { $$ = $1; }
         | '{' statements '}' { $$ = $2; }
         ;
 
-end:	  /* nothing */		{ code(STOP); $$ = progp; }
-	;
+end:      /* nothing */      { code(STOP); $$ = progp; }
+        ;
 
 if: IFTOK { $$ = code(ifcode); code3(STOP, STOP, STOP); }
         ;
 
-cond: '(' expr ')'	{ code(STOP); $$ = $2; }
+cond: '(' expr ')'      { code(STOP); $$ = $2; }
         ;
 
 define:  /* nothing */
@@ -146,7 +159,7 @@ params:   /* nothing */     { $$ = 0; }
 value:    NULLTOK  { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
         | FALSETOK { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
         | TRUETOK  { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 1, NULL)); }
-        |  NUM     { code2(Private::constpush, (Private::Inst)$NUM); }
+        | NUM      { code2(Private::constpush, (Private::Inst)$NUM); }
         | STRING   { code2(Private::strpush, (Private::Inst)$STRING); }
         | NAME     { code1(Private::varpush); code1((Private::Inst) lookupName($NAME)); code1(Private::eval); }
         ;
diff --git a/engines/private/lexer.cpp b/engines/private/lexer.cpp
new file mode 100644
index 0000000000..40922209c3
--- /dev/null
+++ b/engines/private/lexer.cpp
@@ -0,0 +1,1938 @@
+#line 1 "engines/private/lexer.cpp"
+
+#line 3 "engines/private/lexer.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 6
+#define YY_FLEX_SUBMINOR_VERSION 4
+#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;
+#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;
+
+/* 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
+
+#ifndef SIZE_MAX
+#define SIZE_MAX               (~(size_t)0)
+#endif
+
+#endif /* ! C99 */
+
+#endif /* ! FLEXINT_H */
+
+/* begin standard C++ headers. */
+
+/* TODO: this is always defined, so inline it */
+#define yyconst const
+
+#if defined(__GNUC__) && __GNUC__ >= 3
+#define yynoreturn __attribute__((__noreturn__))
+#else
+#define yynoreturn
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an
+ *   integer in range [0..255] for use as an array index.
+ */
+#define YY_SC_TO_UI(c) ((YY_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
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k.
+ * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
+ * Ditto for the __ia64__ case accordingly.
+ */
+#define YY_BUF_SIZE 32768
+#else
+#define YY_BUF_SIZE 16384
+#endif /* __ia64__ */
+#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 int 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)
+    #define YY_LINENO_REWIND_TO(ptr)
+    
+/* 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.
+	 */
+	int yy_buf_size;
+
+	/* Number of characters read into yy_ch_buf, not including EOB
+	 * characters.
+	 */
+	int 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 = NULL; /**< 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 int yy_n_chars;		/* number of characters read into yy_ch_buf */
+int yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = NULL;
+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 ( const char *yy_str  );
+YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int 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() (/*CONSTCOND*/1)
+#define YY_SKIP_YYWRAP
+typedef flex_uint8_t YY_CHAR;
+
+FILE *yyin = NULL, *yyout = NULL;
+
+typedef int yy_state_type;
+
+extern int yylineno;
+int yylineno = 1;
+
+extern char *yytext;
+#ifdef yytext_ptr
+#undef yytext_ptr
+#endif
+#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 yynoreturn yy_fatal_error ( const 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 = (int) (yy_cp - yy_bp); \
+	(yy_hold_char) = *yy_cp; \
+	*yy_cp = '\0'; \
+	(yy_c_buf_p) = yy_cp;
+#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
+	{
+	flex_int32_t yy_verify;
+	flex_int32_t yy_nxt;
+	};
+static const flex_int16_t yy_accept[78] =
+    {   0,
+        0,    0,   24,   22,   21,   20,   20,   22,   22,   22,
+       22,   18,   22,   22,   22,   17,   17,   17,   17,   17,
+       17,   17,   17,   17,   17,   21,   20,    4,    0,   19,
+       18,    1,    2,    5,    3,   17,   17,   17,   17,   17,
+       17,   17,   17,   17,    9,   17,    1,   17,   17,   17,
+       17,   17,   17,   17,   17,   17,   17,   17,   15,   12,
+       17,   14,   17,   17,   10,   11,   17,   13,   17,    6,
+       17,   17,   16,    7,   17,    8,    0
+    } ;
+
+static const YY_CHAR yy_ec[256] =
+    {   0,
+        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,    2,    5,    6,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    7,    1,    8,    9,    9,    9,
+        9,    9,    9,    9,    9,    9,    9,    1,    1,   10,
+       11,   12,    1,    1,   13,   14,   15,   14,   16,   17,
+       14,   14,   14,   14,   14,   18,   14,   19,   14,   14,
+       14,   20,   21,   22,   23,   14,   14,   14,   14,   14,
+        1,    1,    1,    1,   14,    1,   24,   25,   14,   26,
+
+       27,   28,   29,   14,   30,   14,   14,   31,   32,   33,
+       34,   14,   14,   14,   35,   36,   37,   14,   14,   14,
+       14,   14,    1,   38,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    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 const YY_CHAR yy_meta[39] =
+    {   0,
+        1,    1,    2,    3,    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,    1
+    } ;
+
+static const flex_int16_t yy_base[81] =
+    {   0,
+        0,    0,  105,  106,  102,   36,   38,   92,   96,   92,
+       92,   90,   87,   86,   85,    0,   82,   71,   27,   73,
+       65,   60,   56,   61,   61,   83,   41,  106,   76,  106,
+       72,    0,  106,  106,  106,    0,   60,   59,   60,   40,
+       49,   21,   36,   34,    0,   33,    0,   47,   49,   44,
+       39,   48,   26,   32,   34,   26,   23,   42,    0,    0,
+       23,    0,   27,   22,    0,    0,   24,    0,   21,    0,
+       25,   17,    0,    0,   19,    0,  106,   79,   43,   83
+    } ;
+
+static const flex_int16_t yy_def[81] =
+    {   0,
+       77,    1,   77,   77,   77,   77,   77,   77,   78,   77,
+       77,   77,   77,   77,   77,   79,   79,   79,   79,   79,
+       79,   79,   79,   79,   79,   77,   77,   77,   78,   77,
+       77,   80,   77,   77,   77,   79,   79,   79,   79,   79,
+       79,   79,   79,   79,   79,   79,   80,   79,   79,   79,
+       79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
+       79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
+       79,   79,   79,   79,   79,   79,    0,   77,   77,   77
+    } ;
+
+static const flex_int16_t yy_nxt[145] =
+    {   0,
+        4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
+       14,   15,   16,   16,   16,   16,   17,   16,   18,   19,
+       16,   20,   16,   16,   16,   21,   22,   16,   23,   24,
+       16,   16,   16,   16,   25,   16,   16,    7,   27,   27,
+       27,   27,   39,   27,   27,   53,   36,   76,   54,   75,
+       40,   74,   73,   72,   71,   70,   69,   68,   67,   66,
+       65,   64,   63,   62,   61,   60,   59,   58,   57,   56,
+       55,   52,   51,   27,   50,   27,   49,   48,   27,   29,
+       31,   30,   29,   47,   26,   47,   47,   46,   45,   44,
+       43,   42,   41,   38,   37,   35,   34,   33,   31,   32,
+
+       31,   30,   28,   26,   77,    3,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77
+    } ;
+
+static const flex_int16_t yy_chk[145] =
+    {   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,    6,    6,
+        7,    7,   19,   27,   27,   42,   79,   75,   42,   72,
+       19,   71,   69,   67,   64,   63,   61,   58,   57,   56,
+       55,   54,   53,   52,   51,   50,   49,   48,   46,   44,
+       43,   41,   40,    6,   39,    7,   38,   37,   27,   78,
+       31,   29,   78,   80,   26,   80,   80,   25,   24,   23,
+       22,   21,   20,   18,   17,   15,   14,   13,   12,   11,
+
+       10,    9,    8,    5,    3,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
+       77,   77,   77,   77
+    } ;
+
+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/private/lexer.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.
+ *
+ */
+#define YY_NO_INPUT 1
+#line 30 "engines/private/lexer.l"
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+
+#include "private/grammar.h"
+#include "private/tokens.h"
+
+#line 526 "engines/private/lexer.cpp"
+#line 527 "engines/private/lexer.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  );
+
+			int 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
+
+#ifndef YY_NO_UNPUT
+    
+    static void yyunput ( int c, char *buf_ptr  );
+    
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy ( char *, const char *, int );
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen ( const 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
+#ifdef __ia64__
+/* On IA-64, the buffer size is 16k, not 8k */
+#define YY_READ_BUF_SIZE 16384
+#else
+#define YY_READ_BUF_SIZE 8192
+#endif /* __ia64__ */
+#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 do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
+#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 = '*'; \
+		int 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 = (int) fread(buf, 1, (yy_size_t) 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 /*LINTED*/break;
+#endif
+
+#define YY_RULE_SETUP \
+	YY_USER_ACTION
+
+/** The main scanner function which does all the work.
+ */
+YY_DECL
+{
+	yy_state_type yy_current_state;
+	char *yy_cp, *yy_bp;
+	int yy_act;
+    
+	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(  );
+		}
+
+	{
+#line 37 "engines/private/lexer.l"
+
+#line 746 "engines/private/lexer.cpp"
+
+	while ( /*CONSTCOND*/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
+			{
+			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 >= 78 )
+					yy_c = yy_meta[yy_c];
+				}
+			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+			++yy_cp;
+			}
+		while ( yy_current_state != 77 );
+		yy_cp = (yy_last_accepting_cpos);
+		yy_current_state = (yy_last_accepting_state);
+
+yy_find_action:
+		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 38 "engines/private/lexer.l"
+/* ignoring the comment */
+	YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 39 "engines/private/lexer.l"
+return LTE;
+	YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 40 "engines/private/lexer.l"
+return GTE;
+	YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 41 "engines/private/lexer.l"
+return NEQ;
+	YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 42 "engines/private/lexer.l"
+return EQ;
+	YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 43 "engines/private/lexer.l"
+return DEBUGTOK;
+	YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 44 "engines/private/lexer.l"
+return DEFINETOK;
+	YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 45 "engines/private/lexer.l"
+return SETTINGTOK;
+	YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 46 "engines/private/lexer.l"
+return IFTOK;
+	YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 47 "engines/private/lexer.l"
+return ELSETOK;
+	YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 48 "engines/private/lexer.l"
+return GOTOTOK;
+	YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 49 "engines/private/lexer.l"
+return RECT;
+	YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 50 "engines/private/lexer.l"
+return FALSETOK;
+	YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 51 "engines/private/lexer.l"
+return TRUETOK;
+	YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 52 "engines/private/lexer.l"
+return NULLTOK;
+	YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 53 "engines/private/lexer.l"
+return RANDOMTOK;
+	YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 54 "engines/private/lexer.l"
+yylval.s = strdup(yytext); return NAME;
+	YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 55 "engines/private/lexer.l"
+yylval.sym = Private::constant(NUM, atoi(yytext), NULL); return NUM;
+	YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 56 "engines/private/lexer.l"
+yylval.sym = Private::constant(STRING, 0, scumm_strdup(yytext)); return STRING;
+	YY_BREAK
+case 20:
+/* rule 20 can match eol */
+YY_RULE_SETUP
+#line 57 "engines/private/lexer.l"
+/* ignore return */;
+	YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 58 "engines/private/lexer.l"
+/* ignore whitespace */;
+	YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 59 "engines/private/lexer.l"
+return *yytext;
+	YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 60 "engines/private/lexer.l"
+ECHO;
+	YY_BREAK
+#line 915 "engines/private/lexer.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_last_accepting_cpos);
+				yy_current_state = (yy_last_accepting_state);
+				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 user's declarations */
+} /* 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)
+{
+    	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+	char *source = (yytext_ptr);
+	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
+		{
+			int 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_LVALUE;
+
+			int yy_c_buf_p_offset =
+				(int) ((yy_c_buf_p) - b->yy_ch_buf);
+
+			if ( b->yy_is_our_buffer )
+				{
+				int 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,
+							 (yy_size_t) (b->yy_buf_size + 2)  );
+				}
+			else
+				/* Can't grow it, we don't own it. */
+				b->yy_ch_buf = NULL;
+
+			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_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+		/* Extend the array by 50%, plus the number we really need. */
+		int 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, (yy_size_t) new_size  );
+		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+		/* "- 2" to take care of EOB's */
+		YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
+	}
+
+	(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)
+{
+	yy_state_type yy_current_state;
+	char *yy_cp;
+    
+	yy_current_state = (yy_start);
+
+	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+		{
+		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 >= 78 )
+				yy_c = yy_meta[yy_c];
+			}
+		yy_current_state = yy_nxt[yy_base[yy_current_state] + 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 )
+{
+	int yy_is_jam;
+    	char *yy_cp = (yy_c_buf_p);
+
+	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 >= 78 )
+			yy_c = yy_meta[yy_c];
+		}
+	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
+	yy_is_jam = (yy_current_state == 77);
+
+		return yy_is_jam ? 0 : yy_current_state;
+}
+
+#ifndef YY_NO_UNPUT
+
+    static void yyunput (int c, char * yy_bp )
+{
+	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. */
+		int number_to_move = (yy_n_chars) + 2;
+		char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
+					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+		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) = (int) 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;
+}
+
+#endif
+
+#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 */
+			int offset = (int) ((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( (yy_size_t) (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  );
+}
+
+/* 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 = 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; /* After all that talk, this was set to 1 anyways... */
+		(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. */
+		yy_size_t 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 NULL;
+
+	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 = (int) (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 = NULL;
+	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 (const char * yystr )
+{
+    
+	return yy_scan_bytes( yystr, (int) 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 yybytes the byte buffer to scan
+ * @param _yybytes_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  (const char * yybytes, int  _yybytes_len )
+{
+	YY_BUFFER_STATE b;
+	char *buf;
+	yy_size_t n;
+	int i;
+    
+	/* Get memory for full buffer, including space for trailing EOB's. */
+	n = (yy_size_t) (_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 yynoreturn yy_fatal_error (const char* msg )
+{
+			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.
+ * 
+ */
+int yyget_leng  (void)
+{
+        return yyleng;
+}
+
+/** Get the current token.
+ * 
+ */
+
+char *yyget_text  (void)
+{
+        return yytext;
+}
+
+/** Set the current line number.
+ * @param _line_number 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) = NULL;
+    (yy_buffer_stack_top) = 0;
+    (yy_buffer_stack_max) = 0;
+    (yy_c_buf_p) = NULL;
+    (yy_init) = 0;
+    (yy_start) = 0;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+    yyin = stdin;
+    yyout = stdout;
+#else
+    yyin = NULL;
+    yyout = NULL;
+#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, const char * s2, int n )
+{
+		
+	int i;
+	for ( i = 0; i < n; ++i )
+		s1[i] = s2[i];
+}
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen (const char * s )
+{
+	int n;
+	for ( n = 0; s[n]; ++n )
+		;
+
+	return n;
+}
+#endif
+
+void *yyalloc (yy_size_t  size )
+{
+			return 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 realloc(ptr, size);
+}
+
+void yyfree (void * ptr )
+{
+			free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
+}
+
+#define YYTABLES_NAME "yytables"
+
+#line 60 "engines/private/lexer.l"
+
+
+namespace Private {
+
+int parse(char *code) {
+    initSetting();
+    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;
+}
+
+} // End of namespace Private
+
diff --git a/engines/private/grammar.l b/engines/private/lexer.l
similarity index 96%
rename from engines/private/grammar.l
rename to engines/private/lexer.l
index 16d399a439..c23073207f 100644
--- a/engines/private/grammar.l
+++ b/engines/private/lexer.l
@@ -24,13 +24,13 @@
 %option noinput
 %option never-interactive
 
-%option outfile="engines/private/lex.yy.cpp"
+%option outfile="engines/private/lexer.cpp"
 
 %{
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
 
 #include "private/grammar.h"
-#include "private/grammar.tab.h"
+#include "private/tokens.h"
 
 %}
 
diff --git a/engines/private/module.mk b/engines/private/module.mk
index 5af360484d..435820dd34 100644
--- a/engines/private/module.mk
+++ b/engines/private/module.mk
@@ -6,8 +6,8 @@ MODULE_OBJS := \
 	cursors.o \
 	symbol.o \
 	funcs.o \
-    grammar.tab.o \
-	lex.yy.o \
+    grammar.o \
+	lexer.o \
 	private.o
  
 MODULE_DIRS += \
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 513e1cb53a..e8e214734b 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -44,7 +44,7 @@
 
 #include "private/cursors.h"
 #include "private/private.h"
-#include "private/grammar.tab.h"
+#include "private/tokens.h"
 #include "private/grammar.h"
 
 namespace Private {
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index c487126adf..50a2b15428 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -23,7 +23,7 @@
 #include "common/debug.h"
 #include "private/private.h"
 #include "private/grammar.h"
-#include "private/grammar.tab.h"
+#include "private/tokens.h"
 
 namespace Private {
 
diff --git a/engines/private/grammar.tab.h b/engines/private/tokens.h
similarity index 84%
rename from engines/private/grammar.tab.h
rename to engines/private/tokens.h
index 49d2bc0926..13389626f7 100644
--- a/engines/private/grammar.tab.h
+++ b/engines/private/tokens.h
@@ -35,8 +35,8 @@
    especially those whose name start with YY_ or yy_.  They are
    private implementation details that can be changed or removed.  */
 
-#ifndef YY_YY_ENGINES_PRIVATE_GRAMMAR_TAB_H_INCLUDED
-# define YY_YY_ENGINES_PRIVATE_GRAMMAR_TAB_H_INCLUDED
+#ifndef YY_YY_ENGINES_PRIVATE_TOKENS_H_INCLUDED
+# define YY_YY_ENGINES_PRIVATE_TOKENS_H_INCLUDED
 /* Debug traces.  */
 #ifndef YYDEBUG
 # define YYDEBUG 0
@@ -48,8 +48,8 @@ extern int yydebug;
 /* Token kinds.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
-enum yytokentype
-{
+  enum yytokentype
+  {
     YYEMPTY = -2,
     YYEOF = 0,                     /* "end of file"  */
     YYerror = 256,                 /* error  */
@@ -72,23 +72,23 @@ enum yytokentype
     DEFINETOK = 273,               /* DEFINETOK  */
     SETTINGTOK = 274,              /* SETTINGTOK  */
     RANDOMTOK = 275                /* RANDOMTOK  */
-};
-typedef enum yytokentype yytoken_kind_t;
+  };
+  typedef enum yytokentype yytoken_kind_t;
 #endif
 
 /* Value type.  */
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 union YYSTYPE
 {
-#line 38 "engines/private/grammar.y"
+#line 51 "engines/private/grammar.y"
 
-    Private::Symbol	*sym;	/* symbol table pointer */
-    int (**inst)();	/* machine instruction */
-    char *s;
-    int *i;
-    int narg;
+        Private::Symbol *sym; /* symbol table pointer */
+        int (**inst)();       /* machine instruction */
+        char *s;              /* string value */
+        int *i;               /* integer value */
+        int narg;             /* auxiliary value to count function arguments */
 
-#line 92 "engines/private/grammar.tab.h"
+#line 92 "engines/private/tokens.h"
 
 };
 typedef union YYSTYPE YYSTYPE;
@@ -101,4 +101,4 @@ extern YYSTYPE yylval;
 
 int yyparse (void);
 
-#endif /* !YY_YY_ENGINES_PRIVATE_GRAMMAR_TAB_H_INCLUDED  */
+#endif /* !YY_YY_ENGINES_PRIVATE_TOKENS_H_INCLUDED  */


Commit: 87ac8509821ee84005c89655fab916f133877603
    https://github.com/scummvm/scummvm/commit/87ac8509821ee84005c89655fab916f133877603
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: change detection tables to use PVTEYE.Z

Changed paths:
    engines/private/detection.cpp


diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index 3f01d0ef86..d05d7736ab 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -34,7 +34,7 @@ static const ADGameDescription gameDescriptions[] = {
     {
         "private-eye",  // US release
         0,
-        AD_ENTRY1s("ASSETS.Z", "3a7532349cda8126e96dd5e49884af3a", 40232),
+        AD_ENTRY1s("PVTEYE.Z", "b682118cda6a42fa89833cae2b8824bd", 271895),
         Common::EN_USA,
         Common::kPlatformWindows,
         ADGF_NO_FLAGS,
@@ -44,7 +44,7 @@ static const ADGameDescription gameDescriptions[] = {
     {
         "private-eye",  // EU release
         0,
-        AD_ENTRY1s("ASSETS.Z", "73874f969026d6fd21a4e9834ce4a1a7", 17695),
+        AD_ENTRY1s("PVTEYE.Z", "", 0),
         Common::EN_GRB,
         Common::kPlatformWindows,
         ADGF_UNSUPPORTED,
@@ -54,7 +54,7 @@ static const ADGameDescription gameDescriptions[] = {
     {
         "private-eye", // Demo from archive.org
         "Demo",
-        AD_ENTRY1s("ASSETS.Z", "854e141bb67535359620a1833fcc1566", 5955),
+        AD_ENTRY1s("PVTEYE.Z", "8ef908e212bb9c1e10f5e3c81f56682c", 263893),
         Common::EN_USA,
         Common::kPlatformWindows,
         ADGF_DEMO,
@@ -64,7 +64,7 @@ static const ADGameDescription gameDescriptions[] = {
     {
         "private-eye", // Demo from the US release
         "Demo",
-        AD_ENTRY1s("ASSETS.Z", "045766e39f44d6ee3bf92f0d4521587c", 5961),
+        AD_ENTRY1s("PVTEYE.Z", "af383c813157810e89d8d6d595895ff7", 271214),
         Common::EN_USA,
         Common::kPlatformWindows,
         ADGF_DEMO,
@@ -75,7 +75,7 @@ static const ADGameDescription gameDescriptions[] = {
     {
         "private-eye", // Demo from the EU release
         "Demo",
-        AD_ENTRY1s("ASSETS.Z", "15e10e8fbb1e9aac4d32c5d8215e7c86", 2299),
+        AD_ENTRY1s("PVTEYE.Z", "", 0),
         Common::EN_GRB,
         Common::kPlatformWindows,
         ADGF_DEMO | ADGF_UNSUPPORTED,


Commit: 31cc84514f278f571780cd7da66be4dcac25beaf
    https://github.com/scummvm/scummvm/commit/31cc84514f278f571780cd7da66be4dcac25beaf
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: avoid name collisions using a prefix in the lexer and grammar

Changed paths:
    engines/private/grammar.cpp
    engines/private/grammar.y
    engines/private/lexer.cpp
    engines/private/lexer.l
    engines/private/tokens.h


diff --git a/engines/private/grammar.cpp b/engines/private/grammar.cpp
index c9166bc785..b0e048f0f7 100644
--- a/engines/private/grammar.cpp
+++ b/engines/private/grammar.cpp
@@ -63,11 +63,19 @@
 /* Pull parsers.  */
 #define YYPULL 1
 
-
-
+/* Substitute the type names.  */
+#define YYSTYPE         PRIVATE_STYPE
+/* Substitute the variable and function names.  */
+#define yyparse         PRIVATE_parse
+#define yylex           PRIVATE_lex
+#define yyerror         PRIVATE_xerror
+#define yydebug         PRIVATE_debug
+#define yynerrs         PRIVATE_nerrs
+#define yylval          PRIVATE_lval
+#define yychar          PRIVATE_char
 
 /* First part of user prologue.  */
-#line 27 "engines/private/grammar.y"
+#line 29 "engines/private/grammar.y"
 
 
 #include "grammar.h"
@@ -78,20 +86,19 @@
 
 using namespace Private;
 
-extern int yylex();
-extern int yyparse();
+extern int PRIVATE_lex();
+extern int PRIVATE_parse();
 
-void yyerror(const char *str) {
+void PRIVATE_xerror(const char *str) {
 }
 
-
-int yywrap() {
+int PRIVATE_wrap() {
     return 1;
 }
 
 
 
-#line 95 "engines/private/grammar.cpp"
+#line 102 "engines/private/grammar.cpp"
 
 # ifndef YY_CAST
 #  ifdef __cplusplus
@@ -415,7 +422,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
 
 #if (! defined yyoverflow \
      && (! defined __cplusplus \
-         || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+         || (defined PRIVATE_STYPE_IS_TRIVIAL && PRIVATE_STYPE_IS_TRIVIAL)))
 
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
@@ -532,23 +539,23 @@ static const yytype_int8 yytranslate[] =
       15,    16,    17,    18,    19,    20
 };
 
-#if YYDEBUG
+#if PRIVATE_DEBUG
   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
-       0,    67,    67,    68,    71,    72,    73,    76,    77,    80,
-      81,    84,    91,    92,    97,   105,   106,   109,   112,   115,
-     118,   119,   124,   128,   129,   132,   140,   141,   149,   152,
-     153,   154,   155,   156,   159,   160,   161,   162,   163,   164,
-     167,   168,   169,   170,   171,   172,   173,   174,   175,   176,
-     177
+       0,    68,    68,    69,    72,    73,    74,    77,    78,    81,
+      82,    85,    92,    93,    98,   106,   107,   110,   113,   116,
+     119,   120,   125,   129,   130,   133,   141,   142,   150,   153,
+     154,   155,   156,   157,   160,   161,   162,   163,   164,   165,
+     168,   169,   170,   171,   172,   173,   174,   175,   176,   177,
+     178
 };
 #endif
 
 /** Accessing symbol of state STATE.  */
 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
 
-#if YYDEBUG || 0
+#if PRIVATE_DEBUG || 0
 /* The user-facing name of the symbol whose (internal) number is
    YYSYMBOL.  No bounds checking.  */
 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
@@ -727,7 +734,7 @@ static const yytype_int8 yyr2[] =
 enum { YYENOMEM = -2 };
 
 #define yyerrok         (yyerrstatus = 0)
-#define yyclearin       (yychar = YYEMPTY)
+#define yyclearin       (yychar = PRIVATE_EMPTY)
 
 #define YYACCEPT        goto yyacceptlab
 #define YYABORT         goto yyabortlab
@@ -738,7 +745,7 @@ enum { YYENOMEM = -2 };
 
 #define YYBACKUP(Token, Value)                                    \
   do                                                              \
-    if (yychar == YYEMPTY)                                        \
+    if (yychar == PRIVATE_EMPTY)                                        \
       {                                                           \
         yychar = (Token);                                         \
         yylval = (Value);                                         \
@@ -754,12 +761,12 @@ enum { YYENOMEM = -2 };
   while (0)
 
 /* Backward compatibility with an undocumented macro.
-   Use YYerror or YYUNDEF. */
-#define YYERRCODE YYUNDEF
+   Use PRIVATE_error or PRIVATE_UNDEF. */
+#define YYERRCODE PRIVATE_UNDEF
 
 
 /* Enable debugging if requested.  */
-#if YYDEBUG
+#if PRIVATE_DEBUG
 
 # ifndef YYFPRINTF
 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
@@ -884,12 +891,12 @@ do {                                    \
 /* Nonzero means print parse trace.  It is left uninitialized so that
    multiple parsers can coexist.  */
 int yydebug;
-#else /* !YYDEBUG */
+#else /* !PRIVATE_DEBUG */
 # define YYDPRINTF(Args) ((void) 0)
 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
 # define YY_STACK_PRINT(Bottom, Top)
 # define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
+#endif /* !PRIVATE_DEBUG */
 
 
 /* YYINITDEPTH -- initial size of the parser's stacks.  */
@@ -989,7 +996,7 @@ yyparse (void)
 
   YYDPRINTF ((stderr, "Starting parse\n"));
 
-  yychar = YYEMPTY; /* Cause a token to be read.  */
+  yychar = PRIVATE_EMPTY; /* Cause a token to be read.  */
   goto yysetstate;
 
 
@@ -1097,25 +1104,25 @@ yybackup:
   /* Not known => get a lookahead token if don't already have one.  */
 
   /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
-  if (yychar == YYEMPTY)
+  if (yychar == PRIVATE_EMPTY)
     {
       YYDPRINTF ((stderr, "Reading a token\n"));
       yychar = yylex ();
     }
 
-  if (yychar <= YYEOF)
+  if (yychar <= PRIVATE_EOF)
     {
-      yychar = YYEOF;
+      yychar = PRIVATE_EOF;
       yytoken = YYSYMBOL_YYEOF;
       YYDPRINTF ((stderr, "Now at end of input.\n"));
     }
-  else if (yychar == YYerror)
+  else if (yychar == PRIVATE_error)
     {
       /* The scanner already issued an error message, process directly
          to error recovery.  But do not keep the error token as
          lookahead, it is too special and may lead us to an endless
          loop in error recovery. */
-      yychar = YYUNDEF;
+      yychar = PRIVATE_UNDEF;
       yytoken = YYSYMBOL_YYerror;
       goto yyerrlab1;
     }
@@ -1152,7 +1159,7 @@ yybackup:
   YY_IGNORE_MAYBE_UNINITIALIZED_END
 
   /* Discard the shifted token.  */
-  yychar = YYEMPTY;
+  yychar = PRIVATE_EMPTY;
   goto yynewstate;
 
 
@@ -1188,31 +1195,31 @@ yyreduce:
   switch (yyn)
     {
   case 4: /* line: DEBUGTOK '{' debug '}'  */
-#line 71 "engines/private/grammar.y"
+#line 72 "engines/private/grammar.y"
                                              { /* Not used in the game */ }
-#line 1194 "engines/private/grammar.cpp"
+#line 1201 "engines/private/grammar.cpp"
     break;
 
   case 5: /* line: DEFINETOK NAME '{' define '}'  */
-#line 72 "engines/private/grammar.y"
+#line 73 "engines/private/grammar.y"
                                              { installAll((yyvsp[-3].s)); }
-#line 1200 "engines/private/grammar.cpp"
+#line 1207 "engines/private/grammar.cpp"
     break;
 
   case 6: /* line: SETTINGTOK NAME '{' statements '}'  */
-#line 73 "engines/private/grammar.y"
+#line 74 "engines/private/grammar.y"
                                              { saveSetting((yyvsp[-3].s)); initSetting(); }
-#line 1206 "engines/private/grammar.cpp"
+#line 1213 "engines/private/grammar.cpp"
     break;
 
   case 9: /* statements: %empty  */
-#line 80 "engines/private/grammar.y"
+#line 81 "engines/private/grammar.y"
                                { (yyval.inst) = progp; }
-#line 1212 "engines/private/grammar.cpp"
+#line 1219 "engines/private/grammar.cpp"
     break;
 
   case 11: /* statement: GOTOTOK NAME ';'  */
-#line 84 "engines/private/grammar.y"
+#line 85 "engines/private/grammar.y"
                             {
         (yyval.inst) = progp;
         code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s)));
@@ -1220,99 +1227,99 @@ yyreduce:
         code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
         code1(funcpush);
         }
-#line 1224 "engines/private/grammar.cpp"
+#line 1231 "engines/private/grammar.cpp"
     break;
 
   case 12: /* statement: fcall ';'  */
-#line 91 "engines/private/grammar.y"
+#line 92 "engines/private/grammar.y"
                             { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1230 "engines/private/grammar.cpp"
+#line 1237 "engines/private/grammar.cpp"
     break;
 
   case 13: /* statement: if cond body end  */
-#line 92 "engines/private/grammar.y"
+#line 93 "engines/private/grammar.y"
                            {
                 /* else-less if */
                 ((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst);     /* thenpart */
                 ((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst); 
                 }
-#line 1240 "engines/private/grammar.cpp"
+#line 1247 "engines/private/grammar.cpp"
     break;
 
   case 14: /* statement: if cond body end ELSETOK body end  */
-#line 97 "engines/private/grammar.y"
+#line 98 "engines/private/grammar.y"
                                             { 
                 /* if with else */
                 ((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst);     /* thenpart */
                 ((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst);     /* elsepart */
                 ((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst); 
                 }
-#line 1251 "engines/private/grammar.cpp"
+#line 1258 "engines/private/grammar.cpp"
     break;
 
   case 15: /* body: statement  */
-#line 105 "engines/private/grammar.y"
+#line 106 "engines/private/grammar.y"
                              { (yyval.inst) = (yyvsp[0].inst); }
-#line 1257 "engines/private/grammar.cpp"
+#line 1264 "engines/private/grammar.cpp"
     break;
 
   case 16: /* body: '{' statements '}'  */
-#line 106 "engines/private/grammar.y"
+#line 107 "engines/private/grammar.y"
                              { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1263 "engines/private/grammar.cpp"
+#line 1270 "engines/private/grammar.cpp"
     break;
 
   case 17: /* end: %empty  */
-#line 109 "engines/private/grammar.y"
+#line 110 "engines/private/grammar.y"
                              { code(STOP); (yyval.inst) = progp; }
-#line 1269 "engines/private/grammar.cpp"
+#line 1276 "engines/private/grammar.cpp"
     break;
 
   case 18: /* if: IFTOK  */
-#line 112 "engines/private/grammar.y"
+#line 113 "engines/private/grammar.y"
           { (yyval.inst) = code(ifcode); code3(STOP, STOP, STOP); }
-#line 1275 "engines/private/grammar.cpp"
+#line 1282 "engines/private/grammar.cpp"
     break;
 
   case 19: /* cond: '(' expr ')'  */
-#line 115 "engines/private/grammar.y"
+#line 116 "engines/private/grammar.y"
                         { code(STOP); (yyval.inst) = (yyvsp[-1].inst); }
-#line 1281 "engines/private/grammar.cpp"
+#line 1288 "engines/private/grammar.cpp"
     break;
 
   case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  */
-#line 119 "engines/private/grammar.y"
+#line 120 "engines/private/grammar.y"
                                                                         { 
           Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
           assert(r->isValidRect()); 
           defineSymbol((yyvsp[-13].s), r); 
           }
-#line 1291 "engines/private/grammar.cpp"
+#line 1298 "engines/private/grammar.cpp"
     break;
 
   case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
-#line 124 "engines/private/grammar.y"
+#line 125 "engines/private/grammar.y"
                                                             {
           Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);  
           defineSymbol((yyvsp[-11].s), r); 
           }
-#line 1300 "engines/private/grammar.cpp"
+#line 1307 "engines/private/grammar.cpp"
     break;
 
   case 23: /* define: NAME ',' define  */
-#line 128 "engines/private/grammar.y"
+#line 129 "engines/private/grammar.y"
                           { defineSymbol((yyvsp[-2].s), NULL); }
-#line 1306 "engines/private/grammar.cpp"
+#line 1313 "engines/private/grammar.cpp"
     break;
 
   case 24: /* define: NAME  */
-#line 129 "engines/private/grammar.y"
+#line 130 "engines/private/grammar.y"
                           { defineSymbol((yyvsp[0].s), NULL); }
-#line 1312 "engines/private/grammar.cpp"
+#line 1319 "engines/private/grammar.cpp"
     break;
 
   case 25: /* fcall: GOTOTOK '(' NAME ')'  */
-#line 132 "engines/private/grammar.y"
+#line 133 "engines/private/grammar.y"
                                {
                                (yyval.inst) = progp;
                                code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s)));
@@ -1320,166 +1327,166 @@ yyreduce:
                                code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
                                code1(funcpush);
                                }
-#line 1324 "engines/private/grammar.cpp"
+#line 1331 "engines/private/grammar.cpp"
     break;
 
   case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
-#line 140 "engines/private/grammar.y"
+#line 141 "engines/private/grammar.y"
                                                    { (yyval.inst) = progp; }
-#line 1330 "engines/private/grammar.cpp"
+#line 1337 "engines/private/grammar.cpp"
     break;
 
   case 27: /* fcall: NAME '(' startp params ')'  */
-#line 141 "engines/private/grammar.y"
+#line 142 "engines/private/grammar.y"
                                       {
                                (yyval.inst) = (yyvsp[-2].inst);
                                code2(constpush, (Private::Inst) constant(NUM, (yyvsp[-1].narg), NULL));
                                code2(strpush, (Private::Inst) constant(STRING, 0, (yyvsp[-4].s))); 
                                code1(funcpush);
                                }
-#line 1341 "engines/private/grammar.cpp"
+#line 1348 "engines/private/grammar.cpp"
     break;
 
   case 28: /* startp: %empty  */
-#line 149 "engines/private/grammar.y"
+#line 150 "engines/private/grammar.y"
                     { (yyval.inst) = progp; }
-#line 1347 "engines/private/grammar.cpp"
+#line 1354 "engines/private/grammar.cpp"
     break;
 
   case 29: /* params: %empty  */
-#line 152 "engines/private/grammar.y"
+#line 153 "engines/private/grammar.y"
                             { (yyval.narg) = 0; }
-#line 1353 "engines/private/grammar.cpp"
+#line 1360 "engines/private/grammar.cpp"
     break;
 
   case 30: /* params: fcall ',' params  */
-#line 153 "engines/private/grammar.y"
+#line 154 "engines/private/grammar.y"
                             { (yyval.narg) = (yyvsp[0].narg) + 1; }
-#line 1359 "engines/private/grammar.cpp"
+#line 1366 "engines/private/grammar.cpp"
     break;
 
   case 31: /* params: expr ',' params  */
-#line 154 "engines/private/grammar.y"
+#line 155 "engines/private/grammar.y"
                             { (yyval.narg) = (yyvsp[0].narg) + 1; }
-#line 1365 "engines/private/grammar.cpp"
+#line 1372 "engines/private/grammar.cpp"
     break;
 
   case 32: /* params: expr  */
-#line 155 "engines/private/grammar.y"
+#line 156 "engines/private/grammar.y"
                       { (yyval.narg) = 1; }
-#line 1371 "engines/private/grammar.cpp"
+#line 1378 "engines/private/grammar.cpp"
     break;
 
   case 33: /* params: fcall  */
-#line 156 "engines/private/grammar.y"
+#line 157 "engines/private/grammar.y"
                       { (yyval.narg) = 1; }
-#line 1377 "engines/private/grammar.cpp"
+#line 1384 "engines/private/grammar.cpp"
     break;
 
   case 34: /* value: NULLTOK  */
-#line 159 "engines/private/grammar.y"
+#line 160 "engines/private/grammar.y"
                    { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
-#line 1383 "engines/private/grammar.cpp"
+#line 1390 "engines/private/grammar.cpp"
     break;
 
   case 35: /* value: FALSETOK  */
-#line 160 "engines/private/grammar.y"
+#line 161 "engines/private/grammar.y"
                    { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
-#line 1389 "engines/private/grammar.cpp"
+#line 1396 "engines/private/grammar.cpp"
     break;
 
   case 36: /* value: TRUETOK  */
-#line 161 "engines/private/grammar.y"
+#line 162 "engines/private/grammar.y"
                    { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 1, NULL)); }
-#line 1395 "engines/private/grammar.cpp"
+#line 1402 "engines/private/grammar.cpp"
     break;
 
   case 37: /* value: NUM  */
-#line 162 "engines/private/grammar.y"
+#line 163 "engines/private/grammar.y"
                    { code2(Private::constpush, (Private::Inst)(yyvsp[0].sym)); }
-#line 1401 "engines/private/grammar.cpp"
+#line 1408 "engines/private/grammar.cpp"
     break;
 
   case 38: /* value: STRING  */
-#line 163 "engines/private/grammar.y"
+#line 164 "engines/private/grammar.y"
                    { code2(Private::strpush, (Private::Inst)(yyvsp[0].sym)); }
-#line 1407 "engines/private/grammar.cpp"
+#line 1414 "engines/private/grammar.cpp"
     break;
 
   case 39: /* value: NAME  */
-#line 164 "engines/private/grammar.y"
+#line 165 "engines/private/grammar.y"
                    { code1(Private::varpush); code1((Private::Inst) lookupName((yyvsp[0].s))); code1(Private::eval); }
-#line 1413 "engines/private/grammar.cpp"
+#line 1420 "engines/private/grammar.cpp"
     break;
 
   case 40: /* expr: value  */
-#line 167 "engines/private/grammar.y"
+#line 168 "engines/private/grammar.y"
                           { (yyval.inst) = (yyvsp[0].inst); }
-#line 1419 "engines/private/grammar.cpp"
+#line 1426 "engines/private/grammar.cpp"
     break;
 
   case 41: /* expr: '!' value  */
-#line 168 "engines/private/grammar.y"
+#line 169 "engines/private/grammar.y"
                           { code1(Private::negate); (yyval.inst) = (yyvsp[0].inst); }
-#line 1425 "engines/private/grammar.cpp"
+#line 1432 "engines/private/grammar.cpp"
     break;
 
   case 42: /* expr: value EQ value  */
-#line 169 "engines/private/grammar.y"
+#line 170 "engines/private/grammar.y"
                           { code1(Private::eq); }
-#line 1431 "engines/private/grammar.cpp"
+#line 1438 "engines/private/grammar.cpp"
     break;
 
   case 43: /* expr: value NEQ value  */
-#line 170 "engines/private/grammar.y"
+#line 171 "engines/private/grammar.y"
                           { code1(Private::ne); }
-#line 1437 "engines/private/grammar.cpp"
+#line 1444 "engines/private/grammar.cpp"
     break;
 
   case 44: /* expr: value '+' value  */
-#line 171 "engines/private/grammar.y"
+#line 172 "engines/private/grammar.y"
                           { code1(Private::add); }
-#line 1443 "engines/private/grammar.cpp"
+#line 1450 "engines/private/grammar.cpp"
     break;
 
   case 45: /* expr: value '<' value  */
-#line 172 "engines/private/grammar.y"
+#line 173 "engines/private/grammar.y"
                           { code1(Private::lt); }
-#line 1449 "engines/private/grammar.cpp"
+#line 1456 "engines/private/grammar.cpp"
     break;
 
   case 46: /* expr: value '>' value  */
-#line 173 "engines/private/grammar.y"
+#line 174 "engines/private/grammar.y"
                           { code1(Private::gt); }
-#line 1455 "engines/private/grammar.cpp"
+#line 1462 "engines/private/grammar.cpp"
     break;
 
   case 47: /* expr: value LTE value  */
-#line 174 "engines/private/grammar.y"
+#line 175 "engines/private/grammar.y"
                           { code1(Private::le); }
-#line 1461 "engines/private/grammar.cpp"
+#line 1468 "engines/private/grammar.cpp"
     break;
 
   case 48: /* expr: value GTE value  */
-#line 175 "engines/private/grammar.y"
+#line 176 "engines/private/grammar.y"
                           { code1(Private::ge); }
-#line 1467 "engines/private/grammar.cpp"
+#line 1474 "engines/private/grammar.cpp"
     break;
 
   case 49: /* expr: value '+'  */
-#line 176 "engines/private/grammar.y"
+#line 177 "engines/private/grammar.y"
                           { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1473 "engines/private/grammar.cpp"
+#line 1480 "engines/private/grammar.cpp"
     break;
 
   case 50: /* expr: RANDOMTOK '(' NUM '%' ')'  */
-#line 177 "engines/private/grammar.y"
+#line 178 "engines/private/grammar.y"
                                     { code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool); }
-#line 1479 "engines/private/grammar.cpp"
+#line 1486 "engines/private/grammar.cpp"
     break;
 
 
-#line 1483 "engines/private/grammar.cpp"
+#line 1490 "engines/private/grammar.cpp"
 
       default: break;
     }
@@ -1521,7 +1528,7 @@ yyreduce:
 yyerrlab:
   /* Make sure we have latest lookahead translation.  See comments at
      user semantic actions for why this is necessary.  */
-  yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
+  yytoken = yychar == PRIVATE_EMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
   /* If not already recovering from an error, report this error.  */
   if (!yyerrstatus)
     {
@@ -1534,17 +1541,17 @@ yyerrlab:
       /* If just tried and failed to reuse lookahead token after an
          error, discard it.  */
 
-      if (yychar <= YYEOF)
+      if (yychar <= PRIVATE_EOF)
         {
           /* Return failure if at end of input.  */
-          if (yychar == YYEOF)
+          if (yychar == PRIVATE_EOF)
             YYABORT;
         }
       else
         {
           yydestruct ("Error: discarding",
                       yytoken, &yylval);
-          yychar = YYEMPTY;
+          yychar = PRIVATE_EMPTY;
         }
     }
 
@@ -1647,7 +1654,7 @@ yyexhaustedlab:
 | yyreturn -- parsing is finished, clean up and return.  |
 `-------------------------------------------------------*/
 yyreturn:
-  if (yychar != YYEMPTY)
+  if (yychar != PRIVATE_EMPTY)
     {
       /* Make sure we have latest lookahead translation.  See comments at
          user semantic actions for why this is necessary.  */
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index aa42f1439c..c9ec8b44c8 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -23,6 +23,8 @@
 %require "3.6"
 %defines "engines/private/tokens.h"
 %output "engines/private/grammar.cpp"
+%define api.prefix {PRIVATE_}
+
 
 %{
 
@@ -34,14 +36,13 @@
 
 using namespace Private;
 
-extern int yylex();
-extern int yyparse();
+extern int PRIVATE_lex();
+extern int PRIVATE_parse();
 
-void yyerror(const char *str) {
+void PRIVATE_xerror(const char *str) {
 }
 
-
-int yywrap() {
+int PRIVATE_wrap() {
     return 1;
 }
 
diff --git a/engines/private/lexer.cpp b/engines/private/lexer.cpp
index 40922209c3..3cd6e9914e 100644
--- a/engines/private/lexer.cpp
+++ b/engines/private/lexer.cpp
@@ -6,6 +6,31 @@
 
 /* A lexical scanner generated by flex */
 
+#define yy_create_buffer PRIVATE__create_buffer
+#define yy_delete_buffer PRIVATE__delete_buffer
+#define yy_scan_buffer PRIVATE__scan_buffer
+#define yy_scan_string PRIVATE__scan_string
+#define yy_scan_bytes PRIVATE__scan_bytes
+#define yy_init_buffer PRIVATE__init_buffer
+#define yy_flush_buffer PRIVATE__flush_buffer
+#define yy_load_buffer_state PRIVATE__load_buffer_state
+#define yy_switch_to_buffer PRIVATE__switch_to_buffer
+#define yypush_buffer_state PRIVATE_push_buffer_state
+#define yypop_buffer_state PRIVATE_pop_buffer_state
+#define yyensure_buffer_stack PRIVATE_ensure_buffer_stack
+#define yy_flex_debug PRIVATE__flex_debug
+#define yyin PRIVATE_in
+#define yyleng PRIVATE_leng
+#define yylex PRIVATE_lex
+#define yylineno PRIVATE_lineno
+#define yyout PRIVATE_out
+#define yyrestart PRIVATE_restart
+#define yytext PRIVATE_text
+#define yywrap PRIVATE_wrap
+#define yyalloc PRIVATE_alloc
+#define yyrealloc PRIVATE_realloc
+#define yyfree PRIVATE_free
+
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 6
@@ -14,6 +39,240 @@
 #define FLEX_BETA
 #endif
 
+#ifdef yy_create_buffer
+#define PRIVATE__create_buffer_ALREADY_DEFINED
+#else
+#define yy_create_buffer PRIVATE__create_buffer
+#endif
+
+#ifdef yy_delete_buffer
+#define PRIVATE__delete_buffer_ALREADY_DEFINED
+#else
+#define yy_delete_buffer PRIVATE__delete_buffer
+#endif
+
+#ifdef yy_scan_buffer
+#define PRIVATE__scan_buffer_ALREADY_DEFINED
+#else
+#define yy_scan_buffer PRIVATE__scan_buffer
+#endif
+
+#ifdef yy_scan_string
+#define PRIVATE__scan_string_ALREADY_DEFINED
+#else
+#define yy_scan_string PRIVATE__scan_string
+#endif
+
+#ifdef yy_scan_bytes
+#define PRIVATE__scan_bytes_ALREADY_DEFINED
+#else
+#define yy_scan_bytes PRIVATE__scan_bytes
+#endif
+
+#ifdef yy_init_buffer
+#define PRIVATE__init_buffer_ALREADY_DEFINED
+#else
+#define yy_init_buffer PRIVATE__init_buffer
+#endif
+
+#ifdef yy_flush_buffer
+#define PRIVATE__flush_buffer_ALREADY_DEFINED
+#else
+#define yy_flush_buffer PRIVATE__flush_buffer
+#endif
+
+#ifdef yy_load_buffer_state
+#define PRIVATE__load_buffer_state_ALREADY_DEFINED
+#else
+#define yy_load_buffer_state PRIVATE__load_buffer_state
+#endif
+
+#ifdef yy_switch_to_buffer
+#define PRIVATE__switch_to_buffer_ALREADY_DEFINED
+#else
+#define yy_switch_to_buffer PRIVATE__switch_to_buffer
+#endif
+
+#ifdef yypush_buffer_state
+#define PRIVATE_push_buffer_state_ALREADY_DEFINED
+#else
+#define yypush_buffer_state PRIVATE_push_buffer_state
+#endif
+
+#ifdef yypop_buffer_state
+#define PRIVATE_pop_buffer_state_ALREADY_DEFINED
+#else
+#define yypop_buffer_state PRIVATE_pop_buffer_state
+#endif
+
+#ifdef yyensure_buffer_stack
+#define PRIVATE_ensure_buffer_stack_ALREADY_DEFINED
+#else
+#define yyensure_buffer_stack PRIVATE_ensure_buffer_stack
+#endif
+
+#ifdef yylex
+#define PRIVATE_lex_ALREADY_DEFINED
+#else
+#define yylex PRIVATE_lex
+#endif
+
+#ifdef yyrestart
+#define PRIVATE_restart_ALREADY_DEFINED
+#else
+#define yyrestart PRIVATE_restart
+#endif
+
+#ifdef yylex_init
+#define PRIVATE_lex_init_ALREADY_DEFINED
+#else
+#define yylex_init PRIVATE_lex_init
+#endif
+
+#ifdef yylex_init_extra
+#define PRIVATE_lex_init_extra_ALREADY_DEFINED
+#else
+#define yylex_init_extra PRIVATE_lex_init_extra
+#endif
+
+#ifdef yylex_destroy
+#define PRIVATE_lex_destroy_ALREADY_DEFINED
+#else
+#define yylex_destroy PRIVATE_lex_destroy
+#endif
+
+#ifdef yyget_debug
+#define PRIVATE_get_debug_ALREADY_DEFINED
+#else
+#define yyget_debug PRIVATE_get_debug
+#endif
+
+#ifdef yyset_debug
+#define PRIVATE_set_debug_ALREADY_DEFINED
+#else
+#define yyset_debug PRIVATE_set_debug
+#endif
+
+#ifdef yyget_extra
+#define PRIVATE_get_extra_ALREADY_DEFINED
+#else
+#define yyget_extra PRIVATE_get_extra
+#endif
+
+#ifdef yyset_extra
+#define PRIVATE_set_extra_ALREADY_DEFINED
+#else
+#define yyset_extra PRIVATE_set_extra
+#endif
+
+#ifdef yyget_in
+#define PRIVATE_get_in_ALREADY_DEFINED
+#else
+#define yyget_in PRIVATE_get_in
+#endif
+
+#ifdef yyset_in
+#define PRIVATE_set_in_ALREADY_DEFINED
+#else
+#define yyset_in PRIVATE_set_in
+#endif
+
+#ifdef yyget_out
+#define PRIVATE_get_out_ALREADY_DEFINED
+#else
+#define yyget_out PRIVATE_get_out
+#endif
+
+#ifdef yyset_out
+#define PRIVATE_set_out_ALREADY_DEFINED
+#else
+#define yyset_out PRIVATE_set_out
+#endif
+
+#ifdef yyget_leng
+#define PRIVATE_get_leng_ALREADY_DEFINED
+#else
+#define yyget_leng PRIVATE_get_leng
+#endif
+
+#ifdef yyget_text
+#define PRIVATE_get_text_ALREADY_DEFINED
+#else
+#define yyget_text PRIVATE_get_text
+#endif
+
+#ifdef yyget_lineno
+#define PRIVATE_get_lineno_ALREADY_DEFINED
+#else
+#define yyget_lineno PRIVATE_get_lineno
+#endif
+
+#ifdef yyset_lineno
+#define PRIVATE_set_lineno_ALREADY_DEFINED
+#else
+#define yyset_lineno PRIVATE_set_lineno
+#endif
+
+#ifdef yywrap
+#define PRIVATE_wrap_ALREADY_DEFINED
+#else
+#define yywrap PRIVATE_wrap
+#endif
+
+#ifdef yyalloc
+#define PRIVATE_alloc_ALREADY_DEFINED
+#else
+#define yyalloc PRIVATE_alloc
+#endif
+
+#ifdef yyrealloc
+#define PRIVATE_realloc_ALREADY_DEFINED
+#else
+#define yyrealloc PRIVATE_realloc
+#endif
+
+#ifdef yyfree
+#define PRIVATE_free_ALREADY_DEFINED
+#else
+#define yyfree PRIVATE_free
+#endif
+
+#ifdef yytext
+#define PRIVATE_text_ALREADY_DEFINED
+#else
+#define yytext PRIVATE_text
+#endif
+
+#ifdef yyleng
+#define PRIVATE_leng_ALREADY_DEFINED
+#else
+#define yyleng PRIVATE_leng
+#endif
+
+#ifdef yyin
+#define PRIVATE_in_ALREADY_DEFINED
+#else
+#define yyin PRIVATE_in
+#endif
+
+#ifdef yyout
+#define PRIVATE_out_ALREADY_DEFINED
+#else
+#define yyout PRIVATE_out
+#endif
+
+#ifdef yy_flex_debug
+#define PRIVATE__flex_debug_ALREADY_DEFINED
+#else
+#define yy_flex_debug PRIVATE__flex_debug
+#endif
+
+#ifdef yylineno
+#define PRIVATE_lineno_ALREADY_DEFINED
+#else
+#define yylineno PRIVATE_lineno
+#endif
+
 /* First, we deal with  platform-specific or compiler-specific issues. */
 
 /* begin standard C headers. */
@@ -324,7 +583,7 @@ void yyfree ( void *  );
 
 /* Begin user sect3 */
 
-#define yywrap() (/*CONSTCOND*/1)
+#define PRIVATE_wrap() (/*CONSTCOND*/1)
 #define YY_SKIP_YYWRAP
 typedef flex_uint8_t YY_CHAR;
 
@@ -517,14 +776,14 @@ char *yytext;
  *
  */
 #define YY_NO_INPUT 1
-#line 30 "engines/private/lexer.l"
+#line 31 "engines/private/lexer.l"
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
 
 #include "private/grammar.h"
 #include "private/tokens.h"
 
-#line 526 "engines/private/lexer.cpp"
-#line 527 "engines/private/lexer.cpp"
+#line 785 "engines/private/lexer.cpp"
+#line 786 "engines/private/lexer.cpp"
 
 #define INITIAL 0
 
@@ -741,9 +1000,9 @@ YY_DECL
 		}
 
 	{
-#line 37 "engines/private/lexer.l"
+#line 38 "engines/private/lexer.l"
 
-#line 746 "engines/private/lexer.cpp"
+#line 1005 "engines/private/lexer.cpp"
 
 	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
 		{
@@ -798,121 +1057,121 @@ do_action:	/* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 38 "engines/private/lexer.l"
+#line 39 "engines/private/lexer.l"
 /* ignoring the comment */
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 39 "engines/private/lexer.l"
+#line 40 "engines/private/lexer.l"
 return LTE;
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 40 "engines/private/lexer.l"
+#line 41 "engines/private/lexer.l"
 return GTE;
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 41 "engines/private/lexer.l"
+#line 42 "engines/private/lexer.l"
 return NEQ;
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 42 "engines/private/lexer.l"
+#line 43 "engines/private/lexer.l"
 return EQ;
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 43 "engines/private/lexer.l"
+#line 44 "engines/private/lexer.l"
 return DEBUGTOK;
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 44 "engines/private/lexer.l"
+#line 45 "engines/private/lexer.l"
 return DEFINETOK;
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 45 "engines/private/lexer.l"
+#line 46 "engines/private/lexer.l"
 return SETTINGTOK;
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 46 "engines/private/lexer.l"
+#line 47 "engines/private/lexer.l"
 return IFTOK;
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 47 "engines/private/lexer.l"
+#line 48 "engines/private/lexer.l"
 return ELSETOK;
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 48 "engines/private/lexer.l"
+#line 49 "engines/private/lexer.l"
 return GOTOTOK;
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 49 "engines/private/lexer.l"
+#line 50 "engines/private/lexer.l"
 return RECT;
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 50 "engines/private/lexer.l"
+#line 51 "engines/private/lexer.l"
 return FALSETOK;
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 51 "engines/private/lexer.l"
+#line 52 "engines/private/lexer.l"
 return TRUETOK;
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 52 "engines/private/lexer.l"
+#line 53 "engines/private/lexer.l"
 return NULLTOK;
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 53 "engines/private/lexer.l"
+#line 54 "engines/private/lexer.l"
 return RANDOMTOK;
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 54 "engines/private/lexer.l"
-yylval.s = strdup(yytext); return NAME;
+#line 55 "engines/private/lexer.l"
+PRIVATE_lval.s = strdup(PRIVATE_text); return NAME;
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 55 "engines/private/lexer.l"
-yylval.sym = Private::constant(NUM, atoi(yytext), NULL); return NUM;
+#line 56 "engines/private/lexer.l"
+PRIVATE_lval.sym = Private::constant(NUM, atoi(PRIVATE_text), NULL); return NUM;
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 56 "engines/private/lexer.l"
-yylval.sym = Private::constant(STRING, 0, scumm_strdup(yytext)); return STRING;
+#line 57 "engines/private/lexer.l"
+PRIVATE_lval.sym = Private::constant(STRING, 0, scumm_strdup(PRIVATE_text)); return STRING;
 	YY_BREAK
 case 20:
 /* rule 20 can match eol */
 YY_RULE_SETUP
-#line 57 "engines/private/lexer.l"
+#line 58 "engines/private/lexer.l"
 /* ignore return */;
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 58 "engines/private/lexer.l"
+#line 59 "engines/private/lexer.l"
 /* ignore whitespace */;
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 59 "engines/private/lexer.l"
+#line 60 "engines/private/lexer.l"
 return *yytext;
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 60 "engines/private/lexer.l"
+#line 61 "engines/private/lexer.l"
 ECHO;
 	YY_BREAK
-#line 915 "engines/private/lexer.cpp"
+#line 1174 "engines/private/lexer.cpp"
 case YY_STATE_EOF(INITIAL):
 	yyterminate();
 
@@ -1918,7 +2177,7 @@ void yyfree (void * ptr )
 
 #define YYTABLES_NAME "yytables"
 
-#line 60 "engines/private/lexer.l"
+#line 61 "engines/private/lexer.l"
 
 
 namespace Private {
@@ -1929,7 +2188,7 @@ int parse(char *code) {
     yy_delete_buffer(YY_CURRENT_BUFFER);
     bp = yy_scan_string(code);
     yy_switch_to_buffer(bp);
-    yyparse();
+    PRIVATE_parse();
     yy_delete_buffer(bp);
     return 0;
 }
diff --git a/engines/private/lexer.l b/engines/private/lexer.l
index c23073207f..9b39511db4 100644
--- a/engines/private/lexer.l
+++ b/engines/private/lexer.l
@@ -25,6 +25,7 @@
 %option never-interactive
 
 %option outfile="engines/private/lexer.cpp"
+%option prefix="PRIVATE_"
 
 %{
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
@@ -51,9 +52,9 @@ FALSE                   return FALSETOK;
 TRUE                    return TRUETOK;
 NULL                    return NULLTOK;
 Random                  return RANDOMTOK;
-[A-Za-z_][A-Za-z_0-9]*  yylval.s = strdup(yytext); return NAME;
-[\-]?[0-9]+             yylval.sym = Private::constant(NUM, atoi(yytext), NULL); return NUM;
-\"[^\"\r\n]*\"          yylval.sym = Private::constant(STRING, 0, scumm_strdup(yytext)); return STRING;
+[A-Za-z_][A-Za-z_0-9]*  PRIVATE_lval.s = strdup(PRIVATE_text); return NAME;
+[\-]?[0-9]+             PRIVATE_lval.sym = Private::constant(NUM, atoi(PRIVATE_text), NULL); return NUM;
+\"[^\"\r\n]*\"          PRIVATE_lval.sym = Private::constant(STRING, 0, scumm_strdup(PRIVATE_text)); return STRING;
 [\r|\n]+                /* ignore return */;
 [ \t]+                  /* ignore whitespace */;
 .                       return *yytext;
@@ -67,7 +68,7 @@ int parse(char *code) {
     yy_delete_buffer(YY_CURRENT_BUFFER);
     bp = yy_scan_string(code);
     yy_switch_to_buffer(bp);
-    yyparse();
+    PRIVATE_parse();
     yy_delete_buffer(bp);
     return 0;
 }
diff --git a/engines/private/tokens.h b/engines/private/tokens.h
index 13389626f7..3a837478c2 100644
--- a/engines/private/tokens.h
+++ b/engines/private/tokens.h
@@ -35,25 +35,33 @@
    especially those whose name start with YY_ or yy_.  They are
    private implementation details that can be changed or removed.  */
 
-#ifndef YY_YY_ENGINES_PRIVATE_TOKENS_H_INCLUDED
-# define YY_YY_ENGINES_PRIVATE_TOKENS_H_INCLUDED
+#ifndef YY_PRIVATE_ENGINES_PRIVATE_TOKENS_H_INCLUDED
+# define YY_PRIVATE_ENGINES_PRIVATE_TOKENS_H_INCLUDED
 /* Debug traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
+#ifndef PRIVATE_DEBUG
+# if defined YYDEBUG
 #if YYDEBUG
-extern int yydebug;
+#   define PRIVATE_DEBUG 1
+#  else
+#   define PRIVATE_DEBUG 0
+#  endif
+# else /* ! defined YYDEBUG */
+#  define PRIVATE_DEBUG 0
+# endif /* ! defined YYDEBUG */
+#endif  /* ! defined PRIVATE_DEBUG */
+#if PRIVATE_DEBUG
+extern int PRIVATE_debug;
 #endif
 
 /* Token kinds.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-  enum yytokentype
+#ifndef PRIVATE_TOKENTYPE
+# define PRIVATE_TOKENTYPE
+  enum PRIVATE_tokentype
   {
-    YYEMPTY = -2,
-    YYEOF = 0,                     /* "end of file"  */
-    YYerror = 256,                 /* error  */
-    YYUNDEF = 257,                 /* "invalid token"  */
+    PRIVATE_EMPTY = -2,
+    PRIVATE_EOF = 0,               /* "end of file"  */
+    PRIVATE_error = 256,           /* error  */
+    PRIVATE_UNDEF = 257,           /* "invalid token"  */
     NAME = 258,                    /* NAME  */
     STRING = 259,                  /* STRING  */
     NUM = 260,                     /* NUM  */
@@ -73,14 +81,14 @@ extern int yydebug;
     SETTINGTOK = 274,              /* SETTINGTOK  */
     RANDOMTOK = 275                /* RANDOMTOK  */
   };
-  typedef enum yytokentype yytoken_kind_t;
+  typedef enum PRIVATE_tokentype PRIVATE_token_kind_t;
 #endif
 
 /* Value type.  */
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-union YYSTYPE
+#if ! defined PRIVATE_STYPE && ! defined PRIVATE_STYPE_IS_DECLARED
+union PRIVATE_STYPE
 {
-#line 51 "engines/private/grammar.y"
+#line 52 "engines/private/grammar.y"
 
         Private::Symbol *sym; /* symbol table pointer */
         int (**inst)();       /* machine instruction */
@@ -88,17 +96,17 @@ union YYSTYPE
         int *i;               /* integer value */
         int narg;             /* auxiliary value to count function arguments */
 
-#line 92 "engines/private/tokens.h"
+#line 100 "engines/private/tokens.h"
 
 };
-typedef union YYSTYPE YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define YYSTYPE_IS_DECLARED 1
+typedef union PRIVATE_STYPE PRIVATE_STYPE;
+# define PRIVATE_STYPE_IS_TRIVIAL 1
+# define PRIVATE_STYPE_IS_DECLARED 1
 #endif
 
 
-extern YYSTYPE yylval;
+extern PRIVATE_STYPE PRIVATE_lval;
 
-int yyparse (void);
+int PRIVATE_parse (void);
 
-#endif /* !YY_YY_ENGINES_PRIVATE_TOKENS_H_INCLUDED  */
+#endif /* !YY_PRIVATE_ENGINES_PRIVATE_TOKENS_H_INCLUDED  */


Commit: f1fe50ee667b9c515b4240e75028650f26c65f4b
    https://github.com/scummvm/scummvm/commit/f1fe50ee667b9c515b4240e75028650f26c65f4b
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: code convention on type casting

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/symbol.cpp


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index e05ae90c52..34b7bcf43d 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -643,7 +643,7 @@ void SoundArea(ArgArray args) {
     char *n;
 
     if (args[1].type == NAME)
-        n = (char *) args[1].u.sym->name->c_str();
+        n = (char *)args[1].u.sym->name->c_str();
     else if (args[1].type == STRING)
         n = args[1].u.str;
     else
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index e8e214734b..d626c6d8f1 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -387,7 +387,7 @@ bool PrivateEngine::inMask(Graphics::ManagedSurface *surf, Common::Point mousePo
     if (mousePos.x > surf->w || mousePos.y > surf->h)
         return false;
 
-    return ( *((uint32*) surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor);
+    return ( *((uint32*)surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor);
 }
 
 
@@ -1075,11 +1075,11 @@ char *PrivateEngine::getRandomPhoneClip(char *clip, int i, int j) {
 
 void timerCallback(void *refCon) {
     g_private->removeTimer();
-    g_private->_nextSetting = (Common::String*) refCon;
+    g_private->_nextSetting = (Common::String*)refCon;
 }
 
 bool PrivateEngine::installTimer(uint32 delay, Common::String *ns) {
-    return g_system->getTimerManager()->installTimerProc(&timerCallback, delay, (void*) ns, "timerCallback");
+    return g_system->getTimerManager()->installTimerProc(&timerCallback, delay, (void*)ns, "timerCallback");
 }
 
 void PrivateEngine::removeTimer() {
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 50a2b15428..8d03d830d2 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -84,7 +84,7 @@ Symbol *lookupName(char *n) {
 
     else {
         debugC(1, kPrivateDebugCode, "WARNING: %s not defined", s->c_str());
-        return constant(STRING, 0, (char*) s->c_str());
+        return constant(STRING, 0, (char*)s->c_str());
     }
 
 }
@@ -103,7 +103,7 @@ void installAll(char *n) {
         //debug("name %s", s->c_str());
         if (strcmp(n, "settings") == 0) {
             assert(r == NULL);
-            install(s, STRING, 0, (char*) s->c_str(), r, &settings);
+            install(s, STRING, 0, (char*)s->c_str(), r, &settings);
         }
 
         else if (strcmp(n, "variables") == 0) {


Commit: a238290c339b34a15c4770ef3bc91e6abccd11c5
    https://github.com/scummvm/scummvm/commit/a238290c339b34a15c4770ef3bc91e6abccd11c5
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: code convention on type casting

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/grammar.h
    engines/private/private.cpp
    engines/private/private.h
    engines/private/symbol.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index eb63a4b52c..9662d12d81 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -68,7 +68,7 @@ void initInsts() {
 
 /* initialize for code generation */
 void initSetting() {
-    setting = (Setting*)malloc(sizeof(Setting));
+    setting = (Setting *)malloc(sizeof(Setting));
     memset((void *)setting, 0, sizeof(Setting));
 
     prog = (Inst *)&setting->prog;
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 34b7bcf43d..a44415373a 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -131,7 +131,7 @@ void LoadGame(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "LoadGame(%s, %s)", args[0].u.str, args[2].u.sym->name->c_str());
     Common::String *s = new Common::String(args[0].u.str);
-    MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
+    MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
     m->surf = g_private->loadMask(*s, 0, 0, true);
     m->cursor = args[2].u.sym->name;
     m->nextSetting = NULL;
@@ -145,7 +145,7 @@ void SaveGame(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "SaveGame(%s, %s)", args[0].u.str, args[1].u.sym->name->c_str());
     Common::String *s = new Common::String(args[0].u.str);
-    MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
+    MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
     m->surf = g_private->loadMask(*s, 0, 0, true);
     m->cursor = args[1].u.sym->name;
     m->nextSetting = NULL;
@@ -210,7 +210,7 @@ void DossierAdd(ArgArray args) {
 
     assert (args.size() == 2);
     Common::String *s1 = new Common::String(args[0].u.str);
-    DossierInfo *m = (DossierInfo*)malloc(sizeof(DossierInfo));
+    DossierInfo *m = (DossierInfo *)malloc(sizeof(DossierInfo));
     m->page1 = s1;
 
     if (strcmp(args[1].u.str, "\"\"") != 0) {
@@ -244,7 +244,7 @@ void DossierChgSheet(ArgArray args) {
 void DossierPrevSuspect(ArgArray args) {
     assert (args.size() == 3);
     Common::String *s = new Common::String(args[0].u.str);
-    MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
+    MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
 
     int x = args[1].u.val;
     int y = args[2].u.val;
@@ -261,7 +261,7 @@ void DossierPrevSuspect(ArgArray args) {
 void DossierNextSuspect(ArgArray args) {
     assert (args.size() == 3);
     Common::String *s = new Common::String(args[0].u.str);
-    MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
+    MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
 
     int x = args[1].u.val;
     int y = args[2].u.val;
@@ -316,7 +316,7 @@ void Inventory(ArgArray args) {
 
     if (strcmp(b1.u.str, "\"\"") != 0) {
         Common::String *s = new Common::String(b1.u.str);
-        MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
+        MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
         m->surf = g_private->loadMask(*s, 0, 0, true);
 
         if (e.type == NUM)
@@ -380,7 +380,7 @@ void Exit(ArgArray args) {
     // assert types
     assert(args[2].type == RECT || args[2].type == NAME);
     debugC(1, kPrivateDebugScript, "Exit(%d %d %d)", args[0].type, args[1].type, args[2].type); //, args[0].u.str, args[1].u.sym->name->c_str(), "RECT");
-    ExitInfo *e = (ExitInfo*)malloc(sizeof(ExitInfo));
+    ExitInfo *e = (ExitInfo *)malloc(sizeof(ExitInfo));
 
     if (args[0].type == NUM && args[0].u.val == 0)
         e->nextSetting = NULL;
@@ -566,7 +566,7 @@ void _Mask(ArgArray args, bool drawn) {
     //if (drawed)
     //    g_private->loadImage(*s, x, y);
 
-    MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
+    MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
     m->surf = g_private->loadMask(*s, x, y, drawn);
     m->nextSetting = new Common::String(e);
     m->cursor = c;
@@ -601,7 +601,7 @@ void AddSound(char *s, char *t, Symbol *flag = NULL, int val = 0) {
             return;
 
         g_private->_playedPhoneClips.setVal(*sound, true);
-        PhoneInfo *p = (PhoneInfo*)malloc(sizeof(PhoneInfo));
+        PhoneInfo *p = (PhoneInfo *)malloc(sizeof(PhoneInfo));
         p->sound = sound;
         p->flag = flag;
         p->val = val;
@@ -652,7 +652,7 @@ void SoundArea(ArgArray args) {
     debugC(1, kPrivateDebugScript, "SoundArea(%s, %s)", args[0].u.str, n);
     if (strcmp(n, "kAMRadio") == 0) {
         Common::String *s = new Common::String(args[0].u.str);
-        MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
+        MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
         m->surf = g_private->loadMask(*s, 0, 0, true);
         m->cursor = args[2].u.sym->name;
         m->nextSetting = NULL;
@@ -662,7 +662,7 @@ void SoundArea(ArgArray args) {
         g_private->_masks.push_front(*m);
     } else if (strcmp(n, "kPoliceRadio") == 0) {
         Common::String *s = new Common::String(args[0].u.str);
-        MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
+        MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
         m->surf = g_private->loadMask(*s, 0, 0, true);
         m->cursor = args[2].u.sym->name;
         m->nextSetting = NULL;
@@ -672,7 +672,7 @@ void SoundArea(ArgArray args) {
         g_private->_masks.push_front(*m);
     } else if (strcmp(n, "kPhone") == 0) {
         Common::String *s = new Common::String(args[0].u.str);
-        MaskInfo *m = (MaskInfo*)malloc(sizeof(MaskInfo));
+        MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
         m->surf = g_private->loadMask(*s, 0, 0, true);
         m->cursor = args[2].u.sym->name;
         m->nextSetting = NULL;
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 989896b21c..4f14c04bcb 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -51,10 +51,10 @@ typedef struct Datum {  /* interpreter stack type */
 
 typedef struct Arg {
     int n;
-    int (**inst)();
+    int (** inst)();
 } Arg;
 
-typedef int (*Inst)();  /* machine instruction */
+typedef int (* Inst)();  /* machine instruction */
 #define STOP    (Inst) 0
 
 typedef Common::HashMap<void *, Common::String *> PtrToName;
@@ -79,9 +79,9 @@ typedef struct Setting {
 
 extern Setting *psetting;
 
-typedef Common::HashMap<Common::String, Setting*> SettingMap;
+typedef Common::HashMap<Common::String, Setting *> SettingMap;
 typedef Common::Queue<Common::String> StringQueue;
-typedef Common::Queue<Common::Rect*> RectQueue;
+typedef Common::Queue<Common::Rect *> RectQueue;
 
 // Funtions
 
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index d626c6d8f1..b05702db18 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -51,7 +51,7 @@ namespace Private {
 
 PrivateEngine *g_private = NULL;
 
-extern int parse(char*);
+extern int parse(char *);
 
 PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     : Engine(syst), _gameDescription(gd) {
@@ -387,7 +387,7 @@ bool PrivateEngine::inMask(Graphics::ManagedSurface *surf, Common::Point mousePo
     if (mousePos.x > surf->w || mousePos.y > surf->h)
         return false;
 
-    return ( *((uint32*)surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor);
+    return ( *((uint32 *)surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor);
 }
 
 
@@ -706,7 +706,7 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
     for (uint32 i = 0; i < size; ++i) {
         file = new Common::String(stream->readString());
 
-        DossierInfo *m = (DossierInfo*)malloc(sizeof(DossierInfo));
+        DossierInfo *m = (DossierInfo *)malloc(sizeof(DossierInfo));
         m->page1 = file;
 
         file = new Common::String(stream->readString());
@@ -741,7 +741,7 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
     _phone.clear();
 
     for (uint32 j = 0; j < size; ++j) {
-        PhoneInfo *i = (PhoneInfo*)malloc(sizeof(PhoneInfo));
+        PhoneInfo *i = (PhoneInfo *)malloc(sizeof(PhoneInfo));
 
         i->sound = new Common::String(stream->readString());
         i->flag  = variables.getVal(stream->readString());
@@ -1066,7 +1066,7 @@ Common::String *PrivateEngine::getLeaveSound() {
 char *PrivateEngine::getRandomPhoneClip(char *clip, int i, int j) {
     uint r = i + _rnd->getRandomNumber(j - i);
 
-    char *f = (char*)malloc((strlen(clip)+3)*sizeof(char));
+    char *f = (char *)malloc((strlen(clip)+3)*sizeof(char));
     snprintf(f, 32, "%s%02d", clip, r);
     return f;
 }
@@ -1075,11 +1075,11 @@ char *PrivateEngine::getRandomPhoneClip(char *clip, int i, int j) {
 
 void timerCallback(void *refCon) {
     g_private->removeTimer();
-    g_private->_nextSetting = (Common::String*)refCon;
+    g_private->_nextSetting = (Common::String *)refCon;
 }
 
 bool PrivateEngine::installTimer(uint32 delay, Common::String *ns) {
-    return g_system->getTimerManager()->installTimerProc(&timerCallback, delay, (void*)ns, "timerCallback");
+    return g_system->getTimerManager()->installTimerProc(&timerCallback, delay, (void *)ns, "timerCallback");
 }
 
 void PrivateEngine::removeTimer() {
@@ -1096,7 +1096,7 @@ void PrivateEngine::loadLocations(Common::Rect *rect) {
         i++;
         if (sym->u.val) {
             offset = offset + 22;
-            char *f = (char*)malloc(32*sizeof(char));
+            char *f = (char *)malloc(32*sizeof(char));
             snprintf(f, 32, "dryloc%d.bmp", i);
             //debug("%s, %d, %d", f, i, offset);
             Common::String s(*_diaryLocPrefix + f);
diff --git a/engines/private/private.h b/engines/private/private.h
index 8d48349905..daa7c9b7c0 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -195,7 +195,7 @@ public:
 
     Graphics::ManagedSurface *loadMask(const Common::String &, int, int, bool);
     void drawMask(Graphics::ManagedSurface *);
-    bool inMask(Graphics::ManagedSurface*, Common::Point);
+    bool inMask(Graphics::ManagedSurface *, Common::Point);
     uint32 _transparentColor;
     Common::Rect *screenRect;
     void drawScreen();
diff --git a/engines/private/symbol.h b/engines/private/symbol.h
index 101ceb42c6..f22d8bdf3c 100644
--- a/engines/private/symbol.h
+++ b/engines/private/symbol.h
@@ -48,9 +48,9 @@ typedef struct Symbol {     /* symbol table entry */
 extern void showSymbol(Symbol *);
 extern void setSymbol(Symbol *, int);
 
-typedef Common::HashMap<Common::String, Symbol*> SymbolMap;
+typedef Common::HashMap<Common::String, Symbol *> SymbolMap;
 typedef Common::List<Common::String> NameList;
-typedef Common::List<Symbol*> ConstantList;
+typedef Common::List<Symbol *> ConstantList;
 
 extern SymbolMap settings, variables, cursors, locations, rects;
 extern ConstantList constants;
@@ -58,7 +58,7 @@ extern NameList variableList;
 extern NameList locationList;
 
 extern void     defineSymbol(char *, Common::Rect *);
-extern Symbol  *install(Common::String *, int, int, char *, Common::Rect *, SymbolMap*);
+extern Symbol  *install(Common::String *, int, int, char *, Common::Rect *, SymbolMap *);
 extern Symbol  *lookupName(char *);
 extern Symbol  *constant(int, int, char *);
 extern void     installAll(char *);


Commit: 216258ed21b24633ba3d0a4b35561abf16f5e052
    https://github.com/scummvm/scummvm/commit/216258ed21b24633ba3d0a4b35561abf16f5e052
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: avoid global constructors in initCursors

Changed paths:
    engines/private/cursors.cpp


diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index 0bd1a3e087..b3a77c7e3c 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -315,17 +315,17 @@ static struct CursorDataTable {
 
 static struct CursorPointTable {
     const char *name;
-    const Common::Point *point;
+    const int coord[2];
 } cursorPointTable[] = {
-    { "kExit",         new Common::Point(9, 0)},
-    { "kInventory",    new Common::Point(15, 3)},
-    { "kTurnLeft",     new Common::Point(29, 16)},
-    { "kTurnRight",    new Common::Point(1, 15)},
-    { "kZoomIn",       new Common::Point(10, 8)},
-    { "kZoomOut",      new Common::Point(13, 31)},
-    { "kPhone",        new Common::Point(17, 19)},
-    { "default",       new Common::Point(0, 0)},
-    { 0, 0}
+    { "kExit",      {9,   0} },
+    { "kInventory", {15,  3} },
+    { "kTurnLeft",  {29, 16} },
+    { "kTurnRight", {1,  15} },
+    { "kZoomIn",    {10,  8} },
+    { "kZoomOut",   {13, 31} },
+    { "kPhone",     {17, 19} },
+    { "default",    {0,   0} },
+    { 0,            {0,   0} }
 };
 
 CursorDataMap _cursorData;
@@ -336,10 +336,10 @@ void PrivateEngine::initCursors() {
         Common::String *name = new Common::String(cur->name);
         _cursorData.setVal(*name, cur->cursor);
     }
-
+    
     for (Private::CursorPointTable *cur = Private::cursorPointTable; cur->name; cur++) {
         Common::String *name = new Common::String(cur->name);
-        Common::Point *point = new Common::Point(*cur->point);
+        Common::Point *point = new Common::Point(cur->coord[0], cur->coord[1]);
         _cursorPoints.setVal(*name, point);
     }
     CursorMan.replaceCursorPalette(cursorPalette, 0, 3);


Commit: 4d7a70d50857474065ab8d29ae2654978181a97f
    https://github.com/scummvm/scummvm/commit/4d7a70d50857474065ab8d29ae2654978181a97f
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: code convention on type casting

Changed paths:
    engines/private/cursors.h
    engines/private/symbol.cpp


diff --git a/engines/private/cursors.h b/engines/private/cursors.h
index 8aad12a605..fdc3e4a084 100644
--- a/engines/private/cursors.h
+++ b/engines/private/cursors.h
@@ -31,8 +31,8 @@
 
 namespace Private {
 
-typedef Common::HashMap<Common::String, const byte*> CursorDataMap;
-typedef Common::HashMap<Common::String, Common::Point*> CursorPointMap;
+typedef Common::HashMap<Common::String, const byte *> CursorDataMap;
+typedef Common::HashMap<Common::String, Common::Point *> CursorPointMap;
 
 } // End of namespace Private
 
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 8d03d830d2..507e25748d 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -84,7 +84,7 @@ Symbol *lookupName(char *n) {
 
     else {
         debugC(1, kPrivateDebugCode, "WARNING: %s not defined", s->c_str());
-        return constant(STRING, 0, (char*)s->c_str());
+        return constant(STRING, 0, (char *)s->c_str());
     }
 
 }
@@ -103,7 +103,7 @@ void installAll(char *n) {
         //debug("name %s", s->c_str());
         if (strcmp(n, "settings") == 0) {
             assert(r == NULL);
-            install(s, STRING, 0, (char*)s->c_str(), r, &settings);
+            install(s, STRING, 0, (char *)s->c_str(), r, &settings);
         }
 
         else if (strcmp(n, "variables") == 0) {


Commit: e89616a17779ccb4412413cbd42aab9936807086
    https://github.com/scummvm/scummvm/commit/e89616a17779ccb4412413cbd42aab9936807086
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixed in formating of module.mk

Changed paths:
    engines/private/module.mk


diff --git a/engines/private/module.mk b/engines/private/module.mk
index 435820dd34..afbe36f3a2 100644
--- a/engines/private/module.mk
+++ b/engines/private/module.mk
@@ -1,17 +1,17 @@
 MODULE := engines/private
  
 MODULE_OBJS := \
-	metaengine.o \
     code.o \
-	cursors.o \
-	symbol.o \
-	funcs.o \
+    cursors.o \
+    funcs.o \
     grammar.o \
 	lexer.o \
-	private.o
+	metaengine.o \
+    private.o \
+	symbol.o
  
 MODULE_DIRS += \
-	engines/private
+    engines/private
  
 # This module can be built as a plugin
 ifeq ($(ENABLE_PRIVATE), DYNAMIC_PLUGIN)


Commit: 09a2d524473d6b90627c63c4d617ff0ca5d1d122
    https://github.com/scummvm/scummvm/commit/09a2d524473d6b90627c63c4d617ff0ca5d1d122
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: avoid confusion in nested if

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index b05702db18..e60a99c903 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -141,8 +141,10 @@ Common::Error PrivateEngine::run() {
             file = _installerArchive.createReadStreamForMember("GAME.TXT");
 
         // if the demo from the full retail CDROM is used
-        else if (_installerArchive.hasFile("DEMOGAME.DAT"))
-            file = _installerArchive.createReadStreamForMember("DEMOGAME.DAT");
+        else {
+            if (_installerArchive.hasFile("DEMOGAME.DAT"))
+                file = _installerArchive.createReadStreamForMember("DEMOGAME.DAT");
+        }
     }
 
     assert(file != NULL);


Commit: e459ad67777c894208a5e759003cb3ddba7be260
    https://github.com/scummvm/scummvm/commit/e459ad67777c894208a5e759003cb3ddba7be260
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: code convention on type casting

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index e60a99c903..093d1742ee 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -389,7 +389,7 @@ bool PrivateEngine::inMask(Graphics::ManagedSurface *surf, Common::Point mousePo
     if (mousePos.x > surf->w || mousePos.y > surf->h)
         return false;
 
-    return ( *((uint32 *)surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor);
+    return (*((uint32 *)surf->getBasePtr(mousePos.x, mousePos.y)) != _transparentColor);
 }
 
 


Commit: c331703e4b67821ce9fa75ed7f160c14b126836d
    https://github.com/scummvm/scummvm/commit/c331703e4b67821ce9fa75ed7f160c14b126836d
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: code convention on function names

Changed paths:
    engines/private/funcs.cpp


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index a44415373a..37efca4d29 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -31,7 +31,7 @@
 
 namespace Private {
 
-void ChgMode(ArgArray args) {
+void fChgMode(ArgArray args) {
     // assert types
     assert (args.size() == 2 || args.size() == 3);
     if (args.size() == 2)
@@ -63,14 +63,14 @@ void ChgMode(ArgArray args) {
     }
 }
 
-void VSPicture(ArgArray args) {
+void fVSPicture(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "VSPicture(%s)", args[0].u.str);
     g_private->_nextVS = new Common::String(args[0].u.str);
 }
 
 
-void DiaryLocList(ArgArray args) {
+void fDiaryLocList(ArgArray args) {
     int x1, y1, x2, y2;
 
     debugC(1, kPrivateDebugScript, "DiaryLocList(%d, %d, %d, %d)", args[0].u.val, args[1].u.val, args[2].u.val, args[3].u.val);
@@ -86,11 +86,11 @@ void DiaryLocList(ArgArray args) {
 
 }
 
-void DiaryGoLoc(ArgArray args) {
+void fDiaryGoLoc(ArgArray args) {
     debugC(1, kPrivateDebugScript, "WARNING: DiaryGoLoc not implemented");
 }
 
-void DiaryInvList(ArgArray args) {
+void fDiaryInvList(ArgArray args) {
     Common::Rect *r1, *r2;
 
     debugC(1, kPrivateDebugScript, "DiaryInvList(%d, ..)", args[0].u.val);
@@ -101,7 +101,7 @@ void DiaryInvList(ArgArray args) {
     g_private->loadInventory(args[0].u.val, r1, r2);
 }
 
-void Goto(ArgArray args) { // should be goto, but this is a reserved word
+void fgoto(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "goto(%s)", args[0].u.str);
     Common::String *s = new Common::String(args[0].u.str);
@@ -109,7 +109,7 @@ void Goto(ArgArray args) { // should be goto, but this is a reserved word
 }
 
 
-void SyncSound(ArgArray args) {
+void fSyncSound(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "SyncSound(%s, %s)", args[0].u.str, args[1].u.str);
     Common::String *nextSetting = new Common::String(args[1].u.str);
@@ -122,12 +122,12 @@ void SyncSound(ArgArray args) {
     }
 }
 
-void Quit(ArgArray args) {
+void fQuit(ArgArray args) {
     debugC(1, kPrivateDebugScript, "Quit()");
     g_private->quitGame();
 }
 
-void LoadGame(ArgArray args) {
+void fLoadGame(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "LoadGame(%s, %s)", args[0].u.str, args[2].u.sym->name->c_str());
     Common::String *s = new Common::String(args[0].u.str);
@@ -141,7 +141,7 @@ void LoadGame(ArgArray args) {
     g_private->_masks.push_front(*m);
 }
 
-void SaveGame(ArgArray args) {
+void fSaveGame(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "SaveGame(%s, %s)", args[0].u.str, args[1].u.sym->name->c_str());
     Common::String *s = new Common::String(args[0].u.str);
@@ -155,12 +155,12 @@ void SaveGame(ArgArray args) {
     g_private->_masks.push_front(*m);
 }
 
-void RestartGame(ArgArray args) {
+void fRestartGame(ArgArray args) {
     assert(args.size() == 0);
     g_private->restartGame();
 }
 
-void PoliceBust(ArgArray args) {
+void fPoliceBust(ArgArray args) {
     // assert types
     assert (args.size() == 1 || args.size() == 2);
     g_private->_policeBustEnabled = args[0].u.val;
@@ -183,7 +183,7 @@ void PoliceBust(ArgArray args) {
     debugC(1, kPrivateDebugScript, "WARNING: PoliceBust partially implemented");
 }
 
-void BustMovie(ArgArray args) {
+void fBustMovie(ArgArray args) {
     // assert types
     assert (args.size() == 1);
     debugC(1, kPrivateDebugScript, "BustMovie(%s)", args[0].u.str);
@@ -206,7 +206,7 @@ void BustMovie(ArgArray args) {
     g_private->_nextSetting = new Common::String(args[0].u.str);
 }
 
-void DossierAdd(ArgArray args) {
+void fDossierAdd(ArgArray args) {
 
     assert (args.size() == 2);
     Common::String *s1 = new Common::String(args[0].u.str);
@@ -224,7 +224,7 @@ void DossierAdd(ArgArray args) {
     g_private->_dossiers.push_back(*m);
 }
 
-void DossierBitmap(ArgArray args) {
+void fDossierBitmap(ArgArray args) {
 
     assert (args.size() == 2);
 
@@ -237,11 +237,11 @@ void DossierBitmap(ArgArray args) {
 
 }
 
-void DossierChgSheet(ArgArray args) {
+void fDossierChgSheet(ArgArray args) {
     debugC(1, kPrivateDebugScript, "WARNING: DossierChgSheet is not implemented");
 }
 
-void DossierPrevSuspect(ArgArray args) {
+void fDossierPrevSuspect(ArgArray args) {
     assert (args.size() == 3);
     Common::String *s = new Common::String(args[0].u.str);
     MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
@@ -258,7 +258,7 @@ void DossierPrevSuspect(ArgArray args) {
     g_private->_masks.push_front(*m);
 }
 
-void DossierNextSuspect(ArgArray args) {
+void fDossierNextSuspect(ArgArray args) {
     assert (args.size() == 3);
     Common::String *s = new Common::String(args[0].u.str);
     MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
@@ -275,19 +275,19 @@ void DossierNextSuspect(ArgArray args) {
     g_private->_masks.push_front(*m);
 }
 
-void NoStopSounds(ArgArray args) {
+void fNoStopSounds(ArgArray args) {
     assert(args.size() == 0);
     debugC(1, kPrivateDebugScript, "NoStopSounds()");
     g_private->_noStopSounds = true;
 }
 
-void LoseInventory(ArgArray args) {
+void fLoseInventory(ArgArray args) {
     assert(args.size() == 0);
     debugC(1, kPrivateDebugScript, "LoveInventory()");
     g_private->inventory.clear();
 }
 
-void Inventory(ArgArray args) {
+void fInventory(ArgArray args) {
 
     // assert types
     Datum b1 = args[0];
@@ -369,14 +369,14 @@ void Inventory(ArgArray args) {
 
 }
 
-void SetFlag(ArgArray args) {
+void fSetFlag(ArgArray args) {
     assert(args.size() == 2);
     assert(args[0].type == NAME && args[1].type == NUM);
     debugC(1, kPrivateDebugScript, "SetFlag(%s, %d)", args[0].u.sym->name->c_str(), args[1].u.val);
     args[0].u.sym->u.val = args[1].u.val;
 }
 
-void Exit(ArgArray args) {
+void fExit(ArgArray args) {
     // assert types
     assert(args[2].type == RECT || args[2].type == NAME);
     debugC(1, kPrivateDebugScript, "Exit(%d %d %d)", args[0].type, args[1].type, args[2].type); //, args[0].u.str, args[1].u.sym->name->c_str(), "RECT");
@@ -402,20 +402,20 @@ void Exit(ArgArray args) {
     g_private->_exits.push_front(*e);
 }
 
-void SetModifiedFlag(ArgArray args) {
+void fSetModifiedFlag(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "SetModifiedFlag(%d)", args[0].u.val);
     g_private->_modified = args[0].u.val != 0;
 }
 
-void PaperShuffleSound(ArgArray args) {
+void fPaperShuffleSound(ArgArray args) {
     assert(args.size() == 0);
     debugC(1, kPrivateDebugScript, "PaperShuffleSound()");
     Common::String *s = g_private->getPaperShuffleSound();
     g_private->playSound(*s, 1, false, false);
 }
 
-void SoundEffect(ArgArray args) {
+void fSoundEffect(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "SoundEffect(%s)", args[0].u.str);
     if (strcmp("\"\"", args[0].u.str) != 0) {
@@ -427,7 +427,7 @@ void SoundEffect(ArgArray args) {
     }
 }
 
-void Sound(ArgArray args) {
+void fSound(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "Sound(%s)", args[0].u.str);
     if (args.size() == 4) {
@@ -452,7 +452,7 @@ void Sound(ArgArray args) {
     }
 }
 
-void LoopedSound(ArgArray args) {
+void fLoopedSound(ArgArray args) {
     // assert types
     assert(args.size() == 1);
     debugC(1, kPrivateDebugScript, "LoopedSound(%s)", args[0].u.str);
@@ -466,19 +466,19 @@ void LoopedSound(ArgArray args) {
 }
 
 
-void ViewScreen(ArgArray args) {
+void fViewScreen(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "WARNING: ViewScreen not implemented!");
 }
 
-void Transition(ArgArray args) {
+void fTransition(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "Transition(%s, %s)", args[0].u.str, args[1].u.str);
     g_private->_nextMovie = new Common::String(args[0].u.str);
     g_private->_nextSetting = new Common::String(args[1].u.str);
 }
 
-void Resume(ArgArray args) {
+void fResume(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "Resume(%d)", args[0].u.val); // this value is always 1
     g_private->_nextSetting = g_private->_pausedSetting;
@@ -487,7 +487,7 @@ void Resume(ArgArray args) {
     g_private->_origin = &kPrivateOriginOne;
 }
 
-void Movie(ArgArray args) {
+void fMovie(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "Movie(%s, %s)", args[0].u.str, args[1].u.str);
     Common::String *movie = new Common::String(args[0].u.str);
@@ -509,7 +509,7 @@ void Movie(ArgArray args) {
     //g_private->_nextSetting = new Common::String(args[1].u.str);
 }
 
-void CRect(ArgArray args) {
+void fCRect(ArgArray args) {
     // assert types
     int x1, y1, x2, y2;
 
@@ -529,7 +529,7 @@ void CRect(ArgArray args) {
     push(*d);
 }
 
-void Bitmap(ArgArray args) {
+void fBitmap(ArgArray args) {
     assert(args.size() == 1 || args.size() == 3);
 
     int x = 0;
@@ -546,7 +546,7 @@ void Bitmap(ArgArray args) {
     g_private->loadImage(*s, x, y);
 }
 
-void _Mask(ArgArray args, bool drawn) {
+void _fMask(ArgArray args, bool drawn) {
     assert(args.size() == 3 || args.size() == 5);
 
     int x = 0;
@@ -577,14 +577,14 @@ void _Mask(ArgArray args, bool drawn) {
 
 }
 
-void Mask(ArgArray args) {
-    _Mask(args, false);
+void fMask(ArgArray args) {
+    _fMask(args, false);
 }
-void MaskDrawn(ArgArray args) {
-    _Mask(args, true);
+void fMaskDrawn(ArgArray args) {
+    _fMask(args, true);
 }
 
-void AddSound(char *s, char *t, Symbol *flag = NULL, int val = 0) {
+void fAddSound(char *s, char *t, Symbol *flag = NULL, int val = 0) {
     if (strcmp(s, "\"\"") == 0)
         return;
 
@@ -612,15 +612,15 @@ void AddSound(char *s, char *t, Symbol *flag = NULL, int val = 0) {
         error("error: invalid sound type %s", t);
 }
 
-void AMRadioClip(ArgArray args) {
+void fAMRadioClip(ArgArray args) {
     assert(args.size() <= 4);
-    AddSound(args[0].u.str, "AMRadioClip");
+    fAddSound(args[0].u.str, "AMRadioClip");
 }
-void PoliceClip(ArgArray args) {
+void fPoliceClip(ArgArray args) {
     assert(args.size() <= 4);
-    AddSound(args[0].u.str, "PoliceClip");
+    fAddSound(args[0].u.str, "PoliceClip");
 }
-void PhoneClip(ArgArray args) {
+void fPhoneClip(ArgArray args) {
     if (args.size() == 2) {
         debugC(1, kPrivateDebugScript, "Unimplemented PhoneClip special case");
         return;
@@ -629,16 +629,16 @@ void PhoneClip(ArgArray args) {
     int j = args[3].u.val;
 
     if (i == j)
-        AddSound(args[0].u.str, "PhoneClip", args[4].u.sym, args[5].u.val);
+        fAddSound(args[0].u.str, "PhoneClip", args[4].u.sym, args[5].u.val);
     else {
         assert(i < j);
         char *clip = g_private->getRandomPhoneClip(args[0].u.str, i, j);
-        AddSound(clip, "PhoneClip", args[4].u.sym, args[5].u.val);
+        fAddSound(clip, "PhoneClip", args[4].u.sym, args[5].u.val);
     }
 
 }
 
-void SoundArea(ArgArray args) {
+void fSoundArea(ArgArray args) {
     // assert types
     char *n;
 
@@ -683,19 +683,18 @@ void SoundArea(ArgArray args) {
     }
 }
 
-void SafeDigit(ArgArray args) {
-    // This is not needed, since scummvm will take care of this
+void fSafeDigit(ArgArray args) {
     debugC(1, kPrivateDebugScript, "WARNING: SafeDigit is not implemented");
 }
 
-void AskSave(ArgArray args) {
+void fAskSave(ArgArray args) {
     // This is not needed, since scummvm will take care of this
     debugC(1, kPrivateDebugScript, "WARNING: AskSave is partially implemented");
     Common::String *s = new Common::String(args[0].u.str);
     g_private->_nextSetting = s;
 }
 
-void Timer(ArgArray args) {
+void fTimer(ArgArray args) {
     assert (args.size() == 2 || args.size() == 3);
 
     if (args.size() == 3)
@@ -703,7 +702,6 @@ void Timer(ArgArray args) {
     else
         debugC(1, kPrivateDebugScript, "Timer(%d, %s)", args[0].u.val, args[1].u.str);
 
-    //g_system->delayMillis(1000 * args[0].u.val);
     int32 delay = 1000000 * args[0].u.val;
     Common::String *s = new Common::String(args[1].u.str);
     if (delay > 0) {
@@ -721,66 +719,66 @@ static struct FuncTable {
     const char *name;
 } funcTable[] = {
 
-    { ChgMode,         "ChgMode"},
-    { Resume,          "Resume"},
-    { Goto,            "goto"},
-    { SetFlag,         "SetFlag"},
-    { SetModifiedFlag, "SetModifiedFlag"},
-    { Timer,           "Timer"},
+    { fChgMode,         "ChgMode"},
+    { fResume,          "Resume"},
+    { fgoto,            "goto"},
+    { fSetFlag,         "SetFlag"},
+    { fSetModifiedFlag, "SetModifiedFlag"},
+    { fTimer,           "Timer"},
 
     // Sounds
-    { Sound,           "Sound"},
-    { SoundEffect,     "SoundEffect"},
-    { LoopedSound,     "LoopedSound"},
-    { NoStopSounds,    "NoStopSounds"},
-    { SyncSound,       "SyncSound"},
-    { AMRadioClip,     "AMRadioClip"},
-    { PoliceClip,      "PoliceClip"},
-    { PhoneClip,       "PhoneClip"},
-    { SoundArea,       "SoundArea"},
-    { PaperShuffleSound, "PaperShuffleSound"},
+    { fSound,           "Sound"},
+    { fSoundEffect,     "SoundEffect"},
+    { fLoopedSound,     "LoopedSound"},
+    { fNoStopSounds,    "NoStopSounds"},
+    { fSyncSound,       "SyncSound"},
+    { fAMRadioClip,     "AMRadioClip"},
+    { fPoliceClip,      "PoliceClip"},
+    { fPhoneClip,       "PhoneClip"},
+    { fSoundArea,       "SoundArea"},
+    { fPaperShuffleSound, "PaperShuffleSound"},
 
     // Images
-    { Bitmap,          "Bitmap"},
-    { Mask,            "Mask"},
-    { MaskDrawn,       "MaskDrawn"},
-    { VSPicture,       "VSPicture"},
-    { ViewScreen,      "ViewScreen"},
+    { fBitmap,          "Bitmap"},
+    { fMask,            "Mask"},
+    { fMaskDrawn,       "MaskDrawn"},
+    { fVSPicture,       "VSPicture"},
+    { fViewScreen,      "ViewScreen"},
 
     // Video
-    { Transition,      "Transition"},
-    { Movie,           "Movie"},
+    { fTransition,      "Transition"},
+    { fMovie,           "Movie"},
 
     // Diary
-    { DiaryLocList,    "DiaryLocList"},
-    { DiaryInvList,    "DiaryInvList"},
-    { DiaryGoLoc,      "DiaryGoLoc"},
+    { fDiaryLocList,    "DiaryLocList"},
+    { fDiaryInvList,    "DiaryInvList"},
+    { fDiaryGoLoc,      "DiaryGoLoc"},
 
-    { Exit,            "Exit"},
-    { Quit,            "Quit"},
-    { LoadGame,        "LoadGame"},
-    { SaveGame,        "SaveGame"},
-    { AskSave,         "AskSave"},
+    { fExit,            "Exit"},
+    { fQuit,            "Quit"},
+    { fLoadGame,        "LoadGame"},
+    { fSaveGame,        "SaveGame"},
+    { fAskSave,         "AskSave"},
 
     // Dossiers
-    { DossierAdd,      "DossierAdd"},
-    { DossierChgSheet, "DossierChgSheet"},
-    { DossierBitmap,   "DossierBitmap"},
-    { DossierPrevSuspect, "DossierPrevSuspect"},
-    { DossierNextSuspect, "DossierNextSuspect"},
+    { fDossierAdd,      "DossierAdd"},
+    { fDossierChgSheet, "DossierChgSheet"},
+    { fDossierBitmap,   "DossierBitmap"},
+    { fDossierPrevSuspect, "DossierPrevSuspect"},
+    { fDossierNextSuspect, "DossierNextSuspect"},
 
-    { LoseInventory,   "LoseInventory"},
-    { Inventory,       "Inventory"},
-    { CRect,           "CRect"},
-    { RestartGame,     "RestartGame"},
+    { fLoseInventory,   "LoseInventory"},
+    { fInventory,       "Inventory"},
+    { fCRect,           "CRect"},
+    { fRestartGame,     "RestartGame"},
 
     // PoliceBust
-    { PoliceBust,      "PoliceBust"},
-    { BustMovie,       "BustMovie"},
+    { fPoliceBust,      "PoliceBust"},
+    { fBustMovie,       "BustMovie"},
 
     // Others
 
-    { SafeDigit,       "SafeDigit"},
+    { fSafeDigit,       "SafeDigit"},
 
     { 0, 0}
 };


Commit: 7ed834dd8f6abdc6cd1a550c328a28a6070ca9a4
    https://github.com/scummvm/scummvm/commit/7ed834dd8f6abdc6cd1a550c328a28a6070ca9a4
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: removed useless empty lines

Changed paths:
    engines/private/funcs.cpp


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 37efca4d29..acebb7ac7c 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -118,7 +118,6 @@ void fSyncSound(ArgArray args) {
     if (strcmp("\"\"", args[0].u.str) != 0) {
         Common::String *s = new Common::String(args[0].u.str);
         g_private->playSound(*s, 1, true, false);
-        //assert(0);
     }
 }
 
@@ -225,16 +224,11 @@ void fDossierAdd(ArgArray args) {
 }
 
 void fDossierBitmap(ArgArray args) {
-
     assert (args.size() == 2);
-
     int x = args[0].u.val;
     int y = args[1].u.val;
-
     assert(x == 40 && y == 30);
-
     g_private->loadDossier();
-
 }
 
 void fDossierChgSheet(ArgArray args) {
@@ -288,7 +282,6 @@ void fLoseInventory(ArgArray args) {
 }
 
 void fInventory(ArgArray args) {
-
     // assert types
     Datum b1 = args[0];
     Datum v1 = args[1];
@@ -296,7 +289,6 @@ void fInventory(ArgArray args) {
     Datum e = args[3];
     Datum i = args[4];
     Datum c = args[5];
-
     Datum snd = args[8];
 
     assert(v1.type == STRING || v1.type == NAME);
@@ -308,12 +300,10 @@ void fInventory(ArgArray args) {
     Common::String *bmp = new Common::String(i.u.str);
     assert(g_private->isDemo() || strcmp(bmp->c_str(), "\"\"") != 0);
 
-
     if (v1.type == STRING)
         assert(strcmp(v1.u.str, "\"\"") == 0);
 
     debugC(1, kPrivateDebugScript, "Inventory(...)");
-
     if (strcmp(b1.u.str, "\"\"") != 0) {
         Common::String *s = new Common::String(b1.u.str);
         MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
@@ -332,7 +322,6 @@ void fInventory(ArgArray args) {
         else
             m->flag1 = NULL;
 
-
         if (v2.type == NAME)
             m->flag2 = v2.u.sym;
         else
@@ -342,7 +331,6 @@ void fInventory(ArgArray args) {
         g_private->_toTake = true;
 
         Common::String *f;
-
         if (strcmp(snd.u.str, "\"\"") != 0) {
             f = new Common::String(snd.u.str);
         } else {
@@ -362,11 +350,9 @@ void fInventory(ArgArray args) {
         } else {
             g_private->inventory.push_back(*bmp);
         }
-
         if (v2.type == NAME)
             v2.u.sym->u.val = 1;
     }
-
 }
 
 void fSetFlag(ArgArray args) {
@@ -398,7 +384,6 @@ void fExit(ArgArray args) {
     }
 
     e->rect = args[2].u.rect;
-    //debug("Rect %d %d %d %d", args[2].u.rect->top, args[2].u.rect->left, args[2].u.rect->bottom, args[2].u.rect->right);
     g_private->_exits.push_front(*e);
 }
 
@@ -465,7 +450,6 @@ void fLoopedSound(ArgArray args) {
     }
 }
 
-
 void fViewScreen(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "WARNING: ViewScreen not implemented!");
@@ -506,24 +490,19 @@ void fMovie(ArgArray args) {
         debugC(1, kPrivateDebugScript, "movie %s already played", movie->c_str());
         g_private->_nextSetting = g_private->_repeatedMovieExit;
     }
-    //g_private->_nextSetting = new Common::String(args[1].u.str);
 }
 
 void fCRect(ArgArray args) {
     // assert types
-    int x1, y1, x2, y2;
-
     debugC(1, kPrivateDebugScript, "CRect(%d, %d, %d, %d)", args[0].u.val, args[1].u.val, args[2].u.val, args[3].u.val);
-
+    int x1, y1, x2, y2;
     x1 = args[0].u.val;
     y1 = args[1].u.val;
-
     x2 = args[2].u.val;
     y2 = args[3].u.val;
 
     Datum *d = new Datum();
     Common::Rect *rect = new Common::Rect(x1, y1, x2, y2);
-
     d->type = RECT;
     d->u.rect = rect;
     push(*d);
@@ -551,7 +530,6 @@ void _fMask(ArgArray args, bool drawn) {
 
     int x = 0;
     int y = 0;
-
     char *f = args[0].u.str;
     char *e = args[1].u.str;
     Common::String *c = args[2].u.sym->name;
@@ -563,8 +541,6 @@ void _fMask(ArgArray args, bool drawn) {
 
     debugC(1, kPrivateDebugScript, "Mask(%s, %s, %s, %d, %d)", f, e, c->c_str(), x, y);
     const Common::String *s = new Common::String(f);
-    //if (drawed)
-    //    g_private->loadImage(*s, x, y);
 
     MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
     m->surf = g_private->loadMask(*s, x, y, drawn);
@@ -616,10 +592,12 @@ void fAMRadioClip(ArgArray args) {
     assert(args.size() <= 4);
     fAddSound(args[0].u.str, "AMRadioClip");
 }
+
 void fPoliceClip(ArgArray args) {
     assert(args.size() <= 4);
     fAddSound(args[0].u.str, "PoliceClip");
 }
+
 void fPhoneClip(ArgArray args) {
     if (args.size() == 2) {
         debugC(1, kPrivateDebugScript, "Unimplemented PhoneClip special case");
@@ -635,13 +613,11 @@ void fPhoneClip(ArgArray args) {
         char *clip = g_private->getRandomPhoneClip(args[0].u.str, i, j);
         fAddSound(clip, "PhoneClip", args[4].u.sym, args[5].u.val);
     }
-
 }
 
 void fSoundArea(ArgArray args) {
     // assert types
     char *n;
-
     if (args[1].type == NAME)
         n = (char *)args[1].u.sym->name->c_str();
     else if (args[1].type == STRING)
@@ -711,7 +687,6 @@ void fTimer(ArgArray args) {
     } else {
         assert(0);
     }
-
 }
 
 static struct FuncTable {
@@ -719,13 +694,16 @@ static struct FuncTable {
     const char *name;
 } funcTable[] = {
 
+    // Control flow
     { fChgMode,         "ChgMode"},
     { fResume,          "Resume"},
     { fgoto,            "goto"},
-    { fSetFlag,         "SetFlag"},
-    { fSetModifiedFlag, "SetModifiedFlag"},
     { fTimer,           "Timer"},
 
+    // Variables
+    { fSetFlag,         "SetFlag"},
+    { fSetModifiedFlag, "SetModifiedFlag"},
+ 
     // Sounds
     { fSound,           "Sound"},
     { fSoundEffect,     "SoundEffect"},
@@ -744,6 +722,7 @@ static struct FuncTable {
     { fMaskDrawn,       "MaskDrawn"},
     { fVSPicture,       "VSPicture"},
     { fViewScreen,      "ViewScreen"},
+    { fExit,            "Exit"},
 
     // Video
     { fTransition,      "Transition"},
@@ -754,11 +733,12 @@ static struct FuncTable {
     { fDiaryInvList,    "DiaryInvList"},
     { fDiaryGoLoc,      "DiaryGoLoc"},
 
-    { fExit,            "Exit"},
+    // Main menu
     { fQuit,            "Quit"},
     { fLoadGame,        "LoadGame"},
     { fSaveGame,        "SaveGame"},
     { fAskSave,         "AskSave"},
+    { fRestartGame,     "RestartGame"},
 
     // Dossiers
     { fDossierAdd,      "DossierAdd"},
@@ -767,18 +747,17 @@ static struct FuncTable {
     { fDossierPrevSuspect, "DossierPrevSuspect"},
     { fDossierNextSuspect, "DossierNextSuspect"},
 
+    // Inventory
     { fLoseInventory,   "LoseInventory"},
     { fInventory,       "Inventory"},
-    { fCRect,           "CRect"},
-    { fRestartGame,     "RestartGame"},
 
     // PoliceBust
     { fPoliceBust,      "PoliceBust"},
     { fBustMovie,       "BustMovie"},
 
     // Others
-
     { fSafeDigit,       "SafeDigit"},
+    { fCRect,           "CRect"},
 
     { 0, 0}
 };
@@ -800,7 +779,6 @@ void call(char *name, ArgArray args) {
 
     void (*func)(ArgArray) = (void (*)(ArgArray)) _functions.getVal(n);
     func(args);
-
 }
 
 } // End of namespace Private


Commit: 2ef6c7a94cc43ad4b4d800616ffd62211bef6a92
    https://github.com/scummvm/scummvm/commit/2ef6c7a94cc43ad4b4d800616ffd62211bef6a92
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: removed useless empty lines

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 093d1742ee..6c423adf68 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -57,40 +57,41 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     : Engine(syst), _gameDescription(gd) {
     _rnd = new Common::RandomSource("private");
 
+    // Debug channels
     DebugMan.addDebugChannel(kPrivateDebugFunction, "functions", "Function execution debug channel");
     DebugMan.addDebugChannel(kPrivateDebugCode, "code", "Code execution debug channel");
     DebugMan.addDebugChannel(kPrivateDebugScript, "script", "Script execution debug channel");
 
+    // Global object for external reference
     g_private = this;
 
-    _saveGameMask = NULL;
-    _loadGameMask = NULL;
-
-    _dossierNextSuspectMask = NULL;
-    _dossierPrevSuspectMask = NULL;
-
+    // Setting execution
     _nextSetting = NULL;
     _currentSetting = NULL;
-    _nextMovie = NULL;
-    _nextVS = NULL;
+    _pausedSetting = NULL;
     _modified = false;
     _mode = -1;
     _toTake = false;
+
+    // Movies
+    _nextMovie = NULL;
+    _nextVS = NULL;
     _repeatedMovieExit = new Common::String("");
-    _pausedSetting = NULL;
 
+    // Save and load
+    _saveGameMask = NULL;
+    _loadGameMask = NULL;
 
     // Interface
     _frame = new Common::String("inface/general/inface2.bmp");
 
-    // Policebust
+    // Police
     _policeBustEnabled = false;
     _policeBustSetting = NULL;
     _numberClicks = 0;
     policeVideoIndex = 0;
     _sirenSound = new Common::String("po/audio/posfx002.wav");
 
-
     // General sounds
     _globalAudioPath = new Common::String("global/audio/");
     _noStopSounds = false;
@@ -99,7 +100,6 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     _policeRadioArea = NULL;
     _AMRadioArea = NULL;
     _phoneArea = NULL;
-
     // TODO: use this as a default sound for radio
     _infaceRadioPath = new Common::String("inface/radio/");
     _phonePrefix = new Common::String("inface/telephon/");
@@ -108,17 +108,18 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     // Dossiers
     _dossierPage = 0;
     _dossierSuspect = 0;
+    _dossierNextSuspectMask = NULL;
+    _dossierPrevSuspectMask = NULL;
 
     // Diary
     _diaryLocPrefix = new Common::String("inface/diary/loclist/");
-
 }
 
 PrivateEngine::~PrivateEngine() {
     // Dispose your resources here
     delete _rnd;
 
-    // Remove all of our debug levels here
+    // Remove all of our debug levels
     DebugMan.clearAllDebugChannels();
 }
 
@@ -130,7 +131,6 @@ Common::Error PrivateEngine::run() {
 
     assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
     Common::SeekableReadStream *file = NULL;
-
     // if the full game is used
     if (!isDemo()) {
         assert(_installerArchive.hasFile("GAME.DAT"));
@@ -147,6 +147,7 @@ Common::Error PrivateEngine::run() {
         }
     }
 
+    // Read assets file
     assert(file != NULL);
     char *buf = (char *)malloc(file->size()+1);
     file->read(buf, file->size()+1);
@@ -155,13 +156,12 @@ Common::Error PrivateEngine::run() {
     initInsts();
     initFuncs();
     initCursors();
-
     parse(buf);
     free(buf);
     delete file;
     assert(constants.size() > 0);
 
-    // Initialize graphics using following:
+    // Initialize graphics
     _screenW = 640;
     _screenH = 480;
     //_pixelFormat = Graphics::PixelFormat::createFormatCLUT8();
@@ -170,7 +170,6 @@ Common::Error PrivateEngine::run() {
     initGraphics(_screenW, _screenH, &_pixelFormat);
     screenRect = new Common::Rect(0, 0, _screenW, _screenH);
     changeCursor("default");
-
     _origin = new Common::Point(0, 0);
     _image = new Image::BitmapDecoder();
     _compositeSurface = new Graphics::ManagedSurface();
@@ -184,7 +183,7 @@ Common::Error PrivateEngine::run() {
     // Main event loop
     Common::Event event;
     Common::Point mousePos;
-    _videoDecoder = nullptr; //new Video::SmackerDecoder();
+    _videoDecoder = nullptr;
 
     int saveSlot = ConfMan.getInt("save_slot");
     if (saveSlot >= 0) { // load the savegame
@@ -239,7 +238,6 @@ Common::Error PrivateEngine::run() {
 
             default:
             {}
-
             }
         }
 
@@ -252,7 +250,6 @@ Common::Error PrivateEngine::run() {
             playVideo(*_nextMovie);
             _nextMovie = NULL;
             continue;
-
         }
 
         if (_nextVS != NULL && _currentSetting->c_str() == kMainDesktop) {
@@ -260,7 +257,6 @@ Common::Error PrivateEngine::run() {
         }
 
         if (_videoDecoder) {
-
             if (_videoDecoder->getCurFrame() == 0)
                 stopSound(true);
             if (_videoDecoder->endOfVideo()) {
@@ -274,7 +270,6 @@ Common::Error PrivateEngine::run() {
         }
 
         if (_nextSetting != NULL) {
-
             removeTimer();
             debugC(1, kPrivateDebugFunction, "Executing %s", _nextSetting->c_str());
             clearAreas();
@@ -288,7 +283,6 @@ Common::Error PrivateEngine::run() {
         g_system->updateScreen();
         g_system->delayMillis(10);
     }
-
     return Common::kNoError;
 }
 
@@ -302,12 +296,10 @@ void PrivateEngine::clearAreas() {
     _phoneArea = NULL;
     _dossierNextSuspectMask = NULL;
     _dossierPrevSuspectMask = NULL;
-
 }
 
 void PrivateEngine::startPoliceBust() {
     int policeIndex = variables.getVal(kPoliceIndex)->u.val;
-
     int r = _rnd->getRandomNumber(0xc);
     if (0x14 < policeIndex) {
         policeIndex = 0x15;
@@ -336,7 +328,6 @@ void PrivateEngine::checkPoliceBust() {
     if (_numberClicks == _maxNumberClicks+1) {
         uint policeIndex = variables.getVal(kPoliceIndex)->u.val;
         _policeBustSetting = _currentSetting;
-
         if (policeIndex <= 13) {
             _nextSetting = &kPOGoBustMovie;
         } else {
@@ -366,7 +357,6 @@ bool PrivateEngine::cursorExit(Common::Point mousePos) {
                 rs = cs;
                 cursor = e.cursor;
             }
-
         }
     }
 
@@ -405,7 +395,6 @@ bool PrivateEngine::cursorMask(Common::Point mousePos) {
                 changeCursor(*m.cursor);
                 break;
             }
-
         }
     }
     return inside;
@@ -460,7 +449,6 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
                 rs = cs;
                 ns = e.nextSetting;
             }
-
         }
     }
     if (ns != NULL) {
@@ -474,7 +462,6 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
     MaskInfo m;
     for (MaskList::iterator it = _masks.begin(); it != _masks.end(); ++it) {
         m = *it;
-
         //debug("Testing mask %s", m.nextSetting->c_str());
         if (inMask(m.surf, mousePos)) {
             //debug("Inside!");
@@ -495,9 +482,7 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
             if (m.flag2 != NULL) {
                 setSymbol(m.flag2, 1);
             }
-
             break;
-
         }
     }
     if (ns != NULL) {
@@ -518,7 +503,6 @@ void PrivateEngine::selectAMRadioArea(Common::Point mousePos) {
         playSound(sound.c_str(), 1, false, false);
         _AMRadio.pop_back();
     }
-
 }
 
 void PrivateEngine::selectPoliceRadioArea(Common::Point mousePos) {
@@ -533,7 +517,6 @@ void PrivateEngine::selectPoliceRadioArea(Common::Point mousePos) {
         playSound(sound.c_str(), 1, false, false);
         _policeRadio.pop_back();
     }
-
 }
 
 void PrivateEngine::checkPhoneCall() {
@@ -545,7 +528,6 @@ void PrivateEngine::checkPhoneCall() {
 
     if (!_mixer->isSoundHandleActive(_fgSoundHandle))
         playSound(*_phonePrefix + *_phoneCallSound, 1, false, false);
-
 }
 
 void PrivateEngine::selectPhoneArea(Common::Point mousePos) {
@@ -563,7 +545,6 @@ void PrivateEngine::selectPhoneArea(Common::Point mousePos) {
         playSound(sound.c_str(), 1, true, false);
         _phone.pop_back();
     }
-
 }
 
 void PrivateEngine::loadDossier() {
@@ -582,7 +563,6 @@ void PrivateEngine::loadDossier() {
         assert(0);
 }
 
-
 bool PrivateEngine::selectDossierNextSuspect(Common::Point mousePos) {
     if (_dossierNextSuspectMask == NULL)
         return false;
@@ -615,7 +595,6 @@ bool PrivateEngine::selectDossierPrevSuspect(Common::Point mousePos) {
         return true;
     }
     return false;
-
 }
 
 void PrivateEngine::selectLoadGame(Common::Point mousePos) {
@@ -638,8 +617,7 @@ void PrivateEngine::selectSaveGame(Common::Point mousePos) {
 }
 
 bool PrivateEngine::hasFeature(EngineFeature f) const {
-    return
-        (f == kSupportsReturnToLauncher);
+    return (f == kSupportsReturnToLauncher);
 }
 
 void PrivateEngine::restartGame() {
@@ -652,24 +630,20 @@ void PrivateEngine::restartGame() {
     }
 
     // Diary
-
     for (NameList::iterator it = locationList.begin(); it != locationList.end(); ++it) {
         Private::Symbol *sym = locations.getVal(*it);
         sym->u.val = 0;
     }
-
     inventory.clear();
     _dossiers.clear();
 
     // Sounds
-
     _AMRadio.clear();
     _policeRadio.clear();
     _phone.clear();
     _playedPhoneClips.clear();
 
     // Movies
-
     _repeatedMovieExit = NULL;
     _playedMovies.clear();
 
@@ -688,13 +662,11 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
     }
 
     // Diary
-
     for (NameList::iterator it = locationList.begin(); it != locationList.end(); ++it) {
         s.syncAsUint32LE(val);
         Private::Symbol *sym = locations.getVal(*it);
         sym->u.val = val;
     }
-
     uint32 size = 0;
     size = stream->readUint32LE();
     Common::String *file = NULL;
@@ -721,7 +693,6 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
     }
 
     // Radios
-
     Common::String *sound;
     size = stream->readUint32LE();
     _AMRadio.clear();
@@ -751,12 +722,11 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
         _phone.push_back(*i);
     }
 
+    // Played media
     *_repeatedMovieExit = stream->readString();
-
     _playedMovies.clear();
     size = stream->readUint32LE();
     Common::String *movie;
-
     for (uint32 i = 0; i < size; ++i) {
         movie = new Common::String(stream->readString());
         _playedMovies.setVal(*movie, true);
@@ -765,7 +735,6 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
     _playedPhoneClips.clear();
     size = stream->readUint32LE();
     Common::String *phone;
-
     for (uint32 i = 0; i < size; ++i) {
         phone = new Common::String(stream->readString());
         _playedPhoneClips.setVal(*phone, true);
@@ -786,7 +755,6 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
     }
 
     // Diary
-
     for (NameList::iterator it = locationList.begin(); it != locationList.end(); ++it) {
         Private::Symbol *sym = locations.getVal(*it);
         stream->writeUint32LE(sym->u.val);
@@ -799,7 +767,6 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
     }
 
     // Dossiers
-
     stream->writeUint32LE(_dossiers.size());
     for (DossierArray::iterator it = _dossiers.begin(); it != _dossiers.end(); ++it) {
         stream->writeString(it->page1->c_str());
@@ -816,7 +783,6 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
         stream->writeString(*it);
         stream->writeByte(0);
     }
-
     stream->writeUint32LE(_policeRadio.size());
     for (SoundList::iterator it = _policeRadio.begin(); it != _policeRadio.end(); ++it) {
         stream->writeString(*it);
@@ -825,7 +791,6 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
 
     stream->writeUint32LE(_phone.size());
     for (PhoneList::iterator it = _phone.begin(); it != _phone.end(); ++it) {
-        //PhoneInfo *i = *it;
         stream->writeString(*it->sound);
         stream->writeByte(0);
         stream->writeString(*it->flag->name);
@@ -909,7 +874,6 @@ void PrivateEngine::playVideo(const Common::String &name) {
     if (!_videoDecoder->loadStream(file))
         error("unable to load video %s", path.c_str());
     _videoDecoder->start();
-
 }
 
 void PrivateEngine::skipVideo() {
@@ -1026,7 +990,6 @@ bool PrivateEngine::getRandomBool(uint p) {
 }
 
 Common::String *PrivateEngine::getPaperShuffleSound() {
-
     uint r = _rnd->getRandomNumber(6);
     char f[32];
     snprintf(f, 32, "glsfx0%d.wav", kPaperShuffleSound[r]);
@@ -1074,7 +1037,6 @@ char *PrivateEngine::getRandomPhoneClip(char *clip, int i, int j) {
 }
 
 // Timers
-
 void timerCallback(void *refCon) {
     g_private->removeTimer();
     g_private->_nextSetting = (Common::String *)refCon;
@@ -1105,9 +1067,7 @@ void PrivateEngine::loadLocations(Common::Rect *rect) {
             //debug("%hd %hd", rect->left, rect->top + offset);
             loadMask(s, rect->left + 120, rect->top + offset, true);
         }
-
     }
-
 }
 
 void PrivateEngine::loadInventory(uint32 x, Common::Rect *r1, Common::Rect *r2) {
@@ -1117,7 +1077,6 @@ void PrivateEngine::loadInventory(uint32 x, Common::Rect *r1, Common::Rect *r2)
         //debug("%hd %hd", rect->left, rect->top + offset);
         loadMask(*it, r1->left, r1->top + offset, true);
     }
-
 }
 
 } // End of namespace Private


Commit: 5ba173383a75268b7d8a22c7138d69f820ededc2
    https://github.com/scummvm/scummvm/commit/5ba173383a75268b7d8a22c7138d69f820ededc2
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: arithmetic code refactor

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 6c423adf68..7e0940b02a 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -299,16 +299,17 @@ void PrivateEngine::clearAreas() {
 }
 
 void PrivateEngine::startPoliceBust() {
+    // This logic was extracted from the binary
     int policeIndex = variables.getVal(kPoliceIndex)->u.val;
     int r = _rnd->getRandomNumber(0xc);
-    if (0x14 < policeIndex) {
+    if (policeIndex > 0x14) {
         policeIndex = 0x15;
     }
     _maxNumberClicks = r + 0x10 + (policeIndex * 0xe) / -0x15;
-    _sirenWarning = 3 + _rnd->getRandomNumber(0x7);
+    _sirenWarning = _rnd->getRandomNumber(0x7) + 3;
     _numberClicks = 0;
-    if(_sirenWarning >= _maxNumberClicks);
-    _sirenWarning = _maxNumberClicks - 1;
+    if(_sirenWarning >= _maxNumberClicks)
+        _sirenWarning = _maxNumberClicks - 1;
 }
 
 void PrivateEngine::checkPoliceBust() {
@@ -1000,8 +1001,7 @@ Common::String *PrivateEngine::getTakeSound() {
     if (isDemo())
         return (new Common::String(*_globalAudioPath + "mvo007.wav"));
 
-    uint r = 1 + _rnd->getRandomNumber(4);
-
+    uint r = _rnd->getRandomNumber(4) + 1;
     char f[32];
     snprintf(f, 32, "took%d.wav", r);
     return (new Common::String(*_globalAudioPath + f));
@@ -1020,14 +1020,13 @@ Common::String *PrivateEngine::getLeaveSound() {
     if (isDemo())
         return (new Common::String(*_globalAudioPath + "mvo008.wav"));
 
-    uint r = 1 + _rnd->getRandomNumber(4);
+    uint r = _rnd->getRandomNumber(4) + 1;
 
     char f[32];
     snprintf(f, 32, "left%d.wav", r);
     return (new Common::String(*_globalAudioPath + f));
 }
 
-
 char *PrivateEngine::getRandomPhoneClip(char *clip, int i, int j) {
     uint r = i + _rnd->getRandomNumber(j - i);
 


Commit: 96a1f8efe50f45a8639111b4d3d8f5c9e60d9161
    https://github.com/scummvm/scummvm/commit/96a1f8efe50f45a8639111b4d3d8f5c9e60d9161
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: removed unused variables and refactor

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 7e0940b02a..b0fd555295 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -910,13 +910,13 @@ void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
     drawScreen();
 }
 
-void PrivateEngine::drawScreenFrame(Graphics::Surface *screen) {
+void PrivateEngine::drawScreenFrame(Graphics::Surface *surf) {
     Common::String path = convertPath(*_frame);
     Common::File file;
     assert(file.open(path));
     _image->loadStream(file);
     Graphics::Surface *csurf = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
-    screen->copyRectToSurface(*csurf, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
+    surf->copyRectToSurface(*csurf, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
     csurf->free();
     delete csurf;
     _image->destroy();
@@ -953,10 +953,7 @@ void PrivateEngine::drawMask(Graphics::ManagedSurface *surf) {
 }
 
 void PrivateEngine::drawScreen() {
-    Graphics::Surface *screen = g_system->lockScreen();
     Graphics::ManagedSurface *surface = _compositeSurface;
-    int w = surface->w;
-    int h = surface->h;
 
     if (_videoDecoder) {
         const Graphics::Surface *frame = _videoDecoder->decodeNextFrame();
@@ -971,8 +968,7 @@ void PrivateEngine::drawScreen() {
         delete cframe;
     }
 
-    assert(w == _screenW && h == _screenH);
-
+    Graphics::Surface *screen = g_system->lockScreen();
     if (_mode == 1) {
         drawScreenFrame(screen);
     }


Commit: b7e55e5c6fe6fd90fbea86ad1aa4b0ab4c51396e
    https://github.com/scummvm/scummvm/commit/b7e55e5c6fe6fd90fbea86ad1aa4b0ab4c51396e
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: optimize screen drawing

Changed paths:
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index b0fd555295..bf2a7e1a92 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -83,7 +83,7 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     _loadGameMask = NULL;
 
     // Interface
-    _frame = new Common::String("inface/general/inface2.bmp");
+    _framePath = new Common::String("inface/general/inface2.bmp");
 
     // Police
     _policeBustEnabled = false;
@@ -176,6 +176,12 @@ Common::Error PrivateEngine::run() {
     _compositeSurface->create(_screenW, _screenH, _pixelFormat);
     _compositeSurface->setTransparentColor(_transparentColor);
 
+    // Load the game frame once
+    Common::File frameFile;
+    assert(frameFile.open(convertPath(*_framePath)));
+    _image->loadStream(frameFile);
+    _frame = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
+
     // Debugger console
     Console *console = new Console(this);
     setDebugger(console);
@@ -278,6 +284,7 @@ Common::Error PrivateEngine::run() {
             _nextSetting = NULL;
             execute(prog);
             changeCursor("default");
+            drawScreen();
         }
 
         g_system->updateScreen();
@@ -907,19 +914,11 @@ void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
     surf->free();
     delete surf;
     _image->destroy();
-    drawScreen();
+    //drawScreen();
 }
 
 void PrivateEngine::drawScreenFrame(Graphics::Surface *surf) {
-    Common::String path = convertPath(*_frame);
-    Common::File file;
-    assert(file.open(path));
-    _image->loadStream(file);
-    Graphics::Surface *csurf = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
-    surf->copyRectToSurface(*csurf, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
-    csurf->free();
-    delete csurf;
-    _image->destroy();
+    surf->copyRectToSurface(*_frame, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
 }
 
 
@@ -949,7 +948,7 @@ Graphics::ManagedSurface *PrivateEngine::loadMask(const Common::String &name, in
 
 void PrivateEngine::drawMask(Graphics::ManagedSurface *surf) {
     _compositeSurface->transBlitFrom(surf->rawSurface(), *_origin, _transparentColor);
-    drawScreen();
+    //drawScreen();
 }
 
 void PrivateEngine::drawScreen() {
diff --git a/engines/private/private.h b/engines/private/private.h
index daa7c9b7c0..f872c6ae2a 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -132,8 +132,6 @@ private:
 
     Graphics::PixelFormat _pixelFormat;
     Image::ImageDecoder *_image;
-    Graphics::ManagedSurface *_compositeSurface;
-
     int _screenW, _screenH;
 
 public:
@@ -141,7 +139,6 @@ public:
     ~PrivateEngine();
 
     const ADGameDescription *_gameDescription;
-
     bool isDemo() const;
 
     Audio::SoundHandle _fgSoundHandle;
@@ -155,7 +152,6 @@ public:
     void initializePath(const Common::FSNode &gamePath) override;
 
     // User input
-
     void selectPauseMovie(Common::Point);
     void selectMask(Common::Point);
     void selectExit(Common::Point);
@@ -163,7 +159,6 @@ public:
     void selectSaveGame(Common::Point);
 
     // Cursors
-
     bool cursorPauseMovie(Common::Point);
     bool cursorExit(Common::Point);
     bool cursorMask(Common::Point);
@@ -193,23 +188,25 @@ public:
     void changeCursor(Common::String);
     void initCursors();
 
+    // Rendering
+    Graphics::ManagedSurface *_compositeSurface;
     Graphics::ManagedSurface *loadMask(const Common::String &, int, int, bool);
     void drawMask(Graphics::ManagedSurface *);
     bool inMask(Graphics::ManagedSurface *, Common::Point);
     uint32 _transparentColor;
     Common::Rect *screenRect;
+    Common::String *_framePath;
+    Graphics::Surface *_frame;
+    Common::String *_nextVS;
     void drawScreen();
 
     // global state
     const Common::Point *_origin;
     Common::String *_nextSetting;
     Common::String *_currentSetting;
-    Common::String *_nextVS;
-    Common::String *_frame;
     bool            _toTake;
 
     // Dossiers
-
     DossierArray _dossiers;
     unsigned int _dossierSuspect;
     unsigned int _dossierPage;
@@ -220,7 +217,6 @@ public:
     void loadDossier();
 
     // Police Bust
-
     int policeVideoIndex;
     void policeBust();
     bool _policeBustEnabled;
@@ -232,7 +228,6 @@ public:
     Common::String *_policeBustSetting;
 
     // Diary
-
     InvList inventory;
     Common::String *_diaryLocPrefix;
     void loadLocations(Common::Rect *);
@@ -251,12 +246,10 @@ public:
     Common::String *_pausedSetting;
 
     // Masks/Exits
-
     ExitList _exits;
     MaskList _masks;
 
     // Sounds
-
     void playSound(const Common::String &, uint, bool, bool);
     void stopSound(bool);
     bool _noStopSounds;
@@ -270,37 +263,26 @@ public:
     Common::String *_sirenSound;
 
     // Radios
-
-    //Common::String *_radioSound;
     Common::String *_infaceRadioPath;
-
     MaskInfo *_AMRadioArea;
-    //Common::String *_AMRadioPrefix;
-
     MaskInfo *_policeRadioArea;
-    //Common::String *_policeRadioPrefix;
-
     MaskInfo *_phoneArea;
     Common::String *_phonePrefix;
     Common::String *_phoneCallSound;
-
     SoundList _AMRadio;
     SoundList _policeRadio;
     PhoneList _phone;
 
     char *getRandomPhoneClip(char *, int, int);
-
     void selectAMRadioArea(Common::Point);
     void selectPoliceRadioArea(Common::Point);
     void selectPhoneArea(Common::Point);
     void checkPhoneCall();
 
     // Random values
-
     bool getRandomBool(uint);
 
     // Timers
-
     bool installTimer(uint32, Common::String *);
     void removeTimer();
 


Commit: 54d2f034f19b2de54d60178d4559903ab2eb745a
    https://github.com/scummvm/scummvm/commit/54d2f034f19b2de54d60178d4559903ab2eb745a
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: refactor to avoid global constructors

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index acebb7ac7c..4f194d9648 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -46,9 +46,9 @@ void fChgMode(ArgArray args) {
     g_private->_nextSetting = s;
 
     if (g_private->_mode == 0) {
-        g_private->_origin = &kPrivateOriginZero;
+        g_private->setOrigin(kOriginZero);
     } else if (g_private->_mode == 1) {
-        g_private->_origin = &kPrivateOriginOne;
+        g_private->setOrigin(kOriginOne);
     } else
         assert(0);
 
@@ -174,7 +174,7 @@ void fPoliceBust(ArgArray args) {
         } else if (args[1].u.val == 3) {
             g_private->_nextSetting = &kMainDesktop;
             g_private->_mode = 0;
-            g_private->_origin = &kPrivateOriginZero;
+            g_private->setOrigin(kOriginZero);
         } else
             assert(0);
     }
@@ -468,7 +468,7 @@ void fResume(ArgArray args) {
     g_private->_nextSetting = g_private->_pausedSetting;
     g_private->_pausedSetting = NULL;
     g_private->_mode = 1;
-    g_private->_origin = &kPrivateOriginOne;
+    g_private->setOrigin(kOriginOne);
 }
 
 void fMovie(ArgArray args) {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index bf2a7e1a92..1e79b60b6d 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -127,6 +127,11 @@ void PrivateEngine::initializePath(const Common::FSNode &gamePath) {
     SearchMan.addDirectory(gamePath.getPath(), gamePath, 0, 10);
 }
 
+void PrivateEngine::setOrigin(const int point[2]) {
+    delete _origin;
+    _origin = new Common::Point(point[0], point[1]);;
+}
+
 Common::Error PrivateEngine::run() {
 
     assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
diff --git a/engines/private/private.h b/engines/private/private.h
index f872c6ae2a..43854a1d37 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -69,8 +69,8 @@ const int kPoliceBustVideos[6] = {1, 2, 4, 5, 7, 8};
 
 // points
 
-const Common::Point kPrivateOriginZero(0, 0);
-const Common::Point kPrivateOriginOne(64, 48);
+const int kOriginZero[2] = {0,   0};
+const int kOriginOne[2]  = {64, 48};
 
 // settings
 
@@ -202,6 +202,7 @@ public:
 
     // global state
     const Common::Point *_origin;
+    void setOrigin(const int [2]);
     Common::String *_nextSetting;
     Common::String *_currentSetting;
     bool            _toTake;


Commit: 087b2f7fd6f61c1da5df17b5254ba414a3fad8da
    https://github.com/scummvm/scummvm/commit/087b2f7fd6f61c1da5df17b5254ba414a3fad8da
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: code convention fixes

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/symbol.cpp


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 4f194d9648..a00034ad96 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -582,9 +582,7 @@ void fAddSound(char *s, char *t, Symbol *flag = NULL, int val = 0) {
         p->flag = flag;
         p->val = val;
         g_private->_phone.push_back(*p);
-    }
-
-    else
+    } else
         error("error: invalid sound type %s", t);
 }
 
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 1e79b60b6d..a3d6bcbb1e 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -248,7 +248,7 @@ Common::Error PrivateEngine::run() {
                 break;
 
             default:
-            {}
+            break;
             }
         }
 
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index 507e25748d..abbef29dfc 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -104,34 +104,23 @@ void installAll(char *n) {
         if (strcmp(n, "settings") == 0) {
             assert(r == NULL);
             install(s, STRING, 0, (char *)s->c_str(), r, &settings);
-        }
-
-        else if (strcmp(n, "variables") == 0) {
+        } else if (strcmp(n, "variables") == 0) {
             assert(r == NULL);
             install(s, NAME, 0, NULL, r, &variables);
             variableList.push_front(*s);
-        }
-
-        else if (strcmp(n, "cursors") == 0) {
+        } else if (strcmp(n, "cursors") == 0) {
             assert(r == NULL);
             install(s, NAME, 0, NULL, r, &cursors);
-        }
-
-        else if (strcmp(n, "locations") == 0) {
+        } else if (strcmp(n, "locations") == 0) {
             assert(r == NULL);
             install(s, NAME, 0, NULL, r, &locations);
             locationList.push_front(*s);
-        }
-
-        else if (strcmp(n, "rects") == 0) {
+        } else if (strcmp(n, "rects") == 0) {
             assert(r != NULL);
             install(s, RECT, 0, NULL, r, &rects);
-        }
-        else
-            assert(0);
-
+        } else
+            error("invalid symbol type");
     }
-
 }
 
 Symbol *constant(int t, int d, char *s) {


Commit: a106e8c1cc7c7f3bf503a9baab529df6e54e5ed3
    https://github.com/scummvm/scummvm/commit/a106e8c1cc7c7f3bf503a9baab529df6e54e5ed3
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: missing line at the end

Changed paths:
    engines/private/symbol.h


diff --git a/engines/private/symbol.h b/engines/private/symbol.h
index f22d8bdf3c..031b1501d3 100644
--- a/engines/private/symbol.h
+++ b/engines/private/symbol.h
@@ -66,4 +66,4 @@ extern Symbol  *lookup(Common::String, SymbolMap);
 
 } // End of namespace Private
 
-#endif
\ No newline at end of file
+#endif


Commit: fe4ae429960ec4dc8c945bbb81e38b918ffd2f69
    https://github.com/scummvm/scummvm/commit/fe4ae429960ec4dc8c945bbb81e38b918ffd2f69
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: removed old file

Changed paths:
  R engines/private/lex.yy.cpp


diff --git a/engines/private/lex.yy.cpp b/engines/private/lex.yy.cpp
deleted file mode 100644
index 89d79d95ee..0000000000
--- a/engines/private/lex.yy.cpp
+++ /dev/null
@@ -1,1938 +0,0 @@
-#line 1 "engines/private/lex.yy.cpp"
-
-#line 3 "engines/private/lex.yy.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 6
-#define YY_FLEX_SUBMINOR_VERSION 4
-#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;
-#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;
-
-/* 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
-
-#ifndef SIZE_MAX
-#define SIZE_MAX               (~(size_t)0)
-#endif
-
-#endif /* ! C99 */
-
-#endif /* ! FLEXINT_H */
-
-/* begin standard C++ headers. */
-
-/* TODO: this is always defined, so inline it */
-#define yyconst const
-
-#if defined(__GNUC__) && __GNUC__ >= 3
-#define yynoreturn __attribute__((__noreturn__))
-#else
-#define yynoreturn
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an
- *   integer in range [0..255] for use as an array index.
- */
-#define YY_SC_TO_UI(c) ((YY_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
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
-#define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
-#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 int 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)
-    #define YY_LINENO_REWIND_TO(ptr)
-    
-/* 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.
-	 */
-	int yy_buf_size;
-
-	/* Number of characters read into yy_ch_buf, not including EOB
-	 * characters.
-	 */
-	int 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 = NULL; /**< 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 int yy_n_chars;		/* number of characters read into yy_ch_buf */
-int yyleng;
-
-/* Points to current character in buffer. */
-static char *yy_c_buf_p = NULL;
-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 ( const char *yy_str  );
-YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int 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() (/*CONSTCOND*/1)
-#define YY_SKIP_YYWRAP
-typedef flex_uint8_t YY_CHAR;
-
-FILE *yyin = NULL, *yyout = NULL;
-
-typedef int yy_state_type;
-
-extern int yylineno;
-int yylineno = 1;
-
-extern char *yytext;
-#ifdef yytext_ptr
-#undef yytext_ptr
-#endif
-#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 yynoreturn yy_fatal_error ( const 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 = (int) (yy_cp - yy_bp); \
-	(yy_hold_char) = *yy_cp; \
-	*yy_cp = '\0'; \
-	(yy_c_buf_p) = yy_cp;
-#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
-	{
-	flex_int32_t yy_verify;
-	flex_int32_t yy_nxt;
-	};
-static const flex_int16_t yy_accept[78] =
-    {   0,
-        0,    0,   24,   22,   21,   20,   20,   22,   22,   22,
-       22,   18,   22,   22,   22,   17,   17,   17,   17,   17,
-       17,   17,   17,   17,   17,   21,   20,    4,    0,   19,
-       18,    1,    2,    5,    3,   17,   17,   17,   17,   17,
-       17,   17,   17,   17,    9,   17,    1,   17,   17,   17,
-       17,   17,   17,   17,   17,   17,   17,   17,   15,   12,
-       17,   14,   17,   17,   10,   11,   17,   13,   17,    6,
-       17,   17,   16,    7,   17,    8,    0
-    } ;
-
-static const YY_CHAR yy_ec[256] =
-    {   0,
-        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,    2,    5,    6,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    7,    1,    8,    9,    9,    9,
-        9,    9,    9,    9,    9,    9,    9,    1,    1,   10,
-       11,   12,    1,    1,   13,   14,   15,   14,   16,   17,
-       14,   14,   14,   14,   14,   18,   14,   19,   14,   14,
-       14,   20,   21,   22,   23,   14,   14,   14,   14,   14,
-        1,    1,    1,    1,   14,    1,   24,   25,   14,   26,
-
-       27,   28,   29,   14,   30,   14,   14,   31,   32,   33,
-       34,   14,   14,   14,   35,   36,   37,   14,   14,   14,
-       14,   14,    1,   38,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    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 const YY_CHAR yy_meta[39] =
-    {   0,
-        1,    1,    2,    3,    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,    1
-    } ;
-
-static const flex_int16_t yy_base[81] =
-    {   0,
-        0,    0,  105,  106,  102,   36,   38,   92,   96,   92,
-       92,   90,   87,   86,   85,    0,   82,   71,   27,   73,
-       65,   60,   56,   61,   61,   83,   41,  106,   76,  106,
-       72,    0,  106,  106,  106,    0,   60,   59,   60,   40,
-       49,   21,   36,   34,    0,   33,    0,   47,   49,   44,
-       39,   48,   26,   32,   34,   26,   23,   42,    0,    0,
-       23,    0,   27,   22,    0,    0,   24,    0,   21,    0,
-       25,   17,    0,    0,   19,    0,  106,   79,   43,   83
-    } ;
-
-static const flex_int16_t yy_def[81] =
-    {   0,
-       77,    1,   77,   77,   77,   77,   77,   77,   78,   77,
-       77,   77,   77,   77,   77,   79,   79,   79,   79,   79,
-       79,   79,   79,   79,   79,   77,   77,   77,   78,   77,
-       77,   80,   77,   77,   77,   79,   79,   79,   79,   79,
-       79,   79,   79,   79,   79,   79,   80,   79,   79,   79,
-       79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
-       79,   79,   79,   79,   79,   79,   79,   79,   79,   79,
-       79,   79,   79,   79,   79,   79,    0,   77,   77,   77
-    } ;
-
-static const flex_int16_t yy_nxt[145] =
-    {   0,
-        4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
-       14,   15,   16,   16,   16,   16,   17,   16,   18,   19,
-       16,   20,   16,   16,   16,   21,   22,   16,   23,   24,
-       16,   16,   16,   16,   25,   16,   16,    7,   27,   27,
-       27,   27,   39,   27,   27,   53,   36,   76,   54,   75,
-       40,   74,   73,   72,   71,   70,   69,   68,   67,   66,
-       65,   64,   63,   62,   61,   60,   59,   58,   57,   56,
-       55,   52,   51,   27,   50,   27,   49,   48,   27,   29,
-       31,   30,   29,   47,   26,   47,   47,   46,   45,   44,
-       43,   42,   41,   38,   37,   35,   34,   33,   31,   32,
-
-       31,   30,   28,   26,   77,    3,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77
-    } ;
-
-static const flex_int16_t yy_chk[145] =
-    {   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,    6,    6,
-        7,    7,   19,   27,   27,   42,   79,   75,   42,   72,
-       19,   71,   69,   67,   64,   63,   61,   58,   57,   56,
-       55,   54,   53,   52,   51,   50,   49,   48,   46,   44,
-       43,   41,   40,    6,   39,    7,   38,   37,   27,   78,
-       31,   29,   78,   80,   26,   80,   80,   25,   24,   23,
-       22,   21,   20,   18,   17,   15,   14,   13,   12,   11,
-
-       10,    9,    8,    5,    3,   77,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77,   77,   77,   77,   77,   77,   77,
-       77,   77,   77,   77
-    } ;
-
-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/private/grammar.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.
- *
- */
-#define YY_NO_INPUT 1
-#line 30 "engines/private/grammar.l"
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-
-#include "private/grammar.h"
-#include "private/grammar.tab.h"
-
-#line 526 "engines/private/lex.yy.cpp"
-#line 527 "engines/private/lex.yy.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  );
-
-			int 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
-
-#ifndef YY_NO_UNPUT
-    
-    static void yyunput ( int c, char *buf_ptr  );
-    
-#endif
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy ( char *, const char *, int );
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen ( const 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
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
-#define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
-#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 do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
-#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 = '*'; \
-		int 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 = (int) fread(buf, 1, (yy_size_t) 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 /*LINTED*/break;
-#endif
-
-#define YY_RULE_SETUP \
-	YY_USER_ACTION
-
-/** The main scanner function which does all the work.
- */
-YY_DECL
-{
-	yy_state_type yy_current_state;
-	char *yy_cp, *yy_bp;
-	int yy_act;
-    
-	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(  );
-		}
-
-	{
-#line 37 "engines/private/grammar.l"
-
-#line 746 "engines/private/lex.yy.cpp"
-
-	while ( /*CONSTCOND*/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
-			{
-			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 >= 78 )
-					yy_c = yy_meta[yy_c];
-				}
-			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-			++yy_cp;
-			}
-		while ( yy_current_state != 77 );
-		yy_cp = (yy_last_accepting_cpos);
-		yy_current_state = (yy_last_accepting_state);
-
-yy_find_action:
-		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 38 "engines/private/grammar.l"
-/* ignoring the comment */
-	YY_BREAK
-case 2:
-YY_RULE_SETUP
-#line 39 "engines/private/grammar.l"
-return LTE;
-	YY_BREAK
-case 3:
-YY_RULE_SETUP
-#line 40 "engines/private/grammar.l"
-return GTE;
-	YY_BREAK
-case 4:
-YY_RULE_SETUP
-#line 41 "engines/private/grammar.l"
-return NEQ;
-	YY_BREAK
-case 5:
-YY_RULE_SETUP
-#line 42 "engines/private/grammar.l"
-return EQ;
-	YY_BREAK
-case 6:
-YY_RULE_SETUP
-#line 43 "engines/private/grammar.l"
-return DEBUGTOK;
-	YY_BREAK
-case 7:
-YY_RULE_SETUP
-#line 44 "engines/private/grammar.l"
-return DEFINETOK;
-	YY_BREAK
-case 8:
-YY_RULE_SETUP
-#line 45 "engines/private/grammar.l"
-return SETTINGTOK;
-	YY_BREAK
-case 9:
-YY_RULE_SETUP
-#line 46 "engines/private/grammar.l"
-return IFTOK;
-	YY_BREAK
-case 10:
-YY_RULE_SETUP
-#line 47 "engines/private/grammar.l"
-return ELSETOK;
-	YY_BREAK
-case 11:
-YY_RULE_SETUP
-#line 48 "engines/private/grammar.l"
-return GOTOTOK;
-	YY_BREAK
-case 12:
-YY_RULE_SETUP
-#line 49 "engines/private/grammar.l"
-return RECT;
-	YY_BREAK
-case 13:
-YY_RULE_SETUP
-#line 50 "engines/private/grammar.l"
-return FALSETOK;
-	YY_BREAK
-case 14:
-YY_RULE_SETUP
-#line 51 "engines/private/grammar.l"
-return TRUETOK;
-	YY_BREAK
-case 15:
-YY_RULE_SETUP
-#line 52 "engines/private/grammar.l"
-return NULLTOK;
-	YY_BREAK
-case 16:
-YY_RULE_SETUP
-#line 53 "engines/private/grammar.l"
-return RANDOMTOK;
-	YY_BREAK
-case 17:
-YY_RULE_SETUP
-#line 54 "engines/private/grammar.l"
-yylval.s = strdup(yytext); return NAME;
-	YY_BREAK
-case 18:
-YY_RULE_SETUP
-#line 55 "engines/private/grammar.l"
-yylval.sym = Private::constant(NUM, atoi(yytext), NULL); return NUM;
-	YY_BREAK
-case 19:
-YY_RULE_SETUP
-#line 56 "engines/private/grammar.l"
-yylval.sym = Private::constant(STRING, 0, scumm_strdup(yytext)); return STRING;
-	YY_BREAK
-case 20:
-/* rule 20 can match eol */
-YY_RULE_SETUP
-#line 57 "engines/private/grammar.l"
-/* ignore return */;
-	YY_BREAK
-case 21:
-YY_RULE_SETUP
-#line 58 "engines/private/grammar.l"
-/* ignore whitespace */;
-	YY_BREAK
-case 22:
-YY_RULE_SETUP
-#line 59 "engines/private/grammar.l"
-return *yytext;
-	YY_BREAK
-case 23:
-YY_RULE_SETUP
-#line 60 "engines/private/grammar.l"
-ECHO;
-	YY_BREAK
-#line 915 "engines/private/lex.yy.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_last_accepting_cpos);
-				yy_current_state = (yy_last_accepting_state);
-				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 user's declarations */
-} /* 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)
-{
-    	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
-	char *source = (yytext_ptr);
-	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
-		{
-			int 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_LVALUE;
-
-			int yy_c_buf_p_offset =
-				(int) ((yy_c_buf_p) - b->yy_ch_buf);
-
-			if ( b->yy_is_our_buffer )
-				{
-				int 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,
-							 (yy_size_t) (b->yy_buf_size + 2)  );
-				}
-			else
-				/* Can't grow it, we don't own it. */
-				b->yy_ch_buf = NULL;
-
-			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_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
-		/* Extend the array by 50%, plus the number we really need. */
-		int 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, (yy_size_t) new_size  );
-		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
-		/* "- 2" to take care of EOB's */
-		YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
-	}
-
-	(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)
-{
-	yy_state_type yy_current_state;
-	char *yy_cp;
-    
-	yy_current_state = (yy_start);
-
-	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
-		{
-		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 >= 78 )
-				yy_c = yy_meta[yy_c];
-			}
-		yy_current_state = yy_nxt[yy_base[yy_current_state] + 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 )
-{
-	int yy_is_jam;
-    	char *yy_cp = (yy_c_buf_p);
-
-	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 >= 78 )
-			yy_c = yy_meta[yy_c];
-		}
-	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-	yy_is_jam = (yy_current_state == 77);
-
-		return yy_is_jam ? 0 : yy_current_state;
-}
-
-#ifndef YY_NO_UNPUT
-
-    static void yyunput (int c, char * yy_bp )
-{
-	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. */
-		int number_to_move = (yy_n_chars) + 2;
-		char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
-					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
-		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) = (int) 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;
-}
-
-#endif
-
-#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 */
-			int offset = (int) ((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( (yy_size_t) (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  );
-}
-
-/* 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 = 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; /* After all that talk, this was set to 1 anyways... */
-		(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. */
-		yy_size_t 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 NULL;
-
-	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 = (int) (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 = NULL;
-	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 (const char * yystr )
-{
-    
-	return yy_scan_bytes( yystr, (int) 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 yybytes the byte buffer to scan
- * @param _yybytes_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  (const char * yybytes, int  _yybytes_len )
-{
-	YY_BUFFER_STATE b;
-	char *buf;
-	yy_size_t n;
-	int i;
-    
-	/* Get memory for full buffer, including space for trailing EOB's. */
-	n = (yy_size_t) (_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 yynoreturn yy_fatal_error (const char* msg )
-{
-			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.
- * 
- */
-int yyget_leng  (void)
-{
-        return yyleng;
-}
-
-/** Get the current token.
- * 
- */
-
-char *yyget_text  (void)
-{
-        return yytext;
-}
-
-/** Set the current line number.
- * @param _line_number 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) = NULL;
-    (yy_buffer_stack_top) = 0;
-    (yy_buffer_stack_max) = 0;
-    (yy_c_buf_p) = NULL;
-    (yy_init) = 0;
-    (yy_start) = 0;
-
-/* Defined in main.c */
-#ifdef YY_STDINIT
-    yyin = stdin;
-    yyout = stdout;
-#else
-    yyin = NULL;
-    yyout = NULL;
-#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, const char * s2, int n )
-{
-		
-	int i;
-	for ( i = 0; i < n; ++i )
-		s1[i] = s2[i];
-}
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (const char * s )
-{
-	int n;
-	for ( n = 0; s[n]; ++n )
-		;
-
-	return n;
-}
-#endif
-
-void *yyalloc (yy_size_t  size )
-{
-			return 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 realloc(ptr, size);
-}
-
-void yyfree (void * ptr )
-{
-			free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
-}
-
-#define YYTABLES_NAME "yytables"
-
-#line 60 "engines/private/grammar.l"
-
-
-namespace Private {
-
-int parse(char *code) {
-    initSetting();
-    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;
-}
-
-} // End of namespace Private
-


Commit: 27b498b890eb64a8657fcec6fe0cd7b7a1bcb0b2
    https://github.com/scummvm/scummvm/commit/27b498b890eb64a8657fcec6fe0cd7b7a1bcb0b2
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: code convention fixes

Changed paths:
    engines/private/grammar.cpp
    engines/private/grammar.y
    engines/private/private.h


diff --git a/engines/private/grammar.cpp b/engines/private/grammar.cpp
index b0e048f0f7..95a7640cb5 100644
--- a/engines/private/grammar.cpp
+++ b/engines/private/grammar.cpp
@@ -78,7 +78,7 @@
 #line 29 "engines/private/grammar.y"
 
 
-#include "grammar.h"
+#include "private/grammar.h"
 
 #define code1(c1)       Private::code(c1);
 #define code2(c1,c2)    Private::code(c1); Private::code(c2)
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index c9ec8b44c8..08023c8a1b 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -28,7 +28,7 @@
 
 %{
 
-#include "grammar.h"
+#include "private/grammar.h"
 
 #define code1(c1)       Private::code(c1);
 #define code2(c1,c2)    Private::code(c1); Private::code(c2)
diff --git a/engines/private/private.h b/engines/private/private.h
index 43854a1d37..a91ac52e43 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -202,7 +202,7 @@ public:
 
     // global state
     const Common::Point *_origin;
-    void setOrigin(const int [2]);
+    void setOrigin(const int[2]);
     Common::String *_nextSetting;
     Common::String *_currentSetting;
     bool            _toTake;


Commit: c57939f3fdfae298936352ccf706150275599e17
    https://github.com/scummvm/scummvm/commit/c57939f3fdfae298936352ccf706150275599e17
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixed load game code to avoid leaking memory

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index a3d6bcbb1e..d1a15a8719 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -680,16 +680,14 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
         Private::Symbol *sym = locations.getVal(*it);
         sym->u.val = val;
     }
-    uint32 size = 0;
-    size = stream->readUint32LE();
-    Common::String *file = NULL;
+    uint32 size = stream->readUint32LE();
     for (uint32 i = 0; i < size; ++i) {
-        file = new Common::String(stream->readString());
-        inventory.push_back(*file);
+        inventory.push_back(stream->readString());
     }
 
     // Dossiers
     size = stream->readUint32LE();
+    Common::String *file = NULL;
     for (uint32 i = 0; i < size; ++i) {
         file = new Common::String(stream->readString());
 
@@ -706,21 +704,18 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
     }
 
     // Radios
-    Common::String *sound;
     size = stream->readUint32LE();
     _AMRadio.clear();
 
     for (uint32 i = 0; i < size; ++i) {
-        sound = new Common::String(stream->readString());
-        _AMRadio.push_back(*sound);
+        _AMRadio.push_back(stream->readString());
     }
 
     size = stream->readUint32LE();
     _policeRadio.clear();
 
     for (uint32 i = 0; i < size; ++i) {
-        sound = new Common::String(stream->readString());
-        _policeRadio.push_back(*sound);
+        _policeRadio.push_back(stream->readString());
     }
 
     size = stream->readUint32LE();
@@ -739,18 +734,14 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
     *_repeatedMovieExit = stream->readString();
     _playedMovies.clear();
     size = stream->readUint32LE();
-    Common::String *movie;
     for (uint32 i = 0; i < size; ++i) {
-        movie = new Common::String(stream->readString());
-        _playedMovies.setVal(*movie, true);
+        _playedMovies.setVal(stream->readString(), true);
     }
 
     _playedPhoneClips.clear();
     size = stream->readUint32LE();
-    Common::String *phone;
     for (uint32 i = 0; i < size; ++i) {
-        phone = new Common::String(stream->readString());
-        _playedPhoneClips.setVal(*phone, true);
+        _playedPhoneClips.setVal(stream->readString(), true);
     }
 
     return Common::kNoError;


Commit: f63c30f4a1014fca00a87f4201afa4bdb00b83da
    https://github.com/scummvm/scummvm/commit/f63c30f4a1014fca00a87f4201afa4bdb00b83da
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: refactor sound handling to avoid leaking memory

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index a00034ad96..11521187c5 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -330,13 +330,12 @@ void fInventory(ArgArray args) {
         g_private->_masks.push_front(*m);
         g_private->_toTake = true;
 
-        Common::String *f;
         if (strcmp(snd.u.str, "\"\"") != 0) {
-            f = new Common::String(snd.u.str);
+            g_private->playSound(Common::String(snd.u.str), 1, false, false);
         } else {
-            f = g_private->getTakeLeaveSound();
+            g_private->playSound(g_private->getTakeLeaveSound(), 1, false, false);
         }
-        g_private->playSound(*f, 1, false, false);
+
         g_private->inventory.push_back(*bmp);
     } else {
         if (v1.type == NAME) {
@@ -396,8 +395,7 @@ void fSetModifiedFlag(ArgArray args) {
 void fPaperShuffleSound(ArgArray args) {
     assert(args.size() == 0);
     debugC(1, kPrivateDebugScript, "PaperShuffleSound()");
-    Common::String *s = g_private->getPaperShuffleSound();
-    g_private->playSound(*s, 1, false, false);
+    g_private->playSound(g_private->getPaperShuffleSound(), 1, false, false);
 }
 
 void fSoundEffect(ArgArray args) {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index d1a15a8719..5628f32ebd 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -454,7 +454,7 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
             if (cs < rs && e.nextSetting != NULL) { // TODO: check this
                 // an item was not taken
                 if (_toTake) {
-                    playSound(* getLeaveSound(), 1, false, false);
+                    playSound(getLeaveSound(), 1, false, false);
                     _toTake = false;
                 }
 
@@ -487,7 +487,7 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
                 setSymbol(m.flag1, 1);
                 // an item was taken
                 if (_toTake) {
-                    playSound(*getTakeSound(), 1, false, false);
+                    playSound(getTakeSound(), 1, false, false);
                     _toTake = false;
                 }
             }
@@ -981,47 +981,40 @@ bool PrivateEngine::getRandomBool(uint p) {
     return (r <= p);
 }
 
-Common::String *PrivateEngine::getPaperShuffleSound() {
+Common::String PrivateEngine::getPaperShuffleSound() {
     uint r = _rnd->getRandomNumber(6);
-    char f[32];
-    snprintf(f, 32, "glsfx0%d.wav", kPaperShuffleSound[r]);
-    return (new Common::String(*_globalAudioPath + f));
+    return Common::String::format("%sglsfx0%d.wav", _globalAudioPath->c_str(), kPaperShuffleSound[r]);
 }
 
-Common::String *PrivateEngine::getTakeSound() {
+Common::String PrivateEngine::getTakeSound() {
     if (isDemo())
-        return (new Common::String(*_globalAudioPath + "mvo007.wav"));
+        return (Common::String(*_globalAudioPath + "mvo007.wav"));
 
     uint r = _rnd->getRandomNumber(4) + 1;
-    char f[32];
-    snprintf(f, 32, "took%d.wav", r);
-    return (new Common::String(*_globalAudioPath + f));
+    return Common::String::format("%stook%d.wav", _globalAudioPath->c_str(), r);
 }
 
-Common::String *PrivateEngine::getTakeLeaveSound() {
+Common::String PrivateEngine::getTakeLeaveSound() {
     uint r = _rnd->getRandomNumber(1);
     if (r == 0) {
-        return (new Common::String(*_globalAudioPath + "mvo001.wav"));
+        return (Common::String(*_globalAudioPath + "mvo001.wav"));
     } else {
-        return (new Common::String(*_globalAudioPath + "mvo006.wav"));
+        return (Common::String(*_globalAudioPath + "mvo006.wav"));
     }
 }
 
-Common::String *PrivateEngine::getLeaveSound() {
+Common::String PrivateEngine::getLeaveSound() {
     if (isDemo())
-        return (new Common::String(*_globalAudioPath + "mvo008.wav"));
+        return (Common::String(*_globalAudioPath + "mvo008.wav"));
 
     uint r = _rnd->getRandomNumber(4) + 1;
-
-    char f[32];
-    snprintf(f, 32, "left%d.wav", r);
-    return (new Common::String(*_globalAudioPath + f));
+    return Common::String::format("%sleft%d.wav", _globalAudioPath->c_str(), r);
 }
 
 char *PrivateEngine::getRandomPhoneClip(char *clip, int i, int j) {
     uint r = i + _rnd->getRandomNumber(j - i);
 
-    char *f = (char *)malloc((strlen(clip)+3)*sizeof(char));
+    char *f = (char *)malloc((strlen(clip) + 3) * sizeof(char));
     snprintf(f, 32, "%s%02d", clip, r);
     return f;
 }
diff --git a/engines/private/private.h b/engines/private/private.h
index a91ac52e43..9c9f6ba379 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -255,12 +255,12 @@ public:
     void stopSound(bool);
     bool _noStopSounds;
 
-    Common::String *getPaperShuffleSound();
+    Common::String getPaperShuffleSound();
     Common::String *_globalAudioPath;
 
-    Common::String *getTakeSound();
-    Common::String *getTakeLeaveSound();
-    Common::String *getLeaveSound();
+    Common::String getTakeSound();
+    Common::String getTakeLeaveSound();
+    Common::String getLeaveSound();
     Common::String *_sirenSound;
 
     // Radios


Commit: 92fbf819ae0810d56de6caf06b6d6a84d41c10b6
    https://github.com/scummvm/scummvm/commit/92fbf819ae0810d56de6caf06b6d6a84d41c10b6
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: refactor sound handling to avoid leaking memory

Changed paths:
    engines/private/funcs.cpp


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 11521187c5..d5dff3b387 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -116,8 +116,8 @@ void fSyncSound(ArgArray args) {
     g_private->_nextSetting = nextSetting;
 
     if (strcmp("\"\"", args[0].u.str) != 0) {
-        Common::String *s = new Common::String(args[0].u.str);
-        g_private->playSound(*s, 1, true, false);
+        Common::String s(args[0].u.str);
+        g_private->playSound(s, 1, true, false);
     }
 }
 
@@ -196,8 +196,8 @@ void fBustMovie(ArgArray args) {
     snprintf(f, 32, "po/animatio/spoc%02dxs.smk", kPoliceBustVideos[videoIndex]);
 
     if (kPoliceBustVideos[videoIndex] == 2) {
-        Common::String *s = new Common::String("global/transiti/audio/spoc02VO.wav");
-        g_private->playSound(*s, 1, false, false);
+        Common::String s("global/transiti/audio/spoc02VO.wav");
+        g_private->playSound(s, 1, false, false);
     }
 
     Common::String *pv = new Common::String(f);
@@ -402,8 +402,8 @@ void fSoundEffect(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "SoundEffect(%s)", args[0].u.str);
     if (strcmp("\"\"", args[0].u.str) != 0) {
-        Common::String *s = new Common::String(args[0].u.str);
-        g_private->playSound(*s, 1, false, false);
+        Common::String s(args[0].u.str);
+        g_private->playSound(s, 1, false, false);
         //assert(0);
     } else {
         g_private->stopSound(true);
@@ -427,8 +427,8 @@ void fSound(ArgArray args) {
     }
 
     if (strcmp("\"\"", args[0].u.str) != 0) {
-        Common::String *s = new Common::String(args[0].u.str);
-        g_private->playSound(*s, 1, false, false);
+        Common::String s(args[0].u.str);
+        g_private->playSound(s, 1, false, false);
         //assert(0);
     } else {
         g_private->stopSound(true);
@@ -440,8 +440,8 @@ void fLoopedSound(ArgArray args) {
     assert(args.size() == 1);
     debugC(1, kPrivateDebugScript, "LoopedSound(%s)", args[0].u.str);
     if (strcmp("\"\"", args[0].u.str) != 0) {
-        Common::String *s = new Common::String(args[0].u.str);
-        g_private->playSound(*s, 0, true, true);
+        Common::String s(args[0].u.str);
+        g_private->playSound(s, 0, true, true);
         //assert(0);
     } else {
         g_private->stopSound(true);


Commit: 5c89526daaec66dd5096127428a9bf356f5d1e70
    https://github.com/scummvm/scummvm/commit/5c89526daaec66dd5096127428a9bf356f5d1e70
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: refactor sound handling to avoid leaking memory

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index d5dff3b387..11cb8ef2fb 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -191,17 +191,16 @@ void fBustMovie(ArgArray args) {
     if (videoIndex < 0)
         videoIndex = 0;
     assert(videoIndex <= 5);
-
-    char f[32];
-    snprintf(f, 32, "po/animatio/spoc%02dxs.smk", kPoliceBustVideos[videoIndex]);
+    Common::String pv =
+      Common::String::format("po/animatio/spoc%02dxs.smk", 
+        kPoliceBustVideos[videoIndex]);
 
     if (kPoliceBustVideos[videoIndex] == 2) {
         Common::String s("global/transiti/audio/spoc02VO.wav");
         g_private->playSound(s, 1, false, false);
     }
 
-    Common::String *pv = new Common::String(f);
-    g_private->_nextMovie = pv;
+    g_private->_nextMovie = new Common::String(pv);
     g_private->_nextSetting = new Common::String(args[0].u.str);
 }
 
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 5628f32ebd..ada10524e5 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -90,10 +90,10 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     _policeBustSetting = NULL;
     _numberClicks = 0;
     policeVideoIndex = 0;
-    _sirenSound = new Common::String("po/audio/posfx002.wav");
+    _sirenSound = Common::String("po/audio/posfx002.wav");
 
     // General sounds
-    _globalAudioPath = new Common::String("global/audio/");
+    _globalAudioPath = Common::String("global/audio/");
     _noStopSounds = false;
 
     // Radios and phone
@@ -101,9 +101,9 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     _AMRadioArea = NULL;
     _phoneArea = NULL;
     // TODO: use this as a default sound for radio
-    _infaceRadioPath = new Common::String("inface/radio/");
-    _phonePrefix = new Common::String("inface/telephon/");
-    _phoneCallSound = new Common::String("phone.wav");
+    _infaceRadioPath = Common::String("inface/radio/");
+    _phonePrefix = Common::String("inface/telephon/");
+    _phoneCallSound = Common::String("phone.wav");
 
     // Dossiers
     _dossierPage = 0;
@@ -333,7 +333,7 @@ void PrivateEngine::checkPoliceBust() {
 
     if (_numberClicks == _sirenWarning) {
         stopSound(true);
-        playSound(*_sirenSound, 0, false, false);
+        playSound(_sirenSound, 0, false, false);
         _numberClicks++; // Won't execute again
         return;
     }
@@ -512,8 +512,8 @@ void PrivateEngine::selectAMRadioArea(Common::Point mousePos) {
         return;
 
     if (inMask(_AMRadioArea->surf, mousePos)) {
-        Common::String sound = *_infaceRadioPath + "comm_/" + _AMRadio.back() + ".wav";
-        playSound(sound.c_str(), 1, false, false);
+        Common::String sound = _infaceRadioPath + "comm_/" + _AMRadio.back() + ".wav";
+        playSound(sound, 1, false, false);
         _AMRadio.pop_back();
     }
 }
@@ -526,8 +526,8 @@ void PrivateEngine::selectPoliceRadioArea(Common::Point mousePos) {
         return;
 
     if (inMask(_policeRadioArea->surf, mousePos)) {
-        Common::String sound = *_infaceRadioPath + "police/" + _policeRadio.back() + ".wav";
-        playSound(sound.c_str(), 1, false, false);
+        Common::String sound = _infaceRadioPath + "police/" + _policeRadio.back() + ".wav";
+        playSound(sound, 1, false, false);
         _policeRadio.pop_back();
     }
 }
@@ -540,7 +540,7 @@ void PrivateEngine::checkPhoneCall() {
         return;
 
     if (!_mixer->isSoundHandleActive(_fgSoundHandle))
-        playSound(*_phonePrefix + *_phoneCallSound, 1, false, false);
+        playSound(_phonePrefix + _phoneCallSound, 1, false, false);
 }
 
 void PrivateEngine::selectPhoneArea(Common::Point mousePos) {
@@ -554,8 +554,8 @@ void PrivateEngine::selectPhoneArea(Common::Point mousePos) {
         PhoneInfo i = _phone.back();
         Common::String sound(*i.sound);
         setSymbol(i.flag, i.val);
-        sound = *_phonePrefix + sound + ".wav";
-        playSound(sound.c_str(), 1, true, false);
+        sound = _phonePrefix + sound + ".wav";
+        playSound(sound, 1, true, false);
         _phone.pop_back();
     }
 }
@@ -983,32 +983,32 @@ bool PrivateEngine::getRandomBool(uint p) {
 
 Common::String PrivateEngine::getPaperShuffleSound() {
     uint r = _rnd->getRandomNumber(6);
-    return Common::String::format("%sglsfx0%d.wav", _globalAudioPath->c_str(), kPaperShuffleSound[r]);
+    return Common::String::format("%sglsfx0%d.wav", _globalAudioPath.c_str(), kPaperShuffleSound[r]);
 }
 
 Common::String PrivateEngine::getTakeSound() {
     if (isDemo())
-        return (Common::String(*_globalAudioPath + "mvo007.wav"));
+        return (Common::String(_globalAudioPath + "mvo007.wav"));
 
     uint r = _rnd->getRandomNumber(4) + 1;
-    return Common::String::format("%stook%d.wav", _globalAudioPath->c_str(), r);
+    return Common::String::format("%stook%d.wav", _globalAudioPath.c_str(), r);
 }
 
 Common::String PrivateEngine::getTakeLeaveSound() {
     uint r = _rnd->getRandomNumber(1);
     if (r == 0) {
-        return (Common::String(*_globalAudioPath + "mvo001.wav"));
+        return (Common::String(_globalAudioPath + "mvo001.wav"));
     } else {
-        return (Common::String(*_globalAudioPath + "mvo006.wav"));
+        return (Common::String(_globalAudioPath + "mvo006.wav"));
     }
 }
 
 Common::String PrivateEngine::getLeaveSound() {
     if (isDemo())
-        return (Common::String(*_globalAudioPath + "mvo008.wav"));
+        return (Common::String(_globalAudioPath + "mvo008.wav"));
 
     uint r = _rnd->getRandomNumber(4) + 1;
-    return Common::String::format("%sleft%d.wav", _globalAudioPath->c_str(), r);
+    return Common::String::format("%sleft%d.wav", _globalAudioPath.c_str(), r);
 }
 
 char *PrivateEngine::getRandomPhoneClip(char *clip, int i, int j) {
diff --git a/engines/private/private.h b/engines/private/private.h
index 9c9f6ba379..c30d502ac2 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -256,20 +256,20 @@ public:
     bool _noStopSounds;
 
     Common::String getPaperShuffleSound();
-    Common::String *_globalAudioPath;
+    Common::String _globalAudioPath;
 
     Common::String getTakeSound();
     Common::String getTakeLeaveSound();
     Common::String getLeaveSound();
-    Common::String *_sirenSound;
+    Common::String _sirenSound;
 
     // Radios
-    Common::String *_infaceRadioPath;
+    Common::String _infaceRadioPath;
     MaskInfo *_AMRadioArea;
     MaskInfo *_policeRadioArea;
     MaskInfo *_phoneArea;
-    Common::String *_phonePrefix;
-    Common::String *_phoneCallSound;
+    Common::String _phonePrefix;
+    Common::String _phoneCallSound;
     SoundList _AMRadio;
     SoundList _policeRadio;
     PhoneList _phone;


Commit: 79e39874597c8090e72567b9f74e0187308dbdaf
    https://github.com/scummvm/scummvm/commit/79e39874597c8090e72567b9f74e0187308dbdaf
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: removed console

Changed paths:
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index ada10524e5..c8c964c86b 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -187,10 +187,6 @@ Common::Error PrivateEngine::run() {
     _image->loadStream(frameFile);
     _frame = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
 
-    // Debugger console
-    Console *console = new Console(this);
-    setDebugger(console);
-
     // Main event loop
     Common::Event event;
     Common::Point mousePos;
diff --git a/engines/private/private.h b/engines/private/private.h
index c30d502ac2..1ac930e048 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -27,7 +27,6 @@
 #include "common/serializer.h"
 #include "engines/advancedDetector.h"
 #include "engines/engine.h"
-#include "gui/debugger.h"
 
 #include "common/installshieldv3_archive.h"
 
@@ -50,8 +49,6 @@ struct ADGameDescription;
 
 namespace Private {
 
-class Console;
-
 // debug channels
 enum {
     kPrivateDebugFunction = 1 << 0,
@@ -291,14 +288,6 @@ public:
 
 extern PrivateEngine *g_private;
 
-class Console : public GUI::Debugger {
-public:
-    Console(PrivateEngine *vm) {
-    }
-    virtual ~Console(void) {
-    }
-};
-
 } // End of namespace Private
 
 #endif


Commit: f99d4c0161537ce50248b58c0791078e4468347b
    https://github.com/scummvm/scummvm/commit/f99d4c0161537ce50248b58c0791078e4468347b
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: simplified code

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index c8c964c86b..34b87a2586 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -559,14 +559,12 @@ void PrivateEngine::selectPhoneArea(Common::Point mousePos) {
 void PrivateEngine::loadDossier() {
     int x = 40;
     int y = 30;
-    int i = _dossierSuspect;
-    int j = _dossierPage;
 
-    DossierInfo m = _dossiers[i];
+    DossierInfo m = _dossiers[_dossierSuspect];
 
-    if (j == 0) {
+    if (_dossierPage == 0) {
         loadImage(*m.page1, x, y);
-    } else if (j == 1) {
+    } else if (_dossierPage == 1) {
         loadImage(*m.page2, x, y);
     } else
         assert(0);


Commit: 692ab5c22be5de27e18f371e7b1def9947049b28
    https://github.com/scummvm/scummvm/commit/692ab5c22be5de27e18f371e7b1def9947049b28
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: use const string in getRandomPhoneClip

Changed paths:
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 34b87a2586..73adf303e3 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -1005,7 +1005,7 @@ Common::String PrivateEngine::getLeaveSound() {
     return Common::String::format("%sleft%d.wav", _globalAudioPath.c_str(), r);
 }
 
-char *PrivateEngine::getRandomPhoneClip(char *clip, int i, int j) {
+char *PrivateEngine::getRandomPhoneClip(const char *clip, int i, int j) {
     uint r = i + _rnd->getRandomNumber(j - i);
 
     char *f = (char *)malloc((strlen(clip) + 3) * sizeof(char));
diff --git a/engines/private/private.h b/engines/private/private.h
index 1ac930e048..56c8fcaead 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -271,7 +271,7 @@ public:
     SoundList _policeRadio;
     PhoneList _phone;
 
-    char *getRandomPhoneClip(char *, int, int);
+    char *getRandomPhoneClip(const char *, int, int);
     void selectAMRadioArea(Common::Point);
     void selectPoliceRadioArea(Common::Point);
     void selectPhoneArea(Common::Point);


Commit: c14cecfe48393803386f210ac987080c1bc8a787
    https://github.com/scummvm/scummvm/commit/c14cecfe48393803386f210ac987080c1bc8a787
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: refactor _diaryLocPrefix

Changed paths:
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 73adf303e3..df812bcdd1 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -112,7 +112,7 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     _dossierPrevSuspectMask = NULL;
 
     // Diary
-    _diaryLocPrefix = new Common::String("inface/diary/loclist/");
+    _diaryLocPrefix = Common::String("inface/diary/loclist/");
 }
 
 PrivateEngine::~PrivateEngine() {
@@ -1037,11 +1037,9 @@ void PrivateEngine::loadLocations(Common::Rect *rect) {
         i++;
         if (sym->u.val) {
             offset = offset + 22;
-            char *f = (char *)malloc(32*sizeof(char));
-            snprintf(f, 32, "dryloc%d.bmp", i);
-            //debug("%s, %d, %d", f, i, offset);
-            Common::String s(*_diaryLocPrefix + f);
-            //debug("%hd %hd", rect->left, rect->top + offset);
+            Common::String s =
+              Common::String::format("%sdryloc%d.bmp", _diaryLocPrefix.c_str(), i);
+
             loadMask(s, rect->left + 120, rect->top + offset, true);
         }
     }
diff --git a/engines/private/private.h b/engines/private/private.h
index 56c8fcaead..d3dcbf278b 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -227,7 +227,7 @@ public:
 
     // Diary
     InvList inventory;
-    Common::String *_diaryLocPrefix;
+    Common::String _diaryLocPrefix;
     void loadLocations(Common::Rect *);
     void loadInventory(uint32, Common::Rect *, Common::Rect *);
 


Commit: b26c6d0dce424dbbb2ff79414d3029198b518e96
    https://github.com/scummvm/scummvm/commit/b26c6d0dce424dbbb2ff79414d3029198b518e96
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: refactoring to avoid global constructors

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 11cb8ef2fb..dfa26225ab 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -172,7 +172,7 @@ void fPoliceBust(ArgArray args) {
         if (args[1].u.val == 2) {
             // Unclear what it means
         } else if (args[1].u.val == 3) {
-            g_private->_nextSetting = &kMainDesktop;
+            g_private->_nextSetting = new Common::String(kMainDesktop);
             g_private->_mode = 0;
             g_private->setOrigin(kOriginZero);
         } else
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index df812bcdd1..82255cf257 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -196,7 +196,7 @@ Common::Error PrivateEngine::run() {
     if (saveSlot >= 0) { // load the savegame
         loadGameState(saveSlot);
     } else {
-        _nextSetting = &kGoIntro;
+        _nextSetting = new Common::String(kGoIntro);
     }
 
     while (!shouldQuit()) {
@@ -338,9 +338,9 @@ void PrivateEngine::checkPoliceBust() {
         uint policeIndex = variables.getVal(kPoliceIndex)->u.val;
         _policeBustSetting = _currentSetting;
         if (policeIndex <= 13) {
-            _nextSetting = &kPOGoBustMovie;
+            _nextSetting = new Common::String(kPOGoBustMovie);
         } else {
-            _nextSetting = &kPoliceBustFromMO;
+            _nextSetting = new Common::String(kPoliceBustFromMO);
         }
         clearAreas();
         _policeBustEnabled = false;
@@ -425,7 +425,7 @@ void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
         if (!window.contains(mousePos)) {
             if ( _pausedSetting == NULL) {
                 _pausedSetting = _currentSetting;
-                _nextSetting = &kPauseMovie;
+                _nextSetting = new Common::String(kPauseMovie);
             }
         }
     }
@@ -659,7 +659,7 @@ void PrivateEngine::restartGame() {
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
     Common::Serializer s(stream, nullptr);
     debugC(1, kPrivateDebugFunction, "loadGameStream");
-    _nextSetting = &kStartGame;
+    _nextSetting = new Common::String(kStartGame);
     int val;
 
     for (NameList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
diff --git a/engines/private/private.h b/engines/private/private.h
index d3dcbf278b..aa12b250b5 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -71,13 +71,13 @@ const int kOriginOne[2]  = {64, 48};
 
 // settings
 
-static Common::String kPauseMovie("kPauseMovie");
-static Common::String kGoIntro("kGoIntro");
-static Common::String kPoliceBustFromMO("kPoliceBustFromMO");
-static Common::String kMainDesktop("kMainDesktop");
-static Common::String kPoliceIndex("kPoliceIndex");
-static Common::String kPOGoBustMovie("kPOGoBustMovie");
-static Common::String kStartGame("kStartGame");
+static const char *kPauseMovie = "kPauseMovie";
+static const char *kGoIntro = "kGoIntro";
+static const char *kPoliceBustFromMO = "kPoliceBustFromMO";
+static const char *kMainDesktop = "kMainDesktop";
+static const char *kPoliceIndex = "kPoliceIndex";
+static const char *kPOGoBustMovie = "kPOGoBustMovie";
+static const char *kStartGame = "kStartGame";
 
 // structs
 


Commit: 77abcaafaae076ef0e77de4cc2e4852bd4f6f8a2
    https://github.com/scummvm/scummvm/commit/77abcaafaae076ef0e77de4cc2e4852bd4f6f8a2
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: refactor string cmp handling to avoid leaking memory

Changed paths:
    engines/private/funcs.cpp


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index dfa26225ab..e728a008a4 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -114,9 +114,9 @@ void fSyncSound(ArgArray args) {
     debugC(1, kPrivateDebugScript, "SyncSound(%s, %s)", args[0].u.str, args[1].u.str);
     Common::String *nextSetting = new Common::String(args[1].u.str);
     g_private->_nextSetting = nextSetting;
+    Common::String s(args[0].u.str);
 
-    if (strcmp("\"\"", args[0].u.str) != 0) {
-        Common::String s(args[0].u.str);
+    if (s != "\"\"") {
         g_private->playSound(s, 1, true, false);
     }
 }
@@ -208,13 +208,12 @@ void fDossierAdd(ArgArray args) {
 
     assert (args.size() == 2);
     Common::String *s1 = new Common::String(args[0].u.str);
+    Common::String *s2 = new Common::String(args[1].u.str);
     DossierInfo *m = (DossierInfo *)malloc(sizeof(DossierInfo));
     m->page1 = s1;
 
-    if (strcmp(args[1].u.str, "\"\"") != 0) {
-        Common::String *s2 = new Common::String(args[1].u.str);
+    if (*s2 != "\"\"") {
         m->page2 = s2;
-
     } else {
         m->page2 = NULL;
     }
@@ -296,17 +295,17 @@ void fInventory(ArgArray args) {
     assert(snd.type == STRING);
     assert(i.type == STRING);
 
-    Common::String *bmp = new Common::String(i.u.str);
-    assert(g_private->isDemo() || strcmp(bmp->c_str(), "\"\"") != 0);
+    Common::String bmp(i.u.str);
+    assert(g_private->isDemo() || bmp != "\"\"");
 
     if (v1.type == STRING)
         assert(strcmp(v1.u.str, "\"\"") == 0);
 
     debugC(1, kPrivateDebugScript, "Inventory(...)");
-    if (strcmp(b1.u.str, "\"\"") != 0) {
-        Common::String *s = new Common::String(b1.u.str);
+    Common::String mask(b1.u.str);
+    if (mask != "\"\"") {
         MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
-        m->surf = g_private->loadMask(*s, 0, 0, true);
+        m->surf = g_private->loadMask(mask, 0, 0, true);
 
         if (e.type == NUM)
             m->nextSetting = NULL;
@@ -328,25 +327,26 @@ void fInventory(ArgArray args) {
 
         g_private->_masks.push_front(*m);
         g_private->_toTake = true;
+        Common::String sound(snd.u.str);
 
-        if (strcmp(snd.u.str, "\"\"") != 0) {
-            g_private->playSound(Common::String(snd.u.str), 1, false, false);
+        if (sound != "\"\"") {
+            g_private->playSound(sound, 1, false, false);
         } else {
             g_private->playSound(g_private->getTakeLeaveSound(), 1, false, false);
         }
 
-        g_private->inventory.push_back(*bmp);
+        g_private->inventory.push_back(bmp);
     } else {
         if (v1.type == NAME) {
             if (strcmp(c.u.str, "\"REMOVE\"") == 0) {
                 v1.u.sym->u.val = 0;
-                g_private->inventory.remove(*bmp);
+                g_private->inventory.remove(bmp);
             } else {
                 v1.u.sym->u.val = 1;
-                g_private->inventory.push_back(*bmp);
+                g_private->inventory.push_back(bmp);
             }
         } else {
-            g_private->inventory.push_back(*bmp);
+            g_private->inventory.push_back(bmp);
         }
         if (v2.type == NAME)
             v2.u.sym->u.val = 1;
@@ -400,10 +400,9 @@ void fPaperShuffleSound(ArgArray args) {
 void fSoundEffect(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "SoundEffect(%s)", args[0].u.str);
-    if (strcmp("\"\"", args[0].u.str) != 0) {
-        Common::String s(args[0].u.str);
+    Common::String s(args[0].u.str);
+    if (s != "\"\"") {
         g_private->playSound(s, 1, false, false);
-        //assert(0);
     } else {
         g_private->stopSound(true);
     }
@@ -425,10 +424,9 @@ void fSound(ArgArray args) {
             assert(0);
     }
 
-    if (strcmp("\"\"", args[0].u.str) != 0) {
-        Common::String s(args[0].u.str);
+    Common::String s(args[0].u.str);
+    if (s != "\"\"") {
         g_private->playSound(s, 1, false, false);
-        //assert(0);
     } else {
         g_private->stopSound(true);
     }
@@ -438,10 +436,10 @@ void fLoopedSound(ArgArray args) {
     // assert types
     assert(args.size() == 1);
     debugC(1, kPrivateDebugScript, "LoopedSound(%s)", args[0].u.str);
-    if (strcmp("\"\"", args[0].u.str) != 0) {
-        Common::String s(args[0].u.str);
+    Common::String s(args[0].u.str);
+
+    if (s != "\"\"") {
         g_private->playSound(s, 0, true, true);
-        //assert(0);
     } else {
         g_private->stopSound(true);
     }
@@ -473,14 +471,13 @@ void fMovie(ArgArray args) {
     debugC(1, kPrivateDebugScript, "Movie(%s, %s)", args[0].u.str, args[1].u.str);
     Common::String *movie = new Common::String(args[0].u.str);
     Common::String *nextSetting = new Common::String(args[1].u.str);
-    bool isEmptyString = strcmp(args[0].u.str, "\"\"") == 0;
 
-    if (!g_private->_playedMovies.contains(*movie) && !isEmptyString) {
+    if (!g_private->_playedMovies.contains(*movie) && *movie != "\"\"") {
         g_private->_nextMovie = movie;
         g_private->_playedMovies.setVal(*movie, true);
         g_private->_nextSetting = nextSetting;
 
-    } else if (isEmptyString) {
+    } else if (*movie == "\"\"") {
         g_private->_repeatedMovieExit = nextSetting;
         debugC(1, kPrivateDebugScript, "repeated movie exit is %s", nextSetting->c_str());
     } else {


Commit: e14b415f48f37dc3528c09b3e7c43301509b670b
    https://github.com/scummvm/scummvm/commit/e14b415f48f37dc3528c09b3e7c43301509b670b
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: refactor string cmp handling to avoid leaking memory

Changed paths:
    engines/private/cursors.cpp
    engines/private/funcs.cpp
    engines/private/private.cpp


diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index b3a77c7e3c..e267da3a6d 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -351,7 +351,7 @@ void PrivateEngine::changeCursor(Common::String cursor) {
     Common::Point p = *_cursorPoints.getVal(cursor);
 
     int x, y;
-    if (strcmp(cursor.c_str(), "default") == 0) {
+    if (cursor == "default") {
         x = 11;
         y = 16;
     }
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index e728a008a4..d49e1349f8 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -609,16 +609,17 @@ void fPhoneClip(ArgArray args) {
 
 void fSoundArea(ArgArray args) {
     // assert types
-    char *n;
+    //char *n;
+    Common::String n;
     if (args[1].type == NAME)
-        n = (char *)args[1].u.sym->name->c_str();
+        n = *(args[1].u.sym->name);
     else if (args[1].type == STRING)
-        n = args[1].u.str;
+        n = Common::String(args[1].u.str);
     else
-        assert(0);
+        error("Invalid input for SoundArea");
 
-    debugC(1, kPrivateDebugScript, "SoundArea(%s, %s)", args[0].u.str, n);
-    if (strcmp(n, "kAMRadio") == 0) {
+    debugC(1, kPrivateDebugScript, "SoundArea(%s, %s, ..)", args[0].u.str, n.c_str());
+    if (n == "kAMRadio") {
         Common::String *s = new Common::String(args[0].u.str);
         MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
         m->surf = g_private->loadMask(*s, 0, 0, true);
@@ -628,7 +629,7 @@ void fSoundArea(ArgArray args) {
         m->flag2 = NULL;
         g_private->_AMRadioArea = m;
         g_private->_masks.push_front(*m);
-    } else if (strcmp(n, "kPoliceRadio") == 0) {
+    } else if (n == "kPoliceRadio") {
         Common::String *s = new Common::String(args[0].u.str);
         MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
         m->surf = g_private->loadMask(*s, 0, 0, true);
@@ -638,7 +639,7 @@ void fSoundArea(ArgArray args) {
         m->flag2 = NULL;
         g_private->_policeRadioArea = m;
         g_private->_masks.push_front(*m);
-    } else if (strcmp(n, "kPhone") == 0) {
+    } else if (n == "kPhone") {
         Common::String *s = new Common::String(args[0].u.str);
         MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
         m->surf = g_private->loadMask(*s, 0, 0, true);
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 82255cf257..e2ccb40c8e 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -632,7 +632,7 @@ void PrivateEngine::restartGame() {
 
     for (NameList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
         Private::Symbol *sym = variables.getVal(*it);
-        if (strcmp("kAlternateGame", sym->name->c_str()) != 0)
+        if (*(sym->name) != "kAlternateGame")
             sym->u.val = 0;
     }
 


Commit: 491b42235405e0bbc4345819f41132d8bda5858d
    https://github.com/scummvm/scummvm/commit/491b42235405e0bbc4345819f41132d8bda5858d
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: missing new line

Changed paths:
    engines/private/cursors.h


diff --git a/engines/private/cursors.h b/engines/private/cursors.h
index fdc3e4a084..c45cb55536 100644
--- a/engines/private/cursors.h
+++ b/engines/private/cursors.h
@@ -36,4 +36,4 @@ typedef Common::HashMap<Common::String, Common::Point *> CursorPointMap;
 
 } // End of namespace Private
 
-#endif
\ No newline at end of file
+#endif


Commit: 6c4f52d07abdf03e4906ee6f9c70c251df8c4fca
    https://github.com/scummvm/scummvm/commit/6c4f52d07abdf03e4906ee6f9c70c251df8c4fca
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: refactor mask handling to avoid leaking memory

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index d49e1349f8..8283f33c64 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -143,9 +143,9 @@ void fLoadGame(ArgArray args) {
 void fSaveGame(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "SaveGame(%s, %s)", args[0].u.str, args[1].u.sym->name->c_str());
-    Common::String *s = new Common::String(args[0].u.str);
+    Common::String s(args[0].u.str);
     MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
-    m->surf = g_private->loadMask(*s, 0, 0, true);
+    m->surf = g_private->loadMask(s, 0, 0, true);
     m->cursor = args[1].u.sym->name;
     m->nextSetting = NULL;
     m->flag1 = NULL;
@@ -235,13 +235,13 @@ void fDossierChgSheet(ArgArray args) {
 
 void fDossierPrevSuspect(ArgArray args) {
     assert (args.size() == 3);
-    Common::String *s = new Common::String(args[0].u.str);
+    Common::String s(args[0].u.str);
     MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
 
     int x = args[1].u.val;
     int y = args[2].u.val;
 
-    m->surf = g_private->loadMask(*s, x, y, true);
+    m->surf = g_private->loadMask(s, x, y, true);
     m->cursor = new Common::String("kExit");
     m->nextSetting = NULL;
     m->flag1 = NULL;
@@ -252,13 +252,13 @@ void fDossierPrevSuspect(ArgArray args) {
 
 void fDossierNextSuspect(ArgArray args) {
     assert (args.size() == 3);
-    Common::String *s = new Common::String(args[0].u.str);
+    Common::String s(args[0].u.str);
     MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
 
     int x = args[1].u.val;
     int y = args[2].u.val;
 
-    m->surf = g_private->loadMask(*s, x, y, true);
+    m->surf = g_private->loadMask(s, x, y, true);
     m->cursor = new Common::String("kExit");
     m->nextSetting = NULL;
     m->flag1 = NULL;
@@ -515,8 +515,8 @@ void fBitmap(ArgArray args) {
     }
 
     debugC(1, kPrivateDebugScript, "Bitmap(%s, %d, %d)", f, x, y);
-    Common::String *s = new Common::String(args[0].u.str);
-    g_private->loadImage(*s, x, y);
+    Common::String s(args[0].u.str);
+    g_private->loadImage(s, x, y);
 }
 
 void _fMask(ArgArray args, bool drawn) {
@@ -534,10 +534,10 @@ void _fMask(ArgArray args, bool drawn) {
     }
 
     debugC(1, kPrivateDebugScript, "Mask(%s, %s, %s, %d, %d)", f, e, c->c_str(), x, y);
-    const Common::String *s = new Common::String(f);
+    const Common::String s(f);
 
     MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
-    m->surf = g_private->loadMask(*s, x, y, drawn);
+    m->surf = g_private->loadMask(s, x, y, drawn);
     m->nextSetting = new Common::String(e);
     m->cursor = c;
     m->flag1 = NULL;
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index e2ccb40c8e..2d0bc95501 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -259,7 +259,7 @@ Common::Error PrivateEngine::run() {
             continue;
         }
 
-        if (_nextVS != NULL && _currentSetting->c_str() == kMainDesktop) {
+        if (_nextVS != NULL && *_currentSetting == kMainDesktop) {
             loadImage(*_nextVS, 160, 120);
         }
 


Commit: 86f75d18b18b03c2c5809f6aba01faa8e32c98a2
    https://github.com/scummvm/scummvm/commit/86f75d18b18b03c2c5809f6aba01faa8e32c98a2
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: refactor headers

Changed paths:
    engines/private/cursors.h
    engines/private/detection.cpp
    engines/private/grammar.h
    engines/private/grammar.y
    engines/private/metaengine.cpp
    engines/private/private.cpp
    engines/private/private.h
    engines/private/symbol.cpp
    engines/private/symbol.h


diff --git a/engines/private/cursors.h b/engines/private/cursors.h
index c45cb55536..d8def97495 100644
--- a/engines/private/cursors.h
+++ b/engines/private/cursors.h
@@ -20,15 +20,14 @@
  *
  */
 
+#ifndef PRIVATE_CURSORS_H
+#define PRIVATE_CURSORS_H
+
 #include "common/scummsys.h"
 #include "common/str.h"
 #include "common/hash-str.h"
 #include "common/rect.h"
 
-#ifndef PRIVATE_CURSORS_H
-#define PRIVATE_CURSORS_H
-
-
 namespace Private {
 
 typedef Common::HashMap<Common::String, const byte *> CursorDataMap;
diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index d05d7736ab..8ad5c7c85f 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -29,7 +29,6 @@ static const PlainGameDescriptor privateGames[] = {
     { 0, 0 }
 };
 
-
 static const ADGameDescription gameDescriptions[] = {
     {
         "private-eye",  // US release
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 4f14c04bcb..643ae20406 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -20,6 +20,9 @@
  *
  */
 
+#ifndef PRIVATE_GRAMMAR_H
+#define PRIVATE_GRAMMAR_H
+
 #include "common/str.h"
 #include "common/hash-str.h"
 #include "common/hash-ptr.h"
@@ -27,15 +30,12 @@
 #include "common/list.h"
 #include "common/array.h"
 #include "common/rect.h"
-#include "private/symbol.h"
 
-#ifndef PRIVATE_GRAMMAR_H
-#define PRIVATE_GRAMMAR_H
+#include "private/symbol.h"
 
 #define NSTACK 256
 #define NPROG  10000
 
-
 namespace Private {
 
 typedef struct Datum {  /* interpreter stack type */
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 08023c8a1b..5c52e95ede 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -25,7 +25,6 @@
 %output "engines/private/grammar.cpp"
 %define api.prefix {PRIVATE_}
 
-
 %{
 
 #include "private/grammar.h"
diff --git a/engines/private/metaengine.cpp b/engines/private/metaengine.cpp
index 618d5b790e..1725724a4c 100644
--- a/engines/private/metaengine.cpp
+++ b/engines/private/metaengine.cpp
@@ -20,9 +20,10 @@
  *
  */
 
-#include "private/private.h"
 #include "engines/advancedDetector.h"
 
+#include "private/private.h"
+
 class PrivateMetaEngine : public AdvancedMetaEngine {
 public:
     const char *getName() const override {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 2d0bc95501..946f7db4a5 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -20,11 +20,8 @@
  *
  */
 
-#include "common/scummsys.h"
-
 #include "audio/decoders/wave.h"
 #include "audio/audiostream.h"
-
 #include "common/archive.h"
 #include "common/config-manager.h"
 #include "common/debug.h"
@@ -33,12 +30,12 @@
 #include "common/events.h"
 #include "common/file.h"
 #include "common/fs.h"
+#include "common/savefile.h"
+#include "common/scummsys.h"
 #include "common/system.h"
 #include "common/str.h"
-#include "common/savefile.h"
 #include "common/timer.h"
 #include "engines/util.h"
-
 #include "image/bmp.h"
 #include "graphics/cursorman.h"
 
diff --git a/engines/private/private.h b/engines/private/private.h
index aa12b250b5..fa4d8471d4 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -23,17 +23,12 @@
 #ifndef PRIVATE_H
 #define PRIVATE_H
 
+#include "common/installshieldv3_archive.h"
 #include "common/random.h"
 #include "common/serializer.h"
-#include "engines/advancedDetector.h"
 #include "engines/engine.h"
-
-#include "common/installshieldv3_archive.h"
-
-#include "audio/mixer.h"
-#include "video/smk_decoder.h"
-#include "graphics/palette.h"
 #include "graphics/managed_surface.h"
+#include "video/smk_decoder.h"
 
 #include "private/grammar.h"
 
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index abbef29dfc..b1c180f763 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -20,9 +20,8 @@
  *
  */
 
-#include "common/debug.h"
-#include "private/private.h"
 #include "private/grammar.h"
+#include "private/private.h"
 #include "private/tokens.h"
 
 namespace Private {
@@ -89,7 +88,6 @@ Symbol *lookupName(char *n) {
 
 }
 
-
 void installAll(char *n) {
     Common::String *s;
     Common::Rect *r;
diff --git a/engines/private/symbol.h b/engines/private/symbol.h
index 031b1501d3..2301f25286 100644
--- a/engines/private/symbol.h
+++ b/engines/private/symbol.h
@@ -20,6 +20,9 @@
  *
  */
 
+#ifndef PRIVATE_SYMBOL_H
+#define PRIVATE_SYMBOL_H
+
 #include "common/str.h"
 #include "common/hash-str.h"
 #include "common/hash-ptr.h"
@@ -28,9 +31,6 @@
 #include "common/array.h"
 #include "common/rect.h"
 
-#ifndef PRIVATE_SYMBOL_H
-#define PRIVATE_SYMBOL_H
-
 namespace Private {
 
 typedef struct Symbol {     /* symbol table entry */


Commit: f283e0339bd4257f59078346353c0fad137e72d6
    https://github.com/scummvm/scummvm/commit/f283e0339bd4257f59078346353c0fad137e72d6
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: refactor headers

Changed paths:
    engines/private/cursors.cpp
    engines/private/cursors.h
    engines/private/funcs.cpp
    engines/private/private.cpp


diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index e267da3a6d..7cc03f4de9 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -20,6 +20,7 @@
  *
  */
 
+#include "common/rect.h"
 #include "graphics/cursorman.h"
 
 #include "private/cursors.h"
diff --git a/engines/private/cursors.h b/engines/private/cursors.h
index d8def97495..a266d2e176 100644
--- a/engines/private/cursors.h
+++ b/engines/private/cursors.h
@@ -23,10 +23,8 @@
 #ifndef PRIVATE_CURSORS_H
 #define PRIVATE_CURSORS_H
 
-#include "common/scummsys.h"
-#include "common/str.h"
 #include "common/hash-str.h"
-#include "common/rect.h"
+#include "common/str.h"
 
 namespace Private {
 
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 8283f33c64..4046f27d50 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -22,7 +22,6 @@
 
 #include "common/str.h"
 #include "common/timer.h"
-#include "common/debug.h"
 #include "common/system.h"
 
 #include "private/grammar.h"
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 946f7db4a5..d81d393a29 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -29,15 +29,12 @@
 #include "common/error.h"
 #include "common/events.h"
 #include "common/file.h"
-#include "common/fs.h"
 #include "common/savefile.h"
-#include "common/scummsys.h"
 #include "common/system.h"
 #include "common/str.h"
 #include "common/timer.h"
 #include "engines/util.h"
 #include "image/bmp.h"
-#include "graphics/cursorman.h"
 
 #include "private/cursors.h"
 #include "private/private.h"


Commit: b652a71babedcf8334718090fd5eb5a07390f371
    https://github.com/scummvm/scummvm/commit/b652a71babedcf8334718090fd5eb5a07390f371
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: added makefile rule to build lexer/grammar

Changed paths:
    engines/private/module.mk


diff --git a/engines/private/module.mk b/engines/private/module.mk
index afbe36f3a2..ba2f9afcdd 100644
--- a/engines/private/module.mk
+++ b/engines/private/module.mk
@@ -12,7 +12,14 @@ MODULE_OBJS := \
  
 MODULE_DIRS += \
     engines/private
- 
+
+# HACK: Skip this when including the file for detection objects.
+ifeq "$(USE_RULES)" "1"
+private-grammar:
+	flex engines/private/lexer.l
+	bison engines/private/grammar.y
+endif
+
 # This module can be built as a plugin
 ifeq ($(ENABLE_PRIVATE), DYNAMIC_PLUGIN)
 PLUGIN := 1


Commit: 8e78365cfb7bb1ead6bb2ad7074480cdef1fc57a
    https://github.com/scummvm/scummvm/commit/8e78365cfb7bb1ead6bb2ad7074480cdef1fc57a
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: correct detection thanks to @sev

Changed paths:
    engines/private/detection.cpp


diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index 8ad5c7c85f..77b8e1e6c7 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -33,13 +33,14 @@ static const ADGameDescription gameDescriptions[] = {
     {
         "private-eye",  // US release
         0,
-        AD_ENTRY1s("PVTEYE.Z", "b682118cda6a42fa89833cae2b8824bd", 271895),
+        AD_ENTRY2s("pvteye.z", "b682118cda6a42fa89833cae2b8824bd", 271895,
+           "bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
         Common::EN_USA,
         Common::kPlatformWindows,
         ADGF_NO_FLAGS,
         GUIO1(GUIO_NOMIDI)
     },
-
+    /*
     {
         "private-eye",  // EU release
         0,
@@ -49,28 +50,28 @@ static const ADGameDescription gameDescriptions[] = {
         ADGF_UNSUPPORTED,
         GUIO1(GUIO_NOMIDI)
     },
-
+    */
     {
         "private-eye", // Demo from archive.org
         "Demo",
-        AD_ENTRY1s("PVTEYE.Z", "8ef908e212bb9c1e10f5e3c81f56682c", 263893),
+        AD_ENTRY2s("pvteye.z", "8ef908e212bb9c1e10f5e3c81f56682c", 263893,
+           "bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
         Common::EN_USA,
         Common::kPlatformWindows,
         ADGF_DEMO,
         GUIO1(GUIO_NOMIDI)
     },
-
     {
         "private-eye", // Demo from the US release
         "Demo",
-        AD_ENTRY1s("PVTEYE.Z", "af383c813157810e89d8d6d595895ff7", 271214),
+        AD_ENTRY2s("pvteye.z", "af383c813157810e89d8d6d595895ff7", 263893,
+           "bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
         Common::EN_USA,
         Common::kPlatformWindows,
         ADGF_DEMO,
         GUIO1(GUIO_NOMIDI)
     },
-
-
+    /*
     {
         "private-eye", // Demo from the EU release
         "Demo",
@@ -80,13 +81,14 @@ static const ADGameDescription gameDescriptions[] = {
         ADGF_DEMO | ADGF_UNSUPPORTED,
         GUIO1(GUIO_NOMIDI)
     },
-
+    */
     AD_TABLE_END_MARKER
 };
 } // End of namespace Private
 
 static const char *const directoryGlobs[] = {
-    "SUPPORT",
+    "support",
+    "intro",
     0
 };
 


Commit: ad0f44114e1df30a91af2cfbfc68cf5efcda6278
    https://github.com/scummvm/scummvm/commit/ad0f44114e1df30a91af2cfbfc68cf5efcda6278
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: code convention fixes

Changed paths:
    engines/private/cursors.cpp


diff --git a/engines/private/cursors.cpp b/engines/private/cursors.cpp
index 7cc03f4de9..6d9655581e 100644
--- a/engines/private/cursors.cpp
+++ b/engines/private/cursors.cpp
@@ -344,19 +344,17 @@ void PrivateEngine::initCursors() {
         _cursorPoints.setVal(*name, point);
     }
     CursorMan.replaceCursorPalette(cursorPalette, 0, 3);
-
 }
 
 void PrivateEngine::changeCursor(Common::String cursor) {
     assert(_cursorData.contains(cursor));
     Common::Point p = *_cursorPoints.getVal(cursor);
-
     int x, y;
+
     if (cursor == "default") {
         x = 11;
         y = 16;
-    }
-    else {
+    } else {
         x = 32;
         y = 32;
     }


Commit: 9067ecec7cab0ba180df71d8fa1d76bcd4e9b4a6
    https://github.com/scummvm/scummvm/commit/9067ecec7cab0ba180df71d8fa1d76bcd4e9b4a6
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: added hoc copyright

Changed paths:
    engines/private/code.cpp
    engines/private/grammar.y
    engines/private/symbol.cpp


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 9662d12d81..2a86be5bb4 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.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 "common/str.h"
 #include "common/debug.h"
 #include "common/hash-ptr.h"
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 5c52e95ede..9e1ab1029a 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -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.
+
 %require "3.6"
 %defines "engines/private/tokens.h"
 %output "engines/private/grammar.cpp"
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index b1c180f763..b63f10e1ba 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -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.
+
 #include "private/grammar.h"
 #include "private/private.h"
 #include "private/tokens.h"


Commit: 07ef9a9cd52b8d12467b29d6c6eb7954b5779387
    https://github.com/scummvm/scummvm/commit/07ef9a9cd52b8d12467b29d6c6eb7954b5779387
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: removed policeVideoIndex

Changed paths:
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index d81d393a29..1cb573ec39 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -83,7 +83,6 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     _policeBustEnabled = false;
     _policeBustSetting = NULL;
     _numberClicks = 0;
-    policeVideoIndex = 0;
     _sirenSound = Common::String("po/audio/posfx002.wav");
 
     // General sounds
diff --git a/engines/private/private.h b/engines/private/private.h
index fa4d8471d4..88918be2f9 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -210,7 +210,6 @@ public:
     void loadDossier();
 
     // Police Bust
-    int policeVideoIndex;
     void policeBust();
     bool _policeBustEnabled;
     void startPoliceBust();


Commit: 49b6e11f861fa9b0b86394d1aefd58669cb86886
    https://github.com/scummvm/scummvm/commit/49b6e11f861fa9b0b86394d1aefd58669cb86886
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: refactored more strings code

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 4046f27d50..a87f2845cd 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -477,11 +477,11 @@ void fMovie(ArgArray args) {
         g_private->_nextSetting = nextSetting;
 
     } else if (*movie == "\"\"") {
-        g_private->_repeatedMovieExit = nextSetting;
+        g_private->_repeatedMovieExit = *nextSetting;
         debugC(1, kPrivateDebugScript, "repeated movie exit is %s", nextSetting->c_str());
     } else {
         debugC(1, kPrivateDebugScript, "movie %s already played", movie->c_str());
-        g_private->_nextSetting = g_private->_repeatedMovieExit;
+        g_private->_nextSetting = &(g_private->_repeatedMovieExit);
     }
 }
 
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 1cb573ec39..de131b5064 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -70,23 +70,23 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     // Movies
     _nextMovie = NULL;
     _nextVS = NULL;
-    _repeatedMovieExit = new Common::String("");
+    _repeatedMovieExit = "";
 
     // Save and load
     _saveGameMask = NULL;
     _loadGameMask = NULL;
 
     // Interface
-    _framePath = new Common::String("inface/general/inface2.bmp");
+    _framePath = "inface/general/inface2.bmp";
 
     // Police
     _policeBustEnabled = false;
     _policeBustSetting = NULL;
     _numberClicks = 0;
-    _sirenSound = Common::String("po/audio/posfx002.wav");
+    _sirenSound = "po/audio/posfx002.wav";
 
     // General sounds
-    _globalAudioPath = Common::String("global/audio/");
+    _globalAudioPath = "global/audio/";
     _noStopSounds = false;
 
     // Radios and phone
@@ -94,9 +94,9 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     _AMRadioArea = NULL;
     _phoneArea = NULL;
     // TODO: use this as a default sound for radio
-    _infaceRadioPath = Common::String("inface/radio/");
-    _phonePrefix = Common::String("inface/telephon/");
-    _phoneCallSound = Common::String("phone.wav");
+    _infaceRadioPath = "inface/radio/";
+    _phonePrefix = "inface/telephon/";
+    _phoneCallSound = "phone.wav";
 
     // Dossiers
     _dossierPage = 0;
@@ -105,11 +105,12 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     _dossierPrevSuspectMask = NULL;
 
     // Diary
-    _diaryLocPrefix = Common::String("inface/diary/loclist/");
+    _diaryLocPrefix = "inface/diary/loclist/";
 }
 
 PrivateEngine::~PrivateEngine() {
     // Dispose your resources here
+    delete _frame;
     delete _rnd;
 
     // Remove all of our debug levels
@@ -166,7 +167,7 @@ Common::Error PrivateEngine::run() {
     _pixelFormat = Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
     _transparentColor = _pixelFormat.RGBToColor(0,255,0);
     initGraphics(_screenW, _screenH, &_pixelFormat);
-    screenRect = new Common::Rect(0, 0, _screenW, _screenH);
+    screenRect = Common::Rect(0, 0, _screenW, _screenH);
     changeCursor("default");
     _origin = new Common::Point(0, 0);
     _image = new Image::BitmapDecoder();
@@ -176,7 +177,7 @@ Common::Error PrivateEngine::run() {
 
     // Load the game frame once
     Common::File frameFile;
-    assert(frameFile.open(convertPath(*_framePath)));
+    assert(frameFile.open(convertPath(_framePath)));
     _image->loadStream(frameFile);
     _frame = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
 
@@ -644,7 +645,7 @@ void PrivateEngine::restartGame() {
     _playedPhoneClips.clear();
 
     // Movies
-    _repeatedMovieExit = NULL;
+    _repeatedMovieExit = "";
     _playedMovies.clear();
 
 }
@@ -718,7 +719,7 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
     }
 
     // Played media
-    *_repeatedMovieExit = stream->readString();
+    _repeatedMovieExit = stream->readString();
     _playedMovies.clear();
     size = stream->readUint32LE();
     for (uint32 i = 0; i < size; ++i) {
@@ -790,7 +791,7 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
     }
 
     // Played media
-    stream->writeString(*_repeatedMovieExit);
+    stream->writeString(_repeatedMovieExit);
     stream->writeByte(0);
 
     stream->writeUint32LE(_playedMovies.size());
@@ -915,7 +916,7 @@ Graphics::ManagedSurface *PrivateEngine::loadMask(const Common::String &name, in
     _image->loadStream(file);
     Graphics::ManagedSurface *surf = new Graphics::ManagedSurface();
     surf->create(_screenW, _screenH, _pixelFormat);
-    surf->fillRect(*screenRect, _transparentColor);
+    surf->fillRect(screenRect, _transparentColor);
     Graphics::Surface *csurf = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
     surf->transBlitFrom(*csurf, Common::Point(x,y));
     csurf->free();
diff --git a/engines/private/private.h b/engines/private/private.h
index 88918be2f9..1505b6f8f4 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -186,8 +186,8 @@ public:
     void drawMask(Graphics::ManagedSurface *);
     bool inMask(Graphics::ManagedSurface *, Common::Point);
     uint32 _transparentColor;
-    Common::Rect *screenRect;
-    Common::String *_framePath;
+    Common::Rect screenRect;
+    Common::String _framePath;
     Graphics::Surface *_frame;
     Common::String *_nextVS;
     void drawScreen();
@@ -234,7 +234,7 @@ public:
     Common::String *_nextMovie;
     PlayedMediaTable _playedMovies;
     PlayedMediaTable _playedPhoneClips;
-    Common::String *_repeatedMovieExit;
+    Common::String _repeatedMovieExit;
     Common::String *_pausedSetting;
 
     // Masks/Exits


Commit: bc1c212c92e4eec1725b39d610790a2c9c2f722d
    https://github.com/scummvm/scummvm/commit/bc1c212c92e4eec1725b39d610790a2c9c2f722d
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: documented some code

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index de131b5064..36cd2980b8 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -230,11 +230,13 @@ Common::Error PrivateEngine::run() {
                 break;
 
             case Common::EVENT_MOUSEMOVE:
+                // Reset cursor to default
                 changeCursor("default");
+                // The following functions will return true
+                // if the cursor is changed
                 if      (cursorPauseMovie(mousePos)) {}
                 else if (cursorMask(mousePos))       {}
-                else if (cursorExit(mousePos))       {}
-                //
+                else     cursorExit(mousePos);
                 break;
 
             default:


Commit: 0ba260cac139d44560778fb652e15503b9fd7e76
    https://github.com/scummvm/scummvm/commit/0ba260cac139d44560778fb652e15503b9fd7e76
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: first step to use classes and avoid external

Changed paths:
    engines/private/funcs.cpp
    engines/private/grammar.cpp
    engines/private/grammar.h
    engines/private/grammar.y
    engines/private/lexer.cpp
    engines/private/lexer.l
    engines/private/private.cpp
    engines/private/private.h
    engines/private/symbol.cpp
    engines/private/symbol.h
    engines/private/tokens.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index a87f2845cd..43e14e7232 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -185,7 +185,7 @@ void fBustMovie(ArgArray args) {
     // assert types
     assert (args.size() == 1);
     debugC(1, kPrivateDebugScript, "BustMovie(%s)", args[0].u.str);
-    uint policeIndex = variables.getVal(kPoliceIndex)->u.val;
+    uint policeIndex = g_private->maps.variables.getVal(kPoliceIndex)->u.val;
     int videoIndex = policeIndex/2 - 1;
     if (videoIndex < 0)
         videoIndex = 0;
diff --git a/engines/private/grammar.cpp b/engines/private/grammar.cpp
index 95a7640cb5..32751a3960 100644
--- a/engines/private/grammar.cpp
+++ b/engines/private/grammar.cpp
@@ -75,9 +75,10 @@
 #define yychar          PRIVATE_char
 
 /* First part of user prologue.  */
-#line 29 "engines/private/grammar.y"
+#line 51 "engines/private/grammar.y"
 
 
+#include "private/private.h"
 #include "private/grammar.h"
 
 #define code1(c1)       Private::code(c1);
@@ -98,7 +99,7 @@ int PRIVATE_wrap() {
 
 
 
-#line 102 "engines/private/grammar.cpp"
+#line 103 "engines/private/grammar.cpp"
 
 # ifndef YY_CAST
 #  ifdef __cplusplus
@@ -543,12 +544,12 @@ static const yytype_int8 yytranslate[] =
   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
-       0,    68,    68,    69,    72,    73,    74,    77,    78,    81,
-      82,    85,    92,    93,    98,   106,   107,   110,   113,   116,
-     119,   120,   125,   129,   130,   133,   141,   142,   150,   153,
-     154,   155,   156,   157,   160,   161,   162,   163,   164,   165,
-     168,   169,   170,   171,   172,   173,   174,   175,   176,   177,
-     178
+       0,    91,    91,    92,    95,    96,    97,   100,   101,   104,
+     105,   108,   115,   116,   121,   129,   130,   133,   136,   139,
+     142,   143,   148,   152,   153,   156,   164,   165,   173,   176,
+     177,   178,   179,   180,   183,   184,   185,   186,   187,   188,
+     191,   192,   193,   194,   195,   196,   197,   198,   199,   200,
+     201
 };
 #endif
 
@@ -1195,298 +1196,298 @@ yyreduce:
   switch (yyn)
     {
   case 4: /* line: DEBUGTOK '{' debug '}'  */
-#line 72 "engines/private/grammar.y"
+#line 95 "engines/private/grammar.y"
                                              { /* Not used in the game */ }
-#line 1201 "engines/private/grammar.cpp"
+#line 1202 "engines/private/grammar.cpp"
     break;
 
   case 5: /* line: DEFINETOK NAME '{' define '}'  */
-#line 73 "engines/private/grammar.y"
-                                             { installAll((yyvsp[-3].s)); }
-#line 1207 "engines/private/grammar.cpp"
+#line 96 "engines/private/grammar.y"
+                                             { g_private->maps.installAll((yyvsp[-3].s)); }
+#line 1208 "engines/private/grammar.cpp"
     break;
 
   case 6: /* line: SETTINGTOK NAME '{' statements '}'  */
-#line 74 "engines/private/grammar.y"
+#line 97 "engines/private/grammar.y"
                                              { saveSetting((yyvsp[-3].s)); initSetting(); }
-#line 1213 "engines/private/grammar.cpp"
+#line 1214 "engines/private/grammar.cpp"
     break;
 
   case 9: /* statements: %empty  */
-#line 81 "engines/private/grammar.y"
+#line 104 "engines/private/grammar.y"
                                { (yyval.inst) = progp; }
-#line 1219 "engines/private/grammar.cpp"
+#line 1220 "engines/private/grammar.cpp"
     break;
 
   case 11: /* statement: GOTOTOK NAME ';'  */
-#line 85 "engines/private/grammar.y"
+#line 108 "engines/private/grammar.y"
                             {
         (yyval.inst) = progp;
-        code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s)));
-        code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
-        code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
+        code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, (yyvsp[-1].s)));
+        code2(constpush, (Private::Inst) g_private->maps.constant(NUM, 1, NULL));
+        code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, "goto")); 
         code1(funcpush);
         }
-#line 1231 "engines/private/grammar.cpp"
+#line 1232 "engines/private/grammar.cpp"
     break;
 
   case 12: /* statement: fcall ';'  */
-#line 92 "engines/private/grammar.y"
+#line 115 "engines/private/grammar.y"
                             { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1237 "engines/private/grammar.cpp"
+#line 1238 "engines/private/grammar.cpp"
     break;
 
   case 13: /* statement: if cond body end  */
-#line 93 "engines/private/grammar.y"
+#line 116 "engines/private/grammar.y"
                            {
                 /* else-less if */
                 ((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst);     /* thenpart */
                 ((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst); 
                 }
-#line 1247 "engines/private/grammar.cpp"
+#line 1248 "engines/private/grammar.cpp"
     break;
 
   case 14: /* statement: if cond body end ELSETOK body end  */
-#line 98 "engines/private/grammar.y"
+#line 121 "engines/private/grammar.y"
                                             { 
                 /* if with else */
                 ((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst);     /* thenpart */
                 ((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst);     /* elsepart */
                 ((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst); 
                 }
-#line 1258 "engines/private/grammar.cpp"
+#line 1259 "engines/private/grammar.cpp"
     break;
 
   case 15: /* body: statement  */
-#line 106 "engines/private/grammar.y"
+#line 129 "engines/private/grammar.y"
                              { (yyval.inst) = (yyvsp[0].inst); }
-#line 1264 "engines/private/grammar.cpp"
+#line 1265 "engines/private/grammar.cpp"
     break;
 
   case 16: /* body: '{' statements '}'  */
-#line 107 "engines/private/grammar.y"
+#line 130 "engines/private/grammar.y"
                              { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1270 "engines/private/grammar.cpp"
+#line 1271 "engines/private/grammar.cpp"
     break;
 
   case 17: /* end: %empty  */
-#line 110 "engines/private/grammar.y"
+#line 133 "engines/private/grammar.y"
                              { code(STOP); (yyval.inst) = progp; }
-#line 1276 "engines/private/grammar.cpp"
+#line 1277 "engines/private/grammar.cpp"
     break;
 
   case 18: /* if: IFTOK  */
-#line 113 "engines/private/grammar.y"
+#line 136 "engines/private/grammar.y"
           { (yyval.inst) = code(ifcode); code3(STOP, STOP, STOP); }
-#line 1282 "engines/private/grammar.cpp"
+#line 1283 "engines/private/grammar.cpp"
     break;
 
   case 19: /* cond: '(' expr ')'  */
-#line 116 "engines/private/grammar.y"
+#line 139 "engines/private/grammar.y"
                         { code(STOP); (yyval.inst) = (yyvsp[-1].inst); }
-#line 1288 "engines/private/grammar.cpp"
+#line 1289 "engines/private/grammar.cpp"
     break;
 
   case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  */
-#line 120 "engines/private/grammar.y"
+#line 143 "engines/private/grammar.y"
                                                                         { 
           Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
           assert(r->isValidRect()); 
           defineSymbol((yyvsp[-13].s), r); 
           }
-#line 1298 "engines/private/grammar.cpp"
+#line 1299 "engines/private/grammar.cpp"
     break;
 
   case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
-#line 125 "engines/private/grammar.y"
+#line 148 "engines/private/grammar.y"
                                                             {
           Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);  
           defineSymbol((yyvsp[-11].s), r); 
           }
-#line 1307 "engines/private/grammar.cpp"
+#line 1308 "engines/private/grammar.cpp"
     break;
 
   case 23: /* define: NAME ',' define  */
-#line 129 "engines/private/grammar.y"
+#line 152 "engines/private/grammar.y"
                           { defineSymbol((yyvsp[-2].s), NULL); }
-#line 1313 "engines/private/grammar.cpp"
+#line 1314 "engines/private/grammar.cpp"
     break;
 
   case 24: /* define: NAME  */
-#line 130 "engines/private/grammar.y"
+#line 153 "engines/private/grammar.y"
                           { defineSymbol((yyvsp[0].s), NULL); }
-#line 1319 "engines/private/grammar.cpp"
+#line 1320 "engines/private/grammar.cpp"
     break;
 
   case 25: /* fcall: GOTOTOK '(' NAME ')'  */
-#line 133 "engines/private/grammar.y"
+#line 156 "engines/private/grammar.y"
                                {
                                (yyval.inst) = progp;
-                               code2(strpush, (Private::Inst) Private::constant(STRING, 0, (yyvsp[-1].s)));
-                               code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
-                               code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
+                               code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, (yyvsp[-1].s)));
+                               code2(constpush, (Private::Inst) g_private->maps.constant(NUM, 1, NULL));
+                               code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, "goto")); 
                                code1(funcpush);
                                }
-#line 1331 "engines/private/grammar.cpp"
+#line 1332 "engines/private/grammar.cpp"
     break;
 
   case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
-#line 141 "engines/private/grammar.y"
+#line 164 "engines/private/grammar.y"
                                                    { (yyval.inst) = progp; }
-#line 1337 "engines/private/grammar.cpp"
+#line 1338 "engines/private/grammar.cpp"
     break;
 
   case 27: /* fcall: NAME '(' startp params ')'  */
-#line 142 "engines/private/grammar.y"
+#line 165 "engines/private/grammar.y"
                                       {
                                (yyval.inst) = (yyvsp[-2].inst);
-                               code2(constpush, (Private::Inst) constant(NUM, (yyvsp[-1].narg), NULL));
-                               code2(strpush, (Private::Inst) constant(STRING, 0, (yyvsp[-4].s))); 
+                               code2(constpush, (Private::Inst) g_private->maps.constant(NUM, (yyvsp[-1].narg), NULL));
+                               code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, (yyvsp[-4].s))); 
                                code1(funcpush);
                                }
-#line 1348 "engines/private/grammar.cpp"
+#line 1349 "engines/private/grammar.cpp"
     break;
 
   case 28: /* startp: %empty  */
-#line 150 "engines/private/grammar.y"
+#line 173 "engines/private/grammar.y"
                     { (yyval.inst) = progp; }
-#line 1354 "engines/private/grammar.cpp"
+#line 1355 "engines/private/grammar.cpp"
     break;
 
   case 29: /* params: %empty  */
-#line 153 "engines/private/grammar.y"
+#line 176 "engines/private/grammar.y"
                             { (yyval.narg) = 0; }
-#line 1360 "engines/private/grammar.cpp"
+#line 1361 "engines/private/grammar.cpp"
     break;
 
   case 30: /* params: fcall ',' params  */
-#line 154 "engines/private/grammar.y"
+#line 177 "engines/private/grammar.y"
                             { (yyval.narg) = (yyvsp[0].narg) + 1; }
-#line 1366 "engines/private/grammar.cpp"
+#line 1367 "engines/private/grammar.cpp"
     break;
 
   case 31: /* params: expr ',' params  */
-#line 155 "engines/private/grammar.y"
+#line 178 "engines/private/grammar.y"
                             { (yyval.narg) = (yyvsp[0].narg) + 1; }
-#line 1372 "engines/private/grammar.cpp"
+#line 1373 "engines/private/grammar.cpp"
     break;
 
   case 32: /* params: expr  */
-#line 156 "engines/private/grammar.y"
+#line 179 "engines/private/grammar.y"
                       { (yyval.narg) = 1; }
-#line 1378 "engines/private/grammar.cpp"
+#line 1379 "engines/private/grammar.cpp"
     break;
 
   case 33: /* params: fcall  */
-#line 157 "engines/private/grammar.y"
+#line 180 "engines/private/grammar.y"
                       { (yyval.narg) = 1; }
-#line 1384 "engines/private/grammar.cpp"
+#line 1385 "engines/private/grammar.cpp"
     break;
 
   case 34: /* value: NULLTOK  */
-#line 160 "engines/private/grammar.y"
-                   { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
-#line 1390 "engines/private/grammar.cpp"
+#line 183 "engines/private/grammar.y"
+                   { code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 0, NULL)); }
+#line 1391 "engines/private/grammar.cpp"
     break;
 
   case 35: /* value: FALSETOK  */
-#line 161 "engines/private/grammar.y"
-                   { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
-#line 1396 "engines/private/grammar.cpp"
+#line 184 "engines/private/grammar.y"
+                   { code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 0, NULL)); }
+#line 1397 "engines/private/grammar.cpp"
     break;
 
   case 36: /* value: TRUETOK  */
-#line 162 "engines/private/grammar.y"
-                   { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 1, NULL)); }
-#line 1402 "engines/private/grammar.cpp"
+#line 185 "engines/private/grammar.y"
+                   { code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 1, NULL)); }
+#line 1403 "engines/private/grammar.cpp"
     break;
 
   case 37: /* value: NUM  */
-#line 163 "engines/private/grammar.y"
+#line 186 "engines/private/grammar.y"
                    { code2(Private::constpush, (Private::Inst)(yyvsp[0].sym)); }
-#line 1408 "engines/private/grammar.cpp"
+#line 1409 "engines/private/grammar.cpp"
     break;
 
   case 38: /* value: STRING  */
-#line 164 "engines/private/grammar.y"
+#line 187 "engines/private/grammar.y"
                    { code2(Private::strpush, (Private::Inst)(yyvsp[0].sym)); }
-#line 1414 "engines/private/grammar.cpp"
+#line 1415 "engines/private/grammar.cpp"
     break;
 
   case 39: /* value: NAME  */
-#line 165 "engines/private/grammar.y"
-                   { code1(Private::varpush); code1((Private::Inst) lookupName((yyvsp[0].s))); code1(Private::eval); }
-#line 1420 "engines/private/grammar.cpp"
+#line 188 "engines/private/grammar.y"
+                   { code1(Private::varpush); code1((Private::Inst) g_private->maps.lookupName((yyvsp[0].s))); code1(Private::eval); }
+#line 1421 "engines/private/grammar.cpp"
     break;
 
   case 40: /* expr: value  */
-#line 168 "engines/private/grammar.y"
+#line 191 "engines/private/grammar.y"
                           { (yyval.inst) = (yyvsp[0].inst); }
-#line 1426 "engines/private/grammar.cpp"
+#line 1427 "engines/private/grammar.cpp"
     break;
 
   case 41: /* expr: '!' value  */
-#line 169 "engines/private/grammar.y"
+#line 192 "engines/private/grammar.y"
                           { code1(Private::negate); (yyval.inst) = (yyvsp[0].inst); }
-#line 1432 "engines/private/grammar.cpp"
+#line 1433 "engines/private/grammar.cpp"
     break;
 
   case 42: /* expr: value EQ value  */
-#line 170 "engines/private/grammar.y"
+#line 193 "engines/private/grammar.y"
                           { code1(Private::eq); }
-#line 1438 "engines/private/grammar.cpp"
+#line 1439 "engines/private/grammar.cpp"
     break;
 
   case 43: /* expr: value NEQ value  */
-#line 171 "engines/private/grammar.y"
+#line 194 "engines/private/grammar.y"
                           { code1(Private::ne); }
-#line 1444 "engines/private/grammar.cpp"
+#line 1445 "engines/private/grammar.cpp"
     break;
 
   case 44: /* expr: value '+' value  */
-#line 172 "engines/private/grammar.y"
+#line 195 "engines/private/grammar.y"
                           { code1(Private::add); }
-#line 1450 "engines/private/grammar.cpp"
+#line 1451 "engines/private/grammar.cpp"
     break;
 
   case 45: /* expr: value '<' value  */
-#line 173 "engines/private/grammar.y"
+#line 196 "engines/private/grammar.y"
                           { code1(Private::lt); }
-#line 1456 "engines/private/grammar.cpp"
+#line 1457 "engines/private/grammar.cpp"
     break;
 
   case 46: /* expr: value '>' value  */
-#line 174 "engines/private/grammar.y"
+#line 197 "engines/private/grammar.y"
                           { code1(Private::gt); }
-#line 1462 "engines/private/grammar.cpp"
+#line 1463 "engines/private/grammar.cpp"
     break;
 
   case 47: /* expr: value LTE value  */
-#line 175 "engines/private/grammar.y"
+#line 198 "engines/private/grammar.y"
                           { code1(Private::le); }
-#line 1468 "engines/private/grammar.cpp"
+#line 1469 "engines/private/grammar.cpp"
     break;
 
   case 48: /* expr: value GTE value  */
-#line 176 "engines/private/grammar.y"
+#line 199 "engines/private/grammar.y"
                           { code1(Private::ge); }
-#line 1474 "engines/private/grammar.cpp"
+#line 1475 "engines/private/grammar.cpp"
     break;
 
   case 49: /* expr: value '+'  */
-#line 177 "engines/private/grammar.y"
+#line 200 "engines/private/grammar.y"
                           { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1480 "engines/private/grammar.cpp"
+#line 1481 "engines/private/grammar.cpp"
     break;
 
   case 50: /* expr: RANDOMTOK '(' NUM '%' ')'  */
-#line 178 "engines/private/grammar.y"
+#line 201 "engines/private/grammar.y"
                                     { code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool); }
-#line 1486 "engines/private/grammar.cpp"
+#line 1487 "engines/private/grammar.cpp"
     break;
 
 
-#line 1490 "engines/private/grammar.cpp"
+#line 1491 "engines/private/grammar.cpp"
 
       default: break;
     }
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 643ae20406..83650ee869 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -90,32 +90,32 @@ extern void call(char *, ArgArray);
 
 // Code Generation
 
-extern  Datum pop();
-extern  int push(Datum);
+Datum pop();
+int push(Datum);
 extern  Inst *progp;
 
 extern  Inst *code(Inst);
 extern  Inst *prog;
-extern  int eval();
-extern  int add();
-extern  int negate();
-extern  int power();
-extern  int assign();
-extern  int bltin();
-extern  int varpush();
-extern  int constpush();
-extern  int strpush();
-extern  int funcpush();
-extern  int print();
-extern  int ifcode();
-extern  int fail();
-extern  int lt();
-extern  int gt();
-extern  int le();
-extern  int ge();
-extern  int eq();
-extern  int ne();
-extern  int randbool();
+int eval();
+int add();
+int negate();
+int power();
+int assign();
+int bltin();
+int varpush();
+int constpush();
+int strpush();
+int funcpush();
+int print();
+int ifcode();
+int fail();
+int lt();
+int gt();
+int le();
+int ge();
+int eq();
+int ne();
+int randbool();
 
 // Code Execution
 
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 9e1ab1029a..8bf25fe61d 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -50,6 +50,7 @@
 
 %{
 
+#include "private/private.h"
 #include "private/grammar.h"
 
 #define code1(c1)       Private::code(c1);
@@ -92,7 +93,7 @@ lines:   line lines
        ;
 
 line:     DEBUGTOK '{' debug '}'             { /* Not used in the game */ }
-        | DEFINETOK NAME '{' define '}'      { installAll($NAME); }
+        | DEFINETOK NAME '{' define '}'      { g_private->maps.installAll($NAME); }
         | SETTINGTOK NAME '{' statements '}' { saveSetting($NAME); initSetting(); }
         ;
 
@@ -106,9 +107,9 @@ statements:  /* nothing */     { $$ = progp; }
 
 statement: GOTOTOK NAME ';' {
         $$ = progp;
-        code2(strpush, (Private::Inst) Private::constant(STRING, 0, $NAME));
-        code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
-        code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
+        code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, $NAME));
+        code2(constpush, (Private::Inst) g_private->maps.constant(NUM, 1, NULL));
+        code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, "goto")); 
         code1(funcpush);
         }
         | fcall ';'         { $$ = $1; }   
@@ -154,17 +155,17 @@ define:  /* nothing */
 
 fcall:    GOTOTOK '(' NAME ')' {
                                $$ = progp;
-                               code2(strpush, (Private::Inst) Private::constant(STRING, 0, $NAME));
-                               code2(constpush, (Private::Inst) Private::constant(NUM, 1, NULL));
-                               code2(strpush, (Private::Inst) Private::constant(STRING, 0, "goto")); 
+                               code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, $NAME));
+                               code2(constpush, (Private::Inst) g_private->maps.constant(NUM, 1, NULL));
+                               code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, "goto")); 
                                code1(funcpush);
                                }
 
         | RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' { $$ = progp; }
         | NAME '(' startp params ')'  {
                                $$ = $startp;
-                               code2(constpush, (Private::Inst) constant(NUM, $params, NULL));
-                               code2(strpush, (Private::Inst) constant(STRING, 0, $NAME)); 
+                               code2(constpush, (Private::Inst) g_private->maps.constant(NUM, $params, NULL));
+                               code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, $NAME)); 
                                code1(funcpush);
                                }
         ;
@@ -179,12 +180,12 @@ params:   /* nothing */     { $$ = 0; }
         | fcall       { $$ = 1; }
         ;
 
-value:    NULLTOK  { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
-        | FALSETOK { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 0, NULL)); }
-        | TRUETOK  { code2(Private::constpush, (Private::Inst) Private::constant(NUM, 1, NULL)); }
+value:    NULLTOK  { code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 0, NULL)); }
+        | FALSETOK { code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 0, NULL)); }
+        | TRUETOK  { code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 1, NULL)); }
         | NUM      { code2(Private::constpush, (Private::Inst)$NUM); }
         | STRING   { code2(Private::strpush, (Private::Inst)$STRING); }
-        | NAME     { code1(Private::varpush); code1((Private::Inst) lookupName($NAME)); code1(Private::eval); }
+        | NAME     { code1(Private::varpush); code1((Private::Inst) g_private->maps.lookupName($NAME)); code1(Private::eval); }
         ;
 
 expr:     value           { $$ = $1; } 
diff --git a/engines/private/lexer.cpp b/engines/private/lexer.cpp
index 3cd6e9914e..07780b847a 100644
--- a/engines/private/lexer.cpp
+++ b/engines/private/lexer.cpp
@@ -779,11 +779,12 @@ char *yytext;
 #line 31 "engines/private/lexer.l"
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
 
+#include "private/private.h"
 #include "private/grammar.h"
 #include "private/tokens.h"
 
-#line 785 "engines/private/lexer.cpp"
 #line 786 "engines/private/lexer.cpp"
+#line 787 "engines/private/lexer.cpp"
 
 #define INITIAL 0
 
@@ -1000,9 +1001,9 @@ YY_DECL
 		}
 
 	{
-#line 38 "engines/private/lexer.l"
+#line 39 "engines/private/lexer.l"
 
-#line 1005 "engines/private/lexer.cpp"
+#line 1006 "engines/private/lexer.cpp"
 
 	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
 		{
@@ -1057,121 +1058,121 @@ do_action:	/* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 39 "engines/private/lexer.l"
+#line 40 "engines/private/lexer.l"
 /* ignoring the comment */
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 40 "engines/private/lexer.l"
+#line 41 "engines/private/lexer.l"
 return LTE;
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 41 "engines/private/lexer.l"
+#line 42 "engines/private/lexer.l"
 return GTE;
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 42 "engines/private/lexer.l"
+#line 43 "engines/private/lexer.l"
 return NEQ;
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 43 "engines/private/lexer.l"
+#line 44 "engines/private/lexer.l"
 return EQ;
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 44 "engines/private/lexer.l"
+#line 45 "engines/private/lexer.l"
 return DEBUGTOK;
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 45 "engines/private/lexer.l"
+#line 46 "engines/private/lexer.l"
 return DEFINETOK;
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 46 "engines/private/lexer.l"
+#line 47 "engines/private/lexer.l"
 return SETTINGTOK;
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 47 "engines/private/lexer.l"
+#line 48 "engines/private/lexer.l"
 return IFTOK;
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 48 "engines/private/lexer.l"
+#line 49 "engines/private/lexer.l"
 return ELSETOK;
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 49 "engines/private/lexer.l"
+#line 50 "engines/private/lexer.l"
 return GOTOTOK;
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 50 "engines/private/lexer.l"
+#line 51 "engines/private/lexer.l"
 return RECT;
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 51 "engines/private/lexer.l"
+#line 52 "engines/private/lexer.l"
 return FALSETOK;
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 52 "engines/private/lexer.l"
+#line 53 "engines/private/lexer.l"
 return TRUETOK;
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 53 "engines/private/lexer.l"
+#line 54 "engines/private/lexer.l"
 return NULLTOK;
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 54 "engines/private/lexer.l"
+#line 55 "engines/private/lexer.l"
 return RANDOMTOK;
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 55 "engines/private/lexer.l"
-PRIVATE_lval.s = strdup(PRIVATE_text); return NAME;
+#line 56 "engines/private/lexer.l"
+PRIVATE_lval.s = scumm_strdup(PRIVATE_text); return NAME;
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 56 "engines/private/lexer.l"
-PRIVATE_lval.sym = Private::constant(NUM, atoi(PRIVATE_text), NULL); return NUM;
+#line 57 "engines/private/lexer.l"
+PRIVATE_lval.sym = Private::g_private->maps.constant(NUM, atoi(PRIVATE_text), NULL); return NUM;
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 57 "engines/private/lexer.l"
-PRIVATE_lval.sym = Private::constant(STRING, 0, scumm_strdup(PRIVATE_text)); return STRING;
+#line 58 "engines/private/lexer.l"
+PRIVATE_lval.sym = Private::g_private->maps.constant(STRING, 0, scumm_strdup(PRIVATE_text)); return STRING;
 	YY_BREAK
 case 20:
 /* rule 20 can match eol */
 YY_RULE_SETUP
-#line 58 "engines/private/lexer.l"
+#line 59 "engines/private/lexer.l"
 /* ignore return */;
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 59 "engines/private/lexer.l"
+#line 60 "engines/private/lexer.l"
 /* ignore whitespace */;
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 60 "engines/private/lexer.l"
+#line 61 "engines/private/lexer.l"
 return *yytext;
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 61 "engines/private/lexer.l"
+#line 62 "engines/private/lexer.l"
 ECHO;
 	YY_BREAK
-#line 1174 "engines/private/lexer.cpp"
+#line 1175 "engines/private/lexer.cpp"
 case YY_STATE_EOF(INITIAL):
 	yyterminate();
 
@@ -2177,7 +2178,7 @@ void yyfree (void * ptr )
 
 #define YYTABLES_NAME "yytables"
 
-#line 61 "engines/private/lexer.l"
+#line 62 "engines/private/lexer.l"
 
 
 namespace Private {
diff --git a/engines/private/lexer.l b/engines/private/lexer.l
index 9b39511db4..cf03181e9f 100644
--- a/engines/private/lexer.l
+++ b/engines/private/lexer.l
@@ -30,6 +30,7 @@
 %{
 #define FORBIDDEN_SYMBOL_ALLOW_ALL
 
+#include "private/private.h"
 #include "private/grammar.h"
 #include "private/tokens.h"
 
@@ -52,9 +53,9 @@ FALSE                   return FALSETOK;
 TRUE                    return TRUETOK;
 NULL                    return NULLTOK;
 Random                  return RANDOMTOK;
-[A-Za-z_][A-Za-z_0-9]*  PRIVATE_lval.s = strdup(PRIVATE_text); return NAME;
-[\-]?[0-9]+             PRIVATE_lval.sym = Private::constant(NUM, atoi(PRIVATE_text), NULL); return NUM;
-\"[^\"\r\n]*\"          PRIVATE_lval.sym = Private::constant(STRING, 0, scumm_strdup(PRIVATE_text)); return STRING;
+[A-Za-z_][A-Za-z_0-9]*  PRIVATE_lval.s = scumm_strdup(PRIVATE_text); return NAME;
+[\-]?[0-9]+             PRIVATE_lval.sym = Private::g_private->maps.constant(NUM, atoi(PRIVATE_text), NULL); return NUM;
+\"[^\"\r\n]*\"          PRIVATE_lval.sym = Private::g_private->maps.constant(STRING, 0, scumm_strdup(PRIVATE_text)); return STRING;
 [\r|\n]+                /* ignore return */;
 [ \t]+                  /* ignore whitespace */;
 .                       return *yytext;
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 36cd2980b8..d87d49ba95 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -304,7 +304,7 @@ void PrivateEngine::clearAreas() {
 
 void PrivateEngine::startPoliceBust() {
     // This logic was extracted from the binary
-    int policeIndex = variables.getVal(kPoliceIndex)->u.val;
+    int policeIndex = maps.variables.getVal(kPoliceIndex)->u.val;
     int r = _rnd->getRandomNumber(0xc);
     if (policeIndex > 0x14) {
         policeIndex = 0x15;
@@ -331,7 +331,7 @@ void PrivateEngine::checkPoliceBust() {
     }
 
     if (_numberClicks == _maxNumberClicks+1) {
-        uint policeIndex = variables.getVal(kPoliceIndex)->u.val;
+        uint policeIndex = maps.variables.getVal(kPoliceIndex)->u.val;
         _policeBustSetting = _currentSetting;
         if (policeIndex <= 13) {
             _nextSetting = new Common::String(kPOGoBustMovie);
@@ -627,14 +627,14 @@ void PrivateEngine::restartGame() {
     debugC(1, kPrivateDebugFunction, "restartGame");
 
     for (NameList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
-        Private::Symbol *sym = variables.getVal(*it);
+        Private::Symbol *sym = maps.variables.getVal(*it);
         if (*(sym->name) != "kAlternateGame")
             sym->u.val = 0;
     }
 
     // Diary
     for (NameList::iterator it = locationList.begin(); it != locationList.end(); ++it) {
-        Private::Symbol *sym = locations.getVal(*it);
+        Private::Symbol *sym = maps.locations.getVal(*it);
         sym->u.val = 0;
     }
     inventory.clear();
@@ -660,14 +660,14 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
 
     for (NameList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
         s.syncAsUint32LE(val);
-        Private::Symbol *sym = variables.getVal(*it);
+        Private::Symbol *sym = maps.variables.getVal(*it);
         sym->u.val = val;
     }
 
     // Diary
     for (NameList::iterator it = locationList.begin(); it != locationList.end(); ++it) {
         s.syncAsUint32LE(val);
-        Private::Symbol *sym = locations.getVal(*it);
+        Private::Symbol *sym = maps.locations.getVal(*it);
         sym->u.val = val;
     }
     uint32 size = stream->readUint32LE();
@@ -715,7 +715,7 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
         PhoneInfo *i = (PhoneInfo *)malloc(sizeof(PhoneInfo));
 
         i->sound = new Common::String(stream->readString());
-        i->flag  = variables.getVal(stream->readString());
+        i->flag  = maps.variables.getVal(stream->readString());
         i->val   = stream->readUint32LE();
         _phone.push_back(*i);
     }
@@ -744,13 +744,13 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
 
     // Variables
     for (NameList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
-        Private::Symbol *sym = variables.getVal(*it);
+        Private::Symbol *sym = maps.variables.getVal(*it);
         stream->writeUint32LE(sym->u.val);
     }
 
     // Diary
     for (NameList::iterator it = locationList.begin(); it != locationList.end(); ++it) {
-        Private::Symbol *sym = locations.getVal(*it);
+        Private::Symbol *sym = maps.locations.getVal(*it);
         stream->writeUint32LE(sym->u.val);
     }
 
@@ -1029,7 +1029,7 @@ void PrivateEngine::loadLocations(Common::Rect *rect) {
     uint32 i = 0;
     int16 offset = 44;
     for (NameList::iterator it = locationList.begin(); it != locationList.end(); ++it) {
-        Private::Symbol *sym = locations.getVal(*it);
+        Private::Symbol *sym = maps.locations.getVal(*it);
         i++;
         if (sym->u.val) {
             offset = offset + 22;
diff --git a/engines/private/private.h b/engines/private/private.h
index 1505b6f8f4..ba358c8ee9 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -133,6 +133,8 @@ public:
     const ADGameDescription *_gameDescription;
     bool isDemo() const;
 
+    SymbolMaps maps;
+
     Audio::SoundHandle _fgSoundHandle;
     Audio::SoundHandle _bgSoundHandle;
     Video::SmackerDecoder *_videoDecoder;
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index b63f10e1ba..c1fff84217 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -50,7 +50,6 @@
 
 namespace Private {
 
-SymbolMap settings, variables, cursors, locations, rects;
 ConstantList constants;
 NameList variableList;
 NameList locationList;
@@ -86,7 +85,7 @@ Symbol *lookup(Common::String s, SymbolMap symlist) {
 }
 
 /* lookup some name in some symbol table */
-Symbol *lookupName(char *n) {
+Symbol *SymbolMaps::lookupName(char *n) {
     //debug("looking up %s", n);
     Common::String *s = new Common::String(n);
 
@@ -109,10 +108,9 @@ Symbol *lookupName(char *n) {
         debugC(1, kPrivateDebugCode, "WARNING: %s not defined", s->c_str());
         return constant(STRING, 0, (char *)s->c_str());
     }
-
 }
 
-void installAll(char *n) {
+void SymbolMaps::installAll(char *n) {
     Common::String *s;
     Common::Rect *r;
 
@@ -145,7 +143,7 @@ void installAll(char *n) {
     }
 }
 
-Symbol *constant(int t, int d, char *s) {
+Symbol *SymbolMaps::constant(int t, int d, char *s) {
     Symbol *sp;
     Common::String *n = new Common::String("<constant>");
 
diff --git a/engines/private/symbol.h b/engines/private/symbol.h
index 2301f25286..2eca241540 100644
--- a/engines/private/symbol.h
+++ b/engines/private/symbol.h
@@ -45,24 +45,33 @@ typedef struct Symbol {     /* symbol table entry */
 
 // Symbols
 
-extern void showSymbol(Symbol *);
+//extern void showSymbol(Symbol *);
 extern void setSymbol(Symbol *, int);
 
 typedef Common::HashMap<Common::String, Symbol *> SymbolMap;
 typedef Common::List<Common::String> NameList;
 typedef Common::List<Symbol *> ConstantList;
 
-extern SymbolMap settings, variables, cursors, locations, rects;
+class SymbolMaps {
+    public:
+    SymbolMap settings; 
+    SymbolMap variables;
+    SymbolMap cursors;
+    SymbolMap locations;
+    SymbolMap rects;
+
+    Symbol *constant(int t, int d, char *s);
+    Symbol *lookupName(char *n);
+    void installAll(char *n);
+};
+
+//extern SymbolMap settings, variables, cursors, locations, rects;
 extern ConstantList constants;
 extern NameList variableList;
 extern NameList locationList;
 
 extern void     defineSymbol(char *, Common::Rect *);
 extern Symbol  *install(Common::String *, int, int, char *, Common::Rect *, SymbolMap *);
-extern Symbol  *lookupName(char *);
-extern Symbol  *constant(int, int, char *);
-extern void     installAll(char *);
-extern Symbol  *lookup(Common::String, SymbolMap);
 
 } // End of namespace Private
 
diff --git a/engines/private/tokens.h b/engines/private/tokens.h
index 3a837478c2..1e3e25462e 100644
--- a/engines/private/tokens.h
+++ b/engines/private/tokens.h
@@ -88,7 +88,7 @@ extern int PRIVATE_debug;
 #if ! defined PRIVATE_STYPE && ! defined PRIVATE_STYPE_IS_DECLARED
 union PRIVATE_STYPE
 {
-#line 52 "engines/private/grammar.y"
+#line 75 "engines/private/grammar.y"
 
         Private::Symbol *sym; /* symbol table pointer */
         int (**inst)();       /* machine instruction */


Commit: 21b9c93fab8f1fb97709d9a1c8abfb55cf9fc882
    https://github.com/scummvm/scummvm/commit/21b9c93fab8f1fb97709d9a1c8abfb55cf9fc882
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: second step to use classes and avoid external

Changed paths:
    engines/private/grammar.cpp
    engines/private/grammar.h
    engines/private/grammar.y
    engines/private/private.cpp
    engines/private/symbol.cpp
    engines/private/symbol.h


diff --git a/engines/private/grammar.cpp b/engines/private/grammar.cpp
index 32751a3960..67a0e49d49 100644
--- a/engines/private/grammar.cpp
+++ b/engines/private/grammar.cpp
@@ -1293,7 +1293,7 @@ yyreduce:
                                                                         { 
           Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
           assert(r->isValidRect()); 
-          defineSymbol((yyvsp[-13].s), r); 
+          g_private->maps.defineSymbol((yyvsp[-13].s), r); 
           }
 #line 1299 "engines/private/grammar.cpp"
     break;
@@ -1302,20 +1302,20 @@ yyreduce:
 #line 148 "engines/private/grammar.y"
                                                             {
           Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);  
-          defineSymbol((yyvsp[-11].s), r); 
+          g_private->maps.defineSymbol((yyvsp[-11].s), r); 
           }
 #line 1308 "engines/private/grammar.cpp"
     break;
 
   case 23: /* define: NAME ',' define  */
 #line 152 "engines/private/grammar.y"
-                          { defineSymbol((yyvsp[-2].s), NULL); }
+                          { g_private->maps.defineSymbol((yyvsp[-2].s), NULL); }
 #line 1314 "engines/private/grammar.cpp"
     break;
 
   case 24: /* define: NAME  */
 #line 153 "engines/private/grammar.y"
-                          { defineSymbol((yyvsp[0].s), NULL); }
+                          { g_private->maps.defineSymbol((yyvsp[0].s), NULL); }
 #line 1320 "engines/private/grammar.cpp"
     break;
 
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 83650ee869..4a15bdc7e9 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -80,8 +80,7 @@ typedef struct Setting {
 extern Setting *psetting;
 
 typedef Common::HashMap<Common::String, Setting *> SettingMap;
-typedef Common::Queue<Common::String> StringQueue;
-typedef Common::Queue<Common::Rect *> RectQueue;
+
 
 // Funtions
 
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 8bf25fe61d..5881d9a433 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -143,14 +143,14 @@ define:  /* nothing */
         | NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  { 
           Common::Rect *r = new Common::Rect($5->u.val, $7->u.val, $9->u.val, $11->u.val);
           assert(r->isValidRect()); 
-          defineSymbol($NAME, r); 
+          g_private->maps.defineSymbol($NAME, r); 
           }
         | NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' {
           Common::Rect *r = new Common::Rect($5->u.val, $7->u.val, $9->u.val, $11->u.val);  
-          defineSymbol($NAME, r); 
+          g_private->maps.defineSymbol($NAME, r); 
           }
-        | NAME ',' define { defineSymbol($NAME, NULL); }
-        | NAME            { defineSymbol($NAME, NULL); }  
+        | NAME ',' define { g_private->maps.defineSymbol($NAME, NULL); }
+        | NAME            { g_private->maps.defineSymbol($NAME, NULL); }  
         ;
 
 fcall:    GOTOTOK '(' NAME ')' {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index d87d49ba95..ce2fc5f1f2 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -158,7 +158,7 @@ Common::Error PrivateEngine::run() {
     parse(buf);
     free(buf);
     delete file;
-    assert(constants.size() > 0);
+    assert(maps.constants.size() > 0);
 
     // Initialize graphics
     _screenW = 640;
@@ -626,14 +626,14 @@ bool PrivateEngine::hasFeature(EngineFeature f) const {
 void PrivateEngine::restartGame() {
     debugC(1, kPrivateDebugFunction, "restartGame");
 
-    for (NameList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
+    for (NameList::iterator it = maps.variableList.begin(); it != maps.variableList.end(); ++it) {
         Private::Symbol *sym = maps.variables.getVal(*it);
         if (*(sym->name) != "kAlternateGame")
             sym->u.val = 0;
     }
 
     // Diary
-    for (NameList::iterator it = locationList.begin(); it != locationList.end(); ++it) {
+    for (NameList::iterator it = maps.locationList.begin(); it != maps.locationList.end(); ++it) {
         Private::Symbol *sym = maps.locations.getVal(*it);
         sym->u.val = 0;
     }
@@ -658,14 +658,14 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
     _nextSetting = new Common::String(kStartGame);
     int val;
 
-    for (NameList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
+    for (NameList::iterator it = maps.variableList.begin(); it != maps.variableList.end(); ++it) {
         s.syncAsUint32LE(val);
         Private::Symbol *sym = maps.variables.getVal(*it);
         sym->u.val = val;
     }
 
     // Diary
-    for (NameList::iterator it = locationList.begin(); it != locationList.end(); ++it) {
+    for (NameList::iterator it = maps.locationList.begin(); it != maps.locationList.end(); ++it) {
         s.syncAsUint32LE(val);
         Private::Symbol *sym = maps.locations.getVal(*it);
         sym->u.val = val;
@@ -743,13 +743,13 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
         return Common::kNoError;
 
     // Variables
-    for (NameList::iterator it = variableList.begin(); it != variableList.end(); ++it) {
+    for (NameList::iterator it = maps.variableList.begin(); it != maps.variableList.end(); ++it) {
         Private::Symbol *sym = maps.variables.getVal(*it);
         stream->writeUint32LE(sym->u.val);
     }
 
     // Diary
-    for (NameList::iterator it = locationList.begin(); it != locationList.end(); ++it) {
+    for (NameList::iterator it = maps.locationList.begin(); it != maps.locationList.end(); ++it) {
         Private::Symbol *sym = maps.locations.getVal(*it);
         stream->writeUint32LE(sym->u.val);
     }
@@ -1028,7 +1028,7 @@ void PrivateEngine::removeTimer() {
 void PrivateEngine::loadLocations(Common::Rect *rect) {
     uint32 i = 0;
     int16 offset = 44;
-    for (NameList::iterator it = locationList.begin(); it != locationList.end(); ++it) {
+    for (NameList::iterator it = maps.locationList.begin(); it != maps.locationList.end(); ++it) {
         Private::Symbol *sym = maps.locations.getVal(*it);
         i++;
         if (sym->u.val) {
diff --git a/engines/private/symbol.cpp b/engines/private/symbol.cpp
index c1fff84217..f39a451ff5 100644
--- a/engines/private/symbol.cpp
+++ b/engines/private/symbol.cpp
@@ -50,14 +50,7 @@
 
 namespace Private {
 
-ConstantList constants;
-NameList variableList;
-NameList locationList;
-
-StringQueue stringToDefine;
-RectQueue rectToDefine;
-
-void defineSymbol(char *n, Common::Rect *r) {
+void SymbolMaps::defineSymbol(char *n, Common::Rect *r) {
     Common::String *s = new Common::String(n);
     stringToDefine.push(*s);
     rectToDefine.push(r);
@@ -84,6 +77,29 @@ Symbol *lookup(Common::String s, SymbolMap symlist) {
     return r;
 }
 
+/* install some symbol s in a symbol table */
+Symbol *install(Common::String *n, int t, int d, char *s, Common::Rect *r, SymbolMap *symlist) {
+    Common::String *name = new Common::String(*n);
+
+    Symbol *sp;
+
+    sp = (Symbol *)malloc(sizeof(Symbol));
+    sp->name = name;
+    sp->type = t;
+    if (t == NUM || t == NAME)
+        sp->u.val = d;
+    else if (t == STRING)
+        sp->u.str = s;
+    else if (t == RECT)
+        sp->u.rect = r;
+    else
+        assert(0);
+
+    symlist->setVal(*n, sp);
+    assert(symlist->size() > 0);
+    return sp;
+}
+
 /* lookup some name in some symbol table */
 Symbol *SymbolMaps::lookupName(char *n) {
     //debug("looking up %s", n);
@@ -161,27 +177,4 @@ Symbol *SymbolMaps::constant(int t, int d, char *s) {
     return sp;
 }
 
-/* install some symbol s in a symbol table */
-Symbol *install(Common::String *n, int t, int d, char *s, Common::Rect *r, SymbolMap *symlist) {
-    Common::String *name = new Common::String(*n);
-
-    Symbol *sp;
-
-    sp = (Symbol *)malloc(sizeof(Symbol));
-    sp->name = name;
-    sp->type = t;
-    if (t == NUM || t == NAME)
-        sp->u.val = d;
-    else if (t == STRING)
-        sp->u.str = s;
-    else if (t == RECT)
-        sp->u.rect = r;
-    else
-        assert(0);
-
-    symlist->setVal(*n, sp);
-    assert(symlist->size() > 0);
-    return sp;
-}
-
 } // End of namespace Private
diff --git a/engines/private/symbol.h b/engines/private/symbol.h
index 2eca241540..04df249c4f 100644
--- a/engines/private/symbol.h
+++ b/engines/private/symbol.h
@@ -46,33 +46,37 @@ typedef struct Symbol {     /* symbol table entry */
 // Symbols
 
 //extern void showSymbol(Symbol *);
-extern void setSymbol(Symbol *, int);
+void setSymbol(Symbol *, int);
 
 typedef Common::HashMap<Common::String, Symbol *> SymbolMap;
 typedef Common::List<Common::String> NameList;
 typedef Common::List<Symbol *> ConstantList;
 
+typedef Common::Queue<Common::String> StringQueue;
+typedef Common::Queue<Common::Rect *> RectQueue;
+
 class SymbolMaps {
+    private:
+    StringQueue stringToDefine;
+    RectQueue rectToDefine;
+
     public:
     SymbolMap settings; 
     SymbolMap variables;
     SymbolMap cursors;
     SymbolMap locations;
     SymbolMap rects;
+    ConstantList constants;
+    
+    NameList variableList;
+    NameList locationList;
 
     Symbol *constant(int t, int d, char *s);
     Symbol *lookupName(char *n);
     void installAll(char *n);
+    void defineSymbol(char *, Common::Rect *);
 };
 
-//extern SymbolMap settings, variables, cursors, locations, rects;
-extern ConstantList constants;
-extern NameList variableList;
-extern NameList locationList;
-
-extern void     defineSymbol(char *, Common::Rect *);
-extern Symbol  *install(Common::String *, int, int, char *, Common::Rect *, SymbolMap *);
-
 } // End of namespace Private
 
 #endif


Commit: 570a38ab040323bd1e92940c2a00fc7056406739
    https://github.com/scummvm/scummvm/commit/570a38ab040323bd1e92940c2a00fc7056406739
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: removed more extern

Changed paths:
    engines/private/grammar.h
    engines/private/symbol.h


diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 4a15bdc7e9..8596a3b1af 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -48,7 +48,6 @@ typedef struct Datum {  /* interpreter stack type */
     } u;
 } Datum;
 
-
 typedef struct Arg {
     int n;
     int (** inst)();
@@ -60,9 +59,8 @@ typedef int (* Inst)();  /* machine instruction */
 typedef Common::HashMap<void *, Common::String *> PtrToName;
 typedef Common::HashMap<Common::String, void *> NameToPtr;
 
-extern void initInsts();
-extern void initFuncs();
-
+void initInsts();
+void initFuncs();
 
 typedef struct Setting {
 
@@ -81,7 +79,6 @@ extern Setting *psetting;
 
 typedef Common::HashMap<Common::String, Setting *> SettingMap;
 
-
 // Funtions
 
 typedef Common::Array<Datum> ArgArray;
@@ -118,11 +115,11 @@ int randbool();
 
 // Code Execution
 
-extern void initSetting();
-extern void saveSetting(char *);
-extern void loadSetting(Common::String *);
+void initSetting();
+void saveSetting(char *);
+void loadSetting(Common::String *);
 
-extern void execute(Inst *);
+void execute(Inst *);
 
 } // End of namespace Private
 
diff --git a/engines/private/symbol.h b/engines/private/symbol.h
index 04df249c4f..c149ee4b62 100644
--- a/engines/private/symbol.h
+++ b/engines/private/symbol.h
@@ -45,7 +45,6 @@ typedef struct Symbol {     /* symbol table entry */
 
 // Symbols
 
-//extern void showSymbol(Symbol *);
 void setSymbol(Symbol *, int);
 
 typedef Common::HashMap<Common::String, Symbol *> SymbolMap;


Commit: d0e43c93b5f465c2481fc5f34946b20dc11a2aac
    https://github.com/scummvm/scummvm/commit/d0e43c93b5f465c2481fc5f34946b20dc11a2aac
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: use more classes and avoid external

Changed paths:
    engines/private/code.cpp
    engines/private/grammar.cpp
    engines/private/grammar.h
    engines/private/grammar.y
    engines/private/lexer.cpp
    engines/private/lexer.l
    engines/private/private.cpp
    engines/private/private.h
    engines/private/tokens.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 2a86be5bb4..9357cf3800 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -53,9 +53,6 @@
 
 namespace Private {
 
-Setting *setting;
-SettingMap settingMap;
-
 Datum *stack  = NULL; /* the stack */
 Datum *stackp = NULL; /* next free spot on stack */
 
@@ -89,8 +86,8 @@ void initInsts() {
     }
 }
 
-/* initialize for code generation */
-void initSetting() {
+/* initialize setting for code generation */
+void SettingMaps::init() {
     setting = (Setting *)malloc(sizeof(Setting));
     memset((void *)setting, 0, sizeof(Setting));
 
@@ -101,14 +98,13 @@ void initSetting() {
     progp = prog;
 }
 
-void saveSetting(char *name) {
-    //Common::String s(name);
-    settingMap.setVal(name, setting);
+void SettingMaps::save(char *name) {
+    map.setVal(name, setting);
 }
 
-void loadSetting(Common::String *name) {
-    assert(settingMap.contains(*name));
-    setting = settingMap.getVal(*name);
+void SettingMaps::load(Common::String *name) {
+    assert(map.contains(*name));
+    setting = map.getVal(*name);
 
     debugC(1, kPrivateDebugCode, "loading setting %s", name->c_str());
 
@@ -155,7 +151,6 @@ int strpush() { /* push constant onto stack */
     return 0;
 }
 
-
 int varpush() { /* push variable onto stack */
     Datum d;
     d.type = NAME;
@@ -287,7 +282,6 @@ int lt() {
         d2.type = NUM;
     }
 
-
     d1.u.val = (int)(d1.u.val < d2.u.val);
     push(d1);
     return 0;
@@ -311,7 +305,6 @@ int ge() {
         d2.type = NUM;
     }
 
-
     d1.u.val = (int)(d1.u.val >= d2.u.val);
     push(d1);
     return 0;
@@ -335,7 +328,6 @@ int le() {
         d2.type = NUM;
     }
 
-
     d1.u.val = (int)(d1.u.val <= d2.u.val);
     push(d1);
     return 0;
@@ -359,7 +351,6 @@ int eq() {
         d2.type = NUM;
     }
 
-
     d1.u.val = (int)(d1.u.val == d2.u.val);
     push(d1);
     return 0;
@@ -379,7 +370,6 @@ int ne() {
         d2.type = NUM;
     }
 
-
     d1.u.val = (int)(d1.u.val != d2.u.val);
     push(d1);
     return 0;
diff --git a/engines/private/grammar.cpp b/engines/private/grammar.cpp
index 67a0e49d49..25ed01107d 100644
--- a/engines/private/grammar.cpp
+++ b/engines/private/grammar.cpp
@@ -68,7 +68,7 @@
 /* Substitute the variable and function names.  */
 #define yyparse         PRIVATE_parse
 #define yylex           PRIVATE_lex
-#define yyerror         PRIVATE_xerror
+#define yyerror         PRIVATE_error
 #define yydebug         PRIVATE_debug
 #define yynerrs         PRIVATE_nerrs
 #define yylval          PRIVATE_lval
@@ -81,6 +81,9 @@
 #include "private/private.h"
 #include "private/grammar.h"
 
+#undef yyerror
+#define yyerror         PRIVATE_xerror
+
 #define code1(c1)       Private::code(c1);
 #define code2(c1,c2)    Private::code(c1); Private::code(c2)
 #define code3(c1,c2,c3) Private::code(c1); Private::code(c2); Private::code(c3)
@@ -99,7 +102,7 @@ int PRIVATE_wrap() {
 
 
 
-#line 103 "engines/private/grammar.cpp"
+#line 106 "engines/private/grammar.cpp"
 
 # ifndef YY_CAST
 #  ifdef __cplusplus
@@ -544,12 +547,12 @@ static const yytype_int8 yytranslate[] =
   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
-       0,    91,    91,    92,    95,    96,    97,   100,   101,   104,
-     105,   108,   115,   116,   121,   129,   130,   133,   136,   139,
-     142,   143,   148,   152,   153,   156,   164,   165,   173,   176,
-     177,   178,   179,   180,   183,   184,   185,   186,   187,   188,
-     191,   192,   193,   194,   195,   196,   197,   198,   199,   200,
-     201
+       0,    94,    94,    95,    98,    99,   100,   104,   105,   108,
+     109,   112,   119,   120,   125,   133,   134,   137,   140,   143,
+     146,   147,   152,   156,   157,   160,   168,   169,   177,   180,
+     181,   182,   183,   184,   187,   188,   189,   190,   191,   192,
+     195,   196,   197,   198,   199,   200,   201,   202,   203,   204,
+     205
 };
 #endif
 
@@ -1196,31 +1199,32 @@ yyreduce:
   switch (yyn)
     {
   case 4: /* line: DEBUGTOK '{' debug '}'  */
-#line 95 "engines/private/grammar.y"
+#line 98 "engines/private/grammar.y"
                                              { /* Not used in the game */ }
-#line 1202 "engines/private/grammar.cpp"
+#line 1205 "engines/private/grammar.cpp"
     break;
 
   case 5: /* line: DEFINETOK NAME '{' define '}'  */
-#line 96 "engines/private/grammar.y"
+#line 99 "engines/private/grammar.y"
                                              { g_private->maps.installAll((yyvsp[-3].s)); }
-#line 1208 "engines/private/grammar.cpp"
+#line 1211 "engines/private/grammar.cpp"
     break;
 
   case 6: /* line: SETTINGTOK NAME '{' statements '}'  */
-#line 97 "engines/private/grammar.y"
-                                             { saveSetting((yyvsp[-3].s)); initSetting(); }
-#line 1214 "engines/private/grammar.cpp"
+#line 100 "engines/private/grammar.y"
+                                             { g_private->settings.save((yyvsp[-3].s)); 
+                                               g_private->settings.init(); }
+#line 1218 "engines/private/grammar.cpp"
     break;
 
   case 9: /* statements: %empty  */
-#line 104 "engines/private/grammar.y"
+#line 108 "engines/private/grammar.y"
                                { (yyval.inst) = progp; }
-#line 1220 "engines/private/grammar.cpp"
+#line 1224 "engines/private/grammar.cpp"
     break;
 
   case 11: /* statement: GOTOTOK NAME ';'  */
-#line 108 "engines/private/grammar.y"
+#line 112 "engines/private/grammar.y"
                             {
         (yyval.inst) = progp;
         code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, (yyvsp[-1].s)));
@@ -1228,99 +1232,99 @@ yyreduce:
         code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, "goto")); 
         code1(funcpush);
         }
-#line 1232 "engines/private/grammar.cpp"
+#line 1236 "engines/private/grammar.cpp"
     break;
 
   case 12: /* statement: fcall ';'  */
-#line 115 "engines/private/grammar.y"
+#line 119 "engines/private/grammar.y"
                             { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1238 "engines/private/grammar.cpp"
+#line 1242 "engines/private/grammar.cpp"
     break;
 
   case 13: /* statement: if cond body end  */
-#line 116 "engines/private/grammar.y"
+#line 120 "engines/private/grammar.y"
                            {
                 /* else-less if */
                 ((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst);     /* thenpart */
                 ((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst); 
                 }
-#line 1248 "engines/private/grammar.cpp"
+#line 1252 "engines/private/grammar.cpp"
     break;
 
   case 14: /* statement: if cond body end ELSETOK body end  */
-#line 121 "engines/private/grammar.y"
+#line 125 "engines/private/grammar.y"
                                             { 
                 /* if with else */
                 ((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst);     /* thenpart */
                 ((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst);     /* elsepart */
                 ((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst); 
                 }
-#line 1259 "engines/private/grammar.cpp"
+#line 1263 "engines/private/grammar.cpp"
     break;
 
   case 15: /* body: statement  */
-#line 129 "engines/private/grammar.y"
+#line 133 "engines/private/grammar.y"
                              { (yyval.inst) = (yyvsp[0].inst); }
-#line 1265 "engines/private/grammar.cpp"
+#line 1269 "engines/private/grammar.cpp"
     break;
 
   case 16: /* body: '{' statements '}'  */
-#line 130 "engines/private/grammar.y"
+#line 134 "engines/private/grammar.y"
                              { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1271 "engines/private/grammar.cpp"
+#line 1275 "engines/private/grammar.cpp"
     break;
 
   case 17: /* end: %empty  */
-#line 133 "engines/private/grammar.y"
+#line 137 "engines/private/grammar.y"
                              { code(STOP); (yyval.inst) = progp; }
-#line 1277 "engines/private/grammar.cpp"
+#line 1281 "engines/private/grammar.cpp"
     break;
 
   case 18: /* if: IFTOK  */
-#line 136 "engines/private/grammar.y"
+#line 140 "engines/private/grammar.y"
           { (yyval.inst) = code(ifcode); code3(STOP, STOP, STOP); }
-#line 1283 "engines/private/grammar.cpp"
+#line 1287 "engines/private/grammar.cpp"
     break;
 
   case 19: /* cond: '(' expr ')'  */
-#line 139 "engines/private/grammar.y"
+#line 143 "engines/private/grammar.y"
                         { code(STOP); (yyval.inst) = (yyvsp[-1].inst); }
-#line 1289 "engines/private/grammar.cpp"
+#line 1293 "engines/private/grammar.cpp"
     break;
 
   case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  */
-#line 143 "engines/private/grammar.y"
+#line 147 "engines/private/grammar.y"
                                                                         { 
           Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
           assert(r->isValidRect()); 
           g_private->maps.defineSymbol((yyvsp[-13].s), r); 
           }
-#line 1299 "engines/private/grammar.cpp"
+#line 1303 "engines/private/grammar.cpp"
     break;
 
   case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
-#line 148 "engines/private/grammar.y"
+#line 152 "engines/private/grammar.y"
                                                             {
           Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);  
           g_private->maps.defineSymbol((yyvsp[-11].s), r); 
           }
-#line 1308 "engines/private/grammar.cpp"
+#line 1312 "engines/private/grammar.cpp"
     break;
 
   case 23: /* define: NAME ',' define  */
-#line 152 "engines/private/grammar.y"
+#line 156 "engines/private/grammar.y"
                           { g_private->maps.defineSymbol((yyvsp[-2].s), NULL); }
-#line 1314 "engines/private/grammar.cpp"
+#line 1318 "engines/private/grammar.cpp"
     break;
 
   case 24: /* define: NAME  */
-#line 153 "engines/private/grammar.y"
+#line 157 "engines/private/grammar.y"
                           { g_private->maps.defineSymbol((yyvsp[0].s), NULL); }
-#line 1320 "engines/private/grammar.cpp"
+#line 1324 "engines/private/grammar.cpp"
     break;
 
   case 25: /* fcall: GOTOTOK '(' NAME ')'  */
-#line 156 "engines/private/grammar.y"
+#line 160 "engines/private/grammar.y"
                                {
                                (yyval.inst) = progp;
                                code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, (yyvsp[-1].s)));
@@ -1328,166 +1332,166 @@ yyreduce:
                                code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, "goto")); 
                                code1(funcpush);
                                }
-#line 1332 "engines/private/grammar.cpp"
+#line 1336 "engines/private/grammar.cpp"
     break;
 
   case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
-#line 164 "engines/private/grammar.y"
+#line 168 "engines/private/grammar.y"
                                                    { (yyval.inst) = progp; }
-#line 1338 "engines/private/grammar.cpp"
+#line 1342 "engines/private/grammar.cpp"
     break;
 
   case 27: /* fcall: NAME '(' startp params ')'  */
-#line 165 "engines/private/grammar.y"
+#line 169 "engines/private/grammar.y"
                                       {
                                (yyval.inst) = (yyvsp[-2].inst);
                                code2(constpush, (Private::Inst) g_private->maps.constant(NUM, (yyvsp[-1].narg), NULL));
                                code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, (yyvsp[-4].s))); 
                                code1(funcpush);
                                }
-#line 1349 "engines/private/grammar.cpp"
+#line 1353 "engines/private/grammar.cpp"
     break;
 
   case 28: /* startp: %empty  */
-#line 173 "engines/private/grammar.y"
+#line 177 "engines/private/grammar.y"
                     { (yyval.inst) = progp; }
-#line 1355 "engines/private/grammar.cpp"
+#line 1359 "engines/private/grammar.cpp"
     break;
 
   case 29: /* params: %empty  */
-#line 176 "engines/private/grammar.y"
+#line 180 "engines/private/grammar.y"
                             { (yyval.narg) = 0; }
-#line 1361 "engines/private/grammar.cpp"
+#line 1365 "engines/private/grammar.cpp"
     break;
 
   case 30: /* params: fcall ',' params  */
-#line 177 "engines/private/grammar.y"
+#line 181 "engines/private/grammar.y"
                             { (yyval.narg) = (yyvsp[0].narg) + 1; }
-#line 1367 "engines/private/grammar.cpp"
+#line 1371 "engines/private/grammar.cpp"
     break;
 
   case 31: /* params: expr ',' params  */
-#line 178 "engines/private/grammar.y"
+#line 182 "engines/private/grammar.y"
                             { (yyval.narg) = (yyvsp[0].narg) + 1; }
-#line 1373 "engines/private/grammar.cpp"
+#line 1377 "engines/private/grammar.cpp"
     break;
 
   case 32: /* params: expr  */
-#line 179 "engines/private/grammar.y"
+#line 183 "engines/private/grammar.y"
                       { (yyval.narg) = 1; }
-#line 1379 "engines/private/grammar.cpp"
+#line 1383 "engines/private/grammar.cpp"
     break;
 
   case 33: /* params: fcall  */
-#line 180 "engines/private/grammar.y"
+#line 184 "engines/private/grammar.y"
                       { (yyval.narg) = 1; }
-#line 1385 "engines/private/grammar.cpp"
+#line 1389 "engines/private/grammar.cpp"
     break;
 
   case 34: /* value: NULLTOK  */
-#line 183 "engines/private/grammar.y"
+#line 187 "engines/private/grammar.y"
                    { code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 0, NULL)); }
-#line 1391 "engines/private/grammar.cpp"
+#line 1395 "engines/private/grammar.cpp"
     break;
 
   case 35: /* value: FALSETOK  */
-#line 184 "engines/private/grammar.y"
+#line 188 "engines/private/grammar.y"
                    { code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 0, NULL)); }
-#line 1397 "engines/private/grammar.cpp"
+#line 1401 "engines/private/grammar.cpp"
     break;
 
   case 36: /* value: TRUETOK  */
-#line 185 "engines/private/grammar.y"
+#line 189 "engines/private/grammar.y"
                    { code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 1, NULL)); }
-#line 1403 "engines/private/grammar.cpp"
+#line 1407 "engines/private/grammar.cpp"
     break;
 
   case 37: /* value: NUM  */
-#line 186 "engines/private/grammar.y"
+#line 190 "engines/private/grammar.y"
                    { code2(Private::constpush, (Private::Inst)(yyvsp[0].sym)); }
-#line 1409 "engines/private/grammar.cpp"
+#line 1413 "engines/private/grammar.cpp"
     break;
 
   case 38: /* value: STRING  */
-#line 187 "engines/private/grammar.y"
+#line 191 "engines/private/grammar.y"
                    { code2(Private::strpush, (Private::Inst)(yyvsp[0].sym)); }
-#line 1415 "engines/private/grammar.cpp"
+#line 1419 "engines/private/grammar.cpp"
     break;
 
   case 39: /* value: NAME  */
-#line 188 "engines/private/grammar.y"
+#line 192 "engines/private/grammar.y"
                    { code1(Private::varpush); code1((Private::Inst) g_private->maps.lookupName((yyvsp[0].s))); code1(Private::eval); }
-#line 1421 "engines/private/grammar.cpp"
+#line 1425 "engines/private/grammar.cpp"
     break;
 
   case 40: /* expr: value  */
-#line 191 "engines/private/grammar.y"
+#line 195 "engines/private/grammar.y"
                           { (yyval.inst) = (yyvsp[0].inst); }
-#line 1427 "engines/private/grammar.cpp"
+#line 1431 "engines/private/grammar.cpp"
     break;
 
   case 41: /* expr: '!' value  */
-#line 192 "engines/private/grammar.y"
+#line 196 "engines/private/grammar.y"
                           { code1(Private::negate); (yyval.inst) = (yyvsp[0].inst); }
-#line 1433 "engines/private/grammar.cpp"
+#line 1437 "engines/private/grammar.cpp"
     break;
 
   case 42: /* expr: value EQ value  */
-#line 193 "engines/private/grammar.y"
+#line 197 "engines/private/grammar.y"
                           { code1(Private::eq); }
-#line 1439 "engines/private/grammar.cpp"
+#line 1443 "engines/private/grammar.cpp"
     break;
 
   case 43: /* expr: value NEQ value  */
-#line 194 "engines/private/grammar.y"
+#line 198 "engines/private/grammar.y"
                           { code1(Private::ne); }
-#line 1445 "engines/private/grammar.cpp"
+#line 1449 "engines/private/grammar.cpp"
     break;
 
   case 44: /* expr: value '+' value  */
-#line 195 "engines/private/grammar.y"
+#line 199 "engines/private/grammar.y"
                           { code1(Private::add); }
-#line 1451 "engines/private/grammar.cpp"
+#line 1455 "engines/private/grammar.cpp"
     break;
 
   case 45: /* expr: value '<' value  */
-#line 196 "engines/private/grammar.y"
+#line 200 "engines/private/grammar.y"
                           { code1(Private::lt); }
-#line 1457 "engines/private/grammar.cpp"
+#line 1461 "engines/private/grammar.cpp"
     break;
 
   case 46: /* expr: value '>' value  */
-#line 197 "engines/private/grammar.y"
+#line 201 "engines/private/grammar.y"
                           { code1(Private::gt); }
-#line 1463 "engines/private/grammar.cpp"
+#line 1467 "engines/private/grammar.cpp"
     break;
 
   case 47: /* expr: value LTE value  */
-#line 198 "engines/private/grammar.y"
+#line 202 "engines/private/grammar.y"
                           { code1(Private::le); }
-#line 1469 "engines/private/grammar.cpp"
+#line 1473 "engines/private/grammar.cpp"
     break;
 
   case 48: /* expr: value GTE value  */
-#line 199 "engines/private/grammar.y"
+#line 203 "engines/private/grammar.y"
                           { code1(Private::ge); }
-#line 1475 "engines/private/grammar.cpp"
+#line 1479 "engines/private/grammar.cpp"
     break;
 
   case 49: /* expr: value '+'  */
-#line 200 "engines/private/grammar.y"
+#line 204 "engines/private/grammar.y"
                           { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1481 "engines/private/grammar.cpp"
+#line 1485 "engines/private/grammar.cpp"
     break;
 
   case 50: /* expr: RANDOMTOK '(' NUM '%' ')'  */
-#line 201 "engines/private/grammar.y"
+#line 205 "engines/private/grammar.y"
                                     { code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool); }
-#line 1487 "engines/private/grammar.cpp"
+#line 1491 "engines/private/grammar.cpp"
     break;
 
 
-#line 1491 "engines/private/grammar.cpp"
+#line 1495 "engines/private/grammar.cpp"
 
       default: break;
     }
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 8596a3b1af..7dfeb0fc10 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -75,10 +75,20 @@ typedef struct Setting {
 
 // Settings
 
-extern Setting *psetting;
 
 typedef Common::HashMap<Common::String, Setting *> SettingMap;
 
+class SettingMaps {
+    public:
+    Setting *psetting;
+    Setting *setting;
+    SettingMap map;
+
+    void init();
+    void save(char *);
+    void load(Common::String *);
+};
+
 // Funtions
 
 typedef Common::Array<Datum> ArgArray;
@@ -115,9 +125,6 @@ int randbool();
 
 // Code Execution
 
-void initSetting();
-void saveSetting(char *);
-void loadSetting(Common::String *);
 
 void execute(Inst *);
 
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 5881d9a433..be1d148299 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -53,6 +53,9 @@
 #include "private/private.h"
 #include "private/grammar.h"
 
+#undef yyerror
+#define yyerror         PRIVATE_xerror
+
 #define code1(c1)       Private::code(c1);
 #define code2(c1,c2)    Private::code(c1); Private::code(c2)
 #define code3(c1,c2,c3) Private::code(c1); Private::code(c2); Private::code(c3)
@@ -94,7 +97,8 @@ lines:   line lines
 
 line:     DEBUGTOK '{' debug '}'             { /* Not used in the game */ }
         | DEFINETOK NAME '{' define '}'      { g_private->maps.installAll($NAME); }
-        | SETTINGTOK NAME '{' statements '}' { saveSetting($NAME); initSetting(); }
+        | SETTINGTOK NAME '{' statements '}' { g_private->settings.save($NAME); 
+                                               g_private->settings.init(); }
         ;
 
 debug: /* nothing */
diff --git a/engines/private/lexer.cpp b/engines/private/lexer.cpp
index 07780b847a..e2f8a740fc 100644
--- a/engines/private/lexer.cpp
+++ b/engines/private/lexer.cpp
@@ -2184,7 +2184,7 @@ void yyfree (void * ptr )
 namespace Private {
 
 int parse(char *code) {
-    initSetting();
+    g_private->settings.init();
     YY_BUFFER_STATE bp;
     yy_delete_buffer(YY_CURRENT_BUFFER);
     bp = yy_scan_string(code);
diff --git a/engines/private/lexer.l b/engines/private/lexer.l
index cf03181e9f..ad448d49cc 100644
--- a/engines/private/lexer.l
+++ b/engines/private/lexer.l
@@ -64,7 +64,7 @@ Random                  return RANDOMTOK;
 namespace Private {
 
 int parse(char *code) {
-    initSetting();
+    g_private->settings.init();
     YY_BUFFER_STATE bp;
     yy_delete_buffer(YY_CURRENT_BUFFER);
     bp = yy_scan_string(code);
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index ce2fc5f1f2..beaad2c484 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -277,7 +277,7 @@ Common::Error PrivateEngine::run() {
             debugC(1, kPrivateDebugFunction, "Executing %s", _nextSetting->c_str());
             clearAreas();
             _currentSetting = _nextSetting;
-            loadSetting(_nextSetting);
+            settings.load(_nextSetting);
             _nextSetting = NULL;
             execute(prog);
             changeCursor("default");
diff --git a/engines/private/private.h b/engines/private/private.h
index ba358c8ee9..6bb344913a 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -134,6 +134,7 @@ public:
     bool isDemo() const;
 
     SymbolMaps maps;
+    SettingMaps settings;
 
     Audio::SoundHandle _fgSoundHandle;
     Audio::SoundHandle _bgSoundHandle;
diff --git a/engines/private/tokens.h b/engines/private/tokens.h
index 1e3e25462e..bde0cf6a55 100644
--- a/engines/private/tokens.h
+++ b/engines/private/tokens.h
@@ -88,7 +88,7 @@ extern int PRIVATE_debug;
 #if ! defined PRIVATE_STYPE && ! defined PRIVATE_STYPE_IS_DECLARED
 union PRIVATE_STYPE
 {
-#line 75 "engines/private/grammar.y"
+#line 78 "engines/private/grammar.y"
 
         Private::Symbol *sym; /* symbol table pointer */
         int (**inst)();       /* machine instruction */


Commit: a65366edeae0384a33a12aedf408ddb41e24763e
    https://github.com/scummvm/scummvm/commit/a65366edeae0384a33a12aedf408ddb41e24763e
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fix memory leaks

Changed paths:
    engines/private/funcs.cpp
    engines/private/grammar.h
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 43e14e7232..17cc9fc32d 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -42,7 +42,7 @@ void fChgMode(ArgArray args) {
 
     g_private->_mode = args[0].u.val;
     Common::String *s = new Common::String(args[1].u.str);
-    g_private->_nextSetting = s;
+    g_private->setNextSetting(s);
 
     if (g_private->_mode == 0) {
         g_private->setOrigin(kOriginZero);
@@ -104,7 +104,7 @@ void fgoto(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "goto(%s)", args[0].u.str);
     Common::String *s = new Common::String(args[0].u.str);
-    g_private->_nextSetting = s;
+    g_private->setNextSetting(s);
 }
 
 
@@ -112,7 +112,7 @@ void fSyncSound(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "SyncSound(%s, %s)", args[0].u.str, args[1].u.str);
     Common::String *nextSetting = new Common::String(args[1].u.str);
-    g_private->_nextSetting = nextSetting;
+    g_private->setNextSetting(nextSetting);
     Common::String s(args[0].u.str);
 
     if (s != "\"\"") {
@@ -135,6 +135,7 @@ void fLoadGame(ArgArray args) {
     m->nextSetting = NULL;
     m->flag1 = NULL;
     m->flag2 = NULL;
+    free(g_private->_loadGameMask);
     g_private->_loadGameMask = m;
     g_private->_masks.push_front(*m);
 }
@@ -149,6 +150,7 @@ void fSaveGame(ArgArray args) {
     m->nextSetting = NULL;
     m->flag1 = NULL;
     m->flag2 = NULL;
+    free(g_private->_saveGameMask);
     g_private->_saveGameMask = m;
     g_private->_masks.push_front(*m);
 }
@@ -171,7 +173,7 @@ void fPoliceBust(ArgArray args) {
         if (args[1].u.val == 2) {
             // Unclear what it means
         } else if (args[1].u.val == 3) {
-            g_private->_nextSetting = new Common::String(kMainDesktop);
+            g_private->setNextSetting(new Common::String(kMainDesktop));
             g_private->_mode = 0;
             g_private->setOrigin(kOriginZero);
         } else
@@ -199,8 +201,9 @@ void fBustMovie(ArgArray args) {
         g_private->playSound(s, 1, false, false);
     }
 
+    delete g_private->_nextMovie; 
     g_private->_nextMovie = new Common::String(pv);
-    g_private->_nextSetting = new Common::String(args[0].u.str);
+    g_private->setNextSetting(new Common::String(args[0].u.str));
 }
 
 void fDossierAdd(ArgArray args) {
@@ -452,14 +455,15 @@ void fViewScreen(ArgArray args) {
 void fTransition(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "Transition(%s, %s)", args[0].u.str, args[1].u.str);
+    delete g_private->_nextMovie;
     g_private->_nextMovie = new Common::String(args[0].u.str);
-    g_private->_nextSetting = new Common::String(args[1].u.str);
+    g_private->setNextSetting(new Common::String(args[1].u.str));
 }
 
 void fResume(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "Resume(%d)", args[0].u.val); // this value is always 1
-    g_private->_nextSetting = g_private->_pausedSetting;
+    g_private->setNextSetting(g_private->_pausedSetting);
     g_private->_pausedSetting = NULL;
     g_private->_mode = 1;
     g_private->setOrigin(kOriginOne);
@@ -472,16 +476,17 @@ void fMovie(ArgArray args) {
     Common::String *nextSetting = new Common::String(args[1].u.str);
 
     if (!g_private->_playedMovies.contains(*movie) && *movie != "\"\"") {
+        delete g_private->_nextMovie;
         g_private->_nextMovie = movie;
         g_private->_playedMovies.setVal(*movie, true);
-        g_private->_nextSetting = nextSetting;
+        g_private->setNextSetting(nextSetting);
 
     } else if (*movie == "\"\"") {
         g_private->_repeatedMovieExit = *nextSetting;
         debugC(1, kPrivateDebugScript, "repeated movie exit is %s", nextSetting->c_str());
     } else {
         debugC(1, kPrivateDebugScript, "movie %s already played", movie->c_str());
-        g_private->_nextSetting = &(g_private->_repeatedMovieExit);
+        g_private->setNextSetting(new Common::String(g_private->_repeatedMovieExit));
     }
 }
 
@@ -626,6 +631,7 @@ void fSoundArea(ArgArray args) {
         m->nextSetting = NULL;
         m->flag1 = NULL;
         m->flag2 = NULL;
+        free(g_private->_AMRadioArea);
         g_private->_AMRadioArea = m;
         g_private->_masks.push_front(*m);
     } else if (n == "kPoliceRadio") {
@@ -636,6 +642,7 @@ void fSoundArea(ArgArray args) {
         m->nextSetting = NULL;
         m->flag1 = NULL;
         m->flag2 = NULL;
+        free(g_private->_policeRadioArea);
         g_private->_policeRadioArea = m;
         g_private->_masks.push_front(*m);
     } else if (n == "kPhone") {
@@ -646,6 +653,7 @@ void fSoundArea(ArgArray args) {
         m->nextSetting = NULL;
         m->flag1 = NULL;
         m->flag2 = NULL;
+        free(g_private->_phoneArea);
         g_private->_phoneArea = m;
         g_private->_masks.push_front(*m);
     }
@@ -659,7 +667,7 @@ void fAskSave(ArgArray args) {
     // This is not needed, since scummvm will take care of this
     debugC(1, kPrivateDebugScript, "WARNING: AskSave is partially implemented");
     Common::String *s = new Common::String(args[0].u.str);
-    g_private->_nextSetting = s;
+    g_private->setNextSetting(s);
 }
 
 void fTimer(ArgArray args) {
@@ -675,7 +683,7 @@ void fTimer(ArgArray args) {
     if (delay > 0) {
         assert(g_private->installTimer(delay, s));
     } else if (delay == 0) {
-        g_private->_nextSetting = s;
+        g_private->setNextSetting(s);
     } else {
         assert(0);
     }
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 7dfeb0fc10..f38f9db65d 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -75,7 +75,6 @@ typedef struct Setting {
 
 // Settings
 
-
 typedef Common::HashMap<Common::String, Setting *> SettingMap;
 
 class SettingMaps {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index beaad2c484..2a8fa2df1d 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -121,6 +121,13 @@ void PrivateEngine::initializePath(const Common::FSNode &gamePath) {
     SearchMan.addDirectory(gamePath.getPath(), gamePath, 0, 10);
 }
 
+void PrivateEngine::setNextSetting(Common::String *_ns) {
+    if (_ns)
+      debug("deleting %s", _ns->c_str());
+    delete _nextSetting;
+    _nextSetting = _ns;
+}
+
 void PrivateEngine::setOrigin(const int point[2]) {
     delete _origin;
     _origin = new Common::Point(point[0], point[1]);;
@@ -190,7 +197,7 @@ Common::Error PrivateEngine::run() {
     if (saveSlot >= 0) { // load the savegame
         loadGameState(saveSlot);
     } else {
-        _nextSetting = new Common::String(kGoIntro);
+        setNextSetting(new Common::String(kGoIntro));
     }
 
     while (!shouldQuit()) {
@@ -251,12 +258,14 @@ Common::Error PrivateEngine::run() {
             removeTimer();
             _videoDecoder = new Video::SmackerDecoder();
             playVideo(*_nextMovie);
+            delete(_nextMovie);
             _nextMovie = NULL;
             continue;
         }
 
         if (_nextVS != NULL && *_currentSetting == kMainDesktop) {
             loadImage(*_nextVS, 160, 120);
+            drawScreen();
         }
 
         if (_videoDecoder) {
@@ -276,9 +285,10 @@ Common::Error PrivateEngine::run() {
             removeTimer();
             debugC(1, kPrivateDebugFunction, "Executing %s", _nextSetting->c_str());
             clearAreas();
-            _currentSetting = _nextSetting;
+            // This pointer will be free after load
+            _currentSetting = new Common::String(*_nextSetting);
             settings.load(_nextSetting);
-            _nextSetting = NULL;
+            setNextSetting(NULL);
             execute(prog);
             changeCursor("default");
             drawScreen();
@@ -293,12 +303,20 @@ Common::Error PrivateEngine::run() {
 void PrivateEngine::clearAreas() {
     _exits.clear();
     _masks.clear();
+
+    free(_loadGameMask);
     _loadGameMask = NULL;
+    free(_saveGameMask);
     _saveGameMask = NULL;
+    free(_policeRadioArea); 
     _policeRadioArea = NULL;
+    free(_AMRadioArea);
     _AMRadioArea = NULL;
+    free(_phoneArea);
     _phoneArea = NULL;
+    free(_dossierNextSuspectMask);
     _dossierNextSuspectMask = NULL;
+    free(_dossierPrevSuspectMask);
     _dossierPrevSuspectMask = NULL;
 }
 
@@ -334,9 +352,9 @@ void PrivateEngine::checkPoliceBust() {
         uint policeIndex = maps.variables.getVal(kPoliceIndex)->u.val;
         _policeBustSetting = _currentSetting;
         if (policeIndex <= 13) {
-            _nextSetting = new Common::String(kPOGoBustMovie);
+            setNextSetting(new Common::String(kPOGoBustMovie));
         } else {
-            _nextSetting = new Common::String(kPoliceBustFromMO);
+            setNextSetting(new Common::String(kPoliceBustFromMO));
         }
         clearAreas();
         _policeBustEnabled = false;
@@ -421,7 +439,7 @@ void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
         if (!window.contains(mousePos)) {
             if ( _pausedSetting == NULL) {
                 _pausedSetting = _currentSetting;
-                _nextSetting = new Common::String(kPauseMovie);
+                setNextSetting(new Common::String(kPauseMovie));
             }
         }
     }
@@ -458,7 +476,7 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
     }
     if (ns != NULL) {
         //debug("Exit selected %s", ns->c_str());
-        _nextSetting = ns;
+        setNextSetting(new Common::String(*ns));
     }
 }
 
@@ -492,7 +510,7 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
     }
     if (ns != NULL) {
         //debug("Mask selected %s", ns->c_str());
-        _nextSetting = ns;
+        setNextSetting(new Common::String(*ns));
     }
 }
 
@@ -577,6 +595,7 @@ bool PrivateEngine::selectDossierNextSuspect(Common::Point mousePos) {
             loadDossier();
             drawMask(_dossierNextSuspectMask->surf);
             drawMask(_dossierPrevSuspectMask->surf);
+            drawScreen();
         }
         return true;
     }
@@ -594,6 +613,7 @@ bool PrivateEngine::selectDossierPrevSuspect(Common::Point mousePos) {
             loadDossier();
             drawMask(_dossierNextSuspectMask->surf);
             drawMask(_dossierPrevSuspectMask->surf);
+            drawScreen();
         }
         return true;
     }
@@ -655,7 +675,7 @@ void PrivateEngine::restartGame() {
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
     Common::Serializer s(stream, nullptr);
     debugC(1, kPrivateDebugFunction, "loadGameStream");
-    _nextSetting = new Common::String(kStartGame);
+    setNextSetting(new Common::String(kStartGame));
     int val;
 
     for (NameList::iterator it = maps.variableList.begin(); it != maps.variableList.end(); ++it) {
@@ -1012,7 +1032,7 @@ char *PrivateEngine::getRandomPhoneClip(const char *clip, int i, int j) {
 // Timers
 void timerCallback(void *refCon) {
     g_private->removeTimer();
-    g_private->_nextSetting = (Common::String *)refCon;
+    g_private->setNextSetting((Common::String *)refCon);
 }
 
 bool PrivateEngine::installTimer(uint32 delay, Common::String *ns) {
diff --git a/engines/private/private.h b/engines/private/private.h
index 6bb344913a..7685fba62a 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -121,7 +121,7 @@ typedef Common::HashMap<Common::String, bool> PlayedMediaTable;
 class PrivateEngine : public Engine {
 private:
     Common::RandomSource *_rnd;
-
+    Common::String *_nextSetting;
     Graphics::PixelFormat _pixelFormat;
     Image::ImageDecoder *_image;
     int _screenW, _screenH;
@@ -198,7 +198,9 @@ public:
     // global state
     const Common::Point *_origin;
     void setOrigin(const int[2]);
-    Common::String *_nextSetting;
+
+    void setNextSetting(Common::String *);
+    
     Common::String *_currentSetting;
     bool            _toTake;
 


Commit: 799343a9313d9d3901720598150cdea436ac49dc
    https://github.com/scummvm/scummvm/commit/799343a9313d9d3901720598150cdea436ac49dc
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fix memory leaks

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 2a8fa2df1d..b0767c8cb7 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -122,8 +122,6 @@ void PrivateEngine::initializePath(const Common::FSNode &gamePath) {
 }
 
 void PrivateEngine::setNextSetting(Common::String *_ns) {
-    if (_ns)
-      debug("deleting %s", _ns->c_str());
     delete _nextSetting;
     _nextSetting = _ns;
 }
@@ -285,6 +283,7 @@ Common::Error PrivateEngine::run() {
             removeTimer();
             debugC(1, kPrivateDebugFunction, "Executing %s", _nextSetting->c_str());
             clearAreas();
+            delete _currentSetting;
             // This pointer will be free after load
             _currentSetting = new Common::String(*_nextSetting);
             settings.load(_nextSetting);
@@ -438,7 +437,8 @@ void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
         Common::Rect window(_origin->x, _origin->y, _screenW - _origin->x, _screenH - _origin->y);
         if (!window.contains(mousePos)) {
             if ( _pausedSetting == NULL) {
-                _pausedSetting = _currentSetting;
+                delete _pausedSetting;
+                _pausedSetting = new Common::String(*_currentSetting);
                 setNextSetting(new Common::String(kPauseMovie));
             }
         }


Commit: 1924abc1a41108a738c631e0797897d680e8ed06
    https://github.com/scummvm/scummvm/commit/1924abc1a41108a738c631e0797897d680e8ed06
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: stop all sounds when a game is loaded

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index b0767c8cb7..8326dbbd14 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -673,6 +673,9 @@ void PrivateEngine::restartGame() {
 }
 
 Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream) {
+    // We don't want to continue with any sound from a previous game
+    stopSound(true);
+
     Common::Serializer s(stream, nullptr);
     debugC(1, kPrivateDebugFunction, "loadGameStream");
     setNextSetting(new Common::String(kStartGame));


Commit: 4d8144f32d0fe159da5dfd72387e92574e2424d7
    https://github.com/scummvm/scummvm/commit/4d8144f32d0fe159da5dfd72387e92574e2424d7
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: code convention fixes

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 8326dbbd14..e6ada2e702 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -329,7 +329,7 @@ void PrivateEngine::startPoliceBust() {
     _maxNumberClicks = r + 0x10 + (policeIndex * 0xe) / -0x15;
     _sirenWarning = _rnd->getRandomNumber(0x7) + 3;
     _numberClicks = 0;
-    if(_sirenWarning >= _maxNumberClicks)
+    if (_sirenWarning >= _maxNumberClicks)
         _sirenWarning = _maxNumberClicks - 1;
 }
 


Commit: 020aa0a8674b59a6e0ea7a26db1ddfa131f54513
    https://github.com/scummvm/scummvm/commit/020aa0a8674b59a6e0ea7a26db1ddfa131f54513
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fix memory leaks and added more stuff into the main class

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/grammar.h
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 9357cf3800..fa405128b1 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -60,32 +60,6 @@ Inst *prog    = NULL; /* the machine */
 Inst *progp   = NULL; /* next free spot for code generation */
 Inst *pc      = NULL; /* program counter during execution */
 
-
-static struct InstDescr {
-    const Inst func;
-    const char *name;
-} instDescr[] = {
-    { 0,        "STOP",     },
-    { constpush,"constpush" },
-    { strpush,  "strpush",  },
-    { varpush,  "varpush",  },
-    { funcpush, "funcpush", },
-    { eval,     "eval",     },
-    { ifcode,   "ifcode",   },
-    { add,      "add",      },
-    { negate,   "negate",   },
-
-    { 0, 0}
-};
-
-PtrToName _insts;
-
-void initInsts() {
-    for (InstDescr *fnc = instDescr; fnc->name; fnc++) {
-        _insts[(void *)fnc->func] = new Common::String(fnc->name);
-    }
-}
-
 /* initialize setting for code generation */
 void SettingMaps::init() {
     setting = (Setting *)malloc(sizeof(Setting));
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 17cc9fc32d..131ffd7bc8 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -201,8 +201,7 @@ void fBustMovie(ArgArray args) {
         g_private->playSound(s, 1, false, false);
     }
 
-    delete g_private->_nextMovie; 
-    g_private->_nextMovie = new Common::String(pv);
+    g_private->setNextMovie(new Common::String(pv));
     g_private->setNextSetting(new Common::String(args[0].u.str));
 }
 
@@ -455,8 +454,7 @@ void fViewScreen(ArgArray args) {
 void fTransition(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "Transition(%s, %s)", args[0].u.str, args[1].u.str);
-    delete g_private->_nextMovie;
-    g_private->_nextMovie = new Common::String(args[0].u.str);
+    g_private->setNextMovie(new Common::String(args[0].u.str));
     g_private->setNextSetting(new Common::String(args[1].u.str));
 }
 
@@ -476,8 +474,7 @@ void fMovie(ArgArray args) {
     Common::String *nextSetting = new Common::String(args[1].u.str);
 
     if (!g_private->_playedMovies.contains(*movie) && *movie != "\"\"") {
-        delete g_private->_nextMovie;
-        g_private->_nextMovie = movie;
+        g_private->setNextMovie(movie);
         g_private->_playedMovies.setVal(*movie, true);
         g_private->setNextSetting(nextSetting);
 
@@ -689,10 +686,7 @@ void fTimer(ArgArray args) {
     }
 }
 
-static struct FuncTable {
-    void (*func)(Private::ArgArray);
-    const char *name;
-} funcTable[] = {
+FuncTable funcTable[] = {
 
     // Control flow
     { fChgMode,         "ChgMode"},
@@ -762,22 +756,13 @@ static struct FuncTable {
     { 0, 0}
 };
 
-NameToPtr _functions;
-
-void initFuncs() {
-    for (Private::FuncTable *fnc = funcTable; fnc->name; fnc++) {
-        Common::String *name = new Common::String(fnc->name);
-        _functions.setVal(*name, (void *)fnc->func);
-    }
-}
-
 void call(char *name, ArgArray args) {
     Common::String n(name);
-    if (!_functions.contains(n)) {
+    if (!g_private->_functions.contains(n)) {
         error("I don't know how to execute %s", name);
     }
 
-    void (*func)(ArgArray) = (void (*)(ArgArray)) _functions.getVal(n);
+    void (*func)(ArgArray) = (void (*)(ArgArray)) g_private->_functions.getVal(n);
     func(args);
 }
 
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index f38f9db65d..0c721e413f 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -57,7 +57,6 @@ typedef int (* Inst)();  /* machine instruction */
 #define STOP    (Inst) 0
 
 typedef Common::HashMap<void *, Common::String *> PtrToName;
-typedef Common::HashMap<Common::String, void *> NameToPtr;
 
 void initInsts();
 void initFuncs();
@@ -99,7 +98,7 @@ Datum pop();
 int push(Datum);
 extern  Inst *progp;
 
-extern  Inst *code(Inst);
+Inst *code(Inst);
 extern  Inst *prog;
 int eval();
 int add();
@@ -124,7 +123,6 @@ int randbool();
 
 // Code Execution
 
-
 void execute(Inst *);
 
 } // End of namespace Private
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index e6ada2e702..719d981a45 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -126,6 +126,11 @@ void PrivateEngine::setNextSetting(Common::String *_ns) {
     _nextSetting = _ns;
 }
 
+void PrivateEngine::setNextMovie(Common::String *_nm) {
+    delete _nextMovie;
+    _nextMovie = _nm;
+}
+
 void PrivateEngine::setOrigin(const int point[2]) {
     delete _origin;
     _origin = new Common::Point(point[0], point[1]);;
@@ -157,7 +162,6 @@ Common::Error PrivateEngine::run() {
     file->read(buf, file->size()+1);
 
     // Initialize stuff
-    initInsts();
     initFuncs();
     initCursors();
     parse(buf);
@@ -256,8 +260,7 @@ Common::Error PrivateEngine::run() {
             removeTimer();
             _videoDecoder = new Video::SmackerDecoder();
             playVideo(*_nextMovie);
-            delete(_nextMovie);
-            _nextMovie = NULL;
+            setNextMovie(NULL);
             continue;
         }
 
@@ -299,6 +302,13 @@ Common::Error PrivateEngine::run() {
     return Common::kNoError;
 }
 
+void PrivateEngine::initFuncs() {
+    for (Private::FuncTable *fnc = funcTable; fnc->name; fnc++) {
+        Common::String *name = new Common::String(fnc->name);
+        _functions.setVal(*name, (void *)fnc->func);
+    }
+}
+
 void PrivateEngine::clearAreas() {
     _exits.clear();
     _masks.clear();
diff --git a/engines/private/private.h b/engines/private/private.h
index 7685fba62a..c0321d58e7 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -102,6 +102,16 @@ typedef struct DossierInfo {
     Common::String *page2;
 } DossierInfo;
 
+// funcs
+
+typedef struct FuncTable {
+    void (*func)(Private::ArgArray);
+    const char *name;
+} FunctTable;
+
+typedef Common::HashMap<Common::String, void *> NameToPtr;
+extern FuncTable funcTable[];
+
 // lists
 
 typedef Common::List<ExitInfo> ExitList;
@@ -122,6 +132,7 @@ class PrivateEngine : public Engine {
 private:
     Common::RandomSource *_rnd;
     Common::String *_nextSetting;
+    Common::String *_nextMovie;
     Graphics::PixelFormat _pixelFormat;
     Image::ImageDecoder *_image;
     int _screenW, _screenH;
@@ -146,6 +157,11 @@ public:
     void clearAreas();
     void initializePath(const Common::FSNode &gamePath) override;
 
+    // Functions
+
+    NameToPtr _functions;
+    void initFuncs();
+
     // User input
     void selectPauseMovie(Common::Point);
     void selectMask(Common::Point);
@@ -200,6 +216,7 @@ public:
     void setOrigin(const int[2]);
 
     void setNextSetting(Common::String *);
+    void setNextMovie(Common::String *);
     
     Common::String *_currentSetting;
     bool            _toTake;
@@ -236,7 +253,7 @@ public:
 
     int _mode;
     bool _modified;
-    Common::String *_nextMovie;
+
     PlayedMediaTable _playedMovies;
     PlayedMediaTable _playedPhoneClips;
     Common::String _repeatedMovieExit;


Commit: 90b07f5f81afa85e797980595338df3f209c7762
    https://github.com/scummvm/scummvm/commit/90b07f5f81afa85e797980595338df3f209c7762
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: remove pointers

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/grammar.h
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index fa405128b1..c8f53b0525 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -76,11 +76,11 @@ void SettingMaps::save(char *name) {
     map.setVal(name, setting);
 }
 
-void SettingMaps::load(Common::String *name) {
-    assert(map.contains(*name));
-    setting = map.getVal(*name);
+void SettingMaps::load(Common::String &name) {
+    assert(map.contains(name));
+    setting = map.getVal(name);
 
-    debugC(1, kPrivateDebugCode, "loading setting %s", name->c_str());
+    debugC(1, kPrivateDebugCode, "loading setting %s", name.c_str());
 
     prog = (Inst *)&setting->prog;
     stack = (Datum *)&setting->stack;
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 131ffd7bc8..303201311a 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -42,7 +42,7 @@ void fChgMode(ArgArray args) {
 
     g_private->_mode = args[0].u.val;
     Common::String *s = new Common::String(args[1].u.str);
-    g_private->setNextSetting(s);
+    g_private->_nextSetting = *s;
 
     if (g_private->_mode == 0) {
         g_private->setOrigin(kOriginZero);
@@ -104,7 +104,7 @@ void fgoto(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "goto(%s)", args[0].u.str);
     Common::String *s = new Common::String(args[0].u.str);
-    g_private->setNextSetting(s);
+    g_private->_nextSetting = *s;
 }
 
 
@@ -112,7 +112,7 @@ void fSyncSound(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "SyncSound(%s, %s)", args[0].u.str, args[1].u.str);
     Common::String *nextSetting = new Common::String(args[1].u.str);
-    g_private->setNextSetting(nextSetting);
+    g_private->_nextSetting = *nextSetting;
     Common::String s(args[0].u.str);
 
     if (s != "\"\"") {
@@ -173,7 +173,7 @@ void fPoliceBust(ArgArray args) {
         if (args[1].u.val == 2) {
             // Unclear what it means
         } else if (args[1].u.val == 3) {
-            g_private->setNextSetting(new Common::String(kMainDesktop));
+            g_private->_nextSetting = kMainDesktop;
             g_private->_mode = 0;
             g_private->setOrigin(kOriginZero);
         } else
@@ -201,8 +201,8 @@ void fBustMovie(ArgArray args) {
         g_private->playSound(s, 1, false, false);
     }
 
-    g_private->setNextMovie(new Common::String(pv));
-    g_private->setNextSetting(new Common::String(args[0].u.str));
+    g_private->_nextMovie = pv;
+    g_private->_nextSetting = args[0].u.str;
 }
 
 void fDossierAdd(ArgArray args) {
@@ -454,15 +454,15 @@ void fViewScreen(ArgArray args) {
 void fTransition(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "Transition(%s, %s)", args[0].u.str, args[1].u.str);
-    g_private->setNextMovie(new Common::String(args[0].u.str));
-    g_private->setNextSetting(new Common::String(args[1].u.str));
+    g_private->_nextMovie = args[0].u.str;
+    g_private->_nextSetting = args[1].u.str;
 }
 
 void fResume(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "Resume(%d)", args[0].u.val); // this value is always 1
-    g_private->setNextSetting(g_private->_pausedSetting);
-    g_private->_pausedSetting = NULL;
+    g_private->_nextSetting = g_private->_pausedSetting;
+    g_private->_pausedSetting = "";
     g_private->_mode = 1;
     g_private->setOrigin(kOriginOne);
 }
@@ -470,20 +470,19 @@ void fResume(ArgArray args) {
 void fMovie(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "Movie(%s, %s)", args[0].u.str, args[1].u.str);
-    Common::String *movie = new Common::String(args[0].u.str);
-    Common::String *nextSetting = new Common::String(args[1].u.str);
-
-    if (!g_private->_playedMovies.contains(*movie) && *movie != "\"\"") {
-        g_private->setNextMovie(movie);
-        g_private->_playedMovies.setVal(*movie, true);
-        g_private->setNextSetting(nextSetting);
-
-    } else if (*movie == "\"\"") {
-        g_private->_repeatedMovieExit = *nextSetting;
-        debugC(1, kPrivateDebugScript, "repeated movie exit is %s", nextSetting->c_str());
+    Common::String movie = args[0].u.str;
+    Common::String nextSetting = args[1].u.str;
+
+    if (!g_private->_playedMovies.contains(movie) && movie != "\"\"") {
+        g_private->_nextMovie = movie;
+        g_private->_playedMovies.setVal(movie, true);
+        g_private->_nextSetting = nextSetting;
+    } else if (movie == "\"\"") {
+        g_private->_repeatedMovieExit = nextSetting;
+        debugC(1, kPrivateDebugScript, "repeated movie exit is %s", nextSetting.c_str());
     } else {
-        debugC(1, kPrivateDebugScript, "movie %s already played", movie->c_str());
-        g_private->setNextSetting(new Common::String(g_private->_repeatedMovieExit));
+        debugC(1, kPrivateDebugScript, "movie %s already played", movie.c_str());
+        g_private->_nextSetting = g_private->_repeatedMovieExit;
     }
 }
 
@@ -664,7 +663,7 @@ void fAskSave(ArgArray args) {
     // This is not needed, since scummvm will take care of this
     debugC(1, kPrivateDebugScript, "WARNING: AskSave is partially implemented");
     Common::String *s = new Common::String(args[0].u.str);
-    g_private->setNextSetting(s);
+    g_private->_nextSetting = *s;
 }
 
 void fTimer(ArgArray args) {
@@ -680,7 +679,7 @@ void fTimer(ArgArray args) {
     if (delay > 0) {
         assert(g_private->installTimer(delay, s));
     } else if (delay == 0) {
-        g_private->setNextSetting(s);
+        g_private->_nextSetting = *s;
     } else {
         assert(0);
     }
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 0c721e413f..1812b88e44 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -84,7 +84,7 @@ class SettingMaps {
 
     void init();
     void save(char *);
-    void load(Common::String *);
+    void load(Common::String &);
 };
 
 // Funtions
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 719d981a45..8843edf2ae 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -60,15 +60,15 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     g_private = this;
 
     // Setting execution
-    _nextSetting = NULL;
-    _currentSetting = NULL;
-    _pausedSetting = NULL;
+    _nextSetting = "";
+    _currentSetting = "";
+    _pausedSetting = "";
     _modified = false;
     _mode = -1;
     _toTake = false;
 
     // Movies
-    _nextMovie = NULL;
+    _nextMovie = "";
     _nextVS = NULL;
     _repeatedMovieExit = "";
 
@@ -81,7 +81,7 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
 
     // Police
     _policeBustEnabled = false;
-    _policeBustSetting = NULL;
+    _policeBustSetting = "";
     _numberClicks = 0;
     _sirenSound = "po/audio/posfx002.wav";
 
@@ -121,16 +121,6 @@ void PrivateEngine::initializePath(const Common::FSNode &gamePath) {
     SearchMan.addDirectory(gamePath.getPath(), gamePath, 0, 10);
 }
 
-void PrivateEngine::setNextSetting(Common::String *_ns) {
-    delete _nextSetting;
-    _nextSetting = _ns;
-}
-
-void PrivateEngine::setNextMovie(Common::String *_nm) {
-    delete _nextMovie;
-    _nextMovie = _nm;
-}
-
 void PrivateEngine::setOrigin(const int point[2]) {
     delete _origin;
     _origin = new Common::Point(point[0], point[1]);;
@@ -199,7 +189,8 @@ Common::Error PrivateEngine::run() {
     if (saveSlot >= 0) { // load the savegame
         loadGameState(saveSlot);
     } else {
-        setNextSetting(new Common::String(kGoIntro));
+        _nextSetting = kGoIntro;
+        //setNextSetting(new Common::String(kGoIntro));
     }
 
     while (!shouldQuit()) {
@@ -232,9 +223,9 @@ Common::Error PrivateEngine::run() {
                 selectAMRadioArea(mousePos);
                 selectLoadGame(mousePos);
                 selectSaveGame(mousePos);
-                if (!_nextSetting)
+                if (_nextSetting.empty())
                     selectMask(mousePos);
-                if (!_nextSetting)
+                if (_nextSetting.empty())
                     selectExit(mousePos);
                 break;
 
@@ -256,15 +247,15 @@ Common::Error PrivateEngine::run() {
         checkPoliceBust();
 
         // Movies
-        if (_nextMovie != NULL) {
+        if (!_nextMovie.empty()) {
             removeTimer();
             _videoDecoder = new Video::SmackerDecoder();
-            playVideo(*_nextMovie);
-            setNextMovie(NULL);
+            playVideo(_nextMovie);
+            _nextMovie = "";
             continue;
         }
 
-        if (_nextVS != NULL && *_currentSetting == kMainDesktop) {
+        if (_nextVS != NULL && _currentSetting == kMainDesktop) {
             loadImage(*_nextVS, 160, 120);
             drawScreen();
         }
@@ -282,15 +273,14 @@ Common::Error PrivateEngine::run() {
             continue;
         }
 
-        if (_nextSetting != NULL) {
+        if (!_nextSetting.empty()) {
             removeTimer();
-            debugC(1, kPrivateDebugFunction, "Executing %s", _nextSetting->c_str());
+            debugC(1, kPrivateDebugFunction, "Executing %s", _nextSetting.c_str());
             clearAreas();
-            delete _currentSetting;
             // This pointer will be free after load
-            _currentSetting = new Common::String(*_nextSetting);
+            _currentSetting = _nextSetting;
             settings.load(_nextSetting);
-            setNextSetting(NULL);
+            _nextSetting = "";
             execute(prog);
             changeCursor("default");
             drawScreen();
@@ -361,9 +351,9 @@ void PrivateEngine::checkPoliceBust() {
         uint policeIndex = maps.variables.getVal(kPoliceIndex)->u.val;
         _policeBustSetting = _currentSetting;
         if (policeIndex <= 13) {
-            setNextSetting(new Common::String(kPOGoBustMovie));
+            _nextSetting = kPOGoBustMovie;
         } else {
-            setNextSetting(new Common::String(kPoliceBustFromMO));
+            _nextSetting = kPoliceBustFromMO;
         }
         clearAreas();
         _policeBustEnabled = false;
@@ -446,10 +436,9 @@ void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
     if (_mode == 1) {
         Common::Rect window(_origin->x, _origin->y, _screenW - _origin->x, _screenH - _origin->y);
         if (!window.contains(mousePos)) {
-            if ( _pausedSetting == NULL) {
-                delete _pausedSetting;
-                _pausedSetting = new Common::String(*_currentSetting);
-                setNextSetting(new Common::String(kPauseMovie));
+            if (!_pausedSetting.empty()) {
+                _pausedSetting = _currentSetting;
+                _nextSetting = kPauseMovie;
             }
         }
     }
@@ -485,8 +474,8 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
         }
     }
     if (ns != NULL) {
-        //debug("Exit selected %s", ns->c_str());
-        setNextSetting(new Common::String(*ns));
+        _nextSetting = *ns;
+        //setNextSetting(new Common::String(*ns));
     }
 }
 
@@ -520,7 +509,8 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
     }
     if (ns != NULL) {
         //debug("Mask selected %s", ns->c_str());
-        setNextSetting(new Common::String(*ns));
+        _nextSetting = *ns;
+        //setNextSetting(new Common::String(*ns));
     }
 }
 
@@ -688,7 +678,7 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
 
     Common::Serializer s(stream, nullptr);
     debugC(1, kPrivateDebugFunction, "loadGameStream");
-    setNextSetting(new Common::String(kStartGame));
+    _nextSetting = kStartGame;
     int val;
 
     for (NameList::iterator it = maps.variableList.begin(); it != maps.variableList.end(); ++it) {
@@ -1045,7 +1035,7 @@ char *PrivateEngine::getRandomPhoneClip(const char *clip, int i, int j) {
 // Timers
 void timerCallback(void *refCon) {
     g_private->removeTimer();
-    g_private->setNextSetting((Common::String *)refCon);
+    g_private->_nextSetting = *(Common::String *)refCon;
 }
 
 bool PrivateEngine::installTimer(uint32 delay, Common::String *ns) {
diff --git a/engines/private/private.h b/engines/private/private.h
index c0321d58e7..c1480d303b 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -131,8 +131,6 @@ typedef Common::HashMap<Common::String, bool> PlayedMediaTable;
 class PrivateEngine : public Engine {
 private:
     Common::RandomSource *_rnd;
-    Common::String *_nextSetting;
-    Common::String *_nextMovie;
     Graphics::PixelFormat _pixelFormat;
     Image::ImageDecoder *_image;
     int _screenW, _screenH;
@@ -211,14 +209,19 @@ public:
     Common::String *_nextVS;
     void drawScreen();
 
-    // global state
+    // settings
+    Common::String _nextSetting;
+    Common::String _pausedSetting;
+    Common::String  _currentSetting;
+
+    Common::String _nextMovie;
     const Common::Point *_origin;
     void setOrigin(const int[2]);
 
-    void setNextSetting(Common::String *);
-    void setNextMovie(Common::String *);
+    //void setNextSetting(Common::String *);
+    //void setNextMovie(Common::String *);
     
-    Common::String *_currentSetting;
+
     bool            _toTake;
 
     // Dossiers
@@ -239,7 +242,7 @@ public:
     int _numberClicks;
     int _maxNumberClicks;
     int _sirenWarning;
-    Common::String *_policeBustSetting;
+    Common::String _policeBustSetting;
 
     // Diary
     InvList inventory;
@@ -257,7 +260,6 @@ public:
     PlayedMediaTable _playedMovies;
     PlayedMediaTable _playedPhoneClips;
     Common::String _repeatedMovieExit;
-    Common::String *_pausedSetting;
 
     // Masks/Exits
     ExitList _exits;


Commit: 0f9c86fe428235002c9017cdfa0e599a53477228
    https://github.com/scummvm/scummvm/commit/0f9c86fe428235002c9017cdfa0e599a53477228
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: remove pointers

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 303201311a..f235f0e019 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -41,8 +41,7 @@ void fChgMode(ArgArray args) {
         assert(0);
 
     g_private->_mode = args[0].u.val;
-    Common::String *s = new Common::String(args[1].u.str);
-    g_private->_nextSetting = *s;
+    g_private->_nextSetting = args[1].u.str;
 
     if (g_private->_mode == 0) {
         g_private->setOrigin(kOriginZero);
@@ -65,7 +64,7 @@ void fChgMode(ArgArray args) {
 void fVSPicture(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "VSPicture(%s)", args[0].u.str);
-    g_private->_nextVS = new Common::String(args[0].u.str);
+    g_private->_nextVS = args[0].u.str;
 }
 
 
@@ -103,17 +102,15 @@ void fDiaryInvList(ArgArray args) {
 void fgoto(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "goto(%s)", args[0].u.str);
-    Common::String *s = new Common::String(args[0].u.str);
-    g_private->_nextSetting = *s;
+    g_private->_nextSetting = args[0].u.str;
 }
 
 
 void fSyncSound(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "SyncSound(%s, %s)", args[0].u.str, args[1].u.str);
-    Common::String *nextSetting = new Common::String(args[1].u.str);
-    g_private->_nextSetting = *nextSetting;
-    Common::String s(args[0].u.str);
+    g_private->_nextSetting = args[1].u.str;
+    Common::String s = args[0].u.str;
 
     if (s != "\"\"") {
         g_private->playSound(s, 1, true, false);
@@ -128,9 +125,8 @@ void fQuit(ArgArray args) {
 void fLoadGame(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "LoadGame(%s, %s)", args[0].u.str, args[2].u.sym->name->c_str());
-    Common::String *s = new Common::String(args[0].u.str);
     MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
-    m->surf = g_private->loadMask(*s, 0, 0, true);
+    m->surf = g_private->loadMask(args[0].u.str, 0, 0, true);
     m->cursor = args[2].u.sym->name;
     m->nextSetting = NULL;
     m->flag1 = NULL;
@@ -143,9 +139,8 @@ void fLoadGame(ArgArray args) {
 void fSaveGame(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "SaveGame(%s, %s)", args[0].u.str, args[1].u.sym->name->c_str());
-    Common::String s(args[0].u.str);
     MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
-    m->surf = g_private->loadMask(s, 0, 0, true);
+    m->surf = g_private->loadMask(args[0].u.str, 0, 0, true);
     m->cursor = args[1].u.sym->name;
     m->nextSetting = NULL;
     m->flag1 = NULL;
@@ -619,10 +614,11 @@ void fSoundArea(ArgArray args) {
         error("Invalid input for SoundArea");
 
     debugC(1, kPrivateDebugScript, "SoundArea(%s, %s, ..)", args[0].u.str, n.c_str());
+    Common::String s = args[0].u.str;
+
     if (n == "kAMRadio") {
-        Common::String *s = new Common::String(args[0].u.str);
         MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
-        m->surf = g_private->loadMask(*s, 0, 0, true);
+        m->surf = g_private->loadMask(s, 0, 0, true);
         m->cursor = args[2].u.sym->name;
         m->nextSetting = NULL;
         m->flag1 = NULL;
@@ -631,9 +627,8 @@ void fSoundArea(ArgArray args) {
         g_private->_AMRadioArea = m;
         g_private->_masks.push_front(*m);
     } else if (n == "kPoliceRadio") {
-        Common::String *s = new Common::String(args[0].u.str);
         MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
-        m->surf = g_private->loadMask(*s, 0, 0, true);
+        m->surf = g_private->loadMask(s, 0, 0, true);
         m->cursor = args[2].u.sym->name;
         m->nextSetting = NULL;
         m->flag1 = NULL;
@@ -642,9 +637,8 @@ void fSoundArea(ArgArray args) {
         g_private->_policeRadioArea = m;
         g_private->_masks.push_front(*m);
     } else if (n == "kPhone") {
-        Common::String *s = new Common::String(args[0].u.str);
         MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
-        m->surf = g_private->loadMask(*s, 0, 0, true);
+        m->surf = g_private->loadMask(s, 0, 0, true);
         m->cursor = args[2].u.sym->name;
         m->nextSetting = NULL;
         m->flag1 = NULL;
@@ -662,8 +656,7 @@ void fSafeDigit(ArgArray args) {
 void fAskSave(ArgArray args) {
     // This is not needed, since scummvm will take care of this
     debugC(1, kPrivateDebugScript, "WARNING: AskSave is partially implemented");
-    Common::String *s = new Common::String(args[0].u.str);
-    g_private->_nextSetting = *s;
+    g_private->_nextSetting = args[0].u.str;
 }
 
 void fTimer(ArgArray args) {
@@ -675,6 +668,7 @@ void fTimer(ArgArray args) {
         debugC(1, kPrivateDebugScript, "Timer(%d, %s)", args[0].u.val, args[1].u.str);
 
     int32 delay = 1000000 * args[0].u.val;
+    // This pointer is necessary since installTimer needs one
     Common::String *s = new Common::String(args[1].u.str);
     if (delay > 0) {
         assert(g_private->installTimer(delay, s));
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 8843edf2ae..98f1211702 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -69,7 +69,7 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
 
     // Movies
     _nextMovie = "";
-    _nextVS = NULL;
+    _nextVS = "";
     _repeatedMovieExit = "";
 
     // Save and load
@@ -255,8 +255,8 @@ Common::Error PrivateEngine::run() {
             continue;
         }
 
-        if (_nextVS != NULL && _currentSetting == kMainDesktop) {
-            loadImage(*_nextVS, 160, 120);
+        if (!_nextVS.empty() && _currentSetting == kMainDesktop) {
+            loadImage(_nextVS, 160, 120);
             drawScreen();
         }
 
@@ -277,7 +277,6 @@ Common::Error PrivateEngine::run() {
             removeTimer();
             debugC(1, kPrivateDebugFunction, "Executing %s", _nextSetting.c_str());
             clearAreas();
-            // This pointer will be free after load
             _currentSetting = _nextSetting;
             settings.load(_nextSetting);
             _nextSetting = "";
diff --git a/engines/private/private.h b/engines/private/private.h
index c1480d303b..5617413447 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -206,7 +206,7 @@ public:
     Common::Rect screenRect;
     Common::String _framePath;
     Graphics::Surface *_frame;
-    Common::String *_nextVS;
+    Common::String _nextVS;
     void drawScreen();
 
     // settings


Commit: 6b7f690d0789e572c8b426487e174dda3a65eb57
    https://github.com/scummvm/scummvm/commit/6b7f690d0789e572c8b426487e174dda3a65eb57
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: remove pointers

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index f235f0e019..3205249fe8 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -203,18 +203,18 @@ void fBustMovie(ArgArray args) {
 void fDossierAdd(ArgArray args) {
 
     assert (args.size() == 2);
-    Common::String *s1 = new Common::String(args[0].u.str);
-    Common::String *s2 = new Common::String(args[1].u.str);
-    DossierInfo *m = (DossierInfo *)malloc(sizeof(DossierInfo));
-    m->page1 = s1;
+    Common::String s1 = args[0].u.str;
+    Common::String s2 = args[1].u.str; 
+    DossierInfo m = {};
+    m.page1 = s1;
 
-    if (*s2 != "\"\"") {
-        m->page2 = s2;
+    if (s2 != "\"\"") {
+        m.page2 = s2;
     } else {
-        m->page2 = NULL;
+        m.page2 = "";
     }
 
-    g_private->_dossiers.push_back(*m);
+    g_private->_dossiers.push_back(m);
 }
 
 void fDossierBitmap(ArgArray args) {
@@ -553,24 +553,24 @@ void fAddSound(char *s, char *t, Symbol *flag = NULL, int val = 0) {
     if (strcmp(s, "\"\"") == 0)
         return;
 
-    Common::String *sound = new Common::String(s);
+    Common::String sound(s);
     if (strcmp(t, "AMRadioClip") == 0)
-        g_private->_AMRadio.push_back(*sound);
+        g_private->_AMRadio.push_back(sound);
     else if (strcmp(t, "PoliceClip") == 0)
-        g_private->_policeRadio.push_back(*sound);
+        g_private->_policeRadio.push_back(sound);
     else if (strcmp(t, "PhoneClip") == 0) {
         // This condition will avoid adding the same phone call twice,
         // it is unclear why this could be useful, but it looks like a bug
         // in the original scripts
-        if (g_private->_playedPhoneClips.contains(*sound))
+        if (g_private->_playedPhoneClips.contains(sound))
             return;
 
-        g_private->_playedPhoneClips.setVal(*sound, true);
-        PhoneInfo *p = (PhoneInfo *)malloc(sizeof(PhoneInfo));
-        p->sound = sound;
-        p->flag = flag;
-        p->val = val;
-        g_private->_phone.push_back(*p);
+        g_private->_playedPhoneClips.setVal(sound, true);
+        PhoneInfo p = {};
+        p.sound = sound;
+        p.flag = flag;
+        p.val = val;
+        g_private->_phone.push_back(p);
     } else
         error("error: invalid sound type %s", t);
 }
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 98f1211702..fef2a9bb42 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -561,9 +561,8 @@ void PrivateEngine::selectPhoneArea(Common::Point mousePos) {
 
     if (inMask(_phoneArea->surf, mousePos)) {
         PhoneInfo i = _phone.back();
-        Common::String sound(*i.sound);
         setSymbol(i.flag, i.val);
-        sound = _phonePrefix + sound + ".wav";
+        Common::String sound = _phonePrefix + i.sound + ".wav";
         playSound(sound, 1, true, false);
         _phone.pop_back();
     }
@@ -576,9 +575,9 @@ void PrivateEngine::loadDossier() {
     DossierInfo m = _dossiers[_dossierSuspect];
 
     if (_dossierPage == 0) {
-        loadImage(*m.page1, x, y);
+        loadImage(m.page1, x, y);
     } else if (_dossierPage == 1) {
-        loadImage(*m.page2, x, y);
+        loadImage(m.page2, x, y);
     } else
         assert(0);
 }
@@ -700,19 +699,11 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
     // Dossiers
     size = stream->readUint32LE();
     Common::String *file = NULL;
+    DossierInfo m = {};
     for (uint32 i = 0; i < size; ++i) {
-        file = new Common::String(stream->readString());
-
-        DossierInfo *m = (DossierInfo *)malloc(sizeof(DossierInfo));
-        m->page1 = file;
-
-        file = new Common::String(stream->readString());
-        if (file->size() == 0) {
-            m->page2 = NULL;
-        } else {
-            m->page2 = file;
-        }
-        _dossiers.push_back(*m);
+        m.page1 = stream->readString();
+        m.page2 = stream->readString();
+        _dossiers.push_back(m);
     }
 
     // Radios
@@ -732,14 +723,12 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
 
     size = stream->readUint32LE();
     _phone.clear();
-
+    PhoneInfo p = {};
     for (uint32 j = 0; j < size; ++j) {
-        PhoneInfo *i = (PhoneInfo *)malloc(sizeof(PhoneInfo));
-
-        i->sound = new Common::String(stream->readString());
-        i->flag  = maps.variables.getVal(stream->readString());
-        i->val   = stream->readUint32LE();
-        _phone.push_back(*i);
+        p.sound = stream->readString();
+        p.flag  = maps.variables.getVal(stream->readString());
+        p.val   = stream->readUint32LE();
+        _phone.push_back(p);
     }
 
     // Played media
@@ -785,11 +774,11 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
     // Dossiers
     stream->writeUint32LE(_dossiers.size());
     for (DossierArray::iterator it = _dossiers.begin(); it != _dossiers.end(); ++it) {
-        stream->writeString(it->page1->c_str());
+        stream->writeString(it->page1.c_str());
         stream->writeByte(0);
 
-        if (it->page2 != NULL)
-            stream->writeString(it->page2->c_str());
+        if (!it->page2.empty())
+            stream->writeString(it->page2.c_str());
         stream->writeByte(0);
     }
 
@@ -807,7 +796,7 @@ Common::Error PrivateEngine::saveGameStream(Common::WriteStream *stream, bool is
 
     stream->writeUint32LE(_phone.size());
     for (PhoneList::iterator it = _phone.begin(); it != _phone.end(); ++it) {
-        stream->writeString(*it->sound);
+        stream->writeString(it->sound);
         stream->writeByte(0);
         stream->writeString(*it->flag->name);
         stream->writeByte(0);
diff --git a/engines/private/private.h b/engines/private/private.h
index 5617413447..ddbbf77291 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -92,14 +92,14 @@ typedef struct MaskInfo {
 } MaskInfo;
 
 typedef struct PhoneInfo {
-    Common::String *sound;
+    Common::String sound;
     Symbol *flag;
     int val;
 } PhoneInfo;
 
 typedef struct DossierInfo {
-    Common::String *page1;
-    Common::String *page2;
+    Common::String page1;
+    Common::String page2;
 } DossierInfo;
 
 // funcs


Commit: b089f4232933265966bedf0d5d761d588746a49f
    https://github.com/scummvm/scummvm/commit/b089f4232933265966bedf0d5d761d588746a49f
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: remove pointers

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 3205249fe8..2a185e5f48 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -360,25 +360,25 @@ void fExit(ArgArray args) {
     // assert types
     assert(args[2].type == RECT || args[2].type == NAME);
     debugC(1, kPrivateDebugScript, "Exit(%d %d %d)", args[0].type, args[1].type, args[2].type); //, args[0].u.str, args[1].u.sym->name->c_str(), "RECT");
-    ExitInfo *e = (ExitInfo *)malloc(sizeof(ExitInfo));
+    ExitInfo e = {};
 
     if (args[0].type == NUM && args[0].u.val == 0)
-        e->nextSetting = NULL;
+        e.nextSetting = "";
     else
-        e->nextSetting = new Common::String(args[0].u.str);
+        e.nextSetting = args[0].u.str;
 
     if (args[1].type == NUM && args[1].u.val == 0)
-        e->cursor = NULL;
+        e.cursor = "";
     else
-        e->cursor = args[1].u.sym->name;
+        e.cursor = *args[1].u.sym->name;
 
     if (args[2].type == NAME) {
         assert(args[2].u.sym->type == RECT);
         args[2].u.rect = args[2].u.sym->u.rect;
     }
 
-    e->rect = args[2].u.rect;
-    g_private->_exits.push_front(*e);
+    e.rect = *args[2].u.rect;
+    g_private->_exits.push_front(e);
 }
 
 void fSetModifiedFlag(ArgArray args) {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index fef2a9bb42..47d9aa2ac8 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -367,22 +367,22 @@ bool PrivateEngine::cursorExit(Common::Point mousePos) {
     int rs = 100000000;
     int cs = 0;
     ExitInfo e;
-    Common::String *cursor = NULL;
+    Common::String cursor = "";
 
     for (ExitList::iterator it = _exits.begin(); it != _exits.end(); ++it) {
         e = *it;
-        cs = e.rect->width()*e.rect->height();
+        cs = e.rect.width()*e.rect.height();
 
-        if (e.rect->contains(mousePos)) {
-            if (cs < rs && e.cursor != NULL) {
+        if (e.rect.contains(mousePos)) {
+            if (cs < rs && !e.cursor.empty()) {
                 rs = cs;
                 cursor = e.cursor;
             }
         }
     }
 
-    if (cursor != NULL) {
-        changeCursor(*cursor);
+    if (!cursor.empty()) {
+        changeCursor(cursor);
         return true;
     }
 
@@ -449,17 +449,17 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
     if (mousePos.x < 0 || mousePos.y < 0)
         return;
 
-    Common::String *ns = NULL;
+    Common::String ns = "";
     int rs = 100000000;
     int cs = 0;
     ExitInfo e;
     for (ExitList::iterator it = _exits.begin(); it != _exits.end(); ++it) {
         e = *it;
-        cs = e.rect->width()*e.rect->height();
+        cs = e.rect.width()*e.rect.height();
         //debug("Testing exit %s %d", e.nextSetting->c_str(), cs);
-        if (e.rect->contains(mousePos)) {
+        if (e.rect.contains(mousePos)) {
             //debug("Inside! %d %d", cs, rs);
-            if (cs < rs && e.nextSetting != NULL) { // TODO: check this
+            if (cs < rs && !e.nextSetting.empty()) { // TODO: check this
                 // an item was not taken
                 if (_toTake) {
                     playSound(getLeaveSound(), 1, false, false);
@@ -472,9 +472,8 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
             }
         }
     }
-    if (ns != NULL) {
-        _nextSetting = *ns;
-        //setNextSetting(new Common::String(*ns));
+    if (!ns.empty()) {
+        _nextSetting = ns;
     }
 }
 
diff --git a/engines/private/private.h b/engines/private/private.h
index ddbbf77291..ba0d7baa67 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -77,9 +77,9 @@ static const char *kStartGame = "kStartGame";
 // structs
 
 typedef struct ExitInfo {
-    Common::String *nextSetting;
-    Common::Rect   *rect;
-    Common::String *cursor;
+    Common::String nextSetting;
+    Common::Rect   rect;
+    Common::String cursor;
 } ExitInfo;
 
 typedef struct MaskInfo {


Commit: 82b331decf2da3e30d3491917f4d6f38c19abba5
    https://github.com/scummvm/scummvm/commit/82b331decf2da3e30d3491917f4d6f38c19abba5
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: remove more pointers

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 2a185e5f48..0f32514288 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -125,29 +125,33 @@ void fQuit(ArgArray args) {
 void fLoadGame(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "LoadGame(%s, %s)", args[0].u.str, args[2].u.sym->name->c_str());
-    MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
-    m->surf = g_private->loadMask(args[0].u.str, 0, 0, true);
-    m->cursor = args[2].u.sym->name;
-    m->nextSetting = NULL;
-    m->flag1 = NULL;
-    m->flag2 = NULL;
-    free(g_private->_loadGameMask);
+    MaskInfo m = {};
+    m.surf = g_private->loadMask(args[0].u.str, 0, 0, true);
+    m.cursor = *args[2].u.sym->name;
+    m.nextSetting = "";
+    m.flag1 = NULL;
+    m.flag2 = NULL;
+    if (g_private->_loadGameMask.surf)
+        g_private->_loadGameMask.surf->free();
+    delete g_private->_loadGameMask.surf;
     g_private->_loadGameMask = m;
-    g_private->_masks.push_front(*m);
+    g_private->_masks.push_front(m);
 }
 
 void fSaveGame(ArgArray args) {
     // assert types
     debugC(1, kPrivateDebugScript, "SaveGame(%s, %s)", args[0].u.str, args[1].u.sym->name->c_str());
-    MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
-    m->surf = g_private->loadMask(args[0].u.str, 0, 0, true);
-    m->cursor = args[1].u.sym->name;
-    m->nextSetting = NULL;
-    m->flag1 = NULL;
-    m->flag2 = NULL;
-    free(g_private->_saveGameMask);
+    MaskInfo m = {};
+    m.surf = g_private->loadMask(args[0].u.str, 0, 0, true);
+    m.cursor = *args[1].u.sym->name;
+    m.nextSetting = "";
+    m.flag1 = NULL;
+    m.flag2 = NULL;
+    if (g_private->_saveGameMask.surf)
+        g_private->_saveGameMask.surf->free();
+    delete g_private->_saveGameMask.surf;
     g_private->_saveGameMask = m;
-    g_private->_masks.push_front(*m);
+    g_private->_masks.push_front(m);
 }
 
 void fRestartGame(ArgArray args) {
@@ -232,35 +236,35 @@ void fDossierChgSheet(ArgArray args) {
 void fDossierPrevSuspect(ArgArray args) {
     assert (args.size() == 3);
     Common::String s(args[0].u.str);
-    MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
+    MaskInfo m = {};
 
     int x = args[1].u.val;
     int y = args[2].u.val;
 
-    m->surf = g_private->loadMask(s, x, y, true);
-    m->cursor = new Common::String("kExit");
-    m->nextSetting = NULL;
-    m->flag1 = NULL;
-    m->flag2 = NULL;
+    m.surf = g_private->loadMask(s, x, y, true);
+    m.cursor = "kExit";
+    m.nextSetting = "";
+    m.flag1 = NULL;
+    m.flag2 = NULL;
     g_private->_dossierPrevSuspectMask = m;
-    g_private->_masks.push_front(*m);
+    g_private->_masks.push_front(m);
 }
 
 void fDossierNextSuspect(ArgArray args) {
     assert (args.size() == 3);
     Common::String s(args[0].u.str);
-    MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
+    MaskInfo m = {};
 
     int x = args[1].u.val;
     int y = args[2].u.val;
 
-    m->surf = g_private->loadMask(s, x, y, true);
-    m->cursor = new Common::String("kExit");
-    m->nextSetting = NULL;
-    m->flag1 = NULL;
-    m->flag2 = NULL;
+    m.surf = g_private->loadMask(s, x, y, true);
+    m.cursor = "kExit";
+    m.nextSetting = "";
+    m.flag1 = NULL;
+    m.flag2 = NULL;
     g_private->_dossierNextSuspectMask = m;
-    g_private->_masks.push_front(*m);
+    g_private->_masks.push_front(m);
 }
 
 void fNoStopSounds(ArgArray args) {
@@ -300,28 +304,28 @@ void fInventory(ArgArray args) {
     debugC(1, kPrivateDebugScript, "Inventory(...)");
     Common::String mask(b1.u.str);
     if (mask != "\"\"") {
-        MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
-        m->surf = g_private->loadMask(mask, 0, 0, true);
+        MaskInfo m = {};
+        m.surf = g_private->loadMask(mask, 0, 0, true);
 
         if (e.type == NUM)
-            m->nextSetting = NULL;
+            m.nextSetting = "";
         else
-            m->nextSetting = new Common::String(e.u.str);
+            m.nextSetting = *e.u.str;
 
-        m->cursor = new Common::String("kInventory");
-        m->point = new Common::Point(0,0);
+        m.cursor = "kInventory";
+        m.point = Common::Point(0,0);
 
         if (v1.type == NAME)
-            m->flag1 = v1.u.sym;
+            m.flag1 = v1.u.sym;
         else
-            m->flag1 = NULL;
+            m.flag1 = NULL;
 
         if (v2.type == NAME)
-            m->flag2 = v2.u.sym;
+            m.flag2 = v2.u.sym;
         else
-            m->flag2 = NULL;
+            m.flag2 = NULL;
 
-        g_private->_masks.push_front(*m);
+        g_private->_masks.push_front(m);
         g_private->_toTake = true;
         Common::String sound(snd.u.str);
 
@@ -531,14 +535,14 @@ void _fMask(ArgArray args, bool drawn) {
     debugC(1, kPrivateDebugScript, "Mask(%s, %s, %s, %d, %d)", f, e, c->c_str(), x, y);
     const Common::String s(f);
 
-    MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
-    m->surf = g_private->loadMask(s, x, y, drawn);
-    m->nextSetting = new Common::String(e);
-    m->cursor = c;
-    m->flag1 = NULL;
-    m->flag2 = NULL;
-    m->point = new Common::Point(x,y);
-    g_private->_masks.push_front(*m);
+    MaskInfo m = {};
+    m.surf = g_private->loadMask(s, x, y, drawn);
+    m.nextSetting = e;
+    m.cursor = *c;
+    m.flag1 = NULL;
+    m.flag2 = NULL;
+    m.point = Common::Point(x,y);
+    g_private->_masks.push_front(m);
 
 }
 
@@ -615,37 +619,40 @@ void fSoundArea(ArgArray args) {
 
     debugC(1, kPrivateDebugScript, "SoundArea(%s, %s, ..)", args[0].u.str, n.c_str());
     Common::String s = args[0].u.str;
-
+    MaskInfo m = {};
     if (n == "kAMRadio") {
-        MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
-        m->surf = g_private->loadMask(s, 0, 0, true);
-        m->cursor = args[2].u.sym->name;
-        m->nextSetting = NULL;
-        m->flag1 = NULL;
-        m->flag2 = NULL;
-        free(g_private->_AMRadioArea);
+        m.surf = g_private->loadMask(s, 0, 0, true);
+        m.cursor = *args[2].u.sym->name;
+        m.nextSetting = "";
+        m.flag1 = NULL;
+        m.flag2 = NULL;
+        if (g_private->_AMRadioArea.surf)
+            g_private->_AMRadioArea.surf->free();
+        delete g_private->_AMRadioArea.surf;
         g_private->_AMRadioArea = m;
-        g_private->_masks.push_front(*m);
+        g_private->_masks.push_front(m);
     } else if (n == "kPoliceRadio") {
-        MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
-        m->surf = g_private->loadMask(s, 0, 0, true);
-        m->cursor = args[2].u.sym->name;
-        m->nextSetting = NULL;
-        m->flag1 = NULL;
-        m->flag2 = NULL;
-        free(g_private->_policeRadioArea);
+        m.surf = g_private->loadMask(s, 0, 0, true);
+        m.cursor = *args[2].u.sym->name;
+        m.nextSetting = "";
+        m.flag1 = NULL;
+        m.flag2 = NULL;
+        if (g_private->_policeRadioArea.surf)
+            g_private->_policeRadioArea.surf->free();
+        delete g_private->_policeRadioArea.surf;
         g_private->_policeRadioArea = m;
-        g_private->_masks.push_front(*m);
+        g_private->_masks.push_front(m);
     } else if (n == "kPhone") {
-        MaskInfo *m = (MaskInfo *)malloc(sizeof(MaskInfo));
-        m->surf = g_private->loadMask(s, 0, 0, true);
-        m->cursor = args[2].u.sym->name;
-        m->nextSetting = NULL;
-        m->flag1 = NULL;
-        m->flag2 = NULL;
-        free(g_private->_phoneArea);
+        m.surf = g_private->loadMask(s, 0, 0, true);
+        m.cursor = *args[2].u.sym->name;
+        m.nextSetting = "";
+        m.flag1 = NULL;
+        m.flag2 = NULL;
+        if (g_private->_phoneArea.surf)
+            g_private->_phoneArea.surf->free();
+        delete g_private->_phoneArea.surf;
         g_private->_phoneArea = m;
-        g_private->_masks.push_front(*m);
+        g_private->_masks.push_front(m);
     }
 }
 
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 47d9aa2ac8..1fb026fe71 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -73,8 +73,8 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     _repeatedMovieExit = "";
 
     // Save and load
-    _saveGameMask = NULL;
-    _loadGameMask = NULL;
+    _saveGameMask = {};
+    _loadGameMask = {};
 
     // Interface
     _framePath = "inface/general/inface2.bmp";
@@ -90,9 +90,9 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     _noStopSounds = false;
 
     // Radios and phone
-    _policeRadioArea = NULL;
-    _AMRadioArea = NULL;
-    _phoneArea = NULL;
+    _policeRadioArea = {};
+    _AMRadioArea = {};
+    _phoneArea = {};
     // TODO: use this as a default sound for radio
     _infaceRadioPath = "inface/radio/";
     _phonePrefix = "inface/telephon/";
@@ -101,8 +101,8 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
     // Dossiers
     _dossierPage = 0;
     _dossierSuspect = 0;
-    _dossierNextSuspectMask = NULL;
-    _dossierPrevSuspectMask = NULL;
+    _dossierNextSuspectMask = {};
+    _dossierPrevSuspectMask = {};
 
     // Diary
     _diaryLocPrefix = "inface/diary/loclist/";
@@ -302,20 +302,40 @@ void PrivateEngine::clearAreas() {
     _exits.clear();
     _masks.clear();
 
-    free(_loadGameMask);
-    _loadGameMask = NULL;
-    free(_saveGameMask);
-    _saveGameMask = NULL;
-    free(_policeRadioArea); 
-    _policeRadioArea = NULL;
-    free(_AMRadioArea);
-    _AMRadioArea = NULL;
-    free(_phoneArea);
-    _phoneArea = NULL;
-    free(_dossierNextSuspectMask);
-    _dossierNextSuspectMask = NULL;
-    free(_dossierPrevSuspectMask);
-    _dossierPrevSuspectMask = NULL;
+    if (_loadGameMask.surf) 
+        _loadGameMask.surf->free();
+    delete _loadGameMask.surf;
+    _loadGameMask = {};
+
+    if (_saveGameMask.surf)
+        _saveGameMask.surf->free();
+    delete _saveGameMask.surf;
+    _saveGameMask = {};
+
+    if (_policeRadioArea.surf)
+        _policeRadioArea.surf->free();
+    delete _policeRadioArea.surf; 
+    _policeRadioArea = {};
+
+    if (_AMRadioArea.surf)
+        _AMRadioArea.surf->free();
+    delete _AMRadioArea.surf;
+    _AMRadioArea = {};
+
+    if (_phoneArea.surf)
+        _phoneArea.surf->free();
+    delete _phoneArea.surf;
+    _phoneArea = {};
+
+    if (_dossierNextSuspectMask.surf)
+        _dossierNextSuspectMask.surf->free();
+    delete _dossierNextSuspectMask.surf;
+    _dossierNextSuspectMask = {};
+
+    if (_dossierPrevSuspectMask.surf)
+        _dossierPrevSuspectMask.surf->free();
+    delete _dossierPrevSuspectMask.surf;
+    _dossierPrevSuspectMask = {};
 }
 
 void PrivateEngine::startPoliceBust() {
@@ -411,9 +431,9 @@ bool PrivateEngine::cursorMask(Common::Point mousePos) {
         m = *it;
 
         if (inMask(m.surf, mousePos)) {
-            if (m.cursor != NULL) { // TODO: check this
+            if (!m.cursor.empty()) { // TODO: check this
                 inside = true;
-                changeCursor(*m.cursor);
+                changeCursor(m.cursor);
                 break;
             }
         }
@@ -478,14 +498,14 @@ void PrivateEngine::selectExit(Common::Point mousePos) {
 }
 
 void PrivateEngine::selectMask(Common::Point mousePos) {
-    Common::String *ns = NULL;
+    Common::String ns = "";
     MaskInfo m;
     for (MaskList::iterator it = _masks.begin(); it != _masks.end(); ++it) {
         m = *it;
         //debug("Testing mask %s", m.nextSetting->c_str());
         if (inMask(m.surf, mousePos)) {
             //debug("Inside!");
-            if (m.nextSetting != NULL) { // TODO: check this
+            if (!m.nextSetting.empty()) { // TODO: check this
                 //debug("Found Mask %s", m.nextSetting->c_str());
                 ns = m.nextSetting;
             }
@@ -505,21 +525,20 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
             break;
         }
     }
-    if (ns != NULL) {
+    if (!ns.empty()) {
         //debug("Mask selected %s", ns->c_str());
-        _nextSetting = *ns;
-        //setNextSetting(new Common::String(*ns));
+        _nextSetting = ns;
     }
 }
 
 void PrivateEngine::selectAMRadioArea(Common::Point mousePos) {
-    if (_AMRadioArea == NULL)
+    if (_AMRadioArea.surf == NULL)
         return;
 
     if (_AMRadio.empty())
         return;
 
-    if (inMask(_AMRadioArea->surf, mousePos)) {
+    if (inMask(_AMRadioArea.surf, mousePos)) {
         Common::String sound = _infaceRadioPath + "comm_/" + _AMRadio.back() + ".wav";
         playSound(sound, 1, false, false);
         _AMRadio.pop_back();
@@ -527,13 +546,13 @@ void PrivateEngine::selectAMRadioArea(Common::Point mousePos) {
 }
 
 void PrivateEngine::selectPoliceRadioArea(Common::Point mousePos) {
-    if (_policeRadioArea == NULL)
+    if (_policeRadioArea.surf == NULL)
         return;
 
     if (_policeRadio.empty())
         return;
 
-    if (inMask(_policeRadioArea->surf, mousePos)) {
+    if (inMask(_policeRadioArea.surf, mousePos)) {
         Common::String sound = _infaceRadioPath + "police/" + _policeRadio.back() + ".wav";
         playSound(sound, 1, false, false);
         _policeRadio.pop_back();
@@ -541,7 +560,7 @@ void PrivateEngine::selectPoliceRadioArea(Common::Point mousePos) {
 }
 
 void PrivateEngine::checkPhoneCall() {
-    if (_phoneArea == NULL)
+    if (_phoneArea.surf == NULL)
         return;
 
     if (_phone.empty())
@@ -552,13 +571,13 @@ void PrivateEngine::checkPhoneCall() {
 }
 
 void PrivateEngine::selectPhoneArea(Common::Point mousePos) {
-    if (_phoneArea == NULL)
+    if (_phoneArea.surf == NULL)
         return;
 
     if (_phone.empty())
         return;
 
-    if (inMask(_phoneArea->surf, mousePos)) {
+    if (inMask(_phoneArea.surf, mousePos)) {
         PhoneInfo i = _phone.back();
         setSymbol(i.flag, i.val);
         Common::String sound = _phonePrefix + i.sound + ".wav";
@@ -582,16 +601,16 @@ void PrivateEngine::loadDossier() {
 }
 
 bool PrivateEngine::selectDossierNextSuspect(Common::Point mousePos) {
-    if (_dossierNextSuspectMask == NULL)
+    if (_dossierNextSuspectMask.surf == NULL)
         return false;
 
-    if (inMask(_dossierNextSuspectMask->surf, mousePos)) {
+    if (inMask(_dossierNextSuspectMask.surf, mousePos)) {
         if ((_dossierSuspect + 1) < _dossiers.size()) {
             _dossierSuspect++;
             _dossierPage = 0;
             loadDossier();
-            drawMask(_dossierNextSuspectMask->surf);
-            drawMask(_dossierPrevSuspectMask->surf);
+            drawMask(_dossierNextSuspectMask.surf);
+            drawMask(_dossierPrevSuspectMask.surf);
             drawScreen();
         }
         return true;
@@ -600,16 +619,16 @@ bool PrivateEngine::selectDossierNextSuspect(Common::Point mousePos) {
 }
 
 bool PrivateEngine::selectDossierPrevSuspect(Common::Point mousePos) {
-    if (_dossierPrevSuspectMask == NULL)
+    if (_dossierPrevSuspectMask.surf == NULL)
         return false;
 
-    if (inMask(_dossierPrevSuspectMask->surf, mousePos)) {
+    if (inMask(_dossierPrevSuspectMask.surf, mousePos)) {
         if (_dossierSuspect > 0) {
             _dossierSuspect--;
             _dossierPage = 0;
             loadDossier();
-            drawMask(_dossierNextSuspectMask->surf);
-            drawMask(_dossierPrevSuspectMask->surf);
+            drawMask(_dossierNextSuspectMask.surf);
+            drawMask(_dossierPrevSuspectMask.surf);
             drawScreen();
         }
         return true;
@@ -618,22 +637,21 @@ bool PrivateEngine::selectDossierPrevSuspect(Common::Point mousePos) {
 }
 
 void PrivateEngine::selectLoadGame(Common::Point mousePos) {
-    if (_loadGameMask == NULL)
+    if (_loadGameMask.surf == NULL)
         return;
 
-    if (inMask(_loadGameMask->surf, mousePos)) {
+    if (inMask(_loadGameMask.surf, mousePos)) {
         loadGameDialog();
     }
 }
 
 void PrivateEngine::selectSaveGame(Common::Point mousePos) {
-    if (_saveGameMask == NULL)
+    if (_saveGameMask.surf == NULL)
         return;
 
-    if (inMask(_saveGameMask->surf, mousePos)) {
+    if (inMask(_saveGameMask.surf, mousePos)) {
         saveGameDialog();
     }
-
 }
 
 bool PrivateEngine::hasFeature(EngineFeature f) const {
diff --git a/engines/private/private.h b/engines/private/private.h
index ba0d7baa67..421bbf50bf 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -84,11 +84,11 @@ typedef struct ExitInfo {
 
 typedef struct MaskInfo {
     Graphics::ManagedSurface *surf;
-    Common::String *nextSetting;
-    Common::Point *point;
+    Common::String nextSetting;
+    Common::Point point;
     Symbol *flag1;
     Symbol *flag2;
-    Common::String *cursor;
+    Common::String cursor;
 } MaskInfo;
 
 typedef struct PhoneInfo {
@@ -228,8 +228,8 @@ public:
     DossierArray _dossiers;
     unsigned int _dossierSuspect;
     unsigned int _dossierPage;
-    MaskInfo *_dossierNextSuspectMask;
-    MaskInfo *_dossierPrevSuspectMask;
+    MaskInfo _dossierNextSuspectMask;
+    MaskInfo _dossierPrevSuspectMask;
     bool selectDossierNextSuspect(Common::Point);
     bool selectDossierPrevSuspect(Common::Point);
     void loadDossier();
@@ -251,8 +251,8 @@ public:
     void loadInventory(uint32, Common::Rect *, Common::Rect *);
 
     // Save/Load games
-    MaskInfo *_saveGameMask;
-    MaskInfo *_loadGameMask;
+    MaskInfo _saveGameMask;
+    MaskInfo _loadGameMask;
 
     int _mode;
     bool _modified;
@@ -280,9 +280,9 @@ public:
 
     // Radios
     Common::String _infaceRadioPath;
-    MaskInfo *_AMRadioArea;
-    MaskInfo *_policeRadioArea;
-    MaskInfo *_phoneArea;
+    MaskInfo _AMRadioArea;
+    MaskInfo _policeRadioArea;
+    MaskInfo _phoneArea;
     Common::String _phonePrefix;
     Common::String _phoneCallSound;
     SoundList _AMRadio;


Commit: f1f9a1c7c1487a58c6546d98e2c6c4db16c5cf80
    https://github.com/scummvm/scummvm/commit/f1f9a1c7c1487a58c6546d98e2c6c4db16c5cf80
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixes

Changed paths:
    engines/private/funcs.cpp
    engines/private/grammar.h
    engines/private/private.cpp


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index 0f32514288..f15794cdb3 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -310,7 +310,7 @@ void fInventory(ArgArray args) {
         if (e.type == NUM)
             m.nextSetting = "";
         else
-            m.nextSetting = *e.u.str;
+            m.nextSetting = e.u.str;
 
         m.cursor = "kInventory";
         m.point = Common::Point(0,0);
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 1812b88e44..652df85a71 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -90,7 +90,7 @@ class SettingMaps {
 // Funtions
 
 typedef Common::Array<Datum> ArgArray;
-extern void call(char *, ArgArray);
+void call(char *, ArgArray);
 
 // Code Generation
 
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 1fb026fe71..5c51d4186c 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -715,7 +715,6 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
 
     // Dossiers
     size = stream->readUint32LE();
-    Common::String *file = NULL;
     DossierInfo m = {};
     for (uint32 i = 0; i < size; ++i) {
         m.page1 = stream->readString();
@@ -1006,7 +1005,7 @@ Common::String PrivateEngine::getPaperShuffleSound() {
 
 Common::String PrivateEngine::getTakeSound() {
     if (isDemo())
-        return (Common::String(_globalAudioPath + "mvo007.wav"));
+        return (_globalAudioPath + "mvo007.wav");
 
     uint r = _rnd->getRandomNumber(4) + 1;
     return Common::String::format("%stook%d.wav", _globalAudioPath.c_str(), r);
@@ -1015,15 +1014,15 @@ Common::String PrivateEngine::getTakeSound() {
 Common::String PrivateEngine::getTakeLeaveSound() {
     uint r = _rnd->getRandomNumber(1);
     if (r == 0) {
-        return (Common::String(_globalAudioPath + "mvo001.wav"));
+        return (_globalAudioPath + "mvo001.wav");
     } else {
-        return (Common::String(_globalAudioPath + "mvo006.wav"));
+        return (_globalAudioPath + "mvo006.wav");
     }
 }
 
 Common::String PrivateEngine::getLeaveSound() {
     if (isDemo())
-        return (Common::String(_globalAudioPath + "mvo008.wav"));
+        return (_globalAudioPath + "mvo008.wav");
 
     uint r = _rnd->getRandomNumber(4) + 1;
     return Common::String::format("%sleft%d.wav", _globalAudioPath.c_str(), r);


Commit: f29dc856147f32c6d3544b3bb3172df0c6ee8d76
    https://github.com/scummvm/scummvm/commit/f29dc856147f32c6d3544b3bb3172df0c6ee8d76
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: remove more pointers

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index f15794cdb3..bc2e21739d 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -553,11 +553,10 @@ void fMaskDrawn(ArgArray args) {
     _fMask(args, true);
 }
 
-void fAddSound(char *s, char *t, Symbol *flag = NULL, int val = 0) {
-    if (strcmp(s, "\"\"") == 0)
+void fAddSound(Common::String sound, char *t, Symbol *flag = NULL, int val = 0) {
+    if (sound == "\"\"")
         return;
 
-    Common::String sound(s);
     if (strcmp(t, "AMRadioClip") == 0)
         g_private->_AMRadio.push_back(sound);
     else if (strcmp(t, "PoliceClip") == 0)
@@ -601,8 +600,8 @@ void fPhoneClip(ArgArray args) {
         fAddSound(args[0].u.str, "PhoneClip", args[4].u.sym, args[5].u.val);
     else {
         assert(i < j);
-        char *clip = g_private->getRandomPhoneClip(args[0].u.str, i, j);
-        fAddSound(clip, "PhoneClip", args[4].u.sym, args[5].u.val);
+        Common::String sound = g_private->getRandomPhoneClip(args[0].u.str, i, j);
+        fAddSound(sound, "PhoneClip", args[4].u.sym, args[5].u.val);
     }
 }
 
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 5c51d4186c..0a2f10fcb6 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -461,7 +461,6 @@ void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
             }
         }
     }
-
 }
 
 void PrivateEngine::selectExit(Common::Point mousePos) {
@@ -1028,12 +1027,9 @@ Common::String PrivateEngine::getLeaveSound() {
     return Common::String::format("%sleft%d.wav", _globalAudioPath.c_str(), r);
 }
 
-char *PrivateEngine::getRandomPhoneClip(const char *clip, int i, int j) {
+Common::String PrivateEngine::getRandomPhoneClip(const char *clip, int i, int j) {
     uint r = i + _rnd->getRandomNumber(j - i);
-
-    char *f = (char *)malloc((strlen(clip) + 3) * sizeof(char));
-    snprintf(f, 32, "%s%02d", clip, r);
-    return f;
+    return Common::String::format("%s%02d", clip, r);
 }
 
 // Timers
diff --git a/engines/private/private.h b/engines/private/private.h
index 421bbf50bf..32bfeb4d40 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -289,7 +289,7 @@ public:
     SoundList _policeRadio;
     PhoneList _phone;
 
-    char *getRandomPhoneClip(const char *, int, int);
+    Common::String getRandomPhoneClip(const char *, int, int);
     void selectAMRadioArea(Common::Point);
     void selectPoliceRadioArea(Common::Point);
     void selectPhoneArea(Common::Point);


Commit: 817fc1ba0c8d7508992ba3aa45a3268711e6a8e2
    https://github.com/scummvm/scummvm/commit/817fc1ba0c8d7508992ba3aa45a3268711e6a8e2
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
COMMON: moved include guard to the top

Changed paths:
    common/installshieldv3_archive.h


diff --git a/common/installshieldv3_archive.h b/common/installshieldv3_archive.h
index 6506613c8f..f11dfbd210 100644
--- a/common/installshieldv3_archive.h
+++ b/common/installshieldv3_archive.h
@@ -20,6 +20,9 @@
  *
  */
 
+#ifndef COMMON_INSTALLER_ARCHIVE_H
+#define COMMON_INSTALLER_ARCHIVE_H
+
 #include "common/archive.h"
 #include "common/scummsys.h"
 #include "common/endian.h"
@@ -28,9 +31,6 @@
 #include "common/hashmap.h"
 #include "common/str.h"
 
-#ifndef COMMON_INSTALLER_ARCHIVE_H
-#define COMMON_INSTALLER_ARCHIVE_H
-
 namespace Common {
 
 class InstallShieldV3 : public Common::Archive {


Commit: 750eeeb85faaa08893d4fc02386ee14dc04a4b85
    https://github.com/scummvm/scummvm/commit/750eeeb85faaa08893d4fc02386ee14dc04a4b85
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: removed screen locking

Changed paths:
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 0a2f10fcb6..a43c7972dd 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -929,8 +929,9 @@ void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
     //drawScreen();
 }
 
-void PrivateEngine::drawScreenFrame(Graphics::Surface *surf) {
-    surf->copyRectToSurface(*_frame, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
+void PrivateEngine::drawScreenFrame() {
+    g_system->copyRectToScreen(_frame->getPixels(), _frame->pitch, 0, 0, _screenW, _screenH);
+    //surf->copyRectToSurface(*_frame, 0, 0, Common::Rect(0, 0, _screenW, _screenH));
 }
 
 
@@ -979,13 +980,13 @@ void PrivateEngine::drawScreen() {
         delete cframe;
     }
 
-    Graphics::Surface *screen = g_system->lockScreen();
     if (_mode == 1) {
-        drawScreenFrame(screen);
+        drawScreenFrame();
     }
-    Common::Rect window(_origin->x, _origin->y, _screenW - _origin->x, _screenH - _origin->y);
-    screen->copyRectToSurface(*surface, _origin->x, _origin->y, window);
-    g_system->unlockScreen();
+
+    Common::Rect w(_origin->x, _origin->y, _screenW - _origin->x, _screenH - _origin->y);
+    Graphics::Surface sa = surface->getSubArea(w);
+    g_system->copyRectToScreen(sa.getPixels(), sa.pitch, _origin->x, _origin->y, sa.w, sa.h);
     //if (_image->getPalette() != nullptr)
     //    g_system->getPaletteManager()->setPalette(_image->getPalette(), _image->getPaletteStartIndex(), _image->getPaletteColorCount());
     g_system->updateScreen();
diff --git a/engines/private/private.h b/engines/private/private.h
index 32bfeb4d40..f66d7c0103 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -192,7 +192,7 @@ public:
     void skipVideo();
 
     void loadImage(const Common::String &file, int x, int y);
-    void drawScreenFrame(Graphics::Surface *);
+    void drawScreenFrame();
 
     void changeCursor(Common::String);
     void initCursors();


Commit: de9309bb049c394fae1fe6593b51cda621042bf6
    https://github.com/scummvm/scummvm/commit/de9309bb049c394fae1fe6593b51cda621042bf6
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: code convention fixes

Changed paths:
    engines/private/private.cpp
    engines/private/symbol.h


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index a43c7972dd..9c8c4dd753 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -240,7 +240,7 @@ Common::Error PrivateEngine::run() {
                 break;
 
             default:
-            break;
+                break;
             }
         }
 
diff --git a/engines/private/symbol.h b/engines/private/symbol.h
index c149ee4b62..6f1ebb0cda 100644
--- a/engines/private/symbol.h
+++ b/engines/private/symbol.h
@@ -56,24 +56,24 @@ typedef Common::Queue<Common::Rect *> RectQueue;
 
 class SymbolMaps {
     private:
-    StringQueue stringToDefine;
-    RectQueue rectToDefine;
+        StringQueue stringToDefine;
+        RectQueue rectToDefine;
 
     public:
-    SymbolMap settings; 
-    SymbolMap variables;
-    SymbolMap cursors;
-    SymbolMap locations;
-    SymbolMap rects;
-    ConstantList constants;
+        SymbolMap settings; 
+        SymbolMap variables;
+        SymbolMap cursors;
+        SymbolMap locations;
+        SymbolMap rects;
+        ConstantList constants;
     
-    NameList variableList;
-    NameList locationList;
+        NameList variableList;
+        NameList locationList;
 
-    Symbol *constant(int t, int d, char *s);
-    Symbol *lookupName(char *n);
-    void installAll(char *n);
-    void defineSymbol(char *, Common::Rect *);
+        Symbol *constant(int t, int d, char *s);
+        Symbol *lookupName(char *n);
+        void installAll(char *n);
+        void defineSymbol(char *, Common::Rect *);
 };
 
 } // End of namespace Private


Commit: fbbee9b31a33524e035ddc8a6d51302c2e8eaba0
    https://github.com/scummvm/scummvm/commit/fbbee9b31a33524e035ddc8a6d51302c2e8eaba0
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: remove more pointers

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index bc2e21739d..bcd3711dc2 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -44,9 +44,9 @@ void fChgMode(ArgArray args) {
     g_private->_nextSetting = args[1].u.str;
 
     if (g_private->_mode == 0) {
-        g_private->setOrigin(kOriginZero);
+        g_private->_origin = Common::Point(kOriginZero[0], kOriginZero[1]);
     } else if (g_private->_mode == 1) {
-        g_private->setOrigin(kOriginOne);
+        g_private->_origin = Common::Point(kOriginOne[0], kOriginOne[1]);
     } else
         assert(0);
 
@@ -174,7 +174,7 @@ void fPoliceBust(ArgArray args) {
         } else if (args[1].u.val == 3) {
             g_private->_nextSetting = kMainDesktop;
             g_private->_mode = 0;
-            g_private->setOrigin(kOriginZero);
+            g_private->_origin = Common::Point(kOriginZero[0], kOriginZero[1]);
         } else
             assert(0);
     }
@@ -463,7 +463,7 @@ void fResume(ArgArray args) {
     g_private->_nextSetting = g_private->_pausedSetting;
     g_private->_pausedSetting = "";
     g_private->_mode = 1;
-    g_private->setOrigin(kOriginOne);
+    g_private->_origin = Common::Point(kOriginOne[0], kOriginOne[1]);
 }
 
 void fMovie(ArgArray args) {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 9c8c4dd753..9b53259708 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -121,11 +121,6 @@ void PrivateEngine::initializePath(const Common::FSNode &gamePath) {
     SearchMan.addDirectory(gamePath.getPath(), gamePath, 0, 10);
 }
 
-void PrivateEngine::setOrigin(const int point[2]) {
-    delete _origin;
-    _origin = new Common::Point(point[0], point[1]);;
-}
-
 Common::Error PrivateEngine::run() {
 
     assert(_installerArchive.open("SUPPORT/ASSETS.Z"));
@@ -168,7 +163,7 @@ Common::Error PrivateEngine::run() {
     initGraphics(_screenW, _screenH, &_pixelFormat);
     screenRect = Common::Rect(0, 0, _screenW, _screenH);
     changeCursor("default");
-    _origin = new Common::Point(0, 0);
+    _origin = Common::Point(0, 0);
     _image = new Image::BitmapDecoder();
     _compositeSurface = new Graphics::ManagedSurface();
     _compositeSurface->create(_screenW, _screenH, _pixelFormat);
@@ -380,7 +375,7 @@ void PrivateEngine::checkPoliceBust() {
 }
 
 bool PrivateEngine::cursorExit(Common::Point mousePos) {
-    mousePos = mousePos - *_origin;
+    mousePos = mousePos - _origin;
     if (mousePos.x < 0 || mousePos.y < 0)
         return false;
 
@@ -413,7 +408,7 @@ bool PrivateEngine::inMask(Graphics::ManagedSurface *surf, Common::Point mousePo
     if (surf == NULL)
         return false;
 
-    mousePos = mousePos - *_origin;
+    mousePos = mousePos - _origin;
     if (mousePos.x < 0 || mousePos.y < 0)
         return false;
 
@@ -443,7 +438,7 @@ bool PrivateEngine::cursorMask(Common::Point mousePos) {
 
 bool PrivateEngine::cursorPauseMovie(Common::Point mousePos) {
     if (_mode == 1) {
-        Common::Rect window(_origin->x, _origin->y, _screenW - _origin->x, _screenH - _origin->y);
+        Common::Rect window(_origin.x, _origin.y, _screenW - _origin.x, _screenH - _origin.y);
         if (!window.contains(mousePos)) {
             return true;
         }
@@ -453,7 +448,7 @@ bool PrivateEngine::cursorPauseMovie(Common::Point mousePos) {
 
 void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
     if (_mode == 1) {
-        Common::Rect window(_origin->x, _origin->y, _screenW - _origin->x, _screenH - _origin->y);
+        Common::Rect window(_origin.x, _origin.y, _screenW - _origin.x, _screenH - _origin.y);
         if (!window.contains(mousePos)) {
             if (!_pausedSetting.empty()) {
                 _pausedSetting = _currentSetting;
@@ -464,7 +459,7 @@ void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
 }
 
 void PrivateEngine::selectExit(Common::Point mousePos) {
-    mousePos = mousePos - *_origin;
+    mousePos = mousePos - _origin;
     if (mousePos.x < 0 || mousePos.y < 0)
         return;
 
@@ -922,7 +917,7 @@ void PrivateEngine::loadImage(const Common::String &name, int x, int y) {
 
     _image->loadStream(file);
     Graphics::Surface *surf = _image->getSurface()->convertTo(_pixelFormat, _image->getPalette());
-    _compositeSurface->transBlitFrom(*surf, *_origin + Common::Point(x,y), _transparentColor);
+    _compositeSurface->transBlitFrom(*surf, _origin + Common::Point(x,y), _transparentColor);
     surf->free();
     delete surf;
     _image->destroy();
@@ -960,7 +955,7 @@ Graphics::ManagedSurface *PrivateEngine::loadMask(const Common::String &name, in
 }
 
 void PrivateEngine::drawMask(Graphics::ManagedSurface *surf) {
-    _compositeSurface->transBlitFrom(surf->rawSurface(), *_origin, _transparentColor);
+    _compositeSurface->transBlitFrom(surf->rawSurface(), _origin, _transparentColor);
     //drawScreen();
 }
 
@@ -984,9 +979,9 @@ void PrivateEngine::drawScreen() {
         drawScreenFrame();
     }
 
-    Common::Rect w(_origin->x, _origin->y, _screenW - _origin->x, _screenH - _origin->y);
+    Common::Rect w(_origin.x, _origin.y, _screenW - _origin.x, _screenH - _origin.y);
     Graphics::Surface sa = surface->getSubArea(w);
-    g_system->copyRectToScreen(sa.getPixels(), sa.pitch, _origin->x, _origin->y, sa.w, sa.h);
+    g_system->copyRectToScreen(sa.getPixels(), sa.pitch, _origin.x, _origin.y, sa.w, sa.h);
     //if (_image->getPalette() != nullptr)
     //    g_system->getPaletteManager()->setPalette(_image->getPalette(), _image->getPaletteStartIndex(), _image->getPaletteColorCount());
     g_system->updateScreen();
diff --git a/engines/private/private.h b/engines/private/private.h
index f66d7c0103..0f9371e71d 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -212,17 +212,11 @@ public:
     // settings
     Common::String _nextSetting;
     Common::String _pausedSetting;
-    Common::String  _currentSetting;
+    Common::String _currentSetting;
 
     Common::String _nextMovie;
-    const Common::Point *_origin;
-    void setOrigin(const int[2]);
-
-    //void setNextSetting(Common::String *);
-    //void setNextMovie(Common::String *);
-    
-
-    bool            _toTake;
+    Common::Point  _origin;
+    bool           _toTake;
 
     // Dossiers
     DossierArray _dossiers;


Commit: fb798eaa0bbdae1272e9bfd253a548e465131319
    https://github.com/scummvm/scummvm/commit/fb798eaa0bbdae1272e9bfd253a548e465131319
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: class re-organization

Changed paths:
    engines/private/code.cpp
    engines/private/funcs.cpp
    engines/private/grammar.cpp
    engines/private/grammar.h
    engines/private/grammar.y
    engines/private/lexer.cpp
    engines/private/lexer.l
    engines/private/private.cpp
    engines/private/private.h
    engines/private/tokens.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index c8f53b0525..2bf6c54442 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -53,59 +53,63 @@
 
 namespace Private {
 
-Datum *stack  = NULL; /* the stack */
-Datum *stackp = NULL; /* next free spot on stack */
+using namespace Gen;
 
-Inst *prog    = NULL; /* the machine */
-Inst *progp   = NULL; /* next free spot for code generation */
-Inst *pc      = NULL; /* program counter during execution */
+VM *Gen::g_vm = new VM();
+SettingMaps *g_setts = new SettingMaps();
+
+void Gen::VM::run() {
+    execute(g_vm->_prog);
+}
 
 /* initialize setting for code generation */
-void SettingMaps::init() {
-    setting = (Setting *)malloc(sizeof(Setting));
-    memset((void *)setting, 0, sizeof(Setting));
+void SettingMaps::init() { 
+    _setting = (Setting *)malloc(sizeof(Setting));
+    memset((void *)_setting, 0, sizeof(Setting));
 
-    prog = (Inst *)&setting->prog;
-    stack = (Datum *)&setting->stack;
+    Gen::g_vm->_prog = (Inst *)&_setting->prog;
+    Gen::g_vm->_stack = (Datum *)&_setting->stack;
 
-    stackp = stack;
-    progp = prog;
+    Gen::g_vm->_progp = Gen::g_vm->_prog;
+    Gen::g_vm->_stackp = Gen::g_vm->_stack;
 }
 
 void SettingMaps::save(char *name) {
-    map.setVal(name, setting);
+    _map.setVal(name, _setting);
 }
 
 void SettingMaps::load(Common::String &name) {
-    assert(map.contains(name));
-    setting = map.getVal(name);
+    assert(_map.contains(name));
+    _setting = _map.getVal(name);
 
     debugC(1, kPrivateDebugCode, "loading setting %s", name.c_str());
 
-    prog = (Inst *)&setting->prog;
-    stack = (Datum *)&setting->stack;
+    Gen::g_vm->_prog = (Inst *)&_setting->prog;
+    Gen::g_vm->_stack = (Datum *)&_setting->stack;
 
-    stackp = stack;
-    progp = prog;
+    Gen::g_vm->_stackp = Gen::g_vm->_stack;
+    Gen::g_vm->_progp = Gen::g_vm->_prog;
 }
 
-/* push d onto stack */
-int push(Datum d) {
-    assert (!(stackp >= &stack[NSTACK]));
-    *stackp++ = d;
-    return 0;
-}
+namespace Gen {
 
 /* pop and return top elem from stack */
 Datum pop() {
-    assert (!(stackp <= stack));
-    return *--stackp;
+    assert (!(g_vm->_stackp <= g_vm->_stack));
+    return *--g_vm->_stackp;
+}
+
+/* push d onto stack */
+int push(Datum d) {
+    assert (!(g_vm->_stackp >= &g_vm->_stack[NSTACK]));
+    *g_vm->_stackp++ = d;
+    return 0;
 }
 
 /* push constant onto stack */
 int constpush() {
     Datum d;
-    Symbol *s = (Symbol *)*pc++;
+    Symbol *s = (Symbol *)*g_vm->_pc++;
     d.type = NUM;
     d.u.val = s->u.val;
 
@@ -117,7 +121,7 @@ int constpush() {
 int strpush() { /* push constant onto stack */
     Datum d;
     d.type = STRING;
-    Symbol *s = (Symbol *)*pc++;
+    Symbol *s = (Symbol *)*g_vm->_pc++;
     d.u.str = s->u.str;
     debugC(1, kPrivateDebugCode, "pushing const %s with name %s", d.u.str, s->name->c_str());
 
@@ -128,7 +132,7 @@ int strpush() { /* push constant onto stack */
 int varpush() { /* push variable onto stack */
     Datum d;
     d.type = NAME;
-    d.u.sym = (Symbol *)(*pc++);
+    d.u.sym = (Symbol *)(*g_vm->_pc++);
     debugC(1, kPrivateDebugCode, "var pushing %s", d.u.sym->name->c_str());
     push(d);
     return 0;
@@ -351,16 +355,16 @@ int ne() {
 
 /* install one instruction or operand */
 Inst *code(Inst f) {
-    debugC(1, kPrivateDebugCode, "pushing code at %x", progp);
-    Inst *oprogp = progp;
-    assert (!(progp >= &prog[NPROG]));
-    *progp++ = f;
+    //debugC(1, kPrivateDebugCode, "pushing code at %x", progp);
+    Inst *oprogp = g_vm->_progp;
+    assert (!(g_vm->_progp >= &g_vm->_prog[NPROG]));
+    *g_vm->_progp++ = f;
     return oprogp;
 }
 
 int ifcode() {
     Datum d;
-    Inst *savepc = pc;  /* then part */
+    Inst *savepc = g_vm->_pc;  /* then part */
     debugC(1, kPrivateDebugCode, "ifcode: evaluating condition");
 
     execute(savepc+3);  /* condition */
@@ -381,7 +385,7 @@ int ifcode() {
         execute(*((Inst **)(savepc+1)));
     }
     debugC(1, kPrivateDebugCode, "ifcode finished");
-    pc = *((Inst **)(savepc+2)); /* next stmt */
+    g_vm->_pc = *((Inst **)(savepc+2)); /* next stmt */
     return 0;
 }
 
@@ -403,9 +407,11 @@ int fail() {
 
 /* run the machine */
 void execute(Inst *p) {
-    for (pc = p; *pc != STOP; ) {
-        (*(*pc++))();
+    for (g_vm->_pc = p; *(g_vm->_pc) != STOP; ) {
+        (*(*(g_vm->_pc++)))();
     }
 }
 
+} // End of namespace Gen
+
 } // End of namespace Private
diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index bcd3711dc2..15fa03e10e 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -498,7 +498,7 @@ void fCRect(ArgArray args) {
     Common::Rect *rect = new Common::Rect(x1, y1, x2, y2);
     d->type = RECT;
     d->u.rect = rect;
-    push(*d);
+    Gen::push(*d);
 }
 
 void fBitmap(ArgArray args) {
diff --git a/engines/private/grammar.cpp b/engines/private/grammar.cpp
index 25ed01107d..149e323f6d 100644
--- a/engines/private/grammar.cpp
+++ b/engines/private/grammar.cpp
@@ -84,11 +84,12 @@
 #undef yyerror
 #define yyerror         PRIVATE_xerror
 
-#define code1(c1)       Private::code(c1);
-#define code2(c1,c2)    Private::code(c1); Private::code(c2)
-#define code3(c1,c2,c3) Private::code(c1); Private::code(c2); Private::code(c3)
+#define code1(c1)       code(c1);
+#define code2(c1,c2)    code(c1); code(c2)
+#define code3(c1,c2,c3) code(c1); code(c2); code(c3)
 
 using namespace Private;
+using namespace Gen;
 
 extern int PRIVATE_lex();
 extern int PRIVATE_parse();
@@ -102,7 +103,7 @@ int PRIVATE_wrap() {
 
 
 
-#line 106 "engines/private/grammar.cpp"
+#line 107 "engines/private/grammar.cpp"
 
 # ifndef YY_CAST
 #  ifdef __cplusplus
@@ -547,12 +548,12 @@ static const yytype_int8 yytranslate[] =
   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
-       0,    94,    94,    95,    98,    99,   100,   104,   105,   108,
-     109,   112,   119,   120,   125,   133,   134,   137,   140,   143,
-     146,   147,   152,   156,   157,   160,   168,   169,   177,   180,
-     181,   182,   183,   184,   187,   188,   189,   190,   191,   192,
-     195,   196,   197,   198,   199,   200,   201,   202,   203,   204,
-     205
+       0,    95,    95,    96,    99,   100,   101,   105,   106,   109,
+     110,   113,   120,   121,   126,   134,   135,   138,   141,   144,
+     147,   148,   153,   157,   158,   161,   169,   170,   178,   181,
+     182,   183,   184,   185,   188,   189,   190,   191,   192,   193,
+     196,   197,   198,   199,   200,   201,   202,   203,   204,   205,
+     206
 };
 #endif
 
@@ -1199,299 +1200,299 @@ yyreduce:
   switch (yyn)
     {
   case 4: /* line: DEBUGTOK '{' debug '}'  */
-#line 98 "engines/private/grammar.y"
+#line 99 "engines/private/grammar.y"
                                              { /* Not used in the game */ }
-#line 1205 "engines/private/grammar.cpp"
+#line 1206 "engines/private/grammar.cpp"
     break;
 
   case 5: /* line: DEFINETOK NAME '{' define '}'  */
-#line 99 "engines/private/grammar.y"
+#line 100 "engines/private/grammar.y"
                                              { g_private->maps.installAll((yyvsp[-3].s)); }
-#line 1211 "engines/private/grammar.cpp"
+#line 1212 "engines/private/grammar.cpp"
     break;
 
   case 6: /* line: SETTINGTOK NAME '{' statements '}'  */
-#line 100 "engines/private/grammar.y"
-                                             { g_private->settings.save((yyvsp[-3].s)); 
-                                               g_private->settings.init(); }
-#line 1218 "engines/private/grammar.cpp"
+#line 101 "engines/private/grammar.y"
+                                             { g_setts->save((yyvsp[-3].s)); 
+                                               g_setts->init(); }
+#line 1219 "engines/private/grammar.cpp"
     break;
 
   case 9: /* statements: %empty  */
-#line 108 "engines/private/grammar.y"
-                               { (yyval.inst) = progp; }
-#line 1224 "engines/private/grammar.cpp"
+#line 109 "engines/private/grammar.y"
+                               { (yyval.inst) = g_vm->_progp; }
+#line 1225 "engines/private/grammar.cpp"
     break;
 
   case 11: /* statement: GOTOTOK NAME ';'  */
-#line 112 "engines/private/grammar.y"
+#line 113 "engines/private/grammar.y"
                             {
-        (yyval.inst) = progp;
-        code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, (yyvsp[-1].s)));
-        code2(constpush, (Private::Inst) g_private->maps.constant(NUM, 1, NULL));
-        code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, "goto")); 
+        (yyval.inst) = g_vm->_progp;
+        code2(strpush, (Inst) g_private->maps.constant(STRING, 0, (yyvsp[-1].s)));
+        code2(constpush, (Inst) g_private->maps.constant(NUM, 1, NULL));
+        code2(strpush, (Inst) g_private->maps.constant(STRING, 0, "goto")); 
         code1(funcpush);
         }
-#line 1236 "engines/private/grammar.cpp"
+#line 1237 "engines/private/grammar.cpp"
     break;
 
   case 12: /* statement: fcall ';'  */
-#line 119 "engines/private/grammar.y"
+#line 120 "engines/private/grammar.y"
                             { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1242 "engines/private/grammar.cpp"
+#line 1243 "engines/private/grammar.cpp"
     break;
 
   case 13: /* statement: if cond body end  */
-#line 120 "engines/private/grammar.y"
+#line 121 "engines/private/grammar.y"
                            {
                 /* else-less if */
                 ((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst);     /* thenpart */
                 ((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst); 
                 }
-#line 1252 "engines/private/grammar.cpp"
+#line 1253 "engines/private/grammar.cpp"
     break;
 
   case 14: /* statement: if cond body end ELSETOK body end  */
-#line 125 "engines/private/grammar.y"
+#line 126 "engines/private/grammar.y"
                                             { 
                 /* if with else */
                 ((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst);     /* thenpart */
                 ((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst);     /* elsepart */
                 ((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst); 
                 }
-#line 1263 "engines/private/grammar.cpp"
+#line 1264 "engines/private/grammar.cpp"
     break;
 
   case 15: /* body: statement  */
-#line 133 "engines/private/grammar.y"
+#line 134 "engines/private/grammar.y"
                              { (yyval.inst) = (yyvsp[0].inst); }
-#line 1269 "engines/private/grammar.cpp"
+#line 1270 "engines/private/grammar.cpp"
     break;
 
   case 16: /* body: '{' statements '}'  */
-#line 134 "engines/private/grammar.y"
+#line 135 "engines/private/grammar.y"
                              { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1275 "engines/private/grammar.cpp"
+#line 1276 "engines/private/grammar.cpp"
     break;
 
   case 17: /* end: %empty  */
-#line 137 "engines/private/grammar.y"
-                             { code(STOP); (yyval.inst) = progp; }
-#line 1281 "engines/private/grammar.cpp"
+#line 138 "engines/private/grammar.y"
+                             { code1(STOP); (yyval.inst) = g_vm->_progp; }
+#line 1282 "engines/private/grammar.cpp"
     break;
 
   case 18: /* if: IFTOK  */
-#line 140 "engines/private/grammar.y"
-          { (yyval.inst) = code(ifcode); code3(STOP, STOP, STOP); }
-#line 1287 "engines/private/grammar.cpp"
+#line 141 "engines/private/grammar.y"
+          { (yyval.inst) = code1(ifcode); code3(STOP, STOP, STOP); }
+#line 1288 "engines/private/grammar.cpp"
     break;
 
   case 19: /* cond: '(' expr ')'  */
-#line 143 "engines/private/grammar.y"
-                        { code(STOP); (yyval.inst) = (yyvsp[-1].inst); }
-#line 1293 "engines/private/grammar.cpp"
+#line 144 "engines/private/grammar.y"
+                        { code1(STOP); (yyval.inst) = (yyvsp[-1].inst); }
+#line 1294 "engines/private/grammar.cpp"
     break;
 
   case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  */
-#line 147 "engines/private/grammar.y"
+#line 148 "engines/private/grammar.y"
                                                                         { 
           Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
           assert(r->isValidRect()); 
           g_private->maps.defineSymbol((yyvsp[-13].s), r); 
           }
-#line 1303 "engines/private/grammar.cpp"
+#line 1304 "engines/private/grammar.cpp"
     break;
 
   case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
-#line 152 "engines/private/grammar.y"
+#line 153 "engines/private/grammar.y"
                                                             {
           Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);  
           g_private->maps.defineSymbol((yyvsp[-11].s), r); 
           }
-#line 1312 "engines/private/grammar.cpp"
+#line 1313 "engines/private/grammar.cpp"
     break;
 
   case 23: /* define: NAME ',' define  */
-#line 156 "engines/private/grammar.y"
+#line 157 "engines/private/grammar.y"
                           { g_private->maps.defineSymbol((yyvsp[-2].s), NULL); }
-#line 1318 "engines/private/grammar.cpp"
+#line 1319 "engines/private/grammar.cpp"
     break;
 
   case 24: /* define: NAME  */
-#line 157 "engines/private/grammar.y"
+#line 158 "engines/private/grammar.y"
                           { g_private->maps.defineSymbol((yyvsp[0].s), NULL); }
-#line 1324 "engines/private/grammar.cpp"
+#line 1325 "engines/private/grammar.cpp"
     break;
 
   case 25: /* fcall: GOTOTOK '(' NAME ')'  */
-#line 160 "engines/private/grammar.y"
+#line 161 "engines/private/grammar.y"
                                {
-                               (yyval.inst) = progp;
-                               code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, (yyvsp[-1].s)));
-                               code2(constpush, (Private::Inst) g_private->maps.constant(NUM, 1, NULL));
-                               code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, "goto")); 
+                               (yyval.inst) = g_vm->_progp;
+                               code2(strpush, (Inst) g_private->maps.constant(STRING, 0, (yyvsp[-1].s)));
+                               code2(constpush, (Inst) g_private->maps.constant(NUM, 1, NULL));
+                               code2(strpush, (Inst) g_private->maps.constant(STRING, 0, "goto")); 
                                code1(funcpush);
                                }
-#line 1336 "engines/private/grammar.cpp"
+#line 1337 "engines/private/grammar.cpp"
     break;
 
   case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
-#line 168 "engines/private/grammar.y"
-                                                   { (yyval.inst) = progp; }
-#line 1342 "engines/private/grammar.cpp"
+#line 169 "engines/private/grammar.y"
+                                                   { (yyval.inst) = g_vm->_progp; }
+#line 1343 "engines/private/grammar.cpp"
     break;
 
   case 27: /* fcall: NAME '(' startp params ')'  */
-#line 169 "engines/private/grammar.y"
+#line 170 "engines/private/grammar.y"
                                       {
                                (yyval.inst) = (yyvsp[-2].inst);
-                               code2(constpush, (Private::Inst) g_private->maps.constant(NUM, (yyvsp[-1].narg), NULL));
-                               code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, (yyvsp[-4].s))); 
+                               code2(constpush, (Inst) g_private->maps.constant(NUM, (yyvsp[-1].narg), NULL));
+                               code2(strpush, (Inst) g_private->maps.constant(STRING, 0, (yyvsp[-4].s))); 
                                code1(funcpush);
                                }
-#line 1353 "engines/private/grammar.cpp"
+#line 1354 "engines/private/grammar.cpp"
     break;
 
   case 28: /* startp: %empty  */
-#line 177 "engines/private/grammar.y"
-                    { (yyval.inst) = progp; }
-#line 1359 "engines/private/grammar.cpp"
+#line 178 "engines/private/grammar.y"
+                    { (yyval.inst) = g_vm->_progp; }
+#line 1360 "engines/private/grammar.cpp"
     break;
 
   case 29: /* params: %empty  */
-#line 180 "engines/private/grammar.y"
+#line 181 "engines/private/grammar.y"
                             { (yyval.narg) = 0; }
-#line 1365 "engines/private/grammar.cpp"
+#line 1366 "engines/private/grammar.cpp"
     break;
 
   case 30: /* params: fcall ',' params  */
-#line 181 "engines/private/grammar.y"
+#line 182 "engines/private/grammar.y"
                             { (yyval.narg) = (yyvsp[0].narg) + 1; }
-#line 1371 "engines/private/grammar.cpp"
+#line 1372 "engines/private/grammar.cpp"
     break;
 
   case 31: /* params: expr ',' params  */
-#line 182 "engines/private/grammar.y"
+#line 183 "engines/private/grammar.y"
                             { (yyval.narg) = (yyvsp[0].narg) + 1; }
-#line 1377 "engines/private/grammar.cpp"
+#line 1378 "engines/private/grammar.cpp"
     break;
 
   case 32: /* params: expr  */
-#line 183 "engines/private/grammar.y"
+#line 184 "engines/private/grammar.y"
                       { (yyval.narg) = 1; }
-#line 1383 "engines/private/grammar.cpp"
+#line 1384 "engines/private/grammar.cpp"
     break;
 
   case 33: /* params: fcall  */
-#line 184 "engines/private/grammar.y"
+#line 185 "engines/private/grammar.y"
                       { (yyval.narg) = 1; }
-#line 1389 "engines/private/grammar.cpp"
+#line 1390 "engines/private/grammar.cpp"
     break;
 
   case 34: /* value: NULLTOK  */
-#line 187 "engines/private/grammar.y"
-                   { code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 0, NULL)); }
-#line 1395 "engines/private/grammar.cpp"
+#line 188 "engines/private/grammar.y"
+                   { code2(constpush, (Inst) g_private->maps.constant(NUM, 0, NULL)); }
+#line 1396 "engines/private/grammar.cpp"
     break;
 
   case 35: /* value: FALSETOK  */
-#line 188 "engines/private/grammar.y"
-                   { code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 0, NULL)); }
-#line 1401 "engines/private/grammar.cpp"
+#line 189 "engines/private/grammar.y"
+                   { code2(constpush, (Inst) g_private->maps.constant(NUM, 0, NULL)); }
+#line 1402 "engines/private/grammar.cpp"
     break;
 
   case 36: /* value: TRUETOK  */
-#line 189 "engines/private/grammar.y"
-                   { code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 1, NULL)); }
-#line 1407 "engines/private/grammar.cpp"
+#line 190 "engines/private/grammar.y"
+                   { code2(constpush, (Inst) g_private->maps.constant(NUM, 1, NULL)); }
+#line 1408 "engines/private/grammar.cpp"
     break;
 
   case 37: /* value: NUM  */
-#line 190 "engines/private/grammar.y"
-                   { code2(Private::constpush, (Private::Inst)(yyvsp[0].sym)); }
-#line 1413 "engines/private/grammar.cpp"
+#line 191 "engines/private/grammar.y"
+                   { code2(constpush, (Inst)(yyvsp[0].sym)); }
+#line 1414 "engines/private/grammar.cpp"
     break;
 
   case 38: /* value: STRING  */
-#line 191 "engines/private/grammar.y"
-                   { code2(Private::strpush, (Private::Inst)(yyvsp[0].sym)); }
-#line 1419 "engines/private/grammar.cpp"
+#line 192 "engines/private/grammar.y"
+                   { code2(strpush, (Inst)(yyvsp[0].sym)); }
+#line 1420 "engines/private/grammar.cpp"
     break;
 
   case 39: /* value: NAME  */
-#line 192 "engines/private/grammar.y"
-                   { code1(Private::varpush); code1((Private::Inst) g_private->maps.lookupName((yyvsp[0].s))); code1(Private::eval); }
-#line 1425 "engines/private/grammar.cpp"
+#line 193 "engines/private/grammar.y"
+                   { code1(varpush); code1((Inst) g_private->maps.lookupName((yyvsp[0].s))); code1(eval); }
+#line 1426 "engines/private/grammar.cpp"
     break;
 
   case 40: /* expr: value  */
-#line 195 "engines/private/grammar.y"
+#line 196 "engines/private/grammar.y"
                           { (yyval.inst) = (yyvsp[0].inst); }
-#line 1431 "engines/private/grammar.cpp"
+#line 1432 "engines/private/grammar.cpp"
     break;
 
   case 41: /* expr: '!' value  */
-#line 196 "engines/private/grammar.y"
-                          { code1(Private::negate); (yyval.inst) = (yyvsp[0].inst); }
-#line 1437 "engines/private/grammar.cpp"
+#line 197 "engines/private/grammar.y"
+                          { code1(negate); (yyval.inst) = (yyvsp[0].inst); }
+#line 1438 "engines/private/grammar.cpp"
     break;
 
   case 42: /* expr: value EQ value  */
-#line 197 "engines/private/grammar.y"
-                          { code1(Private::eq); }
-#line 1443 "engines/private/grammar.cpp"
+#line 198 "engines/private/grammar.y"
+                          { code1(eq); }
+#line 1444 "engines/private/grammar.cpp"
     break;
 
   case 43: /* expr: value NEQ value  */
-#line 198 "engines/private/grammar.y"
-                          { code1(Private::ne); }
-#line 1449 "engines/private/grammar.cpp"
+#line 199 "engines/private/grammar.y"
+                          { code1(ne); }
+#line 1450 "engines/private/grammar.cpp"
     break;
 
   case 44: /* expr: value '+' value  */
-#line 199 "engines/private/grammar.y"
-                          { code1(Private::add); }
-#line 1455 "engines/private/grammar.cpp"
+#line 200 "engines/private/grammar.y"
+                          { code1(add); }
+#line 1456 "engines/private/grammar.cpp"
     break;
 
   case 45: /* expr: value '<' value  */
-#line 200 "engines/private/grammar.y"
-                          { code1(Private::lt); }
-#line 1461 "engines/private/grammar.cpp"
+#line 201 "engines/private/grammar.y"
+                          { code1(lt); }
+#line 1462 "engines/private/grammar.cpp"
     break;
 
   case 46: /* expr: value '>' value  */
-#line 201 "engines/private/grammar.y"
-                          { code1(Private::gt); }
-#line 1467 "engines/private/grammar.cpp"
+#line 202 "engines/private/grammar.y"
+                          { code1(gt); }
+#line 1468 "engines/private/grammar.cpp"
     break;
 
   case 47: /* expr: value LTE value  */
-#line 202 "engines/private/grammar.y"
-                          { code1(Private::le); }
-#line 1473 "engines/private/grammar.cpp"
+#line 203 "engines/private/grammar.y"
+                          { code1(le); }
+#line 1474 "engines/private/grammar.cpp"
     break;
 
   case 48: /* expr: value GTE value  */
-#line 203 "engines/private/grammar.y"
-                          { code1(Private::ge); }
-#line 1479 "engines/private/grammar.cpp"
+#line 204 "engines/private/grammar.y"
+                          { code1(ge); }
+#line 1480 "engines/private/grammar.cpp"
     break;
 
   case 49: /* expr: value '+'  */
-#line 204 "engines/private/grammar.y"
+#line 205 "engines/private/grammar.y"
                           { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1485 "engines/private/grammar.cpp"
+#line 1486 "engines/private/grammar.cpp"
     break;
 
   case 50: /* expr: RANDOMTOK '(' NUM '%' ')'  */
-#line 205 "engines/private/grammar.y"
-                                    { code3(Private::constpush, (Private::Inst)(yyvsp[-2].sym), randbool); }
-#line 1491 "engines/private/grammar.cpp"
+#line 206 "engines/private/grammar.y"
+                                    { code3(constpush, (Inst)(yyvsp[-2].sym), randbool); }
+#line 1492 "engines/private/grammar.cpp"
     break;
 
 
-#line 1495 "engines/private/grammar.cpp"
+#line 1496 "engines/private/grammar.cpp"
 
       default: break;
     }
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 652df85a71..f0f0583030 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -62,14 +62,8 @@ void initInsts();
 void initFuncs();
 
 typedef struct Setting {
-
     Datum stack[NSTACK]; /* the stack */
-    Datum *stackp;       /* next free spot on stack */
-
     Inst  prog[NPROG];   /* the machine */
-    Inst  *progp;        /* next free spot for code generation */
-    Inst  *pc;           /* program counter during execution */
-
 } Setting;
 
 // Settings
@@ -78,15 +72,17 @@ typedef Common::HashMap<Common::String, Setting *> SettingMap;
 
 class SettingMaps {
     public:
-    Setting *psetting;
-    Setting *setting;
-    SettingMap map;
+    //Setting *_psetting;
+    Setting *_setting;
+    SettingMap _map;
 
     void init();
     void save(char *);
     void load(Common::String &);
 };
 
+extern SettingMaps *g_setts;
+
 // Funtions
 
 typedef Common::Array<Datum> ArgArray;
@@ -94,12 +90,28 @@ void call(char *, ArgArray);
 
 // Code Generation
 
+//extern  Inst *progp;
+//extern  Inst *prog;
+
+namespace Gen {
+
+class VM {
+    public:
+        Datum *_stack;  /* the stack */
+        Datum *_stackp; /* next free spot on stack */
+
+        Inst  *_progp;  /* next free spot for code generation */
+        Inst  *_prog;   /* the machine */
+        Inst  *_pc;     /* program counter during execution */
+        void run();     /* run the virtual machine */
+};
+
+extern VM *g_vm;
+
 Datum pop();
 int push(Datum);
-extern  Inst *progp;
 
 Inst *code(Inst);
-extern  Inst *prog;
 int eval();
 int add();
 int negate();
@@ -125,6 +137,8 @@ int randbool();
 
 void execute(Inst *);
 
+}
+
 } // End of namespace Private
 
 #endif
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index be1d148299..1cc8f20fc0 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -56,11 +56,12 @@
 #undef yyerror
 #define yyerror         PRIVATE_xerror
 
-#define code1(c1)       Private::code(c1);
-#define code2(c1,c2)    Private::code(c1); Private::code(c2)
-#define code3(c1,c2,c3) Private::code(c1); Private::code(c2); Private::code(c3)
+#define code1(c1)       code(c1);
+#define code2(c1,c2)    code(c1); code(c2)
+#define code3(c1,c2,c3) code(c1); code(c2); code(c3)
 
 using namespace Private;
+using namespace Gen;
 
 extern int PRIVATE_lex();
 extern int PRIVATE_parse();
@@ -97,23 +98,23 @@ lines:   line lines
 
 line:     DEBUGTOK '{' debug '}'             { /* Not used in the game */ }
         | DEFINETOK NAME '{' define '}'      { g_private->maps.installAll($NAME); }
-        | SETTINGTOK NAME '{' statements '}' { g_private->settings.save($NAME); 
-                                               g_private->settings.init(); }
+        | SETTINGTOK NAME '{' statements '}' { g_setts->save($NAME); 
+                                               g_setts->init(); }
         ;
 
 debug: /* nothing */
         | NAME ',' debug
         ;
 
-statements:  /* nothing */     { $$ = progp; }
+statements:  /* nothing */     { $$ = g_vm->_progp; }
         | statement statements
 
 
 statement: GOTOTOK NAME ';' {
-        $$ = progp;
-        code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, $NAME));
-        code2(constpush, (Private::Inst) g_private->maps.constant(NUM, 1, NULL));
-        code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, "goto")); 
+        $$ = g_vm->_progp;
+        code2(strpush, (Inst) g_private->maps.constant(STRING, 0, $NAME));
+        code2(constpush, (Inst) g_private->maps.constant(NUM, 1, NULL));
+        code2(strpush, (Inst) g_private->maps.constant(STRING, 0, "goto")); 
         code1(funcpush);
         }
         | fcall ';'         { $$ = $1; }   
@@ -134,13 +135,13 @@ body:         statement      { $$ = $1; }
         | '{' statements '}' { $$ = $2; }
         ;
 
-end:      /* nothing */      { code(STOP); $$ = progp; }
+end:      /* nothing */      { code1(STOP); $$ = g_vm->_progp; }
         ;
 
-if: IFTOK { $$ = code(ifcode); code3(STOP, STOP, STOP); }
+if: IFTOK { $$ = code1(ifcode); code3(STOP, STOP, STOP); }
         ;
 
-cond: '(' expr ')'      { code(STOP); $$ = $2; }
+cond: '(' expr ')'      { code1(STOP); $$ = $2; }
         ;
 
 define:  /* nothing */
@@ -158,23 +159,23 @@ define:  /* nothing */
         ;
 
 fcall:    GOTOTOK '(' NAME ')' {
-                               $$ = progp;
-                               code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, $NAME));
-                               code2(constpush, (Private::Inst) g_private->maps.constant(NUM, 1, NULL));
-                               code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, "goto")); 
+                               $$ = g_vm->_progp;
+                               code2(strpush, (Inst) g_private->maps.constant(STRING, 0, $NAME));
+                               code2(constpush, (Inst) g_private->maps.constant(NUM, 1, NULL));
+                               code2(strpush, (Inst) g_private->maps.constant(STRING, 0, "goto")); 
                                code1(funcpush);
                                }
 
-        | RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' { $$ = progp; }
+        | RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' { $$ = g_vm->_progp; }
         | NAME '(' startp params ')'  {
                                $$ = $startp;
-                               code2(constpush, (Private::Inst) g_private->maps.constant(NUM, $params, NULL));
-                               code2(strpush, (Private::Inst) g_private->maps.constant(STRING, 0, $NAME)); 
+                               code2(constpush, (Inst) g_private->maps.constant(NUM, $params, NULL));
+                               code2(strpush, (Inst) g_private->maps.constant(STRING, 0, $NAME)); 
                                code1(funcpush);
                                }
         ;
 
-startp: /*nothing*/ { $$ = progp; }
+startp: /*nothing*/ { $$ = g_vm->_progp; }
         ;
 
 params:   /* nothing */     { $$ = 0; }
@@ -184,23 +185,23 @@ params:   /* nothing */     { $$ = 0; }
         | fcall       { $$ = 1; }
         ;
 
-value:    NULLTOK  { code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 0, NULL)); }
-        | FALSETOK { code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 0, NULL)); }
-        | TRUETOK  { code2(Private::constpush, (Private::Inst) g_private->maps.constant(NUM, 1, NULL)); }
-        | NUM      { code2(Private::constpush, (Private::Inst)$NUM); }
-        | STRING   { code2(Private::strpush, (Private::Inst)$STRING); }
-        | NAME     { code1(Private::varpush); code1((Private::Inst) g_private->maps.lookupName($NAME)); code1(Private::eval); }
+value:    NULLTOK  { code2(constpush, (Inst) g_private->maps.constant(NUM, 0, NULL)); }
+        | FALSETOK { code2(constpush, (Inst) g_private->maps.constant(NUM, 0, NULL)); }
+        | TRUETOK  { code2(constpush, (Inst) g_private->maps.constant(NUM, 1, NULL)); }
+        | NUM      { code2(constpush, (Inst)$NUM); }
+        | STRING   { code2(strpush, (Inst)$STRING); }
+        | NAME     { code1(varpush); code1((Inst) g_private->maps.lookupName($NAME)); code1(eval); }
         ;
 
 expr:     value           { $$ = $1; } 
-        | '!' value       { code1(Private::negate); $$ = $2; }
-        | value EQ value  { code1(Private::eq); }
-        | value NEQ value { code1(Private::ne); }
-        | value '+' value { code1(Private::add); }
-        | value '<' value { code1(Private::lt); }
-        | value '>' value { code1(Private::gt); }
-        | value LTE value { code1(Private::le); }
-        | value GTE value { code1(Private::ge); }
+        | '!' value       { code1(negate); $$ = $2; }
+        | value EQ value  { code1(eq); }
+        | value NEQ value { code1(ne); }
+        | value '+' value { code1(add); }
+        | value '<' value { code1(lt); }
+        | value '>' value { code1(gt); }
+        | value LTE value { code1(le); }
+        | value GTE value { code1(ge); }
         | value '+'       { $$ = $1; } // unclear what it should do 
-        | RANDOMTOK '(' NUM '%' ')' { code3(Private::constpush, (Private::Inst)$NUM, randbool); }
+        | RANDOMTOK '(' NUM '%' ')' { code3(constpush, (Inst)$NUM, randbool); }
         ;
diff --git a/engines/private/lexer.cpp b/engines/private/lexer.cpp
index e2f8a740fc..87817dc2dd 100644
--- a/engines/private/lexer.cpp
+++ b/engines/private/lexer.cpp
@@ -2184,7 +2184,7 @@ void yyfree (void * ptr )
 namespace Private {
 
 int parse(char *code) {
-    g_private->settings.init();
+    g_setts->init();
     YY_BUFFER_STATE bp;
     yy_delete_buffer(YY_CURRENT_BUFFER);
     bp = yy_scan_string(code);
diff --git a/engines/private/lexer.l b/engines/private/lexer.l
index ad448d49cc..d9cae48dde 100644
--- a/engines/private/lexer.l
+++ b/engines/private/lexer.l
@@ -64,7 +64,7 @@ Random                  return RANDOMTOK;
 namespace Private {
 
 int parse(char *code) {
-    g_private->settings.init();
+    g_setts->init();
     YY_BUFFER_STATE bp;
     yy_delete_buffer(YY_CURRENT_BUFFER);
     bp = yy_scan_string(code);
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 9b53259708..8a3015d5fb 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -273,9 +273,9 @@ Common::Error PrivateEngine::run() {
             debugC(1, kPrivateDebugFunction, "Executing %s", _nextSetting.c_str());
             clearAreas();
             _currentSetting = _nextSetting;
-            settings.load(_nextSetting);
+            g_setts->load(_nextSetting);
             _nextSetting = "";
-            execute(prog);
+            Gen::g_vm->run();
             changeCursor("default");
             drawScreen();
         }
diff --git a/engines/private/private.h b/engines/private/private.h
index 0f9371e71d..52318d1d78 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -64,6 +64,10 @@ const int kPoliceBustVideos[6] = {1, 2, 4, 5, 7, 8};
 const int kOriginZero[2] = {0,   0};
 const int kOriginOne[2]  = {64, 48};
 
+// vm
+
+extern Gen::VM *Gen::g_vm;
+
 // settings
 
 static const char *kPauseMovie = "kPauseMovie";
@@ -143,7 +147,6 @@ public:
     bool isDemo() const;
 
     SymbolMaps maps;
-    SettingMaps settings;
 
     Audio::SoundHandle _fgSoundHandle;
     Audio::SoundHandle _bgSoundHandle;
diff --git a/engines/private/tokens.h b/engines/private/tokens.h
index bde0cf6a55..449037f1fb 100644
--- a/engines/private/tokens.h
+++ b/engines/private/tokens.h
@@ -88,7 +88,7 @@ extern int PRIVATE_debug;
 #if ! defined PRIVATE_STYPE && ! defined PRIVATE_STYPE_IS_DECLARED
 union PRIVATE_STYPE
 {
-#line 78 "engines/private/grammar.y"
+#line 79 "engines/private/grammar.y"
 
         Private::Symbol *sym; /* symbol table pointer */
         int (**inst)();       /* machine instruction */


Commit: c46c9dedd695121ebbe64dc4ade4697294c30f78
    https://github.com/scummvm/scummvm/commit/c46c9dedd695121ebbe64dc4ade4697294c30f78
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: class re-organization

Changed paths:
    engines/private/code.cpp
    engines/private/grammar.cpp
    engines/private/grammar.h
    engines/private/grammar.y
    engines/private/lexer.cpp
    engines/private/lexer.l
    engines/private/private.cpp
    engines/private/tokens.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index 2bf6c54442..fbfcbd7b69 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -56,12 +56,15 @@ namespace Private {
 using namespace Gen;
 
 VM *Gen::g_vm = new VM();
-SettingMaps *g_setts = new SettingMaps();
 
-void Gen::VM::run() {
+void VM::run() {
     execute(g_vm->_prog);
 }
 
+namespace Settings {
+
+SettingMaps *g_setts = new SettingMaps();
+
 /* initialize setting for code generation */
 void SettingMaps::init() { 
     _setting = (Setting *)malloc(sizeof(Setting));
@@ -91,6 +94,8 @@ void SettingMaps::load(Common::String &name) {
     Gen::g_vm->_progp = Gen::g_vm->_prog;
 }
 
+} // end of namespace Settings
+
 namespace Gen {
 
 /* pop and return top elem from stack */
diff --git a/engines/private/grammar.cpp b/engines/private/grammar.cpp
index 149e323f6d..a6d0fdf77f 100644
--- a/engines/private/grammar.cpp
+++ b/engines/private/grammar.cpp
@@ -90,6 +90,7 @@
 
 using namespace Private;
 using namespace Gen;
+using namespace Settings;
 
 extern int PRIVATE_lex();
 extern int PRIVATE_parse();
@@ -103,7 +104,7 @@ int PRIVATE_wrap() {
 
 
 
-#line 107 "engines/private/grammar.cpp"
+#line 108 "engines/private/grammar.cpp"
 
 # ifndef YY_CAST
 #  ifdef __cplusplus
@@ -548,12 +549,12 @@ static const yytype_int8 yytranslate[] =
   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint8 yyrline[] =
 {
-       0,    95,    95,    96,    99,   100,   101,   105,   106,   109,
-     110,   113,   120,   121,   126,   134,   135,   138,   141,   144,
-     147,   148,   153,   157,   158,   161,   169,   170,   178,   181,
-     182,   183,   184,   185,   188,   189,   190,   191,   192,   193,
-     196,   197,   198,   199,   200,   201,   202,   203,   204,   205,
-     206
+       0,    96,    96,    97,   100,   101,   102,   106,   107,   110,
+     111,   114,   121,   122,   127,   135,   136,   139,   142,   145,
+     148,   149,   154,   158,   159,   162,   170,   171,   179,   182,
+     183,   184,   185,   186,   189,   190,   191,   192,   193,   194,
+     197,   198,   199,   200,   201,   202,   203,   204,   205,   206,
+     207
 };
 #endif
 
@@ -1200,32 +1201,32 @@ yyreduce:
   switch (yyn)
     {
   case 4: /* line: DEBUGTOK '{' debug '}'  */
-#line 99 "engines/private/grammar.y"
+#line 100 "engines/private/grammar.y"
                                              { /* Not used in the game */ }
-#line 1206 "engines/private/grammar.cpp"
+#line 1207 "engines/private/grammar.cpp"
     break;
 
   case 5: /* line: DEFINETOK NAME '{' define '}'  */
-#line 100 "engines/private/grammar.y"
+#line 101 "engines/private/grammar.y"
                                              { g_private->maps.installAll((yyvsp[-3].s)); }
-#line 1212 "engines/private/grammar.cpp"
+#line 1213 "engines/private/grammar.cpp"
     break;
 
   case 6: /* line: SETTINGTOK NAME '{' statements '}'  */
-#line 101 "engines/private/grammar.y"
+#line 102 "engines/private/grammar.y"
                                              { g_setts->save((yyvsp[-3].s)); 
                                                g_setts->init(); }
-#line 1219 "engines/private/grammar.cpp"
+#line 1220 "engines/private/grammar.cpp"
     break;
 
   case 9: /* statements: %empty  */
-#line 109 "engines/private/grammar.y"
+#line 110 "engines/private/grammar.y"
                                { (yyval.inst) = g_vm->_progp; }
-#line 1225 "engines/private/grammar.cpp"
+#line 1226 "engines/private/grammar.cpp"
     break;
 
   case 11: /* statement: GOTOTOK NAME ';'  */
-#line 113 "engines/private/grammar.y"
+#line 114 "engines/private/grammar.y"
                             {
         (yyval.inst) = g_vm->_progp;
         code2(strpush, (Inst) g_private->maps.constant(STRING, 0, (yyvsp[-1].s)));
@@ -1233,99 +1234,99 @@ yyreduce:
         code2(strpush, (Inst) g_private->maps.constant(STRING, 0, "goto")); 
         code1(funcpush);
         }
-#line 1237 "engines/private/grammar.cpp"
+#line 1238 "engines/private/grammar.cpp"
     break;
 
   case 12: /* statement: fcall ';'  */
-#line 120 "engines/private/grammar.y"
+#line 121 "engines/private/grammar.y"
                             { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1243 "engines/private/grammar.cpp"
+#line 1244 "engines/private/grammar.cpp"
     break;
 
   case 13: /* statement: if cond body end  */
-#line 121 "engines/private/grammar.y"
+#line 122 "engines/private/grammar.y"
                            {
                 /* else-less if */
                 ((yyvsp[-3].inst))[1] = (Inst)(yyvsp[-1].inst);     /* thenpart */
                 ((yyvsp[-3].inst))[3] = (Inst)(yyvsp[0].inst); 
                 }
-#line 1253 "engines/private/grammar.cpp"
+#line 1254 "engines/private/grammar.cpp"
     break;
 
   case 14: /* statement: if cond body end ELSETOK body end  */
-#line 126 "engines/private/grammar.y"
+#line 127 "engines/private/grammar.y"
                                             { 
                 /* if with else */
                 ((yyvsp[-6].inst))[1] = (Inst)(yyvsp[-4].inst);     /* thenpart */
                 ((yyvsp[-6].inst))[2] = (Inst)(yyvsp[-1].inst);     /* elsepart */
                 ((yyvsp[-6].inst))[3] = (Inst)(yyvsp[0].inst); 
                 }
-#line 1264 "engines/private/grammar.cpp"
+#line 1265 "engines/private/grammar.cpp"
     break;
 
   case 15: /* body: statement  */
-#line 134 "engines/private/grammar.y"
+#line 135 "engines/private/grammar.y"
                              { (yyval.inst) = (yyvsp[0].inst); }
-#line 1270 "engines/private/grammar.cpp"
+#line 1271 "engines/private/grammar.cpp"
     break;
 
   case 16: /* body: '{' statements '}'  */
-#line 135 "engines/private/grammar.y"
+#line 136 "engines/private/grammar.y"
                              { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1276 "engines/private/grammar.cpp"
+#line 1277 "engines/private/grammar.cpp"
     break;
 
   case 17: /* end: %empty  */
-#line 138 "engines/private/grammar.y"
+#line 139 "engines/private/grammar.y"
                              { code1(STOP); (yyval.inst) = g_vm->_progp; }
-#line 1282 "engines/private/grammar.cpp"
+#line 1283 "engines/private/grammar.cpp"
     break;
 
   case 18: /* if: IFTOK  */
-#line 141 "engines/private/grammar.y"
+#line 142 "engines/private/grammar.y"
           { (yyval.inst) = code1(ifcode); code3(STOP, STOP, STOP); }
-#line 1288 "engines/private/grammar.cpp"
+#line 1289 "engines/private/grammar.cpp"
     break;
 
   case 19: /* cond: '(' expr ')'  */
-#line 144 "engines/private/grammar.y"
+#line 145 "engines/private/grammar.y"
                         { code1(STOP); (yyval.inst) = (yyvsp[-1].inst); }
-#line 1294 "engines/private/grammar.cpp"
+#line 1295 "engines/private/grammar.cpp"
     break;
 
   case 21: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')' ',' define  */
-#line 148 "engines/private/grammar.y"
+#line 149 "engines/private/grammar.y"
                                                                         { 
           Common::Rect *r = new Common::Rect((yyvsp[-9].sym)->u.val, (yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val);
           assert(r->isValidRect()); 
           g_private->maps.defineSymbol((yyvsp[-13].s), r); 
           }
-#line 1304 "engines/private/grammar.cpp"
+#line 1305 "engines/private/grammar.cpp"
     break;
 
   case 22: /* define: NAME ',' RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
-#line 153 "engines/private/grammar.y"
+#line 154 "engines/private/grammar.y"
                                                             {
           Common::Rect *r = new Common::Rect((yyvsp[-7].sym)->u.val, (yyvsp[-5].sym)->u.val, (yyvsp[-3].sym)->u.val, (yyvsp[-1].sym)->u.val);  
           g_private->maps.defineSymbol((yyvsp[-11].s), r); 
           }
-#line 1313 "engines/private/grammar.cpp"
+#line 1314 "engines/private/grammar.cpp"
     break;
 
   case 23: /* define: NAME ',' define  */
-#line 157 "engines/private/grammar.y"
+#line 158 "engines/private/grammar.y"
                           { g_private->maps.defineSymbol((yyvsp[-2].s), NULL); }
-#line 1319 "engines/private/grammar.cpp"
+#line 1320 "engines/private/grammar.cpp"
     break;
 
   case 24: /* define: NAME  */
-#line 158 "engines/private/grammar.y"
+#line 159 "engines/private/grammar.y"
                           { g_private->maps.defineSymbol((yyvsp[0].s), NULL); }
-#line 1325 "engines/private/grammar.cpp"
+#line 1326 "engines/private/grammar.cpp"
     break;
 
   case 25: /* fcall: GOTOTOK '(' NAME ')'  */
-#line 161 "engines/private/grammar.y"
+#line 162 "engines/private/grammar.y"
                                {
                                (yyval.inst) = g_vm->_progp;
                                code2(strpush, (Inst) g_private->maps.constant(STRING, 0, (yyvsp[-1].s)));
@@ -1333,166 +1334,166 @@ yyreduce:
                                code2(strpush, (Inst) g_private->maps.constant(STRING, 0, "goto")); 
                                code1(funcpush);
                                }
-#line 1337 "engines/private/grammar.cpp"
+#line 1338 "engines/private/grammar.cpp"
     break;
 
   case 26: /* fcall: RECT '(' NUM ',' NUM ',' NUM ',' NUM ')'  */
-#line 169 "engines/private/grammar.y"
+#line 170 "engines/private/grammar.y"
                                                    { (yyval.inst) = g_vm->_progp; }
-#line 1343 "engines/private/grammar.cpp"
+#line 1344 "engines/private/grammar.cpp"
     break;
 
   case 27: /* fcall: NAME '(' startp params ')'  */
-#line 170 "engines/private/grammar.y"
+#line 171 "engines/private/grammar.y"
                                       {
                                (yyval.inst) = (yyvsp[-2].inst);
                                code2(constpush, (Inst) g_private->maps.constant(NUM, (yyvsp[-1].narg), NULL));
                                code2(strpush, (Inst) g_private->maps.constant(STRING, 0, (yyvsp[-4].s))); 
                                code1(funcpush);
                                }
-#line 1354 "engines/private/grammar.cpp"
+#line 1355 "engines/private/grammar.cpp"
     break;
 
   case 28: /* startp: %empty  */
-#line 178 "engines/private/grammar.y"
+#line 179 "engines/private/grammar.y"
                     { (yyval.inst) = g_vm->_progp; }
-#line 1360 "engines/private/grammar.cpp"
+#line 1361 "engines/private/grammar.cpp"
     break;
 
   case 29: /* params: %empty  */
-#line 181 "engines/private/grammar.y"
+#line 182 "engines/private/grammar.y"
                             { (yyval.narg) = 0; }
-#line 1366 "engines/private/grammar.cpp"
+#line 1367 "engines/private/grammar.cpp"
     break;
 
   case 30: /* params: fcall ',' params  */
-#line 182 "engines/private/grammar.y"
+#line 183 "engines/private/grammar.y"
                             { (yyval.narg) = (yyvsp[0].narg) + 1; }
-#line 1372 "engines/private/grammar.cpp"
+#line 1373 "engines/private/grammar.cpp"
     break;
 
   case 31: /* params: expr ',' params  */
-#line 183 "engines/private/grammar.y"
+#line 184 "engines/private/grammar.y"
                             { (yyval.narg) = (yyvsp[0].narg) + 1; }
-#line 1378 "engines/private/grammar.cpp"
+#line 1379 "engines/private/grammar.cpp"
     break;
 
   case 32: /* params: expr  */
-#line 184 "engines/private/grammar.y"
+#line 185 "engines/private/grammar.y"
                       { (yyval.narg) = 1; }
-#line 1384 "engines/private/grammar.cpp"
+#line 1385 "engines/private/grammar.cpp"
     break;
 
   case 33: /* params: fcall  */
-#line 185 "engines/private/grammar.y"
+#line 186 "engines/private/grammar.y"
                       { (yyval.narg) = 1; }
-#line 1390 "engines/private/grammar.cpp"
+#line 1391 "engines/private/grammar.cpp"
     break;
 
   case 34: /* value: NULLTOK  */
-#line 188 "engines/private/grammar.y"
+#line 189 "engines/private/grammar.y"
                    { code2(constpush, (Inst) g_private->maps.constant(NUM, 0, NULL)); }
-#line 1396 "engines/private/grammar.cpp"
+#line 1397 "engines/private/grammar.cpp"
     break;
 
   case 35: /* value: FALSETOK  */
-#line 189 "engines/private/grammar.y"
+#line 190 "engines/private/grammar.y"
                    { code2(constpush, (Inst) g_private->maps.constant(NUM, 0, NULL)); }
-#line 1402 "engines/private/grammar.cpp"
+#line 1403 "engines/private/grammar.cpp"
     break;
 
   case 36: /* value: TRUETOK  */
-#line 190 "engines/private/grammar.y"
+#line 191 "engines/private/grammar.y"
                    { code2(constpush, (Inst) g_private->maps.constant(NUM, 1, NULL)); }
-#line 1408 "engines/private/grammar.cpp"
+#line 1409 "engines/private/grammar.cpp"
     break;
 
   case 37: /* value: NUM  */
-#line 191 "engines/private/grammar.y"
+#line 192 "engines/private/grammar.y"
                    { code2(constpush, (Inst)(yyvsp[0].sym)); }
-#line 1414 "engines/private/grammar.cpp"
+#line 1415 "engines/private/grammar.cpp"
     break;
 
   case 38: /* value: STRING  */
-#line 192 "engines/private/grammar.y"
+#line 193 "engines/private/grammar.y"
                    { code2(strpush, (Inst)(yyvsp[0].sym)); }
-#line 1420 "engines/private/grammar.cpp"
+#line 1421 "engines/private/grammar.cpp"
     break;
 
   case 39: /* value: NAME  */
-#line 193 "engines/private/grammar.y"
+#line 194 "engines/private/grammar.y"
                    { code1(varpush); code1((Inst) g_private->maps.lookupName((yyvsp[0].s))); code1(eval); }
-#line 1426 "engines/private/grammar.cpp"
+#line 1427 "engines/private/grammar.cpp"
     break;
 
   case 40: /* expr: value  */
-#line 196 "engines/private/grammar.y"
+#line 197 "engines/private/grammar.y"
                           { (yyval.inst) = (yyvsp[0].inst); }
-#line 1432 "engines/private/grammar.cpp"
+#line 1433 "engines/private/grammar.cpp"
     break;
 
   case 41: /* expr: '!' value  */
-#line 197 "engines/private/grammar.y"
+#line 198 "engines/private/grammar.y"
                           { code1(negate); (yyval.inst) = (yyvsp[0].inst); }
-#line 1438 "engines/private/grammar.cpp"
+#line 1439 "engines/private/grammar.cpp"
     break;
 
   case 42: /* expr: value EQ value  */
-#line 198 "engines/private/grammar.y"
+#line 199 "engines/private/grammar.y"
                           { code1(eq); }
-#line 1444 "engines/private/grammar.cpp"
+#line 1445 "engines/private/grammar.cpp"
     break;
 
   case 43: /* expr: value NEQ value  */
-#line 199 "engines/private/grammar.y"
+#line 200 "engines/private/grammar.y"
                           { code1(ne); }
-#line 1450 "engines/private/grammar.cpp"
+#line 1451 "engines/private/grammar.cpp"
     break;
 
   case 44: /* expr: value '+' value  */
-#line 200 "engines/private/grammar.y"
+#line 201 "engines/private/grammar.y"
                           { code1(add); }
-#line 1456 "engines/private/grammar.cpp"
+#line 1457 "engines/private/grammar.cpp"
     break;
 
   case 45: /* expr: value '<' value  */
-#line 201 "engines/private/grammar.y"
+#line 202 "engines/private/grammar.y"
                           { code1(lt); }
-#line 1462 "engines/private/grammar.cpp"
+#line 1463 "engines/private/grammar.cpp"
     break;
 
   case 46: /* expr: value '>' value  */
-#line 202 "engines/private/grammar.y"
+#line 203 "engines/private/grammar.y"
                           { code1(gt); }
-#line 1468 "engines/private/grammar.cpp"
+#line 1469 "engines/private/grammar.cpp"
     break;
 
   case 47: /* expr: value LTE value  */
-#line 203 "engines/private/grammar.y"
+#line 204 "engines/private/grammar.y"
                           { code1(le); }
-#line 1474 "engines/private/grammar.cpp"
+#line 1475 "engines/private/grammar.cpp"
     break;
 
   case 48: /* expr: value GTE value  */
-#line 204 "engines/private/grammar.y"
+#line 205 "engines/private/grammar.y"
                           { code1(ge); }
-#line 1480 "engines/private/grammar.cpp"
+#line 1481 "engines/private/grammar.cpp"
     break;
 
   case 49: /* expr: value '+'  */
-#line 205 "engines/private/grammar.y"
+#line 206 "engines/private/grammar.y"
                           { (yyval.inst) = (yyvsp[-1].inst); }
-#line 1486 "engines/private/grammar.cpp"
+#line 1487 "engines/private/grammar.cpp"
     break;
 
   case 50: /* expr: RANDOMTOK '(' NUM '%' ')'  */
-#line 206 "engines/private/grammar.y"
+#line 207 "engines/private/grammar.y"
                                     { code3(constpush, (Inst)(yyvsp[-2].sym), randbool); }
-#line 1492 "engines/private/grammar.cpp"
+#line 1493 "engines/private/grammar.cpp"
     break;
 
 
-#line 1496 "engines/private/grammar.cpp"
+#line 1497 "engines/private/grammar.cpp"
 
       default: break;
     }
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index f0f0583030..0e3f76efb7 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -61,18 +61,17 @@ typedef Common::HashMap<void *, Common::String *> PtrToName;
 void initInsts();
 void initFuncs();
 
+namespace Settings {
+
 typedef struct Setting {
     Datum stack[NSTACK]; /* the stack */
     Inst  prog[NPROG];   /* the machine */
 } Setting;
 
-// Settings
-
 typedef Common::HashMap<Common::String, Setting *> SettingMap;
 
 class SettingMaps {
     public:
-    //Setting *_psetting;
     Setting *_setting;
     SettingMap _map;
 
@@ -83,15 +82,14 @@ class SettingMaps {
 
 extern SettingMaps *g_setts;
 
+}
+
 // Funtions
 
 typedef Common::Array<Datum> ArgArray;
 void call(char *, ArgArray);
 
-// Code Generation
-
-//extern  Inst *progp;
-//extern  Inst *prog;
+// Code Generation and Execution
 
 namespace Gen {
 
diff --git a/engines/private/grammar.y b/engines/private/grammar.y
index 1cc8f20fc0..0768c6881c 100644
--- a/engines/private/grammar.y
+++ b/engines/private/grammar.y
@@ -62,6 +62,7 @@
 
 using namespace Private;
 using namespace Gen;
+using namespace Settings;
 
 extern int PRIVATE_lex();
 extern int PRIVATE_parse();
diff --git a/engines/private/lexer.cpp b/engines/private/lexer.cpp
index 87817dc2dd..ec5586ccd0 100644
--- a/engines/private/lexer.cpp
+++ b/engines/private/lexer.cpp
@@ -783,8 +783,12 @@ char *yytext;
 #include "private/grammar.h"
 #include "private/tokens.h"
 
-#line 786 "engines/private/lexer.cpp"
-#line 787 "engines/private/lexer.cpp"
+using namespace Private;
+using namespace Gen;
+using namespace Settings;
+
+#line 790 "engines/private/lexer.cpp"
+#line 791 "engines/private/lexer.cpp"
 
 #define INITIAL 0
 
@@ -1001,9 +1005,9 @@ YY_DECL
 		}
 
 	{
-#line 39 "engines/private/lexer.l"
+#line 43 "engines/private/lexer.l"
 
-#line 1006 "engines/private/lexer.cpp"
+#line 1010 "engines/private/lexer.cpp"
 
 	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
 		{
@@ -1058,121 +1062,121 @@ do_action:	/* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 40 "engines/private/lexer.l"
+#line 44 "engines/private/lexer.l"
 /* ignoring the comment */
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 41 "engines/private/lexer.l"
+#line 45 "engines/private/lexer.l"
 return LTE;
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 42 "engines/private/lexer.l"
+#line 46 "engines/private/lexer.l"
 return GTE;
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 43 "engines/private/lexer.l"
+#line 47 "engines/private/lexer.l"
 return NEQ;
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 44 "engines/private/lexer.l"
+#line 48 "engines/private/lexer.l"
 return EQ;
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 45 "engines/private/lexer.l"
+#line 49 "engines/private/lexer.l"
 return DEBUGTOK;
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 46 "engines/private/lexer.l"
+#line 50 "engines/private/lexer.l"
 return DEFINETOK;
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 47 "engines/private/lexer.l"
+#line 51 "engines/private/lexer.l"
 return SETTINGTOK;
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 48 "engines/private/lexer.l"
+#line 52 "engines/private/lexer.l"
 return IFTOK;
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 49 "engines/private/lexer.l"
+#line 53 "engines/private/lexer.l"
 return ELSETOK;
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 50 "engines/private/lexer.l"
+#line 54 "engines/private/lexer.l"
 return GOTOTOK;
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 51 "engines/private/lexer.l"
+#line 55 "engines/private/lexer.l"
 return RECT;
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 52 "engines/private/lexer.l"
+#line 56 "engines/private/lexer.l"
 return FALSETOK;
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 53 "engines/private/lexer.l"
+#line 57 "engines/private/lexer.l"
 return TRUETOK;
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 54 "engines/private/lexer.l"
+#line 58 "engines/private/lexer.l"
 return NULLTOK;
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 55 "engines/private/lexer.l"
+#line 59 "engines/private/lexer.l"
 return RANDOMTOK;
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 56 "engines/private/lexer.l"
+#line 60 "engines/private/lexer.l"
 PRIVATE_lval.s = scumm_strdup(PRIVATE_text); return NAME;
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 57 "engines/private/lexer.l"
-PRIVATE_lval.sym = Private::g_private->maps.constant(NUM, atoi(PRIVATE_text), NULL); return NUM;
+#line 61 "engines/private/lexer.l"
+PRIVATE_lval.sym = g_private->maps.constant(NUM, atoi(PRIVATE_text), NULL); return NUM;
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 58 "engines/private/lexer.l"
-PRIVATE_lval.sym = Private::g_private->maps.constant(STRING, 0, scumm_strdup(PRIVATE_text)); return STRING;
+#line 62 "engines/private/lexer.l"
+PRIVATE_lval.sym = g_private->maps.constant(STRING, 0, scumm_strdup(PRIVATE_text)); return STRING;
 	YY_BREAK
 case 20:
 /* rule 20 can match eol */
 YY_RULE_SETUP
-#line 59 "engines/private/lexer.l"
+#line 63 "engines/private/lexer.l"
 /* ignore return */;
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 60 "engines/private/lexer.l"
+#line 64 "engines/private/lexer.l"
 /* ignore whitespace */;
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 61 "engines/private/lexer.l"
+#line 65 "engines/private/lexer.l"
 return *yytext;
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 62 "engines/private/lexer.l"
+#line 66 "engines/private/lexer.l"
 ECHO;
 	YY_BREAK
-#line 1175 "engines/private/lexer.cpp"
+#line 1179 "engines/private/lexer.cpp"
 case YY_STATE_EOF(INITIAL):
 	yyterminate();
 
@@ -2178,7 +2182,7 @@ void yyfree (void * ptr )
 
 #define YYTABLES_NAME "yytables"
 
-#line 62 "engines/private/lexer.l"
+#line 66 "engines/private/lexer.l"
 
 
 namespace Private {
diff --git a/engines/private/lexer.l b/engines/private/lexer.l
index d9cae48dde..2563bdbb44 100644
--- a/engines/private/lexer.l
+++ b/engines/private/lexer.l
@@ -34,6 +34,10 @@
 #include "private/grammar.h"
 #include "private/tokens.h"
 
+using namespace Private;
+using namespace Gen;
+using namespace Settings;
+
 %}
 
 %%
@@ -54,8 +58,8 @@ TRUE                    return TRUETOK;
 NULL                    return NULLTOK;
 Random                  return RANDOMTOK;
 [A-Za-z_][A-Za-z_0-9]*  PRIVATE_lval.s = scumm_strdup(PRIVATE_text); return NAME;
-[\-]?[0-9]+             PRIVATE_lval.sym = Private::g_private->maps.constant(NUM, atoi(PRIVATE_text), NULL); return NUM;
-\"[^\"\r\n]*\"          PRIVATE_lval.sym = Private::g_private->maps.constant(STRING, 0, scumm_strdup(PRIVATE_text)); return STRING;
+[\-]?[0-9]+             PRIVATE_lval.sym = g_private->maps.constant(NUM, atoi(PRIVATE_text), NULL); return NUM;
+\"[^\"\r\n]*\"          PRIVATE_lval.sym = g_private->maps.constant(STRING, 0, scumm_strdup(PRIVATE_text)); return STRING;
 [\r|\n]+                /* ignore return */;
 [ \t]+                  /* ignore whitespace */;
 .                       return *yytext;
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 8a3015d5fb..3d04f60815 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -273,7 +273,7 @@ Common::Error PrivateEngine::run() {
             debugC(1, kPrivateDebugFunction, "Executing %s", _nextSetting.c_str());
             clearAreas();
             _currentSetting = _nextSetting;
-            g_setts->load(_nextSetting);
+            Settings::g_setts->load(_nextSetting);
             _nextSetting = "";
             Gen::g_vm->run();
             changeCursor("default");
diff --git a/engines/private/tokens.h b/engines/private/tokens.h
index 449037f1fb..76ecfb2f6f 100644
--- a/engines/private/tokens.h
+++ b/engines/private/tokens.h
@@ -88,7 +88,7 @@ extern int PRIVATE_debug;
 #if ! defined PRIVATE_STYPE && ! defined PRIVATE_STYPE_IS_DECLARED
 union PRIVATE_STYPE
 {
-#line 79 "engines/private/grammar.y"
+#line 80 "engines/private/grammar.y"
 
         Private::Symbol *sym; /* symbol table pointer */
         int (**inst)();       /* machine instruction */


Commit: 03d9efa5d02edb3d73ff8e947359b48c6eb84588
    https://github.com/scummvm/scummvm/commit/03d9efa5d02edb3d73ff8e947359b48c6eb84588
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
COMMON: renamed include guard in installshieldv3

Changed paths:
    common/installshieldv3_archive.h


diff --git a/common/installshieldv3_archive.h b/common/installshieldv3_archive.h
index f11dfbd210..07ed31313e 100644
--- a/common/installshieldv3_archive.h
+++ b/common/installshieldv3_archive.h
@@ -20,8 +20,8 @@
  *
  */
 
-#ifndef COMMON_INSTALLER_ARCHIVE_H
-#define COMMON_INSTALLER_ARCHIVE_H
+#ifndef COMMON_INSTALLSHIELDV3_ARCHIVE_H
+#define COMMON_INSTALLSHIELDV3_ARCHIVE_H
 
 #include "common/archive.h"
 #include "common/scummsys.h"


Commit: f62f889344835f4e17f11abc597567739e743a02
    https://github.com/scummvm/scummvm/commit/f62f889344835f4e17f11abc597567739e743a02
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: fixes

Changed paths:
    engines/private/code.cpp
    engines/private/grammar.h
    engines/private/symbol.h


diff --git a/engines/private/code.cpp b/engines/private/code.cpp
index fbfcbd7b69..e2a6213af4 100644
--- a/engines/private/code.cpp
+++ b/engines/private/code.cpp
@@ -53,16 +53,16 @@
 
 namespace Private {
 
-using namespace Gen;
-
-VM *Gen::g_vm = new VM();
+Gen::VM *Gen::g_vm = new Gen::VM();
 
-void VM::run() {
-    execute(g_vm->_prog);
+void Gen::VM::run() {
+    Gen::execute(Gen::g_vm->_prog);
 }
 
 namespace Settings {
 
+using namespace Gen;
+
 SettingMaps *g_setts = new SettingMaps();
 
 /* initialize setting for code generation */
@@ -70,11 +70,11 @@ void SettingMaps::init() {
     _setting = (Setting *)malloc(sizeof(Setting));
     memset((void *)_setting, 0, sizeof(Setting));
 
-    Gen::g_vm->_prog = (Inst *)&_setting->prog;
-    Gen::g_vm->_stack = (Datum *)&_setting->stack;
+    g_vm->_prog = (Inst *)&_setting->prog;
+    g_vm->_stack = (Datum *)&_setting->stack;
 
-    Gen::g_vm->_progp = Gen::g_vm->_prog;
-    Gen::g_vm->_stackp = Gen::g_vm->_stack;
+    g_vm->_progp = Gen::g_vm->_prog;
+    g_vm->_stackp = Gen::g_vm->_stack;
 }
 
 void SettingMaps::save(char *name) {
@@ -87,11 +87,11 @@ void SettingMaps::load(Common::String &name) {
 
     debugC(1, kPrivateDebugCode, "loading setting %s", name.c_str());
 
-    Gen::g_vm->_prog = (Inst *)&_setting->prog;
-    Gen::g_vm->_stack = (Datum *)&_setting->stack;
+    g_vm->_prog = (Inst *)&_setting->prog;
+    g_vm->_stack = (Datum *)&_setting->stack;
 
-    Gen::g_vm->_stackp = Gen::g_vm->_stack;
-    Gen::g_vm->_progp = Gen::g_vm->_prog;
+    g_vm->_stackp = g_vm->_stack;
+    g_vm->_progp = g_vm->_prog;
 }
 
 } // end of namespace Settings
diff --git a/engines/private/grammar.h b/engines/private/grammar.h
index 0e3f76efb7..a71b97a120 100644
--- a/engines/private/grammar.h
+++ b/engines/private/grammar.h
@@ -71,7 +71,7 @@ typedef struct Setting {
 typedef Common::HashMap<Common::String, Setting *> SettingMap;
 
 class SettingMaps {
-    public:
+public:
     Setting *_setting;
     SettingMap _map;
 
@@ -94,7 +94,7 @@ void call(char *, ArgArray);
 namespace Gen {
 
 class VM {
-    public:
+public:
         Datum *_stack;  /* the stack */
         Datum *_stackp; /* next free spot on stack */
 
diff --git a/engines/private/symbol.h b/engines/private/symbol.h
index 6f1ebb0cda..6df245ae66 100644
--- a/engines/private/symbol.h
+++ b/engines/private/symbol.h
@@ -55,25 +55,25 @@ typedef Common::Queue<Common::String> StringQueue;
 typedef Common::Queue<Common::Rect *> RectQueue;
 
 class SymbolMaps {
-    private:
-        StringQueue stringToDefine;
-        RectQueue rectToDefine;
+private:
+    StringQueue stringToDefine;
+    RectQueue rectToDefine;
 
-    public:
-        SymbolMap settings; 
-        SymbolMap variables;
-        SymbolMap cursors;
-        SymbolMap locations;
-        SymbolMap rects;
-        ConstantList constants;
+public:
+    SymbolMap settings; 
+    SymbolMap variables;
+    SymbolMap cursors;
+    SymbolMap locations;
+    SymbolMap rects;
+    ConstantList constants;
     
-        NameList variableList;
-        NameList locationList;
+    NameList variableList;
+    NameList locationList;
 
-        Symbol *constant(int t, int d, char *s);
-        Symbol *lookupName(char *n);
-        void installAll(char *n);
-        void defineSymbol(char *, Common::Rect *);
+    Symbol *constant(int t, int d, char *s);
+    Symbol *lookupName(char *n);
+    void installAll(char *n);
+    void defineSymbol(char *, Common::Rect *);
 };
 
 } // End of namespace Private


Commit: 5b85ca03b7d673f8177a740404f8389d385c8f59
    https://github.com/scummvm/scummvm/commit/5b85ca03b7d673f8177a740404f8389d385c8f59
Author: neuromancer (unknown)
Date: 2021-03-04T02:06:59+01:00

Commit Message:
PRIVATE: added more detection rules

Changed paths:
    engines/private/detection.cpp


diff --git a/engines/private/detection.cpp b/engines/private/detection.cpp
index 77b8e1e6c7..7b08060089 100644
--- a/engines/private/detection.cpp
+++ b/engines/private/detection.cpp
@@ -40,17 +40,36 @@ static const ADGameDescription gameDescriptions[] = {
         ADGF_NO_FLAGS,
         GUIO1(GUIO_NOMIDI)
     },
-    /*
+    {
+        "private-eye", // Demo from the US release
+        "Demo",
+        AD_ENTRY2s("pvteye.z", "af383c813157810e89d8d6d595895ff7", 263893,
+           "bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
+        Common::EN_USA,
+        Common::kPlatformWindows,
+        ADGF_DEMO,
+        GUIO1(GUIO_NOMIDI)
+    },
     {
         "private-eye",  // EU release
         0,
-        AD_ENTRY1s("PVTEYE.Z", "", 0),
+        AD_ENTRY2s("pvteye.z", "d9ce391395701615e8b5d04bc4bf7ec3", 284699,
+           "bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
         Common::EN_GRB,
         Common::kPlatformWindows,
         ADGF_UNSUPPORTED,
         GUIO1(GUIO_NOMIDI)
     },
-    */
+    {
+        "private-eye", // Demo from the EU release
+        "Demo",
+        AD_ENTRY2s("pvteye.z", "01ca8641970189cb2ca3a96526026091", 284129,
+           "bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
+        Common::EN_GRB,
+        Common::kPlatformWindows,
+        ADGF_DEMO | ADGF_UNSUPPORTED,
+        GUIO1(GUIO_NOMIDI)
+    },
     {
         "private-eye", // Demo from archive.org
         "Demo",
@@ -62,15 +81,45 @@ static const ADGameDescription gameDescriptions[] = {
         GUIO1(GUIO_NOMIDI)
     },
     {
-        "private-eye", // Demo from the US release
+        "private-eye", // Another demo
         "Demo",
-        AD_ENTRY2s("pvteye.z", "af383c813157810e89d8d6d595895ff7", 263893,
+        AD_ENTRY2s("pvteye.z", "af383c813157810e89d8d6d595895ff7", 271214,
            "bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
         Common::EN_USA,
         Common::kPlatformWindows,
         ADGF_DEMO,
         GUIO1(GUIO_NOMIDI)
     },
+    {
+        "private-eye", // EU release (ES)
+        "It uses different file format for the assest",
+        AD_ENTRY2s("pvteye.ex_", "f41770550ab717086b2d0c805fef4b8f", 498176,
+           "bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
+        Common::ES_ESP,
+        Common::kPlatformWindows,
+        ADGF_UNSUPPORTED,
+        GUIO1(GUIO_NOMIDI)
+    },
+    {
+        "private-eye", // Demo from the  EU release (ES)
+        "It uses different file format for the assest",
+        AD_ENTRY2s("pvtdemo.ex_", "048f751acd7a0f1a87b20d6dc5229210", 497152,
+           "bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
+        Common::ES_ESP,
+        Common::kPlatformWindows,
+        ADGF_DEMO | ADGF_UNSUPPORTED,
+        GUIO1(GUIO_NOMIDI)
+    },
+    {
+        "private-eye", // EU release (FR)
+        "It uses different file format for the assest",
+        AD_ENTRY2s("pvteye.ex_", "ae0dec43b2f54d45c8a1c93e97092141", 600576,
+           "bklynlgo.bmp", "1dfb703349a46f8ec183de107992b7f5", 33118),
+        Common::FR_FRA,
+        Common::kPlatformWindows,
+        ADGF_UNSUPPORTED,
+        GUIO1(GUIO_NOMIDI)
+    },
     /*
     {
         "private-eye", // Demo from the EU release




More information about the Scummvm-git-logs mailing list