aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/kstring.cpp
diff options
context:
space:
mode:
authorMax Horn2009-03-09 22:25:33 +0000
committerMax Horn2009-03-09 22:25:33 +0000
commit6c932497151f54f31d7b6fbf34a2ee24fd362d63 (patch)
tree30c9d7b4c10f02f64089afff4524bd292f0c3264 /engines/sci/engine/kstring.cpp
parentf3e50fba7c7e7715c2e54f8d7de22434f87beae5 (diff)
downloadscummvm-rg350-6c932497151f54f31d7b6fbf34a2ee24fd362d63.tar.gz
scummvm-rg350-6c932497151f54f31d7b6fbf34a2ee24fd362d63.tar.bz2
scummvm-rg350-6c932497151f54f31d7b6fbf34a2ee24fd362d63.zip
SCI: result_word_t -> ResultWord; switched to Common::List for storing lists of ResultWords
svn-id: r39278
Diffstat (limited to 'engines/sci/engine/kstring.cpp')
-rw-r--r--engines/sci/engine/kstring.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index fa61813044..03378b7ce8 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -254,9 +254,8 @@ reg_t kSetSynonyms(EngineState *s, int funct_nr, int argc, reg_t *argv) {
reg_t kParse(EngineState *s, int funct_nr, int argc, reg_t *argv) {
reg_t stringpos = argv[0];
char *string = kernel_dereference_char_pointer(s, stringpos, 0);
- int words_nr;
char *error;
- result_word_t *words;
+ ResultWordList words;
reg_t event = argv[1];
s->parser_event = event;
@@ -268,39 +267,35 @@ reg_t kParse(EngineState *s, int funct_nr, int argc, reg_t *argv) {
return s->r_acc;
}
- words = vocab_tokenize_string(string, &words_nr,
+ words = vocab_tokenize_string(string,
s->parser_words, s->parser_words_nr,
s->_parserSuffixes,
&error);
s->parser_valid = 0; /* not valid */
- if (words) {
+ if (!words.empty()) {
int syntax_fail = 0;
- vocab_synonymize_tokens(words, words_nr, s->synonyms, s->synonyms_nr);
+ vocab_synonymize_tokens(words, s->synonyms, s->synonyms_nr);
s->r_acc = make_reg(0, 1);
if (s->debug_mode & (1 << SCIkPARSER_NR)) {
- int i;
-
SCIkdebug(SCIkPARSER, "Parsed to the following blocks:\n", 0);
- for (i = 0; i < words_nr; i++)
- SCIkdebug(SCIkPARSER, " Type[%04x] Group[%04x]\n", words[i].w_class, words[i].group);
+ for (ResultWordList::const_iterator i = words.begin(); i != words.end(); ++i)
+ SCIkdebug(SCIkPARSER, " Type[%04x] Group[%04x]\n", i->w_class, i->group);
}
- if (vocab_build_parse_tree(&(s->parser_nodes[0]), words, words_nr, s->parser_branches,
+ if (vocab_build_parse_tree(&(s->parser_nodes[0]), words, s->parser_branches,
s->parser_rules))
syntax_fail = 1; /* Building a tree failed */
#ifdef SCI_SIMPLE_SAID_CODE
- vocab_build_simple_parse_tree(&(s->parser_nodes[0]), words, words_nr);
+ vocab_build_simple_parse_tree(&(s->parser_nodes[0]), words);
#endif /* SCI_SIMPLE_SAID_CODE */
- free(words);
-
if (syntax_fail) {
s->r_acc = make_reg(0, 1);