aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/true_talk/tt_parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/true_talk/tt_parser.cpp')
-rw-r--r--engines/titanic/true_talk/tt_parser.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp
index 5bae72ce33..a48fcaea0e 100644
--- a/engines/titanic/true_talk/tt_parser.cpp
+++ b/engines/titanic/true_talk/tt_parser.cpp
@@ -26,8 +26,34 @@
namespace Titanic {
-void TTparser::processInput(TTinput *input) {
+int TTparser::processInput(TTinput *input) {
+ _input = input;
+ if (normalize(input))
+ return 0;
+
warning("TODO: TTparser::processInput");
+ return 0;
+}
+
+int TTparser::normalize(TTinput *input) {
+ TTstring *line = new TTstring();
+
+ for (const char *lineP = input->_line.c_str(); lineP; ++lineP) {
+ char c = *lineP;
+ if (Common::isLower(c)) {
+ (*line) += c;
+ } else if (Common::isSpace(c)) {
+ if (!line->empty() && line->lastChar() != ' ')
+ (*line) += ' ';
+ } else if (Common::isUpper(c)) {
+ (*line) += toupper(c);
+ } else if (Common::isDigit(c)) {
+ // TODO: num handling
+ }
+ // TODO other cases
+ }
+
+ return 0;
}
} // End of namespace Titanic