From ecaebf7cedba882185c1b87f12a01bc84d91f879 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 28 Dec 2019 23:46:50 +0100 Subject: DIRECTOR: LINGO: Print variable lists as an extra debug step --- engines/director/lingo/lingo-codegen.cpp | 10 ++++++++++ engines/director/lingo/lingo.cpp | 14 ++++++++++++++ engines/director/lingo/lingo.h | 2 ++ 3 files changed, 26 insertions(+) (limited to 'engines') diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp index 16c8a1848f..84557650fd 100644 --- a/engines/director/lingo/lingo-codegen.cpp +++ b/engines/director/lingo/lingo-codegen.cpp @@ -58,6 +58,11 @@ void Lingo::execute(uint pc) { if (debugChannelSet(5, kDebugLingoExec)) printStack("Stack before: ", current); + if (debugChannelSet(9, kDebugLingoExec)) { + debug("Vars after"); + printAllVars(); + } + debugC(1, kDebugLingoExec, "[%3d]: %s", current, instr.c_str()); _pc++; @@ -66,6 +71,11 @@ void Lingo::execute(uint pc) { if (debugChannelSet(5, kDebugLingoExec)) printStack("Stack after: ", current); + if (debugChannelSet(9, kDebugLingoExec)) { + debug("Vars after"); + printAllVars(); + } + if (_pc >= (*_currentScript).size()) { warning("Lingo::execute(): Bad PC (%d)", _pc); break; diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index 0956adeaa8..9c94bc6a96 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -487,4 +487,18 @@ void Lingo::executeImmediateScripts(Frame *frame) { } } +void Lingo::printAllVars() { + debugN(" Local vars: "); + for (SymbolHash::iterator i = _localvars->begin(); i != _localvars->end(); ++i) { + debugN("%s, ", (*i)._key.c_str()); + } + debug(""); + + debugN(" Global vars: "); + for (SymbolHash::iterator i = _globalvars.begin(); i != _globalvars.end(); ++i) { + debugN("%s, ", (*i)._key.c_str()); + } + debug(""); +} + } // End of namespace Director diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h index f9a6661701..caaac44a67 100644 --- a/engines/director/lingo/lingo.h +++ b/engines/director/lingo/lingo.h @@ -231,6 +231,8 @@ public: int alignTypes(Datum &d1, Datum &d2); + void printAllVars(); + int code1(inst code) { _currentScript->push_back(code); return _currentScript->size() - 1; } int code2(inst code_1, inst code_2) { int o = code1(code_1); code1(code_2); return o; } int code3(inst code_1, inst code_2, inst code_3) { int o = code1(code_1); code1(code_2); code1(code_3); return o; } -- cgit v1.2.3