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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Feb 19 15:09:13 CET 2007


Revision: 25724
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25724&view=rev
Author:   peres001
Date:     2007-02-19 06:09:13 -0800 (Mon, 19 Feb 2007)

Log Message:
-----------
refactoring

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

Modified: scummvm/trunk/engines/parallaction/parser.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser.cpp	2007-02-19 14:06:47 UTC (rev 25723)
+++ scummvm/trunk/engines/parallaction/parser.cpp	2007-02-19 14:09:13 UTC (rev 25724)
@@ -83,23 +83,9 @@
 	return v194;
 }
 
-uint16 parseFillBuffers() {
+uint16 fillTokens(char* line) {
 
-	uint16 i;
-	for (i = 0; i < 20; i++)
-		_tokens[i][0] = '\0';
-
-	char buf[200];
-	char *line = NULL;
-	do {
-		line = parseNextLine(buf, 200);
-		if (line == NULL) {
-			error("unexpected end of file while parsing");
-		}
-		line = Common::ltrim(line);
-	} while (strlen(line) == 0 || line[0] == '#');
-
-	i = 0;
+	uint16 i = 0;
 	while (strlen(line) > 0 && i < 20) {
 		line = parseNextToken(line, _tokens[i], 40, " \t\n");
 		if (_tokens[i][0] == '"' && _tokens[i][strlen(_tokens[i]) - 1] != '"') {
@@ -118,6 +104,25 @@
 	return i;
 }
 
+uint16 parseFillBuffers() {
+
+	uint16 i;
+	for (i = 0; i < 20; i++)
+		_tokens[i][0] = '\0';
+
+	char buf[200];
+	char *line = NULL;
+	do {
+		line = parseNextLine(buf, 200);
+		if (line == NULL) {
+			error("unexpected end of file while parsing");
+		}
+		line = Common::ltrim(line);
+	} while (strlen(line) == 0 || line[0] == '#');
+
+	return fillTokens(line);
+}
+
 //
 //	FIXME
 //	this function does the same Job as parseFillBuffers, except that
@@ -139,23 +144,7 @@
 		line = Common::ltrim(line);
 	} while (strlen(line) == 0 || line[0] == '#');
 
-	i = 0;
-	while (strlen(line) > 0 && i < 20) {
-		line = parseNextToken(line, _tokens[i], 40, " \t\n");
-		if (_tokens[i][0] == '"' && _tokens[i][strlen(_tokens[i]) - 1] != '"') {
-
-			line = parseNextToken(line, _tokens[i+1], 40, "\"");
-			strcat(_tokens[i], _tokens[i+1]);
-			_tokens[i][0] = ' ';
-			line++;
-
-		}
-
-		line = Common::ltrim(line);
-		i++;
-	}
-
-	return i;
+	return fillTokens(line);
 }
 
 
@@ -179,23 +168,7 @@
 		line = Common::ltrim(line);
 	} while (strlen(line) == 0 || line[0] == '#');
 
-	i = 0;
-	while (strlen(line) > 0 && i < 20) {
-		line = parseNextToken(line, _tokens[i], 40, " \t\n");
-		if (_tokens[i][0] == '"' && _tokens[i][strlen(_tokens[i]) - 1] != '"') {
-
-			line = parseNextToken(line, _tokens[i+1], 40, "\"");
-			strcat(_tokens[i], _tokens[i+1]);
-			_tokens[i][0] = ' ';
-			line++;
-
-		}
-
-		line = Common::ltrim(line);
-		i++;
-	}
-
-	return i;
+	return fillTokens(line);
 }
 
 


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