[Scummvm-cvs-logs] SF.net SVN: scummvm:[42079] scummvm/trunk/engines/sci/engine/vm.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Jul 3 23:59:07 CEST 2009


Revision: 42079
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42079&view=rev
Author:   thebluegr
Date:     2009-07-03 21:59:07 +0000 (Fri, 03 Jul 2009)

Log Message:
-----------
Replaced script_error and CORE_ERROR with error()

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/vm.cpp

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2009-07-03 20:56:40 UTC (rev 42078)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2009-07-03 21:59:07 UTC (rev 42079)
@@ -186,12 +186,6 @@
 
 #define OBJ_PROPERTY(o, p) (validate_property(o, p))
 
-int script_error(EngineState *s, const char *file, int line, const char *reason) {
-	error("Script error in file %s, line %d: %s\n", file, line, reason);
-	return 0;
-}
-#define CORE_ERROR(area, msg) script_error(s, "[" area "] " __FILE__, __LINE__, msg)
-
 reg_t get_class_address(EngineState *s, int classnr, SCRIPT_GET lock, reg_t caller) {
 
 	if (NULL == s) {
@@ -308,8 +302,7 @@
 		argc = validate_arithmetic(*argp);
 
 		if (argc > 0x800) { // More arguments than the stack could possibly accomodate for
-			CORE_ERROR("SEND", "More than 0x800 arguments to function call\n");
-			return NULL;
+			error("send_selector(): More than 0x800 arguments to function call");
 		}
 
 		// Check if a breakpoint is set on this method
@@ -574,8 +567,7 @@
 	const byte *code_buf = NULL; // (Avoid spurious warning)
 
 	if (!local_script) {
-		script_error(s, __FILE__, __LINE__, "Program Counter gone astray");
-		return;
+		error("run_vm(): program counter gone astray (local_script pointer is null)");
 	}
 
 	if (!restoring)
@@ -685,12 +677,12 @@
 
 #ifndef DISABLE_VALIDATIONS
 		if (xs->sp < xs->fp)
-			script_error(s, "[VM] "__FILE__, __LINE__, "Stack underflow");
+			error("run_vm(): stack underflow");
 
 		variables_max[VAR_TEMP] = xs->sp - xs->fp;
 
 		if (xs->addr.pc.offset >= code_buf_size)
-			script_error(s, "[VM] "__FILE__, __LINE__, "Program Counter gone astray");
+			error("run_vm(): program counter gone astray");
 #endif
 
 		opcode = GET_OP_BYTE(); // Get opcode
@@ -1103,7 +1095,7 @@
 			r_temp = get_class_address(s, opparams[0], SCRIPT_GET_LOAD, xs->addr.pc);
 
 			if (!r_temp.segment)
-				CORE_ERROR("VM", "Invalid superclass in object");
+				error("[VM]: Invalid superclass in object");
 			else {
 				s_temp = xs->sp;
 				xs->sp -= ((opparams[1] >> 1) + restadjust); // Adjust stack
@@ -1407,7 +1399,7 @@
 			break;
 
 		default:
-			script_error(s, __FILE__, __LINE__, "Illegal opcode");
+			error("run_vm(): illegal opcode %x", opnumber);
 
 		} // switch(opcode >> 1)
 
@@ -1506,9 +1498,8 @@
 		selector_id &= ~1;
 
 	if (!obj) {
-		CORE_ERROR("SLC-LU", "Attempt to send to non-object or invalid script");
-		sciprintf("Address was %04x:%04x\n", PRINT_REG(obj_location));
-		return kSelectorNone;
+		error("lookup_selector(): Attempt to send to non-object or invalid script. Address was %04x:%04x", 
+				PRINT_REG(obj_location));
 	}
 
 	if (IS_CLASS(obj))
@@ -1518,9 +1509,8 @@
 
 
 	if (!obj) {
-		CORE_ERROR("SLC-LU", "Error while looking up Species class");
-		sciprintf("Original address was %04x:%04x\n", PRINT_REG(obj_location));
-		sciprintf("Species address was %04x:%04x\n", PRINT_REG(obj->_variables[SCRIPT_SPECIES_SELECTOR]));
+		error("lookup_selector(): Error while looking up Species class.\nOriginal address was %04x:%04x. Species address was %04x:%04x\n", 
+			PRINT_REG(obj_location), PRINT_REG(obj->_variables[SCRIPT_SPECIES_SELECTOR]));
 		return kSelectorNone;
 	}
 
@@ -1560,31 +1550,24 @@
 	Script *script = NULL;
 
 #ifndef DISABLE_VALIDATIONS
-	if (!seg) {
-		CORE_ERROR("EXPORTS", "Script invalid or not loaded");
-		sciprintf("Script was script.%03d (0x%x)\n",
-		          script_nr, script_nr);
-		return NULL_REG;
-	}
+	if (!seg)
+		error("script_lookup_export(): script.%03d (0x%x) is invalid or not loaded",
+				script_nr, script_nr);
 #endif
 
 	script = script_locate_by_segment(s, seg);
 
 #ifndef DISABLE_VALIDATIONS
-	if (script
-	        && export_index < script->exports_nr
-	        && export_index >= 0)
+	if (script && export_index < script->exports_nr && export_index >= 0)
 #endif
 		return make_reg(seg, READ_LE_UINT16((byte *)(script->export_table + export_index)));
 #ifndef DISABLE_VALIDATIONS
 	else {
-		CORE_ERROR("EXPORTS", "Export invalid or script missing ");
 		if (!script)
-			sciprintf("(script.%03d missing)\n", script_nr);
+			error("script_lookup_export(): script.%03d missing", script_nr);
 		else
-			sciprintf("(script.%03d: Sought export %d/%d)\n",
-			          script_nr, export_index, script->exports_nr);
-		return NULL_REG;
+			error("script_lookup_export(): script.%03d: Sought invalid export %d/%d",
+			      script_nr, export_index, script->exports_nr);
 	}
 #endif
 }


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