SCI: fix debugging code of parser, add 0xffe special group into debug support

svn-id: r50956
This commit is contained in:
Martin Kiewitz 2010-07-17 12:06:31 +00:00
parent 83e2aa2360
commit e000d28654
4 changed files with 9 additions and 5 deletions

View File

@ -60,8 +60,8 @@ reg_t kSaid(EngineState *s, int argc, reg_t *argv) {
}
#ifdef DEBUG_PARSER
debugC(2, kDebugLevelParser, "Said block:", 0);
s->_voc->decipherSaidBlock(said_block);
printf("Said block: ");
g_sci->getVocabulary()->decipherSaidBlock(said_block);
#endif
if (voc->parser_event.isNull() || (readSelectorValue(s->_segMan, voc->parser_event, SELECTOR(claimed)))) {

View File

@ -489,7 +489,7 @@ void Kernel::dissectScript(int scriptNumber, Vocabulary *vocab) {
printf("%04x: ", seeker);
while (seeker < _seeker) {
unsigned char nextitem = script->data [seeker++];
uint16 nextitem = script->data [seeker++];
if (nextitem == 0xFF)
printf("\n%04x: ", seeker);
else if (nextitem >= 0xF0) {

View File

@ -142,10 +142,13 @@ bool Vocabulary::loadParserWords() {
const char *Vocabulary::getAnyWordFromGroup(int group) {
if (group == VOCAB_MAGIC_NUMBER_GROUP)
return "{number}";
if (group == VOCAB_MAGIC_NOTHING_GROUP)
return "{nothing}";
for (WordMap::const_iterator i = _parserWords.begin(); i != _parserWords.end(); ++i)
for (WordMap::const_iterator i = _parserWords.begin(); i != _parserWords.end(); ++i) {
if (i->_value._group == group)
return i->_key.c_str();
}
return "{invalid}";
}
@ -301,7 +304,7 @@ ResultWord Vocabulary::lookupWord(const char *word, int word_len) {
}
void Vocabulary::decipherSaidBlock(byte *addr) {
byte nextitem;
uint16 nextitem;
do {
nextitem = *addr++;

View File

@ -78,6 +78,7 @@ enum {
/* This word class is used for numbers */
#define VOCAB_MAGIC_NUMBER_GROUP 0xffd /* 0xffe ? */
#define VOCAB_MAGIC_NOTHING_GROUP 0xffe
/* Number of nodes for each parse_tree_node structure */
#define VOCAB_TREE_NODES 500