From 97be9aa6dc204843f4a896f7e12f6cabc4322b44 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 19 Aug 2016 19:04:07 +0200 Subject: [PATCH] DIRECTOR: Lingo: Improved debug output --- engines/director/lingo/lingo-builtins.cpp | 2 +- engines/director/lingo/lingo-code.cpp | 15 ++++++++------- engines/director/lingo/lingo-codegen.cpp | 2 +- engines/director/lingo/lingo.cpp | 12 ++++++------ 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp index 798ab0824b9a..6738d4b707e8 100644 --- a/engines/director/lingo/lingo-builtins.cpp +++ b/engines/director/lingo/lingo-builtins.cpp @@ -545,7 +545,7 @@ void Lingo::b_alert(int nargs) { d.toString(); - warning("STUB: b_alert"); + warning("STUB: b_alert(%s)", d.u.s->c_str()); delete d.u.s; } diff --git a/engines/director/lingo/lingo-code.cpp b/engines/director/lingo/lingo-code.cpp index 95bb7f35ab27..8712f0990c28 100644 --- a/engines/director/lingo/lingo-code.cpp +++ b/engines/director/lingo/lingo-code.cpp @@ -702,24 +702,25 @@ void Lingo::c_ifcode() { int end = READ_UINT32(&(*g_lingo->_currentScript)[savepc + 2]); int skipEnd = READ_UINT32(&(*g_lingo->_currentScript)[savepc + 3]); - debug(8, "executing cond (have to %s end)", skipEnd ? "skip" : "execute"); + debugC(8, kDebugLingoExec, "executing cond (have to %s end)", skipEnd ? "skip" : "execute"); g_lingo->execute(savepc + 4); /* condition */ d = g_lingo->pop(); if (d.toInt()) { - debug(8, "executing then"); + debugC(8, kDebugLingoExec, "executing then"); g_lingo->execute(then); } else if (elsep) { /* else part? */ - debug(8, "executing else"); + debugC(8, kDebugLingoExec, "executing else"); g_lingo->execute(elsep); } if (!g_lingo->_returning && !skipEnd) { g_lingo->_pc = end; /* next stmt */ - debug(8, "executing end"); - } else - debug(8, "Skipped end"); + debugC(8, kDebugLingoExec, "executing end"); + } else { + debugC(8, kDebugLingoExec, "Skipped end"); + } } void Lingo::c_whencode() { @@ -809,7 +810,7 @@ void Lingo::call(Common::String &name, int nargs) { if (!g_lingo->_handlers.contains(name)) { Symbol *s = g_lingo->lookupVar(name.c_str(), false); if (s && s->type == OBJECT) { - debug(3, "Dereferencing object reference: %s to %s", name.c_str(), s->u.s->c_str()); + debugC(3, kDebugLingoExec, "Dereferencing object reference: %s to %s", name.c_str(), s->u.s->c_str()); name = *s->u.s; } } diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp index 6584a92855d1..32ddea47acd2 100644 --- a/engines/director/lingo/lingo-codegen.cpp +++ b/engines/director/lingo/lingo-codegen.cpp @@ -281,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()); diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp index 06e4e53886b9..d37da4267094 100644 --- a/engines/director/lingo/lingo.cpp +++ b/engines/director/lingo/lingo.cpp @@ -121,17 +121,17 @@ const char *Lingo::findNextDefinition(const char *s) { return NULL; if (!strncmp(res, "macro ", 6)) { - warning("See macro"); + debugC(3, kDebugLingoCompile, "See macro"); return res; } if (!strncmp(res, "factory ", 8)) { - warning("See factory"); + debugC(3, kDebugLingoCompile, "See factory"); return res; } if (!strncmp(res, "method ", 7)) { - warning("See method"); + debugC(3, kDebugLingoCompile, "See method"); return res; } @@ -241,7 +241,7 @@ void Lingo::processEvent(LEvent event, int entityId) { if (!_eventHandlerTypes.contains(event)) error("processEvent: Unknown event %d for entity %d", event, entityId); - debug(2, "processEvent(%s) for %d", _eventHandlerTypes[event], entityId); + debug(2, "STUB: processEvent(%s) for %d", _eventHandlerTypes[event], entityId); } int Lingo::alignTypes(Datum &d1, Datum &d2) { @@ -412,7 +412,7 @@ void Lingo::runTests() { stream->read(script, size); - warning("Compiling file %s of size %d, id: %d", fileList[i].c_str(), size, counter); + debugC(2, kDebugLingoCompile, "Compiling file %s of size %d, id: %d", fileList[i].c_str(), size, counter); _hadError = false; addCode(script, kMovieScript, counter); @@ -420,7 +420,7 @@ void Lingo::runTests() { if (!_hadError) executeScript(kMovieScript, counter); else - warning("Skipping execution"); + debugC(2, kDebugLingoCompile, "Skipping execution"); free(script);