[Scummvm-cvs-logs] SF.net SVN: scummvm: [27967] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sun Jul 8 15:39:23 CEST 2007


Revision: 27967
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27967&view=rev
Author:   peres001
Date:     2007-07-08 06:39:23 -0700 (Sun, 08 Jul 2007)

Log Message:
-----------
Yet another fix for broken parsing/displaying of strings. Now quotes are properly considered when they are needed, and ignored when they aren't.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/parser.cpp
    scummvm/trunk/engines/parallaction/parser.h

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-07-08 13:26:55 UTC (rev 27966)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-07-08 13:39:23 UTC (rev 27967)
@@ -608,7 +608,7 @@
 
 	while (strlen(text) > 0) {
 
-		text = parseNextToken(text, token, 40, "   ");
+		text = parseNextToken(text, token, 40, "   ", true);
 		linewidth += getStringWidth(token);
 
 		if (linewidth > wrapwidth) {
@@ -653,7 +653,8 @@
 
 	while (strlen(text) != 0) {
 
-		text = parseNextToken(text, token, 40, "   ");
+		text = parseNextToken(text, token, 40, "   ", true);
+		printf("%s\n", text);
 		w += getStringWidth(token);
 
 		if (w > maxwidth) {

Modified: scummvm/trunk/engines/parallaction/parser.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser.cpp	2007-07-08 13:26:55 UTC (rev 27966)
+++ scummvm/trunk/engines/parallaction/parser.cpp	2007-07-08 13:39:23 UTC (rev 27967)
@@ -127,7 +127,7 @@
 //
 //	The routine returns the unparsed portion of the input string 's'.
 //
-char *parseNextToken(char *s, char *tok, uint16 count, const char *brk) {
+char *parseNextToken(char *s, char *tok, uint16 count, const char *brk, bool ignoreQuotes) {
 
 	enum STATES { NORMAL, QUOTED };
 
@@ -150,8 +150,13 @@
 			}
 
 			if (*s == '"') {
-				state = QUOTED;
-				s++;
+				if (ignoreQuotes) {
+					*tok++ = *s++;
+					count--;
+				} else {
+					state = QUOTED;
+					s++;
+				}
 			} else {
 				*tok++ = *s++;
 				count--;

Modified: scummvm/trunk/engines/parallaction/parser.h
===================================================================
--- scummvm/trunk/engines/parallaction/parser.h	2007-07-08 13:26:55 UTC (rev 27966)
+++ scummvm/trunk/engines/parallaction/parser.h	2007-07-08 13:39:23 UTC (rev 27967)
@@ -33,7 +33,7 @@
 namespace Parallaction {
 
 uint16 fillBuffers(Common::SeekableReadStream &stream, bool errorOnEOF = false);
-char   *parseNextToken(char *s, char *tok, uint16 count, const char *brk);
+char   *parseNextToken(char *s, char *tok, uint16 count, const char *brk, bool ignoreQuotes = false);
 
 extern char _tokens[][40];
 


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