[Scummvm-cvs-logs] SF.net SVN: scummvm:[41072] scummvm/trunk/engines/sci
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun May 31 17:08:47 CEST 2009
Revision: 41072
http://scummvm.svn.sourceforge.net/scummvm/?rev=41072&view=rev
Author: fingolfin
Date: 2009-05-31 15:08:47 +0000 (Sun, 31 May 2009)
Log Message:
-----------
SCI: Renamed some Vocabulary methods for clarity; also renamed decypherSaidBlock -> decipherSaidBlock; some cleanup in Console::cmdSentenceFragments
Modified Paths:
--------------
scummvm/trunk/engines/sci/console.cpp
scummvm/trunk/engines/sci/engine/kernel.cpp
scummvm/trunk/engines/sci/engine/kstring.cpp
scummvm/trunk/engines/sci/engine/said.cpp
scummvm/trunk/engines/sci/vocabulary.cpp
scummvm/trunk/engines/sci/vocabulary.h
Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp 2009-05-31 15:08:16 UTC (rev 41071)
+++ scummvm/trunk/engines/sci/console.cpp 2009-05-31 15:08:47 UTC (rev 41072)
@@ -499,29 +499,30 @@
for (uint i = 0; i < g_EngineState->_vocabulary->getParserBranchesSize(); i++) {
int j = 0;
- DebugPrintf("R%02d: [%x] ->", i, g_EngineState->_vocabulary->getParseTreeBranch(i).id);
- while ((j < 10) && g_EngineState->_vocabulary->getParseTreeBranch(i).data[j]) {
- int dat = g_EngineState->_vocabulary->getParseTreeBranch(i).data[j++];
+ const parse_tree_branch_t &branch = g_EngineState->_vocabulary->getParseTreeBranch(i);
+ DebugPrintf("R%02d: [%x] ->", i, branch.id);
+ while ((j < 10) && branch.data[j]) {
+ int dat = branch.data[j++];
switch (dat) {
case VOCAB_TREE_NODE_COMPARE_TYPE:
- dat = g_EngineState->_vocabulary->getParseTreeBranch(i).data[j++];
+ dat = branch.data[j++];
DebugPrintf(" C(%x)", dat);
break;
case VOCAB_TREE_NODE_COMPARE_GROUP:
- dat = g_EngineState->_vocabulary->getParseTreeBranch(i).data[j++];
+ dat = branch.data[j++];
DebugPrintf(" WG(%x)", dat);
break;
case VOCAB_TREE_NODE_FORCE_STORAGE:
- dat = g_EngineState->_vocabulary->getParseTreeBranch(i).data[j++];
+ dat = branch.data[j++];
DebugPrintf(" FORCE(%x)", dat);
break;
default:
if (dat > VOCAB_TREE_NODE_LAST_WORD_STORAGE) {
- int dat2 = g_EngineState->_vocabulary->getParseTreeBranch(i).data[j++];
+ int dat2 = branch.data[j++];
DebugPrintf(" %x[%x]", dat, dat2);
} else
DebugPrintf(" ?%x?", dat);
Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp 2009-05-31 15:08:16 UTC (rev 41071)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp 2009-05-31 15:08:47 UTC (rev 41072)
@@ -906,7 +906,7 @@
}
#endif
-bool Vocabulary::getKernelNames() {
+bool Vocabulary::loadKernelNames() {
_kernelNames.clear();
switch (_resmgr->_sciVersion) {
Modified: scummvm/trunk/engines/sci/engine/kstring.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kstring.cpp 2009-05-31 15:08:16 UTC (rev 41071)
+++ scummvm/trunk/engines/sci/engine/kstring.cpp 2009-05-31 15:08:47 UTC (rev 41072)
@@ -95,7 +95,7 @@
#ifdef DEBUG_PARSER
debugC(2, kDebugLevelParser, "Said block:", 0);
- s->_vocabulary->decypherSaidBlock(said_block);
+ s->_vocabulary->decipherSaidBlock(said_block);
#endif
if (s->parser_event.isNull() || (GET_SEL32V(s->parser_event, claimed))) {
Modified: scummvm/trunk/engines/sci/engine/said.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/said.cpp 2009-05-31 15:08:16 UTC (rev 41071)
+++ scummvm/trunk/engines/sci/engine/said.cpp 2009-05-31 15:08:47 UTC (rev 41072)
@@ -2448,7 +2448,7 @@
if (s->parser_valid) {
if (said_parse_spec(s, spec)) {
sciprintf("Offending spec was: ");
- s->_vocabulary->decypherSaidBlock(spec);
+ s->_vocabulary->decipherSaidBlock(spec);
return SAID_NO_MATCH;
}
Modified: scummvm/trunk/engines/sci/vocabulary.cpp
===================================================================
--- scummvm/trunk/engines/sci/vocabulary.cpp 2009-05-31 15:08:16 UTC (rev 41071)
+++ scummvm/trunk/engines/sci/vocabulary.cpp 2009-05-31 15:08:47 UTC (rev 41072)
@@ -92,8 +92,8 @@
debug(2, "Initializing vocabulary");
- if (_resmgr->_sciVersion < SCI_VERSION_01_VGA && getParserWords()) {
- getSuffixes();
+ if (_resmgr->_sciVersion < SCI_VERSION_01_VGA && loadParserWords()) {
+ loadSuffixes();
if (getBranches())
// Now build a GNF grammar out of this
_parserRules = buildGNF();
@@ -102,16 +102,16 @@
_parserRules = NULL;
}
- getOpcodes();
+ loadOpcodes();
- if (!getSelectorNames()) {
+ if (!loadSelectorNames()) {
error("Vocabulary: Could not retrieve selector names");
}
// Map a few special selectors for later use
mapSelectors();
- getKernelNames();
+ loadKernelNames();
}
Vocabulary::~Vocabulary() {
@@ -124,7 +124,7 @@
freeSuffixes();
}
-bool Vocabulary::getSelectorNames() {
+bool Vocabulary::loadSelectorNames() {
int count;
Resource *r = _resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_SNAMES, 0);
@@ -150,7 +150,7 @@
return true;
}
-bool Vocabulary::getOpcodes() {
+bool Vocabulary::loadOpcodes() {
int count, i = 0;
Resource* r = _resmgr->findResource(kResourceTypeVocab, VOCAB_RESOURCE_OPCODES, 0);
@@ -176,7 +176,7 @@
return true;
}
-bool Vocabulary::getParserWords() {
+bool Vocabulary::loadParserWords() {
char currentword[256] = ""; // They're not going to use words longer than 255 ;-)
int currentwordpos = 0;
@@ -260,7 +260,7 @@
return "{invalid}";
}
-bool Vocabulary::getSuffixes() {
+bool Vocabulary::loadSuffixes() {
// Determine if we can find a SCI1 suffix vocabulary first
Resource* resource = NULL;
@@ -410,7 +410,7 @@
return retval;
}
-void Vocabulary::decypherSaidBlock(byte *addr) {
+void Vocabulary::decipherSaidBlock(byte *addr) {
int nextitem;
do {
@@ -503,7 +503,7 @@
return true;
}
-void Vocabulary::printSuffixes() {
+void Vocabulary::printSuffixes() const {
char word_buf[256], alt_buf[256];
Sci::Console *con = ((SciEngine *)g_engine)->_console;
@@ -519,7 +519,7 @@
}
}
-void Vocabulary::printParserWords() {
+void Vocabulary::printParserWords() const {
Sci::Console *con = ((SciEngine *)g_engine)->_console;
int j = 0;
Modified: scummvm/trunk/engines/sci/vocabulary.h
===================================================================
--- scummvm/trunk/engines/sci/vocabulary.h 2009-05-31 15:08:16 UTC (rev 41071)
+++ scummvm/trunk/engines/sci/vocabulary.h 2009-05-31 15:08:47 UTC (rev 41072)
@@ -195,11 +195,12 @@
const char *getAnyWordFromGroup(int group);
- /* Looks up a single word in the words and suffixes list
- ** Parameters: (char *) word: Pointer to the word to look up
- ** (int) word_len: Length of the word to look up
- ** Returns : (const ResultWordList &) A list containing 1 or 0 words
- */
+ /**
+ * Looks up a single word in the words and suffixes list.
+ * @param word pointer to the word to look up
+ * @param word_len length of the word to look up
+ * @return the matching word (or (-1,-1) if there was no match)
+ */
ResultWord lookupWord(const char *word, int word_len);
@@ -239,22 +240,22 @@
*/
parse_rule_list_t *buildGNF(bool verbose = false);
- /* Decyphers a said block and dumps its content via sciprintf.
- ** Parameters: (EngineState *) s: The state to use
- ** (byte *) pos: Pointer to the data to dump
- ** For debugging only.
- */
- void decypherSaidBlock(byte *pos);
+ /**
+ * Deciphers a said block and dumps its content via sciprintf.
+ * For debugging only.
+ * @param pos pointer to the data to dump
+ */
+ void decipherSaidBlock(byte *pos);
/**
- * Prints the parser suffixes to the debug console
+ * Prints the parser suffixes to the debug console.
*/
- void printSuffixes();
+ void printSuffixes() const;
/**
- * Prints the parser words to the debug console
+ * Prints the parser words to the debug console.
*/
- void printParserWords();
+ void printParserWords() const;
uint getParserBranchesSize() const { return _parserBranches.size(); }
const parse_tree_branch_t &getParseTreeBranch(int number) const { return _parserBranches[number]; }
@@ -293,7 +294,7 @@
* Loads the vocabulary selector names.
* Returns true upon success, false otherwise.
*/
- bool getSelectorNames();
+ bool loadSelectorNames();
/* Maps special selectors
** Returns : (void)
@@ -301,33 +302,33 @@
void mapSelectors();
/**
- * Fills the given Array with opcodes.
+ * Loads the opcode names (only used for debugging).
* @return true on success, false on failure
*/
- bool getOpcodes();
+ bool loadOpcodes();
/**
- * Fills the given StringList with kernel function names.
+ * Loads the kernel function names.
*
* This function reads the kernel function name table from resource_map,
- * and fills the given StringList with them.
+ * and fills the _kernelNames array with them.
* The resulting list has the same format regardless of the format of the
* name table of the resource (the format changed between version 0 and 1).
* @return true on success, false on failure
*/
- bool getKernelNames();
+ bool loadKernelNames();
/**
- * Gets all words from the main vocabulary.
+ * Loads all words from the main vocabulary.
* @return true on success, false on failure
*/
- bool getParserWords();
+ bool loadParserWords();
/**
* Loads all suffixes from the suffix vocabulary.
* @return true on success, false on failure
*/
- bool getSuffixes();
+ bool loadSuffixes();
/**
* Frees all suffixes in the given list.
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