aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/parser
diff options
context:
space:
mode:
authorMax Horn2010-11-02 09:49:47 +0000
committerMax Horn2010-11-02 09:49:47 +0000
commitba3e826872d8456a3bca171bf5613f7802e9582a (patch)
treec3b4f245c111d6931ddb13f68a6171dd9615041c /engines/sci/parser
parent31bf3a413756dd55a3b89ec0b2ec798e360f7d49 (diff)
downloadscummvm-rg350-ba3e826872d8456a3bca171bf5613f7802e9582a.tar.gz
scummvm-rg350-ba3e826872d8456a3bca171bf5613f7802e9582a.tar.bz2
scummvm-rg350-ba3e826872d8456a3bca171bf5613f7802e9582a.zip
SCI: Remove any use of printf
svn-id: r54037
Diffstat (limited to 'engines/sci/parser')
-rw-r--r--engines/sci/parser/grammar.cpp40
-rw-r--r--engines/sci/parser/said.cpp2
-rw-r--r--engines/sci/parser/vocabulary.cpp56
-rw-r--r--engines/sci/parser/vocabulary.h2
4 files changed, 50 insertions, 50 deletions
diff --git a/engines/sci/parser/grammar.cpp b/engines/sci/parser/grammar.cpp
index 03e9d29660..8a6cd2dd4d 100644
--- a/engines/sci/parser/grammar.cpp
+++ b/engines/sci/parser/grammar.cpp
@@ -93,49 +93,49 @@ static void vocab_print_rule(ParseRule *rule) {
return;
}
- printf("[%03x] -> ", rule->_id);
+ debugN("[%03x] -> ", rule->_id);
if (rule->_data.empty())
- printf("e");
+ debugN("e");
for (uint i = 0; i < rule->_data.size(); i++) {
uint token = rule->_data[i];
if (token == TOKEN_OPAREN) {
if (i == rule->_firstSpecial)
- printf("_");
+ debugN("_");
- printf("(");
+ debugN("(");
wspace = 0;
} else if (token == TOKEN_CPAREN) {
if (i == rule->_firstSpecial)
- printf("_");
+ debugN("_");
- printf(")");
+ debugN(")");
wspace = 0;
} else {
if (wspace)
- printf(" ");
+ debugN(" ");
if (i == rule->_firstSpecial)
- printf("_");
+ debugN("_");
if (token & TOKEN_TERMINAL_CLASS)
- printf("C(%04x)", token & 0xffff);
+ debugN("C(%04x)", token & 0xffff);
else if (token & TOKEN_TERMINAL_GROUP)
- printf("G(%04x)", token & 0xffff);
+ debugN("G(%04x)", token & 0xffff);
else if (token & TOKEN_STUFFING_LEAF)
- printf("%03x", token & 0xffff);
+ debugN("%03x", token & 0xffff);
else if (token & TOKEN_STUFFING_WORD)
- printf("{%03x}", token & 0xffff);
+ debugN("{%03x}", token & 0xffff);
else
- printf("[%03x]", token); /* non-terminal */
+ debugN("[%03x]", token); /* non-terminal */
wspace = 1;
}
if (i == rule->_firstSpecial)
- printf("_");
+ debugN("_");
}
- printf(" [%d specials]", rule->_numSpecials);
+ debugN(" [%d specials]", rule->_numSpecials);
}
static ParseRule *_vdup(ParseRule *a) {
@@ -321,13 +321,13 @@ void ParseRuleList::print() const {
const ParseRuleList *list = this;
int pos = 0;
while (list) {
- printf("R%03d: ", pos);
+ debugN("R%03d: ", pos);
vocab_print_rule(list->rule);
- printf("\n");
+ debugN("\n");
list = list->next;
pos++;
}
- printf("%d rules total.\n", pos);
+ debugN("%d rules total.\n", pos);
}
static ParseRuleList *_vocab_split_rule_list(ParseRuleList *list) {
@@ -524,9 +524,9 @@ static int _vbpt_write_subexpression(ParseTreeNode *nodes, int *pos, ParseRule *
else
writepos = _vbpt_append_word(nodes, pos, writepos, token & 0xffff);
} else {
- printf("\nError in parser (grammar.cpp, _vbpt_write_subexpression()): Rule data broken in rule ");
+ warning("\nError in parser (grammar.cpp, _vbpt_write_subexpression()): Rule data broken in rule ");
vocab_print_rule(rule);
- printf(", at token position %d\n", *pos);
+ debugN(", at token position %d\n", *pos);
return rulepos;
}
}
diff --git a/engines/sci/parser/said.cpp b/engines/sci/parser/said.cpp
index 7393874856..e9c6d9847f 100644
--- a/engines/sci/parser/said.cpp
+++ b/engines/sci/parser/said.cpp
@@ -39,7 +39,7 @@ namespace Sci {
#ifdef SCI_DEBUG_PARSE_TREE_AUGMENTATION
-#define scidprintf printf
+#define scidprintf debugN
#else
void print_nothing(...) { }
#define scidprintf print_nothing
diff --git a/engines/sci/parser/vocabulary.cpp b/engines/sci/parser/vocabulary.cpp
index 3e35bd652a..b1f928cdd9 100644
--- a/engines/sci/parser/vocabulary.cpp
+++ b/engines/sci/parser/vocabulary.cpp
@@ -458,44 +458,44 @@ void Vocabulary::debugDecipherSaidBlock(const byte *addr) {
nextItem = *addr++;
if (nextItem != 0xff) {
if ((!first) && (nextItem != 0xf0))
- printf(" ");
+ debugN(" ");
first = false;
if (nextItem < 0xf0) {
nextItem = nextItem << 8 | *addr++;
- printf("%s{%03x}", getAnyWordFromGroup(nextItem), nextItem);
+ debugN("%s{%03x}", getAnyWordFromGroup(nextItem), nextItem);
nextItem = 0; // Make sure that group 0xff doesn't abort
} else switch (nextItem) {
case 0xf0:
- printf(",");
+ debugN(",");
break;
case 0xf1:
- printf("&");
+ debugN("&");
break;
case 0xf2:
- printf("/");
+ debugN("/");
break;
case 0xf3:
- printf("(");
+ debugN("(");
break;
case 0xf4:
- printf(")");
+ debugN(")");
break;
case 0xf5:
- printf("[");
+ debugN("[");
break;
case 0xf6:
- printf("]");
+ debugN("]");
break;
case 0xf7:
- printf("#");
+ debugN("#");
break;
case 0xf8:
- printf("<");
+ debugN("<");
break;
case 0xf9:
- printf(">");
+ debugN(">");
break;
case 0xff:
break;
@@ -611,48 +611,48 @@ void _vocab_recursive_ptree_dump(ParseTreeNode *tree, int blanks) {
int i;
if (tree->type == kParseTreeLeafNode) {
- printf("vocab_dump_parse_tree: Error: consp is nil\n");
+ debugN("vocab_dump_parse_tree: Error: consp is nil\n");
return;
}
if (lbranch) {
if (lbranch->type == kParseTreeBranchNode) {
- printf("\n");
+ debugN("\n");
for (i = 0; i < blanks; i++)
- printf(" ");
- printf("(");
+ debugN(" ");
+ debugN("(");
_vocab_recursive_ptree_dump(lbranch, blanks + 1);
- printf(")\n");
+ debugN(")\n");
for (i = 0; i < blanks; i++)
- printf(" ");
+ debugN(" ");
} else
- printf("%x", lbranch->value);
- printf(" ");
- }/* else printf ("nil");*/
+ debugN("%x", lbranch->value);
+ debugN(" ");
+ }/* else debugN ("nil");*/
if (rbranch) {
if (rbranch->type == kParseTreeBranchNode)
_vocab_recursive_ptree_dump(rbranch, blanks);
else {
- printf("%x", rbranch->value);
+ debugN("%x", rbranch->value);
while (rbranch->right) {
rbranch = rbranch->right;
- printf("/%x", rbranch->value);
+ debugN("/%x", rbranch->value);
}
}
- }/* else printf("nil");*/
+ }/* else debugN("nil");*/
}
void vocab_dump_parse_tree(const char *tree_name, ParseTreeNode *nodes) {
- printf("(setq %s \n'(", tree_name);
+ debugN("(setq %s \n'(", tree_name);
_vocab_recursive_ptree_dump(nodes, 1);
- printf("))\n");
+ debugN("))\n");
}
void Vocabulary::dumpParseTree() {
- printf("(setq parse-tree \n'(");
+ debugN("(setq parse-tree \n'(");
_vocab_recursive_ptree_dump(_parserNodes, 1);
- printf("))\n");
+ debugN("))\n");
}
void Vocabulary::synonymizeTokens(ResultWordListList &words) {
diff --git a/engines/sci/parser/vocabulary.h b/engines/sci/parser/vocabulary.h
index 620d50c09d..baf30a03d7 100644
--- a/engines/sci/parser/vocabulary.h
+++ b/engines/sci/parser/vocabulary.h
@@ -243,7 +243,7 @@ public:
ParseRuleList *buildGNF(bool verbose = false);
/**
- * Deciphers a said block and dumps its content via printf.
+ * Deciphers a said block and dumps its content via debugN.
* For debugging only.
* @param pos pointer to the data to dump
*/