[Scummvm-cvs-logs] SF.net SVN: scummvm:[41566] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Tue Jun 16 01:08:45 CEST 2009


Revision: 41566
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41566&view=rev
Author:   drmccoy
Date:     2009-06-15 23:08:44 +0000 (Mon, 15 Jun 2009)

Log Message:
-----------
Fixing the signness indicated by the OP_ enums

Modified Paths:
--------------
    scummvm/trunk/engines/gob/parse.cpp
    scummvm/trunk/engines/gob/parse.h

Modified: scummvm/trunk/engines/gob/parse.cpp
===================================================================
--- scummvm/trunk/engines/gob/parse.cpp	2009-06-15 23:08:28 UTC (rev 41565)
+++ scummvm/trunk/engines/gob/parse.cpp	2009-06-15 23:08:44 UTC (rev 41566)
@@ -96,8 +96,8 @@
 			case OP_LOAD_VAR_INT16:
 			case OP_LOAD_VAR_INT8:
 			case OP_LOAD_IMM_INT16:
-			case OP_LOAD_VAR_UINT32:
-			case OP_LOAD_VAR_UINT32_AS_INT16:
+			case OP_LOAD_VAR_INT32:
+			case OP_LOAD_VAR_INT32_AS_INT16:
 				_vm->_global->_inter_execPtr += 2;
 				break;
 
@@ -125,9 +125,9 @@
 			case 15:
 				_vm->_global->_inter_execPtr += 2;
 
-			case OP_ARRAY_UINT8:
-			case OP_ARRAY_UINT32:
-			case OP_ARRAY_UINT16:
+			case OP_ARRAY_INT8:
+			case OP_ARRAY_INT32:
+			case OP_ARRAY_INT16:
 			case OP_ARRAY_STR:
 				dimCount = _vm->_global->_inter_execPtr[2];
 				// skip header and dimensions
@@ -147,7 +147,7 @@
 				skipExpr(OP_END_EXPR);
 			}
 			continue;
-		} // if ((operation >= OP_ARRAY_UINT8) && (operation <= OP_FUNC))
+		} // if ((operation >= OP_ARRAY_INT8) && (operation <= OP_FUNC))
 
 		if (operation == OP_BEGIN_EXPR) {
 			num++;
@@ -194,7 +194,7 @@
 	while (true) {
 		operation = *_vm->_global->_inter_execPtr++;
 
-		if ((operation >= OP_ARRAY_UINT8) && (operation <= OP_FUNC)) {
+		if ((operation >= OP_ARRAY_INT8) && (operation <= OP_FUNC)) {
 			// operands
 
 			switch (operation) {
@@ -225,8 +225,8 @@
 					strlen((char *) _vm->_global->_inter_execPtr) + 1;
 				break;
 
-			case OP_LOAD_VAR_UINT32:
-			case OP_LOAD_VAR_UINT32_AS_INT16:
+			case OP_LOAD_VAR_INT32:
+			case OP_LOAD_VAR_INT32_AS_INT16:
 				debugN(5, "var_%d", _vm->_inter->load16());
 				break;
 
@@ -239,9 +239,9 @@
 				}
 				break;
 
-			case OP_ARRAY_UINT8: // uint8 array access
-			case OP_ARRAY_UINT32: // uint32 array access
-			case OP_ARRAY_UINT16: // uint16 array access
+			case OP_ARRAY_INT8: // uint8 array access
+			case OP_ARRAY_INT32: // uint32 array access
+			case OP_ARRAY_INT16: // uint16 array access
 			case OP_ARRAY_STR: // string array access
 				debugN(5, "\n");
 				if (operation == OP_ARRAY_STR)
@@ -284,7 +284,7 @@
 				break;
 			}
 			continue;
-		}		// if ((operation >= OP_ARRAY_UINT8) && (operation <= OP_FUNC))
+		}		// if ((operation >= OP_ARRAY_INT8) && (operation <= OP_FUNC))
 
 		// operators
 		switch (operation) {
@@ -415,7 +415,7 @@
 
 	operation = *_vm->_global->_inter_execPtr++;
 	switch (operation) {
-	case OP_LOAD_VAR_UINT32:
+	case OP_LOAD_VAR_INT32:
 	case OP_LOAD_VAR_STR:
 		temp = _vm->_inter->load16() * 4;
 		debugN(5, "&var_%d", temp);
@@ -426,7 +426,7 @@
 		}
 		break;
 
-	case OP_ARRAY_UINT32:
+	case OP_ARRAY_INT32:
 	case OP_ARRAY_STR:
 		debugN(5, "&var_%d[", _vm->_inter->load16());
 		dimCount = *_vm->_global->_inter_execPtr++;
@@ -473,7 +473,9 @@
 	return cmpTemp;
 }
 
-bool Parse::getVarBase(uint32 &varBase, bool mindStop, uint16 *size, uint16 *type) {
+bool Parse::getVarBase(uint32 &varBase, bool mindStop,
+		uint16 *size, uint16 *type) {
+
 	varBase = 0;
 
 	byte operation = *_vm->_global->_inter_execPtr;
@@ -564,9 +566,9 @@
 
 	debugC(5, kDebugParser, "var parse = %d", operation);
 	switch (operation) {
-	case OP_ARRAY_UINT8:
-	case OP_ARRAY_UINT32:
-	case OP_ARRAY_UINT16:
+	case OP_ARRAY_INT8:
+	case OP_ARRAY_INT32:
+	case OP_ARRAY_INT16:
 	case OP_ARRAY_STR:
 		temp = _vm->_inter->load16();
 		dimCount = *_vm->_global->_inter_execPtr++;
@@ -577,11 +579,11 @@
 			temp2 = parseValExpr(OP_END_MARKER);
 			offset = arrDesc[dim] * offset + temp2;
 		}
-		if (operation == OP_ARRAY_UINT8)
+		if (operation == OP_ARRAY_INT8)
 			return varBase + temp + offset;
-		if (operation == OP_ARRAY_UINT32)
+		if (operation == OP_ARRAY_INT32)
 			return varBase + (temp + offset) * 4;
-		if (operation == OP_ARRAY_UINT16)
+		if (operation == OP_ARRAY_INT16)
 			return varBase + (temp + offset) * 2;
 		temp *= 4;
 		offset *= 4;
@@ -597,8 +599,8 @@
 	case OP_LOAD_VAR_INT8:
 		return varBase + _vm->_inter->load16();
 
-	case OP_LOAD_VAR_UINT32:
-	case OP_LOAD_VAR_UINT32_AS_INT16:
+	case OP_LOAD_VAR_INT32:
+	case OP_LOAD_VAR_INT32_AS_INT16:
 	case OP_LOAD_VAR_STR:
 		temp = _vm->_inter->load16() * 4;
 		debugC(5, kDebugParser, "oper = %d",
@@ -656,11 +658,11 @@
 		valPtr++;
 
 		operation = *_vm->_global->_inter_execPtr++;
-		if ((operation >= OP_ARRAY_UINT8) && (operation <= OP_FUNC)) {
+		if ((operation >= OP_ARRAY_INT8) && (operation <= OP_FUNC)) {
 			switch (operation) {
-			case OP_ARRAY_UINT8:
-			case OP_ARRAY_UINT32:
-			case OP_ARRAY_UINT16:
+			case OP_ARRAY_INT8:
+			case OP_ARRAY_INT32:
+			case OP_ARRAY_INT16:
 			case OP_ARRAY_STR:
 				*operPtr = (operation == OP_ARRAY_STR) ? OP_LOAD_IMM_STR : OP_LOAD_IMM_INT16;
 				temp = _vm->_inter->load16();
@@ -672,11 +674,11 @@
 					temp2 = parseValExpr(OP_END_MARKER);
 					offset = offset * arrDescPtr[dim] + temp2;
 				}
-				if (operation == OP_ARRAY_UINT8)
+				if (operation == OP_ARRAY_INT8)
 					*valPtr = (int8) READ_VARO_UINT8(varBase + temp + offset);
-				else if (operation == OP_ARRAY_UINT32)
+				else if (operation == OP_ARRAY_INT32)
 					*valPtr = READ_VARO_UINT32(varBase + temp * 4 + offset * 4);
-				else if (operation == OP_ARRAY_UINT16)
+				else if (operation == OP_ARRAY_INT16)
 					*valPtr = (int16) READ_VARO_UINT16(varBase + temp * 2 + offset * 2);
 				else if (operation == OP_ARRAY_STR) {
 					*valPtr = encodePtr(_vm->_inter->_variables->getAddressOff8(
@@ -725,12 +727,12 @@
 					strlen((char *) _vm->_global->_inter_execPtr) + 1;
 				break;
 
-			case OP_LOAD_VAR_UINT32:
+			case OP_LOAD_VAR_INT32:
 				*operPtr = OP_LOAD_IMM_INT16;
 				*valPtr = READ_VARO_UINT32(varBase + _vm->_inter->load16() * 4);
 				break;
 
-			case OP_LOAD_VAR_UINT32_AS_INT16:
+			case OP_LOAD_VAR_INT32_AS_INT16:
 				*operPtr = OP_LOAD_IMM_INT16;
 				*valPtr = (int16) READ_VARO_UINT16(varBase + _vm->_inter->load16() * 4);
 				break;
@@ -845,7 +847,7 @@
 				break;
 			}
 			continue;
-		} // (op >= OP_ARRAY_UINT8) && (op <= OP_FUNC)
+		} // (op >= OP_ARRAY_INT8) && (op <= OP_FUNC)
 
 		if ((operation == stopToken) || (operation == OP_OR) ||
 				(operation == OP_AND) || (operation == OP_END_EXPR)) {
@@ -1123,8 +1125,8 @@
 					strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(values[0]));
 				break;
 
-			case OP_LOAD_VAR_UINT32:
-			case OP_LOAD_VAR_UINT32_AS_INT16:
+			case OP_LOAD_VAR_INT32:
+			case OP_LOAD_VAR_INT32_AS_INT16:
 				break;
 
 			default:

Modified: scummvm/trunk/engines/gob/parse.h
===================================================================
--- scummvm/trunk/engines/gob/parse.h	2009-06-15 23:08:28 UTC (rev 41565)
+++ scummvm/trunk/engines/gob/parse.h	2009-06-15 23:08:44 UTC (rev 41566)
@@ -29,66 +29,63 @@
 namespace Gob {
 
 enum {
-	OP_NEG = 1,
-	OP_ADD = 2,
-	OP_SUB = 3,
-	OP_BITOR = 4,
-	OP_MUL = 5,
-	OP_DIV = 6,
-	OP_MOD = 7,
-	OP_BITAND = 8,
-	OP_BEGIN_EXPR = 9,
-	OP_END_EXPR = 10,
-	OP_NOT = 11,
+	OP_NEG        =  1,
+	OP_ADD        =  2,
+	OP_SUB        =  3,
+	OP_BITOR      =  4,
+	OP_MUL        =  5,
+	OP_DIV        =  6,
+	OP_MOD        =  7,
+	OP_BITAND     =  8,
+	OP_BEGIN_EXPR =  9,
+	OP_END_EXPR   = 10,
+	OP_NOT        = 11,
 
-	OP_END_MARKER = 12,	// Marks end of an array or string
+	OP_END_MARKER = 12, // Marks end of an array or string
 
 
-	OP_ARRAY_UINT8 = 16,
+	OP_ARRAY_INT8              = 16,
+	OP_LOAD_VAR_INT16          = 17,
+	OP_LOAD_VAR_INT8           = 18,
+	OP_LOAD_IMM_INT32          = 19,
+	OP_LOAD_IMM_INT16          = 20,
+	OP_LOAD_IMM_INT8           = 21,
+	OP_LOAD_IMM_STR            = 22,
+	OP_LOAD_VAR_INT32          = 23,
+	OP_LOAD_VAR_INT32_AS_INT16 = 24,
+	OP_LOAD_VAR_STR            = 25,
+	OP_ARRAY_INT32             = 26,
+	OP_ARRAY_INT16             = 27,
+	OP_ARRAY_STR               = 28,
 
-	OP_LOAD_VAR_INT16 = 17,
-	OP_LOAD_VAR_INT8 = 18,
-	OP_LOAD_IMM_INT32 = 19,
-	OP_LOAD_IMM_INT16 = 20,
-	OP_LOAD_IMM_INT8 = 21,
-	OP_LOAD_IMM_STR = 22,
-
-	OP_LOAD_VAR_UINT32 = 23,
-	OP_LOAD_VAR_UINT32_AS_INT16 = 24,
-	OP_LOAD_VAR_STR = 25,
-
-	OP_ARRAY_UINT32 = 26,
-	OP_ARRAY_UINT16 = 27,
-	OP_ARRAY_STR = 28,
-
 	OP_FUNC = 29,
 
-	OP_OR = 30,	// Logical OR
-	OP_AND = 31,	// Logical AND
-	OP_LESS = 32,
-	OP_LEQ = 33,
+	OP_OR      = 30, // Logical OR
+	OP_AND     = 31, // Logical AND
+	OP_LESS    = 32,
+	OP_LEQ     = 33,
 	OP_GREATER = 34,
-	OP_GEQ = 35,
-	OP_EQ = 36,
-	OP_NEQ = 37
+	OP_GEQ     = 35,
+	OP_EQ      = 36,
+	OP_NEQ     = 37
 };
 
 enum {
-	FUNC_SQRT1 = 0,
-	FUNC_SQRT2 = 1,
-	FUNC_SQRT3 = 6,
+	FUNC_SQRT1 =  0,
+	FUNC_SQRT2 =  1,
+	FUNC_SQRT3 =  6,
 
-	FUNC_SQR = 5,
-	FUNC_ABS = 7,
-	FUNC_RAND = 10
+	FUNC_SQR   =  5,
+	FUNC_ABS   =  7,
+	FUNC_RAND  = 10
 };
 
 enum {
 	// FIXME: The following two 'truth values' are stored inside the list
-	// of "operators". So they somehow coincide with OP_LOAD_VAR_UINT32
-	// and OP_LOAD_VAR_UINT32_AS_UINT16. I haven't yet quite understood
+	// of "operators". So they somehow coincide with OP_LOAD_VAR_INT32
+	// and OP_LOAD_VAR_INT32_AS_INT16. I haven't yet quite understood
 	// how, resp. what that means. You have been warned.
-	GOB_TRUE = 24,
+	GOB_TRUE  = 24,
 	GOB_FALSE = 23
 };
 
@@ -107,9 +104,9 @@
 
 private:
 	enum PointerType {
-		kExecPtr = 0,
+		kExecPtr  = 0,
 		kInterVar = 1,
-		kResStr = 2
+		kResStr   = 2
 	};
 
 	GobEngine *_vm;
@@ -121,7 +118,8 @@
 
 	int cmpHelper(byte *operPtr, int32 *valPtr);
 
-	bool getVarBase(uint32 &varBase, bool mindStop = false, uint16 *size = 0, uint16 *type = 0);
+	bool getVarBase(uint32 &varBase, bool mindStop = false,
+			uint16 *size = 0, uint16 *type = 0);
 };
 
 } // End of namespace Gob


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