diff options
author | Max Horn | 2009-03-08 08:17:43 +0000 |
---|---|---|
committer | Max Horn | 2009-03-08 08:17:43 +0000 |
commit | efa5493b2d01efed5c9488b3c324469969812296 (patch) | |
tree | c363123d9895706e92e9b1e85d41eb8e2c9893e3 /engines/sci/engine | |
parent | 7cf72e8a177b0cbc1c7f9c9e838cf8596ab9e849 (diff) | |
download | scummvm-rg350-efa5493b2d01efed5c9488b3c324469969812296.tar.gz scummvm-rg350-efa5493b2d01efed5c9488b3c324469969812296.tar.bz2 scummvm-rg350-efa5493b2d01efed5c9488b3c324469969812296.zip |
SCI: Changed suffix list to be stored as a Common::List; also fixed spelling: suffices -> suffixes
svn-id: r39214
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/game.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/kstring.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/savegame.cfsml | 3 | ||||
-rw-r--r-- | engines/sci/engine/savegame.cpp | 5 | ||||
-rw-r--r-- | engines/sci/engine/scriptconsole.cpp | 20 | ||||
-rw-r--r-- | engines/sci/engine/scriptdebug.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/state.cpp | 2 | ||||
-rw-r--r-- | engines/sci/engine/state.h | 3 |
8 files changed, 17 insertions, 26 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index a220d33f98..572fe9dc90 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -49,7 +49,7 @@ static int _init_vocabulary(EngineState *s) { // initialize vocabulary and relat sciprintf("Initializing vocabulary\n"); if ((s->resmgr->_sciVersion < SCI_VERSION_01_VGA) && (s->parser_words = vocab_get_words(s->resmgr, &(s->parser_words_nr)))) { - s->parser_suffices = vocab_get_suffices(s->resmgr, &(s->parser_suffices_nr)); + vocab_get_suffixes(s->resmgr, s->_parserSuffixes); if ((s->parser_branches = vocab_get_branches(s->resmgr, &(s->parser_branches_nr)))) // Now build a GNF grammar out of this s->parser_rules = vocab_build_gnf(s->parser_branches, s->parser_branches_nr); @@ -78,7 +78,7 @@ static void _free_vocabulary(EngineState *s) { if (s->parser_words) { vocab_free_words(s->parser_words, s->parser_words_nr); - vocab_free_suffices(s->resmgr, s->parser_suffices, s->parser_suffices_nr); + vocab_free_suffixes(s->resmgr, s->_parserSuffixes); vocab_free_branches(s->parser_branches); vocab_free_rule_list(s->parser_rules); } diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp index 2a2d97b17a..fa61813044 100644 --- a/engines/sci/engine/kstring.cpp +++ b/engines/sci/engine/kstring.cpp @@ -270,7 +270,7 @@ reg_t kParse(EngineState *s, int funct_nr, int argc, reg_t *argv) { words = vocab_tokenize_string(string, &words_nr, s->parser_words, s->parser_words_nr, - s->parser_suffices, s->parser_suffices_nr, + s->_parserSuffixes, &error); s->parser_valid = 0; /* not valid */ diff --git a/engines/sci/engine/savegame.cfsml b/engines/sci/engine/savegame.cfsml index eb5b0d0ffc..ce582ca730 100644 --- a/engines/sci/engine/savegame.cfsml +++ b/engines/sci/engine/savegame.cfsml @@ -1146,8 +1146,7 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { retval->parser_rules = s->parser_rules; retval->parser_words_nr = s->parser_words_nr; retval->parser_words = s->parser_words; - retval->parser_suffices_nr = s->parser_suffices_nr; - retval->parser_suffices = s->parser_suffices; + retval->_parserSuffixes = s->_parserSuffixes; retval->parser_branches_nr = s->parser_branches_nr; retval->parser_branches = s->parser_branches; diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 5b35336763..ca9ecff0a1 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -5306,8 +5306,7 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { retval->parser_rules = s->parser_rules; retval->parser_words_nr = s->parser_words_nr; retval->parser_words = s->parser_words; - retval->parser_suffices_nr = s->parser_suffices_nr; - retval->parser_suffices = s->parser_suffices; + retval->_parserSuffixes = s->_parserSuffixes; retval->parser_branches_nr = s->parser_branches_nr; retval->parser_branches = s->parser_branches; @@ -5383,7 +5382,7 @@ bool get_savegame_metadata(Common::SeekableReadStream* stream, SavegameMetadata* } } // End of auto-generated CFSML data reader code -#line 1195 "engines/sci/engine/savegame.cfsml" +#line 1194 "engines/sci/engine/savegame.cfsml" if (read_eof) return false; diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp index d2f8417e4a..e2a1e94826 100644 --- a/engines/sci/engine/scriptconsole.cpp +++ b/engines/sci/engine/scriptconsole.cpp @@ -707,31 +707,27 @@ static int c_list_words(EngineState *s) { return 0; } -int c_list_suffices(EngineState *s) { - suffix_t **suffices; - int suffices_nr; - int i; +int c_list_suffixes(EngineState *s) { + SuffixList suffixes; char word_buf[256], alt_buf[256]; - suffices = vocab_get_suffices(s->resmgr, &suffices_nr); - - if (!suffices) { + if (!vocab_get_suffixes(s->resmgr, suffixes)) { sciprintf("No suffix vocabulary.\n"); return 1; } - for (i = 0; i < suffices_nr; i++) { - suffix_t *suf = suffices[i]; - + int i = 0; + for (SuffixList::const_iterator suf = suffixes.begin(); suf != suffixes.end(); ++suf) { strncpy(word_buf, suf->word_suffix, suf->word_suffix_length); word_buf[suf->word_suffix_length] = 0; strncpy(alt_buf, suf->alt_suffix, suf->alt_suffix_length); alt_buf[suf->alt_suffix_length] = 0; sciprintf("%4d: (%03x) -%12s => -%12s (%03x)\n", i, suf->class_mask, word_buf, alt_buf, suf->result_class); + ++i; } - vocab_free_suffices(s->resmgr, suffices, suffices_nr); + vocab_free_suffixes(s->resmgr, suffixes); return 0; } @@ -829,7 +825,7 @@ static int c_list(EngineState *s) { return c_kernelnames(s); else if (!strcmp("suffixes", cmd_params[0].str) || !strcmp("suffices", cmd_params[0].str) || !strcmp("sufficos", cmd_params[0].str)) // sufficos: Accusative Plural of 'suffix' - return c_list_suffices(s); + return c_list_suffixes(s); else if (!strcmp("words", cmd_params[0].str)) return c_list_words(s); else if (strcmp("restypes", cmd_params[0].str) == 0) { diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp index 62967c9df6..7a579179c8 100644 --- a/engines/sci/engine/scriptdebug.cpp +++ b/engines/sci/engine/scriptdebug.cpp @@ -791,7 +791,7 @@ int c_sim_parse(EngineState *s) { if (openb) *openb = 0; // remove them and the rest - result = vocab_lookup_word(token, strlen(token), s->parser_words, s->parser_words_nr, s->parser_suffices, s->parser_suffices_nr); + result = vocab_lookup_word(token, strlen(token), s->parser_words, s->parser_words_nr, s->_parserSuffixes); if (result) { s->parser_nodes[i].type = 0; @@ -1026,7 +1026,7 @@ int c_parse(EngineState *s) { string = cmd_params[0].str; sciprintf("Parsing '%s'\n", string); words = vocab_tokenize_string(string, &words_nr, s->parser_words, s->parser_words_nr, - s->parser_suffices, s->parser_suffices_nr, &error); + s->_parserSuffixes, &error); if (words) { int i, syntax_fail = 0; diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index 65262da82f..0c7cbd8411 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -145,8 +145,6 @@ EngineState::EngineState() : _dirseeker(this) { sys_strings = 0; parser_words = 0; parser_words_nr = 0; - parser_suffices = 0; - parser_suffices_nr = 0; parser_branches = 0; parser_rules = 0; parser_branches_nr = 0; diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 2b4a991118..bc33f6de92 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -254,8 +254,7 @@ struct EngineState { /* Parser data: */ word_t **parser_words; int parser_words_nr; - suffix_t **parser_suffices; - int parser_suffices_nr; + SuffixList _parserSuffixes; parse_tree_branch_t *parser_branches; parse_rule_list_t *parser_rules; /* GNF rules used in the parser algorithm */ int parser_branches_nr; |