aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/director/lingo/lingo-codegen.cpp10
-rw-r--r--engines/director/lingo/lingo.h9
2 files changed, 19 insertions, 0 deletions
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 8473f2e8a0..b5bc8014c1 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -64,6 +64,16 @@ void Lingo::execute(int pc) {
}
}
+void Lingo::pushContext() {
+ Context *con = new Context;
+
+ _contexts.push_back(con);
+}
+
+void Lingo::popContext() {
+ _contexts.pop_back();
+}
+
Symbol *Lingo::lookupVar(const char *name, bool create, bool putInLocalList) {
Symbol *sym;
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index becd41002a..bec14f2b59 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -113,6 +113,11 @@ typedef Common::HashMap<int32, ScriptData *> ScriptHash;
typedef Common::Array<Datum> StackData;
typedef Common::HashMap<Common::String, Symbol *, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> SymbolHash;
+struct Context { /* execution context */
+ Symbol *handler;
+ SymbolHash *localvars;
+};
+
class Lingo {
public:
Lingo(DirectorEngine *vm);
@@ -135,6 +140,8 @@ public:
public:
void execute(int pc);
+ void pushContext();
+ void popContext();
Symbol *lookupVar(const char *name, bool create = true, bool putInLocalList = true);
void define(Common::String &s, int start, int nargs);
void codeArg(Common::String *s);
@@ -205,6 +212,8 @@ private:
Common::HashMap<Common::String, bool, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _localvars;
SymbolHash _handlers;
+ Common::Array<Context *> _contexts;
+
int _pc;
StackData _stack;