[Scummvm-cvs-logs] SF.net SVN: scummvm:[51242] scummvm/trunk/engines/sci
m_kiewitz at users.sourceforge.net
m_kiewitz at users.sourceforge.net
Sat Jul 24 13:51:10 CEST 2010
Revision: 51242
http://scummvm.svn.sourceforge.net/scummvm/?rev=51242&view=rev
Author: m_kiewitz
Date: 2010-07-24 11:51:09 +0000 (Sat, 24 Jul 2010)
Log Message:
-----------
SCI: added said spec dump ability to logkernel
Modified Paths:
--------------
scummvm/trunk/engines/sci/console.cpp
scummvm/trunk/engines/sci/engine/vm.cpp
scummvm/trunk/engines/sci/parser/said.cpp
scummvm/trunk/engines/sci/parser/vocabulary.cpp
scummvm/trunk/engines/sci/parser/vocabulary.h
Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp 2010-07-24 10:12:56 UTC (rev 51241)
+++ scummvm/trunk/engines/sci/console.cpp 2010-07-24 11:51:09 UTC (rev 51242)
@@ -1302,7 +1302,8 @@
spec[len++] = 0xFF;
printf("Matching '%s' against:", string);
- _engine->getVocabulary()->decipherSaidBlock(spec);
+ _engine->getVocabulary()->debugDecipherSaidBlock(spec);
+ printf("\n");
bool res = _engine->getVocabulary()->tokenizeString(words, string, &error);
if (res && !words.empty()) {
Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp 2010-07-24 10:12:56 UTC (rev 51241)
+++ scummvm/trunk/engines/sci/engine/vm.cpp 2010-07-24 11:51:09 UTC (rev 51242)
@@ -664,8 +664,18 @@
printf(" (%s)", s->_segMan->getObjectName(argv[parmNr]));
break;
case SIG_TYPE_REFERENCE:
- printf(" ('%s')", s->_segMan->getString(argv[parmNr]).c_str());
- break;
+ if (kernelCall->function == kSaid) {
+ SegmentRef saidSpec = s->_segMan->dereference(argv[parmNr]);
+ if (saidSpec.isRaw) {
+ printf(" ('");
+ g_sci->getVocabulary()->debugDecipherSaidBlock(saidSpec.raw);
+ printf("')");
+ } else {
+ printf(" (non-raw said-spec)");
+ }
+ } else {
+ printf(" ('%s')", s->_segMan->getString(argv[parmNr]).c_str());
+ }
default:
break;
}
Modified: scummvm/trunk/engines/sci/parser/said.cpp
===================================================================
--- scummvm/trunk/engines/sci/parser/said.cpp 2010-07-24 10:12:56 UTC (rev 51241)
+++ scummvm/trunk/engines/sci/parser/said.cpp 2010-07-24 11:51:09 UTC (rev 51242)
@@ -1003,11 +1003,8 @@
ParseTreeNode *parse_tree_ptr = voc->_parserNodes;
if (voc->parserIsValid) {
- if (said_parse_spec(spec)) {
- scidprintf("Offending spec was: ");
- voc->decipherSaidBlock(spec);
+ if (said_parse_spec(spec))
return SAID_NO_MATCH;
- }
if (verbose)
vocab_dump_parse_tree("Said-tree", said_tree);
Modified: scummvm/trunk/engines/sci/parser/vocabulary.cpp
===================================================================
--- scummvm/trunk/engines/sci/parser/vocabulary.cpp 2010-07-24 10:12:56 UTC (rev 51241)
+++ scummvm/trunk/engines/sci/parser/vocabulary.cpp 2010-07-24 11:51:09 UTC (rev 51242)
@@ -321,54 +321,58 @@
return retval;
}
-void Vocabulary::decipherSaidBlock(byte *addr) {
- uint16 nextitem;
+void Vocabulary::debugDecipherSaidBlock(const byte *addr) {
+ bool first = true;
+ uint16 nextItem;
do {
- nextitem = *addr++;
+ nextItem = *addr++;
+ if (nextItem != 0xff) {
+ if ((!first) && (nextItem != 0xf0))
+ printf(" ");
+ first = false;
- if (nextitem < 0xf0) {
- nextitem = nextitem << 8 | *addr++;
- printf(" %s[%03x]", getAnyWordFromGroup(nextitem), nextitem);
+ if (nextItem < 0xf0) {
+ nextItem = nextItem << 8 | *addr++;
+ printf("%s{%03x}", getAnyWordFromGroup(nextItem), nextItem);
- nextitem = 42; // Make sure that group 0xff doesn't abort
- } else switch (nextitem) {
- case 0xf0:
- printf(" ,");
- break;
- case 0xf1:
- printf(" &");
- break;
- case 0xf2:
- printf(" /");
- break;
- case 0xf3:
- printf(" (");
- break;
- case 0xf4:
- printf(" )");
- break;
- case 0xf5:
- printf(" [");
- break;
- case 0xf6:
- printf(" ]");
- break;
- case 0xf7:
- printf(" #");
- break;
- case 0xf8:
- printf(" <");
- break;
- case 0xf9:
- printf(" >");
- break;
- case 0xff:
- break;
+ nextItem = 0; // Make sure that group 0xff doesn't abort
+ } else switch (nextItem) {
+ case 0xf0:
+ printf(",");
+ break;
+ case 0xf1:
+ printf("&");
+ break;
+ case 0xf2:
+ printf("/");
+ break;
+ case 0xf3:
+ printf("(");
+ break;
+ case 0xf4:
+ printf(")");
+ break;
+ case 0xf5:
+ printf("[");
+ break;
+ case 0xf6:
+ printf("]");
+ break;
+ case 0xf7:
+ printf("#");
+ break;
+ case 0xf8:
+ printf("<");
+ break;
+ case 0xf9:
+ printf(">");
+ break;
+ case 0xff:
+ break;
}
- } while (nextitem != 0xff);
-
- printf("\n");
+ }
+ } while (nextItem != 0xff);
}
static const byte lowerCaseMap[256] = {
Modified: scummvm/trunk/engines/sci/parser/vocabulary.h
===================================================================
--- scummvm/trunk/engines/sci/parser/vocabulary.h 2010-07-24 10:12:56 UTC (rev 51241)
+++ scummvm/trunk/engines/sci/parser/vocabulary.h 2010-07-24 11:51:09 UTC (rev 51242)
@@ -235,7 +235,7 @@
* For debugging only.
* @param pos pointer to the data to dump
*/
- void decipherSaidBlock(byte *pos);
+ void debugDecipherSaidBlock(const byte *pos);
/**
* Prints the parser suffixes to the debug console.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list