From e8278c4c6891b8b3b2ef95f2f55e4730d76234ba Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Thu, 31 Jul 2008 17:23:38 +0000 Subject: GUI Layout parsing. Work in progress. svn-id: r33475 --- common/xmlparser.cpp | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'common') 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; } -- cgit v1.2.3