Skip to content

Commit

Permalink
DIRECTOR: Lingo: Improved debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Aug 19, 2016
1 parent 7896f2b commit 97be9aa
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion engines/director/lingo/lingo-builtins.cpp
Expand Up @@ -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;
}
Expand Down
15 changes: 8 additions & 7 deletions engines/director/lingo/lingo-code.cpp
Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion engines/director/lingo/lingo-codegen.cpp
Expand Up @@ -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());
Expand Down
12 changes: 6 additions & 6 deletions engines/director/lingo/lingo.cpp
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -412,15 +412,15 @@ 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);

if (!_hadError)
executeScript(kMovieScript, counter);
else
warning("Skipping execution");
debugC(2, kDebugLingoCompile, "Skipping execution");

free(script);

Expand Down

0 comments on commit 97be9aa

Please sign in to comment.