[Scummvm-cvs-logs] scummvm master -> 1abbe6bcf0b203725ae5c519a9a4502be89fa949

sev- sev at scummvm.org
Fri Aug 19 09:55:31 CEST 2016


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2074fad2cf DIRECTOR: Lingo: Improved stack content trace
0ab903a9e2 COMMON: Added checkers for debug channels.
1abbe6bcf0 DIRECTOR: Lingo: Hide script hexdump under debug level


Commit: 2074fad2cf48e901d3cacccad200d13e88487f82
    https://github.com/scummvm/scummvm/commit/2074fad2cf48e901d3cacccad200d13e88487f82
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-19T09:55:22+02:00

Commit Message:
DIRECTOR: Lingo: Improved stack content trace

Changed paths:
    engines/director/lingo/lingo-codegen.cpp



diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp
index 44ae8e9..3b72784 100644
--- a/engines/director/lingo/lingo-codegen.cpp
+++ b/engines/director/lingo/lingo-codegen.cpp
@@ -57,10 +57,14 @@ 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]))();
@@ -78,7 +82,6 @@ Common::String Lingo::decodeInstruction(int pc) {
 		inst i;
 
 		while (*pars) {
-			warning("--- %d  of %d --  %s", pc, _currentScript->size(), res.c_str());
 			switch (*pars++) {
 			case 'i':
 				{


Commit: 0ab903a9e2416f329439d094bc6b6864a3454e37
    https://github.com/scummvm/scummvm/commit/0ab903a9e2416f329439d094bc6b6864a3454e37
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-19T09:55:22+02:00

Commit Message:
COMMON: Added checkers for debug channels.

Sometimes there is a need to add debug execution and enable it from
the command line. Now it is possible, both with debug levels and channels

Changed paths:
    common/debug.cpp
    common/debug.h



diff --git a/common/debug.cpp b/common/debug.cpp
index ce34a00..c61fc63 100644
--- a/common/debug.cpp
+++ b/common/debug.cpp
@@ -120,6 +120,18 @@ bool DebugManager::isDebugChannelEnabled(uint32 channel) {
 
 } // End of namespace Common
 
+bool debugLevelSet(int level) {
+	return level <= gDebugLevel;
+}
+
+bool debugChannelSet(int level, uint32 debugChannels) {
+	if (gDebugLevel != 11)
+		if (level > gDebugLevel || !(DebugMan.isDebugChannelEnabled(debugChannels)))
+			return false;
+
+	return true;
+}
+
 
 #ifndef DISABLE_TEXT_CONSOLE
 
diff --git a/common/debug.h b/common/debug.h
index 00bad81..883a0bf 100644
--- a/common/debug.h
+++ b/common/debug.h
@@ -31,11 +31,10 @@ inline void debug(const char *s, ...) {}
 inline void debug(int level, const char *s, ...) {}
 inline void debugN(const char *s, ...) {}
 inline void debugN(int level, const char *s, ...) {}
-inline void debugC(int level, uint32 engineChannel, const char *s, ...) {}
-inline void debugC(uint32 engineChannel, const char *s, ...) {}
-inline void debugCN(int level, uint32 engineChannel, const char *s, ...) {}
-inline void debugCN(uint32 engineChannel, const char *s, ...) {}
-
+inline void debugC(int level, uint32 debugChannels, const char *s, ...) {}
+inline void debugC(uint32 debugChannels, const char *s, ...) {}
+inline void debugCN(int level, uint32 debugChannels, const char *s, ...) {}
+inline void debugCN(uint32 debugChannels, const char *s, ...) {}
 
 #else
 
@@ -111,6 +110,18 @@ void debugCN(uint32 debugChannels, const char *s, ...) GCC_PRINTF(2, 3);
 #endif
 
 /**
+ * Returns true if the debug level is set to the specified level
+ */
+bool debugLevelSet(int level);
+
+/**
+ * Returns true if the debug level and channel are active
+ *
+ * @see enableDebugChannel
+ */
+bool debugChannelSet(int level, uint32 debugChannels);
+
+/**
  * The debug level. Initially set to -1, indicating that no debug output
  * should be shown. Positive values usually imply an increasing number of
  * debug output shall be generated, the higher the value, the more verbose the


Commit: 1abbe6bcf0b203725ae5c519a9a4502be89fa949
    https://github.com/scummvm/scummvm/commit/1abbe6bcf0b203725ae5c519a9a4502be89fa949
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-08-19T09:55:22+02:00

Commit Message:
DIRECTOR: Lingo: Hide script hexdump under debug level

Changed paths:
    engines/director/lingo/lingo.cpp



diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 0f4b539..412b817 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -198,8 +198,10 @@ void Lingo::addCode(const char *code, ScriptType type, uint16 id) {
 
 	_inFactory = false;
 
-	if (_currentScript->size() && !_hadError)
-		Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst));
+	if (debugChannelSet(3, kDebugLingoCompile)) {
+		if (_currentScript->size() && !_hadError)
+			Common::hexdump((byte *)&_currentScript->front(), _currentScript->size() * sizeof(inst));
+	}
 }
 
 void Lingo::executeScript(ScriptType type, uint16 id) {






More information about the Scummvm-git-logs mailing list