aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorVicent Marti2008-07-31 17:23:38 +0000
committerVicent Marti2008-07-31 17:23:38 +0000
commite8278c4c6891b8b3b2ef95f2f55e4730d76234ba (patch)
treeed1b52a33a707fef777cddfbf8567f3ef23d0027 /common
parent01cf9174b1ea896b5dc7ddc8ec560ca1bd4de4f4 (diff)
downloadscummvm-rg350-e8278c4c6891b8b3b2ef95f2f55e4730d76234ba.tar.gz
scummvm-rg350-e8278c4c6891b8b3b2ef95f2f55e4730d76234ba.tar.bz2
scummvm-rg350-e8278c4c6891b8b3b2ef95f2f55e4730d76234ba.zip
GUI Layout parsing. Work in progress.
svn-id: r33475
Diffstat (limited to 'common')
-rw-r--r--common/xmlparser.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/common/xmlparser.cpp b/common/xmlparser.cpp
index 030b5b9491..89dd5d7e32 100644
--- a/common/xmlparser.cpp
+++ b/common/xmlparser.cpp
@@ -41,25 +41,34 @@ bool XMLParser::parserError(const char *errorString, ...) {
int lineCount = 1;
int lineStart = 0;
- do {
- if (_text[pos] == '\n' || _text[pos] == '\r') {
- lineCount++;
-
- if (lineStart == 0)
- lineStart = MAX(pos + 1, _pos - 60);
- }
- } while (pos-- > 0);
+ if (_fileName == "Memory Stream") {
+ lineStart = MAX(0, _pos - 35);
+ lineCount = 0;
+ } else {
+ do {
+ if (_text[pos] == '\n' || _text[pos] == '\r') {
+ lineCount++;
+
+ if (lineStart == 0)
+ lineStart = MAX(pos + 1, _pos - 60);
+ }
+ } while (pos-- > 0);
+ }
char lineStr[70];
_text.stream()->seek(lineStart, SEEK_SET);
_text.stream()->readLine(lineStr, 70);
+
+ for (int i = 0; i < 70; ++i)
+ if (lineStr[i] == '\n')
+ lineStr[i] = ' ';
- printf(" File <%s>, line %d:\n", _fileName.c_str(), lineCount);
+ printf("\n File <%s>, line %d:\n", _fileName.c_str(), lineCount);
bool startFull = lineStr[0] == '<';
bool endFull = lineStr[strlen(lineStr) - 1] == '>';
- printf("%s%s%s\n", startFull ? "" : "...", endFull ? "" : "...", lineStr);
+ printf("%s%s%s\n", startFull ? "" : "...", lineStr, endFull ? "" : "...");
int cursor = MIN(_pos - lineStart, 70);
@@ -77,7 +86,7 @@ bool XMLParser::parserError(const char *errorString, ...) {
vprintf(errorString, args);
va_end(args);
- printf("\n");
+ printf("\n\n");
return false;
}
@@ -123,9 +132,8 @@ bool XMLParser::parseActiveKey(bool closed) {
return false;
}
- if (closed) {
+ if (closed)
delete _activeKey.pop();
- }
return true;
}