aboutsummaryrefslogtreecommitdiff
path: root/engines/director/lingo/lingo-codegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/director/lingo/lingo-codegen.cpp')
-rw-r--r--engines/director/lingo/lingo-codegen.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 9390a8b7f9..32ddea47ac 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -57,17 +57,21 @@ void Lingo::execute(int pc) {
debugC(1, kDebugLingoExec, "[%3d]: %s", _pc, instr.c_str());
+ Common::String stack("Stack: ");
+
for (uint i = 0; i < _stack.size(); i++) {
- debugCN(5, kDebugLingoExec, "%d ", _stack[i].u.i);
+ Datum d = _stack[i];
+ d.toString();
+ stack += Common::String::format("<%s> ", d.u.s->c_str());
}
- debugCN(5, kDebugLingoExec, "%s", "");
+ debugC(5, kDebugLingoExec, "%s", stack.c_str());
_pc++;
(*((*_currentScript)[_pc - 1]))();
}
}
-Common::String Lingo::decodeInstruction(int pc) {
+Common::String Lingo::decodeInstruction(int pc, int *newPc) {
Symbol sym;
Common::String res;
@@ -114,6 +118,9 @@ Common::String Lingo::decodeInstruction(int pc) {
res = "<unknown>";
}
+ if (newPc)
+ *newPc = pc;
+
return res;
}
@@ -182,7 +189,7 @@ void Lingo::define(Common::String &name, int start, int nargs, Common::String *p
if (prefix)
name = *prefix + "-" + name;
- debug(3, "define(\"%s\", %d, %d, %d)", name.c_str(), start, _currentScript->size() - 1, nargs);
+ debugC(3, kDebugLingoCompile, "define(\"%s\", %d, %d, %d)", name.c_str(), start, _currentScript->size() - 1, nargs);
if (!_handlers.contains(name)) { // Create variable if it was not defined
sym = new Symbol;
@@ -274,7 +281,7 @@ int Lingo::codeFunc(Common::String *s, int numpar) {
if (s->equalsIgnoreCase("me")) {
if (!g_lingo->_currentFactory.empty()) {
g_lingo->codeString(g_lingo->_currentFactory.c_str());
- debug(2, "Repaced 'me' with %s", g_lingo->_currentFactory.c_str());
+ debugC(2, kDebugLingoCompile, "Replaced 'me' with %s", g_lingo->_currentFactory.c_str());
} else {
warning("'me' out of factory method");
g_lingo->codeString(s->c_str());