[Scummvm-cvs-logs] CVS: tools descumm.cpp,1.35,1.36 descumm6.cpp,1.100,1.101

Max Horn fingolfin at users.sourceforge.net
Sat May 10 16:40:05 CEST 2003


Update of /cvsroot/scummvm/tools
In directory sc8-pr-cvs1:/tmp/cvs-serv22622

Modified Files:
	descumm.cpp descumm6.cpp 
Log Message:
small fix

Index: descumm.cpp
===================================================================
RCS file: /cvsroot/scummvm/tools/descumm.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- descumm.cpp	10 May 2003 23:20:13 -0000	1.35
+++ descumm.cpp	10 May 2003 23:39:49 -0000	1.36
@@ -1282,7 +1282,7 @@
 	if (offset == 0) {
 		sprintf(buf, "/* goto %.4X; */", to);
 	} else if (!dontOutputElse && maybeAddElse(cur, to)) {
-		pendingElse = 1;
+		pendingElse = true;
 		pendingElseTo = to;
 		pendingElseOffs = cur - 1;
 		pendingElseOpcode = g_jump_opcode;

Index: descumm6.cpp
===================================================================
RCS file: /cvsroot/scummvm/tools/descumm6.cpp,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -d -r1.100 -r1.101
--- descumm6.cpp	10 May 2003 23:20:13 -0000	1.100
+++ descumm6.cpp	10 May 2003 23:39:49 -0000	1.101
@@ -1083,12 +1083,16 @@
 	int cur = get_curoffs();
 	int to = cur + offset;
 
-	if (!dontOutputElse && maybeAddElse(cur, to)) {
-		// In order to avoid stray lonely "} else {" from occuring, we check
-		// for offset = 1. These cases really constitute NOPs, obviously.
-		// But apparently they were generated by the script compiler for
-		// switch/case constructs.
-		pendingElse = (offset != 1);
+	if (offset == 1) {
+		// Sometimes, jumps with offset 1 occur. I used to suppress those.
+		// But it turns out that's not quite correct in some cases. With this
+		// code, it can sometimes happens that you get an empty 'else' branch;
+		// but in many other cases, an otherwis hidden instruction is revealed,
+		// or an instruction is placed into an else branch instead of being
+		// (incorrectly) placed inside the body of the 'if' itself.
+		sprintf(output, "/* jump %x; */", to);
+	} else if (!dontOutputElse && maybeAddElse(cur, to)) {
+		pendingElse = true;
 		pendingElseTo = to;
 		pendingElseOffs = cur - 1;
 		pendingElseOpcode = g_jump_opcode;
@@ -1137,7 +1141,7 @@
 
 	e = strecpy(e, negate ? "if (" : "unless (");
 	e = se_astext(se, e);
-	sprintf(e, ") goto %x", to);
+	sprintf(e, ") jump %x", to);
 }
 
 





More information about the Scummvm-git-logs mailing list