[Scummvm-cvs-logs] SF.net SVN: scummvm:[40473] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Tue May 12 10:14:24 CEST 2009
Revision: 40473
http://scummvm.svn.sourceforge.net/scummvm/?rev=40473&view=rev
Author: thebluegr
Date: 2009-05-12 08:14:24 +0000 (Tue, 12 May 2009)
Log Message:
-----------
Moved the "suffixes" and "words" console commands to ScummVM's debug console
Modified Paths:
--------------
scummvm/trunk/engines/sci/console.cpp
scummvm/trunk/engines/sci/console.h
scummvm/trunk/engines/sci/engine/scriptconsole.cpp
Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp 2009-05-12 07:21:44 UTC (rev 40472)
+++ scummvm/trunk/engines/sci/console.cpp 2009-05-12 08:14:24 UTC (rev 40473)
@@ -82,6 +82,8 @@
DCmd_Register("version", WRAP_METHOD(Console, cmdGetVersion));
DCmd_Register("selectors", WRAP_METHOD(Console, cmdSelectors));
DCmd_Register("kernelnames", WRAP_METHOD(Console, cmdKernelNames));
+ DCmd_Register("suffixes", WRAP_METHOD(Console, cmdSuffixes));
+ DCmd_Register("words", WRAP_METHOD(Console, cmdWords));
DCmd_Register("man", WRAP_METHOD(Console, cmdMan));
}
@@ -146,6 +148,54 @@
return true;
}
+bool Console::cmdSuffixes(int argc, const char **argv) {
+ SuffixList suffixes;
+ char word_buf[256], alt_buf[256];
+
+ if (!vocab_get_suffixes(_vm->getResMgr(), suffixes)) {
+ DebugPrintf("No suffix vocabulary.\n");
+ return true;
+ }
+
+ 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;
+
+ DebugPrintf("%4d: (%03x) -%12s => -%12s (%03x)\n", i, suf->class_mask, word_buf, alt_buf, suf->result_class);
+ ++i;
+ }
+
+ vocab_free_suffixes(_vm->getResMgr(), suffixes);
+
+ return true;
+}
+
+bool Console::cmdWords(int argc, const char **argv) {
+ WordMap words;
+
+ vocab_get_words(_vm->getResMgr(), words);
+
+ if (words.empty()) {
+ DebugPrintf("No vocabulary.\n");
+ return true;
+ }
+
+ int j = 0;
+ for (WordMap::iterator i = words.begin(); i != words.end(); ++i) {
+ DebugPrintf("%4d: %03x [%03x] %20s |", j, i->_value._class, i->_value._group, i->_key.c_str());
+ if (j % 3 == 0)
+ DebugPrintf("\n");
+ j++;
+ }
+
+ DebugPrintf("\n");
+
+ return true;
+}
+
bool Console::cmdMan(int argc, const char **argv) {
#if 0
int section = 0;
Modified: scummvm/trunk/engines/sci/console.h
===================================================================
--- scummvm/trunk/engines/sci/console.h 2009-05-12 07:21:44 UTC (rev 40472)
+++ scummvm/trunk/engines/sci/console.h 2009-05-12 08:14:24 UTC (rev 40473)
@@ -46,6 +46,8 @@
bool cmdGetVersion(int argc, const char **argv);
bool cmdSelectors(int argc, const char **argv);
bool cmdKernelNames(int argc, const char **argv);
+ bool cmdSuffixes(int argc, const char **argv);
+ bool cmdWords(int argc, const char **argv);
bool cmdMan(int argc, const char **argv);
private:
Modified: scummvm/trunk/engines/sci/engine/scriptconsole.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptconsole.cpp 2009-05-12 07:21:44 UTC (rev 40472)
+++ scummvm/trunk/engines/sci/engine/scriptconsole.cpp 2009-05-12 08:14:24 UTC (rev 40473)
@@ -679,50 +679,6 @@
return res;
}
-static int c_list_words(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
- WordMap words;
-
- vocab_get_words(s->resmgr, words);
-
- if (words.empty()) {
- sciprintf("No vocabulary.\n");
- return 1;
- }
-
- int j = 0;
- for (WordMap::iterator i = words.begin(); i != words.end(); ++i) {
- sciprintf("%4d: %03x [%03x] %s\n", j, i->_value._class, i->_value._group, i->_key.c_str());
- j++;
- }
-
- return 0;
-}
-
-int c_list_suffixes(EngineState *s, const Common::Array<cmd_param_t> &cmdParams) {
- SuffixList suffixes;
- char word_buf[256], alt_buf[256];
-
- if (!vocab_get_suffixes(s->resmgr, suffixes)) {
- sciprintf("No suffix vocabulary.\n");
- return 1;
- }
-
- 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_suffixes(s->resmgr, suffixes);
-
- return 0;
-}
-
static void _cmd_print_command(cmd_mm_entry_t *data, int full) {
const char *paramseeker = ((cmd_command_t *)data)->param;
@@ -787,8 +743,6 @@
"docs - lists all misc. documentation\n"
"\n"
"restypes - lists all resource types\n"
- "words - lists all kernel words\n"
- "suffixes - lists all suffix replacements\n"
"[resource] - lists all [resource]s");
} else if (cmdParams.size() == 1) {
const char *mm_subsects[3] = {"cmds", "vars", "docs"};
@@ -808,11 +762,6 @@
return 1;
}
- else if (!strcmp("suffixes", cmdParams[0].str) || !strcmp("suffices", cmdParams[0].str) || !strcmp("sufficos", cmdParams[0].str))
- // sufficos: Accusative Plural of 'suffix'
- return c_list_suffixes(s, cmdParams);
- else if (!strcmp("words", cmdParams[0].str))
- return c_list_words(s, cmdParams);
else if (strcmp("restypes", cmdParams[0].str) == 0) {
for (i = 0; i < kResourceTypeInvalid; i++)
sciprintf("%s\n", getResourceTypeName((ResourceType)i));
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